FengChaoYu 1 ano atrás
pai
commit
5d46cd7892

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

@@ -125,18 +125,18 @@ public class NormChargeLogic {
             throw new RemoteServiceException("收费标准不能为空");
         }
 
-        if (Objects.isNull(bean.getSelfWorkerAmount())) {
-            if (bean.getNormType().equals(NormTypeEnum.M.getKey())) {
-                throw new RemoteServiceException("自有库存师傅分账金额不能为空");
-            } else {
-                throw new RemoteServiceException("师傅分账金额不能为空");
-            }
-        }
-
-        if (Objects.isNull(bean.getManualAmount())) {
-            throw new RemoteServiceException("师傅手工费用不能为空");
-        }
-
+//        if (Objects.isNull(bean.getSelfWorkerAmount())) {
+//            if (bean.getNormType().equals(NormTypeEnum.M.getKey())) {
+//                throw new RemoteServiceException("自有库存师傅分账金额不能为空");
+//            } else {
+//                throw new RemoteServiceException("师傅分账金额不能为空");
+//            }
+//        }
+//
+//        if (Objects.isNull(bean.getManualAmount())) {
+//            throw new RemoteServiceException("师傅手工费用不能为空");
+//        }
+//
 //        if (bean.getNormType().equals(NormTypeEnum.M.getKey()) && Objects.isNull(bean.getOutWorkerAmount())) {
 //            throw new RemoteServiceException("外购辅材师傅分账金额不能为空");
 //        }
@@ -156,7 +156,8 @@ public class NormChargeLogic {
                     }
                 }
 
