FengChaoYu 9 mesiacov pred
rodič
commit
ea519e25c6

+ 4 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/listvo/material/WebsitStockPVO.java

@@ -1,6 +1,7 @@
 package com.gree.mall.manager.bean.listvo.material;
 
 import com.gree.mall.manager.annotation.ZfireField;
+import com.gree.mall.manager.enums.material.PartsApplyCategoryEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -38,6 +39,9 @@ public class WebsitStockPVO {
     @ApiModelProperty("配件编码")
     private String goodsCode;
     @ZfireField(tbName = "b")
+    @ApiModelProperty("配件类型")
+    private PartsApplyCategoryEnum partType;
+    @ZfireField(tbName = "b")
     @ApiModelProperty("适用品牌")
     private String brandRelaName;
     @ZfireField(tbName = "b")

+ 3 - 2
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/MaterialMapper.java

@@ -15,7 +15,6 @@ import com.gree.mall.manager.bean.material.vender.WebsitVenderVO;
 import com.gree.mall.manager.bean.material.worker.NewRefundManageVO;
 import com.gree.mall.manager.bean.material.worker.OldRefundManageRecordBean;
 import com.gree.mall.manager.bean.material.worker.OldRefundManageVO;
-import com.gree.mall.manager.plus.entity.WebsitPartsSalesItem;
 import com.gree.mall.manager.zfire.bean.PartsParamBean;
 import com.gree.mall.manager.zfire.bean.WebsitGoodsParamBean;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
@@ -142,6 +141,7 @@ public interface MaterialMapper {
      * @param categoryId
      * @param goodsName
      * @param goodsSpecification
+     * @param partType
      * @return
      */
     List<WebsitSalesGoodsVO> existStockGoods(@Param("companyWechatId") String companyWechatId,
@@ -149,7 +149,8 @@ public interface MaterialMapper {
                                              @Param("goodsType") String goodsType,
                                              @Param("categoryId") String categoryId,
                                              @Param("goodsName") String goodsName,
-                                             @Param("goodsSpecification") String goodsSpecification);
+                                             @Param("goodsSpecification") String goodsSpecification,
+                                             @Param("partType") String partType);
 
     /**
      * 查询配件

+ 15 - 13
mall-server-api/src/main/java/com/gree/mall/manager/controller/material/manage/WebsitSalesController.java

@@ -40,7 +40,7 @@ import java.util.concurrent.locks.Lock;
 
 @Slf4j
 @RestController
-@Api(value = "网点销售管理API", tags ={"网点销售管理API"} )
+@Api(value = "网点销售管理API", tags = {"网点销售管理API"})
 @Validated
 @RequestMapping(value = "/websit/sales", produces = "application/json; charset=utf-8")
 public class WebsitSalesController {
@@ -59,7 +59,8 @@ public class WebsitSalesController {
             @RequestBody WebsitSalesParamBean zfireParamBean
     ) {
         IPage<WebsitSalesVO> page = websitSalesLogic.page(zfireParamBean);
-        return ResponseHelper.success(page, new TypeReference<WebsitSalesVO>() {});
+        return ResponseHelper.success(page, new TypeReference<WebsitSalesVO>() {
+        });
     }
 
     @PostMapping("/list/export")
@@ -103,7 +104,7 @@ public class WebsitSalesController {
             if (obtain.tryLock(5, TimeUnit.SECONDS)) {
                 websitSalesLogic.edit(bean);
             }
-        } catch(Exception e) {
+        } catch (Exception e) {
             log.error("【销售订单处理】失败", e);
             throw e;
         } finally {
@@ -126,7 +127,7 @@ public class WebsitSalesController {
             if (obtain.tryLock(5, TimeUnit.SECONDS)) {
                 websitSalesLogic.submit(salesId, price, urlPrc, remark);
             }
-        } catch(Exception e) {
+        } catch (Exception e) {
             log.error("【销售订单处理】失败", e);
             throw e;
         } finally {
@@ -146,7 +147,7 @@ public class WebsitSalesController {
             if (obtain.tryLock(5, TimeUnit.SECONDS)) {
                 websitSalesLogic.changeCash(salesId);
             }
-        } catch(Exception e) {
+        } catch (Exception e) {
             log.error("【销售订单处理】失败", e);
             throw e;
         } finally {
@@ -167,7 +168,7 @@ public class WebsitSalesController {
             if (obtain.tryLock(5, TimeUnit.SECONDS)) {
                 websitSalesLogic.confirm(salesId, storageId);
             }
-        } catch(Exception e) {
+        } catch (Exception e) {
             log.error("【销售订单处理】失败", e);
             throw e;
         } finally {
@@ -195,7 +196,7 @@ public class WebsitSalesController {
             @ApiParam(value = "商品类型", required = true) @RequestParam WebsitGoodsTypeEnum type,
             @ApiParam(value = "商品名称") @RequestParam(required = false) String goodsName,
             @ApiParam(value = "工程基础资料id") @RequestParam(required = false) String orderEnginBaseId
-            ) throws RemoteServiceException {
+    ) throws RemoteServiceException {
         List<WebsitSalesGoodsVO> list = websitSalesLogic.existStockGoods(saleType, websitId, categoryId, type, goodsName, orderEnginBaseId);
         return ResponseHelper.success(list);
     }
@@ -207,9 +208,10 @@ public class WebsitSalesController {
             @ApiParam(value = "分类id", required = false) @RequestParam(required = false) String categoryId,
             @ApiParam(value = "商品类型", required = false) @RequestParam WebsitGoodsTypeEnum type,
             @ApiParam(value = "商品名称") @RequestParam(required = false) String goodsName,
-            @ApiParam(value = "规格") @RequestParam(required = false) String goodsSpecification
+            @ApiParam(value = "规格") @RequestParam(required = false) String goodsSpecification,
+            @ApiParam(value = "配件类型") @RequestParam(required = false) String partType
     ) throws RemoteServiceException {
-        List<WebsitSalesGoodsVO> list = websitSalesLogic.existStockGoodsList(websitId, categoryId, type, goodsName,goodsSpecification);
+        List<WebsitSalesGoodsVO> list = websitSalesLogic.existStockGoodsList(websitId, categoryId, type, goodsName, goodsSpecification, partType);
         return ResponseHelper.success(list);
     }
 
@@ -226,7 +228,7 @@ public class WebsitSalesController {
 
     @PostMapping("/m/import")
     @ApiOperation(value = "网点销售订单-导入辅材(下载模板:辅材销售订单导入模板.xlsx)")
-    public ResponseHelper<String> importMaterialData (
+    public ResponseHelper<String> importMaterialData(
             @RequestPart("file") MultipartFile file
     ) throws Exception {
         AdminUserCom adminUser = commonLogic.getAdminUser();
@@ -240,7 +242,7 @@ public class WebsitSalesController {
             if (obtain.tryLock(5, TimeUnit.SECONDS)) {
                 batchId = websitSalesLogic.importMaterialData(file);
             }
-        } catch(Exception e) {
+        } catch (Exception e) {
             log.error("【导入辅材销售处理】失败", e);
             throw e;
         } finally {
@@ -252,7 +254,7 @@ public class WebsitSalesController {
 
     @PostMapping("/p/import")
     @ApiOperation(value = "网点销售订单-导入配件(下载模板:配件销售订单导入模板.xlsx)")
-    public ResponseHelper<String> importPartsData (
+    public ResponseHelper<String> importPartsData(
             @RequestPart("file") MultipartFile file
     ) throws Exception {
         AdminUserCom adminUser = commonLogic.getAdminUser();
@@ -266,7 +268,7 @@ public class WebsitSalesController {
             if (obtain.tryLock(5, TimeUnit.SECONDS)) {
                 batchId = websitSalesLogic.importPartsData(file);
             }
-        } catch(Exception e) {
+        } catch (Exception e) {
             log.error("【导入配件销售处理】失败", e);
             throw e;
         } finally {

+ 40 - 38
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/manage/WebsitSalesLogic.java

@@ -82,7 +82,7 @@ public class WebsitSalesLogic {
         FieldUtils.materialParam(zfireParamBean, WebsitSalesVO.class, adminUser);
 
         return materialMapper.websitSalesPage(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean,
-                zfireParamBean.getGoodsName(),zfireParamBean.getGoodsSpecification(),zfireParamBean.getIsFilter());
+                zfireParamBean.getGoodsName(), zfireParamBean.getGoodsSpecification(), zfireParamBean.getIsFilter());
 
     }
 
@@ -123,7 +123,7 @@ public class WebsitSalesLogic {
         }
 
         if (bean.getFlag().equals(MaterialSalesFlagEnum.PAY_NOT_TAKE.getKey())
-                || bean.getFlag().equals(MaterialSalesFlagEnum.PAY_TAKE.getKey()) ) {
+                || bean.getFlag().equals(MaterialSalesFlagEnum.PAY_TAKE.getKey())) {
             WebsitSalesPayOrder order = websitSalesPayOrderService.lambdaQuery()
                     .eq(WebsitSalesPayOrder::getCompanyWechatId, sales.getCompanyWechatId())
                     .eq(WebsitSalesPayOrder::getWebsitId, sales.getWebsitId())
@@ -307,7 +307,7 @@ public class WebsitSalesLogic {
             }
 
             item.setConvertQty(convertQty)
-                .setConvertPrice(convertPrice);
+                    .setConvertPrice(convertPrice);
         }
 
     }
@@ -430,7 +430,7 @@ public class WebsitSalesLogic {
                 price = sales.getTotalAmount();
             }
 
-            if(Objects.nonNull(price)) {
+            if (Objects.nonNull(price)) {
 
                 if (price.compareTo(new BigDecimal("0")) == -1)
                     throw new RemoteServiceException("金额不能为负数");
@@ -440,7 +440,7 @@ public class WebsitSalesLogic {
             }
 
 
-            websitGoodsMangerLogic.upManage(sales.getOrderEnginBaseId(),sales.getGoodsType());
+            websitGoodsMangerLogic.upManage(sales.getOrderEnginBaseId(), sales.getGoodsType());
 
         }
     }
@@ -457,7 +457,7 @@ public class WebsitSalesLogic {
             throw new RemoteServiceException("销售单为\"" + flagEnum.getRemark() + "\"状态,不能确认提货");
         }
 
-        if ((sales.getIsImport() || sales.getOrderSource().equals(SourceSalesEnum.ONLINE.getKey())) && StringUtils.isBlank(storageId) ) {
+        if ((sales.getIsImport() || sales.getOrderSource().equals(SourceSalesEnum.ONLINE.getKey())) && StringUtils.isBlank(storageId)) {
             throw new RemoteServiceException("请选择仓库");
         }
         Storage storage = null;
@@ -497,6 +497,7 @@ public class WebsitSalesLogic {
 
     /**
      * 改变支付方式 (师傅在线下单后改变现金)
+     *
      * @param salesId
      */
     public void changeCash(String salesId) {
@@ -556,11 +557,11 @@ public class WebsitSalesLogic {
         }
 
         if (saleType.equals(WebsitSalesTypeEnum.ENGIN.getName()) && StringUtils.isBlank(orderEnginBaseId)) {
-                throw new RemoteServiceException("请先选择工程基础资料");
+            throw new RemoteServiceException("请先选择工程基础资料");
         }
         List<WebsitSalesGoodsVO> goodsList;
         if (type.getKey().equals(WebsitGoodsTypeEnum.M.getKey())) {
-            goodsList = materialMapper.existStockGoods(companyId, websitId, type.getKey(), categoryId, goodsName, null);
+            goodsList = materialMapper.existStockGoods(companyId, websitId, type.getKey(), categoryId, goodsName, null, partType);
         } else {
             goodsList = materialMapper.notStockGoods(companyId, websitId, type.getKey(), goodsName);
         }
@@ -649,7 +650,7 @@ public class WebsitSalesLogic {
 
 
     public List<WebsitSalesGoodsVO> existStockGoodsList(String websitId, String categoryId, WebsitGoodsTypeEnum type,
-                                                        String goodsName, String goodsSpecification) {
+                                                        String goodsName, String goodsSpecification, String partType) {
 
         AdminUserCom adminUser = commonLogic.getAdminUser();
         String companyId = "";
@@ -657,7 +658,7 @@ public class WebsitSalesLogic {
             companyId = adminUser.getAdminCompanyWechat().getCompanyWechatId();
         }
 
-        List<WebsitSalesGoodsVO> goodsList = materialMapper.existStockGoods(companyId, websitId, type.getKey(), categoryId, goodsName,goodsSpecification);
+        List<WebsitSalesGoodsVO> goodsList = materialMapper.existStockGoods(companyId, websitId, type.getKey(), categoryId, goodsName, goodsSpecification, partType);
         if (CollectionUtil.isNotEmpty(goodsList) && WebsitGoodsTypeEnum.P.getKey().equals(type.getKey())) {
             for (WebsitSalesGoodsVO vo : goodsList) {
                 this.computeSalesPrice(companyId, vo);
@@ -732,10 +733,10 @@ public class WebsitSalesLogic {
                 .collect(Collectors.toMap(AdminWebsit::getName, Function.identity()));
 
         Map<String, User> userMap = userList.stream()
-                    .collect(Collectors.toMap(User::getMobile, Function.identity(), (k1, k2) -> k2));
+                .collect(Collectors.toMap(User::getMobile, Function.identity(), (k1, k2) -> k2));
 
         Map<String, User> existUserMap = userList.stream()
-                    .collect(Collectors.toMap(User::getUserId, Function.identity()));
+                .collect(Collectors.toMap(User::getUserId, Function.identity()));
 
         Map<String, WebsitGoodsCategory> categoryMap = categoryList.stream()
                 .collect(Collectors.toMap(WebsitGoodsCategory::getCategoryId, Function.identity()));
@@ -772,19 +773,19 @@ public class WebsitSalesLogic {
             }
 
             if (Objects.isNull(row.get(0))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 网点名称不能为空");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 网点名称不能为空");
             }
             if (Objects.isNull(row.get(1))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 师傅联系电话不能为空");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 师傅联系电话不能为空");
             }
             if (Objects.isNull(row.get(2))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 辅材名称不能为空");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 辅材名称不能为空");
             }
             if (Objects.isNull(row.get(3))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 数量不能为空");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 数量不能为空");
             }
             if (Objects.isNull(row.get(4))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 销售价格不能为空");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 销售价格不能为空");
             }
 //            if (Objects.isNull(row.get(5))) {
 //                throw new RemoteServiceException("第" + (i+1) + "行, 销售时间不能为空");
@@ -799,15 +800,15 @@ public class WebsitSalesLogic {
             String storageStr = (String) row.get(6);
 
             if (!websitMap.containsKey(websitStr)) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 网点名称不存在");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 网点名称不存在");
             }
             if (!userMap.containsKey(mobileStr)) {
 //                throw new RemoteServiceException("第" + (i+1) + "行, 师傅联系电话不存在");
                 if (StringUtils.isBlank(mobileStr)) {
-                    throw new RemoteServiceException("第" + (i+1) + "行, 手机号不能为空");
+                    throw new RemoteServiceException("第" + (i + 1) + "行, 手机号不能为空");
                 }
                 if (StringUtils.isBlank(customerStr)) {
-                    throw new RemoteServiceException("第" + (i+1) + "行, 客户名称不能为空");
+                    throw new RemoteServiceException("第" + (i + 1) + "行, 客户名称不能为空");
                 }
                 if (!userMap.containsKey(customerStr + mobileStr)) {
                     User user = new User();
@@ -818,30 +819,30 @@ public class WebsitSalesLogic {
                 }
             }
             if (!goodsMap.containsKey(goodsNameStr)) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 辅材名称不存在");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 辅材名称不存在");
             }
             BigDecimal qty;
             try {
                 qty = new BigDecimal(qtyStr);
                 if (qty.compareTo(BigDecimal.ZERO) <= 0) {
-                    throw new RemoteServiceException("第" + (i+1) + "行, 请输入有效数量");
+                    throw new RemoteServiceException("第" + (i + 1) + "行, 请输入有效数量");
                 }
             } catch (Exception e) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 数量转换异常");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 数量转换异常");
             }
             BigDecimal salesPrice;
             try {
                 salesPrice = new BigDecimal(salesPriceStr);
                 if (qty.compareTo(BigDecimal.ZERO) < 0) {
-                    throw new RemoteServiceException("第" + (i+1) + "行, 请输入有效销售价格");
+                    throw new RemoteServiceException("第" + (i + 1) + "行, 请输入有效销售价格");
                 }
             } catch (Exception e) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 销售价格转换异常");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 销售价格转换异常");
             }
 
             ImportMaterialSalesBean bean = new ImportMaterialSalesBean();
 
