فهرست منبع

feat:后端添加校验

shc 8 ماه پیش
والد
کامیت
fc031294bf

+ 10 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmScorePackaeServiceImpl.java

@@ -1156,6 +1156,16 @@ public class WmScorePackaeServiceImpl extends ServiceImpl<WmScorePackageMapper,
                 return typeQty;
             }).collect(Collectors.toList());
 
+            long sum = collect.stream().mapToLong(ttq -> (long) ttq.getPrice() * ttq.getQty()).sum();
+
+            if (sum == 0L) {
+                throw new RuntimeException("拆解子项总分值为0,请核实");
+            }
+
+            if (sum - wmScorePackage.getScore() != 0L) {
+                throw new RuntimeException("拆解子项总分值" + sum + "与发包分值不想等,请核实");
+            }
+
             // 获取关联积分包的剩余用量
             if (relatedScoreId) {