Commit 9aa1cf16 authored by 刘林's avatar 刘林

fix(jg):暂存功能问题处理

parent 70947d80
...@@ -29,4 +29,5 @@ public class EquipmentInfoDto { ...@@ -29,4 +29,5 @@ public class EquipmentInfoDto {
* 属地监管部门:orgCode_名称 * 属地监管部门:orgCode_名称
*/ */
private String orgBranchCode; private String orgBranchCode;
private String orgBranchName;
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ public class TransferNoticeStrategyHandler implements ToBeSubmitDetailStrategy { ...@@ -23,7 +23,7 @@ public class TransferNoticeStrategyHandler implements ToBeSubmitDetailStrategy {
Map<String, Object> basic = new HashMap<>(); Map<String, Object> basic = new HashMap<>();
basic.put("type", ApplicationFormTypeEnum.YZGZ.getBusinessCode()); basic.put("type", ApplicationFormTypeEnum.YZGZ.getBusinessCode());
basic.put("receiveOrgCreditCode", transferInfo.get("receiveOrgCreditCode")); basic.put("receiveOrgCreditCode", transferInfo.get("receiveOrgCode"));
basic.put("code", transferInfo.get("EQU_LIST_CODE")); basic.put("code", transferInfo.get("EQU_LIST_CODE"));
basic.put("equCategory", transferInfo.get("EQU_CATEGORY_CODE")); basic.put("equCategory", transferInfo.get("EQU_CATEGORY_CODE"));
Map<String, Map<String, Object>> result = new HashMap<>(); Map<String, Map<String, Object>> result = new HashMap<>();
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest; import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService; import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.feign.WorkFlowFeignService; import com.yeejoin.amos.boot.module.jg.biz.feign.WorkFlowFeignService;
...@@ -11,7 +12,9 @@ import lombok.extern.slf4j.Slf4j; ...@@ -11,7 +12,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author Administrator * @author Administrator
...@@ -90,10 +93,44 @@ public class CmWorkflowServiceImpl implements ICmWorkflowService { ...@@ -90,10 +93,44 @@ public class CmWorkflowServiceImpl implements ICmWorkflowService {
throw new LocalBadRequest(devMessage); throw new LocalBadRequest(devMessage);
} catch (Exception e) { } catch (Exception e) {
log.error("调用工作流完成任务接口失败", e); log.error("调用工作流完成任务接口失败", e);
throw new RuntimeException(e.getMessage()); String responseBody = extractFeignResponseBody(e);
String devMessage = extractDevMessageFromJson(responseBody);
throw new RuntimeException( devMessage != null ? devMessage : "流程处理失败", e);
} }
return processTaskDTO; return processTaskDTO;
} }
private String extractFeignResponseBody(Exception e) {
if (e instanceof feign.FeignException) {
feign.FeignException fe = (feign.FeignException) e;
try {
return new String(fe.content(), StandardCharsets.UTF_8);
} catch (Exception ex) {
log.warn("读取Feign响应体失败", ex);
}
}
return e.getMessage();
}
private String extractDevMessageFromJson(String jsonStr) {
if (jsonStr == null || jsonStr.trim().isEmpty()) return null;
try {
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> json = mapper.readValue(jsonStr, Map.class);
Object devMessage = json.get("devMessage");
Object message = json.get("message");
if (devMessage != null && !String.valueOf(devMessage).trim().isEmpty()) {
return String.valueOf(devMessage);
} else if (message != null) {
return String.valueOf(message);
}
} catch (Exception ex) {
log.warn("解析响应JSON出错: {}", jsonStr, ex);
}
return null;
}
@Override @Override
public ProcessTaskDTO rollBack(String processInstanceId) { public ProcessTaskDTO rollBack(String processInstanceId) {
......
...@@ -960,7 +960,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -960,7 +960,7 @@ public class CommonServiceImpl implements ICommonService {
unitList.stream(), unitList.stream(),
unitListByType.stream() unitListByType.stream()
).collect(Collectors.toMap( ).collect(Collectors.toMap(
map -> (String) map.get("useCode"), // 以 unitCode 作为 key map -> String.valueOf(map.get("useCode")), // 以 unitCode 作为 key
map -> map, map -> map,
(existing, replacement) -> existing // 如果 key 冲突,保留原有的 (existing, replacement) -> existing // 如果 key 冲突,保留原有的
)).values()); )).values());
......
...@@ -201,7 +201,7 @@ public class DataDockServiceImpl { ...@@ -201,7 +201,7 @@ public class DataDockServiceImpl {
String equList = String.valueOf(equ.get("equList")); String equList = String.valueOf(equ.get("equList"));
String isCompleteXa = String.valueOf(equ.get("isCompleteXa")); String isCompleteXa = String.valueOf(equ.get("isCompleteXa"));
// 压力管道保存 工程装置表信息 必须在saveUseInfo之前进行,需要提前生成工程装置id // 压力管道保存 工程装置表信息 必须在saveUseInfo之前进行,需要提前生成工程装置id
saveProjectContraption(equ, equList); saveProjectContraption(equ, equList, company, dataSource);
// 保存到设备表 // 保存到设备表
saveUseInfo(equ, record, dataSource, remark, company); saveUseInfo(equ, record, dataSource, remark, company);
saveDesignInfo(equ, record); saveDesignInfo(equ, record);
...@@ -276,28 +276,43 @@ public class DataDockServiceImpl { ...@@ -276,28 +276,43 @@ public class DataDockServiceImpl {
/** /**
* 保存工程装置表信息 * 保存工程装置表信息
*/ */
private void saveProjectContraption(Map<String, Object> equ, String equList) { private void saveProjectContraption(Map<String, Object> equ, String equList,CompanyBo company,String dataSource) {
if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) { if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) {
IdxBizJgProjectContraption projectContraption = JSON.parseObject(JSON.toJSONString(equ), IdxBizJgProjectContraption.class); IdxBizJgProjectContraption projectContraption = JSON.parseObject(JSON.toJSONString(equ), IdxBizJgProjectContraption.class);
if (!ValidationUtil.isEmpty(projectContraption)) { if (!ValidationUtil.isEmpty(projectContraption)) {
String useUnitCode = String.valueOf(equ.get("useUnitCode")).trim();// 使用单位Code String useUnitCode = Objects.toString(equ.get("useUnitCode"),company.getCompanyCode());// 使用单位Code
String useUnit = String.valueOf(equ.get("useUnit")).trim();// 使用单位名称 String useUnit = Objects.toString(equ.get("useUnit"), company.getCompanyName());// 使用单位名称
String proConName = String.valueOf(equ.get("projectContraption")).trim();// 工程装置名称 String proConName = String.valueOf(equ.get("projectContraption")).trim();// 工程装置名称
// 查询该企业下是否已经有该工程装置名称 有-》追加 update 无-》新增 save // 查询该企业下是否已经有该工程装置名称 有-》追加 update 无-》新增 save
IdxBizJgProjectContraption oldContraption = idxBizJgProjectContraptionService.lambdaQuery() IdxBizJgProjectContraption oldContraption = null;
if ("使用单位".equals(company.getCompanyType())) {
oldContraption = idxBizJgProjectContraptionService.lambdaQuery()
.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, useUnitCode) .eq(IdxBizJgProjectContraption::getUseUnitCreditCode, useUnitCode)
.eq(IdxBizJgProjectContraption::getUseUnitName, useUnit) .eq(IdxBizJgProjectContraption::getUseUnitName, useUnit)
.eq(IdxBizJgProjectContraption::getProjectContraption, proConName) .eq(IdxBizJgProjectContraption::getProjectContraption, proConName)
.list().stream().findFirst().orElse(null); .list().stream().findFirst().orElse(null);
}else{
oldContraption = idxBizJgProjectContraptionService.lambdaQuery()
.eq(IdxBizJgProjectContraption::getUscUnitCreditCode, company.getCompanyCode())
.eq(IdxBizJgProjectContraption::getUscUnitName, company.getCompanyName())
.eq(IdxBizJgProjectContraption::getProjectContraption, proConName)
.list().stream().findFirst().orElse(null);
}
projectContraption.setRecDate(new Date()); projectContraption.setRecDate(new Date());
projectContraption.setDataQualityScore("1"); projectContraption.setDataQualityScore("1");
if (ObjectUtils.isEmpty(oldContraption)) { // save if (ObjectUtils.isEmpty(oldContraption) ) { // save
Long sequenceNbr = sequence.nextId(); Long sequenceNbr = sequence.nextId();
projectContraption.setSequenceNbr(sequenceNbr); projectContraption.setSequenceNbr(sequenceNbr);
if ("使用单位".equals(company.getCompanyType())) {
projectContraption.setUseUnitCreditCode(useUnitCode); projectContraption.setUseUnitCreditCode(useUnitCode);
projectContraption.setUseUnitName(useUnit); projectContraption.setUseUnitName(useUnit);
} else if ("安装改造维修单位".equals(company.getCompanyType())){
projectContraption.setUscUnitCreditCode(company.getCompanyCode());
projectContraption.setUscUnitName(company.getCompanyName());
}else{
projectContraption.setUseUnitCreditCode(MapUtil.getStr(equ,"useUnitCode"));
projectContraption.setUseUnitName(MapUtil.getStr(equ, "useUnit"));
}
projectContraption.setEquList(equList); projectContraption.setEquList(equList);
projectContraption.setEquListName(EquipmentClassifityEnum.getNameByCode(equList)); projectContraption.setEquListName(EquipmentClassifityEnum.getNameByCode(equList));
projectContraption.setEquCategory((String) equ.get("equCategory")); projectContraption.setEquCategory((String) equ.get("equCategory"));
...@@ -307,6 +322,7 @@ public class DataDockServiceImpl { ...@@ -307,6 +322,7 @@ public class DataDockServiceImpl {
projectContraption.setPipelineLength(Double.parseDouble((String) equ.get("pipeLength"))); projectContraption.setPipelineLength(Double.parseDouble((String) equ.get("pipeLength")));
projectContraption.setUseRegistrationCode((String) equ.get("useOrgCode")); projectContraption.setUseRegistrationCode((String) equ.get("useOrgCode"));
projectContraption.setIsIntoManagement(Boolean.FALSE); projectContraption.setIsIntoManagement(Boolean.FALSE);
projectContraption.setDataSource(dataSource);
idxBizJgProjectContraptionService.save(projectContraption); idxBizJgProjectContraptionService.save(projectContraption);
equ.put("projectContraptionId", sequenceNbr); equ.put("projectContraptionId", sequenceNbr);
} else { // update } else { // update
...@@ -331,9 +347,9 @@ public class DataDockServiceImpl { ...@@ -331,9 +347,9 @@ public class DataDockServiceImpl {
log.error("数据===>{}", JSONObject.toJSONString(equ)); log.error("数据===>{}", JSONObject.toJSONString(equ));
IdxBizJgUseInfo useInfo = JSON.parseObject(JSON.toJSONString(equ), IdxBizJgUseInfo.class); IdxBizJgUseInfo useInfo = JSON.parseObject(JSON.toJSONString(equ), IdxBizJgUseInfo.class);
if (!ValidationUtil.isEmpty(useInfo)) { if (!ValidationUtil.isEmpty(useInfo)) {
String provinceName = Objects.toString(equ.get("provinceName"),"陕西省"); String provinceName = Objects.toString(equ.get("provinceName"),"");
String provinceCode = "610000"; String provinceCode = "610000";
String cityName = Objects.toString(equ.get("cityName"),"西安市"); String cityName = Objects.toString(equ.get("cityName"),"");
String cityCode = ""; String cityCode = "";
if (!ValidationUtil.isEmpty(cityName)) { if (!ValidationUtil.isEmpty(cityName)) {
cityCode = getRegionCode(cityName, "CITY"); cityCode = getRegionCode(cityName, "CITY");
...@@ -359,7 +375,10 @@ public class DataDockServiceImpl { ...@@ -359,7 +375,10 @@ public class DataDockServiceImpl {
if (company != null && "使用单位".equals(company.getCompanyType())) { if (company != null && "使用单位".equals(company.getCompanyType())) {
useInfo.setUseUnitCreditCode(company.getCompanyCode()); useInfo.setUseUnitCreditCode(company.getCompanyCode());
useInfo.setUseUnitName(company.getCompanyName()); useInfo.setUseUnitName(company.getCompanyName());
} else { } else if (company != null && "安装改造维修单位".equals(company.getCompanyType())){
useInfo.setUSC_UNIT_CREDIT_CODE(company.getCompanyCode());
useInfo.setUSC_UNIT_NAME(company.getCompanyName());
}else{
useInfo.setUseUnitCreditCode(MapUtil.getStr(equ,"useUnitCode")); useInfo.setUseUnitCreditCode(MapUtil.getStr(equ,"useUnitCode"));
useInfo.setUseUnitName(MapUtil.getStr(equ, "useUnit")); useInfo.setUseUnitName(MapUtil.getStr(equ, "useUnit"));
} }
...@@ -381,7 +400,7 @@ public class DataDockServiceImpl { ...@@ -381,7 +400,7 @@ public class DataDockServiceImpl {
useInfo.setIsNotEs("1"); useInfo.setIsNotEs("1");
useInfo.setIsIntoManagement(Boolean.FALSE); useInfo.setIsIntoManagement(Boolean.FALSE);
useInfo.setRemark(remark); useInfo.setRemark(remark);
if (Arrays.asList("jg_his","jg_his_black","jg_his_xa","jg_his_black_pl","jg_his_pl").contains(dataSource)){ if (Arrays.asList("jg_his","jg_his_xa","jg_his_pl").contains(dataSource)){
String equState = Optional.ofNullable(equ.get("EQU_STATE")) String equState = Optional.ofNullable(equ.get("EQU_STATE"))
.map(Object::toString) .map(Object::toString)
.orElse(String.valueOf(EquimentEnum.ZAIYONG.getCode())); .orElse(String.valueOf(EquimentEnum.ZAIYONG.getCode()));
...@@ -812,6 +831,9 @@ public class DataDockServiceImpl { ...@@ -812,6 +831,9 @@ public class DataDockServiceImpl {
// } // }
equCodeList.add(data.getEquCode()); equCodeList.add(data.getEquCode());
useOrgCodeList.add(data.getUseOrgCode()); useOrgCodeList.add(data.getUseOrgCode());
if (data.getFactoryNum() != null && data.getProduceUnitCreditCode() != null){
factoryNumList.add(data.getProduceUnitCreditCode() + "_" +data.getFactoryNum());
}
dataList.add(data); dataList.add(data);
} }
...@@ -1504,19 +1526,22 @@ public class DataDockServiceImpl { ...@@ -1504,19 +1526,22 @@ public class DataDockServiceImpl {
private void DTTechnicalParamsCheck(EquipInfoExcelDto data, StringBuffer rowError) { private void DTTechnicalParamsCheck(EquipInfoExcelDto data, StringBuffer rowError) {
} }
private void batchSaveHisEquipmentData(String remark, List<EquipInfoExcelDto> equipInfoExcelDtos, LinkedHashMap equipmentInfoForm) { @Transactional(rollbackFor = Exception.class)
public void batchSaveHisEquipmentData(String remark, List<EquipInfoExcelDto> equipInfoExcelDtos, LinkedHashMap equipmentInfoForm) {
String[] keys = { String[] keys = {
"PRODUCT_PHOTO", "OTHER_ACCESSORIES_REG", "DESIGN_DOC", "DESIGN_STANDARD", "PRODUCT_PHOTO", "OTHER_ACCESSORIES_REG", "DESIGN_DOC", "DESIGN_STANDARD",
"OTHER_ACCESSORIES_DES", "PRODUCT_QUALITY_YIELD_PROVE", "FACTORY_STANDARD", "OTHER_ACCESSORIES_DES", "PRODUCT_QUALITY_YIELD_PROVE", "FACTORY_STANDARD",
"INS_USE_MAINTAIN_EXPLAIN", "OTHER_ACCESSORIES_FACT", "INS_USE_MAINTAIN_EXPLAIN", "OTHER_ACCESSORIES_FACT",
"BOILER_ENERGY_EFFICIENCY_CERTIFICATE", "FACT_SUPERVISION_INSPECTION_REPORT","INSPECT_REPORT" "BOILER_ENERGY_EFFICIENCY_CERTIFICATE", "FACT_SUPERVISION_INSPECTION_REPORT","INSPECT_REPORT"
}; };
String[] parts = Optional.ofNullable(equipmentInfoForm.get("orgBranchCode")) String[] parts = Optional.ofNullable(equipmentInfoForm.get("orgBranchCode"))
.map(String::valueOf) .map(String::valueOf)
.map(s -> s.split("_", 2)) .map(s -> s.split("_", 2))
.orElse(new String[0]); .orElse(new String[0]);
String orgBranchCode = parts.length > 0 ? parts[0] : ""; String orgBranchCode = parts.length > 0 ? parts[0] : "";
String orgBranchName = parts.length > 1 ? parts[1] : ""; String orgBranchName = parts.length > 1 ? parts[1] : "";
String equList = String.valueOf(equipmentInfoForm.get("EQU_LIST")); String equList = String.valueOf(equipmentInfoForm.get("EQU_LIST"));
String equCategory = String.valueOf(equipmentInfoForm.get("EQU_CATEGORY")); String equCategory = String.valueOf(equipmentInfoForm.get("EQU_CATEGORY"));
...@@ -1525,24 +1550,37 @@ public class DataDockServiceImpl { ...@@ -1525,24 +1550,37 @@ public class DataDockServiceImpl {
: "his".equals(equipmentInfoForm.get("DATA_SOURCE")) : "his".equals(equipmentInfoForm.get("DATA_SOURCE"))
? "jg_his_pl" ? "jg_his_pl"
: "jg_his_black_pl"; : "jg_his_black_pl";
Set<String> recordSet = new HashSet<>();
Arrays.stream(equipInfoExcelDtos.toArray(new EquipInfoExcelDto[0])).forEach(equ -> { for (EquipInfoExcelDto equ : equipInfoExcelDtos) {
if (!equ.getEquList().equals(equList) || !equ.getEquCategory().equals(equCategory)){ if (!equList.equals(equ.getEquList()) || !equCategory.equals(equ.getEquCategory())) {
log.error("设备不一致:模板[{}, {}],当前[{}, {}]",
equList, equCategory, equ.getEquList(), equ.getEquCategory());
throw new BadRequest("设备种类或设备类型与模板上传不一致,请核对后进行上传!"); throw new BadRequest("设备种类或设备类型与模板上传不一致,请核对后进行上传!");
} }
}
Set<String> recordSet = new HashSet<>();
for (EquipInfoExcelDto equ : equipInfoExcelDtos) {
List<Map<String, Object>> fileDataList = (List<Map<String, Object>>) equ.getFileData(); List<Map<String, Object>> fileDataList = (List<Map<String, Object>>) equ.getFileData();
Map<String, Object> equMap = (Map<String, Object>) JSON.parseObject(JSON.toJSONString(equ), Map.class); Map<String, Object> equMap = (Map<String, Object>) JSON.parseObject(JSON.toJSONString(equ), Map.class);
for (String key : keys) { for (String key : keys) {
String camelKey = toCamelCase(key.toLowerCase()); String camelKey = toCamelCase(key.toLowerCase());
equMap.put(camelKey, getUrlByKey(fileDataList, key)); equMap.put(camelKey, getUrlByKey(fileDataList, key));
}
equMap.put("orgBranchName", orgBranchName); equMap.put("orgBranchName", orgBranchName);
equMap.put("orgBranchCode", orgBranchCode); equMap.put("orgBranchCode", orgBranchCode);
equMap.put("EQU_STATE", equipmentInfoForm.get("EQU_STATE")); equMap.put("EQU_STATE", equipmentInfoForm.get("EQU_STATE"));
}
String record = this.saveEquipmentDataInTransaction(equMap, dataSource, remark); String record = this.saveEquipmentDataInTransaction(equMap, dataSource, remark);
recordSet.add(record); recordSet.add(record);
}); }
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
eventPublisher.publish(new EquipCreateOrEditEvent(
this,
BusinessTypeEnum.JG_NEW_EQUIP.name(),
recordSet,
EquipCreateOrEditEvent.EquipType.equip
));
} }
/** /**
......
...@@ -39,6 +39,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*; ...@@ -39,6 +39,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.biz.config.PressureVesselListener; import com.yeejoin.amos.boot.module.jg.biz.config.PressureVesselListener;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext; import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService; import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.edit.backup.TechParamsBackupService;
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.reminder.core.event.EquipCreateOrEditEvent; import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent;
...@@ -329,6 +330,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -329,6 +330,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired @Autowired
private EventPublisher eventPublisher; private EventPublisher eventPublisher;
@Autowired
private TechParamsBackupService techParamsBackupService;
public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE"; public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE";
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
...@@ -1188,6 +1192,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1188,6 +1192,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
equipInfoMap.put("companyLevel", companyLevel); equipInfoMap.put("companyLevel", companyLevel);
equipInfoMap.put("type", equIpClassMap.get("type")); equipInfoMap.put("type", equIpClassMap.get("type"));
String formType = Optional.ofNullable(equIpClassMap.get("formType"))
.map(Object::toString)
.filter(s -> !s.trim().isEmpty())
.orElse("add");
equipInfoMap.put("formType", formType);
// 设备参数 // 设备参数
if (equIpClassMap.containsKey(EQU_LIST) && !ValidationUtil.isEmpty(equIpClassMap.get(EQU_LIST).toString())) { if (equIpClassMap.containsKey(EQU_LIST) && !ValidationUtil.isEmpty(equIpClassMap.get(EQU_LIST).toString())) {
Map<String, Object> equipParamsMap = this.getEquipParamsMap(record, "", equIpClassMap.get(EQU_LIST).toString()); Map<String, Object> equipParamsMap = this.getEquipParamsMap(record, "", equIpClassMap.get(EQU_LIST).toString());
...@@ -3616,9 +3625,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3616,9 +3625,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 八大类技术参数和主要零部件和安全附件表 // 八大类技术参数和主要零部件和安全附件表
List<IdxBizJgMainParts> mainPartsList = new ArrayList<>(); List<IdxBizJgMainParts> mainPartsList = new ArrayList<>();
List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>(); List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>();
// 统一设置所有 SEQ 字段
Object params = techParamsBackupService.getTechParams(equList, record);
// 电梯 // 电梯
if (EquipmentClassifityEnum.DT.getCode().equals(equList)) { if (EquipmentClassifityEnum.DT.getCode().equals(equList)) {
if (params instanceof IdxBizJgTechParamsElevator) {
equipmentParamsForm.put("ELEVATOR_SEQ", ((IdxBizJgTechParamsElevator) params).getSequenceNbr());
}
IdxBizJgTechParamsElevator elevator = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsElevator.class); IdxBizJgTechParamsElevator elevator = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsElevator.class);
if (!ValidationUtil.isEmpty(elevator)) { if (!ValidationUtil.isEmpty(elevator)) {
elevator.setRecord(record); elevator.setRecord(record);
...@@ -3629,6 +3643,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3629,6 +3643,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
// 厂车 // 厂车
else if (EquipmentClassifityEnum.CC.getCode().equals(equList)) { else if (EquipmentClassifityEnum.CC.getCode().equals(equList)) {
if (params instanceof IdxBizJgTechParamsVehicle) {
equipmentParamsForm.put("VEHICLE_SEQ", ((IdxBizJgTechParamsVehicle) params).getSequenceNbr());
}
IdxBizJgTechParamsVehicle vehicle = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVehicle.class); IdxBizJgTechParamsVehicle vehicle = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVehicle.class);
if (!ValidationUtil.isEmpty(vehicle)) { if (!ValidationUtil.isEmpty(vehicle)) {
vehicle.setRecord(record); vehicle.setRecord(record);
...@@ -3646,6 +3663,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3646,6 +3663,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
// 索道 // 索道
else if (EquipmentClassifityEnum.KYSD.getCode().equals(equList)) { else if (EquipmentClassifityEnum.KYSD.getCode().equals(equList)) {
if (params instanceof IdxBizJgTechParamsRopeway) {
equipmentParamsForm.put("ROPEWAY_SEQ", ((IdxBizJgTechParamsRopeway) params).getSequenceNbr());
}
IdxBizJgTechParamsRopeway ropeway = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRopeway.class); IdxBizJgTechParamsRopeway ropeway = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRopeway.class);
if (!ValidationUtil.isEmpty(ropeway)) { if (!ValidationUtil.isEmpty(ropeway)) {
ropeway.setRecord(record); ropeway.setRecord(record);
...@@ -3662,6 +3682,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3662,6 +3682,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
// 游乐设施 // 游乐设施
else if (EquipmentClassifityEnum.YLSS.getCode().equals(equList)) { else if (EquipmentClassifityEnum.YLSS.getCode().equals(equList)) {
if (params instanceof IdxBizJgTechParamsRides) {
equipmentParamsForm.put("RIDES_SEQ", ((IdxBizJgTechParamsRides) params).getSequenceNbr());
}
IdxBizJgTechParamsRides rides = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRides.class); IdxBizJgTechParamsRides rides = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRides.class);
if (!ValidationUtil.isEmpty(rides)) { if (!ValidationUtil.isEmpty(rides)) {
rides.setRecord(record); rides.setRecord(record);
...@@ -3672,6 +3695,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3672,6 +3695,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
// 锅炉 // 锅炉
else if (EquipmentClassifityEnum.GL.getCode().equals(equList)) { else if (EquipmentClassifityEnum.GL.getCode().equals(equList)) {
if (params instanceof IdxBizJgTechParamsBoiler) {
equipmentParamsForm.put("BOILER_SEQ", ((IdxBizJgTechParamsBoiler) params).getSequenceNbr());
}
IdxBizJgTechParamsBoiler boiler = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsBoiler.class); IdxBizJgTechParamsBoiler boiler = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsBoiler.class);
if (!ValidationUtil.isEmpty(boiler)) { if (!ValidationUtil.isEmpty(boiler)) {
boiler.setRecord(record); boiler.setRecord(record);
...@@ -3687,6 +3713,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3687,6 +3713,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
// 压力容器 // 压力容器
else if (EquipmentClassifityEnum.YLRQ.getCode().equals(equList)) { else if (EquipmentClassifityEnum.YLRQ.getCode().equals(equList)) {
if (params instanceof IdxBizJgTechParamsVessel) {
equipmentParamsForm.put("VESSEL_SEQ", ((IdxBizJgTechParamsVessel) params).getSequenceNbr());
}
IdxBizJgTechParamsVessel vessel = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVessel.class); IdxBizJgTechParamsVessel vessel = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVessel.class);
if (!ValidationUtil.isEmpty(vessel)) { if (!ValidationUtil.isEmpty(vessel)) {
vessel.setRecord(record); vessel.setRecord(record);
...@@ -3710,6 +3739,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3710,6 +3739,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
// 压力管道 // 压力管道
else if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) { else if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) {
if (params instanceof IdxBizJgTechParamsPipeline) {
equipmentParamsForm.put("PIPELINE_SEQ", ((IdxBizJgTechParamsPipeline) params).getSequenceNbr());
}
IdxBizJgTechParamsPipeline pipeline = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsPipeline.class); IdxBizJgTechParamsPipeline pipeline = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipeline)) { if (!ValidationUtil.isEmpty(pipeline)) {
pipeline.setRecord(record); pipeline.setRecord(record);
...@@ -4509,6 +4541,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4509,6 +4541,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private EquipmentInfoDto createEquipmentInfoDto private EquipmentInfoDto createEquipmentInfoDto
(Map<String, Object> equipmentInfoForm, JgVehicleInformationMapper jgVehicleInformationMapper) { (Map<String, Object> equipmentInfoForm, JgVehicleInformationMapper jgVehicleInformationMapper) {
String[] parts = Optional.ofNullable(equipmentInfoForm.get("orgBranchCode"))
.map(Object::toString)
.map(s -> s.split("_", 2))
.orElse(new String[0]);
String orgBranchCode = parts.length > 0 ? parts[0] : "";
String orgBranchName = parts.length > 1 ? parts[1] : "";
EquipmentInfoDto dto = new EquipmentInfoDto(); EquipmentInfoDto dto = new EquipmentInfoDto();
String equListCode = (String) equipmentInfoForm.get("EQU_LIST"); String equListCode = (String) equipmentInfoForm.get("EQU_LIST");
String equCategoryCode = (String) equipmentInfoForm.get("EQU_CATEGORY"); String equCategoryCode = (String) equipmentInfoForm.get("EQU_CATEGORY");
...@@ -4521,10 +4559,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4521,10 +4559,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
dto.setEquDefine(jgVehicleInformationMapper.getEquCategoryNameByCode(equDefineCode)); dto.setEquDefine(jgVehicleInformationMapper.getEquCategoryNameByCode(equDefineCode));
dto.setDataSource((String) equipmentInfoForm.get("DATA_SOURCE")); dto.setDataSource((String) equipmentInfoForm.get("DATA_SOURCE"));
dto.setUseOrgCode((String) equipmentInfoForm.get("USE_ORG_CODE")); dto.setUseOrgCode((String) equipmentInfoForm.get("USE_ORG_CODE"));
dto.setOrgBranchCode(orgBranchCode);
dto.setOrgBranchName(orgBranchName);
if ("his".equals(equipmentInfoForm.get("DATA_SOURCE"))) { if ("his".equals(equipmentInfoForm.get("DATA_SOURCE"))) {
dto.setReceiveOrgCode(((String) equipmentInfoForm.get("RECEIVE_ORG_CODE")).split("_")[0]); dto.setReceiveOrgCode(((String) equipmentInfoForm.get("RECEIVE_ORG_CODE")).split("_")[0]);
dto.setReceiveOrgName(((String) equipmentInfoForm.get("RECEIVE_ORG_CODE")).split("_")[1]); dto.setReceiveOrgName(((String) equipmentInfoForm.get("RECEIVE_ORG_CODE")).split("_")[1]);
dto.setOrgBranchCode(Optional.ofNullable(equipmentInfoForm.get("orgBranchCode")).map(Object::toString).orElse(""));
dto.setEquState(Optional.ofNullable(equipmentInfoForm.get("EQU_STATE")).map(Object::toString).orElse("")); dto.setEquState(Optional.ofNullable(equipmentInfoForm.get("EQU_STATE")).map(Object::toString).orElse(""));
} }
dto.setPossession(Optional.ofNullable(equipmentInfoForm.get("VEHICLE_APANAGE")).map(Object::toString).orElse("")); dto.setPossession(Optional.ofNullable(equipmentInfoForm.get("VEHICLE_APANAGE")).map(Object::toString).orElse(""));
......
...@@ -145,9 +145,10 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -145,9 +145,10 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
private JgUseRegistrationManageServiceImpl useRegistrationManageService; private JgUseRegistrationManageServiceImpl useRegistrationManageService;
@Autowired @Autowired
private IIdxBizJgOtherInfoService otherInfoService; private IIdxBizJgOtherInfoService otherInfoService;
@Autowired @Autowired
private EventPublisher eventPublisher; private EventPublisher eventPublisher;
@Autowired
private JgVehicleInformationMapper jgVehicleInformationMapper;
/** /**
* 新增移装变更登记 * 新增移装变更登记
...@@ -393,7 +394,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -393,7 +394,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
this.flowExecute(oldTransfer.getSequenceNbr(), oldTransfer.getInstanceId(), "0", "", String.valueOf(map.get("nextTaskId"))); this.flowExecute(oldTransfer.getSequenceNbr(), oldTransfer.getInstanceId(), "0", "", String.valueOf(map.get("nextTaskId")));
} else { } else {
// 如果是新启动的流程开启自动访问 // 如果是新启动的流程开启自动访问
String equipListName = Optional.ofNullable(tableData.get("equListDesc")).orElse("无").toString(); String equipListName = jgVehicleInformationMapper.getEquCategoryNameByCode(Objects.toString(tableData.get("equListCode")));
oldTransfer.setAuditStatus(WorkFlowStatusEnum.TRANSFER_RECEIVE.getPass()); oldTransfer.setAuditStatus(WorkFlowStatusEnum.TRANSFER_RECEIVE.getPass());
oldTransfer.setStatus(WorkFlowStatusEnum.TRANSFER_RECEIVE.getPass()); oldTransfer.setStatus(WorkFlowStatusEnum.TRANSFER_RECEIVE.getPass());
oldTransfer.setEquipListName(equipListName); oldTransfer.setEquipListName(equipListName);
......
...@@ -34,6 +34,7 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCur ...@@ -34,6 +34,7 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCur
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.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis; import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.jg.biz.utils.ObjectCleanerUtils;
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.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;
...@@ -643,13 +644,15 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -643,13 +644,15 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
dto.setCreateDate(new Date()); dto.setCreateDate(new Date());
dto.setEquList(jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquListCode())); dto.setEquList(jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquListCode()));
dto.setEquCategory(jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquCategory())); dto.setEquCategory(jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquCategory()));
dto = ObjectCleanerUtils.removeStringNullFields(dto, JgTransferNotice.class);
list.add(dto); list.add(dto);
this.saveOrUpdate(list.get(0)); this.saveOrUpdate(list.get(0));
if (!CollectionUtils.isEmpty(deviceList)){ if (!CollectionUtils.isEmpty(deviceList)){
JgTransferNotice finalDto = dto;
deviceList.forEach(obj -> { deviceList.forEach(obj -> {
JgTransferNoticeEq jgRelationEquip = new JgTransferNoticeEq(); JgTransferNoticeEq jgRelationEquip = new JgTransferNoticeEq();
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR"))); jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(dto.getSequenceNbr().toString()); jgRelationEquip.setEquipTransferId(finalDto.getSequenceNbr() +"");
jgRelationEquip.setEquCategory(obj.getOrDefault("EQU_CATEGORY", "").toString());//设备类别 jgRelationEquip.setEquCategory(obj.getOrDefault("EQU_CATEGORY", "").toString());//设备类别
jgRelationEquip.setEquList(String.valueOf(obj.get("EQU_LIST")));//设备种类 jgRelationEquip.setEquList(String.valueOf(obj.get("EQU_LIST")));//设备种类
jgRelationEquip.setEquListCode(String.valueOf(obj.get("EQU_LIST_CODE")));//设备种类编码 jgRelationEquip.setEquListCode(String.valueOf(obj.get("EQU_LIST_CODE")));//设备种类编码
......
...@@ -629,6 +629,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -629,6 +629,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
map.put("safetyManagerId", data[0]); map.put("safetyManagerId", data[0]);
map.put("safetyManagerName", data[1]); map.put("safetyManagerName", data[1]);
} }
if (map.containsKey("useUnitCreditCode") && map.get("useUnitCreditCode") != null) {
String[] data = String.valueOf(map.getString("useUnitCreditCode")).split("_");
map.put("useUnitCreditCode", data[0]);
}
// 使用单位提交 // 使用单位提交
jgUseRegistration.setUseUnitName(CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ? jgUseRegistration.setUseUnitName(CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ?
company.getCompanyName().split("_")[1] : company.getCompanyName()); company.getCompanyName().split("_")[1] : company.getCompanyName());
...@@ -1241,6 +1245,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -1241,6 +1245,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 装置更新管道的技术参数、设计信息、安装信息 // 装置更新管道的技术参数、设计信息、安装信息
if (jgProjectContraption != null) { if (jgProjectContraption != null) {
updatePieLineTechAndInspection(equipmentLists); updatePieLineTechAndInspection(equipmentLists);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(jgUseRegistration.getApplyNo())
.businessType(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName())
.businessId(jgUseRegistration.getSequenceNbr() + "")
.equId(jgProjectContraption.getSequenceNbr() +"")
.approvalUnit(jgUseRegistration.getReceiveOrgName())
.approvalUnitCode(jgUseRegistration.getReceiveCompanyCode())
.changeContent(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName() + "业务办理")
.status("正常")
.routePath(taskV2Model.getRoutePath())
.build());
} }
for (int i = 0; i < equipmentLists.size(); i++) { for (int i = 0; i < equipmentLists.size(); i++) {
Map<String, Object> equipment = equipmentLists.get(i); Map<String, Object> equipment = equipmentLists.get(i);
...@@ -1790,6 +1805,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -1790,6 +1805,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 新增页面选择无设备代码后,在审批通过后自动生成设备代码 // 新增页面选择无设备代码后,在审批通过后自动生成设备代码
this.justGenerateEquCode(lambda, registerInfo, jgUseRegistration.getReceiveCompanyCode(), mapData, jgRegistrationHistory); this.justGenerateEquCode(lambda, registerInfo, jgUseRegistration.getReceiveCompanyCode(), mapData, jgRegistrationHistory);
idxBizJgRegisterInfoService.update(lambda); idxBizJgRegisterInfoService.update(lambda);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(jgUseRegistration.getApplyNo())
.businessType(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName())
.businessId(jgUseRegistration.getSequenceNbr() + "")
.equId((String) mapData.get("equipId"))
.approvalUnit(jgUseRegistration.getReceiveOrgName())
.approvalUnitCode(jgUseRegistration.getReceiveCompanyCode())
.changeContent(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName() + "业务办理")
.status("正常")
.routePath(taskV2Model.getRoutePath())
.build());
} }
} }
// 使用信息 // 使用信息
...@@ -1804,17 +1830,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -1804,17 +1830,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
useInfoMapper.updateById(useInfo); useInfoMapper.updateById(useInfo);
// 更新es // 更新es
updateEsData(usePlace, mapData, otherInfo, useInfo, jgUseRegistration, jsonObject); updateEsData(usePlace, mapData, otherInfo, useInfo, jgUseRegistration, jsonObject);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(jgUseRegistration.getApplyNo())
.businessType(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName())
.businessId(jgUseRegistration.getSequenceNbr() + "")
.equId((String) mapData.get("equipId"))
.approvalUnit(jgUseRegistration.getReceiveOrgName())
.approvalUnitCode(jgUseRegistration.getReceiveCompanyCode())
.changeContent(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName() + "业务办理")
.status("正常")
.routePath(taskV2Model.getRoutePath())
.build());
} }
/** /**
......
package com.yeejoin.amos.boot.module.jg.biz.utils;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.experimental.UtilityClass;
import java.util.Map;
import java.util.stream.Collectors;
@UtilityClass
public class ObjectCleanerUtils {
public static <T> T removeStringNullFields(T obj, Class<T> clazz) {
if (obj == null) return null;
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> map = mapper.convertValue(obj, new TypeReference<Map<String, Object>>() {});
Map<String, Object> cleanedMap = map.entrySet().stream()
.filter(e -> {
Object value = e.getValue();
return value != null && !(value instanceof String && "null".equalsIgnoreCase((String) value));
})
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
return mapper.convertValue(cleanedMap, clazz);
}
}
\ 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