额外参数
This commit is contained in:
@@ -11,6 +11,7 @@ import com.czg.market.service.MkShopConsumeDiscountRecordService;
|
||||
import com.czg.market.service.OrderInfoService;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.order.enums.PaymentPayTypeEnum;
|
||||
import com.czg.order.service.OrderInfoCustomService;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.service.market.service.impl.AppWxServiceImpl;
|
||||
@@ -28,6 +29,7 @@ import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 回调
|
||||
*
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@@ -78,7 +80,7 @@ public class NotifyController {
|
||||
String failReason = jsonObject.getString("fail_reason");
|
||||
try {
|
||||
distributionUserService.withdrawNotify(outBillNo, state, failReason);
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
log.warn("转账回调失败", e);
|
||||
}
|
||||
return SUCCESS;
|
||||
@@ -106,15 +108,15 @@ public class NotifyController {
|
||||
String tradeState = plainTextJson.getString("trade_state");
|
||||
String transactionId = plainTextJson.getString("transaction_id");
|
||||
OrderPayment payment = paymentService.getOne(new QueryWrapper().eq(OrderPayment::getOrderNo, outTradeNo));
|
||||
payment.setPayStatus("fail");
|
||||
payment.setPayStatus(PaymentPayTypeEnum.PayStatus.FAIL);
|
||||
if ("SUCCESS".equals(tradeState)) {
|
||||
try {
|
||||
payment.setTradeNumber(transactionId);
|
||||
payment.setPayTime(DateUtil.date().toLocalDateTime());
|
||||
payment.setRespJson(plainTextJson.toJSONString());
|
||||
payment.setPayStatus("success");
|
||||
payment.setPayStatus(PaymentPayTypeEnum.PayStatus.SUCCESS);
|
||||
distributionUserService.rechargeCallBack(payment.getShopId(), payment.getAmount(), payment.getId());
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
log.error("充值回调失败", e);
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.czg.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.czg.enums.OrderNoPrefixEnum;
|
||||
import com.czg.market.service.OrderInfoService;
|
||||
import com.czg.order.entity.CashierCart;
|
||||
@@ -20,7 +19,9 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 订单定时任务
|
||||
@@ -59,18 +60,30 @@ public class OTimeTask {
|
||||
cartService.remove(cartUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单 过期 退钱
|
||||
*/
|
||||
public void gbOrderExpire() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 退钱补偿
|
||||
* 积分 和 拼团
|
||||
*/
|
||||
@Scheduled(cron = "0 50 23 * * ? ")
|
||||
public void refundCompensate() {
|
||||
//积分 和 拼团
|
||||
List<String> ware = List.of(PaymentPayTypeEnum.SourceType.WARE, PaymentPayTypeEnum.SourceType.POINT);
|
||||
|
||||
LocalDateTime tenMinutesAgo = LocalDateTime.now().minusMinutes(10);
|
||||
LocalDateTime thirdDayAgo = LocalDateTime.now().minusDays(3);
|
||||
List<OrderPayment> list = orderPaymentService.list(QueryWrapper.create()
|
||||
.gt(OrderPayment::getUpdateTime, thirdDayAgo)
|
||||
.lt(OrderPayment::getUpdateTime, tenMinutesAgo)
|
||||
.eq(OrderPayment::getPayType, PaymentPayTypeEnum.REFUND.getValue())
|
||||
.ne(OrderPayment::getPayStatus, "success"));
|
||||
.in(OrderPayment::getSourceType, ware)
|
||||
.eq(OrderPayment::getPayType, PaymentPayTypeEnum.PayType.REFUND)
|
||||
.ne(OrderPayment::getPayStatus, PaymentPayTypeEnum.PayStatus.SUCCESS));
|
||||
for (OrderPayment payment : list) {
|
||||
String refPayOrderNo = CzgRandomUtils.snowflake(OrderNoPrefixEnum.REP);
|
||||
payService.unifyRefund(payment, refPayOrderNo);
|
||||
|
||||
Reference in New Issue
Block a user