Commit d027820c authored by Lambertliu's avatar Lambertliu

fix(jg):处理冲突

parents 7e38df11 bcb3ed48
...@@ -15,12 +15,10 @@ import com.yeejoin.amos.api.openapi.util.MultiFieldKey; ...@@ -15,12 +15,10 @@ import com.yeejoin.amos.api.openapi.util.MultiFieldKey;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -45,7 +43,6 @@ public class TmCylinderFillingExamineService extends MyBaseServiceImpl<TmCylinde ...@@ -45,7 +43,6 @@ public class TmCylinderFillingExamineService extends MyBaseServiceImpl<TmCylinde
private EventPublisher eventPublisher; private EventPublisher eventPublisher;
@DSTransactional @DSTransactional
@Transactional(rollbackFor = Exception.class)
public String createCylinderFillingExamine(List<TmCylinderFillingExamineModel> model) { public String createCylinderFillingExamine(List<TmCylinderFillingExamineModel> model) {
if (ValidationUtil.isEmpty(model)) if (ValidationUtil.isEmpty(model))
throw new BadRequest("液化气体气瓶充装信息审核为空."); throw new BadRequest("液化气体气瓶充装信息审核为空.");
...@@ -87,11 +84,14 @@ public class TmCylinderFillingExamineService extends MyBaseServiceImpl<TmCylinde ...@@ -87,11 +84,14 @@ public class TmCylinderFillingExamineService extends MyBaseServiceImpl<TmCylinde
if (!ValidationUtil.isEmpty(oldList)) { if (!ValidationUtil.isEmpty(oldList)) {
List<String> fileUrlList = Lists.newArrayList(); List<String> fileUrlList = Lists.newArrayList();
oldList.forEach(old -> { oldList.forEach(old -> {
if (old.getFillingAuditUrl() != null) { if (!ValidationUtil.isEmpty(old.getFillingAuditUrl())) {
fileUrlList.addAll(Arrays.asList(ValidationUtil.isEmpty(old.getFillingAuditUrl()) ? new String[0] : old.getFillingAuditUrl().split(","))); fileUrlList.add(old.getFillingAuditUrl());
} }
}); });
eventPublisher.publish(new FileToBeDeleteEvent(this, FileDeleteUtil.extractFileNames(fileUrlList))); List<String> fileNameList = FileDeleteUtil.extractFileNames(fileUrlList);
if (!ValidationUtil.isEmpty(fileNameList)) {
eventPublisher.publish(new FileToBeDeleteEvent(this, fileNameList));
}
} }
} }
......
...@@ -32,6 +32,11 @@ public class FileDeleteUtil { ...@@ -32,6 +32,11 @@ public class FileDeleteUtil {
List<String> fileUrls = Lists.newArrayList(); List<String> fileUrls = Lists.newArrayList();
if (!ValidationUtil.isEmpty(jsonStr)) { if (!ValidationUtil.isEmpty(jsonStr)) {
try { try {
log.debug("jsonStr:{}", jsonStr);
if (!JSONObject.isValid(jsonStr)) {
fileUrls.add(jsonStr);
return fileUrls;
}
Object json = JSONObject.parse(jsonStr); Object json = JSONObject.parse(jsonStr);
if (json instanceof JSONArray) { if (json instanceof JSONArray) {
JSONArray jsonArray = JSONObject.parseArray(jsonStr); JSONArray jsonArray = JSONObject.parseArray(jsonStr);
...@@ -57,7 +62,7 @@ public class FileDeleteUtil { ...@@ -57,7 +62,7 @@ public class FileDeleteUtil {
} }
return fileUrls; return fileUrls;
} catch (Exception e) { } catch (Exception e) {
log.info("Error parsing JSON: {}", jsonStr); log.error("Error parsing JSON: {}", jsonStr);
System.err.println("Error parsing JSON: " + e.getMessage()); System.err.println("Error parsing JSON: " + e.getMessage());
} }
} }
......
...@@ -43,7 +43,7 @@ public class IdxBizJgProjectContraptionController extends BaseController { ...@@ -43,7 +43,7 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增管道工程装置表", notes = "新增管道工程装置表") @ApiOperation(httpMethod = "POST", value = "新增管道工程装置表", notes = "新增管道工程装置表")
public ResponseModel<Boolean> save(@RequestBody IdxBizJgProjectContraptionDto model) { public ResponseModel<IdxBizJgProjectContraption> save(@RequestBody IdxBizJgProjectContraptionDto model) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.saveFirstMergeProjectContraption(model)); return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.saveFirstMergeProjectContraption(model));
} }
......
...@@ -16,7 +16,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum; ...@@ -16,7 +16,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum; import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum; import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.biz.service.*; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgProjectContraptionService;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto; import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
...@@ -318,7 +318,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -318,7 +318,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
if(CollectionUtil.isNotEmpty(records)){ if(CollectionUtil.isNotEmpty(records)){
List<IdxBizJgInspectionDetectionInfo> jgInspectionDetectionInfos= new ArrayList<>(); List<IdxBizJgInspectionDetectionInfo> jgInspectionDetectionInfos= new ArrayList<>();
for (Object record : records) { for (Object record : records) {
IdxBizJgInspectionDetectionInfo detectionInfo = JSON.parseObject(toJSONString(record), IdxBizJgInspectionDetectionInfo.class); IdxBizJgInspectionDetectionInfo detectionInfo = JSON.parseObject(JSONObject.toJSONString(record), IdxBizJgInspectionDetectionInfo.class);
if(Objects.nonNull(detectionInfo)){ if(Objects.nonNull(detectionInfo)){
if (record instanceof LinkedHashMap){ if (record instanceof LinkedHashMap){
Map map = (LinkedHashMap)record; Map map = (LinkedHashMap)record;
...@@ -497,7 +497,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -497,7 +497,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
} }
} }
public boolean saveFirstMergeProjectContraption(IdxBizJgProjectContraptionDto model) { public IdxBizJgProjectContraption saveFirstMergeProjectContraption(IdxBizJgProjectContraptionDto model) {
// 单位类型 // 单位类型
Map<String, Object> companyInfoMap = jgInstallationNoticeService.getCompanyType(); Map<String, Object> companyInfoMap = jgInstallationNoticeService.getCompanyType();
IdxBizJgProjectContraption projectContraption = JSON.parseObject(toJSONString(model), IdxBizJgProjectContraption.class); IdxBizJgProjectContraption projectContraption = JSON.parseObject(toJSONString(model), IdxBizJgProjectContraption.class);
...@@ -516,7 +516,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -516,7 +516,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
projectContraption.setPipelineLength(0.0); projectContraption.setPipelineLength(0.0);
projectContraption.setUseUnitName(companyInfoMap.get("companyName").toString()); projectContraption.setUseUnitName(companyInfoMap.get("companyName").toString());
projectContraption.setUseUnitCreditCode(companyInfoMap.get("creditCode").toString()); projectContraption.setUseUnitCreditCode(companyInfoMap.get("creditCode").toString());
return this.saveOrUpdateData(projectContraption); this.saveOrUpdateData(projectContraption);
return projectContraption;
} }
@Override @Override
......
...@@ -2930,7 +2930,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2930,7 +2930,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 3.回滚更新idx_biz_jg_supervision_info表 // 3.回滚更新idx_biz_jg_supervision_info表
this.rollBackSupervisionInfo(record); this.rollBackSupervisionInfo(record);
// 4.es的EQU_STATE, USE_ORG_CODE、ORG_BRANCH_CODE、ORG_BRANCH_NAME、STATUS // 4.es的EQU_STATE, USE_ORG_CODE、ORG_BRANCH_CODE、ORG_BRANCH_NAME、STATUS
this.rollBackForEquipEsInfo(record, flag); this.rollBackForEquipEsInfo(record, flag,jgUseRegistration);
// 5.历史设备处理 // 5.历史设备处理
this.dealHisRegEquipData(jgUseRegistration, record); this.dealHisRegEquipData(jgUseRegistration, record);
}); });
...@@ -3023,7 +3023,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3023,7 +3023,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return jgRelationEquipMapper.selectList(eqLambdaQueryWrapper); return jgRelationEquipMapper.selectList(eqLambdaQueryWrapper);
} }
private void rollBackForEquipEsInfo(String record, Boolean flag) { private void rollBackForEquipEsInfo(String record, Boolean flag,JgUseRegistration jgUseRegistration) {
LambdaQueryWrapper<IdxBizJgConstructionInfo> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizJgConstructionInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.select(IdxBizJgConstructionInfo::getUscUnitCreditCode, wrapper.select(IdxBizJgConstructionInfo::getUscUnitCreditCode,
IdxBizJgConstructionInfo::getUscUnitName, IdxBizJgConstructionInfo::getUscUnitName,
...@@ -3044,8 +3044,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3044,8 +3044,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (jgConstructionInfo != null){ if (jgConstructionInfo != null){
esEquipmentCategoryDto.setUSC_UNIT_NAME(jgConstructionInfo.getUscUnitName()); esEquipmentCategoryDto.setUSC_UNIT_NAME(jgConstructionInfo.getUscUnitName());
esEquipmentCategoryDto.setUSC_UNIT_CREDIT_CODE(jgConstructionInfo.getUscUnitCreditCode()); esEquipmentCategoryDto.setUSC_UNIT_CREDIT_CODE(jgConstructionInfo.getUscUnitCreditCode());
esEquipmentCategory.save(esEquipmentCategoryDto);
} }
//如果是历史电站已纳管改为未纳管
if("1".equals(jgUseRegistration.getRegType())){
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(false);
}
esEquipmentCategory.save(esEquipmentCategoryDto);
} }
} }
......
...@@ -160,11 +160,11 @@ ...@@ -160,11 +160,11 @@
(select SEQUENCE_NBR from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) detectionInfoSequenceNbr, (select SEQUENCE_NBR from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) detectionInfoSequenceNbr,
(select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectOrgName, (select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectOrgName,
(select name from cb_data_dictionary where type = 'JYJL' and code = (select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1)) inspectConclusion, (select name from cb_data_dictionary where type = 'JYJL' and code = (select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1)) inspectConclusion,
(select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) nextInspectDate, to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1),'YYYY-MM-DD') nextInspectDate,
(select USC_UNIT_NAME from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscUnitName, (select USC_UNIT_NAME from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscUnitName,
(select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscDate, to_char((select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1),'YYYY-MM-DD') as uscDate,
ibjdi."DESIGN_UNIT_NAME" AS designUnitName, ibjdi."DESIGN_UNIT_NAME" AS designUnitName,
ibjui."USE_DATE" AS useDate, to_char(ibjui."USE_DATE",'YYYY-MM-DD') AS useDate,
ibjui."RECORD" AS record ibjui."RECORD" AS record
FROM idx_biz_jg_use_info ibjui FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
<select id="selectEquipListByExport" resultType="java.util.Map"> <select id="selectEquipListByExport" resultType="java.util.Map">
SELECT ibjtpp."PIPE_NAME" AS productName, SELECT ibjtpp."PIPE_NAME" AS productName,
ibjtpp."PIPELINE_NUMBER" AS pipelineNumber, ibjtpp."PIPELINE_NUMBER" AS pipelineNumber,
ibjtpp."DEVICE_LEVEL" AS deviceLevel, (select name from cb_data_dictionary where code = ibjtpp."DEVICE_LEVEL" and type = 'GBI') deviceLevel,
ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter, ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter,
ibjtpp."WALL_THICKNESS" AS wallThickness, ibjtpp."WALL_THICKNESS" AS wallThickness,
ibjtpp."PIPE_LENGTH" AS pipeLength, ibjtpp."PIPE_LENGTH" AS pipeLength,
...@@ -231,12 +231,12 @@ ...@@ -231,12 +231,12 @@
ibjtpp."WORK_MEDIUM" AS workMedium, ibjtpp."WORK_MEDIUM" AS workMedium,
ibjtpp."REMARKS" AS remarks, ibjtpp."REMARKS" AS remarks,
(select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectOrgName, (select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectOrgName,
(select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectConclusion, (select name from cb_data_dictionary where type = 'JYJL' and code = (select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1)) inspectConclusion,
(select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) nextInspectDate, to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1),'YYYY-MM-DD') nextInspectDate,
(select USC_UNIT_NAME from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscUnitName, (select USC_UNIT_NAME from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscUnitName,
(select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscDate, to_char((select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1),'YYYY-MM-DD') as uscDate,
ibjdi."DESIGN_UNIT_NAME" AS designUnitName, ibjdi."DESIGN_UNIT_NAME" AS designUnitName,
ibjui."USE_DATE" AS useDate, to_char(ibjui."USE_DATE",'YYYY-MM-DD') AS useDate,
ibjui."RECORD" AS record ibjui."RECORD" AS record
FROM idx_biz_jg_use_info ibjui FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
......
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