Commit 6613eea8 authored by Lambertliu's avatar Lambertliu

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

parents c94cf27f 92c963d6
...@@ -117,4 +117,9 @@ public class TzsUserInfo extends BaseEntity { ...@@ -117,4 +117,9 @@ public class TzsUserInfo extends BaseEntity {
*/ */
@TableField("amos_user_id") @TableField("amos_user_id")
private String amosUserId; private String amosUserId;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
} }
...@@ -117,4 +117,9 @@ public class TzsUserInfo extends BaseEntity { ...@@ -117,4 +117,9 @@ public class TzsUserInfo extends BaseEntity {
*/ */
@TableField("amos_user_id") @TableField("amos_user_id")
private String amosUserId; private String amosUserId;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
} }
...@@ -117,4 +117,9 @@ public class TzsUserInfo extends BaseEntity { ...@@ -117,4 +117,9 @@ public class TzsUserInfo extends BaseEntity {
*/ */
@TableField("amos_user_id") @TableField("amos_user_id")
private String amosUserId; private String amosUserId;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
} }
...@@ -17,7 +17,8 @@ public enum SafetyProblemTypeEnum { ...@@ -17,7 +17,8 @@ public enum SafetyProblemTypeEnum {
JYBJ("21", "检验报检", "设备报检", "safetyProblemTracing/jy/bj", null), JYBJ("21", "检验报检", "设备报检", "safetyProblemTracing/jy/bj", null),
WBCQ("1", "维保超期", "设备维保超期", "safetyProblemTracing/wb/cq", "outOfMaintenanceRecords"), WBCQ("1", "维保超期", "设备维保超期", "safetyProblemTracing/wb/cq", "outOfMaintenanceRecords"),
WBBA("11", "维保合同备案", "设备维保合同备案", "safetyProblemTracing/wb/ba", null), WBBA("11", "维保合同备案", "设备维保合同备案", "safetyProblemTracing/wb/ba", null),
XKCQ("3", "许可超期", "企业许可超期", "safetyProblemTracing/xk/cq", null); XKCQ("3", "许可超期", "企业许可超期", "safetyProblemTracing/xk/cq", null),
ZZCQ("4", "人员资质超期", "人员资质超期", "safetyProblemTracing/zz/cq", null);
private final String code; private final String code;
......
...@@ -146,7 +146,10 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> { ...@@ -146,7 +146,10 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
* 查询许可超期的企业 * 查询许可超期的企业
* */ * */
List<Map<String, Object>> queryOutOfQualificationRecord(); List<Map<String, Object>> queryOutOfQualificationRecord();
/**
* 查询资质超期的证书
**/
List<Map<String, Object>> queryOutOfCertificationRecord();
/** /**
* 大屏业务全过程统计已经完成的单据 * 大屏业务全过程统计已经完成的单据
* *
...@@ -233,5 +236,7 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> { ...@@ -233,5 +236,7 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
void updateEnterpriseSafetyStatus(@Param("useUnitCodeList") Set<String> useUnitCodeList); void updateEnterpriseSafetyStatus(@Param("useUnitCodeList") Set<String> useUnitCodeList);
List<EquipmentClassifyDto> getEquClassifyByCode(@Param("parentCode") String parentCode); List<EquipmentClassifyDto> getEquClassifyByCode(@Param("parentCode") String parentCode);
} }
...@@ -34,4 +34,6 @@ public interface SafetyProblemTracingMapper extends BaseMapper<SafetyProblemTrac ...@@ -34,4 +34,6 @@ public interface SafetyProblemTracingMapper extends BaseMapper<SafetyProblemTrac
List<Map<String, Object>> countEquOverdue(@Param("typeList") List<String> typeList,@Param("orgCode") String orgCode); List<Map<String, Object>> countEquOverdue(@Param("typeList") List<String> typeList,@Param("orgCode") String orgCode);
List<String> getSourceId(@Param("orgCode") String orgCode, @Param("typeList") List<String> typeList); List<String> getSourceId(@Param("orgCode") String orgCode, @Param("typeList") List<String> typeList);
Page<Map<String, Object>> queryUserListProblemById(Page<Map<String, Object>> page, String problemId);
} }
...@@ -2618,4 +2618,24 @@ ...@@ -2618,4 +2618,24 @@
) )
SELECT * FROM category_tree ORDER BY level; SELECT * FROM category_tree ORDER BY level;
</select> </select>
<select id="queryOutOfCertificationRecord" resultType="java.util.Map">
SELECT
ei.use_unit_code useUnitCode,
ei.use_unit useUnit,
ei.unit_type unitType,
ei.supervise_org_code superviseOrgCode,
ei.supervise_org_name superviseOrgName,
tup.sequence_nbr permissionSeq,
tup.cert_no certNo,
tup.expiry_date expiryDate,
tui.name userName,
tui.sequence_nbr userSeq
FROM
tzs_user_permission tup
LEFT JOIN tzs_user_info tui ON tup.user_seq = tui.sequence_nbr
LEFT JOIN tz_base_enterprise_info ei ON ei.use_unit_code = tui.unit_code
WHERE
tup.expiry_date <![CDATA[<]]> CURRENT_DATE AND tup.permission_post IN ('permissionData66151', 'permissionData66152', 'permissionData6552');
</select>
</mapper> </mapper>
...@@ -102,6 +102,27 @@ ...@@ -102,6 +102,27 @@
<select id="queryPrincipalUnitByProblemId" resultType="java.util.Map"> <select id="queryPrincipalUnitByProblemId" resultType="java.util.Map">
SELECT * FROM ( SELECT * FROM (
SELECT SELECT
'1' sourceTypeCode,
spt.sequence_nbr problemSeq,
ei.sequence_nbr sequenceNbr,
ei.use_unit unitName,
ei.use_unit_code useUnitCode,
ei.unit_type unitType,
ei.governing_body governingBody,
ei.use_contact useContact,
ei.contact_phone contactPhone,
ei.status,
case when ei.status = '0' then '异常'
else '正常' end problemStatusName,
case when ei.status = '0' then 'red'
else 'green' end problemStatusColor
FROM
tzs_safety_problem_tracing spt
LEFT JOIN tz_base_enterprise_info ei on ei.use_unit_code = spt.principal_unit_code
WHERE
spt.sequence_nbr = #{problemId}
UNION
SELECT
'2' sourceTypeCode, '2' sourceTypeCode,
spt.sequence_nbr problemSeq, spt.sequence_nbr problemSeq,
ei.sequence_nbr sequenceNbr, ei.sequence_nbr sequenceNbr,
...@@ -240,4 +261,23 @@ ...@@ -240,4 +261,23 @@
and source_type_code = '3' and source_type_code = '3'
</select> </select>
<select id="queryUserListProblemById" resultType="java.util.Map">
SELECT
tui.sequence_nbr sequenceNbr,
tui.name,
tui.certificate_num certificateNum,
tui.phone,
tui.post_name postName,
case when tui.qr_code_state = '0' then '异常'
else '正常' end problemStatusName,
case when tui.qr_code_state = '0' then 'red'
else 'green' end problemStatusColor
FROM
tzs_user_info tui
LEFT JOIN tzs_user_permission tup on tup.user_seq = tui.sequence_nbr
LEFT JOIN tzs_safety_problem_tracing tspt on tspt.source_id = tup.sequence_nbr
WHERE
tspt.is_delete = '0' and tspt.sequence_nbr = #{problemId}
</select>
</mapper> </mapper>
...@@ -181,6 +181,22 @@ public class SafetyProblemTracingController extends BaseController { ...@@ -181,6 +181,22 @@ public class SafetyProblemTracingController extends BaseController {
} }
/** /**
* 根据问题ID及问题类型查询关联设备列表
*
* @param problemId 问题Id
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "根据问题ID及问题类型查询关联人员列表", notes = "根据问题ID及问题类型查询关联人员列表")
@GetMapping(value = "/user/list")
public ResponseModel<Page<Map<String, Object>>> queryUserListProblemById(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size, @RequestParam(value = "sequenceNbr") String problemId) {
Page<Map<String, Object>> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(safetyProblemTracingServiceImpl.queryUserListProblemById(page, problemId));
}
/**
* 根据问题ID及问题类型查询关联企业 * 根据问题ID及问题类型查询关联企业
* *
* @param problemId 问题Id * @param problemId 问题Id
......
...@@ -30,6 +30,8 @@ public class SafetyProblemEventHandlerFactory { ...@@ -30,6 +30,8 @@ public class SafetyProblemEventHandlerFactory {
return new JYBJEventHandler(safetyProblemTracingService, idxBizJgOtherInfoService, esEquipmentCategory); return new JYBJEventHandler(safetyProblemTracingService, idxBizJgOtherInfoService, esEquipmentCategory);
} else if (topic.startsWith(SafetyProblemTypeEnum.XKCQ.getTopic())) { } else if (topic.startsWith(SafetyProblemTypeEnum.XKCQ.getTopic())) {
return new XKCQEventHandler(safetyProblemTracingService); return new XKCQEventHandler(safetyProblemTracingService);
}else if (topic.startsWith(SafetyProblemTypeEnum.ZZCQ.getTopic())) {
return new ZZCQEventHandler(safetyProblemTracingService);
} else { } else {
// 其他策略类的创建 // 其他策略类的创建
throw new IllegalArgumentException("Unsupported topic: " + topic); throw new IllegalArgumentException("Unsupported topic: " + topic);
......
package com.yeejoin.amos.boot.module.jg.biz.handler;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent;
import com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler;
import com.yeejoin.amos.boot.module.jg.biz.listener.SafetyProblemTopicMessage;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.SafetyProblemTracingServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* ZZCQEventHandler 类实现了 SafetyProblemEventHandler 接口,
* 用于处理人员资质超期安全问题事件。
*/
@Component
public class ZZCQEventHandler implements SafetyProblemEventHandler {
SafetyProblemTracingServiceImpl safetyProblemTracingService;
@Autowired
public ZZCQEventHandler(SafetyProblemTracingServiceImpl safetyProblemTracingService) {
this.safetyProblemTracingService = safetyProblemTracingService;
}
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数用于描述发生的安全问题事件。
*/
@Override
public void handle(SafetyProblemEvent event) {
// 此处为处理安全问题事件的逻辑代码
JSONArray jsonArray = JSONObject.parseArray(event.getMessage().toString());
generateProblem(jsonArray);
}
private void generateProblem(JSONArray jsonArray) {
SafetyProblemTopicMessage.generatePersonnelProblem(jsonArray, SafetyProblemTypeEnum.ZZCQ, safetyProblemTracingService);
}
}
...@@ -186,6 +186,42 @@ public class SafetyProblemTopicMessage extends EmqxListener { ...@@ -186,6 +186,42 @@ public class SafetyProblemTopicMessage extends EmqxListener {
.eq("problem_status_code", SafetyProblemStatusEnum.UNHANDLED.getCode()));} .eq("problem_status_code", SafetyProblemStatusEnum.UNHANDLED.getCode()));}
} }
public static void generatePersonnelProblem(JSONArray jsonArray, SafetyProblemTypeEnum problemTypeEnum, SafetyProblemTracingServiceImpl safetyProblemTracingService) {
if (jsonArray == null || problemTypeEnum == null) {
throw new IllegalArgumentException("jsonObject and problemTypeEnum must not be null.");
}
if (!ValidationUtil.isEmpty(jsonArray)) {
List<SafetyProblemTracing> safetyProblemTracingList = jsonArray.stream().map(item -> {
if (!(item instanceof JSONObject)) {
throw new IllegalArgumentException("item is not a JSONObject.");
}
JSONObject json = (JSONObject) item;
SafetyProblemTracing safetyProblemTracing = new SafetyProblemTracing();
safetyProblemTracing.setProblemType(problemTypeEnum.getName());
safetyProblemTracing.setProblemTypeCode(problemTypeEnum.getCode());
safetyProblemTracing.setProblemDesc(problemTypeEnum.getDesc() + "-" + json.getOrDefault("userName", "") + "-" + json.getOrDefault("certNo", ""));
safetyProblemTracing.setSourceType(SafetyProblemSourceTypeEnum.PERSONNEL.getName());
safetyProblemTracing.setSourceTypeCode(SafetyProblemSourceTypeEnum.PERSONNEL.getCode());
safetyProblemTracing.setSourceId(json.getOrDefault("permissionSeq", "").toString());
safetyProblemTracing.setProblemTime(new Date());
safetyProblemTracing.setPrincipalUnit(json.getOrDefault("useUnit", "").toString());
safetyProblemTracing.setPrincipalUnitCode(json.getOrDefault("useUnitCode", "").toString());
safetyProblemTracing.setPrincipalUnitType(json.getOrDefault("unitType", "").toString());
safetyProblemTracing.setGoverningBody(json.getOrDefault("superviseOrgName", "").toString());
safetyProblemTracing.setGoverningBodyCode(json.getOrDefault("useUnitCode", "").toString());
safetyProblemTracing.setGoverningBodyOrgCode(json.getOrDefault("superviseOrgCode", "").toString());
safetyProblemTracing.setCreateDate(new Date());
safetyProblemTracing.setProblemStatus(SafetyProblemStatusEnum.UNHANDLED.getName());
safetyProblemTracing.setProblemStatusCode(SafetyProblemStatusEnum.UNHANDLED.getCode());
return safetyProblemTracing;
}).collect(Collectors.toList());
safetyProblemTracingService.saveOrUpdateBatchByColumns(safetyProblemTracingList,
safetyProblemTracing -> new QueryWrapper<>()
.eq("problem_type_code", safetyProblemTracing.getProblemTypeCode())
.eq("source_id", safetyProblemTracing.getSourceId())
.eq("problem_status_code", SafetyProblemStatusEnum.UNHANDLED.getCode()));}
}
public String buildTopic(String topic) { public String buildTopic(String topic) {
String topicPrefix = "$share/" + applicationName; String topicPrefix = "$share/" + applicationName;
return String.format("%s/%s", topicPrefix, topic); return String.format("%s/%s", topicPrefix, topic);
......
...@@ -32,10 +32,12 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -32,10 +32,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
...@@ -52,6 +54,7 @@ import java.util.stream.IntStream; ...@@ -52,6 +54,7 @@ import java.util.stream.IntStream;
import java.util.stream.Stream; import java.util.stream.Stream;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import static com.alibaba.fastjson.JSON.toJSONString; import static com.alibaba.fastjson.JSON.toJSONString;
/** /**
* 管道工程装置表服务实现类 * 管道工程装置表服务实现类
...@@ -197,53 +200,99 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -197,53 +200,99 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
.isNull(IdxBizJgProjectContraption::getProjectContraptionParentId) .isNull(IdxBizJgProjectContraption::getProjectContraptionParentId)
.orderByDesc(IdxBizJgProjectContraption::getRecDate) .orderByDesc(IdxBizJgProjectContraption::getRecDate)
.page(page); .page(page);
pageList.getRecords().forEach(record -> { if (!ValidationUtil.isEmpty(pageList.getRecords())) {
BigDecimal pipelineLength = BigDecimal.valueOf(record.getPipelineLength()); pageList.getRecords().forEach(record -> {
BigDecimal roundedValue = pipelineLength.setScale(3, RoundingMode.HALF_UP); BigDecimal pipelineLength = BigDecimal.valueOf(record.getPipelineLength());
BigDecimal strippedValue = roundedValue.stripTrailingZeros(); BigDecimal roundedValue = pipelineLength.setScale(3, RoundingMode.HALF_UP);
record.setPipelineLength(Double.valueOf(strippedValue.toPlainString())); BigDecimal strippedValue = roundedValue.stripTrailingZeros();
record.setDataSourceName(EquipSourceEnum.getDataSourceName(record.getDataSource())); record.setPipelineLength(Double.valueOf(strippedValue.toPlainString()));
record.setFullAddress( record.setDataSourceName(EquipSourceEnum.getDataSourceName(record.getDataSource()));
Stream.of(record.getProvinceName(), record.getCityName(), record.getCountyName(), record.getStreetName(), record.getAddress()) record.setFullAddress(
.map(value -> value == null ? "" : value) Stream.of(record.getProvinceName(), record.getCityName(), record.getCountyName(), record.getStreetName(), record.getAddress())
.collect(Collectors.joining()) .map(value -> value == null ? "" : value)
); .collect(Collectors.joining())
record.setCanEdit(this.checkContraptionIsCanEdit(record.getSequenceNbr())); );
record.setCanDelete(this.checkContraptionIsCanDelete(record.getSequenceNbr(),isIntoManagement)); });
List<Long> projectContraptionIdList = pageList.getRecords().stream().map(IdxBizJgProjectContraption::getSequenceNbr).collect(Collectors.toList());
Map<String, Boolean> canEditMap = this.checkContraptionIsCanEdit(projectContraptionIdList);
pageList.getRecords().forEach(record -> record.setCanEdit(canEditMap.get(record.getSequenceNbr())));
Map<String, Boolean> canDeleteMap = this.checkContraptionIsCanDelete(projectContraptionIdList, isIntoManagement);
pageList.getRecords().forEach(record -> record.setCanDelete(canDeleteMap.get(record.getSequenceNbr())));
//判断是否有检验结果录入 //判断是否有检验结果录入
judgeCheckResult(record); judgeCheckResult(pageList.getRecords());
}); }
return pageList; return pageList;
} }
/** /**
* 此处判断是否有检验结果 所有的管道信息都需要有检验结果才可以展示 * 此处判断是否有检验结果 所有的管道信息都需要有检验结果才可以展示
* @param record * @param records
*/ */
private void judgeCheckResult(IdxBizJgProjectContraption record) { private void judgeCheckResult(List<IdxBizJgProjectContraption> records) {
record.setDisableBasicButton(true); List<IdxBizJgProjectContraption> pipelineList = records.stream().filter(record -> PipelineEnum.PRESSURE_PIPELINE.getCode().equals(record.getEquList())).collect(Collectors.toList());
if ("8200".equals(record.getEquCategory()) || "8100".equals(record.getEquCategory()) || "8300".equals(record.getEquCategory())) { if (!ValidationUtil.isEmpty(pipelineList)) {
int notNullCount = this.baseMapper.selectCheckCountByNotNull(String.valueOf(record.getSequenceNbr())); StopWatch watch1 = new StopWatch();
long total = this.baseMapper.selectEquipCount(String.valueOf(record.getSequenceNbr())); List<Long> projectContraptionIdList = pipelineList.stream().map(IdxBizJgProjectContraption::getSequenceNbr).collect(Collectors.toList());
if(total==notNullCount && total !=0){ watch1.start();
record.setDisableBasicButton(false); List<Map<String, Integer>> notNullCountList = this.baseMapper.selectCheckCountByNotNull(projectContraptionIdList);
watch1.stop();
System.out.println("watch1:" + watch1.getTotalTimeMillis());
StopWatch watch2 = new StopWatch();
watch2.start();
List<Map<String, Integer>> totalList = this.baseMapper.selectEquipCount(projectContraptionIdList);
watch2.stop();
System.out.println("watch2:" + watch2.getTotalTimeMillis());
for (IdxBizJgProjectContraption record : pipelineList) {
Map<String, Integer> totalMap = totalList.stream().filter(item -> String.valueOf(record.getSequenceNbr()).equals(item.get("project_contraption_id"))).findFirst().orElse(new HashMap<>());
Map<String, Integer> notNullCountMap = notNullCountList.stream().filter(item -> String.valueOf(record.getSequenceNbr()).equals(item.get("project_contraption_id"))).findFirst().orElse(new HashMap<>());
Integer total = totalMap.get("count");
Integer notNullCount = notNullCountMap.get("count");
if(total != null && total.equals(notNullCount) && total != 0){
record.setDisableBasicButton(false);
}
} }
} }
} }
private Boolean checkContraptionIsCanEdit(Long projectContraptionId) { private Map<String, Boolean> checkContraptionIsCanEdit(List<Long> projectContraptionIdList) {
Integer inUseTime = this.baseMapper.countContraptionInUseTimesForEdit(projectContraptionId); Map<String, Boolean> resultMap = new HashMap<>();
return inUseTime <= 0; if (ValidationUtil.isEmpty(projectContraptionIdList)) {
return resultMap;
} }
private Boolean checkContraptionIsCanDelete(Long projectContraptionId,Boolean isIntoManagement) { List<Map<String, Integer>> inUseTimeMap = this.baseMapper.countContraptionInUseTimesForEdit(projectContraptionIdList);
Integer inUseTime = 0;
if(isIntoManagement){ return getCheckResultMap(projectContraptionIdList, resultMap, inUseTimeMap);
inUseTime= this.baseMapper.countContraptionInUseTimesForDeleteByIntoManagement(projectContraptionId); }
}else {
inUseTime = this.baseMapper.countContraptionInUseTimesForDelete(projectContraptionId);
private Map<String, Boolean> checkContraptionIsCanDelete(List<Long> projectContraptionIdList, Boolean isIntoManagement) {
Map<String, Boolean> resultMap = new HashMap<>();
if (ValidationUtil.isEmpty(projectContraptionIdList)) {
return resultMap;
}
List<Map<String, Integer>> inUseTimeMap;
if(isIntoManagement) {
inUseTimeMap = this.baseMapper.countContraptionInUseTimesForDeleteByIntoManagementBatch(projectContraptionIdList);
} else {
inUseTimeMap = this.baseMapper.countContraptionInUseTimesForDelete(projectContraptionIdList);
}
return getCheckResultMap(projectContraptionIdList, resultMap, inUseTimeMap);
}
private Map<String, Boolean> getCheckResultMap(List<Long> projectContraptionIdList, Map<String, Boolean> resultMap, List<Map<String, Integer>> inUseTimeMap) {
for (Long projectContraptionId : projectContraptionIdList) {
Optional<Integer> inUseCountOpt = inUseTimeMap.stream()
.filter(map -> projectContraptionId.toString().equals(map.get("project_contraption_id")))
.map(map -> map.get("inUseNumber"))
.filter(Objects::nonNull)
.findFirst();
Integer inUseCount = inUseCountOpt.orElse(0);
resultMap.put(String.valueOf(projectContraptionId), inUseCount <= 0);
} }
return inUseTime <= 0; return resultMap;
} }
@Override @Override
...@@ -307,7 +356,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -307,7 +356,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
page.setRecords(baseMapper.selectEquipListPage(sequenceNbr, (current - 1) * size, size)); page.setRecords(baseMapper.selectEquipListPage(sequenceNbr, (current - 1) * size, size));
page.setTotal(baseMapper.selectEquipCount(sequenceNbr)); Map<String, Integer> totalMap = baseMapper.selectEquipCount(new ArrayList<>(Collections.singletonList(Long.parseLong(sequenceNbr)))).get(0);
page.setTotal(totalMap.get("count"));
return page; return page;
} }
......
...@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl; ...@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing; import com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing;
...@@ -11,7 +13,9 @@ import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum; ...@@ -11,7 +13,9 @@ import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock; import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -54,15 +58,24 @@ public class SafetyProblemTracingGenServiceImpl{ ...@@ -54,15 +58,24 @@ public class SafetyProblemTracingGenServiceImpl{
@Autowired @Autowired
TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper; TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper;
@Autowired
TzsUserInfoMapper tzsUserInfoMapper;
@Scheduled(cron = "0 0 1 * * ?") @Scheduled(cron = "0 0 1 * * ?")
@SchedulerLock(name = "executeSafetyProblemCheck", lockAtMostFor = "PT5H", lockAtLeastFor = "PT10M") @SchedulerLock(name = "executeSafetyProblemCheck", lockAtMostFor = "PT5H", lockAtLeastFor = "PT10M")
public void executeSafetyProblemCheck() { public void executeSafetyProblemCheck() {
executeMaintenanceCheck(); executeMaintenanceCheck();
executeInspectionCheck(); executeInspectionCheck();
executePersonnalCertificationCheck();
executeEnterpriseQualificationCheck(); executeEnterpriseQualificationCheck();
} }
private void executePersonnalCertificationCheck() {
logger.info("开始人员资质超期检查");
List<Map<String, Object>> certificationRecords = commonMapper.queryOutOfCertificationRecord();
updateUserInfoAndSendMessage(certificationRecords);
logger.info("人员资质超期检查结束");
}
public void executeInspectionCheck() { public void executeInspectionCheck() {
logger.info("开始检验检测超期检查"); logger.info("开始检验检测超期检查");
// 查询当天检验超期的设备 // 查询当天检验超期的设备
...@@ -149,6 +162,18 @@ public class SafetyProblemTracingGenServiceImpl{ ...@@ -149,6 +162,18 @@ public class SafetyProblemTracingGenServiceImpl{
sendSafetyProblemMessage(mapList, SafetyProblemTypeEnum.XKCQ); sendSafetyProblemMessage(mapList, SafetyProblemTypeEnum.XKCQ);
} }
private void updateUserInfoAndSendMessage(List<Map<String, Object>> certificationRecords) {
Set<String> outOfUnitLicenseList = certificationRecords.stream().map(m -> m.get("userSeq").toString()).collect(Collectors.toSet());
if (!ValidationUtil.isEmpty(outOfUnitLicenseList)) {
LambdaUpdateWrapper<TzsUserInfo> up = new LambdaUpdateWrapper();
up.in(BaseEntity::getSequenceNbr,outOfUnitLicenseList);
up.set(TzsUserInfo::getQrCodeState,0);
tzsUserInfoMapper.update(null,up);
}
sendSafetyProblemMessage(certificationRecords, SafetyProblemTypeEnum.ZZCQ);
}
/** /**
* 发送安全问题 * 发送安全问题
* @param mapList * @param mapList
......
...@@ -210,4 +210,8 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr ...@@ -210,4 +210,8 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
return true; return true;
} }
public Page<Map<String, Object>> queryUserListProblemById(Page<Map<String, Object>> page, String problemId) {
return this.baseMapper.queryUserListProblemById(page, problemId);
}
} }
\ No newline at end of file
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
{ {
"dictDataKey": "0", "dictDataKey": "0",
"dictDataValue": "按设备种类", "dictDataValue": "按设备种类",
"dictDataDesc": "upload/tzs/common/image/按照设备种类选择.png" "dictDataDesc": "upload/tzs/common/image/业务场景-设备.png"
}, },
{ {
"dictDataKey": "1", "dictDataKey": "1",
"dictDataValue": "按应用场景", "dictDataValue": "按应用场景",
"dictDataDesc": "upload/tzs/common/image/按照应用场景选择.png" "dictDataDesc": "upload/tzs/common/image/业务场景-应用.png"
} }
], ],
"SGGZ": [ "SGGZ": [
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
{ {
"name": "批量导入", "name": "批量导入",
"code": "PL_DR", "code": "PL_DR",
"image": "upload/tzs/common/image/新增设备.png" "image": "upload/tzs/common/image/新增设备(批量).png"
} }
] ]
} }
\ No newline at end of file
...@@ -195,4 +195,10 @@ public class TzsUserInfo extends BaseEntity { ...@@ -195,4 +195,10 @@ public class TzsUserInfo extends BaseEntity {
@TableField(value = "job_title") @TableField(value = "job_title")
private String jobTitle; private String jobTitle;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
} }
package com.yeejoin.amos.boot.module.tcm.api.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.Map;
/**
* 安全追溯问题
*
* @author system_generator
* @date 2024-05-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SafetyProblemTracingDto", description = "安全追溯问题")
public class SafetyProblemTracingDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "问题编号")
private String problemNum;
@ApiModelProperty(value = "问题类型(维保超期、检验超期、资质超期等)")
private String problemType;
@ApiModelProperty(value = "问题类型图片")
private String problemTypePic;
@ApiModelProperty(value = "问题来源类型(1个人、2设备、3企业)")
private String sourceType;
@ApiModelProperty(value = "问题来源ID(个人ID、设备ID、企业ID)")
private String sourceId;
@ApiModelProperty(value = "问题描述")
private String problemDesc;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "问题产生查询开始时间")
private Date problemTimeStart;
@ApiModelProperty(value = "问题产生时间")
private Date problemTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "问题产生查询结束时间")
private Date problemTimeEnd;
@ApiModelProperty(value = "主体单位名称")
private String principalUnit;
@ApiModelProperty(value = "主体单位统一代码")
private String principalUnitCode;
@ApiModelProperty(value = "主体单位类型(使用、安改维、检验检测等)")
private String principalUnitType;
@ApiModelProperty(value = "管辖机构名称")
private String governingBody;
@ApiModelProperty(value = "管辖机构单位代码")
private String governingBodyCode;
@ApiModelProperty(value = "管辖机构组织机构代码(例如50*60*70)")
private String governingBodyOrgCode;
@ApiModelProperty(value = "主体单位所属区域名称(陕西省/西安市/莲湖区)")
private String regionName;
@ApiModelProperty(value = "所属区域代码(6100000/6100010/6100011)")
private String regionCode;
@ApiModelProperty(value = "所属区域代码(6100000/6100010/6100011)")
private String cityCode;
@ApiModelProperty(value = "问题状态(0未处理、1已处理)")
private String problemStatus;
@ApiModelProperty(value = "问题状态代码(0未处理、1已处理)")
private String problemStatusCode;
@ApiModelProperty(value = "问题状态对象")
private Map<String, String> problemStatusObj;
@ApiModelProperty(value = "更新人员")
private String recUser;
@ApiModelProperty(value = "创建人ID")
private String createUserId;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "创建人")
private String createUser;
@ApiModelProperty(value = "企业负责人")
private String unitCharger;
@ApiModelProperty(value = "企业负责人联系电话")
private String unitChargerPhone;
@ApiModelProperty(value = "设备监管码")
private String equipSuperviseCode;
@ApiModelProperty(value = "设备种类")
private String equipList;
@ApiModelProperty(value = "人员名称")
private String userName;
@ApiModelProperty(value = "人员电话")
private String userPhone;
@ApiModelProperty(value = "人员岗位")
private String userPost;
@ApiModelProperty(value = "扩展信息")
private String extraInfo;
@ApiModelProperty(value = "设备种类代码")
private String equipListCode;
@ApiModelProperty(value = "问题类型代码(维保超期、检验超期、资质超期等)")
private String problemTypeCode;
@ApiModelProperty(value = "问题来源类型code(1个人、2设备、3企业)")
private String sourceTypeCode;
@ApiModelProperty(value = "问题等级(一级、二级、三级)")
private String problemLevel;
@ApiModelProperty(value = "问题等级code")
private String problemLevelCode;
@ApiModelProperty(value = "隐患等级(红:隐患状态为未处理、黄:暂无、绿:隐患状态为已处理、灰:暂无)")
private String hiddenDangersLevel;
@ApiModelProperty(value = "设备类别code")
private String equCategoryCode;
@ApiModelProperty(value = "设备类别")
private String equCategory;
}
...@@ -117,4 +117,8 @@ public class TzsUserInfoDto extends BaseDto { ...@@ -117,4 +117,8 @@ public class TzsUserInfoDto extends BaseDto {
@ApiModelProperty(value = "菜单类型下的所有人员类型") @ApiModelProperty(value = "菜单类型下的所有人员类型")
private List<String> menuTypeUnderPost; private List<String> menuTypeUnderPost;
@ApiModelProperty("二维码状态0异常1正常")
private String qrCodeState;
} }
package com.yeejoin.amos.boot.module.tcm.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 安全追溯问题
*
* @author system_generator
* @date 2024-05-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tzs_safety_problem_tracing")
public class SafetyProblemTracing extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 问题编号
*/
@TableField("problem_num")
private String problemNum;
/**
* 问题类型(维保超期、检验超期、资质超期等)
*/
@TableField("problem_type")
private String problemType;
/**
* 问题来源类型(1个人、2企业、3设备)
*/
@TableField("source_type")
private String sourceType;
/**
* 问题来源ID(个人ID、设备ID、企业ID)
*/
@TableField("source_id")
private String sourceId;
/**
* 问题描述
*/
@TableField("problem_desc")
private String problemDesc;
/**
* 问题产生时间
*/
@TableField("problem_time")
private Date problemTime;
/**
* 主体单位名称
*/
@TableField("principal_unit")
private String principalUnit;
/**
* 主体单位统一代码
*/
@TableField("principal_unit_code")
private String principalUnitCode;
/**
* 主体单位类型(使用、安改维、检验检测等)
*/
@TableField("principal_unit_type")
private String principalUnitType;
/**
* 管辖机构名称
*/
@TableField("governing_body")
private String governingBody;
/**
* 管辖机构单位代码
*/
@TableField("governing_body_code")
private String governingBodyCode;
/**
* 管辖机构组织机构代码(例如50*60*70)
*/
@TableField("governing_body_org_code")
private String governingBodyOrgCode;
/**
* 主体单位所属区域名称(陕西省/西安市/莲湖区)
*/
@TableField("region_name")
private String regionName;
/**
* 所属区域代码(6100000/6100010/6100011)
*/
@TableField("region_code")
private String regionCode;
/**
* 问题状态(0未处理、1已处理)
*/
@TableField("problem_status")
private String problemStatus;
/**
* 问题状态代码(0未处理、1已处理)
*/
@TableField("problem_status_code")
private String problemStatusCode;
/**
* 更新人员
*/
@TableField("rec_user")
private String recUser;
/**
* 创建人ID
*/
@TableField("create_user_id")
private String createUserId;
/**
* 创建时间
*/
@TableField("create_date")
private Date createDate;
/**
* 创建人
*/
@TableField("create_user")
private String createUser;
/**
* 企业负责人
*/
@TableField("unit_charger")
private String unitCharger;
/**
* 企业负责人联系电话
*/
@TableField("unit_charger_phone")
private String unitChargerPhone;
/**
* 设备监管码
*/
@TableField("equip_supervise_code")
private String equipSuperviseCode;
/**
* 设备种类
*/
@TableField("equip_list")
private String equipList;
/**
* 人员名称
*/
@TableField("user_name")
private String userName;
/**
* 人员电话
*/
@TableField("user_phone")
private String userPhone;
/**
* 人员岗位
*/
@TableField("user_post")
private String userPost;
/**
* 扩展信息
*/
@TableField("extraInfo")
private String extraInfo;
/**
* 设备种类代码
*/
@TableField("equip_list_code")
private String equipListCode;
/**
* 问题类型代码(维保超期、检验超期、资质超期等)
*/
@TableField("problem_type_code")
private String problemTypeCode;
/**
* 问题来源类型code(1个人、2企业、3设备)
*/
@TableField("source_type_code")
private String sourceTypeCode;
/**
* 问题等级(一级、二级、三级)
*/
@TableField("problem_level")
private String problemLevel;
/**
* 问题等级code
*/
@TableField("problem_level_code")
private String problemLevelCode;
}
...@@ -195,4 +195,9 @@ public class TzsUserInfo extends BaseEntity { ...@@ -195,4 +195,9 @@ public class TzsUserInfo extends BaseEntity {
@TableField(value = "job_title") @TableField(value = "job_title")
private String jobTitle; private String jobTitle;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
} }
package com.yeejoin.amos.boot.module.tcm.api.enums;
import lombok.Getter;
/**
* 业务类型枚举
*
* @author Administrator
*/
@Getter
public enum SafetyProblemSourceTypeEnum {
/**
* 问题主体类型
*/
UNIT("2", "企业"),
EQUIP("3", "设备"),
PERSONNEL("1", "个人");
private final String code;
private final String name;
SafetyProblemSourceTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getNameByType(String code) {
String name = null;
for (SafetyProblemSourceTypeEnum enumOne : SafetyProblemSourceTypeEnum.values()) {
if (enumOne.getCode().equals(code)) {
name = enumOne.getName();
break;
}
}
return name;
}
}
package com.yeejoin.amos.boot.module.tcm.api.enums;
import lombok.Getter;
/**
* 业务类型枚举
*
* @author Administrator
*/
@Getter
public enum SafetyProblemStatusEnum {
/**
* 问题主体类型
*/
UNHANDLED("0", "未处理", "red"),
HANDLED("1", "已处理", "green");
private final String code;
private final String name;
private final String color;
SafetyProblemStatusEnum(String code, String name, String color) {
this.code = code;
this.name = name;
this.color = color;
}
public static String getNameByType(String code) {
String name = null;
for (SafetyProblemStatusEnum enumOne : SafetyProblemStatusEnum.values()) {
if (enumOne.getCode().equals(code)) {
name = enumOne.getName();
break;
}
}
return name;
}
}
package com.yeejoin.amos.boot.module.tcm.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tcm.api.entity.SafetyProblemTracing;
/**
* 安全追溯问题 Mapper 接口
*
* @author system_generator
* @date 2024-05-21
*/
public interface SafetyProblemTracingMapper extends BaseMapper<SafetyProblemTracing> {
}
package com.yeejoin.amos.boot.module.tcm.api.service;
/**
* 安全追溯问题接口类
*
* @author system_generator
* @date 2024-05-21
*/
public interface ISafetyProblemTracingService {}
...@@ -134,6 +134,9 @@ public class TzsUserInfoVo { ...@@ -134,6 +134,9 @@ public class TzsUserInfoVo {
@ApiModelProperty(value = "设备类型") @ApiModelProperty(value = "设备类型")
private JSONArray equipType; private JSONArray equipType;
@ApiModelProperty(value = "设备类型名称")
private String equipTypeName;
/** /**
* 内部人员编码 * 内部人员编码
*/ */
...@@ -156,4 +159,6 @@ public class TzsUserInfoVo { ...@@ -156,4 +159,6 @@ public class TzsUserInfoVo {
*/ */
private String jobTitle; private String jobTitle;
@ApiModelProperty(value = "人员类型名称")
private String postName;
} }
package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import com.yeejoin.amos.boot.module.tcm.api.dto.SafetyProblemTracingDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.SafetyProblemTracing;
import com.yeejoin.amos.boot.module.tcm.api.mapper.SafetyProblemTracingMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ISafetyProblemTracingService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
/**
* 安全追溯问题服务实现类
*
* @author system_generator
* @date 2024-05-21
*/
@Service
public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTracingDto, SafetyProblemTracing, SafetyProblemTracingMapper> implements ISafetyProblemTracingService {
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tcm.biz.service.impl; package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -279,7 +280,20 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI ...@@ -279,7 +280,20 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
tzsUserInfoVo.setNewPost(JSON.parseArray(tzsUserInfo.getNewPost())); tzsUserInfoVo.setNewPost(JSON.parseArray(tzsUserInfo.getNewPost()));
} }
if (!ObjectUtils.isEmpty(tzsUserInfo.getEquipType())) { if (!ObjectUtils.isEmpty(tzsUserInfo.getEquipType())) {
tzsUserInfoVo.setEquipType(JSON.parseArray(tzsUserInfo.getEquipType())); JSONArray equipTypeJSONArray = JSON.parseArray(tzsUserInfo.getEquipType());
tzsUserInfoVo.setEquipType(equipTypeJSONArray);
if(CollUtil.isNotEmpty(equipTypeJSONArray)){
StringBuilder equipTypeName = new StringBuilder();
for (Object o : equipTypeJSONArray) {
String s = EquipmentClassifityEnum.getName.get(o);
if(StringUtils.isEmpty(s)){
s = String.valueOf(o);
}
equipTypeName.append(s);
equipTypeName.append(",");
}
tzsUserInfoVo.setEquipTypeName(equipTypeName.substring(0,equipTypeName.length()-1));
}
} }
tzsUserInfoVo.setIdentification(ObjectUtils.isEmpty(tzsUserInfo.getIdentification()) ? null : JSON.parseArray(tzsUserInfo.getIdentification())); tzsUserInfoVo.setIdentification(ObjectUtils.isEmpty(tzsUserInfo.getIdentification()) ? null : JSON.parseArray(tzsUserInfo.getIdentification()));
tzsUserInfoVo.setProfile(ObjectUtils.isEmpty(tzsUserInfo.getProfile()) ? null : JSON.parseArray(tzsUserInfo.getProfile())); tzsUserInfoVo.setProfile(ObjectUtils.isEmpty(tzsUserInfo.getProfile()) ? null : JSON.parseArray(tzsUserInfo.getProfile()));
...@@ -944,6 +958,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI ...@@ -944,6 +958,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
} }
// 更新资质 // 更新资质
tzsUserPermissionServiceImpl.updatePermissionData(tzsUserInfoDto); tzsUserPermissionServiceImpl.updatePermissionData(tzsUserInfoDto);
tzsUserInfoDto.setQrCodeState("1");
this.updateWithModel(tzsUserInfoDto); this.updateWithModel(tzsUserInfoDto);
return tzsUserInfoDto; return tzsUserInfoDto;
} }
......
package com.yeejoin.amos.boot.module.tcm.biz.service.impl; package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.TzsUserPermissionDto; import com.yeejoin.amos.boot.module.common.api.dto.TzsUserPermissionDto;
import com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission; import com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.SafetyProblemTracing;
import com.yeejoin.amos.boot.module.tcm.api.enums.SafetyProblemSourceTypeEnum;
import com.yeejoin.amos.boot.module.tcm.api.enums.SafetyProblemStatusEnum;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserPermissionMapper; import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserPermissionMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzsUserPermissionService; import com.yeejoin.amos.boot.module.tcm.api.service.ITzsUserPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -66,6 +72,8 @@ public class TzsUserPermissionServiceImpl extends BaseService<TzsUserPermissionD ...@@ -66,6 +72,8 @@ public class TzsUserPermissionServiceImpl extends BaseService<TzsUserPermissionD
public List<TzsUserPermissionDto> queryForTzsUserPermissionList() { public List<TzsUserPermissionDto> queryForTzsUserPermissionList() {
return this.queryForList("", false); return this.queryForList("", false);
} }
@Autowired
private SafetyProblemTracingServiceImpl safetyProblemTracingService;
/** /**
* 更新资质权限数据 * 更新资质权限数据
...@@ -151,12 +159,35 @@ public class TzsUserPermissionServiceImpl extends BaseService<TzsUserPermissionD ...@@ -151,12 +159,35 @@ public class TzsUserPermissionServiceImpl extends BaseService<TzsUserPermissionD
.parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0) .parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0)
.toFormatter(); .toFormatter();
Object sequenceNbr = permissionData.get("sequenceNbr");
if(Objects.nonNull(sequenceNbr)){
permission.setSequenceNbr(Long.valueOf(String.valueOf(sequenceNbr)));
}
String expiryDateString = String.valueOf(Optional.ofNullable(permissionData.get("expiryDate")).orElse("")); String expiryDateString = String.valueOf(Optional.ofNullable(permissionData.get("expiryDate")).orElse(""));
if (!ValidationUtil.isEmpty(expiryDateString)) { if (!ValidationUtil.isEmpty(expiryDateString)) {
LocalDate localDate1 = LocalDate.parse(expiryDateString, formatter); LocalDate localDate1 = LocalDate.parse(expiryDateString, formatter);
LocalDateTime localDateTime1 = localDate1.atStartOfDay(); LocalDateTime localDateTime1 = localDate1.atStartOfDay();
Date expiryDate = Date.from(localDateTime1.atZone(ZoneId.systemDefault()).toInstant()); Date expiryDate = Date.from(localDateTime1.atZone(ZoneId.systemDefault()).toInstant());
permission.setExpiryDate(expiryDate); permission.setExpiryDate(expiryDate);
//如果有效期大于当前日期,同时问题列表有未处理的问题,则修改成已处理
LocalDate now = LocalDate.now();
if(!localDate1.isBefore(now) && Objects.nonNull(sequenceNbr)){
LambdaQueryWrapper<SafetyProblemTracing> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SafetyProblemTracing::getSourceId,sequenceNbr)
.eq(SafetyProblemTracing::getSourceTypeCode, SafetyProblemSourceTypeEnum.PERSONNEL.getCode())
.eq(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.UNHANDLED.getCode());
List<SafetyProblemTracing> safetyProblemTracingList = safetyProblemTracingService.list(wrapper);
if(CollUtil.isNotEmpty(safetyProblemTracingList)){
LambdaUpdateWrapper<SafetyProblemTracing> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.HANDLED.getCode())
.set(SafetyProblemTracing::getProblemStatus, SafetyProblemStatusEnum.HANDLED.getName())
.set(SafetyProblemTracing::getRecDate,new Date())
.eq(SafetyProblemTracing::getSourceId,sequenceNbr)
.eq(SafetyProblemTracing::getSourceTypeCode, SafetyProblemSourceTypeEnum.PERSONNEL.getCode());
safetyProblemTracingService.update(updateWrapper);
}
}
} }
String issueDateString = String.valueOf(Optional.ofNullable(permissionData.get("issueDate")).orElse("")); String issueDateString = String.valueOf(Optional.ofNullable(permissionData.get("issueDate")).orElse(""));
...@@ -166,7 +197,6 @@ public class TzsUserPermissionServiceImpl extends BaseService<TzsUserPermissionD ...@@ -166,7 +197,6 @@ public class TzsUserPermissionServiceImpl extends BaseService<TzsUserPermissionD
Date issueDate = Date.from(localDateTime2.atZone(ZoneId.systemDefault()).toInstant()); Date issueDate = Date.from(localDateTime2.atZone(ZoneId.systemDefault()).toInstant());
permission.setIssueDate(issueDate); permission.setIssueDate(issueDate);
} }
permission.setApprovedOrgan((String) permissionData.get("approvedOrgan")); permission.setApprovedOrgan((String) permissionData.get("approvedOrgan"));
permission.setCertAttachment(JSONArray.toJSONString(permissionData.get("certAttachment"))); permission.setCertAttachment(JSONArray.toJSONString(permissionData.get("certAttachment")));
permission.setCertType(ZYRY_TYPE.equals(type) ? String.valueOf(permissionData.get("certType")) : null); permission.setCertType(ZYRY_TYPE.equals(type) ? String.valueOf(permissionData.get("certType")) : null);
......
...@@ -142,5 +142,12 @@ public class TzsUserInfo extends BaseEntity { ...@@ -142,5 +142,12 @@ public class TzsUserInfo extends BaseEntity {
@TableField("new_post") @TableField("new_post")
private String newPost; private String newPost;
/**
* 二维码状态0异常1正常
*/
@TableField("qr_code_state")
private String qrCodeState;
@TableField("post_name")
private String postName;
} }
package com.yeejoin.amos.boot.module.ymt.api.mapper; package com.yeejoin.amos.boot.module.ymt.api.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectConstruction;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* 管道工程装置表 Mapper 接口 * 管道工程装置表 Mapper 接口
...@@ -27,17 +24,37 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro ...@@ -27,17 +24,37 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
/** /**
* 统计工程装置的引用次数(非待提交、非已撤回、非已驳回) * 统计工程装置的引用次数(非待提交、非已撤回、非已驳回)
* *
* @param projectContraptionId 工程装置唯一标识 * @param projectContraptionIdList 工程装置唯一标识
* @return 被引用次数 > 0 则设备不可编辑 * @return 被引用次数 > 0 则设备不可编辑
*/ */
Integer countContraptionInUseTimesForEdit(@Param("projectContraptionId") Long projectContraptionId); List<Map<String, Integer>> countContraptionInUseTimesForEdit(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
/** /**
* 统计设备被引用的次数(只有存在就算引用-作废除外) * 统计设备被引用的次数(只有存在就算引用-作废除外)
* @param projectContraptionIdList 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
List<Map<String, Integer>> countContraptionInUseTimesForDelete(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
/**
* 获取管道信息总数
*
* @param projectContraptionIdList
* @return
*/
List<Map<String, Integer>> selectEquipCount(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
/**
* 获取不为空的检验信息个数
*/
List<Map<String, Integer>> selectCheckCountByNotNull(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
/**
* 统计已纳管设备被引用的次数(只有存在就算引用-作废除外)
* @param projectContraptionId 设备唯一标识 * @param projectContraptionId 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除 * @return 被引用次数 > 0 则设备不可删除
*/ */
Integer countContraptionInUseTimesForDelete(@Param("projectContraptionId") Long projectContraptionId); Integer countContraptionInUseTimesForDeleteByIntoManagement(@Param("projectContraptionId")Long projectContraptionId);
List<IdxBizJgProjectContraption> selectErrorManagementProject(); List<IdxBizJgProjectContraption> selectErrorManagementProject();
...@@ -62,13 +79,6 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro ...@@ -62,13 +79,6 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
List<Map<String, Object>> selectEquipListPage(@Param("sequenceNbr") String sequenceNbr, @Param("current") int current, @Param("size") int size); List<Map<String, Object>> selectEquipListPage(@Param("sequenceNbr") String sequenceNbr, @Param("current") int current, @Param("size") int size);
/** /**
* 获取管道信息总数
* @param sequenceNbr
* @return
*/
long selectEquipCount(@Param("sequenceNbr") String sequenceNbr);
/**
* 获取导出传输/公共管道的信息 * 获取导出传输/公共管道的信息
* @param sequenceNbr * @param sequenceNbr
* @return * @return
...@@ -76,14 +86,9 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro ...@@ -76,14 +86,9 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
List<Map<String, Object>> selectEquipListByExport(@Param("sequenceNbr") String sequenceNbr); List<Map<String, Object>> selectEquipListByExport(@Param("sequenceNbr") String sequenceNbr);
/** /**
* 获取不为空的检验信息个数
*/
int selectCheckCountByNotNull(@Param("sequenceNbr") String sequenceNbr);
/**
* 统计已纳管设备被引用的次数(只有存在就算引用-作废除外) * 统计已纳管设备被引用的次数(只有存在就算引用-作废除外)
* @param projectContraptionId 设备唯一标识 * @param projectContraptionId 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除 * @return 被引用次数 > 0 则设备不可删除
*/ */
Integer countContraptionInUseTimesForDeleteByIntoManagement(@Param("projectContraptionId")Long projectContraptionId); List<Map<String, Integer>> countContraptionInUseTimesForDeleteByIntoManagementBatch(@Param("projectContraptionIdList") List<Long> projectContraptionIdList);
} }
...@@ -123,4 +123,5 @@ public class TzsUserInfoVo { ...@@ -123,4 +123,5 @@ public class TzsUserInfoVo {
* 证件照片 * 证件照片
*/ */
private JSONArray appointDoc; private JSONArray appointDoc;
private String postName;
} }
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