Compare commits
	
		
			No commits in common. "28c42b48519e0ecb123b6945ad2f1c46af49af04" and "19bee0f3b225eb70cbc92ee5925191e9716ec8b8" have entirely different histories.
		
	
	
		
			28c42b4851
			...
			19bee0f3b2
		
	
		| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
package com.hzs.system.config;
 | 
			
		||||
 | 
			
		||||
import com.hzs.common.core.domain.R;
 | 
			
		||||
import com.hzs.system.config.dto.AdvertBannerDTO;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @BelongsProject: hzs_cloud
 | 
			
		||||
 * @BelongsPackage: com.hzs.system.config
 | 
			
		||||
 * @Author: yh
 | 
			
		||||
 * @CreateTime: 2023-05-15  10:15
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * @Version: 1.0
 | 
			
		||||
 */
 | 
			
		||||
public interface AdvertBannerServiceApi {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询全部banner
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    R<List<AdvertBannerDTO>> findAll();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,13 +1,14 @@
 | 
			
		|||
package com.hzs.bonus.bonus.service.impl;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
			
		||||
import com.hzs.bonus.bonus.mapper.BdWaresBonusMapper;
 | 
			
		||||
import com.hzs.bonus.bonus.param.BdWaresBonusParam;
 | 
			
		||||
import com.hzs.bonus.bonus.service.IBdWaresBonusItemsService;
 | 
			
		||||
import com.hzs.bonus.bonus.service.IBdWaresBonusService;
 | 
			
		||||
import com.hzs.common.core.constant.SystemFieldConstants;
 | 
			
		||||
import com.hzs.common.core.enums.EYesNo;
 | 
			
		||||
import com.hzs.common.core.utils.DateUtils;
 | 
			
		||||
import com.hzs.common.domain.member.bonus.BdWaresBonus;
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +29,7 @@ import java.util.List;
 | 
			
