Commit 99b1a2d5 authored by 韩桐桐's avatar 韩桐桐

Merge branch 'refs/heads/develop_tzs_register_test' into develop_tzs_register

parents 1603d4f0 76714de6
...@@ -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);
} }
/** /**
......
...@@ -814,7 +814,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -814,7 +814,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
List<Object> factoryNumList = deviceList.stream().limit(3).map(item -> item.get("pipelineNumber")).collect(Collectors.toList()); List<Object> factoryNumList = deviceList.stream().limit(3).map(item -> item.get("pipelineNumber")).collect(Collectors.toList());
placeholders.put("equipTypeList", equipTypeList); placeholders.put("equipTypeList", equipTypeList);
placeholders.put("produceCodeList", factoryNumList); placeholders.put("produceCodeList", factoryNumList);
placeholders.put("productName", historyJson.get("projectContraption")); placeholders.put("productName", Optional.ofNullable(historyJson.get("projectContraption")).orElse(historyJson.get("PROJECT_CONTRAPTION")));
} else { } else {
placeholders.put("equipType", getValue.apply("equType")); placeholders.put("equipType", getValue.apply("equType"));
placeholders.put("produceCode", getValue.apply("factoryNum")); placeholders.put("produceCode", getValue.apply("factoryNum"));
......
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);
// 删除暂存 // 删除暂存
...@@ -291,11 +295,17 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -291,11 +295,17 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
notice.setNextTaskId(workflowResultDto.getNextTaskId()); notice.setNextTaskId(workflowResultDto.getNextTaskId());
notice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds()); notice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
notice.setCreateDate(new Date()); notice.setCreateDate(new Date());
updateById(notice);
// 上个代办改为已办 // 上个代办改为已办
TaskV2Model taskV2Model = this.updateLastTodo(notice, FlowStatusEnum.TO_BE_PROCESSED); TaskV2Model taskV2Model = this.updateLastTodo(notice, FlowStatusEnum.TO_BE_PROCESSED);
// 创建新的代办 // 创建新的代办
this.createNewTodo(notice, workflowResultDto, taskV2Model, FlowStatusEnum.TO_BE_PROCESSED); this.createNewTodo(notice, workflowResultDto, taskV2Model, FlowStatusEnum.TO_BE_PROCESSED);
// 压力管道情况处理
if (EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode())) {
oldPipJsonData = this.getNowPipJsonData(noticeDto.getProjectContraptionId());
notice.setPipeLengthChanged(this.calculatePipeLengthChange(JSONArray.parseArray(JSON.toJSONString(oldPipJsonData.get(DEVICE_LIST))),
JSONArray.parseArray(JSON.toJSONString(noticeDto.getDeviceList()))));
}
this.updateById(notice);
} }
commonService.saveExecuteFlowData2Redis(notice.getInstanceId(), this.buildInstanceRuntimeData(notice)); commonService.saveExecuteFlowData2Redis(notice.getInstanceId(), this.buildInstanceRuntimeData(notice));
} else { } else {
...@@ -309,9 +319,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -309,9 +319,10 @@ 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)))
.forEach(obj -> {
JgReformNoticeEq jgRelationEquip = new JgReformNoticeEq(); JgReformNoticeEq jgRelationEquip = new JgReformNoticeEq();
jgRelationEquip.setEquId(String.valueOf(obj.get(SEQUENCE_NBR))); jgRelationEquip.setEquId(String.valueOf(obj.get(equSeq)));
jgRelationEquip.setEquipTransferId(String.valueOf(notice.getSequenceNbr())); jgRelationEquip.setEquipTransferId(String.valueOf(notice.getSequenceNbr()));
noticeEqs.add(jgRelationEquip); noticeEqs.add(jgRelationEquip);
}); });
...@@ -352,8 +363,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -352,8 +363,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);
}); });
// 添加作废标识:不在流程中即可作废 // 压力管道添加作废标识:不在流程中即可作废
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); 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);
...@@ -416,8 +429,16 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -416,8 +429,16 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
String tempFileName = "改造告知单_" + System.currentTimeMillis() + "_temp"; String tempFileName = "改造告知单_" + System.currentTimeMillis() + "_temp";
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
ArrayList<Map<String, Object>> maps = new ArrayList<>(); ArrayList<Map<String, Object>> maps = new ArrayList<>();
// 管道按照装置打一份告知书
if (EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode()) && !noticeEqs.isEmpty()) {
Map<String, Object> information = jgReformNoticeMapper.queryEquipInformation(noticeEqs.get(0).getSequenceNbr());
if (CollectionUtils.isEmpty(information)) {
throw new IllegalArgumentException("改造告知单不存在");
}
Map<String, Object> stringObjectMap = jgInstallationNoticeService.fullFillTemplateObj(Collections.singletonList(information), BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName().substring(0, 2));
maps.add(stringObjectMap);
} else {
for (JgReformNoticeEq noticeEq : noticeEqs) { for (JgReformNoticeEq noticeEq : noticeEqs) {
Map<String, Object> information = jgReformNoticeMapper.queryEquipInformation(noticeEq.getSequenceNbr()); Map<String, Object> information = jgReformNoticeMapper.queryEquipInformation(noticeEq.getSequenceNbr());
if (CollectionUtils.isEmpty(information)) { if (CollectionUtils.isEmpty(information)) {
throw new IllegalArgumentException("改造告知单不存在"); throw new IllegalArgumentException("改造告知单不存在");
...@@ -425,6 +446,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -425,6 +446,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
Map<String, Object> stringObjectMap = jgInstallationNoticeService.fullFillTemplateObj(Collections.singletonList(information), BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName().substring(0, 2)); Map<String, Object> stringObjectMap = jgInstallationNoticeService.fullFillTemplateObj(Collections.singletonList(information), BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName().substring(0, 2));
maps.add(stringObjectMap); maps.add(stringObjectMap);
} }
}
data.put("equipBasicInfoList", maps); data.put("equipBasicInfoList", maps);
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", data, response); WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", data, response);
} }
...@@ -445,7 +467,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -445,7 +467,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 +535,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -511,8 +535,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 +547,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -523,9 +547,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 +586,20 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -562,22 +586,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 +850,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -828,7 +850,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 +915,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -893,8 +915,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 +974,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -954,10 +974,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());
...@@ -1046,13 +1066,19 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1046,13 +1066,19 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = new ArrayList<>(15); List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = new ArrayList<>(15);
List<IdxBizJgTechParamsPipeline> paramsPipelineList = new ArrayList<>(15); List<IdxBizJgTechParamsPipeline> paramsPipelineList = new ArrayList<>(15);
List<ESEquipmentCategoryDto> esEquipmentCategoryList = new ArrayList<>(15); List<ESEquipmentCategoryDto> esEquipmentCategoryList = new ArrayList<>(15);
// eq关系表
List<JgReformNoticeEq> noticeEqs = new ArrayList<>(15);
// 设备信息 // 设备信息
toAddPipData.forEach(pipData -> { toAddPipData.forEach(pipData -> {
String record = UUID.randomUUID().toString(); String record = UUID.randomUUID().toString();
Date date = new Date(); Date date = new Date();
// eq表
JgReformNoticeEq jgRelationEquip = new JgReformNoticeEq();
jgRelationEquip.setEquId(record);
jgRelationEquip.setEquipTransferId(String.valueOf(notice.getSequenceNbr()));
noticeEqs.add(jgRelationEquip);
// 使用信息 // 使用信息
IdxBizJgUseInfo useInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgUseInfo.class); IdxBizJgUseInfo useInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgUseInfo.class);
// 使用信息
useInfo.setRecord(record); useInfo.setRecord(record);
useInfo.setSequenceNbr(null); useInfo.setSequenceNbr(null);
useInfo.setRecDate(date); useInfo.setRecDate(date);
...@@ -1119,6 +1145,14 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1119,6 +1145,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)) {
...@@ -1160,12 +1194,12 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1160,12 +1194,12 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
idxBizJgInspectionDetectionInfoService.saveBatch(inspectionDetectionInfoList); idxBizJgInspectionDetectionInfoService.saveBatch(inspectionDetectionInfoList);
iIdxBizJgTechParamsPipelineService.saveBatch(paramsPipelineList); iIdxBizJgTechParamsPipelineService.saveBatch(paramsPipelineList);
esEquipmentCategory.saveAll(esEquipmentCategoryList); esEquipmentCategory.saveAll(esEquipmentCategoryList);
jgReformNoticeEqMapper.insertBatchSomeColumn(noticeEqs);
} }
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 +1321,21 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1287,15 +1321,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) {
......
...@@ -32,7 +32,7 @@ public class MonthCylinderBusinessStatisticsJob { ...@@ -32,7 +32,7 @@ public class MonthCylinderBusinessStatisticsJob {
this.businessStatisticsMapper = businessStatisticsMapper; this.businessStatisticsMapper = businessStatisticsMapper;
} }
@Scheduled(cron = "0 */5 * * * ?") @Scheduled(cron = "0 0 2 * * ?")
@SchedulerLock(name = "cylinderBusinessStatisticsJob", lockAtMostFor = "PT1H") @SchedulerLock(name = "cylinderBusinessStatisticsJob", lockAtMostFor = "PT1H")
public void cylinderBusinessStatisticsJob() { public void cylinderBusinessStatisticsJob() {
List<Map<String, Object>> useRegisterCountList = useRegistrationMapper.getUseRegisterCountTotal(); List<Map<String, Object>> useRegisterCountList = useRegistrationMapper.getUseRegisterCountTotal();
......
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