From 20ad0135fc465913b4f5b7c2c0e61a572f382a9c Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期日, 28 九月 2025 16:24:43 +0800
Subject: [PATCH] 标准树结构去掉中天科技检测中心
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
index ca14986..7b74ae6 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -966,7 +966,7 @@
if (insProduct.getInspectionValueType().equals("1") && insProduct.getInsResult().equals(1)) {
List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName());
- if (insProductAnalysisDtoList.size() < 10) {
+ if (CollectionUtils.isEmpty(insProductAnalysisDtoList)) {
continue;
}
@@ -975,8 +975,10 @@
.collect(Collectors.toList());
double deviation = isDeviationOverTenPercent(laseValueList, insProduct.getLastValue());
+ // 鍒ゆ柇瑕佹眰鍊兼槸鍚﹀亸宸秴杩�10%
+ double asked = isDeviationOverTenPercentByAsked(insProduct.getAsk(), insProduct.getLastValue());
// 鍒ゆ柇鍋忓樊鏄惁澶т簬10
- if (deviation > 10) {
+ if (deviation > 10 || asked > 10) {
// 鍒ゆ柇涔嬪墠鏄惁娣诲姞杩�, 娣诲姞杩囦笉闇�瑕佹坊鍔�
long count = insProductDeviationWarningService.count(Wrappers.<InsProductDeviationWarning>lambdaQuery()
.eq(InsProductDeviationWarning::getInsProductId, insProduct.getId()));
@@ -1004,7 +1006,8 @@
deviationWarningDetail.setSupplierName(ifsInventoryQuantity.getSupplierName());
deviationWarningDetail.setTestValue(insProduct.getLastValue());
deviationWarningDetail.setDetectionTime(insProduct.getCreateTime());
- deviationWarningDetail.setIsIssue(1);
+ deviationWarningDetail.setIsIssue(deviation > 10 ? 1 : 0);
+ deviationWarningDetail.setIsIssueAsked(asked > 10 ? 1 : 0);
insProductAnalysisDtoList.add(deviationWarningDetail);
@@ -1067,6 +1070,24 @@
}
/**
+ * *****璁$畻鍋忓樊锛堣姹傚�硷級****
+ * @param asked
+ * @param targetStr
+ * @return
+ */
+ public static double isDeviationOverTenPercentByAsked(String asked, String targetStr) {
+ if(!isNumeric(asked)) return 0;
+ double average = Double.parseDouble(asked);
+ double target = Double.parseDouble(targetStr);
+ double deviationPercent = Math.abs(target - average) / average * 100;
+
+ // 淇濈暀涓や綅灏忔暟
+ DecimalFormat df = new DecimalFormat("#.00");
+ String formatted = df.format(deviationPercent);
+ return Double.parseDouble(formatted);
+ }
+
+ /**
* ******鍘熷璁板綍妯℃澘澶嶅埗*****
* @param orderId
* @param ids
--
Gitblit v1.9.3