Commit 533f2c1c authored by suhuiguang's avatar suhuiguang

feat(jyjc): 报检开发调整

1.报检规则4.0开发
parent 1b06b1ee
package com.yeejoin.amos.boot.module.common.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("装置查询参数")
public class ContraptionQueryParams {
@ApiModelProperty(value = "检验类型", required = true)
private String inspectionType;
@ApiModelProperty("设备类别")
private String equCategory;
@ApiModelProperty("设备列表")
private String equList;
@ApiModelProperty("设备定义")
private String equDefine;
@ApiModelProperty("城市")
private String city;
@ApiModelProperty("区县")
private String county;
}
...@@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor; ...@@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
...@@ -24,7 +25,7 @@ public class EquipCategoryTypeHandler implements TypeHandler<String> { ...@@ -24,7 +25,7 @@ public class EquipCategoryTypeHandler implements TypeHandler<String> {
public String handle(String code) { public String handle(String code) {
return code != null ? CODE_NAME_MAP.computeIfAbsent(code, (k) -> { return code != null ? CODE_NAME_MAP.computeIfAbsent(code, (k) -> {
EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode, code).select(EquipmentCategory::getName, EquipmentCategory::getId)); EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode, code).select(EquipmentCategory::getName, EquipmentCategory::getId));
return equipmentCategory == null ? "" : equipmentCategory.getName(); return Optional.ofNullable(equipmentCategory).map(EquipmentCategory::getName).orElse("");
}) : null; }) : null;
} }
} }
...@@ -28,4 +28,14 @@ public interface BizCommonConstant { ...@@ -28,4 +28,14 @@ public interface BizCommonConstant {
* 资质信息key * 资质信息key
*/ */
String UNIT_LICENCE_KEY = "baseUnitLicences"; String UNIT_LICENCE_KEY = "baseUnitLicences";
/**
* 推送状态初始
*/
String PUSH_STATUS_INIT = "1";
/**
* 推送状态成功
*/
String PUSH_STATUS_SUCCESS = "2";
} }
package com.yeejoin.amos.boot.module.jyjc.api.dto;
import com.yeejoin.amos.boot.module.jyjc.api.model.InspectionEquipData;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @author Administrator
*/
@ApiModel(value = "检验检测申请信息推送数据-压力管道")
@Data
public class InspectionApplicationPushDataPipeline implements Serializable {
@ApiModelProperty(value = "报检单号")
private String applicationNo;
@ApiModelProperty(value = "申请日期")
private Date applicationDate;
@ApiModelProperty(value = "报检单位编号")
private String applicationUnitCode;
@ApiModelProperty(value = "报检单位名称")
private String applicationUnitName;
@ApiModelProperty(value = "报检单位地址")
private String applicationUnitAddress;
@ApiModelProperty(value = "报检单位联系人")
private String applicationContactName;
@ApiModelProperty(value = "申请联系人电话")
private String applicationContactPhone;
@ApiModelProperty(value = "检验检测类型")
private String inspectionType;
@ApiModelProperty(value = "监管单位名称")
private String superviseOrgName;
@ApiModelProperty(value = "检验检测单位编码")
private String inspectionUnitCode;
@ApiModelProperty(value = "检验检测单位名称")
private String inspectionUnitName;
@ApiModelProperty(value = "管道类别")
private String pipelineClass;
@ApiModelProperty(value = "工程(装置)名称")
private String deviceName;
@ApiModelProperty(value = "安装地点/使用地点")
private String address;
@ApiModelProperty(value = "使用登记证编号")
private String useRegistrationCode;
@ApiModelProperty(value = "设备数量(m)")
private String totalLength;
@ApiModelProperty(value = "报检的管道")
private List<PipelineResultItemDto> inspectionEquips;
private String traceId;
}
package com.yeejoin.amos.boot.module.jyjc.api.dto;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultDataModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 管道检验检测结果数据接收
*
* @author system_generator
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(value = "PipelineInspectionResultDto", description = "管道检验检测结果数据接收")
public class PipelineInspectionResultDto extends JyjcInspectionResultDataModel {
@ApiModelProperty(value = "报检的管道")
private List<PipelineResultItemDto> inspectionEquips;
}
package com.yeejoin.amos.boot.module.jyjc.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 压力管道汇总表数据项
*
* @author system_generator
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "压力管道汇总表数据项")
public class PipelineResultItemDto {
@ApiModelProperty(value = "唯一标识")
private String equipId;
@ApiModelProperty(value = "管道名称(登记单元)")
private String pipeName;
@ApiModelProperty(value = "管道编号")
private String pipelineNumber;
@ApiModelProperty(value = "设计单位名称")
private String designUnitName;
@ApiModelProperty(value = "管道级别")
private String deviceLevel;
@ApiModelProperty(value = "公称直径")
private String nominalDiameter;
@ApiModelProperty(value = "公称壁厚")
private String wallThickness;
@ApiModelProperty(value = "管道长度")
private String pipeLength;
@ApiModelProperty(value = "设计压力")
private String pressure;
@ApiModelProperty(value = "设计温度")
private String temperature;
@ApiModelProperty(value = "设计介质")
private String medium;
@ApiModelProperty(value = "工作压力")
private String workPressure;
@ApiModelProperty(value = "工作温度")
private String workTemperature;
@ApiModelProperty(value = "工作介质")
private String workMedium;
@ApiModelProperty(value = "备注")
private String remarks;
}
...@@ -19,8 +19,8 @@ public enum ResultTypeEnum { ...@@ -19,8 +19,8 @@ public enum ResultTypeEnum {
/** /**
* 集成方式 * 集成方式
*/ */
INPUT("检验机构录入", "input"), INPUT("手工录入", "input"),
INTEGRATED("检验机构对接", "integrated"), INTEGRATED("系统对接", "integrated"),
USEUNITENTRY("使用单位录入", "useUnitEntry"); USEUNITENTRY("使用单位录入", "useUnitEntry");
private final String name; private final String name;
......
...@@ -148,10 +148,15 @@ public class JyjcInspectionApplicationModel extends BaseModel { ...@@ -148,10 +148,15 @@ public class JyjcInspectionApplicationModel extends BaseModel {
@ApiModelProperty(value = "下一步任务名称") @ApiModelProperty(value = "下一步任务名称")
private String nextTaskName; private String nextTaskName;
@ApiModelProperty(value = "设备分类") @ApiModelProperty(value = "设备种类编码")
private String equList; private String equList;
@ApiModelProperty(value = "设备种类名称")
private String equListName;
@ApiModelProperty(value = "设备类别code") @ApiModelProperty(value = "设备类别code")
private String equCategory; private String equCategory;
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
and ((tzjia.application_unit_code = #{currentApplicationUnitCode} or tzjia.inspection_unit_code = #{currentInspectionUnitCode}) OR tzjia.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' )) and ((tzjia.application_unit_code = #{currentApplicationUnitCode} or tzjia.inspection_unit_code = #{currentInspectionUnitCode}) OR tzjia.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
</when> </when>
<otherwise> <otherwise>
1=2 and 1=2
</otherwise> </otherwise>
</choose> </choose>
</where> </where>
......
...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil; import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.common.api.dto.ContraptionQueryParams;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel;
...@@ -325,15 +326,14 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -325,15 +326,14 @@ public class JyjcInspectionApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/projectContraptionPage") @GetMapping(value = "/projectContraptionPage")
@ApiOperation(value = "按照检验类型查询可进行检验的装置", notes = "不包括流程中的") @ApiOperation(value = "按照检验类型查询可进行检验的装置", notes = "不包括流程中的")
public ResponseModel<IPage<IdxBizJgProjectContraption>> getJgProjectContraptionPage(@RequestParam String inspectionType, public ResponseModel<IPage<IdxBizJgProjectContraption>> getJgProjectContraptionPage(ContraptionQueryParams queryParams,
@RequestParam String equCategory,
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) { @RequestParam(value = "size") int size) {
ReginParams selectedOrgInfo = getSelectedOrgInfo(); ReginParams selectedOrgInfo = getSelectedOrgInfo();
Page<IdxBizJgProjectContraption> page = new Page<>(); Page<IdxBizJgProjectContraption> page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
IPage<IdxBizJgProjectContraption> re = jyjcInspectionApplicationServiceImpl.getJgProjectContraptionPage(inspectionType, page, selectedOrgInfo.getCompany().getCompanyCode(), equCategory); IPage<IdxBizJgProjectContraption> re = jyjcInspectionApplicationServiceImpl.getJgProjectContraptionPage(queryParams, page, selectedOrgInfo.getCompany().getCompanyCode());
return ResponseHelper.buildResponse(re); return ResponseHelper.buildResponse(re);
} }
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jyjc.biz.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jyjc.api.dto.PipelineInspectionResultDto;
import com.yeejoin.amos.boot.module.jyjc.api.enums.ResultTypeEnum; import com.yeejoin.amos.boot.module.jyjc.api.enums.ResultTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultDataModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultDataModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel;
...@@ -243,4 +244,16 @@ public class JyjcInspectionResultController extends BaseController { ...@@ -243,4 +244,16 @@ public class JyjcInspectionResultController extends BaseController {
public ResponseModel<Boolean> delUseUnitEntry(@RequestParam(value = "sequenceNbr")String resultSeq) { public ResponseModel<Boolean> delUseUnitEntry(@RequestParam(value = "sequenceNbr")String resultSeq) {
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.delUseUnitEntry(Long.valueOf(resultSeq))); return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.delUseUnitEntry(Long.valueOf(resultSeq)));
} }
/**
* 压力管道-报检结果接收
* @param resultData 结果信息
* @return List<JyjcInspectionResultDataModel>
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "报检结果接收", notes = "对外对接使用,支持单条及批量")
@PostMapping(value = "/pipeline/receive")
public ResponseModel<List<PipelineInspectionResultDto>> savePipelineResultDataBatch(@RequestBody List<PipelineInspectionResultDto> resultData){
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.receivePipelineResultData(resultData));
}
} }
...@@ -12,7 +12,7 @@ import java.util.List; ...@@ -12,7 +12,7 @@ import java.util.List;
@Getter @Getter
public class InspectionDetectionSaveToDbEvent extends ApplicationEvent { public class InspectionDetectionSaveToDbEvent extends ApplicationEvent {
private List<JyjcInspectionResult> jyjcInspectionResultList; private final List<JyjcInspectionResult> jyjcInspectionResultList;
/** /**
* Create a new {@code ApplicationEvent}. * Create a new {@code ApplicationEvent}.
......
package com.yeejoin.amos.boot.module.jyjc.biz.event;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import lombok.Getter;
import org.springframework.context.ApplicationEvent;
import java.util.List;
/**
* @author Administrator
*/
@Getter
public class UseInfoSaveToDbEvent extends ApplicationEvent {
private List<JyjcInspectionResult> jyjcInspectionResultList;
/**
* Create a new {@code ApplicationEvent}.
*
* @param source the object on which the event initially occurred or with
* which the event is associated (never {@code null})
*/
public UseInfoSaveToDbEvent(Object source, List<JyjcInspectionResult> jyjcInspectionResultList) {
super(source);
this.jyjcInspectionResultList = jyjcInspectionResultList;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.event.listener; package com.yeejoin.amos.boot.module.jyjc.biz.event.listener;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.biz.event.InspectionDetectionSaveToDbEvent; import com.yeejoin.amos.boot.module.jyjc.biz.event.InspectionDetectionSaveToDbEvent;
import com.yeejoin.amos.boot.module.jyjc.biz.event.listener.service.InspectionDetectionInfoUpdateService; import com.yeejoin.amos.boot.module.jyjc.biz.event.listener.service.InspectionDetectionInfoUpdateService;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.InspectionDetectionInfoMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.List;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;
/** /**
* @author Administrator * @author Administrator
...@@ -41,7 +29,7 @@ public class InspectionDetectionSaveToDbEventListener implements ApplicationList ...@@ -41,7 +29,7 @@ public class InspectionDetectionSaveToDbEventListener implements ApplicationList
private final BlockingQueue<JyjcInspectionResult> blockingQueue = new LinkedBlockingQueue<>(); private final BlockingQueue<JyjcInspectionResult> blockingQueue = new LinkedBlockingQueue<>();
private final InspectionDetectionInfoUpdateService updateService; private final InspectionDetectionInfoUpdateService updateService;
@Override @Override
...@@ -68,9 +56,4 @@ public class InspectionDetectionSaveToDbEventListener implements ApplicationList ...@@ -68,9 +56,4 @@ public class InspectionDetectionSaveToDbEventListener implements ApplicationList
} }
} }
package com.yeejoin.amos.boot.module.jyjc.biz.event.listener;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.biz.event.UseInfoSaveToDbEvent;
import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
/**
* @author Administrator
*/
@Component
@Slf4j
public class UseInfoSaveToDbEventListener implements ApplicationListener<UseInfoSaveToDbEvent> {
@Value("${user.info.save.thread.number:3}")
private int threadNumber;
@Autowired
UseInfoMapper useInfoMapper;
private BlockingQueue<JyjcInspectionResult> blockingQueue = new LinkedBlockingQueue<>();
@Override
public void onApplicationEvent(UseInfoSaveToDbEvent event) {
log.info("收到更新使用信息的检验检测字段消息:{}", JSONObject.toJSONString(event.getJyjcInspectionResultList()));
blockingQueue.addAll(event.getJyjcInspectionResultList());
}
@PostConstruct
public void init() {
ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);
for (int i = 0; i < threadNumber; i++) {
executorService.execute(() -> {
while (true) {
try {
JyjcInspectionResult jyjcInspectionResult = blockingQueue.take();
//更新使用信息表
useInfoMapper.updateByRecord(jyjcInspectionResult.getEquipUnicode(), jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo());
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
});
}
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.event.listener.result;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Sets;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultParamService;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionResultServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgInspectionDetectionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgTechParamsPipelineMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.*;
@Component
@RequiredArgsConstructor
public class BatchEquipResultDataProcessor implements SupportableResultDataProcessor {
private final IJyjcInspectionResultParamService iJyjcInspectionResultParamService;
private final ObjectMapper objectMapper;
private final IdxBizJgTechParamsPipelineMapper techParamPipelineMapper;
private final IdxBizJgInspectionDetectionInfoMapper inspectionDetectionInfoMapper;
private final BizEmqPublisher bizEmqPublisher;
private final CommonServiceImpl commonService;
private final SnowflakeIdUtil sequence;
private final UseInfoMapper useInfoMapper;
private final JyjcInspectionResultServiceImpl inspectionResultService;
private static final Set<String> SUPPORTED_TYPES = Sets.newHashSet(EquipmentClassifityEnum.YLGD.getCode());
@Override
public boolean support(String equList) {
return SUPPORTED_TYPES.contains(equList);
}
@Override
public void process(JyjcInspectionResult jyjcInspectionResult) {
Set<String> records = new HashSet<>();
JyjcInspectionResultParam param = iJyjcInspectionResultParamService.getOneParamByResultSeq(jyjcInspectionResult.getSequenceNbr());
if (!ObjectUtils.isEmpty(param.getParamJson())) {
JSONObject paramObj = JSON.parseObject(param.getParamJson());
try {
List<Map<String, Object>> equips = objectMapper.readValue(
objectMapper.writeValueAsString(paramObj.get("equip")),
new TypeReference<ArrayList<Map<String, Object>>>() {
}
);
equips.forEach(e -> {
String record = String.valueOf(e.get("equipId"));
records.add(record);
// 1.更新管道的技术参数
updateTechParams(e, record);
// 2.检验信息更新或者插入
IdxBizJgInspectionDetectionInfo info = new IdxBizJgInspectionDetectionInfo();
LambdaQueryWrapper<IdxBizJgInspectionDetectionInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizJgInspectionDetectionInfo::getResultSeq, jyjcInspectionResult.getSequenceNbr());
wrapper.eq(IdxBizJgInspectionDetectionInfo::getRecord, record);
List<IdxBizJgInspectionDetectionInfo> list = inspectionDetectionInfoMapper.selectList(wrapper);
JyjcInspectionResultAttachment jybgFile = inspectionResultService.getReportAttachment(jyjcInspectionResult.getSequenceNbr());
if (CollectionUtils.isEmpty(list)) {
// 无则插入
commonService.buildInspectInfo(jyjcInspectionResult, info, jybgFile, record);
info.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert");
} else {
// 已经维护过则更新
info = list.get(0);
commonService.buildInspectInfo(jyjcInspectionResult, info, jybgFile, record);
inspectionDetectionInfoMapper.updateById(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update");
}
// 3.更新使用信息表,最新检验信息
useInfoMapper.updateByRecord(record, jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo());
// 4.更新es下次检验日期
commonService.updateEquipNextInspectDate(jyjcInspectionResult, record);
});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
// 5.更新单据信息的json(公共)
inspectionResultService.updateHisDataAfterResultUpdate(jyjcInspectionResult.getApplicationNo());
// 6.发送数据刷新消息
inspectionResultService.sendDataRefreshMsg(records);
}
}
private void updateTechParams(Map<String, Object> e, String record) {
JyjcInspectionResultServiceImpl.doUpdatePipelineTechParams(e, record, techParamPipelineMapper);
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.event.listener.result;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
public interface ResultDataProcessor {
void process(JyjcInspectionResult jyjcInspectionResult);
}
package com.yeejoin.amos.boot.module.jyjc.biz.event.listener.result;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
public class ResultDataProcessorWrapper implements ResultDataProcessor {
private final SupportableResultDataProcessor delegate;
public ResultDataProcessorWrapper(SupportableResultDataProcessor delegate) {
this.delegate = delegate;
}
@Override
public void process(JyjcInspectionResult jyjcInspectionResult) {
delegate.process(jyjcInspectionResult);
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.event.listener.result;
import com.yeejoin.amos.component.robot.BadRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Component
@RequiredArgsConstructor
public class ResultProcessorFactory {
private final Map<String, ResultDataProcessor> processorMap = new ConcurrentHashMap<>();
private final List<SupportableResultDataProcessor> processors;
public ResultDataProcessor getProcessor(String equList) {
return processorMap.computeIfAbsent(equList, k ->
new ResultDataProcessorWrapper(
processors.stream()
.filter(p -> p.support(equList))
.findFirst()
.orElseThrow(() -> new BadRequest("No processor found for: " + equList))
)
);
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.event.listener.result;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Sets;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import com.yeejoin.amos.boot.module.common.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionResultServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgInspectionDetectionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Component
@RequiredArgsConstructor
@Slf4j
public class SingleEquipResultDataProcessor implements SupportableResultDataProcessor {
private final CommonServiceImpl commonService;
private final SnowflakeIdUtil sequence;
private final IdxBizJgInspectionDetectionInfoMapper inspectionDetectionInfoMapper;
private final BizEmqPublisher bizEmqPublisher;
private final UseInfoMapper useInfoMapper;
private final JyjcInspectionResultServiceImpl inspectionResultService;
private static final Set<String> SUPPORTED_TYPES = Sets.newHashSet(
EquipmentClassifityEnum.GL.getCode(),
EquipmentClassifityEnum.YLRQ.getCode(),
EquipmentClassifityEnum.DT.getCode(),
EquipmentClassifityEnum.QZJX.getCode(),
EquipmentClassifityEnum.CC.getCode(),
EquipmentClassifityEnum.YLSS.getCode(),
EquipmentClassifityEnum.KYSD.getCode()
);
@Override
public boolean support(String equList) {
return SUPPORTED_TYPES.contains(equList);
}
@Override
public void process(JyjcInspectionResult jyjcInspectionResult) {
IdxBizJgInspectionDetectionInfo info = new IdxBizJgInspectionDetectionInfo();
QueryWrapper<IdxBizJgInspectionDetectionInfo> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(IdxBizJgInspectionDetectionInfo::getInspectReportNo, jyjcInspectionResult.getSequenceNbr());
List<IdxBizJgInspectionDetectionInfo> list = inspectionDetectionInfoMapper.selectList(wrapper);
String record;
if (CollectionUtils.isEmpty(list)) {
fillInspectionFields(jyjcInspectionResult, info);
info.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(info);
record = info.getRecord();
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert");
} else {
info = list.get(0);
fillInspectionFields(jyjcInspectionResult, info);
inspectionDetectionInfoMapper.updateById(info);
record = info.getRecord();
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update");
}
try {
bizEmqPublisher.getEmqKeeper().getMqttClient().publish(String.format(TZSCommonConstant.DATA_REFRESH_TOPIC, DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.UPDATE), JSONObject.toJSONString(Collections.singletonList(record)).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) {
log.error("发送数据变更emq消息失败:{}", e.getMessage(), e);
}
// 3.更新使用信息表最新的检验信息
useInfoMapper.updateByRecord(jyjcInspectionResult.getEquipUnicode(), jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo());
// 4.es更新下次检验日期
commonService.updateEquipNextInspectDate(jyjcInspectionResult, jyjcInspectionResult.getEquipUnicode());
// 更新单据信息的json(公共)
inspectionResultService.updateHisDataAfterResultUpdate(jyjcInspectionResult.getApplicationNo());
// 发送数据刷新消息
inspectionResultService.sendDataRefreshMsg(Collections.singleton(record));
}
private void fillInspectionFields(JyjcInspectionResult jyjcInspectionResult, IdxBizJgInspectionDetectionInfo info) {
info.setInspectOrgName(jyjcInspectionResult.getInspectionTypeName());
info.setInspectType(jyjcInspectionResult.getInspectionType());
info.setRecord(jyjcInspectionResult.getEquipUnicode());
info.setInspectDate(jyjcInspectionResult.getInspectionDate());
info.setInspectStaff(getInspectUserName(jyjcInspectionResult));
info.setInspectStaffCode(jyjcInspectionResult.getInspector());
info.setInspectConclusion(jyjcInspectionResult.getInspectionConclusion());
info.setProblemRemark(jyjcInspectionResult.getNonConformance());
info.setNextInspectDate(jyjcInspectionResult.getNextInspectionDate());
info.setSequenceCode(jyjcInspectionResult.getEquipUnicode());
info.setInspectOrgCode(jyjcInspectionResult.getInspectionUnitCode());
info.setInspectReportNo(jyjcInspectionResult.getResultNo());
info.setRecDate(new Date());
}
private String getInspectUserName(JyjcInspectionResult model) {
List<TzsUserInfo> userInfos = commonService.getUserInfosByUnitCode(model.getInspectionUnitCode());
return userInfos.stream().filter(u -> model.getInspector().contains(u.getSequenceNbr() + "")).map(TzsUserInfo::getName).collect(Collectors.joining(","));
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.event.listener.result;
public interface SupportableResultDataProcessor extends ResultDataProcessor{
boolean support(String equList);
}
package com.yeejoin.amos.boot.module.jyjc.biz.event.listener.service; package com.yeejoin.amos.boot.module.jyjc.biz.event.listener.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher; import com.yeejoin.amos.boot.module.jyjc.biz.event.listener.result.ResultProcessorFactory;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonServiceImpl; import lombok.RequiredArgsConstructor;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.InspectionDetectionInfoMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
@RequiredArgsConstructor
public class InspectionDetectionInfoUpdateService { public class InspectionDetectionInfoUpdateService {
@Autowired private final ResultProcessorFactory resultProcessorFactory;
CommonServiceImpl commonService;
@Autowired
private SnowflakeIdUtil sequence;
@Autowired
InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
@Autowired
BizEmqPublisher bizEmqPublisher;
@Autowired
private EmqKeeper emqKeeper;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(JyjcInspectionResult jyjcInspectionResult) { public void update(JyjcInspectionResult jyjcInspectionResult) {
InspectionDetectionInfo info = new InspectionDetectionInfo(); resultProcessorFactory.getProcessor(jyjcInspectionResult.getEquList()).process(jyjcInspectionResult);
QueryWrapper<InspectionDetectionInfo> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(InspectionDetectionInfo::getInspectReportNo, jyjcInspectionResult.getResultNo());
List<InspectionDetectionInfo> list = inspectionDetectionInfoMapper.selectList(wrapper);
String record;
if (CollectionUtils.isEmpty(list)) {
fillInspectionFields(jyjcInspectionResult, info);
info.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(info);
record = info.getRecord();
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert");
} else {
info = list.get(0);
fillInspectionFields(jyjcInspectionResult, info);
inspectionDetectionInfoMapper.updateById(info);
record = info.getRecord();
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update");
}
try {
emqKeeper.getMqttClient().publish(String.format(TZSCommonConstant.DATA_REFRESH_TOPIC, DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.UPDATE), JSONObject.toJSONString(Collections.singletonList(record)).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) {
log.error("发送数据变更emq消息失败:{}", e.getMessage(), e);
}
}
private void fillInspectionFields(JyjcInspectionResult jyjcInspectionResult, InspectionDetectionInfo info) {
info.setInspectOrgName(jyjcInspectionResult.getInspectionTypeName());
info.setInspectType(jyjcInspectionResult.getInspectionType());
info.setRecord(jyjcInspectionResult.getEquipUnicode());
info.setInspectDate(jyjcInspectionResult.getInspectionDate());
info.setInspectStaff(getInspectUserName(jyjcInspectionResult));
info.setInspectStaffCode(jyjcInspectionResult.getInspector());
info.setInspectConclusion(jyjcInspectionResult.getInspectionConclusion());
info.setProblemRemark(jyjcInspectionResult.getNonConformance());
info.setNextInspectDate(jyjcInspectionResult.getNextInspectionDate());
info.setSequenceCode(jyjcInspectionResult.getEquipUnicode());
info.setInspectOrgCode(jyjcInspectionResult.getInspectionUnitCode());
info.setInspectReportNo(jyjcInspectionResult.getResultNo());
info.setRecDate(new Date());
} }
private String getInspectUserName(JyjcInspectionResult model) {
List<TzsUserInfo> userInfos = commonService.getUserInfosByUnitCode(model.getInspectionUnitCode());
return userInfos.stream().filter(u -> model.getInspector().contains(u.getSequenceNbr() + "")).map(TzsUserInfo::getName).collect(Collectors.joining(","));
}
} }
package com.yeejoin.amos.boot.module.jyjc.biz.event.publisher; package com.yeejoin.amos.boot.module.jyjc.biz.event.publisher;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -15,6 +16,7 @@ import java.util.List; ...@@ -15,6 +16,7 @@ import java.util.List;
*/ */
@Component @Component
@Slf4j @Slf4j
@Getter
public class BizEmqPublisher { public class BizEmqPublisher {
private final EmqKeeper emqKeeper; private final EmqKeeper emqKeeper;
...@@ -29,14 +31,14 @@ public class BizEmqPublisher { ...@@ -29,14 +31,14 @@ public class BizEmqPublisher {
private static final String INSPECTION_DETECTION_SAVE_TO_DB_TOPIC_PREFIX = "safetyProblemTracing/jy/bj"; private static final String INSPECTION_DETECTION_SAVE_TO_DB_TOPIC_PREFIX = "safetyProblemTracing/jy/bj";
private static final String INSPECTION_DETECTION_SAVE_TO_DB_TOPIC_TYPE_UPDATE = "update"; private static final String INSPECTION_DETECTION_SAVE_TO_DB_TOPIC_TYPE_UPDATE = "update";
public void sendInspectionMsgAfterSave(InspectionDetectionInfo info, String type) { public void sendInspectionMsgAfterSave(IdxBizJgInspectionDetectionInfo info, String type) {
try { try {
if (emqKeeper.getMqttClient() == null) { if (emqKeeper.getMqttClient() == null) {
return; return;
} }
// 安全追溯目前只需要type=update的信息 // 安全追溯目前只需要type=update的信息
if (INSPECTION_DETECTION_SAVE_TO_DB_TOPIC_TYPE_UPDATE.equals(type)) { if (INSPECTION_DETECTION_SAVE_TO_DB_TOPIC_TYPE_UPDATE.equals(type)) {
List<InspectionDetectionInfo> list = new ArrayList<>(); List<IdxBizJgInspectionDetectionInfo> list = new ArrayList<>();
list.add(info); list.add(info);
emqKeeper.getMqttClient().publish(this.buildSave2DbEmqTopic(type), JSON.toJSONBytes(list), 2, false); emqKeeper.getMqttClient().publish(this.buildSave2DbEmqTopic(type), JSON.toJSONBytes(list), 2, false);
} }
......
...@@ -10,13 +10,12 @@ import org.springframework.stereotype.Component; ...@@ -10,13 +10,12 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
public class EventPublisher { public class EventPublisher {
private ApplicationEventPublisher publisher; private final ApplicationEventPublisher publisher;
public EventPublisher(ApplicationEventPublisher publisher) { public EventPublisher(ApplicationEventPublisher publisher) {
this.publisher = publisher; this.publisher = publisher;
} }
@Async
public void publish(ApplicationEvent event) { public void publish(ApplicationEvent event) {
publisher.publishEvent(event); publisher.publishEvent(event);
} }
......
...@@ -36,25 +36,4 @@ public class JyjcInspectionApplicationPushLogServiceImpl extends BaseService<Jyj ...@@ -36,25 +36,4 @@ public class JyjcInspectionApplicationPushLogServiceImpl extends BaseService<Jyj
return this.queryForList("" , false); return this.queryForList("" , false);
} }
/**
* 记录日志
*
*
* @param params params
* @return {@link boolean}
* @author yangyang
* @throws
* @date 2023/12/15 15:53
*/
public boolean saveInspectionApplicationPushLog(Map<String, Object> params) {
JyjcInspectionApplicationModel inspectionApplicationModel = (JyjcInspectionApplicationModel) params.get("inspectionApplication");
List<JyjcInspectionApplicationEquipModel> applicationEquipModels = (List<JyjcInspectionApplicationEquipModel>) params.get("applicationEquips");
JyjcInspectionApplicationPushLog logEntity = new JyjcInspectionApplicationPushLog();
logEntity.setApplicationSeq(inspectionApplicationModel.getSequenceNbr());
logEntity.setInspectionUnitCode(inspectionApplicationModel.getInspectionUnitCode());
logEntity.setPushData(JSON.toJSONString(applicationEquipModels));
logEntity.setPushStatus("0");
return this.save(logEntity);
}
} }
\ No newline at end of file
...@@ -39,4 +39,11 @@ public class JyjcInspectionResultAttachmentServiceImpl extends BaseService<JyjcI ...@@ -39,4 +39,11 @@ public class JyjcInspectionResultAttachmentServiceImpl extends BaseService<JyjcI
wrapper.eq(JyjcInspectionResultAttachment::getResultSeq, resultSeq); wrapper.eq(JyjcInspectionResultAttachment::getResultSeq, resultSeq);
return this.baseMapper.selectList(wrapper); return this.baseMapper.selectList(wrapper);
} }
public JyjcInspectionResultAttachment getOneByUniKey(Long resultSeq, String attachmentType) {
LambdaQueryWrapper<JyjcInspectionResultAttachment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(JyjcInspectionResultAttachment::getResultSeq, resultSeq);
wrapper.likeLeft(JyjcInspectionResultAttachment::getAttachmentType, attachmentType);
return this.baseMapper.selectOne(wrapper);
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.typeHandler;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.typeHandler.TypeHandler;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 特种设备目录处理器
*/
@Component("equipCategoryTypeHandler")
@RequiredArgsConstructor
public class EquipCategoryTypeHandler implements TypeHandler<String> {
private final Map<String, String> CODE_NAME_MAP = new ConcurrentHashMap<>();
private final EquipmentCategoryMapper equipmentCategoryMapper;
@Override
public String handle(String code) {
return code != null ? CODE_NAME_MAP.computeIfAbsent(code, (k) -> {
EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode, code).select(EquipmentCategory::getName, EquipmentCategory::getId));
return equipmentCategory == null ? "" : equipmentCategory.getName();
}) : null;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.util;
public class CompareUtils {
public static boolean isNullOrEmpty(String str) {
return str == null || str.trim().isEmpty() || "null".equals(str);
}
}
...@@ -65,13 +65,13 @@ spring.kafka.security.protocol=SASL_PLAINTEXT ...@@ -65,13 +65,13 @@ spring.kafka.security.protocol=SASL_PLAINTEXT
spring.kafka.properties.sasl.mechanism=PLAIN spring.kafka.properties.sasl.mechanism=PLAIN
#定期检验是否启用规则:true-启用,false-不启用,默认不配置时不启动规则 #定期检验是否启用规则:true-启用,false-不启用,默认不配置时不启动规则
inspection.rule.enabled.DQJY=true inspection.rule.enabled.DQJY=false
#安装监督检验是否启用规则:true-启用,false-不启用 #安装监督检验是否启用规则:true-启用,false-不启用
inspection.rule.enabled.AZJDJY=true inspection.rule.enabled.AZJDJY=false
#改造监督检验是否启用规则:true-启用,false-不启用 #改造监督检验是否启用规则:true-启用,false-不启用
inspection.rule.enabled.GZJDJY=true inspection.rule.enabled.GZJDJY=false
#维修监督检验是否启用规则:true-启用,false-不启用 #维修监督检验是否启用规则:true-启用,false-不启用
inspection.rule.enabled.WXJDJY=true inspection.rule.enabled.WXJDJY=false
#电梯检测是否启用规则:true-启用,false-不启用 #电梯检测是否启用规则:true-启用,false-不启用
inspection.rule.enabled.DTJC=true inspection.rule.enabled.DTJC=false
inspection.rule.enabled.WTJY=true inspection.rule.enabled.WTJY=false
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ymt.api.mapper; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ymt.api.mapper;
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.common.api.dto.ContraptionQueryParams;
import com.yeejoin.amos.boot.module.ymt.api.dto.ProjectWaitRefreshDataQualityScore; import com.yeejoin.amos.boot.module.ymt.api.dto.ProjectWaitRefreshDataQualityScore;
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;
...@@ -66,12 +67,11 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro ...@@ -66,12 +67,11 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
* 查询检验的装置 * 查询检验的装置
* *
* @param page 分页 * @param page 分页
* @param inspectionType 检验类型 * @param queryParams 查询参数
* @param companyCode 公司code * @param companyCode 公司code
* @param equCategory 设备类别
* @return 分页 * @return 分页
*/ */
IPage<IdxBizJgProjectContraption> queryJgProjectContraptionPage(Page<IdxBizJgProjectContraption> page, @Param("inspectionType") String inspectionType, @Param("companyCode") String companyCode, @Param("equCategory") String equCategory); IPage<IdxBizJgProjectContraption> queryJgProjectContraptionPage(Page<IdxBizJgProjectContraption> page, @Param("params") ContraptionQueryParams queryParams, @Param("companyCode") String companyCode);
/** /**
* 获取管道信息分页 * 获取管道信息分页
......
...@@ -280,15 +280,30 @@ ...@@ -280,15 +280,30 @@
idx_biz_jg_project_contraption pc idx_biz_jg_project_contraption pc
where where
1=1 1=1
<if test="params.equList != null and params.equList != ''">
and pc.equ_list= #{params.equList}
</if>
<if test="params.equCategory != null and params.equCategory != ''">
and pc.equ_category= #{params.equCategory}
</if>
<if test="params.equDefine != null and params.equDefine != ''">
and pc.equ_define= #{params.equDefine}
</if>
<if test="params.city != null and params.city != ''">
and pc.city= #{params.city}
</if>
<if test="params.county != null and params.county != ''">
and pc.county= #{params.county}
</if>
<choose> <choose>
<when test="inspectionType == 'AZJDJY'"> <when test="params.inspectionType == 'AZJDJY'">
and pc.usc_unit_credit_code=#{companyCode} and pc.usc_unit_credit_code=#{companyCode}
and pc.is_into_management = true and pc.is_into_management = true
and (pc.use_registration_code is null or pc.use_registration_code = '' ) and (pc.use_registration_code is null or pc.use_registration_code = '' )
</when> </when>
<otherwise> <otherwise>
<choose> <choose>
<when test="equCategory == '8300'"> <when test="params.equCategory == '8300'">
and pc.use_unit_credit_code=#{companyCode} and pc.use_unit_credit_code=#{companyCode}
and pc.is_into_management = true and pc.is_into_management = true
and pc.use_registration_code <![CDATA[<>]]> '' and pc.use_registration_code <![CDATA[<>]]> ''
...@@ -302,10 +317,9 @@ ...@@ -302,10 +317,9 @@
</choose> </choose>
and not EXISTS (SELECt 1 FROM tz_jyjc_inspection_application a where a.status='6611' and a.application_unit_code=#{companyCode} and a.project_contraption_id = pc.sequence_nbr) and not EXISTS (SELECt 1 FROM tz_jyjc_inspection_application a where a.status='6611' and a.application_unit_code=#{companyCode} and a.project_contraption_id = pc.sequence_nbr)
and (pc.project_contraption_parent_id is null or pc.project_contraption_parent_id = '') and (pc.project_contraption_parent_id is null or pc.project_contraption_parent_id = '')
and pc.equ_category = #{equCategory}
) s ) s
<where> <where>
<if test="inspectionType == 'DQJY' and equCategory != '8300'"> <if test="params.inspectionType == 'DQJY' and params.equCategory != '8300'">
s.inspectNum = s.totalNum s.inspectNum = s.totalNum
and s.inspectNum > 0 and s.inspectNum > 0
</if> </if>
......
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