		|||
public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdWaresBonus> implements IBdWaresBonusService {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdWaresBonusItemsService iBdWaresBonusItemsService;
 | 
			
		||||
    private IBdWaresBonusItemsService waresBonusItemsService;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<BdWaresBonusExt> querySpecialWaresBonus(BdWaresBonusParam waresBonusParam) {
 | 
			
		||||
| 
						 | 
				
			
			@ -39,21 +40,21 @@ public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdW
 | 
			
		|||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void deleteSpecialWaresBonus(Long pkId, Long userId) {
 | 
			
		||||
        // 删除明细表
 | 
			
		||||
        iBdWaresBonusItemsService.deleteWaresBonusItems(null, pkId, userId);
 | 
			
		||||
        LambdaUpdateWrapper<BdWaresBonus> updateWrapper = new LambdaUpdateWrapper<>();
 | 
			
		||||
        updateWrapper.set(BdWaresBonus::getPkModified, userId);
 | 
			
		||||
        updateWrapper.set(BdWaresBonus::getDelFlag, EYesNo.NO.getIntValue());
 | 
			
		||||
        updateWrapper.set(BdWaresBonus::getModifiedTime, DateUtils.currentDateTime());
 | 
			
		||||
        updateWrapper.eq(BdWaresBonus::getPkId, pkId);
 | 
			
		||||
        waresBonusItemsService.deleteWaresBonusItems(null, pkId, userId);
 | 
			
		||||
        UpdateWrapper<BdWaresBonus> updateWrapper = new UpdateWrapper<>();
 | 
			
		||||
        updateWrapper.set(SystemFieldConstants.PK_MODIFIED, userId);
 | 
			
		||||
        updateWrapper.set(SystemFieldConstants.DEL_FLAG, EYesNo.NO.getIntValue());
 | 
			
		||||
        updateWrapper.set(SystemFieldConstants.MODIFIED_TIME, DateUtils.currentDateTime());
 | 
			
		||||
        updateWrapper.eq(SystemFieldConstants.PK_ID, pkId);
 | 
			
		||||
        update(updateWrapper);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public BdWaresBonus queryWaresBonusById(BdWaresBonusParam waresBonusParam) {
 | 
			
		||||
        LambdaQueryWrapper<BdWaresBonus> queryWrapper = new LambdaQueryWrapper<>();
 | 
			
		||||
        queryWrapper.eq(BdWaresBonus::getPkWares, waresBonusParam.getPkWares());
 | 
			
		||||
        QueryWrapper<BdWaresBonus> queryWrapper = new QueryWrapper<>();
 | 
			
		||||
        queryWrapper.eq(SystemFieldConstants.PK_WARES, waresBonusParam.getPkWares());
 | 
			
		||||
        if (waresBonusParam.getPkId() != null) {
 | 
			
		||||
            queryWrapper.ne(BdWaresBonus::getPkId, waresBonusParam.getPkId());
 | 
			
		||||
            queryWrapper.ne(SystemFieldConstants.PK_ID, waresBonusParam.getPkId());
 | 
			
		||||
        }
 | 
			
		||||
        return baseMapper.selectOne(queryWrapper);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -90,12 +91,12 @@ public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdW
 | 
			
		|||
        }
 | 
			
		||||
        if (updateWaresBonusItems.size() > 0) {
 | 
			
		||||
            // 删除
 | 
			
		||||
            iBdWaresBonusItemsService.deleteWaresBonusItems(updateWaresBonusItems, updateWaresBonusItems.get(0).getPkWaresBonus(), userId);
 | 
			
		||||
            iBdWaresBonusItemsService.updateWaresBonusItems(updateWaresBonusItems);
 | 
			
		||||
            waresBonusItemsService.deleteWaresBonusItems(updateWaresBonusItems, updateWaresBonusItems.get(0).getPkWaresBonus(), userId);
 | 
			
		||||
            waresBonusItemsService.updateWaresBonusItems(updateWaresBonusItems);
 | 
			
		||||
        }
 | 
			
		||||
        // 新增
 | 
			
		||||
        if (insertWaresBonusItems.size() > 0) {
 | 
			
		||||
            iBdWaresBonusItemsService.insetWaresBonusItems(insertWaresBonusItems);
 | 
			
		||||
            waresBonusItemsService.insetWaresBonusItems(insertWaresBonusItems);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2134,11 +2134,10 @@ public class BonusSettleRangeHandle extends BonusSettleHandle {
 | 
			
		|||
                                // 差价就是级差收益
 | 
			
		||||
                                BigDecimal bonusIncome;
 | 
			
		||||
                                if (bonusIncomeMap.containsKey(targetMemberRangeExt.getPkMember())) {
 | 
			
		||||
                                    bonusIncome = bonusIncomeMap.get(targetMemberRangeExt.getPkMember()).add(tmpPrice.subtract(targetRangePrice).multiply(new BigDecimal(saOrderItemsExt.getWaresQuantity())));
 | 
			
		||||
                                    bonusIncome = bonusIncomeMap.get(targetMemberRangeExt.getPkMember()).add(tmpPrice.subtract(targetRangePrice));
 | 
			
		||||
                                } else {
 | 
			
		||||
                                    bonusIncome = tmpPrice.subtract(targetRangePrice).multiply(new BigDecimal(saOrderItemsExt.getWaresQuantity()));
 | 
			
		||||
                                    bonusIncome = tmpPrice.subtract(targetRangePrice);
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                                bonusIncomeMap.put(targetMemberRangeExt.getPkMember(), bonusIncome);
 | 
			
		||||
                                // 临时价格更新
 | 
			
		||||
                                tmpPrice = targetRangePrice;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -333,7 +333,6 @@
 | 
			
		|||
        <result column="PK_ORDER" property="pkOrder"/>
 | 
			
		||||
        <result column="PK_ID" property="pkId"/>
 | 
			
		||||
        <result column="PRICE" property="price"/>
 | 
			
		||||
        <result column="WARES_QUANTITY" property="waresQuantity"/>
 | 
			
		||||
        <result column="PK_WARES" property="pkWares"/>
 | 
			
		||||
        <result column="PK_PRODUCT" property="pkProduct"/>
 | 
			
		||||
        <result column="PK_WARES_DETAIL" property="pkWaresDetail"/>
 | 
			
		||||
| 
						 | 
				
			
			@ -349,7 +348,6 @@
 | 
			
		|||
        select soi.pk_order,
 | 
			
		||||
        soi.pk_id,
 | 
			
		||||
        soi.price,
 | 
			
		||||
        soi.wares_quantity,
 | 
			
		||||
        bwr.pk_wares,
 | 
			
		||||
        bwr.pk_product,
 | 
			
		||||
        bwr.pk_wares_detail,
 | 
			
		||||
| 
						 | 
				
			
			@ -362,8 +360,7 @@
 | 
			
		|||
        soi.pk_product,
 | 
			
		||||
        soi.pk_wares_detail,
 | 
			
		||||
        soi.pk_wares_specs_sku,
 | 
			
		||||
        soi.price,
 | 
			
		||||
        max(soi.wares_quantity) wares_quantity
 | 
			
		||||
        soi.price
 | 
			
		||||
        from sa_order so
 | 
			
		||||
        left join sa_order_items soi
 | 
			
		||||
        on soi.pk_order = so.pk_id
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,12 +17,14 @@ import com.hzs.common.core.web.domain.AjaxResult;
 | 
			
		|||
import com.hzs.common.domain.member.ext.CuMemberExt;
 | 
			
		||||
import com.hzs.common.domain.sale.ext.BdWaresExt;
 | 
			
		||||
import com.hzs.common.domain.sale.ext.BdWaresSpecsSkuExt;
 | 
			
		||||
import com.hzs.common.domain.sale.wares.*;
 | 
			
		||||
import com.hzs.common.domain.sale.wares.BdWares;
 | 
			
		||||
import com.hzs.common.domain.sale.wares.BdWaresLabel;
 | 
			
		||||
import com.hzs.common.domain.sale.wares.BdWaresRange;
 | 
			
		||||
import com.hzs.common.domain.sale.wares.BdWaresSpecsSku;
 | 
			
		||||
import com.hzs.common.domain.system.config.BdLabel;
 | 
			
		||||
import com.hzs.common.domain.system.ext.BdLabelExt;
 | 
			
		||||
import com.hzs.common.security.utils.SecurityUtils;
 | 
			
		||||
import com.hzs.member.base.IMemberServiceApi;
 | 
			
		||||
import com.hzs.member.base.dto.ShowWaresDTO;
 | 
			
		||||
import com.hzs.retail.wares.param.RetailWaresDetailParam;
 | 
			
		||||
import com.hzs.retail.wares.param.RetailWaresParam;
 | 
			
		||||
import com.hzs.retail.wares.vo.RetailWaresDetailVO;
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +68,7 @@ public class ApiRetailWaresController extends BaseController {
 | 
			
		|||
    private IBdWaresRangeService iBdWaresRangeService;
 | 
			
		||||
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    ICurrencyServiceApi iCurrencyServiceApi;
 | 
			
		||||
    ICurrencyServiceApi currencyServiceApi;
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IAreaCurrencyServiceApi iAreaCurrencyServiceApi;
 | 
			
		||||
    @DubboReference
 | 
			
		||||
| 
						 | 
				
			
			@ -92,6 +94,7 @@ public class ApiRetailWaresController extends BaseController {
 | 
			
		|||
        param.setSystemType(SecurityUtils.getSystemType());
 | 
			
		||||
        param.setPkCountry(SecurityUtils.getPkCountry());
 | 
			
		||||
        // 商品列表
 | 
			
		||||
        startPage();
 | 
			
		||||
        List<BdWaresExt> bdWaresExtList = iBdWaresService.listRetailWaresByCondition(param);
 | 
			
		||||
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(bdWaresExtList)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -174,11 +177,9 @@ public class ApiRetailWaresController extends BaseController {
 | 
			
		|||
                                                Integer pkGrade, boolean showLabel) {
 | 
			
		||||
        // 返回商品列表
 | 
			
		||||
        List<RetailWaresVO> resultList = new ArrayList<>();
 | 
			
		||||
        // 当前会员ID
 | 
			
		||||
        Long userId = SecurityUtils.getUserId();
 | 
			
		||||
 | 
			
		||||
        // 汇率比例
 | 
			
		||||
        R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
 | 
			
		||||
        R<CurrencyDTO> currency = currencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
 | 
			
		||||
        BigDecimal inExchangeRate = currency.getData().getInExchangeRate();
 | 
			
		||||
 | 
			
		||||
        // 商品主键列表
 | 
			
		||||
| 
						 | 
				
			
			@ -207,25 +208,7 @@ public class ApiRetailWaresController extends BaseController {
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 检验商品团队信息
 | 
			
		||||
        Map<Integer, List<BdWaresAuthority>> waresAuthorityMap = iBdWaresService.getWaresAuthority(waresIdList);
 | 
			
		||||
        List<ShowWaresDTO> showWaresList = bdWaresExtList.stream().map(tmpBdWares -> {
 | 
			
		||||
            ShowWaresDTO showWaresDTO = new ShowWaresDTO();
 | 
			
		||||
            showWaresDTO.setPkWares(tmpBdWares.getPkId());
 | 
			
		||||
            showWaresDTO.setLoginMember(userId);
 | 
			
		||||
            showWaresDTO.setWaresAuthorityList(waresAuthorityMap.get(tmpBdWares.getPkId()));
 | 
			
		||||
            return showWaresDTO;
 | 
			
		||||
        }).collect(Collectors.toList());
 | 
			
		||||
        R<Map<Integer, Boolean>> waresShowMapDto = iMemberServiceApi.checkIsShowWares(showWaresList);
 | 
			
		||||
        Map<Integer, Boolean> waresShowMap = waresShowMapDto.getData();
 | 
			
		||||
 | 
			
		||||
        for (BdWaresExt bdWaresExt : bdWaresExtList) {
 | 
			
		||||
            // 校验团队信息
 | 
			
		||||
            Boolean isShowWares = waresShowMap.get(bdWaresExt.getPkId());
 | 
			
		||||
            if (null == isShowWares || !isShowWares) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (null != list) {
 | 
			
		||||
                // 商品标签处理
 | 
			
		||||
                // 保证标签
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
 | 
			
		|||
import cn.hutool.core.date.DateUtil;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.alibaba.fastjson2.JSONArray;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.hzs.common.core.constant.*;
 | 
			
		||||
import com.hzs.common.core.constant.msg.SaOrderMsgConstants;
 | 
			
		||||
import com.hzs.common.core.constant.msg.WaresMsgConstants;
 | 
			
		||||
| 
						 | 
				
			
			@ -35,6 +35,7 @@ import com.hzs.sale.wares.service.*;
 | 
			
		|||
import com.hzs.sale.wares.vo.*;
 | 
			
		||||
import com.hzs.system.base.ICurrencyServiceApi;
 | 
			
		||||
import com.hzs.system.base.dto.CurrencyDTO;
 | 
			
		||||
import com.hzs.system.config.AdvertBannerServiceApi;
 | 
			
		||||
import com.hzs.system.config.IAreaCurrencyServiceApi;
 | 
			
		||||
import com.hzs.system.config.IGradeServiceApi;
 | 
			
		||||
import com.hzs.system.config.dto.AreaCurrencyDTO;
 | 
			
		||||
| 
						 | 
				
			
			@ -59,34 +60,52 @@ import java.util.stream.Collectors;
 | 
			
		|||
public class ApiBdWaresController extends BaseController {
 | 
			
		||||
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IGradeServiceApi iGradeServiceApi;
 | 
			
		||||
    IGradeServiceApi gradeServiceApi;
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IMemberServiceApi iMemberServiceApi;
 | 
			
		||||
    IMemberServiceApi memberServiceApi;
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IAreaCurrencyServiceApi iAreaCurrencyServiceApi;
 | 
			
		||||
    IAreaCurrencyServiceApi areaCurrencyServiceApi;
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    ICurrencyServiceApi iCurrencyServiceApi;
 | 
			
		||||
    ICurrencyServiceApi currencyServiceApi;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdWaresService iBdWaresService;
 | 
			
		||||
    private IBdWaresLabelService waresLabelService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdWaresSpecsSkuService iBdWaresSpecsSkuService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdWaresLabelService iBdWaresLabelService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdWaresGradeService iBdWaresGradeService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdWaresRangeService iBdWaresRangeService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    protected IShoppingCartService iShoppingCartService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ISaOrderService iSaOrderService;
 | 
			
		||||
 | 
			
		||||
    private IBdWaresGradeService waresGradeService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    protected RedisService redisService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    protected StringRedisTemplate redisTemplate;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    protected IShoppingCartService shoppingCartService;
 | 
			
		||||
 | 
			
		||||
    private IBdWaresService bdWaresService;
 | 
			
		||||
 | 
			
		||||
    private IBdWaresSpecsSkuService bdWaresSpecsSkuService;
 | 
			
		||||
 | 
			
		||||
    private IBdWaresRangeService bdWaresRangeService;
 | 
			
		||||
 | 
			
		||||
    private ISaOrderService saOrderService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    public void setSaOrderService(ISaOrderService saOrderService) {
 | 
			
		||||
        this.saOrderService = saOrderService;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    public void setBdWaresRangeService(IBdWaresRangeService bdWaresRangeService) {
 | 
			
		||||
        this.bdWaresRangeService = bdWaresRangeService;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    public void setBdWaresSpecsSkuService(IBdWaresSpecsSkuService bdWaresSpecsSkuService) {
 | 
			
		||||
        this.bdWaresSpecsSkuService = bdWaresSpecsSkuService;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    public void setBdWaresService(IBdWaresService bdWaresService) {
 | 
			
		||||
        this.bdWaresService = bdWaresService;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据专区查找专区的商品
 | 
			
		||||
| 
						 | 
				
			
			@ -98,42 +117,48 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
        if (cuWaresParams.getSpecialArea() == null) {
 | 
			
		||||
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY));
 | 
			
		||||
        }
 | 
			
		||||
        Integer pkCountry = cuWaresParams.getPkCountry() != null ? cuWaresParams.getPkCountry() : SecurityUtils.getPkCountry();
 | 
			
		||||
 | 
			
		||||
        Integer pkCountry;
 | 
			
		||||
        if (cuWaresParams.getPkCountry() != null) {
 | 
			
		||||
            pkCountry = cuWaresParams.getPkCountry();
 | 
			
		||||
        } else {
 | 
			
		||||
            pkCountry = SecurityUtils.getPkCountry();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 返回数据
 | 
			
		||||
        List<CuWaresParams> waresParamsList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        // 查询商品列表
 | 
			
		||||
        List<BdWaresExt> bdWaresExtList = iBdWaresService.queryWaresByCondition(cuWaresParams.getSpecialArea(), cuWaresParams.getPkAreaClassify(), cuWaresParams.getWaresName(), null, null, pkCountry);
 | 
			
		||||
        List<BdWaresExt> bdWaresExtList = bdWaresService.queryWaresByCondition(cuWaresParams.getSpecialArea(), cuWaresParams.getPkAreaClassify(), cuWaresParams.getWaresName(), null, null, pkCountry);
 | 
			
		||||
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(bdWaresExtList)) {
 | 
			
		||||
            // 等级
 | 
			
		||||
            R<List<GradeDTO>> gradeDTO = iGradeServiceApi.queryGradeList(pkCountry);
 | 
			
		||||
            R<List<GradeDTO>> gradeDTO = gradeServiceApi.queryGradeList(pkCountry);
 | 
			
		||||
            List<GradeDTO> gradeList = gradeDTO.getData();
 | 
			
		||||
            Map<Integer, GradeDTO> gradeMap = gradeList.stream().filter(grade -> ESystemType.DEFAULT.getValue() == grade.getSystemType()).collect(Collectors.toMap(GradeDTO::getGradeValue, Function.identity()));
 | 
			
		||||
 | 
			
		||||
            // 当前会员ID
 | 
			
		||||
            Long userId = SecurityUtils.getUserId();
 | 
			
		||||
            CuMember cuMember = iSaOrderService.getCuMemberByKey(userId);
 | 
			
		||||
            CuMember cuMember = saOrderService.getCuMemberByKey(userId);
 | 
			
		||||
            // 当前会员编号
 | 
			
		||||
            String memberCode = cuMember.getMemberCode();
 | 
			
		||||
 | 
			
		||||
            // 汇率比例
 | 
			
		||||
            R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
 | 
			
		||||
            R<CurrencyDTO> currency = currencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
 | 
			
		||||
            BigDecimal inExchangeRate = currency.getData().getInExchangeRate();
 | 
			
		||||
 | 
			
		||||
            // 商品主键列表
 | 
			
		||||
            List<Integer> waresIdList = bdWaresExtList.stream().map(BdWares::getPkId).collect(Collectors.toList());
 | 
			
		||||
            // 检验商品团队信息
 | 
			
		||||
            Map<Integer, List<BdWaresAuthority>> waresAuthorityMap = iBdWaresService.getWaresAuthority(waresIdList);
 | 
			
		||||
            Map<Integer, List<BdWaresAuthority>> waresAuthorityMap = bdWaresService.getWaresAuthority(waresIdList);
 | 
			
		||||
            List<ShowWaresDTO> showWaresList = bdWaresExtList.stream().map(we -> getShowWares(we.getPkId(), userId, memberCode, waresAuthorityMap)).collect(Collectors.toList());
 | 
			
		||||
            R<Map<Integer, Boolean>> waresShowMapDto = iMemberServiceApi.checkIsShowWares(showWaresList);
 | 
			
		||||
            R<Map<Integer, Boolean>> waresShowMapDto = memberServiceApi.checkIsShowWares(showWaresList);
 | 
			
		||||
            Map<Integer, Boolean> waresShowMap = waresShowMapDto.getData();
 | 
			
		||||
 | 
			
		||||
            // 商品标签列表
 | 
			
		||||
            BdWaresLabel waresLabel = new BdWaresLabel();
 | 
			
		||||
            waresLabel.setPkIdList(waresIdList);
 | 
			
		||||
            List<BdLabelExt> list = iBdWaresLabelService.selectByList(waresLabel);
 | 
			
		||||
            List<BdLabelExt> list = waresLabelService.selectByList(waresLabel);
 | 
			
		||||
 | 
			
		||||
            // 标签
 | 
			
		||||
            for (BdWaresExt bdWaresExt : bdWaresExtList) {
 | 
			
		||||
| 
						 | 
				
			
			@ -168,14 +193,14 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
            // 查询商品sku 最小值 和数量
 | 
			
		||||
            Map<Integer, List<BdWaresSpecsSkuExt>> waresSpecsSkuMap = new HashMap<>();
 | 
			
		||||
            if (waresIdList.size() > 0) {
 | 
			
		||||
                List<BdWaresSpecsSkuExt> waresSpecsSkuArray = iBdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(waresIdList);
 | 
			
		||||
                List<BdWaresSpecsSkuExt> waresSpecsSkuArray = bdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(waresIdList);
 | 
			
		||||
                waresSpecsSkuMap = waresSpecsSkuArray.stream().collect(Collectors.groupingBy(BdWaresSpecsSkuExt::getPkWares));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            List<BdWaresSpecsSkuExt> waresSpecsSkuList = new ArrayList<>();
 | 
			
		||||
            if (waresIdList.size() > 0) {
 | 
			
		||||
                // 查询默认规格
 | 
			
		||||
                waresSpecsSkuList = iBdWaresSpecsSkuService.selectByWaresSpecsSku(waresIdList);
 | 
			
		||||
                waresSpecsSkuList = bdWaresSpecsSkuService.selectByWaresSpecsSku(waresIdList);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            List<BdWaresRange> bdWaresRangeList = new ArrayList<>();
 | 
			
		||||
| 
						 | 
				
			
			@ -184,14 +209,14 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
                    || EOrderType.COOPERATE_ORDER.getValue() == cuWaresParams.getSpecialArea()) {
 | 
			
		||||
                // 复购业绩计算
 | 
			
		||||
                if (waresIdList.size() > 0) {
 | 
			
		||||
                    bdWaresRangeList = iBdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdList);
 | 
			
		||||
                    bdWaresRangeList = bdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdList);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            Set<Integer> waresIdSet = new HashSet<>();
 | 
			
		||||
            List<String> authWaresList = new ArrayList<>();
 | 
			
		||||
            if (waresIdList.size() > 0) {
 | 
			
		||||
                // 处理商品权限
 | 
			
		||||
                List<WaresGradeAwards> waresGradeAwardsList = iBdWaresGradeService.queryWaresGradeAwards(waresIdList);
 | 
			
		||||
                List<WaresGradeAwards> waresGradeAwardsList = waresGradeService.queryWaresGradeAwards(waresIdList);
 | 
			
		||||
                // 先处理没有配置等级、奖衔的商品
 | 
			
		||||
                waresGradeAwardsList.forEach(waresGradeAwards -> {
 | 
			
		||||
                    waresIdSet.add(waresGradeAwards.getPkWares());
 | 
			
		||||
| 
						 | 
				
			
			@ -200,6 +225,9 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 海粉等级实体
 | 
			
		||||
            GradeDTO haiFanGradeDTO = gradeMap.get(EGrade.HAI_FAN.getValue());
 | 
			
		||||
 | 
			
		||||
            for (BdWaresExt waresExt : bdWaresExtList) {
 | 
			
		||||
                // 校验团队信息
 | 
			
		||||
                Boolean isShowWares = waresShowMap.get(waresExt.getPkId());
 | 
			
		||||
| 
						 | 
				
			
			@ -255,6 +283,14 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
                        // 零售价
 | 
			
		||||
                        retailPrice = retailPrice.add(bdWaresSpecsSkuExt.getRetailPrice().multiply(BigDecimal.valueOf(bdWaresSpecsSkuExt.getQuantity())));
 | 
			
		||||
                    }
 | 
			
		||||
                    if (cuWaresParams.getPkCountry() != null && !pkCountry.equals(SecurityUtils.getPkCountry())) {
 | 
			
		||||
                        // 当登陆人的结算国和前端结算国不一致 即为跨国报单
 | 
			
		||||
                        if (!pkCountry.equals(SecurityUtils.getPkCountry())) {
 | 
			
		||||
                            // 跨国报单 跨国汇率
 | 
			
		||||
                            R<CurrencyDTO> kgCurrency = currencyServiceApi.getCurrency(pkCountry);
 | 
			
		||||
                            waresPrice = waresPrice.multiply(inExchangeRate).divide(kgCurrency.getData().getInExchangeRate(), 2, BigDecimal.ROUND_HALF_UP);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                // 计算商品列表价格和业绩最小值
 | 
			
		||||
| 
						 | 
				
			
			@ -308,7 +344,7 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
                }
 | 
			
		||||
                List<AreaCurrencyDTO> areaCurrencyDTOList = new ArrayList<>();
 | 
			
		||||
                if (pkCurrencySet.size() > 0) {
 | 
			
		||||
                    areaCurrencyDTOList = iAreaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue());
 | 
			
		||||
                    areaCurrencyDTOList = areaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue());
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                for (CuWaresParams waresParams : waresParamsList) {
 | 
			
		||||
| 
						 | 
				
			
			@ -334,7 +370,7 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
     **/
 | 
			
		||||
    private BigDecimal getSpecialDeductRatio(CuWaresParams cuWaresParams, Integer pkCountry, Integer accountValue) {
 | 
			
		||||
        // 查询专区所属币种
 | 
			
		||||
        List<AreaCurrencyDTO> areaCurrencyDTOList = iAreaCurrencyServiceApi.queryAreaCurrencyByCondition(cuWaresParams.getSpecialArea(), pkCountry).getData();
 | 
			
		||||
        List<AreaCurrencyDTO> areaCurrencyDTOList = areaCurrencyServiceApi.queryAreaCurrencyByCondition(cuWaresParams.getSpecialArea(), pkCountry).getData();
 | 
			
		||||
        BigDecimal elseRatio = BigDecimal.ZERO;
 | 
			
		||||
        BigDecimal deductRatio = BigDecimal.ZERO;
 | 
			
		||||
        boolean flag = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -386,8 +422,13 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
            return AjaxResult.error(WaresMsgConstants.WARES_NUMBER_DOES_NOT_EXIST);
 | 
			
		||||
        }
 | 
			
		||||
        Long loginMemberId = SecurityUtils.getUserId();
 | 
			
		||||
        Integer pkCountry = cuWaresParams.getPkCountry() == null ? SecurityUtils.getPkCountry() : cuWaresParams.getPkCountry();
 | 
			
		||||
        cuWaresParams = iBdWaresSpecsSkuService.queryWaresSpecsSku(cuWaresParams.getSpecialArea(), cuWaresParams.getWaresCode(), loginMemberId, pkCountry);
 | 
			
		||||
        Integer pkCountry;
 | 
			
		||||
        if (cuWaresParams.getPkCountry() == null) {
 | 
			
		||||
            pkCountry = SecurityUtils.getPkCountry();
 | 
			
		||||
        } else {
 | 
			
		||||
            pkCountry = cuWaresParams.getPkCountry();
 | 
			
		||||
        }
 | 
			
		||||
        cuWaresParams = bdWaresSpecsSkuService.queryWaresSpecsSku(cuWaresParams.getSpecialArea(), cuWaresParams.getWaresCode(), loginMemberId, pkCountry);
 | 
			
		||||
 | 
			
		||||
        // 预计发货时间(秒)
 | 
			
		||||
        if (cuWaresParams.getArrivalTime() != null && cuWaresParams.getCreationTime() != null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -414,7 +455,7 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
 | 
			
		||||
            List<AreaCurrencyDTO> areaCurrencyDTOList = new ArrayList<>();
 | 
			
		||||
            if (pkCurrencySet.size() > 0) {
 | 
			
		||||
                areaCurrencyDTOList = iAreaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue());
 | 
			
		||||
                areaCurrencyDTOList = areaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue());
 | 
			
		||||
            }
 | 
			
		||||
            cuWaresParams.setDeductMoney(ComputeUtil.computeBonusMultiply(cuWaresParams.getWaresPrice(), deductRatio));
 | 
			
		||||
            if (areaCurrencyDTOList.size() > 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -442,19 +483,19 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
        if (cuWaresItemsParams.getWaresCode() == null || cuWaresItemsParams.getPkWaresDetail() == null) {
 | 
			
		||||
            return AjaxResult.error(WaresMsgConstants.WARES_NUMBER_DOES_NOT_EXIST);
 | 
			
		||||
        }
 | 
			
		||||
        return AjaxResult.success(iBdWaresSpecsSkuService.queryWaresDetailSkuBySpecs(cuWaresItemsParams));
 | 
			
		||||
        return AjaxResult.success(bdWaresSpecsSkuService.queryWaresDetailSkuBySpecs(cuWaresItemsParams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询商品
 | 
			
		||||
     */
 | 
			
		||||
    @PostMapping("/get-wares-agreement")
 | 
			
		||||
    @PostMapping("get-wares-agreement")
 | 
			
		||||
    public AjaxResult getWaresAgreement(@RequestBody WaresAgrementParam waresAgrementParam) {
 | 
			
		||||
        if (waresAgrementParam.getWaresCodeList().size() == 0) {
 | 
			
		||||
            return AjaxResult.error(TransactionUtils.getContent(WaresMsgConstants.WARES_CODE_NOT_NULL));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        List<BdAgreement> waresExtList = iBdWaresService.selectByWaresCodeList(waresAgrementParam.getWaresCodeList());
 | 
			
		||||
        List<BdAgreement> waresExtList = bdWaresService.selectByWaresCodeList(waresAgrementParam.getWaresCodeList());
 | 
			
		||||
        OrderAlertVo orderAlertVo = new OrderAlertVo();
 | 
			
		||||
        Integer alertTime = 0;
 | 
			
		||||
        orderAlertVo.setWaresExtList(waresExtList);
 | 
			
		||||
| 
						 | 
				
			
			@ -477,28 +518,34 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
        if (cuWaresParams.getSpecialArea() == null) {
 | 
			
		||||
            return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY));
 | 
			
		||||
        }
 | 
			
		||||
        Integer pkCountry = cuWaresParams.getPkCountry() != null ? cuWaresParams.getPkCountry() : SecurityUtils.getPkCountry();
 | 
			
		||||
 | 
			
		||||
        Integer pkCountry;
 | 
			
		||||
        if (cuWaresParams.getPkCountry() != null) {
 | 
			
		||||
            pkCountry = cuWaresParams.getPkCountry();
 | 
			
		||||
        } else {
 | 
			
		||||
            pkCountry = SecurityUtils.getPkCountry();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 返回数据列表
 | 
			
		||||
        List<CuWaresParams> waresParamsList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        // 查询商品列表
 | 
			
		||||
        List<BdWaresExt> bdWaresExtList = iBdWaresService.queryRecommendWaresByCondition(cuWaresParams.getSpecialArea(), cuWaresParams.getPkAreaClassify(), cuWaresParams.getWaresName(), pkCountry);
 | 
			
		||||
        List<BdWaresExt> bdWaresExtList = bdWaresService.queryRecommendWaresByCondition(cuWaresParams.getSpecialArea(), cuWaresParams.getPkAreaClassify(), cuWaresParams.getWaresName(), pkCountry);
 | 
			
		||||
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(bdWaresExtList)) {
 | 
			
		||||
            // 商品ID列表
 | 
			
		||||
            List<Integer> pkWaresIds = bdWaresExtList.stream().map(BdWares::getPkId).collect(Collectors.toList());
 | 
			
		||||
 | 
			
		||||
            // 当前会员
 | 
			
		||||
            CuMember cuMember = iSaOrderService.getCuMemberByKey(SecurityUtils.getUserId());
 | 
			
		||||
            CuMember cuMember = saOrderService.getCuMemberByKey(SecurityUtils.getUserId());
 | 
			
		||||
            // 汇率比例
 | 
			
		||||
            R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(pkCountry);
 | 
			
		||||
            R<CurrencyDTO> currency = currencyServiceApi.getCurrency(pkCountry);
 | 
			
		||||
            BigDecimal inExchangeRate = currency.getData().getInExchangeRate();
 | 
			
		||||
 | 
			
		||||
            // 查询商品标签列表
 | 
			
		||||
            BdWaresLabel waresLabel = new BdWaresLabel();
 | 
			
		||||
            waresLabel.setPkIdList(pkWaresIds);
 | 
			
		||||
            List<BdLabelExt> labelList = iBdWaresLabelService.selectByList(waresLabel);
 | 
			
		||||
            List<BdLabelExt> labelList = waresLabelService.selectByList(waresLabel);
 | 
			
		||||
 | 
			
		||||
            // 标签
 | 
			
		||||
            for (BdWaresExt bdWaresExt : bdWaresExtList) {
 | 
			
		||||
| 
						 | 
				
			
			@ -531,7 +578,7 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
 | 
			
		||||
            Map<Integer, List<BdWaresSpecsSkuExt>> waresSpecsSkuMap = new HashMap<>();
 | 
			
		||||
            if (pkWaresIds.size() > 0) {
 | 
			
		||||
                List<BdWaresSpecsSkuExt> waresSpecsSkuArray = iBdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(pkWaresIds);
 | 
			
		||||
                List<BdWaresSpecsSkuExt> waresSpecsSkuArray = bdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(pkWaresIds);
 | 
			
		||||
                waresSpecsSkuMap = waresSpecsSkuArray.stream().collect(Collectors.groupingBy(BdWaresSpecsSkuExt::getPkWares));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -549,7 +596,7 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
                    bdWaresExtList.forEach(we -> {
 | 
			
		||||
                        waresIdSet.add(we.getPkId());
 | 
			
		||||
                    });
 | 
			
		||||
                    List<BdWaresRange> bdWaresRangeList = iBdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdSet);
 | 
			
		||||
                    List<BdWaresRange> bdWaresRangeList = bdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdSet);
 | 
			
		||||
                    for (BdWaresRange bdWaresRange : bdWaresRangeList) {
 | 
			
		||||
                        if (waresExt.getPkId().intValue() == bdWaresRange.getPkWares().intValue()) {
 | 
			
		||||
                            waresPrice = waresPrice.add(bdWaresRange.getPrice());
 | 
			
		||||
| 
						 | 
				
			
			@ -580,20 +627,29 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
                waresParams.setAssAchieve(assAchieve);
 | 
			
		||||
                // 商品业绩计算汇率
 | 
			
		||||
                if (waresParams.getWaresAchieve() != null) {
 | 
			
		||||
                    if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) {
 | 
			
		||||
                        waresParams.setWaresAchieve(waresParams.getWaresAchieve().multiply(inExchangeRate));
 | 
			
		||||
 | 
			
		||||
                    } else {
 | 
			
		||||
                        waresParams.setWaresAchieve(waresParams.getWaresAchieve());
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
                    waresParams.setWaresAchieve(BigDecimal.ZERO);
 | 
			
		||||
                }
 | 
			
		||||
                // 商品bv 计算
 | 
			
		||||
                if (waresParams.getAssAchieve() != null) {
 | 
			
		||||
                    if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) {
 | 
			
		||||
                        waresParams.setAssAchieve(waresParams.getAssAchieve().multiply(inExchangeRate));
 | 
			
		||||
                    } else {
 | 
			
		||||
                        waresParams.setAssAchieve(waresParams.getAssAchieve());
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
                    waresParams.setAssAchieve(BigDecimal.ZERO);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                // 查询默认规格
 | 
			
		||||
                JSONArray jsonArray = new JSONArray();
 | 
			
		||||
                List<BdWaresSpecsSkuExt> list = iBdWaresSpecsSkuService.selectByWaresSpecsSku(Collections.singletonList(waresExt.getPkId()));
 | 
			
		||||
                List<BdWaresSpecsSkuExt> list = bdWaresSpecsSkuService.selectByWaresSpecsSku(Collections.singletonList(waresExt.getPkId()));
 | 
			
		||||
                List<BdWaresSpecsSkuExt> collect = list.stream().filter(DistinctByKeyUtil.distinctByKey(BdWaresSpecsSku::getPkWaresDetail)).collect(Collectors.toList());
 | 
			
		||||
                for (BdWaresSpecsSkuExt bdWaresSpecsSku : collect) {
 | 
			
		||||
                    JSONObject js = new JSONObject();
 | 
			
		||||
| 
						 | 
				
			
			@ -604,9 +660,9 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
                }
 | 
			
		||||
                waresParams.setProductGroup(jsonArray);
 | 
			
		||||
                // 查询等级配置
 | 
			
		||||
                LambdaQueryWrapper<BdWaresGrade> queryWrapper = new LambdaQueryWrapper<>();
 | 
			
		||||
                queryWrapper.eq(BdWaresGrade::getPkWares, waresExt.getPkId());
 | 
			
		||||
                List<BdWaresGrade> waresGradeList = iBdWaresGradeService.list(queryWrapper);
 | 
			
		||||
                QueryWrapper<BdWaresGrade> queryWrapper = new QueryWrapper<>();
 | 
			
		||||
                queryWrapper.eq("PK_WARES", waresExt.getPkId());
 | 
			
		||||
                List<BdWaresGrade> waresGradeList = waresGradeService.list(queryWrapper);
 | 
			
		||||
                if (waresGradeList.size() > 0) {
 | 
			
		||||
                    // 查询等级和商品是否存在 不存在不返回该数据
 | 
			
		||||
                    for (BdWaresGrade bdWaresGrade : waresGradeList) {
 | 
			
		||||
| 
						 | 
				
			
			@ -614,6 +670,7 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
                        if (pkSettleGrade.equals(bdWaresGrade.getPkRange())) {
 | 
			
		||||
                            waresParamsList.add(waresParams);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
                    waresParamsList.add(waresParams);
 | 
			
		||||
| 
						 | 
				
			
			@ -628,17 +685,18 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @PostMapping("/get-wares-info")
 | 
			
		||||
    @PostMapping("get-wares-info")
 | 
			
		||||
    public AjaxResult getWaresInfo(@RequestBody WaresInfoParam waresInfoParam) {
 | 
			
		||||
        BdWares wares = iBdWaresService.getWares(waresInfoParam.getPkWares());
 | 
			
		||||
        BdWares wares = bdWaresService.getWares(waresInfoParam.getPkWares());
 | 
			
		||||
        WaresInfoVo waresInfoVo = new WaresInfoVo();
 | 
			
		||||
        waresInfoVo.setWaresName(wares.getWaresName());
 | 
			
		||||
 | 
			
		||||
        waresInfoVo.setNumber(waresInfoParam.getNumber());
 | 
			
		||||
        waresInfoVo.setPkWares(wares.getPkId());
 | 
			
		||||
        waresInfoVo.setCover(wares.getCover1());
 | 
			
		||||
 | 
			
		||||
        List<Integer> waresSpecsSkuList = waresInfoParam.getWaresSpecsSku().stream().map(WaresSpecsSkuParam::getPkWaresSpecsSku).collect(Collectors.toList());
 | 
			
		||||
        List<WaresItemWaresInfo> waresItemWaresInfos = iBdWaresSpecsSkuService.selectByPkIds(waresSpecsSkuList);
 | 
			
		||||
        List<WaresItemWaresInfo> waresItemWaresInfos = bdWaresSpecsSkuService.selectByPkIds(waresSpecsSkuList);
 | 
			
		||||
        BigDecimal waresPrice = BigDecimal.ZERO;
 | 
			
		||||
        BigDecimal pv = BigDecimal.ZERO;
 | 
			
		||||
        BigDecimal waresPriceAmount = BigDecimal.ZERO;
 | 
			
		||||
| 
						 | 
				
			
			@ -653,11 +711,14 @@ public class ApiBdWaresController extends BaseController {
 | 
			
		|||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
 | 
			
		||||
        Integer pkCountry = SecurityUtils.getPkCountry();
 | 
			
		||||
        if (CountryConstants.CHINA_COUNTRY.equals(pkCountry)) {
 | 
			
		||||
            R<CurrencyDTO> currency = currencyServiceApi.getCurrency(pkCountry);
 | 
			
		||||
            // 汇率比例
 | 
			
		||||
            BigDecimal inExchangeRate = currency.getData().getInExchangeRate();
 | 
			
		||||
            pv = ComputeUtil.computeMultiply(pv, inExchangeRate);
 | 
			
		||||
            pvAmount = ComputeUtil.computeMultiply(pvAmount, inExchangeRate);
 | 
			
		||||
        }
 | 
			
		||||
        waresInfoVo.setWaresPrice(waresPrice);
 | 
			
		||||
        waresInfoVo.setPv(pv);
 | 
			
		||||
        waresInfoVo.setWaresCode(wares.getWaresCode());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,9 @@ import java.util.List;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * 商品标签表 Mapper 接口
 | 
			
		||||
 *
 | 
			
		||||
 * @author hzs
 | 
			
		||||
 * @since 2022-10-21
 | 
			
		||||
 */
 | 
			
		||||
public interface BdWaresLabelMapper extends BaseMapper<BdWaresLabel> {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,15 +8,12 @@ import java.util.List;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * 商品标签表 服务类
 | 
			
		||||
 *
 | 
			
		||||
 * @author hzs
 | 
			
		||||
 * @since 2022-10-21
 | 
			
		||||
 */
 | 
			
		||||
public interface IBdWaresLabelService extends IService<BdWaresLabel> {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据商品查询 商品所属标签
 | 
			
		||||
     *
 | 
			
		||||
     * @param waresLabel
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    List<BdLabelExt> selectByList(BdWaresLabel waresLabel);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,9 @@ import java.util.List;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * 极差明细表 服务类
 | 
			
		||||
 *
 | 
			
		||||
 * @author hzs
 | 
			
		||||
 * @since 2022-09-09
 | 
			
		||||
 */
 | 
			
		||||
public interface IBdWaresRangeService extends IService<BdWaresRange> {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -16,6 +19,9 @@ public interface IBdWaresRangeService extends IService<BdWaresRange> {
 | 
			
		|||
     *
 | 
			
		||||
     * @param cuMember   会员
 | 
			
		||||
     * @param pkWareList 商品主键
 | 
			
		||||
     * @return: List<BdWaresRange>
 | 
			
		||||
     * @Author: sui q
 | 
			
		||||
     * @Date: 2022/9/26 16:48
 | 
			
		||||
     */
 | 
			
		||||
    List<BdWaresRange> queryWaresRangeByCondition(CuMember cuMember, List<Integer> pkWareList);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -26,6 +32,9 @@ public interface IBdWaresRangeService extends IService<BdWaresRange> {
 | 
			
		|||
     * @param rangeType    类型
 | 
			
		||||
     * @param level        基本
 | 
			
		||||
     * @param specsSkuList 最小库存单位
 | 
			
		||||
     * @return: List<BdWaresRange>
 | 
			
		||||
     * @Author: sui q
 | 
			
		||||
     * @Date: 2022/9/26 15:33
 | 
			
		||||
     */
 | 
			
		||||
    List<BdWaresRange> querySkuWaresRangeByCondition(Integer pkCountry, Integer rangeType, Integer level, List<Integer> specsSkuList);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,10 +13,19 @@ import java.util.List;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * 商品标签表 服务实现类
 | 
			
		||||
 *
 | 
			
		||||
 * @author hzs
 | 
			
		||||
 * @since 2022-10-21
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class BdWaresLabelServiceImpl extends ServiceImpl<BdWaresLabelMapper, BdWaresLabel> implements IBdWaresLabelService {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据商品查询 商品所属标签
 | 
			
		||||
     *
 | 
			
		||||
     * @param waresLabel
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<BdLabelExt> selectByList(BdWaresLabel waresLabel) {
 | 
			
		||||
        return baseMapper.selectByList(waresLabel);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,10 @@
 | 
			
		|||
package com.hzs.sale.wares.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
			
		||||
 | 
			
		||||
import com.hzs.common.core.constant.CountryConstants;
 | 
			
		||||
import com.hzs.common.core.constant.SystemFieldConstants;
 | 
			
		||||
import com.hzs.common.core.enums.EAwards;
 | 
			
		||||
import com.hzs.common.core.enums.ERangeType;
 | 
			
		||||
import com.hzs.common.domain.member.base.CuMember;
 | 
			
		||||
| 
						 | 
				
			
			@ -22,25 +23,28 @@ import java.util.List;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * 极差明细表 服务实现类
 | 
			
		||||
 *
 | 
			
		||||
 * @author hzs
 | 
			
		||||
 * @since 2022-09-09
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdWaresRange> implements IBdWaresRangeService {
 | 
			
		||||
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IRangeServiceApi iRangeServiceApi;
 | 
			
		||||
    IRangeServiceApi rangeServiceApi;
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IAwardsServiceApi iAwardsServiceApi;
 | 
			
		||||
    IAwardsServiceApi awardsServiceApi;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<BdWaresRange> queryWaresRangeByCondition(CuMember cuMember, List<Integer> pkWareList) {
 | 
			
		||||
        int level = cuMember.getPkSettleGrade();
 | 
			
		||||
        int rangeType = ERangeType.GRADE.getValue();
 | 
			
		||||
        BdAwards bdAwards = iAwardsServiceApi.getAwardsOne(cuMember.getPkAwards()).getData();
 | 
			
		||||
        BdAwards bdAwards = awardsServiceApi.getAwardsOne(cuMember.getPkAwards()).getData();
 | 
			
		||||
        if (bdAwards.getAwardsValue() > EAwards.MEMBER.getValue()) {
 | 
			
		||||
            level = cuMember.getPkAwards();
 | 
			
		||||
            rangeType = ERangeType.AWARDS.getValue();
 | 
			
		||||
        }
 | 
			
		||||
        RangeDTO rangeDTO = iRangeServiceApi.queryRangeDtoByCondition(cuMember.getPkSettleCountry(), rangeType, level).getData();
 | 
			
		||||
        RangeDTO rangeDTO = rangeServiceApi.queryRangeDtoByCondition(cuMember.getPkSettleCountry(), rangeType, level).getData();
 | 
			
		||||
        if (rangeDTO == null) {
 | 
			
		||||
            return new ArrayList<>();
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -49,13 +53,19 @@ public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdW
 | 
			
		|||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<BdWaresRange> querySkuWaresRangeByCondition(Integer pkCountry, Integer rangeType, Integer level, List<Integer> specsSkuList) {
 | 
			
		||||
        RangeDTO rangeDTO = iRangeServiceApi.queryRangeDtoByCondition(pkCountry, rangeType, level).getData();
 | 
			
		||||
        LambdaQueryWrapper<BdWaresRange> queryWrapper = new LambdaQueryWrapper<>();
 | 
			
		||||
        queryWrapper.eq(BdWaresRange::getPkRange, rangeDTO.getPkRange());
 | 
			
		||||
        queryWrapper.in(BdWaresRange::getPkWaresSpecsSku, specsSkuList);
 | 
			
		||||
        RangeDTO rangeDTO = rangeServiceApi.queryRangeDtoByCondition(pkCountry, rangeType, level).getData();
 | 
			
		||||
        QueryWrapper<BdWaresRange> queryWrapper = new QueryWrapper<>();
 | 
			
		||||
        queryWrapper.eq(SystemFieldConstants.PK_RANGE, rangeDTO.getPkRange());
 | 
			
		||||
        queryWrapper.in(SystemFieldConstants.PK_WARES_SPECS_SKU, specsSkuList);
 | 
			
		||||
        return baseMapper.selectList(queryWrapper);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 以range 为主表查询商品极差信息
 | 
			
		||||
     *
 | 
			
		||||
     * @param pkWares
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<BdWaresRange> queryWaresList(Long pkWares, Integer pkCountry) {
 | 
			
		||||
        return baseMapper.queryWaresList(pkWares, pkCountry);
 | 
			
		||||
| 
						 | 
				
			
			@ -64,7 +74,7 @@ public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdW
 | 
			
		|||
    @Override
 | 
			
		||||
    public List<BdWaresRange> listRetailWaresRange(Integer pkGrade, List<Integer> pkWareList) {
 | 
			
		||||
        // 新零售只有等级级差,不需要处理奖衔
 | 
			
		||||
        RangeDTO rangeDTO = iRangeServiceApi.queryRangeDtoByCondition(CountryConstants.CHINA_COUNTRY, ERangeType.GRADE.getValue(), pkGrade).getData();
 | 
			
		||||
        RangeDTO rangeDTO = rangeServiceApi.queryRangeDtoByCondition(CountryConstants.CHINA_COUNTRY, ERangeType.GRADE.getValue(), pkGrade).getData();
 | 
			
		||||
        if (rangeDTO == null) {
 | 
			
		||||
            return new ArrayList<>();
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,9 @@ import java.util.List;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * 极差配置 Mapper 接口
 | 
			
		||||
 *
 | 
			
		||||
 * @author zhangjing
 | 
			
		||||
 * @since 2022-09-09
 | 
			
		||||
 */
 | 
			
		||||
public interface BdRangeMapper extends BaseMapper<BdRange> {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -18,6 +21,9 @@ public interface BdRangeMapper extends BaseMapper<BdRange> {
 | 
			
		|||
     * @param pkCountry 国家
 | 
			
		||||
     * @param rangeType 极差类型
 | 
			
		||||
     * @param pkLevel   等级
 | 
			
		||||
     * @return: Map<String, RangeDTO>
 | 
			
		||||
     * @Author: sui q
 | 
			
		||||
     * @Date: 2023/1/3 14:00
 | 
			
		||||
     */
 | 
			
		||||
    List<RangeDTO> queryRangeDto(@Param("pkCountry") Integer pkCountry,
 | 
			
		||||
                                 @Param("rangeType") Integer rangeType,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
package com.hzs.system.config.provider;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import cn.hutool.core.collection.CollectionUtil;
 | 
			
		||||
import com.hzs.common.core.domain.R;
 | 
			
		||||
import com.hzs.common.domain.system.config.BdAdvertBanner;
 | 
			
		||||
import com.hzs.system.config.AdvertBannerServiceApi;
 | 
			
		||||
import com.hzs.system.config.dto.AdvertBannerDTO;
 | 
			
		||||
import com.hzs.system.config.service.IBdAdvertBannerService;
 | 
			
		||||
import org.apache.dubbo.config.annotation.DubboService;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @BelongsProject: hzs_cloud
 | 
			
		||||
 * @BelongsPackage: com.hzs.system.config.provider
 | 
			
		||||
 * @Author: yh
 | 
			
		||||
 * @CreateTime: 2023-05-15  10:14
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * @Version: 1.0
 | 
			
		||||
 */
 | 
			
		||||
@DubboService
 | 
			
		||||
public class AdvertBannerServiceProvider implements AdvertBannerServiceApi {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdAdvertBannerService advertBannerService;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询全部banner
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<List<AdvertBannerDTO>> findAll() {
 | 
			
		||||
        List<AdvertBannerDTO> bannerDTOList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        List<BdAdvertBanner> bannerList = advertBannerService.listData(null);
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(bannerList)) {
 | 
			
		||||
            bannerDTOList = bannerList.stream().map(advertBanner -> BeanUtil.copyProperties(advertBanner, AdvertBannerDTO.class)).collect(Collectors.toList());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return R.ok(bannerDTOList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -12,27 +12,37 @@ import java.util.List;
 | 
			
		|||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 极差配置
 | 
			
		||||
 * @description: 极差配置
 | 
			
		||||
 * @author: zhang jing
 | 
			
		||||
 * @date: 2022/11/10 17:02
 | 
			
		||||
 * @param:
 | 
			
		||||
 * @return:
 | 
			
		||||
 **/
 | 
			
		||||
@DubboService
 | 
			
		||||
public class RangeServiceProvider implements IRangeServiceApi {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdRangeService iBdRangeService;
 | 
			
		||||
    private IBdRangeService rangeService;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @description: 根据国家查询极差配置列表
 | 
			
		||||
     * @author: zhang jing
 | 
			
		||||
     * @date: 2022/9/29 15:17
 | 
			
		||||
     * @param: [pkCountry]
 | 
			
		||||
     * @return: com.hzs.common.core.domain.R<java.util.List < com.hzs.common.domain.system.config.BdAwards>>
 | 
			
		||||
     **/
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<List<BdRangeExt>> queryRange(Integer pkCountry) {
 | 
			
		||||
        return R.ok(iBdRangeService.queryRange(pkCountry));
 | 
			
		||||
        return R.ok(rangeService.queryRange(pkCountry));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<Map<String, RangeDTO>> queryRangeDto() {
 | 
			
		||||
        return R.ok(iBdRangeService.queryRangeDto());
 | 
			
		||||
        return R.ok(rangeService.queryRangeDto());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<RangeDTO> queryRangeDtoByCondition(Integer pkCountry, Integer rangeType, Integer pkLevel) {
 | 
			
		||||
        return R.ok(iBdRangeService.getRangeDTO(pkCountry, rangeType, pkLevel));
 | 
			
		||||
        return R.ok(rangeService.getRangeDTO(pkCountry, rangeType, pkLevel));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,27 +9,48 @@ import java.util.List;
 | 
			
		|||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 极差配置 服务类
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author zhangjing
 | 
			
		||||
 * @since 2022-09-09
 | 
			
		||||
 */
 | 
			
		||||
public interface IBdRangeService extends IService<BdRange> {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增极差
 | 
			
		||||
     * @description: 新增极差
 | 
			
		||||
     * @author: zhang jing
 | 
			
		||||
     * @date: 2022/10/28 14:23
 | 
			
		||||
     * @param: [rangeExt]
 | 
			
		||||
     * @return: boolean
 | 
			
		||||
     **/
 | 
			
		||||
    boolean saveRange(BdRangeExt rangeExt);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 修改极差
 | 
			
		||||
     * @description: 修改极差
 | 
			
		||||
     * @author: zhang jing
 | 
			
		||||
     * @date: 2022/10/28 14:23
 | 
			
		||||
     * @param: [rangeExt]
 | 
			
		||||
     * @return: boolean
 | 
			
		||||
     **/
 | 
			
		||||
    boolean updateRange(BdRangeExt rangeExt);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据国家查询极差配置列表
 | 
			
		||||
     * @description: 根据国家查询极差配置列表
 | 
			
		||||
     * @author: zhang jing
 | 
			
		||||
     * @date: 2022/11/11 18:02
 | 
			
		||||
     * @param: [pkCountry]
 | 
			
		||||
     * @return: java.util.List<com.hzs.common.domain.system.config.BdRange>
 | 
			
		||||
     **/
 | 
			
		||||
    List<BdRangeExt> queryRange(Integer pkCountry);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询各个国家极差的配置  键为 国家+极差类型+等级主键
 | 
			
		||||
     *
 | 
			
		||||
     * @return: Map<String, RangeDTO>
 | 
			
		||||
     * @Author: sui q
 | 
			
		||||
     * @Date: 2023/1/3 14:00
 | 
			
		||||
     */
 | 
			
		||||
    Map<String, RangeDTO> queryRangeDto();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +60,9 @@ public interface IBdRangeService extends IService<BdRange> {
 | 
			
		|||
     * @param pkCountry 国家
 | 
			
		||||
     * @param rangeType 极差类型
 | 
			
		||||
     * @param pkLevel   等级主键
 | 
			
		||||
     * @return: RangeDTO
 | 
			
		||||
     * @Author: sui q
 | 
			
		||||
     * @Date: 2023/2/4 15:54
 | 
			
		||||
     */
 | 
			
		||||
    RangeDTO getRangeDTO(Integer pkCountry, Integer rangeType, Integer pkLevel);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,17 +7,20 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
			
		|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
			
		||||
import com.hzs.common.core.constant.CacheConstants;
 | 
			
		||||
import com.hzs.common.core.constant.Constants;
 | 
			
		||||
import com.hzs.common.core.domain.R;
 | 
			
		||||
import com.hzs.common.core.enums.*;
 | 
			
		||||
import com.hzs.common.core.service.RedisService;
 | 
			
		||||
import com.hzs.common.domain.system.config.BdRange;
 | 
			
		||||
import com.hzs.common.domain.system.config.BdRangeDetails;
 | 
			
		||||
import com.hzs.common.domain.system.config.ext.BdRangeExt;
 | 
			
		||||
import com.hzs.common.security.utils.SecurityUtils;
 | 
			
		||||
import com.hzs.system.base.ITransactionServiceApi;
 | 
			
		||||
import com.hzs.system.config.dto.RangeDTO;
 | 
			
		||||
import com.hzs.system.config.mapper.BdRangeMapper;
 | 
			
		||||
import com.hzs.system.config.service.IBdRangeDetailsService;
 | 
			
		||||
import com.hzs.system.config.service.IBdRangeService;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.apache.dubbo.config.annotation.DubboReference;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -26,18 +29,40 @@ import java.util.concurrent.TimeUnit;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * 极差配置 服务实现类
 | 
			
		||||
 *
 | 
			
		||||
 * @author zhangjing
 | 
			
		||||
 * @since 2022-09-09
 | 
			
		||||
 */
 | 
			
		||||
@Slf4j
 | 
			
		||||
@Service
 | 
			
		||||
public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> implements IBdRangeService {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdRangeDetailsService iBdRangeDetailsService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IBdRangeDetailsService rangeDetailsService;
 | 
			
		||||
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    ITransactionServiceApi iTransactionServiceApi;
 | 
			
		||||
 | 
			
		||||
    private RedisService redisService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    public void setRedisService(RedisService redisService) {
 | 
			
		||||
        this.redisService = redisService;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @description: 新增极差
 | 
			
		||||
     * @author: zhang jing
 | 
			
		||||
     * @date: 2022/10/28 14:23
 | 
			
		||||
     * @param: [rangeExt]
 | 
			
		||||
     * @return: boolean
 | 
			
		||||
     **/
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean saveRange(BdRangeExt rangeExt) {
 | 
			
		||||
        //字段翻译保存到数据库
 | 
			
		||||
        R<Integer> pkTransaction = iTransactionServiceApi.createTransaction(rangeExt.getPkCountry(), ETransactionKey.RANGE,
 | 
			
		||||
                rangeExt.getRangeName(), EYesNo.YES, EYesNo.NO);
 | 
			
		||||
        rangeExt.setPkTransaction(pkTransaction.getData());
 | 
			
		||||
        LambdaQueryWrapper<BdRange> queryWrapper = new LambdaQueryWrapper<>();
 | 
			
		||||
        queryWrapper.eq(BdRange::getPkCountry, rangeExt.getPkCountry());
 | 
			
		||||
        queryWrapper.eq(BdRange::getRangeValue, rangeExt.getRangeValue());
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +80,7 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
 | 
			
		|||
                rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
 | 
			
		||||
                rangeDetails.setPkCreator(SecurityUtils.getUserId());
 | 
			
		||||
                rangeDetails.setCreationTime(new Date());
 | 
			
		||||
                iBdRangeDetailsService.save(rangeDetails);
 | 
			
		||||
                rangeDetailsService.save(rangeDetails);
 | 
			
		||||
            }
 | 
			
		||||
            //奖衔
 | 
			
		||||
            for (Integer aw : awardsList) {
 | 
			
		||||
| 
						 | 
				
			
			@ -66,20 +91,31 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
 | 
			
		|||
                rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
 | 
			
		||||
                rangeDetails.setPkCreator(SecurityUtils.getUserId());
 | 
			
		||||
                rangeDetails.setCreationTime(new Date());
 | 
			
		||||
                iBdRangeDetailsService.save(rangeDetails);
 | 
			
		||||
                rangeDetailsService.save(rangeDetails);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        redisService.deleteObject(CacheConstants.BD_RANGE + rangeExt.getPkCountry());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @description: 修改极差
 | 
			
		||||
     * @author: zhang jing
 | 
			
		||||
     * @date: 2022/10/28 14:23
 | 
			
		||||
     * @param: [rangeExt]
 | 
			
		||||
     * @return: boolean
 | 
			
		||||
     **/
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean updateRange(BdRangeExt rangeExt) {
 | 
			
		||||
        //字段翻译保存到数据库
 | 
			
		||||
        R<Integer> pkTransaction = iTransactionServiceApi.createTransaction(rangeExt.getPkCountry(), ETransactionKey.RANGE,
 | 
			
		||||
                rangeExt.getRangeName(), EYesNo.YES, EYesNo.NO);
 | 
			
		||||
        rangeExt.setPkTransaction(pkTransaction.getData());
 | 
			
		||||
        baseMapper.updateById(rangeExt);
 | 
			
		||||
        LambdaUpdateWrapper<BdRangeDetails> updateWrapper = new LambdaUpdateWrapper<>();
 | 
			
		||||
        updateWrapper.set(BdRangeDetails::getDelFlag, EYesNo.NO.getIntValue());
 | 
			
		||||
        updateWrapper.eq(BdRangeDetails::getPkRange, rangeExt.getPkId());
 | 
			
		||||
        iBdRangeDetailsService.update(updateWrapper);
 | 
			
		||||
        rangeDetailsService.update(updateWrapper);
 | 
			
		||||
        List<Integer> gradeList = rangeExt.getGradeList();
 | 
			
		||||
        List<Integer> awardsList = rangeExt.getAwardsList();
 | 
			
		||||
        //等级
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +127,7 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
 | 
			
		|||
            rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
 | 
			
		||||
            rangeDetails.setPkCreator(SecurityUtils.getUserId());
 | 
			
		||||
            rangeDetails.setCreationTime(new Date());
 | 
			
		||||
            iBdRangeDetailsService.save(rangeDetails);
 | 
			
		||||
            rangeDetailsService.save(rangeDetails);
 | 
			
		||||
        }
 | 
			
		||||
        //奖衔
 | 
			
		||||
        for (Integer aw : awardsList) {
 | 
			
		||||
| 
						 | 
				
			
			@ -102,12 +138,20 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
 | 
			
		|||
            rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
 | 
			
		||||
            rangeDetails.setPkCreator(SecurityUtils.getUserId());
 | 
			
		||||
            rangeDetails.setCreationTime(new Date());
 | 
			
		||||
            iBdRangeDetailsService.save(rangeDetails);
 | 
			
		||||
            rangeDetailsService.save(rangeDetails);
 | 
			
		||||
        }
 | 
			
		||||
        redisService.deleteObject(CacheConstants.BD_RANGE + rangeExt.getPkCountry());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @description: 根据国家查询极差配置列表
 | 
			
		||||
     * @author: zhang jing
 | 
			
		||||
     * @date: 2022/11/11 18:07
 | 
			
		||||
     * @param: [pkCountry]
 | 
			
		||||
     * @return: java.util.List<com.hzs.common.domain.system.config.BdRange>
 | 
			
		||||
     **/
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<BdRangeExt> queryRange(Integer pkCountry) {
 | 
			
		||||
        List<BdRangeExt> rangeList = redisService.getCacheList(CacheConstants.BD_RANGE + pkCountry);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,6 +55,11 @@ public class SystemFieldConstants {
 | 
			
		|||
     */
 | 
			
		||||
    public static final String MODIFIED_TIME = "MODIFIED_TIME";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 国家
 | 
			
		||||
     */
 | 
			
		||||
    public static final String PK_COUNTRY_VALUE = "pkCountry";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 国家
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -65,6 +70,46 @@ public class SystemFieldConstants {
 | 
			
		|||
     */
 | 
			
		||||
    public static final String PK_CORP = "pk_corp";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 等级值
 | 
			
		||||
     */
 | 
			
		||||
    public static final String GRADE_VALUE = "grade_value";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 等级结算值
 | 
			
		||||
     */
 | 
			
		||||
    public static final String START_VALUE = "start_value";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 极差类型
 | 
			
		||||
     */
 | 
			
		||||
    public static final String RANGE_TYPE = "range_type";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 级别
 | 
			
		||||
     */
 | 
			
		||||
    public static final String PK_LEVEL = "pk_level";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 极差
 | 
			
		||||
     */
 | 
			
		||||
    public static final String PK_RANGE = "pk_range";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 规格sku主键
 | 
			
		||||
     */
 | 
			
		||||
    public static final String PK_WARES_SPECS_SKU = "pk_wares_specs_sku";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 商品明细主键
 | 
			
		||||
     */
 | 
			
		||||
    public static final String PK_WARES_DETAIL = "PK_WARES_DETAIL";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 商品主键
 | 
			
		||||
     */
 | 
			
		||||
    public static final String PK_WARES = "PK_WARES";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 审核状态
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,12 @@ import lombok.experimental.Accessors;
 | 
			
		|||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 商品标签表
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author hzs
 | 
			
		||||
 * @since 2022-10-21
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,12 @@ import lombok.experimental.Accessors;
 | 
			
		|||
import java.math.BigDecimal;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 极差配置
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author zhangjing
 | 
			
		||||
 * @since 2022-09-09
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue