Commit bf6d7509 authored by 刘林's avatar 刘林

fix(jg):车用气瓶历史平台登记功能开发

parent 52aba08c
package com.yeejoin.amos.boot.module.jg.api.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @apiNote 设备基本情况
* @author LiuLin
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EquipmentInfoDto {
private String equListCode;
private String equCategoryCode;
private String equDefineCode;
private String equList;
private String equCategory;
private String equDefine;
private String dataSource;
private String useOrgCode;
private String receiveOrgCode;
private String receiveOrgName;
private String possession;
}
\ No newline at end of file
......@@ -48,7 +48,10 @@ public enum BusinessTypeEnum {
JG_VEHICLE_GAS_APPLICATION("118", "车用气瓶登记"),
JG_VEHICLE_GAS_CYLINDER_CHANGE("119", "车用气瓶变更登记");
JG_VEHICLE_GAS_CYLINDER_CHANGE("119", "车用气瓶变更登记"),
JG_HISTORY_USAGE_REGISTRATION("119", "历史设备登记");
private final String code;
private final String name;
......
......@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.Joiner;
......@@ -16,17 +17,22 @@ import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
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.CodeGenerateDto;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipInfoCylinderExcelDto;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.ConstructionEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipmentInfoDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgCertificateChangeRecord;
import com.yeejoin.amos.boot.module.jg.api.entity.JgCertificateChangeRecordEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.entity.JgVehicleInformation;
import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
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.feign.TzsServiceFeignClient;
......@@ -34,6 +40,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgRegisterInfoDto;
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.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
......@@ -57,6 +64,7 @@ import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
......@@ -71,6 +79,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException;
import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
......@@ -229,6 +239,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private CodeUtil codeUtil;
@Autowired
private TzsServiceFeignClient tzsServiceFeignClient;
@Autowired
private JgUseRegistrationManageServiceImpl jgUseRegistrationManageService;
@Autowired
private JgVehicleInformationMapper jgVehicleInformationMapper;
@Autowired
private JgCertificateChangeRecordServiceImpl certificateChangeRecordService;
@Autowired
private Sequence sequence;
@Autowired
private JgCertificateChangeRecordEqServiceImpl certificateChangeRecordEqService;
/**
* 将对象的属性由驼峰转为纯大写下划线格式
......@@ -2082,19 +2102,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
public static String getUrlByKey(List<Map<String, Object>> dataList, String key) {
private String getUrlByKey(List<Map<String, Object>> dataList, String key) {
if (dataList == null || dataList.isEmpty()) {
return null; // 如果 dataList 为空或 null,返回 null
return null;
}
for (Map<String, Object> item : dataList) {
if (key.equals(item.get("key"))) {
List<Map<String, String>> value = (List<Map<String, String>>) item.get("value");
if (value != null && !value.isEmpty()) {
return value.get(0).get("url");
}
return JSON.toJSONString(item.get("value"));
}
}
return null; // 如果找不到对应的 URL,返回 null
return null;
}
@Override
......@@ -2115,16 +2132,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
LinkedHashMap equipmentInfoForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_INFO_FORM_ID));
LinkedHashMap attachmentUpload = (LinkedHashMap) checkAndCast(paramMap.get(ATTACHMENT_UPLOAD));
String equListCode = (String) equipmentInfoForm.get("EQU_LIST");
String equCategoryCode = (String) equipmentInfoForm.get("EQU_CATEGORY");
String equDefineCode = (String) equipmentInfoForm.get("EQU_DEFINE");
String dataSource = (String) equipmentInfoForm.get("DATA_SOURCE");
String useOrgCode = (String) equipmentInfoForm.get("USE_ORG_CODE");
String receiveOrgCode = (String) equipmentInfoForm.get("RECEIVE_ORG_CODE");
String possession = (String) equipmentInfoForm.get("VEHICLE_APANAGE");
EquipmentInfoDto equipInfoDto = this.createEquipmentInfoDto(equipmentInfoForm, jgVehicleInformationMapper);
// 登记证记录表主键
Long changeRecordId= sequence.nextId();
List<EquipInfoCylinderExcelDto> equipInfoCylinderExcelDtoList =JSON.parseArray(JSON.toJSONString(attachmentUpload.get(EQU_LISTS)), EquipInfoCylinderExcelDto.class);
Date date = new Date();
equipInfoCylinderExcelDtoList.forEach(data->{
String record = UUID.randomUUID().toString();
List<Map<String, Object>> fileDataList = (List<Map<String, Object>>)(data.getFileData());
......@@ -2142,10 +2153,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgUseInfo useInfo = new IdxBizJgUseInfo();
BeanUtils.copyProperties(data, useInfo);
useInfo.setRecord(record);
useInfo.setRecDate(date);
useInfo.setDataSource(dataSource.equals("his")? "jg_his" : "jg");//区分历史设备和新增设备
useInfo.setRecDate(new Date());
useInfo.setDataSource("his".equals(equipInfoDto.getDataSource())? "jg_his" : "jg");//区分历史设备和新增设备
useInfo.setEquState(null);
useInfo.setIsIntoManagement(dataSource.equals("his"));//历史气瓶导入为已纳管设备
useInfo.setIsIntoManagement("his".equals(equipInfoDto.getDataSource()));//历史气瓶导入为已纳管设备
// 使用单位信息
if("个人主体".equals(company.getCompanyType())){
useInfo.setUseUnitCreditCode(company.getCompanyCode().split("_")[1]);
......@@ -2160,7 +2171,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgDesignInfo designInfo = new IdxBizJgDesignInfo();
BeanUtils.copyProperties(data, designInfo);
designInfo.setRecord(record);
designInfo.setRecDate(date);
designInfo.setRecDate(new Date());
if (data.getDesignDate() != null){
designInfo.setDesignDate(DateUtil.parse(data.getDesignDate(), "yyyy-MM-dd"));
}
......@@ -2173,7 +2184,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgFactoryInfo factoryInfo = new IdxBizJgFactoryInfo();
BeanUtils.copyProperties(data, factoryInfo);
factoryInfo.setRecord(record);
factoryInfo.setRecDate(date);
factoryInfo.setRecDate(new Date());
factoryInfo.setProductQualityYieldProve(productQualityYieldProve);
factoryInfo.setFactoryStandard(factoryStandard);
factoryInfo.setInsUseMaintainExplain(insUseMaintainExplain);
......@@ -2187,17 +2198,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgRegisterInfo registerInfo = new IdxBizJgRegisterInfo();
BeanUtils.copyProperties(data, registerInfo);
registerInfo.setRecord(record);
registerInfo.setRecDate(date);
registerInfo.setEquCategory(equCategoryCode);
registerInfo.setEquDefine(equDefineCode);
registerInfo.setEquList(equListCode);
registerInfo.setRecDate(new Date());
registerInfo.setEquCategory(equipInfoDto.getEquCategoryCode());
registerInfo.setEquDefine(equipInfoDto.getEquDefineCode());
registerInfo.setEquList(equipInfoDto.getEquListCode());
registerInfo.setRegisterState(idxBizJgRegisterInfoService.getRegCode());
registerInfo.setProductPhoto(productPhoto);
registerInfo.setOtherAccessoriesReg(otherAccessoriesReg);
registerInfo.setUseOrgCode(useOrgCode);
if (dataSource.equals("his")){
registerInfo.setEquCode(this.getEquCode(registerInfo, factoryInfo, receiveOrgCode));
registerInfo.setUseOrgCode(equipInfoDto.getUseOrgCode());
if ("his".equals(equipInfoDto.getDataSource())){
registerInfo.setEquCode(this.getEquCode(registerInfo, factoryInfo, equipInfoDto.getReceiveOrgCode()));
}
registerInfoList.add(registerInfo);
......@@ -2206,14 +2216,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
BeanUtils.copyProperties(data, inspectionDetectionInfo);
inspectionDetectionInfo.setInspectOrgCode( data.getInspectOrgCode());
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(date);
inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfo.setInspectType("ZZJDJY");
inspectionDetectionInfo.setInspectConclusion("6040");//默认合格
inspectionDetectionInfo.setInspectDate(DateUtil.parse(data.getInspectDate(), "yyyy-MM-dd"));
// 根据条件确定增加的年数
inspectionDetectionInfo.setNextInspectDate(Date.from(
LocalDate.parse(data.getInspectDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"))
.plusYears(SPECIAL_CYLINDER.getCode().equals(equDefineCode) ? 3 : 4)
.plusYears(SPECIAL_CYLINDER.getCode().equals(equipInfoDto.getEquDefineCode()) ? 3 : 4)
.atStartOfDay(ZoneId.systemDefault())
.toInstant()));
inspectionDetectionInfoList.add(inspectionDetectionInfo);
......@@ -2222,9 +2232,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgOtherInfo otherInfo = new IdxBizJgOtherInfo();
BeanUtils.copyProperties(data, otherInfo);
otherInfo.setRecord(record);
otherInfo.setRecDate(date);
if (dataSource.equals("his")){
otherInfo.setSupervisoryCode(this.getSupervisoryCode(possession, registerInfo));
otherInfo.setRecDate(new Date());
if ("his".equals(equipInfoDto.getDataSource())){
otherInfo.setSupervisoryCode(this.getSupervisoryCode(equipInfoDto.getPossession(), registerInfo));
otherInfo.setClaimStatus("已认领");
}
otherInfoList.add(otherInfo);
......@@ -2233,48 +2243,44 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgTechParamsVessel paramsVessel = new IdxBizJgTechParamsVessel();
BeanUtils.copyProperties(data, paramsVessel);
paramsVessel.setRecord(record);
paramsVessel.setRecDate(date);
paramsVessel.setRecDate(new Date());
paramsVesselList.add(paramsVessel);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(data), ESEquipmentCategoryDto.class);
List<EquipmentCategory> equList = commonService.getEquipmentCategoryList(equListCode, null);
List<EquipmentCategory> equCategory = commonService.getEquipmentCategoryList(equCategoryCode, null);
List<EquipmentCategory> equDefine = commonService.getEquipmentCategoryList(equDefineCode, null);
ESEquipmentCategoryDto esEquipmentDto = JSON.parseObject(toJSONString(data), ESEquipmentCategoryDto.class);
esEquipmentDto.setDATA_SOURCE(useInfo.getDataSource());
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate() + "");
esEquipmentDto.setREC_DATE(System.currentTimeMillis());
esEquipmentDto.setSEQUENCE_NBR(record);
esEquipmentDto.setFACTORY_NUM(factoryInfo.getFactoryNum());
esEquipmentDto.setUSE_INNER_CODE(useInfo.getUseInnerCode());
esEquipmentDto.setUSE_ORG_CODE(equipInfoDto.getUseOrgCode());
esEquipmentDto.setIS_INTO_MANAGEMENT("his".equals(equipInfoDto.getDataSource()));
if ("his".equals(equipInfoDto.getDataSource())){
esEquipmentDto.setEQU_CODE(registerInfo.getEquCode());
}
esEquipmentDto.setEQU_CATEGORY_CODE(equipInfoDto.getEquCategoryCode());
esEquipmentDto.setEQU_CATEGORY(equipInfoDto.getEquCategory());
esEquipmentDto.setEQU_LIST_CODE(equipInfoDto.getEquListCode());
esEquipmentDto.setEQU_LIST(equipInfoDto.getEquList());
esEquipmentDto.setEQU_DEFINE_CODE(equipInfoDto.getEquDefineCode());
esEquipmentDto.setEQU_DEFINE(equipInfoDto.getEquDefine());
// 使用单位信息
dto.setDATA_SOURCE(useInfo.getDataSource());
dto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate() + "");
dto.setREC_DATE(System.currentTimeMillis());
dto.setSEQUENCE_NBR(record);
dto.setFACTORY_NUM(factoryInfo.getFactoryNum());
dto.setUSE_INNER_CODE(useInfo.getUseInnerCode());
dto.setEQU_CATEGORY_CODE(equCategoryCode);
dto.setUSE_ORG_CODE(useOrgCode);
dto.setIS_INTO_MANAGEMENT(dataSource.equals("his"));
if (dataSource.equals("his")){
dto.setEQU_CODE(registerInfo.getEquCode());
}
if (CollectionUtils.isNotEmpty(equCategory)) {
dto.setEQU_CATEGORY(equCategory.get(0).getName());
}
dto.setEQU_LIST_CODE(equListCode);
if (CollectionUtils.isNotEmpty(equList)) {
dto.setEQU_LIST(equList.get(0).getName());
}
dto.setEQU_DEFINE_CODE(equDefineCode);
if (CollectionUtils.isNotEmpty(equDefine)) {
dto.setEQU_DEFINE(equDefine.get(0).getName());
}
// 使用单位信息
if("个人主体".equals(company.getCompanyType())){
dto.setUSE_UNIT_CREDIT_CODE(company.getCompanyCode().split("_")[1]);
dto.setUSE_UNIT_NAME(company.getCompanyName().split("_")[1]);
esEquipmentDto.setUSE_UNIT_CREDIT_CODE(company.getCompanyCode().split("_")[1]);
esEquipmentDto.setUSE_UNIT_NAME(company.getCompanyName().split("_")[1]);
}else {
dto.setUSE_UNIT_CREDIT_CODE(company.getCompanyCode());
dto.setUSE_UNIT_NAME(company.getCompanyName());
esEquipmentDto.setUSE_UNIT_CREDIT_CODE(company.getCompanyCode());
esEquipmentDto.setUSE_UNIT_NAME(company.getCompanyName());
}
esEquipmentCategoryList.add(dto);
esEquipmentCategoryList.add(esEquipmentDto);
// 生成tzs_jg_certificate_change_record_eq记录
JgCertificateChangeRecordEq changeRecordEq = new JgCertificateChangeRecordEq();
changeRecordEq.setChangeRecordId(String.valueOf(changeRecordId));//登记证记录主键
changeRecordEq.setEquId(registerInfo.getRecord());//设备主键
changeRecordEq.setProductCode(factoryInfo.getFactoryNum());//产品编号
certificateChangeRecordEqService.save(changeRecordEq);
});
Optional.of(useInfoList).filter(list -> !list.isEmpty()).ifPresent(idxBizJgUseInfoService::saveBatch);
Optional.of(designInfoList).filter(list -> !list.isEmpty()).ifPresent(idxBizJgDesignInfoService::saveBatch);
......@@ -2284,9 +2290,114 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
Optional.of(paramsVesselList).filter(list -> !list.isEmpty()).ifPresent(idxBizJgTechParamsVesselService::saveBatch);
Optional.of(inspectionDetectionInfoList).filter(list -> !list.isEmpty()).ifPresent(idxBizJgInspectionDetectionInfoService::saveBatch);
Optional.of(esEquipmentCategoryList).filter(list -> !list.isEmpty()).ifPresent(esEquipmentCategory::saveAll);
// 生成证书管理表记录
JgUseRegistrationManage registrationManage = this.saveRegistrationManage(equipInfoDto, company);
// 生成一条tzs_jg_certificate_change_record记录
generateCertificateChangeRecord(registrationManage, changeRecordId);
return String.format("导入完成,成功导入: %d 条数据!", useInfoList.size());
}
private EquipmentInfoDto createEquipmentInfoDto(Map<String, Object> equipmentInfoForm, JgVehicleInformationMapper jgVehicleInformationMapper) {
EquipmentInfoDto dto = new EquipmentInfoDto();
String equListCode = (String) equipmentInfoForm.get("EQU_LIST");
String equCategoryCode = (String) equipmentInfoForm.get("EQU_CATEGORY");
String equDefineCode = (String) equipmentInfoForm.get("EQU_DEFINE");
dto.setEquListCode(equListCode);
dto.setEquCategoryCode(equCategoryCode);
dto.setEquDefineCode(equDefineCode);
dto.setEquList(jgVehicleInformationMapper.getEquCategoryNameByCode(equListCode));
dto.setEquCategory(jgVehicleInformationMapper.getEquCategoryNameByCode(equCategoryCode));
dto.setEquDefine(jgVehicleInformationMapper.getEquCategoryNameByCode(equDefineCode));
dto.setDataSource((String) equipmentInfoForm.get("DATA_SOURCE"));
dto.setUseOrgCode((String) equipmentInfoForm.get("USE_ORG_CODE"));
dto.setReceiveOrgCode(((String) equipmentInfoForm.get("RECEIVE_ORG_CODE")).split("_")[0]);
dto.setReceiveOrgName(((String) equipmentInfoForm.get("RECEIVE_ORG_CODE")).split("_")[1]);
dto.setPossession((String) equipmentInfoForm.get("VEHICLE_APANAGE"));
return dto;
}
private JgUseRegistrationManage saveRegistrationManage(EquipmentInfoDto equipInfoDto, CompanyBo company) {
JgUseRegistrationManage jgUseRegistrationManage = new JgUseRegistrationManage();
jgUseRegistrationManage.setApplyNo(this.getApplicationNo());
jgUseRegistrationManage.setCertificateStatus("已登记");
jgUseRegistrationManage.setReceiveOrgName(equipInfoDto.getReceiveOrgName());
jgUseRegistrationManage.setAuditPassDate(new Date());
jgUseRegistrationManage.setRegType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName());
jgUseRegistrationManage.setRegDate(new Date());
jgUseRegistrationManage.setEquList(equipInfoDto.getEquList());
jgUseRegistrationManage.setEquListCode(equipInfoDto.getEquListCode());
jgUseRegistrationManage.setEquCategory(equipInfoDto.getEquCategory());
jgUseRegistrationManage.setEquCategoryCode(equipInfoDto.getEquCategoryCode());
jgUseRegistrationManage.setEquDefine(equipInfoDto.getEquDefine());
jgUseRegistrationManage.setEquDefineCode(equipInfoDto.getEquDefineCode());
jgUseRegistrationManage.setIsDelete(Boolean.FALSE);
jgUseRegistrationManage.setEquUseAddress("");
jgUseRegistrationManage.setManageType("unit");
jgUseRegistrationManage.setUseUnitAddress(company.getAddress());
jgUseRegistrationManage.setUseRegistrationCode(equipInfoDto.getUseOrgCode());
jgUseRegistrationManage.setUseUnitCreditCode(company.getCompanyCode());
jgUseRegistrationManage.setUseUnitName(company.getCompanyName());
jgUseRegistrationManage.setReceiveCompanyCode(equipInfoDto.getReceiveOrgCode());
jgUseRegistrationManage.setCertificateNo(generateCertificateNo(equipInfoDto, new Date(), equipInfoDto.getReceiveOrgCode()));
jgUseRegistrationManageService.save(jgUseRegistrationManage);
return jgUseRegistrationManage;
}
private void generateCertificateChangeRecord(JgUseRegistrationManage registrationManage, Long changeRecordId) {
JgCertificateChangeRecord changeRecord = new JgCertificateChangeRecord();
changeRecord.setApplyNo(registrationManage.getApplyNo());
changeRecord.setReceiveOrgName(registrationManage.getReceiveOrgName());
changeRecord.setAuditPassDate(new Date());
changeRecord.setRegType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName());
changeRecord.setRegDate(registrationManage.getCreateDate());
changeRecord.setChangeContent(this.buildRecordContent(registrationManage));//变更内容
changeRecord.setUseRegistrationCode(registrationManage.getUseRegistrationCode());//使用登记编号
changeRecord.setReceiveCompanyCode(registrationManage.getReceiveCompanyCode());//接收机构公司代码
changeRecord.setCertificateNo(registrationManage.getCertificateNo());//登记证书唯一码
changeRecord.setUseUnitCreditCode(registrationManage.getUseUnitCreditCode());//使用单位统一信用代码
changeRecord.setUseUnitName(registrationManage.getUseUnitName());//使用单位名称
changeRecord.setEquCategory(registrationManage.getEquCategory());//设备类别编码
changeRecord.setRoutePath("");
changeRecord.setCreateDate(new Date());
changeRecord.setSequenceNbr(changeRecordId);
certificateChangeRecordService.save(changeRecord);
}
private String buildRecordContent(JgUseRegistrationManage registrationManage) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
return registrationManage.getRecUserName() + "批量上传了【"+BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName()+"】," +
"单号【" + registrationManage.getApplyNo() + "】,上传日期" + simpleDateFormat.format(registrationManage.getRecDate());
}
/**
* 生成使用登记证书唯一标识
* @param dto 包含有 设备种类 & 设备类别 & 设备品种 的map
* @param date 生成证日期 (不传取当前时间)
* @param receiveCompanyCode 接收机构统一信用代码
* @return 使用登记证书唯一标识
*/
private String generateCertificateNo(EquipmentInfoDto dto,Date date,String receiveCompanyCode){
String ym = "";
try {
ym = Optional.of(DateUtils.dateFormat(date, DateUtils.DATE_PATTERN_MM)).orElse(DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM));
} catch (ParseException e) {
log.error("日期转换失败:", e);
}
String equCode = Optional.ofNullable(dto.getEquCategoryCode()).orElse(dto.getEquDefineCode());
String registrationCode = equCode + receiveCompanyCode + ym;
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(registrationCode);
return responseModel.getResult();
}
private String getApplicationNo(){
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.SYDJ.getCode(), 1);
if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) {
log.error("车用气瓶使用登记申请单单号获取失败!");
throw new BadRequest("车用气瓶使用登记申请单单号获取失败!");
}
return listResponseModel.getResult().get(0);
}
public StringBuilder checkExcelData(EquipInfoCylinderExcelDto data, AnalysisContext context) {
StringBuilder result = new StringBuilder();
ReadRowHolder readRowHolder = context.readRowHolder();
......@@ -2451,7 +2562,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
listener.setCompany(company);
}
public String findUseCode(List<Map<String, Object>> unitList, String inspectOrgCode) {
Optional<Map<String, Object>> optional = unitList.stream()
.filter(map -> map.get("useCode").equals(inspectOrgCode))
......
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