FengChaoYu 1 napja
szülő
commit
947a55ef66

+ 10 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/supply/sales/price/ProductPriceVO.java

@@ -1,6 +1,7 @@
 package com.gree.mall.manager.bean.supply.sales.price;
 package com.gree.mall.manager.bean.supply.sales.price;
 
 
 import com.gree.mall.manager.annotation.ZfireField;
 import com.gree.mall.manager.annotation.ZfireField;
+import com.gree.mall.manager.bean.supply.funds.CustomerWalletBean;
 import com.gree.mall.manager.enums.material.StateEnum;
 import com.gree.mall.manager.enums.material.StateEnum;
 import com.gree.mall.manager.enums.material.UnitEnum;
 import com.gree.mall.manager.enums.material.UnitEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
@@ -8,7 +9,9 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 @Data
 @Data
 @ApiModel
 @ApiModel
@@ -94,4 +97,11 @@ public class ProductPriceVO {
     @ApiModelProperty(value = "修改时间")
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
     private Date updateTime;
 
 
+    @ZfireField(hide = true, ignoreSelect = true, isQuery = false)
+    @ApiModelProperty("现金钱包")
+    private List<CustomerWalletBean> wallets = new ArrayList<>();
+
+    @ZfireField(hide = true, ignoreSelect = true, isQuery = false)
+    @ApiModelProperty("返利钱包")
+    private List<CustomerWalletBean> rebateWallets = new ArrayList<>();
 }
 }

+ 11 - 0
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java

@@ -804,4 +804,15 @@ public interface CommonMapper {
      * @return
      * @return
      */
      */
     IPage<RetailOrderVO> retailOrderList(Page page, @Param("ex") ZfireParamBean zfireParamBean);
     IPage<RetailOrderVO> retailOrderList(Page page, @Param("ex") ZfireParamBean zfireParamBean);
+
+    /**
+     * 产品价格物料列表
+     * @param page
+     * @param smallId
+     * @param salesTypeCode
+     * @param specsName
+     * @param goodsMaterialName
+     * @return
+     */
+    IPage<ProductPriceVO> productPriceMaterialList(Page page, @Param("smallId") String smallId, @Param("salesTypeCode") String salesTypeCode, @Param("specsName") String specsName, @Param("goodsMaterialName") String goodsMaterialName);
 }
 }

+ 16 - 4
mall-server-api/src/main/java/com/gree/mall/manager/controller/supply/sales/price/ProductPriceController.java

@@ -10,12 +10,10 @@ import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.integration.redis.util.RedisLockRegistry;
 import org.springframework.integration.redis.util.RedisLockRegistry;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
@@ -72,4 +70,18 @@ public class ProductPriceController {
 
 
         return ResponseHelper.success();
         return ResponseHelper.success();
     }
     }
+
+    @PostMapping("/material/list")
+    @ApiOperation("调价机型列表")
+    public ResponseHelper<IPage<ProductPriceVO>> materialList(
+            @ApiParam(value = "小类id") @RequestParam(required = false) String smallId,
+            @ApiParam(value = "销售类型编号") @RequestParam(required = false) String salesTypeCode,
+            @ApiParam(value = "机型型号") @RequestParam(required = false) String specsName,
+            @ApiParam(value = "物料名称") @RequestParam(required = false) String goodsMaterialName,
+            @ApiParam(value = "页号", required = true) @RequestParam Integer pageNum,
+            @ApiParam(value = "页大小", required = true) @RequestParam Integer pageSize
+    ) {
+        IPage<ProductPriceVO> page = productPriceLogic.materialList(smallId, salesTypeCode, specsName, goodsMaterialName, pageNum, pageSize);
+        return ResponseHelper.success(page);
+    }
 }
 }

+ 58 - 2
mall-server-api/src/main/java/com/gree/mall/manager/logic/supply/sales/price/ProductPriceLogic.java

@@ -1,22 +1,28 @@
 package com.gree.mall.manager.logic.supply.sales.price;
 package com.gree.mall.manager.logic.supply.sales.price;
 
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.supply.funds.CustomerWalletBean;
 import com.gree.mall.manager.bean.supply.sales.price.ProductPriceVO;
 import com.gree.mall.manager.bean.supply.sales.price.ProductPriceVO;
 import com.gree.mall.manager.commonmapper.CommonMapper;
 import com.gree.mall.manager.commonmapper.CommonMapper;
 import com.gree.mall.manager.enums.material.StateEnum;
 import com.gree.mall.manager.enums.material.StateEnum;
