diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/NotifyController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/NotifyController.java index 3ad44f8..67a425e 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/NotifyController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/NotifyController.java @@ -100,6 +100,9 @@ public class NotifyController { String orderNo=object.get("mchOrderNo").toString(); String tradeNo=object.get("payOrderId").toString(); return payService.callBackPayFST(tradeNo); + }else { + String tradeNo=object.get("payOrderId").toString(); + return String.valueOf(payService.activateOrder(tradeNo)); } } } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java index 9408aaf..69e87e4 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java @@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.entity.*; import com.chaozhanggui.system.cashierservice.entity.dto.ReturnGroupOrderDto; @@ -13,6 +14,7 @@ import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO; import com.chaozhanggui.system.cashierservice.entity.vo.ShopUserListVo; import com.chaozhanggui.system.cashierservice.exception.MsgException; import com.chaozhanggui.system.cashierservice.mapper.MpOrderDetailMapper; +import com.chaozhanggui.system.cashierservice.mapper.MpOrderInfoMapper; import com.chaozhanggui.system.cashierservice.model.PayReq; import com.chaozhanggui.system.cashierservice.model.TradeQueryReq; import com.chaozhanggui.system.cashierservice.netty.PushToClientChannelHandlerAdapter; @@ -169,6 +171,8 @@ public class PayService { private ShopUtils shopUtils; @Autowired private MpOrderDetailMapper mpOrderDetailMapper; + @Autowired + private MpOrderInfoMapper mpOrderInfoMapper; public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) { this.shopSongOrderService = shopSongOrderService; @@ -1471,6 +1475,19 @@ public class PayService { } + /** + * 重新激活支付中的订单 + * + * @param tradeNo + * @return + */ + public int activateOrder(String tradeNo) { + return mpOrderInfoMapper.update(null, new LambdaUpdateWrapper() + .eq(TbOrderInfo::getOrderNo, tradeNo) + .eq(TbOrderInfo::getStatus, "paying") + .set(TbOrderInfo::getStatus, "unpaid")); + } + // public Result returnOrder(){ //