|
|
|
|
@ -1387,19 +1387,19 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper, |
|
|
|
|
*/ |
|
|
|
|
private void matchStandardProcess(List<StatementVO> settlementVOs) { |
|
|
|
|
// 根据工序Id分组
|
|
|
|
|
Map<Long, List<StatementVO>> groupByPsId = settlementVOs.stream().collect(Collectors.groupingBy(StatementVO::getPpsId)); |
|
|
|
|
Set<Long> psIds = groupByPsId.keySet(); |
|
|
|
|
Map<String, List<StatementVO>> groupByPsName = settlementVOs.stream().collect(Collectors.groupingBy(StatementVO::getPsName)); |
|
|
|
|
Set<String> psNames = groupByPsName.keySet(); |
|
|
|
|
final int batchSize = 500; |
|
|
|
|
List<OemStandardProcessEntity> allStandardList = new ArrayList<>(); |
|
|
|
|
List<List<Long>> splitPsIds = Lists.partition(new ArrayList<>(psIds), batchSize); |
|
|
|
|
for (List<Long> subPsIds : splitPsIds) { |
|
|
|
|
List<OemStandardProcessEntity> batchList = oemStandardProcessService.list(new LambdaQueryWrapper<OemStandardProcessEntity>().in(OemStandardProcessEntity::getProcessId, subPsIds)); |
|
|
|
|
List<List<String>> splitPsNames = Lists.partition(new ArrayList<>(psNames), batchSize); |
|
|
|
|
for (List<String> subPsNames : splitPsNames) { |
|
|
|
|
List<OemStandardProcessEntity> batchList = oemStandardProcessService.list(new LambdaQueryWrapper<OemStandardProcessEntity>().in(OemStandardProcessEntity::getProcessName, subPsNames)); |
|
|
|
|
allStandardList.addAll(batchList); |
|
|
|
|
} |
|
|
|
|
Map<Long, List<OemStandardProcessEntity>> standardMap = allStandardList.stream().collect(Collectors.groupingBy(OemStandardProcessEntity::getProcessId)); |
|
|
|
|
for (Map.Entry<Long, List<StatementVO>> entry : groupByPsId.entrySet()) { |
|
|
|
|
Long psId = entry.getKey(); |
|
|
|
|
List<OemStandardProcessEntity> standardProcessList = standardMap.getOrDefault(psId, Collections.emptyList()); |
|
|
|
|
Map<String, List<OemStandardProcessEntity>> standardMap = allStandardList.stream().collect(Collectors.groupingBy(OemStandardProcessEntity::getProcessName)); |
|
|
|
|
for (Map.Entry<String, List<StatementVO>> entry : groupByPsName.entrySet()) { |
|
|
|
|
String psName = entry.getKey(); |
|
|
|
|
List<OemStandardProcessEntity> standardProcessList = standardMap.getOrDefault(psName, Collections.emptyList()); |
|
|
|
|
for (StatementVO statementVO : entry.getValue()) { |
|
|
|
|
OemStandardProcessEntity oemStandardProcessEntity = getStandardProcessCode(standardProcessList, statementVO); |
|
|
|
|
if (oemStandardProcessEntity != null) { |
|
|
|
|
@ -1422,31 +1422,31 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper, |
|
|
|
|
} |
|
|
|
|
// ====================== 规则1:仅【工序】,其他全为null ======================
|
|
|
|
|
for (OemStandardProcessEntity s : allStandardList) { |
|
|
|
|
boolean rule1 = Objects.equals(s.getProcessId(), statementVO.getPpsId()) && StringUtils.isEmpty(s.getPlate()) && StringUtils.isEmpty(s.getPlateThickness()) && StringUtils.isEmpty(s.getPartName()); |
|
|
|
|
boolean rule1 = Objects.equals(s.getProcessName(), statementVO.getPsName()) && StringUtils.isEmpty(s.getPlate()) && StringUtils.isEmpty(s.getPlateThickness()) && StringUtils.isEmpty(s.getPartName()); |
|
|
|
|
|
|
|
|
|
if (rule1) return s; |
|
|
|
|
} |
|
|
|
|
// ====================== 规则2:仅【工序+镀种】,其他null ======================
|
|
|
|
|
for (OemStandardProcessEntity s : allStandardList) { |
|
|
|
|
boolean rule2 = Objects.equals(s.getProcessId(), statementVO.getPpsId()) && StringUtils.equals(s.getPlate(), statementVO.getPlate()) && StringUtils.isEmpty(s.getPlateThickness()) && StringUtils.isEmpty(s.getPartName()); |
|
|
|
|
boolean rule2 = Objects.equals(s.getProcessName(), statementVO.getPsName()) && StringUtils.equals(s.getPlate(), statementVO.getPlate()) && StringUtils.isEmpty(s.getPlateThickness()) && StringUtils.isEmpty(s.getPartName()); |
|
|
|
|
|
|
|
|
|
if (rule2) return s; |
|
|
|
|
} |
|
|
|
|
// ====================== 规则3:仅【工序+镀层厚度】,其他null ======================
|
|
|
|
|
for (OemStandardProcessEntity s : allStandardList) { |
|
|
|
|
boolean rule3 = Objects.equals(s.getProcessId(), statementVO.getPpsId()) && StringUtils.isEmpty(s.getPlate()) && StringUtils.equals(s.getPlateThickness(), statementVO.getRosThickness()) && StringUtils.isEmpty(s.getPartName()); |
|
|
|
|
boolean rule3 = Objects.equals(s.getProcessName(), statementVO.getPsName()) && StringUtils.isEmpty(s.getPlate()) && StringUtils.equals(s.getPlateThickness(), statementVO.getRosThickness()) && StringUtils.isEmpty(s.getPartName()); |
|
|
|
|
if (rule3) return s; |
|
|
|
|
} |
|
|
|
|
// ====================== 规则4:仅【工序+零件名】,其他null ======================
|
|
|
|
|
for (OemStandardProcessEntity s : allStandardList) { |
|
|
|
|
boolean rule4 = Objects.equals(s.getProcessId(), statementVO.getPpsId()) && StringUtils.isEmpty(s.getPlate()) && StringUtils.isEmpty(s.getPlateThickness()) && StringUtils.equals(s.getPartName(), statementVO.getPartName()); |
|
|
|
|
boolean rule4 = Objects.equals(s.getProcessName(), statementVO.getPsName()) && StringUtils.isEmpty(s.getPlate()) && StringUtils.isEmpty(s.getPlateThickness()) && StringUtils.equals(s.getPartName(), statementVO.getPartName()); |
|
|
|
|
|
|
|
|
|
if (rule4) return s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ====================== 规则5:【工序+镀层厚度+零件名】,镀种null ======================
|
|
|
|
|
for (OemStandardProcessEntity s : allStandardList) { |
|
|
|
|
boolean rule5 = Objects.equals(s.getProcessId(), statementVO.getPpsId()) && StringUtils.isEmpty(s.getPlate()) && StringUtils.equals(s.getPlateThickness(), statementVO.getRosThickness()) && StringUtils.equals(s.getPartName(), statementVO.getPartName()); |
|
|
|
|
boolean rule5 = Objects.equals(s.getProcessName(), statementVO.getPsName()) && StringUtils.isEmpty(s.getPlate()) && StringUtils.equals(s.getPlateThickness(), statementVO.getRosThickness()) && StringUtils.equals(s.getPartName(), statementVO.getPartName()); |
|
|
|
|
if (rule5) return s; |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
|