From 19c7504036f53f04c13a3098e3f3e53259a21594 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 16 May 2023 14:11:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=AE=9E=E7=89=A9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Goods/GoodsDetailController.java | 6 +- .../controller/HighApproveController.java | 42 ++++- .../bweb/controller/HighTestController.java | 2 +- .../Goods/DeliveryAddressController.java | 2 +- .../OrderMobileRechargeController.java | 4 +- .../consumer/OrderMobileRechargeConsumer.java | 99 ++++++++++++ .../schedule/HighRechargeOrderSchedule.java | 2 +- .../java/com/hai/config/RechargeConfig.java | 2 +- .../main/java/com/hai/entity/HighOrder.java | 33 +++- .../java/com/hai/enum_type/ApproveType.java | 2 +- .../java/com/hai/goods/model/GoodsModel.java | 12 ++ .../hai/goods/service/GoodsDetailService.java | 3 + .../goods/service/GoodsPresentService.java | 10 ++ .../service/impl/GoodsDetailServiceImpl.java | 31 +++- .../service/impl/GoodsPresentServiceImpl.java | 65 ++++++-- .../impl/OrderCreateHandleServiceImpl.java | 29 +--- .../impl/OrderPaySuccessServiceImpl.java | 2 +- .../order/service/impl/OrderServiceImpl.java | 9 ++ .../java/com/hai/order/topic/OrderTopic.java | 1 + .../java/com/hai/order/utils/OrderUtil.java | 15 +- .../hai/service/OutRechargeOrderService.java | 8 +- .../service/impl/HighApproveServiceImpl.java | 11 ++ .../impl/HighCouponCodeServiceImpl.java | 6 +- .../impl/OutRechargeOrderServiceImpl.java | 153 ++++++++---------- .../com/v1/controller/orderController.java | 17 ++ 25 files changed, 415 insertions(+), 151 deletions(-) create mode 100644 hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java b/hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java index 66354cf9..c0f52b98 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java @@ -81,7 +81,6 @@ public class GoodsDetailController { map.put("opId" , userInfoModel.getSecUser().getId()); } - PageHelper.startPage(pageNum,pageSize); List list = goodsDetailService.getGoodsDetailList(map); @@ -165,9 +164,7 @@ public class GoodsDetailController { goodsDetail.setCreateTime(goods.getCreateTime()); goodsDetail.setUpdateTime(new Date()); goodsDetail.setGoodsTypeName(goodsType.getTitle()); - - goodsDetail.setOpId(userInfoModel.getSecUser().getId()); - goodsDetail.setOpName(userInfoModel.getSecUser().getLoginName()); + goodsDetail.setCompanyId(userInfoModel.getBsCompany().getId()); goodsDetailService.updateGoodsDetail(goodsDetail); @@ -275,6 +272,7 @@ public class GoodsDetailController { approve.setUpdateTime(new Date()); approve.setSubmitOperatorId(userInfoModel.getSecUser().getId()); approve.setSubmitOperatorName(userInfoModel.getSecUser().getUserName()); + approve.setExt1(userInfoModel.getBsCompany().getId().toString()); // 增加审批 highApproveService.insertApprove(approve); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java b/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java index 6ef83480..958f51c4 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java @@ -10,8 +10,13 @@ import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.DateUtil; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.GoodsDetail; +import com.hai.entity.GoodsSku; import com.hai.entity.HighApprove; import com.hai.enum_type.ApproveType; +import com.hai.goods.model.GoodsModel; +import com.hai.goods.service.GoodsDetailService; +import com.hai.goods.service.GoodsSkuService; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; import com.hai.service.HighApproveService; @@ -20,14 +25,17 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; 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.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -46,12 +54,18 @@ public class HighApproveController { @Autowired private UserCenter userCenter; + @Resource + private GoodsSkuService goodsSkuService; + @Resource private HighApproveService highApproveService; @Resource private HighCouponService highCouponService; + @Resource + private GoodsDetailService goodsDetailService; + @RequestMapping(value="/approveProcessed",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "审批") @@ -112,6 +126,26 @@ public class HighApproveController { if (approve.getObjectType().equals(ApproveType.UP_SHELF_APPROVE.getType())) { map.put("object", highCouponService.getCouponById(approve.getObjectId())); } + if (approve.getObjectType().equals(ApproveType.GOODS_UP_SHELF_APPROVE.getType())) { + + + + GoodsDetail goodsDetail = goodsDetailService.findGoodsDetailById(approve.getObjectId()); + + if (goodsDetail == null) { + log.error("GoodsDetailController -> findGoodsDetailById() error!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关商品信息"); + } + + GoodsModel goodsModel = new GoodsModel(); + + BeanUtils.copyProperties(goodsDetail, goodsModel); + + goodsModel.setGoodsSkus(goodsSkuService.getGoodsSkuList(goodsDetail.getId())); + + map.put("object", goodsModel); + + } return ResponseMsgUtil.success(map); @@ -129,12 +163,18 @@ public class HighApproveController { @RequestParam(name = "objectId", required = false) Long objectId, @RequestParam(name = "objectName", required = false) String objectName, @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize) { + @RequestParam(name = "pageSize", required = true) Integer pageSize ,HttpServletRequest request) { try { + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + Map map = new HashMap<>(); map.put("approveSerialNo", approveSerialNo); map.put("objectType", objectType); + if (objectType == 4) { + map.put("companyId", userInfoModel.getBsCompany().getId()); + } map.put("objectId", objectId); map.put("objectName", objectName); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java index 52c4d168..adfc7192 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -1 +1 @@ - package com.bweb.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.alipay.api.domain.OfferObject; import com.bweb.config.SysConst; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.order.model.ExportOrderMobileModel; import com.hai.order.model.OrderThirdPartyModel; import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderService; import com.hai.order.type.*; import com.hai.order.utils.OrderUtil; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; 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.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.File; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @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 OutRechargeOrderService outRechargeOrderService; @Autowired private OutRechargeChildOrderService childOrderService; @Resource private BsOrderRebateService bsOrderRebateService; @Resource private CommonService commonService; @Resource private OrderService orderService; @Resource private HighOrderService highOrderService; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStationStores", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取油站") public ResponseData getStationStores() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); mapPost.put("merchId" , "20220896102"); Map map = new HashMap<>(); map.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); map.put("merchId" , "20220896102"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/refuelOnline/getStationStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRechargeProduct", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取充值产品") public ResponseData getRechargeProduct() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/mobileRecharge/getMobileProduct" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getAllCities", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询可用城市") public ResponseData getAllCities() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/apiMerchants/getAllCities" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克门店") public ResponseData starbucksStore() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("lat" , "29.56900"); mapPost.put("lon" , "106.55843"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("lat" , "29.56900"); map.put("lon" , "106.55843"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克商品") public ResponseData starbucksProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcStoresList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData kfcStoresList() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcStoresList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcProductByStoreCode", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据门店编码查询KFC产品") public ResponseData kfcProductByStoreCode(@RequestParam(name = "storeCode", required = true) String storeCode) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("storeCode" , storeCode); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("storeCode" , storeCode); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcProductByStoreCode" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRegional", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询区域信息") public ResponseData getRegional() { try { return ResponseMsgUtil.success(commonService.getRegional("code" , "name" , "childs")); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/memberProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询会员产品") public ResponseData memberProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/memberRecharge/memberProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("notifyUrl" , "test"); mapPost.put("content" , object.toString()); System.out.println(mapPost); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("timetable" , mapPost.get("timetable").toString()); map.put("orderNo" , mapPost.get("orderNo")); map.put("productType" , object.getString("productType")); map.put("content" , object.toString()); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileChildOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据订单号修改话费订单状态") public ResponseData mobileChildOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); String key = "recharge_" + order.getId(); try { // 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, order.getOrderNo()); if(Boolean.TRUE.equals(lock)) { // 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成 int orderStatus = outRechargeOrderService.orderWhetherRecharge(order); log.info("处理话费订单:" + orderStatus + "订单号" + order.getOrderNo()); if (orderStatus == 1) { outRechargeOrderService.getPrepaidRechargeApi(order); } if (orderStatus == 2) { outRechargeOrderService.refundOrder(order.getId()); } if (orderStatus == 4) { HighOrder highOrder = highOrderService.getOrderByOrderNo(order.getOrderNo()); highOrder.setExceptionStatus(true); highOrder.setExceptionContent("话费订单存在多条重复记录"); highOrderService.updateOrder(highOrder); } if (orderStatus == 5) { outRechargeOrderService.completeOrder(order.getId()); } } else { // 加锁失败,重试 Thread.sleep(100); mobileChildOrderByOrderNo(orderNo); } return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } finally { // 删除key,释放锁 redisTemplate.delete(key); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(3); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, "工会卡充值退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileDw", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费订单下载") public ResponseData mobileDw(@RequestParam(name = "createTimeS", required = false) String createTimeS, @RequestParam(name = "createTimeE", required = false) String createTimeE, @RequestParam(name = "refundTimeS", required = false) String refundTimeS, @RequestParam(name = "refundTimeE", required = false) String refundTimeE ) { try { Map map = new HashMap<>(); map.put("productType" , 9); map.put("createTimeS" , createTimeS); map.put("createTimeE" , createTimeE); map.put("refundTimeS" , refundTimeS); map.put("refundTimeE" , refundTimeE); List order = highOrderService.getOrderListNotChild(map); List list = new ArrayList<>(); ExportOrderMobileModel model; for (HighOrder highOrder : order) { model = new ExportOrderMobileModel(); OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNoNotChild(highOrder.getOrderNo()); if (rechargeOrder != null) { OutRechargeChildOrder childOrder = mobileChildOrderHandle(highOrder,rechargeOrder); model.setRechargeOrderNo(rechargeOrder.getOrderNo()); if (childOrder != null) { model.setChildOrderNo(childOrder.getOrderNo()); if (childOrder.getRechargePlatform() != null) { model.setRechargePlatform(RechargePlatformType.getDataByType(childOrder.getRechargePlatform()).getName()); } model.setRemark(childOrder.getExt1()); } } model.setFinishTime(highOrder.getFinishTime()); model.setOrderStatus(OrderStatus.getDataByType(highOrder.getOrderStatus()).getName()); model.setMemPhone(highOrder.getMemPhone()); model.setCreateTime(highOrder.getCreateTime()); model.setTitle(highOrder.getTitle()); model.setPayablePrice(highOrder.getPayablePrice()); model.setRefundTime(highOrder.getRefundTime()); model.setPayPrice(highOrder.getPayPrice()); model.setOrderNo(highOrder.getOrderNo()); model.setMemCardNo(highOrder.getMemCardNo()); if (highOrder.getPayType() != null) { model.setPayType(OrderPayType.getDataByType(highOrder.getPayType()).getName()); } list.add(model); } String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/"; String pathName = System.currentTimeMillis()+".xlsx"; File file = new File(fileUrl); if (!file.exists()) { file.mkdirs(); } EasyExcel.write(fileUrl+pathName) .head(ExportOrderMobileModel.class) .sheet("话费交易订单") .doWrite(list); return ResponseMsgUtil.success(pathName); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } public OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder) { // 组装查询子订单数据 Map childOrderMap101 = new HashMap<>(); childOrderMap101.put("parent_order_id", outRechargeOrder.getId()); childOrderMap101.put("status", "101,102"); // 查询充值订单 List childOrders = childOrderService.getListRechargeChildOrder(childOrderMap101); OutRechargeChildOrder childOrder; // 判读是否存在多个充值中的订单 if (childOrders.size() > 0) { childOrder = childOrders.get(0); if (childOrders.size() > 1) { childOrder.setExt1("当前订单存在多个充值订单"); } } else { childOrder = childOrderService.findByOrderId(outRechargeOrder.getId()); if (childOrder != null && highOrder != null && childOrder.getStatus() != null && highOrder.getOrderStatus() != null) { if (highOrder.getOrderStatus() == 2 && childOrder.getStatus() != 102) { childOrder.setExt1("主订单充值中,但是充值订单状态不为充值中"); } if (highOrder.getOrderStatus() == 3 && childOrder.getStatus() != 101) { childOrder.setExt1("主订单充值成功,但是充值订单状态不为充值成功"); } if (highOrder.getOrderStatus() == 4 && !(childOrder.getStatus() == 103 || childOrder.getStatus() == 104)) { childOrder.setExt1("主订单退款,但是充值订单状态不为退款"); } } } return childOrder; } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData test() { try { JSONObject object = new JSONObject(); object.put("productType" , 101); object.put("phone" , "17726395120"); object.put("orderNo" , "ZF1130202305041640363988083900"); object.put("orderId" , 792 ); object.put("title" , "惠付门店"); object.put("createTime" , new Date()); object.put("price" , 1); bsOrderRebateService.insertOrderRebate(object); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file + package com.bweb.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.alipay.api.domain.OfferObject; import com.bweb.config.SysConst; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.order.model.ExportOrderMobileModel; import com.hai.order.model.OrderThirdPartyModel; import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderService; import com.hai.order.type.*; import com.hai.order.utils.OrderUtil; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; 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.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.File; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @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 OutRechargeOrderService outRechargeOrderService; @Autowired private OutRechargeChildOrderService childOrderService; @Resource private BsOrderRebateService bsOrderRebateService; @Resource private CommonService commonService; @Resource private OrderService orderService; @Resource private HighOrderService highOrderService; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStationStores", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取油站") public ResponseData getStationStores() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); mapPost.put("merchId" , "20220896102"); Map map = new HashMap<>(); map.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); map.put("merchId" , "20220896102"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/refuelOnline/getStationStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRechargeProduct", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取充值产品") public ResponseData getRechargeProduct() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/mobileRecharge/getMobileProduct" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getAllCities", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询可用城市") public ResponseData getAllCities() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/apiMerchants/getAllCities" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克门店") public ResponseData starbucksStore() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("lat" , "29.56900"); mapPost.put("lon" , "106.55843"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("lat" , "29.56900"); map.put("lon" , "106.55843"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克商品") public ResponseData starbucksProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcStoresList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData kfcStoresList() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcStoresList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcProductByStoreCode", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据门店编码查询KFC产品") public ResponseData kfcProductByStoreCode(@RequestParam(name = "storeCode", required = true) String storeCode) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("storeCode" , storeCode); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("storeCode" , storeCode); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcProductByStoreCode" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRegional", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询区域信息") public ResponseData getRegional() { try { return ResponseMsgUtil.success(commonService.getRegional("code" , "name" , "childs")); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/memberProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询会员产品") public ResponseData memberProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/memberRecharge/memberProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("notifyUrl" , "test"); mapPost.put("content" , object.toString()); System.out.println(mapPost); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("timetable" , mapPost.get("timetable").toString()); map.put("orderNo" , mapPost.get("orderNo")); map.put("productType" , object.getString("productType")); map.put("content" , object.toString()); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(3); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, "工会卡充值退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileDw", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费订单下载") public ResponseData mobileDw(@RequestParam(name = "createTimeS", required = false) String createTimeS, @RequestParam(name = "createTimeE", required = false) String createTimeE, @RequestParam(name = "refundTimeS", required = false) String refundTimeS, @RequestParam(name = "refundTimeE", required = false) String refundTimeE ) { try { Map map = new HashMap<>(); map.put("productType" , 9); map.put("createTimeS" , createTimeS); map.put("createTimeE" , createTimeE); map.put("refundTimeS" , refundTimeS); map.put("refundTimeE" , refundTimeE); List order = highOrderService.getOrderListNotChild(map); List list = new ArrayList<>(); ExportOrderMobileModel model; for (HighOrder highOrder : order) { model = new ExportOrderMobileModel(); OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNoNotChild(highOrder.getOrderNo()); if (rechargeOrder != null) { OutRechargeChildOrder childOrder = mobileChildOrderHandle(highOrder,rechargeOrder); model.setRechargeOrderNo(rechargeOrder.getOrderNo()); if (childOrder != null) { model.setChildOrderNo(childOrder.getOrderNo()); if (childOrder.getRechargePlatform() != null) { model.setRechargePlatform(RechargePlatformType.getDataByType(childOrder.getRechargePlatform()).getName()); } model.setRemark(childOrder.getExt1()); } } model.setFinishTime(highOrder.getFinishTime()); model.setOrderStatus(OrderStatus.getDataByType(highOrder.getOrderStatus()).getName()); model.setMemPhone(highOrder.getMemPhone()); model.setCreateTime(highOrder.getCreateTime()); model.setTitle(highOrder.getTitle()); model.setPayablePrice(highOrder.getPayablePrice()); model.setRefundTime(highOrder.getRefundTime()); model.setPayPrice(highOrder.getPayPrice()); model.setOrderNo(highOrder.getOrderNo()); model.setMemCardNo(highOrder.getMemCardNo()); if (highOrder.getPayType() != null) { model.setPayType(OrderPayType.getDataByType(highOrder.getPayType()).getName()); } list.add(model); } String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/"; String pathName = System.currentTimeMillis()+".xlsx"; File file = new File(fileUrl); if (!file.exists()) { file.mkdirs(); } EasyExcel.write(fileUrl+pathName) .head(ExportOrderMobileModel.class) .sheet("话费交易订单") .doWrite(list); return ResponseMsgUtil.success(pathName); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } public OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder) { // 组装查询子订单数据 Map childOrderMap101 = new HashMap<>(); childOrderMap101.put("parent_order_id", outRechargeOrder.getId()); childOrderMap101.put("status", "101,102"); // 查询充值订单 List childOrders = childOrderService.getListRechargeChildOrder(childOrderMap101); OutRechargeChildOrder childOrder; // 判读是否存在多个充值中的订单 if (childOrders.size() > 0) { childOrder = childOrders.get(0); if (childOrders.size() > 1) { childOrder.setExt1("当前订单存在多个充值订单"); } } else { childOrder = childOrderService.findByOrderId(outRechargeOrder.getId()); if (childOrder != null && highOrder != null && childOrder.getStatus() != null && highOrder.getOrderStatus() != null) { if (highOrder.getOrderStatus() == 2 && childOrder.getStatus() != 102) { childOrder.setExt1("主订单充值中,但是充值订单状态不为充值中"); } if (highOrder.getOrderStatus() == 3 && childOrder.getStatus() != 101) { childOrder.setExt1("主订单充值成功,但是充值订单状态不为充值成功"); } if (highOrder.getOrderStatus() == 4 && !(childOrder.getStatus() == 103 || childOrder.getStatus() == 104)) { childOrder.setExt1("主订单退款,但是充值订单状态不为退款"); } } } return childOrder; } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData test() { try { JSONObject object = new JSONObject(); object.put("productType" , 101); object.put("phone" , "17726395120"); object.put("orderNo" , "ZF1130202305041640363988083900"); object.put("orderId" , 792 ); object.put("title" , "惠付门店"); object.put("createTime" , new Date()); object.put("price" , 1); bsOrderRebateService.insertOrderRebate(object); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-cweb/src/main/java/com/cweb/controller/Goods/DeliveryAddressController.java b/hai-cweb/src/main/java/com/cweb/controller/Goods/DeliveryAddressController.java index 93afeba0..48dec891 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/Goods/DeliveryAddressController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/Goods/DeliveryAddressController.java @@ -139,7 +139,7 @@ public class DeliveryAddressController { } if (deliveryAddress.getWhetherDefault()) { - deliveryAddressService.cleanDeliveryAddressDefault(deliveryAddress.getUserId()); + deliveryAddressService.cleanDeliveryAddressDefault(userInfoModel.getHighUser().getId()); } GoodsDeliveryAddress goodsDeliveryAddress = deliveryAddressService.findDeliveryAddressById(deliveryAddress.getId()); diff --git a/hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java b/hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java index 7941f54b..75f2b376 100644 --- a/hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java +++ b/hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java @@ -139,8 +139,8 @@ public class OrderMobileRechargeController { @RequestParam(name = "payTimeS", required = false) Long payTimeS, @RequestParam(name = "payTimeE", required = false) Long payTimeE, @RequestParam(name = "productType", required = false) Integer productType, - @RequestParam(name = "refundTimeS", required = false) String refundTimeS, - @RequestParam(name = "refundTimeE", required = false) String refundTimeE, + @RequestParam(name = "refundTimeS", required = false) Long refundTimeS, + @RequestParam(name = "refundTimeE", required = false) Long refundTimeE, @RequestParam(name = "finishTimeS", required = false) Long finishTimeS, @RequestParam(name = "finishTimeE", required = false) Long finishTimeE) { try { diff --git a/hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java b/hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java new file mode 100644 index 00000000..4a9a8f27 --- /dev/null +++ b/hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java @@ -0,0 +1,99 @@ +package com.web.rocketmq.consumer; + +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.CommonSysConst; +import com.hai.config.RechargeConfig; +import com.hai.entity.OutRechargeChildOrder; +import com.hai.entity.OutRechargeOrder; +import com.hai.service.OutRechargeChildOrderService; +import com.hai.service.OutRechargeOrderService; +import lombok.extern.slf4j.Slf4j; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Date; + +@Component +@Slf4j +@RocketMQMessageListener(consumerGroup = "order-mobile-recharge-group", topic = "order-topic",selectorExpression = "mobile-recharge") +public class OrderMobileRechargeConsumer implements RocketMQListener { + + @Resource + private OutRechargeOrderService outRechargeOrderService; + + @Resource + private OutRechargeChildOrderService outRechargeChildOrderService; + + @Override + public void onMessage(OutRechargeChildOrder childOrder) { + + JSONObject object = new JSONObject(); + + OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId()); + + object.put("rechargePrice" , outRechargeOrder.getRechargePrice()); + object.put("rechargeMobile" , outRechargeOrder.getRechargeContent()); + object.put("productId" , outRechargeOrder.getGoodsId()); + object.put("parentOrderId" , outRechargeOrder.getId()); + + // -1 取消,0充值中 ,1充值成功,2充值失败,3部分成功 + Integer status = outRechargeOrderService.getRechargeOrderLegality(childOrder); + + if (status == 2 || status == -1) { + // 补充下单参数 + object = outRechargeOrderService.prepaidRechargeOrderHandle(object); + + // 尖椒充值 + if (object.getInteger("rechargePlatform") == 1) { + object.put("out_order_id", childOrder.getOrderNo()); + object.put("amount", object.getBigDecimal("rechargePrice")); + object.put("mobile", object.getString("rechargeMobile")); + object.put("notifyUrl", CommonSysConst.getSysConfig().getJjNotifyUrl()); + JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object); + childOrder.setExt1(returnObject.toJSONString()); + } + + // 龙阅 + if (object.getInteger("rechargePlatform") == 2) { + + if (object.getString("code") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + object.put("out_trade_num", childOrder.getOrderNo()); + object.put("product_id", object.getString("code")); + object.put("mobile", object.getString("rechargeMobile")); + object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl()); + JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); + childOrder.setExt1(returnObject.toJSONString()); + } + + // 畅停充值 + if (object.getInteger("rechargePlatform") == 4) { + + if (object.getString("code") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + object.put("orderid", childOrder.getOrderNo()); + object.put("product_id", object.getString("code")); + object.put("phone", object.getString("rechargeMobile")); + object.put("price", object.getBigDecimal("rechargePrice")); + JSONObject returnObject = RechargeConfig.rechargeOrderByHg(object); + childOrder.setExt1(returnObject.toJSONString()); + } + + + System.out.println("消费内容:" + childOrder); + + childOrder.setUpdateTime(new Date()); + outRechargeChildOrderService.updateOrder(childOrder); + } + + } +} diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java index 778a8ee2..2e309e0c 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java @@ -50,7 +50,7 @@ public class HighRechargeOrderSchedule { * @Date 14:18 2022/5/31 * @Param [] */ - @Scheduled(cron = "0 0/120 * * * ?") //每120分钟执行一次 + @Scheduled(cron = "0 0/60 * * * ?") //每120分钟执行一次 public void initRechargeOrder() { log.info("处理话费订单定时任务开始"); Map map = new HashMap<>(); diff --git a/hai-service/src/main/java/com/hai/config/RechargeConfig.java b/hai-service/src/main/java/com/hai/config/RechargeConfig.java index 817fd6ef..716b50c4 100644 --- a/hai-service/src/main/java/com/hai/config/RechargeConfig.java +++ b/hai-service/src/main/java/com/hai/config/RechargeConfig.java @@ -69,7 +69,7 @@ public class RechargeConfig { paramMap.put("userid" , CommonSysConst.getSysConfig().getLyMemberId()); paramMap.put("sign", WxUtils.generateSignatureLy(paramMap , CommonSysConst.getSysConfig().getLyApiKey() , WXPayConstants.SignType.MD5)); - log.info("发起龙阅订单充值="); + log.info("发起龙阅订单充值"); log.info("龙阅订单充值-请求参数: " + JSON.toJSONString(paramMap)); JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/recharge", paramMap); diff --git a/hai-service/src/main/java/com/hai/entity/HighOrder.java b/hai-service/src/main/java/com/hai/entity/HighOrder.java index 56bf0f76..ccf71fbc 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrder.java @@ -3,6 +3,7 @@ package com.hai.entity; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; +import java.util.List; /** * high_order @@ -261,8 +262,38 @@ public class HighOrder implements Serializable { */ private String ext6; + private String time; + + private String goodsTypeName; + + public String getGoodsTypeName() { + return goodsTypeName; + } + + public void setGoodsTypeName(String goodsTypeName) { + this.goodsTypeName = goodsTypeName; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + private static final long serialVersionUID = 1L; + private List highChildOrderList; + + public List getHighChildOrderList() { + return highChildOrderList; + } + + public void setHighChildOrderList(List highChildOrderList) { + this.highChildOrderList = highChildOrderList; + } + public Long getId() { return id; } @@ -844,4 +875,4 @@ public class HighOrder implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/enum_type/ApproveType.java b/hai-service/src/main/java/com/hai/enum_type/ApproveType.java index c14feed9..b4b8760f 100644 --- a/hai-service/src/main/java/com/hai/enum_type/ApproveType.java +++ b/hai-service/src/main/java/com/hai/enum_type/ApproveType.java @@ -9,7 +9,7 @@ public enum ApproveType { UP_SHELF_APPROVE(1, "卡卷上架审批"), COUPON_PRICE_APPROVE(2, "卡卷价格审批"), COUPON_DISTRIBUTE_APPROVE(3, "卡卷分发审批"), - GOODS_UP_SHELF_APPROVE(4, "卡卷分发审批"), + GOODS_UP_SHELF_APPROVE(4, "实物审批"), ; private Integer type; diff --git a/hai-service/src/main/java/com/hai/goods/model/GoodsModel.java b/hai-service/src/main/java/com/hai/goods/model/GoodsModel.java index 23da907d..af2182f6 100644 --- a/hai-service/src/main/java/com/hai/goods/model/GoodsModel.java +++ b/hai-service/src/main/java/com/hai/goods/model/GoodsModel.java @@ -1,9 +1,11 @@ package com.hai.goods.model; import com.hai.entity.GoodsDetail; +import com.hai.entity.GoodsSku; import java.io.Serializable; import java.math.BigDecimal; +import java.util.List; public class GoodsModel extends GoodsDetail { @@ -14,6 +16,8 @@ public class GoodsModel extends GoodsDetail { private Boolean whetherMultiple; + private List goodsSkus; + public BigDecimal getPrice() { return price; @@ -38,4 +42,12 @@ public class GoodsModel extends GoodsDetail { public void setWhetherMultiple(Boolean whetherMultiple) { this.whetherMultiple = whetherMultiple; } + + public List getGoodsSkus() { + return goodsSkus; + } + + public void setGoodsSkus(List goodsSkus) { + this.goodsSkus = goodsSkus; + } } diff --git a/hai-service/src/main/java/com/hai/goods/service/GoodsDetailService.java b/hai-service/src/main/java/com/hai/goods/service/GoodsDetailService.java index 5f774f33..ba9d1983 100644 --- a/hai-service/src/main/java/com/hai/goods/service/GoodsDetailService.java +++ b/hai-service/src/main/java/com/hai/goods/service/GoodsDetailService.java @@ -3,6 +3,7 @@ package com.hai.goods.service; import com.hai.entity.ApiMchProduct; import com.hai.entity.GoodsDetail; import com.hai.entity.GoodsLogistics; +import com.hai.entity.HighApprove; import java.util.List; import java.util.Map; @@ -57,4 +58,6 @@ public interface GoodsDetailService { */ GoodsDetail findGoodsDetailById(Long id); + void upShelfApproveResult(HighApprove highApprove); + } diff --git a/hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java b/hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java index 1600be4b..1d2f2ad7 100644 --- a/hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java +++ b/hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java @@ -92,4 +92,14 @@ public interface GoodsPresentService { List getPresentRecord(Map map); void presentUser(HighOrder order , HighChildOrder highChildOrder); + + /** + * @Author Sum1Dream + * @Name preGiveUser + * @Description // 预送用户卡券 + * @Date 14:45 2023/5/10 + * @Param [order, highChildOrder] + * @Return void + */ + void preGiveUser( HighChildOrder highChildOrder); } diff --git a/hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java b/hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java index b16cae50..67dc1b0e 100644 --- a/hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java +++ b/hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java @@ -1,16 +1,17 @@ package com.hai.goods.service.impl; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; import com.hai.dao.GoodsDetailMapper; import com.hai.dao.GoodsLogisticsMapper; -import com.hai.entity.ApiMerchantsExample; -import com.hai.entity.GoodsDetail; -import com.hai.entity.GoodsDetailExample; -import com.hai.entity.GoodsLogistics; +import com.hai.entity.*; import com.hai.goods.service.GoodsDetailService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.Map; @@ -67,4 +68,26 @@ public class GoodsDetailServiceImpl implements GoodsDetailService { return goodsDetailMapper.selectByPrimaryKey(id); } + @Override + public void upShelfApproveResult(HighApprove highApprove) { + GoodsDetail goodsDetail = findGoodsDetailById(highApprove.getObjectId()); + if (goodsDetail == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息!"); + } + + if (goodsDetail.getStatus() != 3) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态错误!"); + } + + // 状态: 1:待审批 2:驳回 3:通过 + if (highApprove.getStatus() == 2) { + goodsDetail.setStatus(2); + } + if (highApprove.getStatus() == 3) { + goodsDetail.setStatus(1); + } + + goodsDetail.setUpdateTime(new Date()); + updateGoodsDetail(goodsDetail); + } } diff --git a/hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java b/hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java index aee8543d..55d74237 100644 --- a/hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java @@ -1,5 +1,6 @@ package com.hai.goods.service.impl; +import com.hai.config.HuiLianTongConfig; import com.hai.dao.GoodsPresentMapper; import com.hai.dao.GoodsPresentRecordMapper; import com.hai.entity.*; @@ -94,7 +95,6 @@ public class GoodsPresentServiceImpl implements GoodsPresentService { } @Override - @Async public void presentUser(HighOrder order, HighChildOrder highChildOrder) { try { @@ -102,26 +102,36 @@ public class GoodsPresentServiceImpl implements GoodsPresentService { List goodsPresents = goodsPresentService.getPresentList(highChildOrder.getGoodsId()); if (goodsPresents.size() > 0) { - for (int j = 0; j < highChildOrder.getSaleCount(); j++) { + for (GoodsPresent present : goodsPresents) { GoodsPresentRecord presentRecord = new GoodsPresentRecord(); presentRecord.setStatus("0"); if (present.getType() == 1) { - for (int i = 0; i < present.getNum(); i++) { - HighCoupon coupon = highCouponService.getCouponById(present.getSourceId()); - // 支付购买卡券 - couponCodeService.payCoupon(order,highChildOrder,coupon); + HighCoupon coupon = highCouponService.getCouponById(present.getSourceId()); + if (coupon.getCouponSource() == 1 || coupon.getCouponSource() == 2 || coupon.getCouponSource() == 3) { + for (int i = 0; i < present.getNum(); i++) { + for (int j = 0; j < highChildOrder.getSaleCount(); j++) { + // 支付购买卡券 + couponCodeService.payCoupon(order,highChildOrder,coupon); + } + } + } + if (coupon.getCouponSource() == 4 || coupon.getCouponSource() == 5) { + for (int i = 0; i < present.getNum(); i++) { + // 支付购买卡券 + couponCodeService.payCoupon(order,highChildOrder,coupon); + } } } if (present.getType() == 2) { - highDiscountAgentCodeService.giveDiscount(present.getSourceId() , Long.valueOf(present.getNum()), order.getMemId()); + highDiscountAgentCodeService.giveDiscount(present.getSourceId() , ((long) present.getNum() * highChildOrder.getSaleCount()), order.getMemId()); } presentRecord.setOrderNo(order.getOrderNo()); presentRecord.setOrderId(order.getId()); - presentRecord.setChildOrderId(highChildOrder.getOrderId()); + presentRecord.setChildOrderId(highChildOrder.getId()); presentRecord.setCreateTime(new Date()); - presentRecord.setNum(presentRecord.getNum()); + presentRecord.setNum(present.getNum()*highChildOrder.getSaleCount()); presentRecord.setUpdateTime(new Date()); presentRecord.setType(present.getType()); presentRecord.setStatus("1"); @@ -133,9 +143,44 @@ public class GoodsPresentServiceImpl implements GoodsPresentService { goodsPresentService.insertPresentRecord(presentRecord); } } - } + + } catch (Exception e) { + + } + } + + @Override + public void preGiveUser(HighChildOrder childOrder) { + + try { + + List goodsPresents = goodsPresentService.getPresentList(childOrder.getGoodsId()); + + if (goodsPresents.size() > 0) { + for (GoodsPresent present : goodsPresents) { + if (present.getType() == 1) { + HighCoupon coupon = highCouponService.getCouponById(present.getSourceId()); + if (coupon.getCouponSource() == 1 || coupon.getCouponSource() == 2 || coupon.getCouponSource() == 3) { + for (int i = 0; i < present.getNum(); i++) { + for (int j = 0; j < childOrder.getSaleCount(); j++) { + highCouponService.assignOrderStock(present.getSourceId(), childOrder.getChildOrderNo()); + } + } + } + if (coupon.getCouponSource() == 4) { + HuiLianTongConfig.recharge(childOrder.getChildOrderNo(), + childOrder.getSaleCount()*present.getNum(), + coupon.getCouponKey(), + childOrder.getMemPhone()); + } + + } + } + } + } catch (Exception e) { } + } } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index cb282846..7847cd56 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -53,14 +53,10 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { @Resource private CommonService commonService; - @Resource - private BsCompanyService companyService; - @Resource - private OrderService orderService; @Resource - private BsConfigService bsConfigService; + private BsCompanyService companyService; @Resource private SecConfigService secConfigService; @@ -77,8 +73,6 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { @Resource private HighMerchantStoreService storeService; - @Resource - private GoodsPresentService goodsPresentService; @Resource private HighMerchantService merchantService; @@ -138,6 +132,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { @Resource private GoodsSkuService goodsSkuService; + @Resource + private GoodsPresentService presentService; + @Resource private ShoppingCartService shoppingCartService; @@ -945,6 +942,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); childOrder.setPraiseStatus(0); childOrder.setCreateTime(new Date()); + childOrder.setExt5(goods.getOpId().toString()); if (createOrderChild.getShopCartId() != null) { shoppingCartService.deleteShoppingCart(createOrderChild.getShopCartId()); @@ -952,22 +950,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { goodsSkuService.decreaseStockNum(createOrderChild.getSkuId(), createOrderChild.getSaleCount()); - -// List goodsPresents = goodsPresentService.getPresentList(childOrder.getGoodsId()); -// -// -//// if (goodsPresents.size() > 0) { -//// for (int j = 0; j < childOrder.getSaleCount(); j++) { -//// for (GoodsPresent present : goodsPresents) { -//// if (present.getType() == 1) { -//// for (int i = 0; i < present.getNum(); i++) { -//// couponService.assignOrderStock(present.getSourceId(), childOrder.getChildOrderNo()); -//// } -//// } -//// -//// } -//// } -//// } + presentService.preGiveUser(childOrder); return childOrder; } 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 2da87f62..737cb600 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 @@ -496,7 +496,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { * @Param [order] * @Return void */ - private void mobileRecharge(HighOrder order) throws Exception { + private void mobileRecharge(HighOrder order) { OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(order.getOrderNo()); if (outRechargeOrder.getPayStatus() == null) { if (order.getProductType().equals(9)) { 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 c5913677..6be554d5 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 @@ -305,6 +305,7 @@ public class OrderServiceImpl implements OrderService { HighChildOrder childOrder = orderCreateHandleService.goods(order , child); childOrderList.add(childOrder); order.setProductType(OrderProductType.PRODUCT_TYPE12.getNumber()); + order.setSecUserId(childOrder.getId()); if (StringUtils.isBlank(order.getTitle())) { order.setTitle(childOrder.getGoodsName()); @@ -622,6 +623,14 @@ public class OrderServiceImpl implements OrderService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单无法退款!"); } + // 订单是否异常,订单没异常则需要校验产品业务是否支持退款 + if (order.getExceptionStatus().equals(true) + // 产品业务是否支付退款 + && order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber()) + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单无法退款!"); + } + // 退款订单号 String refundOrderNo = OrderUtil.generateRefundOrderNo(); diff --git a/hai-service/src/main/java/com/hai/order/topic/OrderTopic.java b/hai-service/src/main/java/com/hai/order/topic/OrderTopic.java index 93558014..d1f5438c 100644 --- a/hai-service/src/main/java/com/hai/order/topic/OrderTopic.java +++ b/hai-service/src/main/java/com/hai/order/topic/OrderTopic.java @@ -11,6 +11,7 @@ public enum OrderTopic { ORDER_TOPIC_CANCEL(ORDER_TOPIC.getTopic() + ":cancel", "订单取消"), ORDER_TOPIC_REFUND_SUCCESS(ORDER_TOPIC.getTopic() + ":refund-success", "订单退款成功业务"), ORDER_TOPIC_PROFIT_SHARING(ORDER_TOPIC.getTopic() + ":profit-sharing", "订单分账业务"), + MOBILE_TOPIC_PROFIT_RECHARGE(ORDER_TOPIC.getTopic() + ":mobile-recharge", "话费订单充值业务"), ; private String topic; diff --git a/hai-service/src/main/java/com/hai/order/utils/OrderUtil.java b/hai-service/src/main/java/com/hai/order/utils/OrderUtil.java index c5bb47bb..a2b38dbb 100644 --- a/hai-service/src/main/java/com/hai/order/utils/OrderUtil.java +++ b/hai-service/src/main/java/com/hai/order/utils/OrderUtil.java @@ -51,11 +51,16 @@ public class OrderUtil { * @return * @throws Exception */ - public static String generateOrderNo() throws Exception { - // 5位随机数 + 1位线程生成数 - String randomNum = (new Random().nextInt(8999) + 1000) + IDGenerator.nextId(1); - // 生成订单号 - return DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + randomNum; + public static String generateOrderNo() { + try { + // 5位随机数 + 1位线程生成数 + String randomNum = (new Random().nextInt(8999) + 1000) + IDGenerator.nextId(1); + // 生成订单号 + return DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + randomNum; + } catch (Exception e) { + return null; + } + } /** diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java index b8ead430..6148530f 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java @@ -144,7 +144,7 @@ public interface OutRechargeOrderService { * @Param [rechargeOrder] * @Return void */ - void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) throws Exception; + void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder); /** * @Author Sum1Dream @@ -197,7 +197,7 @@ public interface OutRechargeOrderService { * @Param [object] * @Return void */ - Integer getRechargeOrderLegality(OutRechargeChildOrder childOrder) throws Exception; + Integer getRechargeOrderLegality(OutRechargeChildOrder childOrder); /** * @Author Sum1Dream @@ -207,7 +207,9 @@ public interface OutRechargeOrderService { * @Param [childOrder] * @Return java.lang.Integer 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成 */ - Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder) throws Exception; + Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder); OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder); + + JSONObject prepaidRechargeOrderHandle(JSONObject object); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java index 542d7fb3..ee7f2fb6 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java @@ -7,6 +7,7 @@ import com.hai.common.exception.SysCode; import com.hai.dao.HighApproveMapper; import com.hai.entity.*; import com.hai.enum_type.ApproveType; +import com.hai.goods.service.GoodsDetailService; import com.hai.model.HighCouponModel; import com.hai.service.HighAgentService; import com.hai.service.HighApproveService; @@ -37,6 +38,9 @@ public class HighApproveServiceImpl implements HighApproveService { @Resource private HighCouponService highCouponService; + @Resource + private GoodsDetailService goodsDetailService; + @Override @Transactional(propagation= Propagation.REQUIRES_NEW ,rollbackFor = Exception.class) @@ -82,6 +86,10 @@ public class HighApproveServiceImpl implements HighApproveService { if (highApprove.getObjectType().equals(ApproveType.COUPON_DISTRIBUTE_APPROVE.getType())) { highCouponService.distributeApprove(highApprove); } + if (highApprove.getObjectType().equals(ApproveType.GOODS_UP_SHELF_APPROVE.getType())) { + goodsDetailService.upShelfApproveResult(highApprove); + } + updateApprove(highApprove); } @@ -102,6 +110,9 @@ public class HighApproveServiceImpl implements HighApproveService { if (MapUtils.getInteger(map, "objectId") != null) { criteria.andObjectTypeEqualTo(MapUtils.getInteger(map, "objectId")); } + if (MapUtils.getInteger(map, "companyId") != null) { + criteria.andExt1EqualTo(MapUtils.getString(map, "companyId")); + } if (MapUtils.getString(map, "objectName") != null) { criteria.andObjectNameLike("%" + MapUtils.getString(map, "objectName") + "%"); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java index 5d56d5c2..1d18959a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java @@ -329,7 +329,7 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { if (coupon.getCouponSource().equals(4)) { // 推送给汇联通 JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(childOrder.getChannelOrderNo()); - if (returnParam != null && returnParam.getString("respCode").equals("0000")) { + if (returnParam.getString("respCode").equals("0000")) { // 解密 JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data")); JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class); @@ -362,10 +362,10 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { } } else if (coupon.getCouponSource().equals(5)) { // 预发码 - JSONObject preSendCoupon = ChongQingCNPCService.preSendCoupon(coupon.getCouponKey(), order.getOrderNo(), childOrder.getSaleCount(), order.getMemPhone()); + JSONObject preSendCoupon = ChongQingCNPCService.preSendCoupon(coupon.getCouponKey(), childOrder.getChildOrderNo(), childOrder.getSaleCount(), order.getMemPhone()); if (preSendCoupon.getInteger("status").equals(1)) { // 给用户发码 - JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), childOrder.getSaleCount(), order.getMemPhone()); + JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), childOrder.getChildOrderNo(), childOrder.getSaleCount(), order.getMemPhone()); JSONObject couponDetail = response.getJSONObject("ticketDetail"); JSONArray codeList = response.getJSONArray("codeList"); for (Object data : codeList) { diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index 9833f215..bc31ef77 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -17,6 +17,7 @@ import com.hai.entity.*; import com.hai.enum_type.*; import com.hai.model.*; import com.hai.order.service.OrderService; +import com.hai.order.topic.OrderTopic; import com.hai.order.type.OrderChildStatus; import com.hai.order.type.OrderPayType; import com.hai.order.type.OrderRefundOpUserType; @@ -26,6 +27,7 @@ import com.hai.service.*; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -50,6 +52,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { @Resource private OutRechargeOrderMapper outRechargeOrderMapper; + @Resource + private RocketMQTemplate rocketMQTemplate; + @Resource private OutRechargeOrderMapperExt outRechargeOrderMapperExt; @@ -395,7 +400,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } @Override - public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) throws Exception { + public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) { JSONObject object = new JSONObject(); object.put("rechargePrice" , outRechargeOrder.getRechargePrice()); @@ -427,46 +432,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { childOrder.setUpdateTime(new Date()); childOrder.setCreateTime(new Date()); - // 尖椒充值 - if (object.getInteger("rechargePlatform") == 1) { - object.put("out_order_id", childOrder.getOrderNo()); - object.put("amount", object.getBigDecimal("rechargePrice")); - object.put("mobile", object.getString("rechargeMobile")); - object.put("notifyUrl", CommonSysConst.getSysConfig().getJjNotifyUrl()); - JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object); - childOrder.setExt1(returnObject.toJSONString()); - } - - // 龙阅 - if (object.getInteger("rechargePlatform") == 2) { - - if (object.getString("code") == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - - object.put("out_trade_num", childOrder.getOrderNo()); - object.put("product_id", object.getString("code")); - object.put("mobile", object.getString("rechargeMobile")); - object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl()); - JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); - childOrder.setExt1(returnObject.toJSONString()); - } - - // 畅停充值 - if (object.getInteger("rechargePlatform") == 4) { - - if (object.getString("code") == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - - object.put("orderid", childOrder.getOrderNo()); - object.put("product_id", object.getString("code")); - object.put("phone", object.getString("rechargeMobile")); - object.put("price", object.getBigDecimal("rechargePrice")); - JSONObject returnObject = RechargeConfig.rechargeOrderByHg(object); - childOrder.setExt1(returnObject.toJSONString()); - } outRechargeChildOrderService.insertOrder(childOrder); + rocketMQTemplate.syncSend(OrderTopic.MOBILE_TOPIC_PROFIT_RECHARGE.getTopic(), childOrder); } @Override @@ -483,7 +450,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { // 加锁成功,处理业务 // 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成 int orderStatus = orderWhetherRecharge(outRechargeOrder); - + log.info("处理话费" + outRechargeOrder.getOrderNo() + "订单状态:" + orderStatus); if (orderStatus == 1) { getPrepaidRechargeApi(outRechargeOrder); } @@ -583,67 +550,73 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } @Override - public Integer getRechargeOrderLegality(OutRechargeChildOrder childOrder) throws Exception { + public Integer getRechargeOrderLegality(OutRechargeChildOrder childOrder) { - JSONObject object = new JSONObject(); - // 龙阅 - if (childOrder.getRechargePlatform() == 2) { + try { + JSONObject object = new JSONObject(); + // 龙阅 + if (childOrder.getRechargePlatform() == 2) { - object.put("out_trade_nums" , childOrder.getOrderNo()); + object.put("out_trade_nums" , childOrder.getOrderNo()); - JSONObject jsonObject = RechargeConfig.checkOrderByLy(object); + JSONObject jsonObject = RechargeConfig.checkOrderByLy(object); - JSONArray objectJSONArray = jsonObject.getJSONArray("data"); - JSONObject objectData = new JSONObject(); - for (Object objects : objectJSONArray) { - objectData = (JSONObject) objects; - } - if (objectData.size() == 0) { - if (jsonObject.getInteger("errno") == 0) { - return 2; - } else { - return 99; - } - } else { - // -1取消,0充值中 ,1充值成功,2充值失败,3部分成功 - return objectData.getInteger("state"); - } - - } - // 畅停 - if (childOrder.getRechargePlatform() == 4) { - object.put("orderid" , childOrder.getOrderNo()); - - JSONObject jsonObject = RechargeConfig.checkOrderByHg(object); - if (jsonObject.getJSONArray("data") == null) { - if (jsonObject.getInteger("code") == 20001) { - return 2; - } - return 99; - } else { JSONArray objectJSONArray = jsonObject.getJSONArray("data"); - JSONObject objectData; + JSONObject objectData = new JSONObject(); for (Object objects : objectJSONArray) { objectData = (JSONObject) objects; - // 0充值中,1成功,2失败,3已取消,4部分充值,5缓存订单 + } + if (objectData.size() == 0) { + if (jsonObject.getInteger("errno") == 0) { + return 2; + } else { + return 99; + } + } else { // -1取消,0充值中 ,1充值成功,2充值失败,3部分成功 + return objectData.getInteger("state"); + } + + } + // 畅停 + if (childOrder.getRechargePlatform() == 4) { + object.put("orderid" , childOrder.getOrderNo()); - if (objectData.getInteger("status") == 0 || objectData.getInteger("status") == 5) { - return 0; - } else if (objectData.getInteger("status") == 1) { - return 1; - } else if (objectData.getInteger("status") == 2) { + JSONObject jsonObject = RechargeConfig.checkOrderByHg(object); + if (jsonObject.getJSONArray("data") == null) { + if (jsonObject.getInteger("code") == 20001) { return 2; - } else if (objectData.getInteger("status") == 3) { - return -1; - } else if (objectData.getInteger("status") == 4) { - return 3; } + return 99; + } else { + JSONArray objectJSONArray = jsonObject.getJSONArray("data"); + JSONObject objectData; + for (Object objects : objectJSONArray) { + objectData = (JSONObject) objects; + // 0充值中,1成功,2失败,3已取消,4部分充值,5缓存订单 + // -1取消,0充值中 ,1充值成功,2充值失败,3部分成功 + + if (objectData.getInteger("status") == 0 || objectData.getInteger("status") == 5) { + return 0; + } else if (objectData.getInteger("status") == 1) { + return 1; + } else if (objectData.getInteger("status") == 2) { + return 2; + } else if (objectData.getInteger("status") == 3) { + return -1; + } else if (objectData.getInteger("status") == 4) { + return 3; + } + } } } + return 99; + }catch (Exception e) { + return null; } - return 99; + + } // 获取当前最新的充值平台 @@ -664,7 +637,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { * @Param [object] * @Return com.alibaba.fastjson.JSONObject */ - private JSONObject prepaidRechargeOrderHandle(JSONObject object) { + + @Override + public JSONObject prepaidRechargeOrderHandle(JSONObject object) { if (object.getLong("productId") == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "产品编码为空"); @@ -711,7 +686,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } @Override - public Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder) throws Exception { + public Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder) { // 查询子订单 List childOrderList = outRechargeChildOrderService.getListRechargeChildOrderByOrderId(rechargeOrder.getId()); diff --git a/v1/src/main/java/com/v1/controller/orderController.java b/v1/src/main/java/com/v1/controller/orderController.java index f944c1b3..18c4e866 100644 --- a/v1/src/main/java/com/v1/controller/orderController.java +++ b/v1/src/main/java/com/v1/controller/orderController.java @@ -423,6 +423,23 @@ public class orderController { } } + @RequestMapping(value = "/test", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "对外订单退款接口") + public ResponseData test() { + try { + + System.out.println("话费请求订单================================="); + + Thread.currentThread().sleep(30000); + + return ResponseMsgUtil.success("请求成功!"); + + } catch (Exception e) { + log.error("HighOpenApiController --> createOrder() error!", e); + return ResponseMsgUtil.exception(e); + } + } }