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 958f51c4..c8632979 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java @@ -172,7 +172,7 @@ public class HighApproveController { Map map = new HashMap<>(); map.put("approveSerialNo", approveSerialNo); map.put("objectType", objectType); - if (objectType == 4) { + if (objectType != null && objectType == 4) { map.put("companyId", userInfoModel.getBsCompany().getId()); } map.put("objectId", objectId); 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 6c4fc7bf..fb427cb6 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.openApi.config.BlxConfig; import com.hai.openApi.service.ApiBlxCouponService; 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 ApiBlxCouponService apiBlxCouponService; @Resource private BlxConfig blxConfig; @Resource private CommonService commonService; @Resource private OrderService orderService; @Resource private HighOrderService highOrderService; @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 = "/getHuiLianTongCardByCardNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据卡号查询汇联通工会卡详情") public ResponseData getHuiLianTongCardByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) { try { // 查询工会卡 JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(cardNo); JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); return ResponseMsgUtil.success(resolveResponse); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/consumption", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡支付") public ResponseData consumption(@RequestParam(name = "payRealPrice", required = true) BigDecimal payRealPrice, @RequestParam(name = "cardNo", required = true) String cardNo) { try { String goodsDesc = ""; String tranDesc = ""; String instCode = "11101527"; String businessType = "hisen_consume"; // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(OrderUtil.generateOrderNo(), cardNo, payRealPrice, businessType, instCode, goodsDesc, tranDesc); if (!consumption.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } // 响应参数 JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); if (consumptionResult.getBoolean("success") != true) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); } return ResponseMsgUtil.success(consumptionResult); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() 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 { Map map = new HashMap<>(); map.put("organizeCode" , "dhy"); JSONObject object = HttpsUtils.doGet("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/generateJwt" , map); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "qureyCouponPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData qureyCouponPage() { try { JSONObject object = blxConfig.queryCouponPage(); if (object.getInteger("code") == 1) { JSONArray jsonArray = object.getJSONObject("data").getJSONArray("records"); for (int i = 0; i < jsonArray.size(); i++) { if (jsonArray.getJSONObject(i).getString("couponCode") != null) { ApiBlxCoupon apiBlxCoupon = apiBlxCouponService.findBlxCoupon(jsonArray.getJSONObject(i).getString("couponCode")); if (apiBlxCoupon == null) { apiBlxCoupon = new ApiBlxCoupon(); apiBlxCoupon.setCouponCode(jsonArray.getJSONObject(i).getString("couponCode")); apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); apiBlxCoupon.setCreateTime(new Date()); apiBlxCoupon.setCouponName(jsonArray.getJSONObject(i).getString("couponName")); apiBlxCoupon.setDenomination(jsonArray.getJSONObject(i).getInteger("denomination")); apiBlxCoupon.setUpdateTime(new Date()); apiBlxCoupon.setMinPrice(jsonArray.getJSONObject(i).getInteger("minPrice")); apiBlxCoupon.setUseStartTime(jsonArray.getJSONObject(i).getDate("useStartTime")); apiBlxCoupon.setUseEndTime(jsonArray.getJSONObject(i).getDate("useEndTime")); apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); apiBlxCoupon.setReceiveDays(jsonArray.getJSONObject(i).getInteger("receiveDays")); apiBlxCoupon.setReceiveLimit(jsonArray.getJSONObject(i).getInteger("receiveLimit")); apiBlxCouponService.insertBlxCoupon(apiBlxCoupon); } else { apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); apiBlxCoupon.setCouponName(jsonArray.getJSONObject(i).getString("couponName")); apiBlxCoupon.setDenomination(jsonArray.getJSONObject(i).getInteger("denomination")); apiBlxCoupon.setUpdateTime(new Date()); apiBlxCoupon.setMinPrice(jsonArray.getJSONObject(i).getInteger("minPrice")); apiBlxCoupon.setUseStartTime(jsonArray.getJSONObject(i).getDate("useStartTime")); apiBlxCoupon.setUseEndTime(jsonArray.getJSONObject(i).getDate("useEndTime")); apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); apiBlxCoupon.setReceiveDays(jsonArray.getJSONObject(i).getInteger("receiveDays")); apiBlxCoupon.setReceiveLimit(jsonArray.getJSONObject(i).getInteger("receiveLimit")); apiBlxCouponService.editBlxCoupon(apiBlxCoupon); } } } } return ResponseMsgUtil.success(apiBlxCouponService.getBlxCouponList(new HashMap<>())); } 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.openApi.config.BlxConfig; import com.hai.openApi.service.ApiBlxCouponService; 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 ApiBlxCouponService apiBlxCouponService; @Resource private BlxConfig blxConfig; @Resource private CommonService commonService; @Resource private OrderService orderService; @Resource private HighOrderService highOrderService; @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 = "/getHuiLianTongCardByCardNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据卡号查询汇联通工会卡详情") public ResponseData getHuiLianTongCardByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) { try { // 查询工会卡 JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(cardNo); JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); return ResponseMsgUtil.success(resolveResponse); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/consumption", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡支付") public ResponseData consumption(@RequestParam(name = "payRealPrice", required = true) BigDecimal payRealPrice, @RequestParam(name = "cardNo", required = true) String cardNo) { try { String goodsDesc = ""; String tranDesc = ""; String instCode = "11101527"; String businessType = "hisen_consume"; // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(OrderUtil.generateOrderNo(), cardNo, payRealPrice, businessType, instCode, goodsDesc, tranDesc); if (!consumption.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } // 响应参数 JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); if (consumptionResult.getBoolean("success") != true) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); } return ResponseMsgUtil.success(consumptionResult); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() 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 { Map map = new HashMap<>(); map.put("organizeCode" , "dhy"); JSONObject object = HttpsUtils.doGet("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/generateJwt" , map); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "qureyCouponPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData qureyCouponPage() { try { JSONObject object = blxConfig.queryCouponPage(); if (object.getInteger("code") == 1) { JSONArray jsonArray = object.getJSONObject("data").getJSONArray("records"); for (int i = 0; i < jsonArray.size(); i++) { if (jsonArray.getJSONObject(i).getString("couponCode") != null) { ApiBlxCoupon apiBlxCoupon = apiBlxCouponService.findBlxCoupon(jsonArray.getJSONObject(i).getString("couponCode")); if (apiBlxCoupon == null) { apiBlxCoupon = new ApiBlxCoupon(); apiBlxCoupon.setCouponCode(jsonArray.getJSONObject(i).getString("couponCode")); apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); apiBlxCoupon.setCreateTime(new Date()); apiBlxCoupon.setCouponName(jsonArray.getJSONObject(i).getString("couponName")); apiBlxCoupon.setDenomination(jsonArray.getJSONObject(i).getInteger("denomination")); apiBlxCoupon.setUpdateTime(new Date()); apiBlxCoupon.setMinPrice(jsonArray.getJSONObject(i).getInteger("minPrice")); apiBlxCoupon.setUseStartTime(jsonArray.getJSONObject(i).getDate("useStartTime")); apiBlxCoupon.setUseEndTime(jsonArray.getJSONObject(i).getDate("useEndTime")); apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); apiBlxCoupon.setReceiveDays(jsonArray.getJSONObject(i).getInteger("receiveDays")); apiBlxCoupon.setReceiveLimit(jsonArray.getJSONObject(i).getInteger("receiveLimit")); apiBlxCouponService.insertBlxCoupon(apiBlxCoupon); } else { apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); apiBlxCoupon.setCouponName(jsonArray.getJSONObject(i).getString("couponName")); apiBlxCoupon.setDenomination(jsonArray.getJSONObject(i).getInteger("denomination")); apiBlxCoupon.setUpdateTime(new Date()); apiBlxCoupon.setMinPrice(jsonArray.getJSONObject(i).getInteger("minPrice")); apiBlxCoupon.setUseStartTime(jsonArray.getJSONObject(i).getDate("useStartTime")); apiBlxCoupon.setUseEndTime(jsonArray.getJSONObject(i).getDate("useEndTime")); apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); apiBlxCoupon.setReceiveDays(jsonArray.getJSONObject(i).getInteger("receiveDays")); apiBlxCoupon.setReceiveLimit(jsonArray.getJSONObject(i).getInteger("receiveLimit")); apiBlxCouponService.editBlxCoupon(apiBlxCoupon); } } } } return ResponseMsgUtil.success(apiBlxCouponService.getBlxCouponList(new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "sendCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "停车券发券") public ResponseData sendCoupon() { try { JSONObject jsonObject = new JSONObject(); jsonObject.put("couponCode" , "16881066428954950"); jsonObject.put("receiverPhone" , "18090580471"); jsonObject.put("receiverCount" , "1"); JSONObject object = blxConfig.sendCoupon(jsonObject); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "getUserCouponPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取用户卡券") public ResponseData getUserCouponPage(@RequestParam(name = "phone", required = true) String phone) { try { JSONObject jsonObject = new JSONObject(); jsonObject.put("userMobile" , phone); JSONObject object = blxConfig.getUserCouponPage(jsonObject); int num = 0; if (object.getInteger("code") == 1) { num = object.getJSONObject("data").getInteger("total"); } return ResponseMsgUtil.success(num); } 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/HighCouponController.java b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java index eeb02db6..6239eb89 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -77,7 +77,7 @@ public class HighCouponController { @RequestMapping(value = "/getCouponList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "卡卷列表") - public ResponseData getCouponList(@RequestParam(name = "regionId", required = true) String regionId, + public ResponseData getCouponList(@RequestParam(name = "companyId", required = true) String companyId, @RequestParam(name = "merchantId", required = false) Long merchantId, @RequestParam(name = "couponName", required = false) String couponName, @RequestParam(name = "couponType", required = false) Integer couponType, @@ -88,25 +88,18 @@ public class HighCouponController { @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { - SecRegion region = commonService.getParentByRegion(Long.parseLong(regionId)); - if (region != null) { - BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); - if (bsCompany != null) { - Map map = new HashMap<>(); - map.put("companyId", bsCompany.getId()); - map.put("merchantId", merchantId); - map.put("couponName", couponName); - map.put("couponType", couponType); - map.put("brandId", brandId); - map.put("goodsTypeId", goodsTypeId); - map.put("displayArea", displayArea); - map.put("notCouponSource", 2); - map.put("status", 2); - PageHelper.startPage(pageNum, pageSize); - return ResponseMsgUtil.success(new PageInfo<>(highCouponService.getCouponList(map))); - } - } - return ResponseMsgUtil.success(new PageInfo<>()); + Map map = new HashMap<>(); + map.put("companyId", companyId); + map.put("merchantId", merchantId); + map.put("couponName", couponName); + map.put("couponType", couponType); + map.put("brandId", brandId); + map.put("goodsTypeId", goodsTypeId); + map.put("displayArea", displayArea); + map.put("notCouponSource", 2); + map.put("status", 2); + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highCouponService.getCouponList(map))); } catch (Exception e) { log.error("HighCouponController -> getCouponList() error!", e); diff --git a/hai-order/src/main/java/com/web/controller/OrderPayController.java b/hai-order/src/main/java/com/web/controller/OrderPayController.java index e2a6fc0e..698f2f7c 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -26,6 +26,7 @@ import com.hai.order.service.OrderService; import com.hai.order.service.OrderPayService; import com.hai.order.type.OrderProductType; import com.hai.order.type.OrderStatus; +import com.hai.order.type.PlatformType; import com.hai.service.*; import com.web.config.SysConst; import io.swagger.annotations.Api; @@ -50,6 +51,7 @@ import java.util.concurrent.ThreadLocalRandom; /** * 订单支付 + * * @className: OrderPayController * @author: HuRui * @date: 2022/8/30 @@ -103,7 +105,7 @@ public class OrderPayController { @Resource private SecConfigService secConfigService; - @RequestMapping(value="/wechatPay",method = RequestMethod.POST) + @RequestMapping(value = "/wechatPay", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "微信支付") public ResponseData wechatPay(@RequestBody JSONObject body) { @@ -112,9 +114,9 @@ public class OrderPayController { System.out.println("微信支付===================" + body); if (body == null - || StringUtils.isBlank(body.getString("orderNo")) - // || body.getInteger("openIdType") == null - || StringUtils.isBlank(body.getString("openId")) + || StringUtils.isBlank(body.getString("orderNo")) + // || body.getInteger("openIdType") == null + || StringUtils.isBlank(body.getString("openId")) ) { log.error("wxPay error!", "参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -122,7 +124,7 @@ public class OrderPayController { // 查询订单 HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); - if(!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { + if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { log.error("wxPay ERROR", "订单不处于待支付状态"); throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); } @@ -138,10 +140,18 @@ public class OrderPayController { WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo(); weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxPayMchAppId()); // 公众号id weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxPayMchId()); // 商户号 - if (openIdType != null && openIdType.equals(2)) { - weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_HSG_MP); // 商户号公众号 + if (PlatformType.TYPE2.getNumber().equals(body.getInteger("platformType"))) { + if (openIdType != null && openIdType.equals(2)) { + weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_QYX_MP); // 商户号公众号 + } else { + weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_QYX_MINI); // 嗨森逛小程序 + } } else { - weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_HSG_MINI); // 嗨森逛小程序 + if (openIdType != null && openIdType.equals(2)) { + weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_HSG_MP); // 商户号公众号 + } else { + weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_HSG_MINI); // 嗨森逛小程序 + } } // 订单产品类型 @@ -150,132 +160,149 @@ public class OrderPayController { orderTitle = productType.getName(); } - if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE1.getNumber())) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); - } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE2.getNumber())) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); + if (PlatformType.TYPE2.getNumber().equals(body.getInteger("platformType"))) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1648729281); + } else { + if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE1.getNumber())) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); - } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE3.getNumber())) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE2.getNumber())) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); - } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE4.getNumber())) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE3.getNumber())) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); - } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) { - HighCoupon coupon = couponService.getCouponById(order.getHighChildOrderList().get(0).getGoodsId()); - if (coupon.getCouponSource() != null && coupon.getCouponSource().equals(4)) { - // GZ_SINOPEC_QUOTA 单日限购数量 - SecConfig gzSinopecQuota = secConfigService.findByCodeType("GZ_SINOPEC_QUOTA"); - if (gzSinopecQuota != null - && couponService.userBuySourceLimitNumber(order.getMemId(),4) >= Integer.parseInt(gzSinopecQuota.getCodeValue())) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,已达单日限购数量"); - } - if (order.getMemDiscountId() != null) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); - } else { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1634835264); - } - } else { + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE4.getNumber())) { weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); - } - } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { - // 查询油站 - HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); - if (store == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油站"); - } - if (store.getPrestoreType().equals(1)) { - if (order.getTotalPrice().compareTo(gasService.getMerPriceByMerId(store.getMerchantId())) == 1) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) { + HighCoupon coupon = couponService.getCouponById(order.getHighChildOrderList().get(0).getGoodsId()); + if (coupon.getCouponSource() != null && coupon.getCouponSource().equals(4)) { + // GZ_SINOPEC_QUOTA 单日限购数量 + SecConfig gzSinopecQuota = secConfigService.findByCodeType("GZ_SINOPEC_QUOTA"); + if (gzSinopecQuota != null + && couponService.userBuySourceLimitNumber(order.getMemId(), 4) >= Integer.parseInt(gzSinopecQuota.getCodeValue())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,已达单日限购数量"); + } + if (order.getMemDiscountId() != null) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); + } else { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1634835264); + } + } else { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); + } + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) { + HighCoupon coupon = couponService.getCouponById(order.getHighChildOrderList().get(0).getGoodsId()); + if (coupon.getCouponSource() != null && coupon.getCouponSource().equals(4)) { + if (order.getMemDiscountId() != null) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); + } else { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1634835264); + } + } else { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); } - } - if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { - // 查询支付配置 - HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1, GasChannelPayPlatformType.type1 ); - if (gasChannelConfig == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { + // 查询油站 + HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油站"); } - weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); - profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; - - if (store.getSourceType().equals(1)) { - // 预存类型 0:非预存 1:预存门店 - if (store.getPrestoreType().equals(0)) { - // 第三方平台 - HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId(), 1); - if (merTripartitePlatform != null) { - weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); - // 是否分账 - profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true)?"Y":"N"; - } + if (store.getPrestoreType().equals(1)) { + if (order.getTotalPrice().compareTo(gasService.getMerPriceByMerId(store.getMerchantId())) == 1) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); } } - } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { + if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1, GasChannelPayPlatformType.type1); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + if (store.getSourceType().equals(1)) { + // 预存类型 0:非预存 1:预存门店 + if (store.getPrestoreType().equals(0)) { + // 第三方平台 + HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId(), 1); + if (merTripartitePlatform != null) { + weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); + // 是否分账 + profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true) ? "Y" : "N"; + } + } + } - // 查询支付配置 - HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2,GasChannelPayPlatformType.type1 ); - if (gasChannelConfig == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); - } - weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); - profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; + } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { - } else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2, GasChannelPayPlatformType.type1); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; - // 查询支付配置 - HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3,GasChannelPayPlatformType.type1 ); - if (gasChannelConfig == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); - } - weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); - profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; + } else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { - } else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { - // 查询支付配置 - HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4,GasChannelPayPlatformType.type1 ); - if (gasChannelConfig == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); - } - weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); - profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3, GasChannelPayPlatformType.type1); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4, GasChannelPayPlatformType.type1); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type5.getNumber())) { + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type5, GasChannelPayPlatformType.type1); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; - } else if (store.getSourceType().equals(MerchantStoreSourceType.type5.getNumber())) { - // 查询支付配置 - HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type5,GasChannelPayPlatformType.type1 ); - if (gasChannelConfig == null) { + } else { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); } - weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); - profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; - } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); - } - - } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE7.getNumber())) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE7.getNumber())) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); - } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE8.getNumber())) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1619676214); + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE8.getNumber())) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1619676214); - } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); - } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); - }else { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1609882817); + } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); + } else { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1609882817); + } } + // weChatPayReqInfo.setOpenid(openId); weChatPayReqInfo.setSub_openid(body.getString("openId")); weChatPayReqInfo.setNonce_str(nonce_str); // 随机字符串 - weChatPayReqInfo.setBody(orderTitle); // 商品描述 - weChatPayReqInfo.setOut_trade_no(order.getOrderNo()); // 商户订单号 + weChatPayReqInfo.setBody(orderTitle); // 商品描述 + weChatPayReqInfo.setOut_trade_no(order.getOrderNo()); // 商户订单号 weChatPayReqInfo.setTotal_fee(total_fee); // 总金额 weChatPayReqInfo.setSpbill_create_ip("122.9.135.148"); // 终端ip weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getWxPayNotifyUrl()); // 通知url @@ -286,11 +313,11 @@ public class OrderPayController { weChatPayReqInfo.setTime_expire(DateUtil.date2String(DateUtil.addMinute(order.getCreateTime(), 10), "yyyyMMddHHmmss")); //附加数据,区分订单类型 - Map payMap = new HashMap<>(); + Map payMap = new HashMap<>(); payMap.put("app_id", weChatPayReqInfo.getSub_appid()); payMap.put("api_key", SysConst.getSysConfig().getWxPayApiKey()); payMap.put("unified_order_url", SysConst.getSysConfig().getWxPayUnifiedOrderUrl()); - SortedMap sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap); + SortedMap sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo, payMap); order.setAccountMerchantNum(weChatPayReqInfo.getSub_mch_id()); order.setProfitSharingStatus(profitSharing.equals("Y")); @@ -299,12 +326,12 @@ public class OrderPayController { return ResponseMsgUtil.success(sortedMap); } catch (Exception e) { - log.error("OrderController -> create() error!",e); + log.error("OrderController -> create() error!", e); return ResponseMsgUtil.exception(e); } } - @RequestMapping(value="/cardPay",method = RequestMethod.POST) + @RequestMapping(value = "/cardPay", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "卡支付") public ResponseData cardPay(@RequestBody JSONObject body) { @@ -347,7 +374,7 @@ public class OrderPayController { } // 查询订单 HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); - if(!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { + if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { log.error("OrderController --> cardPay() ERROR", "订单不处于待支付状态"); throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); } @@ -369,7 +396,7 @@ public class OrderPayController { } } catch (Exception e) { - log.error("OrderPayController -> cardPay() error!",e); + log.error("OrderPayController -> cardPay() error!", e); return ResponseMsgUtil.exception(e); } } @@ -487,7 +514,7 @@ public class OrderPayController { } }*/ - @RequestMapping(value="/unionPay",method = RequestMethod.POST) + @RequestMapping(value = "/unionPay", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "银联支付") public ResponseData unionPay(@RequestBody JSONObject body, HttpServletRequest request) { @@ -498,11 +525,11 @@ public class OrderPayController { } HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); - if(order == null) { + if (order == null) { log.error("OrderController --> orderToPay() ERROR", "未找到订单信息"); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); } - if(!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { + if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { log.error("OrderController --> orderToPay() ERROR", "订单不处于待支付状态"); throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); } diff --git a/hai-order/src/main/resources/dev/logback.xml b/hai-order/src/main/resources/dev/logback.xml index eb4dc1eb..8a5d6cc6 100644 --- a/hai-order/src/main/resources/dev/logback.xml +++ b/hai-order/src/main/resources/dev/logback.xml @@ -175,4 +175,25 @@ + + log/blxLog.log + + log/blxLog/blxLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + diff --git a/hai-order/src/main/resources/prod/logback.xml b/hai-order/src/main/resources/prod/logback.xml index 550c4194..d448a3ab 100644 --- a/hai-order/src/main/resources/prod/logback.xml +++ b/hai-order/src/main/resources/prod/logback.xml @@ -195,4 +195,24 @@ + + log/blxLog.log + + log/blxLog/blxLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + diff --git a/hai-service/src/main/java/com/hai/config/CmsContentConfig.java b/hai-service/src/main/java/com/hai/config/CmsContentConfig.java index 826681bc..bce01f06 100644 --- a/hai-service/src/main/java/com/hai/config/CmsContentConfig.java +++ b/hai-service/src/main/java/com/hai/config/CmsContentConfig.java @@ -41,7 +41,7 @@ public class CmsContentConfig { map.put("status" , 1); PageHelper.startPage(1, 3); return new PageInfo<>( highDiscountPackageService.getDiscountPackageList(map)).getList(); - } else if (CmsContentDataEnum.REFUEL.getName().equals(title) || CmsContentDataEnum.INTEGRAL.getName().equals(title) || CmsContentDataEnum.UNION_CARD.getName().equals(title)){ + } else if (CmsContentDataEnum.REFUEL.getName().equals(title) || CmsContentDataEnum.INTEGRAL.getName().equals(title) || CmsContentDataEnum.UNION_CARD.getName().equals(title) || CmsContentDataEnum.BLX_COUPON.getName().equals(title)){ map.put("companyId", companyId); map.put("displayArea", CmsContentDataEnum.getTypeByName(title)); map.put("notCouponSource", 2); diff --git a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java index 176130ea..73b52722 100644 --- a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java +++ b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java @@ -136,4 +136,6 @@ public class CommonSysConfig { private String payPostUrl; private String filesystem; + private String blxPostUrl; + } diff --git a/hai-service/src/main/java/com/hai/config/WxOrderConfig.java b/hai-service/src/main/java/com/hai/config/WxOrderConfig.java index 5841937c..ccdb8e00 100644 --- a/hai-service/src/main/java/com/hai/config/WxOrderConfig.java +++ b/hai-service/src/main/java/com/hai/config/WxOrderConfig.java @@ -74,6 +74,12 @@ public class WxOrderConfig { */ public static final String MCH_ID_1624126902 = "1624126902"; + /** + * 微信支付商户号 + * 贵州紫凌电子商务有限公司 + */ + public static final String MCH_ID_1648729281 = "1648729281"; + /** * 嗨森逛公众号APPID */ @@ -83,6 +89,15 @@ public class WxOrderConfig { * 嗨森逛小程序APPID */ public static final String APPID_HSG_MINI = "wx8d49e2f83025229d"; + /** + * 黔印象公众号APPID + */ + public static final String APPID_QYX_MP = "wxf846cf24e87420a2"; + + /** + * 黔印象小程序APPID + */ + public static final String APPID_QYX_MINI = "wx5e0cac96ea91c01f"; public static OrderRefundModel orderToRefund(String paySerialNo,BigDecimal totalFee,BigDecimal refundFee) throws Exception { diff --git a/hai-service/src/main/java/com/hai/entity/ApiMchProduct.java b/hai-service/src/main/java/com/hai/entity/ApiMchProduct.java index fd7d8dec..63de65ff 100644 --- a/hai-service/src/main/java/com/hai/entity/ApiMchProduct.java +++ b/hai-service/src/main/java/com/hai/entity/ApiMchProduct.java @@ -20,7 +20,7 @@ public class ApiMchProduct implements Serializable { private Long id; /** - * 产品类型 1:星巴克 2:肯德基 3:会员充值 4:积分充值 5:购买卡券 6:加油服务 7:优惠券包 8:汇联通充值 9:话费充值 + * 产品类型 1:星巴克 2:肯德基 3:会员充值 4:积分充值 5:购买卡券 6:加油服务 7:优惠券包 8:汇联通充值 9:话费充值 12:实物产品 */ private Integer productType; @@ -239,4 +239,4 @@ public class ApiMchProduct 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/CmsContentDataEnum.java b/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java index c631426b..2c46b2a7 100644 --- a/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java +++ b/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java @@ -17,6 +17,7 @@ public enum CmsContentDataEnum { PREFERABLY(4 , "优选商品"), UNION_CARD(5 , "工会卡专区"), DISCOUNT(6 , "天天好券"), + BLX_COUPON(7 , "停车券专区"), MSG(90 , "消息通知"), ; diff --git a/hai-service/src/main/java/com/hai/model/UserModel.java b/hai-service/src/main/java/com/hai/model/UserModel.java index 962f334f..806e1587 100644 --- a/hai-service/src/main/java/com/hai/model/UserModel.java +++ b/hai-service/src/main/java/com/hai/model/UserModel.java @@ -17,6 +17,9 @@ public class UserModel { // 未使用优惠券数量 private Integer unusedDiscount; + // 停车券余额 + private Integer blxCouponBalance; + // 待支付数量 private Long unpaid; @@ -157,4 +160,12 @@ public class UserModel { public void setOrderPayNum(Long orderPayNum) { this.orderPayNum = orderPayNum; } + + public Integer getBlxCouponBalance() { + return blxCouponBalance; + } + + public void setBlxCouponBalance(Integer blxCouponBalance) { + this.blxCouponBalance = blxCouponBalance; + } } diff --git a/hai-service/src/main/java/com/hai/openApi/config/BlxConfig.java b/hai-service/src/main/java/com/hai/openApi/config/BlxConfig.java index 73e3787a..492c62b5 100644 --- a/hai-service/src/main/java/com/hai/openApi/config/BlxConfig.java +++ b/hai-service/src/main/java/com/hai/openApi/config/BlxConfig.java @@ -1,8 +1,13 @@ package com.hai.openApi.config; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.RedisUtil; +import com.hai.config.CommonSysConst; +import com.hai.config.HuiLianTongUnionCardConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -15,6 +20,8 @@ public class BlxConfig { @Resource private RedisUtil redisUtil; + private static Logger log = LoggerFactory.getLogger(BlxConfig.class); + /** * @Author Sum1Dream * @Name generateJw @@ -24,18 +31,20 @@ public class BlxConfig { * @Return java.lang.String */ public String generateJw() { + Object token = redisUtil.get("BlxToken"); if (token == null) { Map map = new HashMap<>(); map.put("organizeCode" , "dhy"); - + log.info("============ 比邻星停车券业务-获取TOKEN-START ============="); JSONObject object = HttpsUtils.doGet("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/generateJwt" , map); - + log.info("请求参数: " + map); + log.info("响应参数: " + object); + log.info("============ 比邻星停车券业务-获取TOKEN-END =============="); return object.getString("data"); - - } + return token.toString(); } @@ -48,7 +57,7 @@ public class BlxConfig { * @Return com.alibaba.fastjson.JSONObject */ public JSONObject queryCouponPage() { - + log.info("============ 比邻星停车券业务-获取比邻星停车券列表-START ============="); Map map = new HashMap<>(); map.put("rows" , "20"); map.put("currPage" , "1"); @@ -56,10 +65,14 @@ public class BlxConfig { Map header = new HashMap<>(); header.put("token" , generateJw()); - return HttpsUtils.doPost("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/qureyCouponPage" , map , header); + JSONObject object = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/admin/api/qureyCouponPage" , map , header); + log.info("头部参数: " + header); + log.info("请求参数: " + map); + log.info("响应参数: " + object); + log.info("============ 比邻星停车券业务-获取比邻星停车券列表-END =============="); + return object; } - /** * @Author Sum1Dream * @Name sendCoupon @@ -69,6 +82,7 @@ public class BlxConfig { * @Return com.alibaba.fastjson.JSONObject */ public JSONObject sendCoupon(JSONObject object) { + Map map = new HashMap<>(); map.put("couponCode" , object.getString("couponCode")); map.put("receiverPhone" , object.getString("receiverPhone")); @@ -76,8 +90,46 @@ public class BlxConfig { Map header = new HashMap<>(); header.put("token" , generateJw()); + log.info("============ 比邻星停车券业务-发放停车券-START ============="); + JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/admin/api/sendCupon" , map , header); + log.info("头部参数: " + header); + log.info("请求参数: " + map); + log.info("响应参数: " + data); + log.info("============ 比邻星停车券业务-发放停车券-END ============="); + return data; + + } + + /** + * @Author Sum1Dream + * @Name queryCouponPage + * @Description // 获取比邻星停车券列表 + * @Date 10:57 2023/7/11 + * @Param [] + * @Return com.alibaba.fastjson.JSONObject + */ + public JSONObject getUserCouponPage(JSONObject object) { + log.info("============ 比邻星停车券业务-获取用户未使用卡券列表-START ============="); + Map map = new HashMap<>(); + map.put("rows" , "2000"); + map.put("currPage" , "1"); + + JSONObject jsonObject = new JSONObject(); + + jsonObject.put("userMobile" , object.getString("userMobile")); + jsonObject.put("couponStatus" , 1); + map.put("data" , jsonObject); + + Map header = new HashMap<>(); + header.put("token" , generateJw()); + + JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/admin/api/getUserCouponPage" , map , header); + log.info("头部参数: " + header); + log.info("请求参数: " + map); + log.info("响应参数: " + data); + log.info("============ 比邻星停车券业务-获取比邻星停车券列表-END =============="); + return data; - return HttpsUtils.doPost("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/qureyCouponPage" , map , header); } } diff --git a/hai-service/src/main/java/com/hai/openApi/service/ApiOrderCreateHandleService.java b/hai-service/src/main/java/com/hai/openApi/service/ApiOrderCreateHandleService.java index 8fd6bd55..e0ca47d8 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/ApiOrderCreateHandleService.java +++ b/hai-service/src/main/java/com/hai/openApi/service/ApiOrderCreateHandleService.java @@ -68,4 +68,6 @@ public interface ApiOrderCreateHandleService { */ ApiOrder starbucksHandle(JSONObject object) throws Exception; + ApiOrder blxCouponHandle(JSONObject object) throws Exception; + } diff --git a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java index 85639311..8f8c333c 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java @@ -337,4 +337,18 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ } + + @Override + public ApiOrder blxCouponHandle(JSONObject object) throws Exception { + + // 获取下单内容 + JSONObject dataObject = JSONObject.parseObject(object.getString("content")); + + JSONArray dataArray = dataObject.getJSONArray("data"); + + // 查询api商户 + ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); + + return null; + } } diff --git a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java index 6bab5f0e..934dc356 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java @@ -203,6 +203,27 @@ public class ApiOrderServiceImpl implements ApiOrderService { orderService.createOrder(createOrderModel); } + // 处理话费充值订单 + if (OrderProductType.PRODUCT_TYPE13.getNumber().equals(object.getInteger("productType"))) { + apiOrder = orderCreateHandleService.mobileHandle(object); + + // 组装子订单内容 + CreateOrderChildModel createOrderChildModel = new CreateOrderChildModel(); + createOrderChildModel.setMemName(apiMerchants.getMerchantName()); + createOrderChildModel.setMemPhone(apiMerchants.getPhone()); + createOrderChildModel.setCompanyId(2L); + createOrderChildModel.setGoodsType(OrderChildGoodsType.TYPE6.getNumber()); + createOrderChildModel.setGoodsId(dataObject.getLong("productId")); + createOrderChildModel.setRechargeContent(dataObject.getString("mobile")); + createOrderChildModel.setSaleCount(1); + createOrderChildModel.setIsTyAgent(false); + createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice()); + + // 组装订单 + createOrderModel.getChildOrderList().add(createOrderChildModel); + orderService.createOrder(createOrderModel); + } + apiOrder.setOrderNo(createOrderModel.getOrderNo()); apiOrder.setStatus(1); 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 e397a3d7..ce407af6 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 @@ -173,7 +173,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { String childOrderNo = OrderUtil.generateChildOrderNo(); // 如果不是来源不是贵州中石化,需要校验库存 - if (!coupon.getCouponSource().equals(4) && !coupon.getCouponSource().equals(5)) { + if (!coupon.getCouponSource().equals(4) && !coupon.getCouponSource().equals(5) && !coupon.getCouponSource().equals(6)) { if (couponService.assignOrderStock(coupon.getId(), childOrderNo) == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "库存不足"); } 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 737cb600..05841ac1 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 @@ -459,15 +459,6 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { private void starbucksOrderHandle(String channelOrderNo) throws Exception { // 订单支付 QianZhuConfig.starbucksOrdersPay(channelOrderNo); - - // 推送订单记录 -// HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); -// highGasOrderPush.setType(OrderPushType.type8.getType()); -// highGasOrderPush.setOrderNo(order.getOrderNo()); -// highGasOrderPush.setCreateTime(new Date()); -// highGasOrderPush.setRequestContent(order.getOrderNo()); -// highGasOrderPush.setReturnContent(requestContent.toJSONString()); -// highGasOrderPushMapper.insert(highGasOrderPush); } /** diff --git a/hai-service/src/main/java/com/hai/order/type/OrderProductType.java b/hai-service/src/main/java/com/hai/order/type/OrderProductType.java index cd789016..0e027e41 100644 --- a/hai-service/src/main/java/com/hai/order/type/OrderProductType.java +++ b/hai-service/src/main/java/com/hai/order/type/OrderProductType.java @@ -21,6 +21,7 @@ public enum OrderProductType { PRODUCT_TYPE10(10, "电影票" ,"" , ""), PRODUCT_TYPE11(11, "贵州中石化" , "", "GZ_SINOPEC_CONFIG"), PRODUCT_TYPE12(12, "实物商品" , "orderLogo/goods.png", "GOODS"), + PRODUCT_TYPE13(13, "比邻星停车券" , "orderLogo/coupon.png", "BLX_COUPON"), PRODUCT_TYPE101(101, "惠支付" , "orderLogo/pay.png", "PAY"), PRODUCT_TYPE102(102, "门店活动" , "orderLogo/store_activity.png", "STORE_ACTIVITY"), ; diff --git a/hai-service/src/main/java/com/hai/order/type/PlatformType.java b/hai-service/src/main/java/com/hai/order/type/PlatformType.java new file mode 100644 index 00000000..db8b7cd2 --- /dev/null +++ b/hai-service/src/main/java/com/hai/order/type/PlatformType.java @@ -0,0 +1,46 @@ +package com.hai.order.type; + +import java.util.Objects; + +public enum PlatformType { + TYPE1(1, "嗨森逛"), + TYPE2(2, "黔印象"), + ; + + private Integer number; + + private String name; + + PlatformType(int number, String name) { + this.number = number; + this.name = name; + } + + /** + * 根据类型查询数据 + * @param type + * @return + */ + public static PlatformType getDataByType(Integer type) { + for (PlatformType ele : values()) { + if(Objects.equals(type,ele.getNumber())) return ele; + } + return null; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-service/src/main/java/com/hai/service/HighUserCardService.java b/hai-service/src/main/java/com/hai/service/HighUserCardService.java index 09de3c4b..8ddc5cff 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserCardService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserCardService.java @@ -73,4 +73,6 @@ public interface HighUserCardService { **/ HighUserCard getUserHtlCardNo(Long userId); + Integer getBlxCouponBalance(String phone); + } 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 1d18959a..d92ff85d 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 @@ -18,6 +18,10 @@ import com.hai.entity.*; import com.hai.enum_type.OrderPushType; import com.hai.model.GzSinopecModel; import com.hai.model.UserInfoModel; +import com.hai.openApi.config.BlxConfig; +import com.hai.openApi.service.ApiBlxCouponService; +import com.hai.order.service.OrderService; +import com.hai.order.type.OrderStatus; import com.hai.service.*; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -26,6 +30,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.*; /** @@ -57,9 +62,6 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { @Resource private HighCouponAgentService highCouponAgentService; - @Resource - private HighChildOrderMapper highChildOrderMapper; - @Resource private HighActivityInfoService activityInfoService; @@ -71,6 +73,15 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { highCouponCodeMapper.insert(highCouponCode); } + @Resource + private BlxConfig blxConfig; + + @Resource + private ApiBlxCouponService apiBlxCouponService; + + @Resource + private OrderService orderService; + @Override public void insertList(List list) throws Exception { for (HighCouponCode highCouponCode: list) { @@ -396,6 +407,40 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { highUserCouponService.insertUserCoupon(highUserCoupon); } } + } else if (coupon.getCouponSource().equals(6)) { + // 派发停车券 + ApiBlxCoupon apiBlxCoupon = apiBlxCouponService.findBlxCoupon(coupon.getCouponKey()); + if (apiBlxCoupon == null || apiBlxCoupon.getCouponStatus() != 1) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买"); + } + // 计算上送卡券数量 + int num = coupon.getSalesPrice().divide(new BigDecimal(apiBlxCoupon.getDenomination())).intValue(); + if (num > 0) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("couponCode" , coupon.getCouponKey()); + jsonObject.put("receiverPhone" , order.getMemPhone()); + jsonObject.put("receiverCount" , num); + + JSONObject object = blxConfig.sendCoupon(jsonObject); + + if (object.getInteger("code") == 1) { + order.setOrderStatus(OrderStatus.STATUS3.getNumber()); + order.setFinishTime(new Date()); + orderService.updateOrderData(order); + + // 卡卷关联用户 + HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setMerchantId(coupon.getMerchantId()); + highUserCoupon.setCouponId(coupon.getId()); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(childOrder.getId()); + highUserCoupon.setUserId(order.getMemId()); + highUserCoupon.setCreateTime(new Date()); + highUserCoupon.setUseEndTime(apiBlxCoupon.getUseEndTime()); + highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 + highUserCouponService.insertUserCoupon(highUserCoupon); + } + } } else { // 查询子订单的兑换码 HighCouponCode code = getCodeByChildOrderNo(childOrder.getChildOrderNo()); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java index 4350f3a5..667566d7 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java @@ -1,5 +1,6 @@ package com.hai.service.impl; +import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; @@ -12,6 +13,7 @@ import com.hai.entity.HighUserCardExample; import com.hai.enum_type.OilCardStatusEnum; import com.hai.enum_type.UserCardType; import com.hai.model.HighUserModel; +import com.hai.openApi.config.BlxConfig; import com.hai.service.HighFleetOilCardService; import com.hai.service.HighOilCardService; import com.hai.service.HighUserCardService; @@ -32,6 +34,10 @@ public class HighUserCardServiceImpl implements HighUserCardService { @Resource private UserCenter userCenter; + + @Resource + private BlxConfig blxConfig; + @Resource private HighOilCardService oilCardService; @@ -164,4 +170,25 @@ public class HighUserCardServiceImpl implements HighUserCardService { } return null; } + + @Override + public Integer getBlxCouponBalance(String phone) { + + if (phone == null) { + return 0; + } + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("userMobile" , phone); + + JSONObject object = blxConfig.getUserCouponPage(jsonObject); + + int num = 0; + + if (object.getInteger("code") == 1) { + num = object.getJSONObject("data").getInteger("total"); + } + + return num; + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index 0a0e730a..c126c291 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -18,6 +18,7 @@ import com.hai.enum_type.LoginPlatform; import com.hai.enum_type.OilCardBindStatusEnum; import com.hai.enum_type.UserCardType; import com.hai.model.HighUserModel; +import com.hai.openApi.config.BlxConfig; import com.hai.service.*; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -51,6 +52,7 @@ public class HighUserServiceImpl implements HighUserService { @Resource private HighUserCardService highUserCardService; + @Resource private HighOrderService highOrderService; @@ -125,6 +127,7 @@ public class HighUserServiceImpl implements HighUserService { } } user.setOpenIdH5(MapUtils.getString(other, "openIdH5")); + user.setOpenId(MapUtils.getString(other, "openId")); loginLog.setUserId(user.getId()); userLoginLogMapper.insert(loginLog); @@ -208,6 +211,7 @@ public class HighUserServiceImpl implements HighUserService { user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userId)); user.setIsSetHltCard(highUserCardService.isBindHtlCard(userId)); user.setHltCardNo(highUserCardService.getUserHtlCardNo(userId)); + user.setBlxCouponBalance(highUserCardService.getBlxCouponBalance(user.getPhone())); // 查询油卡 List oilCardList = highUserCardService.getListByUser(userId, UserCardType.type2.getType()); diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index c4895d86..5cd558a2 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -132,3 +132,4 @@ filesystem=https://hsgcs.dctpay.com/filesystem/ #payPostUrl=http://localhost:9601/crest/ # +blxPostUrl=https://vertical-formats-gateway.blx.bodata.cn:18443 diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index 826aac03..3848450e 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -119,3 +119,6 @@ wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 #PAY payPostUrl=https://pay.dctpay.com/crest/ filesystem=https://hsg.dctpay.com/filesystem/ + + +blxPostUrl=https://gateway.vf.bilinxing.com diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index 6e0f87b1..0aed1961 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -125,3 +125,6 @@ wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 #PAY payPostUrl=https://pay.dctpay.com/crest/ filesystem=https://hsg.dctpay.com/filesystem/ + + +blxPostUrl=https://gateway.vf.bilinxing.com diff --git a/hai-user/src/main/resources/dev/logback.xml b/hai-user/src/main/resources/dev/logback.xml index 8d23e06c..7b5dccdf 100644 --- a/hai-user/src/main/resources/dev/logback.xml +++ b/hai-user/src/main/resources/dev/logback.xml @@ -90,4 +90,24 @@ + + + log/blxLog.log + + log/blxLog/blxLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + diff --git a/hai-user/src/main/resources/prod/logback.xml b/hai-user/src/main/resources/prod/logback.xml index 0f091738..92a722c6 100644 --- a/hai-user/src/main/resources/prod/logback.xml +++ b/hai-user/src/main/resources/prod/logback.xml @@ -90,4 +90,24 @@ + + + log/blxLog.log + + log/blxLog/blxLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + diff --git a/v1/src/main/java/com/v1/controller/business/BlxCouponController.java b/v1/src/main/java/com/v1/controller/business/BlxCouponController.java index da13139a..be727fb2 100644 --- a/v1/src/main/java/com/v1/controller/business/BlxCouponController.java +++ b/v1/src/main/java/com/v1/controller/business/BlxCouponController.java @@ -1,6 +1,13 @@ package com.v1.controller.business; +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.common.utils.ResponseMsgUtil; +import com.hai.entity.ApiMerchants; +import com.hai.model.ResponseData; import com.hai.openApi.service.ApiBlxCouponService; import com.hai.openApi.service.ApiMobileRechargeProductService; import com.hai.order.type.OrderProductType; @@ -40,60 +47,60 @@ public class BlxCouponController { private ApiIpAddressService apiIpAddressService; -// @RequestMapping(value = "/getCouponList", method = RequestMethod.POST) -// @ResponseBody -// @ApiOperation(value = "获取话费充值产品") -// public ResponseData getCouponList(@RequestBody JSONObject object , HttpServletRequest request ) { -// try { -// -// String ip = ""; -// // 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for -// if (request.getHeader("x-forwarded-for") == null) { -// ip = request.getRemoteAddr(); -// } else { -// ip = request.getHeader("x-forwarded-for"); -// } -// -// if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { -// log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); -// } -// -// if ( -// StringUtils.isBlank(object.getString("merchId")) || -// StringUtils.isBlank(object.getString("sign")) -// ) { -// log.error("getRechargeProduct error!", "请求参数校验失败!"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); -// } -// -// ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); -// -// if (apiMerchants == null) { -// log.error("getRechargeProduct error!", "帐户号错误!"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST); -// } -// -// if (!secConfigService.isConfig(OrderProductType.PRODUCT_TYPE9.getApiCode(), object.getString("merchId"))) { -// log.error("getAllCities error!", "当前帐户无权限查询!"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, ""); -// } -// -// Map map = new HashMap<>(); -// map.put("apiKey" , apiMerchants.getApiKey()); -// map.put("merchId" , object.getString("merchId")); -// -// if (!secConfigService.isSignVerify(map , object.getString("sign"))) { -// log.error("getRechargeProduct error!", "签名校验失败!"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); -// } -// -// return ResponseMsgUtil.success(apiBlxCouponService.getBlxCouponList(object.getString("merchId"))); -// -// } catch (Exception e) { -// log.error("HighOpenApiController --> getRechargeProduct() error!", e); -// return ResponseMsgUtil.exception(e); -// } -// } + @RequestMapping(value = "/getCouponList", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "获取停车券列表") + public ResponseData getCouponList(@RequestBody JSONObject object , HttpServletRequest request ) { + try { + + String ip = ""; + // 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for + if (request.getHeader("x-forwarded-for") == null) { + ip = request.getRemoteAddr(); + } else { + ip = request.getHeader("x-forwarded-for"); + } + + if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { + log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); + } + + if ( + StringUtils.isBlank(object.getString("merchId")) || + StringUtils.isBlank(object.getString("sign")) + ) { + log.error("getRechargeProduct error!", "请求参数校验失败!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); + } + + ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); + + if (apiMerchants == null) { + log.error("getRechargeProduct error!", "帐户号错误!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST); + } + + if (!secConfigService.isConfig(OrderProductType.PRODUCT_TYPE13.getApiCode(), object.getString("merchId"))) { + log.error("getAllCities error!", "当前帐户无权限查询!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, ""); + } + + Map map = new HashMap<>(); + map.put("apiKey" , apiMerchants.getApiKey()); + map.put("merchId" , object.getString("merchId")); + + if (!secConfigService.isSignVerify(map , object.getString("sign"))) { + log.error("getRechargeProduct error!", "签名校验失败!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + } + + return ResponseMsgUtil.success(apiBlxCouponService.getBlxCouponList(new HashMap<>())); + + } catch (Exception e) { + log.error("HighOpenApiController --> getRechargeProduct() error!", e); + return ResponseMsgUtil.exception(e); + } + } } diff --git a/v1/src/main/java/com/v1/controller/orderController.java b/v1/src/main/java/com/v1/controller/orderController.java index 18c4e866..0e10e85d 100644 --- a/v1/src/main/java/com/v1/controller/orderController.java +++ b/v1/src/main/java/com/v1/controller/orderController.java @@ -168,6 +168,17 @@ public class orderController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写下单手机号,就餐方式,下单信息,门店编码"); } } + if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE13.getNumber())) { + if (dataObject.getJSONArray("data") == null + || StringUtils.isBlank(dataObject.getString("couponCode")) + || StringUtils.isBlank(dataObject.getString("receiverPhone")) + || dataObject.getInteger("receiverCount") == null + ) { + log.error("OrderController -> create() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写卡券编码,手机号,购买数量"); + } + } + return ResponseMsgUtil.success(apiOrderService.createOrder(object)); } catch (Exception e) {