|
@@ -800,7 +800,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
public void updateOrderPaid(Long id1, Long payOrderId) {
|
|
|
|
|
|
|
|
|
- System.out.println("#########updateOrderPaid####payOrderId:"+payOrderId);
|
|
|
+// System.out.println("#########updateOrderPaid####payOrderId:"+payOrderId);
|
|
|
|
|
|
//add by Ben 根据支付订单id,查询所有 支付订单 对应的 订单
|
|
|
List<TradeOrderDO> TradeOrderDOList = tradeOrderMapper.selectList("pay_order_id", payOrderId);
|
|
@@ -809,7 +809,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
|
|
|
Long tradeOrderId = tradeOrderDO.getId();
|
|
|
|
|
|
- System.out.println("#########updateOrderPaid####tradeOrderId:"+tradeOrderId);
|
|
|
+// System.out.println("#########updateOrderPaid####tradeOrderId:"+tradeOrderId);
|
|
|
|
|
|
// 1. 校验并获得交易订单(可支付)
|
|
|
KeyValue<TradeOrderDO, PayOrderRespDTO> orderResult = validateOrderPayable(tradeOrderId, payOrderId);
|
|
@@ -822,7 +822,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
new TradeOrderDO().setStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus()).setPayStatus(true)
|
|
|
.setPayTime(LocalDateTime.now()).setPayChannelCode(payOrder.getChannelCode()));
|
|
|
|
|
|
- System.out.println("#########updateOrderPaid####updateCount:"+updateCount);
|
|
|
+// System.out.println("#########updateOrderPaid####updateCount:"+updateCount);
|
|
|
|
|
|
if (updateCount == 0) {
|
|
|
throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID);
|
|
@@ -1084,6 +1084,11 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
return order;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 用户手动取消订单
|
|
|
+ * @param userId 用户编号
|
|
|
+ * @param id 订单编号
|
|
|
+ */
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@TradeOrderLog(operateType = TradeOrderOperateTypeEnum.MEMBER_CANCEL)
|
|
@@ -1100,8 +1105,21 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
|
|
|
// 2. 取消订单
|
|
|
cancelOrder0(order, TradeOrderCancelTypeEnum.MEMBER_CANCEL);
|
|
|
+
|
|
|
+ //3.退回订单已支付的积分 add by Ben
|
|
|
+ Integer payIntegral = order.getPayIntegral();//每个订单使用的积分
|
|
|
+ Long tradeOrderId = order.getId();
|
|
|
+ String orderNum = order.getNo();
|
|
|
+ //如果订单有使用积分,则退回积分
|
|
|
+ if(payIntegral>0) {
|
|
|
+ integralService.updateUserIntegral(userId, CaclEnum.ORDER_CANCEL_BY_USER_REFUND_INTEGRAL, payIntegral, 0, tradeOrderId, orderNum);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 订单超时未支付,自动取消
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public int cancelOrderBySystem() {
|
|
|
// 1. 查询过期的待支付订单
|
|
@@ -1117,6 +1135,17 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
for (TradeOrderDO order : orders) {
|
|
|
try {
|
|
|
getSelf().cancelOrderBySystem(order);
|
|
|
+
|
|
|
+ //退回订单已支付的积分 add by Ben
|
|
|
+ Integer payIntegral = order.getPayIntegral();//每个订单使用的积分
|
|
|
+ Long tradeOrderId = order.getId();
|
|
|
+ String orderNum = order.getNo();
|
|
|
+ Long userId = order.getUserId();
|
|
|
+ //如果订单有使用积分,则退回积分
|
|
|
+ if(payIntegral>0) {
|
|
|
+ integralService.updateUserIntegral(userId, CaclEnum.ORDER_CANCEL_BY_SYSTEM_REFUND_INTEGRAL, payIntegral, 0, tradeOrderId, orderNum);
|
|
|
+ }
|
|
|
+
|
|
|
count++;
|
|
|
} catch (Throwable e) {
|
|
|
log.error("[cancelOrderBySystem][order({}) 过期订单异常]", order.getId(), e);
|