## 商品列表添加权限控制;

This commit is contained in:
cabbage 2025-07-10 14:29:19 +08:00
parent dadd325016
commit 7376415d2f
17 changed files with 132 additions and 417 deletions

View File

@ -1,25 +0,0 @@
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();
}

View File

@ -1,14 +1,13 @@
package com.hzs.bonus.bonus.service.impl; package com.hzs.bonus.bonus.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.bonus.bonus.mapper.BdWaresBonusMapper; import com.hzs.bonus.bonus.mapper.BdWaresBonusMapper;
import com.hzs.bonus.bonus.param.BdWaresBonusParam; import com.hzs.bonus.bonus.param.BdWaresBonusParam;
import com.hzs.bonus.bonus.service.IBdWaresBonusItemsService; import com.hzs.bonus.bonus.service.IBdWaresBonusItemsService;
import com.hzs.bonus.bonus.service.IBdWaresBonusService; 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.enums.EYesNo;
import com.hzs.common.core.utils.DateUtils; import com.hzs.common.core.utils.DateUtils;
import com.hzs.common.domain.member.bonus.BdWaresBonus; import com.hzs.common.domain.member.bonus.BdWaresBonus;
@ -29,7 +28,7 @@ import java.util.List;
public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdWaresBonus> implements IBdWaresBonusService { public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdWaresBonus> implements IBdWaresBonusService {
@Autowired @Autowired
private IBdWaresBonusItemsService waresBonusItemsService; private IBdWaresBonusItemsService iBdWaresBonusItemsService;
@Override @Override
public List<BdWaresBonusExt> querySpecialWaresBonus(BdWaresBonusParam waresBonusParam) { public List<BdWaresBonusExt> querySpecialWaresBonus(BdWaresBonusParam waresBonusParam) {
@ -40,21 +39,21 @@ public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdW
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteSpecialWaresBonus(Long pkId, Long userId) { public void deleteSpecialWaresBonus(Long pkId, Long userId) {
// 删除明细表 // 删除明细表
waresBonusItemsService.deleteWaresBonusItems(null, pkId, userId); iBdWaresBonusItemsService.deleteWaresBonusItems(null, pkId, userId);
UpdateWrapper<BdWaresBonus> updateWrapper = new UpdateWrapper<>(); LambdaUpdateWrapper<BdWaresBonus> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(SystemFieldConstants.PK_MODIFIED, userId); updateWrapper.set(BdWaresBonus::getPkModified, userId);
updateWrapper.set(SystemFieldConstants.DEL_FLAG, EYesNo.NO.getIntValue()); updateWrapper.set(BdWaresBonus::getDelFlag, EYesNo.NO.getIntValue());
updateWrapper.set(SystemFieldConstants.MODIFIED_TIME, DateUtils.currentDateTime()); updateWrapper.set(BdWaresBonus::getModifiedTime, DateUtils.currentDateTime());
updateWrapper.eq(SystemFieldConstants.PK_ID, pkId); updateWrapper.eq(BdWaresBonus::getPkId, pkId);
update(updateWrapper); update(updateWrapper);
} }
@Override @Override
public BdWaresBonus queryWaresBonusById(BdWaresBonusParam waresBonusParam) { public BdWaresBonus queryWaresBonusById(BdWaresBonusParam waresBonusParam) {
QueryWrapper<BdWaresBonus> queryWrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdWaresBonus> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SystemFieldConstants.PK_WARES, waresBonusParam.getPkWares()); queryWrapper.eq(BdWaresBonus::getPkWares, waresBonusParam.getPkWares());
if (waresBonusParam.getPkId() != null) { if (waresBonusParam.getPkId() != null) {
queryWrapper.ne(SystemFieldConstants.PK_ID, waresBonusParam.getPkId()); queryWrapper.ne(BdWaresBonus::getPkId, waresBonusParam.getPkId());
} }
return baseMapper.selectOne(queryWrapper); return baseMapper.selectOne(queryWrapper);
} }
@ -91,12 +90,12 @@ public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdW
} }
if (updateWaresBonusItems.size() > 0) { if (updateWaresBonusItems.size() > 0) {
// 删除 // 删除
waresBonusItemsService.deleteWaresBonusItems(updateWaresBonusItems, updateWaresBonusItems.get(0).getPkWaresBonus(), userId); iBdWaresBonusItemsService.deleteWaresBonusItems(updateWaresBonusItems, updateWaresBonusItems.get(0).getPkWaresBonus(), userId);
waresBonusItemsService.updateWaresBonusItems(updateWaresBonusItems); iBdWaresBonusItemsService.updateWaresBonusItems(updateWaresBonusItems);
} }
// 新增 // 新增
if (insertWaresBonusItems.size() > 0) { if (insertWaresBonusItems.size() > 0) {
waresBonusItemsService.insetWaresBonusItems(insertWaresBonusItems); iBdWaresBonusItemsService.insetWaresBonusItems(insertWaresBonusItems);
} }
} }

View File

