|
@@ -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;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|