+import com.gree.mall.manager.enums.supply.BalanceTypeEnum;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.logic.common.CommonLogic;
+import com.gree.mall.manager.logic.supply.funds.CompanyWalletLogic;
 import com.gree.mall.manager.plus.entity.ProductPrice;
 import com.gree.mall.manager.plus.entity.ProductPrice;
 import com.gree.mall.manager.plus.service.ProductPriceService;
 import com.gree.mall.manager.plus.service.ProductPriceService;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 
 @Slf4j
 @Slf4j
 @Service
 @Service
@@ -26,12 +32,15 @@ public class ProductPriceLogic {
     private final CommonLogic commonLogic;
     private final CommonLogic commonLogic;
     private final CommonMapper commonMapper;
     private final CommonMapper commonMapper;
     private final ProductPriceService productPriceService;
     private final ProductPriceService productPriceService;
+    private final CompanyWalletLogic companyWalletLogic;
 
 
     public IPage<ProductPriceVO> list(ZfireParamBean zfireParamBean) {
     public IPage<ProductPriceVO> list(ZfireParamBean zfireParamBean) {
         AdminUserCom adminUser = commonLogic.getAdminUser();
         AdminUserCom adminUser = commonLogic.getAdminUser();
         FieldUtils.platformParam(zfireParamBean, ProductPriceVO.class, adminUser);
         FieldUtils.platformParam(zfireParamBean, ProductPriceVO.class, adminUser);
 
 
-        return commonMapper.productPriceList(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+        IPage<ProductPriceVO> productPriceIPage = commonMapper.productPriceList(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+
+        return productPriceIPage;
     }
     }
 
 
     public void batchCancel(List<String> ids) {
     public void batchCancel(List<String> ids) {
@@ -55,4 +64,51 @@ public class ProductPriceLogic {
                 .update();
                 .update();
     }
     }
 
 
+    public IPage<ProductPriceVO> materialList(String smallId, String salesTypeCode, String specsName, String goodsMaterialName,
+                                              Integer pageNum, Integer pageSize) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        IPage<ProductPriceVO> productPriceIPage = commonMapper.productPriceMaterialList(new Page(pageNum, pageSize), smallId, salesTypeCode, specsName, goodsMaterialName);
+
+        if (CollectionUtil.isNotEmpty(productPriceIPage.getRecords())) {
+            List<CustomerWalletBean> customerWalletBeans = new ArrayList<>();
+            if (adminUser.getType() != 2) {
+                customerWalletBeans = companyWalletLogic.queryWalletByAdminCompanyId(adminUser.getCompanyWechatId());
+
+                Map<String, CustomerWalletBean> commonlyCustomerWalletMap = customerWalletBeans.stream()
+                        .collect(Collectors.toMap(CustomerWalletBean::getWalletId, v -> v));
+
+                for (ProductPriceVO vo : productPriceIPage.getRecords()) {
+                    List<String> productPriceWalletRelaList = new ArrayList<>();
+                    // 产品与钱包关系
+                    if (StringUtils.isNotBlank(vo.getRebateTypeId())) {
+                        productPriceWalletRelaList.addAll(Arrays.asList(vo.getRebateTypeId().split(",")));
+                    }
+                    if (StringUtils.isNotBlank(vo.getWalletId())) {
+                        productPriceWalletRelaList.addAll(Arrays.asList(vo.getWalletId().split(",")));
+                    }
+
+                    List<CustomerWalletBean> walletBeanList = new ArrayList<>();
+                    List<CustomerWalletBean> rebateWalletList = new ArrayList<>();
+
+                    for (String walletId : productPriceWalletRelaList) {
+                        final CustomerWalletBean walletBean = commonlyCustomerWalletMap.get(walletId);
+                        if (Objects.nonNull(walletBean)) {
+                            if (walletBean.getType().equals(BalanceTypeEnum.W.getKey())) {
+                                walletBeanList.add(walletBean);
+                            } else {
+                                rebateWalletList.add(walletBean);
+                            }
+                        }
+                    }
+
+                    //现金钱包
+                    vo.getWallets().addAll(walletBeanList);
+                    //返利钱包
+                    vo.getRebateWallets().addAll(rebateWalletList);
+                }
+            }
+        }
+
+        return productPriceIPage;
+    }
 }
 }

+ 0 - 39
mall-server-api/src/main/java/com/gree/mall/manager/zfire/bean/FieldBean.java

@@ -1,39 +0,0 @@
-package com.gree.mall.manager.zfire.bean;
-
-//已废弃,请使用AdminField
-//
-//@Data
-//public class FieldBean {
-//    private String id;
-//    private String adminUserId;
-//    private String moduleId;
-//    @ApiModelProperty(value = "java字段名")
-//    private String jName;
-//    @ApiModelProperty(value = "字段title")
-//    private String label;
-//    @ApiModelProperty(value = "提示语")
-//    private String placeholder;
-//    @ApiModelProperty(value = "输入类型【input/select/number/amount/datetime】文本/选择/数字/金额/时间")
-//    private String type = "input";
-////    @ApiModelProperty(value = "name=显示  value=传参")
-////    private List<Map<String,Object>> option;
-//    @ApiModelProperty(value = "true=多选,false=单选")
-//    private Boolean multiple = false;
-//    @ApiModelProperty(value = "前端预留code,由前端自定义,默认为空")
-//    private String frontCode;
-//    @ApiModelProperty(value = "可能为空(查询组装参数用)")
-//    private String tbName;
-//    @ApiModelProperty(value = "可能为空(查询组装参数用)")
-//    private String colName;
-//    @ApiModelProperty(value = "字段显示宽度")
-//    private Integer width = 0;
-//    @ApiModelProperty(value = "排序字段,越大越前")
-//    private Integer sortNum = 0;
-//    @ApiModelProperty(value = "是否显示 true=显示 false=隐藏")
-//    private Boolean isShow = true;
-//    @ApiModelProperty(value = "是否可复制 true=可复制 false=不可复制")
-//    private Boolean isCopy = false;
-//    @ApiModelProperty(value = "是否合计 true=是 false=否")
-//    private Boolean isTotal = true;
-//
-//}

+ 49 - 0
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -1490,5 +1490,54 @@
         </if>
         </if>
         ${ex.orderBy}
         ${ex.orderBy}
     </select>
     </select>
+    <select id="productPriceMaterialList"
+            resultType="com.gree.mall.manager.bean.supply.sales.price.ProductPriceVO">
+        SELECT
+            id,
+            sales_type_code,
+            sales_type_name,
+            factory_no,
+            main_id,
+            main_name,
+            small_id,
+            small_name,
+            goods_material_id,
+            goods_material_name,
+            series_name,
+            specs_name,
+            unit,
+            price,
+            start_date,
+            end_date,
+            rebate_type_id,
+            rebate_type_name,
+            wallet_id,
+            wallet_name
+        FROM (
+            SELECT *,
+                ROW_NUMBER() OVER (
+                    PARTITION BY sales_type_code, factory_no ORDER BY price ASC
+                ) AS rn
+            FROM product_price
+            WHERE
+                status = 'ON'
+                AND del = 0
+                AND (start_date IS NULL OR start_date <![CDATA[ <= ]]> NOW())
+                AND (end_date IS NULL OR end_date <![CDATA[ >= ]]> NOW())
+                <if test="smallId != null and smallId !=''">
+                    AND small_id = #{smallId}
+                </if>
+                <if test="salesTypeCode != null and salesTypeCode !=''">
+                    AND sales_type_code = #{salesTypeCode}
+                </if>
+                <if test="specsName != null and specsName !=''">
+                    AND specs_name LIKE CONCAT('%', #{specsName}, '%')
+                </if>
+                <if test="goodsMaterialName != null and goodsMaterialName !=''">
+                    AND goods_material_name LIKE CONCAT('%', #{goodsMaterialName}, '%')
+                </if>
+        ) AS t
+        WHERE rn = 1
+    </select>
 
 
 </mapper>
 </mapper>