Commit 34c48c6f authored by 韩桐桐's avatar 韩桐桐

fix(jg):改造告知通过驳回接口+作废接口调整

parent 4f55def9
...@@ -184,6 +184,9 @@ public class JgReformNoticeDto extends BaseDto { ...@@ -184,6 +184,9 @@ public class JgReformNoticeDto extends BaseDto {
@ApiModelProperty(value = "管道列表") @ApiModelProperty(value = "管道列表")
private List<Map<String, Object>> pipelineList; private List<Map<String, Object>> pipelineList;
@ApiModelProperty(value = "删除的管道列表")
private List<Map<String, Object>> delPipelineList;
@ApiModelProperty (value = "区名字") @ApiModelProperty (value = "区名字")
private String countyName; private String countyName;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
isn.inform_number AS informNumber, isn.inform_number AS informNumber,
isn.next_task_id as nextTaskId, isn.next_task_id as nextTaskId,
isn.cancel_reason as cancelReason, isn.cancel_reason as cancelReason,
isn.project_contraption_id as projectContraptionId,
DATE_FORMAT(isn.plan_date,'%Y-%m-%d') AS planDate, DATE_FORMAT(isn.plan_date,'%Y-%m-%d') AS planDate,
DATE_FORMAT(isn.notice_date,'%Y-%m-%d') AS noticeDate, DATE_FORMAT(isn.notice_date,'%Y-%m-%d') AS noticeDate,
DATE_FORMAT(isn.accept_date,'%Y-%m-%d') AS acceptDate, DATE_FORMAT(isn.accept_date,'%Y-%m-%d') AS acceptDate,
......
...@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -7,6 +7,7 @@ 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;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil; import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.util.StringUtil; import com.github.pagehelper.util.StringUtil;
...@@ -34,12 +35,9 @@ import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext; ...@@ -34,12 +35,9 @@ import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent; import com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent;
import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher; import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService; import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils; 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.*;
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.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
...@@ -50,6 +48,7 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; ...@@ -50,6 +48,7 @@ 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 lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
...@@ -74,6 +73,8 @@ import java.util.*; ...@@ -74,6 +73,8 @@ import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.toJSONString;
/** /**
* 改造告知服务实现类 * 改造告知服务实现类
* *
...@@ -82,6 +83,7 @@ import java.util.stream.Collectors; ...@@ -82,6 +83,7 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@Slf4j @Slf4j
@RequiredArgsConstructor
public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, JgReformNotice, JgReformNoticeMapper> implements IJgReformNoticeService, ICompensateFlowDataOfRedis<JgReformNotice> { public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, JgReformNotice, JgReformNoticeMapper> implements IJgReformNoticeService, ICompensateFlowDataOfRedis<JgReformNotice> {
private static final String SUBMIT_TYPE_FLOW = "1"; private static final String SUBMIT_TYPE_FLOW = "1";
...@@ -96,51 +98,44 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -96,51 +98,44 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
public static final String EQU_CATEGORY_CODE = "EQU_CATEGORY_CODE"; public static final String EQU_CATEGORY_CODE = "EQU_CATEGORY_CODE";
public static final String EQUIP_INFO = "equipInfo"; public static final String EQUIP_INFO = "equipInfo";
public static final String PROJECT_CONTRAPTION_ID = "projectContraptionId"; public static final String PROJECT_CONTRAPTION_ID = "projectContraptionId";
public static final String PRODUCT_PHOTO = "PRODUCT_PHOTO";
public static final String PRODUCT_QUALIFICATION_CERTIFICATE = "PRODUCT_QUALIFICATION_CERTIFICATE";
public static final String OTHER_ACCESSORIES = "OTHER_ACCESSORIES";
public static final String DEL_PIPELINE_LIST = "delPipelineList";
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";
// 咸阳行政区划code // 咸阳行政区划code
private static final String XIAN_YANG = "610400"; private static final String XIAN_YANG = "610400";
private final EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired private final JgReformNoticeEqMapper jgReformNoticeEqMapper;
EquipmentCategoryMapper equipmentCategoryMapper; private final RegistrationInfoMapper tzsJgRegistrationInfoMapper;
private final OtherInfoMapper otherInfoMapper;
@Autowired private final TzsServiceFeignClient tzsServiceFeignClient;
JgReformNoticeEqMapper jgReformNoticeEqMapper; private final IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper;
@Autowired private final RedisUtils redisUtils;
RegistrationInfoMapper tzsJgRegistrationInfoMapper; private final SnowflakeIdUtil sequence;
@Autowired private final JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
OtherInfoMapper tzsJgOtherInfoMapper; private final JgInstallationNoticeServiceImpl jgInstallationNoticeService;
@Autowired private final JgReformNoticeMapper jgReformNoticeMapper;
TzsServiceFeignClient tzsServiceFeignClient; private final CommonServiceImpl commonService;
@Autowired private final CmWorkflowServiceImpl cmWorkflowService;
IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper; private final RedissonClient redissonClient;
@Autowired private final JgRegistrationHistoryMapper jgRegistrationHistoryMapper;
RedisUtils redisUtils; private final SuperviseInfoMapper superviseInfoMapper;
@Autowired private final ESEquipmentCategory esEquipmentCategory;
private SnowflakeIdUtil sequence; private final EventPublisher eventPublisher;
@Autowired private final ICmWorkflowService iCmWorkflowService;
JgRegistrationHistoryServiceImpl jgRegistrationHistoryService; private final IIdxBizJgUseInfoService idxBizJgUseInfoService;
@Autowired private final IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoService;
JgInstallationNoticeServiceImpl jgInstallationNoticeService; private final IIdxBizJgConstructionInfoService iIdxBizJgConstructionInfoService;
@Autowired private final IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
private JgReformNoticeMapper jgReformNoticeMapper; private final IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoServiceImpl;
@Autowired private final IIdxBizJgOtherInfoService iIdxBizJgOtherInfoService;
private CommonServiceImpl commonService; private final IIdxBizJgSupervisionInfoService iIdxBizJgSupervisionInfoService;
@Autowired private final IdxBizJgInspectionDetectionInfoServiceImpl idxBizJgInspectionDetectionInfoService;
private CmWorkflowServiceImpl cmWorkflowService; private final IIdxBizJgTechParamsPipelineService iIdxBizJgTechParamsPipelineService;
@Autowired private final JgUseRegistrationServiceImpl useRegistrationService;
private RedissonClient redissonClient;
@Autowired
private JgRegistrationHistoryMapper jgRegistrationHistoryMapper;
@Autowired
ESEquipmentCategory esEquipmentCategory;
@Autowired
private EventPublisher eventPublisher;
@Autowired
private ICmWorkflowService iCmWorkflowService;
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
...@@ -213,7 +208,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -213,7 +208,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
/** /**
* 更新改造告知 * 更新改造告知
*
*/ */
@SuppressWarnings({"rawtypes", "Duplicates"}) @SuppressWarnings({"rawtypes", "Duplicates"})
public JgReformNoticeDto updateNotice(String submitType, Map<String, Object> noticeMap, String op) { public JgReformNoticeDto updateNotice(String submitType, Map<String, Object> noticeMap, String op) {
...@@ -358,6 +352,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -358,6 +352,8 @@ 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);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
noticePage.setRecords(mappedRecords); noticePage.setRecords(mappedRecords);
...@@ -449,7 +445,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -449,7 +445,7 @@ 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 = !EquipmentClassifityEnum.YLGD.getCode().equals(equListCode) ? model.getDeviceList() : model.getPipelineList();
if (CollectionUtils.isEmpty(deviceList)) { if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("请选择设备!"); throw new BadRequest("请选择设备!");
} }
...@@ -515,7 +511,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -515,7 +511,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))), JSONArray.parseArray(JSON.toJSONString(jsonObject.get(PIPELINE_LIST))))); notice.setPipeLengthChanged(this.calculatePipeLengthChange(JSONArray.parseArray(JSON.toJSONString(oldPipJsonData.get(PIPELINE_LIST))),
JSONArray.parseArray(JSON.toJSONString(jsonObject.get(PIPELINE_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)) {
...@@ -526,7 +523,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -526,7 +523,7 @@ 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(RECORD)))
.map(obj -> new JgReformNoticeEq() .map(obj -> new JgReformNoticeEq()
.setEquId(obj.get(RECORD).toString()) .setEquId(obj.get(RECORD).toString())
.setEquipTransferId(String.valueOf(sequenceNbr))) .setEquipTransferId(String.valueOf(sequenceNbr)))
...@@ -872,7 +869,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -872,7 +869,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
jgReformNotice.setPromoter(reginParams.getUserModel().getUserId()); jgReformNotice.setPromoter(reginParams.getUserModel().getUserId());
jgReformNotice.setRemark(jgReformNoticeDto.getRemark()); jgReformNotice.setRemark(jgReformNoticeDto.getRemark());
TaskV2Model taskV2Model; TaskV2Model taskV2Model;
if ("0".equals(op)) { if ("0".equals(op)) {// 通过
if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) { if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) {
LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, jgReformNoticeDto.getSequenceNbr()); queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, jgReformNoticeDto.getSequenceNbr());
...@@ -901,6 +898,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -901,6 +898,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
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("");
// 压力管道情况处理
this.YLGDDataPassHandler(jgReformNotice);
this.updateLastTodo(jgReformNotice, FlowStatusEnum.TO_BE_FINISHED); this.updateLastTodo(jgReformNotice, FlowStatusEnum.TO_BE_FINISHED);
this.updateById(jgReformNotice); this.updateById(jgReformNotice);
} else { } else {
...@@ -941,9 +940,232 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -941,9 +940,232 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} }
} }
/**
* redis获取用户信息
**/
protected ReginParams getSelectedOrgInfo() {
return JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
}
private void YLGDDataPassHandler(JgReformNotice notice) {
if (!EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode())) {
return;
}
// 1.更新工程装置数据
JgRegistrationHistory registrationHistory = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>().eq(JgRegistrationHistory::getCurrentDocumentId, notice.getSequenceNbr()));
JSONObject newData = JSONObject.parseObject(registrationHistory.getChangeData());
JSONArray newPipData = JSONArray.parseArray(newData.getString(PIPELINE_LIST));
JSONArray delPipData = JSONArray.parseArray(newData.getString(DEL_PIPELINE_LIST));
JSONObject oldData = JSONObject.parseObject(registrationHistory.getOldData());
JSONArray oldPipData = JSONArray.parseArray(oldData.getString(PIPELINE_LIST));
// 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> toAddPipData = newPipData.stream().filter(item -> StringUtils.isEmpty(JSON.parseObject(item.toString()).getString(RECORD))).map(item -> JSON.parseObject(item.toString())).collect(Collectors.toList());
List<String> toDeletePipRecords = delPipData.stream().map(item -> JSON.parseObject(item.toString()).getString(RECORD)).collect(Collectors.toList());
this.addPipDataWithFlowPass(toAddPipData, notice);
this.updatePipDataWithFlowPass(toUpdatePipData);
this.delPipDataWithFlowPass(toDeletePipRecords);
// 1.2更新工程装置中的【基本信息】 + 【使用信息】 + 管道长度等
// List<String> lastAllRecords = new ArrayList<>();
// lastAllRecords.addAll(toUpdatePipRecords);
// lastAllRecords.addAll(toAddPipDataRecords);
// lastAllRecords.forEach(record -> {
// 产品照片 PRODUCT_PHOTO
// String productPhoto = JSON.toJSONString(newData.get(PRODUCT_PHOTO));
// idxBizJgRegisterInfoService.update(new LambdaUpdateWrapper<IdxBizJgRegisterInfo>().set(IdxBizJgRegisterInfo::getProductPhoto, productPhoto).eq(IdxBizJgRegisterInfo::getRecord, record));
// });
// 产品质量合格证明 PRODUCT_QUALIFICATION_CERTIFICATE 其他附件 OTHER_ACCESSORIES 管道总长度
// String productQualificationCertificate = JSON.toJSONString(newData.get(PRODUCT_QUALIFICATION_CERTIFICATE));
// String otherAccessories = JSON.toJSONString(newData.get(OTHER_ACCESSORIES));
double pipLengthLastSum = newPipData.stream().mapToDouble(item -> JSONObject.parseObject(item.toString()).getDoubleValue(PIPE_LENGTH)).sum();
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<IdxBizJgProjectContraption>()
.eq(IdxBizJgProjectContraption::getSequenceNbr, notice.getProjectContraptionId())
// .set(IdxBizJgProjectContraption::getProductQualificationCertificate, productQualificationCertificate)
// .set(IdxBizJgProjectContraption::getOtherAccessories, otherAccessories)
.set(IdxBizJgProjectContraption::getPipelineLength, pipLengthLastSum)
.set(IdxBizJgProjectContraption::getPipeLengthChanged, notice.getPipeLengthChanged());
idxBizJgProjectContraptionMapper.update(null, updateWrapper);
}
private void delPipDataWithFlowPass(List<String> toDeletePipRecords) {
List<ESEquipmentCategoryDto> esEquipmentCategoryDtoList = toDeletePipRecords.stream().map(
record -> new ESEquipmentCategoryDto().setSEQUENCE_NBR(record)
).collect(Collectors.toList());
// 删除涉及的19张表的数据
superviseInfoMapper.deleteDataAll(toDeletePipRecords);
// 删除es中的数据
esEquipmentCategory.deleteAll(esEquipmentCategoryDtoList);
}
private void updatePipDataWithFlowPass(List<JSONObject> toUpdatePipData) {
toUpdatePipData.forEach(pipData -> {
String record = pipData.getString(RECORD);
String pipeName = pipData.getString("pipeName");
String pipelineNumber = pipData.getString("pipelineNumber");
String deviceLevel = pipData.getString("deviceLevel");
String nominalDiameter = pipData.getString("nominalDiameter");
String wallThickness = pipData.getString("wallThickness");
String pipeLength = pipData.getString("pipeLength");
String pressure = pipData.getString("pressure");
String temperature = pipData.getString("temperature");
String medium = pipData.getString("medium");
String workPressure = pipData.getString("workPressure");
String workTemperature = pipData.getString("workTemperature");
String workMedium = pipData.getString("workMedium");
String remarks = pipData.getString("remarks");
LambdaUpdateWrapper<IdxBizJgTechParamsPipeline> pipelineLambdaUpdateWrapper = new LambdaUpdateWrapper<IdxBizJgTechParamsPipeline>().eq(IdxBizJgTechParamsPipeline::getRecord, record)
.set(IdxBizJgTechParamsPipeline::getPipeName, pipeName)
.set(IdxBizJgTechParamsPipeline::getPipelineNumber, pipelineNumber)
.set(IdxBizJgTechParamsPipeline::getDeviceLevel, deviceLevel)
.set(IdxBizJgTechParamsPipeline::getNominalDiameter, nominalDiameter)
.set(IdxBizJgTechParamsPipeline::getWallThickness, wallThickness)
.set(IdxBizJgTechParamsPipeline::getPipeLength, pipeLength)
.set(IdxBizJgTechParamsPipeline::getPressure, pressure)
.set(IdxBizJgTechParamsPipeline::getTemperature, temperature)
.set(IdxBizJgTechParamsPipeline::getMedium, medium)
.set(IdxBizJgTechParamsPipeline::getWorkPressure, workPressure)
.set(IdxBizJgTechParamsPipeline::getWorkTemperature, workTemperature)
.set(IdxBizJgTechParamsPipeline::getWorkMedium, workMedium)
.set(IdxBizJgTechParamsPipeline::getRemarks, remarks);
iIdxBizJgTechParamsPipelineService.update(pipelineLambdaUpdateWrapper);
});
}
private void addPipDataWithFlowPass(List<JSONObject> toAddPipData, JgReformNotice notice) {
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(notice.getProjectContraptionId());
List<IdxBizJgUseInfo> useInfoList = new ArrayList<>(15);
List<IdxBizJgDesignInfo> designInfoList = new ArrayList<>(15);
List<IdxBizJgFactoryInfo> factoryInfoList = new ArrayList<>(15);
List<IdxBizJgConstructionInfo> constructionInfoList = new ArrayList<>(15);
List<IdxBizJgRegisterInfo> registerInfoList = new ArrayList<>(15);
List<IdxBizJgSupervisionInfo> supervisionInfoList = new ArrayList<>(15);
List<IdxBizJgOtherInfo> otherInfoList = new ArrayList<>(15);
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = new ArrayList<>(15);
List<IdxBizJgTechParamsPipeline> paramsPipelineList = new ArrayList<>(15);
List<ESEquipmentCategoryDto> esEquipmentCategoryList = new ArrayList<>(15);
// 设备信息
toAddPipData.forEach(pipData -> {
String record = UUID.randomUUID().toString();
Date date = new Date();
// 使用信息
IdxBizJgUseInfo useInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgUseInfo.class);
// 使用信息
useInfo.setRecord(record);
useInfo.setSequenceNbr(null);
useInfo.setRecDate(date);
useInfo.setDataSource("jg");
useInfo.setIsIntoManagement(Boolean.TRUE);
useInfo.setUseUnitCreditCode(notice.getUseUnitCreditCode());
useInfo.setUseUnitName(notice.getUseUnitName());
useInfo.setEquState("1");
useInfo.setProjectContraption(notice.getProjectContraption());
useInfo.setProjectContraptionId(notice.getProjectContraptionId());
useInfoList.add(useInfo);
// 设计信息
IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgDesignInfo.class);
designInfo.setRecord(record);
designInfo.setRecDate(date);
designInfo.setSequenceNbr(null);
designInfoList.add(designInfo);
// 制造信息
IdxBizJgFactoryInfo factoryInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgFactoryInfo.class);
factoryInfo.setRecord(record);
factoryInfo.setRecDate(date);
factoryInfo.setSequenceNbr(null);
factoryInfoList.add(factoryInfo);
// 施工信息
IdxBizJgConstructionInfo constructionInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgConstructionInfo.class);
CompanyBo company = this.getSelectedOrgInfo().getCompany();
constructionInfo.setRecord(record);
constructionInfo.setRecDate(date);
constructionInfo.setUscUnitCreditCode(company.getCompanyCode());
constructionInfo.setUscUnitName(company.getCompanyName());
constructionInfo.setSequenceNbr(null);
constructionInfoList.add(constructionInfo);
// 注册登记信息
IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgRegisterInfo.class);
registerInfo.setRecord(record);
registerInfo.setRecDate(date);
registerInfo.setSequenceNbr(null);
registerInfo.setEquCodeType("2");
registerInfo.setRegisterState("6045");
registerInfo.setEquCode(useRegistrationService.generateEquCode(projectContraption.getEquList(), projectContraption.getEquCategory(), projectContraption.getEquDefine(), date, notice.getReceiveCompanyCode()));
registerInfo.setProductName(pipData.getString("pipeName"));
registerInfoList.add(registerInfo);
// 监督管理
IdxBizJgSupervisionInfo supervisionInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgSupervisionInfo.class);
supervisionInfo.setRecord(record);
supervisionInfo.setRecDate(date);
supervisionInfo.setSequenceNbr(null);
supervisionInfoList.add(supervisionInfo);
// 其他信息
IdxBizJgOtherInfo otherInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgOtherInfo.class);
otherInfo.setRecord(record);
otherInfo.setSequenceNbr(null);
otherInfo.setClaimStatus("已认领");
otherInfo.setRecDate(date);
otherInfo.setSupervisoryCode(projectContraption.getSupervisoryCode());
otherInfo.setCylinderStampAttachment("");
otherInfo.setInformationSituation("");
otherInfo.setInformationManageCode("");
otherInfoList.add(otherInfo);
// 管道技术参数
IdxBizJgTechParamsPipeline pipelineInfo = JSON.parseObject(toJSONString(pipData), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipelineInfo)) {
pipelineInfo.setRecord(record);
pipelineInfo.setRecDate(date);
pipelineInfo.setSequenceNbr(null);
paramsPipelineList.add(pipelineInfo);
}
ESEquipmentCategoryDto esEquipmentDto = JSON.parseObject(toJSONString(pipData), ESEquipmentCategoryDto.class);
esEquipmentDto.setDATA_SOURCE(useInfo.getDataSource());
esEquipmentDto.setREC_DATE(System.currentTimeMillis());
esEquipmentDto.setSEQUENCE_NBR(record);
esEquipmentDto.setIS_INTO_MANAGEMENT(false);
esEquipmentDto.setEQU_CATEGORY_CODE(projectContraption.getEquCategory());
esEquipmentDto.setEQU_CATEGORY(projectContraption.getEquCategoryName());
esEquipmentDto.setEQU_LIST_CODE(projectContraption.getEquList());
esEquipmentDto.setEQU_LIST(projectContraption.getEquListName());
esEquipmentDto.setEQU_DEFINE_CODE(projectContraption.getEquDefine());
esEquipmentDto.setEQU_DEFINE(projectContraption.getEquDefineName());
esEquipmentDto.setSTATUS("已认领");
esEquipmentDto.setUSC_UNIT_CREDIT_CODE(projectContraption.getUscUnitCreditCode());
esEquipmentDto.setUSC_UNIT_NAME(projectContraption.getUscUnitName());
esEquipmentDto.setUSE_UNIT_CREDIT_CODE(projectContraption.getUseUnitCreditCode());
esEquipmentDto.setUSE_UNIT_NAME(projectContraption.getUseUnitName());
esEquipmentDto.setPROJECT_CONTRAPTION(projectContraption.getProjectContraption());
esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
esEquipmentDto.setProjectContraptionId(notice.getProjectContraptionId());
esEquipmentCategoryList.add(esEquipmentDto);
});
idxBizJgUseInfoService.saveBatch(useInfoList);
idxBizJgDesignInfoService.saveBatch(designInfoList);
iIdxBizJgConstructionInfoService.saveBatch(constructionInfoList);
idxBizJgFactoryInfoService.saveBatch(factoryInfoList);
idxBizJgRegisterInfoServiceImpl.saveBatch(registerInfoList);
iIdxBizJgOtherInfoService.saveBatch(otherInfoList);
iIdxBizJgSupervisionInfoService.saveBatch(supervisionInfoList);
idxBizJgInspectionDetectionInfoService.saveBatch(inspectionDetectionInfoList);
iIdxBizJgTechParamsPipelineService.saveBatch(paramsPipelineList);
esEquipmentCategory.saveAll(esEquipmentCategoryList);
}
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), new JSONObject(oldData), 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) { public void saveOrUpdateHistory(String registrationClass, JSON changeData, JSON oldData, String currentDocumentId) {
...@@ -1032,12 +1254,14 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1032,12 +1254,14 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
case TO_BE_SUBMITTED: // 待提交 case TO_BE_SUBMITTED: // 待提交
// 1.删除暂存时生成的待办 // 1.删除暂存时生成的待办
commonService.deleteTasksByRelationId(reformNotice.getSequenceNbr() + ""); commonService.deleteTasksByRelationId(reformNotice.getSequenceNbr() + "");
// 4.记录到历史表 // 4.记录到历史表 目前保存历史表的操作已经在保存业务/更新业务时,后续此处不在需要,当前保留为了确保本次上线前的已经提交的数据作废能留痕
this.recordHistoryWhenVoided(reformNotice); this.recordHistoryWhenVoided(reformNotice);
break; break;
case TO_BE_FINISHED: // 已完成 case TO_BE_FINISHED: // 已完成
// 1.清空redis 缓存的流程中及已完成安装告知的设备 // 1.清空redis 缓存的流程中及已完成安装告知的设备
this.delRepeatUseEquipData(reformNotice); this.delRepeatUseEquipData(reformNotice);
// 2.压力管道回退到改造前的设备数据
this.fallbackDataWithFlowPass(reformNotice);
break; break;
default: default:
// 流程中(驳回、撤回等) // 流程中(驳回、撤回等)
...@@ -1052,6 +1276,28 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1052,6 +1276,28 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} }
} }
/**
* 压力管道回退到改造前的设备数据
*
* @param notice
*/
private void fallbackDataWithFlowPass(JgReformNotice notice) {
if (!EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode())) {
return;
}
JgRegistrationHistory registrationHistory = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>().eq(JgRegistrationHistory::getCurrentDocumentId, notice.getSequenceNbr()));
JSONObject newData = JSONObject.parseObject(registrationHistory.getChangeData());
JSONArray alreadyDelPipData = JSONArray.parseArray(newData.getString(DEL_PIPELINE_LIST));
JSONObject oldData = JSONObject.parseObject(registrationHistory.getOldData());
JSONArray oldPipData = JSONArray.parseArray(oldData.getString(PIPELINE_LIST));
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<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());
this.addPipDataWithFlowPass(toAddPipData, notice);
this.delPipDataWithFlowPass(toDeletePipRecords);
}
private void finishedTask(JgReformNotice reformNotice) { private void finishedTask(JgReformNotice reformNotice) {
HashMap<String, Object> taskMap = new HashMap<>(); HashMap<String, Object> taskMap = new HashMap<>();
taskMap.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); taskMap.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
...@@ -1067,20 +1313,21 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -1067,20 +1313,21 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
/** /**
* 作废时记录数据到历史表 * 作废时记录数据到历史表
*
* @param reformNotice * @param reformNotice
*/ */
private void recordHistoryWhenVoided(JgReformNotice reformNotice) { private void recordHistoryWhenVoided(JgReformNotice reformNotice) {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(reformNotice)); JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(this.queryBySequenceNbr(reformNotice.getSequenceNbr())));
List<String> equList = getEquList(reformNotice); // List<String> equList = getEquList(reformNotice);
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.saveOrUpdateHisData(String.valueOf(reformNotice.getSequenceNbr()), jsonObject, null); this.saveOrUpdateHisData(String.valueOf(reformNotice.getSequenceNbr()), jsonObject, null);
} }
@Override @Override
public boolean beforeCheck(JgReformNotice jgReformNotice) { public boolean beforeCheck(JgReformNotice jgReformNotice) {
return jgReformNotice.getInstanceId() != null && !jgReformNotice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())) &&!jgReformNotice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_DISCARD.getCode())); return jgReformNotice.getInstanceId() != null && !jgReformNotice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())) && !jgReformNotice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_DISCARD.getCode()));
} }
@Override @Override
......
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