From 0ea3d02eb068a091a259232858a810c777f4e4dc Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 28 Apr 2023 11:05:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=AE=9E=E7=89=A9?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/HighTestController.java | 2 +- .../HighActivityUserLotteryNumService.java | 2 +- .../hai/service/impl/CommonServiceImpl.java | 4 +- ...HighActivityUserLotteryNumServiceImpl.java | 6 +- .../business/OrderRebateController.java | 86 ++++++++++++++++++- 5 files changed, 91 insertions(+), 9 deletions(-) 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 2bbcb53f..3b2315cf 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -1 +1 @@ - package com.bweb.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.alipay.api.domain.OfferObject; import com.bweb.config.SysConst; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.order.model.ExportOrderMobileModel; import com.hai.order.model.OrderThirdPartyModel; import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderService; import com.hai.order.type.*; import com.hai.order.utils.OrderUtil; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.File; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private OutRechargeOrderService outRechargeOrderService; @Autowired private OutRechargeChildOrderService childOrderService; @Resource private BsOrderRebateService bsOrderRebateService; @Resource private CommonService commonService; @Resource private OrderService orderService; @Resource private HighOrderService highOrderService; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStationStores", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取油站") public ResponseData getStationStores() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); mapPost.put("merchId" , "20220896102"); Map map = new HashMap<>(); map.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); map.put("merchId" , "20220896102"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/refuelOnline/getStationStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRechargeProduct", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取充值产品") public ResponseData getRechargeProduct() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/mobileRecharge/getMobileProduct" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getAllCities", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询可用城市") public ResponseData getAllCities() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/apiMerchants/getAllCities" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克门店") public ResponseData starbucksStore() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("lat" , "29.56900"); mapPost.put("lon" , "106.55843"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("lat" , "29.56900"); map.put("lon" , "106.55843"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克商品") public ResponseData starbucksProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcStoresList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData kfcStoresList() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcStoresList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcProductByStoreCode", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据门店编码查询KFC产品") public ResponseData kfcProductByStoreCode(@RequestParam(name = "storeCode", required = true) String storeCode) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("storeCode" , storeCode); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("storeCode" , storeCode); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcProductByStoreCode" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRegional", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询区域信息") public ResponseData getRegional() { try { return ResponseMsgUtil.success(commonService.getRegional("code" , "name" , "childs")); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/memberProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询会员产品") public ResponseData memberProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/memberRecharge/memberProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("notifyUrl" , "test"); mapPost.put("content" , object.toString()); System.out.println(mapPost); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("timetable" , mapPost.get("timetable").toString()); map.put("orderNo" , mapPost.get("orderNo")); map.put("productType" , object.getString("productType")); map.put("content" , object.toString()); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileChildOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据订单号修改话费订单状态") public ResponseData mobileChildOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); // 查询子订单 HighOrder highOrder = highOrderService.getOrderByOrderNo(order.getOrderNo()); // 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成 int orderStatus = outRechargeOrderService.orderWhetherRecharge(order); log.info("处理话费订单:" + orderStatus + "订单号" + order.getOrderNo()); if (orderStatus == 2 && highOrder.getOrderStatus() == 4) { order.setRechargeStatus(203); order.setPayStatus(105); } if (orderStatus == 5 && highOrder.getOrderStatus() == 3) { order.setRechargeStatus(202); order.setPayStatus(100); } outRechargeOrderService.updateOrder(order); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } // 退款订单号 @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(3); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, "工会卡充值退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileDw", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费订单下载") public ResponseData mobileDw(@RequestParam(name = "createTimeS", required = false) String createTimeS, @RequestParam(name = "createTimeE", required = false) String createTimeE, @RequestParam(name = "refundTimeS", required = false) String refundTimeS, @RequestParam(name = "refundTimeE", required = false) String refundTimeE ) { try { Map map = new HashMap<>(); map.put("productType" , 9); map.put("createTimeS" , createTimeS); map.put("createTimeE" , createTimeE); map.put("refundTimeS" , refundTimeS); map.put("refundTimeE" , refundTimeE); List order = highOrderService.getOrderListNotChild(map); List list = new ArrayList<>(); ExportOrderMobileModel model; for (HighOrder highOrder : order) { model = new ExportOrderMobileModel(); OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNoNotChild(highOrder.getOrderNo()); if (rechargeOrder != null) { OutRechargeChildOrder childOrder = mobileChildOrderHandle(highOrder,rechargeOrder); model.setRechargeOrderNo(rechargeOrder.getOrderNo()); if (childOrder != null) { model.setChildOrderNo(childOrder.getOrderNo()); if (childOrder.getRechargePlatform() != null) { model.setRechargePlatform(RechargePlatformType.getDataByType(childOrder.getRechargePlatform()).getName()); } model.setRemark(childOrder.getExt1()); } } model.setFinishTime(highOrder.getFinishTime()); model.setOrderStatus(OrderStatus.getDataByType(highOrder.getOrderStatus()).getName()); model.setMemPhone(highOrder.getMemPhone()); model.setCreateTime(highOrder.getCreateTime()); model.setTitle(highOrder.getTitle()); model.setPayablePrice(highOrder.getPayablePrice()); model.setRefundTime(highOrder.getRefundTime()); model.setPayPrice(highOrder.getPayPrice()); model.setOrderNo(highOrder.getOrderNo()); model.setMemCardNo(highOrder.getMemCardNo()); if (highOrder.getPayType() != null) { model.setPayType(OrderPayType.getDataByType(highOrder.getPayType()).getName()); } list.add(model); } String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/"; String pathName = System.currentTimeMillis()+".xlsx"; File file = new File(fileUrl); if (!file.exists()) { file.mkdirs(); } EasyExcel.write(fileUrl+pathName) .head(ExportOrderMobileModel.class) .sheet("话费交易订单") .doWrite(list); return ResponseMsgUtil.success(pathName); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } public OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder) { // 组装查询子订单数据 Map childOrderMap101 = new HashMap<>(); childOrderMap101.put("parent_order_id", outRechargeOrder.getId()); childOrderMap101.put("status", "101,102"); // 查询充值订单 List childOrders = childOrderService.getListRechargeChildOrder(childOrderMap101); OutRechargeChildOrder childOrder; // 判读是否存在多个充值中的订单 if (childOrders.size() > 0) { childOrder = childOrders.get(0); if (childOrders.size() > 1) { childOrder.setExt1("当前订单存在多个充值订单"); } } else { childOrder = childOrderService.findByOrderId(outRechargeOrder.getId()); if (childOrder != null && highOrder != null && childOrder.getStatus() != null && highOrder.getOrderStatus() != null) { if (highOrder.getOrderStatus() == 2 && childOrder.getStatus() != 102) { childOrder.setExt1("主订单充值中,但是充值订单状态不为充值中"); } if (highOrder.getOrderStatus() == 3 && childOrder.getStatus() != 101) { childOrder.setExt1("主订单充值成功,但是充值订单状态不为充值成功"); } if (highOrder.getOrderStatus() == 4 && !(childOrder.getStatus() == 103 || childOrder.getStatus() == 104)) { childOrder.setExt1("主订单退款,但是充值订单状态不为退款"); } } } return childOrder; } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData test() { try { JSONObject object = new JSONObject(); object.put("productType" , 102); object.put("userId" , 366); object.put("orderNo" , "202131231237812367126"); object.put("orderId" , 892 ); object.put("title" , "南充大饭店"); object.put("createTime" , new Date()); object.put("payRealPrice" , 50); bsOrderRebateService.insertOrderRebate(object); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file + package com.bweb.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.alipay.api.domain.OfferObject; import com.bweb.config.SysConst; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.order.model.ExportOrderMobileModel; import com.hai.order.model.OrderThirdPartyModel; import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderService; import com.hai.order.type.*; import com.hai.order.utils.OrderUtil; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.File; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private OutRechargeOrderService outRechargeOrderService; @Autowired private OutRechargeChildOrderService childOrderService; @Resource private BsOrderRebateService bsOrderRebateService; @Resource private CommonService commonService; @Resource private OrderService orderService; @Resource private HighOrderService highOrderService; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStationStores", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取油站") public ResponseData getStationStores() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); mapPost.put("merchId" , "20220896102"); Map map = new HashMap<>(); map.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); map.put("merchId" , "20220896102"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/refuelOnline/getStationStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRechargeProduct", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取充值产品") public ResponseData getRechargeProduct() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/mobileRecharge/getMobileProduct" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getAllCities", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询可用城市") public ResponseData getAllCities() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/apiMerchants/getAllCities" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克门店") public ResponseData starbucksStore() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("lat" , "29.56900"); mapPost.put("lon" , "106.55843"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("lat" , "29.56900"); map.put("lon" , "106.55843"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克商品") public ResponseData starbucksProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcStoresList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData kfcStoresList() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcStoresList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcProductByStoreCode", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据门店编码查询KFC产品") public ResponseData kfcProductByStoreCode(@RequestParam(name = "storeCode", required = true) String storeCode) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("storeCode" , storeCode); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("storeCode" , storeCode); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcProductByStoreCode" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRegional", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询区域信息") public ResponseData getRegional() { try { return ResponseMsgUtil.success(commonService.getRegional("code" , "name" , "childs")); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/memberProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询会员产品") public ResponseData memberProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/memberRecharge/memberProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("notifyUrl" , "test"); mapPost.put("content" , object.toString()); System.out.println(mapPost); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("timetable" , mapPost.get("timetable").toString()); map.put("orderNo" , mapPost.get("orderNo")); map.put("productType" , object.getString("productType")); map.put("content" , object.toString()); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileChildOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据订单号修改话费订单状态") public ResponseData mobileChildOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); String key = "recharge_" + order.getId(); try { // 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, order.getOrderNo()); if(Boolean.TRUE.equals(lock)) { // 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成 int orderStatus = outRechargeOrderService.orderWhetherRecharge(order); log.info("处理话费订单:" + orderStatus + "订单号" + order.getOrderNo()); if (orderStatus == 1) { outRechargeOrderService.getPrepaidRechargeApi(order); } if (orderStatus == 2) { outRechargeOrderService.refundOrder(order.getId()); } if (orderStatus == 4) { HighOrder highOrder = highOrderService.getOrderByOrderNo(order.getOrderNo()); highOrder.setExceptionStatus(true); highOrder.setExceptionContent("话费订单存在多条重复记录"); highOrderService.updateOrder(highOrder); } if (orderStatus == 5) { outRechargeOrderService.completeOrder(order.getId()); } } else { // 加锁失败,重试 Thread.sleep(100); mobileChildOrderByOrderNo(orderNo); } return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } finally { // 删除key,释放锁 redisTemplate.delete(key); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(3); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, "工会卡充值退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileDw", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费订单下载") public ResponseData mobileDw(@RequestParam(name = "createTimeS", required = false) String createTimeS, @RequestParam(name = "createTimeE", required = false) String createTimeE, @RequestParam(name = "refundTimeS", required = false) String refundTimeS, @RequestParam(name = "refundTimeE", required = false) String refundTimeE ) { try { Map map = new HashMap<>(); map.put("productType" , 9); map.put("createTimeS" , createTimeS); map.put("createTimeE" , createTimeE); map.put("refundTimeS" , refundTimeS); map.put("refundTimeE" , refundTimeE); List order = highOrderService.getOrderListNotChild(map); List list = new ArrayList<>(); ExportOrderMobileModel model; for (HighOrder highOrder : order) { model = new ExportOrderMobileModel(); OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNoNotChild(highOrder.getOrderNo()); if (rechargeOrder != null) { OutRechargeChildOrder childOrder = mobileChildOrderHandle(highOrder,rechargeOrder); model.setRechargeOrderNo(rechargeOrder.getOrderNo()); if (childOrder != null) { model.setChildOrderNo(childOrder.getOrderNo()); if (childOrder.getRechargePlatform() != null) { model.setRechargePlatform(RechargePlatformType.getDataByType(childOrder.getRechargePlatform()).getName()); } model.setRemark(childOrder.getExt1()); } } model.setFinishTime(highOrder.getFinishTime()); model.setOrderStatus(OrderStatus.getDataByType(highOrder.getOrderStatus()).getName()); model.setMemPhone(highOrder.getMemPhone()); model.setCreateTime(highOrder.getCreateTime()); model.setTitle(highOrder.getTitle()); model.setPayablePrice(highOrder.getPayablePrice()); model.setRefundTime(highOrder.getRefundTime()); model.setPayPrice(highOrder.getPayPrice()); model.setOrderNo(highOrder.getOrderNo()); model.setMemCardNo(highOrder.getMemCardNo()); if (highOrder.getPayType() != null) { model.setPayType(OrderPayType.getDataByType(highOrder.getPayType()).getName()); } list.add(model); } String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/"; String pathName = System.currentTimeMillis()+".xlsx"; File file = new File(fileUrl); if (!file.exists()) { file.mkdirs(); } EasyExcel.write(fileUrl+pathName) .head(ExportOrderMobileModel.class) .sheet("话费交易订单") .doWrite(list); return ResponseMsgUtil.success(pathName); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } public OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder) { // 组装查询子订单数据 Map childOrderMap101 = new HashMap<>(); childOrderMap101.put("parent_order_id", outRechargeOrder.getId()); childOrderMap101.put("status", "101,102"); // 查询充值订单 List childOrders = childOrderService.getListRechargeChildOrder(childOrderMap101); OutRechargeChildOrder childOrder; // 判读是否存在多个充值中的订单 if (childOrders.size() > 0) { childOrder = childOrders.get(0); if (childOrders.size() > 1) { childOrder.setExt1("当前订单存在多个充值订单"); } } else { childOrder = childOrderService.findByOrderId(outRechargeOrder.getId()); if (childOrder != null && highOrder != null && childOrder.getStatus() != null && highOrder.getOrderStatus() != null) { if (highOrder.getOrderStatus() == 2 && childOrder.getStatus() != 102) { childOrder.setExt1("主订单充值中,但是充值订单状态不为充值中"); } if (highOrder.getOrderStatus() == 3 && childOrder.getStatus() != 101) { childOrder.setExt1("主订单充值成功,但是充值订单状态不为充值成功"); } if (highOrder.getOrderStatus() == 4 && !(childOrder.getStatus() == 103 || childOrder.getStatus() == 104)) { childOrder.setExt1("主订单退款,但是充值订单状态不为退款"); } } } return childOrder; } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData test() { try { JSONObject object = new JSONObject(); object.put("productType" , 102); object.put("userId" , 366); object.put("orderNo" , "202131231237812367126"); object.put("orderId" , 892 ); object.put("title" , "南充大饭店"); object.put("createTime" , new Date()); object.put("payRealPrice" , 50); bsOrderRebateService.insertOrderRebate(object); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/service/HighActivityUserLotteryNumService.java b/hai-service/src/main/java/com/hai/service/HighActivityUserLotteryNumService.java index f061a1d0..254fbd51 100644 --- a/hai-service/src/main/java/com/hai/service/HighActivityUserLotteryNumService.java +++ b/hai-service/src/main/java/com/hai/service/HighActivityUserLotteryNumService.java @@ -41,7 +41,7 @@ public interface HighActivityUserLotteryNumService { /** * - * 获取抽奖次数 + * 免费获取抽奖次数 * @param activityId 活动id * @param userId 用户id * @return diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java index 2b16ec94..3a0d0f89 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java @@ -843,7 +843,7 @@ public class CommonServiceImpl implements CommonService { storeModel.setRotate(1); storeModel.setWidth(20); storeModel.setHeight(20); - storeModel.setAlpha(0.5); + storeModel.setAlpha(1); JSONObject callout = new JSONObject(); @@ -898,7 +898,7 @@ public class CommonServiceImpl implements CommonService { storeModel.setRotate(1); storeModel.setWidth(20); storeModel.setHeight(20); - storeModel.setAlpha(0.5); + storeModel.setAlpha(1); JSONObject callout = new JSONObject(); callout.put("content" , store.getStoreName()); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java index 42e8c205..23034cb0 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java @@ -146,11 +146,11 @@ public class HighActivityUserLotteryNumServiceImpl implements HighActivityUserLo if (secConfig != null) { // 判断是否活动为空 if (detail == null) { - addLotteryNum(activityId , userId , 3); - return 3; + addLotteryNum(activityId , userId , 1); + return 1; } else { if (!DateUtil.isNow(detail.getUpdateTime())) { - detail.setLotteryNum(3); + detail.setLotteryNum(1); detail.setUpdateTime(new Date()); highActivityUserLotteryNumMapper.updateByPrimaryKey(detail); } diff --git a/v1/src/main/java/com/v1/controller/business/OrderRebateController.java b/v1/src/main/java/com/v1/controller/business/OrderRebateController.java index 8fda36af..3987598b 100644 --- a/v1/src/main/java/com/v1/controller/business/OrderRebateController.java +++ b/v1/src/main/java/com/v1/controller/business/OrderRebateController.java @@ -7,6 +7,7 @@ import com.hai.common.exception.SysCode; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.ApiMerchants; import com.hai.entity.HighGoldRec; +import com.hai.entity.HighUser; import com.hai.model.ResponseData; import com.hai.service.*; import com.hai.service.impl.OutRechargeOrderServiceImpl; @@ -112,9 +113,90 @@ public class OrderRebateController { } } + @RequestMapping(value = "/recycleIntegralPre", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "退款回收积分预处理") + public ResponseData recycleIntegralPre(@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("apiKey")) || + StringUtils.isBlank(object.getString("merchId")) || + StringUtils.isBlank(object.getString("orderNo")) || + StringUtils.isBlank(object.getString("userId")) || + 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); + } + + Map map = new HashMap<>(); + map.put("apiKey" , object.getString("apiKey")); + map.put("merchId" , object.getString("merchId")); + map.put("orderNo" , object.getString("orderNo")); + map.put("userId" , object.getString("userId")); + + + if (!secConfigService.isSignVerify(map , object.getString("sign"))) { + log.error("getRechargeProduct error!", "签名校验失败!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + } + + + Map mapGold = new HashMap<>(); + mapGold.put("goldType", 1); + mapGold.put("resType", object.getInteger("productType")); + mapGold.put("resId", object.getLong("orderId")); + + List goldRecs = highGoldRecService.getGoldRec(mapGold); + + Integer integralNum = 0; + + // 查询用户信息 + HighUser user = highUserService.findByUserId(object.getLong("userId")); + + for (HighGoldRec goldRec : goldRecs) { + integralNum += goldRec.getGold(); + } + + if (integralNum > user.getGold()) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "积分数量不足"); + } + + String remark = "订单" + object.getString("orderNo") + "退款,退还积分:" + integralNum; + // 积分退款 + highUserService.goldHandle(user.getId(), integralNum,2, object.getInteger("productType"), object.getLong("orderId") , remark); + + return ResponseMsgUtil.success("操作成功"); + } catch (Exception e) { + log.error("HighOrderController --> getBackendToken() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/recycleIntegral", method = RequestMethod.POST) @ResponseBody - @ApiOperation(value = "退款回收积分") + @ApiOperation(value = "退款回收积分处理") public ResponseData recycleIntegral(@RequestBody JSONObject object , HttpServletRequest request ) { try { @@ -173,7 +255,7 @@ public class OrderRebateController { for (HighGoldRec goldRec : goldRecs) { String remark = "订单" + object.getString("orderNo") + "退款,退还积分:" + goldRec.getGold(); // 积分退款 - highUserService.goldHandle(goldRec.getUserId(), goldRec.getGold(),1, object.getInteger("productType"), object.getLong("orderId") , remark); + highUserService.goldHandle(goldRec.getUserId(), goldRec.getGold(),2, object.getInteger("productType"), object.getLong("orderId") , remark); } return ResponseMsgUtil.success("操作成功"); From 94ac746a726f56cb2e35889da2f598daddd22d97 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 8 May 2023 15:13:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=AE=9E=E7=89=A9?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/HighGasController.java | 2 +- .../bweb/controller/HighTestController.java | 2 +- .../com/cweb/controller/CommonController.java | 3 +- .../Goods/ShoppingCartController.java | 36 +++-- .../hai/schedule/HighIntegralSchedule.java | 2 +- .../main/java/com/hai/entity/HighGoldRec.java | 8 +- .../goods/service/ShoppingCartService.java | 10 ++ .../service/impl/ShoppingCartServiceImpl.java | 24 ++++ .../openApi/config/PriceComputeConfig.java | 4 +- .../hai/openApi/service/ApiOrderService.java | 10 ++ .../service/impl/ApiOrderServiceImpl.java | 43 +++++- .../impl/OrderPaySuccessServiceImpl.java | 3 +- .../service/impl/OrderRefundServiceImpl.java | 10 +- .../order/service/impl/OrderServiceImpl.java | 6 +- .../java/com/hai/service/CommonService.java | 2 +- .../com/hai/service/HighGoldRecService.java | 10 ++ .../java/com/hai/service/HighUserService.java | 2 +- .../service/impl/ApiMerchantsServiceImpl.java | 28 ++-- .../BsDistributionUserRelServiceImpl.java | 6 +- .../impl/BsOrderRebateServiceImpl.java | 9 +- .../hai/service/impl/CommonServiceImpl.java | 26 +++- ...HighActivityUserLotteryNumServiceImpl.java | 4 +- .../service/impl/HighGoldRecServiceImpl.java | 36 +++++ .../impl/HighGoodsTypeServiceImpl.java | 3 + .../service/impl/HighOrderServiceImpl.java | 12 +- .../hai/service/impl/HighUserServiceImpl.java | 3 +- .../impl/OutRechargeOrderServiceImpl.java | 2 +- .../pay/impl/GoodsOrderServiceImpl.java | 2 +- .../prod-9401/commonConfig.properties | 4 + .../resources/prod/commonConfig.properties | 4 + .../com/v1/controller/WxMsgController.java | 133 ++++++++++++++++-- .../business/ApiMerchantsController.java | 8 +- .../business/GzSinopecController.java | 51 ++++--- .../v1/controller/business/KfcController.java | 8 +- .../business/MemberProductsController.java | 4 +- .../business/MobileRechargeController.java | 4 +- .../business/OrderRebateController.java | 98 +++++++++---- .../business/RefuelOnlineController.java | 4 +- .../business/StarbucksController.java | 8 +- .../com/v1/controller/orderController.java | 95 +++++++++++-- 40 files changed, 579 insertions(+), 150 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java index 709ed8b7..e6ab31fd 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java @@ -856,7 +856,7 @@ public class HighGasController { } else if (order.getPayType() == 3){ String remark = "订单" + order.getOrderNo() + "退款,退还积分:" + order.getPayGold(); // 积分退款 - highUserService.goldHandle(order.getMemId(), order.getPayGold(),1, 3, order.getId() , remark); + highUserService.goldHandle(order.getMemId(), order.getPayGold(),1, 3, order.getId() , remark , order.getOrderNo()); order.setOrderStatus(4); //order.setRefundTime(new Date()); //order.setRefundPrice(order.getPayRealPrice()); 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 3b2315cf..52c4d168 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -1 +1 @@ - package com.bweb.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.alipay.api.domain.OfferObject; import com.bweb.config.SysConst; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.order.model.ExportOrderMobileModel; import com.hai.order.model.OrderThirdPartyModel; import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderService; import com.hai.order.type.*; import com.hai.order.utils.OrderUtil; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.File; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private OutRechargeOrderService outRechargeOrderService; @Autowired private OutRechargeChildOrderService childOrderService; @Resource private BsOrderRebateService bsOrderRebateService; @Resource private CommonService commonService; @Resource private OrderService orderService; @Resource private HighOrderService highOrderService; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStationStores", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取油站") public ResponseData getStationStores() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); mapPost.put("merchId" , "20220896102"); Map map = new HashMap<>(); map.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); map.put("merchId" , "20220896102"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/refuelOnline/getStationStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRechargeProduct", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取充值产品") public ResponseData getRechargeProduct() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/mobileRecharge/getMobileProduct" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getAllCities", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询可用城市") public ResponseData getAllCities() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/apiMerchants/getAllCities" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克门店") public ResponseData starbucksStore() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("lat" , "29.56900"); mapPost.put("lon" , "106.55843"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("lat" , "29.56900"); map.put("lon" , "106.55843"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克商品") public ResponseData starbucksProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcStoresList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData kfcStoresList() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcStoresList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcProductByStoreCode", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据门店编码查询KFC产品") public ResponseData kfcProductByStoreCode(@RequestParam(name = "storeCode", required = true) String storeCode) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("storeCode" , storeCode); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("storeCode" , storeCode); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcProductByStoreCode" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRegional", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询区域信息") public ResponseData getRegional() { try { return ResponseMsgUtil.success(commonService.getRegional("code" , "name" , "childs")); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/memberProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询会员产品") public ResponseData memberProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/memberRecharge/memberProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("notifyUrl" , "test"); mapPost.put("content" , object.toString()); System.out.println(mapPost); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("timetable" , mapPost.get("timetable").toString()); map.put("orderNo" , mapPost.get("orderNo")); map.put("productType" , object.getString("productType")); map.put("content" , object.toString()); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileChildOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据订单号修改话费订单状态") public ResponseData mobileChildOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); String key = "recharge_" + order.getId(); try { // 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, order.getOrderNo()); if(Boolean.TRUE.equals(lock)) { // 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成 int orderStatus = outRechargeOrderService.orderWhetherRecharge(order); log.info("处理话费订单:" + orderStatus + "订单号" + order.getOrderNo()); if (orderStatus == 1) { outRechargeOrderService.getPrepaidRechargeApi(order); } if (orderStatus == 2) { outRechargeOrderService.refundOrder(order.getId()); } if (orderStatus == 4) { HighOrder highOrder = highOrderService.getOrderByOrderNo(order.getOrderNo()); highOrder.setExceptionStatus(true); highOrder.setExceptionContent("话费订单存在多条重复记录"); highOrderService.updateOrder(highOrder); } if (orderStatus == 5) { outRechargeOrderService.completeOrder(order.getId()); } } else { // 加锁失败,重试 Thread.sleep(100); mobileChildOrderByOrderNo(orderNo); } return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } finally { // 删除key,释放锁 redisTemplate.delete(key); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(3); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, "工会卡充值退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileDw", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费订单下载") public ResponseData mobileDw(@RequestParam(name = "createTimeS", required = false) String createTimeS, @RequestParam(name = "createTimeE", required = false) String createTimeE, @RequestParam(name = "refundTimeS", required = false) String refundTimeS, @RequestParam(name = "refundTimeE", required = false) String refundTimeE ) { try { Map map = new HashMap<>(); map.put("productType" , 9); map.put("createTimeS" , createTimeS); map.put("createTimeE" , createTimeE); map.put("refundTimeS" , refundTimeS); map.put("refundTimeE" , refundTimeE); List order = highOrderService.getOrderListNotChild(map); List list = new ArrayList<>(); ExportOrderMobileModel model; for (HighOrder highOrder : order) { model = new ExportOrderMobileModel(); OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNoNotChild(highOrder.getOrderNo()); if (rechargeOrder != null) { OutRechargeChildOrder childOrder = mobileChildOrderHandle(highOrder,rechargeOrder); model.setRechargeOrderNo(rechargeOrder.getOrderNo()); if (childOrder != null) { model.setChildOrderNo(childOrder.getOrderNo()); if (childOrder.getRechargePlatform() != null) { model.setRechargePlatform(RechargePlatformType.getDataByType(childOrder.getRechargePlatform()).getName()); } model.setRemark(childOrder.getExt1()); } } model.setFinishTime(highOrder.getFinishTime()); model.setOrderStatus(OrderStatus.getDataByType(highOrder.getOrderStatus()).getName()); model.setMemPhone(highOrder.getMemPhone()); model.setCreateTime(highOrder.getCreateTime()); model.setTitle(highOrder.getTitle()); model.setPayablePrice(highOrder.getPayablePrice()); model.setRefundTime(highOrder.getRefundTime()); model.setPayPrice(highOrder.getPayPrice()); model.setOrderNo(highOrder.getOrderNo()); model.setMemCardNo(highOrder.getMemCardNo()); if (highOrder.getPayType() != null) { model.setPayType(OrderPayType.getDataByType(highOrder.getPayType()).getName()); } list.add(model); } String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/"; String pathName = System.currentTimeMillis()+".xlsx"; File file = new File(fileUrl); if (!file.exists()) { file.mkdirs(); } EasyExcel.write(fileUrl+pathName) .head(ExportOrderMobileModel.class) .sheet("话费交易订单") .doWrite(list); return ResponseMsgUtil.success(pathName); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } public OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder) { // 组装查询子订单数据 Map childOrderMap101 = new HashMap<>(); childOrderMap101.put("parent_order_id", outRechargeOrder.getId()); childOrderMap101.put("status", "101,102"); // 查询充值订单 List childOrders = childOrderService.getListRechargeChildOrder(childOrderMap101); OutRechargeChildOrder childOrder; // 判读是否存在多个充值中的订单 if (childOrders.size() > 0) { childOrder = childOrders.get(0); if (childOrders.size() > 1) { childOrder.setExt1("当前订单存在多个充值订单"); } } else { childOrder = childOrderService.findByOrderId(outRechargeOrder.getId()); if (childOrder != null && highOrder != null && childOrder.getStatus() != null && highOrder.getOrderStatus() != null) { if (highOrder.getOrderStatus() == 2 && childOrder.getStatus() != 102) { childOrder.setExt1("主订单充值中,但是充值订单状态不为充值中"); } if (highOrder.getOrderStatus() == 3 && childOrder.getStatus() != 101) { childOrder.setExt1("主订单充值成功,但是充值订单状态不为充值成功"); } if (highOrder.getOrderStatus() == 4 && !(childOrder.getStatus() == 103 || childOrder.getStatus() == 104)) { childOrder.setExt1("主订单退款,但是充值订单状态不为退款"); } } } return childOrder; } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData test() { try { JSONObject object = new JSONObject(); object.put("productType" , 102); object.put("userId" , 366); object.put("orderNo" , "202131231237812367126"); object.put("orderId" , 892 ); object.put("title" , "南充大饭店"); object.put("createTime" , new Date()); object.put("payRealPrice" , 50); bsOrderRebateService.insertOrderRebate(object); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file + package com.bweb.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.alipay.api.domain.OfferObject; import com.bweb.config.SysConst; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.order.model.ExportOrderMobileModel; import com.hai.order.model.OrderThirdPartyModel; import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderService; import com.hai.order.type.*; import com.hai.order.utils.OrderUtil; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.File; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private OutRechargeOrderService outRechargeOrderService; @Autowired private OutRechargeChildOrderService childOrderService; @Resource private BsOrderRebateService bsOrderRebateService; @Resource private CommonService commonService; @Resource private OrderService orderService; @Resource private HighOrderService highOrderService; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStationStores", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取油站") public ResponseData getStationStores() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); mapPost.put("merchId" , "20220896102"); Map map = new HashMap<>(); map.put("apiKey" , "4B1DF80A2D64376D2807ACA6CFEDE8AA"); map.put("merchId" , "20220896102"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/refuelOnline/getStationStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRechargeProduct", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取充值产品") public ResponseData getRechargeProduct() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/mobileRecharge/getMobileProduct" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getAllCities", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询可用城市") public ResponseData getAllCities() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/apiMerchants/getAllCities" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克门店") public ResponseData starbucksStore() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("lat" , "29.56900"); mapPost.put("lon" , "106.55843"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("lat" , "29.56900"); map.put("lon" , "106.55843"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克商品") public ResponseData starbucksProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/starbucks/starbucksProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcStoresList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData kfcStoresList() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcStoresList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/kfcProductByStoreCode", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据门店编码查询KFC产品") public ResponseData kfcProductByStoreCode(@RequestParam(name = "storeCode", required = true) String storeCode) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("storeCode" , storeCode); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("storeCode" , storeCode); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/kfc/kfcProductByStoreCode" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getRegional", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询区域信息") public ResponseData getRegional() { try { return ResponseMsgUtil.success(commonService.getRegional("code" , "name" , "childs")); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/memberProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询会员产品") public ResponseData memberProducts() { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/memberRecharge/memberProducts" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("notifyUrl" , "test"); mapPost.put("content" , object.toString()); System.out.println(mapPost); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("timetable" , mapPost.get("timetable").toString()); map.put("orderNo" , mapPost.get("orderNo")); map.put("productType" , object.getString("productType")); map.put("content" , object.toString()); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileChildOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据订单号修改话费订单状态") public ResponseData mobileChildOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); String key = "recharge_" + order.getId(); try { // 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, order.getOrderNo()); if(Boolean.TRUE.equals(lock)) { // 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成 int orderStatus = outRechargeOrderService.orderWhetherRecharge(order); log.info("处理话费订单:" + orderStatus + "订单号" + order.getOrderNo()); if (orderStatus == 1) { outRechargeOrderService.getPrepaidRechargeApi(order); } if (orderStatus == 2) { outRechargeOrderService.refundOrder(order.getId()); } if (orderStatus == 4) { HighOrder highOrder = highOrderService.getOrderByOrderNo(order.getOrderNo()); highOrder.setExceptionStatus(true); highOrder.setExceptionContent("话费订单存在多条重复记录"); highOrderService.updateOrder(highOrder); } if (orderStatus == 5) { outRechargeOrderService.completeOrder(order.getId()); } } else { // 加锁失败,重试 Thread.sleep(100); mobileChildOrderByOrderNo(orderNo); } return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } finally { // 删除key,释放锁 redisTemplate.delete(key); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(3); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, "工会卡充值退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mobileDw", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费订单下载") public ResponseData mobileDw(@RequestParam(name = "createTimeS", required = false) String createTimeS, @RequestParam(name = "createTimeE", required = false) String createTimeE, @RequestParam(name = "refundTimeS", required = false) String refundTimeS, @RequestParam(name = "refundTimeE", required = false) String refundTimeE ) { try { Map map = new HashMap<>(); map.put("productType" , 9); map.put("createTimeS" , createTimeS); map.put("createTimeE" , createTimeE); map.put("refundTimeS" , refundTimeS); map.put("refundTimeE" , refundTimeE); List order = highOrderService.getOrderListNotChild(map); List list = new ArrayList<>(); ExportOrderMobileModel model; for (HighOrder highOrder : order) { model = new ExportOrderMobileModel(); OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNoNotChild(highOrder.getOrderNo()); if (rechargeOrder != null) { OutRechargeChildOrder childOrder = mobileChildOrderHandle(highOrder,rechargeOrder); model.setRechargeOrderNo(rechargeOrder.getOrderNo()); if (childOrder != null) { model.setChildOrderNo(childOrder.getOrderNo()); if (childOrder.getRechargePlatform() != null) { model.setRechargePlatform(RechargePlatformType.getDataByType(childOrder.getRechargePlatform()).getName()); } model.setRemark(childOrder.getExt1()); } } model.setFinishTime(highOrder.getFinishTime()); model.setOrderStatus(OrderStatus.getDataByType(highOrder.getOrderStatus()).getName()); model.setMemPhone(highOrder.getMemPhone()); model.setCreateTime(highOrder.getCreateTime()); model.setTitle(highOrder.getTitle()); model.setPayablePrice(highOrder.getPayablePrice()); model.setRefundTime(highOrder.getRefundTime()); model.setPayPrice(highOrder.getPayPrice()); model.setOrderNo(highOrder.getOrderNo()); model.setMemCardNo(highOrder.getMemCardNo()); if (highOrder.getPayType() != null) { model.setPayType(OrderPayType.getDataByType(highOrder.getPayType()).getName()); } list.add(model); } String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/"; String pathName = System.currentTimeMillis()+".xlsx"; File file = new File(fileUrl); if (!file.exists()) { file.mkdirs(); } EasyExcel.write(fileUrl+pathName) .head(ExportOrderMobileModel.class) .sheet("话费交易订单") .doWrite(list); return ResponseMsgUtil.success(pathName); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } public OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder) { // 组装查询子订单数据 Map childOrderMap101 = new HashMap<>(); childOrderMap101.put("parent_order_id", outRechargeOrder.getId()); childOrderMap101.put("status", "101,102"); // 查询充值订单 List childOrders = childOrderService.getListRechargeChildOrder(childOrderMap101); OutRechargeChildOrder childOrder; // 判读是否存在多个充值中的订单 if (childOrders.size() > 0) { childOrder = childOrders.get(0); if (childOrders.size() > 1) { childOrder.setExt1("当前订单存在多个充值订单"); } } else { childOrder = childOrderService.findByOrderId(outRechargeOrder.getId()); if (childOrder != null && highOrder != null && childOrder.getStatus() != null && highOrder.getOrderStatus() != null) { if (highOrder.getOrderStatus() == 2 && childOrder.getStatus() != 102) { childOrder.setExt1("主订单充值中,但是充值订单状态不为充值中"); } if (highOrder.getOrderStatus() == 3 && childOrder.getStatus() != 101) { childOrder.setExt1("主订单充值成功,但是充值订单状态不为充值成功"); } if (highOrder.getOrderStatus() == 4 && !(childOrder.getStatus() == 103 || childOrder.getStatus() == 104)) { childOrder.setExt1("主订单退款,但是充值订单状态不为退款"); } } } return childOrder; } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData test() { try { JSONObject object = new JSONObject(); object.put("productType" , 101); object.put("phone" , "17726395120"); object.put("orderNo" , "ZF1130202305041640363988083900"); object.put("orderId" , 792 ); object.put("title" , "惠付门店"); object.put("createTime" , new Date()); object.put("price" , 1); bsOrderRebateService.insertOrderRebate(object); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java index cf59b1ff..a1fe6f31 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java @@ -426,6 +426,7 @@ public class CommonController { @ApiOperation(value = "获取地图门店") public ResponseData getMapStore( @RequestParam(name = "distance", required = true) Double distance, + @RequestParam(name = "type", required = true) Integer type, @RequestParam(name = "name", required = false) String name, @RequestParam(name = "childId", required = false) Long childId, @RequestParam(name = "longitude", required = true) String longitude, @@ -433,7 +434,7 @@ public class CommonController { ) { try { - return ResponseMsgUtil.success(commonService.getMapStore(name , childId , latitude , longitude , distance)); + return ResponseMsgUtil.success(commonService.getMapStore(name , childId , latitude , longitude , distance , type)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java b/hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java index 6e969925..289fe082 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java @@ -133,18 +133,34 @@ public class ShoppingCartController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "超过最大库存!"); } - shoppingCart.setUserId(userInfoModel.getHighUser().getId()); - shoppingCart.setTitle(goodsDetail.getName()); - shoppingCart.setImg(sku.getShowImg()); - shoppingCart.setOriginalPrice(sku.getOriginalPrice()); - shoppingCart.setLoseEfficacy(false); - shoppingCart.setPrice(sku.getPrice()); - shoppingCart.setCreateTime(new Date()); - shoppingCart.setUpdateTime(new Date()); + Map map = new HashMap<>(); + + map.put("userId", userInfoModel.getHighUser().getId()); + map.put("goodsId", shoppingCart.getGoodsId()); + map.put("sku", shoppingCart.getSku()); + + GoodsShoppingCart goodsShoppingCart = shoppingCartService.findShoppingCartByMap(map); + + if (goodsShoppingCart == null) { + + shoppingCart.setUserId(userInfoModel.getHighUser().getId()); + shoppingCart.setTitle(goodsDetail.getName()); + shoppingCart.setImg(sku.getShowImg()); + shoppingCart.setOriginalPrice(sku.getOriginalPrice()); + shoppingCart.setLoseEfficacy(false); + shoppingCart.setPrice(sku.getPrice()); + shoppingCart.setCreateTime(new Date()); + shoppingCart.setUpdateTime(new Date()); + + shoppingCartService.insertShoppingCart(shoppingCart); + } else { + int num = Integer.parseInt(shoppingCart.getNum()) + Integer.parseInt(goodsShoppingCart.getNum()); + goodsShoppingCart.setNum(Integer.toString(num)); + shoppingCartService.updateShoppingCart(goodsShoppingCart); + } - shoppingCartService.insertShoppingCart(shoppingCart); - return ResponseMsgUtil.success("新增成功"); + return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error("GoodsDetailController --> insertPrice() error!", e); diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java index db9e1c98..56d78933 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java @@ -36,7 +36,7 @@ public class HighIntegralSchedule { for (HighGoldRec goldRec : list) { - highUserService.goldHandle(goldRec.getUserId(), goldRec.getGold(), 2, 5, goldRec.getResId() , "积分过期" ); + highUserService.goldHandle(goldRec.getUserId(), goldRec.getGold(), 2, 5, goldRec.getResId() , "积分过期" , goldRec.getResOrderNo()); goldRec.setStatus(9); goldRec.setUpdateTime(new Date()); diff --git a/hai-service/src/main/java/com/hai/entity/HighGoldRec.java b/hai-service/src/main/java/com/hai/entity/HighGoldRec.java index d7e61628..aa3f6458 100644 --- a/hai-service/src/main/java/com/hai/entity/HighGoldRec.java +++ b/hai-service/src/main/java/com/hai/entity/HighGoldRec.java @@ -1,5 +1,7 @@ package com.hai.entity; +import com.hai.model.HighGoldRecModel; + import java.io.Serializable; import java.util.Date; @@ -12,7 +14,7 @@ import java.util.Date; * 代码由工具生成 * **/ -public class HighGoldRec implements Serializable { +public class HighGoldRec extends HighGoldRecModel implements Serializable { /** * 编号 */ @@ -44,7 +46,7 @@ public class HighGoldRec implements Serializable { private Date createTime; /** - * 来源类型:1.充值 2.订单 3.退款 + * 来源类型:1.充值 2.订单 3:退款 4:积分返利 101:惠支付积分返利 102:惠支付门店活动差价返利 103: 积分冻结 */ private Integer resType; @@ -258,4 +260,4 @@ public class HighGoldRec implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/goods/service/ShoppingCartService.java b/hai-service/src/main/java/com/hai/goods/service/ShoppingCartService.java index 5904d383..0a499cc4 100644 --- a/hai-service/src/main/java/com/hai/goods/service/ShoppingCartService.java +++ b/hai-service/src/main/java/com/hai/goods/service/ShoppingCartService.java @@ -56,6 +56,16 @@ public interface ShoppingCartService { */ GoodsShoppingCart findShoppingCartById(Long id); + /** + * @Author Sum1Dream + * @Name findShoppingCartByMap + * @Description // 根据map查询购物车 + * @Date 14:20 2023/5/5 + * @Param [map] + * @Return com.hai.entity.GoodsShoppingCart + */ + GoodsShoppingCart findShoppingCartByMap(Map map); + /** * @Author Sum1Dream * @Name DeleteShoppingCart diff --git a/hai-service/src/main/java/com/hai/goods/service/impl/ShoppingCartServiceImpl.java b/hai-service/src/main/java/com/hai/goods/service/impl/ShoppingCartServiceImpl.java index 042c2f2c..cb67920a 100644 --- a/hai-service/src/main/java/com/hai/goods/service/impl/ShoppingCartServiceImpl.java +++ b/hai-service/src/main/java/com/hai/goods/service/impl/ShoppingCartServiceImpl.java @@ -44,6 +44,30 @@ public class ShoppingCartServiceImpl implements ShoppingCartService { return shoppingCartMapper.selectByPrimaryKey(id); } + @Override + public GoodsShoppingCart findShoppingCartByMap(Map map) { + GoodsShoppingCartExample example = new GoodsShoppingCartExample(); + GoodsShoppingCartExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map, "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); + } + if (MapUtils.getString(map, "sku") != null) { + criteria.andSkuEqualTo(MapUtils.getString(map, "sku")); + } + if (MapUtils.getLong(map, "goodsId") != null) { + criteria.andGoodsIdEqualTo(MapUtils.getLong(map, "goodsId")); + } + + List list = shoppingCartMapper.selectByExample(example); + + if (list.size() > 0 ) { + return list.get(0); + } + + return null; + } + @Override public void deleteShoppingCart(Long id) { shoppingCartMapper.deleteByPrimaryKey(id); diff --git a/hai-service/src/main/java/com/hai/openApi/config/PriceComputeConfig.java b/hai-service/src/main/java/com/hai/openApi/config/PriceComputeConfig.java index 936dc74c..f5a96639 100644 --- a/hai-service/src/main/java/com/hai/openApi/config/PriceComputeConfig.java +++ b/hai-service/src/main/java/com/hai/openApi/config/PriceComputeConfig.java @@ -31,7 +31,7 @@ public class PriceComputeConfig { public Boolean mchBalance(ApiMerchants apiMerchants , BigDecimal price , String orderNo) { - // 当前账号余额是否可以充值当前金额 + // 当前账号余额是否可以使用当前金额 if (apiMerchants.getAmounts().compareTo(price) < 0) { return false; } @@ -44,7 +44,7 @@ public class PriceComputeConfig { // 变更前金额 BigDecimal beforeAmount = apiMerchants.getAmounts(); // 计算金额 - apiMerchants.setAmounts(apiMerchants.getAmounts(). subtract(price)); + apiMerchants.setAmounts(apiMerchants.getAmounts().subtract(price)); // 变更后金额 BigDecimal afterAmount = apiMerchants.getAmounts(); diff --git a/hai-service/src/main/java/com/hai/openApi/service/ApiOrderService.java b/hai-service/src/main/java/com/hai/openApi/service/ApiOrderService.java index 26acb461..c8be22ba 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/ApiOrderService.java +++ b/hai-service/src/main/java/com/hai/openApi/service/ApiOrderService.java @@ -57,4 +57,14 @@ public interface ApiOrderService { * @Return com.hai.entity.ApiOrder */ ApiOrder findByOrderNo(String mchOrderNo , String orderNo); + + /** + * @Author Sum1Dream + * @Name refund + * @Description // 退款 + * @Date 16:24 2023/5/4 + * @Param [orderNo] + * @Return void + */ + void refund(String orderNo); } 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 b2acd714..6bab5f0e 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 @@ -10,6 +10,7 @@ import com.hai.entity.ApiMerchants; import com.hai.entity.ApiOrder; import com.hai.entity.ApiOrderExample; import com.hai.entity.HighOrder; +import com.hai.enum_type.OrderStatusEnum; import com.hai.openApi.service.ApiOrderCreateHandleService; import com.hai.openApi.service.ApiOrderService; import com.hai.order.model.CreateOrderChildModel; @@ -18,6 +19,7 @@ import com.hai.order.service.OrderPayBeforeService; import com.hai.order.service.OrderPayService; import com.hai.order.service.OrderService; import com.hai.order.type.OrderChildGoodsType; +import com.hai.order.type.OrderPayType; import com.hai.order.type.OrderProductType; import com.hai.order.type.OrderStatus; import com.hai.order.utils.OrderUtil; @@ -53,8 +55,7 @@ public class ApiOrderServiceImpl implements ApiOrderService { @Resource private OrderPayService orderPayService; - @Resource - private ApiOrderService apiOrderService; + @Override @Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW) @@ -224,7 +225,7 @@ public class ApiOrderServiceImpl implements ApiOrderService { ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); - ApiOrder apiOrder = apiOrderService.findByOrderNo(object.getString("mchOrderNo") , null); + ApiOrder apiOrder = findByOrderNo(object.getString("mchOrderNo") , null); // 查询订单 HighOrder order = orderService.getOrderDetailByNo(object.getString("orderNo")); @@ -308,4 +309,40 @@ public class ApiOrderServiceImpl implements ApiOrderService { return null; } + + @Override + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void refund(String orderNo) { + HighOrder order = orderService.getOrderDetailByNo(orderNo); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的的订单"); + } + if (!order.getOrderStatus().equals(OrderStatusEnum.type2.getType()) + && !order.getOrderStatus().equals(OrderStatusEnum.type3.getType()) + && !order.getOrderStatus().equals(OrderStatusEnum.type7.getType())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单当前状态无法退款"); + } + if (!order.getPayType().equals(OrderPayType.PAY_TYPE9.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付方式错误"); + } + + ApiOrder apiOrder = findByOrderNo(null , orderNo); + ApiMerchants merchants = apiMerchantsService.findByMchId(apiOrder.getMchId()); + + if (apiOrder.getStatus() == 1 || apiOrder.getStatus() == 4 || apiOrder.getStatus() == 5) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单当前状态无法退款"); + } + + apiOrder.setStatus(4); + apiOrder.setUpdateTime(new Date()); + apiOrderMapper.updateByPrimaryKey(apiOrder); + + + Map map = new HashMap<>(); + map.put("sourceType", 100); + map.put("sourceContent", "退款金额:" + apiOrder.getCostPrice() + " 元"); + apiMerchantsService.recharge(merchants.getId(), apiOrder.getCostPrice(), map); + + + } } 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 2677bcb9..9037f58e 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 @@ -277,7 +277,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { // 金币 1:100 Integer goldNum = new BigDecimal(childOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue(); String remark = "订单" + order.getOrderNo() + "积分充值积分:" + goldNum; - userService.goldHandle(childOrder.getGoodsId(), goldNum, 1, 1, childOrder.getId() , remark); + userService.goldHandle(childOrder.getGoodsId(), goldNum, 1, 1, childOrder.getId() , remark , order.getOrderNo()); } /** @@ -522,6 +522,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { goodsOrder.setStatus("1"); goodsOrderExtService.updateGoodsOrder(goodsOrder); + // 赠送卡券or优惠券 List goodsPresents = goodsPresentService.getPresentList(highChildOrder.getGoodsId()); if (goodsPresents.size() > 0) { diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java index 58bd58cb..c3b74d32 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java @@ -14,6 +14,7 @@ import com.hai.entity.HighOrder; import com.hai.entity.HighOrderRefund; import com.hai.entity.HighOrderRefundExample; import com.hai.model.OrderRefundModel; +import com.hai.openApi.service.ApiOrderService; import com.hai.order.model.RefundPriceModel; import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderService; @@ -56,6 +57,9 @@ public class OrderRefundServiceImpl implements OrderRefundService { @Resource private HighFleetOilCardService fleetOilCardService; + @Resource + private ApiOrderService apiOrderService; + @Override public void update(HighOrderRefund orderRefund) { orderRefundMapper.updateByPrimaryKey(orderRefund); @@ -151,7 +155,7 @@ public class OrderRefundServiceImpl implements OrderRefundService { if (refundIntegral != null && refundIntegral > 0) { String remark = "订单" + order.getOrderNo() + "退款,退还积分:" + refundIntegral; // 积分退款 - highUserService.goldHandle(order.getMemId(), order.getPayGold(),1, 3, order.getId() , remark); + highUserService.goldHandle(order.getMemId(), order.getPayGold(),1, 3, order.getId() , remark , order.getOrderNo()); } // 第三方退款 @@ -220,6 +224,10 @@ public class OrderRefundServiceImpl implements OrderRefundService { // 油卡退款 fleetOilCardService.refund(order.getOrderNo()); refundPriceModel.setRefundSuccess(true); + } else if (orderPayType.getNumber().equals(OrderPayType.PAY_TYPE9.getNumber())) { + // 商户退款 + apiOrderService.refund(order.getOrderNo()); + refundPriceModel.setRefundSuccess(true); } } catch (Exception e) { diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index c1114fa5..9f6dcfcd 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -476,7 +476,7 @@ public class OrderServiceImpl implements OrderService { } // 扣除用户积分 userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(), - "积分抵扣金额,交易订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold()); + "积分抵扣金额,交易订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold() , order.getOrderNo()); order.setOrderStatus(OrderStatus.STATUS2.getNumber()); order.setPayRealPrice(order.getPayPrice()); @@ -488,7 +488,7 @@ public class OrderServiceImpl implements OrderService { } else { // 扣除用户积分 userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(), - "积分抵扣金额,交易订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold()); + "积分抵扣金额,交易订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold() , order.getOrderNo()); } } @@ -573,7 +573,7 @@ public class OrderServiceImpl implements OrderService { if (order.getPayGold() != null && order.getPayGold() > 0) { // 积分返回 String remark = "订单" + order.getOrderNo() + "取消,退还积分:" + order.getPayGold(); - userService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark); + userService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark , order.getOrderNo()); } for (HighChildOrder childOrder : order.getHighChildOrderList()) { diff --git a/hai-service/src/main/java/com/hai/service/CommonService.java b/hai-service/src/main/java/com/hai/service/CommonService.java index 252c4beb..abd092d7 100644 --- a/hai-service/src/main/java/com/hai/service/CommonService.java +++ b/hai-service/src/main/java/com/hai/service/CommonService.java @@ -336,5 +336,5 @@ public interface CommonService { */ JSONObject getIndustry(); - List getMapStore(String name , Long childId , String latitude , String longitude , Double distance); + List getMapStore(String name , Long childId , String latitude , String longitude , Double distance , Integer type); } diff --git a/hai-service/src/main/java/com/hai/service/HighGoldRecService.java b/hai-service/src/main/java/com/hai/service/HighGoldRecService.java index 92b60733..da46be03 100644 --- a/hai-service/src/main/java/com/hai/service/HighGoldRecService.java +++ b/hai-service/src/main/java/com/hai/service/HighGoldRecService.java @@ -37,6 +37,16 @@ public interface HighGoldRecService { **/ List getGoldRec(Map map); + /** + * @Author Sum1Dream + * @Name findGoldRec + * @Description // 查询订单数据 + * @Date 11:22 2023/5/5 + * @Param [map] + * @Return com.hai.entity.HighGoldRec + */ + HighGoldRec findGoldRec(Map map); + /** * @Author Sum1Dream * @name queryGold.java diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index 8ced6049..db30c9a6 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -136,7 +136,7 @@ public interface HighUserService { * @Description 用户金币充值、消费 * @Date 2021/3/27 9:51 **/ - void goldHandle(Long userId, Integer goldNum, Integer goldType, Integer resType, Long resId , String remark); + void goldHandle(Long userId, Integer goldNum, Integer goldType, Integer resType, Long resId , String remark , String orderNo); /** * @Author Sum1Dream diff --git a/hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java index 9db999fa..43a5f0df 100644 --- a/hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java @@ -126,17 +126,27 @@ public class ApiMerchantsServiceImpl implements ApiMerchantsService { // 查询商户 ApiMerchants apiMerchants = apiMerchantsMapper.selectByPrimaryKey(merchantId); + + Long opId = null; + String opName = null; + if (apiMerchants == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户"); } - // 操作人 - UserInfoModel sessionModel = userCenter.getSessionModel(UserInfoModel.class); - if (sessionModel == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知用户"); - } - if ( sessionModel.getSecRole().getRoleType() != 1) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足"); + + if (MapUtils.getInteger(otherParam, "sourceType") == 99) { + // 操作人 + UserInfoModel sessionModel = userCenter.getSessionModel(UserInfoModel.class); + if (sessionModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知用户"); + } + if ( sessionModel.getSecRole().getRoleType() != 1) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "权限不足"); + } + opId = sessionModel.getSecUser().getId(); + opName = sessionModel.getSecUser().getUserName(); } + if (apiMerchants.getStatus() != 100) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户被禁用"); } @@ -155,8 +165,8 @@ public class ApiMerchantsServiceImpl implements ApiMerchantsService { apiAmountRecord.setCreateTime(new Date()); apiAmountRecord.setUpdateTime(new Date()); apiAmountRecord.setMchId(apiMerchants.getMchId()); - apiAmountRecord.setOperatorId(sessionModel.getSecUser().getId()); - apiAmountRecord.setOperatorName(sessionModel.getSecUser().getUserName()); + apiAmountRecord.setOperatorId(opId); + apiAmountRecord.setOperatorName(opName); apiAmountRecord.setStatus(100); apiAmountRecord.setAmount(amount); apiAmountRecord.setAfterAmount(afterAmount); diff --git a/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java index e72c165c..db111e01 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java @@ -188,7 +188,9 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe if (distributionUserRel.getPopularizeUserId() != null) { bsDistributionRebateMapper.insert(distributionRebate); // 上级返利 - highUserService.goldHandle(distributionUserRel.getPopularizeUserId(), object.getInteger("integralNumFirst"), 1, 4, object.getLong("userId") , user.getName() + "下单:获得返利" + object.getInteger("integralNumFirst")); + highUserService.goldHandle(distributionUserRel.getPopularizeUserId(), object.getInteger("integralNumFirst"), + 1, 4, object.getLong("userId") , + user.getName() + "下单:获得返利" + object.getInteger("integralNumFirst") , ""); // 查询下单用户顶级推广员 Map mapTop = new HashMap<>(); @@ -202,7 +204,7 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe distributionRebate.setType(2); bsDistributionRebateMapper.insert(distributionRebate); // 顶级返利 - highUserService.goldHandle(distributionUserRelTop.getPopularizeUserId(), object.getInteger("integralNumSecond"), 1, 4, object.getLong("userId") , user.getName() + "下单:获得返利" + object.getInteger("integralNumSecond")); + highUserService.goldHandle(distributionUserRelTop.getPopularizeUserId(), object.getInteger("integralNumSecond"), 1, 4, object.getLong("userId") , user.getName() + "下单:获得返利" + object.getInteger("integralNumSecond") , ""); } diff --git a/hai-service/src/main/java/com/hai/service/impl/BsOrderRebateServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsOrderRebateServiceImpl.java index 5679074b..d15cd7a9 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsOrderRebateServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsOrderRebateServiceImpl.java @@ -99,7 +99,7 @@ public class BsOrderRebateServiceImpl implements BsOrderRebateService { object.put("logoImg" , OrderProductType.getDataByType(highOrder.getProductType()).getImgUrl()); bsDistributionUserRelService.distributionRebate(object); - highUserService.goldHandle(highOrder.getMemId(), integralNum.intValue(), 1, 4, highOrder.getId(), object.getString("remark") + integralNum); + highUserService.goldHandle(highOrder.getMemId(), integralNum.intValue(), 1, 4, highOrder.getId(), object.getString("remark") + integralNum , highOrder.getOrderNo()); // 查询积分返利记录 BsOrderRebate orderRebate = new BsOrderRebate(); @@ -167,6 +167,11 @@ public class BsOrderRebateServiceImpl implements BsOrderRebateService { // 积分返利积分 BigDecimal integralNum = jsonObject.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + + if (integralNum.compareTo(new BigDecimal(0)) < 1) { + integralNum = new BigDecimal(1); + } + if (bsIntegralRebate.getSecondDistribution() !=null || bsIntegralRebate.getFirstDistribution() != null) { // 1级分销 BigDecimal integralNumFirst = jsonObject.getBigDecimal("price").multiply(bsIntegralRebate.getFirstDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP ); @@ -187,7 +192,7 @@ public class BsOrderRebateServiceImpl implements BsOrderRebateService { object.put("logoImg" , OrderProductType.getDataByType(jsonObject.getInteger("productType")).getImgUrl()); bsDistributionUserRelService.distributionRebate(object); - highUserService.goldHandle(highUser.getId(), integralNum.intValue(), 1, jsonObject.getInteger("productType"), jsonObject.getLong("orderId"), object.getString("remark") + integralNum); + highUserService.goldHandle(highUser.getId(), integralNum.intValue(), 1, jsonObject.getInteger("productType"), jsonObject.getLong("orderId"), object.getString("remark") + integralNum , jsonObject.getString("orderNo")); // 查询积分返利记录 BsOrderRebate orderRebate = new BsOrderRebate(); diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java index 3a0d0f89..824c6f89 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java @@ -807,7 +807,7 @@ public class CommonServiceImpl implements CommonService { } @Override - public List getMapStore(String name, Long childId , String latitude , String longitude , Double distance) { + public List getMapStore(String name, Long childId , String latitude , String longitude , Double distance , Integer type) { // 获取支付门店 Map params = new HashMap<>(); @@ -817,6 +817,20 @@ public class CommonServiceImpl implements CommonService { if (childId != null) { params.put("childId", childId); } + String borderWidth; + String padding; + Double alpha; + // 1:ios 2:安卓 + if (type == 2) { + borderWidth = "12"; + padding = "14"; + alpha = 1.0; + + } else { + borderWidth = "10"; + padding = null; + alpha = 0.5; + } List list = new ArrayList<>(); @@ -843,7 +857,7 @@ public class CommonServiceImpl implements CommonService { storeModel.setRotate(1); storeModel.setWidth(20); storeModel.setHeight(20); - storeModel.setAlpha(1); + storeModel.setAlpha(alpha); JSONObject callout = new JSONObject(); @@ -852,8 +866,9 @@ public class CommonServiceImpl implements CommonService { callout.put("color" , "#ffffff"); callout.put("fontSize" , 14); callout.put("borderRadius" , 15); - callout.put("borderWidth" , "10"); + callout.put("borderWidth" , borderWidth); callout.put("bgColor" , "#e51860"); + callout.put("padding" , padding); callout.put("display" , "ALWAYS"); storeModel.setCallout(callout); @@ -898,7 +913,7 @@ public class CommonServiceImpl implements CommonService { storeModel.setRotate(1); storeModel.setWidth(20); storeModel.setHeight(20); - storeModel.setAlpha(1); + storeModel.setAlpha(alpha); JSONObject callout = new JSONObject(); callout.put("content" , store.getStoreName()); @@ -906,7 +921,8 @@ public class CommonServiceImpl implements CommonService { callout.put("color" , "#ffffff"); callout.put("fontSize" , 14); callout.put("borderRadius" , 15); - callout.put("borderWidth" , "10"); + callout.put("borderWidth" , borderWidth); + callout.put("padding" , padding); callout.put("bgColor" , "#e51860"); callout.put("display" , "ALWAYS"); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java index 23034cb0..20afaccb 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java @@ -146,11 +146,11 @@ public class HighActivityUserLotteryNumServiceImpl implements HighActivityUserLo if (secConfig != null) { // 判断是否活动为空 if (detail == null) { - addLotteryNum(activityId , userId , 1); + addLotteryNum(activityId , userId , Integer.valueOf(secConfig.getCodeValue())); return 1; } else { if (!DateUtil.isNow(detail.getUpdateTime())) { - detail.setLotteryNum(1); + detail.setLotteryNum(Integer.valueOf(secConfig.getCodeValue())); detail.setUpdateTime(new Date()); highActivityUserLotteryNumMapper.updateByPrimaryKey(detail); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java index 508f4fae..6ddff44c 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java @@ -77,6 +77,42 @@ public class HighGoldRecServiceImpl implements HighGoldRecService { return list; } + @Override + public HighGoldRec findGoldRec(Map map) { + HighGoldRecExample example = new HighGoldRecExample(); + HighGoldRecExample.Criteria criteria = example.createCriteria(); + + + if (MapUtils.getLong(map, "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); + } + + if (MapUtils.getLong(map, "goldType") != null) { + criteria.andGoldTypeEqualTo(MapUtils.getLong(map, "goldType")); + } + + if (MapUtils.getLong(map, "resType") != null) { + criteria.andResTypeEqualTo(MapUtils.getInteger(map, "resType")); + } + if (MapUtils.getLong(map, "resId") != null) { + criteria.andResIdEqualTo(MapUtils.getLong(map, "resId")); + } + + if (MapUtils.getInteger(map, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); + } { + criteria.andStatusEqualTo(1); + } + + example.setOrderByClause("create_time desc"); + List list = highGoldRecMapper.selectByExample(example); + + if (list.size() > 0) { + return list.get(0); + } + return null; + } + @Override public List> queryGold(Map map) { diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGoodsTypeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGoodsTypeServiceImpl.java index b15b0ceb..7f167d93 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGoodsTypeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGoodsTypeServiceImpl.java @@ -45,6 +45,9 @@ public class HighGoodsTypeServiceImpl implements HighGoodsTypeService { }else { criteria.andParentIdIsNull(); } + if (MapUtils.getLong(map, "companyId") != null) { + criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId")); + } criteria.andStatusEqualTo(1); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 0586d07e..1f9b64db 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -325,7 +325,7 @@ public class HighOrderServiceImpl implements HighOrderService { // 扣除用户积分 highUserService.goldHandle(highOrder.getMemId(), highOrder.getPayGold(), 2, 2, highOrder.getId(), - "抵扣积分订单:" + highOrder.getOrderNo() + ",使用积分:" + highOrder.getPayGold()); + "抵扣积分订单:" + highOrder.getOrderNo() + ",使用积分:" + highOrder.getPayGold() , highOrder.getOrderNo()); } // 积分金额等于应付金额 @@ -562,7 +562,7 @@ public class HighOrderServiceImpl implements HighOrderService { // 金币 1:100 Integer goldNum = new BigDecimal(highChildOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue(); String remark = "订单" + order.getOrderNo() + "积分充值积分:" + goldNum; - highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId(), remark); + highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId(), remark , highChildOrder.getChildOrderNo()); } /* if (highChildOrder.getGoodsType() == 3) { @@ -1103,7 +1103,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (order.getPayGold() != null) { // 积分返回 String remark = "订单" + order.getOrderNo() + "取消,退还积分:" + order.getPayGold(); - highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark); + highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark , order.getOrderNo()); } updateOrder(order); @@ -1810,7 +1810,7 @@ public class HighOrderServiceImpl implements HighOrderService { highOrder.setPayPrice(highOrder.getPayPrice().subtract(integralPrice)); String remark = "订单" + highOrder.getOrderNo() + "下单,使用积分:" + object.getInteger("integralNum"); - highUserService.goldHandle(highOrder.getMemId(), object.getInteger("integralNum"), 2, 2, highOrder.getId() , remark); + highUserService.goldHandle(highOrder.getMemId(), object.getInteger("integralNum"), 2, 2, highOrder.getId() , remark , highOrder.getOrderNo()); } // 判断积分支付是否扣完金额 @@ -2104,7 +2104,7 @@ public class HighOrderServiceImpl implements HighOrderService { // 退还积分 if (order.getPayGold() != null) { String remark = "订单" + order.getOrderNo() + "退款,退还积分:" + order.getPayGold(); - highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark); + highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark , order.getOrderNo()); if (order.getPayRealPrice().compareTo(new BigDecimal(0)) == 0) { order.setOrderStatus(4); //order.setRefundTime(new Date()); @@ -2188,7 +2188,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (order.getPayGold() != null) { // 积分返回 String remark = "订单" + order.getOrderNo() + "取消,退还积分:" + order.getPayGold(); - highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark); + highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark , order.getOrderNo()); } updateOrder(order); 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 a8dfa436..cd022045 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 @@ -334,7 +334,7 @@ public class HighUserServiceImpl implements HighUserService { @Override @Transactional(propagation= Propagation.REQUIRED) - public void goldHandle(Long userId, Integer goldNum, Integer goldType, Integer resType, Long resId , String remark) { + public void goldHandle(Long userId, Integer goldNum, Integer goldType, Integer resType, Long resId , String remark , String orderNo) { // 查询用户信息 HighUser user = highUserMapper.selectByPrimaryKey(userId); if (user == null) { @@ -364,6 +364,7 @@ public class HighUserServiceImpl implements HighUserService { highGoldRec.setResType(resType); highGoldRec.setResId(resId); highGoldRec.setStatus(1); + highGoldRec.setResOrderNo(orderNo); highGoldRec.setRemark(remark); if (goldNum > 0) { highGoldRecService.insertGoldRec(highGoldRec); diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index c05a3824..9833f215 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -227,7 +227,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { if (order.getIntegralNum() != null) { // 积分返回 String remark = "话费订单" + order.getOrderNo() + "取消,退还积分:" + order.getIntegralNum().intValue(); - highUserService.goldHandle(order.getUserId(), order.getIntegralNum().intValue(), 1, 3, order.getId() , remark); + highUserService.goldHandle(order.getUserId(), order.getIntegralNum().intValue(), 1, 3, order.getId() , remark , order.getOrderNo()); } updateOrder(order); diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index 779013a9..cbcd530d 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -338,7 +338,7 @@ public class GoodsOrderServiceImpl implements PayService { // 金币 1:100 Integer goldNum = new BigDecimal(highChildOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue(); String remark = "订单" + order.getOrderNo() + "积分充值积分:" + goldNum; - highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId() , remark); + highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId() , remark , highChildOrder.getChildOrderNo()); } /* if (highChildOrder.getGoodsType() == 3) { diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index 05fb505c..921ebc98 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -112,3 +112,7 @@ wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df wxH5AppId=wxa075e8509802f826 wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 + +#PAY +payPostUrl=https://pay.dctpay.com/crest/ +filesystem=https://hsg.dctpay.com/filesystem/ diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index d17d2e30..d648e2e6 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -118,3 +118,7 @@ wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df wxH5AppId=wxa075e8509802f826 wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 + +#PAY +payPostUrl=https://pay.dctpay.com/crest/ +filesystem=https://hsg.dctpay.com/filesystem/ diff --git a/v1/src/main/java/com/v1/controller/WxMsgController.java b/v1/src/main/java/com/v1/controller/WxMsgController.java index 73dda188..650618e4 100644 --- a/v1/src/main/java/com/v1/controller/WxMsgController.java +++ b/v1/src/main/java/com/v1/controller/WxMsgController.java @@ -147,11 +147,125 @@ public class WxMsgController { else if ("event".equals(msgType)) { // 用户关注公众号 if ("subscribe".equals(event)) { - content = - "您好,感谢关注嗨森逛商城!\n\n" + - linkContent + - "服务热线:400-023-6806" - ; + if (eventKey != null && eventKey.length() != 0) { + JSONObject object = weChatQrcodeUtils.paramPars(eventKey); + // type = 1 推广扫码 + if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type1.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type1.getType())) { + linkContent ="扫码领取\n\n"; + // todo 推广扫码 + } + // type = 2 在线加油门店扫码 + if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type2.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type2.getType())){ + // 商户门店 + HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code")); + linkContent = + "欢迎来到" + store.getStoreName()+"" + + "[哇][哇][哇]\n\n点击这里一键加油\n\n"; + } + // 3:查看视频教程 + if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type3.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type3.getType())){ + // 重庆 + if ( Objects.equals(object.getString("code"), "1")) { + linkContent = + "加油优惠选我们,你的出行不再忧愁\uD83D\uDC97\n\n" + + "查看中石油操作流程\n\n" + + "走得更远,看得更美的风景,加油添生活![太阳]\n\n" + + "好车要好油,优惠更加牛![發]\n\n"; + } + // 贵州 + if (Objects.equals(object.getString("code"), "2")) { + linkContent = + "加满好油,一路畅游!✨✨\n\n" + + "查看中石化操作流程\n\n" + + "用心为您着想,诚意为您服务。\uD83C\uDF39\n\n" + + "油客来自五湖四海,在这里祝您一路顺风。\n\n"; + + } + + } + // 4:支付码牌扫码 + if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type4.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type4.getType())){ + // 支付码码牌上的二维码 + if (Objects.equals(object.getString("codeType"), "PAYMENT_CODE")) { + linkContent = + "点击领取优惠券,享受更多优惠[礼物]\n\n" + + "立即领取优惠券\n\n"; + + + } + + // 支付成功生成的二维码 + if (Objects.equals(object.getString("codeType"), "PAYMENT_SUCCESS")) { + linkContent = + "支付分享,享受更高优惠[礼物]\n\n" + + "分享好友\n\n"; + } + // 扫码分享二维码进入 + if (Objects.equals(object.getString("codeType"), "SHARE")) { + linkContent = + "支付分享,享受更高优惠[礼物]\n\n" + + "分享好友\n\n"; + } + } + + // 5:扫码贵州中石化优惠券二维码 + if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type5.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type5.getType())){ + mapQrCode.put("type", object.getString("encryptType")); + // 二维码参数 + mapQrCode.put("id", object.getString("code")); + // 商户门店 + linkContent = + "山高水远,相伴致远[爱心][爱心]\n\n" + + "领取中石化加油券\n\n" + + "您追求实惠的折扣,我们追求高超的品质\uD83D\uDD16\n\n" + + "迎南来北往宾朋尊驾,[福]\n\n" + + "送平安顺遂诚意祝福![福]\n\n"; + } + // 6:扫码重庆中石油优惠券二维码 + if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type6.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type6.getType())){ + mapQrCode.put("type", object.getString("encryptType")); + // 二维码参数 + mapQrCode.put("id", object.getString("code")); + log.info("map参数:" + mapQrCode); + // 商户门店 + linkContent = + "加好油,添好运,我们更适意[礼物]\n\n" + + "领取中石油加油券\n\n" + + "致力于质量与福利,赢得客户心。\n\n" + + "一路精彩,“油”我相伴!\uD83C\uDF1F\n\n"; + } + } + else { + linkContent = "点击查看更多优惠\n\n"; + } + content = linkContent + "服务热线:400-023-6806"; +// content = +// "您好,感谢关注嗨森逛商城!\n\n" + +// linkContent + +// "服务热线:400-023-6806" +// ; } // 用户扫码进入公众号 @@ -204,8 +318,7 @@ public class WxMsgController { linkContent = "点击领取优惠券,享受更多优惠[礼物]\n\n" + "立即领取优惠券\n\n"; @@ -217,8 +330,7 @@ public class WxMsgController { linkContent = "支付分享,享受更高优惠[礼物]\n\n" + "分享好友\n\n"; } @@ -227,8 +339,7 @@ public class WxMsgController { linkContent = "支付分享,享受更高优惠[礼物]\n\n" + "分享好友\n\n"; } diff --git a/v1/src/main/java/com/v1/controller/business/ApiMerchantsController.java b/v1/src/main/java/com/v1/controller/business/ApiMerchantsController.java index e64978f6..8b825607 100644 --- a/v1/src/main/java/com/v1/controller/business/ApiMerchantsController.java +++ b/v1/src/main/java/com/v1/controller/business/ApiMerchantsController.java @@ -60,7 +60,7 @@ public class ApiMerchantsController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("timetable")) || StringUtils.isBlank(object.getString("sign")) @@ -77,7 +77,7 @@ public class ApiMerchantsController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("timetable" , object.getString("timetable")); map.put("merchId" , object.getString("merchId")); @@ -114,7 +114,7 @@ public class ApiMerchantsController { ip = request.getHeader("x-forwarded-for"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("sign")) ) { @@ -137,7 +137,7 @@ public class ApiMerchantsController { Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { diff --git a/v1/src/main/java/com/v1/controller/business/GzSinopecController.java b/v1/src/main/java/com/v1/controller/business/GzSinopecController.java index 12f2a23a..f8fb79c8 100644 --- a/v1/src/main/java/com/v1/controller/business/GzSinopecController.java +++ b/v1/src/main/java/com/v1/controller/business/GzSinopecController.java @@ -69,7 +69,7 @@ public class GzSinopecController { } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("timetable")) || StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("sign")) @@ -78,9 +78,16 @@ public class GzSinopecController { 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); + } + Map map = new HashMap<>(); map.put("timetable" , object.getString("timetable")); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { @@ -88,12 +95,7 @@ public class GzSinopecController { throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); } - 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_TYPE11.getApiCode(), object.getString("merchId"))) { log.error("getAllCities error!", "当前帐户无权限查询!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, ""); @@ -140,7 +142,7 @@ public class GzSinopecController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("orderNo")) || StringUtils.isBlank(object.getString("count")) || StringUtils.isBlank(object.getString("couTypeCode")) || @@ -153,9 +155,16 @@ public class GzSinopecController { 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); + } + Map map = new HashMap<>(); map.put("timetable" , object.getString("timetable")); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("orderNo" , object.getString("orderNo")); map.put("count" , object.getString("count")); map.put("couTypeCode" , object.getString("couTypeCode")); @@ -167,12 +176,6 @@ public class GzSinopecController { throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); } - 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_TYPE11.getApiCode(), object.getString("merchId"))) { log.error("getAllCities error!", "当前帐户无权限查询!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, ""); @@ -237,7 +240,7 @@ public class GzSinopecController { } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("timetable")) || StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("couNo")) || @@ -247,9 +250,18 @@ public class GzSinopecController { 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); + } + + Map map = new HashMap<>(); map.put("timetable" , object.getString("timetable")); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("couNo" , object.getString("couNo")); map.put("merchId" , object.getString("merchId")); @@ -258,12 +270,7 @@ public class GzSinopecController { throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); } - 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_TYPE11.getApiCode(), object.getString("merchId"))) { log.error("getAllCities error!", "当前帐户无权限查询!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, ""); diff --git a/v1/src/main/java/com/v1/controller/business/KfcController.java b/v1/src/main/java/com/v1/controller/business/KfcController.java index c06c4938..6db3cc7f 100644 --- a/v1/src/main/java/com/v1/controller/business/KfcController.java +++ b/v1/src/main/java/com/v1/controller/business/KfcController.java @@ -79,7 +79,7 @@ public class KfcController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("sign")) ) { @@ -100,7 +100,7 @@ public class KfcController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); @@ -140,7 +140,7 @@ public class KfcController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("storeCode")) || StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("sign")) @@ -162,7 +162,7 @@ public class KfcController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); map.put("storeCode" , object.getString("storeCode")); diff --git a/v1/src/main/java/com/v1/controller/business/MemberProductsController.java b/v1/src/main/java/com/v1/controller/business/MemberProductsController.java index 4c0f1af0..e84d79f4 100644 --- a/v1/src/main/java/com/v1/controller/business/MemberProductsController.java +++ b/v1/src/main/java/com/v1/controller/business/MemberProductsController.java @@ -78,7 +78,7 @@ public class MemberProductsController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("sign")) ) { @@ -99,7 +99,7 @@ public class MemberProductsController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { diff --git a/v1/src/main/java/com/v1/controller/business/MobileRechargeController.java b/v1/src/main/java/com/v1/controller/business/MobileRechargeController.java index 0043b195..dde1658d 100644 --- a/v1/src/main/java/com/v1/controller/business/MobileRechargeController.java +++ b/v1/src/main/java/com/v1/controller/business/MobileRechargeController.java @@ -65,7 +65,7 @@ public class MobileRechargeController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("sign")) ) { @@ -86,7 +86,7 @@ public class MobileRechargeController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { diff --git a/v1/src/main/java/com/v1/controller/business/OrderRebateController.java b/v1/src/main/java/com/v1/controller/business/OrderRebateController.java index 3987598b..5daf1d81 100644 --- a/v1/src/main/java/com/v1/controller/business/OrderRebateController.java +++ b/v1/src/main/java/com/v1/controller/business/OrderRebateController.java @@ -73,8 +73,15 @@ public class OrderRebateController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || + StringUtils.isBlank(object.getString("phone")) || + StringUtils.isBlank(object.getString("productType")) || + StringUtils.isBlank(object.getString("orderNo")) || + StringUtils.isBlank(object.getString("orderId")) || + StringUtils.isBlank(object.getString("price")) || + StringUtils.isBlank(object.getString("title")) || + StringUtils.isBlank(object.getString("createTime")) || StringUtils.isBlank(object.getString("sign")) ) { log.error("getRechargeProduct error!", "请求参数校验失败!"); @@ -89,7 +96,6 @@ public class OrderRebateController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); map.put("merchId" , object.getString("merchId")); map.put("phone" , object.getString("phone")); map.put("productType" , object.getInteger("productType")); @@ -98,6 +104,7 @@ public class OrderRebateController { map.put("price" , object.getBigDecimal("price")); map.put("title" , object.getString("title")); map.put("createTime" , object.getDate("createTime")); + map.put("apiKey" , apiMerchants.getApiKey()); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { log.error("getRechargeProduct error!", "签名校验失败!"); @@ -113,10 +120,10 @@ public class OrderRebateController { } } - @RequestMapping(value = "/recycleIntegralPre", method = RequestMethod.POST) + @RequestMapping(value = "/recycleIntegral", method = RequestMethod.POST) @ResponseBody - @ApiOperation(value = "退款回收积分预处理") - public ResponseData recycleIntegralPre(@RequestBody JSONObject object , HttpServletRequest request ) { + @ApiOperation(value = "退款回收积分") + public ResponseData recycleIntegral(@RequestBody JSONObject object , HttpServletRequest request ) { try { String ip = ""; @@ -132,10 +139,10 @@ public class OrderRebateController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("orderNo")) || - StringUtils.isBlank(object.getString("userId")) || + StringUtils.isBlank(object.getString("orderId")) || StringUtils.isBlank(object.getString("sign")) ) { log.error("getRechargeProduct error!", "请求参数校验失败!"); @@ -150,10 +157,10 @@ public class OrderRebateController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); + map.put("orderId" , object.getString("orderId")); map.put("orderNo" , object.getString("orderNo")); - map.put("userId" , object.getString("userId")); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { @@ -164,27 +171,32 @@ public class OrderRebateController { Map mapGold = new HashMap<>(); mapGold.put("goldType", 1); - mapGold.put("resType", object.getInteger("productType")); mapGold.put("resId", object.getLong("orderId")); List goldRecs = highGoldRecService.getGoldRec(mapGold); + if (goldRecs.size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "未知订单号"); + } + Integer integralNum = 0; - // 查询用户信息 - HighUser user = highUserService.findByUserId(object.getLong("userId")); + Long userId = null; for (HighGoldRec goldRec : goldRecs) { + userId = goldRec.getUserId(); integralNum += goldRec.getGold(); } + HighUser user = highUserService.findByUserId(userId); + if (integralNum > user.getGold()) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "积分数量不足"); } - String remark = "订单" + object.getString("orderNo") + "退款,退还积分:" + integralNum; + String remark = "订单" + object.getString("orderNo") + "退款积分冻结:" + integralNum; // 积分退款 - highUserService.goldHandle(user.getId(), integralNum,2, object.getInteger("productType"), object.getLong("orderId") , remark); + highUserService.goldHandle(user.getId(), integralNum,2, 103, object.getLong("orderId") , remark , object.getString("orderNo")); return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { @@ -194,10 +206,10 @@ public class OrderRebateController { } - @RequestMapping(value = "/recycleIntegral", method = RequestMethod.POST) + @RequestMapping(value = "/refundReturn", method = RequestMethod.POST) @ResponseBody - @ApiOperation(value = "退款回收积分处理") - public ResponseData recycleIntegral(@RequestBody JSONObject object , HttpServletRequest request ) { + @ApiOperation(value = "退款回调") + public ResponseData refundReturn(@RequestBody JSONObject object , HttpServletRequest request ) { try { String ip = ""; @@ -213,11 +225,11 @@ public class OrderRebateController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("orderId")) || + StringUtils.isBlank(object.getString("refundStatus")) || StringUtils.isBlank(object.getString("orderNo")) || - StringUtils.isBlank(object.getString("productType")) || StringUtils.isBlank(object.getString("sign")) ) { log.error("getRechargeProduct error!", "请求参数校验失败!"); @@ -232,10 +244,10 @@ public class OrderRebateController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); - map.put("productType" , object.getInteger("productType")); map.put("orderId" , object.getLong("orderId")); + map.put("refundStatus" , object.getString("refundStatus")); map.put("orderNo" , object.getString("orderNo")); @@ -244,20 +256,50 @@ public class OrderRebateController { throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); } - Map mapGold = new HashMap<>(); - mapGold.put("goldType", 1); - mapGold.put("resType", object.getInteger("productType")); + mapGold.put("goldType", 2); + mapGold.put("resType", 103); mapGold.put("resId", object.getLong("orderId")); - List goldRecs = highGoldRecService.getGoldRec(mapGold); + HighGoldRec goldRecs = highGoldRecService.findGoldRec(mapGold); - for (HighGoldRec goldRec : goldRecs) { - String remark = "订单" + object.getString("orderNo") + "退款,退还积分:" + goldRec.getGold(); + if (goldRecs == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "未知订单号"); + } + + if (object.getString("refundStatus").equals("succeed")) { + // 查询是否存在多次退款 + Map mapGoldRepeat = new HashMap<>(); + mapGoldRepeat.put("goldType", 1); + mapGoldRepeat.put("resType", 3); + mapGoldRepeat.put("resId", object.getLong("orderId")); + + List goldRecsRepeat = highGoldRecService.getGoldRec(mapGoldRepeat); + + if (goldRecsRepeat.size() > 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "重复退款"); + } + + String remark = "订单" + object.getString("orderNo") + "退款成功扣除积分:" + goldRecs.getGold(); + goldRecs.setResType(3); + goldRecs.setUpdateTime(new Date()); + goldRecs.setRemark(remark); + highGoldRecService.updateGoldRec(goldRecs); + } else { + + String remark = "订单" + object.getString("orderNo") + "退款失败,退还积分:" + goldRecs.getGold(); + goldRecs.setStatus(0); + goldRecs.setUpdateTime(new Date()); + highGoldRecService.updateGoldRec(goldRecs); // 积分退款 - highUserService.goldHandle(goldRec.getUserId(), goldRec.getGold(),2, object.getInteger("productType"), object.getLong("orderId") , remark); + highUserService.goldHandle(goldRecs.getUserId(), goldRecs.getGold(),1, 104, object.getLong("orderId") , remark , object.getString("orderNo")); + } + + + + return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); diff --git a/v1/src/main/java/com/v1/controller/business/RefuelOnlineController.java b/v1/src/main/java/com/v1/controller/business/RefuelOnlineController.java index bf4b8b3b..7b4b08ca 100644 --- a/v1/src/main/java/com/v1/controller/business/RefuelOnlineController.java +++ b/v1/src/main/java/com/v1/controller/business/RefuelOnlineController.java @@ -74,7 +74,7 @@ public class RefuelOnlineController { ip = request.getHeader("x-forwarded-for"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("sign")) ) { @@ -100,7 +100,7 @@ public class RefuelOnlineController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { diff --git a/v1/src/main/java/com/v1/controller/business/StarbucksController.java b/v1/src/main/java/com/v1/controller/business/StarbucksController.java index cd7805af..f53a63bf 100644 --- a/v1/src/main/java/com/v1/controller/business/StarbucksController.java +++ b/v1/src/main/java/com/v1/controller/business/StarbucksController.java @@ -78,7 +78,7 @@ public class StarbucksController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("lat")) || StringUtils.isBlank(object.getString("lon")) || @@ -101,7 +101,7 @@ public class StarbucksController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); map.put("lat" , object.getString("lat")); map.put("lon" , object.getString("lon")); @@ -145,7 +145,7 @@ public class StarbucksController { throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); } - if (StringUtils.isBlank(object.getString("apiKey")) || + if ( StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("sign")) ) { @@ -166,7 +166,7 @@ public class StarbucksController { } Map map = new HashMap<>(); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { diff --git a/v1/src/main/java/com/v1/controller/orderController.java b/v1/src/main/java/com/v1/controller/orderController.java index 1040a9a2..f944c1b3 100644 --- a/v1/src/main/java/com/v1/controller/orderController.java +++ b/v1/src/main/java/com/v1/controller/orderController.java @@ -9,11 +9,14 @@ import com.hai.config.WxOrderConfig; import com.hai.entity.ApiMerchants; import com.hai.entity.ApiOrder; import com.hai.entity.ApiProductConfig; +import com.hai.entity.HighOrder; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.openApi.service.ApiOrderService; import com.hai.order.model.RefundPriceModel; +import com.hai.order.service.OrderService; import com.hai.order.type.OrderProductType; +import com.hai.order.type.OrderRefundOpUserType; import com.hai.service.*; import com.v1.config.ToolConfig; import io.swagger.annotations.Api; @@ -51,8 +54,9 @@ public class orderController { @Autowired private RedisTemplate redisTemplate; + @Resource - private ApiOrderService orderService; + private OrderService orderService; @Resource private ApiIpAddressService apiIpAddressService; @@ -60,6 +64,9 @@ public class orderController { @Resource private ApiOrderService apiOrderService; + @Resource + private HighOrderService highOrderService; + @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") @@ -80,7 +87,6 @@ public class orderController { } if ( - StringUtils.isBlank(object.getString("apiKey")) || StringUtils.isBlank(object.getString("productType")) || StringUtils.isBlank(object.getString("timetable")) || StringUtils.isBlank(object.getString("orderNo")) || @@ -108,7 +114,7 @@ public class orderController { map.put("timetable" , object.getString("timetable")); map.put("orderNo" , object.getString("orderNo")); map.put("productType" , object.getString("productType")); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("content" , object.getString("content")); map.put("merchId" , object.getString("merchId")); @@ -162,7 +168,7 @@ public class orderController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写下单手机号,就餐方式,下单信息,门店编码"); } } - return ResponseMsgUtil.success(orderService.createOrder(object)); + return ResponseMsgUtil.success(apiOrderService.createOrder(object)); } catch (Exception e) { log.error("HighOpenApiController --> createOrder() error!", e); @@ -190,7 +196,6 @@ public class orderController { } if ( - StringUtils.isBlank(object.getString("apiKey")) || StringUtils.isBlank(object.getString("mchOrderNo")) || StringUtils.isBlank(object.getString("sign")) || StringUtils.isBlank(object.getString("merchId")) @@ -208,7 +213,7 @@ public class orderController { Map map = new HashMap<>(); map.put("mchOrderNo" , object.getString("mchOrderNo")); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); if (!secConfigService.isSignVerify(map, object.getString("sign"))) { @@ -225,7 +230,7 @@ public class orderController { object.put("orderNo" , apiOrder.getOrderNo()); - ApiOrder order = orderService.payOrder(object); + ApiOrder order = apiOrderService.payOrder(object); return ResponseMsgUtil.success(order); @@ -258,7 +263,6 @@ public class orderController { } if ( - StringUtils.isBlank(object.getString("apiKey")) || StringUtils.isBlank(object.getString("mchOrderNo")) || StringUtils.isBlank(object.getString("sign")) || StringUtils.isBlank(object.getString("merchId")) @@ -276,7 +280,7 @@ public class orderController { Map map = new HashMap<>(); map.put("mchOrderNo" , object.getString("mchOrderNo")); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); if (!secConfigService.isSignVerify(map, object.getString("sign"))) { @@ -292,14 +296,80 @@ public class orderController { } } + @RequestMapping(value = "/refund", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "退款") + public ResponseData refund(@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("mchOrderNo")) || + StringUtils.isBlank(object.getString("sign")) || + StringUtils.isBlank(object.getString("merchId")) + ) { + log.error("createOrder 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); + } + + Map map = new HashMap<>(); + map.put("mchOrderNo" , object.getString("mchOrderNo")); + map.put("apiKey" , apiMerchants.getApiKey()); + map.put("merchId" , object.getString("merchId")); + + if (!secConfigService.isSignVerify(map, object.getString("sign"))) { + log.error("createOrder error!", "签名校验失败!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + } + + ApiOrder apiOrder = apiOrderService.findByOrderNo(object.getString("mchOrderNo") , null); + + HighOrder order = highOrderService.getOrderByOrderNo(apiOrder.getOrderNo()); + + + 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("HighOpenApiController --> createOrder() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "对外订单退款接口") public ResponseData externalOrderRefund(@RequestBody JSONObject object , HttpServletRequest request) { try { - System.out.println(object); - String ip = ""; // 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for if (request.getHeader("x-forwarded-for") == null) { @@ -314,7 +384,6 @@ public class orderController { } if ( - StringUtils.isBlank(object.getString("apiKey")) || StringUtils.isBlank(object.getString("paySerialNo")) || StringUtils.isBlank(object.getString("wxMchId")) || StringUtils.isBlank(object.getString("refundPrice")) || @@ -338,7 +407,7 @@ public class orderController { map.put("wxMchId" , object.getString("wxMchId")); map.put("payRealPrice" , object.getString("payRealPrice")); map.put("refundPrice" , object.getString("refundPrice")); - map.put("apiKey" , object.getString("apiKey")); + map.put("apiKey" , apiMerchants.getApiKey()); map.put("merchId" , object.getString("merchId")); if (!secConfigService.isSignVerify(map, object.getString("sign"))) {