Commit 3f45ecb4 authored by 刘林's avatar 刘林

fix(jg):处理车用气瓶和安装告知错误数据

parent bd8b650d
......@@ -7,10 +7,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServ
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -88,4 +85,17 @@ public class JgInstallationByWorkFlowController {
jgInstallationNoticeServiceImpl.accept(jgInstallationNoticeDto, op);
return ResponseHelper.buildResponse(null);
}
/**
* 处理安装告知流程结束,业务未结束单子问题
* @param applyNo 申请单号
* @return s
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/handleNoticeWrongData")
@ApiOperation(httpMethod = "POST", value = "处理安装告知流程结束,业务未结束单子问题", notes = "处理安装告知流程结束,业务未结束单子问题")
public ResponseModel<Object> handleNoticeWrongData(@RequestParam("applyNo") String applyNo) {
jgInstallationNoticeServiceImpl.handleNoticeWrongData(applyNo);
return ResponseHelper.buildResponse("ok");
}
}
......@@ -248,4 +248,19 @@ public class JgVehicleInformationController extends BaseController {
public ResponseModel<Object> saveOrUpdateHisData(@RequestBody JSONObject map) {
return ResponseHelper.buildResponse(jgVehicleInformationServiceImpl.saveOrUpdateHisData(map));
}
/**
* 处理车用气瓶流程结束,业务未结束单子问题
* @param applyNo 申请单号
* @param equDefineCode 设备品种code
* @return s
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/handleVehicleWrongData")
@ApiOperation(httpMethod = "POST", value = "处理车用气瓶流程结束,业务未结束单子问题", notes = "处理车用气瓶流程结束,业务未结束单子问题")
public ResponseModel<Object> handleVehicleWrongData(@RequestParam("applyNo") String applyNo,
@RequestParam("equDefineCode") String equDefineCode) {
jgVehicleInformationServiceImpl.handleVehicleWrongData(applyNo, equDefineCode);
return ResponseHelper.buildResponse("ok");
}
}
......@@ -212,6 +212,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
List<String> useInnerCodeList = new ArrayList<>();// 单位内部编号集合
List<String> equCodeList = new ArrayList<>();// 设备代码集合
List<String> factoryNumList = new ArrayList<>();
private static final int MAX_UPLOAD = 2000; // 最大上传条数
// 出厂编码集合
@Autowired
RestHighLevelClient restHighLevelClient;
......@@ -1058,7 +1059,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 根据96333码检查唯一性
LambdaQueryWrapper<IdxBizJgOtherInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizJgOtherInfo::getCode96333, equipmentInfoForm.get(CODE96333));
wrapper.notIn(IdxBizJgOtherInfo::getClaimStatus, "待认领", "已拒领", "草稿");
wrapper.notIn(IdxBizJgOtherInfo::getClaimStatus, "待认领,已拒领,草稿");
wrapper.ne(!ObjectUtils.isEmpty(equipmentInfoForm.get(OTHERINFO_SEQ)), IdxBizJgOtherInfo::getSequenceNbr, equipmentInfoForm.get(OTHERINFO_SEQ));
Integer count = otherInfoMapper.selectCount(wrapper);
if (count > 0) {
......@@ -4139,6 +4140,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!checkMsg.isEmpty()) {
resultError.add(checkMsg);
}
// 限制最大上传数量
if (aircraftList.size() > MAX_UPLOAD) {
resultError.add("每次最多允许上传 " + MAX_UPLOAD + " 条数据,请分批上传!");
throw new BadRequest(resultError.stream().filter(s -> !s.isEmpty()).collect(Collectors.joining("<br/>")));
}
}
@Override
......
......@@ -361,16 +361,17 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
/**
* 历史数据填充设备种类、设备类别、设备品种
*
* @param detail 返回json
* @param notice 当前单据
*/
private void fillingEquCategoryNameForHisData(Map<String, Object> detail, JgInstallationNotice notice) {
if(!StringUtils.isEmpty(notice.getProjectContraptionId())){
if (!StringUtils.isEmpty(notice.getProjectContraptionId())) {
LambdaQueryWrapper<IdxBizJgProjectContraption> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BaseEntity::getSequenceNbr, notice.getProjectContraptionId());
queryWrapper.select(IdxBizJgProjectContraption::getEquListName,IdxBizJgProjectContraption::getEquCategoryName,IdxBizJgProjectContraption::getEquDefineName,BaseEntity::getSequenceNbr);
queryWrapper.select(IdxBizJgProjectContraption::getEquListName, IdxBizJgProjectContraption::getEquCategoryName, IdxBizJgProjectContraption::getEquDefineName, BaseEntity::getSequenceNbr);
IdxBizJgProjectContraption projectContraption = projectContraptionService.getBaseMapper().selectOne(queryWrapper);
if(projectContraption != null){
if (projectContraption != null) {
detail.put("equListName", projectContraption.getEquListName());
detail.put("equCategoryName", projectContraption.getEquCategoryName());
detail.put("equDefineName", projectContraption.getEquDefineName());
......@@ -584,7 +585,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
lambda.eq(JgInstallationNoticeEq::getEquipTransferId, noticeDto.getSequenceNbr());
jgInstallationNoticeEqMapper.delete(lambda);
List<Map<String, Object>> deviceList = noticeDto.getDeviceList();
if(!CollectionUtils.isEmpty(deviceList)){
if (!CollectionUtils.isEmpty(deviceList)) {
ArrayList<JgInstallationNoticeEq> jgInstallationNoticeEqs = new ArrayList<>();
deviceList.forEach(item -> {
JgInstallationNoticeEq jgInstallationNoticeEq = new JgInstallationNoticeEq();
......@@ -738,21 +739,22 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
//获取管道和气瓶的基本信息汇总表
List<CompletableFuture<byte[]>> exportSummaryBasicInfoData = jgUseRegistrationService.getExportSummaryBasicInfoData(Collections.singletonList(Long.valueOf(sequenceNbr)), jgInstallationNotice.getEquCategoryCode(), "安装告知", Boolean.TRUE, null);
toZipFileByData(response, exportSummaryBasicInfoData, templateToPdfData, jgInstallationNotice.getApplyNo());
}else {
} else {
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", map, response);
}
}
/**
* 将数据全部压缩成zip
*
* @param response
* @param exportSummaryBasicInfoData
* @param templateToPdfData
* @param applyNo
*/
private void toZipFileByData(HttpServletResponse response, List<CompletableFuture<byte[]>> exportSummaryBasicInfoData, byte[] templateToPdfData, String applyNo) {
String filePrefix ="压力管道基本信息汇总表_";
String customFileName="压力管道告知单_设备基本信息汇总表_" + applyNo + ".zip";
String filePrefix = "压力管道基本信息汇总表_";
String customFileName = "压力管道告知单_设备基本信息汇总表_" + applyNo + ".zip";
// 打包zip
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream)) {
......@@ -797,17 +799,17 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper<TzBaseUnitLicence> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode);
// 资质支持多个显示and (certTypeCode = 'xx1' or certTypeCode = 'xx2')
wrapper.and(w-> {
wrapper.and(w -> {
String[] certTypeCodes = companyType.split(",");
for(String certTypeCode: certTypeCodes){
for (String certTypeCode : certTypeCodes) {
w.or().eq(TzBaseUnitLicence::getCertTypeCode, certTypeCode);
}
});
wrapper.orderByDesc(TzBaseUnitLicence::getExpiryDate);
wrapper.orderByDesc(TzBaseUnitLicence::getRecDate);
// 去重显示3个
wrapper.groupBy(TzBaseUnitLicence::getCertNo,TzBaseUnitLicence::getExpiryDate);
wrapper.select(TzBaseUnitLicence::getCertNo,TzBaseUnitLicence::getExpiryDate);
wrapper.groupBy(TzBaseUnitLicence::getCertNo, TzBaseUnitLicence::getExpiryDate);
wrapper.select(TzBaseUnitLicence::getCertNo, TzBaseUnitLicence::getExpiryDate);
wrapper.last(" LIMIT 3");
List<TzBaseUnitLicence> list = baseUnitLicenceMapper.selectList(wrapper);
......@@ -889,7 +891,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
this.repeatUsedEquipCheck(deviceList, reginParams.getCompany().getCompanyCode());
}
List<String> applyNoList = new ArrayList<>();
if (ValidationUtil.isEmpty(model.getApplyNo())){
if (ValidationUtil.isEmpty(model.getApplyNo())) {
// 获取告知单号
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.AZGZ.getCode(), 1);
if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) {
......@@ -901,7 +903,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
log.error("告知单返回为空");
throw new BadRequest("告知单生成失败!");
}
}else{
} else {
applyNoList.add(model.getApplyNo());
}
......@@ -924,7 +926,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
Long sequenceNbr = collect.get(0).getSequenceNbr();
return jgRelationEquip.setEquipTransferId(String.valueOf(sequenceNbr));
}).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(jgRelationEquipList)){
if (!CollectionUtils.isEmpty(jgRelationEquipList)) {
if (!ValidationUtil.isEmpty(model.getSequenceNbr())) {
LambdaQueryWrapper<JgInstallationNoticeEq> lambda = new QueryWrapper<JgInstallationNoticeEq>().lambda();
lambda.eq(JgInstallationNoticeEq::getEquipTransferId, model.getSequenceNbr());
......@@ -1081,7 +1083,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
dto.setCreateUserId(reginParams.getUserModel().getUserId());
dto.setCreateDate(new Date());
list.add(dto);
if (!CollectionUtils.isEmpty(deviceList)){
if (!CollectionUtils.isEmpty(deviceList)) {
deviceList.forEach(obj -> {
JgInstallationNoticeEq jgRelationEquip = new JgInstallationNoticeEq();
jgRelationEquip.setEquId(!ValidationUtil.isEmpty(obj.get("SEQUENCE_NBR")) ? String.valueOf(obj.get("SEQUENCE_NBR")) : String.valueOf(obj.get("record")));
......@@ -1352,7 +1354,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
// 工程装置id
String projectContraptionId = jgInstallationNotice.getProjectContraptionId();
String equCategoryCode = jgInstallationNotice.getEquCategoryCode();
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode)|| PipelineEnum.LONG_DISTANCE_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.COMMON_PIPELINE.getCode().equals(equCategoryCode)) {
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.LONG_DISTANCE_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.COMMON_PIPELINE.getCode().equals(equCategoryCode)) {
// 处理工业管道审批后业务数据保存
this.savePipelineData(jgInstallationNotice, jgRelationEquips, finalYm, dto, taskV2Model1);
jgResumeInfoService.saveBatchResume(
......@@ -1540,10 +1542,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
queryWrapper2.eq(IdxBizJgRegisterInfo::getRecord, jgRelationEquip.getEquId());
return tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
}
private IdxBizJgRegisterInfo getIdxBizJgRegisterInfo2(JgInstallationNoticeEq jgRelationEquip) {
LambdaQueryWrapper<IdxBizJgRegisterInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(IdxBizJgRegisterInfo::getRecord, jgRelationEquip.getEquId());
queryWrapper2.select(TzsBaseEntity::getSequenceNbr,IdxBizJgRegisterInfo::getRecord, IdxBizJgRegisterInfo::getEquCodeType);
queryWrapper2.select(TzsBaseEntity::getSequenceNbr, IdxBizJgRegisterInfo::getRecord, IdxBizJgRegisterInfo::getEquCodeType);
return tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
}
......@@ -1633,7 +1636,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
//张三办理了【单位变更】 ,单号【DWBG202407050001】,办理日期2024-07-05
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
return obj.getUseUnitName()+"的"+agencyUserModelFeignClientResult.getResult().getRealName() + "办理了【" + BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName() + "】,单号【"
return obj.getUseUnitName() + "的" + agencyUserModelFeignClientResult.getResult().getRealName() + "办理了【" + BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName() + "】,单号【"
+ obj.getApplyNo() + "】,申请日期" + simpleDateFormat.format(obj.getCreateDate());
}
......@@ -1658,7 +1661,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName(), new JSONObject(his), registerInfo.getRecord(), jgInstallationNotice.getSequenceNbr().toString());
}
public JSONObject getHisData(JgInstallationNotice jgInstallationNotice){
public JSONObject getHisData(JgInstallationNotice jgInstallationNotice) {
return commonService.queryHistoryData(jgInstallationNotice.getSequenceNbr());
}
......@@ -1709,7 +1712,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
String equCategoryCode = jgInstallationNotice.getEquCategoryCode();
Map<String, Object> installationInfo = BeanUtil.beanToMap(jgInstallationNotice, false, true);
// 压力管道从工程装置表查询设备信息
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode)|| PipelineEnum.LONG_DISTANCE_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.COMMON_PIPELINE.getCode().equals(equCategoryCode)) {
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.LONG_DISTANCE_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.COMMON_PIPELINE.getCode().equals(equCategoryCode)) {
String projectContraptionId = jgInstallationNotice.getProjectContraptionId();
IdxBizJgProjectContraption projectContraption = projectContraptionService.getById(projectContraptionId);
if (!ValidationUtil.isEmpty(projectContraption)) {
......@@ -1886,7 +1889,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
constructionInfoMapper.delete(new LambdaQueryWrapper<IdxBizJgConstructionInfo>().eq(IdxBizJgConstructionInfo::getNoticeId, installationNotice.getSequenceNbr()));
String equCategoryCode = installationNotice.getEquCategoryCode();
// 如果设备类型是工业管道,则还需删除工程装置施工信息
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode)|| PipelineEnum.LONG_DISTANCE_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.COMMON_PIPELINE.getCode().equals(equCategoryCode)) {
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.LONG_DISTANCE_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.COMMON_PIPELINE.getCode().equals(equCategoryCode)) {
LambdaQueryWrapper<IdxBizJgProjectConstruction> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizJgProjectConstruction::getNoticeId, installationNotice.getSequenceNbr());
projectConstructionMapper.delete(queryWrapper);
......@@ -1896,7 +1899,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private void clearUseInfoOfEquip(JgInstallationNotice installationNotice) {
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, installationNotice.getSequenceNbr());
queryWrapper.select(JgInstallationNoticeEq::getEquipTransferId, BaseEntity::getSequenceNbr,JgInstallationNoticeEq::getEquId);
queryWrapper.select(JgInstallationNoticeEq::getEquipTransferId, BaseEntity::getSequenceNbr, JgInstallationNoticeEq::getEquId);
List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(queryWrapper);
jgInstallationNoticeEqs.forEach(jgRelationEquip -> {
// 1.use_info 回退
......@@ -1915,7 +1918,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
});
// 如果是工业管道,则回滚工程装置表信息
String equCategoryCode = installationNotice.getEquCategoryCode();
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode)|| PipelineEnum.LONG_DISTANCE_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.COMMON_PIPELINE.getCode().equals(equCategoryCode)) {
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.LONG_DISTANCE_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.COMMON_PIPELINE.getCode().equals(equCategoryCode)) {
this.rollBackProjectContraptionInfo(installationNotice);
}
//删除设备履历信息
......@@ -1930,6 +1933,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
/**
* 回滚工程装置表信息
*
* @param installationNotice installationNotice
*/
private void rollBackProjectContraptionInfo(JgInstallationNotice installationNotice) {
......@@ -1949,6 +1953,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
/**
* 释放96333码为未使用状态
*
* @param jgRelationEquip jgRelationEquip
*/
private void release96333Code(JgInstallationNoticeEq jgRelationEquip) {
......@@ -1976,7 +1981,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
esEquipmentCategoryDto.setUSE_PLACE(null);
esEquipmentCategoryDto.setUSE_PLACE_CODE(null);
esEquipmentCategoryDto.setADDRESS(null);
if (EquCodeTypeEnum.SYSTEM_GENERATED.getCode().equals(idxBizJgRegisterInfo.getEquCodeType())){
if (EquCodeTypeEnum.SYSTEM_GENERATED.getCode().equals(idxBizJgRegisterInfo.getEquCodeType())) {
esEquipmentCategoryDto.setEQU_CODE(null);
}
esEquipmentCategory.save(esEquipmentCategoryDto);
......@@ -1989,7 +1994,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaUpdateWrapper<IdxBizJgRegisterInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgRegisterInfo::getRecord, jgRelationEquip.getEquId());
updateWrapper.set(IdxBizJgRegisterInfo::getEquCode, null);
tzsJgRegistrationInfoMapper.update(null,updateWrapper);
tzsJgRegistrationInfoMapper.update(null, updateWrapper);
}
}
......@@ -2004,7 +2009,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private void rollBackOtherInfo(JgInstallationNoticeEq jgRelationEquip) {
LambdaUpdateWrapper<OtherInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(AbstractEquipBaseEntity::getRecord,jgRelationEquip.getEquId());
updateWrapper.eq(AbstractEquipBaseEntity::getRecord, jgRelationEquip.getEquId());
updateWrapper.set(OtherInfo::getCode96333, null);
updateWrapper.set(OtherInfo::getSupervisoryCode, null);
tzsJgOtherInfoMapper.update(null, updateWrapper);
......@@ -2142,7 +2147,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Override
public boolean beforeCheck(JgInstallationNotice notice) {
return notice.getInstanceId() != null && !notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())) &&!notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_DISCARD.getCode()));
return notice.getInstanceId() != null && !notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())) && !notice.getNoticeStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_DISCARD.getCode()));
}
@Override
......@@ -2153,6 +2158,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
/**
* 列表数据查询
*
* @param ids
* @return
*/
......@@ -2326,4 +2332,171 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
projectConstructionMapper.insert(idxBizJgProjectConstruction);
}
public void handleNoticeWrongData(String applyNo) {
JgInstallationNotice jgInstallationNotice = jgInstallationNoticeMapper.selectOne(new LambdaQueryWrapper<JgInstallationNotice>()
.in(JgInstallationNotice::getApplyNo, applyNo)
.eq(JgInstallationNotice::getIsDelete, 0)
.ne(JgInstallationNotice::getStatus, "已作废"));
WorkflowResultDto workflowResultDto = new WorkflowResultDto();
workflowResultDto.setNextExecutorRoleIds(jgInstallationNotice.getNextExecuteIds());
workflowResultDto.setNextTaskCode("已完成");
workflowResultDto.setNextTaskId(jgInstallationNotice.getNextTaskId());
workflowResultDto.setNextExecutorUserIds(jgInstallationNotice.getNextExecuteUserIds());
this.updateData(jgInstallationNotice, "0", workflowResultDto);
}
public void updateData(JgInstallationNotice jgInstallationNotice, String op, WorkflowResultDto workflowResultDto) {
JgInstallationNoticeDto dto = new JgInstallationNoticeDto();
BeanUtils.copyProperties(jgInstallationNotice, dto);
// 组装设备注册代码
String ym = null;
try {
ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM);
} catch (ParseException e) {
log.error("日期转换失败:{}", e);
}
// 执行工作流并返回组装好的工作流信息
jgInstallationNotice.setPromoter(RequestContext.getExeUserId());
jgInstallationNotice.setNextTaskId(workflowResultDto.getNextTaskId());
if ("0".equals(op)) {
if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) { // 审批通过
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr());
List<JgInstallationNoticeEq> jgRelationEquips = jgInstallationNoticeEqMapper.selectList(queryWrapper);
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
// 上个代办改为已办
HashMap<String, Object> taskMap = new HashMap<>();
taskMap.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
taskMap.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
taskMap.put("relationId", jgInstallationNotice.getInstanceId());
taskMap.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
taskMap.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtils.copyProperties(jgInstallationNotice, taskMessageDto);
taskMap.put("model", taskMessageDto);
TaskV2Model taskV2Model1 = commonService.updateTaskModel(taskMap);
String finalYm = ym;
// 工程装置id
String projectContraptionId = jgInstallationNotice.getProjectContraptionId();
String equCategoryCode = jgInstallationNotice.getEquCategoryCode();
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.LONG_DISTANCE_PIPELINE.getCode().equals(equCategoryCode) || PipelineEnum.COMMON_PIPELINE.getCode().equals(equCategoryCode)) {
// 处理工业管道审批后业务数据保存
this.savePipelineData(jgInstallationNotice, jgRelationEquips, finalYm, dto, taskV2Model1);
jgResumeInfoService.saveBatchResume(
Lists.newArrayList(JgResumeInfoDto.builder()
.applyNo(jgInstallationNotice.getApplyNo())
.businessType(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName())
.businessId(String.valueOf(jgInstallationNotice.getSequenceNbr()))
.equId(String.valueOf(jgInstallationNotice.getProjectContraptionId()))
.approvalUnit(jgInstallationNotice.getReceiveOrgName())
.approvalUnitCode(jgInstallationNotice.getReceiveOrgCreditCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName() + "业务办理")
.routePath(taskV2Model1.getRoutePath())
.build()));
} else {
jgRelationEquips.forEach(jgRelationEquip -> {
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
IdxBizJgRegisterInfo idxBizJgRegisterInfo = getIdxBizJgRegisterInfo(jgRelationEquip);
String equCode = Optional.ofNullable(idxBizJgRegisterInfo.getEquDefine())
.orElse(idxBizJgRegisterInfo.getEquCategory());
String registrationCode = equCode + jgInstallationNotice.getReceiveOrgCreditCode() + finalYm;
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(registrationCode);
String deviceRegistrationCode = responseModel.getResult();
Map<String, Object> map = new HashMap<>();
map.put("cityCode", jgInstallationNotice.getCity());
map.put("countyCode", jgInstallationNotice.getCounty());
map.put("equCategory", idxBizJgRegisterInfo.getEquCategory());
map.put("isXiXian", jgInstallationNotice.getIsXixian() == null ? "null" : jgInstallationNotice.getIsXixian().equals("0") ? "null" : "1");
Map<String, Object> mapCode;
ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
mapCode = code.getResult();
supervisoryCodeInfoMapper.updateStatusBySuperviseCode(mapCode.get("superviseCode").toString());
jgInstallationNotice.setHandleDate(new Date());
//jgInstallationNotice.setInformNumber(deviceRegistrationCode);
jgRelationEquip.setInformNumber(deviceRegistrationCode);
jgInstallationNotice.setSupervisoryCode(mapCode.get("superviseCode").toString());
jgInstallationNotice.setPromoter("");
Map<String, Object> map1 = new HashMap<>();
// 更新其他业务表
if (!ValidationUtil.isEmpty(mapCode.get("code96333"))) {
tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString());
map1.put("CODE96333", tzsJgOtherInfo.getCode96333());
}
tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
// 更新设备监管部门信息
LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda()
.eq(IdxBizJgSupervisionInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = idxBizJgSupervisionInfoMapper.selectOne(eq);
if (!ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchCode()) && !ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchName())) {
HashMap<String, Object> parentMessage = (HashMap<String, Object>) Privilege.companyClient.queryByOrgcode(jgInstallationNotice.getOrgBranchCode()).getResult();
// 目前平台返回key为compnay(存在拼写错误)
CompanyModel parentModel = JSON.parseObject(JSON.toJSONString(parentMessage.get("compnay")), CompanyModel.class);
idxBizJgSupervisionInfo.setOrgBranchCode(parentModel.getOrgCode());
idxBizJgSupervisionInfo.setOrgBranchName(parentModel.getCompanyName());
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(parentModel.getCompanyCode());
idxBizJgSupervisionInfoMapper.updateById(idxBizJgSupervisionInfo);
}
// 生成设备代码及更新历史表的的设备代码字段
this.justGenerateEquCode(idxBizJgRegisterInfo, jgInstallationNotice.getReceiveOrgCreditCode(), jgInstallationNotice);
tzsJgRegistrationInfoMapper.updateById(idxBizJgRegisterInfo);
// 更新es
updateEquipEs(jgInstallationNotice, tzsJgOtherInfo, idxBizJgRegisterInfo, idxBizJgSupervisionInfo, map1, dto);
// 记录施工信息表
createConstruction2Db(jgInstallationNotice, jgRelationEquip);
// 更新使用信息
updateJgUseInfo(jgInstallationNotice, jgRelationEquip);
// 生成证记录表主键
long certChangeSeq = sequence.nextId();
// 生成jg证书变更记录
genJgCertificateChangeRecord(jgInstallationNotice, certChangeSeq, registrationCode, idxBizJgRegisterInfo.getEquCategory(), taskV2Model1);
// 查询设备制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
factoryInfoWrapper.eq(IdxBizJgFactoryInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgFactoryInfo idxBizJgFactoryInfo = idxBizJgFactoryInfoService.getOne(factoryInfoWrapper);
// 生成tzs_jg_certificate_change_record_eq记录
JgCertificateChangeRecordEq changeRecordEq = new JgCertificateChangeRecordEq();
changeRecordEq.setChangeRecordId(String.valueOf(certChangeSeq));//登记证记录主键
changeRecordEq.setEquId(jgRelationEquip.getEquId());//设备主键
changeRecordEq.setProductCode(idxBizJgFactoryInfo.getFactoryNum());
certificateChangeRecordEqService.save(changeRecordEq);
});
jgResumeInfoService.saveBatchResume(
jgRelationEquips.stream()
.map(v -> JgResumeInfoDto.builder()
.applyNo(jgInstallationNotice.getApplyNo())
.businessType(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName())
.businessId(String.valueOf(jgInstallationNotice.getSequenceNbr()))
.equId(String.valueOf(v.getEquId()))
.approvalUnit(jgInstallationNotice.getReceiveOrgName())
.approvalUnitCode(jgInstallationNotice.getReceiveOrgCreditCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName() + "业务办理")
.routePath(taskV2Model1.getRoutePath())
.build())
.collect(Collectors.toList())
);
}
// 更新关联设备表
jgInstallationNoticeEqService.updateBatchById(jgRelationEquips);
// 发送数据刷新消息
eventPublisher.publish(new DataRefreshEvent(this, jgRelationEquips.stream().map(JgInstallationNoticeEq::getEquId).collect(Collectors.toList()), DataRefreshEvent.DataType.equipment.name(), DataRefreshEvent.Operation.UPDATE));
}
}
jgInstallationNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
this.updateById(jgInstallationNotice);
this.saveHisDataBeforeUpdate(jgInstallationNotice);
commonService.saveExecuteFlowData2Redis(jgInstallationNotice.getInstanceId(), this.buildInstanceRuntimeData(jgInstallationNotice));
}
}
\ No newline at end of file
......@@ -2533,4 +2533,17 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
public boolean countUseTimesForInvalid(Object code) {
return jgVehicleInformationMapper.countUseTimesForInvalid(code) <= 0;
}
public void handleVehicleWrongData(String applyNo, String equDefineCode) {
JgVehicleInformation vehicleInformation = jgVehicleInformationMapper.selectOne(new LambdaQueryWrapper<JgVehicleInformation>()
.in(JgVehicleInformation::getApplyNo, applyNo)
.eq(JgVehicleInformation::getIsDelete, 0)
.ne(JgVehicleInformation::getStatus, "已作废"));
WorkflowResultDto workflowResultDto = new WorkflowResultDto();
workflowResultDto.setNextExecutorRoleIds(vehicleInformation.getNextExecuteIds());
workflowResultDto.setNextTaskCode("已完成");
workflowResultDto.setNextTaskId(vehicleInformation.getNextTaskId());
workflowResultDto.setNextExecutorUserIds(vehicleInformation.getNextExecuteUserIds());
this.updateData(vehicleInformation.getSequenceNbr(), "0", workflowResultDto, Boolean.FALSE, equDefineCode);
}
}
\ No newline at end of file
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