From b8b938ab734f4d87e0db2521e31407041b04b10d Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 26 十二月 2024 19:11:37 +0800 Subject: [PATCH] 修改分佣逻辑 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java index 0c1622f..a7bdf76 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java @@ -85,7 +85,7 @@ goodsVO.setGoodsId(goods.getId()); goodsVO.setGoodsName(goods.getName()); R<Price> r = remoteOrderGoodsClient.getGoodsPrice(loginUserApplet.getUserid(), goods.getId(), null); - if (R.isSuccess(r)){ + if (null != r.getData()){ Price price = r.getData(); goodsVO.setSellingPrice(price.getCash()); goodsVO.setIntegral(price.getPoint()); @@ -103,8 +103,8 @@ LoginUser loginUserApplet = tokenService.getLoginUserApplet(); AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); - BigDecimal sellingPrice; - Integer integral; + BigDecimal sellingPrice = BigDecimal.ZERO; + Integer integral = 0; GoodsArea goodsArea = goodsAreaMapper.selectOne(new LambdaQueryWrapper<GoodsArea>() .eq(GoodsArea::getGoodsId, goodsId) @@ -120,9 +120,10 @@ GoodsVip goodsVip = goodsVipService.getOne(new LambdaQueryWrapper<GoodsVip>() .eq(GoodsVip::getVip, vipSetting.getId()) .eq(GoodsVip::getGoodsId, goodsId)); - - sellingPrice = goodsVip.getSellingPrice(); - integral = goodsVip.getIntegral(); + if(null != goodsVip){ + sellingPrice = goodsVip.getSellingPrice(); + integral = goodsVip.getIntegral(); + } } Goods goods = this.getById(goodsId); @@ -220,6 +221,7 @@ for (GoodsArea goodsArea : goodsAreaList) { List<GoodsArea> goodsAreaList1 = goodsArea.getGoodsAreaList(); for (GoodsArea area : goodsAreaList1) { + area.setId(null); area.setGoodsId(id); area.setProvince(goodsArea.getProvince()); area.setCity(goodsArea.getCity()); @@ -236,6 +238,10 @@ private void saveGoodsVipList(List<GoodsVip> goodsVipList, Integer id) { goodsVipService.remove(new LambdaQueryWrapper<GoodsVip>() .eq(GoodsVip::getGoodsId, id)); + goodsVipList.forEach(item -> { + item.setId(null); + item.setGoodsId(id); + }); goodsVipService.saveBatch(goodsVipList); } @@ -337,6 +343,9 @@ private List<VipSetting> getVipSettings(Stream<Integer> goodsVipList) { List<Integer> vipIds = goodsVipList.collect(Collectors.toList()); + if (CollectionUtils.isEmpty(vipIds)){ + return new ArrayList<>(); + } return vipSettingService.listByIds(vipIds); } -- Gitblit v1.7.1