From 82fbcce60ae86965441ae045df1f864d10005d35 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期一, 21 八月 2023 17:59:46 +0800 Subject: [PATCH] 检验计划 --- inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionProductServiceImpl.java | 71 +---------------------------------- 1 files changed, 2 insertions(+), 69 deletions(-) diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionProductServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionProductServiceImpl.java index 7e63ffb..0c4f613 100644 --- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionProductServiceImpl.java +++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionProductServiceImpl.java @@ -1,14 +1,13 @@ package com.yuanchu.limslaboratory.service.impl; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; + import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yuanchu.limslaboratory.mapper.InspectionProductMapper; import com.yuanchu.limslaboratory.pojo.InspectionProduct; -import com.yuanchu.limslaboratory.pojo.vo.InsProductVo; import com.yuanchu.limslaboratory.service.InspectionProductService; import org.springframework.stereotype.Service; -import javax.annotation.Resource; + /** * 鐢宠鍗曚笅鐗╂枡涓殑椤圭洰(InspectionProduct)琛ㄦ湇鍔″疄鐜扮被 @@ -19,72 +18,6 @@ @Service public class InspectionProductServiceImpl extends ServiceImpl<InspectionProductMapper, InspectionProduct> implements InspectionProductService { - @Resource - InspectionProductMapper inspectionProductMapper; - /* //鏇存柊妫�楠岄」鐩� - @Override - public boolean updateInsProduct(Integer userId, InspectionProduct inspectionProduct) { - //璧嬪�兼楠屽憳id - inspectionProduct.setUserId(userId); - //鍒ゆ柇妫�娴嬪�兼槸鍚︽弧瓒虫爣鍑嗗�煎拰鍐呮帶鍊肩殑瑕佹眰,濡傛灉涓嶆弧瓒冲垯妫�楠岀粨璁轰负涓嶅悎鏍�0 - String testValue = inspectionProduct.getTestValue();//妫�楠屽�� - String required = inspectionProduct.getRequired();//鏍囧噯鍊� - String internal = inspectionProduct.getInternal();//鍐呮帶鍊� - inspectionProduct.setTestState(checkValues(required, internal, testValue)); - //鏍规嵁妫�楠岄」鐩悕鍜屽叧鑱旂殑妫�楠岀墿鏂檌d鏉ユ煡璇㈡楠岄」鐩殑鏁版嵁 - LambdaUpdateWrapper<InspectionProduct> updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(InspectionProduct::getInspectionMaterialId, inspectionProduct.getInspectionMaterialId()) - .eq(InspectionProduct::getName, inspectionProduct.getName()); - inspectionProductMapper.update(inspectionProduct, updateWrapper); - return true; - }*/ - - /*鍒ゆ柇妫�娴嬪�兼槸鍚︽弧瓒虫爣鍑嗗�煎拰鍐呮帶鍊肩殑瑕佹眰,濡傛灉涓嶆弧瓒冲垯妫�楠岀粨璁轰负涓嶅悎鏍�*/ - private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) { - boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); - boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr); - - if (isStandardValueSatisfied && isControlValueSatisfied) { - return 1; - } else { - return 0; - } - } - - private boolean isValueSatisfied(String valueStr, String detectionValueStr) { - String substring = valueStr.substring(1, 2); - if (substring.equals("=")) { - String operator = valueStr.substring(0, 2); - Double standardValue = Double.parseDouble(valueStr.substring(2)); - Double detectionValue = Double.parseDouble(detectionValueStr); - switch (operator) { - case ">=": - return detectionValue >= standardValue; - case "<=": - return detectionValue <= standardValue; - default: - return false; - } - } else { - String operator = valueStr.substring(0, 1); - Double standardValue = Double.parseDouble(valueStr.substring(1)); - Double detectionValue = Double.parseDouble(detectionValueStr); - switch (operator) { - case ">": - return detectionValue > standardValue; - case "鈮�": - return detectionValue >= standardValue; - case "鈮�": - return detectionValue <= standardValue; - case "<": - return detectionValue < standardValue; - case "=": - return detectionValue.equals(standardValue); - default: - return false; - } - } - } } -- Gitblit v1.9.3