修复售后订单问题 修复支付问题
This commit is contained in:
@ -2,11 +2,7 @@ package co.yixiang.yshop.module.order.controller.admin.storeaftersales.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 售后记录 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
|
@ -18,71 +18,71 @@ import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@Data
|
||||
public class StoreOrderBaseVO {
|
||||
|
||||
@Schema(description = "订单号", required = true, example = "20527")
|
||||
@Schema(description = "订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20527")
|
||||
@NotNull(message = "订单号不能为空")
|
||||
private String orderId;
|
||||
|
||||
@Schema(description = "额外订单号", example = "12452")
|
||||
private String extendOrderId;
|
||||
|
||||
@Schema(description = "用户id", required = true, example = "8323")
|
||||
@Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "8323")
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "用户姓名", required = true, example = "张三")
|
||||
@Schema(description = "用户姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotNull(message = "用户姓名不能为空")
|
||||
private String realName;
|
||||
|
||||
@MobileDesensitize
|
||||
@Schema(description = "用户电话", required = true)
|
||||
@Schema(description = "用户电话", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "用户电话不能为空")
|
||||
private String userPhone;
|
||||
|
||||
@Schema(description = "详细地址", required = true)
|
||||
@Schema(description = "详细地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "详细地址不能为空")
|
||||
private String userAddress;
|
||||
|
||||
@Schema(description = "购物车id", required = true, example = "23301")
|
||||
@Schema(description = "购物车id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23301")
|
||||
@NotNull(message = "购物车id不能为空")
|
||||
private String cartId;
|
||||
|
||||
@Schema(description = "运费金额", required = true, example = "637")
|
||||
@Schema(description = "运费金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "637")
|
||||
@NotNull(message = "运费金额不能为空")
|
||||
private BigDecimal freightPrice;
|
||||
|
||||
@Schema(description = "订单商品总数", required = true)
|
||||
@Schema(description = "订单商品总数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "订单商品总数不能为空")
|
||||
private Integer totalNum;
|
||||
|
||||
@Schema(description = "订单总价", required = true, example = "31659")
|
||||
@Schema(description = "订单总价", requiredMode = Schema.RequiredMode.REQUIRED, example = "31659")
|
||||
@NotNull(message = "订单总价不能为空")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@Schema(description = "邮费", required = true)
|
||||
@Schema(description = "邮费", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "邮费不能为空")
|
||||
private BigDecimal totalPostage;
|
||||
|
||||
@Schema(description = "实际支付金额", required = true, example = "19682")
|
||||
@Schema(description = "实际支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "19682")
|
||||
@NotNull(message = "实际支付金额不能为空")
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@Schema(description = "支付邮费", required = true)
|
||||
@Schema(description = "支付邮费", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "支付邮费不能为空")
|
||||
private BigDecimal payPostage;
|
||||
|
||||
@Schema(description = "抵扣金额", required = true, example = "16463")
|
||||
@Schema(description = "抵扣金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "16463")
|
||||
@NotNull(message = "抵扣金额不能为空")
|
||||
private BigDecimal deductionPrice;
|
||||
|
||||
@Schema(description = "优惠券id", required = true, example = "3299")
|
||||
@Schema(description = "优惠券id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3299")
|
||||
// @NotNull(message = "优惠券id不能为空")
|
||||
private Long couponId;
|
||||
|
||||
@Schema(description = "优惠券金额", required = true, example = "22157")
|
||||
@Schema(description = "优惠券金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "22157")
|
||||
@NotNull(message = "优惠券金额不能为空")
|
||||
private BigDecimal couponPrice;
|
||||
|
||||
@Schema(description = "支付状态", required = true, example = "11728")
|
||||
@Schema(description = "支付状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "11728")
|
||||
@NotNull(message = "支付状态不能为空")
|
||||
private Integer paid;
|
||||
|
||||
@ -90,15 +90,15 @@ public class StoreOrderBaseVO {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@Schema(description = "支付方式", required = true, example = "2")
|
||||
@Schema(description = "支付方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "支付方式不能为空")
|
||||
private String payType;
|
||||
|
||||
@Schema(description = "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)", required = true, example = "1")
|
||||
@Schema(description = "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "0 未退款 1 申请中 2 已退款", required = true, example = "2")
|
||||
@Schema(description = "0 未退款 1 申请中 2 已退款", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "0 未退款 1 申请中 2 已退款不能为空")
|
||||
private Integer refundStatus;
|
||||
|
||||
@ -118,7 +118,7 @@ public class StoreOrderBaseVO {
|
||||
@Schema(description = "不退款的理由", example = "不喜欢")
|
||||
private String refundReason;
|
||||
|
||||
@Schema(description = "退款金额", required = true, example = "7547")
|
||||
@Schema(description = "退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "7547")
|
||||
@NotNull(message = "退款金额不能为空")
|
||||
private BigDecimal refundPrice;
|
||||
|
||||
@ -134,63 +134,63 @@ public class StoreOrderBaseVO {
|
||||
@Schema(description = "快递单号/手机号", example = "24798")
|
||||
private String deliveryId;
|
||||
|
||||
@Schema(description = "消费赚取积分", required = true)
|
||||
@Schema(description = "消费赚取积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "消费赚取积分不能为空")
|
||||
private BigDecimal gainIntegral;
|
||||
|
||||
@Schema(description = "使用积分", required = true)
|
||||
@Schema(description = "使用积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "使用积分不能为空")
|
||||
private BigDecimal useIntegral;
|
||||
|
||||
@Schema(description = "实际支付积分", required = true)
|
||||
@Schema(description = "实际支付积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "实际支付积分不能为空")
|
||||
private BigDecimal payIntegral;
|
||||
|
||||
@Schema(description = "给用户退了多少积分")
|
||||
private BigDecimal backIntegral;
|
||||
|
||||
@Schema(description = "备注", required = true)
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "备注不能为空")
|
||||
private String mark;
|
||||
|
||||
@Schema(description = "唯一id(md5加密)类似id", required = true)
|
||||
@Schema(description = "唯一id(md5加密)类似id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "唯一id(md5加密)类似id不能为空")
|
||||
private String unique;
|
||||
|
||||
@Schema(description = "管理员备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "商户ID", required = true, example = "8499")
|
||||
@Schema(description = "商户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "8499")
|
||||
@NotNull(message = "商户ID不能为空")
|
||||
private Integer merId;
|
||||
|
||||
@Schema(description = "拼团产品id0一般产品", example = "3865")
|
||||
private Long combinationId;
|
||||
|
||||
@Schema(description = "拼团id 0没有拼团", required = true, example = "8463")
|
||||
@Schema(description = "拼团id 0没有拼团", requiredMode = Schema.RequiredMode.REQUIRED, example = "8463")
|
||||
@NotNull(message = "拼团id 0没有拼团不能为空")
|
||||
private Long pinkId;
|
||||
|
||||
@Schema(description = "成本价", required = true)
|
||||
@Schema(description = "成本价", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "成本价不能为空")
|
||||
private BigDecimal cost;
|
||||
|
||||
@Schema(description = "秒杀产品ID", required = true, example = "21525")
|
||||
@Schema(description = "秒杀产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21525")
|
||||
@NotNull(message = "秒杀产品ID不能为空")
|
||||
private Long seckillId;
|
||||
|
||||
@Schema(description = "砍价id", example = "5132")
|
||||
private Integer bargainId;
|
||||
|
||||
@Schema(description = "核销码", required = true)
|
||||
@Schema(description = "核销码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "核销码不能为空")
|
||||
private String verifyCode;
|
||||
|
||||
@Schema(description = "门店id", required = true, example = "12064")
|
||||
@Schema(description = "门店id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12064")
|
||||
@NotNull(message = "门店id不能为空")
|
||||
private Integer storeId;
|
||||
|
||||
@Schema(description = "配送方式 1=快递 ,2=门店自提", required = true, example = "2")
|
||||
@Schema(description = "配送方式 1=快递 ,2=门店自提", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "配送方式 1=快递 ,2=门店自提不能为空")
|
||||
private Integer shippingType;
|
||||
|
||||
|
@ -35,8 +35,8 @@ public class AppReturnLogisticsParam {
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@NotBlank(message="订单编号不能为空")
|
||||
private String orderCode;
|
||||
/*@NotBlank(message="订单编号不能为空")
|
||||
private String orderCode;*/
|
||||
|
||||
/**
|
||||
* 售后订单id
|
||||
|
@ -7,7 +7,6 @@ import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -2,7 +2,6 @@ package co.yixiang.yshop.module.order.controller.app.afterorder.vo;
|
||||
|
||||
|
||||
import co.yixiang.yshop.module.product.controller.app.cart.vo.AppStoreCartQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -12,7 +11,6 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -158,6 +158,7 @@ public class AppOrderController {
|
||||
*/
|
||||
@RequestMapping(value = "payBack{detailsId}.json")
|
||||
public String payBack(HttpServletRequest request, @PathVariable String detailsId) {
|
||||
//底层通过调用pay模块的handler接受回调信息
|
||||
return manager.payBack(detailsId, new HttpRequestNoticeParams(request));
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class AppPayParam implements Serializable {
|
||||
@Schema(description = "来源", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String from;
|
||||
|
||||
@NotBlank(message = "选择支付类型 PayTypeEnum类型(alipay weixin yue)")
|
||||
@NotBlank(message = "选择支付类型 PayTypeEnum类型(weixin_h5|weixin_applet|weixin_app)")
|
||||
@Schema(description = "支付类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String paytype;
|
||||
|
||||
|
@ -6,12 +6,10 @@ import co.yixiang.yshop.module.product.controller.app.cart.vo.AppStoreCartQueryV
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
@ -186,6 +186,7 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
.oid(yxStoreOrder.getId()).changeType(APPLY_AFTER_SALES.getValue())
|
||||
.changeMessage(APPLY_AFTER_SALES.getDesc()).changeTime(LocalDateTime.now()).build();
|
||||
// 记录订单操作
|
||||
|
||||
storeOrderStatusMapper.insert(orderStatusDO);
|
||||
//操作记录
|
||||
storeAfterSalesStatusService.create(storeAfterSales.getUserId(), storeAfterSales.getId(),
|
||||
@ -208,7 +209,6 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
.eq(StoreOrderDO::getOrderId, afterSales.getOrderCode()));
|
||||
|
||||
// 查询售后信息子项
|
||||
|
||||
List<StoreAfterSalesItemDO> afterSalesItemDOS =
|
||||
storeAfterSalesItemMapper.selectList(new LambdaUpdateWrapper<StoreAfterSalesItemDO>()
|
||||
.eq(StoreAfterSalesItemDO::getStoreAfterSalesId, afterSales.getId()));
|
||||
@ -217,6 +217,11 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
afterSalesItemDOS.stream().map(cart -> JSON.parseObject(cart.getCartInfo(), AppStoreCartQueryVo.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
||||
for (AppStoreCartQueryVo cart : cartInfo) {
|
||||
totalPrice = totalPrice.add(cart.getTruePrice().multiply(BigDecimal.valueOf(cart.getCartNum())));
|
||||
}
|
||||
|
||||
// 查询是否发货
|
||||
StoreOrderStatusDO orderStatusDO =
|
||||
storeOrderStatusMapper.selectOne(new LambdaQueryWrapper<StoreOrderStatusDO>()
|
||||
@ -227,6 +232,7 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
AppStoreOrderAfterSalesDetailVo result =
|
||||
AppStoreOrderAfterSalesDetailVo.builder()
|
||||
// 售后信息
|
||||
.id(afterSales.getId())
|
||||
.refundAmount(afterSales.getRefundAmount()).reasons(afterSales.getReasons())
|
||||
.explains(afterSales.getExplains()).explainImg(afterSales.getExplainImg())
|
||||
.state(afterSales.getState()).salesState(afterSales.getSalesState())
|
||||
@ -236,9 +242,9 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
.receivingStatus(afterSales.getReceivingStatus())
|
||||
.serviceType(afterSales.getServiceType())
|
||||
// 订单信息
|
||||
.id(storeOrderDO.getId()).orderId(storeOrderDO.getOrderId()).uid(storeOrderDO.getUid())
|
||||
.orderId(storeOrderDO.getOrderId()).uid(storeOrderDO.getUid())
|
||||
.createTime(storeOrderDO.getCreateTime())
|
||||
.payPrice(storeOrderDO.getPayPrice()).totalPrice(storeOrderDO.getTotalPrice())
|
||||
.payPrice(storeOrderDO.getPayPrice()).totalPrice(totalPrice)
|
||||
.totalPostage(storeOrderDO.getTotalPostage()).deductionPrice(storeOrderDO.getDeductionPrice())
|
||||
.deliveryTime(orderStatusDO == null ? null : orderStatusDO.getChangeTime())
|
||||
.payTime(storeOrderDO.getPayTime())
|
||||
@ -454,9 +460,8 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public Boolean addLogisticsInformation(AppReturnLogisticsParam param) {
|
||||
StoreAfterSalesDO storeAfterSales = this.baseMapper.selectOne(Wrappers.<StoreAfterSalesDO>lambdaQuery()
|
||||
.eq(StoreAfterSalesDO::getId, param.getId())
|
||||
.eq(StoreAfterSalesDO::getOrderCode, param.getOrderCode()));
|
||||
StoreAfterSalesDO storeAfterSales = getById(param.getId());
|
||||
// .eq(StoreAfterSalesDO::getOrderCode, param.getOrderCode()));
|
||||
if (!storeAfterSales.getState().equals(AfterSalesStatusEnum.AUDITED.getValue())) {
|
||||
throw exception(ORDER_STATUS_NOT_EXPRESS_);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package co.yixiang.yshop.module.order.service.storeaftersalesstatus;
|
||||
|
||||
import co.yixiang.yshop.module.order.dal.dataobject.storeaftersalesstatus.StoreAfterSalesStatusDO;
|
||||
import co.yixiang.yshop.module.order.dal.mysql.storeaftersalesstatus.StoreAfterSalesStatusMapper;
|
||||
import co.yixiang.yshop.module.order.service.storeorder.AsyncStoreOrderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -22,6 +23,9 @@ import static co.yixiang.yshop.framework.security.core.util.SecurityFrameworkUti
|
||||
@Validated
|
||||
public class StoreAfterSalesStatusServiceImpl implements StoreAfterSalesStatusService {
|
||||
|
||||
|
||||
// @Resource
|
||||
// private AsyncStoreOrderService asyncStoreOrderService;
|
||||
@Resource
|
||||
private StoreAfterSalesStatusMapper storeAfterSalesStatusMapper;
|
||||
|
||||
@ -43,6 +47,9 @@ public class StoreAfterSalesStatusServiceImpl implements StoreAfterSalesStatusSe
|
||||
storeAfterSalesStatus.setChangeTime(LocalDateTime.now());
|
||||
storeAfterSalesStatus.setOperator(Objects.requireNonNull(getLoginUserId()).toString());
|
||||
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
|
||||
|
||||
//异步统计
|
||||
// asyncStoreOrderService.orderData(uid);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ import co.yixiang.yshop.module.pay.PayContext;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo.PayParam;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchantdetails.MerchantDetailsDO;
|
||||
import co.yixiang.yshop.module.pay.service.merchantdetails.MerchantDetailsService;
|
||||
import co.yixiang.yshop.module.pay.strategy.PayEnum;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.service.WxPayService;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.service.WxPayServiceUtils;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.skd.HttpKit;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.skd.PaymentApi;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.skd.PaymentKit;
|
||||
@ -72,6 +72,8 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.egzosn.pay.spring.boot.core.PayServiceManager;
|
||||
import com.egzosn.pay.spring.boot.core.bean.MerchantPayOrder;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
@ -150,15 +152,12 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
@Resource
|
||||
private StoreOrderStatusMapper storeOrderStatusMapper;
|
||||
|
||||
@Resource
|
||||
private WxPayService wxPayService;
|
||||
|
||||
@Resource
|
||||
private ProductCouponService couponService;
|
||||
|
||||
@Resource
|
||||
private AppCouponRelationService appCouponRelationService;
|
||||
|
||||
@Resource
|
||||
private PayServiceManager manager;
|
||||
|
||||
private static final String LOCK_KEY = "cart:check:stock:lock";
|
||||
private static final String STOCK_LOCK_KEY = "cart:do:stock:lock";
|
||||
|
||||
@ -371,7 +370,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
storeOrder.setTotalPrice(computeVo.getTotalPrice());
|
||||
storeOrder.setTotalPostage(computeVo.getPayPostage());
|
||||
|
||||
storeOrder.setCouponId(param.getCouponId());
|
||||
storeOrder.setCouponId(param.getCouponId() != null && param.getCouponId().compareTo(0l) > 0 ? param.getCouponId() : null);
|
||||
storeOrder.setCouponPrice(computeVo.getCouponPrice());
|
||||
storeOrder.setPayPrice(computeVo.getPayPrice());
|
||||
storeOrder.setPayPostage(computeVo.getPayPostage());
|
||||
@ -396,7 +395,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
// 减库存加销量
|
||||
this.deStockIncSale(cartInfo);
|
||||
|
||||
if (param.getCouponId() != null && param.getCouponId() != 0) {
|
||||
if (param.getCouponId() != null && param.getCouponId() != 0 && param.getCouponId() != -1) {
|
||||
// 使用优惠券
|
||||
appCouponRelationService.verificationCoupon(param.getCouponId());
|
||||
}
|
||||
@ -454,9 +453,11 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
if (orderInfo.getPayInfo() == null) {
|
||||
return false;
|
||||
}
|
||||
if (PayTypeEnum.WEIXIN.getValue().equals(param.getPaytype())) {
|
||||
//paytype含有weixin就查微信订单
|
||||
if (param.getPaytype().contains(PayTypeEnum.WEIXIN.getValue())) {
|
||||
//微信查单
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails("4");
|
||||
if (merchantDetailsDO == null) throw exception(ORDER_QUERY_NO_MERCHANT);
|
||||
PayInfo payInfo = JsonUtils.parseObject(orderInfo.getPayInfo(), PayInfo.class);
|
||||
if (payInfo == null) return false;
|
||||
if (payInfo.getTransaction_id() == null) return false;
|
||||
@ -492,12 +493,27 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
//小程序支付需要openid
|
||||
if (Objects.isNull(userDO.getRoutineOpenid())) throw exception(USER_NOT_BINDING_WX_APPLET);
|
||||
}
|
||||
//微信h5支付商户配置
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails(PayTypeEnum.toType(param.getPaytype()).getCode());
|
||||
//根据type得到支付商户配置
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails(PayTypeEnum.toType(param.getPaytype()).getCode());
|
||||
PayContext payContext = new PayContext();
|
||||
Map<String, String> packageParams = payContext.selectPayWay(PayEnum.WEIXIN.getCode(),
|
||||
new PayParam(orderInfo.getOrderId(), orderInfo.getPayPrice(), userDO.getRoutineOpenid(), ServletUtils.getClientIP(),
|
||||
param.getPaytype(), "Yshop商城", merchantDetailsDO));
|
||||
Map<String, String> packageParams = new HashMap<>();
|
||||
if (param.getPaytype().contains(PayTypeEnum.ALI.getValue())) {
|
||||
aliPay(orderInfo, param, packageParams);
|
||||
updatePayInfo(orderInfo,packageParams);
|
||||
}else if(param.getPaytype().contains(PayTypeEnum.WEIXIN.getValue())){
|
||||
packageParams = payContext.selectPayWay(PayTypeEnum.WEIXIN.getValue(),
|
||||
new PayParam(orderInfo.getOrderId(), orderInfo.getPayPrice(), userDO.getRoutineOpenid(), ServletUtils.getClientIP(),
|
||||
param.getPaytype(), "Yshop商城", merchantDetailsDO));
|
||||
updatePayInfo(orderInfo,packageParams);
|
||||
}else if(param.getPaytype().contains(PayTypeEnum.YUE.getValue())){
|
||||
yuePay(param.getUni(),uid);
|
||||
}
|
||||
// 异步统计
|
||||
asyncStoreOrderService.orderData(uid);
|
||||
return packageParams;
|
||||
}
|
||||
|
||||
private void updatePayInfo(AppStoreOrderQueryVo orderInfo, Map<String, String> packageParams){
|
||||
PayInfo payInfo = new PayInfo();
|
||||
payInfo.setOrderId(orderInfo.getOrderId());
|
||||
payInfo.setOut_trade_no(packageParams.get("out_trade_no"));
|
||||
@ -508,10 +524,22 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
StoreOrderDO storeOrder = new StoreOrderDO();
|
||||
storeOrder.setPayInfo(JsonUtils.toJsonString(payInfo));
|
||||
this.update(storeOrder, wrapper);
|
||||
// 异步统计
|
||||
asyncStoreOrderService.orderData(uid);
|
||||
return packageParams;
|
||||
}
|
||||
|
||||
private void aliPay(AppStoreOrderQueryVo orderInfo, AppPayParam param, Map<String, String> packageParams ){
|
||||
if(PayTypeEnum.ALI_H5.getValue().equals(param.getPaytype())){
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("1", "WAP", "支付宝H5商品购买",
|
||||
"h5商品购买", orderInfo.getPayPrice(), param.getUni()+"-"+ RandomStringUtil.getRandomCode(3,0)+"H5");
|
||||
String str = manager.toPay(payOrder);
|
||||
log.info(str);
|
||||
// packageParams.put("data",manager.toPay(payOrder));
|
||||
}else if(PayTypeEnum.ALI_APP.getValue().equals(param.getFrom())){
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("1", "APP", "支付宝APP商品购买",
|
||||
"支付宝APP5商品购买", orderInfo.getPayPrice(), param.getUni()+"-"+ RandomStringUtil.getRandomCode(3,0)+"APP");
|
||||
// packageParams.put("data",manager.app(payOrder));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public void wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
@ -563,7 +591,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
// throw exception(STORE_ORDER_PAY_FEE_ERROR);
|
||||
//最简单做法 不一致退还支付金额,订单装态不变
|
||||
assert payInfo != null;
|
||||
Map map = wxPayService.refund(resultMap.get("transaction_id"), payInfo.getOut_refund_no(), orderInfo.getTotalPrice(), totalFee, merchantDetailsDO);
|
||||
Map map = new WxPayServiceUtils().refund(resultMap.get("transaction_id"), payInfo.getOut_refund_no(), orderInfo.getTotalPrice(), totalFee, merchantDetailsDO);
|
||||
log.info("退款详情:" + map);
|
||||
String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||
response.getWriter().write(result);
|
||||
@ -928,7 +956,8 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
|
||||
long count = appStoreProductReplyService.count(Wrappers.<StoreProductReplyDO>lambdaQuery()
|
||||
.eq(StoreProductReplyDO::getOid, orderCartInfo.getOid())
|
||||
.eq(StoreProductReplyDO::getProductId, orderCartInfo.getProductId()));
|
||||
.eq(StoreProductReplyDO::getProductId, orderCartInfo.getProductId())
|
||||
.eq(StoreProductReplyDO::getUnique, unique));
|
||||
if (count > 0) {
|
||||
throw exception(COMMENT_PRODUCT_IN_EXISTS);
|
||||
}
|
||||
@ -1009,13 +1038,16 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails("4");
|
||||
PayInfo payInfo = JsonUtils.parseObject(order.getPayInfo(), PayInfo.class);
|
||||
//取消之前要查询微信端是否支付完成如若由于网络原因造成两端不一致以微信端支付装态为准,已支付则不能取消,走退款逻辑
|
||||
if (payInfo == null) throw exception(ORDER_PAYINFO_ERROR);
|
||||
Map<String, String> map = PaymentApi.queryByOutTradeNo(merchantDetailsDO.getAppid(), merchantDetailsDO.getMchId(), merchantDetailsDO.getKeyPrivate(), payInfo.getOut_trade_no());
|
||||
log.info("查询微信订单状态:{}", map);
|
||||
//支付方也需要调用关闭订单接口
|
||||
if (Objects.equals(map.get(WxOrderResultEnum.TRADE_STATE.getValue()), WxOrderResultEnum.NOT_PAY.getValue())) {
|
||||
Map<String, String> closeOrderMap = PaymentApi.closeOrder(merchantDetailsDO.getAppid(), merchantDetailsDO.getMchId(), merchantDetailsDO.getKeyPrivate(), payInfo.getOut_trade_no());
|
||||
log.info("微信关闭订单:{}", closeOrderMap);
|
||||
// if (payInfo == null) throw exception(ORDER_PAYINFO_ERROR);
|
||||
// 有微信订单的数据关闭微信订单
|
||||
if (payInfo != null) {
|
||||
Map<String, String> map = PaymentApi.queryByOutTradeNo(merchantDetailsDO.getAppid(), merchantDetailsDO.getMchId(), merchantDetailsDO.getKeyPrivate(), payInfo.getOut_trade_no());
|
||||
log.info("查询微信订单状态:{}", map);
|
||||
//支付方也需要调用关闭订单接口
|
||||
if (Objects.equals(map.get(WxOrderResultEnum.TRADE_STATE.getValue()), WxOrderResultEnum.NOT_PAY.getValue())) {
|
||||
Map<String, String> closeOrderMap = PaymentApi.closeOrder(merchantDetailsDO.getAppid(), merchantDetailsDO.getMchId(), merchantDetailsDO.getKeyPrivate(), payInfo.getOut_trade_no());
|
||||
log.info("微信关闭订单:{}", closeOrderMap);
|
||||
}
|
||||
}
|
||||
|
||||
this.regressionIntegral(order, 0);
|
||||
@ -1077,7 +1109,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
} else if (PayTypeEnum.WEIXIN.getValue().equals(orderQueryVo.getPayType())) {
|
||||
// 微信
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails("4");
|
||||
packageParams = wxPayService.refund(payInfo.getTransaction_id(), payInfo.getOut_refund_no(), orderQueryVo.getTotalPrice(), price, merchantDetailsDO);
|
||||
packageParams = new WxPayServiceUtils().refund(payInfo.getTransaction_id(), payInfo.getOut_refund_no(), orderQueryVo.getTotalPrice(), price, merchantDetailsDO);
|
||||
|
||||
log.info("退款信息:{}", packageParams);
|
||||
//退款成功操作 应该在回调url中
|
||||
@ -1410,7 +1442,11 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
|
||||
//是否是固定邮费,没设置运费模板走固定
|
||||
if (tempId == 0) {
|
||||
return storeCartVO.getProductInfo().getPostage();
|
||||
storePostage =
|
||||
storePostage.add(storeCartVO.getProductInfo().getPostage()
|
||||
.multiply(BigDecimal.valueOf(storeCartVO.getCartNum())));
|
||||
continue;
|
||||
// return storeCartVO.getProductInfo().getPostage();
|
||||
}
|
||||
|
||||
//根据模板类型获取相应的数量
|
||||
@ -1467,7 +1503,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
}
|
||||
|
||||
//处理区域邮费
|
||||
boolean isFirst = true; //用来是否多个产品的标识 false表示数量大于1
|
||||
boolean isFirst = false; //用来是否多个产品的标识 false表示数量大于1
|
||||
for (TemplateDto templateDTO : templateDTOMap.values()) {
|
||||
if (isFirst) {//首件
|
||||
//只满足首件
|
||||
|
@ -1,229 +0,0 @@
|
||||
package co.yixiang.yshop.module.order.service.storeorder;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import co.yixiang.yshop.framework.common.enums.OrderInfoEnum;
|
||||
import co.yixiang.yshop.module.member.controller.app.user.vo.AppUserOrderCountVo;
|
||||
import co.yixiang.yshop.module.member.service.user.MemberUserService;
|
||||
import co.yixiang.yshop.module.order.controller.admin.storeorder.vo.ShoperOrderTimeDataVo;
|
||||
import co.yixiang.yshop.module.order.dal.dataobject.storeaftersales.StoreAfterSalesDO;
|
||||
import co.yixiang.yshop.module.order.dal.dataobject.storeorder.StoreOrderDO;
|
||||
import co.yixiang.yshop.module.order.dal.mysql.storeorder.StoreOrderMapper;
|
||||
import co.yixiang.yshop.module.order.dal.redis.order.AsyncCountRedisDAO;
|
||||
import co.yixiang.yshop.module.order.dal.redis.order.AsyncOrderRedisDAO;
|
||||
import co.yixiang.yshop.module.order.service.storeaftersales.AppStoreAfterSalesService;
|
||||
import co.yixiang.yshop.module.order.service.storeorder.dto.OrderTimeDataDto;
|
||||
import co.yixiang.yshop.module.product.service.storeproduct.StoreProductService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 异步订单 Service 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class AsynStoreOrderServiceImpl implements AsyncStoreOrderService {
|
||||
|
||||
@Resource
|
||||
private StoreOrderMapper storeOrderMapper;
|
||||
@Resource
|
||||
private AppStoreAfterSalesService appStoreAfterSalesService;
|
||||
@Resource
|
||||
private AsyncOrderRedisDAO asyncOrderRedisDAO;
|
||||
@Resource
|
||||
private AsyncCountRedisDAO asyncCountRedisDAO;
|
||||
@Resource
|
||||
private MemberUserService userService;
|
||||
@Resource
|
||||
private StoreProductService productService;
|
||||
|
||||
/**
|
||||
* 获取某个用户的订单统计数据
|
||||
*
|
||||
* @param uid uid>0 取用户 否则取所有
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
public void orderData(Long uid) {
|
||||
log.info("========获取某个用户的订单统计数据=========");
|
||||
//订单支付没有退款 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperOne = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperOne.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperOne.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue());
|
||||
Long orderCount = storeOrderMapper.selectCount(wrapperOne);
|
||||
|
||||
//订单支付没有退款 支付总金额
|
||||
double sumPrice = storeOrderMapper.sumPrice(uid);
|
||||
|
||||
//订单待支付 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperTwo = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperTwo.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperTwo.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_0.getValue());
|
||||
Long unpaidCount = storeOrderMapper.selectCount(wrapperTwo);
|
||||
|
||||
//订单待发货 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperThree = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperThree.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperThree.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_0.getValue());
|
||||
Long unshippedCount = storeOrderMapper.selectCount(wrapperThree);
|
||||
|
||||
//订单待收货 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperFour = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperFour.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperFour.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_1.getValue());
|
||||
Long receivedCount = storeOrderMapper.selectCount(wrapperFour);
|
||||
|
||||
//订单待评价 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperFive = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperFive.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperFive.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_2.getValue());
|
||||
Long evaluatedCount = storeOrderMapper.selectCount(wrapperFive);
|
||||
|
||||
//订单已完成 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperSix = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperSix.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperSix.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_3.getValue());
|
||||
Long completeCount = storeOrderMapper.selectCount(wrapperSix);
|
||||
|
||||
//售后退款
|
||||
Long salesCount = appStoreAfterSalesService.lambdaQuery()
|
||||
.eq(Objects.nonNull(uid), StoreAfterSalesDO::getUserId, uid)
|
||||
.count();
|
||||
|
||||
AppUserOrderCountVo appUserOrderCountVo = AppUserOrderCountVo.builder()
|
||||
.orderCount(orderCount)
|
||||
.sumPrice(sumPrice)
|
||||
.unpaidCount(unpaidCount)
|
||||
.unshippedCount(unshippedCount)
|
||||
.receivedCount(receivedCount)
|
||||
.evaluatedCount(evaluatedCount)
|
||||
.completeCount(completeCount)
|
||||
.refundCount(salesCount)
|
||||
.build();
|
||||
|
||||
//存redis
|
||||
asyncOrderRedisDAO.set(appUserOrderCountVo,uid);
|
||||
|
||||
this.getOrderTimeData();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 首页订单/用户等统计
|
||||
*
|
||||
* @return OrderTimeDataDto
|
||||
*/
|
||||
@Async
|
||||
@Override
|
||||
public void getOrderTimeData() {
|
||||
OrderTimeDataDto orderTimeDataDto = new OrderTimeDataDto();
|
||||
|
||||
ShoperOrderTimeDataVo shoperOrderTimeData = this.getShoperOrderTimeData();
|
||||
|
||||
BeanUtil.copyProperties(shoperOrderTimeData, orderTimeDataDto);
|
||||
|
||||
|
||||
orderTimeDataDto.setUserCount(userService.count());
|
||||
orderTimeDataDto.setOrderCount(storeOrderMapper.selectCount());
|
||||
orderTimeDataDto.setPriceCount(storeOrderMapper.sumTotalPrice());
|
||||
orderTimeDataDto.setGoodsCount(productService.count());
|
||||
|
||||
asyncCountRedisDAO.set(orderTimeDataDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步后台统计
|
||||
*/
|
||||
public ShoperOrderTimeDataVo getShoperOrderTimeData() {
|
||||
|
||||
Date today = DateUtil.beginOfDay(new Date());
|
||||
Date yesterday = DateUtil.beginOfDay(DateUtil.yesterday());
|
||||
Date nowMonth = DateUtil.beginOfMonth(new Date());
|
||||
Date lastWeek = DateUtil.beginOfDay(DateUtil.lastWeek());
|
||||
|
||||
ShoperOrderTimeDataVo orderTimeDataVo = new ShoperOrderTimeDataVo();
|
||||
|
||||
//今日成交额
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperOne = new LambdaQueryWrapper<>();
|
||||
wrapperOne
|
||||
.ge(StoreOrderDO::getPayTime, today)
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue());
|
||||
orderTimeDataVo.setTodayPrice(storeOrderMapper.todayPrice(wrapperOne));
|
||||
//今日订单数
|
||||
orderTimeDataVo.setTodayCount(storeOrderMapper.selectCount(wrapperOne));
|
||||
|
||||
//昨日成交额
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperTwo = new LambdaQueryWrapper<>();
|
||||
wrapperTwo
|
||||
.lt(StoreOrderDO::getPayTime, today)
|
||||
.ge(StoreOrderDO::getPayTime, yesterday)
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue());
|
||||
orderTimeDataVo.setProPrice(storeOrderMapper.todayPrice(wrapperTwo));
|
||||
//昨日订单数
|
||||
orderTimeDataVo.setProCount(storeOrderMapper.selectCount(wrapperTwo));
|
||||
|
||||
//本月成交额
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperThree = new LambdaQueryWrapper<>();
|
||||
wrapperThree
|
||||
.ge(StoreOrderDO::getPayTime, nowMonth)
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue());
|
||||
orderTimeDataVo.setMonthPrice(storeOrderMapper.todayPrice(wrapperThree));
|
||||
//本月订单数
|
||||
orderTimeDataVo.setMonthCount(storeOrderMapper.selectCount(wrapperThree));
|
||||
|
||||
//上周成交额
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperLastWeek = new LambdaQueryWrapper<>();
|
||||
wrapperLastWeek
|
||||
.lt(StoreOrderDO::getPayTime, today)
|
||||
.ge(StoreOrderDO::getPayTime, lastWeek)
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue());
|
||||
orderTimeDataVo.setLastWeekPrice(storeOrderMapper.todayPrice(wrapperLastWeek));
|
||||
//上周订单数
|
||||
orderTimeDataVo.setLastWeekCount(storeOrderMapper.selectCount(wrapperLastWeek));
|
||||
|
||||
|
||||
return orderTimeDataVo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -125,7 +125,7 @@ public class AsyncStoreOrderServiceImpl implements AsyncStoreOrderService {
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_NORMAL.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_DEFAULT.getValue());
|
||||
Long unpaidCount = storeOrderMapper.selectCount(wrapperTwo);
|
||||
AppUserOrderCountVo appUserOrderCountVo = AppUserOrderCountVo.builder()
|
||||
AppUserOrderCountVo appUserOrderCountVo = AppUserOrderCountVo.builder()
|
||||
.orderCount(orderCount)
|
||||
.sumPrice(sumPrice)
|
||||
.unpaidCount(unpaidCount)
|
||||
@ -136,7 +136,7 @@ public class AsyncStoreOrderServiceImpl implements AsyncStoreOrderService {
|
||||
.refundCount(salesCount)
|
||||
.build();
|
||||
|
||||
//先删除再存redis
|
||||
//先删除再存redis
|
||||
asyncOrderRedisDAO.delete(uid);
|
||||
asyncOrderRedisDAO.set(appUserOrderCountVo,uid);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package co.yixiang.yshop.module.order.service.storeorder.dto;
|
||||
|
||||
import co.yixiang.yshop.framework.common.serializer.BigDecimalSerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
@ -20,8 +20,6 @@ import javax.annotation.Resource;
|
||||
@Validated
|
||||
public class StoreOrderStatusServiceImpl extends ServiceImpl<StoreOrderStatusMapper, StoreOrderStatusDO> implements StoreOrderStatusService {
|
||||
|
||||
@Resource
|
||||
private StoreOrderStatusMapper storeOrderStatusMapper;
|
||||
@Resource
|
||||
private AsyncStoreOrderService asyncStoreOrderService;
|
||||
/**
|
||||
|
Reference in New Issue
Block a user