Commit 2eae243e authored by 刘林's avatar 刘林

fix(jg):处理气瓶履历信息

parent beea0a39
...@@ -44,7 +44,7 @@ public class DataRefreshListener { ...@@ -44,7 +44,7 @@ public class DataRefreshListener {
private final TzsDataRefreshMessageServiceImpl tzsDataRefreshMessageService; private final TzsDataRefreshMessageServiceImpl tzsDataRefreshMessageService;
@TransactionalEventListener(value = DataRefreshEvent.class) @TransactionalEventListener(value = DataRefreshEvent.class, fallbackExecution = true)
@Async @Async
public void onEquipCreateOrEdit(DataRefreshEvent event) { public void onEquipCreateOrEdit(DataRefreshEvent event) {
log.info("收到数据刷新消息:{}", JSONObject.toJSONString(event)); log.info("收到数据刷新消息:{}", JSONObject.toJSONString(event));
......
...@@ -40,10 +40,12 @@ import com.yeejoin.amos.boot.module.common.api.enums.JYJCBusinessTypeEnum; ...@@ -40,10 +40,12 @@ import com.yeejoin.amos.boot.module.common.api.enums.JYJCBusinessTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.JYJCResultEnum; import com.yeejoin.amos.boot.module.common.api.enums.JYJCResultEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory; import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgResumeInfoEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.enums.*; 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.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgResumeInfoEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransferService; import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransferService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService; import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
...@@ -133,6 +135,7 @@ import java.util.stream.Collectors; ...@@ -133,6 +135,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.IDX_BIZ_EQUIPMENT_INFO; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.IDX_BIZ_EQUIPMENT_INFO;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
/** /**
* 装备分类服务实现类 * 装备分类服务实现类
...@@ -314,15 +317,14 @@ public class CommonServiceImpl implements ICommonService { ...@@ -314,15 +317,14 @@ public class CommonServiceImpl implements ICommonService {
@Autowired @Autowired
private CbDataDictTypeHandler dataDictTypeHandler; private CbDataDictTypeHandler dataDictTypeHandler;
@Autowired @Autowired
private JgResumeInfoServiceImpl jgResumeInfoService; private JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired @Autowired
private RestHighLevelClient restHighLevelClient; private RestHighLevelClient restHighLevelClient;
@Autowired @Autowired
CodeUtil codeUtil; private CodeUtil codeUtil;
@Autowired
private JgResumeInfoEqMapper jgResumeInfoEqMapper;
public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE"; public static final String DATA_QUALITY_SCORE = "DATA_QUALITY_SCORE";
...@@ -3500,4 +3502,19 @@ public class CommonServiceImpl implements ICommonService { ...@@ -3500,4 +3502,19 @@ public class CommonServiceImpl implements ICommonService {
public String queryBaseUnitNameByCreditCode(String unitCreditCode) { public String queryBaseUnitNameByCreditCode(String unitCreditCode) {
return ValidationUtil.isEmpty(unitCreditCode) ? unitCreditCode : commonMapper.queryUnitNameByCreditCode(unitCreditCode); return ValidationUtil.isEmpty(unitCreditCode) ? unitCreditCode : commonMapper.queryUnitNameByCreditCode(unitCreditCode);
} }
public void batchInsertResumeEq(Long resumeId, List<Map<String, Object>> equipmentLists) {
List<JgResumeInfoEq> list = equipmentLists.stream()
.map(e -> JgResumeInfoEq.builder()
.resumeId(resumeId)
.equId(String.valueOf(e.get("record")))
.build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
}
} }
\ No newline at end of file
...@@ -28,6 +28,7 @@ import com.yeejoin.amos.boot.module.common.api.dao.ExcelImportErrorLogDao; ...@@ -28,6 +28,7 @@ import com.yeejoin.amos.boot.module.common.api.dao.ExcelImportErrorLogDao;
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.common.api.dto.ExcelImportErrorLogDto; import com.yeejoin.amos.boot.module.common.api.dto.ExcelImportErrorLogDto;
import com.yeejoin.amos.boot.module.common.api.enums.ConstructionTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.ConstructionTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.common.DataDockTemplateVersionUtils; import com.yeejoin.amos.boot.module.jg.api.common.DataDockTemplateVersionUtils;
import com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils; import com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils;
import com.yeejoin.amos.boot.module.jg.api.converter.DictParamsConverter; import com.yeejoin.amos.boot.module.jg.api.converter.DictParamsConverter;
...@@ -39,10 +40,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.*; ...@@ -39,10 +40,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum; import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum; import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest; import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext; import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext; import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
...@@ -98,6 +96,7 @@ import java.util.stream.StreamSupport; ...@@ -98,6 +96,7 @@ import java.util.stream.StreamSupport;
import static com.alibaba.fastjson.JSON.toJSONString; import static com.alibaba.fastjson.JSON.toJSONString;
import static com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant.EQU_CATEGORY_CODE_GDYLRQ; import static com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant.EQU_CATEGORY_CODE_GDYLRQ;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl.toCamelCase; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl.toCamelCase;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
@Slf4j @Slf4j
@Service @Service
...@@ -142,6 +141,7 @@ public class DataDockServiceImpl { ...@@ -142,6 +141,7 @@ public class DataDockServiceImpl {
private final CodeUtil codeUtil; private final CodeUtil codeUtil;
private final CommonMapper commonMapper; private final CommonMapper commonMapper;
private final JgResumeInfoServiceImpl jgResumeInfoService; private final JgResumeInfoServiceImpl jgResumeInfoService;
private final JgResumeInfoEqMapper jgResumeInfoEqMapper;
private final IdxBizJgMaintenanceRecordInfoServiceImpl idxBizJgMaintenanceRecordInfoService; private final IdxBizJgMaintenanceRecordInfoServiceImpl idxBizJgMaintenanceRecordInfoService;
private final TzBaseEnterpriseInfoMapper enterpriseInfoMapper; private final TzBaseEnterpriseInfoMapper enterpriseInfoMapper;
private final Map<String, Object> resultError = new HashMap<>(); private final Map<String, Object> resultError = new HashMap<>();
...@@ -1727,6 +1727,9 @@ public class DataDockServiceImpl { ...@@ -1727,6 +1727,9 @@ public class DataDockServiceImpl {
this.updatePipelineLength(projectContraptionIdSet); this.updatePipelineLength(projectContraptionIdSet);
this.createResumePipelineBatch(projectContraptionIdSet, String.format(pipelineRoutePath, projectContraptionIdSet), company); this.createResumePipelineBatch(projectContraptionIdSet, String.format(pipelineRoutePath, projectContraptionIdSet), company);
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_PROJECT.name(), projectContraptionIdSet, EquipCreateOrEditEvent.EquipType.project)); eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_PROJECT.name(), projectContraptionIdSet, EquipCreateOrEditEvent.EquipType.project));
}else if (CylinderTypeEnum.CYLINDER.getCode().equals(equCategory)){
this.createResumeCylinderBatch(recordSet,dataSource, equipRoutePath, company);
eventPublisher.publish(new EquipCreateOrEditEvent(this,BusinessTypeEnum.JG_NEW_EQUIP.name(),recordSet, EquipCreateOrEditEvent.EquipType.equip));
}else{ }else{
this.createResumeBatch(recordSet,dataSource, equipRoutePath, company); this.createResumeBatch(recordSet,dataSource, equipRoutePath, company);
eventPublisher.publish(new EquipCreateOrEditEvent(this,BusinessTypeEnum.JG_NEW_EQUIP.name(),recordSet, EquipCreateOrEditEvent.EquipType.equip)); eventPublisher.publish(new EquipCreateOrEditEvent(this,BusinessTypeEnum.JG_NEW_EQUIP.name(),recordSet, EquipCreateOrEditEvent.EquipType.equip));
...@@ -1745,6 +1748,29 @@ public class DataDockServiceImpl { ...@@ -1745,6 +1748,29 @@ public class DataDockServiceImpl {
} }
} }
private void createResumeCylinderBatch(Set<String> records, String dataSource, String equipRoutePath, CompanyBo company) {
JgResumeInfoDto dto = JgResumeInfoDto.builder()
.businessType(BusinessTypeEnum.JG_NEW_EQUIP.getName())
.status("正常")
.approvalUnitCode(company.getCompanyCode())
.approvalUnit(company.getCompanyName())
.changeContent(BusinessTypeEnum.JG_NEW_EQUIP.getName() + "业务办理")
.routePath(String.format(equipRoutePath, dataSource))
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
List<JgResumeInfoEq> list = records.stream()
.map(record -> JgResumeInfoEq.builder()
.resumeId(dto.getSequenceNbr())
.equId(record)
.build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
}
private void updatePipelineLength(Set<String> projectContraptionIdSet) { private void updatePipelineLength(Set<String> projectContraptionIdSet) {
projectContraptionIdSet.forEach(pieLineDataChangeService::updatePipelineLength); projectContraptionIdSet.forEach(pieLineDataChangeService::updatePipelineLength);
} }
......
...@@ -331,6 +331,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -331,6 +331,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired @Autowired
private JgResumeInfoServiceImpl jgResumeInfoService; private JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired @Autowired
private JgResumeInfoEqMapper jgResumeInfoEqMapper;
@Autowired
private JgRegistrationHistoryServiceImpl jgRegistrationHistoryService; private JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired @Autowired
private SafetyProblemTracingMapper safetyProblemTracingMapper; private SafetyProblemTracingMapper safetyProblemTracingMapper;
...@@ -3834,8 +3836,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3834,8 +3836,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
this.saveOrUpdateEquParams(equipmentInfoForm, equipmentParamsForm, equList, record, date, operateType); this.saveOrUpdateEquParams(equipmentInfoForm, equipmentParamsForm, equList, record, date, operateType);
if(OPERATESAVE.equals(operateType)){ if(OPERATESAVE.equals(operateType)){
// 记录设备创建履历 // 记录设备创建履历
if (CylinderTypeEnum.CYLINDER.getCode().equals(equCategory)){
this.createResumeForCylinder(record, String.format(equipRoutePath, record, useInfo.getDataSource()), company);
} else {
this.createResume(record, String.format(equipRoutePath, record, useInfo.getDataSource()), company); this.createResume(record, String.format(equipRoutePath, record, useInfo.getDataSource()), company);
} }
}
return record; return record;
} }
...@@ -3853,6 +3859,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3853,6 +3859,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
); );
} }
public void createResumeForCylinder(String record, String routePath, CompanyBo company) {
JgResumeInfo info = new JgResumeInfo();
String businessType = BusinessTypeEnum.JG_NEW_EQUIP.getName();
info.setBusinessType(businessType);
info.setBusinessId(record);
info.setStatus("正常");
info.setApprovalUnitCode(company.getCompanyCode());
info.setApprovalUnit(company.getCompanyName());
info.setChangeContent(businessType + "业务办理");
info.setRoutePath(routePath);
jgResumeInfoService.save(info);
jgResumeInfoEqMapper.insert(JgResumeInfoEq.builder()
.resumeId(info.getSequenceNbr())
.equId(record)
.build());
}
/** /**
* 保存或者更新设备技术参数 * 保存或者更新设备技术参数
* @param equipmentInfoForm * @param equipmentInfoForm
...@@ -4716,7 +4739,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4716,7 +4739,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
.build(); .build();
equipmentLists.add(equipMap); equipmentLists.add(equipMap);
}); });
JgResumeInfo info = new JgResumeInfo();
info.setStatus("正常");
if ("his".equals(equipInfoDto.getDataSource())) { if ("his".equals(equipInfoDto.getDataSource())) {
// 生成证书管理表记录 // 生成证书管理表记录
LambdaQueryWrapper<JgUseRegistrationManage> queryWrapper = new LambdaQueryWrapper<JgUseRegistrationManage>() LambdaQueryWrapper<JgUseRegistrationManage> queryWrapper = new LambdaQueryWrapper<JgUseRegistrationManage>()
...@@ -4787,37 +4811,25 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4787,37 +4811,25 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
updateHistory(objectHashMap, String.valueOf(jgUseRegistration.getSequenceNbr())); updateHistory(objectHashMap, String.valueOf(jgUseRegistration.getSequenceNbr()));
String routePath = this.buildTaskModel(jgUseRegistration, equipInfoDto.getEquListCode()); String routePath = this.buildTaskModel(jgUseRegistration, equipInfoDto.getEquListCode());
jgResumeInfoService.saveBatchResume( String businessType = BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName();
equipmentLists.stream() info.setBusinessType(businessType);
.map(equipId -> JgResumeInfoDto.builder() info.setBusinessId(String.valueOf(jgUseRegistration.getSequenceNbr()));
.applyNo(jgUseRegistration.getApplyNo()) info.setApplyNo(jgUseRegistration.getApplyNo());
.businessType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName()) info.setApprovalUnitCode(jgUseRegistration.getReceiveOrgName());
.businessId(String.valueOf(jgUseRegistration.getSequenceNbr())) info.setApprovalUnit(jgUseRegistration.getReceiveCompanyCode());
.equId(String.valueOf(equipId.get("record"))) info.setChangeContent(businessType + "业务办理");
.approvalUnit(jgUseRegistration.getReceiveOrgName()) info.setRoutePath(routePath);
.approvalUnitCode(jgUseRegistration.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName() + "业务办理")
.routePath(routePath)
.build())
.collect(Collectors.toList())
);
} else { } else {
jgResumeInfoService.saveBatchResume( String businessType = BusinessTypeEnum.JG_NEW_EQUIP.getName();
equipmentLists.stream() info.setBusinessType(businessType);
.map(equipId -> JgResumeInfoDto.builder() info.setApprovalUnitCode(reginParams.getCompany().getCompanyCode());
.businessType(BusinessTypeEnum.JG_NEW_EQUIP.getName()) info.setApprovalUnit(reginParams.getCompany().getCompanyName());
.businessId(String.valueOf(equipId.get("record"))) info.setChangeContent(businessType + "业务办理");
.equId(String.valueOf(equipId.get("record"))) info.setRoutePath(equipRoutePath);
.approvalUnit(reginParams.getCompany().getCompanyName())
.approvalUnitCode(reginParams.getCompany().getCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_NEW_EQUIP.getName() + "业务办理")
.routePath(String.format(equipRoutePath, equipId.get("record"), equipId.get("dataSource")))
.build())
.collect(Collectors.toList())
);
} }
jgResumeInfoService.save(info);
commonServiceImpl.batchInsertResumeEq(info.getSequenceNbr(), equipmentLists);
batchInsert(idxBizJgUseInfoMapper, useInfoList, "使用信息"); batchInsert(idxBizJgUseInfoMapper, useInfoList, "使用信息");
batchInsert(idxBizJgRegisterInfoMapper, registerInfoList, "注册信息"); batchInsert(idxBizJgRegisterInfoMapper, registerInfoList, "注册信息");
batchInsert(idxBizJgSupervisionInfoMapper, supervisionInfoList, "监督信息"); batchInsert(idxBizJgSupervisionInfoMapper, supervisionInfoList, "监督信息");
......
...@@ -16,12 +16,14 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -16,12 +16,14 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; 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.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum; import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgCertificateReplenishMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgCertificateReplenishMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgResumeInfoEqMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgCertificateReplenishService; import com.yeejoin.amos.boot.module.jg.api.service.IJgCertificateReplenishService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest; import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
...@@ -74,6 +76,8 @@ import java.util.function.Function; ...@@ -74,6 +76,8 @@ import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
/** /**
* 使用登记表补证服务实现类 * 使用登记表补证服务实现类
* *
...@@ -157,6 +161,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate ...@@ -157,6 +161,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
private final IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService; private final IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
private final JgCertificateReplenishMapper jgCertificateReplenishMapper; private final JgCertificateReplenishMapper jgCertificateReplenishMapper;
private final JgResumeInfoServiceImpl jgResumeInfoService; private final JgResumeInfoServiceImpl jgResumeInfoService;
private final JgResumeInfoEqMapper jgResumeInfoEqMapper;
private final IdxBizJgProjectContraptionServiceImplService jgProjectContraptionServiceImplService; private final IdxBizJgProjectContraptionServiceImplService jgProjectContraptionServiceImplService;
/** /**
...@@ -545,6 +550,29 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate ...@@ -545,6 +550,29 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
private void createResume(JgCertificateReplenish certificateReplenish, String routePath) { private void createResume(JgCertificateReplenish certificateReplenish, String routePath) {
List<JgCertificateReplenishEq> replenishEqs = certificateReplenishEqService.getBaseMapper().selectList(new LambdaQueryWrapper<JgCertificateReplenishEq>() List<JgCertificateReplenishEq> replenishEqs = certificateReplenishEqService.getBaseMapper().selectList(new LambdaQueryWrapper<JgCertificateReplenishEq>()
.eq(JgCertificateReplenishEq::getCertificateReplenishId, certificateReplenish.getSequenceNbr())); .eq(JgCertificateReplenishEq::getCertificateReplenishId, certificateReplenish.getSequenceNbr()));
if (CylinderTypeEnum.CYLINDER.getCode().equals(certificateReplenish.getEquCategoryCode())){
JgResumeInfoDto dto = JgResumeInfoDto.builder().applyNo(certificateReplenish.getApplyNo())
.businessType(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName())
.businessId(String.valueOf(certificateReplenish.getSequenceNbr()))
.approvalUnit(certificateReplenish.getReceiveOrgName())
.approvalUnitCode(certificateReplenish.getReceiveOrgCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName() + "业务办理")
.routePath(routePath)
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
List<JgResumeInfoEq> list = replenishEqs.stream()
.map(eq -> JgResumeInfoEq.builder()
.resumeId(dto.getSequenceNbr())
.equId(eq.getEquId())
.build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
}else{
jgResumeInfoService.saveBatchResume(replenishEqs.stream().map(eq-> JgResumeInfoDto.builder().applyNo(certificateReplenish.getApplyNo()) jgResumeInfoService.saveBatchResume(replenishEqs.stream().map(eq-> JgResumeInfoDto.builder().applyNo(certificateReplenish.getApplyNo())
.businessType(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName()) .businessType(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName())
.businessId(String.valueOf(certificateReplenish.getSequenceNbr())) .businessId(String.valueOf(certificateReplenish.getSequenceNbr()))
...@@ -557,6 +585,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate ...@@ -557,6 +585,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
.build()).collect(Collectors.toList()) .build()).collect(Collectors.toList())
); );
} }
}
public void saveManageRecord(JgCertificateReplenish certRep, TaskV2Model taskV2Model) { public void saveManageRecord(JgCertificateReplenish certRep, TaskV2Model taskV2Model) {
Long certChangeRecordSeq = sequence.nextId(); Long certChangeRecordSeq = sequence.nextId();
......
...@@ -792,6 +792,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -792,6 +792,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
public void updateExecuteIds(String instanceId, JgChangeRegistrationName jgChangeRegistrationName, String operate, ProcessTaskDTO processTaskDTO) { public void updateExecuteIds(String instanceId, JgChangeRegistrationName jgChangeRegistrationName, String operate, ProcessTaskDTO processTaskDTO) {
List<String> roleListNext = new ArrayList<>(); List<String> roleListNext = new ArrayList<>();
List<String> roleListAll = new ArrayList<>(); List<String> roleListAll = new ArrayList<>();
List<String> recordList;
String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName(); String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName();
String taskName = ""; String taskName = "";
String nextTaskId = ""; String nextTaskId = "";
...@@ -834,7 +835,10 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -834,7 +835,10 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
// 更新代办 // 更新代办
TaskV2Model taskV2Model = updateTaskModel(jgChangeRegistrationName, operate); TaskV2Model taskV2Model = updateTaskModel(jgChangeRegistrationName, operate);
// 修改业务信息 // 修改业务信息
updateInfoOther(taskV2Model, jgChangeRegistrationName); recordList = updateInfoOther(taskV2Model, jgChangeRegistrationName);
Lists.partition(recordList, ES_BATCH_SIZE)
.forEach(batch -> updateEsData(batch, jgChangeRegistrationName));
this.updateEnterpriseInfo(jgChangeRegistrationName);
} }
// 保存redis最新流程数据 // 保存redis最新流程数据
commonService.saveExecuteFlowData2Redis(jgChangeRegistrationName.getInstanceId(), this.buildInstanceRuntimeData(jgChangeRegistrationName)); commonService.saveExecuteFlowData2Redis(jgChangeRegistrationName.getInstanceId(), this.buildInstanceRuntimeData(jgChangeRegistrationName));
...@@ -879,7 +883,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -879,7 +883,7 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
return commonService.getDictionaryCodeByName(auditStatus); return commonService.getDictionaryCodeByName(auditStatus);
} }
public void updateInfoOther(TaskV2Model taskV2Model, JgChangeRegistrationName jgChangeRegistrationName) { public List<String> updateInfoOther(TaskV2Model taskV2Model, JgChangeRegistrationName jgChangeRegistrationName) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
LambdaUpdateWrapper<RegUnitInfo> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<RegUnitInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(RegUnitInfo::getUnitCode, jgChangeRegistrationName.getUseUnitCreditCode()); updateWrapper.eq(RegUnitInfo::getUnitCode, jgChangeRegistrationName.getUseUnitCreditCode());
...@@ -932,8 +936,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -932,8 +936,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
final List<String> recordList = new ArrayList<>(allEquipIds); final List<String> recordList = new ArrayList<>(allEquipIds);
Lists.partition(recordList, DB_BATCH_SIZE) Lists.partition(recordList, DB_BATCH_SIZE)
.forEach(batch -> jgUseInfoMapper.updateUseUnitNameByRecords(useUnitName, creditCode, batch)); .forEach(batch -> jgUseInfoMapper.updateUseUnitNameByRecords(useUnitName, creditCode, batch));
Lists.partition(recordList, ES_BATCH_SIZE)
.forEach(batch -> updateEsData(batch, jgChangeRegistrationName));
} }
if (!CollectionUtils.isEmpty(certificateSeqList)) { if (!CollectionUtils.isEmpty(certificateSeqList)) {
final String newUseUnitName = jgChangeRegistrationName.getNewUseUnitName(); final String newUseUnitName = jgChangeRegistrationName.getNewUseUnitName();
...@@ -1017,7 +1019,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -1017,7 +1019,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
Lists.partition(eqRecords, DB_BATCH_SIZE).forEach(batch -> jgCertificateChangeRecordEqMapper.insertBatchSomeColumn(batch)); Lists.partition(eqRecords, DB_BATCH_SIZE).forEach(batch -> jgCertificateChangeRecordEqMapper.insertBatchSomeColumn(batch));
this.createResumeBatch(recordProjectContraptionIdMap, cylinderEquipIds, jgChangeRegistrationName, taskV2Model.getRoutePath());
return allEquipIds;
}
private void updateEnterpriseInfo(JgChangeRegistrationName jgChangeRegistrationName) {
// 当企业下所有使用登记证单位信息都改为最新的时候再去修改系统中单位信息 // 当企业下所有使用登记证单位信息都改为最新的时候再去修改系统中单位信息
Optional.ofNullable(tzBaseEnterpriseInfoMapper.selectOne( Optional.ofNullable(tzBaseEnterpriseInfoMapper.selectOne(
Wrappers.<TzBaseEnterpriseInfo>lambdaQuery() Wrappers.<TzBaseEnterpriseInfo>lambdaQuery()
...@@ -1070,7 +1076,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -1070,7 +1076,6 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}); });
this.createResumeBatch(recordProjectContraptionIdMap, cylinderEquipIds, jgChangeRegistrationName, taskV2Model.getRoutePath());
} }
private void createResumeBatch(Map<String, String> recordProjectContraptionIdMap, Set<String> cylinderEquipIds, JgChangeRegistrationName jgChangeRegistrationName, String routePath) { private void createResumeBatch(Map<String, String> recordProjectContraptionIdMap, Set<String> cylinderEquipIds, JgChangeRegistrationName jgChangeRegistrationName, String routePath) {
...@@ -1231,8 +1236,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -1231,8 +1236,11 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
// 更新代办 // 更新代办
TaskV2Model taskV2Model = updateTaskModel(jgChangeRegistrationName, "0"); TaskV2Model taskV2Model = updateTaskModel(jgChangeRegistrationName, "0");
// 修改业务信息 // 修改业务信息
updateInfoOther(taskV2Model, jgChangeRegistrationName); List<String> recordList = updateInfoOther(taskV2Model, jgChangeRegistrationName);
commonService.saveExecuteFlowData2Redis(jgChangeRegistrationName.getInstanceId(), this.buildInstanceRuntimeData(jgChangeRegistrationName)); commonService.saveExecuteFlowData2Redis(jgChangeRegistrationName.getInstanceId(), this.buildInstanceRuntimeData(jgChangeRegistrationName));
this.getBaseMapper().updateById(jgChangeRegistrationName); this.getBaseMapper().updateById(jgChangeRegistrationName);
Lists.partition(recordList, ES_BATCH_SIZE)
.forEach(batch -> updateEsData(batch, jgChangeRegistrationName));
this.updateEnterpriseInfo(jgChangeRegistrationName);
} }
} }
...@@ -17,20 +17,15 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; ...@@ -17,20 +17,15 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
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.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.service.ICompensateFlowDataOfRedis; import com.yeejoin.amos.boot.module.common.api.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent; import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisableEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
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.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum; import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgEnableDisableService; import com.yeejoin.amos.boot.module.jg.api.service.IJgEnableDisableService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest; import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
...@@ -75,6 +70,7 @@ import java.util.*; ...@@ -75,6 +70,7 @@ import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
import static java.util.stream.Collectors.toSet; import static java.util.stream.Collectors.toSet;
/** /**
...@@ -99,6 +95,8 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -99,6 +95,8 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
@Autowired @Autowired
JgResumeInfoServiceImpl jgResumeInfoService; JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired
private JgResumeInfoEqMapper jgResumeInfoEqMapper;
@Autowired @Autowired
private CommonServiceImpl commonService; private CommonServiceImpl commonService;
...@@ -696,28 +694,49 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -696,28 +694,49 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
} }
private void createResume(JgEnableDisable jgEnableDisable, String routePath) { private void createResume(JgEnableDisable jgEnableDisable, String routePath) {
if (!jgEnableDisable.getEquListCode().equals(EquipmentClassifityEnum.YLGD.getCode())) { // 非压力管道按照设备记录履历
LambdaQueryWrapper<JgEnableDisableEq> queryWrapper = new LambdaQueryWrapper<>(); List<JgEnableDisableEq> enableDisableEqs =
queryWrapper.eq(JgEnableDisableEq::getEnableDisableApplyId, jgEnableDisable.getSequenceNbr()); jgEnableDisableEqService.list(
List<JgEnableDisableEq> enableDisableEqs = jgEnableDisableEqService.list(queryWrapper); new LambdaQueryWrapper<JgEnableDisableEq>()
jgResumeInfoService.saveBatchResume(enableDisableEqs.stream().map(eq -> JgResumeInfoDto.builder().applyNo(jgEnableDisable.getApplyNo()) .eq(JgEnableDisableEq::getEnableDisableApplyId,
.businessType(getRegistrationClass(jgEnableDisable)) jgEnableDisable.getSequenceNbr())
.businessId(String.valueOf(jgEnableDisable.getSequenceNbr()))
.equId(eq.getEquId())
.approvalUnit(jgEnableDisable.getReceiveOrgName())
.approvalUnitCode(jgEnableDisable.getReceiveCompanyCode())
.status("正常")
.createUserId(jgEnableDisable.getCreateUserId())
.createUserName(jgEnableDisable.getCreateUserName())
.changeContent(getRegistrationClass(jgEnableDisable) + "业务办理")
.routePath(routePath)
.build()).collect(Collectors.toList())
); );
} else { // 压力管道按照装置记录履历
jgResumeInfoService.saveBatchResume(Collections.singletonList(JgResumeInfoDto.builder().applyNo(jgEnableDisable.getApplyNo()) String equListCode = jgEnableDisable.getEquListCode();
// 1️⃣ 压力管道:按装置记录履历
if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)) {
JgResumeInfoDto resume = buildBaseResume(jgEnableDisable, routePath);
resume.setEquId(jgEnableDisable.getProjectContraptionId());
jgResumeInfoService.saveBatchResume(Collections.singletonList(resume));
return;
}
// 2️⃣ 气瓶:一条履历 + 多设备关系
if (CylinderTypeEnum.CYLINDER.getCode().equals(equListCode)) {
JgResumeInfoDto resume = buildBaseResume(jgEnableDisable, routePath);
jgResumeInfoService.saveBatchResume(Collections.singletonList(resume));
batchInsertResumeEq(resume.getSequenceNbr(), enableDisableEqs);
return;
}
// 3️⃣ 其他设备:按设备直接记履历
List<JgResumeInfoDto> resumeList = enableDisableEqs.stream()
.map(eq -> {
JgResumeInfoDto dto = buildBaseResume(jgEnableDisable, routePath);
dto.setEquId(eq.getEquId());
return dto;
})
.collect(Collectors.toList());
jgResumeInfoService.saveBatchResume(resumeList);
}
private JgResumeInfoDto buildBaseResume(JgEnableDisable jgEnableDisable, String routePath) {
return JgResumeInfoDto.builder()
.applyNo(jgEnableDisable.getApplyNo())
.businessType(getRegistrationClass(jgEnableDisable)) .businessType(getRegistrationClass(jgEnableDisable))
.businessId(String.valueOf(jgEnableDisable.getSequenceNbr())) .businessId(String.valueOf(jgEnableDisable.getSequenceNbr()))
.equId(jgEnableDisable.getProjectContraptionId())
.approvalUnit(jgEnableDisable.getReceiveOrgName()) .approvalUnit(jgEnableDisable.getReceiveOrgName())
.approvalUnitCode(jgEnableDisable.getReceiveCompanyCode()) .approvalUnitCode(jgEnableDisable.getReceiveCompanyCode())
.status("正常") .status("正常")
...@@ -725,7 +744,23 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -725,7 +744,23 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
.createUserName(jgEnableDisable.getCreateUserName()) .createUserName(jgEnableDisable.getCreateUserName())
.changeContent(getRegistrationClass(jgEnableDisable) + "业务办理") .changeContent(getRegistrationClass(jgEnableDisable) + "业务办理")
.routePath(routePath) .routePath(routePath)
.build();
}
private void batchInsertResumeEq(Long resumeId, List<JgEnableDisableEq> eqs) {
if (CollectionUtils.isEmpty(eqs)) {
return;
}
List<JgResumeInfoEq> list = eqs.stream()
.map(eq -> JgResumeInfoEq.builder()
.resumeId(resumeId)
.equId(eq.getEquId())
.build()) .build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
); );
} }
} }
......
...@@ -20,11 +20,13 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; ...@@ -20,11 +20,13 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; 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.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.*; import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgResumeInfoEqMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgOverDesignServiceLifeService; import com.yeejoin.amos.boot.module.jg.api.service.IJgOverDesignServiceLifeService;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest; import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext; import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
...@@ -79,6 +81,8 @@ import java.util.*; ...@@ -79,6 +81,8 @@ import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toList;
/** /**
...@@ -110,6 +114,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -110,6 +114,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
private final JgUseRegistrationManageServiceImpl useRegistrationManageService; private final JgUseRegistrationManageServiceImpl useRegistrationManageService;
private final IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService; private final IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService;
private final JgResumeInfoServiceImpl jgResumeInfoService; private final JgResumeInfoServiceImpl jgResumeInfoService;
private final JgResumeInfoEqMapper jgResumeInfoEqMapper;
private final InspectionDetectionInfoMapper inspectionDetectionInfoMapper; private final InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
private final SnowflakeIdUtil sequence; private final SnowflakeIdUtil sequence;
private final EventPublisher eventPublisher; private final EventPublisher eventPublisher;
...@@ -726,6 +731,29 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -726,6 +731,29 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
} }
private void saveResumeInfo(TaskV2Model taskV2Model, JgOverDesignServiceLife jgOverDesignServiceLife, List<IdxBizJgDesignInfo> designInfoList) { private void saveResumeInfo(TaskV2Model taskV2Model, JgOverDesignServiceLife jgOverDesignServiceLife, List<IdxBizJgDesignInfo> designInfoList) {
if (CylinderTypeEnum.CYLINDER.getCode().equals(jgOverDesignServiceLife.getEquCategory())){
JgResumeInfoDto dto = JgResumeInfoDto.builder().applyNo(jgOverDesignServiceLife.getApplyNo())
.businessType(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName())
.businessId(String.valueOf(jgOverDesignServiceLife.getSequenceNbr()))
.approvalUnit(jgOverDesignServiceLife.getReceiveOrgName())
.approvalUnitCode(jgOverDesignServiceLife.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath())
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
List<JgResumeInfoEq> list = designInfoList.stream()
.map(eq -> JgResumeInfoEq.builder()
.resumeId(dto.getSequenceNbr())
.equId(eq.getRecord())
.build())
.collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
);
}
}else{
jgResumeInfoService.saveBatchResume(designInfoList.stream().map(eq-> JgResumeInfoDto.builder().applyNo(jgOverDesignServiceLife.getApplyNo()) jgResumeInfoService.saveBatchResume(designInfoList.stream().map(eq-> JgResumeInfoDto.builder().applyNo(jgOverDesignServiceLife.getApplyNo())
.businessType(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName()) .businessType(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName())
.businessId(String.valueOf(jgOverDesignServiceLife.getSequenceNbr())) .businessId(String.valueOf(jgOverDesignServiceLife.getSequenceNbr()))
...@@ -738,6 +766,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -738,6 +766,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
.build()).collect(Collectors.toList()) .build()).collect(Collectors.toList())
); );
} }
}
/** /**
* 发送超设计使用年限消息 * 发送超设计使用年限消息
......
...@@ -1355,19 +1355,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -1355,19 +1355,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.routePath(taskV2Model.getRoutePath()) .routePath(taskV2Model.getRoutePath())
.build()); .build());
}else{ }else{
for (Map<String, Object> equipmentMap : equipmentLists) { JgResumeInfoDto dto = JgResumeInfoDto.builder()
resumeList.add(JgResumeInfoDto.builder()
.applyNo(jgUseRegistration.getApplyNo()) .applyNo(jgUseRegistration.getApplyNo())
.businessType(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName()) .businessType(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName())
.businessId(jgUseRegistration.getSequenceNbr() + "") .businessId(jgUseRegistration.getSequenceNbr() + "")
.equId(Objects.toString(equipmentMap.get("record"),""))
.approvalUnit(jgUseRegistration.getReceiveOrgName()) .approvalUnit(jgUseRegistration.getReceiveOrgName())
.approvalUnitCode(jgUseRegistration.getReceiveCompanyCode()) .approvalUnitCode(jgUseRegistration.getReceiveCompanyCode())
.changeContent(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName() + "业务办理") .changeContent(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName() + "业务办理")
.status("正常") .status("正常")
.routePath(taskV2Model.getRoutePath()) .routePath(taskV2Model.getRoutePath())
.build()); .build();
} jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
commonServiceImpl.batchInsertResumeEq(dto.getSequenceNbr(),equipmentLists);
} }
// 批量收集的结果 // 批量收集的结果
List<JgCertificateChangeRecordEq> jgCertificateChangeRecordEqBatchList = new ArrayList<>(); List<JgCertificateChangeRecordEq> jgCertificateChangeRecordEqBatchList = new ArrayList<>();
......
...@@ -32,10 +32,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum; ...@@ -32,10 +32,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.*; 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.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgVehicleInformationService; import com.yeejoin.amos.boot.module.jg.api.service.IJgVehicleInformationService;
import com.yeejoin.amos.boot.module.jg.api.vo.JgVehicleInformationVo; import com.yeejoin.amos.boot.module.jg.api.vo.JgVehicleInformationVo;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
...@@ -107,6 +104,7 @@ import java.util.stream.Stream; ...@@ -107,6 +104,7 @@ import java.util.stream.Stream;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XIAN_YANG; import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XIAN_YANG;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XIAN; import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XIAN;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl.DB_BATCH_SIZE;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl.getAuditPassedDate; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl.getAuditPassedDate;
/** /**
...@@ -173,6 +171,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -173,6 +171,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
@Autowired @Autowired
private JgResumeInfoServiceImpl jgResumeInfoService; private JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired @Autowired
private JgResumeInfoEqMapper jgResumeInfoEqMapper;
@Autowired
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper; private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired @Autowired
private JgCertificateChangeRecordServiceImpl certificateChangeRecordService; private JgCertificateChangeRecordServiceImpl certificateChangeRecordService;
...@@ -1053,22 +1053,29 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1053,22 +1053,29 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// 生成一条tzs_jg_certificate_change_record记录 // 生成一条tzs_jg_certificate_change_record记录
generateCertificateChangeRecord(jgVehicleInformation, registerInfo, changeRecordId, taskV2Model); generateCertificateChangeRecord(jgVehicleInformation, registerInfo, changeRecordId, taskV2Model);
JgResumeInfoDto dto = JgResumeInfoDto.builder()
jgResumeInfoService.saveBatchResume(
equipIdList.stream()
.map(equipId -> JgResumeInfoDto.builder()
.applyNo(jgVehicleInformation.getApplyNo()) .applyNo(jgVehicleInformation.getApplyNo())
.businessType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName()) .businessType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName())
.businessId(String.valueOf(jgVehicleInformation.getSequenceNbr())) .businessId(String.valueOf(jgVehicleInformation.getSequenceNbr()))
.equId(equipId)
.approvalUnit(jgVehicleInformation.getReceiveOrgName()) .approvalUnit(jgVehicleInformation.getReceiveOrgName())
.approvalUnitCode(jgVehicleInformation.getReceiveCompanyCode()) .approvalUnitCode(jgVehicleInformation.getReceiveCompanyCode())
.status("正常") .status("正常")
.changeContent(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName() + "业务办理") .changeContent(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath()) .routePath(taskV2Model.getRoutePath())
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
List<JgResumeInfoEq> list = equipIdList.stream()
.map(equipId -> JgResumeInfoEq.builder()
.resumeId(dto.getSequenceNbr())
.equId(equipId)
.build()) .build())
.collect(Collectors.toList()) .collect(Collectors.toList());
for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
jgResumeInfoEqMapper.insertBatchSomeColumn(
list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
); );
}
// 车用气瓶评分 // 车用气瓶评分
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.name(), Sets.newHashSet(equipIdList), EquipCreateOrEditEvent.EquipType.equip)); eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.name(), Sets.newHashSet(equipIdList), EquipCreateOrEditEvent.EquipType.equip));
} }
......
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