Commit c88b4ead authored by tianbo's avatar tianbo

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

parents 3b2027ba 89921fb2
...@@ -166,6 +166,9 @@ public class SafetyProblemTracingDto extends BaseDto { ...@@ -166,6 +166,9 @@ public class SafetyProblemTracingDto extends BaseDto {
@ApiModelProperty(value = "首次使用截止日期/延长使用截止日期") @ApiModelProperty(value = "首次使用截止日期/延长使用截止日期")
private String useDeadline; private String useDeadline;
@ApiModelProperty(value = "取消原因")
private String cancelReason;
@Data @Data
@Getter @Getter
@Setter @Setter
......
...@@ -15,7 +15,8 @@ public enum SafetyProblemStatusEnum { ...@@ -15,7 +15,8 @@ public enum SafetyProblemStatusEnum {
*/ */
UNHANDLED("0", "未处理", "red"), UNHANDLED("0", "未处理", "red"),
HANDLED("1", "已处理", "green"); HANDLED("1", "已处理", "green"),
SCRAP("2", "取消", "grey");
private final String code; private final String code;
......
...@@ -21,9 +21,7 @@ public enum SafetyProblemTypeEnum { ...@@ -21,9 +21,7 @@ public enum SafetyProblemTypeEnum {
XKCQ("5", "3", "许可超期", "企业许可超期", "safetyProblemTracing/xk/cq", null), XKCQ("5", "3", "许可超期", "企业许可超期", "safetyProblemTracing/xk/cq", null),
ZZCQ("6", "9", "资质超期", "人员资质超期", "safetyProblemTracing/zz/cq", null), ZZCQ("6", "9", "资质超期", "人员资质超期", "safetyProblemTracing/zz/cq", null),
SJNXCQ("7", "5", "超设计年限", "设备超设计年限", "safetyProblemTracing/synx/cq", null), SJNXCQ("7", "5", "超设计年限", "设备超设计年限", "safetyProblemTracing/synx/cq", null),
SJNXDJ("8", "5", "超设计年限登记", "超设计年限登记", "safetyProblemTracing/synx/dj", null), SJNXDJ("8", "5", "超设计年限登记", "超设计年限登记", "safetyProblemTracing/synx/dj", null);
SBBF("9", "4", "设备报废", "设备办理报废业务", "safetyProblemTracing/sb/bf", null),
SBBFCX("10", "4", "设备报废撤销", "设备办理报废业务撤销", "safetyProblemTracing/sb/bfcx", null);
/** /**
* 数据主键 * 数据主键
......
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.event.SafetyProblemEvent;
import com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.SafetyProblemTracingServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* SBBFCXEventHandler 类实现了 SafetyProblemEventHandler 接口,
* 用于处理设备报废撤销问题事件。
*/
@Component
public class SBBFCXEventHandler implements SafetyProblemEventHandler {
private SafetyProblemTracingServiceImpl safetyProblemTracingService;
@Autowired
public SBBFCXEventHandler(SafetyProblemTracingServiceImpl safetyProblemTracingService) {
this.safetyProblemTracingService = safetyProblemTracingService;
}
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数用于描述发生的安全问题事件。
*/
@Override
public void handle(SafetyProblemEvent event) {
// 此处为处理安全问题事件的逻辑代码
JSONArray jsonArray = JSONObject.parseArray(event.getMessage().toString());
handleProblem(jsonArray);
}
private void handleProblem(JSONArray jsonArray) {
// TODO 后续增加设备报废撤销问题处理逻辑
// safetyProblemTracingService.recoverProblemBySourceId(jsonArray);
}
}
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.service.impl.SafetyProblemTracingServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList;
import java.util.List;
/**
* SBBFEventHandler 类实现了 SafetyProblemEventHandler 接口,
* 用于处理设备报废问题事件。
*/
@Component
public class SBBFEventHandler implements SafetyProblemEventHandler {
private SafetyProblemTracingServiceImpl safetyProblemTracingService;
@Autowired
public SBBFEventHandler(SafetyProblemTracingServiceImpl safetyProblemTracingService) {
this.safetyProblemTracingService = safetyProblemTracingService;
}
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数用于描述发生的安全问题事件。
*/
@Override
public void handle(SafetyProblemEvent event) {
// 此处为处理安全问题事件的逻辑代码
JSONArray jsonArray = JSONObject.parseArray(event.getMessage().toString());
handleProblem(jsonArray);
}
private void handleProblem(JSONArray jsonArray) {
List<String> records = new ArrayList<>();
for (int i = 0; i < jsonArray.size() && !ValidationUtil.isEmpty(jsonArray.get(i)); i++) {
records.add(jsonArray.get(i).toString());
}
safetyProblemTracingService.deleteBySourceId(records, SafetyProblemTypeEnum.SBBF.getName());
}
}
...@@ -38,10 +38,6 @@ public class SafetyProblemEventHandlerFactory { ...@@ -38,10 +38,6 @@ public class SafetyProblemEventHandlerFactory {
return new SJNXCQEventHandler(safetyProblemTracingService); return new SJNXCQEventHandler(safetyProblemTracingService);
} else if (topic.startsWith(SafetyProblemTypeEnum.SJNXDJ.getTopic())) { } else if (topic.startsWith(SafetyProblemTypeEnum.SJNXDJ.getTopic())) {
return new SJNXDJEventHandler(equipmentProblemStrategy); return new SJNXDJEventHandler(equipmentProblemStrategy);
} else if (topic.startsWith(SafetyProblemTypeEnum.SBBF.getTopic())) {
return new SBBFEventHandler(safetyProblemTracingService);
} else if (topic.startsWith(SafetyProblemTypeEnum.SBBFCX.getTopic())) {
return new SBBFCXEventHandler(safetyProblemTracingService);
} else { } else {
// 其他策略类的创建 // 其他策略类的创建
throw new IllegalArgumentException("Unsupported topic: " + topic); throw new IllegalArgumentException("Unsupported topic: " + topic);
......
...@@ -2646,9 +2646,10 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2646,9 +2646,10 @@ public class CommonServiceImpl implements ICommonService {
formData.put("equCategory", category != null ? category.getName() : null); formData.put("equCategory", category != null ? category.getName() : null);
} }
//检验类型 台套模版 //检验类型 台套模版
if (formData.containsKey("inspectType")) { Optional.ofNullable(formData.getString("inspectType"))
formData.put("inspectType", JYJCBusinessTypeEnum.getNameByCode(formData.getString("inspectType")).getName()); .map(JYJCBusinessTypeEnum::getNameByCode)
} .map(JYJCBusinessTypeEnum::getName)
.ifPresent(name -> formData.put("inspectType", name));
//检验结论 台套模版 //检验结论 台套模版
if (formData.containsKey("inspectConclusion")) { if (formData.containsKey("inspectConclusion")) {
formData.put("inspectConclusion", JYJCResultEnum.getNameByCode(formData.getString("inspectConclusion")).getName()); formData.put("inspectConclusion", JYJCResultEnum.getNameByCode(formData.getString("inspectConclusion")).getName());
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -47,6 +46,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; ...@@ -47,6 +46,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
...@@ -56,7 +56,6 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; ...@@ -56,7 +56,6 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO; import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO; import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import io.seata.spring.annotation.GlobalTransactional; import io.seata.spring.annotation.GlobalTransactional;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -76,7 +75,6 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -76,7 +75,6 @@ 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 org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -118,7 +116,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -118,7 +116,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
private IdxBizJgUseInfoMapper idxBizJgUseInfoMapper; private IdxBizJgUseInfoMapper idxBizJgUseInfoMapper;
@Autowired @Autowired
private JgRegistrationHistoryMapper jgRegistrationHistoryMapper; private JgRegistrationHistoryMapper jgRegistrationHistoryMapper;
@Autowired
private IdxBizJgOtherInfoMapper idxBizJgOtherInfoMapper;
@Autowired @Autowired
private RedissonClient redissonClient; private RedissonClient redissonClient;
...@@ -1142,7 +1141,10 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -1142,7 +1141,10 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
equState = EquipmentEnum.ZHUXIAO.getCode(); equState = EquipmentEnum.ZHUXIAO.getCode();
} }
Integer finalEquState = equState; Integer finalEquState = equState;
equipmentCategoryDtos.forEach(e-> e.setEQU_STATE(finalEquState)); equipmentCategoryDtos.forEach(e-> {
e.setEQU_STATE(finalEquState);
e.setProblemStatus(SafetyProblemStatusEnum.SCRAP.getCode());
});
return StreamSupport.stream(equipmentCategoryDtos.spliterator(), false).collect(Collectors.toList()); return StreamSupport.stream(equipmentCategoryDtos.spliterator(), false).collect(Collectors.toList());
} }
...@@ -1170,18 +1172,6 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -1170,18 +1172,6 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
lambdaEq.select(JgScrapCancelEq::getEquId); lambdaEq.select(JgScrapCancelEq::getEquId);
List<String> records = jgScrapCancelEqService.list(lambdaEq).stream().map(JgScrapCancelEq::getEquId).collect(Collectors.toList()); List<String> records = jgScrapCancelEqService.list(lambdaEq).stream().map(JgScrapCancelEq::getEquId).collect(Collectors.toList());
eventPublisher.publish(new DataRefreshEvent(this, records, DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.UPDATE)); eventPublisher.publish(new DataRefreshEvent(this, records, DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.UPDATE));
// 发送更新设备安全追溯问题消息
if (CollectionUtil.isNotEmpty(records)) {
try {
JSONArray jsonArray = new JSONArray();
jsonArray.addAll(records);
emqKeeper.getMqttClient().publish(SafetyProblemTypeEnum.SBBF.getTopic(), jsonArray.toJSONString().getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) {
logger.error("发送设备报废消息失败---->{}", e.getMessage());
throw new RuntimeException(e);
}
}
} }
private List<String> updateInfoOther(JgScrapCancel jgScrapCancel, String routePath) { private List<String> updateInfoOther(JgScrapCancel jgScrapCancel, String routePath) {
...@@ -1198,6 +1188,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -1198,6 +1188,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
Map<String, Map<String, Object>> resultMap = new HashMap<>(); Map<String, Map<String, Object>> resultMap = new HashMap<>();
if (CancelTypeEnum.SCRAPPED.getCode().equals(jgScrapCancel.getCancelType())) { if (CancelTypeEnum.SCRAPPED.getCode().equals(jgScrapCancel.getCancelType())) {
idxBizJgUseInfoMapper.batchUpdateUseInfo(equipIds, EquipmentEnum.BAOFEI.getCode()); idxBizJgUseInfoMapper.batchUpdateUseInfo(equipIds, EquipmentEnum.BAOFEI.getCode());
// 设备的安全追溯问题聚合状态改为报废
idxBizJgOtherInfoMapper.batchUpdateOtherInfo(equipIds);
map1.put("EQU_STATE", String.valueOf(EquipmentEnum.BAOFEI.getCode())); map1.put("EQU_STATE", String.valueOf(EquipmentEnum.BAOFEI.getCode()));
// 修改证管理表中的证的状态 // 修改证管理表中的证的状态
if (!EquipmentClassifityEnum.YLGD.getCode().equals(jgScrapCancel.getEquListCode())) { if (!EquipmentClassifityEnum.YLGD.getCode().equals(jgScrapCancel.getEquListCode())) {
......
...@@ -33,6 +33,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo; ...@@ -33,6 +33,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo;
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.enums.EquipmentEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -135,9 +136,7 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr ...@@ -135,9 +136,7 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
queryWrapper.eq(SafetyProblemTracing::getSequenceNbr, sequenceNbr); queryWrapper.eq(SafetyProblemTracing::getSequenceNbr, sequenceNbr);
SafetyProblemTracing problem = this.baseMapper.selectOne(queryWrapper); SafetyProblemTracing problem = this.baseMapper.selectOne(queryWrapper);
BeanUtil.copyProperties(problem, entity); BeanUtil.copyProperties(problem, entity);
Map<String, String> problemStatusObj = new HashMap<>(); String cancelReason;
problemStatusObj.put("problemStatusCode", entity.getProblemStatusCode());
entity.setProblemStatusObj(problemStatusObj);
if (!ValidationUtil.isEmpty(problem.getExtraInfo())) { if (!ValidationUtil.isEmpty(problem.getExtraInfo())) {
try { try {
JSONObject jsonObject = JSONObject.parseObject(entity.getExtraInfo()); JSONObject jsonObject = JSONObject.parseObject(entity.getExtraInfo());
...@@ -154,11 +153,22 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr ...@@ -154,11 +153,22 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
if (jsonObject.containsKey("useDeadline")) { if (jsonObject.containsKey("useDeadline")) {
entity.setUseDeadline(jsonObject.getString("useDeadline")); entity.setUseDeadline(jsonObject.getString("useDeadline"));
} }
if (jsonObject.containsKey("cancelReason")) {
cancelReason = jsonObject.getString("cancelReason");
entity.setCancelReason(cancelReason);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("extraInfo解析失败", e); log.error("extraInfo解析失败", e);
} }
} }
Map<String, String> problemStatusObj = new HashMap<>();
if (!ValidationUtil.isEmpty(entity.getCancelReason())) {
problemStatusObj.put("problemStatusCode", SafetyProblemStatusEnum.SCRAP.getCode());
} else {
problemStatusObj.put("problemStatusCode", entity.getProblemStatusCode());
}
entity.setProblemStatusObj(problemStatusObj);
return entity; return entity;
} }
...@@ -279,7 +289,8 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr ...@@ -279,7 +289,8 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
safetyProblemTracings.forEach(item -> { safetyProblemTracings.forEach(item -> {
// 设备问题标记为删除状态。但处理状态保留 // 设备问题标记为删除状态。但处理状态保留
item.setIsDelete(true); item.setIsDelete(true);
JSONObject extraInfo = new JSONObject(); String extraInfoStr = item.getExtraInfo();
JSONObject extraInfo = ValidationUtil.isEmpty(extraInfoStr) ? new JSONObject() : JSONObject.parseObject(extraInfoStr);
extraInfo.put("deleteReason", deleteReason); extraInfo.put("deleteReason", deleteReason);
item.setExtraInfo(extraInfo.toJSONString()); item.setExtraInfo(extraInfo.toJSONString());
}); });
...@@ -289,6 +300,30 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr ...@@ -289,6 +300,30 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
} }
/** /**
* 根据sourceId取消安全追溯问题
*
* @param sourceIds 问题源id
* @param cancelReason 取消原因
*/
@Transactional
public void cancelBySourceId(List<String> sourceIds, String cancelReason) {
List<SafetyProblemTracing> safetyProblemTracings = this.baseMapper.selectList(
new LambdaQueryWrapper<SafetyProblemTracing>().in(SafetyProblemTracing::getSourceId, sourceIds)
.eq(SafetyProblemTracing::getIsDelete, false));
if (!ValidationUtil.isEmpty(safetyProblemTracings)) {
safetyProblemTracings.forEach(item -> {
String extraInfoStr = item.getExtraInfo();
JSONObject extraInfo = ValidationUtil.isEmpty(extraInfoStr) ? new JSONObject() : JSONObject.parseObject(extraInfoStr);
extraInfo.put("cancelReason", cancelReason);
item.setExtraInfo(extraInfo.toJSONString());
});
// 批量更新
this.updateBatchById(safetyProblemTracings);
}
}
/**
* 根据源id更新问题 * 根据源id更新问题
* *
* @param record 问题源记录 * @param record 问题源记录
...@@ -300,6 +335,12 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr ...@@ -300,6 +335,12 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
public void updateBySourceId(String record, Map<String, Object> detail, public void updateBySourceId(String record, Map<String, Object> detail,
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo, IdxBizJgInspectionDetectionInfo inspectionDetectionInfo,
IdxBizJgMaintenanceRecordInfo lastMaintenanceRecordInfo) { IdxBizJgMaintenanceRecordInfo lastMaintenanceRecordInfo) {
// 如果设备是报废的,则更新问题的extend字段,标识是报废的设备
if (EquipmentEnum.BAOFEI.getCode().toString().equals(detail.get("EQU_STATE"))) {
cancelBySourceId(Collections.singletonList(record), "设备报废");
return;
}
LambdaQueryWrapper<SafetyProblemTracing> queryWrapper = new LambdaQueryWrapper<SafetyProblemTracing>() LambdaQueryWrapper<SafetyProblemTracing> queryWrapper = new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getSourceId, record) .eq(SafetyProblemTracing::getSourceId, record)
.eq(SafetyProblemTracing::getIsDelete, false) .eq(SafetyProblemTracing::getIsDelete, false)
...@@ -373,26 +414,4 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr ...@@ -373,26 +414,4 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
records.forEach(record -> fieldMap.put(record, MapUtil.of("problemStatus", SafetyProblemStatusEnum.HANDLED.getCode()))); records.forEach(record -> fieldMap.put(record, MapUtil.of("problemStatus", SafetyProblemStatusEnum.HANDLED.getCode())));
return fieldMap; return fieldMap;
} }
@Transactional
public void recoverProblemBySourceId(List<String> sourceIds) {
// 查询条件:sourceId 在列表中,且 extraInfo 包含 deleteReason 为设备报废的记录
String deleteReasonJson = "\"deleteReason\":" + SafetyProblemTypeEnum.SBBF.getName();
List<SafetyProblemTracing> safetyProblemTracings = this.baseMapper.selectList(
new LambdaQueryWrapper<SafetyProblemTracing>()
.in(SafetyProblemTracing::getSourceId, sourceIds)
.like(SafetyProblemTracing::getExtraInfo, deleteReasonJson));
if (!ValidationUtil.isEmpty(safetyProblemTracings)) {
safetyProblemTracings.forEach(item -> {
// 设备问题恢复为未删除状态。
item.setIsDelete(false);
JSONObject extraInfo = new JSONObject();
extraInfo.put("deleteReason", null);
item.setExtraInfo(extraInfo.toJSONString());
});
// 批量更新
this.updateBatchById(safetyProblemTracings);
}
}
} }
\ No newline at end of file
...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.biz.common.utils.StringUtils; ...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.biz.common.utils.StringUtils;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.DpSubUtils; import com.yeejoin.amos.boot.module.statistcs.biz.utils.DpSubUtils;
import com.yeejoin.amos.boot.module.statistics.api.enums.DPStatusEnum; import com.yeejoin.amos.boot.module.statistics.api.enums.DPStatusEnum;
import com.yeejoin.amos.boot.module.statistics.api.enums.MatinfoEnum; import com.yeejoin.amos.boot.module.statistics.api.enums.MatinfoEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentEnum;
import com.yeejoin.amos.feign.morphic.Morphic; import com.yeejoin.amos.feign.morphic.Morphic;
import com.yeejoin.amos.feign.morphic.model.FormSceneModel; import com.yeejoin.amos.feign.morphic.model.FormSceneModel;
import jdk.nashorn.api.scripting.ScriptObjectMirror; import jdk.nashorn.api.scripting.ScriptObjectMirror;
...@@ -610,7 +611,9 @@ public class DPSubServiceImpl { ...@@ -610,7 +611,9 @@ public class DPSubServiceImpl {
e.printStackTrace(); e.printStackTrace();
} }
} }
if ("正常".equals(problemStatus) || "已处理".equals(problemStatus)) { if (EquipmentEnum.BAOFEI.getCode().toString().equals(result.getString("EQU_STATE"))) {
color = "grey";
} else if ("正常".equals(problemStatus) || "已处理".equals(problemStatus)) {
color = "green"; color = "green";
} else if ("异常".equals(problemStatus) || "未处理".equals(problemStatus)) { } else if ("异常".equals(problemStatus) || "未处理".equals(problemStatus)) {
color = "red"; color = "red";
......
...@@ -4,6 +4,9 @@ import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper; ...@@ -4,6 +4,9 @@ import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/** /**
* 安全追溯-其他信息表 Mapper 接口 * 安全追溯-其他信息表 Mapper 接口
...@@ -14,4 +17,18 @@ import org.apache.ibatis.annotations.Select; ...@@ -14,4 +17,18 @@ import org.apache.ibatis.annotations.Select;
public interface IdxBizJgOtherInfoMapper extends CustomBaseMapper<IdxBizJgOtherInfo> { public interface IdxBizJgOtherInfoMapper extends CustomBaseMapper<IdxBizJgOtherInfo> {
@Select("select SUPERVISORY_CODE from idx_biz_jg_other_info where record = #{equipmentCode}") @Select("select SUPERVISORY_CODE from idx_biz_jg_other_info where record = #{equipmentCode}")
String getSupervisoryCodeByEquipmentCode(@Param("equipmentCode") String equipmentCode); String getSupervisoryCodeByEquipmentCode(@Param("equipmentCode") String equipmentCode);
/**
* 批量更新other表状态为报废(2)
*
* @param equipIds 设备 ID 列表
*/
@Update("<script>" +
"update idx_biz_jg_other_info set \"STATUS\" = '2' " +
"where \"RECORD\" in " +
"<foreach item='equipId' collection='equipIds' open='(' separator=',' close=')'>" +
"#{equipId}" +
"</foreach>" +
"</script>")
void batchUpdateOtherInfo(@Param("equipIds") List<String> equipIds);
} }
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