Browse Source

辅材收费标准去掉外购检查与逻辑

FengChaoYu 10 months ago
parent
commit
8209f29a4a

+ 33 - 32
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/base/NormChargeLogic.java

@@ -118,15 +118,15 @@ public class NormChargeLogic {
             throw new RemoteServiceException("师傅手工费用不能为空");
         }
 
-        if (bean.getNormType().equals(NormTypeEnum.M.getKey()) && Objects.isNull(bean.getOutWorkerAmount())) {
-            throw new RemoteServiceException("外购辅材师傅分账金额不能为空");
-        }
+//        if (bean.getNormType().equals(NormTypeEnum.M.getKey()) && Objects.isNull(bean.getOutWorkerAmount())) {
+//            throw new RemoteServiceException("外购辅材师傅分账金额不能为空");
+//        }
         // 检查收费标准和分账金额
         if (bean.getNormAmount().compareTo(BigDecimal.ZERO) > 0) {
             BigDecimal selWorkerAmount = BigDecimal.ZERO;
             BigDecimal selWebsitAmount = BigDecimal.ZERO;
-            BigDecimal outWorkerAmount = BigDecimal.ZERO;
-            BigDecimal outWebsitAmount = BigDecimal.ZERO;
+//            BigDecimal outWorkerAmount = BigDecimal.ZERO;
+//            BigDecimal outWebsitAmount = BigDecimal.ZERO;
 
             if (bean.getSelfWorkerAmount().compareTo(BigDecimal.ZERO) > 0) {
                 if (bean.getSelfWorkerAmount().compareTo(bean.getNormAmount()) > 0) {
@@ -143,19 +143,20 @@ public class NormChargeLogic {
                 selWebsitAmount = bean.getNormAmount();
             }
 
-            if (bean.getOutWorkerAmount().compareTo(BigDecimal.ZERO) > 0) {
-                if (bean.getOutWorkerAmount().compareTo(bean.getNormAmount()) > 0) {
-                    throw new RemoteServiceException("外购辅材师傅分账金额不能大于收费标准");
-                }
-                outWorkerAmount = bean.getOutWorkerAmount();
-                outWebsitAmount = bean.getNormAmount().subtract(outWorkerAmount);
-            } else {
-                outWebsitAmount = bean.getNormAmount();
-            }
+//            if (bean.getOutWorkerAmount().compareTo(BigDecimal.ZERO) > 0) {
+//                if (bean.getOutWorkerAmount().compareTo(bean.getNormAmount()) > 0) {
+//                    throw new RemoteServiceException("外购辅材师傅分账金额不能大于收费标准");
+//                }
+//                outWorkerAmount = bean.getOutWorkerAmount();
+//                outWebsitAmount = bean.getNormAmount().subtract(outWorkerAmount);
+//            } else {
+//                outWebsitAmount = bean.getNormAmount();
+//            }
             bean.setSelfWorkerAmount(selWorkerAmount)
                     .setSelfWebsitAmount(selWebsitAmount)
-                    .setOutWorkerAmount(outWorkerAmount)
-                    .setOutWebsitAmount(outWebsitAmount);
+//                    .setOutWorkerAmount(outWorkerAmount)
+//                    .setOutWebsitAmount(outWebsitAmount)
+            ;
         }
     }
 
@@ -213,16 +214,16 @@ public class NormChargeLogic {
 
         for (int i = 0; i < objects.size(); i++) {
             List<Object> row = (List<Object>) objects.get(i);
-            if (row.size() < 9) {
+            if (row.size() < 8) {
                 row.add(null);
                 row.add(null);
                 row.add(null);
             }
-            if (row.size() < 10) {
+            if (row.size() < 9) {
                 row.add(null);
                 row.add(null);
             }
-            if (row.size() < 11) {
+            if (row.size() < 10) {
                 row.add(null);
             }
             if (Objects.isNull(row.get(0))) {
@@ -243,10 +244,10 @@ public class NormChargeLogic {
             if (Objects.isNull(row.get(5))) {
                 throw new RemoteServiceException("第" + (i+1) + "行, 自有库存师傅分账金额不能为空");
             }
+//            if (Objects.isNull(row.get(6))) {
+//                throw new RemoteServiceException("第" + (i+1) + "行, 外购辅材师傅分账金额不能为空");
+//            }
             if (Objects.isNull(row.get(6))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 外购辅材师傅分账金额不能为空");
-            }
-            if (Objects.isNull(row.get(7))) {
                 throw new RemoteServiceException("第" + (i+1) + "行, 师傅手工费用不能为空");
             }
 
@@ -256,11 +257,11 @@ public class NormChargeLogic {
             String unitStr = (String) row.get(3);
             String salesStr = (String) row.get(4);
             String amount1Str = (String) row.get(5);
-            String amount2Str = (String) row.get(6);
-            String manualAmountStr = (String) row.get(7);
-            String goodsCodeStr = (String) row.get(8);
-            String specificationStr = (String) row.get(9);
-            String remark = (String) row.get(10);
+//            String amount2Str = (String) row.get(6);
+            String manualAmountStr = (String) row.get(6);
+            String goodsCodeStr = (String) row.get(7);
+            String specificationStr = (String) row.get(8);
+            String remark = (String) row.get(9);
 
             if (!treeMap.containsKey(parentCategoryStr)) {
                 throw new RemoteServiceException("第" + (i+1) + "行, 大类信息不存在");
@@ -304,8 +305,8 @@ public class NormChargeLogic {
             goods.setNormAmount(new BigDecimal(salesStr));
             goods.setSelfWorkerAmount(new BigDecimal(amount1Str));
             goods.setSelfWebsitAmount(goods.getNormAmount().subtract(new BigDecimal(amount1Str)));
-            goods.setOutWorkerAmount(new BigDecimal(amount2Str));
-            goods.setOutWebsitAmount(goods.getNormAmount().subtract(new BigDecimal(amount2Str)));
+//            goods.setOutWorkerAmount(new BigDecimal(amount2Str));
+//            goods.setOutWebsitAmount(goods.getNormAmount().subtract(new BigDecimal(amount2Str)));
             goods.setManualAmount(new BigDecimal(manualAmountStr));
             goods.setUnit(unitStr);
             goods.setNormType(NormTypeEnum.M.getKey());
@@ -314,9 +315,9 @@ public class NormChargeLogic {
                 throw new RemoteServiceException("第" + (i+1) + "行, 自有库存师傅分账金额不能大于收费标准");
             }
 
-            if (goods.getOutWorkerAmount().compareTo(goods.getNormAmount()) > 0) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 外购辅材师傅分账金额不能大于收费标准");
-            }
+//            if (goods.getOutWorkerAmount().compareTo(goods.getNormAmount()) > 0) {
+//                throw new RemoteServiceException("第" + (i+1) + "行, 外购辅材师傅分账金额不能大于收费标准");
+//            }
 
             goodsList.add(goods);
         }

BIN
mall-server-api/src/main/resources/template/辅材收费标准模板(物料收费).xlsx