|
@@ -2,6 +2,7 @@ package com.citu.module.menduner.system.service.order;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.citu.framework.common.pojo.PageResult;
|
|
|
import com.citu.module.menduner.common.util.LoginUserContext;
|
|
|
import com.citu.module.menduner.system.controller.app.jobhunt.order.vo.AppTradeOrderPageReqVO;
|
|
@@ -152,6 +153,31 @@ public class TradeOrderServiceImpl implements TradeOrderService {
|
|
|
orderProducer.send(order);
|
|
|
|
|
|
}
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void manualUpdateOrderPaid(Long id, Long payOrderId) {
|
|
|
+ // 校验并获得支付订单(可支付)
|
|
|
+ PayOrderRespDTO payOrder = validateOrderCanPaid(id, payOrderId);
|
|
|
+
|
|
|
+ // 更新 PayOrderDO 状态为已支付
|
|
|
+ int updateCount = tradeOrderMapper.updateByIdAndPayed(id, false,
|
|
|
+ new TradeOrderDO().setPayStatus(true).setPayTime(LocalDateTime.now())
|
|
|
+ // 支付成功就完成
|
|
|
+ .setStatus(TradeOrderStatusEnum.COMPLETED.getStatus())
|
|
|
+ // null的目的是解决订单超时后,pay服务才同步状态回到订单
|
|
|
+ .setCancelType(null)
|
|
|
+ .setCancelTime(null)
|
|
|
+ .setPayChannelCode(payOrder.getChannelCode()));
|
|
|
+ if (updateCount == 0) {
|
|
|
+ throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID);
|
|
|
+ }
|
|
|
+ //设置金额为0
|
|
|
+ tradeOrderMapper.update(null,new LambdaUpdateWrapper<TradeOrderDO>().eq(TradeOrderDO::getId,id).set(TradeOrderDO::getPrice,0));
|
|
|
+ payOrderApi.updatePayOrderPrice(payOrderId,0);
|
|
|
+ //发送mq做业务逻辑处理
|
|
|
+ TradeOrderDO order = tradeOrderMapper.selectById(id);
|
|
|
+ orderProducer.send(order);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 校验交易订单满足被支付的条件
|