From 9a214a210b6bbb50c782ef4621fc443d2376fdb4 Mon Sep 17 00:00:00 2001 From: ls Date: Tue, 17 Jun 2025 10:25:44 +0800 Subject: [PATCH] review --- .../constant/ExperimentReviewProcessType.java | 3 + .../database/entity/ExperimentReview.java | 32 ++-- .../service/executor/ExecutorHolder.java | 151 +----------------- .../impl/ExperimentReviewServiceImpl.java | 15 +- 4 files changed, 39 insertions(+), 162 deletions(-) diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/constant/ExperimentReviewProcessType.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/constant/ExperimentReviewProcessType.java index 8137718..06d7444 100644 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/constant/ExperimentReviewProcessType.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/constant/ExperimentReviewProcessType.java @@ -1,5 +1,8 @@ package org.jeecg.modules.database.constant; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "试验流程标准") public interface ExperimentReviewProcessType { String GJB548C = "GJB548C"; diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/entity/ExperimentReview.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/entity/ExperimentReview.java index aa8c7ee..e147b71 100644 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/entity/ExperimentReview.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/entity/ExperimentReview.java @@ -1,18 +1,18 @@ package org.jeecg.modules.database.entity; +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + import java.io.Serializable; import java.util.Date; import java.util.List; -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.springframework.format.annotation.DateTimeFormat; -import org.jeecgframework.poi.excel.annotation.Excel; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - /** * @Description: 试验评定结果 * @Author: jeecg-boot @@ -78,29 +78,29 @@ public class ExperimentReview implements Serializable { * 试验流程标准 */ @Excel(name = "试验流程标准", width = 15) - @Schema(description = "试验流程标准") + @Schema(description = "试验流程标准", allowableValues = {"GJB548C", "ESCC229000", "ESCC22500", "QJ10004"}) private String processType; /** * 是否需要退火 */ @Excel(name = "是否需要退火", width = 15) - @Schema(description = "是否需要退火(Y/N)") - private String need_anneal; + @Schema(description = "是否需要退火", allowableValues = {"Y", "N"}) + private String needAnneal; /** * 是否需要辐照 */ @Excel(name = "是否需要辐照", width = 15) - @Schema(description = "是否需要辐照(Y/N)") - private String need_radiation; + @Schema(description = "是否需要辐照", allowableValues = {"Y", "N"}) + private String needRadiation; /** * 是否需要老练 */ @Excel(name = "是否需要老练", width = 15) - @Schema(description = "是否需要老练(Y/N)") - private String need_burnin; + @Schema(description = "是否需要老练", allowableValues = {"Y", "N"}) + private String needBurnin; /** * 评定结果 diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/executor/ExecutorHolder.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/executor/ExecutorHolder.java index 39137a2..6638465 100644 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/executor/ExecutorHolder.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/executor/ExecutorHolder.java @@ -1,164 +1,27 @@ package org.jeecg.modules.database.service.executor; import jakarta.annotation.PostConstruct; -import jakarta.annotation.Resource; -import org.jeecg.modules.database.constant.ExperimentReviewProcessType; import org.jeecg.modules.database.entity.Experiment; import org.jeecg.modules.database.entity.ExperimentSampleInfo; import org.jeecg.modules.database.service.IExperimentReviewRuleExecutor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.HashMap; -import java.util.Map; +import java.util.*; @Component public class ExecutorHolder { - private Map executors = new HashMap<>(); - @Resource - private ESCC225001Executor eSCC225001Executor; - @Resource - private ESCC225002Executor eSCC225002Executor; - @Resource - private ESCC225003Executor eSCC225003Executor; - @Resource - private ESCC225004Executor eSCC225004Executor; - @Resource - private ESCC2290001Executor eSCC2290001Executor; - @Resource - private ESCC2290002Executor eSCC2290002Executor; - @Resource - private ESCC2290003Executor eSCC2290003Executor; - @Resource - private ESCC2290004Executor eSCC2290004Executor; - @Resource - private ESCC2290005Executor eSCC2290005Executor; - @Resource - private ESCC2290006Executor eSCC2290006Executor; - @Resource - private ESCC2290007Executor eSCC2290007Executor; - @Resource - private ESCC2290008Executor eSCC2290008Executor; - @Resource - private ESCC2290009Executor eSCC2290009Executor; - @Resource - private GJB548C1Executor gjb548C1Executor; - @Resource - private GJB548C2Executor gJB548C2Executor; - @Resource - private GJB548C3Executor gJB548C3Executor; - @Resource - private GJB548C4Executor gJB548C4Executor; - @Resource - private GJB548C5Executor gJB548C5Executor; - @Resource - private GJB548C6Executor gJB548C6Executor; - @Resource - private GJB548C7Executor gJB548C7Executor; - @Resource - private GJB548C8Executor gJB548C8Executor; - @Resource - private GJB548C9Executor gJB548C9Executor; - @Resource - private GJB548C10Executor gJB548C10Executor; - @Resource - private GJB548C11Executor gJB548C11Executor; - @Resource - private GJB548C12Executor gJB548C12Executor; - @Resource - private GJB548C13Executor gJB548C13Executor; - @Resource - private GJB548C14Executor gJB548C14Executor; - @Resource - private GJB548C15Executor gJB548C15Executor; - @Resource - private GJB548C16Executor gJB548C16Executor; - @Resource - private QJ100041Executor qJ100041Executor; - @Resource - private QJ100042Executor qJ100042Executor; - @Resource - private QJ100043Executor qJ100043Executor; - @Resource - private QJ100044Executor qJ100044Executor; - @Resource - private QJ100045Executor qJ100045Executor; - @Resource - private QJ100046Executor qJ100046Executor; - @Resource - private QJ100047Executor qJ100047Executor; - @Resource - private QJ100048Executor qJ100048Executor; - @Resource - private QJ100049Executor qJ100049Executor; - @Resource - private QJ1000410Executor qJ1000410Executor; - @Resource - private QJ1000411Executor qJ1000411Executor; - @Resource - private QJ1000412Executor qJ1000412Executor; - @Resource - private QJ1000413Executor qJ1000413Executor; - @Resource - private QJ1000414Executor qJ1000414Executor; - @Resource - private QJ1000415Executor qJ1000415Executor; - @Resource - private QJ1000416Executor qJ1000416Executor; - @Resource - private QJ1000417Executor qJ1000417Executor; + private Map executorMap = new HashMap<>(); + @Autowired + private List executorList; @PostConstruct public void init() { - executors.put(ExperimentReviewProcessType.ESCC22500 + "1", eSCC225001Executor); - executors.put(ExperimentReviewProcessType.ESCC22500 + "2", eSCC225002Executor); - executors.put(ExperimentReviewProcessType.ESCC22500 + "3", eSCC225003Executor); - executors.put(ExperimentReviewProcessType.ESCC22500 + "4", eSCC225004Executor); - executors.put(ExperimentReviewProcessType.ESCC229000 + "1", eSCC2290001Executor); - executors.put(ExperimentReviewProcessType.ESCC229000 + "2", eSCC2290002Executor); - executors.put(ExperimentReviewProcessType.ESCC229000 + "3", eSCC2290003Executor); - executors.put(ExperimentReviewProcessType.ESCC229000 + "4", eSCC2290004Executor); - executors.put(ExperimentReviewProcessType.ESCC229000 + "5", eSCC2290005Executor); - executors.put(ExperimentReviewProcessType.ESCC229000 + "6", eSCC2290006Executor); - executors.put(ExperimentReviewProcessType.ESCC229000 + "7", eSCC2290007Executor); - executors.put(ExperimentReviewProcessType.ESCC229000 + "8", eSCC2290008Executor); - executors.put(ExperimentReviewProcessType.ESCC229000 + "9", eSCC2290009Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "1", gjb548C1Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "2", gJB548C2Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "3", gJB548C3Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "4", gJB548C4Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "5", gJB548C5Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "6", gJB548C6Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "7", gJB548C7Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "8", gJB548C8Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "9", gJB548C9Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "10", gJB548C10Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "11", gJB548C11Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "12", gJB548C12Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "13", gJB548C13Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "14", gJB548C14Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "15", gJB548C15Executor); - executors.put(ExperimentReviewProcessType.GJB548C + "16", gJB548C16Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "1", qJ100041Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "2", qJ100042Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "3", qJ100043Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "4", qJ100044Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "5", qJ100045Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "6", qJ100046Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "7", qJ100047Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "8", qJ100048Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "9", qJ100049Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "10", qJ1000410Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "11", qJ1000411Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "12", qJ1000412Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "13", qJ1000413Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "14", qJ1000414Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "15", qJ1000415Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "16", qJ1000416Executor); - executors.put(ExperimentReviewProcessType.QJ10004 + "17", qJ1000417Executor); + executorList.forEach(executor -> executorMap.put(executor.getProcessType() + executor.getPriority(), executor)); } public String execute(String processType, Experiment experiment, ExperimentSampleInfo sampleInfo) { - IExperimentReviewRuleExecutor executor = executors.get(processType); + IExperimentReviewRuleExecutor executor = executorMap.get(processType); if (executor == null) { return null; } diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentReviewServiceImpl.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentReviewServiceImpl.java index e26b554..304626c 100644 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentReviewServiceImpl.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentReviewServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; +import java.util.stream.Collectors; /** * @Description: 试验评定结果 @@ -60,12 +61,19 @@ public class ExperimentReviewServiceImpl extends ServiceImpl detailList = experimentReviewDetailService.getBySample(experimentId, sampleId); + List matchedRuleList = detailList.stream().map(v -> experimentReviewRuleService.getById(v.getRuleId())) + .filter(v -> v != null).collect(Collectors.toList()); + result.setMatchedRuleList(matchedRuleList); ExperimentReviewDetail first = CollUtil.getFirst(detailList); ExperimentReviewDetail last = CollUtil.getLast(detailList); if (detailList.size() > 1 && !StrUtil.equals(first.getResult(), last.getResult())) {