Commit a2f3a42b authored by suhuiguang's avatar suhuiguang

1.检验检验过滤技术参数核对

2.安全追溯检验结果信息发送
parent a5d7fe7e
......@@ -143,12 +143,6 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
}
}
private List<String> getCanDealInspectionType() {
List<String> canDealInspectionTypes = new ArrayList<>(JDJY_ARRAY);
canDealInspectionTypes.addAll(DSJ_ARRAY);
return canDealInspectionTypes;
}
private void pushData2Kafka(String dockingUnitCode, JyjcInspectionApplicationPushLog pushLog) {
// 发送kafka指定的主题
String topic = String.format(INSPECTION_APPLICATION_PUSH_TOPIC, dockingUnitCode);
......@@ -171,6 +165,12 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
return pushLog;
}
private List<String> getCanDealInspectionType() {
List<String> canDealInspectionTypes = new ArrayList<>(JDJY_ARRAY);
canDealInspectionTypes.addAll(DSJ_ARRAY);
return canDealInspectionTypes;
}
private String buildData(long traceId, JyjcInspectionApplicationModel applicationModel) {
InspectionApplicationPushData pushData = new InspectionApplicationPushData();
BeanUtil.copyProperties(applicationModel, pushData);
......
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
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.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;
......@@ -44,8 +45,14 @@ public class InspectionDetectionSaveToDbEventListener implements ApplicationList
@Autowired
InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
@Autowired
BizEmqPublisher bizEmqPublisher;
private BlockingQueue<JyjcInspectionResult> blockingQueue = new LinkedBlockingQueue<>();
@Override
public void onApplicationEvent(InspectionDetectionSaveToDbEvent event) {
log.info("收到检验检测信息插入或者更新消息:{}", JSONObject.toJSONString(event.getJyjcInspectionResultList()));
......@@ -65,13 +72,15 @@ public class InspectionDetectionSaveToDbEventListener implements ApplicationList
wrapper.lambda().eq(InspectionDetectionInfo::getInspectReportNo, jyjcInspectionResult.getResultNo());
List<InspectionDetectionInfo> list = inspectionDetectionInfoMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
extracted(jyjcInspectionResult, info);
fillInspectionFields(jyjcInspectionResult, info);
info.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(info);
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert");
} else {
info = list.get(0);
extracted(jyjcInspectionResult, info);
fillInspectionFields(jyjcInspectionResult, info);
inspectionDetectionInfoMapper.updateById(info);
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update");
}
} catch (Exception e) {
log.error(e.getMessage(), e);
......@@ -82,7 +91,11 @@ public class InspectionDetectionSaveToDbEventListener implements ApplicationList
}
}
private void extracted(JyjcInspectionResult jyjcInspectionResult, InspectionDetectionInfo info) {
private void fillInspectionFields(JyjcInspectionResult jyjcInspectionResult, InspectionDetectionInfo info) {
info.setInspectOrgName(jyjcInspectionResult.getInspectionTypeName());
info.setInspectType(jyjcInspectionResult.getInspectionType());
info.setRecord(jyjcInspectionResult.getEquipUnicode());
......
package com.yeejoin.amos.boot.module.jyjc.biz.event.publisher;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
/**
* @author Administrator
*/
@Component
@Slf4j
public class BizEmqPublisher {
private EmqKeeper emqKeeper;
public BizEmqPublisher(EmqKeeper emqKeeper) {
this.emqKeeper = emqKeeper;
}
/**
* 检验检测结果入库消息
*/
private static final String INSPECTION_DETECTION_SAVE_TO_DB_TOPIC_PREFIX = "safetyProblemTracing/jy/bj";
public void sendInspectionMsgAfterSave(InspectionDetectionInfo info, String type) {
try {
emqKeeper.getMqttClient().publish(this.buildSave2DbEmqTopic(type), JSON.toJSONBytes(info), 2, false);
} catch (MqttException e) {
log.error("发送检验检测信息入库消息失败", e);
}
}
private String buildSave2DbEmqTopic(String type) {
return String.format("%s/%s", INSPECTION_DETECTION_SAVE_TO_DB_TOPIC_PREFIX, type);
}
}
......@@ -14,7 +14,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcBaseMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.TaskModelDto;
import com.yeejoin.amos.boot.module.jyjc.api.model.WorkflowResultDto;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CmWorkflowServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
......
......@@ -6,7 +6,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionResultParamMapper;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultParamService;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultParamModel;
import com.yeejoin.amos.boot.module.jyjc.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.util.ObjectUtils;
......
......@@ -26,8 +26,9 @@ import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultParamS
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultService;
import com.yeejoin.amos.boot.module.jyjc.biz.event.InspectionDetectionSaveToDbEvent;
import com.yeejoin.amos.boot.module.jyjc.biz.event.UseInfoSaveToDbEvent;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils;
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.enums.EquipmentClassifityEnum;
......@@ -108,6 +109,9 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
@Autowired
EventPublisher eventPublisher;
@Autowired
BizEmqPublisher bizEmqPublisher;
/**
* 检验检测单位分页查询
*/
......@@ -264,10 +268,14 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
extracted(model, info, jybgFile);
info.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert");
} else {
info = list.get(0);
extracted(model, info, jybgFile);
inspectionDetectionInfoMapper.updateById(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update");
}
//更新使用信息表
useInfoMapper.updateByRecord(model.getEquipUnicode(), model.getNextInspectionDate(), model.getInspectionType(), model.getApplicationNo());
......
package com.yeejoin.amos.boot.module.jyjc.biz.util;
/**
* @author Administrator
*/
public class JyjcConstant {
/**
* 技术参数json类型字段
*/
public static final String[] TECH_PARAM_JSON_FIELDS = {"safetyAccessoriesAndRelatedDevices", "gasCylinderAccessories"};
}
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