From 26b1496ac38c09e4fb468c0c194c5509634187cd Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 30 Apr 2024 09:30:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cweb/controller/HighTestController.java | 2 +- .../com/cweb/controller/QzOrderController.java | 17 +++++++++++++---- .../impl/OrderPaySuccessServiceImpl.java | 18 +++++++++++++++++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java index 64289b57..c81d5622 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java @@ -1 +1 @@ -package com.cweb.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.Base64Util; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.enum_type.LoginPlatform; import com.hai.enum_type.MerchantStoreSourceType; import com.hai.model.*; import com.hai.pay.channel.huift.TradeService; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.bouncycastle.util.encoders.UrlBase64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import sun.nio.cs.StreamEncoder; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private PayloService payloService; @Resource private HighGasService gasService; @Resource private HighUserService userService; @Resource private HighOrderService orderService; @Resource private HighMerchantStoreService merchantStoreService; @RequestMapping(value = "/invalidCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "重庆CNPC电子券作废") public ResponseData invalidCoupon(@RequestParam(name = "couponNo", required = true) String couponNo, @RequestParam(name = "random", required = false) String random) { try { return ResponseMsgUtil.success(ChongQingCNPCService.invalidCoupon(couponNo, null)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/ycShellPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单退款") public ResponseData ycShellPageQueryAllStation() { try { return ResponseMsgUtil.success(payloService.ycShellPageQueryAllStation(1, 50)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/HuiLianTongConfigPayOrderByCouNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData HuiLianTongConfigPayOrderByCouNo(@RequestParam(name = "couNo", required = true) String couNo) { try { JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couNo); if (jsonObject.getString("respCode").equals("0000")) { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); return ResponseMsgUtil.success(data); } else { log.error("getRechargeProduct error!", "查询失败!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "查询失败"); } } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getPayloAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "paylo油站") public ResponseData getPayloAllStation(HttpServletRequest request) { try { gasService.getPayloAllStation(); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @Resource private TradeService tradeService; @RequestMapping(value = "/huiftTrade", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "huiftTrade") public ResponseData huiftTrade(HttpServletRequest request) { try { // return ResponseMsgUtil.success(tradeService.thirdPreOrder(orderService.getOrderByOrderNo("2024040215535447310"))); return ResponseMsgUtil.success(tradeService.thirdPayResult("P17124793186600955280")); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/loginBySilence", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "【H5】根据手机号登录") public ResponseData loginBySilence(@RequestParam(value = "phone", required = true) String phone , HttpServletRequest request, HttpServletResponse response) { try { // 客户端 LoginPlatform platform = LoginPlatform.getDataByType("H5"); if (platform == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); } return ResponseMsgUtil.success(userService.loginAndRegister(platform, phone, null, new HashMap<>(), request, response)); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } @Resource private HighQzOrderService highQzOrderService; @RequestMapping(value = "/getCinemaOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getCinemaOrderByOrderNo") public ResponseData getCinemaOrderByOrderNo(HttpServletRequest request, HttpServletResponse response) { try { return ResponseMsgUtil.success(highQzOrderService.assemblyQzOrder("20240429103010139871001", "CINEMA")); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } } \ No newline at end of file +package com.cweb.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.Base64Util; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.enum_type.LoginPlatform; import com.hai.enum_type.MerchantStoreSourceType; import com.hai.model.*; import com.hai.pay.channel.huift.TradeService; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.bouncycastle.util.encoders.UrlBase64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import sun.nio.cs.StreamEncoder; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private PayloService payloService; @Resource private HighGasService gasService; @Resource private HighUserService userService; @Resource private HighOrderService orderService; @Resource private HighMerchantStoreService merchantStoreService; @RequestMapping(value = "/invalidCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "重庆CNPC电子券作废") public ResponseData invalidCoupon(@RequestParam(name = "couponNo", required = true) String couponNo, @RequestParam(name = "random", required = false) String random) { try { return ResponseMsgUtil.success(ChongQingCNPCService.invalidCoupon(couponNo, null)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/ycShellPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单退款") public ResponseData ycShellPageQueryAllStation() { try { return ResponseMsgUtil.success(payloService.ycShellPageQueryAllStation(1, 50)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/HuiLianTongConfigPayOrderByCouNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData HuiLianTongConfigPayOrderByCouNo(@RequestParam(name = "couNo", required = true) String couNo) { try { JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couNo); if (jsonObject.getString("respCode").equals("0000")) { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); return ResponseMsgUtil.success(data); } else { log.error("getRechargeProduct error!", "查询失败!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "查询失败"); } } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getPayloAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "paylo油站") public ResponseData getPayloAllStation(HttpServletRequest request) { try { gasService.getPayloAllStation(); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @Resource private TradeService tradeService; @RequestMapping(value = "/huiftTrade", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "huiftTrade") public ResponseData huiftTrade(HttpServletRequest request) { try { // return ResponseMsgUtil.success(tradeService.thirdPreOrder(orderService.getOrderByOrderNo("2024040215535447310"))); return ResponseMsgUtil.success(tradeService.thirdPayResult("P17124793186600955280")); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/loginBySilence", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "【H5】根据手机号登录") public ResponseData loginBySilence(@RequestParam(value = "phone", required = true) String phone , HttpServletRequest request, HttpServletResponse response) { try { // 客户端 LoginPlatform platform = LoginPlatform.getDataByType("H5"); if (platform == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); } return ResponseMsgUtil.success(userService.loginAndRegister(platform, phone, null, new HashMap<>(), request, response)); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } @Resource private HighQzOrderService highQzOrderService; @RequestMapping(value = "/getCinemaOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getCinemaOrderByOrderNo") public ResponseData getCinemaOrderByOrderNo(HttpServletRequest request, HttpServletResponse response) { try { return ResponseMsgUtil.success(QianZhuConfig.getCinemaOrderByOrderNo("20240429164821205766001")); // return ResponseMsgUtil.success(highQzOrderService.assemblyQzOrder("20240429164821205766001", "CINEMA")); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-cweb/src/main/java/com/cweb/controller/QzOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/QzOrderController.java index 116990ed..fbf18a63 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/QzOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/QzOrderController.java @@ -9,6 +9,8 @@ import com.hai.entity.HighChildOrder; import com.hai.entity.HighGasOrderRefund; import com.hai.entity.HighOrder; import com.hai.model.OrderRefundModel; +import com.hai.order.type.OrderChildStatus; +import com.hai.order.type.OrderStatus; import com.hai.service.HighOrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -79,17 +81,24 @@ public class QzOrderController { // 5:已支付(默认不发) 10:已出票 -5:已取消 15:交易成功 if (dataObject.getInteger("eventType") == -5) { - childOrder.setChildOrderStatus(5); - order.setOrderStatus(5); + childOrder.setChildOrderStatus(OrderChildStatus.STATUS5.getNumber()); + order.setOrderStatus(OrderStatus.STATUS5.getNumber()); order.setCancelTime(new Date()); order.setCancelRemarks(data.getString("cancelReason")); } - if (dataObject.getInteger("eventType") == 15) { + if (dataObject.getInteger("eventType") == 10) { + childOrder.setChildOrderStatus(OrderChildStatus.STATUS3.getNumber()); + order.setOrderStatus(OrderStatus.STATUS3.getNumber()); + order.setFinishTime(new Date()); + } + + // 交易成功:开场后两小时,订单状态从已出票自动变成交易成功 + /* if (dataObject.getInteger("eventType") == 15) { childOrder.setChildOrderStatus(3); order.setOrderStatus(3); order.setFinishTime(new Date()); - } + }*/ } } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index 46933b70..803e6a83 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -265,7 +265,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE4.getNumber())) { } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE5.getNumber())) { - + cinemaHandle(order.getOrderNo()); } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE6.getNumber())) { mobileRechargeHandle(order); } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE7.getNumber())) { @@ -581,6 +581,22 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { } + /** + * 电影票 + */ + private void cinemaHandle(String orderNo) throws Exception { + // 支付电影票 + JSONObject object = QianZhuConfig.payMovieOrder(orderNo); + + // 推送订单记录 + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type4.getType()); + highGasOrderPush.setOrderNo(orderNo); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setReturnContent(object.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); + } + /** * @Author Sum1Dream * @Name mobileRecharge