|
@@ -19,9 +19,7 @@ import com.kxs.common.mq.handlers.IMQSender;
|
|
|
import com.kxs.common.pay.enums.PayPlatformEnum;
|
|
|
import com.kxs.common.pay.enums.PayStatusCommEnum;
|
|
|
import com.kxs.common.pay.factory.PaymentFactory;
|
|
|
-import com.kxs.common.pay.model.PayRequest;
|
|
|
-import com.kxs.common.pay.model.QueryRequest;
|
|
|
-import com.kxs.common.pay.model.QueryResponse;
|
|
|
+import com.kxs.common.pay.model.*;
|
|
|
import com.kxs.common.security.util.SecurityUtils;
|
|
|
import com.kxs.lhb.basic.api.amqp.RabbitOrderTimeoutQueueMQ;
|
|
|
import com.kxs.lhb.basic.api.constant.enums.NotifyStatusEnum;
|
|
@@ -332,8 +330,9 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
throw new GlobalCustomerException("订单正在取消中");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- order.setStatus(OrderStatusEnum.CANCEL.getCode());
|
|
|
+ if(order.getServerFee().compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ order.setStatus(OrderStatusEnum.CANCEL.getCode());
|
|
|
+ }
|
|
|
order.setRemark(param.getRemark());
|
|
|
order.updateById();
|
|
|
|
|
@@ -343,10 +342,32 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.applyPerson(SecurityUtils.getUser().getName()).build();
|
|
|
channelFactory.getChannel(order.getIfCode()).orderCancel(req);
|
|
|
|
|
|
+
|
|
|
sendToOrder(order, NotifyStatusEnum.CANCEL);
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean refundFee(LhbOrder param) {
|
|
|
+
|
|
|
+ LhbOrder order = getById(param.getId());
|
|
|
+ if(order == null){
|
|
|
+ throw new GlobalCustomerException("订单不存在");
|
|
|
+ }
|
|
|
+ RefundRequest req = RefundRequest.builder().refundReason(param.getRemark())
|
|
|
+ .outTradeNo(order.getOrderSn())
|
|
|
+ .refundFee(param.getRefundPrice().doubleValue())
|
|
|
+ .totalFee(order.getServerFee().doubleValue())
|
|
|
+ .outRefundNo(CommonConstants.REFUND_ORDER_PREFIX + IdUtil.getSnowflakeNextIdStr())
|
|
|
+ .payTypeEnum(PayPlatformEnum.WX).build();
|
|
|
+ RefundResponse refund = paymentFactory.getPayService(PayPlatformEnum.WX.getType()).refund(req);
|
|
|
+ order.setRefundTradeNo(refund.getTradeNo());
|
|
|
+ order.setRefundPrice(param.getRefundPrice());
|
|
|
+ order.setStatus(OrderStatusEnum.REFUND.getCode());
|
|
|
+ log.info("订单{}退款成功", order.getOrderSn());
|
|
|
+ return order.updateById();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Async
|
|
|
public void orderStatusTask() {
|
|
@@ -406,6 +427,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 构建推送消息
|
|
|
*
|