-                selWorkerAmount = bean.getSelfWorkerAmount();
+//                selWorkerAmount = bean.getSelfWorkerAmount();
+                selWorkerAmount = bean.getNormAmount();
                 selWebsitAmount = bean.getNormAmount().subtract(selWorkerAmount);
             } else {
                 selWebsitAmount = bean.getNormAmount();
@@ -245,16 +246,16 @@ public class NormChargeLogic {
 
         for (int i = 0; i < objects.size(); i++) {
             List<Object> row = (List<Object>) objects.get(i);
-            if (row.size() < 8) {
+            if (row.size() < 6) {
                 row.add(null);
                 row.add(null);
                 row.add(null);
             }
-            if (row.size() < 9) {
+            if (row.size() < 7) {
                 row.add(null);
                 row.add(null);
             }
-            if (row.size() < 10) {
+            if (row.size() < 8) {
                 row.add(null);
             }
             if (Objects.isNull(row.get(0))) {
@@ -287,12 +288,12 @@ public class NormChargeLogic {
             String goodsNameStr = (String) row.get(2);
             String unitStr = (String) row.get(3);
             String salesStr = (String) row.get(4);
-            String amount1Str = (String) row.get(5);
+//            String amount1Str = (String) row.get(5);
 //            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);
+//            String manualAmountStr = (String) row.get(6);
+            String goodsCodeStr = (String) row.get(5);
+            String specificationStr = (String) row.get(6);
+            String remark = (String) row.get(7);
 
             if (!treeMap.containsKey(parentCategoryStr)) {
                 throw new RemoteServiceException("第" + (i+1) + "行, 大类信息不存在");
@@ -334,11 +335,12 @@ public class NormChargeLogic {
             goods.setSpecification(specificationStr);
             goods.setRemark(remark);
             goods.setNormAmount(new BigDecimal(salesStr));
-            goods.setSelfWorkerAmount(new BigDecimal(amount1Str));
-            goods.setSelfWebsitAmount(goods.getNormAmount().subtract(new BigDecimal(amount1Str)));
+            goods.setSelfWorkerAmount(goods.getNormAmount());
+//            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.setManualAmount(new BigDecimal(manualAmountStr));
+//            goods.setManualAmount(new BigDecimal(manualAmountStr));
             goods.setUnit(unitStr);
             goods.setNormType(NormTypeEnum.M.getKey());
 
@@ -384,16 +386,16 @@ public class NormChargeLogic {
 
         for (int i = 0; i < objects.size(); i++) {
             List<Object> row = (List<Object>) objects.get(i);
-            if (row.size() < 8) {
+            if (row.size() < 6) {
                 row.add(null);
                 row.add(null);
                 row.add(null);
             }
-            if (row.size() < 9) {
+            if (row.size() < 7) {
                 row.add(null);
                 row.add(null);
             }
-            if (row.size() < 10) {
+            if (row.size() < 8) {
                 row.add(null);
             }
             if (Objects.isNull(row.get(0))) {
@@ -411,23 +413,23 @@ public class NormChargeLogic {
             if (Objects.isNull(row.get(4))) {
                 throw new RemoteServiceException("第" + (i+1) + "行, 收费标准不能为空");
             }
-            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(5))) {
+//                throw new RemoteServiceException("第" + (i+1) + "行, 师傅分账金额不能为空");
+//            }
+//            if (Objects.isNull(row.get(6))) {
+//                throw new RemoteServiceException("第" + (i+1) + "行, 师傅手工费用不能为空");
+//            }
 
             String parentCategoryStr = (String) row.get(0);
             String categoryStr = (String) row.get(1);
             String goodsNameStr = (String) row.get(2);
             String unitStr = (String) row.get(3);
             String salesStr = (String) row.get(4);
-            String amount1Str = (String) row.get(5);
-            String manualAmountStr = (String) row.get(6);
-            String goodsCodeStr = (String) row.get(7);
-            String specificationStr = (String) row.get(8);
-            String remark = (String) row.get(9);
+//            String amount1Str = (String) row.get(5);
+//            String manualAmountStr = (String) row.get(6);
+            String goodsCodeStr = (String) row.get(5);
+            String specificationStr = (String) row.get(6);
+            String remark = (String) row.get(7);
 
             if (!treeMap.containsKey(parentCategoryStr)) {
                 throw new RemoteServiceException("第" + (i+1) + "行, 大类信息不存在");
@@ -469,9 +471,10 @@ public class NormChargeLogic {
             goods.setSpecification(specificationStr);
             goods.setRemark(remark);
             goods.setNormAmount(new BigDecimal(salesStr));
-            goods.setSelfWorkerAmount(new BigDecimal(amount1Str));
-            goods.setSelfWebsitAmount(goods.getNormAmount().subtract(new BigDecimal(amount1Str)));
-            goods.setManualAmount(new BigDecimal(manualAmountStr));
+            goods.setSelfWorkerAmount(goods.getNormAmount());
+//            goods.setSelfWorkerAmount(new BigDecimal(amount1Str));
+//            goods.setSelfWebsitAmount(goods.getNormAmount().subtract(new BigDecimal(amount1Str)));
+//            goods.setManualAmount(new BigDecimal(manualAmountStr));
             goods.setUnit(unitStr);
             goods.setNormType(NormTypeEnum.S.getKey());
 

+ 64 - 62
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/base/WebsitGoodsLogic.java

@@ -142,9 +142,7 @@ public class WebsitGoodsLogic {
 
         WebsitGoods goods = new WebsitGoods();
         BeanUtils.copyProperties(bean, goods);
-        // 库存单位与销售单位一致
-        goods.setGoodsSalesUnit(goods.getGoodsStockUnit());
-//        goods.setManageWorkerStock(JudgeEnum.YES.getKey());
+
         if (StringUtils.isBlank(goods.getNormType())) {
             goods.setNormType(NormTypeEnum.M.getKey());
         }
@@ -187,21 +185,28 @@ public class WebsitGoodsLogic {
     }
 
     private void stockUnitEmptyAdd(WebsitGoods goods) {
-        if (StringUtils.isNotBlank(goods.getGoodsStockUnit())) {
+        if (goods.getGoodsType().equals(WebsitGoodsTypeEnum.M.getKey())) {
+            if (StringUtils.isNotBlank(goods.getGoodsStockUnit())) {
+                throw new RemoteServiceException("库存单位不能为空");
+            }
+            if (StringUtils.isNotBlank(goods.getGoodsSalesUnit())) {
+                throw new RemoteServiceException("销售单位不能为空");
+            }
+        }
 
-            String type = goods.getGoodsType().equals(WebsitGoodsTypeEnum.M.getKey()) ? "ASSIST_UNIT" : "PARTS_UNIT";
-            Integer count = sysDictCompanyService.lambdaQuery()
-                    .eq(SysDictCompany::getDictType, type)
-                    .eq(SysDictCompany::getDictValue, goods.getGoodsStockUnit())
-                    .count();
+        String type = goods.getGoodsType().equals(WebsitGoodsTypeEnum.M.getKey()) ? "ASSIST_UNIT" : "PARTS_UNIT";
+        Integer count = sysDictCompanyService.lambdaQuery()
+                .eq(SysDictCompany::getDictType, type)
+                .eq(SysDictCompany::getDictValue, goods.getGoodsStockUnit())
+                .count();
 
-            if (count == 0) {
-                SysDictCompany company = new SysDictCompany();
-                company.setDictType(type)
-                        .setDictValue(goods.getGoodsStockUnit());
-                sysDictCompanyLogic.saveOpenDict(company);
-            }
+        if (count == 0) {
+            SysDictCompany company = new SysDictCompany();
+            company.setDictType(type)
+                    .setDictValue(goods.getGoodsStockUnit());
+            sysDictCompanyLogic.saveOpenDict(company);
         }
+
     }
 
     private void handlePartsInfo(HttpServletRequest request, WebsitGoods goods, WebsitGoodsBean bean) {
@@ -273,44 +278,44 @@ public class WebsitGoodsLogic {
             if (goods.getNormType().equals(NormTypeEnum.M.getKey()) && Objects.isNull(goods.getNormAmount())) {
                 throw new RemoteServiceException("收费标准不能为空");
             }
-
-            if (Objects.isNull(goods.getSelfWorkerAmount())) {
-                if (goods.getNormType().equals(NormTypeEnum.M.getKey())) {
-                    throw new RemoteServiceException("自有库存师傅分账金额不能为空");
-                } else {
-                    throw new RemoteServiceException("师傅分账比例不能为空");
-                }
-            }
+//
+//            if (Objects.isNull(goods.getSelfWorkerAmount())) {
+//                if (goods.getNormType().equals(NormTypeEnum.M.getKey())) {
+//                    throw new RemoteServiceException("自有库存师傅分账金额不能为空");
+//                } else {
+//                    throw new RemoteServiceException("师傅分账比例不能为空");
+//                }
+//            }
 
 //            if (goods.getNormType().equals(NormTypeEnum.M.getKey()) && Objects.isNull(goods.getOutWorkerAmount())) {
 //                throw new RemoteServiceException("外购配件师傅分账金额不能为空");
 //            }
 
             // 检查收费标准和分账金额
-            BigDecimal selWorkerAmount = BigDecimal.ZERO;
+            BigDecimal selWorkerAmount = goods.getNormAmount();
             BigDecimal selWebsitAmount = BigDecimal.ZERO;
 //            BigDecimal outWorkerAmount = BigDecimal.ZERO;
 //            BigDecimal outWebsitAmount = BigDecimal.ZERO;
-            if (goods.getNormType().equals(NormTypeEnum.M.getKey())) {
-                if (goods.getSelfWorkerAmount().compareTo(BigDecimal.ZERO) > 0) {
-
-                    if (goods.getSelfWorkerAmount().compareTo(goods.getNormAmount()) > 0) {
-                        throw new RemoteServiceException("自有库存师傅分账金额不能大于收费标准");
-                    }
-
-                    selWorkerAmount = goods.getSelfWorkerAmount();
-                    selWebsitAmount = goods.getNormAmount().subtract(selWorkerAmount);
-                } else {
-                    selWebsitAmount = goods.getNormAmount();
-                }
-
-            } else {
-                if (goods.getSelfWorkerAmount().add(goods.getSelfWebsitAmount()).compareTo(BigDecimal.valueOf(100)) > 0) {
-                    throw new RemoteServiceException("分账比例不能大于100%");
-                }
-                selWorkerAmount = goods.getSelfWorkerAmount();
-                selWebsitAmount = goods.getSelfWebsitAmount();
-            }
+//            if (goods.getNormType().equals(NormTypeEnum.M.getKey())) {
+//                if (goods.getSelfWorkerAmount().compareTo(BigDecimal.ZERO) > 0) {
+//
+//                    if (goods.getSelfWorkerAmount().compareTo(goods.getNormAmount()) > 0) {
+//                        throw new RemoteServiceException("自有库存师傅分账金额不能大于收费标准");
+//                    }
+//
+//                    selWorkerAmount = goods.getSelfWorkerAmount();
+//                    selWebsitAmount = goods.getNormAmount().subtract(selWorkerAmount);
+//                } else {
+//                    selWebsitAmount = goods.getNormAmount();
+//                }
+//
+//            } else {
+//                if (goods.getSelfWorkerAmount().add(goods.getSelfWebsitAmount()).compareTo(BigDecimal.valueOf(100)) > 0) {
+//                    throw new RemoteServiceException("分账比例不能大于100%");
+//                }
+//                selWorkerAmount = goods.getSelfWorkerAmount();
+//                selWebsitAmount = goods.getSelfWebsitAmount();
+//            }
 
 //            if (Objects.nonNull(goods.getOutWorkerAmount())
 //                    && goods.getOutWorkerAmount().compareTo(BigDecimal.ZERO) > 0) {
@@ -345,9 +350,6 @@ public class WebsitGoodsLogic {
         BeanUtils.copyProperties(bean, goods);
         goods.setCompanyWechatId(oldGoods.getCompanyWechatId())
                 .setCompanyWechatName(oldGoods.getCompanyWechatName());
-        // 库存单位与销售单位一致
-        goods.setGoodsSalesUnit(goods.getGoodsStockUnit());
-//        goods.setManageWorkerStock(JudgeEnum.YES.getKey());
 
         if (StringUtils.isNotBlank(goods.getGoodsCategoryId())) {
             WebsitGoodsCategory category = websitGoodsCategoryService.getById(goods.getGoodsCategoryId());
@@ -565,11 +567,11 @@ public class WebsitGoodsLogic {
         for (int i = 0; i < objects.size(); i++) {
             List<Object> row = (List<Object>) objects.get(i);
             CommonUtils.initList2(row, 11);
-            if (row.size() < 8) {
+            if (row.size() < 7) {
                 row.add(null);
                 row.add(null);
             }
-            if (row.size() < 9) {
+            if (row.size() < 8) {
                 row.add(null);
             }
             if (Objects.isNull(row.get(0))) {
@@ -590,9 +592,9 @@ public class WebsitGoodsLogic {
             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) + "行, 外购库存师傅分账金额不能为空");
 //            }
@@ -603,10 +605,10 @@ public class WebsitGoodsLogic {
             String normAmountStr = (String) row.get(3);
             String brandStr = (String) row.get(4);
             String categoryStr = (String) row.get(5);
-            String selfAmountStr = (String) row.get(6);
+//            String selfAmountStr = (String) row.get(6);
             String partType = (String) row.get(7);
-            String goodsCodeStr = (String) row.get(8);
-            String remark = (String) row.get(9);
+            String goodsCodeStr = (String) row.get(7);
+            String remark = (String) row.get(8);
 
 //            Integer count = websitGoodsService.lambdaQuery()
 //                    .eq(WebsitGoods::getCompanyWechatId, companyWechatId)
@@ -646,12 +648,12 @@ public class WebsitGoodsLogic {
             }
 
             BigDecimal normAmount = new BigDecimal(normAmountStr);
-            BigDecimal selfAmount = new BigDecimal(selfAmountStr);
+//            BigDecimal selfAmount = new BigDecimal(selfAmountStr);
 //            BigDecimal outAmount = new BigDecimal(outAmountStr);
-
-            if (selfAmount.compareTo(normAmount) > 0) {
-                throw new RemoteServiceException("第" + (i + 1) + "行, 自有库存师傅分账金额不能大于收费标准");
-            }
+//
+//            if (selfAmount.compareTo(normAmount) > 0) {
+//                throw new RemoteServiceException("第" + (i + 1) + "行, 自有库存师傅分账金额不能大于收费标准");
+//            }
 
             if (!"空调-冰箱-生活电器".contains(partType)) {
                 throw new RemoteServiceException("第" + (i + 1) + "行, 配件类型错误");
@@ -668,8 +670,8 @@ public class WebsitGoodsLogic {
             goods.setRemark(remark);
             goods.setMarketPrice(new BigDecimal(salesStr));
             goods.setNormAmount(normAmount);
-            goods.setSelfWorkerAmount(selfAmount);
-            goods.setSelfWebsitAmount(normAmount.subtract(selfAmount));
+            goods.setSelfWorkerAmount(normAmount);
+//            goods.setSelfWebsitAmount(normAmount.subtract(selfAmount));
 //            goods.setOutWorkerAmount(outAmount);
 //            goods.setOutWebsitAmount(normAmount.subtract(outAmount));
             goods.setBrandRelaName(brandStr);

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


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


BIN
mall-server-api/src/main/resources/template/配件模板(服务收费).xlsx


BIN
mall-server-api/src/main/resources/template/配件模板(配件物料).xlsx