提交代码

dev-discount
胡锐 2 years ago
parent 9fa70087cd
commit 6ae301399f
  1. 14
      hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java
  2. 2
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  3. 2
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

@ -10,6 +10,7 @@ import com.hai.entity.*;
import com.hai.order.service.OrderPaySuccessService; import com.hai.order.service.OrderPaySuccessService;
import com.hai.order.service.OrderService; import com.hai.order.service.OrderService;
import com.hai.order.type.OrderPayType; import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderStatus;
import com.hai.service.pay.NotifyService; import com.hai.service.pay.NotifyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -65,10 +66,16 @@ public class OrderPayNotifyController {
// 处理业务 // 处理业务
log.info("开始处理业务"); log.info("开始处理业务");
// 查询交易订单
HighOrder order = orderService.getOrderDetailByNo(map.get("out_trade_no"));
if (order != null && order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) {
// 处理订单业务
paySuccessService.orderPaySuccessHandle(map.get("out_trade_no"), paySuccessService.orderPaySuccessHandle(map.get("out_trade_no"),
OrderPayType.PAY_TYPE2, map.get("out_trade_no"), OrderPayType.PAY_TYPE2, map.get("out_trade_no"),
new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100")), new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100")),
null); null);
}
log.info("处理业务完成"); log.info("处理业务完成");
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
@ -96,16 +103,15 @@ public class OrderPayNotifyController {
// 查询订单信息 // 查询订单信息
HighOrder order = orderService.getOrderDetailByNo(body.getString("tradetrace")); HighOrder order = orderService.getOrderDetailByNo(body.getString("tradetrace"));
if (order == null) { if (order != null && order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
log.info("开始处理业务"); log.info("开始处理业务");
// 异步处理业务 // 处理订单业务
paySuccessService.orderPaySuccessHandle(order.getOrderNo(), paySuccessService.orderPaySuccessHandle(order.getOrderNo(),
OrderPayType.PAY_TYPE5, OrderPayType.PAY_TYPE5,
body.getString("wtorderid"), body.getString("wtorderid"),
order.getPayPrice(), order.getPayPrice(),
null); null);
}
log.info("处理业务完成"); log.info("处理业务完成");
} }
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());

@ -96,7 +96,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard) { public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard) {
HighOrder order = orderService.getOrderDetailByNo(orderNo); HighOrder order = orderService.getOrderDetailByNo(orderNo);
try { try {
if (order != null && order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { if (order != null) {
order.setPaySerialNo(paySerialNo); order.setPaySerialNo(paySerialNo);
order.setPayRealPrice(payRealPrice); order.setPayRealPrice(payRealPrice);
order.setPayTime(new Date()); order.setPayTime(new Date());

@ -431,7 +431,7 @@ public class OrderServiceImpl implements OrderService {
rocketMQTemplate.syncSend(OrderTopic.ORDER_TOPIC_CANCEL.getTopic(), rocketMsg,1000,14); rocketMQTemplate.syncSend(OrderTopic.ORDER_TOPIC_CANCEL.getTopic(), rocketMsg,1000,14);
} else if (orderData.getOrderStatus().equals(OrderStatus.STATUS2.getNumber())) { } else if (orderData.getOrderStatus().equals(OrderStatus.STATUS2.getNumber())) {
// 异步处理业务 // 处理业务
return paySuccessService.orderPaySuccessHandle(orderData.getOrderNo(), OrderPayType.PAY_TYPE3, null, new BigDecimal("0"), null); return paySuccessService.orderPaySuccessHandle(orderData.getOrderNo(), OrderPayType.PAY_TYPE3, null, new BigDecimal("0"), null);
} }
return orderData; return orderData;

Loading…
Cancel
Save