From 492f99a9800558122613d1b287bae1421662987f Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 20 May 2024 10:21:55 +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 --- .../com/cweb/controller/HighTestController.java | 2 +- .../com/cweb/controller/QzOrderController.java | 8 ++++++++ .../java/com/web/controller/TestController.java | 2 +- .../service/impl/OrderPayBeforeServiceImpl.java | 8 ++++++++ .../hai/order/service/impl/OrderServiceImpl.java | 2 +- .../hai/service/pay/impl/CinemaOrderService.java | 8 ++++++++ .../src/main/resources/dev/commonConfig.properties | 14 +++++++------- 7 files changed, 34 insertions(+), 10 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 c81d5622..3b7a787d 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(QianZhuConfig.getCinemaOrderByOrderNo("20240429164821205766001")); // return ResponseMsgUtil.success(highQzOrderService.assemblyQzOrder("20240429164821205766001", "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.QRCodeGenerator; 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); } } public static void main(String[] args) throws Exception { // 读取json文件内容 BufferedReader reader = new BufferedReader(new FileReader("C:/Users/hurui/Desktop/无标题.json")); StringBuilder jsonContent = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { jsonContent.append(line); } reader.close(); // 解析json字符串 JSONArray dataList = JSONObject.parseObject(jsonContent.toString()).getJSONArray("RECORDS"); for (Object obj : dataList) { JSONObject data = (JSONObject) obj; // 生成二维码 String qrCodeImg = data.getString("store_key")+".png"; String qrCodeUrl = "D:/qrCode/" + qrCodeImg; //参数 String param = "https://hsg.dctpay.com/hsgH5?accountId=000000&gasKey="+data.getString("store_key")+"&code="; QRCodeGenerator.generateQRCodeImage(param, 350, 350, qrCodeUrl); } } } \ 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 8de702ed..c286ecd1 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/QzOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/QzOrderController.java @@ -3,6 +3,7 @@ package com.cweb.controller; import com.alibaba.fastjson.JSONObject; import com.hai.common.security.AESEncodeUtil; import com.hai.config.CommonSysConst; +import com.hai.config.QianZhuConfig; import com.hai.config.WxOrderConfig; import com.hai.dao.HighGasOrderRefundMapper; import com.hai.entity.HighChildOrder; @@ -92,6 +93,13 @@ public class QzOrderController { childOrder.setChildOrderStatus(OrderChildStatus.STATUS3.getNumber()); order.setOrderStatus(OrderStatus.STATUS3.getNumber()); order.setFinishTime(new Date()); + + // 订单详情 + JSONObject cinemaOrderDetail = QianZhuConfig.getCinemaOrderByOrderNo(order.getOrderNo()); + if (cinemaOrderDetail != null) { + JSONObject cinemaOrderData = cinemaOrderDetail.getJSONObject("data"); + childOrder.setExt4(cinemaOrderData.getJSONArray("coupons").toJSONString()); + } } // 交易成功:开场后两小时,订单状态从已出票自动变成交易成功 diff --git a/hai-order/src/main/java/com/web/controller/TestController.java b/hai-order/src/main/java/com/web/controller/TestController.java index ce823df7..93ecb22d 100644 --- a/hai-order/src/main/java/com/web/controller/TestController.java +++ b/hai-order/src/main/java/com/web/controller/TestController.java @@ -1 +1 @@ -package com.web.controller; import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.*; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderPaySuccessService; import com.hai.order.service.OrderService; import com.hai.order.service.impl.OrderPaySuccessServiceImpl; import com.hai.order.type.OrderStatus; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.rocketmq.client.producer.SendCallback; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.integration.support.MessageBuilder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class TestController { private static Logger log = LoggerFactory.getLogger(TestController.class); @Autowired private RocketMQTemplate rocketMQTemplate; @Resource private OrderService orderService; @Resource private RedisUtil redisUtil; @Autowired private RedisTemplate redisTemplate; @Resource private OrderPaySuccessServiceImpl orderPaySuccessService = new OrderPaySuccessServiceImpl(); @RequestMapping(value = "/orderBusHandle", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData orderBusHandle(@RequestParam(name = "orderNo", required = true) String orderNo) { try { orderPaySuccessService.orderBusHandle(orderService.getOrderDetailByNo(orderNo)); /* HighOrder order = orderService.getOrderDetailByNo(orderNo); if (order != null) { // orderService.refundOrder(orderNo, DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss")); // order.setRefundTime(new Date()); // orderService.updateOrderData(order); return ResponseMsgUtil.success("修改成功"); }*/ return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rocketMq", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData rocketMq(@RequestParam(name = "topicGroup", required = true) String topicGroup, @RequestParam(name = "body", required = true) String body) { try { long startTime = System.currentTimeMillis(); // org.springframework.messaging.Message message = MessageBuilder.withPayload(order).build(); CreateOrderModel createOrder = new CreateOrderModel(); //发送对象消息 HighOrder order = rocketMQTemplate.sendAndReceive("order-topic:create", createOrder, HighOrder.class); System.out.println("订单号:" + order.getOrderNo()); // SendResult sendResult = rocketMQTemplate.syncSend("order-topic:create", message, 3000); /*List list = new LinkedList<>(); for (int i = 0; i <= 100;i++) { list.add(orderService.getDetailByOrderNo("HF2022080918014365701")); *//* list.add(orderService.getDetailByOrderNo("HF2022080918014365701"));*//* *//* updateUserWithRedisLock("coupon_" + couponKey, i+""); new Thread(() -> {*//* *//* redisTemplate.opsForValue().setIfAbsent("coupon_" + couponKey, i); System.out.println("加入数据" + i);*//* // redisTemplate.delete("coupon" + couponKey); // System.out.println("释放数据" + index); *//* });*//* }*/ System.out.println(System.currentTimeMillis() - startTime); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } public void updateUserWithRedisLock(String couponKey, String value) throws InterruptedException { // 占分布式锁,去redis占坑 // 1. 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent("coupon" + couponKey, value); if(lock) { //加锁成功... // todo business System.out.println("加锁成功: " + value); redisTemplate.delete("coupon" + couponKey); //删除key,释放锁 } else { System.out.println("加锁失败"); /* Thread.sleep(100); // 加锁失败,重试 updateUserWithRedisLock("sysUser");*/ } } } \ No newline at end of file +package com.web.controller; import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.*; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.QianZhuConfig; import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderPaySuccessService; import com.hai.order.service.OrderService; import com.hai.order.service.impl.OrderPaySuccessServiceImpl; import com.hai.order.type.OrderStatus; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.rocketmq.client.producer.SendCallback; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.integration.support.MessageBuilder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class TestController { private static Logger log = LoggerFactory.getLogger(TestController.class); @Autowired private RocketMQTemplate rocketMQTemplate; @Resource private OrderService orderService; @Resource private RedisUtil redisUtil; @Autowired private RedisTemplate redisTemplate; @Resource private OrderPaySuccessServiceImpl orderPaySuccessService = new OrderPaySuccessServiceImpl(); @RequestMapping(value = "/orderBusHandle", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData orderBusHandle(@RequestParam(name = "orderNo", required = true) String orderNo) { try { orderPaySuccessService.orderBusHandle(orderService.getOrderDetailByNo(orderNo)); /* HighOrder order = orderService.getOrderDetailByNo(orderNo); if (order != null) { // orderService.refundOrder(orderNo, DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss")); // order.setRefundTime(new Date()); // orderService.updateOrderData(order); return ResponseMsgUtil.success("修改成功"); }*/ return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rocketMq", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData rocketMq(@RequestParam(name = "topicGroup", required = true) String topicGroup, @RequestParam(name = "body", required = true) String body) { try { JSONObject object = QianZhuConfig.payMovieOrder(""); /* long startTime = System.currentTimeMillis(); // org.springframework.messaging.Message message = MessageBuilder.withPayload(order).build(); CreateOrderModel createOrder = new CreateOrderModel(); //发送对象消息 HighOrder order = rocketMQTemplate.sendAndReceive("order-topic:create", createOrder, HighOrder.class); System.out.println("订单号:" + order.getOrderNo());*/ // SendResult sendResult = rocketMQTemplate.syncSend("order-topic:create", message, 3000); /*List list = new LinkedList<>(); for (int i = 0; i <= 100;i++) { list.add(orderService.getDetailByOrderNo("HF2022080918014365701")); *//* list.add(orderService.getDetailByOrderNo("HF2022080918014365701"));*//* *//* updateUserWithRedisLock("coupon_" + couponKey, i+""); new Thread(() -> {*//* *//* redisTemplate.opsForValue().setIfAbsent("coupon_" + couponKey, i); System.out.println("加入数据" + i);*//* // redisTemplate.delete("coupon" + couponKey); // System.out.println("释放数据" + index); *//* });*//* }*/ System.out.println(QianZhuConfig.getCinemaOrderByOrderNo("20240507150827007293601").getJSONObject("data").getJSONArray("coupons").toJSONString()); return ResponseMsgUtil.success(null); //return ResponseMsgUtil.success(QianZhuConfig.payMovieOrder("20240507150827007293601")); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } public void updateUserWithRedisLock(String couponKey, String value) throws InterruptedException { // 占分布式锁,去redis占坑 // 1. 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent("coupon" + couponKey, value); if(lock) { //加锁成功... // todo business System.out.println("加锁成功: " + value); redisTemplate.delete("coupon" + couponKey); //删除key,释放锁 } else { System.out.println("加锁失败"); /* Thread.sleep(100); // 加锁失败,重试 updateUserWithRedisLock("sysUser");*/ } } } \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPayBeforeServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPayBeforeServiceImpl.java index 55fb3306..96d51f4c 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPayBeforeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPayBeforeServiceImpl.java @@ -16,6 +16,7 @@ import com.hai.order.type.OrderProductType; import com.hai.service.HighGasChannelConfigService; import com.hai.service.HighGasService; import com.hai.service.HighMerchantStoreService; +import com.hai.service.SecConfigService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -34,6 +35,8 @@ public class OrderPayBeforeServiceImpl implements OrderPayBeforeService { private HighGasService gasService; @Resource private HighGasChannelConfigService gasChannelConfigService; + @Resource + private SecConfigService secConfigService; @Override public void payOrderCheck(HighOrder order) { @@ -93,6 +96,11 @@ public class OrderPayBeforeServiceImpl implements OrderPayBeforeService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); } + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE16.getNumber())) { + SecConfig type = secConfigService.findByCodeType("OIL_CARD_RECHARGE"); + if (type != null && type.getCodeValue().equals("false")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时进行无法充值!"); + } } } } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 3836b147..b141de70 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -626,7 +626,7 @@ public class OrderServiceImpl implements OrderService { if (orderData.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { // 10分钟内未支付,自动取消订单 Message rocketMsg = MessageBuilder.withPayload(order).build(); - // 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())) { // 支付校验 diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/CinemaOrderService.java b/hai-service/src/main/java/com/hai/service/pay/impl/CinemaOrderService.java index 15107f05..da2c567f 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/CinemaOrderService.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/CinemaOrderService.java @@ -62,6 +62,14 @@ public class CinemaOrderService implements PayService { highGasOrderPush.setRequestContent(order.getOrderNo()); highGasOrderPush.setReturnContent(object.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); + + // 电影票订单详情 + JSONObject cinemaOrderDetail = QianZhuConfig.getCinemaOrderByOrderNo(order.getOrderNo()); + if (cinemaOrderDetail != null) { + JSONObject cinemaOrderData = cinemaOrderDetail.getJSONObject("data"); + order.getHighChildOrderList().get(0).setExt4(cinemaOrderData.getJSONArray("coupons").toJSONString()); + highOrderService.updateOrder(order); + } } } diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index 5f38e50f..767b4ce2 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -36,13 +36,13 @@ jzPrivateKeyUrl=/home/project/hsg/fileKey/JzPrivateKey.key jzPublicKeyUrl=/home/project/hsg/fileKey/JzPublicKey.key # ???? -qinzhuUrl=https://live.qianzhu8.com -qinzhuUrlToken=https://live.qianzhu8.com/gateway -qinzhuHtmlUrl=https://qz.dctpay.com -qianzhuH5url=https://nf.qianzhu8.com/gateway -qinzhuPlatformId=10458 -qinzhuSecret=nnl3gg4ss0pka11t -qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify +qinzhuUrl=https://live-test.qianzhu8.com +qinzhuUrlToken=https://live-test.qianzhu8.com/gateway +qinzhuHtmlUrl=https://m-test.qianzhu8.com +qianzhuH5url=https://nf-test.qianzhu8.com/gateway +qinzhuPlatformId=10376 +qinzhuSecret=ktxb49sh2jfhgn8g +qianzhuOrderNotify=https://hsgcs.dctpay.com/crest/qianzhu/orderNotify thirdAppKey=211394653 thirdAppSecret=cyQpQKMaGUG186iEZRt1uQ==