|
@@ -108,8 +108,10 @@ import com.fs.huifuPay.domain.HuifuCreateOrderResult;
|
|
|
import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
|
|
import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
|
|
|
import com.fs.huifuPay.sdk.opps.core.utils.HuiFuUtils;
|
|
import com.fs.huifuPay.sdk.opps.core.utils.HuiFuUtils;
|
|
|
import com.fs.huifuPay.service.HuiFuService;
|
|
import com.fs.huifuPay.service.HuiFuService;
|
|
|
|
|
+import com.fs.live.domain.LiveCouponUser;
|
|
|
import com.fs.live.domain.LiveOrder;
|
|
import com.fs.live.domain.LiveOrder;
|
|
|
import com.fs.live.mapper.LiveOrderMapper;
|
|
import com.fs.live.mapper.LiveOrderMapper;
|
|
|
|
|
+import com.fs.live.service.ILiveCouponUserService;
|
|
|
import com.fs.pay.pay.dto.OrderQueryDTO;
|
|
import com.fs.pay.pay.dto.OrderQueryDTO;
|
|
|
import com.fs.pay.pay.dto.RefundDTO;
|
|
import com.fs.pay.pay.dto.RefundDTO;
|
|
|
import com.fs.pay.service.IPayService;
|
|
import com.fs.pay.service.IPayService;
|
|
@@ -337,6 +339,8 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsStoreCouponUserScrmService couponUserService;
|
|
private IFsStoreCouponUserScrmService couponUserService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ private ILiveCouponUserService liveCouponUserService;
|
|
|
|
|
+ @Autowired
|
|
|
private ICompanyService companyService;
|
|
private ICompanyService companyService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsStoreOrderItemScrmService storeOrderItemService;
|
|
private IFsStoreOrderItemScrmService storeOrderItemService;
|
|
@@ -2145,14 +2149,36 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void refundOrderCoupon(FsStoreOrderScrm order) {
|
|
|
|
|
+ refundCoupon(order);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void refundCoupon(FsStoreOrderScrm order) {
|
|
private void refundCoupon(FsStoreOrderScrm order) {
|
|
|
- if (order.getCouponId() != null) {
|
|
|
|
|
- FsStoreCouponUserScrm couponUser = couponUserService.selectFsStoreCouponUserById(order.getCouponId());
|
|
|
|
|
- if (couponUser != null) {
|
|
|
|
|
- couponUser.setStatus(0);
|
|
|
|
|
- couponUser.setUseTime(null);
|
|
|
|
|
- couponUserService.updateFsStoreCouponUser(couponUser);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (order == null || order.getCouponId() == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 直播订单(orderType=2)couponId 存的是 live_coupon_user.id
|
|
|
|
|
+ if (order.getOrderType() != null && order.getOrderType() == 2) {
|
|
|
|
|
+ refundLiveCoupon(order.getCouponId());
|
|
|
|
|
+ }
|
|
|
|
|
+// FsStoreCouponUserScrm couponUser = couponUserService.selectFsStoreCouponUserById(order.getCouponId());
|
|
|
|
|
+// if (couponUser != null) {
|
|
|
|
|
+// couponUser.setStatus(0);
|
|
|
|
|
+// couponUser.setUseTime(null);
|
|
|
|
|
+// couponUserService.updateFsStoreCouponUser(couponUser);
|
|
|
|
|
+// }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 直播优惠券回退(与 LiveOrderServiceImpl#refundCoupon 一致)
|
|
|
|
|
+ */
|
|
|
|
|
+ private void refundLiveCoupon(Long couponUserId) {
|
|
|
|
|
+ LiveCouponUser couponUser = liveCouponUserService.selectLiveCouponUserById(couponUserId);
|
|
|
|
|
+ if (couponUser != null) {
|
|
|
|
|
+ couponUser.setStatus(0);
|
|
|
|
|
+ couponUser.setUseTime(null);
|
|
|
|
|
+ liveCouponUserService.updateLiveCouponUser(couponUser);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3658,6 +3684,8 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
if (order.getTuiUserId() != null && order.getTuiUserId() > 0) {
|
|
if (order.getTuiUserId() != null && order.getTuiUserId() > 0) {
|
|
|
userService.subTuiMoney(order);
|
|
userService.subTuiMoney(order);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 优惠券返回(含直播券)
|
|
|
|
|
+ this.refundCoupon(order);
|
|
|
// 卓美财务要求,如果退款就必须生成售后订单
|
|
// 卓美财务要求,如果退款就必须生成售后订单
|
|
|
// 检查配置,如果delete_after_sales为true,创建退款成功的售后订单
|
|
// 检查配置,如果delete_after_sales为true,创建退款成功的售后订单
|
|
|
String deleteAfterSalesConfig = configService.selectConfigByKey("delete_after_sales");
|
|
String deleteAfterSalesConfig = configService.selectConfigByKey("delete_after_sales");
|