## 商品列表添加权限控制;
This commit is contained in:
parent
dadd325016
commit
7376415d2f
|
@ -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();
|
||||
|
||||
}
|
|
@ -1,14 +1,13 @@
|
|||
package com.hzs.bonus.bonus.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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;
|
||||
|
@ -29,7 +28,7 @@ import java.util.List;
|
|||
public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdWaresBonus> implements IBdWaresBonusService {
|
||||
|
||||
@Autowired
|
||||
private IBdWaresBonusItemsService waresBonusItemsService;
|
||||
private IBdWaresBonusItemsService iBdWaresBonusItemsService;
|
||||
|
||||
@Override
|
||||
public List<BdWaresBonusExt> querySpecialWaresBonus(BdWaresBonusParam waresBonusParam) {
|
||||
|
@ -40,21 +39,21 @@ public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdW
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteSpecialWaresBonus(Long pkId, Long userId) {
|
||||
// 删除明细表
|
||||
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);
|
||||
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);
|
||||
update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BdWaresBonus queryWaresBonusById(BdWaresBonusParam waresBonusParam) {
|
||||
QueryWrapper<BdWaresBonus> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(SystemFieldConstants.PK_WARES, waresBonusParam.getPkWares());
|
||||
LambdaQueryWrapper<BdWaresBonus> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdWaresBonus::getPkWares, waresBonusParam.getPkWares());
|
||||
if (waresBonusParam.getPkId() != null) {
|
||||
queryWrapper.ne(SystemFieldConstants.PK_ID, waresBonusParam.getPkId());
|
||||
queryWrapper.ne(BdWaresBonus::getPkId, waresBonusParam.getPkId());
|
||||
}
|
||||
return baseMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
@ -91,12 +90,12 @@ public class BdWaresBonusServiceImpl extends ServiceImpl<BdWaresBonusMapper, BdW
|
|||
}
|
||||
if (updateWaresBonusItems.size() > 0) {
|
||||
// 删除
|
||||
waresBonusItemsService.deleteWaresBonusItems(updateWaresBonusItems, updateWaresBonusItems.get(0).getPkWaresBonus(), userId);
|
||||
waresBonusItemsService.updateWaresBonusItems(updateWaresBonusItems);
|
||||
iBdWaresBonusItemsService.deleteWaresBonusItems(updateWaresBonusItems, updateWaresBonusItems.get(0).getPkWaresBonus(), userId);
|
||||
iBdWaresBonusItemsService.updateWaresBonusItems(updateWaresBonusItems);
|
||||
}
|
||||
// 新增
|
||||
if (insertWaresBonusItems.size() > 0) {
|
||||
waresBonusItemsService.insetWaresBonusItems(insertWaresBonusItems);
|
||||
iBdWaresBonusItemsService.insetWaresBonusItems(insertWaresBonusItems);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.sale.ext.BdWaresExt;
|
||||
import com.hzs.common.domain.sale.ext.BdWaresSpecsSkuExt;
|
||||
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.sale.wares.*;
|
||||
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;
|
||||
|
@ -68,7 +66,7 @@ public class ApiRetailWaresController extends BaseController {
|
|||
private IBdWaresRangeService iBdWaresRangeService;
|
||||
|
||||
@DubboReference
|
||||
ICurrencyServiceApi currencyServiceApi;
|
||||
ICurrencyServiceApi iCurrencyServiceApi;
|
||||
@DubboReference
|
||||
IAreaCurrencyServiceApi iAreaCurrencyServiceApi;
|
||||
@DubboReference
|
||||
|
@ -94,7 +92,6 @@ public class ApiRetailWaresController extends BaseController {
|
|||
param.setSystemType(SecurityUtils.getSystemType());
|
||||
param.setPkCountry(SecurityUtils.getPkCountry());
|
||||
// 商品列表
|
||||
startPage();
|
||||
List<BdWaresExt> bdWaresExtList = iBdWaresService.listRetailWaresByCondition(param);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(bdWaresExtList)) {
|
||||
|
@ -177,9 +174,11 @@ public class ApiRetailWaresController extends BaseController {
|
|||
Integer pkGrade, boolean showLabel) {
|
||||
// 返回商品列表
|
||||
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();
|
||||
|
||||
// 商品主键列表
|
||||
|
@ -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) {
|
||||
// 校验团队信息
|
||||
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.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.hzs.common.core.constant.*;
|
||||
import com.hzs.common.core.constant.msg.SaOrderMsgConstants;
|
||||
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.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;
|
||||
|
@ -60,52 +59,34 @@ import java.util.stream.Collectors;
|
|||
public class ApiBdWaresController extends BaseController {
|
||||
|
||||
@DubboReference
|
||||
IGradeServiceApi gradeServiceApi;
|
||||
IGradeServiceApi iGradeServiceApi;
|
||||
@DubboReference
|
||||
IMemberServiceApi memberServiceApi;
|
||||
IMemberServiceApi iMemberServiceApi;
|
||||
@DubboReference
|
||||
IAreaCurrencyServiceApi areaCurrencyServiceApi;
|
||||
IAreaCurrencyServiceApi iAreaCurrencyServiceApi;
|
||||
@DubboReference
|
||||
ICurrencyServiceApi currencyServiceApi;
|
||||
ICurrencyServiceApi iCurrencyServiceApi;
|
||||
|
||||
@Autowired
|
||||
private IBdWaresLabelService waresLabelService;
|
||||
private IBdWaresService iBdWaresService;
|
||||
@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
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据专区查找专区的商品
|
||||
|
@ -117,48 +98,42 @@ public class ApiBdWaresController extends BaseController {
|
|||
if (cuWaresParams.getSpecialArea() == null) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY));
|
||||
}
|
||||
|
||||
Integer pkCountry;
|
||||
if (cuWaresParams.getPkCountry() != null) {
|
||||
pkCountry = cuWaresParams.getPkCountry();
|
||||
} else {
|
||||
pkCountry = SecurityUtils.getPkCountry();
|
||||
}
|
||||
Integer pkCountry = cuWaresParams.getPkCountry() != null ? cuWaresParams.getPkCountry() : SecurityUtils.getPkCountry();
|
||||
|
||||
// 返回数据
|
||||
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)) {
|
||||
// 等级
|
||||
R<List<GradeDTO>> gradeDTO = gradeServiceApi.queryGradeList(pkCountry);
|
||||
R<List<GradeDTO>> gradeDTO = iGradeServiceApi.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 = saOrderService.getCuMemberByKey(userId);
|
||||
CuMember cuMember = iSaOrderService.getCuMemberByKey(userId);
|
||||
// 当前会员编号
|
||||
String memberCode = cuMember.getMemberCode();
|
||||
|
||||
// 汇率比例
|
||||
R<CurrencyDTO> currency = currencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
|
||||
R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
|
||||
BigDecimal inExchangeRate = currency.getData().getInExchangeRate();
|
||||
|
||||
// 商品主键列表
|
||||
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());
|
||||
R<Map<Integer, Boolean>> waresShowMapDto = memberServiceApi.checkIsShowWares(showWaresList);
|
||||
R<Map<Integer, Boolean>> waresShowMapDto = iMemberServiceApi.checkIsShowWares(showWaresList);
|
||||
Map<Integer, Boolean> waresShowMap = waresShowMapDto.getData();
|
||||
|
||||
// 商品标签列表
|
||||
BdWaresLabel waresLabel = new BdWaresLabel();
|
||||
waresLabel.setPkIdList(waresIdList);
|
||||
List<BdLabelExt> list = waresLabelService.selectByList(waresLabel);
|
||||
List<BdLabelExt> list = iBdWaresLabelService.selectByList(waresLabel);
|
||||
|
||||
// 标签
|
||||
for (BdWaresExt bdWaresExt : bdWaresExtList) {
|
||||
|
@ -193,14 +168,14 @@ public class ApiBdWaresController extends BaseController {
|
|||
// 查询商品sku 最小值 和数量
|
||||
Map<Integer, List<BdWaresSpecsSkuExt>> waresSpecsSkuMap = new HashMap<>();
|
||||
if (waresIdList.size() > 0) {
|
||||
List<BdWaresSpecsSkuExt> waresSpecsSkuArray = bdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(waresIdList);
|
||||
List<BdWaresSpecsSkuExt> waresSpecsSkuArray = iBdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(waresIdList);
|
||||
waresSpecsSkuMap = waresSpecsSkuArray.stream().collect(Collectors.groupingBy(BdWaresSpecsSkuExt::getPkWares));
|
||||
}
|
||||
|
||||
List<BdWaresSpecsSkuExt> waresSpecsSkuList = new ArrayList<>();
|
||||
if (waresIdList.size() > 0) {
|
||||
// 查询默认规格
|
||||
waresSpecsSkuList = bdWaresSpecsSkuService.selectByWaresSpecsSku(waresIdList);
|
||||
waresSpecsSkuList = iBdWaresSpecsSkuService.selectByWaresSpecsSku(waresIdList);
|
||||
}
|
||||
|
||||
List<BdWaresRange> bdWaresRangeList = new ArrayList<>();
|
||||
|
@ -209,14 +184,14 @@ public class ApiBdWaresController extends BaseController {
|
|||
|| EOrderType.COOPERATE_ORDER.getValue() == cuWaresParams.getSpecialArea()) {
|
||||
// 复购业绩计算
|
||||
if (waresIdList.size() > 0) {
|
||||
bdWaresRangeList = bdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdList);
|
||||
bdWaresRangeList = iBdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdList);
|
||||
}
|
||||
}
|
||||
Set<Integer> waresIdSet = new HashSet<>();
|
||||
List<String> authWaresList = new ArrayList<>();
|
||||
if (waresIdList.size() > 0) {
|
||||
// 处理商品权限
|
||||
List<WaresGradeAwards> waresGradeAwardsList = waresGradeService.queryWaresGradeAwards(waresIdList);
|
||||
List<WaresGradeAwards> waresGradeAwardsList = iBdWaresGradeService.queryWaresGradeAwards(waresIdList);
|
||||
// 先处理没有配置等级、奖衔的商品
|
||||
waresGradeAwardsList.forEach(waresGradeAwards -> {
|
||||
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) {
|
||||
// 校验团队信息
|
||||
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())));
|
||||
}
|
||||
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<>();
|
||||
if (pkCurrencySet.size() > 0) {
|
||||
areaCurrencyDTOList = areaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue());
|
||||
areaCurrencyDTOList = iAreaCurrencyServiceApi.queryAreaCurrencyBySpecialArea(pkCurrencySet, EAccount.REPEAT.getValue());
|
||||
}
|
||||
|
||||
for (CuWaresParams waresParams : waresParamsList) {
|
||||
|
@ -370,7 +334,7 @@ public class ApiBdWaresController extends BaseController {
|
|||
**/
|
||||
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 deductRatio = BigDecimal.ZERO;
|
||||
boolean flag = false;
|
||||
|
@ -422,13 +386,8 @@ public class ApiBdWaresController extends BaseController {
|
|||
return AjaxResult.error(WaresMsgConstants.WARES_NUMBER_DOES_NOT_EXIST);
|
||||
}
|
||||
Long loginMemberId = SecurityUtils.getUserId();
|
||||
Integer pkCountry;
|
||||
if (cuWaresParams.getPkCountry() == null) {
|
||||
pkCountry = SecurityUtils.getPkCountry();
|
||||
} else {
|
||||
pkCountry = cuWaresParams.getPkCountry();
|
||||
}
|
||||
cuWaresParams = bdWaresSpecsSkuService.queryWaresSpecsSku(cuWaresParams.getSpecialArea(), cuWaresParams.getWaresCode(), loginMemberId, pkCountry);
|
||||
Integer pkCountry = cuWaresParams.getPkCountry() == null ? SecurityUtils.getPkCountry() : cuWaresParams.getPkCountry();
|
||||
cuWaresParams = iBdWaresSpecsSkuService.queryWaresSpecsSku(cuWaresParams.getSpecialArea(), cuWaresParams.getWaresCode(), loginMemberId, pkCountry);
|
||||
|
||||
// 预计发货时间(秒)
|
||||
if (cuWaresParams.getArrivalTime() != null && cuWaresParams.getCreationTime() != null) {
|
||||
|
@ -455,7 +414,7 @@ public class ApiBdWaresController extends BaseController {
|
|||
|
||||
List<AreaCurrencyDTO> areaCurrencyDTOList = new ArrayList<>();
|
||||
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));
|
||||
if (areaCurrencyDTOList.size() > 0) {
|
||||
|
@ -483,19 +442,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(bdWaresSpecsSkuService.queryWaresDetailSkuBySpecs(cuWaresItemsParams));
|
||||
return AjaxResult.success(iBdWaresSpecsSkuService.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 = bdWaresService.selectByWaresCodeList(waresAgrementParam.getWaresCodeList());
|
||||
List<BdAgreement> waresExtList = iBdWaresService.selectByWaresCodeList(waresAgrementParam.getWaresCodeList());
|
||||
OrderAlertVo orderAlertVo = new OrderAlertVo();
|
||||
Integer alertTime = 0;
|
||||
orderAlertVo.setWaresExtList(waresExtList);
|
||||
|
@ -518,34 +477,28 @@ public class ApiBdWaresController extends BaseController {
|
|||
if (cuWaresParams.getSpecialArea() == null) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(SaOrderMsgConstants.SPECIAL_AREA_NOT_EMPTY));
|
||||
}
|
||||
|
||||
Integer pkCountry;
|
||||
if (cuWaresParams.getPkCountry() != null) {
|
||||
pkCountry = cuWaresParams.getPkCountry();
|
||||
} else {
|
||||
pkCountry = SecurityUtils.getPkCountry();
|
||||
}
|
||||
Integer pkCountry = cuWaresParams.getPkCountry() != null ? cuWaresParams.getPkCountry() : SecurityUtils.getPkCountry();
|
||||
|
||||
// 返回数据列表
|
||||
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)) {
|
||||
// 商品ID列表
|
||||
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();
|
||||
|
||||
// 查询商品标签列表
|
||||
BdWaresLabel waresLabel = new BdWaresLabel();
|
||||
waresLabel.setPkIdList(pkWaresIds);
|
||||
List<BdLabelExt> labelList = waresLabelService.selectByList(waresLabel);
|
||||
List<BdLabelExt> labelList = iBdWaresLabelService.selectByList(waresLabel);
|
||||
|
||||
// 标签
|
||||
for (BdWaresExt bdWaresExt : bdWaresExtList) {
|
||||
|
@ -578,7 +531,7 @@ public class ApiBdWaresController extends BaseController {
|
|||
|
||||
Map<Integer, List<BdWaresSpecsSkuExt>> waresSpecsSkuMap = new HashMap<>();
|
||||
if (pkWaresIds.size() > 0) {
|
||||
List<BdWaresSpecsSkuExt> waresSpecsSkuArray = bdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(pkWaresIds);
|
||||
List<BdWaresSpecsSkuExt> waresSpecsSkuArray = iBdWaresSpecsSkuService.selectByMinWaresSpecsSkuByPkWaresList(pkWaresIds);
|
||||
waresSpecsSkuMap = waresSpecsSkuArray.stream().collect(Collectors.groupingBy(BdWaresSpecsSkuExt::getPkWares));
|
||||
}
|
||||
|
||||
|
@ -596,7 +549,7 @@ public class ApiBdWaresController extends BaseController {
|
|||
bdWaresExtList.forEach(we -> {
|
||||
waresIdSet.add(we.getPkId());
|
||||
});
|
||||
List<BdWaresRange> bdWaresRangeList = bdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdSet);
|
||||
List<BdWaresRange> bdWaresRangeList = iBdWaresRangeService.queryWaresRangeByCondition(cuMember, waresIdSet);
|
||||
for (BdWaresRange bdWaresRange : bdWaresRangeList) {
|
||||
if (waresExt.getPkId().intValue() == bdWaresRange.getPkWares().intValue()) {
|
||||
waresPrice = waresPrice.add(bdWaresRange.getPrice());
|
||||
|
@ -627,29 +580,20 @@ 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 = 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());
|
||||
for (BdWaresSpecsSkuExt bdWaresSpecsSku : collect) {
|
||||
JSONObject js = new JSONObject();
|
||||
|
@ -660,9 +604,9 @@ public class ApiBdWaresController extends BaseController {
|
|||
}
|
||||
waresParams.setProductGroup(jsonArray);
|
||||
// 查询等级配置
|
||||
QueryWrapper<BdWaresGrade> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("PK_WARES", waresExt.getPkId());
|
||||
List<BdWaresGrade> waresGradeList = waresGradeService.list(queryWrapper);
|
||||
LambdaQueryWrapper<BdWaresGrade> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdWaresGrade::getPkWares, waresExt.getPkId());
|
||||
List<BdWaresGrade> waresGradeList = iBdWaresGradeService.list(queryWrapper);
|
||||
if (waresGradeList.size() > 0) {
|
||||
// 查询等级和商品是否存在 不存在不返回该数据
|
||||
for (BdWaresGrade bdWaresGrade : waresGradeList) {
|
||||
|
@ -670,7 +614,6 @@ public class ApiBdWaresController extends BaseController {
|
|||
if (pkSettleGrade.equals(bdWaresGrade.getPkRange())) {
|
||||
waresParamsList.add(waresParams);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
waresParamsList.add(waresParams);
|
||||
|
@ -685,18 +628,17 @@ public class ApiBdWaresController extends BaseController {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("get-wares-info")
|
||||
@PostMapping("/get-wares-info")
|
||||
public AjaxResult getWaresInfo(@RequestBody WaresInfoParam waresInfoParam) {
|
||||
BdWares wares = bdWaresService.getWares(waresInfoParam.getPkWares());
|
||||
BdWares wares = iBdWaresService.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 = bdWaresSpecsSkuService.selectByPkIds(waresSpecsSkuList);
|
||||
List<WaresItemWaresInfo> waresItemWaresInfos = iBdWaresSpecsSkuService.selectByPkIds(waresSpecsSkuList);
|
||||
BigDecimal waresPrice = BigDecimal.ZERO;
|
||||
BigDecimal pv = BigDecimal.ZERO;
|
||||
BigDecimal waresPriceAmount = BigDecimal.ZERO;
|
||||
|
@ -711,14 +653,11 @@ public class ApiBdWaresController extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
Integer pkCountry = SecurityUtils.getPkCountry();
|
||||
if (CountryConstants.CHINA_COUNTRY.equals(pkCountry)) {
|
||||
R<CurrencyDTO> currency = currencyServiceApi.getCurrency(pkCountry);
|
||||
R<CurrencyDTO> currency = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
|
||||
// 汇率比例
|
||||
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,9 +8,6 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 商品标签表 Mapper 接口
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-10-21
|
||||
*/
|
||||
public interface BdWaresLabelMapper extends BaseMapper<BdWaresLabel> {
|
||||
|
||||
|
|
|
@ -8,12 +8,15 @@ 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,9 +8,6 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 极差明细表 服务类
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-09-09
|
||||
*/
|
||||
public interface IBdWaresRangeService extends IService<BdWaresRange> {
|
||||
|
||||
|
@ -19,9 +16,6 @@ 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);
|
||||
|
||||
|
@ -32,9 +26,6 @@ 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,19 +13,10 @@ 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,10 +1,9 @@
|
|||
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.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;
|
||||
|
@ -23,28 +22,25 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 极差明细表 服务实现类
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-09-09
|
||||
*/
|
||||
@Service
|
||||
public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdWaresRange> implements IBdWaresRangeService {
|
||||
|
||||
@DubboReference
|
||||
IRangeServiceApi rangeServiceApi;
|
||||
IRangeServiceApi iRangeServiceApi;
|
||||
@DubboReference
|
||||
IAwardsServiceApi awardsServiceApi;
|
||||
IAwardsServiceApi iAwardsServiceApi;
|
||||
|
||||
@Override
|
||||
public List<BdWaresRange> queryWaresRangeByCondition(CuMember cuMember, List<Integer> pkWareList) {
|
||||
int level = cuMember.getPkSettleGrade();
|
||||
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()) {
|
||||
level = cuMember.getPkAwards();
|
||||
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) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
@ -53,19 +49,13 @@ public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdW
|
|||
|
||||
@Override
|
||||
public List<BdWaresRange> querySkuWaresRangeByCondition(Integer pkCountry, Integer rangeType, Integer level, List<Integer> 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);
|
||||
RangeDTO rangeDTO = iRangeServiceApi.queryRangeDtoByCondition(pkCountry, rangeType, level).getData();
|
||||
LambdaQueryWrapper<BdWaresRange> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdWaresRange::getPkRange, rangeDTO.getPkRange());
|
||||
queryWrapper.in(BdWaresRange::getPkWaresSpecsSku, specsSkuList);
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以range 为主表查询商品极差信息
|
||||
*
|
||||
* @param pkWares
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BdWaresRange> queryWaresList(Long pkWares, Integer pkCountry) {
|
||||
return baseMapper.queryWaresList(pkWares, pkCountry);
|
||||
|
@ -74,7 +64,7 @@ public class BdWaresRangeServiceImpl extends ServiceImpl<BdWaresRangeMapper, BdW
|
|||
@Override
|
||||
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) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
|
|
@ -9,9 +9,6 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 极差配置 Mapper 接口
|
||||
*
|
||||
* @author zhangjing
|
||||
* @since 2022-09-09
|
||||
*/
|
||||
public interface BdRangeMapper extends BaseMapper<BdRange> {
|
||||
|
||||
|
@ -21,9 +18,6 @@ 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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -12,37 +12,27 @@ 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 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
|
||||
public R<List<BdRangeExt>> queryRange(Integer pkCountry) {
|
||||
return R.ok(rangeService.queryRange(pkCountry));
|
||||
return R.ok(iBdRangeService.queryRange(pkCountry));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Map<String, RangeDTO>> queryRangeDto() {
|
||||
return R.ok(rangeService.queryRangeDto());
|
||||
return R.ok(iBdRangeService.queryRangeDto());
|
||||
}
|
||||
|
||||
@Override
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,48 +9,27 @@ 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();
|
||||
|
||||
|
@ -60,9 +39,6 @@ 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,20 +7,17 @@ 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;
|
||||
|
||||
|
@ -29,40 +26,18 @@ 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 rangeDetailsService;
|
||||
|
||||
@DubboReference
|
||||
ITransactionServiceApi iTransactionServiceApi;
|
||||
|
||||
private IBdRangeDetailsService iBdRangeDetailsService;
|
||||
@Autowired
|
||||
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());
|
||||
|
@ -80,7 +55,7 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
|
|||
rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
|
||||
rangeDetails.setPkCreator(SecurityUtils.getUserId());
|
||||
rangeDetails.setCreationTime(new Date());
|
||||
rangeDetailsService.save(rangeDetails);
|
||||
iBdRangeDetailsService.save(rangeDetails);
|
||||
}
|
||||
//奖衔
|
||||
for (Integer aw : awardsList) {
|
||||
|
@ -91,31 +66,20 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
|
|||
rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
|
||||
rangeDetails.setPkCreator(SecurityUtils.getUserId());
|
||||
rangeDetails.setCreationTime(new Date());
|
||||
rangeDetailsService.save(rangeDetails);
|
||||
iBdRangeDetailsService.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());
|
||||
rangeDetailsService.update(updateWrapper);
|
||||
iBdRangeDetailsService.update(updateWrapper);
|
||||
List<Integer> gradeList = rangeExt.getGradeList();
|
||||
List<Integer> awardsList = rangeExt.getAwardsList();
|
||||
//等级
|
||||
|
@ -127,7 +91,7 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
|
|||
rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
|
||||
rangeDetails.setPkCreator(SecurityUtils.getUserId());
|
||||
rangeDetails.setCreationTime(new Date());
|
||||
rangeDetailsService.save(rangeDetails);
|
||||
iBdRangeDetailsService.save(rangeDetails);
|
||||
}
|
||||
//奖衔
|
||||
for (Integer aw : awardsList) {
|
||||
|
@ -138,20 +102,12 @@ public class BdRangeServiceImpl extends ServiceImpl<BdRangeMapper, BdRange> impl
|
|||
rangeDetails.setPkCountry(SecurityUtils.getPkCountry());
|
||||
rangeDetails.setPkCreator(SecurityUtils.getUserId());
|
||||
rangeDetails.setCreationTime(new Date());
|
||||
rangeDetailsService.save(rangeDetails);
|
||||
iBdRangeDetailsService.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,11 +55,6 @@ public class SystemFieldConstants {
|
|||
*/
|
||||
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 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,12 +12,7 @@ import lombok.experimental.Accessors;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品标签表
|
||||
* </p>
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-10-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
@ -15,12 +15,7 @@ import lombok.experimental.Accessors;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 极差配置
|
||||
* </p>
|
||||
*
|
||||
* @author zhangjing
|
||||
* @since 2022-09-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
@ -37,7 +32,7 @@ public class BdRange extends BaseEntity {
|
|||
/**
|
||||
* 极差名称
|
||||
*/
|
||||
@Excel(name = "极差名称",sort=1)
|
||||
@Excel(name = "极差名称", sort = 1)
|
||||
@TableField("RANGE_NAME")
|
||||
private String rangeName;
|
||||
/**
|
||||
|
@ -46,7 +41,7 @@ public class BdRange extends BaseEntity {
|
|||
@TableField("RANGE_VALUE")
|
||||
@Transaction(transactionKey = EnumsPrefixConstants.AWARDS)
|
||||
private Integer rangeValue;
|
||||
@Excel(name = "极差值",sort=2)
|
||||
@Excel(name = "极差值", sort = 2)
|
||||
@TableField(exist = false)
|
||||
private String rangeValueVal;
|
||||
|
||||
|
|
Loading…
Reference in New Issue