@ -17,14 +17,12 @@ import com.hzs.common.core.web.domain.AjaxResult;
import com.hzs.common.domain.member.ext.CuMemberExt; import com.hzs.common.domain.member.ext.CuMemberExt;
import com.hzs.common.domain.sale.ext.BdWaresExt; import com.hzs.common.domain.sale.ext.BdWaresExt;
import com.hzs.common.domain.sale.ext.BdWaresSpecsSkuExt; import com.hzs.common.domain.sale.ext.BdWaresSpecsSkuExt;
import com.hzs.common.domain.sale.wares.BdWares; import com.hzs.common.domain.sale.wares.*;
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.config.BdLabel;
import com.hzs.common.domain.system.ext.BdLabelExt; import com.hzs.common.domain.system.ext.BdLabelExt;
import com.hzs.common.security.utils.SecurityUtils; import com.hzs.common.security.utils.SecurityUtils;
import com.hzs.member.base.IMemberServiceApi; 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.RetailWaresDetailParam;
import com.hzs.retail.wares.param.RetailWaresParam; import com.hzs.retail.wares.param.RetailWaresParam;
import com.hzs.retail.wares.vo.RetailWaresDetailVO; import com.hzs.retail.wares.vo.RetailWaresDetailVO;
@ -68,7 +66,7 @@ public class ApiRetailWaresController extends BaseController {
private IBdWaresRangeService iBdWaresRangeService; private IBdWaresRangeService iBdWaresRangeService;
@DubboReference @DubboReference
ICurrencyServiceApi currencyServiceApi; ICurrencyServiceApi iCurrencyServiceApi;
@DubboReference @DubboReference
IAreaCurrencyServiceApi iAreaCurrencyServiceApi; IAreaCurrencyServiceApi iAreaCurrencyServiceApi;
@DubboReference @DubboReference
@ -94,7 +92,6 @@ public class ApiRetailWaresController extends BaseController {
param.setSystemType(SecurityUtils.getSystemType()); param.setSystemType(SecurityUtils.getSystemType());
param.setPkCountry(SecurityUtils.getPkCountry()); param.setPkCountry(SecurityUtils.getPkCountry());
// 商品列表 // 商品列表
startPage();
List<BdWaresExt> bdWaresExtList = iBdWaresService.listRetailWaresByCondition(param); List<BdWaresExt> bdWaresExtList = iBdWaresService.listRetailWaresByCondition(param);
if (CollectionUtil.isNotEmpty(bdWaresExtList)) { if (CollectionUtil.isNotEmpty(bdWaresExtList)) {
@ -177,9 +174,11 @@ public class ApiRetailWaresController extends BaseController {
Integer pkGrade, boolean showLabel) { Integer pkGrade, boolean showLabel) {
// 返回商品列表 // 返回商品列表
List<RetailWaresVO> resultList = new ArrayList<>(); List<RetailWaresVO> resultList = new ArrayList<>();
// 当前会员ID
Long userId = SecurityUtils.getUserId();
// 汇率比例 // 汇率比例
R<CurrencyDTO> currency = currencyServiceApi.getCurrency(SecurityUtils.getPkCountry()); R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
BigDecimal inExchangeRate = currency.getData().getInExchangeRate(); BigDecimal inExchangeRate = currency.getData().getInExchangeRate();
// 商品主键列表 // 商品主键列表
@ -208,7 +207,25 @@ 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) { for (BdWaresExt bdWaresExt : bdWaresExtList) {
// 校验团队信息
Boolean isShowWares = waresShowMap.get(bdWaresExt.getPkId());
if (null == isShowWares || !isShowWares) {
continue;
}
if (null != list) { if (null != list) {
// 商品标签处理 // 商品标签处理
// 保证标签 // 保证标签

View File

@ -5,7 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hzs.common.core.constant.*; import com.hzs.common.core.constant.*;
import com.hzs.common.core.constant.msg.SaOrderMsgConstants; import com.hzs.common.core.constant.msg.SaOrderMsgConstants;
import com.hzs.common.core.constant.msg.WaresMsgConstants; import com.hzs.common.core.constant.msg.WaresMsgConstants;
@ -35,7 +35,6 @@ import com.hzs.sale.wares.service.*;
import com.hzs.sale.wares.vo.*; import com.hzs.sale.wares.vo.*;
import com.hzs.system.base.ICurrencyServiceApi; import com.hzs.system.base.ICurrencyServiceApi;
import com.hzs.system.base.dto.CurrencyDTO; import com.hzs.system.base.dto.CurrencyDTO;
import com.hzs.system.config.AdvertBannerServiceApi;
import com.hzs.system.config.IAreaCurrencyServiceApi; import com.hzs.system.config.IAreaCurrencyServiceApi;
import com.hzs.system.config.IGradeServiceApi; import com.hzs.system.config.IGradeServiceApi;
import com.hzs.system.config.dto.AreaCurrencyDTO; import com.hzs.system.config.dto.AreaCurrencyDTO;
@ -60,52 +59,34 @@ import java.util.stream.Collectors;
public class ApiBdWaresController extends BaseController { public class ApiBdWaresController extends BaseController {
@DubboReference @DubboReference
IGradeServiceApi gradeServiceApi; IGradeServiceApi iGradeServiceApi;
@DubboReference @DubboReference
IMemberServiceApi memberServiceApi; IMemberServiceApi iMemberServiceApi;
@DubboReference @DubboReference
IAreaCurrencyServiceApi areaCurrencyServiceApi; IAreaCurrencyServiceApi iAreaCurrencyServiceApi;
@DubboReference @DubboReference
ICurrencyServiceApi currencyServiceApi; ICurrencyServiceApi iCurrencyServiceApi;
@Autowired @Autowired
private IBdWaresLabelService waresLabelService; private IBdWaresService iBdWaresService;
@Autowired @Autowired
private IBdWaresGradeService waresGradeService; private IBdWaresSpecsSkuService iBdWaresSpecsSkuService;
@Autowired
private IBdWaresLabelService iBdWaresLabelService;
@Autowired
private IBdWaresGradeService iBdWaresGradeService;
@Autowired
private IBdWaresRangeService iBdWaresRangeService;
@Autowired
protected IShoppingCartService iShoppingCartService;
@Autowired
private ISaOrderService iSaOrderService;
@Autowired @Autowired
protected RedisService redisService; protected RedisService redisService;
@Autowired @Autowired
protected StringRedisTemplate redisTemplate; 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;
}
/** /**
* 根据专区查找专区的商品 * 根据专区查找专区的商品
@ -117,48 +98,42 @@ public class ApiBdWaresController extends BaseController {
if (cuWaresParams.getSpecialArea() == null) { if (cuWaresParams.getSpecialArea() == null) {
return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY)); 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<CuWaresParams> waresParamsList = new ArrayList<>();
// 查询商品列表 // 查询商品列表
List<BdWaresExt> bdWaresExtList = bdWaresService.queryWaresByCondition(cuWaresParams.getSpecialArea(), cuWaresParams.getPkAreaClassify(), cuWaresParams.getWaresName(), null, null, pkCountry); List<BdWaresExt> bdWaresExtList = iBdWaresService.queryWaresByCondition(cuWaresParams.getSpecialArea(), cuWaresParams.getPkAreaClassify(), cuWaresParams.getWaresName(), null, null, pkCountry);
if (CollectionUtil.isNotEmpty(bdWaresExtList)) { if (CollectionUtil.isNotEmpty(bdWaresExtList)) {
// 等级 // 等级
R<List<GradeDTO>> gradeDTO = gradeServiceApi.queryGradeList(pkCountry); R<List<GradeDTO>> gradeDTO = iGradeServiceApi.queryGradeList(pkCountry);
List<GradeDTO> gradeList = gradeDTO.getData(); 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())); Map<Integer, GradeDTO> gradeMap = gradeList.stream().filter(grade -> ESystemType.DEFAULT.getValue() == grade.getSystemType()).collect(Collectors.toMap(GradeDTO::getGradeValue, Function.identity()));
// 当前会员ID // 当前会员ID
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
CuMember cuMember = saOrderService.getCuMemberByKey(userId); CuMember cuMember = iSaOrderService.getCuMemberByKey(userId);
// 当前会员编号 // 当前会员编号
String memberCode = cuMember.getMemberCode(); String memberCode = cuMember.getMemberCode();
// 汇率比例 // 汇率比例
R<CurrencyDTO> currency = currencyServiceApi.getCurrency(SecurityUtils.getPkCountry()); R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
BigDecimal inExchangeRate = currency.getData().getInExchangeRate(); BigDecimal inExchangeRate = currency.getData().getInExchangeRate();
// 商品主键列表 // 商品主键列表
List<Integer> waresIdList = bdWaresExtList.stream().map(BdWares::getPkId).collect(Collectors.toList()); List<Integer> waresIdList = bdWaresExtList.stream().map(BdWares::getPkId).collect(Collectors.toList());
// 检验商品团队信息 // 检验商品团队信息
Map<Integer, List<BdWaresAuthority>> waresAuthorityMap = bdWaresService.getWaresAuthority(waresIdList); Map<Integer, List<BdWaresAuthority>> waresAuthorityMap = iBdWaresService.getWaresAuthority(waresIdList);
List<ShowWaresDTO> showWaresList = bdWaresExtList.stream().map(we -> getShowWares(we.getPkId(), userId, memberCode, waresAuthorityMap)).collect(Collectors.toList()); List<ShowWaresDTO> showWaresList = bdWaresExtList.stream().map(we -> getShowWares(we.getPkId(), userId, memberCode, waresAuthorityMap)).collect(Collectors.toList());
R<Map<Integer, Boolean>> waresShowMapDto = memberServiceApi.checkIsShowWares(showWaresList); R<Map<Integer, Boolean>> waresShowMapDto = iMemberServiceApi.checkIsShowWares(showWaresList);
Map<Integer, Boolean> waresShowMap = waresShowMapDto.getData(); Map<Integer, Boolean> waresShowMap = waresShowMapDto.getData();
// 商品标签列表 // 商品标签列表
BdWaresLabel waresLabel = new BdWaresLabel(); BdWaresLabel waresLabel = new BdWaresLabel();
waresLabel.setPkIdList(waresIdList); waresLabel.setPkIdList(waresIdList);
List<BdLabelExt> list = waresLabelService.selectByList(waresLabel); List<BdLabelExt> list = iBdWaresLabelService.selectByList(waresLabel);
// 标签 // 标签
for (BdWaresExt bdWaresExt : bdWaresExtList) { for (BdWaresExt bdWaresExt : bdWaresExtList) {
@ -193,14 +168,14 @@ public class ApiBdWaresController extends BaseController {
// 查询商品sku 最小值 和数量 // 查询商品sku 最小值 和数量
Map<Integer, List<BdWaresSpecsSkuExt>> waresSpecsSkuMap = new HashMap<>(); Map<Integer, List<BdWaresSpecsSkuExt>> waresSpecsSkuMap = new HashMap<>();
if (waresIdList.size() > 0) { if (waresIdList.size() > 0) {
List<BdWaresSpecsSkuExt> waresSpecsSkuArray = bdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(waresIdList); List<BdWaresSpecsSkuExt> waresSpecsSkuArray = iBdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(waresIdList);
waresSpecsSkuMap = waresSpecsSkuArray.stream().collect(Collectors.groupingBy(BdWaresSpecsSkuExt::getPkWares)); waresSpecsSkuMap = waresSpecsSkuArray.stream().collect(Collectors.groupingBy(BdWaresSpecsSkuExt::getPkWares));
} }
List<BdWaresSpecsSkuExt> waresSpecsSkuList = new ArrayList<>(); List<BdWaresSpecsSkuExt> waresSpecsSkuList = new ArrayList<>();
if (waresIdList.size() > 0) { if (waresIdList.size() > 0) {
// 查询默认规格 // 查询默认规格
waresSpecsSkuList = bdWaresSpecsSkuService.selectByWaresSpecsSku(waresIdList); waresSpecsSkuList = iBdWaresSpecsSkuService.selectByWaresSpecsSku(waresIdList);
} }
List<BdWaresRange> bdWaresRangeList = new ArrayList<>(); List<BdWaresRange> bdWaresRangeList = new ArrayList<>();
@ -209,14 +184,14 @@ public class ApiBdWaresController extends BaseController {
|| EOrderType.COOPERATE_ORDER.getValue() == cuWaresParams.getSpecialArea()) { || EOrderType.COOPERATE_ORDER.getValue() == cuWaresParams.getSpecialArea()) {
// 复购业绩计算 // 复购业绩计算
if (waresIdList.size() > 0) { if (waresIdList.size() > 0) {
bdWaresRangeList = bdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdList); bdWaresRangeList = iBdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdList);
} }
} }
Set<Integer> waresIdSet = new HashSet<>(); Set<Integer> waresIdSet = new HashSet<>();
List<String> authWaresList = new ArrayList<>(); List<String> authWaresList = new ArrayList<>();
if (waresIdList.size() > 0) { if (waresIdList.size() > 0) {
// 处理商品权限 // 处理商品权限
List<WaresGradeAwards> waresGradeAwardsList = waresGradeService.queryWaresGradeAwards(waresIdList); List<WaresGradeAwards> waresGradeAwardsList = iBdWaresGradeService.queryWaresGradeAwards(waresIdList);
// 先处理没有配置等级奖衔的商品 // 先处理没有配置等级奖衔的商品
waresGradeAwardsList.forEach(waresGradeAwards -> { waresGradeAwardsList.forEach(waresGradeAwards -> {
waresIdSet.add(waresGradeAwards.getPkWares()); waresIdSet.add(waresGradeAwards.getPkWares());
@ -225,9 +200,6 @@ public class ApiBdWaresController extends BaseController {
}); });
} }
// 海粉等级实体
GradeDTO haiFanGradeDTO = gradeMap.get(EGrade.HAI_FAN.getValue());
for (BdWaresExt waresExt : bdWaresExtList) { for (BdWaresExt waresExt : bdWaresExtList) {
// 校验团队信息 // 校验团队信息
Boolean isShowWares = waresShowMap.get(waresExt.getPkId()); Boolean isShowWares = waresShowMap.get(waresExt.getPkId());
@ -283,14 +255,6 @@ public class ApiBdWaresController extends BaseController {
// 零售价 // 零售价
retailPrice = retailPrice.add(bdWaresSpecsSkuExt.getRetailPrice().multiply(BigDecimal.valueOf(bdWaresSpecsSkuExt.getQuantity()))); 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);
}
}
} }
// 计算商品列表价格和业绩最小值 // 计算商品列表价格和业绩最小值
@ -344,7 +308,7 @@ public class ApiBdWaresController extends BaseController {
} }
List<AreaCurrencyDTO> areaCurrencyDTOList = new ArrayList<>(); List<AreaCurrencyDTO> areaCurrencyDTOList = new ArrayList<>();
if (pkCurrencySet.size() > 0) { if (pkCurrencySet.size() > 0) {
areaCurrencyDTOList = areaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue()); areaCurrencyDTOList = iAreaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue());
} }
for (CuWaresParams waresParams : waresParamsList) { for (CuWaresParams waresParams : waresParamsList) {
@ -370,7 +334,7 @@ public class ApiBdWaresController extends BaseController {
**/ **/
private BigDecimal getSpecialDeductRatio(CuWaresParams cuWaresParams, Integer pkCountry, Integer accountValue) { private BigDecimal getSpecialDeductRatio(CuWaresParams cuWaresParams, Integer pkCountry, Integer accountValue) {
// 查询专区所属币种 // 查询专区所属币种
List<AreaCurrencyDTO> areaCurrencyDTOList = areaCurrencyServiceApi.queryAreaCurrencyByCondition(cuWaresParams.getSpecialArea(), pkCountry).getData(); List<AreaCurrencyDTO> areaCurrencyDTOList = iAreaCurrencyServiceApi.queryAreaCurrencyByCondition(cuWaresParams.getSpecialArea(), pkCountry).getData();
BigDecimal elseRatio = BigDecimal.ZERO; BigDecimal elseRatio = BigDecimal.ZERO;
BigDecimal deductRatio = BigDecimal.ZERO; BigDecimal deductRatio = BigDecimal.ZERO;
boolean flag = false; boolean flag = false;
@ -422,13 +386,8 @@ public class ApiBdWaresController extends BaseController {
return AjaxResult.error(WaresMsgConstants.WARES_NUMBER_DOES_NOT_EXIST); return AjaxResult.error(WaresMsgConstants.WARES_NUMBER_DOES_NOT_EXIST);
} }
Long loginMemberId = SecurityUtils.getUserId(); Long loginMemberId = SecurityUtils.getUserId();
Integer pkCountry; Integer pkCountry = cuWaresParams.getPkCountry() == null ? SecurityUtils.getPkCountry() : cuWaresParams.getPkCountry();
if (cuWaresParams.getPkCountry() == null) { cuWaresParams = iBdWaresSpecsSkuService.queryWaresSpecsSku(cuWaresParams.getSpecialArea(), cuWaresParams.getWaresCode(), loginMemberId, pkCountry);
pkCountry = SecurityUtils.getPkCountry();
} else {
pkCountry = cuWaresParams.getPkCountry();
}
cuWaresParams = bdWaresSpecsSkuService.queryWaresSpecsSku(cuWaresParams.getSpecialArea(), cuWaresParams.getWaresCode(), loginMemberId, pkCountry);
// 预计发货时间 // 预计发货时间
if (cuWaresParams.getArrivalTime() != null && cuWaresParams.getCreationTime() != null) { if (cuWaresParams.getArrivalTime() != null && cuWaresParams.getCreationTime() != null) {
@ -455,7 +414,7 @@ public class ApiBdWaresController extends BaseController {
List<AreaCurrencyDTO> areaCurrencyDTOList = new ArrayList<>(); List<AreaCurrencyDTO> areaCurrencyDTOList = new ArrayList<>();
if (pkCurrencySet.size() > 0) { if (pkCurrencySet.size() > 0) {
areaCurrencyDTOList = areaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue()); areaCurrencyDTOList = iAreaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue());
} }
cuWaresParams.setDeductMoney(ComputeUtil.computeBonusMultiply(cuWaresParams.getWaresPrice(), deductRatio)); cuWaresParams.setDeductMoney(ComputeUtil.computeBonusMultiply(cuWaresParams.getWaresPrice(), deductRatio));
if (areaCurrencyDTOList.size() > 0) { if (areaCurrencyDTOList.size() > 0) {
@ -483,19 +442,19 @@ public class ApiBdWaresController extends BaseController {
if (cuWaresItemsParams.getWaresCode() == null || cuWaresItemsParams.getPkWaresDetail() == null) { if (cuWaresItemsParams.getWaresCode() == null || cuWaresItemsParams.getPkWaresDetail() == null) {
return AjaxResult.error(WaresMsgConstants.WARES_NUMBER_DOES_NOT_EXIST); return AjaxResult.error(WaresMsgConstants.WARES_NUMBER_DOES_NOT_EXIST);
} }
return AjaxResult.success(bdWaresSpecsSkuService.queryWaresDetailSkuBySpecs(cuWaresItemsParams)); return AjaxResult.success(iBdWaresSpecsSkuService.queryWaresDetailSkuBySpecs(cuWaresItemsParams));
} }
/** /**
* 查询商品 * 查询商品
*/ */
@PostMapping("get-wares-agreement") @PostMapping("/get-wares-agreement")
public AjaxResult getWaresAgreement(@RequestBody WaresAgrementParam waresAgrementParam) { public AjaxResult getWaresAgreement(@RequestBody WaresAgrementParam waresAgrementParam) {
if (waresAgrementParam.getWaresCodeList().size() == 0) { if (waresAgrementParam.getWaresCodeList().size() == 0) {
return AjaxResult.error(TransactionUtils.getContent(WaresMsgConstants.WARES_CODE_NOT_NULL)); return AjaxResult.error(TransactionUtils.getContent(WaresMsgConstants.WARES_CODE_NOT_NULL));
} }
List<BdAgreement> waresExtList = bdWaresService.selectByWaresCodeList(waresAgrementParam.getWaresCodeList()); List<BdAgreement> waresExtList = iBdWaresService.selectByWaresCodeList(waresAgrementParam.getWaresCodeList());
OrderAlertVo orderAlertVo = new OrderAlertVo(); OrderAlertVo orderAlertVo = new OrderAlertVo();
Integer alertTime = 0; Integer alertTime = 0;
orderAlertVo.setWaresExtList(waresExtList); orderAlertVo.setWaresExtList(waresExtList);
@ -518,34 +477,28 @@ public class ApiBdWaresController extends BaseController {
if (cuWaresParams.getSpecialArea() == null) { if (cuWaresParams.getSpecialArea() == null) {
return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY)); 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<CuWaresParams> waresParamsList = new ArrayList<>();
// 查询商品列表 // 查询商品列表
List<BdWaresExt> bdWaresExtList = bdWaresService.queryRecommendWaresByCondition(cuWaresParams.getSpecialArea(), cuWaresParams.getPkAreaClassify(), cuWaresParams.getWaresName(), pkCountry); List<BdWaresExt> bdWaresExtList = iBdWaresService.queryRecommendWaresByCondition(cuWaresParams.getSpecialArea(), cuWaresParams.getPkAreaClassify(), cuWaresParams.getWaresName(), pkCountry);
if (CollectionUtil.isNotEmpty(bdWaresExtList)) { if (CollectionUtil.isNotEmpty(bdWaresExtList)) {
// 商品ID列表 // 商品ID列表
List<Integer> pkWaresIds = bdWaresExtList.stream().map(BdWares::getPkId).collect(Collectors.toList()); List<Integer> pkWaresIds = bdWaresExtList.stream().map(BdWares::getPkId).collect(Collectors.toList());
// 当前会员 // 当前会员
CuMember cuMember = saOrderService.getCuMemberByKey(SecurityUtils.getUserId()); CuMember cuMember = iSaOrderService.getCuMemberByKey(SecurityUtils.getUserId());
// 汇率比例 // 汇率比例
R<CurrencyDTO> currency = currencyServiceApi.getCurrency(pkCountry); R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(pkCountry);
BigDecimal inExchangeRate = currency.getData().getInExchangeRate(); BigDecimal inExchangeRate = currency.getData().getInExchangeRate();
// 查询商品标签列表 // 查询商品标签列表
BdWaresLabel waresLabel = new BdWaresLabel(); BdWaresLabel waresLabel = new BdWaresLabel();
waresLabel.setPkIdList(pkWaresIds); waresLabel.setPkIdList(pkWaresIds);
List<BdLabelExt> labelList = waresLabelService.selectByList(waresLabel); List<BdLabelExt> labelList = iBdWaresLabelService.selectByList(waresLabel);
// 标签 // 标签
for (BdWaresExt bdWaresExt : bdWaresExtList) { for (BdWaresExt bdWaresExt : bdWaresExtList) {
@ -578,7 +531,7 @@ public class ApiBdWaresController extends BaseController {
Map<Integer, List<BdWaresSpecsSkuExt>> waresSpecsSkuMap = new HashMap<>(); Map<Integer, List<BdWaresSpecsSkuExt>> waresSpecsSkuMap = new HashMap<>();
if (pkWaresIds.size() > 0) { if (pkWaresIds.size() > 0) {
List<BdWaresSpecsSkuExt> waresSpecsSkuArray = bdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(pkWaresIds); List<BdWaresSpecsSkuExt> waresSpecsSkuArray = iBdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(pkWaresIds);
waresSpecsSkuMap = waresSpecsSkuArray.stream().collect(Collectors.groupingBy(BdWaresSpecsSkuExt::getPkWares)); waresSpecsSkuMap = waresSpecsSkuArray.stream().collect(Collectors.groupingBy(BdWaresSpecsSkuExt::getPkWares));
} }
@ -596,7 +549,7 @@ public class ApiBdWaresController extends BaseController {
bdWaresExtList.forEach(we -> { bdWaresExtList.forEach(we -> {
waresIdSet.add(we.getPkId()); waresIdSet.add(we.getPkId());
}); });
List<BdWaresRange> bdWaresRangeList = bdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdSet); List<BdWaresRange> bdWaresRangeList = iBdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdSet);
for (BdWaresRange bdWaresRange : bdWaresRangeList) { for (BdWaresRange bdWaresRange : bdWaresRangeList) {
if (waresExt.getPkId().intValue() == bdWaresRange.getPkWares().intValue()) { if (waresExt.getPkId().intValue() == bdWaresRange.getPkWares().intValue()) {
waresPrice = waresPrice.add(bdWaresRange.getPrice()); waresPrice = waresPrice.add(bdWaresRange.getPrice());
@ -627,29 +580,20 @@ public class ApiBdWaresController extends BaseController {
waresParams.setAssAchieve(assAchieve); waresParams.setAssAchieve(assAchieve);
// 商品业绩计算汇率 // 商品业绩计算汇率
if (waresParams.getWaresAchieve() != null) { if (waresParams.getWaresAchieve() != null) {
if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { waresParams.setWaresAchieve(waresParams.getWaresAchieve().multiply(inExchangeRate));
waresParams.setWaresAchieve(waresParams.getWaresAchieve().multiply(inExchangeRate));
} else {
waresParams.setWaresAchieve(waresParams.getWaresAchieve());
}
} else { } else {
waresParams.setWaresAchieve(BigDecimal.ZERO); waresParams.setWaresAchieve(BigDecimal.ZERO);
} }
// 商品bv 计算 // 商品bv 计算
if (waresParams.getAssAchieve() != null) { if (waresParams.getAssAchieve() != null) {
if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { waresParams.setAssAchieve(waresParams.getAssAchieve().multiply(inExchangeRate));
waresParams.setAssAchieve(waresParams.getAssAchieve().multiply(inExchangeRate));
} else {
waresParams.setAssAchieve(waresParams.getAssAchieve());
}
} else { } else {
waresParams.setAssAchieve(BigDecimal.ZERO); waresParams.setAssAchieve(BigDecimal.ZERO);
} }
// 查询默认规格 // 查询默认规格
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
List<BdWaresSpecsSkuExt> list = bdWaresSpecsSkuService.selectByWaresSpecsSku(Collections.singletonList(waresExt.getPkId())); List<BdWaresSpecsSkuExt> list = iBdWaresSpecsSkuService.selectByWaresSpecsSku(Collections.singletonList(waresExt.getPkId()));
List<BdWaresSpecsSkuExt> collect = list.stream().filter(DistinctByKeyUtil.distinctByKey(BdWaresSpecsSku::getPkWaresDetail)).collect(Collectors.toList()); List<BdWaresSpecsSkuExt> collect = list.stream().filter(DistinctByKeyUtil.distinctByKey(BdWaresSpecsSku::getPkWaresDetail)).collect(Collectors.toList());
for (BdWaresSpecsSkuExt bdWaresSpecsSku : collect) { for (BdWaresSpecsSkuExt bdWaresSpecsSku : collect) {
JSONObject js = new JSONObject(); JSONObject js = new JSONObject();
@ -660,9 +604,9 @@ public class ApiBdWaresController extends BaseController {
} }
waresParams.setProductGroup(jsonArray); waresParams.setProductGroup(jsonArray);
// 查询等级配置 // 查询等级配置
QueryWrapper<BdWaresGrade> queryWrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdWaresGrade> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq("PK_WARES", waresExt.getPkId()); queryWrapper.eq(BdWaresGrade::getPkWares, waresExt.getPkId());
List<BdWaresGrade> waresGradeList = waresGradeService.list(queryWrapper); List<BdWaresGrade> waresGradeList = iBdWaresGradeService.list(queryWrapper);
if (waresGradeList.size() > 0) { if (waresGradeList.size() > 0) {
// 查询等级和商品是否存在 不存在不返回该数据 // 查询等级和商品是否存在 不存在不返回该数据
for (BdWaresGrade bdWaresGrade : waresGradeList) { for (BdWaresGrade bdWaresGrade : waresGradeList) {
@ -670,7 +614,6 @@ public class ApiBdWaresController extends BaseController {
if (pkSettleGrade.equals(bdWaresGrade.getPkRange())) { if (pkSettleGrade.equals(bdWaresGrade.getPkRange())) {
waresParamsList.add(waresParams); waresParamsList.add(waresParams);
} }
} }
} else { } else {
waresParamsList.add(waresParams); waresParamsList.add(waresParams);
@ -685,18 +628,17 @@ public class ApiBdWaresController extends BaseController {
* *
* @return * @return
*/ */
@PostMapping("get-wares-info") @PostMapping("/get-wares-info")
public AjaxResult getWaresInfo(@RequestBody WaresInfoParam waresInfoParam) { public AjaxResult getWaresInfo(@RequestBody WaresInfoParam waresInfoParam) {
BdWares wares = bdWaresService.getWares(waresInfoParam.getPkWares()); BdWares wares = iBdWaresService.getWares(waresInfoParam.getPkWares());
WaresInfoVo waresInfoVo = new WaresInfoVo(); WaresInfoVo waresInfoVo = new WaresInfoVo();
waresInfoVo.setWaresName(wares.getWaresName()); waresInfoVo.setWaresName(wares.getWaresName());
waresInfoVo.setNumber(waresInfoParam.getNumber()); waresInfoVo.setNumber(waresInfoParam.getNumber());
waresInfoVo.setPkWares(wares.getPkId()); waresInfoVo.setPkWares(wares.getPkId());
waresInfoVo.setCover(wares.getCover1()); waresInfoVo.setCover(wares.getCover1());
List<Integer> waresSpecsSkuList = waresInfoParam.getWaresSpecsSku().stream().map(WaresSpecsSkuParam::getPkWaresSpecsSku).collect(Collectors.toList()); List<Integer> waresSpecsSkuList = waresInfoParam.getWaresSpecsSku().stream().map(WaresSpecsSkuParam::getPkWaresSpecsSku).collect(Collectors.toList());
List<WaresItemWaresInfo> waresItemWaresInfos = bdWaresSpecsSkuService.selectByPkIds(waresSpecsSkuList); List<WaresItemWaresInfo> waresItemWaresInfos = iBdWaresSpecsSkuService.selectByPkIds(waresSpecsSkuList);
BigDecimal waresPrice = BigDecimal.ZERO; BigDecimal waresPrice = BigDecimal.ZERO;
BigDecimal pv = BigDecimal.ZERO; BigDecimal pv = BigDecimal.ZERO;
BigDecimal waresPriceAmount = BigDecimal.ZERO; BigDecimal waresPriceAmount = BigDecimal.ZERO;
@ -711,14 +653,11 @@ public class ApiBdWaresController extends BaseController {
} }
} }
} }
Integer pkCountry = SecurityUtils.getPkCountry(); R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
if (CountryConstants.CHINA_COUNTRY.equals(pkCountry)) { // 汇率比例
R<CurrencyDTO> currency = currencyServiceApi.getCurrency(pkCountry); BigDecimal inExchangeRate = currency.getData().getInExchangeRate();
// 汇率比例 pv = ComputeUtil.computeMultiply(pv, inExchangeRate);
BigDecimal inExchangeRate = currency.getData().getInExchangeRate(); pvAmount = ComputeUtil.computeMultiply(pvAmount, inExchangeRate);
pv = ComputeUtil.computeMultiply(pv, inExchangeRate);
pvAmount = ComputeUtil.computeMultiply(pvAmount, inExchangeRate);
}
waresInfoVo.setWaresPrice(waresPrice); waresInfoVo.setWaresPrice(waresPrice);
waresInfoVo.setPv(pv); waresInfoVo.setPv(pv);
waresInfoVo.setWaresCode(wares.getWaresCode()); waresInfoVo.setWaresCode(wares.getWaresCode());

View File

@ -8,9 +8,6 @@ import java.util.List;
/** /**
* 商品标签表 Mapper 接口 * 商品标签表 Mapper 接口
*
* @author hzs
* @since 2022-10-21
*/ */
public interface BdWaresLabelMapper extends BaseMapper<BdWaresLabel> { public interface BdWaresLabelMapper extends BaseMapper<BdWaresLabel> {

View File

@ -8,12 +8,15 @@ import java.util.List;
/** /**
* 商品标签表 服务类 * 商品标签表 服务类
*
* @author hzs
* @since 2022-10-21
*/ */
public interface IBdWaresLabelService extends IService<BdWaresLabel> { public interface IBdWaresLabelService extends IService<BdWaresLabel> {
/**
* 根据商品查询 商品所属标签
*
* @param waresLabel
* @return
*/
List<BdLabelExt> selectByList(BdWaresLabel waresLabel); List<BdLabelExt> selectByList(BdWaresLabel waresLabel);
} }

View File

@ -8,9 +8,6 @@ import java.util.List;
/** /**
* 极差明细表 服务类 * 极差明细表 服务类
*
* @author hzs
* @since 2022-09-09
*/ */
public interface IBdWaresRangeService extends IService<BdWaresRange> { public interface IBdWaresRangeService extends IService<BdWaresRange> {
@ -19,9 +16,6 @@ public interface IBdWaresRangeService extends IService<BdWaresRange> {
* *
* @param cuMember 会员 * @param cuMember 会员
* @param pkWareList 商品主键 * @param pkWareList 商品主键
* @return: List<BdWaresRange>
* @Author: sui q
* @Date: 2022/9/26 16:48
*/ */
List<BdWaresRange> queryWaresRangeByCondition(CuMember cuMember, List<Integer> pkWareList); List<BdWaresRange> queryWaresRangeByCondition(CuMember cuMember, List<Integer> pkWareList);
@ -32,9 +26,6 @@ public interface IBdWaresRangeService extends IService<BdWaresRange> {
* @param rangeType 类型 * @param rangeType 类型
* @param level 基本 * @param level 基本
* @param specsSkuList 最小库存单位 * @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); List<BdWaresRange> querySkuWaresRangeByCondition(Integer pkCountry, Integer rangeType, Integer level, List<Integer> specsSkuList);

View File

@ -13,19 +13,10 @@ import java.util.List;
/** /**
* 商品标签表 服务实现类 * 商品标签表 服务实现类
*
* @author hzs
* @since 2022-10-21
*/ */
@Service @Service
public class BdWaresLabelServiceImpl extends ServiceImpl<BdWaresLabelMapper, BdWaresLabel> implements IBdWaresLabelService { public class BdWaresLabelServiceImpl extends ServiceImpl<BdWaresLabelMapper, BdWaresLabel> implements IBdWaresLabelService {
/**
* 根据商品查询 商品所属标签
*
* @param waresLabel
* @return
*/
@Override @Override
public List<BdLabelExt> selectByList(BdWaresLabel waresLabel) { public List<BdLabelExt> selectByList(BdWaresLabel waresLabel) {
return baseMapper.selectByList(waresLabel); return baseMapper.selectByList(waresLabel);

View File

@ -1,10 +1,9 @@
package com.hzs.sale.wares.service.impl; package com.hzs.sale.wares.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.core.constant.CountryConstants; 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.EAwards;
import com.hzs.common.core.enums.ERangeType; import com.hzs.common.core.enums.ERangeType;
import com.hzs.common.domain.member.base.CuMember; import com.hzs.common.domain.member.base.CuMember;
@ -23,28 +22,25 @@ import java.util.List;
/** /**
* 极差明细表 服务实现类 * 极差明细表 服务实现类
*
* @author hzs
* @since 2022-09-09
*/ */
@Service @Service
public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdWaresRange> implements IBdWaresRangeService { public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdWaresRange> implements IBdWaresRangeService {
@DubboReference @DubboReference
IRangeServiceApi rangeServiceApi; IRangeServiceApi iRangeServiceApi;
@DubboReference @DubboReference
IAwardsServiceApi awardsServiceApi; IAwardsServiceApi iAwardsServiceApi;
@Override @Override
public List<BdWaresRange> queryWaresRangeByCondition(CuMember cuMember, List<Integer> pkWareList) { public List<BdWaresRange> queryWaresRangeByCondition(CuMember cuMember, List<Integer> pkWareList) {
int level = cuMember.getPkSettleGrade(); int level = cuMember.getPkSettleGrade();
int rangeType = ERangeType.GRADE.getValue(); int rangeType = ERangeType.GRADE.getValue();
BdAwards bdAwards = awardsServiceApi.getAwardsOne(cuMember.getPkAwards()).getData(); BdAwards bdAwards = iAwardsServiceApi.getAwardsOne(cuMember.getPkAwards()).getData();
if (bdAwards.getAwardsValue() > EAwards.MEMBER.getValue()) { if (bdAwards.getAwardsValue() > EAwards.MEMBER.getValue()) {
level = cuMember.getPkAwards(); level = cuMember.getPkAwards();
rangeType = ERangeType.AWARDS.getValue(); rangeType = ERangeType.AWARDS.getValue();
} }
RangeDTO rangeDTO = rangeServiceApi.queryRangeDtoByCondition(cuMember.getPkSettleCountry(), rangeType, level).getData(); RangeDTO rangeDTO = iRangeServiceApi.queryRangeDtoByCondition(cuMember.getPkSettleCountry(), rangeType, level).getData();
if (rangeDTO == null) { if (rangeDTO == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -53,19 +49,13 @@ public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdW
@Override @Override
public List<BdWaresRange> querySkuWaresRangeByCondition(Integer pkCountry, Integer rangeType, Integer level, List<Integer> specsSkuList) { public List<BdWaresRange> querySkuWaresRangeByCondition(Integer pkCountry, Integer rangeType, Integer level, List<Integer> specsSkuList) {
RangeDTO rangeDTO = rangeServiceApi.queryRangeDtoByCondition(pkCountry, rangeType, level).getData(); RangeDTO rangeDTO = iRangeServiceApi.queryRangeDtoByCondition(pkCountry, rangeType, level).getData();
QueryWrapper<BdWaresRange> queryWrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdWaresRange> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SystemFieldConstants.PK_RANGE, rangeDTO.getPkRange()); queryWrapper.eq(BdWaresRange::getPkRange, rangeDTO.getPkRange());
queryWrapper.in(SystemFieldConstants.PK_WARES_SPECS_SKU, specsSkuList); queryWrapper.in(BdWaresRange::getPkWaresSpecsSku, specsSkuList);
return baseMapper.selectList(queryWrapper); return baseMapper.selectList(queryWrapper);
} }
/**
* 以range 为主表查询商品极差信息
*
* @param pkWares
* @return
*/
@Override @Override
public List<BdWaresRange> queryWaresList(Long pkWares, Integer pkCountry) { public List<BdWaresRange> queryWaresList(Long pkWares, Integer pkCountry) {
return baseMapper.queryWaresList(pkWares, pkCountry); return baseMapper.queryWaresList(pkWares, pkCountry);
@ -74,7 +64,7 @@ public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdW
@Override @Override
public List<BdWaresRange> listRetailWaresRange(Integer pkGrade, List<Integer> pkWareList) { public List<BdWaresRange> listRetailWaresRange(Integer pkGrade, List<Integer> pkWareList) {
// 新零售只有等级级差不需要处理奖衔 // 新零售只有等级级差不需要处理奖衔
RangeDTO rangeDTO = rangeServiceApi.queryRangeDtoByCondition(CountryConstants.CHINA_COUNTRY, ERangeType.GRADE.getValue(), pkGrade).getData(); RangeDTO rangeDTO = iRangeServiceApi.queryRangeDtoByCondition(CountryConstants.CHINA_COUNTRY, ERangeType.GRADE.getValue(), pkGrade).getData();
if (rangeDTO == null) { if (rangeDTO == null) {
return new ArrayList<>(); return new ArrayList<>();
} }

View File

@ -9,9 +9,6 @@ import java.util.List;
/** /**
* 极差配置 Mapper 接口 * 极差配置 Mapper 接口
*
* @author zhangjing
* @since 2022-09-09
*/ */
public interface BdRangeMapper extends BaseMapper<BdRange> { public interface BdRangeMapper extends BaseMapper<BdRange> {
@ -21,9 +18,6 @@ public interface BdRangeMapper extends BaseMapper<BdRange> {
* @param pkCountry 国家 * @param pkCountry 国家
* @param rangeType 极差类型 * @param rangeType 极差类型
* @param pkLevel 等级 * @param pkLevel 等级
* @return: Map<String, RangeDTO>
* @Author: sui q
* @Date: 2023/1/3 14:00
*/ */
List<RangeDTO> queryRangeDto(@Param("pkCountry") Integer pkCountry, List<RangeDTO> queryRangeDto(@Param("pkCountry") Integer pkCountry,
@Param("rangeType") Integer rangeType, @Param("rangeType") Integer rangeType,

View File

@ -1,48 +0,0 @@
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);
}
}

View File

@ -12,37 +12,27 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @description: 极差配置 * 极差配置
* @author: zhang jing
* @date: 2022/11/10 17:02
* @param:
* @return:
**/ **/
@DubboService @DubboService
public class RangeServiceProvider implements IRangeServiceApi { public class RangeServiceProvider implements IRangeServiceApi {
@Autowired @Autowired
private IBdRangeService rangeService; private IBdRangeService iBdRangeService;
/**
* @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 @Override
public R<List<BdRangeExt>> queryRange(Integer pkCountry) { public R<List<BdRangeExt>> queryRange(Integer pkCountry) {
return R.ok(rangeService.queryRange(pkCountry)); return R.ok(iBdRangeService.queryRange(pkCountry));
} }
@Override @Override
public R<Map<String, RangeDTO>> queryRangeDto() { public R<Map<String, RangeDTO>> queryRangeDto() {
return R.ok(rangeService.queryRangeDto()); return R.ok(iBdRangeService.queryRangeDto());
} }
@Override @Override
public R<RangeDTO> queryRangeDtoByCondition(Integer pkCountry, Integer rangeType, Integer pkLevel) { public R<RangeDTO> queryRangeDtoByCondition(Integer pkCountry, Integer rangeType, Integer pkLevel) {
return R.ok(rangeService.getRangeDTO(pkCountry, rangeType, pkLevel)); return R.ok(iBdRangeService.getRangeDTO(pkCountry, rangeType, pkLevel));
} }
} }

View File

@ -9,48 +9,27 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* <p>
* 极差配置 服务类 * 极差配置 服务类
* </p>
*
* @author zhangjing
* @since 2022-09-09
*/ */
public interface IBdRangeService extends IService<BdRange> { public interface IBdRangeService extends IService<BdRange> {
/** /**
* @description: 新增极差 * 新增极差
* @author: zhang jing
* @date: 2022/10/28 14:23
* @param: [rangeExt]
* @return: boolean
**/ **/
boolean saveRange(BdRangeExt rangeExt); boolean saveRange(BdRangeExt rangeExt);
/** /**
* @description: 修改极差 * 修改极差
* @author: zhang jing
* @date: 2022/10/28 14:23
* @param: [rangeExt]
* @return: boolean
**/ **/
boolean updateRange(BdRangeExt rangeExt); 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); List<BdRangeExt> queryRange(Integer pkCountry);
/** /**
* 查询各个国家极差的配置 键为 国家+极差类型+等级主键 * 查询各个国家极差的配置 键为 国家+极差类型+等级主键
*
* @return: Map<String, RangeDTO>
* @Author: sui q
* @Date: 2023/1/3 14:00
*/ */
Map<String, RangeDTO> queryRangeDto(); Map<String, RangeDTO> queryRangeDto();
@ -60,9 +39,6 @@ public interface IBdRangeService extends IService<BdRange> {
* @param pkCountry 国家 * @param pkCountry 国家
* @param rangeType 极差类型 * @param rangeType 极差类型
* @param pkLevel 等级主键 * @param pkLevel 等级主键
* @return: RangeDTO
* @Author: sui q
* @Date: 2023/2/4 15:54
*/ */
RangeDTO getRangeDTO(Integer pkCountry, Integer rangeType, Integer pkLevel); RangeDTO getRangeDTO(Integer pkCountry, Integer rangeType, Integer pkLevel);
} }

View File

@ -7,20 +7,17 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.core.constant.CacheConstants; import com.hzs.common.core.constant.CacheConstants;
import com.hzs.common.core.constant.Constants; 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.enums.*;
import com.hzs.common.core.service.RedisService; import com.hzs.common.core.service.RedisService;
import com.hzs.common.domain.system.config.BdRange; import com.hzs.common.domain.system.config.BdRange;
import com.hzs.common.domain.system.config.BdRangeDetails; import com.hzs.common.domain.system.config.BdRangeDetails;
import com.hzs.common.domain.system.config.ext.BdRangeExt; import com.hzs.common.domain.system.config.ext.BdRangeExt;
import com.hzs.common.security.utils.SecurityUtils; 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.dto.RangeDTO;
import com.hzs.system.config.mapper.BdRangeMapper; import com.hzs.system.config.mapper.BdRangeMapper;
import com.hzs.system.config.service.IBdRangeDetailsService; import com.hzs.system.config.service.IBdRangeDetailsService;
import com.hzs.system.config.service.IBdRangeService; import com.hzs.system.config.service.IBdRangeService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -29,40 +26,18 @@ import java.util.concurrent.TimeUnit;
/** /**
* 极差配置 服务实现类 * 极差配置 服务实现类
*
* @author zhangjing
* @since 2022-09-09
*/ */
@Slf4j @Slf4j
@Service @Service
public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> implements IBdRangeService { public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> implements IBdRangeService {
@Autowired @Autowired
private IBdRangeDetailsService rangeDetailsService; private IBdRangeDetailsService iBdRangeDetailsService;
@Autowired
@DubboReference
ITransactionServiceApi iTransactionServiceApi;
private RedisService redisService; 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 @Override
public boolean saveRange(BdRangeExt rangeExt) { 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<>(); LambdaQueryWrapper<BdRange> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BdRange::getPkCountry, rangeExt.getPkCountry()); queryWrapper.eq(BdRange::getPkCountry, rangeExt.getPkCountry());
queryWrapper.eq(BdRange::getRangeValue, rangeExt.getRangeValue()); queryWrapper.eq(BdRange::getRangeValue, rangeExt.getRangeValue());
@ -80,7 +55,7 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
rangeDetails.setPkCountry(SecurityUtils.getPkCountry()); rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
rangeDetails.setPkCreator(SecurityUtils.getUserId()); rangeDetails.setPkCreator(SecurityUtils.getUserId());
rangeDetails.setCreationTime(new Date()); rangeDetails.setCreationTime(new Date());
rangeDetailsService.save(rangeDetails); iBdRangeDetailsService.save(rangeDetails);
} }
//奖衔 //奖衔
for (Integer aw : awardsList) { for (Integer aw : awardsList) {
@ -91,31 +66,20 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
rangeDetails.setPkCountry(SecurityUtils.getPkCountry()); rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
rangeDetails.setPkCreator(SecurityUtils.getUserId()); rangeDetails.setPkCreator(SecurityUtils.getUserId());
rangeDetails.setCreationTime(new Date()); rangeDetails.setCreationTime(new Date());
rangeDetailsService.save(rangeDetails); iBdRangeDetailsService.save(rangeDetails);
} }
} }
redisService.deleteObject(CacheConstants.BD_RANGE + rangeExt.getPkCountry()); redisService.deleteObject(CacheConstants.BD_RANGE + rangeExt.getPkCountry());
return true; return true;
} }
/**
* @description: 修改极差
* @author: zhang jing
* @date: 2022/10/28 14:23
* @param: [rangeExt]
* @return: boolean
**/
@Override @Override
public boolean updateRange(BdRangeExt rangeExt) { 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); baseMapper.updateById(rangeExt);
LambdaUpdateWrapper<BdRangeDetails> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<BdRangeDetails> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(BdRangeDetails::getDelFlag, EYesNo.NO.getIntValue()); updateWrapper.set(BdRangeDetails::getDelFlag, EYesNo.NO.getIntValue());
updateWrapper.eq(BdRangeDetails::getPkRange, rangeExt.getPkId()); updateWrapper.eq(BdRangeDetails::getPkRange, rangeExt.getPkId());
rangeDetailsService.update(updateWrapper); iBdRangeDetailsService.update(updateWrapper);
List<Integer> gradeList = rangeExt.getGradeList(); List<Integer> gradeList = rangeExt.getGradeList();
List<Integer> awardsList = rangeExt.getAwardsList(); List<Integer> awardsList = rangeExt.getAwardsList();
//等级 //等级
@ -127,7 +91,7 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
rangeDetails.setPkCountry(SecurityUtils.getPkCountry()); rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
rangeDetails.setPkCreator(SecurityUtils.getUserId()); rangeDetails.setPkCreator(SecurityUtils.getUserId());
rangeDetails.setCreationTime(new Date()); rangeDetails.setCreationTime(new Date());
rangeDetailsService.save(rangeDetails); iBdRangeDetailsService.save(rangeDetails);
} }
//奖衔 //奖衔
for (Integer aw : awardsList) { for (Integer aw : awardsList) {
@ -138,20 +102,12 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
rangeDetails.setPkCountry(SecurityUtils.getPkCountry()); rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
rangeDetails.setPkCreator(SecurityUtils.getUserId()); rangeDetails.setPkCreator(SecurityUtils.getUserId());
rangeDetails.setCreationTime(new Date()); rangeDetails.setCreationTime(new Date());
rangeDetailsService.save(rangeDetails); iBdRangeDetailsService.save(rangeDetails);
} }
redisService.deleteObject(CacheConstants.BD_RANGE + rangeExt.getPkCountry()); redisService.deleteObject(CacheConstants.BD_RANGE + rangeExt.getPkCountry());
return true; 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 @Override
public List<BdRangeExt> queryRange(Integer pkCountry) { public List<BdRangeExt> queryRange(Integer pkCountry) {
List<BdRangeExt> rangeList = redisService.getCacheList(CacheConstants.BD_RANGE + pkCountry); List<BdRangeExt> rangeList = redisService.getCacheList(CacheConstants.BD_RANGE + pkCountry);

View File

@ -55,11 +55,6 @@ public class SystemFieldConstants {
*/ */
public static final String MODIFIED_TIME = "MODIFIED_TIME"; public static final String MODIFIED_TIME = "MODIFIED_TIME";
/**
* 国家
*/
public static final String PK_COUNTRY_VALUE = "pkCountry";
/** /**
* 国家 * 国家
*/ */
@ -70,46 +65,6 @@ public class SystemFieldConstants {
*/ */
public static final String PK_CORP = "pk_corp"; 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";
/** /**
* 审核状态 * 审核状态
*/ */

View File

@ -12,12 +12,7 @@ import lombok.experimental.Accessors;
import java.util.List; import java.util.List;
/** /**
* <p>
* 商品标签表 * 商品标签表
* </p>
*
* @author hzs
* @since 2022-10-21
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -15,12 +15,7 @@ import lombok.experimental.Accessors;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* <p>
* 极差配置 * 极差配置
* </p>
*
* @author zhangjing
* @since 2022-09-09
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ -37,7 +32,7 @@ public class BdRange extends BaseEntity {
/** /**
* 极差名称 * 极差名称
*/ */
@Excel(name = "极差名称",sort=1) @Excel(name = "极差名称", sort = 1)
@TableField("RANGE_NAME") @TableField("RANGE_NAME")
private String rangeName; private String rangeName;
/** /**
@ -46,7 +41,7 @@ public class BdRange extends BaseEntity {
@TableField("RANGE_VALUE") @TableField("RANGE_VALUE")
@Transaction(transactionKey = EnumsPrefixConstants.AWARDS) @Transaction(transactionKey = EnumsPrefixConstants.AWARDS)
private Integer rangeValue; private Integer rangeValue;
@Excel(name = "极差值",sort=2) @Excel(name = "极差值", sort = 2)
@TableField(exist = false) @TableField(exist = false)
private String rangeValueVal; private String rangeValueVal;