-            bean.setIndex(i+1);
+            bean.setIndex(i + 1);
             bean.setAdminWebsit(websitMap.get(websitStr));
             bean.setUser(userMap.containsKey(mobileStr) ? userMap.get(mobileStr) : userMap.get(customerStr + mobileStr));
             bean.setGoods(goodsMap.get(goodsNameStr));
@@ -1050,7 +1051,8 @@ public class WebsitSalesLogic {
 
         try {
             goodsMap = websitGoods.stream()
-                    .collect(Collectors.toMap(WebsitGoods::getGoodsCode, Function.identity()));;
+                    .collect(Collectors.toMap(WebsitGoods::getGoodsCode, Function.identity()));
+            ;
         } catch (Exception e) {
             throw new RemoteServiceException("系统里的配件编码信息有重复");
         }
@@ -1098,16 +1100,16 @@ public class WebsitSalesLogic {
                 row.add("");
             }
             if (Objects.isNull(row.get(0))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 网点名称不能为空");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 网点名称不能为空");
             }
             if (Objects.isNull(row.get(1))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 师傅联系电话不能为空");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 师傅联系电话不能为空");
             }
             if (Objects.isNull(row.get(2))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 配件编码不能为空");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 配件编码不能为空");
             }
             if (Objects.isNull(row.get(3))) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 数量不能为空");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 数量不能为空");
             }
 //            if (Objects.isNull(row.get(4))) {
 //                throw new RemoteServiceException("第" + (i+1) + "行, 销售价格不能为空");
