Commit 45fd03ef authored by 韩桐桐's avatar 韩桐桐

fix(jg):改造告知接口调整

parent f9458d52
...@@ -181,9 +181,6 @@ public class JgReformNoticeDto extends BaseDto { ...@@ -181,9 +181,6 @@ public class JgReformNoticeDto extends BaseDto {
@ApiModelProperty (value = "告知设备列表") @ApiModelProperty (value = "告知设备列表")
private List<Map<String, Object>> deviceList; private List<Map<String, Object>> deviceList;
@ApiModelProperty(value = "管道列表")
private List<Map<String, Object>> pipelineList;
@ApiModelProperty(value = "删除的管道列表") @ApiModelProperty(value = "删除的管道列表")
private List<Map<String, Object>> delPipelineList; private List<Map<String, Object>> delPipelineList;
......
...@@ -140,7 +140,10 @@ public class IdxBizJgProjectContraptionController extends BaseController { ...@@ -140,7 +140,10 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个管道工程装置表", notes = "根据sequenceNbr查询单个管道工程装置表") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个管道工程装置表", notes = "根据sequenceNbr查询单个管道工程装置表")
// 传record的原因是前端组件内部写死了,此处是工程装置表seq // 传record的原因是前端组件内部写死了,此处是工程装置表seq
public ResponseModel<Object> detailsNotFormId(@RequestParam("record") String sequenceNbr) { public ResponseModel<Object> detailsNotFormId(@RequestParam("record") String sequenceNbr) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.details(sequenceNbr).get(EQUIP_INFO_FORM_ID)); Map<String, Object> objectMap = idxBizJgProjectContraptionServiceImpl.details(sequenceNbr).get(EQUIP_INFO_FORM_ID);
Object pipelineListObj = objectMap.remove("pipelineList");
objectMap.put("deviceList", pipelineListObj);
return ResponseHelper.buildResponse(objectMap);
} }
/** /**
......
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.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapBuilder; import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -89,7 +91,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -89,7 +91,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
private static final String SUBMIT_TYPE_FLOW = "1"; private static final String SUBMIT_TYPE_FLOW = "1";
private static final String PROCESS_DEFINITION_KEY = "renovationNoticeNew"; private static final String PROCESS_DEFINITION_KEY = "renovationNoticeNew";
private static final String TABLE_PAGE_ID = "reformNoticeAdd"; private static final String TABLE_PAGE_ID = "reformNoticeAdd";
public static final String PIPELINE_LIST = "pipelineList"; public static final String DEVICE_LIST = "deviceList";
public static final String PIPE_LENGTH = "pipeLength"; public static final String PIPE_LENGTH = "pipeLength";
public static final String RECORD = "record"; public static final String RECORD = "record";
public static final String SEQUENCE_NBR = "SEQUENCE_NBR"; public static final String SEQUENCE_NBR = "SEQUENCE_NBR";
...@@ -101,7 +103,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -101,7 +103,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
public static final String PRODUCT_PHOTO = "PRODUCT_PHOTO"; public static final String PRODUCT_PHOTO = "PRODUCT_PHOTO";
public static final String PRODUCT_QUALIFICATION_CERTIFICATE = "PRODUCT_QUALIFICATION_CERTIFICATE"; public static final String PRODUCT_QUALIFICATION_CERTIFICATE = "PRODUCT_QUALIFICATION_CERTIFICATE";
public static final String OTHER_ACCESSORIES = "OTHER_ACCESSORIES"; public static final String OTHER_ACCESSORIES = "OTHER_ACCESSORIES";
public static final String DEL_PIPELINE_LIST = "delPipelineList"; public static final String DEL_DEVICE_LIST = "delDeviceList";
private final List<String> NOT_FLOWING_STATE = Arrays.asList("6610", "6614", "6615", "6617", "6616"); private final List<String> NOT_FLOWING_STATE = Arrays.asList("6610", "6614", "6615", "6617", "6616");
// 西安行政区划code // 西安行政区划code
private static final String XIAN = "610100"; private static final String XIAN = "610100";
...@@ -176,7 +178,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -176,7 +178,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
List<String> ids = noticeEqs.stream().map(JgReformNoticeEq::getEquId).collect(Collectors.toList()); List<String> ids = noticeEqs.stream().map(JgReformNoticeEq::getEquId).collect(Collectors.toList());
Iterable<ESEquipmentCategoryDto> equips = esEquipmentCategory.findAllById(ids); Iterable<ESEquipmentCategoryDto> equips = esEquipmentCategory.findAllById(ids);
List<Map<String, Object>> equipListMaps = getEquipListMaps(equips); List<Map<String, Object>> equipListMaps = getEquipListMaps(equips);
reformNoticeMap.put("deviceList", equipListMaps); reformNoticeMap.put(DEVICE_LIST, equipListMaps);
reformNoticeMap.put("EQU_LIST_CODE", notice.getEquListCode()); reformNoticeMap.put("EQU_LIST_CODE", notice.getEquListCode());
reformNoticeMap.put("EQU_CATEGORY_CODE", notice.getEquCategoryCode()); reformNoticeMap.put("EQU_CATEGORY_CODE", notice.getEquCategoryCode());
reformNoticeMap.put("QUERY_TYPE", "GZ_GZ"); reformNoticeMap.put("QUERY_TYPE", "GZ_GZ");
...@@ -222,8 +224,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -222,8 +224,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// 字段转换 // 字段转换
this.convertField(noticeDto); this.convertField(noticeDto);
JgReformNotice notice = this.getById(noticeDto.getSequenceNbr()); JgReformNotice notice = this.getById(noticeDto.getSequenceNbr());
List<Map<String, Object>> deviceList = EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode()) ? noticeDto.getDeviceList() : noticeDto.getPipelineList(); // 业务单据中的设备主键 管道的为record 其他设备为SEQUENCE_NBR
List<String> records = deviceList.stream().map(equ -> String.valueOf(equ.get(RECORD))).collect(Collectors.toList()); String equSeq = !EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode()) ? SEQUENCE_NBR : RECORD;
List<Map<String, Object>> deviceList = noticeDto.getDeviceList();
List<String> records = deviceList.stream().filter(item -> !Objects.isNull(item.get(RECORD))).map(equ -> String.valueOf(equ.get(RECORD))).collect(Collectors.toList());
this.checkRepeatUsed(submitType, records, notice); this.checkRepeatUsed(submitType, records, notice);
if (SUBMIT_TYPE_FLOW.equals(submitType)) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程 // 发起流程
...@@ -255,8 +259,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -255,8 +259,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// 压力管道情况处理 // 压力管道情况处理
if (EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode())) { if (EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode())) {
oldPipJsonData = this.getNowPipJsonData(noticeDto.getProjectContraptionId()); oldPipJsonData = this.getNowPipJsonData(noticeDto.getProjectContraptionId());
notice.setPipeLengthChanged(this.calculatePipeLengthChange(JSONArray.parseArray(JSON.toJSONString(oldPipJsonData.get(PIPELINE_LIST))), notice.setPipeLengthChanged(this.calculatePipeLengthChange(JSONArray.parseArray(JSON.toJSONString(oldPipJsonData.get(DEVICE_LIST))),
JSONArray.parseArray(JSON.toJSONString(noticeDto.getPipelineList())))); JSONArray.parseArray(JSON.toJSONString(noticeDto.getDeviceList()))));
} }
jgReformNoticeMapper.updateById(notice); jgReformNoticeMapper.updateById(notice);
// 删除暂存 // 删除暂存
...@@ -309,12 +313,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -309,12 +313,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// eq关系表 // eq关系表
List<JgReformNoticeEq> noticeEqs = new ArrayList<>(); List<JgReformNoticeEq> noticeEqs = new ArrayList<>();
// 更新设备关系表 // 更新设备关系表
deviceList.forEach(obj -> { deviceList.stream().filter(obj -> !Objects.isNull(obj.get(equSeq)))
JgReformNoticeEq jgRelationEquip = new JgReformNoticeEq(); .forEach(obj -> {
jgRelationEquip.setEquId(String.valueOf(obj.get(SEQUENCE_NBR))); JgReformNoticeEq jgRelationEquip = new JgReformNoticeEq();
jgRelationEquip.setEquipTransferId(String.valueOf(notice.getSequenceNbr())); jgRelationEquip.setEquId(String.valueOf(obj.get(equSeq)));
noticeEqs.add(jgRelationEquip); jgRelationEquip.setEquipTransferId(String.valueOf(notice.getSequenceNbr()));
}); noticeEqs.add(jgRelationEquip);
});
jgReformNoticeEqMapper.insertBatchSomeColumn(noticeEqs); jgReformNoticeEqMapper.insertBatchSomeColumn(noticeEqs);
return noticeDto; return noticeDto;
} catch (BadRequest | LocalBadRequest e) { } catch (BadRequest | LocalBadRequest e) {
...@@ -352,8 +357,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -352,8 +357,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
String noticeStatusDesc = FlowStatusEnum.getNameByType(Long.valueOf((String) notice.get("noticeStatus"))); String noticeStatusDesc = FlowStatusEnum.getNameByType(Long.valueOf((String) notice.get("noticeStatus")));
notice.put("noticeStatusDesc", noticeStatusDesc); notice.put("noticeStatusDesc", noticeStatusDesc);
}); });
// 添加作废标识:不在流程中即可作废 // 压力管道添加作废标识:不在流程中即可作废
notice.put("canVoided", idxBizJgProjectContraptionMapper.countContraptionInUseTimesForDeleteByIntoManagement(Long.parseLong(String.valueOf(notice.get("projectContraptionId")))) == 0); if (EquipmentClassifityEnum.YLGD.getCode().equals(notice.get("equListCode")) && !ValidationUtil.isEmpty(notice.get("projectContraptionId"))) {
notice.put("canVoided", idxBizJgProjectContraptionMapper.countContraptionInUseTimesForDeleteByIntoManagement(Long.parseLong(String.valueOf(notice.get("projectContraptionId")))) == 0);
}
}).collect(Collectors.toList()); }).collect(Collectors.toList());
noticePage.setRecords(mappedRecords); noticePage.setRecords(mappedRecords);
...@@ -445,7 +452,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -445,7 +452,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
JSONObject oldPipJsonData = new JSONObject(); JSONObject oldPipJsonData = new JSONObject();
List<JgReformNoticeEq> noticeEqs = new ArrayList<>(); List<JgReformNoticeEq> noticeEqs = new ArrayList<>();
// 获取告知设备列表 // 获取告知设备列表
List<Map<String, Object>> deviceList = !EquipmentClassifityEnum.YLGD.getCode().equals(equListCode) ? model.getDeviceList() : model.getPipelineList(); List<Map<String, Object>> deviceList = model.getDeviceList();
// 业务单据中的设备主键 管道的为record 其他设备为SEQUENCE_NBR
String equSeq = !EquipmentClassifityEnum.YLGD.getCode().equals(equListCode) ? SEQUENCE_NBR : RECORD;
if (CollectionUtils.isEmpty(deviceList)) { if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("请选择设备!"); throw new BadRequest("请选择设备!");
} }
...@@ -511,8 +520,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -511,8 +520,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// 压力管道情况处理 // 压力管道情况处理
if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)) { if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)) {
oldPipJsonData = this.getNowPipJsonData(String.valueOf(jsonObject.get(PROJECT_CONTRAPTION_ID))); oldPipJsonData = this.getNowPipJsonData(String.valueOf(jsonObject.get(PROJECT_CONTRAPTION_ID)));
notice.setPipeLengthChanged(this.calculatePipeLengthChange(JSONArray.parseArray(JSON.toJSONString(oldPipJsonData.get(PIPELINE_LIST))), notice.setPipeLengthChanged(this.calculatePipeLengthChange(JSONArray.parseArray(JSON.toJSONString(oldPipJsonData.get(DEVICE_LIST))),
JSONArray.parseArray(JSON.toJSONString(jsonObject.get(PIPELINE_LIST))))); JSONArray.parseArray(JSON.toJSONString(jsonObject.get(DEVICE_LIST)))));
} }
this.saveOrUpdateHisData(String.valueOf(sequenceNbr), jsonObject, oldPipJsonData); this.saveOrUpdateHisData(String.valueOf(sequenceNbr), jsonObject, oldPipJsonData);
if (SUBMIT_TYPE_FLOW.equals(submitType)) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
...@@ -523,9 +532,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -523,9 +532,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// 插入业务单 // 插入业务单
jgReformNoticeMapper.insert(notice); jgReformNoticeMapper.insert(notice);
// 更新设备关系表 // 更新设备关系表
deviceList.stream().filter(obj -> !Objects.isNull(obj.get(RECORD))) deviceList.stream().filter(obj -> !Objects.isNull(obj.get(equSeq)))
.map(obj -> new JgReformNoticeEq() .map(obj -> new JgReformNoticeEq()
.setEquId(obj.get(RECORD).toString()) .setEquId(obj.get(equSeq).toString())
.setEquipTransferId(String.valueOf(sequenceNbr))) .setEquipTransferId(String.valueOf(sequenceNbr)))
.forEach(noticeEqs::add); .forEach(noticeEqs::add);
jgReformNoticeEqMapper.insertBatchSomeColumn(noticeEqs); jgReformNoticeEqMapper.insertBatchSomeColumn(noticeEqs);
...@@ -562,22 +571,20 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -562,22 +571,20 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
return new JSONObject(Optional.ofNullable(idxBizJgProjectContraptionMapper.getDetail(projectContraptionId)) return new JSONObject(Optional.ofNullable(idxBizJgProjectContraptionMapper.getDetail(projectContraptionId))
.map(map -> { .map(map -> {
commonService.convertStringToJsonobject(map, IdxBizJgProjectContraptionServiceImpl.jsonFields); commonService.convertStringToJsonobject(map, IdxBizJgProjectContraptionServiceImpl.jsonFields);
map.put(PIPELINE_LIST, idxBizJgProjectContraptionMapper.selectEquipList((String) map.get(SEQUENCE_NBR))); map.put(DEVICE_LIST, idxBizJgProjectContraptionMapper.selectEquipList((String) map.get(SEQUENCE_NBR)));
return map; return map;
}) })
.orElse(Collections.emptyMap())); .orElse(Collections.emptyMap()));
} }
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) { private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> equipList.stream().filter(item -> !Objects.isNull(item.get(RECORD))).forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).equipRepeatUsedCheck(String.valueOf(equipMap.get(RECORD)), companyCode));
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.equipRepeatUsedCheck(String.valueOf(equipMap.get(RECORD)), companyCode));
} }
private void checkRepeatUsed(String submitType, List<String> records, JgReformNotice jgReformNotice) { private void checkRepeatUsed(String submitType, List<String> records, JgReformNotice jgReformNotice) {
if (SUBMIT_TYPE_FLOW.equals(submitType)) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 流程中校验 // 流程中校验
records.forEach(record -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY) records.stream().filter(item -> !Objects.isNull(item)).forEach(record -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
.equipRepeatUsedCheck(record, jgReformNotice.getInstallUnitCreditCode())); .equipRepeatUsedCheck(record, jgReformNotice.getInstallUnitCreditCode()));
} }
} }
...@@ -828,7 +835,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -828,7 +835,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
* @param dto 改造信息 * @param dto 改造信息
* @param op 通过或驳回 * @param op 通过或驳回
*/ */
@Transactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class)
public void accept(Map<String, Object> map, String op) { public void accept(Map<String, Object> map, String op) {
LinkedHashMap model1 = (LinkedHashMap) map.get("model"); LinkedHashMap model1 = (LinkedHashMap) map.get("model");
String opinion = (String) map.get("opinion"); String opinion = (String) map.get("opinion");
...@@ -893,8 +900,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -893,8 +900,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
noticeEq.setInformNumber(deviceRegistrationCode); noticeEq.setInformNumber(deviceRegistrationCode);
jgReformNoticeEqMapper.updateById(noticeEq); jgReformNoticeEqMapper.updateById(noticeEq);
}); });
// 通过时记录或更新历史数据
this.saveOrUpdateHisData(String.valueOf(jgReformNotice.getSequenceNbr()), jsonObject, null);
jgReformNotice.setAcceptDate(new Date()); jgReformNotice.setAcceptDate(new Date());
jgReformNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())); jgReformNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
jgReformNotice.setPromoter(""); jgReformNotice.setPromoter("");
...@@ -954,10 +959,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -954,10 +959,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// 1.更新工程装置数据 // 1.更新工程装置数据
JgRegistrationHistory registrationHistory = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>().eq(JgRegistrationHistory::getCurrentDocumentId, notice.getSequenceNbr())); JgRegistrationHistory registrationHistory = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>().eq(JgRegistrationHistory::getCurrentDocumentId, notice.getSequenceNbr()));
JSONObject newData = JSONObject.parseObject(registrationHistory.getChangeData()); JSONObject newData = JSONObject.parseObject(registrationHistory.getChangeData());
JSONArray newPipData = JSONArray.parseArray(newData.getString(PIPELINE_LIST)); JSONArray newPipData = JSONArray.parseArray(newData.getString(DEVICE_LIST));
JSONArray delPipData = JSONArray.parseArray(newData.getString(DEL_PIPELINE_LIST)); JSONArray delPipData = JSONArray.parseArray(newData.getString(DEL_DEVICE_LIST));
JSONObject oldData = JSONObject.parseObject(registrationHistory.getOldData()); JSONObject oldData = JSONObject.parseObject(registrationHistory.getOldData());
JSONArray oldPipData = JSONArray.parseArray(oldData.getString(PIPELINE_LIST)); JSONArray oldPipData = JSONArray.parseArray(oldData.getString(DEVICE_LIST));
// 1.1更新工程装置中的【管道信息】增加减少或修改管道信息 // 1.1更新工程装置中的【管道信息】增加减少或修改管道信息
List<JSONObject> toUpdatePipData = newPipData.stream().filter(item -> !StringUtils.isEmpty(JSON.parseObject(item.toString()).getString(RECORD))).map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList()); List<JSONObject> toUpdatePipData = newPipData.stream().filter(item -> !StringUtils.isEmpty(JSON.parseObject(item.toString()).getString(RECORD))).map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList());
List<JSONObject> toAddPipData = newPipData.stream().filter(item -> StringUtils.isEmpty(JSON.parseObject(item.toString()).getString(RECORD))).map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList()); List<JSONObject> toAddPipData = newPipData.stream().filter(item -> StringUtils.isEmpty(JSON.parseObject(item.toString()).getString(RECORD))).map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList());
...@@ -1119,6 +1124,14 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1119,6 +1124,14 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
otherInfo.setInformationManageCode(""); otherInfo.setInformationManageCode("");
otherInfoList.add(otherInfo); otherInfoList.add(otherInfo);
// 检验检测
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgInspectionDetectionInfo.class);
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(date);
Optional.ofNullable(inspectionDetectionInfo.getNextInspectDate()).ifPresent(x -> inspectionDetectionInfo.setNextInspectDate(DateUtil.parse(DateUtil.format(inspectionDetectionInfo.getNextInspectDate(), DatePattern.NORM_DATE_PATTERN))));
inspectionDetectionInfo.setSequenceNbr(null);
idxBizJgInspectionDetectionInfoService.saveOrUpdateData(inspectionDetectionInfo);
// 管道技术参数 // 管道技术参数
IdxBizJgTechParamsPipeline pipelineInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgTechParamsPipeline.class); IdxBizJgTechParamsPipeline pipelineInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipelineInfo)) { if (!ValidationUtil.isEmpty(pipelineInfo)) {
...@@ -1164,8 +1177,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1164,8 +1177,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
private void saveOrUpdateHisData(String sequenceNbr, JSONObject changeData, JSONObject oldData) { private void saveOrUpdateHisData(String sequenceNbr, JSONObject changeData, JSONObject oldData) {
this.saveOrUpdateHistory(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName(), new JSONObject(changeData), this.saveOrUpdateHistory(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName(), changeData, oldData, sequenceNbr);
new JSONObject(oldData), sequenceNbr);
} }
public void saveOrUpdateHistory(String registrationClass, JSON changeData, JSON oldData, String currentDocumentId) { public void saveOrUpdateHistory(String registrationClass, JSON changeData, JSON oldData, String currentDocumentId) {
...@@ -1287,15 +1299,21 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1287,15 +1299,21 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} }
JgRegistrationHistory registrationHistory = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>().eq(JgRegistrationHistory::getCurrentDocumentId, notice.getSequenceNbr())); JgRegistrationHistory registrationHistory = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>().eq(JgRegistrationHistory::getCurrentDocumentId, notice.getSequenceNbr()));
JSONObject newData = JSONObject.parseObject(registrationHistory.getChangeData()); JSONObject newData = JSONObject.parseObject(registrationHistory.getChangeData());
JSONArray alreadyDelPipData = JSONArray.parseArray(newData.getString(DEL_PIPELINE_LIST)); JSONArray alreadyDelPipData = JSONArray.parseArray(newData.getString(DEL_DEVICE_LIST));
JSONObject oldData = JSONObject.parseObject(registrationHistory.getOldData()); JSONObject oldData = JSONObject.parseObject(registrationHistory.getOldData());
JSONArray oldPipData = JSONArray.parseArray(oldData.getString(PIPELINE_LIST)); JSONArray oldPipData = JSONArray.parseArray(oldData.getString(DEVICE_LIST));
double oldPipLength = oldPipData.stream().mapToDouble(item -> JSON.parseObject(item.toString()).getDoubleValue(PIPE_LENGTH)).sum();
List<String> oldPipDataRecords = oldPipData.stream().map(item -> JSON.parseObject(item.toString()).getString(RECORD)).collect(Collectors.toList()); List<String> oldPipDataRecords = oldPipData.stream().map(item -> JSON.parseObject(item.toString()).getString(RECORD)).collect(Collectors.toList());
List<String> nowPipDataRecords = idxBizJgProjectContraptionMapper.selectEquipList(notice.getProjectContraptionId()).stream().map(item -> String.valueOf(item.get("record"))).collect(Collectors.toList()); List<String> nowPipDataRecords = idxBizJgProjectContraptionMapper.selectEquipList(notice.getProjectContraptionId()).stream().map(item -> String.valueOf(item.get("record"))).collect(Collectors.toList());
List<JSONObject> toAddPipData = alreadyDelPipData.stream().map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList()); List<JSONObject> toAddPipData = alreadyDelPipData.stream().map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList());
List<String> toDeletePipRecords = nowPipDataRecords.stream().filter(item -> !oldPipDataRecords.contains(item)).collect(Collectors.toList()); List<String> toDeletePipRecords = nowPipDataRecords.stream().filter(item -> !oldPipDataRecords.contains(item)).collect(Collectors.toList());
this.addPipDataWithFlowPass(toAddPipData, notice); this.addPipDataWithFlowPass(toAddPipData, notice);
this.delPipDataWithFlowPass(toDeletePipRecords); this.delPipDataWithFlowPass(toDeletePipRecords);
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<IdxBizJgProjectContraption>()
.eq(IdxBizJgProjectContraption::getSequenceNbr, notice.getProjectContraptionId())
.set(IdxBizJgProjectContraption::getPipelineLength, oldPipLength)
.set(IdxBizJgProjectContraption::getPipeLengthChanged, 0);
idxBizJgProjectContraptionMapper.update(null, updateWrapper);
} }
private void finishedTask(JgReformNotice reformNotice) { private void finishedTask(JgReformNotice reformNotice) {
......
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