Commit e83f1f3e authored by suhuiguang's avatar suhuiguang

fix(jg): 压力管道管道长度

1.压力管道新设备导入自测联调修改
parent deecf65c
...@@ -38,6 +38,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*; ...@@ -38,6 +38,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*;
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;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.PieLineDataChangeServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher; import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent; import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent;
...@@ -163,6 +164,8 @@ public class DataDockServiceImpl { ...@@ -163,6 +164,8 @@ public class DataDockServiceImpl {
private final IdxBizJgOtherInfoMapper idxBizJgOtherInfoMapper; private final IdxBizJgOtherInfoMapper idxBizJgOtherInfoMapper;
private final IdxBizJgInspectionDetectionInfoMapper idxBizJgInspectionDetectionInfoMapper; private final IdxBizJgInspectionDetectionInfoMapper idxBizJgInspectionDetectionInfoMapper;
private final PieLineDataChangeServiceImpl pieLineDataChangeService;
@Value("${equip.detail.path:/mixuap?appId=1742358052905971713&id=1734100233714954241&formType=detail&record=%s&DATA_SOURCE=%s}") @Value("${equip.detail.path:/mixuap?appId=1742358052905971713&id=1734100233714954241&formType=detail&record=%s&DATA_SOURCE=%s}")
private String equipRoutePath; private String equipRoutePath;
...@@ -325,18 +328,12 @@ public class DataDockServiceImpl { ...@@ -325,18 +328,12 @@ public class DataDockServiceImpl {
projectContraption.setEquCategoryName(EquCategoryConverter.getKeyByValue((String) equ.get("equCategory"))); projectContraption.setEquCategoryName(EquCategoryConverter.getKeyByValue((String) equ.get("equCategory")));
projectContraption.setEquDefine((String) equ.get("equDefine")); projectContraption.setEquDefine((String) equ.get("equDefine"));
projectContraption.setEquDefineName(EquDefineConverter.getKeyByValue((String) equ.get("equDefine"))); projectContraption.setEquDefineName(EquDefineConverter.getKeyByValue((String) equ.get("equDefine")));
projectContraption.setPipelineLength(new BigDecimal(Objects.toString(equ.get("totalPipeLength"), "0")).doubleValue());
projectContraption.setUseRegistrationCode((String) equ.get("useOrgCode")); projectContraption.setUseRegistrationCode((String) equ.get("useOrgCode"));
projectContraption.setIsIntoManagement(Boolean.FALSE); projectContraption.setIsIntoManagement(Boolean.FALSE);
projectContraption.setDataSource(dataSource); projectContraption.setDataSource(dataSource);
idxBizJgProjectContraptionService.save(projectContraption); idxBizJgProjectContraptionService.save(projectContraption);
} else { // update } else {
sequenceNbr = oldContraption.getSequenceNbr(); sequenceNbr = oldContraption.getSequenceNbr();
Double oldPipelineLength = oldContraption.getPipelineLength();
UpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("sequence_nbr", oldContraption.getSequenceNbr()) // 根据主键更新
.set("pipeline_length", Double.sum(oldPipelineLength, Double.parseDouble((String) equ.get("pipeLength"))));
idxBizJgProjectContraptionService.update(updateWrapper);
} }
} }
} }
...@@ -1574,14 +1571,6 @@ public class DataDockServiceImpl { ...@@ -1574,14 +1571,6 @@ public class DataDockServiceImpl {
Set<String> recordSet = new HashSet<>(); Set<String> recordSet = new HashSet<>();
Set<String> projectContraptionSet = new HashSet<>(); Set<String> projectContraptionSet = new HashSet<>();
Map<String, Long> projectContraptionMap = new HashMap<>(); Map<String, Long> projectContraptionMap = new HashMap<>();
Map<String, BigDecimal> pipeLengthMap = equipInfoExcelDtos.stream()
.collect(Collectors.groupingBy(
e -> Objects.toString(e.getProjectContraptionNo(), "").trim(),
Collectors.mapping(
e -> PipLenCalUtils.calBigDecimal(e.getPipeLength()),
Collectors.reducing(BigDecimal.ZERO, BigDecimal::add)
)
));
Set<String> projectContraptionIdSet = new HashSet<>(); Set<String> projectContraptionIdSet = new HashSet<>();
for (EquipInfoExcelDto equ : equipInfoExcelDtos) { for (EquipInfoExcelDto equ : equipInfoExcelDtos) {
List<Map<String, Object>> fileDataList = (List<Map<String, Object>>) equ.getFileData(); List<Map<String, Object>> fileDataList = (List<Map<String, Object>>) equ.getFileData();
...@@ -1597,8 +1586,6 @@ public class DataDockServiceImpl { ...@@ -1597,8 +1586,6 @@ public class DataDockServiceImpl {
String projectContraptionNo = Objects.toString(equMap.get("projectContraptionNo"), "").trim(); String projectContraptionNo = Objects.toString(equMap.get("projectContraptionNo"), "").trim();
Long projectContraptionId; Long projectContraptionId;
if (!projectContraptionSet.contains(projectContraptionNo)) { if (!projectContraptionSet.contains(projectContraptionNo)) {
BigDecimal totalPipeLength = pipeLengthMap.getOrDefault(projectContraptionNo, BigDecimal.ZERO);
equMap.put("totalPipeLength",totalPipeLength);
projectContraptionId = this.saveProjectContraption(equMap, equList, company, dataSource); projectContraptionId = this.saveProjectContraption(equMap, equList, company, dataSource);
projectContraptionSet.add(projectContraptionNo); projectContraptionSet.add(projectContraptionNo);
projectContraptionMap.put(projectContraptionNo, projectContraptionId); projectContraptionMap.put(projectContraptionNo, projectContraptionId);
...@@ -1613,6 +1600,7 @@ public class DataDockServiceImpl { ...@@ -1613,6 +1600,7 @@ public class DataDockServiceImpl {
recordSet.add(record); recordSet.add(record);
} }
if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) { if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) {
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{ }else{
...@@ -1621,6 +1609,10 @@ public class DataDockServiceImpl { ...@@ -1621,6 +1609,10 @@ public class DataDockServiceImpl {
} }
} }
private void updatePipelineLength(Set<String> projectContraptionIdSet) {
projectContraptionIdSet.forEach(pieLineDataChangeService::updatePipelineLength);
}
private void createResumeBatch(Set<String> records, String dataSource, String routePath, CompanyBo company) { private void createResumeBatch(Set<String> records, String dataSource, String routePath, CompanyBo company) {
jgResumeInfoService.saveBatchResume(records.stream().map(record->JgResumeInfoDto.builder() jgResumeInfoService.saveBatchResume(records.stream().map(record->JgResumeInfoDto.builder()
.businessType(BusinessTypeEnum.JG_NEW_EQUIP.getName()) .businessType(BusinessTypeEnum.JG_NEW_EQUIP.getName())
......
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