From c4664502dfdaffff555b532e65b51a57ac8b29c2 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 16 十月 2024 17:51:32 +0800 Subject: [PATCH] 合并代码 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java | 66 ++++++++++++++++++++++++++------ 1 files changed, 53 insertions(+), 13 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java index 554db1a..7b112a6 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java @@ -3,7 +3,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.feignClient.AppUserAddressClient; +import com.ruoyi.account.api.feignClient.AppUserClient; +import com.ruoyi.account.api.feignClient.AppUserIntegralChangeClient; +import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.account.api.model.TAppUserAddress; +import com.ruoyi.account.api.model.TAppUserIntegralChange; +import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.api.model.TExchangeOrder; @@ -51,8 +56,12 @@ @Resource private AppUserAddressClient appUserAddressClient; + + @Resource + private AppUserClient appUserClient; - + @Resource + private AppUserIntegralChangeClient appUserIntegralChangeClient; @@ -87,12 +96,16 @@ String imgUrl = ""; if(tExchangeOrder.getOrderType() == 1){ TGoods goods = goodsClient.getGoodsById(tExchangeOrder.getGoodsId()).getData(); - name = goods.getName(); - imgUrl = goods.getCoverPicture(); + if(null != goods){ + name = goods.getName(); + imgUrl = goods.getCoverPicture(); + } }else{ TCoupon coupon = couponClient.getCouponById1(tExchangeOrder.getCouponId()).getData(); - name = coupon.getName(); - imgUrl = coupon.getCoverPicture(); + if(null != coupon){ + name = coupon.getName(); + imgUrl = coupon.getCoverPicture(); + } } exchangeOrderList.setName(name); exchangeOrderList.setImgUrl(imgUrl); @@ -128,15 +141,19 @@ String imgUrl = ""; if(exchangeOrder.getOrderType() == 1){ TGoods goods = goodsClient.getGoodsById(exchangeOrder.getGoodsId()).getData(); - name = goods.getName(); - imgUrl = goods.getCoverPicture(); + if(null != goods){ + name = goods.getName(); + imgUrl = goods.getCoverPicture(); + } }else{ TCoupon coupon = couponClient.getCouponById1(exchangeOrder.getCouponId()).getData(); - info.setCouponType(coupon.getType()); - info.setDays(coupon.getDays()); - info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); - name = coupon.getName(); - imgUrl = coupon.getCoverPicture(); + if(null != coupon){ + info.setCouponType(coupon.getType()); + info.setDays(coupon.getDays()); + info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + name = coupon.getName(); + imgUrl = coupon.getCoverPicture(); + } } info.setName(name); info.setImgUrl(imgUrl); @@ -168,8 +185,31 @@ } PageInfo<TExchangeOrder> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); List<TExchangeOrder> list = this.baseMapper.pageList(pageInfo,query,startTime1,startTime2); - + for (TExchangeOrder tShoppingOrder : list) { + tShoppingOrder.setUid(tShoppingOrder.getId().toString()); + switch (tShoppingOrder.getOrderType()){ + case 1: + TGoods data = goodsClient.getGoodsById(tShoppingOrder.getGoodsId()).getData(); + if (data!=null){ + tShoppingOrder.setName(data.getName()); + } + break; + case 2: + TCoupon data1 = couponClient.getCouponById1(tShoppingOrder.getCouponId()).getData(); + if (data1!=null){ + tShoppingOrder.setName(data1.getName()); + } + break; + } + if (tShoppingOrder.getAppUserId() != null){ + TAppUser data = appUserClient.getUserById(tShoppingOrder.getAppUserId()).getData(); + if (data!=null){ + tShoppingOrder.setPhone(data.getPhone()); + } + } + } pageInfo.setRecords(list); return pageInfo; } + } -- Gitblit v1.7.1