提交代码

dev-discount
胡锐 2 years ago
parent 931cc698f4
commit 4211df4a3b
  1. 21
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  2. 21
      hai-service/src/main/java/com/hai/order/service/OrderPayBeforeService.java
  3. 2
      hai-service/src/main/java/com/hai/order/service/OrderPayService.java
  4. 81
      hai-service/src/main/java/com/hai/order/service/impl/OrderPayBeforeServiceImpl.java
  5. 9
      hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java
  6. 2
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  7. 5
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

@ -10,7 +10,6 @@ import com.hai.common.pay.util.MD5Util;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst;
import com.hai.config.UnionPayConfig;
import com.hai.config.WxOrderConfig;
import com.hai.entity.*;
@ -21,8 +20,9 @@ import com.hai.enum_type.UserCardType;
import com.hai.model.HighMerchantStoreModel;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.order.service.OrderPayBeforeService;
import com.hai.order.service.OrderService;
import com.hai.order.service.impl.OrderPayService;
import com.hai.order.service.OrderPayService;
import com.hai.order.type.OrderProductType;
import com.hai.order.type.OrderStatus;
import com.hai.service.*;
@ -92,6 +92,9 @@ public class OrderPayController {
@Resource
private WechatPayUtil wechatPayUtil;
@Resource
private OrderPayBeforeService orderPayBeforeService;
@RequestMapping(value="/wechatPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "微信支付")
@ -288,6 +291,9 @@ public class OrderPayController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, "");
}
// 支付业务交易
orderPayBeforeService.payOrderCheck(order);
if (userCard.getType().equals(UserCardType.type1.getType())) {
return ResponseMsgUtil.success(orderPayService.hltCardPay(order, userCard));
@ -306,7 +312,7 @@ public class OrderPayController {
return ResponseMsgUtil.exception(e);
}
}
/*
@RequestMapping(value="/oilCardPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "嗨森逛油卡支付")
@ -361,9 +367,9 @@ public class OrderPayController {
log.error("OrderPayController -> oilCardPay() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}*/
@RequestMapping(value="/hltCardPay",method = RequestMethod.POST)
/* @RequestMapping(value="/hltCardPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "贵州汇联通工会卡支付")
public ResponseData hltCardPay(@RequestBody JSONObject body) {
@ -418,7 +424,7 @@ public class OrderPayController {
log.error("OrderController -> hltCardPay() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}*/
@RequestMapping(value="/unionPay",method = RequestMethod.POST)
@ResponseBody
@ -440,6 +446,9 @@ public class OrderPayController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, "");
}
// 支付前业务校验
orderPayBeforeService.payOrderCheck(order);
return ResponseMsgUtil.success(unionPayConfig.upPreOrder(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, order.getOrderNo(), order.getPayPrice(), "购买商品", SysConst.getSysConfig().getUnionPayNotifyUrl(), request));
} catch (Exception e) {

@ -0,0 +1,21 @@
package com.hai.order.service;
import com.hai.entity.HighOrder;
/**
* @className: OrderPayBeforeService
* @author: HuRui
* @date: 2023/1/11
**/
public interface OrderPayBeforeService {
/**
* 支付订单前置校验校验
* @param order
* @return
*/
void payOrderCheck(HighOrder order);
}

@ -1,4 +1,4 @@
package com.hai.order.service.impl;
package com.hai.order.service;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUserCard;

@ -0,0 +1,81 @@
package com.hai.order.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.config.WxOrderConfig;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasChannelConfig;
import com.hai.entity.HighMerchantTripartitePlatform;
import com.hai.entity.HighOrder;
import com.hai.enum_type.GasChannel;
import com.hai.enum_type.GasChannelPayPlatformType;
import com.hai.enum_type.MerchantStoreSourceType;
import com.hai.model.HighMerchantStoreModel;
import com.hai.order.service.OrderPayBeforeService;
import com.hai.order.type.OrderProductType;
import com.hai.service.HighGasChannelConfigService;
import com.hai.service.HighGasService;
import com.hai.service.HighMerchantStoreService;
import org.springframework.stereotype.Service;
/**
* @className: payOrderCheckImpl
* @author: HuRui
* @date: 2023/1/11
**/
@Service("orderPayBeforeService")
public class OrderPayBeforeServiceImpl implements OrderPayBeforeService {
private HighMerchantStoreService merchantStoreService;
private HighGasService gasService;
private HighGasChannelConfigService gasChannelConfigService;
@Override
public void payOrderCheck(HighOrder order) {
if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) {
// 查询油站
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId());
if (store == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油站");
}
if (order.getTotalPrice().compareTo(gasService.getMerPriceByMerId(store.getMerchantId())) == 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服");
}
if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) {
// 查询支付配置
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1, GasChannelPayPlatformType.type1 );
if (gasChannelConfig == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!");
}
} else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) {
// 查询支付配置
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2,GasChannelPayPlatformType.type1 );
if (gasChannelConfig == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!");
}
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) {
// 查询支付配置
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3,GasChannelPayPlatformType.type1 );
if (gasChannelConfig == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!");
}
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) {
// 查询支付配置
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4,GasChannelPayPlatformType.type1 );
if (gasChannelConfig == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!");
}
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!");
}
}
}
}

@ -1,30 +1,23 @@
package com.hai.order.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.TuanYouConfig;
import com.hai.entity.*;
import com.hai.enum_type.OilCardRecordSourceTypeEnum;
import com.hai.enum_type.OrderPayTypeEnum;
import com.hai.enum_type.OrderPushType;
import com.hai.order.service.OrderPayService;
import com.hai.order.service.OrderPaySuccessService;
import com.hai.order.service.OrderService;
import com.hai.order.type.OrderChildStatus;
import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderProductType;
import com.hai.order.type.OrderStatus;
import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighOilCardService;
import com.hai.service.HighUserCardService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@ -138,6 +138,8 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
// 处理订单产品业务
orderBusHandle(order);
// 推送消息
pushUserMsg(order.getId() , "支付成功");
}

@ -74,6 +74,8 @@ public class OrderServiceImpl implements OrderService {
@Resource
private OrderCancelHandleService orderCancelHandleService;
@Resource
private OrderPayBeforeService orderPayBeforeService;
@Resource
private OrderPaySuccessService paySuccessService;
@ -412,13 +414,14 @@ public class OrderServiceImpl implements OrderService {
// 订单入库
HighOrder orderData = insertOrderData(order);
if (orderData.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) {
// 10分钟内未支付,自动取消订单
Message<HighOrder> rocketMsg = MessageBuilder.withPayload(order).build();
rocketMQTemplate.syncSend(OrderTopic.ORDER_TOPIC_CANCEL.getTopic(), rocketMsg,1000,14);
} else if (orderData.getOrderStatus().equals(OrderStatus.STATUS2.getNumber())) {
// 支付校验
orderPayBeforeService.payOrderCheck(orderData);
// 处理业务
return paySuccessService.orderPaySuccessHandle(orderData.getOrderNo(), OrderPayType.PAY_TYPE3, null, new BigDecimal("0"), null);
}

Loading…
Cancel
Save