Commit 428b2733 authored by hezhuozhi's avatar hezhuozhi

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

parents 03a467be 49b2bd99
...@@ -181,6 +181,9 @@ public class JgReformNoticeDto extends BaseDto { ...@@ -181,6 +181,9 @@ 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 String countyName; private String countyName;
......
...@@ -33,7 +33,7 @@ public interface IJgReformNoticeService extends IService<JgReformNotice> { ...@@ -33,7 +33,7 @@ public interface IJgReformNoticeService extends IService<JgReformNotice> {
* @param noticeDto 改造告知 * @param noticeDto 改造告知
* @param op 操作类型 * @param op 操作类型
*/ */
JgReformNoticeDto updateInstallationNotice(String submitType, JgReformNoticeDto noticeDto, String op); JgReformNoticeDto updateNotice(String submitType, Map<String, Object> noticeMap, String op);
/** /**
* 分页查询 * 分页查询
......
...@@ -65,13 +65,9 @@ public class JgReformNoticeController extends BaseController { ...@@ -65,13 +65,9 @@ public class JgReformNoticeController extends BaseController {
@PutMapping(value = "/update") @PutMapping(value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新改造告知", notes = "根据sequenceNbr更新改造告知") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新改造告知", notes = "根据sequenceNbr更新改造告知")
public ResponseModel<JgReformNoticeDto> updateBySequenceNbrJgReformNotice(@RequestParam String submitType, public ResponseModel<JgReformNoticeDto> updateBySequenceNbrJgReformNotice(@RequestParam String submitType,
@RequestBody JgReformNoticeDto installationInfo, @RequestBody Map<String, Object> noticeMap,
@RequestParam(value = "op", required = false) String op) { @RequestParam(value = "op", required = false) String op) {
if (Objects.isNull(installationInfo)) { return ResponseHelper.buildResponse(jgReformNoticeService.updateNotice(submitType, noticeMap, op));
throw new IllegalArgumentException("参数installationInfo不能为空");
}
return ResponseHelper.buildResponse(jgReformNoticeService.updateInstallationNotice(submitType, installationInfo, op));
} }
/** /**
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl; ...@@ -3,6 +3,7 @@ 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.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.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -40,11 +41,9 @@ import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils; ...@@ -40,11 +41,9 @@ import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory; import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; 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.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SupervisoryCodeInfoMapper;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model; import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
...@@ -88,6 +87,15 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -88,6 +87,15 @@ 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 PIPE_LENGTH = "pipeLength";
public static final String RECORD = "record";
public static final String SEQUENCE_NBR = "SEQUENCE_NBR";
public static final String PROJECT_CONTRAPTION = "projectContraption";
public static final String EQU_LIST_CODE = "EQU_LIST_CODE";
public static final String EQU_CATEGORY_CODE = "EQU_CATEGORY_CODE";
public static final String EQUIP_INFO = "equipInfo";
public static final String PROJECT_CONTRAPTION_ID = "projectContraptionId";
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
...@@ -108,13 +116,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -108,13 +116,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
@Autowired @Autowired
TzsServiceFeignClient tzsServiceFeignClient; TzsServiceFeignClient tzsServiceFeignClient;
@Autowired @Autowired
SupervisoryCodeInfoMapper supervisoryCodeInfoMapper; IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
private SnowflakeIdUtil sequence; private SnowflakeIdUtil sequence;
@Autowired @Autowired
IIdxBizJgRegisterInfoService idxBizJgRegisterInfoService; JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired @Autowired
JgInstallationNoticeServiceImpl jgInstallationNoticeService; JgInstallationNoticeServiceImpl jgInstallationNoticeService;
@Autowired @Autowired
...@@ -156,8 +164,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -156,8 +164,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
reformNoticeMap.put("street", notice.getStreet() + "_" + notice.getStreetName()); reformNoticeMap.put("street", notice.getStreet() + "_" + notice.getStreetName());
} }
reformNoticeMap.put("constructionManagerId", notice.getConstructionManagerId() + "_" + notice.getConstructionManager()); reformNoticeMap.put("constructionManagerId", notice.getConstructionManagerId() + "_" + notice.getConstructionManager());
if ((Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_FINISHED.getCode()) || (Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_DISCARD.getCode())) { if ((Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_FINISHED.getCode())
// 完成 或 作废时显示历史数据 || (Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_DISCARD.getCode())
|| EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode())) {
// 完成 或 作废时显示历史数据(压力管道也显示历史数据)
JSONObject hisData = commonService.queryHistoryData(notice.getSequenceNbr()); JSONObject hisData = commonService.queryHistoryData(notice.getSequenceNbr());
if (!ValidationUtil.isEmpty(hisData)) { if (!ValidationUtil.isEmpty(hisData)) {
// 格式化基本通用信息的时间类型字段 // 格式化基本通用信息的时间类型字段
...@@ -204,19 +214,22 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -204,19 +214,22 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
/** /**
* 更新改造告知 * 更新改造告知
* *
* @param noticeDto 改造告知
*/ */
@SuppressWarnings({"rawtypes", "Duplicates"}) @SuppressWarnings({"rawtypes", "Duplicates"})
public JgReformNoticeDto updateInstallationNotice(String submitType, JgReformNoticeDto noticeDto, String op) { public JgReformNoticeDto updateNotice(String submitType, Map<String, Object> noticeMap, String op) {
try { try {
String noticeJsonStr = JSON.toJSONString(noticeMap);
JgReformNoticeDto noticeDto = JSON.parseObject(noticeJsonStr, JgReformNoticeDto.class);
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) { if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空"); throw new IllegalArgumentException("参数不能为空");
} }
// 压力管道使用
JSONObject oldPipJsonData = new JSONObject();
// 字段转换 // 字段转换
this.convertField(noticeDto); this.convertField(noticeDto);
JgReformNotice notice = this.getById(noticeDto.getSequenceNbr()); JgReformNotice notice = this.getById(noticeDto.getSequenceNbr());
List<Map<String, Object>> deviceList = noticeDto.getDeviceList(); List<Map<String, Object>> deviceList = EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode()) ? noticeDto.getDeviceList() : noticeDto.getPipelineList();
List<String> records = deviceList.stream().map(equ -> String.valueOf(equ.get("SEQUENCE_NBR"))).collect(Collectors.toList()); List<String> records = deviceList.stream().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)) {
// 发起流程 // 发起流程
...@@ -245,7 +258,12 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -245,7 +258,12 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
notice.setInstanceId(workflowResultDto.getInstanceId()); notice.setInstanceId(workflowResultDto.getInstanceId());
notice.setNextTaskId(workflowResultDto.getNextTaskId()); notice.setNextTaskId(workflowResultDto.getNextTaskId());
notice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds()); notice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
// 压力管道情况处理
if (EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode())) {
oldPipJsonData = this.getNowPipJsonData(noticeDto.getProjectContraptionId());
notice.setPipeLengthChanged(this.calculatePipeLengthChange(JSONArray.parseArray(JSON.toJSONString(oldPipJsonData.get(PIPELINE_LIST))),
JSONArray.parseArray(JSON.toJSONString(noticeDto.getPipelineList()))));
}
jgReformNoticeMapper.updateById(notice); jgReformNoticeMapper.updateById(notice);
// 删除暂存 // 删除暂存
commonService.deleteTasksByRelationId(notice.getSequenceNbr() + ""); commonService.deleteTasksByRelationId(notice.getSequenceNbr() + "");
...@@ -291,7 +309,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -291,7 +309,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
BeanUtils.copyProperties(noticeDto, bean); BeanUtils.copyProperties(noticeDto, bean);
jgReformNoticeMapper.updateById(bean); jgReformNoticeMapper.updateById(bean);
} }
this.saveOrUpdateHisData(String.valueOf(noticeDto.getSequenceNbr()), JSONObject.parseObject(noticeJsonStr), oldPipJsonData);
jgReformNoticeEqMapper.delete(new LambdaQueryWrapper<JgReformNoticeEq>() jgReformNoticeEqMapper.delete(new LambdaQueryWrapper<JgReformNoticeEq>()
.eq(JgReformNoticeEq::getEquipTransferId, notice.getSequenceNbr())); .eq(JgReformNoticeEq::getEquipTransferId, notice.getSequenceNbr()));
// eq关系表 // eq关系表
...@@ -299,7 +317,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -299,7 +317,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// 更新设备关系表 // 更新设备关系表
deviceList.forEach(obj -> { deviceList.forEach(obj -> {
JgReformNoticeEq jgRelationEquip = new JgReformNoticeEq(); JgReformNoticeEq jgRelationEquip = new JgReformNoticeEq();
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR"))); jgRelationEquip.setEquId(String.valueOf(obj.get(SEQUENCE_NBR)));
jgRelationEquip.setEquipTransferId(String.valueOf(notice.getSequenceNbr())); jgRelationEquip.setEquipTransferId(String.valueOf(notice.getSequenceNbr()));
noticeEqs.add(jgRelationEquip); noticeEqs.add(jgRelationEquip);
}); });
...@@ -425,8 +443,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -425,8 +443,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
JSONObject jsonObject = JSONObject.parseObject(jsonString); JSONObject jsonObject = JSONObject.parseObject(jsonString);
JgReformNoticeDto model = JSON.parseObject(jsonString, JgReformNoticeDto.class); JgReformNoticeDto model = JSON.parseObject(jsonString, JgReformNoticeDto.class);
convertField(model); convertField(model);
String equListCode = String.valueOf(jsonObject.get(EQU_LIST_CODE));
String equCategoryCode = String.valueOf(jsonObject.get(EQU_CATEGORY_CODE));
// 压力管道使用
JSONObject oldPipJsonData = new JSONObject();
List<JgReformNoticeEq> noticeEqs = new ArrayList<>();
// 获取告知设备列表 // 获取告知设备列表
List<Map<String, Object>> deviceList = model.getDeviceList(); List<Map<String, Object>> deviceList = EquipmentClassifityEnum.YLGD.getCode().equals(equListCode) ? model.getDeviceList() : model.getPipelineList();
if (CollectionUtils.isEmpty(deviceList)) { if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("请选择设备!"); throw new BadRequest("请选择设备!");
} }
...@@ -458,9 +481,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -458,9 +481,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
notice.setCreateUserName(reginParams.getUserModel().getRealName()); notice.setCreateUserName(reginParams.getUserModel().getRealName());
notice.setCreateUserId(reginParams.getUserModel().getUserId()); notice.setCreateUserId(reginParams.getUserModel().getUserId());
notice.setCreateUserCompanyName(reginParams.getCompany().getCompanyName()); notice.setCreateUserCompanyName(reginParams.getCompany().getCompanyName());
notice.setProjectContraption(ValidationUtil.isEmpty(jsonObject.get("projectContraption")) ? "" : String.valueOf(jsonObject.get("projectContraption"))); notice.setProjectContraption(ValidationUtil.isEmpty(jsonObject.get(PROJECT_CONTRAPTION)) ? "" : String.valueOf(jsonObject.get(PROJECT_CONTRAPTION)));
String equListCode = String.valueOf(jsonObject.get("EQU_LIST_CODE"));
String equCategoryCode = String.valueOf(jsonObject.get("EQU_CATEGORY_CODE"));
notice.setEquListCode(equListCode); notice.setEquListCode(equListCode);
EquipmentCategory equipmentCategory1 = equipmentCategoryMapper.selectOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode, equListCode)); EquipmentCategory equipmentCategory1 = equipmentCategoryMapper.selectOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode, equListCode));
notice.setEquListName(ValidationUtil.isEmpty(equipmentCategory1) ? null : equipmentCategory1.getName()); notice.setEquListName(ValidationUtil.isEmpty(equipmentCategory1) ? null : equipmentCategory1.getName());
...@@ -491,27 +512,26 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -491,27 +512,26 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} else { } else {
notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode())); notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
} }
// 压力管道情况处理
// notice.setCreateUserId(reginParams.getUserModel().getUserId()); if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)) {
// 插入业务单 oldPipJsonData = this.getNowPipJsonData(String.valueOf(jsonObject.get(PROJECT_CONTRAPTION_ID)));
jgReformNoticeMapper.insert(notice); notice.setPipeLengthChanged(this.calculatePipeLengthChange(JSONArray.parseArray(JSON.toJSONString(oldPipJsonData.get(PIPELINE_LIST))), JSONArray.parseArray(JSON.toJSONString(jsonObject.get(PIPELINE_LIST)))));
}
List<JgReformNoticeEq> noticeEqs = new ArrayList<>(); this.saveOrUpdateHisData(String.valueOf(sequenceNbr), jsonObject, oldPipJsonData);
// 更新设备关系表
deviceList.forEach(obj -> {
JgReformNoticeEq jgRelationEquip = new JgReformNoticeEq();
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(String.valueOf(sequenceNbr));
noticeEqs.add(jgRelationEquip);
});
jgReformNoticeEqMapper.insertBatchSomeColumn(noticeEqs);
if (SUBMIT_TYPE_FLOW.equals(submitType)) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
this.buildTask(notice, workflowResultList); this.buildTask(notice, workflowResultList);
} else { } else {
this.saveTempReformNotice(notice); this.saveTempReformNotice(notice);
} }
// 插入业务单
jgReformNoticeMapper.insert(notice);
// 更新设备关系表
deviceList.stream().filter(obj -> Objects.isNull(obj.get(RECORD)))
.map(obj -> new JgReformNoticeEq()
.setEquId(obj.get(RECORD).toString())
.setEquipTransferId(String.valueOf(sequenceNbr)))
.forEach(noticeEqs::add);
jgReformNoticeEqMapper.insertBatchSomeColumn(noticeEqs);
this.updateRedisBatch(Collections.singletonList(notice)); this.updateRedisBatch(Collections.singletonList(notice));
return Collections.singletonList(notice); return Collections.singletonList(notice);
} catch (BadRequest | LocalBadRequest e) { } catch (BadRequest | LocalBadRequest e) {
...@@ -527,8 +547,34 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -527,8 +547,34 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} }
} }
/**
* 计算管道长度变化 正值为增长,负值为减少
*
* @param oldPipData 旧管道数据
* @param newPipData 新管道数据
* @return 管道长度变化,正值为增长,负值为减少
*/
private String calculatePipeLengthChange(JSONArray oldPipData, JSONArray newPipData) {
double oldPipLen = oldPipData.stream().mapToDouble(item -> JSONObject.parseObject(item.toString()).getDoubleValue(PIPE_LENGTH)).sum();
double newPipLen = newPipData.stream().mapToDouble(item -> JSONObject.parseObject(item.toString()).getDoubleValue(PIPE_LENGTH)).sum();
double change = newPipLen - oldPipLen;
return change == 0 ? "0" : String.format("%+.2f", change);
}
private JSONObject getNowPipJsonData(String projectContraptionId) {
return new JSONObject(Optional.ofNullable(idxBizJgProjectContraptionMapper.getDetail(projectContraptionId))
.map(map -> {
commonService.convertStringToJsonobject(map, IdxBizJgProjectContraptionServiceImpl.jsonFields);
map.put(PIPELINE_LIST, idxBizJgProjectContraptionMapper.selectEquipList((String) map.get(SEQUENCE_NBR)));
return map;
})
.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 -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode)); equipList.forEach(equipMap ->
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) {
...@@ -850,8 +896,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -850,8 +896,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
noticeEq.setInformNumber(deviceRegistrationCode); noticeEq.setInformNumber(deviceRegistrationCode);
jgReformNoticeEqMapper.updateById(noticeEq); jgReformNoticeEqMapper.updateById(noticeEq);
}); });
// 通过时记录历史数据 // 通过时记录或更新历史数据
this.saveHisDataBeforeUpdate(String.valueOf(jgReformNotice.getSequenceNbr()), jsonObject); 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("");
...@@ -896,8 +942,29 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -896,8 +942,29 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} }
private void saveHisDataBeforeUpdate(String sequenceNbr, JSONObject jsonObject) { private void saveOrUpdateHisData(String sequenceNbr, JSONObject changeData, JSONObject oldData) {
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName(), new JSONObject(jsonObject), null, sequenceNbr); this.saveOrUpdateHistory(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName(), new JSONObject(changeData), new JSONObject(oldData), sequenceNbr);
}
public void saveOrUpdateHistory(String registrationClass, JSON changeData, JSON oldData, String currentDocumentId) {
JgRegistrationHistory jgRegistrationHistory = new JgRegistrationHistory();
LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda();
lambda.eq(JgRegistrationHistory::getCurrentDocumentId, currentDocumentId);
lambda.eq(JgRegistrationHistory::getIsDelete, false);
Integer integer = jgRegistrationHistoryService.getBaseMapper().selectCount(lambda);
if (integer > 0) {
jgRegistrationHistory.setChangeData(JSON.toJSONString(changeData));
jgRegistrationHistory.setOldData(JSON.toJSONString(oldData));
jgRegistrationHistoryService.update(jgRegistrationHistory, lambda);
} else {
jgRegistrationHistory.setChangeData(JSON.toJSONString(changeData));
jgRegistrationHistory.setOldData(JSON.toJSONString(oldData));
jgRegistrationHistory.setStatus("new");
jgRegistrationHistory.setRegistrationClass(registrationClass);
jgRegistrationHistory.setEquId(null);
jgRegistrationHistory.setCurrentDocumentId(currentDocumentId);
jgRegistrationHistoryService.save(jgRegistrationHistory);
}
} }
public InstanceRuntimeData buildInstanceRuntimeData(JgReformNotice jgReformNotice) { public InstanceRuntimeData buildInstanceRuntimeData(JgReformNotice jgReformNotice) {
...@@ -1008,7 +1075,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1008,7 +1075,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
Iterable<ESEquipmentCategoryDto> esEquipmentCategoryDtos = esEquipmentCategory.findAllById(equList); Iterable<ESEquipmentCategoryDto> esEquipmentCategoryDtos = esEquipmentCategory.findAllById(equList);
List<Map<String, Object>> deviceList = getEquipListMaps(esEquipmentCategoryDtos); List<Map<String, Object>> deviceList = getEquipListMaps(esEquipmentCategoryDtos);
jsonObject.put("deviceList", deviceList); jsonObject.put("deviceList", deviceList);
this.saveHisDataBeforeUpdate(String.valueOf(reformNotice.getSequenceNbr()), jsonObject); this.saveOrUpdateHisData(String.valueOf(reformNotice.getSequenceNbr()), jsonObject, null);
} }
@Override @Override
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<select id="getDetail" resultType="java.util.Map"> <select id="getDetail" resultType="java.util.Map">
SELECT SELECT
SEQUENCE_NBR, SEQUENCE_NBR,
SEQUENCE_NBR as projectContraptionId,
USE_UNIT_CREDIT_CODE, USE_UNIT_CREDIT_CODE,
EQU_LIST, EQU_LIST,
EQU_CATEGORY, EQU_CATEGORY,
......
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