FengChaoYu 10 mesi fa
parent
commit
a6bab6f476

+ 6 - 5
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/stock/WorkerStockLogic.java

@@ -123,6 +123,8 @@ public class WorkerStockLogic {
         final DateTime curDate = DateUtil.date();
         final String idStr = IdWorker.getIdStr();
 
+        String tipsGoodsName = websitGoodsTypeEnum.getKey().equals(WebsitGoodsTypeEnum.M.getKey()) ? "辅材" : "配件";
+
         for (int i = 0; i < datas.size(); i++) {
             List<String> row = (List<String>) datas.get(i);
             CommonUtils.initList(row, 10);
@@ -139,8 +141,7 @@ public class WorkerStockLogic {
                         .eq(WorkerGoods::getGoodsId, goodsId)
                         .one();
                 if (workerGoods == null) {
-                    String typeTipsStr = websitGoodsTypeEnum.getKey().equals(WebsitGoodsTypeEnum.M.getKey()) ? "辅材" : "配件";
-                    throw new RemoteServiceException(typeTipsStr + "编号【" + goodsId + "】不存在");
+                    throw new RemoteServiceException(tipsGoodsName + "编号【" + goodsId + "】不存在");
                 }
 
                 //判断师傅信息
@@ -157,7 +158,7 @@ public class WorkerStockLogic {
                         .eq(WorkerStock::getWorkerId, user.getUserId())
                         .eq(WorkerStock::getGoodsId, goodsId).count();
                 if (count > 0) {
-                    throw new RemoteServiceException("商品编号【" + goodsId + "】的库存记录已存在于系统,导入失败");
+                    throw new RemoteServiceException(tipsGoodsName + "编号【" + goodsId + "】的库存记录已存在于系统,导入失败");
                 }
 
                 WorkerStockDTO workerStockDTO = new WorkerStockDTO();
@@ -198,7 +199,7 @@ public class WorkerStockLogic {
                         .eq(WebsitGoods::getGoodsId, goodsId)
                         .one();
                 if (websitGoods == null) {
-                    throw new RemoteServiceException("商品编号【" + goodsId + "】不存在");
+                    throw new RemoteServiceException(tipsGoodsName + "编号【" + goodsId + "】不存在");
                 }
 
                 //判断师傅信息
@@ -216,7 +217,7 @@ public class WorkerStockLogic {
                         .eq(WorkerStock::getGoodsId, goodsId)
                         .count();
                 if (count > 0) {
-                    throw new RemoteServiceException("商品编号【" + goodsId + "】的库存记录已存在于系统,导入失败");
+                    throw new RemoteServiceException(tipsGoodsName + "编号【" + goodsId + "】的库存记录已存在于系统,导入失败");
                 }
                 WorkerStockDTO workerStockDTO = new WorkerStockDTO();
                 workerStockDTO.setCompanyWechatId(adminUser.getCompanyWechatId());