Commit 8053f3d6 authored by suhuiguang's avatar suhuiguang

fix(大编辑):bug修复

1.字段处理,空制造bug修改 2.管道编辑公共部分开发
parent 6940b0f2
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.biz.common.annotation.Group;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 安全追溯-压力管道
*
......@@ -21,4 +25,38 @@ public class PipelineChangeItemDto extends TechParamsPipelineChangeFieldDto {
@FieldDisplayDefine(value = "设计单位名称")
private String designUnitName;
@FieldDisplayDefine(value = "检验检测流水id", isExist = false)
private String jySeq;
@FieldDisplayDefine(value = "安装信息流水", isExist = false)
private String constructionInfoSeq;
@FieldDisplayDefine(value ="检验类型", dictCode = "JYJC")
private String inspectType;
@FieldDisplayDefine(value ="检验机构统一信用代码")
private String inspectOrgCode;
@FieldDisplayDefine(value ="检验机构名称")
private String inspectOrgName;
@FieldDisplayDefine(value ="检验报告", type = JSON.class)
private String inspectReport;
@FieldDisplayDefine(value ="检验人员")
private String inspectStaff;
@FieldDisplayDefine(value ="检验日期")
private Date inspectDate;
@FieldDisplayDefine(value ="检验结论", dictCode = "JYJL")
private String inspectConclusion;
@FieldDisplayDefine(value = "下次检验日期")
private Date nextInspectDate;
@FieldDisplayDefine(value ="检验报告编号")
private String inspectReportNo;
}
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.biz.common.annotation.Group;
import io.swagger.annotations.ApiModel;
......@@ -30,10 +31,27 @@ public class ProjectContraptionChangeDataDto extends BaseChangeDataDto {
@FieldDisplayDefine(value = "工程(装置)编号/项目编号")
private String projectContraptionNo;
@FieldDisplayDefine(value = "设备品种代码")
private String equDefineCode;
@FieldDisplayDefine(value = "设备种类名称", isExist = false)
private String equListName;
@FieldDisplayDefine(value = "设备种类编码", isExist = false)
private String equList;
@FieldDisplayDefine(value = "设备类别名称", isExist = false)
private String equCategoryName;
@FieldDisplayDefine(value = "设备类别编码", isExist = false)
private String equCategory;
@FieldDisplayDefine(value = "设备品种名称")
private String equDefineName;
@FieldDisplayDefine(value = "设备品种代码", typeHandler = "equipCategoryTypeHandler")
private String equDefine;
@FieldDisplayDefine(value = "装置管道总长度(m)", isExist = false)
......@@ -49,18 +67,18 @@ public class ProjectContraptionChangeDataDto extends BaseChangeDataDto {
private String productQualificationCertificate;
@FieldDisplayDefine(value = "使用地点代码_省")
@FieldDisplayDefine(value = "使用地点代码_省",typeHandler = "regionCodeTypeHandler")
private String province;
@FieldDisplayDefine(value = "使用地点代码_市")
@FieldDisplayDefine(value = "使用地点代码_市", typeHandler = "regionCodeTypeHandler")
private String city;
@FieldDisplayDefine(value = "使用地点代码_区(县)")
@FieldDisplayDefine(value = "使用地点代码_区(县)", typeHandler = "regionCodeTypeHandler")
private String county;
@FieldDisplayDefine(value = "使用地点代码_街道(镇)")
@FieldDisplayDefine(value = "使用地点代码_街道(镇)", typeHandler = "regionCodeTypeHandler")
private String street;
......@@ -68,6 +86,10 @@ public class ProjectContraptionChangeDataDto extends BaseChangeDataDto {
private String address;
@FieldDisplayDefine(value = "使用地点名称省")
private String provinceName;
@FieldDisplayDefine(value = "使用地点_市名称")
private String cityName;
......@@ -86,4 +108,19 @@ public class ProjectContraptionChangeDataDto extends BaseChangeDataDto {
@FieldDisplayDefine(value = " 装置结束位置", type = JSON.class)
private String endLatitudeLongitude;
@FieldDisplayDefine(value = "来源类型", isExist = false)
private String dataSource;
@FieldDisplayDefine(value = "使用单位名称", isExist = false)
private String useUnitCreditCode;
@FieldDisplayDefine(value = "使用单位统一信用代码", isExist = false)
private String useUnitName;
@FieldDisplayDefine(value = "施工单位统一信用代码", isExist = false)
private String uscUnitCreditCode;
@FieldDisplayDefine(value = "施工单位名称", isExist = false)
private String uscUnitName;
}
......@@ -891,10 +891,18 @@
ibjtpp."REMARKS" AS remarks,
ibjdi."DESIGN_UNIT_NAME" AS designUnitName,
ibjui."USE_DATE" AS useDate,
ibjui."RECORD" AS record
ibjui."RECORD" AS record,
(SELECT SEQUENCE_NBR from idx_biz_jg_construction_info where "RECORD" = ibjui."RECORD" ORDER BY USC_DATE DESC limit 1) constructionInfoSeq,
(SELECT USC_UNIT_NAME from idx_biz_jg_construction_info where "RECORD" = ibjui."RECORD" ORDER BY USC_DATE DESC limit 1) uscUnitName,
to_char((SELECT USC_DATE from idx_biz_jg_construction_info where "RECORD" = ibjui."RECORD" ORDER BY USC_DATE DESC limit 1), 'YYYY-MM') uscDate,
(select SEQUENCE_NBR from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) jySeq,
(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,
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 INSPECT_REPORT from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectReport
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_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD
WHERE
ibjui.record in
<foreach collection="records" item="record" open="(" close=")" separator=",">
......
......@@ -14,8 +14,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.biz.common.annotation.Group;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.typeHandler.TypeHandler;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
......@@ -23,10 +23,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.FormatService;
import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContraptionServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.*;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
......@@ -59,7 +56,6 @@ import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -77,6 +73,8 @@ import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgCertificateRepl
@Getter
public class CommonEquipDataProcessService {
private final IdxBizJgConstructionInfoServiceImpl jgConstructionInfoService;
private final IdxBizJgDesignInfoMapper idxBizJgDesignInfoMapper;
private final IdxBizJgFactoryInfoMapper jgFactoryInfoMapper;
......@@ -121,6 +119,8 @@ public class CommonEquipDataProcessService {
private final FormatService formatService;
private final IdxBizJgRegisterInfoServiceImpl jgRegisterInfoService;
public static final String BASE_COLUMN_REC_DATE = "\"REC_DATE\"";
public static final String BASE_COLUMN_REC_USERID = "\"REC_USER_ID\"";
......@@ -289,7 +289,7 @@ public class CommonEquipDataProcessService {
}
});
List<FieldChangeMeta> up = changeDataNew.stream().filter(n -> !StringUtils.equals(n.getColumnNewValue(), n.getColumnOldValue())).collect(Collectors.toList());
up.forEach(fieldChangeMeta->{
up.forEach(fieldChangeMeta -> {
fieldChangeMeta.setDisplayOldValue(formatService.format(fieldChangeMeta.getFieldDisplayDefine(), fieldChangeMeta.getColumnOldValue()));
fieldChangeMeta.setDisplayNewValue(formatService.format(fieldChangeMeta.getFieldDisplayDefine(), fieldChangeMeta.getColumnNewValue()));
});
......@@ -914,7 +914,7 @@ public class CommonEquipDataProcessService {
Page<IdxBizJgProjectContraption> page = new Page<>();
page.setCurrent(params.getLong("current"));
page.setSize(params.getLong("size"));
if(projectContraptionIds.isEmpty()){
if (projectContraptionIds.isEmpty()) {
return page;
}
// 工程装置名称
......@@ -979,4 +979,45 @@ public class CommonEquipDataProcessService {
equipChangeDataUpdateServiceImpl.updateInspectInfoEs(record, equipUseInfoChangeDataDto);
}
}
public void setNameByCode2UseInfo(IdxBizJgUseInfo useInfoNew) {
// 1.使用地点name冗余
// 市
List<LinkedHashMap> city = (List<LinkedHashMap>) this.getRedisUtils().get("CITY");
// 区
List<LinkedHashMap> region = (List<LinkedHashMap>) this.getRedisUtils().get("REGION");
// 街道
List<LinkedHashMap> street = (List<LinkedHashMap>) this.getRedisUtils().get("STREET");
// 城市
if (StringUtils.isNotEmpty(useInfoNew.getCity()) && !org.apache.commons.lang3.ObjectUtils.isEmpty(city)) {
city.forEach(item -> {
if (String.valueOf(item.get("regionCode")).equals(useInfoNew.getCity())) {
useInfoNew.setCityName(String.valueOf(item.get("regionName")));
}
});
}
// 区县
if (StringUtils.isNotEmpty(useInfoNew.getCounty()) && !org.apache.commons.lang3.ObjectUtils.isEmpty(region)) {
region.forEach(item -> {
if (String.valueOf(item.get("regionCode")).equals(useInfoNew.getCounty())) {
useInfoNew.setCountyName(String.valueOf(item.get("regionName")));
}
});
}
// 街道
if (StringUtils.isNotEmpty(useInfoNew.getFactoryUseSiteStreet()) && !org.apache.commons.lang3.ObjectUtils.isEmpty(street)) {
street.forEach(item -> {
if (String.valueOf(item.get("regionCode")).equals(useInfoNew.getFactoryUseSiteStreet())) {
useInfoNew.setStreetName(String.valueOf(item.get("regionName")));
}
});
}
// 2.产权单位名称冗余
// 产权单位信息
if (StringUtils.isNotEmpty(useInfoNew.getEstateUnitCreditCode())) {
CompanyBo companyBo = this.getCommonMapper().queryCompanyByCode(useInfoNew.getEstateUnitCreditCode());
Optional.ofNullable(companyBo).ifPresent(item -> useInfoNew.setEstateUnitName(companyBo.getCompanyName()));
}
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.process.equip;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
import com.yeejoin.amos.boot.module.jg.api.dto.PieLineDesignChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.PipelineChangeItemDto;
import com.yeejoin.amos.boot.module.jg.api.dto.ProjectContraptionChangeDataDto;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContraptionServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgSupervisionInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Component
@RequiredArgsConstructor
public class PieLineDataChangeServiceImpl {
private final IdxBizJgSupervisionInfoServiceImpl supervisionInfoService;
private ESEquipmentCategory esEquipmentCategory;
private final SuperviseInfoMapper superviseInfoMapper;
private final CommonEquipDataProcessService commonEquipDataProcessService;
private final IdxBizJgProjectContraptionServiceImpl idxBizJgProjectContraptionServiceImpl;
private final EquipChangeDataUpdateServiceImpl equipChangeDataUpdateServiceImpl;
public PieLineDataChangeServiceImpl(CommonEquipDataProcessService commonEquipDataProcessService, IdxBizJgProjectContraptionServiceImpl idxBizJgProjectContraptionServiceImpl, EquipChangeDataUpdateServiceImpl equipChangeDataUpdateServiceImpl) {
this.commonEquipDataProcessService = commonEquipDataProcessService;
this.idxBizJgProjectContraptionServiceImpl = idxBizJgProjectContraptionServiceImpl;
this.equipChangeDataUpdateServiceImpl = equipChangeDataUpdateServiceImpl;
}
private final SnowflakeIdUtil idUtil;
public void update(ProjectContraptionChangeDataDto projectContraptionChangeDataDtoNew, List<FieldChangeMeta> allChangeColumns) {
// 原有对象行转列
......@@ -81,15 +92,171 @@ public class PieLineDataChangeServiceImpl {
}
public void deletePieLineBatch(List<PipelineChangeItemDto> deletedPieLines, List<FieldChangeMeta> allChangeColumns, String projectContraptionId) {
// todo 构建日志 allChangeColumns afterData = null
// todo 数据库管道删除
// todo es管道删除
List<String> recordsForDeleted = deletedPieLines.stream().map(TechParamsPipelineChangeFieldDto::getRecord).collect(Collectors.toList());
// 构建删除日志
this.buildDeletePieLineLog(recordsForDeleted, allChangeColumns, projectContraptionId);
// 删除涉及的19张表的数据
superviseInfoMapper.deleteDataAll(recordsForDeleted);
List<ESEquipmentCategoryDto> esDtoList = recordsForDeleted.stream().map(v -> {
ESEquipmentCategoryDto esDto = new ESEquipmentCategoryDto();
esDto.setSEQUENCE_NBR(v);
return esDto;
}).collect(Collectors.toList());
// 删除es中的数据
esEquipmentCategory.deleteAll(esDtoList);
}
private void buildDeletePieLineLog(List<String> recordsForDeleted, List<FieldChangeMeta> allChangeColumns, String projectContraptionId) {
recordsForDeleted.forEach(record -> {
FieldChangeMeta fieldChangeMeta = new FieldChangeMeta();
fieldChangeMeta.setChangeId(projectContraptionId);
fieldChangeMeta.setColumnKey("record");
fieldChangeMeta.setColumnLabel("管道删除");
fieldChangeMeta.setColumnType("String");
fieldChangeMeta.setFieldDisplayDefine(null);
fieldChangeMeta.setColumnFamily("pie_line_delete");
fieldChangeMeta.setColumnNewValue(null);
fieldChangeMeta.setDisplayNewValue(null);
fieldChangeMeta.setColumnOldValue(record);
fieldChangeMeta.setDisplayOldValue(record);
allChangeColumns.add(fieldChangeMeta);
});
}
void newPieLine(ProjectContraptionChangeDataDto projectContraptionChangeDataDto, PipelineChangeItemDto newPieLine, List<FieldChangeMeta> allChangeColumns) {
String record = idUtil.nextId().toString();
this.buildNewPieLineLog(projectContraptionChangeDataDto, record, allChangeColumns);
// 检验信息
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = BeanUtil.copyProperties(newPieLine, IdxBizJgInspectionDetectionInfo.class);
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
List<Map<String, Object>> inspectionAndTestingInstitutions = commonEquipDataProcessService.getCommonService().getUnitListByType("inspection", "gasCylindersForCars", false);
Optional<Map<String, Object>> optional = inspectionAndTestingInstitutions.stream().filter(x -> x.get("useCode").equals(inspectionDetectionInfo.getInspectOrgCode())).findFirst();
Map<String, Object> mapOrDefault = optional.orElse(Collections.emptyMap());
inspectionDetectionInfo.setInspectOrgName((String) mapOrDefault.getOrDefault("useUnit", inspectionDetectionInfo.getInspectOrgName()));
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfo.setSequenceNbr(null);
if (inspectionDetectionInfo.getNextInspectDate() != null) {
inspectionDetectionInfo.setNextInspectDate(DateUtil.parse(DateUtil.format(inspectionDetectionInfo.getNextInspectDate(), DatePattern.NORM_DATE_PATTERN)));
}
}
// 使用信息
IdxBizJgUseInfo useInfo = BeanUtil.copyProperties(newPieLine, IdxBizJgUseInfo.class);
useInfo.setRecord(record);
useInfo.setSequenceNbr(null);
useInfo.setRecDate(new Date());
useInfo.setDataSource(projectContraptionChangeDataDto.getDataSource());
useInfo.setIsIntoManagement(Boolean.FALSE);
SingleProjectEquipChangeProcess.setNewUseAddressInfo(projectContraptionChangeDataDto, useInfo);
commonEquipDataProcessService.getIdxBizJgUseInfoService().save(useInfo);
// 设计信息
IdxBizJgDesignInfo designInfo = BeanUtil.copyProperties(newPieLine, IdxBizJgDesignInfo.class);
designInfo.setRecord(record);
designInfo.setRecDate(new Date());
designInfo.setSequenceNbr(null);
commonEquipDataProcessService.getIdxBizJgDesignInfoMapper().insert(designInfo);
// 制造信息
IdxBizJgFactoryInfo factoryInfo = BeanUtil.copyProperties(newPieLine, IdxBizJgFactoryInfo.class);
factoryInfo.setRecord(record);
factoryInfo.setRecDate(new Date());
factoryInfo.setSequenceNbr(null);
commonEquipDataProcessService.getJgFactoryInfoMapper().insert(factoryInfo);
// 施工信息
IdxBizJgConstructionInfo constructionInfo = BeanUtil.copyProperties(newPieLine, IdxBizJgConstructionInfo.class);
constructionInfo.setRecord(record);
constructionInfo.setRecDate(new Date());
constructionInfo.setUscUnitCreditCode(projectContraptionChangeDataDto.getUscUnitCreditCode());
constructionInfo.setUscUnitName(projectContraptionChangeDataDto.getUscUnitName());
constructionInfo.setSequenceNbr(null);
commonEquipDataProcessService.getJgConstructionInfoService().save(constructionInfo);
// 注册登记信息
IdxBizJgRegisterInfo registerInfo = BeanUtil.copyProperties(newPieLine, IdxBizJgRegisterInfo.class);
registerInfo.setRecord(record);
registerInfo.setRecDate(new Date());
registerInfo.setSequenceNbr(null);
registerInfo.setEquCodeType("2");
registerInfo.setRegisterState(this.getRegCode());
registerInfo.setEquList(projectContraptionChangeDataDto.getEquList());
registerInfo.setEquCategory(projectContraptionChangeDataDto.getEquCategory());
registerInfo.setEquDefine(projectContraptionChangeDataDto.getEquDefine());
// 补丁:saveOrUpdate在update数据时不会更新字段为null的字段,但是编辑设备的代码时,从有改成无,equCode解析成null,但是此时需要将equcode删掉
registerInfo.setEquCode(ObjectUtils.isEmpty(registerInfo.getEquCode()) ? "" : registerInfo.getEquCode());
// 监督管理
IdxBizJgSupervisionInfo supervisionInfo = BeanUtil.copyProperties(newPieLine, IdxBizJgSupervisionInfo.class);
supervisionInfo.setRecord(record);
supervisionInfo.setRecDate(new Date());
supervisionInfo.setSequenceNbr(null);
supervisionInfoService.save(supervisionInfo);
// 其他信息
IdxBizJgOtherInfo otherInfo = BeanUtil.copyProperties(newPieLine, IdxBizJgOtherInfo.class);
otherInfo.setRecord(record);
otherInfo.setSequenceNbr(null);
otherInfo.setClaimStatus("已认领");
otherInfo.setRecDate(new Date());
commonEquipDataProcessService.getIdxBizJgOtherInfoMapper().insert(otherInfo);
//管道技术参数
IdxBizJgTechParamsPipeline pipelineInfo = BeanUtil.copyProperties(newPieLine, IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipelineInfo)) {
pipelineInfo.setRecord(record);
pipelineInfo.setRecDate(new Date());
pipelineInfo.setSequenceNbr(null);
}
registerInfo.setProductName(pipelineInfo.getPipeName());
commonEquipDataProcessService.getJgRegisterInfoService().save(registerInfo);
ESEquipmentCategoryDto esEquipmentDto = BeanUtil.copyProperties(newPieLine, ESEquipmentCategoryDto.class);
esEquipmentDto.setDATA_SOURCE(useInfo.getDataSource());
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentDto.setREC_DATE(new Date().getTime());
esEquipmentDto.setSEQUENCE_NBR(record);
esEquipmentDto.setIS_INTO_MANAGEMENT(false);
esEquipmentDto.setEQU_CATEGORY_CODE(projectContraptionChangeDataDto.getEquCategory());
esEquipmentDto.setEQU_CATEGORY(projectContraptionChangeDataDto.getEquCategoryName());
esEquipmentDto.setEQU_LIST_CODE(projectContraptionChangeDataDto.getEquList());
esEquipmentDto.setEQU_LIST(projectContraptionChangeDataDto.getEquListName());
esEquipmentDto.setEQU_DEFINE_CODE(projectContraptionChangeDataDto.getEquDefine());
esEquipmentDto.setEQU_DEFINE(projectContraptionChangeDataDto.getEquDefineName());
esEquipmentDto.setSTATUS("已认领");
esEquipmentDto.setUSC_UNIT_CREDIT_CODE(projectContraptionChangeDataDto.getUscUnitCreditCode());
esEquipmentDto.setUSC_UNIT_NAME(projectContraptionChangeDataDto.getUscUnitName());
esEquipmentDto.setUSE_UNIT_CREDIT_CODE(projectContraptionChangeDataDto.getUseUnitCreditCode());
esEquipmentDto.setUSE_UNIT_NAME(projectContraptionChangeDataDto.getUseUnitName());
esEquipmentDto.setPROJECT_CONTRAPTION(projectContraptionChangeDataDto.getProjectContraption());
esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
esEquipmentDto.setProjectContraptionId(projectContraptionChangeDataDto.getProjectContraptionId());
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentCategory.save(esEquipmentDto);
}
private void buildNewPieLineLog(ProjectContraptionChangeDataDto projectContraptionChangeDataDto, String record, List<FieldChangeMeta> allChangeColumns) {
FieldChangeMeta fieldChangeMeta = new FieldChangeMeta();
fieldChangeMeta.setChangeId(projectContraptionChangeDataDto.getProjectContraptionId());
fieldChangeMeta.setColumnKey("record");
fieldChangeMeta.setColumnLabel("管道新增");
fieldChangeMeta.setColumnType("String");
fieldChangeMeta.setFieldDisplayDefine(null);
fieldChangeMeta.setColumnFamily("pie_line_create");
fieldChangeMeta.setColumnNewValue(record);
fieldChangeMeta.setDisplayNewValue(record);
fieldChangeMeta.setColumnOldValue(null);
fieldChangeMeta.setDisplayOldValue(null);
allChangeColumns.add(fieldChangeMeta);
}
void newPieLine(String projectContraptionId, PipelineChangeItemDto it, List<FieldChangeMeta> allChangeColumns, String applyNo) {
// todo 创建管道的设备几张表
// todo 创建道的es
// todo 构建变更流水 beforeData = null
private String getRegCode() {
return commonEquipDataProcessService.getJgRegisterInfoService().getRegCode();
}
}
......@@ -37,7 +37,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
IdxBizJgUseInfo useInfoNew = BeanUtil.copyProperties(useInfoOld, IdxBizJgUseInfo.class);
CommonEquipDataProcessService.castMap2Bean(changeJson, useInfoNew);
useInfoNew.setSequenceNbr(useInfoOld.getSequenceNbr());
this.setNameByCode2UseInfo(useInfoNew);
commonEquipDataProcessService.setNameByCode2UseInfo(useInfoNew);
IdxBizJgRegisterInfo registerInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgRegisterInfoService().getOne(new LambdaQueryWrapper<IdxBizJgRegisterInfo>().eq(IdxBizJgRegisterInfo::getRecord, record));
IdxBizJgRegisterInfo registerInfoNew = BeanUtil.copyProperties(registerInfoOld, IdxBizJgRegisterInfo.class);
......@@ -140,46 +140,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
}
}
private void setNameByCode2UseInfo(IdxBizJgUseInfo useInfoNew) {
// 1.使用地点name冗余
// 市
List<LinkedHashMap> city = (List<LinkedHashMap>) commonEquipDataProcessService.getRedisUtils().get("CITY");
// 区
List<LinkedHashMap> region = (List<LinkedHashMap>) commonEquipDataProcessService.getRedisUtils().get("REGION");
// 街道
List<LinkedHashMap> street = (List<LinkedHashMap>) commonEquipDataProcessService.getRedisUtils().get("STREET");
// 城市
if (StringUtils.isNotEmpty(useInfoNew.getCity()) && !ObjectUtils.isEmpty(city)) {
city.forEach(item -> {
if (String.valueOf(item.get("regionCode")).equals(useInfoNew.getCity())) {
useInfoNew.setCityName(String.valueOf(item.get("regionName")));
}
});
}
// 区县
if (StringUtils.isNotEmpty(useInfoNew.getCounty()) && !ObjectUtils.isEmpty(region)) {
region.forEach(item -> {
if (String.valueOf(item.get("regionCode")).equals(useInfoNew.getCounty())) {
useInfoNew.setCountyName(String.valueOf(item.get("regionName")));
}
});
}
// 街道
if (StringUtils.isNotEmpty(useInfoNew.getFactoryUseSiteStreet()) && !ObjectUtils.isEmpty(street)) {
street.forEach(item -> {
if (String.valueOf(item.get("regionCode")).equals(useInfoNew.getFactoryUseSiteStreet())) {
useInfoNew.setStreetName(String.valueOf(item.get("regionName")));
}
});
}
// 2.产权单位名称冗余
// 产权单位信息
if (StringUtils.isNotEmpty(useInfoNew.getEstateUnitCreditCode())) {
CompanyBo companyBo = commonEquipDataProcessService.getCommonMapper().queryCompanyByCode(useInfoNew.getEstateUnitCreditCode());
Optional.ofNullable(companyBo).ifPresent(item -> useInfoNew.setEstateUnitName(companyBo.getCompanyName()));
}
}
private void beforeCheckForUseOrgCode(IdxBizJgUseInfo useInfoOld, IdxBizJgRegisterInfo registerInfoNew) {
// 1.使用登记证编辑时重复性校验
......
......@@ -4,14 +4,14 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
import com.yeejoin.amos.boot.module.jg.api.dto.PipelineChangeItemDto;
import com.yeejoin.amos.boot.module.jg.api.dto.ProjectContraptionChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.TechParamsPipelineChangeFieldDto;
import com.yeejoin.amos.boot.module.jg.api.dto.RequestChangeData;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgConstructionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -58,13 +58,19 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
items.forEach(item -> {
String record = item.getRecord();
if (record == null) { // 新增的管道逻辑
pieLineDataChangeService.newPieLine(projectContraptionChangeDataDto.getProjectContraptionId(), item, allChangeColumns, projectContraptionId);
} else { // 更新逻辑
pieLineDataChangeService.newPieLine(projectContraptionChangeDataDto, item, allChangeColumns);
} else { // 更新管道逻辑
// 基本信息
this.updateUseInfo(item, projectContraptionChangeDataDto, allChangeColumns);
// 安装信息
this.updateConstructionInfo(item, projectContraptionChangeDataDto, allChangeColumns);
// 检验信息
this.updateInspectInfo(item, projectContraptionChangeDataDto, allChangeColumns);
// 设计信息更新
pieLineDataChangeService.saveDesignForPieLine(record, allChangeColumns, item);
// 技术参数入库保存
TechParamsPipelineChangeFieldDto paramsPipelineChangeFieldDto = new TechParamsPipelineChangeFieldDto();
BeanUtil.copyProperties(item, paramsPipelineChangeFieldDto, false);
BeanUtil.copyProperties(item, paramsPipelineChangeFieldDto, true);
commonEquipDataProcessService.savePieLineTechParam(record, allChangeColumns, paramsPipelineChangeFieldDto);
}
});
......@@ -73,6 +79,62 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
return allChangeColumns;
}
private void updateInspectInfo(PipelineChangeItemDto item, ProjectContraptionChangeDataDto projectContraptionChangeDataDto, List<FieldChangeMeta> allChangeColumns) {
String jySeq = item.getJySeq();
if (jySeq != null) {
IdxBizJgInspectionDetectionInfo inspectionDetectionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getInspectionDetectionInfoService().getById(jySeq);
IdxBizJgInspectionDetectionInfo inspectionDetectionInfoNew = new IdxBizJgInspectionDetectionInfo();
BeanUtil.copyProperties(inspectionDetectionInfoOld, inspectionDetectionInfoNew, true);
BeanUtil.copyProperties(item, inspectionDetectionInfoNew, true);
inspectionDetectionInfoNew.setSequenceNbr(inspectionDetectionInfoOld.getSequenceNbr());
List<FieldChangeMeta> inspectionFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getInspectionDetectionInfoService().getBaseMapper(), inspectionDetectionInfoOld, inspectionDetectionInfoNew, projectContraptionChangeDataDto.getProjectContraptionId() + "/" + item.getRecord(), "SEQUENCE_NBR", inspectionDetectionInfoOld.getSequenceNbr());
allChangeColumns.addAll(inspectionFieldChangeMetas);
commonEquipDataProcessService.updateEsDataOfEquip(item.getRecord(), inspectionDetectionInfoNew);
}
}
private void updateConstructionInfo(PipelineChangeItemDto item, ProjectContraptionChangeDataDto projectContraptionChangeDataDto, List<FieldChangeMeta> allChangeColumns) {
String constructionInfoSeq = item.getConstructionInfoSeq();
if (constructionInfoSeq != null) {
IdxBizJgConstructionInfo constructionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgConstructionInfoService().getById(constructionInfoSeq);
IdxBizJgConstructionInfo constructionInfoNew = new IdxBizJgConstructionInfo();
BeanUtil.copyProperties(constructionInfoOld, constructionInfoNew, true);
BeanUtil.copyProperties(item, constructionInfoNew, true);
constructionInfoNew.setSequenceNbr(constructionInfoOld.getSequenceNbr());
List<FieldChangeMeta> constructionInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgConstructionInfoService().getBaseMapper(), constructionInfoOld, constructionInfoNew, projectContraptionChangeDataDto.getProjectContraptionId() + "/" + item.getRecord(), "SEQUENCE_NBR", constructionInfoOld.getSequenceNbr());
allChangeColumns.addAll(constructionInfoFieldChangeMetas);
}
}
private void updateUseInfo(PipelineChangeItemDto updatePieLine, ProjectContraptionChangeDataDto projectContraptionChangeDataDto, List<FieldChangeMeta> allChangeColumns) {
IdxBizJgUseInfo useInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getUseInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgUseInfo>().eq(IdxBizJgUseInfo::getRecord, updatePieLine.getRecord()));
IdxBizJgUseInfo useInfoNew = new IdxBizJgUseInfo();
BeanUtil.copyProperties(useInfoOld, useInfoNew, true);
BeanUtil.copyProperties(updatePieLine, useInfoNew, true);
useInfoNew.setSequenceNbr(useInfoOld.getSequenceNbr());
setNewUseAddressInfo(projectContraptionChangeDataDto, useInfoNew);
// 冗余的字典名称字段更新
commonEquipDataProcessService.setNameByCode2UseInfo(useInfoNew);
List<FieldChangeMeta> useInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getUseInfoMapper(), useInfoOld, useInfoNew, projectContraptionChangeDataDto.getProjectContraptionId() + "/" + useInfoNew.getRecord(), "record", useInfoNew.getRecord());
allChangeColumns.addAll(useInfoFieldChangeMetas);
}
static void setNewUseAddressInfo(ProjectContraptionChangeDataDto projectContraptionChangeDataDto, IdxBizJgUseInfo useInfoNew) {
useInfoNew.setUseUnitCreditCode(projectContraptionChangeDataDto.getUseUnitCreditCode());
useInfoNew.setUseUnitName(projectContraptionChangeDataDto.getUseUnitName());
useInfoNew.setProjectContraption(projectContraptionChangeDataDto.getProjectContraption());
useInfoNew.setProjectContraptionId(projectContraptionChangeDataDto.getProjectContraptionId());
useInfoNew.setProvince(projectContraptionChangeDataDto.getProvince());
useInfoNew.setProvinceName(projectContraptionChangeDataDto.getProvinceName());
useInfoNew.setCity(projectContraptionChangeDataDto.getCity());
useInfoNew.setCityName(projectContraptionChangeDataDto.getCityName());
useInfoNew.setCounty(projectContraptionChangeDataDto.getCounty());
useInfoNew.setCountyName(projectContraptionChangeDataDto.getCountyName());
useInfoNew.setFactoryUseSiteStreet(projectContraptionChangeDataDto.getStreet());
useInfoNew.setStreetName(projectContraptionChangeDataDto.getStreetName());
useInfoNew.setAddress(projectContraptionChangeDataDto.getAddress());
}
private void setNameForDictKey(ProjectContraptionChangeDataDto projectContraptionChangeDataDto) {
// 1.使用地点name冗余
// 市
......
......@@ -22,9 +22,9 @@ public class EquipCategoryTypeHandler implements TypeHandler<String> {
@Override
public String handle(String code) {
return CODE_NAME_MAP.computeIfAbsent(code, (k) -> {
return code != null ? CODE_NAME_MAP.computeIfAbsent(code, (k) -> {
EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode, code).select(EquipmentCategory::getName, EquipmentCategory::getId));
return equipmentCategory == null ? "" : equipmentCategory.getName();
});
}) : null;
}
}
......@@ -20,6 +20,7 @@ public class EstateUnitTypeHandler implements TypeHandler<String> {
@Override
public String handle(String unitCreditCode) {
return CODE_NAME_MAP.computeIfAbsent(unitCreditCode, (k) -> commonMapper.queryUnitNameByCreditCode(unitCreditCode));
return unitCreditCode != null ? CODE_NAME_MAP.computeIfAbsent(unitCreditCode,
(k) -> commonMapper.queryUnitNameByCreditCode(unitCreditCode)) : null;
}
}
......@@ -22,13 +22,13 @@ public class RegionCodeTypeHandler implements TypeHandler<String> {
@Override
public String handle(String regionCode) {
return CODE_NAME_MAP.computeIfAbsent(regionCode, (k) -> {
return regionCode != null ? CODE_NAME_MAP.computeIfAbsent(regionCode, (k) -> {
List<LinkedHashMap> list1 = (List<LinkedHashMap>) redisUtils.get(CommonServiceImpl.PROVINCE);
List<LinkedHashMap> list2 = (List<LinkedHashMap>) redisUtils.get(CommonServiceImpl.CITY);
List<LinkedHashMap> list3 = (List<LinkedHashMap>) redisUtils.get(CommonServiceImpl.REGION);
List<LinkedHashMap> list4 = (List<LinkedHashMap>) redisUtils.get(CommonServiceImpl.STREET);
Optional<LinkedHashMap> op = Stream.of(list1, list2, list3, list4).flatMap(Collection::stream).filter(item -> String.valueOf(item.get("regionCode")).trim().equals(regionCode)).findFirst();
return op.map(linkedHashMap -> linkedHashMap.get("regionName").toString()).orElse(null);
});
}) : null;
}
}
......@@ -77,6 +77,7 @@ public class IdxBizJgInspectionDetectionInfo extends TzsBaseEntity implements IB
*
*/
@TableField("\"INSPECT_STAFF\"")
@FieldDisplayDefine(value ="检验人员")
private String inspectStaff;
/**
......
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