From 85c4410b0948799a93f19f345b4ed18c253c89f3 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 03 九月 2024 10:26:33 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java | 69 +++++++++++++++++++++++++++++----- 1 files changed, 59 insertions(+), 10 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java index 30fb46a..e3ba3e6 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java @@ -6,6 +6,8 @@ import com.ruoyi.account.api.dto.GrantCouponDto; import com.ruoyi.account.api.feignClient.AppCouponClient; import com.ruoyi.account.api.feignClient.AppUserAddressClient; +import com.ruoyi.account.api.feignClient.AppUserClient; +import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.account.api.model.TAppUserAddress; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; @@ -42,11 +44,10 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -68,6 +69,8 @@ @Resource private CouponClient couponClient; + @Resource + private AppUserClient appUserClient; @Resource private AppUserAddressClient appUserAddressClient; @@ -190,14 +193,16 @@ * @return */ @Override - public List<MyShoppingOrderList> getMyShoppingOrderList(GetMyShoppingOrderList query) { + public Map<String, Object> getMyShoppingOrderList(GetMyShoppingOrderList query) { Long userId = tokenService.getLoginUserApplet().getUserId(); LambdaQueryWrapper<TShoppingOrder> wrapper = new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0) .eq(TShoppingOrder::getAppUserId, userId); if(query.getStatus() != 0){ wrapper.eq(TShoppingOrder::getStatus, query.getStatus()); } - List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + query.getPageCurr() + ", " + query.getPageSize())); + long count = this.count(wrapper); + Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize(); + List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + pageCurr + ", " + query.getPageSize())); List<MyShoppingOrderList> pageList = new ArrayList<>(); for (TShoppingOrder tShoppingOrder : list) { MyShoppingOrderList myShoppingOrderList = new MyShoppingOrderList(); @@ -209,7 +214,7 @@ name = goods.getName(); imgUrl = goods.getCoverPicture(); }else{ - TCoupon coupon = couponClient.getCouponById1(tShoppingOrder.getGoodsId()).getData(); + TCoupon coupon = couponClient.getCouponById1(tShoppingOrder.getCouponId()).getData(); name = coupon.getName(); imgUrl = coupon.getCoverPicture(); } @@ -223,7 +228,10 @@ myShoppingOrderList.setOrderType(tShoppingOrder.getOrderType()); pageList.add(myShoppingOrderList); } - return pageList; + Map<String, Object> map = new HashMap<>(); + map.put("list", pageList); + map.put("total", count); + return map; } @@ -251,7 +259,7 @@ name = goods.getName(); imgUrl = goods.getCoverPicture(); }else{ - TCoupon coupon = couponClient.getCouponById1(shoppingOrder.getGoodsId()).getData(); + TCoupon coupon = couponClient.getCouponById1(shoppingOrder.getCouponId()).getData(); info.setCouponType(coupon.getType()); info.setDays(coupon.getDays()); info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); @@ -268,8 +276,12 @@ info.setOrderAmount(shoppingOrder.getOrderAmount()); info.setPaymentAmount(shoppingOrder.getPaymentAmount()); info.setRemark(shoppingOrder.getRemark()); - info.setDeliveryTime(shoppingOrder.getConsignerTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); - info.setFinishTime(shoppingOrder.getReceivingTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + if(null != shoppingOrder.getConsignerTime()){ + info.setDeliveryTime(shoppingOrder.getConsignerTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + } + if(null != shoppingOrder.getReceivingTime()){ + info.setFinishTime(shoppingOrder.getReceivingTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + } return info; } @@ -349,6 +361,7 @@ if(1 == paymentType){ WxPaymentRefundModel model = new WxPaymentRefundModel(); model.setOut_trade_no(shoppingOrder.getCode()); + model.setTransaction_id(shoppingOrder.getSerialNumber()); model.setOut_refund_no(shoppingOrderRefund.getRefundCode()); model.setReason("取消订单"); model.setNotify_url("http://127.0.0.1:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); @@ -394,6 +407,7 @@ public AjaxResult cancelShoppingOrderWxRefund(String out_refund_no, String refund_id, String refund_status, String success_time) { if("SUCCESS".equals(refund_status)){ TShoppingOrderRefund one = shoppingOrderRefundService.getOne(new LambdaQueryWrapper<TShoppingOrderRefund>().eq(TShoppingOrderRefund::getRefundCode, out_refund_no)); + one.setRefundStatus(2); one.setRefundSerialNumber(refund_id); one.setRefundTime(LocalDateTime.parse(success_time, DateTimeFormatter.ofPattern("yyyy-MM-DDTHH:mm:ss+TIMEZONE"))); shoppingOrderRefundService.updateById(one); @@ -495,8 +509,43 @@ } PageInfo<TShoppingOrder> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); List<TShoppingOrder> list = this.baseMapper.pageList(pageInfo,query,startTime1,startTime2); + for (TShoppingOrder 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; } + + @Override + public List<SixShopDto> sixBefore(LocalDate sixBefore, Integer status) { + return this.baseMapper.sixBefore(sixBefore,status); + } + + @Override + public BigDecimal getSumAmount(LocalDate sixBefore) { + return this.baseMapper.getSumAmount(sixBefore); + } + + } -- Gitblit v1.7.1