@@ -1125,15 +1127,15 @@ public class WebsitSalesLogic {
             String storageStr = (String) row.get(5);
 
             if (!websitMap.containsKey(websitStr)) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 网点名称不存在");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 网点名称不存在");
             }
             if (!userMap.containsKey(mobileStr)) {
 //                throw new RemoteServiceException("第" + (i+1) + "行, 师傅联系电话不存在");
                 if (StringUtils.isBlank(mobileStr)) {
-                    throw new RemoteServiceException("第" + (i+1) + "行, 手机号不能为空");
+                    throw new RemoteServiceException("第" + (i + 1) + "行, 手机号不能为空");
                 }
                 if (StringUtils.isBlank(customerStr)) {
-                    throw new RemoteServiceException("第" + (i+1) + "行, 客户名称不能为空");
+                    throw new RemoteServiceException("第" + (i + 1) + "行, 客户名称不能为空");
                 }
                 if (!userMap.containsKey(customerStr + mobileStr)) {
                     User user = new User();
@@ -1144,16 +1146,16 @@ public class WebsitSalesLogic {
                 }
             }
             if (!goodsMap.containsKey(goodsNameStr)) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 配件编码不存在");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 配件编码不存在");
             }
             BigDecimal qty;
             try {
                 qty = new BigDecimal(qtyStr);
                 if (qty.compareTo(BigDecimal.ZERO) <= 0) {
-                    throw new RemoteServiceException("第" + (i+1) + "行, 请输入有效数量");
+                    throw new RemoteServiceException("第" + (i + 1) + "行, 请输入有效数量");
                 }
             } catch (Exception e) {
-                throw new RemoteServiceException("第" + (i+1) + "行, 数量转换异常");
+                throw new RemoteServiceException("第" + (i + 1) + "行, 数量转换异常");
             }
             BigDecimal salesPrice;
 //            try {
@@ -1183,7 +1185,7 @@ public class WebsitSalesLogic {
 
             ImportMaterialSalesBean bean = new ImportMaterialSalesBean();
 
-            bean.setIndex(i+1);
+            bean.setIndex(i + 1);
             bean.setAdminWebsit(websitMap.get(websitStr));
             bean.setUser(userMap.containsKey(mobileStr) ? userMap.get(mobileStr) : userMap.get(customerStr + mobileStr));
             bean.setGoods(goods);

+ 6 - 1
mall-server-api/src/main/resources/mapper/MaterialMapper.xml

@@ -259,7 +259,12 @@
 
             AND a.goods_type = #{goodsType}
         </if>
-          <!-- AND a.qty > 0 -->
+        <if test="partType!=null and partType!=''">
+            AND b.part_type = #{partType}
+        </if>
+        <if test="goodsType=='P'.toString()">
+            a.qty > 0
+        </if>
         GROUP BY a.goods_id
         LIMIT 100
     </select>