From acccff9860b271d55c55dc87486f7c20b9896e6c Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期一, 13 一月 2025 16:19:54 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 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 9c2c7b0..2fbcf1b 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 @@ -87,15 +87,17 @@ private GoodsBargainPriceDetailService goodsBargainPriceDetailService; @Resource private OrderClient orderClient; + @Resource + private GoodsEvaluateService goodsEvaluateService; @Override public PageInfo<GoodsVO> goodsList(Goods search) { Integer vipId = 0; - String provinceCode = null; - String cityCode = null; - String districtCode = null; + String provinceCode = "0"; + String cityCode = "0"; + String districtCode = "0"; String token = SecurityUtils.getToken(ServletUtils.getRequest()); if(StringUtils.isNotEmpty(token)){ Long userid = tokenService.getLoginUserApplet().getUserid(); @@ -258,6 +260,17 @@ } Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData(); goodsVO.setSaleNum(integer); + GoodsEvaluate goodsEvaluate = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId) + .orderByDesc(GoodsEvaluate::getGrade).eq(GoodsEvaluate::getStatus, 2).eq(GoodsEvaluate::getDelFlag, 0).last(" limit 0, 1").one(); + if (null != goodsEvaluate) { + AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId()); + if(null != appUserById){ + goodsEvaluate.setUserName(appUserById.getName()); + goodsEvaluate.setAvatar(appUserById.getAvatar()); + goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId())); + } + } + goodsVO.setGoodsEvaluate(goodsEvaluate); return goodsVO; } @@ -446,6 +459,7 @@ List<AppUser> appUsers = appUserClient.listByIds(userIds); for (GoodsAppUser goodsAppUser : goodsAppUserList) { appUsers.stream().filter(u -> u.getId().equals(goodsAppUser.getAppUserId())).findFirst().ifPresent( u -> { + goodsAppUser.setAppUserIdStr(goodsAppUser.getAppUserId().toString()); goodsAppUser.setUserName(u.getName()); goodsAppUser.setPhone(u.getPhone()); VipSetting vipSetting = vipSettingService.getById(u.getVipId()); -- Gitblit v1.7.1