Commit 897f8799 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_main' of http://39.100.92.250:5000/moa/amos-boot-biz…

Merge branch 'develop_tzs_main' of http://39.100.92.250:5000/moa/amos-boot-biz into develop_tzs_main
parents ddfe5922 6098a5ed
...@@ -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<>();
...@@ -842,7 +842,7 @@ public class DataDockServiceImpl { ...@@ -842,7 +842,7 @@ public class DataDockServiceImpl {
* @param record 设备唯一编码 * @param record 设备唯一编码
*/ */
private void saveEquInfoToEs(String record, String isCompleteXa) { private void saveEquInfoToEs(String record, String isCompleteXa) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(record); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(record);
ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
if (!ObjectUtils.isEmpty(equipmentCategoryDto)) { if (!ObjectUtils.isEmpty(equipmentCategoryDto)) {
long recTime; long recTime;
...@@ -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);
} }
...@@ -2950,7 +2976,7 @@ public class DataDockServiceImpl { ...@@ -2950,7 +2976,7 @@ public class DataDockServiceImpl {
idxBizJgUseInfoService.updateById(useInfo); idxBizJgUseInfoService.updateById(useInfo);
// es更新 // es更新
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(useInfo.getRecord()); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(useInfo.getRecord());
ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto equipmentCategoryDto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
equipmentCategoryDto.setIS_INTO_MANAGEMENT(Boolean.TRUE); equipmentCategoryDto.setIS_INTO_MANAGEMENT(Boolean.TRUE);
esEquipmentCategory.save(equipmentCategoryDto); esEquipmentCategory.save(equipmentCategoryDto);
......
...@@ -106,7 +106,6 @@ import java.util.concurrent.atomic.AtomicReference; ...@@ -106,7 +106,6 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function; 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 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.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE;
...@@ -1141,7 +1140,7 @@ public class DataHandlerServiceImpl { ...@@ -1141,7 +1140,7 @@ public class DataHandlerServiceImpl {
} }
String[] recordArr = records.trim().split(","); String[] recordArr = records.trim().split(",");
for (String record : recordArr) { for (String record : recordArr) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(record); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(record);
categoryOtherInfoMapper.updateEsStatus(record); categoryOtherInfoMapper.updateEsStatus(record);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(record); Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(record);
......
...@@ -113,6 +113,7 @@ import java.util.*; ...@@ -113,6 +113,7 @@ import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
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.enums.CylinderTypeEnum.SPECIAL_CYLINDER; import static com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum.SPECIAL_CYLINDER;
...@@ -331,6 +332,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -331,6 +332,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;
...@@ -501,16 +504,28 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -501,16 +504,28 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* @return record * @return record
*/ */
private ResponseModel pipelineEquipCreateOrUpdate(Map<String, Object> paramMap, CompanyBo company) { private ResponseModel pipelineEquipCreateOrUpdate(Map<String, Object> paramMap, CompanyBo company) {
List<ESEquipmentCategoryDto> addEsEquipCategoryDtos = new ArrayList<>();
List<ESEquipmentCategoryDto> deleteEsEquipCategoryDtos = new ArrayList<>();
List<ESEquipmentInfo> addEsEquipInfos = new ArrayList<>();
List<ESEquipmentInfo> deleteEsEquipInfos = new ArrayList<>();
// 获取表单数据并进行类型检查 // 获取表单数据并进行类型检查
LinkedHashMap equipmentInfoForm = castToLinkedHashMap(paramMap.get(EQUIP_INFO_FORM_ID)); LinkedHashMap equipmentInfoForm = castToLinkedHashMap(paramMap.get(EQUIP_INFO_FORM_ID));
// 操作类型
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
try { try {
String submitType = String.valueOf(paramMap.get("submitType")); String submitType = String.valueOf(paramMap.get("submitType"));
return ResponseHelper.buildResponse(batchSubmitOrUpdatePipeline(equipmentInfoForm, submitType, company)); return ResponseHelper.buildResponse(batchSubmitOrUpdatePipeline(equipmentInfoForm, submitType, company, addEsEquipCategoryDtos, deleteEsEquipCategoryDtos, addEsEquipInfos, deleteEsEquipInfos));
} catch (Exception e) { } catch (Exception e) {
log.error("操作失败,数据异常: {}", e.getMessage(), e); log.error("操作失败,数据异常: {}", e.getMessage(), e);
handleError(e, String.valueOf(paramMap.getOrDefault(SEQUENCE_NBR, "")), operateType); // 回滚es:新增的需要删除、删除的需要用快照数据保存
if (!ValidationUtil.isEmpty(addEsEquipCategoryDtos)) {
esEquipmentCategory.deleteAll(addEsEquipCategoryDtos);
esEquipmentDao.deleteAll(this.buildEquipData(addEsEquipCategoryDtos.stream().map(ESEquipmentCategoryDto::getSEQUENCE_NBR).collect(Collectors.toList())));
}
if (!ValidationUtil.isEmpty(deleteEsEquipCategoryDtos)) {
esEquipmentCategory.saveAll(deleteEsEquipCategoryDtos);
}
if (!ValidationUtil.isEmpty(deleteEsEquipInfos)) {
esEquipmentDao.saveAll(deleteEsEquipInfos);
}
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
} }
...@@ -535,7 +550,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -535,7 +550,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return new ArrayList<>(15); return new ArrayList<>(15);
} }
private Long batchSubmitOrUpdatePipeline(LinkedHashMap equipmentInfoForm, String submitType, CompanyBo company) { private Long batchSubmitOrUpdatePipeline(LinkedHashMap equipmentInfoForm, String submitType, CompanyBo company, List<ESEquipmentCategoryDto> addEsEquipCategoryDtos, List<ESEquipmentCategoryDto> deleteEsEquipCategoryDtos, List<ESEquipmentInfo> addEsEquipInfos, List<ESEquipmentInfo> deleteEsEquipInfos) {
Date date = new Date(); Date date = new Date();
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT; String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
// 设备是否复制而来,复制来的设备走新增 // 设备是否复制而来,复制来的设备走新增
...@@ -558,10 +573,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -558,10 +573,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
.stream() .stream()
.map(IdxBizJgUseInfo::getRecord) .map(IdxBizJgUseInfo::getRecord)
.collect(Collectors.toList()); .collect(Collectors.toList());
idxBizJgRegisterInfoService.batchDeleteByRecord(MapBuilder.<String, Object>create() // 删除涉及的19张表的数据
.put("recordList", records) superviseInfoMapper.deleteDataAll(records);
.put("equList", equipmentInfoForm.get("EQU_LIST")) // 先查询旧es数据,用于后续报错回滚
.build()); deleteEsEquipCategoryDtos.addAll(StreamSupport.stream(esEquipmentCategory.findAllById(records).spliterator(), false).collect(Collectors.toList()));
deleteEsEquipInfos.addAll(StreamSupport.stream(esEquipmentDao.findAllById(records).spliterator(), false).collect(Collectors.toList()));
// 删除两个es
esEquipmentCategory.deleteAll(this.buildEquipCategoryData(records));
esEquipmentDao.deleteAll(this.buildEquipData(records));
} }
List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipmentInfoForm.get(PIPELINE_LIST); List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipmentInfoForm.get(PIPELINE_LIST);
...@@ -837,6 +856,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -837,6 +856,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName()); esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
esEquipmentDto.setProjectContraptionId(String.valueOf(sequenceNbr)); esEquipmentDto.setProjectContraptionId(String.valueOf(sequenceNbr));
esEquipmentCategoryList.add(esEquipmentDto); esEquipmentCategoryList.add(esEquipmentDto);
addEsEquipCategoryDtos.add(esEquipmentDto);
} }
idxBizJgUseInfoService.saveOrUpdateBatch(useInfoList); idxBizJgUseInfoService.saveOrUpdateBatch(useInfoList);
iIdxBizJgDesignInfoService.saveOrUpdateBatch(designInfoList); iIdxBizJgDesignInfoService.saveOrUpdateBatch(designInfoList);
...@@ -911,8 +931,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -911,8 +931,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
LinkedHashMap equipmentParamsForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_PARAMS_FORM_ID)); LinkedHashMap equipmentParamsForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_PARAMS_FORM_ID));
// 操作类型 // 操作类型
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT; String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
// 设备是否复制而来,复制来的设备走新增
boolean isCopy = !ValidationUtil.isEmpty(equipmentInfoForm.get(IS_COPY));
operateType = isCopy ? OPERATESAVE : operateType;
String submitType = String.valueOf(paramMap.get("submitType")); String submitType = String.valueOf(paramMap.get("submitType"));
String record = (String) equipmentInfoForm.get(RECORD); String record = (String) equipmentInfoForm.get(RECORD);
ESEquipmentCategoryDto esEquipmentCategoryDto = esEquipmentCategory.findById(record).orElse(null);
try { try {
// 设备代码 字段的唯一性校验 // 设备代码 字段的唯一性校验
checkEquCodeUniqueness(equipmentInfoForm); checkEquCodeUniqueness(equipmentInfoForm);
...@@ -921,7 +945,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -921,7 +945,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 96333码 字段的唯一性校验 // 96333码 字段的唯一性校验
check96333Code(equipmentInfoForm); check96333Code(equipmentInfoForm);
} catch (Exception e) { } catch (Exception e) {
handleError(e, null, null); handleError(e, null, null, null);
} }
// 操作类型 // 操作类型
try { try {
...@@ -933,7 +957,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -933,7 +957,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} catch (Exception e) { } catch (Exception e) {
log.error("操作失败,数据异常: " + e.getMessage(), e); log.error("操作失败,数据异常: " + e.getMessage(), e);
handleError(e, record, operateType); handleError(e, record, operateType, esEquipmentCategoryDto);
} }
return ResponseHelper.buildResponse(record); return ResponseHelper.buildResponse(record);
} }
...@@ -948,7 +972,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -948,7 +972,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String submitType = String.valueOf(paramMap.get("submitType")); String submitType = String.valueOf(paramMap.get("submitType"));
String record = (String) equipmentInfoForm.get(RECORD); String record = (String) equipmentInfoForm.get(RECORD);
String dataSource = (String) equipmentInfoForm.get(DATA_SOURCE); String dataSource = (String) equipmentInfoForm.get(DATA_SOURCE);
ESEquipmentCategoryDto esEquipmentCategoryDto = esEquipmentCategory.findById(record).orElse(null);
if (dataSource.contains("his")) { if (dataSource.contains("his")) {
// 使用登记证编号校验 // 使用登记证编号校验
this.checkUseRegistrationCodeIsNotNUll(equipmentInfoForm); this.checkUseRegistrationCodeIsNotNUll(equipmentInfoForm);
...@@ -969,7 +993,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -969,7 +993,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 历史有使用登记证的场车设备校验车牌号的唯一性 // 历史有使用登记证的场车设备校验车牌号的唯一性
checkCarNumberUniquenessWithHisCC(equipmentInfoForm, record, dataSource); checkCarNumberUniquenessWithHisCC(equipmentInfoForm, record, dataSource);
} catch (Exception e) { } catch (Exception e) {
handleError(e, null, null); handleError(e, null, null, null);
} }
// 使用登记按照单位办理除外,其余进行编辑校验 // 使用登记按照单位办理除外,其余进行编辑校验
...@@ -981,6 +1005,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -981,6 +1005,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
// 操作类型 // 操作类型
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT; String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
// 设备是否复制而来,复制来的设备走新增
boolean isCopy = !ValidationUtil.isEmpty(equipmentInfoForm.get(IS_COPY));
operateType = isCopy ? OPERATESAVE : operateType;
try { try {
// 保存数据 // 保存数据
record = batchSubmitOrUpdate(equipmentClassForm, equipmentInfoForm, equipmentParamsForm, submitType, company); record = batchSubmitOrUpdate(equipmentClassForm, equipmentInfoForm, equipmentParamsForm, submitType, company);
...@@ -991,7 +1018,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -991,7 +1018,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} catch (Exception e) { } catch (Exception e) {
log.error("操作失败,数据异常: " + e.getMessage(), e); log.error("操作失败,数据异常: " + e.getMessage(), e);
handleError(e, record, operateType); handleError(e, record, operateType, esEquipmentCategoryDto);
} }
return ResponseHelper.buildResponse(record); return ResponseHelper.buildResponse(record);
} }
...@@ -1184,7 +1211,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1184,7 +1211,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} }
private void handleError(Exception e, String record, String operateType) { private void handleError(Exception e, String record, String operateType, ESEquipmentCategoryDto esEquipmentCategoryDto) {
log.error("处理设备新增或更新异常: " + e.getMessage(), e); log.error("处理设备新增或更新异常: " + e.getMessage(), e);
// 删除数据库数据和ES数据 // 删除数据库数据和ES数据
if (!ObjectUtils.isEmpty(record) && OPERATESAVE.equals(operateType)) { if (!ObjectUtils.isEmpty(record) && OPERATESAVE.equals(operateType)) {
...@@ -1193,6 +1220,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1193,6 +1220,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
superviseInfoMapper.deleteDataAll(records); superviseInfoMapper.deleteDataAll(records);
esEquipmentCategory.deleteById(record); esEquipmentCategory.deleteById(record);
} }
if (!ValidationUtil.isEmpty(record) && OPERATEEDIT.equals(operateType) && !ValidationUtil.isEmpty(esEquipmentCategoryDto)) {
esEquipmentCategory.save(esEquipmentCategoryDto);
}
throw new BadRequest(e.getMessage()); throw new BadRequest(e.getMessage());
} }
...@@ -1220,34 +1250,49 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1220,34 +1250,49 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean batchDeleteByRecord(Map<String, Object> map) { public boolean batchDeleteByRecord(Map<String, Object> map) {
Object recordList = map.get("recordList");
List<String> records = new ArrayList<>(); List<String> records = new ArrayList<>();
List<ESEquipmentCategoryDto> list = new ArrayList<>(); List<ESEquipmentCategoryDto> originalEsList1 = new ArrayList<>();
// 删除ES数据 List<ESEquipmentInfo> originalEsList2 = new ArrayList<>();
if (recordList.toString().contains("[")) { try {
for (String record : (List<String>) recordList) { Object recordList = map.get("recordList");
records.add(record); // 删除ES数据
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto(); if (recordList.toString().contains("[")) {
esEquipmentCategoryDto.setSEQUENCE_NBR(record); records.addAll((List<String>) recordList);
list.add(esEquipmentCategoryDto); } else {
records.add(recordList.toString());
} }
} else { this.checkForDelete(records);
records.add(recordList.toString()); if (CollUtil.isNotEmpty(records)) {
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto(); // 删除涉及的19张表的数据
esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString()); superviseInfoMapper.deleteDataAll(records);
list.add(esEquipmentCategoryDto); }
if (CollUtil.isNotEmpty(records)) {
originalEsList1 = StreamSupport.stream(esEquipmentCategory.findAllById(records).spliterator(), false).collect(Collectors.toList());
originalEsList2 = StreamSupport.stream(esEquipmentDao.findAllById(records).spliterator(), false).collect(Collectors.toList());
// 删除es中的数据
esEquipmentCategory.deleteAll(this.buildEquipCategoryData(records));
esEquipmentDao.deleteAll(this.buildEquipData(records));
}
return true;
} catch (Exception e) {
log.error("批量删除设备注册信息异常: " + e.getMessage(), e);
this.rollbackEsInfo(originalEsList1, originalEsList2);
throw new BadRequest(e.getMessage());
} }
this.checkForDelete(records); }
if (CollUtil.isNotEmpty(records)) {
// 删除涉及的19张表的数据 /**
superviseInfoMapper.deleteDataAll(records); * 回滚es删除的数据
* @param originalEsList1 esEquipmentCategoryDto集合
* @param originalEsList2 esEquipmentInfo集合
*/
private void rollbackEsInfo(List<ESEquipmentCategoryDto> originalEsList1, List<ESEquipmentInfo> originalEsList2) {
if (CollUtil.isNotEmpty(originalEsList1)) {
esEquipmentCategory.saveAll(originalEsList1);
} }
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(originalEsList2)) {
// 删除es中的数据 esEquipmentDao.saveAll(originalEsList2);
esEquipmentCategory.deleteAll(list);
esEquipmentDao.deleteAll(this.buildEquipData(records));
} }
return true;
} }
private Iterable<? extends ESEquipmentInfo> buildEquipData(List<String> records) { private Iterable<? extends ESEquipmentInfo> buildEquipData(List<String> records) {
...@@ -1258,6 +1303,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1258,6 +1303,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
private Iterable<? extends ESEquipmentCategoryDto> buildEquipCategoryData(List<String> records) {
return records.stream().map(record->{
ESEquipmentCategoryDto esEquipmentInfo = new ESEquipmentCategoryDto();
esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
}
/** /**
* 删除校验,被引用时不可删除 * 删除校验,被引用时不可删除
* *
...@@ -3834,7 +3887,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3834,7 +3887,11 @@ 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)){
// 记录设备创建履历 // 记录设备创建履历
this.createResume(record, String.format(equipRoutePath, record, useInfo.getDataSource()), company); 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);
}
} }
return record; return record;
} }
...@@ -3853,6 +3910,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3853,6 +3910,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
...@@ -4062,8 +4136,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4062,8 +4136,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
public void saveEsData(String id) { public void saveEsData(String id) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(id); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(id);
categoryOtherInfoMapper.updateEsStatus(id);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
if (!ObjectUtils.isEmpty(dto)) { if (!ObjectUtils.isEmpty(dto)) {
long recTime; long recTime;
...@@ -4716,7 +4789,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4716,7 +4789,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 +4861,25 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4787,37 +4861,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,17 +550,41 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate ...@@ -545,17 +550,41 @@ 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()));
jgResumeInfoService.saveBatchResume(replenishEqs.stream().map(eq-> JgResumeInfoDto.builder().applyNo(certificateReplenish.getApplyNo()) if (CylinderTypeEnum.CYLINDER.getCode().equals(certificateReplenish.getEquCategoryCode())){
.businessType(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName()) JgResumeInfoDto dto = JgResumeInfoDto.builder().applyNo(certificateReplenish.getApplyNo())
.businessId(String.valueOf(certificateReplenish.getSequenceNbr())) .businessType(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName())
.equId(eq.getEquId()) .businessId(String.valueOf(certificateReplenish.getSequenceNbr()))
.approvalUnit(certificateReplenish.getReceiveOrgName()) .approvalUnit(certificateReplenish.getReceiveOrgName())
.approvalUnitCode(certificateReplenish.getReceiveOrgCode()) .approvalUnitCode(certificateReplenish.getReceiveOrgCode())
.status("正常") .status("正常")
.changeContent(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName() + "业务办理") .changeContent(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName() + "业务办理")
.routePath(routePath) .routePath(routePath)
.build()).collect(Collectors.toList()) .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())
.businessType(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName())
.businessId(String.valueOf(certificateReplenish.getSequenceNbr()))
.equId(eq.getEquId())
.approvalUnit(certificateReplenish.getReceiveOrgName())
.approvalUnitCode(certificateReplenish.getReceiveOrgCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_REPLACEMENT_REGISTRATION.getName() + "业务办理")
.routePath(routePath)
.build()).collect(Collectors.toList())
);
}
} }
public void saveManageRecord(JgCertificateReplenish certRep, TaskV2Model taskV2Model) { public void saveManageRecord(JgCertificateReplenish certRep, TaskV2Model taskV2Model) {
......
...@@ -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,36 +694,73 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto, ...@@ -696,36 +694,73 @@ 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()) String equListCode = jgEnableDisable.getEquListCode();
.approvalUnitCode(jgEnableDisable.getReceiveCompanyCode()) // 1️⃣ 压力管道:按装置记录履历
.status("正常") if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)) {
.createUserId(jgEnableDisable.getCreateUserId()) JgResumeInfoDto resume = buildBaseResume(jgEnableDisable, routePath);
.createUserName(jgEnableDisable.getCreateUserName()) resume.setEquId(jgEnableDisable.getProjectContraptionId());
.changeContent(getRegistrationClass(jgEnableDisable) + "业务办理") jgResumeInfoService.saveBatchResume(Collections.singletonList(resume));
.routePath(routePath) return;
.build()).collect(Collectors.toList()) }
);
} else { // 压力管道按照装置记录履历 // 2️⃣ 气瓶:一条履历 + 多设备关系
jgResumeInfoService.saveBatchResume(Collections.singletonList(JgResumeInfoDto.builder().applyNo(jgEnableDisable.getApplyNo()) if (CylinderTypeEnum.CYLINDER.getCode().equals(equListCode)) {
.businessType(getRegistrationClass(jgEnableDisable)) JgResumeInfoDto resume = buildBaseResume(jgEnableDisable, routePath);
.businessId(String.valueOf(jgEnableDisable.getSequenceNbr())) jgResumeInfoService.saveBatchResume(Collections.singletonList(resume));
.equId(jgEnableDisable.getProjectContraptionId()) batchInsertResumeEq(resume.getSequenceNbr(), enableDisableEqs);
.approvalUnit(jgEnableDisable.getReceiveOrgName()) return;
.approvalUnitCode(jgEnableDisable.getReceiveCompanyCode()) }
.status("正常")
.createUserId(jgEnableDisable.getCreateUserId()) // 3️⃣ 其他设备:按设备直接记履历
.createUserName(jgEnableDisable.getCreateUserName()) List<JgResumeInfoDto> resumeList = enableDisableEqs.stream()
.changeContent(getRegistrationClass(jgEnableDisable) + "业务办理") .map(eq -> {
.routePath(routePath) JgResumeInfoDto dto = buildBaseResume(jgEnableDisable, routePath);
.build()) 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))
.businessId(String.valueOf(jgEnableDisable.getSequenceNbr()))
.approvalUnit(jgEnableDisable.getReceiveOrgName())
.approvalUnitCode(jgEnableDisable.getReceiveCompanyCode())
.status("正常")
.createUserId(jgEnableDisable.getCreateUserId())
.createUserName(jgEnableDisable.getCreateUserName())
.changeContent(getRegistrationClass(jgEnableDisable) + "业务办理")
.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())
.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,17 +731,41 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -726,17 +731,41 @@ 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) {
jgResumeInfoService.saveBatchResume(designInfoList.stream().map(eq-> JgResumeInfoDto.builder().applyNo(jgOverDesignServiceLife.getApplyNo()) if (CylinderTypeEnum.CYLINDER.getCode().equals(jgOverDesignServiceLife.getEquCategory())){
.businessType(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName()) JgResumeInfoDto dto = JgResumeInfoDto.builder().applyNo(jgOverDesignServiceLife.getApplyNo())
.businessId(String.valueOf(jgOverDesignServiceLife.getSequenceNbr())) .businessType(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName())
.equId(eq.getRecord()) .businessId(String.valueOf(jgOverDesignServiceLife.getSequenceNbr()))
.approvalUnit(jgOverDesignServiceLife.getReceiveOrgName()) .approvalUnit(jgOverDesignServiceLife.getReceiveOrgName())
.approvalUnitCode(jgOverDesignServiceLife.getReceiveCompanyCode()) .approvalUnitCode(jgOverDesignServiceLife.getReceiveCompanyCode())
.status("正常") .status("正常")
.changeContent(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName() + "业务办理") .changeContent(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath()) .routePath(taskV2Model.getRoutePath())
.build()).collect(Collectors.toList()) .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())
.businessType(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName())
.businessId(String.valueOf(jgOverDesignServiceLife.getSequenceNbr()))
.equId(eq.getRecord())
.approvalUnit(jgOverDesignServiceLife.getReceiveOrgName())
.approvalUnitCode(jgOverDesignServiceLife.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath())
.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() + "") .approvalUnit(jgUseRegistration.getReceiveOrgName())
.equId(Objects.toString(equipmentMap.get("record"),"")) .approvalUnitCode(jgUseRegistration.getReceiveCompanyCode())
.approvalUnit(jgUseRegistration.getReceiveOrgName()) .changeContent(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName() + "业务办理")
.approvalUnitCode(jgUseRegistration.getReceiveCompanyCode()) .status("正常")
.changeContent(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName() + "业务办理") .routePath(taskV2Model.getRoutePath())
.status("正常") .build();
.routePath(taskV2Model.getRoutePath()) jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
.build()); 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()
.applyNo(jgVehicleInformation.getApplyNo())
.businessType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName())
.businessId(String.valueOf(jgVehicleInformation.getSequenceNbr()))
.approvalUnit(jgVehicleInformation.getReceiveOrgName())
.approvalUnitCode(jgVehicleInformation.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath())
.build();
jgResumeInfoService.saveBatchResume(Collections.singletonList(dto));
List<JgResumeInfoEq> list = equipIdList.stream()
.map(equipId -> JgResumeInfoEq.builder()
.resumeId(dto.getSequenceNbr())
.equId(equipId)
.build())
.collect(Collectors.toList());
jgResumeInfoService.saveBatchResume( for (int i = 0; i < list.size(); i += DB_BATCH_SIZE) {
equipIdList.stream() jgResumeInfoEqMapper.insertBatchSomeColumn(
.map(equipId -> JgResumeInfoDto.builder() list.subList(i, Math.min(i + DB_BATCH_SIZE, list.size()))
.applyNo(jgVehicleInformation.getApplyNo()) );
.businessType(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName()) }
.businessId(String.valueOf(jgVehicleInformation.getSequenceNbr()))
.equId(equipId)
.approvalUnit(jgVehicleInformation.getReceiveOrgName())
.approvalUnitCode(jgVehicleInformation.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath())
.build())
.collect(Collectors.toList())
);
// 车用气瓶评分 // 车用气瓶评分
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));
} }
......
...@@ -13,7 +13,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -13,7 +13,9 @@ 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.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao;
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.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto; import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
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;
...@@ -94,6 +96,8 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp ...@@ -94,6 +96,8 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp
@Resource @Resource
private ESEquipmentCategory esEquipmentCategory; private ESEquipmentCategory esEquipmentCategory;
@Resource @Resource
private EsEquipmentDao esEquipmentDao;
@Resource
private TzsServiceFeignClient tzsServiceFeignClient; private TzsServiceFeignClient tzsServiceFeignClient;
@Resource @Resource
private JgVehicleInformationServiceImpl vehicleInformationService; private JgVehicleInformationServiceImpl vehicleInformationService;
...@@ -707,13 +711,23 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp ...@@ -707,13 +711,23 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp
* 认领过程中报错,回滚第一步的es数据 * 认领过程中报错,回滚第一步的es数据
*/ */
public void handleClaimFailed(List<String> records) { public void handleClaimFailed(List<String> records) {
if (!records.isEmpty()) { esEquipmentCategory.deleteAll(this.buildEquipCategoryData(records));
records.forEach(record -> { esEquipmentDao.deleteAll(this.buildEquipData(records));
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(record); }
if (!ObjectUtils.isEmpty(data)) {
esEquipmentCategory.deleteById(record); private Iterable<? extends ESEquipmentInfo> buildEquipData(List<String> records) {
} return records.stream().map(record->{
}); ESEquipmentInfo esEquipmentInfo = new ESEquipmentInfo();
} esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
}
private Iterable<? extends ESEquipmentCategoryDto> buildEquipCategoryData(List<String> records) {
return records.stream().map(record->{
ESEquipmentCategoryDto esEquipmentInfo = new ESEquipmentCategoryDto();
esEquipmentInfo.setSEQUENCE_NBR(record);
return esEquipmentInfo;
}).collect(Collectors.toList());
} }
} }
\ No newline at end of file
...@@ -30,7 +30,7 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> { ...@@ -30,7 +30,7 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> {
int updateOtherInfo(String supervisorCode, String editStatus); int updateOtherInfo(String supervisorCode, String editStatus);
Map<String, Object> selectDataById(String id); Map<String, Object> selectJgAllViewDataById(String id);
CategoryOtherInfo queryInitCode(@Param("initCode") @NonNull String initCode); CategoryOtherInfo queryInitCode(@Param("initCode") @NonNull String initCode);
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD
WHERE ibjoi."RECORD" = #{record} WHERE ibjoi."RECORD" = #{record}
</select> </select>
<select id="selectDataById" resultType="java.util.Map"> <select id="selectJgAllViewDataById" resultType="java.util.Map">
SELECT "SEQUENCE_NBR", SELECT "SEQUENCE_NBR",
"REC_DATE", "REC_DATE",
"CREATE_DATE", "CREATE_DATE",
......
...@@ -1664,7 +1664,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1664,7 +1664,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override @Override
public void checkEsData(String id) { public void checkEsData(String id) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(id); Map<String, Object> map = categoryOtherInfoMapper.selectJgAllViewDataById(id);
categoryOtherInfoMapper.updateEsStatus(id); categoryOtherInfoMapper.updateEsStatus(id);
ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto dto = JSON.parseObject(toJSONString(map), ESEquipmentCategoryDto.class);
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(id); Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(id);
......
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