| | |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.mall.mapper.MallMoneyFlowMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | |
| | | private MallOrderInfoMapper mallOrderInfoMapper; |
| | | @Resource |
| | | private MallMoneyFlowMapper mallMoneyFlowMapper; |
| | | @Resource |
| | | private IApiMallMemberWalletService memberWalletService; |
| | | |
| | | @PostMapping("/payment/callback") |
| | | public String handlePaymentCallback( |
| | |
| | | |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOne(new LambdaQueryWrapper<MallMoneyFlow>().eq(MallMoneyFlow::getOrderNo, orderId)); |
| | | if (mallMoneyFlow != null) { |
| | | // 更新订单状态为已支付 |
| | | mallMoneyFlow.setStatus(2); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | if(1 == mallMoneyFlow.getStatus()){ |
| | | memberWalletService.addBalance(mallMoneyFlow.getAmount(),mallMoneyFlow.getMemberId()); |
| | | // 更新订单状态为已支付 |
| | | mallMoneyFlow.setStatus(2); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | } |
| | | }else{ |
| | | MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectById(Long.parseLong(orderId)); |
| | | if(mallOrderInfo != null){ |
| | | if("1" == mallOrderInfo.getPayResult()){ |
| | | return "payment-success"; |
| | | } |
| | | updateOrderStatus(orderId, status, amount, payDate, tranId); |
| | | } |
| | | } |
| | | MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectById(Long.parseLong(orderId)); |
| | | if(mallOrderInfo != null){ |
| | | updateOrderStatus(orderId, status, amount, payDate, tranId); |
| | | } |
| | | // 跳转到支付成功页面 |
| | | return "payment-success"; |
| | | } |
| | | |