Commit eb5e3bdb authored by litengwei's avatar litengwei

Merge remote-tracking branch 'origin/develop_dl_plan6_temp' into develop_dl_plan6_temp

parents d6685b17 6722d0cc
......@@ -65,6 +65,12 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
@Param("dutyDate") String dutyDate,
@Param("groupCode") String groupCode
);
List<Map<String, Object>> newStationViewDataByFieldCode(
@Param("dutyDate") String dutyDate,
@Param("groupCode") String groupCode,
@Param("fieldCode") String fieldCode
);
/**
* 利用mysql 生成连续时间区间
*
......
......@@ -32,12 +32,14 @@ public interface IDutyCommonService {
List<Map<String, Object>> statisticsDay(String beginDate, String endDate) throws ParseException;
/**
* 新值班月视图
*
* @param beginDate
* @param endDate
* @param dutyType
* @return
* @throws ParseException
*/
List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate) throws ParseException;
List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate, String fieldCode) throws ParseException;
/**
* 不分页查询
*
......
......@@ -102,6 +102,21 @@
and i.group_code =#{groupCode}
GROUP BY i.field_value
</select>
<select id="newStationViewDataByFieldCode" resultType="java.util.Map">
select
i.field_value as postTypeName,
count(1) as total
from
cb_duty_person_shift s,
cb_dynamic_form_instance i
where
s.instance_id = i.instance_id
and i.field_code = #{fieldCode}
AND s.duty_date = #{dutyDate}
AND s.shift_id is not null
and i.group_code =#{groupCode}
GROUP BY i.field_value
</select>
<select id="genRangeDate" resultType="map">
SELECT
DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date,
......
......@@ -61,7 +61,11 @@ public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentC
@TableField(exist=false)
@ApiModelProperty(value = "级别")
private String level;
@TableField(exist = false)
@ApiModelProperty(value = "个数-巡检树用")
private Integer patrolNum;
@TableField(exist=false)
@ApiModelProperty(value = "个数")
private Double count;
......
......@@ -103,9 +103,10 @@ public class DutyCarController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyCarService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyCarService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
* 调班
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.text.ParseException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -18,18 +17,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFireFightingService;
......@@ -102,9 +97,10 @@ public class DutyFireFightingController extends BaseController{
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFireFightingService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyFireFightingService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
* 调班
......
......@@ -89,9 +89,10 @@ public class DutyFirstAidController extends BaseController{
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFirstAidService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyFirstAidService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
* 调班
......
......@@ -103,9 +103,10 @@ public class DutyPersonController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyPersonService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyPersonService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
......
......@@ -230,7 +230,8 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
LocalDate startDate = LocalDate.parse(start);
LocalDate endDate = LocalDate.parse(end);
long distance = ChronoUnit.DAYS.between(startDate, endDate);
if (distance < 1) {
if (distance < 1 && StringUtils.isNotBlank(start)) {
list.add(start);
return list;
}
Stream.iterate(startDate, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> list.add(f.toString()));
......@@ -278,7 +279,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
/*bug2468 值班排班,日历视图单班次执勤人数满足≤3且班次≤2时,值班显示方式错误 陈召 结束*/
}
public List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate) throws ParseException {
public List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate, String fieldCode) throws ParseException {
Date dateBegin = DateUtils.dateParse(beginDate, DateUtils.DATE_PATTERN);
String timeStart = DateUtils.dateTimeToDateString(dateBegin);
......@@ -306,7 +307,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
result.put("key", objectMap.get("date"));
String dateString = objectMap.get("date").toString();
if(this.getGroupCode().equals("dutyPerson")) {
result.put("data", getPersonPostTypeNameAndCount(dateString));
result.put("data", getPersonPostTypeNameAndCount(dateString, fieldCode));
}else if(this.getGroupCode().equals("dutyCar")) {
result.put("data", getCarPostTypeNameAndCount(dateString));
}else if(this.getGroupCode().equals("dutyFireFighting")) {
......@@ -323,11 +324,16 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
/**
* 排班值班人员的统计类型为:
* 岗位: 岗位人员数量
* 岗位: 岗位人员数量
*
* @param dutyDate
* @param dutyType
* @return
*/
public Object getPersonPostTypeNameAndCount(String dutyDate) {
public Object getPersonPostTypeNameAndCount(String dutyDate, String fieldCode) {
if (StringUtils.isNotBlank(fieldCode)) {
return dutyPersonShiftService.getBaseMapper().newStationViewDataByFieldCode(dutyDate, this.getGroupCode(), fieldCode);
}
return dutyPersonShiftService.getBaseMapper().newStationViewData(dutyDate, this.getGroupCode());
}
/**
......
......@@ -7,12 +7,12 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.equipmanage.common.enums.SourceTypeEnum;
import com.yeejoin.equipmanage.common.utils.SpringUtils;
import com.yeejoin.equipmanage.mapper.EquipmentCategoryMapper;
import com.yeejoin.equipmanage.service.ISourceStatistics;
import com.yeejoin.equipmanage.service.impl.SourcesStatisticsImpl;
import org.apache.commons.lang3.StringUtils;
......@@ -88,6 +88,9 @@ public class EquipmentCategoryController extends AbstractBaseController {
@Value("${redis_equip_type_count}")
private String equipTypeAndCount;
@Autowired
private EquipmentCategoryMapper equipmentCategoryMapper;
private static final String equipmentTreeListAll = "equipmentTreeListAll";
private static final String equipmentTreeListIndustry = "equipmentTreeListIndustry";
// 装备redis缓存key前缀
......@@ -378,6 +381,152 @@ public class EquipmentCategoryController extends AbstractBaseController {
}
/**
* 消防设施分类定义树
*
* @return
*/
@RequestMapping(value = "/equipAndFireAllTree", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防设施分类定义树组合消防装备树", notes = "消防设施分类定义树组合消防装备树")
public ResponseModel<List<EquipmentCategory>> equipAndFireAllTree() {
Integer countAll = 0;
List<EquipmentCategory> result = new ArrayList<>();
List<EquipmentCategory> listFireCategories = listFirePrivate();
if (listFireCategories.size() == 2) {
countAll = listFireCategories.get(0).getPatrolNum() + listFireCategories.get(1).getPatrolNum();
}
List<EquipmentCategory> listEquipCategories = listEquipPrivate();
if (listEquipCategories.size() == 1) {
countAll = countAll + listEquipCategories.get(0).getPatrolNum();
}
List<EquipmentCategory> treeListByCustom = getTreeListByCustom();
if (treeListByCustom.size() == 2) {
countAll = countAll + treeListByCustom.get(0).getPatrolNum() + treeListByCustom.get(1).getPatrolNum();
}
listFireCategories.addAll(listEquipCategories);
listFireCategories.addAll(treeListByCustom);
EquipmentCategory equipmentCategory = new EquipmentCategory();
equipmentCategory.setChildren(listFireCategories);
equipmentCategory.setCode("-3");
equipmentCategory.setName("全部类型" + "(" + countAll + ")");
equipmentCategory.setId(-3L);
equipmentCategory.setHasLowerClassification(true);
result.add(equipmentCategory);
return CommonResponseUtil.success(result);
}
/**
* 自定义和重点部位组装
* @return
*/
private List<EquipmentCategory> getTreeListByCustom() {
List<EquipmentCategory> result = new ArrayList<>();
EquipmentCategory equipmentCategory = new EquipmentCategory();
int keyPartsTypeCount = equipmentCategoryMapper.countByKeyPartsType();
equipmentCategory.setCode("-4");
equipmentCategory.setName("重点部位" + "(" + keyPartsTypeCount + ")");
equipmentCategory.setPatrolNum(keyPartsTypeCount);
equipmentCategory.setId(-4L);
equipmentCategory.setParentId(-3L);
equipmentCategory.setHasLowerClassification(false);
result.add(equipmentCategory);
EquipmentCategory equipmentCategory2 = new EquipmentCategory();
int customTypeCount = equipmentCategoryMapper.countByCustomType();
equipmentCategory2.setCode("-5");
equipmentCategory2.setName("自定义巡查点" + "(" + customTypeCount + ")");
equipmentCategory2.setPatrolNum(customTypeCount);
equipmentCategory2.setId(-5L);
equipmentCategory2.setParentId(-3L);
equipmentCategory2.setHasLowerClassification(false);
result.add(equipmentCategory2);
return result;
}
private List<EquipmentCategory> listFirePrivate() {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryListByFacilities(Integer.valueOf(equipmentCategoryLeftTypeCode));
List<EquipmentCategory> list = new ArrayList<>();
List<EquipmentCategory> result = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
final Integer[] countAll = {0};
equipmentCategorys.forEach(action -> {
String beginName = action.getName();
String subCode = action.getCode().replaceAll("0+$", "");
int count = equipmentCategoryMapper.countByCategoryCode(subCode);
action.setName(action.getName() + "(" + count + ")");
countAll[0] = count + countAll[0];
if (beginName.equals("消防设施") || beginName.equals("消防系统")) {
action.setPatrolNum(count);
action.setParentId(-1L);
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
ArrayList<EquipmentCategory> tmplist = new ArrayList<EquipmentCategory>();
tmplist.add(action);
tmpMap.put(action.getParentId().toString(), tmplist);
} else {
if (!tmpMap.get(action.getParentId().toString()).contains(action)) {
tmpMap.get(action.getParentId().toString()).add(action);
}
}
}
});
getChildren(list, tmpMap);
EquipmentCategory equipmentCategory = new EquipmentCategory();
equipmentCategory.setChildren(list);
equipmentCategory.setCode("-1");
equipmentCategory.setName("消防设施(" + countAll[0] + ")");
equipmentCategory.setPatrolNum(countAll[0]);
equipmentCategory.setId(-1L);
equipmentCategory.setHasLowerClassification(true);
equipmentCategory.setParentId(-3L);
result.add(equipmentCategory);
return result;
}
private List<EquipmentCategory> listEquipPrivate() {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryListNotFacilities(Integer.valueOf(equipmentCategoryLeftTypeCode));
List<EquipmentCategory> list = new ArrayList<>();
List<EquipmentCategory> result = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
final Integer[] countAll = {0};
equipmentCategorys.forEach(action -> {
String subCode = action.getCode().replaceAll("0+$", "");
int count = equipmentCategoryMapper.countByCategoryCode(subCode);
countAll[0] = countAll[0] + count;
action.setName(action.getName() + "(" + count + ")");
if (action.getParentId() == null) {
action.setPatrolNum(count);
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
ArrayList<EquipmentCategory> tmplist = new ArrayList<EquipmentCategory>();
tmplist.add(action);
tmpMap.put(action.getParentId().toString(), tmplist);
} else {
if (!tmpMap.get(action.getParentId().toString()).contains(action)) {
tmpMap.get(action.getParentId().toString()).add(action);
}
}
}
});
getChildren(list, tmpMap);
EquipmentCategory equipmentCategory = new EquipmentCategory();
equipmentCategory.setChildren(list);
equipmentCategory.setCode("-2");
equipmentCategory.setName("消防装备(" + countAll[0] + ")");
equipmentCategory.setId(-2L);
equipmentCategory.setPatrolNum(countAll[0]);
equipmentCategory.setHasLowerClassification(true);
equipmentCategory.setParentId(-3L);
result.add(equipmentCategory);
return result;
}
/**
*
* 获取子节点
**/
......
......@@ -57,6 +57,22 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head);
int countByCategoryCode(@Param("code") String code);
/**
* 重点部位数量
* @return
*/
int countByKeyPartsType();
/**
* 自定义数量
* @return
*/
int countByCustomType();
List<EquipmentCategory> getEquipmentCategoryCarList();
List<EquipmentCategory> getEquipmentCategoryEquipmentList();
......
......@@ -418,56 +418,56 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
queryWrapper.ne(EquipmentSpecificAlarmLog::getStatus, AlarmStatusEnum.HF.getCode());
List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getBaseMapper()
.selectList(queryWrapper);
EquipmentSpecificAlarmLog log = logs.get(0);
String cleanType = equipmentSpecificMapper.getEquipmentBySpecificId(log.getEquipmentSpecificId());
EquipmentSpecific specific = equipmentSpecificMapper.selectById(log.getEquipmentSpecificId());
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
logs.forEach(x -> {
x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode());
x.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value);
if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId);
}
// 自动确警处理
if (StringUtil.isNotEmpty(cleanType) && AlarmCleanTypeEnum.ZDXC.getCode().equals(cleanType)){
x.setConfirmType(x.getType());
x.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(x.getType()));
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName();
if (x.getType().equals(AlarmTypeEnum.PB.getCode())) {
x.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。");
} else {
x.setAlarmReason(equipmentName + "引起设备报警");
if (0 < logs.size()) {
EquipmentSpecificAlarmLog log = logs.get(0);
String cleanType = equipmentSpecificMapper.getEquipmentBySpecificId(log.getEquipmentSpecificId());
EquipmentSpecific specific = equipmentSpecificMapper.selectById(log.getEquipmentSpecificId());
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
logs.forEach(x -> {
x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode());
x.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value);
if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId);
}
x.setResolveResult(dateString + "系统收到设备复归(已消除)信号,系统自动处理。");
x.setConfirmUser("");
x.setConfirmUserName("系统自动处理");
x.setConfirmDate(date);
}
});
if (jcsSwitch && AlarmTypeEnum.HZGJ.getCode().equals(log.getType())) {
Token token = remoteSecurityService.getServerToken();
String toke = token.getToke();
String appKey = token.getAppKey();
String product = token.getProduct();
String userId = remoteSecurityService.getAgencyUser().getUserId();
// 确警消息发送
if (org.apache.commons.lang3.StringUtils.isNotBlank(userId)) {
new Thread(new Runnable() {
@Override
public void run() {
try {
ConfirmAlarmServiceImpl.sendIotSystemAlarm(log, userId, appKey, product, toke);
} catch (Exception e) {
e.printStackTrace();
}
// 自动确警处理
if (StringUtil.isNotEmpty(cleanType) && AlarmCleanTypeEnum.ZDXC.getCode().equals(cleanType)){
x.setConfirmType(x.getType());
x.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(x.getType()));
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName();
if (x.getType().equals(AlarmTypeEnum.PB.getCode())) {
x.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。");
} else {
x.setAlarmReason(equipmentName + "引起设备报警");
}
}).start();
x.setResolveResult(dateString + "系统收到设备复归(已消除)信号,系统自动处理。");
x.setConfirmUser("");
x.setConfirmUserName("系统自动处理");
x.setConfirmDate(date);
}
});
if (jcsSwitch && AlarmTypeEnum.HZGJ.getCode().equals(log.getType())) {
Token token = remoteSecurityService.getServerToken();
String toke = token.getToke();
String appKey = token.getAppKey();
String product = token.getProduct();
String userId = remoteSecurityService.getAgencyUser().getUserId();
// 确警消息发送
if (org.apache.commons.lang3.StringUtils.isNotBlank(userId)) {
new Thread(new Runnable() {
@Override
public void run() {
try {
ConfirmAlarmServiceImpl.sendIotSystemAlarm(log, userId, appKey, product, toke);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
}
if (!logs.isEmpty()) {
equipmentSpecificAlarmLogService.updateBatchById(logs);
}
if (flag) {
......
......@@ -4,13 +4,18 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.patrol.business.dao.mapper.InputItemMapper;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -67,6 +72,11 @@ public class InputItemController extends AbstractBaseController {
IInputItemDao inputItemDao;
@Autowired
JcsFeignClient jcsFeignClient;
@Autowired
InputItemMapper inputItemMapper;
@Value("${equipment.hierarchy}")
private String hierarchy;
/**
......@@ -78,7 +88,40 @@ public class InputItemController extends AbstractBaseController {
@RequestMapping(value = "/queryItemByPageNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryItemByPageNew(
@ApiParam(value = "组合查询条件", required = false, defaultValue = "[]") @RequestBody(required = false) InputItemPageParam criterias,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable,
@ApiParam(value = "树code")@RequestParam(required = false) String treeId) {
int inhierarchy = 1;
String subCode = "";
if (StringUtil.isNotEmpty(treeId) && Long.parseLong(treeId) > 0) {
String[] result = hierarchy.split(",");
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < result.length; i++) {
map.put(i, Integer.valueOf(result[i]));
}
Map<String, String> equipmentCategory = inputItemMapper.getCategoryByCode(treeId, "2");
if (equipmentCategory == null) {
throw new RuntimeException("装备定义code有误");
}
for (int i = 0; i < result.length + 1; i++) {
//进来先判断是否默认就是空,如果为空第一层
if (!StringUtil.isNotEmpty(equipmentCategory.get("parentId"))) {
//判断是否是最下面的子节点
if (i >= 4) {
inhierarchy = 8;
} else {
inhierarchy = map.get(i);
}
break;
} else {
//查找到循环几次为空
equipmentCategory = inputItemMapper.getCategoryById(equipmentCategory.get("parentId"));
}
}
subCode = treeId.substring(0, inhierarchy);
}
ReginParams reginParams = getSelectedOrgInfo();
//查询向上查询所属单位的bizOrgCode
String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
......@@ -87,9 +130,38 @@ public class InputItemController extends AbstractBaseController {
criterias.setPageNumber(pageable.getPageNumber()-1);
criterias.setPageSize(pageable.getPageSize());
}
criterias.setTreeId(treeId);
criterias.setInhierarchy(inhierarchy);
criterias.setSubCode(subCode);
Page<InputItemVo> page = inputItemService.queryInputItemByPageNew(criterias);
List<Map<String, String>> allCategoryNameList = inputItemMapper.getAllCategoryName();
Map<String, String> resultMap = new HashMap<>();
for (Map<String, String> map : allCategoryNameList) {
resultMap.put(map.get("code"), map.get("name"));
}
for (InputItemVo inputItemVo : page.getContent()) {
String finalTypeName = "";
finalTypeName = StringUtils.isNotEmpty(inputItemVo.getCustomType())? "自定义巡检点" : "";
String keyPartsTypeName = StringUtils.isNotEmpty(inputItemVo.getKeyPartsType())? "重点部位类型" : "";
if (StringUtils.isNotEmpty(finalTypeName) && StringUtils.isNotEmpty(keyPartsTypeName)) {
finalTypeName = finalTypeName + "," + keyPartsTypeName;
} else if (!StringUtils.isNotEmpty(finalTypeName) && StringUtils.isNotEmpty(keyPartsTypeName)) {
finalTypeName = keyPartsTypeName;
}
String equipmentTypeName = StringUtils.isNotEmpty(inputItemVo.getEquipmentType())? resultMap.get(inputItemVo.getEquipmentType()) : "";
if (StringUtils.isNotEmpty(finalTypeName) && StringUtils.isNotEmpty(equipmentTypeName)) {
finalTypeName = finalTypeName + "," + equipmentTypeName;
} else if (!StringUtils.isNotEmpty(finalTypeName) && StringUtils.isNotEmpty(equipmentTypeName)) {
finalTypeName = equipmentTypeName;
}
String facilitiesTypeName = StringUtils.isNotEmpty(inputItemVo.getFacilitiesType())? resultMap.get(inputItemVo.getFacilitiesType()) : "";
if (StringUtils.isNotEmpty(finalTypeName) && StringUtils.isNotEmpty(facilitiesTypeName)) {
finalTypeName = finalTypeName + "," + facilitiesTypeName;
} else if (!StringUtils.isNotEmpty(finalTypeName) && StringUtils.isNotEmpty(facilitiesTypeName)) {
finalTypeName = facilitiesTypeName;
}
inputItemVo.setTypeName(finalTypeName);
}
return CommonResponseUtil.success(page);
}
......@@ -471,8 +543,9 @@ public class InputItemController extends AbstractBaseController {
if (param.getEquipmentType() == null && param.getCustomType() == null&&param.getFacilitiesType() == null&&param.getKeyPartsType() == null){
throw new BadRequest("适用类型至少需选择一项");
}
//如果为1则为否,顺应机场逻辑
param.setCustomType("1".equals(param.getCustomType()) ? null : param.getCustomType());
param.setKeyPartsType("1".equals(param.getKeyPartsType()) ? null : param.getKeyPartsType());
AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) {
return CommonResponseUtil.failure("用户session过期");
......
......@@ -22,8 +22,16 @@ public interface InputItemMapper extends BaseMapper {
* */
public long countInputItemInfoDataNew(InputItemPageParam param);
Map<String, String> getCategoryByCode(@Param("code") String code, @Param("industryCode") String industryCode);
Map<String, String> getCategoryById(@Param("id") String id);
List<Map<String, String>> getAllCategoryName();
public List<InputItemVo> getInputItemInfoNew(InputItemPageParam param);
Map<Long, Long> getAllCountInfo();
Map<String,String> getEquipParentCode(String code);
Map<String,String> getSystemParentCode(String id);
......
......@@ -23,6 +23,37 @@ public class InputItemPageParam extends CommonPageable{
private String itemType;
private List<Long> catalogIds;
private Integer inhierarchy;
private String subCode;
public Integer getInhierarchy() {
return inhierarchy;
}
public void setInhierarchy(Integer inhierarchy) {
this.inhierarchy = inhierarchy;
}
public String getSubCode() {
return subCode;
}
public void setSubCode(String subCode) {
this.subCode = subCode;
}
//查询页面左侧树ID
private String treeId;
public String getTreeId() {
return treeId;
}
public void setTreeId(String treeId) {
this.treeId = treeId;
}
public String getBizOrgCode() {
return bizOrgCode;
}
......
......@@ -9,6 +9,8 @@ public class InputItemVo {
private long catalogId;
private String catalogName;
private String typeName;
/**
* 创建者
......@@ -103,6 +105,54 @@ public class InputItemVo {
//单位名称
private String bizOrgName;
private String keyPartsType;
private String customType;
private String facilitiesType;
private String equipmentType;
public String getFacilitiesType() {
return facilitiesType;
}
public void setFacilitiesType(String facilitiesType) {
this.facilitiesType = facilitiesType;
}
public String getEquipmentType() {
return equipmentType;
}
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
public String getKeyPartsType() {
return keyPartsType;
}
public void setKeyPartsType(String keyPartsType) {
this.keyPartsType = keyPartsType;
}
public String getCustomType() {
return customType;
}
public void setCustomType(String customType) {
this.customType = customType;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getBizOrgCode() {
return bizOrgCode;
}
......
......@@ -344,7 +344,7 @@
UNION ALL
SELECT ec.id,
ec.parent_id,
ec.id as CODE,
ec.code as CODE,
ec.NAME,
ec.is_consumptive,
ec.description,
......@@ -357,7 +357,8 @@
FROM wl_equipment_category ec
left join wl_industry i on ec.industry_code = i.code
WHERE
(ec.code LIKE CONCAT ('92','%') and ec.parent_id = '1302863809086623746') or (ec.code LIKE CONCAT ('92','%') and ec.parent_id = '846')
<!-- (ec.code LIKE CONCAT ('92','%') and ec.parent_id = '1302863809086623746') or (ec.code LIKE CONCAT ('92','%') and ec.parent_id = '846')-->
ec.code like CONCAT ('92', '%')
</select>
......@@ -498,4 +499,19 @@
AND wl_equipment_category.industry_code = #{industryCode}
</if>
</select>
<select id="countByCategoryCode" resultType="int">
select count(*) from p_input_item
where equipment_type like concat(#{code}, '%') or facilities_type like concat(#{code}, '%')
</select>
<select id="countByKeyPartsType" resultType="int">
select count(*) from p_input_item
where key_parts_type is not null
</select>
<select id="countByCustomType" resultType="int">
select count(*) from p_input_item
where custom_type is not null
</select>
</mapper>
......@@ -59,3 +59,5 @@ jcs.fegin.name=JCS
emergency.command.section.id=1418223840361709569
management.endpoints.enabled-by-default=false
equipment.hierarchy=1,2,4,6
\ No newline at end of file
......@@ -60,6 +60,10 @@
<result property="riskDesc" column="risk_desc" />
<result property="bizOrgName" column="biz_org_name" />
<result property="bizOrgCode" column="biz_org_code" />
<result property="keyPartsType" column="key_parts_type" />
<result property="customType" column="custom_type" />
<result property="facilitiesType" column="facilities_type" />
<result property="equipmentType" column="equipment_type" />
</resultMap>
<!--统计 -->
<select id="countInputItemInfoData" resultType="long">
......@@ -269,6 +273,21 @@
<if test="bizOrgCode!=null and bizOrgCode!=''">
and a.biz_org_code LIKE CONCAT (#{bizOrgCode} ,'%')
</if>
<if test="treeId != null and treeId != '' and treeId == -1">
and a.facilities_type is not null
</if>
<if test="treeId != null and treeId != '' and treeId == -2">
and a.equipment_type is not null
</if>
<if test="treeId != null and treeId != '' and treeId == -4">
and a.key_parts_type is not null
</if>
<if test="treeId != null and treeId != '' and treeId == -5">
and a.custom_type is not null
</if>
<if test="subCode!=null and subCode!='' and subCode!=' ' and treeId != null and treeId != '' and treeId != -3 and treeId != -1 and treeId != -2 and treeId != -4 and treeId != -5">
and ((LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}) or (LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}))
</if>
<choose>
<when test="level == '-0' ">and a.level is null</when>
<when test="level!=null and level != '-0'">and a.level = #{level}</when>
......@@ -276,6 +295,14 @@
order by a.id desc
</select>
<select id="getCategoryByCode" resultType="java.util.Map">
select ifnull(parent_id, '') as parentId from wl_equipment_category where code = #{code} and industry_code = #{industryCode}
</select>
<select id="getCategoryById" resultType="java.util.Map">
select ifnull(parent_id, '') as parentId from wl_equipment_category where id = #{id}
</select>
<select id="getInputItemInfoNew" resultMap="inputItemMap">
SELECT
a.id,
......@@ -299,7 +326,10 @@
ELSE
'5级'
END )AS level,
key_parts_type,
custom_type,
equipment_type,
facilities_type,
a.risk_desc
from
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
......@@ -316,6 +346,21 @@
<if test="bizOrgCode!=null and bizOrgCode!=''">
and a.biz_org_code LIKE CONCAT (#{bizOrgCode},'%')
</if>
<if test="treeId != null and treeId != '' and treeId == -1">
and a.facilities_type is not null
</if>
<if test="treeId != null and treeId != '' and treeId == -2">
and a.equipment_type is not null
</if>
<if test="treeId != null and treeId != '' and treeId == -4">
and a.key_parts_type is not null
</if>
<if test="treeId != null and treeId != '' and treeId == -5">
and a.custom_type is not null
</if>
<if test="subCode!=null and subCode!='' and subCode!=' ' and treeId != null and treeId != '' and treeId != -3 and treeId != -1 and treeId != -2 and treeId != -4 and treeId != -5">
and ((LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}) or (LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}))
</if>
<choose>
<when test="level == '-0' ">and a.level is null</when>
<when test="level!=null and level != '-0'">and a.level = #{level}</when>
......@@ -339,7 +384,43 @@
select * from wl_equipment_category where id = #{parentId}
</select>
<select id="getAllCountInfo" resultType="java.util.Map">
SELECT
IF
( equipment_type = - 1, - 2, equipment_type ) AS myId,
count( equipment_type ) AS count
FROM
p_input_item
WHERE
equipment_type IS NOT NULL
GROUP BY
equipment_type UNION ALL
SELECT
facilities_type AS myId,
count( facilities_type ) AS count
FROM
p_input_item
WHERE
facilities_type IS NOT NULL
GROUP BY
facilities_type UNION ALL
SELECT
- 5 AS myId,
count(*) AS count
FROM
p_input_item
WHERE
custom_type IS NOT NULL UNION ALL
SELECT
- 4 AS myId,
count(*) AS count
FROM
p_input_item
WHERE
key_parts_type IS NOT NULL
</select>
<select id="getAllCategoryName" resultType="java.util.Map">
select code, `name` from wl_equipment_category
</select>
</mapper>
\ No newline at end of file
......@@ -333,7 +333,7 @@
ELSE
'移动点'
END) fixed,
p.charge_person_id userName,
p.charge_person_name userName,
p.charge_dept_id depid,
IFNULL(p.risk_source_id, '') as buildingId,
p.remark,
......
package com.yeejoin.amos.boot.module.tdc.api.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class CheckModelDto {
private static final long serialVersionUID = 1L;
@TableId(value = "sequence_nbr", type = IdType.ID_WORKER)
protected Long sequenceNbr;
@ApiModelProperty(value = "模型名称")
private String modelName;
@ApiModelProperty(value = "机构code")
private String amosOrgCode;
@ApiModelProperty(value = "机构名称")
private String amosOrgName;
@ApiModelProperty(value = "指标表名")
private String idxTableName;
@ApiModelProperty(value = "校验状态")
private int checkStatus;
@ApiModelProperty(value = "校验时间")
private Date checkDate;
@ApiModelProperty(value = "模型图片地址")
private String modelPictureUrl;
@ApiModelProperty(value = "模型规则知识包")
private String modelRule;
@ApiModelProperty(value = "指标模型所属项目id")
private String projectId;
@ApiModelProperty(value = "指标模型表id")
private String tableId;
@ApiModelProperty(value = "模型校验项数量")
private int checkItemAmount;
private String circle;
}
......@@ -58,5 +58,4 @@ public class CheckModel {
@ApiModelProperty(value = "模型校验项数量")
private int checkItemAmount;
}
package com.yeejoin.amos.boot.module.tdc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import org.mapstruct.Mapper;
......@@ -10,4 +13,6 @@ import org.mapstruct.Mapper;
*/
@Mapper
public interface CheckModelMapper extends BaseMapper<CheckModel> {
IPage<CheckModelDto> selectByOrgCode(Page page, String amosOrgCode);
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tdc.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import org.springframework.stereotype.Service;
......@@ -19,7 +20,7 @@ public interface CheckModelService extends IService<CheckModel> {
* @return 模型list
*/
// List<CheckModel> selectByOrgCode(String amosOrgCode);
IPage<CheckModel> selectByOrgCode(int current, int size, String amosOrgCode);
IPage<CheckModelDto> selectByOrgCode(int current, int size, String amosOrgCode);
List<CheckModel> selectByOrgCode(String amosOrgCode);
......
......@@ -2,4 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.CheckModelMapper">
<select id="selectByOrgCode" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto">
select `*`,'●' as circle from tdc_model
<where>
<if test = "amosOrgCode != null and amosOrgCode != ''">
and amosOrgCode=#{amosOrgCode}
</if>
</where>
</select>
</mapper>
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.CheckResultMapper">
<select id="selectResult" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto">
select check_date, case when check_type="1" then '全站校验' else `model_name` end as `name`
select check_date, case when check_type="0" then '全站校验' else `model_name` end as `name`
from `tdc_check_result`
<where>
<if test="code != '' and code != null">
......
package com.yeejoin.amos.boot.module.tdc.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckModelService;
import io.swagger.annotations.Api;
......@@ -32,7 +33,7 @@ public class CheckModelController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "selectByOrgCode")
@ApiOperation(httpMethod = "GET",value = "根据amosOrgCode查询模型列表", notes = "根据amosOrgCode查询模型列表")
public ResponseModel<IPage<CheckModel>> selectByOrgCode(int current, int size, String amosOrgCode) {
public ResponseModel<IPage<CheckModelDto>> selectByOrgCode(int current, int size, String amosOrgCode) {
return ResponseHelper.buildResponse(checkModelService.selectByOrgCode(current,size,amosOrgCode));
}
......
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
......@@ -39,27 +40,23 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
CheckResultMapper checkResultMapper;
@Autowired
CheckModelMapper checkModelMapper;
@Autowired
IdxFeignService idxFeignService;
@Autowired
RuleTrigger ruleTrigger;
@Override
public IPage<CheckModel> selectByOrgCode(int current, int size, String amosOrgCode) {
public IPage<CheckModelDto> selectByOrgCode(int current, int size, String amosOrgCode) {
Page page = new Page(current,size);
if(ValidationUtil.isEmpty(amosOrgCode)){
return this.page(page);
}else{
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CheckModel::getAmosOrgCode, amosOrgCode);
// return baseMapper.selectList(wrapper);
return this.page(page,wrapper);
}
return checkModelMapper.selectByOrgCode(page,amosOrgCode);
}
@Override
public List<CheckModel> selectByOrgCode(String amosOrgCode) {
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
......@@ -67,6 +64,8 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
return baseMapper.selectList(wrapper);
}
@Override
public CheckModel selectOneByDate(String amosOrgCode) {
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment