Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

master
袁野 8 months ago
commit ec679f98c9
  1. 15
      hai-order/src/main/java/com/web/controller/OrderController.java
  2. 2
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  3. 2
      hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java
  4. 10
      hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java
  5. 1
      hai-service/src/main/java/com/hai/order/type/OrderPayType.java
  6. 25
      hai-service/src/main/java/com/hai/pay/channel/huift/TradeService.java

@ -416,21 +416,6 @@ public class OrderController {
} }
} }
@RequestMapping(value = "/getOrderDetail", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询订单详情")
public ResponseData getOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) {
try {
return ResponseMsgUtil.success(orderService.getOrderDetailByNo(orderNo));
} catch (Exception e) {
log.error("HighOrderController --> getOrderDetail() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getPopularizeUserOrderList",method = RequestMethod.GET) @RequestMapping(value="/getPopularizeUserOrderList",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "获取推广用户订单列表") @ApiOperation(value = "获取推广用户订单列表")

@ -103,7 +103,7 @@ public class OrderPayController {
@Resource @Resource
private OrderPayBeforeService orderPayBeforeService; private OrderPayBeforeService orderPayBeforeService;
@Resource
private TradeService huiftTradeService; private TradeService huiftTradeService;
@Resource @Resource

@ -150,7 +150,7 @@ public class OrderPayNotifyController {
log.info("开始处理业务"); log.info("开始处理业务");
// 处理订单业务 // 处理订单业务
paySuccessService.orderPaySuccessHandle(order.getOrderNo(), paySuccessService.orderPaySuccessHandle(order.getOrderNo(),
OrderPayType.PAY_TYPE2, OrderPayType.PAY_TYPE10,
body.getString("orderNo"), body.getString("orderNo"),
order.getPayPrice(), order.getPayPrice(),
null,null); null,null);

@ -17,6 +17,7 @@ import com.hai.order.service.OrderRefundService;
import com.hai.order.service.OrderService; import com.hai.order.service.OrderService;
import com.hai.order.type.*; import com.hai.order.type.*;
import com.hai.order.utils.OrderUtil; import com.hai.order.utils.OrderUtil;
import com.hai.pay.channel.huift.TradeService;
import com.hai.pay.channel.huipay.config.HuiConfig; import com.hai.pay.channel.huipay.config.HuiConfig;
import com.hai.service.HighFleetOilCardService; import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighOilCardService; import com.hai.service.HighOilCardService;
@ -57,7 +58,8 @@ public class OrderRefundServiceImpl implements OrderRefundService {
@Resource @Resource
private ApiOrderService apiOrderService; private ApiOrderService apiOrderService;
@Resource
private TradeService huiftTradeService;
@Resource @Resource
private HuiConfig huiConfig; private HuiConfig huiConfig;
@ -253,6 +255,12 @@ public class OrderRefundServiceImpl implements OrderRefundService {
// 商户退款 // 商户退款
apiOrderService.refund(order.getOrderNo()); apiOrderService.refund(order.getOrderNo());
refundPriceModel.setRefundSuccess(true); refundPriceModel.setRefundSuccess(true);
} else if (orderPayType.getNumber().equals(OrderPayType.PAY_TYPE10.getNumber())) {
// 商户退款
JSONObject refundObj = huiftTradeService.thirdPayRefund(refundOrderNo, refundPrice, order.getOrderNo());
refundPriceModel.setThirdPartyRefundOrderNo(refundObj.getString("refundOrderNo"));
refundPriceModel.setRefundSuccess(true);
} }
} catch (Exception e) { } catch (Exception e) {

@ -18,6 +18,7 @@ public enum OrderPayType {
PAY_TYPE7(7, "嗨森逛个人油卡"), PAY_TYPE7(7, "嗨森逛个人油卡"),
PAY_TYPE8(8, "嗨森逛车队油卡"), PAY_TYPE8(8, "嗨森逛车队油卡"),
PAY_TYPE9(9, "API商户金额"), PAY_TYPE9(9, "API商户金额"),
PAY_TYPE10(10, "快捷支付"),
; ;
private Integer number; private Integer number;

@ -8,6 +8,8 @@ import com.hai.common.utils.HttpsUtils;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderRefund; import com.hai.entity.HighOrderRefund;
import com.hai.enum_type.OrderStatusEnum;
import com.hai.order.type.OrderPayType;
import com.hai.pay.channel.huift.config.HuiftConfig; import com.hai.pay.channel.huift.config.HuiftConfig;
import com.hai.service.HighOrderService; import com.hai.service.HighOrderService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -72,19 +74,32 @@ public class TradeService {
/** /**
* 交易退款 * 交易退款
* @param orderRefund * @param refundOrderNo 退款订单号
* @param refundPrice 退款金额
* @param orderNo 订单号
* @return * @return
* @throws Exception * @throws Exception
*/ */
public JSONObject thirdPayRefund(HighOrderRefund orderRefund) throws Exception { public JSONObject thirdPayRefund(String refundOrderNo, BigDecimal refundPrice, String orderNo) throws Exception {
// 查询订单 // 查询订单
HighOrder order = orderService.getOrderById(orderRefund.getId()); HighOrder order = orderService.getOrderByOrderNo(orderNo);
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的的订单");
}
if (!order.getOrderStatus().equals(OrderStatusEnum.type2.getType())
&& !order.getOrderStatus().equals(OrderStatusEnum.type3.getType())
&& !order.getOrderStatus().equals(OrderStatusEnum.type7.getType())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单当前状态无法退款");
}
if (!order.getPayType().equals(OrderPayType.PAY_TYPE10.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付方式错误");
}
Map<String,Object> param = new HashMap<>(); Map<String,Object> param = new HashMap<>();
param.put("shopCode", HuiftConfig.shopcode); param.put("shopCode", HuiftConfig.shopcode);
param.put("preOrderNo", order.getPayChannelOrderNo()); param.put("preOrderNo", order.getPayChannelOrderNo());
param.put("outRefundNo", orderRefund.getRefundOrderNo()); param.put("outRefundNo", refundOrderNo);
param.put("refundAmt", orderRefund.getRefundPrice().multiply(new BigDecimal("100")).intValue()); param.put("refundAmt", refundPrice.multiply(new BigDecimal("100")).intValue());
param.put("sign", HuiftConfig.md5Encode(HuiftConfig.paramSort(param, HuiftConfig.signSecret).getBytes()).toLowerCase()); param.put("sign", HuiftConfig.md5Encode(HuiftConfig.paramSort(param, HuiftConfig.signSecret).getBytes()).toLowerCase());
JSONObject response = HttpsUtils.doPost(HuiftConfig.reqUrl + "/hfq/v1/thirdPay/thirdPayRefund", JSONObject.toJSONString(param)); JSONObject response = HttpsUtils.doPost(HuiftConfig.reqUrl + "/hfq/v1/thirdPay/thirdPayRefund", JSONObject.toJSONString(param));
if (response.getString("status").equals("ok")) { if (response.getString("status").equals("ok")) {

Loading…
Cancel
Save