From a96c5eddcd63fa6f09e4cdce9e28c7b846068f0c Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期三, 18 九月 2024 16:45:51 +0800 Subject: [PATCH] 9.18 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 50 insertions(+), 3 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 2f91c70..529097c 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,6 +44,7 @@ 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.*; @@ -66,6 +69,8 @@ @Resource private CouponClient couponClient; + @Resource + private AppUserClient appUserClient; @Resource private AppUserAddressClient appUserAddressClient; @@ -196,8 +201,7 @@ wrapper.eq(TShoppingOrder::getStatus, query.getStatus()); } 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<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + query.getPageCurr() + ", " + query.getPageSize())); List<MyShoppingOrderList> pageList = new ArrayList<>(); for (TShoppingOrder tShoppingOrder : list) { MyShoppingOrderList myShoppingOrderList = new MyShoppingOrderList(); @@ -356,9 +360,10 @@ 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"); + model.setNotify_url("http://221.182.45.100:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); amount.setRefund(refundAmount.multiply(new BigDecimal(100)).intValue()); amount.setTotal(shoppingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); @@ -401,6 +406,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); @@ -476,6 +482,7 @@ TShoppingOrder shoppingOrder = this.baseMapper.selectOne(Wrappers.lambdaQuery(TShoppingOrder.class).eq(TShoppingOrder::getCode, code)); shoppingOrder.setPaymentStatus(2); shoppingOrder.setSerialNumber(outTradeNo); + shoppingOrder.setPayTime(LocalDateTime.now()); this.updateById(shoppingOrder); //如果是优惠券,赠送优惠券 if (shoppingOrder.getOrderType()==2){ @@ -502,8 +509,48 @@ } 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); + } + + @Override + public List<Map<String, Object>> getData(ChargingStatisticsQueryDto statisticsQueryDto) { + return this.baseMapper.getData(statisticsQueryDto); + } + + } -- Gitblit v1.7.1