Commit 562774c8 authored by Lambertliu's avatar Lambertliu

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 9de3f67b e1e78244
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
public class DictParamsConverter implements Converter<String> { public class DictParamsConverter implements Converter<String> {
private static final Map<String, String> dictMap = new HashMap<>(); public static final Map<String, String> dictMap = new HashMap<>();
static { static {
// 填充映射关系 // 填充映射关系
......
...@@ -45,7 +45,6 @@ public class EquCategoryConverter implements Converter<String> { ...@@ -45,7 +45,6 @@ public class EquCategoryConverter implements Converter<String> {
equipmentMap.put("碰碰车类", "6A00"); equipmentMap.put("碰碰车类", "6A00");
equipmentMap.put("滑道类", "6B00"); equipmentMap.put("滑道类", "6B00");
equipmentMap.put("无动力游乐设施", "6E00"); equipmentMap.put("无动力游乐设施", "6E00");
equipmentMap.put("工业管道", "8300");
equipmentMap.put("客运架空索道", "9100"); equipmentMap.put("客运架空索道", "9100");
equipmentMap.put("客运缆车", "9200"); equipmentMap.put("客运缆车", "9200");
equipmentMap.put("客运拖牵索道", "9300"); equipmentMap.put("客运拖牵索道", "9300");
...@@ -54,6 +53,9 @@ public class EquCategoryConverter implements Converter<String> { ...@@ -54,6 +53,9 @@ public class EquCategoryConverter implements Converter<String> {
equipmentMap.put("液压驱动电梯", "3200"); equipmentMap.put("液压驱动电梯", "3200");
equipmentMap.put("自动扶梯与自动人行道", "3300"); equipmentMap.put("自动扶梯与自动人行道", "3300");
equipmentMap.put("其它类型电梯", "3400"); equipmentMap.put("其它类型电梯", "3400");
equipmentMap.put("长输管道", "8100");
equipmentMap.put("公用管道", "8200");
equipmentMap.put("工业管道", "8300");
} }
@Override @Override
......
...@@ -63,9 +63,6 @@ public class EquDefineConverter implements Converter<String> { ...@@ -63,9 +63,6 @@ public class EquDefineConverter implements Converter<String> {
equipmentMap.put("滑索系列", "6E20"); equipmentMap.put("滑索系列", "6E20");
equipmentMap.put("空中飞人系列", "6E30"); equipmentMap.put("空中飞人系列", "6E30");
equipmentMap.put("系留式观光气球系列", "6E40"); equipmentMap.put("系留式观光气球系列", "6E40");
equipmentMap.put("工艺管道", "8310");
equipmentMap.put("动力管道", "8320");
equipmentMap.put("制冷管道", "8330");
equipmentMap.put("往复式客运架空索道", "9110"); equipmentMap.put("往复式客运架空索道", "9110");
equipmentMap.put("循环式客运架空索道", "9120"); equipmentMap.put("循环式客运架空索道", "9120");
equipmentMap.put("往复式客运缆车", "9210"); equipmentMap.put("往复式客运缆车", "9210");
...@@ -83,6 +80,13 @@ public class EquDefineConverter implements Converter<String> { ...@@ -83,6 +80,13 @@ public class EquDefineConverter implements Converter<String> {
equipmentMap.put("防爆电梯", "3410"); equipmentMap.put("防爆电梯", "3410");
equipmentMap.put("消防员电梯", "3420"); equipmentMap.put("消防员电梯", "3420");
equipmentMap.put("杂物电梯", "3430"); equipmentMap.put("杂物电梯", "3430");
equipmentMap.put("输油管道", "8110");
equipmentMap.put("输气管道", "8120");
equipmentMap.put("燃气管道", "8210");
equipmentMap.put("热力管道", "8220");
equipmentMap.put("工艺管道", "8310");
equipmentMap.put("动力管道", "8320");
equipmentMap.put("制冷管道", "8330");
} }
@Override @Override
......
package com.yeejoin.amos.boot.module.jg.api.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class EquipRequestParamsDto {
private String companyCode;
private String companyName;
private String companyAddress;
private String execUserId;
private String execUserName;
private String equListCode;
private String equListName;
private String equCategoryCode;
private String equCategoryName;
private String equDefineCode;
private String equDefineName;
private String dataSource;
private String orgBranchCode;
private String orgBranchName;
private String useOrgCode;
private String vehicleApanage;
private String receiveOrgCode;
private String receiveOrgName;
private String projectContraptionSeq;
private String projectContraption;
private String projectContraptionNo;
private String productPhoto;
private String productQualificationCertificate;
private String otherAccessories;
private double pipelineLength;
private String equCode;
private String inspectUnitCreditCode;
private String inspectUnitName;
}
\ No newline at end of file
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
public class InspectConclusionConverter implements Converter<String> { public class InspectConclusionConverter implements Converter<String> {
private static final Map<String, String> dictMap = new HashMap<>(); public static final Map<String, String> dictMap = new HashMap<>();
static { static {
// 填充映射关系 // 填充映射关系
......
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
public class InspectTypeConverter implements Converter<String> { public class InspectTypeConverter implements Converter<String> {
private static final Map<String, String> dictMap = new HashMap<>(); public static final Map<String, String> dictMap = new HashMap<>();
static { static {
// 填充映射关系 // 填充映射关系
......
...@@ -88,21 +88,21 @@ public class PipingExcelDto extends BaseDto { ...@@ -88,21 +88,21 @@ public class PipingExcelDto extends BaseDto {
@ApiModelProperty(value = "安装单位统一社会信用代码") @ApiModelProperty(value = "安装单位统一社会信用代码")
@ExcelProperty(value = "安装单位统一社会信用代码") @ExcelProperty(value = "安装单位统一社会信用代码")
private String installUnitCode; private String uscUnitCreditCode;
@ApiModelProperty(value = "安装单位名称") @ApiModelProperty(value = "安装单位名称")
@ExcelProperty(value = "安装单位名称") @ExcelProperty(value = "安装单位名称")
private String installUnitName; private String uscUnitName;
//-----------------------------------------------------------------------检验检测信息 //-----------------------------------------------------------------------检验检测信息
@ApiModelProperty(value = "检验检测机构统一社会信用代码") @ApiModelProperty(value = "检验检测机构统一社会信用代码")
@ExcelProperty(value = "检验检测机构统一社会信用代码") @ExcelProperty(value = "检验检测机构统一社会信用代码")
private String inspectUnitCode; private String inspectOrgCode;
@ApiModelProperty(value = "检验检测机构名称") @ApiModelProperty(value = "检验检测机构名称")
@ExcelProperty(value = "检验检测机构名称") @ExcelProperty(value = "检验检测机构名称")
private String inspectUnitName; private String inspectOrgName;
@ApiModelProperty(value = "检验结论") @ApiModelProperty(value = "检验结论")
@ExcelProperty(value = "检验结论") @ExcelProperty(value = "检验结论")
...@@ -118,7 +118,7 @@ public class PipingExcelDto extends BaseDto { ...@@ -118,7 +118,7 @@ public class PipingExcelDto extends BaseDto {
@ApiModelProperty(value = "检验人员名称") @ApiModelProperty(value = "检验人员名称")
@ExcelProperty(value = "检验人员名称") @ExcelProperty(value = "检验人员名称")
private String inspectPersonName; private String inspectStaff;
@ApiModelProperty(value = "下次检验日期") @ApiModelProperty(value = "下次检验日期")
@ExcelProperty(value = "下次检验日期") @ExcelProperty(value = "下次检验日期")
...@@ -126,7 +126,7 @@ public class PipingExcelDto extends BaseDto { ...@@ -126,7 +126,7 @@ public class PipingExcelDto extends BaseDto {
@ApiModelProperty(value = "检验报告编号") @ApiModelProperty(value = "检验报告编号")
@ExcelProperty(value = "检验报告编号") @ExcelProperty(value = "检验报告编号")
private String inspectReportCode; private String inspectReportNo;
//-----------------------------------------------------------------------设计信息 //-----------------------------------------------------------------------设计信息
......
...@@ -4,8 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill; ...@@ -4,8 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data; import lombok.*;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Date; import java.util.Date;
...@@ -19,6 +18,9 @@ import java.util.Date; ...@@ -19,6 +18,9 @@ import java.util.Date;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_registration_history") @TableName("tzs_jg_registration_history")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class JgRegistrationHistory extends BaseEntity { public class JgRegistrationHistory extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader; import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.context.AnalysisContext;
...@@ -17,17 +19,25 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -17,17 +19,25 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil; 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.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.converter.DictParamsConverter;
import com.yeejoin.amos.boot.module.jg.api.converter.EquCategoryConverter; import com.yeejoin.amos.boot.module.jg.api.converter.EquCategoryConverter;
import com.yeejoin.amos.boot.module.jg.api.converter.EquDefineConverter; import com.yeejoin.amos.boot.module.jg.api.converter.EquDefineConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipInfoExcelDto; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.dto.PipingExcelDto; import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
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.*; import com.yeejoin.amos.boot.module.jg.biz.service.*;
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.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import io.seata.spring.annotation.GlobalTransactional; import io.seata.spring.annotation.GlobalTransactional;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -42,6 +52,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -42,6 +52,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
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 org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.InputStream; import java.io.InputStream;
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -71,16 +82,21 @@ public class DataDockServiceImpl { ...@@ -71,16 +82,21 @@ public class DataDockServiceImpl {
private final IIdxBizJgTechParamsBoilerService iIdxBizJgTechParamsBoilerService; private final IIdxBizJgTechParamsBoilerService iIdxBizJgTechParamsBoilerService;
private final IIdxBizJgTechParamsVesselService iIdxBizJgTechParamsVesselService; private final IIdxBizJgTechParamsVesselService iIdxBizJgTechParamsVesselService;
private final IIdxBizJgTechParamsPipelineService iIdxBizJgTechParamsPipelineService; private final IIdxBizJgTechParamsPipelineService iIdxBizJgTechParamsPipelineService;
private final IdxBizJgInspectionDetectionInfoServiceImpl idxBizJgInspectionDetectionInfoService;
private final IIdxBizJgTechParamsRidesService iIdxBizJgTechParamsRidesService; private final IIdxBizJgTechParamsRidesService iIdxBizJgTechParamsRidesService;
private final IIdxBizJgTechParamsRopewayService iIdxBizJgTechParamsRopewayService; private final IIdxBizJgTechParamsRopewayService iIdxBizJgTechParamsRopewayService;
private final IIdxBizJgTechParamsElevatorService iIdxBizJgTechParamsElevatorService; private final IIdxBizJgTechParamsElevatorService iIdxBizJgTechParamsElevatorService;
private final IdxBizJgProjectContraptionServiceImpl idxBizJgProjectContraptionServiceImpl; private final IdxBizJgProjectContraptionServiceImpl idxBizJgProjectContraptionServiceImpl;
private final IdxBizJgConstructionInfoServiceImpl idxBizJgConstructionInfoService; private final IdxBizJgConstructionInfoServiceImpl idxBizJgConstructionInfoService;
private final JgInstallationNoticeServiceImpl installationNoticeService;
private final TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper; private final TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
private final JgUseRegistrationManageServiceImpl jgUseRegistrationManageService;
private final RedisUtils redisUtils; private final RedisUtils redisUtils;
private final JgUseRegistrationServiceImpl jgUseRegistrationServiceImpl;
private final JgUseRegistrationEqServiceImpl jgUseRegistrationEqServiceImpl;
private final TzsServiceFeignClient tzsServiceFeignClient; private final TzsServiceFeignClient tzsServiceFeignClient;
;
private final CommonServiceImpl commonService; private final CommonServiceImpl commonService;
private final JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
private final Map<String, Object> resultError = new HashMap<>(); private final Map<String, Object> resultError = new HashMap<>();
List<String> useInnerCodeList = new ArrayList<>();// 单位内部编号集合 List<String> useInnerCodeList = new ArrayList<>();// 单位内部编号集合
...@@ -1314,11 +1330,12 @@ public class DataDockServiceImpl { ...@@ -1314,11 +1330,12 @@ public class DataDockServiceImpl {
public Object checkGDData(MultipartFile multipartFile, Boolean isGYGD) throws Exception { public Object checkGDData(MultipartFile multipartFile, Boolean isGYGD) throws Exception {
List<PipingExcelDto> dataList = new ArrayList<>(); List<PipingExcelDto> dataList = new ArrayList<>();
List<String> resultGDError = new ArrayList<>(); List<String> resultGDError = new ArrayList<>();
List<String> pipelineNumList = new ArrayList<>();
try { try {
EasyExcel.read(multipartFile.getInputStream(), PipingExcelDto.class, new AnalysisEventListener<PipingExcelDto>() { EasyExcel.read(multipartFile.getInputStream(), PipingExcelDto.class, new AnalysisEventListener<PipingExcelDto>() {
@Override @Override
public void invoke(PipingExcelDto data, AnalysisContext context) { public void invoke(PipingExcelDto data, AnalysisContext context) {
resultGDError.add(checkGDExcelData(data, context, isGYGD).toString()); resultGDError.add(checkGDExcelData(data, context, isGYGD, pipelineNumList).toString());
dataList.add(data); dataList.add(data);
} }
...@@ -1342,7 +1359,7 @@ public class DataDockServiceImpl { ...@@ -1342,7 +1359,7 @@ public class DataDockServiceImpl {
} }
} }
public StringBuffer checkGDExcelData(PipingExcelDto data, AnalysisContext context, Boolean isGYGD) { public StringBuffer checkGDExcelData(PipingExcelDto data, AnalysisContext context, Boolean isGYGD, List<String> pipelineNumList) {
StringBuffer rowError = new StringBuffer(); StringBuffer rowError = new StringBuffer();
ReadRowHolder readRowHolder = context.readRowHolder(); ReadRowHolder readRowHolder = context.readRowHolder();
...@@ -1350,71 +1367,41 @@ public class DataDockServiceImpl { ...@@ -1350,71 +1367,41 @@ public class DataDockServiceImpl {
try { try {
log.info("解析第{}行数据:{}", rowIndex, JSON.toJSONString(data)); log.info("解析第{}行数据:{}", rowIndex, JSON.toJSONString(data));
checkNotBlank(data.getPipeName(), "管道名称不能为空;", rowError); checkNotBlank(data.getPipeName(), "管道名称不能为空;", rowError);
// 同一工程装置下管道编号不能重复
if (!ValidationUtil.isEmpty(data.getProjectContraption())) {
// 使用单位Code
String useUnitCode = String.valueOf(data.getUseUnitCode()).trim();
// 使用单位名称
String useUnit = String.valueOf(data.getUseUnit()).trim();
// 工程装置名称
String proConName = data.getProjectContraption().trim();
// 查询该企业下工程装置名称
IdxBizJgProjectContraption oldContraption = idxBizJgProjectContraptionService.lambdaQuery()
.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, useUnitCode)
.eq(IdxBizJgProjectContraption::getUseUnitName, useUnit)
.eq(IdxBizJgProjectContraption::getProjectContraption, proConName)
.list().stream().findFirst().orElse(null);
Optional.ofNullable(oldContraption).ifPresent(old -> {
List<String> pipelineNumberList = idxBizJgProjectContraptionServiceImpl.getBaseMapper()
.selectEquipList(String.valueOf(old.getSequenceNbr()))
.stream()
.map(item -> (String) item.get("pipelineNumber"))
.collect(Collectors.toList());
if (pipelineNumberList.contains(data.getPipelineNumber())) {
rowError.append(String.format("系统中工程装置(%s)下已经存在管道编号(%s);", data.getProjectContraption(), data.getPipelineNumber()));
}
});
List<String> list = projectContraptionMap.get(data.getProjectContraption());
if (null != list) {
// 判断该装置下是否已经存在该管道编号
if (list.contains(data.getPipelineNumber())) {
rowError.append(String.format("同一工程装置(%s)下管道编号不能重复;", data.getProjectContraption()));
}
list.add(data.getPipelineNumber());
} else {
list = new ArrayList<>();
}
projectContraptionMap.put(data.getProjectContraption(), list);
}
checkNotBlank(data.getDesignUnitCreditCode(), "设计单位统一社会信用代码不能为空;", rowError); checkNotBlank(data.getDesignUnitCreditCode(), "设计单位统一社会信用代码不能为空;", rowError);
checkNotBlank(data.getDesignUnitName(), "设计单位名称不能为空;", rowError); checkNotBlank(data.getDesignUnitName(), "设计单位名称不能为空;", rowError);
checkNotBlank(data.getInspectUnitCode(), "检验检测机构统一社会信用代码不能为空;", rowError); checkNotBlank(data.getInspectOrgCode(), "检验检测机构统一社会信用代码不能为空;", rowError);
checkNotBlank(data.getInspectUnitName(), "检验检测机构名称不能为空;", rowError); checkNotBlank(data.getInspectOrgName(), "检验检测机构名称不能为空;", rowError);
checkNotBlank(data.getInspectConclusion(), "检验结论不能为空;", rowError); checkNotBlank(data.getInspectConclusion(), "检验结论不能为空;", rowError);
checkNotBlank(data.getInspectType(), "检验类型不能为空;", rowError); checkNotBlank(data.getInspectType(), "检验类型不能为空;", rowError);
checkNotBlank(data.getInspectDate(), "检验日期不能为空;", rowError); checkNotBlank(data.getInspectDate(), "检验日期不能为空;", rowError);
Optional.ofNullable(data.getInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "检验日期格式不正确;", rowError)); Optional.ofNullable(data.getInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "检验日期格式不正确;", rowError));
checkNotBlank(data.getInspectPersonName(), "检验人员名称不能为空;", rowError); checkNotBlank(data.getInspectStaff(), "检验人员名称不能为空;", rowError);
checkNotBlank(data.getNextInspectDate(), "下次检验日期不能为空;", rowError); checkNotBlank(data.getNextInspectDate(), "下次检验日期不能为空;", rowError);
Optional.ofNullable(data.getNextInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "下次检验日期格式不正确;", rowError)); Optional.ofNullable(data.getNextInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "下次检验日期格式不正确;", rowError));
checkNotBlank(data.getInspectReportCode(), "检验报告编号不能为空;", rowError); checkNotBlank(data.getInspectReportNo(), "检验报告编号不能为空;", rowError);
checkNotBlank(data.getInstallUnitCode(), "安装单位统一社会信用代码不能为空;", rowError); checkNotBlank(data.getUscUnitCreditCode(), "安装单位统一社会信用代码不能为空;", rowError);
checkNotBlank(data.getInstallUnitName(), "安装单位名称不能为空;", rowError); checkNotBlank(data.getUscUnitName(), "安装单位名称不能为空;", rowError);
// 技术参数 // 技术参数
checkNotBlank(data.getWallThickness(), "公称壁厚不能为空;", rowError); checkNotBlank(data.getWallThickness(), "公称壁厚不能为空;", rowError);
Optional.ofNullable(data.getWallThickness()).ifPresent(item -> checkPipeSpecifications(item, "公称壁厚请输入数字或者/分割的范围,如2/6", rowError)); Optional.ofNullable(data.getWallThickness()).ifPresent(item -> checkPipeSpecifications(item, "公称壁厚请输入数字或者/分割的范围,如2/6", rowError));
checkNotBlank(data.getNominalDiameter(), "公称直径不能为空;", rowError); checkNotBlank(data.getNominalDiameter(), "公称直径不能为空;", rowError);
Optional.ofNullable(data.getNominalDiameter()).ifPresent(item -> checkPipeSpecifications(item, "公称直径请输入数字或者/分割的范围,如2/6", rowError)); Optional.ofNullable(data.getNominalDiameter()).ifPresent(item -> checkPipeSpecifications(item, "公称直径请输入数字或者/分割的范围,如2/6", rowError));
checkNotBlank(data.getPipeLength(), "管道长度不能为空;", rowError); checkNotBlank(data.getPipeLength(), "管道长度不能为空;", rowError);
Optional.ofNullable(data.getPipeLength()).ifPresent(item -> checkDateFormatNumber(item, "管道长度必须为数字", rowError)); Optional.ofNullable(data.getPipeLength()).ifPresent(item -> checkDateFormatNumber(item, "管道长度必须为数字", rowError));
checkNotBlank(data.getPressure(), "设计-压力不能为空;", rowError); checkNotBlank(data.getPressure(), "设计-压力不能为空;", rowError);
checkNotBlank(data.getMedium(), "设计-介质不能为空;", rowError); checkNotBlank(data.getMedium(), "设计-介质不能为空;", rowError);
checkNotBlank(data.getTemperature(), "设计-温度不能为空;", rowError); checkNotBlank(data.getTemperature(), "设计-温度不能为空;", rowError);
checkNotBlank(data.getPipelineNumber(), "管道编号不能为空;", rowError); checkNotBlank(data.getPipelineNumber(), "管道编号不能为空;", rowError);
Optional.ofNullable(data.getPipelineNumber()).ifPresent(v -> {
if (pipelineNumList.contains(v)) {
rowError.append("管道编号不能重复");
} else {
pipelineNumList.add(v);
}
});
checkNotBlank(data.getDeviceLevel(), "管道级别不能为空;", rowError); checkNotBlank(data.getDeviceLevel(), "管道级别不能为空;", rowError);
// 工业管道校验使用信息 // 工业管道校验使用信息
if (isGYGD) { if (isGYGD) {
// todo // todo
...@@ -1448,174 +1435,184 @@ public class DataDockServiceImpl { ...@@ -1448,174 +1435,184 @@ public class DataDockServiceImpl {
@GlobalTransactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class)
public Object savePipingData(Map<String, Object> paramMap) { public Object savePipingData(Map<String, Object> paramMap) {
// 获取数据
JSONObject equipInfo = JSON.parseObject(toJSONString(paramMap.get("equipInfo")), JSONObject.class); JSONObject equipInfo = JSON.parseObject(toJSONString(paramMap.get("equipInfo")), JSONObject.class);
JSONObject attachmentUpload = JSON.parseObject(toJSONString(paramMap.get("attachmentUpload")), JSONObject.class); JSONObject attachmentUpload = JSON.parseObject(toJSONString(paramMap.get("attachmentUpload")), JSONObject.class);
List<PipingExcelDto> equLists = JSONArray.parseArray(toJSONString(attachmentUpload.get("equLists"))).toJavaList(PipingExcelDto.class); List<PipingExcelDto> equLists = JSONArray.parseArray(toJSONString(attachmentUpload.get("equLists"))).toJavaList(PipingExcelDto.class);
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
CompanyBo company = reginParams.getCompany();
// 监管——历史——管道——批量
String dataSource = "jg_his_gd_pl";
// 公共参数提取
EquipRequestParamsDto paramsDto = this.extractCommonData(dataSource, reginParams, equipInfo, equLists);
// 是否工业管道 // 是否工业管道
boolean isYLGD = "8300".equals(String.valueOf(equipInfo.get("EQU_CATEGORY"))); boolean isGYGD = "8300".equals(paramsDto.getEquCategoryCode());
if (isYLGD) {
this.saveIndustrialPipData(company, equipInfo, equLists); // 确保使用登记证和工程装置在该单位下都是不存在的,方可导入数据
} else { if (isGYGD) {
this.savePublicLongDistancePipData(company, equipInfo, equLists); this.checkTheUnitRegManageAlreadyExists(paramsDto);
}
this.checkTheUnitProConMatching(paramsDto);
this.checkTheUnitProConAlreadyExists(paramsDto);
// 生成工程装置表信息
IdxBizJgProjectContraption proCon = this.saveProjectContraption(paramsDto);
// 保存管道对应的idx表数据
List<String> records = this.savePipInfoToIdxTables(equLists, paramsDto, proCon);
if (isGYGD) {
// 生成使用登记表信息 + 设备关系表 + 历史表
JgUseRegistration useReg = this.saveUseRegAndEq(paramsDto, records, proCon);
// 生成使用登记证表数据
this.saveUseRegManage(paramsDto, useReg);
} }
return Boolean.TRUE; return Boolean.TRUE;
} }
/** /**
* 工业管道保存 * 检查本单位是否存在使用等级证编号
*
* @param paramsDto
*/
public void checkTheUnitRegManageAlreadyExists(EquipRequestParamsDto paramsDto) {
Integer useRegManageCount = jgUseRegistrationManageService.lambdaQuery().eq(JgUseRegistrationManage::getUseRegistrationCode, paramsDto.getCompanyCode()).eq(JgUseRegistrationManage::getUseUnitName, paramsDto.getCompanyName()).eq(JgUseRegistrationManage::getUseRegistrationCode, paramsDto.getUseOrgCode()).eq(JgUseRegistrationManage::getEquList, EquipmentClassifityEnum.getNameByCode(paramsDto.getEquListCode())).eq(JgUseRegistrationManage::getEquCategory, EquCategoryConverter.getKeyByValue(paramsDto.getEquCategoryCode())).count();
if (useRegManageCount > 0) {
throw new BadRequest("系统已存在该使用登记证编号!");
}
}
/**
* 公共参数提取
* *
* @param equipInfo * @param equipInfo
* @param equLists * @param equLists
* @return
*/ */
public void saveIndustrialPipData(CompanyBo company, JSONObject equipInfo, List<PipingExcelDto> equLists) { public EquipRequestParamsDto extractCommonData(String dataSource, ReginParams reginParams, JSONObject equipInfo, List<PipingExcelDto> equLists) {
String equList = String.valueOf(equipInfo.get("EQU_LIST")); AgencyUserModel userModel = reginParams.getUserModel();
String equCategory = String.valueOf(equipInfo.get("EQU_CATEGORY")); CompanyBo company = reginParams.getCompany();
String equDefine = String.valueOf(equipInfo.get("EQU_DEFINE")); String orgBranchCode = String.valueOf(equipInfo.get("orgBranchCode"));
String equListCode = String.valueOf(equipInfo.get("EQU_LIST"));
// 1. 校验是否第一次上传,限制同一个工程装置(同一编号同一名称)只能导一次 todo String equCategoryCode = String.valueOf(equipInfo.get("EQU_CATEGORY"));
// 2. 有使用登记证 - String equDefineCode = String.valueOf(equipInfo.get("EQU_DEFINE"));
// 2.1 匹配本单位使用登记证 匹配成功 系统存在改使用登记证 String receiveOrgCode = String.valueOf(equipInfo.get("RECEIVE_ORG_CODE"));
// 2.1.0 匹配本单位下的工程装置名称和工程装置编号不是一一对应的,抛出异常 String inspectUnitCreditCode = Optional.ofNullable(equLists.get(0).getInspectOrgCode()).orElse("");
// 2.1.1 匹配本单位下的工程装置(同一编号同一名称) (一一对应) 匹配成功 ===》(将设备挂到改装置下) String inspectUnitName = Optional.ofNullable(equLists.get(0).getInspectOrgName()).orElse("");
// 2.1.1 匹配本单位下的工程装置(同一编号同一名称) (一一对应) 匹配失败 ===》 生成新工程装置表数据 String useOrgCode = String.valueOf(equipInfo.get("USE_ORG_CODE"));
// 2.2 匹配本单位使用登记证 匹配失败 系统不存在改使用登记证 return new EquipRequestParamsDto().setCompanyCode(company.getCompanyCode().split("_")[0])
// 2.2.0 匹配本单位下的工程装置(同一编号同一名称) (一一对应) 匹配成功 抛出异常 .setCompanyName(company.getCompanyName())
// 2.2.1 生成使用登记证表数据 .setCompanyAddress(company.getAddress())
// 2.2.2 生成工程装置表信息 .setExecUserId(userModel.getUserId())
// 3. 更新管道对应的idx表数据 .setExecUserName(userModel.getUserName())
.setEquListCode(equListCode)
.setEquListName(EquipmentClassifityEnum.getNameByCode(equListCode))
.setEquCategoryCode(equCategoryCode)
.setEquCategoryName(EquCategoryConverter.getKeyByValue(equCategoryCode))
.setEquDefineCode(equDefineCode).setEquDefineName(EquDefineConverter.getKeyByValue(equDefineCode))
.setDataSource(dataSource)
.setOrgBranchCode(orgBranchCode.split("_").length > 1 ? orgBranchCode.split("_")[0] : "")
.setOrgBranchName(orgBranchCode.split("_").length > 1 ? orgBranchCode.split("_")[1] : "")
.setUseOrgCode(useOrgCode)
.setVehicleApanage(String.valueOf(equipInfo.get("VEHICLE_APANAGE")))
.setReceiveOrgCode(receiveOrgCode.split("_")[0])
.setReceiveOrgName(receiveOrgCode.split("_")[1])
.setProjectContraption(String.valueOf(equipInfo.get("PROJECT_CONTRAPTION")))
.setProjectContraptionNo(String.valueOf(equipInfo.get("PROJECT_CONTRAPTION_NO")))
.setProductPhoto(toJSONString(equipInfo.get("PRODUCT_PHOTO")))
.setProductQualificationCertificate(toJSONString(equipInfo.get("PRODUCT_QUALIFICATION_CERTIFICATE")))
.setOtherAccessories(toJSONString(equipInfo.get("OTHER_ACCESSORIES")))
.setPipelineLength(equLists.stream().mapToDouble(item -> Double.parseDouble(item.getPipeLength())).sum())
.setInspectUnitCreditCode(inspectUnitCreditCode)
.setInspectUnitName(inspectUnitName)
.setEquCode(installationNoticeService.generateEquCode(equListCode, equCategoryCode, equDefineCode, new Date(), receiveOrgCode));
} }
// 通用方法初始化 List /**
private <T> List<T> initializeList() { * 检查本单位是否已存在该工程装置
return new ArrayList<>(15); * 存在则抛出异常
*
* @param paramsDto
*/
public void checkTheUnitProConAlreadyExists(EquipRequestParamsDto paramsDto) {
Integer count = idxBizJgProjectContraptionService.lambdaQuery().select(IdxBizJgProjectContraption::getPipelineLength).eq(IdxBizJgProjectContraption::getUseUnitCreditCode, paramsDto.getCompanyCode()).eq(IdxBizJgProjectContraption::getUseUnitName, paramsDto.getCompanyName())
// 限制到设备类别
.eq(IdxBizJgProjectContraption::getEquCategory, paramsDto.getEquCategoryCode()).eq(IdxBizJgProjectContraption::getIsIntoManagement, Boolean.TRUE).eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE).eq(IdxBizJgProjectContraption::getProjectContraption, paramsDto.getProjectContraption()).eq(IdxBizJgProjectContraption::getProjectContraptionNo, paramsDto.getProjectContraptionNo()).count();
// 存在数据 名称和编号能一一对应,限制不让导入
if (count > 0) {
throw new BadRequest("系统已存在该工程装置!");
}
} }
/** /**
* 公用、长输管道保存 * 检查本单位下工程装置名称和工程装置编号是不是一一对应的
* 不对应抛出异常
* *
* @param equipInfo * @param paramsDto
* @param equLists
*/ */
public void savePublicLongDistancePipData(CompanyBo company, JSONObject equipInfo, List<PipingExcelDto> equLists) { private void checkTheUnitProConMatching(EquipRequestParamsDto paramsDto) {
String companyCode = company.getCompanyCode().split("_")[0]; Integer existsConflictNum = idxBizJgProjectContraptionService.lambdaQuery().eq(IdxBizJgProjectContraption::getUseUnitCreditCode, paramsDto.getCompanyCode()).eq(IdxBizJgProjectContraption::getUseUnitName, paramsDto.getCompanyName())
String companyName = company.getCompanyName();
String equList = String.valueOf(equipInfo.get("EQU_LIST"));
String equCategory = String.valueOf(equipInfo.get("EQU_CATEGORY"));
String equDefine = String.valueOf(equipInfo.get("EQU_DEFINE"));
// 设备来源
String dataSource = "jg_his";
// 属地监管部门
String orgBranchCode = String.valueOf(equipInfo.get("orgBranchCode"));
// 所属属地
String vehicleApanage = String.valueOf(equipInfo.get("VEHICLE_APANAGE"));
// 工程装置名称
String projectContraption = String.valueOf(equipInfo.get("PROJECT_CONTRAPTION"));
// 工程装置编号
String projectContraptionNo = String.valueOf(equipInfo.get("PROJECT_CONTRAPTION_NO"));
// 产品照片
String productPhoto = toJSONString(equipInfo.get("PRODUCT_PHOTO"));
// 产品质量合格证明
String productQualificationCertificate = toJSONString(equipInfo.get("PRODUCT_QUALIFICATION_CERTIFICATE"));
// 其他附件
String otherAccessories = toJSONString(equipInfo.get("OTHER_ACCESSORIES"));
// 汇总管道长度
double pipelineLength = equLists.stream().mapToDouble(item -> Double.parseDouble(item.getPipeLength())).sum();
// 1. 校验是否第一次上传,限制同一个工程装置(同一编号同一名称)只能导一次 todo
// 2. 工程装置名称和工程装置编号不是一一对应的,抛出异常
Integer existsConflictNum = idxBizJgProjectContraptionService.lambdaQuery()
.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, companyCode)
.eq(IdxBizJgProjectContraption::getUseUnitName, companyName)
.eq(IdxBizJgProjectContraption::getIsIntoManagement, Boolean.TRUE) .eq(IdxBizJgProjectContraption::getIsIntoManagement, Boolean.TRUE)
.eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE) .eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE)
.and(wrapper -> wrapper .and(wrapper -> wrapper.ne(IdxBizJgProjectContraption::getProjectContraptionNo, paramsDto.getProjectContraptionNo()).eq(IdxBizJgProjectContraption::getProjectContraption, paramsDto.getProjectContraption())
.ne(IdxBizJgProjectContraption::getProjectContraptionNo, projectContraptionNo) .or().eq(IdxBizJgProjectContraption::getProjectContraptionNo, paramsDto.getProjectContraptionNo()).ne(IdxBizJgProjectContraption::getProjectContraption, paramsDto.getProjectContraption())
.eq(IdxBizJgProjectContraption::getProjectContraption, projectContraption)
.or()
.eq(IdxBizJgProjectContraption::getProjectContraptionNo, projectContraptionNo)
.ne(IdxBizJgProjectContraption::getProjectContraption, projectContraption)
) )
.count(); .count();
if (existsConflictNum > 0) { if (existsConflictNum > 0) {
throw new BadRequest("工程装置名称或编号与本单位下的已存在的数据冲突!"); throw new BadRequest("工程装置名称或编号与本单位下的已存在的数据冲突!");
} }
}
/**
* 保存管道对应的idx表数据
*
* @param equLists
* @param paramsDto
*/
public List<String> savePipInfoToIdxTables(List<PipingExcelDto> equLists, EquipRequestParamsDto paramsDto, IdxBizJgProjectContraption proCon) {
List<String> recordList = new ArrayList<>();
List<IdxBizJgUseInfo> useInfoList = new ArrayList<>();
List<IdxBizJgDesignInfo> designInfoList = new ArrayList<>();
List<IdxBizJgFactoryInfo> factoryInfoList = new ArrayList<>();
List<IdxBizJgConstructionInfo> constructionInfoList = new ArrayList<>();
List<IdxBizJgRegisterInfo> registerInfoList = new ArrayList<>();
List<IdxBizJgSupervisionInfo> supervisionInfoList = new ArrayList<>();
List<IdxBizJgOtherInfo> otherInfoList = new ArrayList<>();
List<IdxBizJgTechParamsPipeline> paramsPipelineList = new ArrayList<>();
List<ESEquipmentCategoryDto> esEquipmentCategoryList = new ArrayList<>();
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = new ArrayList<>();
// 3. 无证 - 匹配本单位下的工程装置(同一编号同一名称)
List<IdxBizJgProjectContraption> projectContraptions = idxBizJgProjectContraptionService.lambdaQuery()
.select(IdxBizJgProjectContraption::getPipelineLength)
.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, companyCode)
.eq(IdxBizJgProjectContraption::getUseUnitName, companyName)
.eq(IdxBizJgProjectContraption::getEquCategory, equCategory)// 限制到设备类别
.eq(IdxBizJgProjectContraption::getIsIntoManagement, Boolean.TRUE)
.eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE)
.eq(IdxBizJgProjectContraption::getProjectContraption, projectContraption)
.eq(IdxBizJgProjectContraption::getProjectContraptionNo, projectContraptionNo)
.list();
// 3.1 匹配不到数据 生成一条工程装置表信息
if (projectContraptions.isEmpty()) {
IdxBizJgProjectContraption contraption = IdxBizJgProjectContraption.builder()
.projectContraption(projectContraption)
.projectContraptionNo(projectContraptionNo)
.useUnitCreditCode(companyCode)
.useUnitName(companyName)
// .uscUnitCreditCode().uscUnitName()
.equList(equList)
.equListName(EquipmentClassifityEnum.getNameByCode(equList))
.equCategory(equCategory)
.equCategoryName(EquCategoryConverter.getKeyByValue(equCategory))
.equDefine(equDefine)
.equDefineName(EquDefineConverter.getKeyByValue(equDefine))
.pipelineLength(pipelineLength)
.productPhoto(productPhoto)
.otherAccessories(otherAccessories)
.orgCode(orgBranchCode.split("_")[0])
.orgName(orgBranchCode.split("_")[1])
.productQualificationCertificate(productQualificationCertificate)
// .province().provinceName().city().cityName().county().countyName().street().streetName().address()
.supervisoryCode(idxBizJgRegisterInfoServiceImpl.getSupervisoryCode(vehicleApanage, equCategory))
.isIntoManagement(Boolean.TRUE)
.dataSource(dataSource)
// .equCode()
.isFirstMerge(Boolean.FALSE)
.build();
idxBizJgProjectContraptionService.save(contraption);
}
// 3.2 匹配到数据 名称和编号能一一对应,增补到改工程装置上
double oldPipLength = projectContraptions.stream().mapToDouble(item -> Double.parseDouble(String.valueOf(item.getPipelineLength()))).sum();
idxBizJgProjectContraptionService.lambdaUpdate()
.set(IdxBizJgProjectContraption::getPipelineLength, Double.sum(oldPipLength, pipelineLength))
.update();
// 4. 更新管道对应的idx表数据
List<IdxBizJgUseInfo> useInfoList = initializeList();
List<IdxBizJgDesignInfo> designInfoList = initializeList();
List<IdxBizJgFactoryInfo> factoryInfoList = initializeList();
List<IdxBizJgConstructionInfo> constructionInfoList = initializeList();
List<IdxBizJgRegisterInfo> registerInfoList = initializeList();
List<IdxBizJgSupervisionInfo> supervisionInfoList = initializeList();
List<IdxBizJgOtherInfo> otherInfoList = initializeList();
List<IdxBizJgTechParamsPipeline> paramsPipelineList = initializeList();
List<ESEquipmentCategoryDto> esEquipmentCategoryList = initializeList();
for (PipingExcelDto pipeline : equLists) { for (PipingExcelDto pipeline : equLists) {
String record = UUID.randomUUID().toString(); String record = UUID.randomUUID().toString();
recordList.add(record);
// 使用信息 // 使用信息
IdxBizJgUseInfo useInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgUseInfo.class); IdxBizJgUseInfo useInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgUseInfo.class);
// 使用信息
useInfo.setRecord(record); useInfo.setRecord(record);
useInfo.setSequenceNbr(null); useInfo.setSequenceNbr(null);
useInfo.setRecDate(new Date()); useInfo.setRecDate(new Date());
useInfo.setDataSource(dataSource); useInfo.setDataSource(paramsDto.getDataSource());
useInfo.setIsIntoManagement(Boolean.FALSE); useInfo.setIsIntoManagement(Boolean.TRUE);
useInfo.setUseUnitCreditCode(companyCode); useInfo.setUseUnitCreditCode(paramsDto.getCompanyCode());
useInfo.setUseUnitName(companyName); useInfo.setUseUnitName(paramsDto.getCompanyName());
useInfo.setProjectContraption(projectContraption); useInfo.setProjectContraption(paramsDto.getProjectContraption());
useInfo.setProjectContraptionId(projectContraptionNo); useInfo.setProjectContraptionId(paramsDto.getProjectContraptionSeq());
useInfoList.add(useInfo); useInfoList.add(useInfo);
// 检验检测信息
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgInspectionDetectionInfo.class);
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
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)));
}
// dictName -> dictCode
inspectionDetectionInfo.setInspectType(InspectTypeConverter.dictMap.get(inspectionDetectionInfo.getInspectType()));
inspectionDetectionInfo.setInspectConclusion(InspectConclusionConverter.dictMap.get(inspectionDetectionInfo.getInspectConclusion()));
inspectionDetectionInfoList.add(inspectionDetectionInfo);
}
// 设计信息 // 设计信息
IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgDesignInfo.class); IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgDesignInfo.class);
designInfo.setRecord(record); designInfo.setRecord(record);
...@@ -1640,11 +1637,17 @@ public class DataDockServiceImpl { ...@@ -1640,11 +1637,17 @@ public class DataDockServiceImpl {
// 注册登记信息 // 注册登记信息
IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgRegisterInfo.class); IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgRegisterInfo.class);
registerInfo.setRecord(record); registerInfo.setRecord(record);
registerInfo.setUseOrgCode(paramsDto.getUseOrgCode());
registerInfo.setRegisterState("6045");
registerInfo.setEquCode(paramsDto.getEquCode());
registerInfo.setEquList(paramsDto.getEquListCode());
registerInfo.setEquCategory(paramsDto.getEquCategoryCode());
registerInfo.setEquDefine(paramsDto.getEquDefineCode());
registerInfo.setRecDate(new Date()); registerInfo.setRecDate(new Date());
registerInfo.setSequenceNbr(null); registerInfo.setSequenceNbr(null);
registerInfo.setEquCodeType("2"); registerInfo.setEquCodeType("2");
// registerInfo.setRegisterState(this.getRegCode()); registerInfo.setRegisterState(idxBizJgRegisterInfoServiceImpl.getRegCode());
// registerInfo.setEquCode(); registerInfo.setEquCode(paramsDto.getEquCode());
// 监督管理 // 监督管理
IdxBizJgSupervisionInfo supervisionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgSupervisionInfo.class); IdxBizJgSupervisionInfo supervisionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgSupervisionInfo.class);
...@@ -1657,6 +1660,7 @@ public class DataDockServiceImpl { ...@@ -1657,6 +1660,7 @@ public class DataDockServiceImpl {
IdxBizJgOtherInfo otherInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgOtherInfo.class); IdxBizJgOtherInfo otherInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgOtherInfo.class);
otherInfo.setRecord(record); otherInfo.setRecord(record);
otherInfo.setSequenceNbr(null); otherInfo.setSequenceNbr(null);
otherInfo.setSupervisoryCode(proCon.getSupervisoryCode());
otherInfo.setClaimStatus("已认领"); otherInfo.setClaimStatus("已认领");
otherInfo.setRecDate(new Date()); otherInfo.setRecDate(new Date());
otherInfoList.add(otherInfo); otherInfoList.add(otherInfo);
...@@ -1667,35 +1671,35 @@ public class DataDockServiceImpl { ...@@ -1667,35 +1671,35 @@ public class DataDockServiceImpl {
pipelineInfo.setRecord(record); pipelineInfo.setRecord(record);
pipelineInfo.setRecDate(new Date()); pipelineInfo.setRecDate(new Date());
pipelineInfo.setSequenceNbr(null); pipelineInfo.setSequenceNbr(null);
// 字典name -》 字典code
pipelineInfo.setDeviceLevel(DictParamsConverter.dictMap.get(pipelineInfo.getDeviceLevel()));
paramsPipelineList.add(pipelineInfo); paramsPipelineList.add(pipelineInfo);
} }
registerInfo.setProductName(pipelineInfo.getPipeName()); registerInfo.setProductName(pipelineInfo.getPipeName());
registerInfoList.add(registerInfo); registerInfoList.add(registerInfo);
// ESEquipmentCategoryDto esEquipmentDto = JSON.parseObject(toJSONString(equipmentInfoForm), ESEquipmentCategoryDto.class); // es
// esEquipmentDto.setDATA_SOURCE(useInfo.getDataSource()); ESEquipmentCategoryDto esEquipmentDto = JSON.parseObject(toJSONString(pipeline), ESEquipmentCategoryDto.class);
// if (inspectionDetectionInfo.getNextInspectDate() != null) { esEquipmentDto.setDATA_SOURCE(paramsDto.getDataSource());
// esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime()); esEquipmentDto.setREC_DATE(System.currentTimeMillis());
// } esEquipmentDto.setSEQUENCE_NBR(record);
// esEquipmentDto.setREC_DATE(System.currentTimeMillis()); esEquipmentDto.setIS_INTO_MANAGEMENT(Boolean.TRUE);
// esEquipmentDto.setSEQUENCE_NBR(record); esEquipmentDto.setEQU_CATEGORY_CODE(paramsDto.getEquCategoryCode());
// esEquipmentDto.setIS_INTO_MANAGEMENT(false); esEquipmentDto.setEQU_CATEGORY(paramsDto.getEquCategoryName());
// esEquipmentDto.setEQU_CATEGORY_CODE(registerInfo.getEquCategory()); esEquipmentDto.setEQU_LIST_CODE(paramsDto.getEquListCode());
// esEquipmentDto.setEQU_CATEGORY(equCategoryName); esEquipmentDto.setEQU_LIST(paramsDto.getEquListName());
// esEquipmentDto.setEQU_LIST_CODE(registerInfo.getEquList()); esEquipmentDto.setEQU_DEFINE_CODE(paramsDto.getEquDefineCode());
// esEquipmentDto.setEQU_LIST(equListName); esEquipmentDto.setEQU_DEFINE(paramsDto.getEquDefineName());
// esEquipmentDto.setEQU_DEFINE_CODE(registerInfo.getEquDefine()); esEquipmentDto.setSTATUS("已认领");
// esEquipmentDto.setEQU_DEFINE(equListName); esEquipmentDto.setUSC_UNIT_CREDIT_CODE(pipeline.getUscUnitCreditCode());
// esEquipmentDto.setSTATUS("已认领"); esEquipmentDto.setUSC_UNIT_NAME(pipeline.getUscUnitName());
// esEquipmentDto.setUSC_UNIT_CREDIT_CODE(projectContraption.getUscUnitCreditCode()); esEquipmentDto.setPROJECT_CONTRAPTION(paramsDto.getProjectContraption());
// esEquipmentDto.setUSC_UNIT_NAME(projectContraption.getUscUnitName()); esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
// esEquipmentDto.setPROJECT_CONTRAPTION(projectContraption.getProjectContraption()); esEquipmentDto.setProjectContraptionId(paramsDto.getProjectContraptionSeq());
// esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName()); if (inspectionDetectionInfo.getNextInspectDate() != null) {
// esEquipmentDto.setProjectContraptionId(String.valueOf(sequenceNbr)); esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
// if (inspectionDetectionInfo.getNextInspectDate() != null) { }
// esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime()); esEquipmentCategoryList.add(esEquipmentDto);
// }
// esEquipmentCategoryList.add(esEquipmentDto);
} }
idxBizJgUseInfoService.saveBatch(useInfoList); idxBizJgUseInfoService.saveBatch(useInfoList);
idxBizJgDesignInfoService.saveBatch(designInfoList); idxBizJgDesignInfoService.saveBatch(designInfoList);
...@@ -1705,6 +1709,163 @@ public class DataDockServiceImpl { ...@@ -1705,6 +1709,163 @@ public class DataDockServiceImpl {
idxBizJgOtherInfoService.saveBatch(otherInfoList); idxBizJgOtherInfoService.saveBatch(otherInfoList);
idxBizJgSupervisionInfoService.saveBatch(supervisionInfoList); idxBizJgSupervisionInfoService.saveBatch(supervisionInfoList);
iIdxBizJgTechParamsPipelineService.saveBatch(paramsPipelineList); iIdxBizJgTechParamsPipelineService.saveBatch(paramsPipelineList);
idxBizJgInspectionDetectionInfoService.saveBatch(inspectionDetectionInfoList);
esEquipmentCategory.saveAll(esEquipmentCategoryList); esEquipmentCategory.saveAll(esEquipmentCategoryList);
return recordList;
}
/**
* 生成使用登记表信息 + 设备关系表 + 历史表
*
* @param paramsDto
*/
public JgUseRegistration saveUseRegAndEq(EquipRequestParamsDto paramsDto, List<String> records, IdxBizJgProjectContraption proCon) {
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.SYDJ.getCode(), 1);
String spplyNo = listResponseModel.getResult().get(0);
Long useRegseq = sequence.nextId();
JgUseRegistration useReg = new JgUseRegistration()
.setSupervisoryCode(proCon.getSupervisoryCode())
.setUseUnitCreditCode(paramsDto.getCompanyCode())
.setUseUnitName(paramsDto.getCompanyName())
.setApplyNo(spplyNo)
.setAuditStatus(FlowStatusEnum.TO_BE_FINISHED.getName())
.setStatus(FlowStatusEnum.TO_BE_FINISHED.getName())
.setReceiveOrgName(paramsDto.getReceiveOrgName())
.setInspectUnitCreditCode(paramsDto.getInspectUnitCreditCode())
.setInspectUnitName(paramsDto.getInspectUnitName())
.setAuditPassDate(new Date()).setRegType("1").setRegDate(new Date())
.setUseRegistrationCode(paramsDto.getUseOrgCode())
.setReceiveOrgCode(paramsDto.getReceiveOrgCode())
.setReceiveCompanyCode(paramsDto.getReceiveOrgCode())
// .setReceiveCompanyOrgCode()
.setReceiveOrgName(paramsDto.getReceiveOrgName())
.setUseAddress("")
.setManageType("unit")
.setCreateDate(new Date())
.setCreateUserId(paramsDto.getExecUserId())
.setCreateUserName(paramsDto.getExecUserName())
.setRegDate(new Date());
useReg.setSequenceNbr(useRegseq);
jgUseRegistrationServiceImpl.save(useReg);
records.forEach(record -> {
JgUseRegistrationEq useRegEq = new JgUseRegistrationEq();
useRegEq.setEquipTransferId(String.valueOf(useReg.getSequenceNbr()));
useRegEq.setRecDate(new Date());
useRegEq.setEquId(record);
useRegEq.setRecUserId(paramsDto.getExecUserId());
useRegEq.setRecUserName(paramsDto.getExecUserName());
jgUseRegistrationEqServiceImpl.save(useRegEq);
});
JSONObject changeData = getJgUseRegistrationChangeData(paramsDto, records, spplyNo);
JgRegistrationHistory registrationHistory = JgRegistrationHistory.builder()
.registrationClass("使用登记")
.changeData(JSON.toJSONString(changeData))
.status("history")
.currentDocumentId(String.valueOf(useRegseq))
.build();
registrationHistory.setRecDate(new Date());
registrationHistory.setCreateDate(new Date());
registrationHistory.setRecUserId(paramsDto.getExecUserId());
registrationHistory.setCreateUserId(paramsDto.getExecUserId());
registrationHistory.setRecUserName(paramsDto.getExecUserName());
jgRegistrationHistoryService.save(registrationHistory);
return useReg;
}
private JSONObject getJgUseRegistrationChangeData(EquipRequestParamsDto paramsDto, List<String> records, String spplyNo) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("receiveOrgCode", paramsDto.getReceiveOrgCode() + "_" + paramsDto.getReceiveOrgName());
jsonObject.put("status", FlowStatusEnum.TO_BE_FINISHED.getName());
jsonObject.put("applyNo", spplyNo);
jsonObject.remove("submit");
jsonObject.remove("instanceId");
if (!ObjectUtils.isEmpty(jsonObject.get("factoryUseSiteStreet"))) {
jsonObject.put("factoryUseSiteStreet", String.valueOf(Long.valueOf(jsonObject.get("factoryUseSiteStreet").toString())));
}
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionService.getById(paramsDto.getProjectContraptionSeq());
jsonObject.put("pipelineLength", projectContraption.getPipelineLength());
jsonObject.put("projectContraption", projectContraption.getProjectContraption());
jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
jsonObject.put("equipmentLists", jgUseRegistrationServiceImpl.getBaseMapper().queryForUnitPipelineEquipment(records));
jsonObject.put("useRegistrationCode", paramsDto.getUseOrgCode());
// 转化 附件 字段
this.convertStringToJsonObject(jsonObject, JgUseRegistrationServiceImpl.jsonFields);
return jsonObject;
}
/**
* 生成使用登记证管理表信息
*
* @param paramsDto
*/
public void saveUseRegManage(EquipRequestParamsDto paramsDto, JgUseRegistration useReg) {
Map<String, String> equType = new HashMap<>();
equType.put("equListCode", paramsDto.getEquCategoryCode());
equType.put("equCategoryCode", paramsDto.getEquDefineCode());
JgUseRegistrationManage registrationManage = JgUseRegistrationManage.builder()
.equListCode(paramsDto.getEquListCode())
.equList(paramsDto.getEquListName())
.equCategoryCode(paramsDto.getEquCategoryCode())
.equCategory(paramsDto.getEquCategoryName())
.equDefineCode(paramsDto.getEquDefineCode())
.equDefine(paramsDto.getEquDefineName())
.useUnitName(paramsDto.getCompanyName())
.useUnitCreditCode(paramsDto.getCompanyCode())
.applyNo(useReg.getApplyNo())
.receiveCompanyCode(paramsDto.getReceiveOrgCode())
.receiveOrgName(paramsDto.getReceiveOrgName())
.auditPassDate(new Date())
.useRegistrationCode(paramsDto.getUseOrgCode())
.certificateNo(commonService.generateCertificateNo(equType, new Date(), paramsDto.getReceiveOrgCode()))
.regType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName())
.certificateStatus("已登记")
.regDate(new Date())
// .equUseAddress()
.useUnitAddress(paramsDto.getCompanyAddress()).manageType("unit").isScrap("0").version(1).build();
jgUseRegistrationManageService.save(registrationManage);
}
/**
* 生成工程装置表信息
*
* @param paramsDto
*/
public IdxBizJgProjectContraption saveProjectContraption(EquipRequestParamsDto paramsDto) {
Long seq = sequence.nextId();
IdxBizJgProjectContraption contraption = IdxBizJgProjectContraption.builder().projectContraption(paramsDto.getProjectContraption()).projectContraptionNo(paramsDto.getProjectContraptionNo()).useUnitCreditCode(paramsDto.getCompanyCode()).useUnitName(paramsDto.getCompanyName())
// .uscUnitCreditCode().uscUnitName()
.equList(paramsDto.getEquListCode()).equListName(paramsDto.getEquListName()).equCategory(paramsDto.getEquCategoryCode()).equCategoryName(paramsDto.getEquCategoryName()).equDefine(paramsDto.getEquDefineCode()).equDefineName(paramsDto.getEquDefineName()).pipelineLength(paramsDto.getPipelineLength()).productPhoto(paramsDto.getProductPhoto()).otherAccessories(paramsDto.getOtherAccessories()).orgCode(paramsDto.getOrgBranchCode()).orgName(paramsDto.getOrgBranchName()).productQualificationCertificate(paramsDto.getProductQualificationCertificate())
// .province().provinceName().city().cityName().county().countyName().street().streetName().address()
.supervisoryCode(idxBizJgRegisterInfoServiceImpl.getSupervisoryCode(paramsDto.getVehicleApanage(), paramsDto.getEquCategoryCode())).isIntoManagement(Boolean.TRUE).dataSource(paramsDto.getDataSource()).equCode(paramsDto.getEquCode()).isFirstMerge(Boolean.FALSE).build();
contraption.setSequenceNbr(seq);
paramsDto.setProjectContraptionSeq(String.valueOf(seq));
idxBizJgProjectContraptionService.save(contraption);
return contraption;
}
public void convertStringToJsonObject(Object obj, String[] jsonFields) {
if (obj instanceof JSONObject) {
JSONObject jsonObject = (JSONObject) obj;
for (String field : jsonFields) {
if (jsonObject.get(field) != null && jsonObject.get(field) instanceof String) {
jsonObject.put(field, JSON.parse(JSONObject.toJSONString(jsonObject.get(field))));
}
}
} else if (obj instanceof Map) {
Map<String, Object> map = (Map<String, Object>) obj;
for (String field : jsonFields) {
if (map.containsKey(field) && map.get(field) instanceof String) {
map.put(field, JSON.parse(JSONObject.toJSONString(map.get(field))));
}
}
} else {
// 处理其他类型
System.out.println("Unsupported Object Type");
}
} }
} }
...@@ -2077,7 +2077,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -2077,7 +2077,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
createProjectConstruction2Db(jgInstallationNotice, projectContraption, deviceRegistrationCode, noticeRelationEquips); createProjectConstruction2Db(jgInstallationNotice, projectContraption, deviceRegistrationCode, noticeRelationEquips);
} }
private String generateEquCode(String equListCode, String equCategoryCode, String equDefineCode, Date now, String receiveCompanyCode) { public String generateEquCode(String equListCode, String equCategoryCode, String equDefineCode, Date now, String receiveCompanyCode) {
CodeGenerateDto codeGenerateDto = new CodeGenerateDto(); CodeGenerateDto codeGenerateDto = new CodeGenerateDto();
codeGenerateDto.setEquList(equListCode); codeGenerateDto.setEquList(equListCode);
codeGenerateDto.setEquCategory(equCategoryCode); codeGenerateDto.setEquCategory(equCategoryCode);
......
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