From 21729963619ba3220b93cfeac718277add7b3d7d Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 12 Jan 2024 14:38:55 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev --- .../bweb/controller/BsCompanyController.java | 2 +- .../BsDistributionUserRelController.java | 19 - .../bweb/controller/HighCouponController.java | 2 +- .../controller/HighDiscountController.java | 33 + .../bweb/controller/HighTestController.java | 2 +- .../controller/Goods/GoodsController.java | 12 +- .../controller/HighThirdPartyController.java | 23 - .../web/controller/OrderPayController.java | 2 +- hai-order/src/main/resources/dev/logback.xml | 21 + hai-order/src/main/resources/prod/logback.xml | 20 + .../java/com/hai/config/CmsContentConfig.java | 2 +- .../com/hai/config/HuiLianTongConfig.java | 2 +- .../main/java/com/hai/config/PetroConfig.java | 2 +- .../java/com/hai/config/RechargeConfig.java | 12 + .../com/hai/enum_type/CmsContentDataEnum.java | 1 + .../service/impl/ApiOrderServiceImpl.java | 5 +- .../service/impl/OrderPayServiceImpl.java | 4 +- .../com/hai/service/HighOrderService.java | 146 +-- .../impl/HighDiscountUserRelServiceImpl.java | 3 + .../service/impl/HighOrderServiceImpl.java | 870 ------------------ .../resources/dev/commonConfig.properties | 2 + .../com/v1/controller/WxMsgController.java | 25 +- v1/src/main/resources/dev/logback.xml | 21 + v1/src/main/resources/prod/logback.xml | 20 + 24 files changed, 172 insertions(+), 1079 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java b/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java index 27e0f26f..929c0232 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java @@ -108,7 +108,7 @@ public class BsCompanyController { // 校验该区域是否存在公司 if (bsCompanyService.selectCompanyByRegion(secCompanyModel.getCompany().getRegionId()) != null) { log.error("BsCompanyController --> addCompanyAndUser() error!", "该区域分公司已存在"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, ""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "该区域分公司已存在"); } // 校验公司名称 diff --git a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java index cd59ca2f..79213782 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java @@ -137,24 +137,5 @@ public class BsDistributionUserRelController { } } - @RequestMapping(value = "/orderListByAgentId", method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "B端查询代理商订单") - public ResponseData orderListByAgentId(@RequestParam(name = "agentId", required = false) Long agentId, - @RequestParam(name = "code", required = false) Long code, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize) { - try { - - Map map = new HashMap<>(); - map.put("agentId" , agentId); - map.put("code" , code); - PageHelper.startPage(pageNum,pageSize); - return ResponseMsgUtil.success(new PageInfo<>(highOrderService.orderListByAgentId(map))); - } catch (Exception e) { - log.error("HighOrderController --> getBackendToken() error!", e); - return ResponseMsgUtil.exception(e); - } - } } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index 81702877..4f37c4f0 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -326,7 +326,7 @@ public class HighCouponController { } } - if (coupon.getCompanyId() == 57) { + if (coupon.getCompanyId() == 57 || coupon.getCompanyId() == 58) { coupon.setStatus(2); highCouponService.updateCoupon(coupon); coupon.setUpdateTime(new Date()); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java index ffcd1c9d..79359147 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java @@ -13,6 +13,7 @@ import com.hai.entity.HighDiscount; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; import com.hai.service.HighDiscountService; +import com.hai.service.HighDiscountUserRelService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -47,6 +48,9 @@ public class HighDiscountController { @Resource private HighDiscountService highDiscountService; + @Resource + private HighDiscountUserRelService discountUserRelService; + @RequestMapping(value="/insertDiscount",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "增加优惠券") @@ -234,4 +238,33 @@ public class HighDiscountController { } } + @RequestMapping(value="/getAgentDiscountList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询代理商优惠券列表") + public ResponseData getAgentDiscountList(@RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "discountName", required = false) String discountName, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + if (userInfoModel.getHighAgent() == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, ""); + } + + Map param = new HashMap<>(); + param.put("ext1", userInfoModel.getHighAgent().getId()); + param.put("discountName", discountName); + param.put("status", status); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(discountUserRelService.getDiscountList(param))); + + } catch (Exception e) { + log.error("HighDiscountController -> getUserDiscountList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + } 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 b6917712..9b96ab80 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.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.entity.*; import com.hai.enum_type.GasOilPriceStatusEnum; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.openApi.config.BlxConfig; import com.hai.order.service.OrderService; import com.hai.order.type.OrderProductType; import com.hai.order.type.OrderRefundOpUserType; import com.hai.order.utils.OrderUtil; import com.hai.pay.channel.huipay.config.HuiConfig; 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.bouncycastle.LICENSE; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.FileOutputStream; import java.io.InputStream; import java.math.BigDecimal; import java.net.URL; import java.net.URLConnection; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @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 BsOrderRebateService bsOrderRebateService; @Resource private PetroConfig petroConfig; @Resource private HighGoldRecService highGoldRecService; @Resource private OrderService orderService; @Resource private HighUserCardService highUserCardService; @Resource private HighOrderService highOrderService; @Resource private HighUserService highUserService; @Resource private HighGasService gasService; @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HuiConfig huiConfig; @Resource private CommonService commonService; @Resource private HighOilCardOrderService highOilCardOrderService; @Resource private HighGasOrderService gasOrderService; @Resource private ShellGroupService shellGroupService; @Resource private HighMerchantStoreService merchantStoreService; @RequestMapping(value = "/gasSyncPayment", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "重庆壳牌推送") public ResponseData gasSyncPayment(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighGasOrder order = gasOrderService.getDetailByOrderNo(orderNo); if (order != null) { // 查询油站 HighMerchantStore store = merchantStoreService.getDetailById(order.getStoreId()); if (store == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店"); } return ResponseMsgUtil.success( // 推送加好油 shellGroupService.gasSyncPayment(order.getOrderNo(), store.getStoreKey(), order.getPayTime(), order.getGasRefuelPrice(), order.getGasOilNo(), order.getGasGunNo(), order.getPayPrice(), order.getTotalDeductionPrice() ) ); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncPayment() error!", e); return ResponseMsgUtil.exception(e); } } @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 = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230394901"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("content" , object.getJSONObject("content").toString()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "B94B5E62807FA56A7260AB581D8A1B48", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(Integer.valueOf(3)); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardByCardNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据卡号查询汇联通工会卡详情") public ResponseData getHuiLianTongCardByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) { try { // 查询工会卡 JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(cardNo); JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); return ResponseMsgUtil.success(resolveResponse); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/consumption", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡支付") public ResponseData consumption(@RequestParam(name = "payRealPrice", required = true) BigDecimal payRealPrice, @RequestParam(name = "cardNo", required = true) String cardNo) { try { String goodsDesc = ""; String tranDesc = ""; String instCode = "11101527"; String businessType = "hisen_consume"; // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(OrderUtil.generateOrderNo(), cardNo, payRealPrice, businessType, instCode, goodsDesc, tranDesc); if (!consumption.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } // 响应参数 JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); if (consumptionResult.getBoolean("success") != true) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); } return ResponseMsgUtil.success(consumptionResult); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, OrderProductType.getDataByType(order.getProductType()).getName() + "退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); if (order.getProductType().equals(4)) { HighUser user = highUserService.findByUserId(order.getMemId()); // 获取应退款积分 int integralNum = order.getTotalPrice().multiply(new BigDecimal(100)).intValue(); if ( integralNum> user.getGold()) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "积分数量不足"); } String remark = "订单" + order.getOrderNo() + "退还积分:" + integralNum; // 积分退款 highUserService.goldHandle(user.getId(), integralNum,2, 3, order.getId() , remark , order.getOrderNo()); } return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @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 = "/getBlxCouponBalance", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询停车券") public ResponseData getBlxCouponBalance(@RequestParam(name = "phone", required = true) String phone) { try { highUserCardService.getBlxCouponBalance(phone); return ResponseMsgUtil.success("object"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsParking", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData queryJsParking(@RequestParam(name = "gps", required = true) String gps) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("gps" , gps); mapPost.put("range" , "1000"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsParking" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getUserCouponPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData getUserCouponPage(@RequestParam(name = "phone", required = true) String phone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("phone" , phone); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getUserCouponPage" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData queryJsOrderList(@RequestParam(name = "carNo", required = true) String carNo, @RequestParam(name = "orderStatus", required = true) String orderStatus) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("orderStatus" , orderStatus); mapPost.put("carNo" , carNo); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsOrderList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/sendCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发放券") public ResponseData sendCoupon(@RequestParam(name = "couponCode", required = true) String couponCode, @RequestParam(name = "receiverCount", required = true) String receiverCount, @RequestParam(name = "receiverPhone", required = true) String receiverPhone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getCouponList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/preorder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发起支付") public ResponseData preorder() { try { JSONObject object = new JSONObject(); object.put("outTradeNo" , "HUI" + OrderUtil.generateOrderNo()); object.put("transType" , "JSAPI"); object.put("payMode" , "WECHAT"); object.put("totalAmount" , "0.01"); object.put("profitSharing" , 0); object.put("subject" , "测试"); object.put("userId" , "oUGn_4unIjp90MY-oEXluY4laDrQ"); return ResponseMsgUtil.success(huiConfig.preorder(object)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryGasInfoListByPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油门店") public ResponseData queryGasInfoListByPage() { try { HighMerchantModel merchant = highMerchantService.getMerchantById(39L); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue();i++) { JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; for (Object gasObject : jsonArray) { JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); if (store != null) { store.setType(1); store.setSourceType(2); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("gasId")); store.setStoreName(object.getString("gasName")); store.setStoreLogo(object.getString("gasLogoSmall")); store.setRegionId(object.getLong("provinceCode")); store.setRegionName(object.getString("provinceName")); store.setAddress(object.getString("gasAddress")); store.setLongitude(object.getString("gasAddressLongitude")); store.setLatitude(object.getString("gasAddressLatitude")); store.setStatus(object.getInteger("gasStatus")); store.setPrestoreType(0); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getString("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setSourceType(2); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("gasId")); highMerchantStore.setStoreName(object.getString("gasName")); highMerchantStore.setStoreLogo(object.getString("gasLogoSmall")); highMerchantStore.setRegionId(object.getLong("provinceCode")); highMerchantStore.setRegionName(object.getString("provinceName")); highMerchantStore.setAddress(object.getString("gasAddress")); highMerchantStore.setLongitude(object.getString("gasAddressLongitude")); highMerchantStore.setLatitude(object.getString("gasAddressLatitude")); highMerchantStore.setStatus(1); highMerchantStore.setPrestoreType(0); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } } return ResponseMsgUtil.success("完成"); } 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(@RequestParam(name = "no", required = true) String no) { try { JSONObject jsonObject = DianConfig.getGasInfoByGasId(no); return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getGasInfoAll", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取全量油站") public ResponseData getGasInfoAll() { try { HighMerchantModel merchant = highMerchantService.getMerchantById(39L); JSONObject jsonObject = DianConfig.getGasInfoAll(); JSONArray resultObject = jsonObject.getObject("result", JSONArray.class); for (int i = 0; i < resultObject.size();i++) { Object objectData = resultObject.get(i); JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectData)); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("jyzid")); SecRegion region = commonService.getRegionsByName(object.getString("province")); if (store != null) { store.setType(1); store.setSourceType(6); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("jyzid")); store.setStoreName(object.getString("mingcheng")); store.setStoreLogo(object.getString("tupian")); store.setRegionId(region.getRegionId()); store.setRegionName(object.getString("province")); store.setAddress(object.getString("dizhi")); store.setLongitude(object.getString("lng")); store.setLatitude(object.getString("lat")); store.setStatus(object.getInteger("zhuangtai")); store.setPrestoreType(0); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getString("youhao")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName( oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setSourceType(6); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("jyzid")); highMerchantStore.setStoreName(object.getString("mingcheng")); highMerchantStore.setStoreLogo(object.getString("tupian")); highMerchantStore.setRegionId(region.getRegionId()); highMerchantStore.setRegionName(object.getString("province")); highMerchantStore.setAddress(object.getString("dizhi")); highMerchantStore.setLongitude(object.getString("lng")); highMerchantStore.setLatitude(object.getString("lat")); highMerchantStore.setStatus(1); highMerchantStore.setPrestoreType(0); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getOrderPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getOrderPay") public ResponseData getOrderPay(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOilCardOrder highOilCardOrder = highOilCardOrderService.findOrder(orderNo); highOilCardOrder.setStatus(2); JSONObject object = KytcService.getOrderPay(highOilCardOrder.getThirdOrderNo() , highOilCardOrder.getPrice() , highOilCardOrder.getCardNo()); highOilCardOrder.setExt1(object.toJSONString()); highOilCardOrderService.updateOilCardOrder(highOilCardOrder); return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getOrderInfo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getOrderInfo") public ResponseData getOrderInfo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOilCardOrder highOilCardOrder = highOilCardOrderService.findOrder(orderNo); JSONObject object = KytcService.getOrderInfo(highOilCardOrder.getThirdOrderNo()); highOilCardOrder.setExt2(object.toJSONString()); if (object.getBoolean("State") == true) { JSONObject jsonObject = object.getJSONObject("Data"); if (jsonObject.getInteger("OilOrderState") == 2) { highOilCardOrder.setStatus(3); HighOrder highOrder = highOrderService.getOrderByOrderNo(highOilCardOrder.getOrderNo()); highOrder.setOrderStatus(3); highOrder.getHighChildOrderList().get(0).setChildOrderStatus(3); highOrderService.updateOrder(highOrder); } } highOilCardOrderService.updateOilCardOrder(highOilCardOrder); return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取物流") public ResponseData getLogisticsMsg(@RequestParam(name = "no", required = true) String no) { try { JSONObject jsonObjects = CommonConfig.getLogisticsMsg(no); return ResponseMsgUtil.success(jsonObjects); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } // @RequestMapping(value = "/synCouponRule", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "获取卡券") // public ResponseData synCouponRule() { // try { // return ResponseMsgUtil.success(PetroConfig.synCouponRule()); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } // @RequestMapping(value = "/getCoupon", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "卡券下单") // public ResponseData getCoupon() { // try { // // JSONObject jsonObject = PetroConfig.getCoupon("16000443991501" , "18090580471" , OrderUtil.generateOrderNo()); // String data = PetroConfig.decrypt(jsonObject.getString("biz_content")); // JSONObject object = JSONObject.parseObject(data); // // return ResponseMsgUtil.success(object); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } @RequestMapping(value = "/decrypt", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解码") public ResponseData decrypt(@RequestParam(name = "content", required = true) String content) { try { String data = PetroConfig.decrypt(content); return ResponseMsgUtil.success(data); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deleteOilNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "删除油品") public ResponseData deleteOilNo() { try { gasService.deleteOilNo(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getJiaHaoYouAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "加好油油站刷新") public ResponseData getJiaHaoYouAllStation() { try { gasService.getJiaHaoYouAllStation(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getDianAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "点点网络") public ResponseData getDianAllStation() { try { gasService.getDianAllStation(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/integralRebateOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "积分返利") public ResponseData integralRebateOrder() { try { // 查询满足初步返利条件订单 List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { // 查询是否存在积分记录 Map map = new HashMap<>(); map.put("goldType", 1); map.put("resType", 4); map.put("userId", highOrder.getMemId()); map.put("resId", highOrder.getId()); List goldRecs = highGoldRecService.getGoldRec(map); // 判断是否重复赠送积分 if (goldRecs.size() == 0) { bsOrderRebateService.insertOrderRebate(highOrder); } highOrder.setWhetherRebate(true); highOrderService.updateOrderDetail(highOrder); } return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getApiCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取卡券") public ResponseData getApiCoupon() { try { // 查询满足初步返利条件订单 List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { // 查询是否存在积分记录 Map map = new HashMap<>(); map.put("goldType", 1); map.put("resType", 4); map.put("userId", highOrder.getMemId()); map.put("resId", highOrder.getId()); List goldRecs = highGoldRecService.getGoldRec(map); // 判断是否重复赠送积分 if (goldRecs.size() == 0) { bsOrderRebateService.insertOrderRebate(highOrder); } highOrder.setWhetherRebate(true); highOrderService.updateOrderDetail(highOrder); } return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getCouponList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData getCouponList(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { PetroConfig.init(2); JSONObject jsonObject = petroConfig.couponDetail(mchOrderNo); if (!jsonObject.getString("code").equals("1")) { throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前订单未查询到!"); } String data = PetroConfig.decrypt(jsonObject.getString("biz_content")); JSONObject jsonData = JSONObject.parseObject(data); return ResponseMsgUtil.success(jsonData); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付退款") public ResponseData refund(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20231255604"); mapPost.put("mchOrderNo" , mchOrderNo); // mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "7CCB9CB8B630CDB8E32A694426BED12B", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/refund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/decryptPetroConfig", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解码") public ResponseData decryptPetroConfig(@RequestParam(name = "content", required = true) String content) { try { PetroConfig.init(1); String data = PetroConfig.decrypt(content); JSONObject object = JSONObject.parseObject(data); return ResponseMsgUtil.success(object); } 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.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.entity.*; import com.hai.enum_type.GasOilPriceStatusEnum; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.openApi.config.BlxConfig; import com.hai.order.service.OrderService; import com.hai.order.type.OrderProductType; import com.hai.order.type.OrderRefundOpUserType; import com.hai.order.utils.OrderUtil; import com.hai.pay.channel.huipay.config.HuiConfig; 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.bouncycastle.LICENSE; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.FileOutputStream; import java.io.InputStream; import java.math.BigDecimal; import java.net.URL; import java.net.URLConnection; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @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 BsOrderRebateService bsOrderRebateService; @Resource private PetroConfig petroConfig; @Resource private HighGoldRecService highGoldRecService; @Resource private OrderService orderService; @Resource private HighUserCardService highUserCardService; @Resource private HighOrderService highOrderService; @Resource private HighUserService highUserService; @Resource private HighGasService gasService; @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HuiConfig huiConfig; @Resource private CommonService commonService; @Resource private HighOilCardOrderService highOilCardOrderService; @Resource private HighGasOrderService gasOrderService; @Resource private ShellGroupService shellGroupService; @Resource private HighMerchantStoreService merchantStoreService; @RequestMapping(value = "/gasSyncPayment", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "重庆壳牌推送") public ResponseData gasSyncPayment(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighGasOrder order = gasOrderService.getDetailByOrderNo(orderNo); if (order != null) { // 查询油站 HighMerchantStore store = merchantStoreService.getDetailById(order.getStoreId()); if (store == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店"); } return ResponseMsgUtil.success( // 推送加好油 shellGroupService.gasSyncPayment(order.getOrderNo(), store.getStoreKey(), order.getPayTime(), order.getGasRefuelPrice(), order.getGasOilNo(), order.getGasGunNo(), order.getPayPrice(), order.getTotalDeductionPrice() ) ); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncPayment() error!", e); return ResponseMsgUtil.exception(e); } } @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 = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230394901"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("content" , object.getJSONObject("content").toString()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "B94B5E62807FA56A7260AB581D8A1B48", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(Integer.valueOf(3)); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardByCardNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据卡号查询汇联通工会卡详情") public ResponseData getHuiLianTongCardByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) { try { // 查询工会卡 JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(cardNo); JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); return ResponseMsgUtil.success(resolveResponse); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/consumption", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡支付") public ResponseData consumption(@RequestParam(name = "payRealPrice", required = true) BigDecimal payRealPrice, @RequestParam(name = "cardNo", required = true) String cardNo) { try { String goodsDesc = ""; String tranDesc = ""; String instCode = "11101652"; String businessType = "hisen_consume"; // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(OrderUtil.generateOrderNo(), cardNo, payRealPrice, businessType, instCode, goodsDesc, tranDesc); if (!consumption.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } // 响应参数 JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); if (consumptionResult.getBoolean("success") != true) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); } return ResponseMsgUtil.success(consumptionResult); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, OrderProductType.getDataByType(order.getProductType()).getName() + "退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); if (order.getProductType().equals(4)) { HighUser user = highUserService.findByUserId(order.getMemId()); // 获取应退款积分 int integralNum = order.getTotalPrice().multiply(new BigDecimal(100)).intValue(); if ( integralNum> user.getGold()) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "积分数量不足"); } String remark = "订单" + order.getOrderNo() + "退还积分:" + integralNum; // 积分退款 highUserService.goldHandle(user.getId(), integralNum,2, 3, order.getId() , remark , order.getOrderNo()); } return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @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 = "/getBlxCouponBalance", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询停车券") public ResponseData getBlxCouponBalance(@RequestParam(name = "phone", required = true) String phone) { try { highUserCardService.getBlxCouponBalance(phone); return ResponseMsgUtil.success("object"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsParking", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData queryJsParking(@RequestParam(name = "gps", required = true) String gps) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("gps" , gps); mapPost.put("range" , "1000"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsParking" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getUserCouponPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData getUserCouponPage(@RequestParam(name = "phone", required = true) String phone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("phone" , phone); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getUserCouponPage" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData queryJsOrderList(@RequestParam(name = "carNo", required = true) String carNo, @RequestParam(name = "orderStatus", required = true) String orderStatus) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("orderStatus" , orderStatus); mapPost.put("carNo" , carNo); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsOrderList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/sendCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发放券") public ResponseData sendCoupon(@RequestParam(name = "couponCode", required = true) String couponCode, @RequestParam(name = "receiverCount", required = true) String receiverCount, @RequestParam(name = "receiverPhone", required = true) String receiverPhone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getCouponList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/preorder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发起支付") public ResponseData preorder() { try { JSONObject object = new JSONObject(); object.put("outTradeNo" , "HUI" + OrderUtil.generateOrderNo()); object.put("transType" , "JSAPI"); object.put("payMode" , "WECHAT"); object.put("totalAmount" , "0.01"); object.put("profitSharing" , 0); object.put("subject" , "测试"); object.put("userId" , "oUGn_4unIjp90MY-oEXluY4laDrQ"); return ResponseMsgUtil.success(huiConfig.preorder(object)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryGasInfoListByPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油门店") public ResponseData queryGasInfoListByPage() { try { HighMerchantModel merchant = highMerchantService.getMerchantById(39L); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue();i++) { JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; for (Object gasObject : jsonArray) { JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); if (store != null) { store.setType(1); store.setSourceType(2); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("gasId")); store.setStoreName(object.getString("gasName")); store.setStoreLogo(object.getString("gasLogoSmall")); store.setRegionId(object.getLong("provinceCode")); store.setRegionName(object.getString("provinceName")); store.setAddress(object.getString("gasAddress")); store.setLongitude(object.getString("gasAddressLongitude")); store.setLatitude(object.getString("gasAddressLatitude")); store.setStatus(object.getInteger("gasStatus")); store.setPrestoreType(0); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getString("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setSourceType(2); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("gasId")); highMerchantStore.setStoreName(object.getString("gasName")); highMerchantStore.setStoreLogo(object.getString("gasLogoSmall")); highMerchantStore.setRegionId(object.getLong("provinceCode")); highMerchantStore.setRegionName(object.getString("provinceName")); highMerchantStore.setAddress(object.getString("gasAddress")); highMerchantStore.setLongitude(object.getString("gasAddressLongitude")); highMerchantStore.setLatitude(object.getString("gasAddressLatitude")); highMerchantStore.setStatus(1); highMerchantStore.setPrestoreType(0); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } } return ResponseMsgUtil.success("完成"); } 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(@RequestParam(name = "no", required = true) String no) { try { JSONObject jsonObject = DianConfig.getGasInfoByGasId(no); return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getGasInfoAll", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取全量油站") public ResponseData getGasInfoAll() { try { HighMerchantModel merchant = highMerchantService.getMerchantById(39L); JSONObject jsonObject = DianConfig.getGasInfoAll(); JSONArray resultObject = jsonObject.getObject("result", JSONArray.class); for (int i = 0; i < resultObject.size();i++) { Object objectData = resultObject.get(i); JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectData)); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("jyzid")); SecRegion region = commonService.getRegionsByName(object.getString("province")); if (store != null) { store.setType(1); store.setSourceType(6); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("jyzid")); store.setStoreName(object.getString("mingcheng")); store.setStoreLogo(object.getString("tupian")); store.setRegionId(region.getRegionId()); store.setRegionName(object.getString("province")); store.setAddress(object.getString("dizhi")); store.setLongitude(object.getString("lng")); store.setLatitude(object.getString("lat")); store.setStatus(object.getInteger("zhuangtai")); store.setPrestoreType(0); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getString("youhao")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName( oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setSourceType(6); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("jyzid")); highMerchantStore.setStoreName(object.getString("mingcheng")); highMerchantStore.setStoreLogo(object.getString("tupian")); highMerchantStore.setRegionId(region.getRegionId()); highMerchantStore.setRegionName(object.getString("province")); highMerchantStore.setAddress(object.getString("dizhi")); highMerchantStore.setLongitude(object.getString("lng")); highMerchantStore.setLatitude(object.getString("lat")); highMerchantStore.setStatus(1); highMerchantStore.setPrestoreType(0); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getOrderPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getOrderPay") public ResponseData getOrderPay(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOilCardOrder highOilCardOrder = highOilCardOrderService.findOrder(orderNo); highOilCardOrder.setStatus(2); JSONObject object = KytcService.getOrderPay(highOilCardOrder.getThirdOrderNo() , highOilCardOrder.getPrice() , highOilCardOrder.getCardNo()); highOilCardOrder.setExt1(object.toJSONString()); highOilCardOrderService.updateOilCardOrder(highOilCardOrder); return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getOrderInfo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getOrderInfo") public ResponseData getOrderInfo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOilCardOrder highOilCardOrder = highOilCardOrderService.findOrder(orderNo); JSONObject object = KytcService.getOrderInfo(highOilCardOrder.getThirdOrderNo()); highOilCardOrder.setExt2(object.toJSONString()); if (object.getBoolean("State") == true) { JSONObject jsonObject = object.getJSONObject("Data"); if (jsonObject.getInteger("OilOrderState") == 2) { highOilCardOrder.setStatus(3); HighOrder highOrder = highOrderService.getOrderByOrderNo(highOilCardOrder.getOrderNo()); highOrder.setOrderStatus(3); highOrder.getHighChildOrderList().get(0).setChildOrderStatus(3); highOrderService.updateOrder(highOrder); } } highOilCardOrderService.updateOilCardOrder(highOilCardOrder); return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取物流") public ResponseData getLogisticsMsg(@RequestParam(name = "no", required = true) String no) { try { JSONObject jsonObjects = CommonConfig.getLogisticsMsg(no); return ResponseMsgUtil.success(jsonObjects); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } // @RequestMapping(value = "/synCouponRule", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "获取卡券") // public ResponseData synCouponRule() { // try { // return ResponseMsgUtil.success(PetroConfig.synCouponRule()); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } // @RequestMapping(value = "/getCoupon", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "卡券下单") // public ResponseData getCoupon() { // try { // // JSONObject jsonObject = PetroConfig.getCoupon("16000443991501" , "18090580471" , OrderUtil.generateOrderNo()); // String data = PetroConfig.decrypt(jsonObject.getString("biz_content")); // JSONObject object = JSONObject.parseObject(data); // // return ResponseMsgUtil.success(object); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } @RequestMapping(value = "/decrypt", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解码") public ResponseData decrypt(@RequestParam(name = "content", required = true) String content) { try { String data = PetroConfig.decrypt(content); return ResponseMsgUtil.success(data); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deleteOilNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "删除油品") public ResponseData deleteOilNo() { try { gasService.deleteOilNo(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getJiaHaoYouAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "加好油油站刷新") public ResponseData getJiaHaoYouAllStation() { try { gasService.getJiaHaoYouAllStation(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getDianAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "点点网络") public ResponseData getDianAllStation() { try { gasService.getDianAllStation(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/integralRebateOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "积分返利") public ResponseData integralRebateOrder() { try { // 查询满足初步返利条件订单 List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { // 查询是否存在积分记录 Map map = new HashMap<>(); map.put("goldType", 1); map.put("resType", 4); map.put("userId", highOrder.getMemId()); map.put("resId", highOrder.getId()); List goldRecs = highGoldRecService.getGoldRec(map); // 判断是否重复赠送积分 if (goldRecs.size() == 0) { bsOrderRebateService.insertOrderRebate(highOrder); } highOrder.setWhetherRebate(true); highOrderService.updateOrderDetail(highOrder); } return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getApiCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取卡券") public ResponseData getApiCoupon() { try { // 查询满足初步返利条件订单 List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { // 查询是否存在积分记录 Map map = new HashMap<>(); map.put("goldType", 1); map.put("resType", 4); map.put("userId", highOrder.getMemId()); map.put("resId", highOrder.getId()); List goldRecs = highGoldRecService.getGoldRec(map); // 判断是否重复赠送积分 if (goldRecs.size() == 0) { bsOrderRebateService.insertOrderRebate(highOrder); } highOrder.setWhetherRebate(true); highOrderService.updateOrderDetail(highOrder); } return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getCouponList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData getCouponList(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { PetroConfig.init(2); JSONObject jsonObject = petroConfig.couponDetail(mchOrderNo); if (!jsonObject.getString("code").equals("1")) { throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前订单未查询到!"); } String data = PetroConfig.decrypt(jsonObject.getString("biz_content")); JSONObject jsonData = JSONObject.parseObject(data); return ResponseMsgUtil.success(jsonData); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付退款") public ResponseData refund(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20231255604"); mapPost.put("mchOrderNo" , mchOrderNo); // mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "7CCB9CB8B630CDB8E32A694426BED12B", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/refund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/decryptPetroConfig", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解码") public ResponseData decryptPetroConfig(@RequestParam(name = "content", required = true) String content) { try { PetroConfig.init(1); String data = PetroConfig.decrypt(content); JSONObject object = JSONObject.parseObject(data); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/resolveResponseMembership", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解码") public ResponseData resolveResponseMembership(@RequestParam(name = "content", required = true) String content) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(content); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/synCouponRule", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "synCouponRule") public ResponseData synCouponRule(@RequestParam(name = "orderid", required = true) String orderid) { try { JSONObject object = new JSONObject(); object.put("orderid" , orderid); JSONObject jsonObject = RechargeConfig.checkOrderByHg(object); return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java b/hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java index 2ee0d8e0..e316245d 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java @@ -110,11 +110,13 @@ public class GoodsController { } } - if (price == 1) { - goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice)).collect(Collectors.toList()); - } - if (price == 2) { - goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice).reversed()).collect(Collectors.toList()); + if (price != null) { + if (price == 1) { + goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice)).collect(Collectors.toList()); + } + if (price == 2) { + goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice).reversed()).collect(Collectors.toList()); + } } return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, goodsModels.size(), pageSize, new PageInfo<>(goodsModels))); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java index 1b48f462..c6599e9e 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -430,29 +430,6 @@ public class HighThirdPartyController { } } - @RequestMapping(value = "/thirdCancelOrder", method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "取消订单") - public ResponseData thirdCancelOrder(@RequestParam(name = "orderId", required = true) Long orderId) { - try { - - HighOrder order = highOrderService.getOrderById(orderId); - - if (order.getOrderStatus() == 1) { - highOrderService.thirdCancelOrder(orderId); - } else { - log.error("orderToPay error!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); - } - - return ResponseMsgUtil.success("操作成功"); - - } catch (Exception e) { - log.error("HighOrderController --> cancelOrder() error!", e); - return ResponseMsgUtil.exception(e); - } - } - @RequestMapping(value = "/getMemberProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询会员产品") diff --git a/hai-order/src/main/java/com/web/controller/OrderPayController.java b/hai-order/src/main/java/com/web/controller/OrderPayController.java index 28381e9a..97593065 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -346,7 +346,7 @@ public class OrderPayController { weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE8.getNumber())) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1619676214); + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1648729281); } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) { weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); diff --git a/hai-order/src/main/resources/dev/logback.xml b/hai-order/src/main/resources/dev/logback.xml index 8a5d6cc6..116b7071 100644 --- a/hai-order/src/main/resources/dev/logback.xml +++ b/hai-order/src/main/resources/dev/logback.xml @@ -196,4 +196,25 @@ + + log/wechatPay.log + + log/petroLog/petroLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + diff --git a/hai-order/src/main/resources/prod/logback.xml b/hai-order/src/main/resources/prod/logback.xml index d448a3ab..9e4d9887 100644 --- a/hai-order/src/main/resources/prod/logback.xml +++ b/hai-order/src/main/resources/prod/logback.xml @@ -215,4 +215,24 @@ + + log/wechatPay.log + + log/petroLog/petroLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + diff --git a/hai-service/src/main/java/com/hai/config/CmsContentConfig.java b/hai-service/src/main/java/com/hai/config/CmsContentConfig.java index bce01f06..074ab856 100644 --- a/hai-service/src/main/java/com/hai/config/CmsContentConfig.java +++ b/hai-service/src/main/java/com/hai/config/CmsContentConfig.java @@ -48,7 +48,7 @@ public class CmsContentConfig { map.put("status", 2); PageHelper.startPage(1, 3); return new PageInfo<>(highCouponService.getCouponList(map)).getList(); - } else if (CmsContentDataEnum.MSG.getName().equals(title)){ + } else if (CmsContentDataEnum.GOODS.getName().equals(title)){ map.put("companyId", companyId); map.put("displayArea", CmsContentDataEnum.getTypeByName(title)); map.put("notCouponSource", 2); diff --git a/hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java b/hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java index f85a8de4..9ad36698 100644 --- a/hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java +++ b/hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java @@ -64,7 +64,7 @@ public class HuiLianTongConfig { * @return * @throws Exception */ - public static JSONObject recharge(String orderNo, Integer distCouCount, String couTypeCode, String phone) throws Exception { + public static JSONObject recharge(String orderNo, Integer distCouCount, String couTypeCode, String phone) throws Exception { Map map = new HashMap<>(); map.put("orderNo", orderNo); map.put("distCouCount", distCouCount); diff --git a/hai-service/src/main/java/com/hai/config/PetroConfig.java b/hai-service/src/main/java/com/hai/config/PetroConfig.java index 4252c33d..52285105 100644 --- a/hai-service/src/main/java/com/hai/config/PetroConfig.java +++ b/hai-service/src/main/java/com/hai/config/PetroConfig.java @@ -42,7 +42,7 @@ public class PetroConfig { private BsTripartiteReqLogService reqLogService; - private static Logger log = LoggerFactory.getLogger(HuiLianTongUnionCardConfig.class); + private static Logger log = LoggerFactory.getLogger(PetroConfig.class); public static void init(Integer type) { diff --git a/hai-service/src/main/java/com/hai/config/RechargeConfig.java b/hai-service/src/main/java/com/hai/config/RechargeConfig.java index b63b44d3..277edac9 100644 --- a/hai-service/src/main/java/com/hai/config/RechargeConfig.java +++ b/hai-service/src/main/java/com/hai/config/RechargeConfig.java @@ -238,6 +238,18 @@ public class RechargeConfig { } + /** + * @Author Sum1Dream + * @Name jNiuGoodsList + * @Description // 简牛快充查询产品列表 + * @Date 14:11 2024/1/5 + * @return com.alibaba.fastjson.JSONObject + */ +// public static JSONObject jNiuGoodsList() throws { +// +// } + + private static String paramSort(final Map param) { Set keySet = param.keySet(); String[] keyArray = keySet.toArray(new String[keySet.size()]); diff --git a/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java b/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java index 2c46b2a7..e25b4f70 100644 --- a/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java +++ b/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java @@ -18,6 +18,7 @@ public enum CmsContentDataEnum { UNION_CARD(5 , "工会卡专区"), DISCOUNT(6 , "天天好券"), BLX_COUPON(7 , "停车券专区"), + GOODS(8 , "实物商品"), MSG(90 , "消息通知"), ; 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 bff5f496..a823023d 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 @@ -58,12 +58,9 @@ public class ApiOrderServiceImpl implements ApiOrderService { @Override - @Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW) public ApiOrder createOrder(JSONObject object) throws Exception { - ApiOrder apiOrder = new ApiOrder(); - // 获取下单内容 JSONObject dataObject = JSONObject.parseObject(object.getString("content")); @@ -308,7 +305,7 @@ public class ApiOrderServiceImpl implements ApiOrderService { @Override - @Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW) + @Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW , timeout = 30) public ApiOrder payOrder(JSONObject object) throws Exception{ ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java index 504aa530..d6515986 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java @@ -65,7 +65,7 @@ public class OrderPayServiceImpl implements OrderPayService { String businessType = "hisen_consume"; if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) { - instCode = "11101526"; + instCode = "11101654"; businessType = "sinopec_oil_code"; goodsDesc = "购买加油券"; tranDesc = order.getHighChildOrderList().get(0).getGoodsName(); @@ -87,8 +87,6 @@ public class OrderPayServiceImpl implements OrderPayService { tranDesc = "购买" + order.getHighChildOrderList().get(0).getGoodsName(); } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) { - instCode = "11101608"; - businessType = "actual_goods"; goodsDesc = "购买实物产品"; tranDesc = "购买" + order.getHighChildOrderList().get(0).getGoodsName(); diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index 46500e5c..8a92f77c 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -43,12 +43,6 @@ public interface HighOrderService { */ void updateOrderDetail(HighOrder highOrder); - /** - * 订单业务交易处理 - * 注意:支付完成后可以调用此方法 - * @param order - */ - void orderBusinessTransaction(HighOrder order) throws Exception; /** * @Author 胡锐 @@ -85,15 +79,6 @@ public interface HighOrderService { */ List getChildOrderByOrder(Long orderId); - /** - * @Author Sum1Dream - * @name getChildOrderByPresentation.java - * @Description // 根据是否赠品查询子订单 - * @Date 16:20 2021/9/7 - * @Param [orderId, isGiveAway] - * @return com.hai.entity.HighChildOrder - **/ - HighChildOrder getChildOrderByPresentation(Long orderId); /** * @Author 胡锐 @@ -130,12 +115,6 @@ public interface HighOrderService { **/ List getOrderList(Map map); - /** - * @Author 胡锐 - * @Description 查询订单列表 - * @Date 2021/3/26 23:06 - **/ - List getOrderListNotChild(Map map); /** * 查询订单列表 @@ -184,13 +163,6 @@ public interface HighOrderService { */ List getOrderListByIdCode(String identificationCode, Map map) throws Exception; - /** - * @Author 胡锐 - * @Description 查询需要关闭的订单列表 - * @Date 2021/3/27 15:43 - **/ - List getCloseOrder(); - /** * 根据优惠券代理商id 查询已消费的订单 * @param discountCodeId @@ -205,13 +177,6 @@ public interface HighOrderService { **/ void childOrderComplete(Long childOrderId); - /** - * @Author 胡锐 - * @Description 取消订单 - * @Date 2021/3/27 15:50 - **/ - void cancelOrder(Long orderId); - /** * @Author 袁野 * @Description 根据用户查询订单统计 @@ -226,16 +191,6 @@ public interface HighOrderService { **/ Long whetherCheck(Long memId , Integer status); - /** - * @Author Sum1Dream - * @name orderCheck.java - * @Description // 订单查看 - * @Date 14:46 2022/7/19 - * @Param [java.lang.Long] - * @return void - */ - void orderCheck(Long orderId); - /** * @Author 袁野 * @Description 未使用优惠券数量 @@ -243,33 +198,11 @@ public interface HighOrderService { **/ Integer countUnusedDiscountByUserId(Long userId , Integer status); - /** - * 查询处于已经支付和待支付的话费订单 - * @return - */ - List getAlreadyPaidMobileOrder(); - /** - * 查询处于已经支付和待支付的KFC订单 - * @return - */ - List getAlreadyPaidKfcOrder(); - - /** - * 查询处于已经支付和待支付的话费订单 - * @return - */ - List getAlreadyPaidCinemaOrder(); List getTest(); - /** - * 查询团油超过支付时间24小时订单 - * @return - */ - List> getFinishGasOrder(); - /** * 查询订单列表 * @param map @@ -397,12 +330,6 @@ public interface HighOrderService { */ List getDateCountByRecharge(); - /** - * 查询用户当天加油订单数据量 - * @param userId - * @return - */ - int getGasTheDayOrderNum(Long userId); /** * @Author Sum1Dream @@ -489,51 +416,6 @@ public interface HighOrderService { HighOrder insertThirdProduct(JSONObject object) throws Exception; - /** - * @Author Sum1Dream - * @name hltUnionCardPay.java - * @Description // 汇联通支付 - * @Date 17:21 2022/5/25 - * @Param [java.lang.Long, com.hai.entity.OutRechargeOrder] - * @return void - */ - void hltUnionCardPayByThirdProduct(HighUserCard userCard, Long orderId) throws Exception; - - /** - * @Author Sum1Dream - * @name getThirdOrder.java - * @Description // 查询第三方为支付已支付订单 - * @Date 11:26 2022/7/8 - * @Param [] - * @return java.util.List - */ - List getThirdOrder(); - - /** - * @Author Sum1Dream - * @name orderToRefund.java - * @Description // 第三方订单退款 - * @Date 4:44 下午 2022/1/24 - * @Param [java.lang.Long] - * @return void - */ - void thirdOrderToRefund(Long orderId) throws Exception; - - /** - * @Author Sum1Dream - * @Description //取消订单 Administrator - * @Date 18:37 2021/6/12 - * @Param [orderId] - * @return void - **/ - void thirdCancelOrder(Long orderId); - - /** - * 查询自建站列表 - * @param goodsId - * @return - */ - List getSelfOilStationOrderList(String goodsId); /** * @Author Sum1Dream @@ -545,15 +427,6 @@ public interface HighOrderService { */ List integralRebateOrder(); - /** - * @Author Sum1Dream - * @name orderSource.java - * @Description // 查询订单来源 - * @Date 14:11 2022/8/4 - * @Param [java.lang.Integer, java.lang.Long] - * @return com.alibaba.fastjson.JSONObject - */ - JSONObject orderSource(Integer goodsType , Long goodsId , String orderNo , Long companyId , Integer productId); /** * @Author Sum1Dream @@ -565,24 +438,7 @@ public interface HighOrderService { */ List promoteOrderList(String identificationCode) throws Exception; - /** - * @Author Sum1Dream - * @name orderListByAgentId.java - * @Description // B端查询代理商订单 - * @Date 16:11 2022/8/19 - * @Param [java.util.Map] - * @return java.util.List - */ - List orderListByAgentId(Map map) throws Exception; - /** - * @Author Sum1Dream - * @Name phoneBillOrderMigration - * @Description // 话费订单迁移 - * @Date 10:19 2023/2/2 - * @Param [highOrder] - * @Return void - */ - void phoneBillOrderMigration(HighOrder highOrder); + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java index 9a5018fa..6bbcb2f4 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java @@ -284,6 +284,9 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic if (MapUtils.getInteger(map, "status") != null) { criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); } + if (MapUtils.getString(map, "ext1") != null) { + criteria.andExt1EqualTo(MapUtils.getString(map, "ext1")); + } if (MapUtils.getInteger(map, "discountUseScope") != null) { criteria.andDiscountUseScopeEqualTo(MapUtils.getInteger(map, "discountUseScope")); 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 4032342b..20e20596 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 @@ -383,300 +383,6 @@ public class HighOrderServiceImpl implements HighOrderService { highOrderMapper.updateByPrimaryKey(highOrder); } - @Override - public void orderBusinessTransaction(HighOrder order) throws Exception { - for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { - // 商品类型 商品类型 1:卡卷 2:金币充值 - if (highChildOrder.getGoodsType() == 1) { - highChildOrder.setChildOrderStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 - - HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId()); - - // 是否预约 - if (coupon.getReserveStatus() == true) { - HighOrderPre orderPre = new HighOrderPre(); - orderPre.setCompanyId(coupon.getCompanyId()); - orderPre.setMerchantId(coupon.getMerchantId()); - orderPre.setMerchantStoreId(highChildOrder.getStoreId()); - orderPre.setPreOrderNo(System.currentTimeMillis() + ""); - orderPre.setOrderId(order.getId()); - orderPre.setOrderNo(order.getOrderNo()); - orderPre.setChildOrderId(highChildOrder.getId()); - orderPre.setPayRealPrice(order.getPayRealPrice()); - orderPre.setGoodsType(1); - orderPre.setGoodsName(coupon.getCouponName()); - orderPre.setGoodsId(coupon.getId()); - orderPre.setPreUserId(order.getMemId()); - orderPre.setPreUserName(order.getMemName()); - orderPre.setPreUserPhone(order.getMemPhone()); - orderPre.setPreUserRemark(order.getRemarks()); - orderPre.setStatus(1); - highOrderPreService.insertOrderPre(orderPre); - } - - // 贵州中石化 - if (coupon.getCouponSource() == 4) { - Map push = new HashMap<>(); - push.put("couTypeCode", coupon.getCouponKey()); - push.put("distCouCount", highChildOrder.getSaleCount()); - push.put("userPhone", order.getMemPhone()); - // push.put("thirdUserId", order.getMerchId()); - - // 推送给高速 - JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(highChildOrder.getExt2()); - if (returnParam != null && returnParam.getString("respCode").equals("0000")) { - // 解密 - JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data")); - JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class); - for (Object data : dataArray) { - JSONObject dataObject = (JSONObject) data; - HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); - couponCodeOther.setType(1); - couponCodeOther.setOrderId(order.getId()); - couponCodeOther.setChildOrderId(highChildOrder.getId()); - couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode")); - couponCodeOther.setCouNo(dataObject.getString("couNo")); - couponCodeOther.setActiveTime(dataObject.getDate("activeTime")); - couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate")); - couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate")); - couponCodeOther.setStatus(20); - couponCodeOther.setCreateTime(new Date()); - highCouponCodeOtherMapper.insert(couponCodeOther); - - // 卡卷关联用户 - HighUserCoupon highUserCoupon = new HighUserCoupon(); - highUserCoupon.setOrderId(order.getId()); - highUserCoupon.setChildOrderId(highChildOrder.getId()); - highUserCoupon.setMerchantId(coupon.getMerchantId()); - highUserCoupon.setCouponId(coupon.getId()); - highUserCoupon.setUserId(order.getMemId()); - highUserCoupon.setCreateTime(new Date()); - highUserCoupon.setQrCodeImg(dataObject.getString("couNo")); - highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate")); - highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 - highUserCouponMapper.insert(highUserCoupon); - } - } - - // 推送记录 - HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); - highGasOrderPush.setType(OrderPushType.type6.getType()); - highGasOrderPush.setOrderNo(order.getOrderNo()); - highGasOrderPush.setCreateTime(new Date()); - highGasOrderPush.setCode(returnParam.getString("result")); - highGasOrderPush.setRequestContent(JSONObject.toJSONString(push)); - highGasOrderPush.setReturnContent(returnParam.toJSONString()); - highGasOrderPushMapper.insert(highGasOrderPush); - - } else if (coupon.getCouponSource() == 5) { - // 给用户发码 - JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), highChildOrder.getSaleCount(), order.getMemPhone()); - - // 推送记录 - JSONObject request = new JSONObject(); - request.put("requestCode", coupon.getCouponKey()); - request.put("tradeId", order.getOrderNo()); - request.put("ticketSum", highChildOrder.getSaleCount()); - request.put("phone", order.getMemPhone()); - - HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); - highGasOrderPush.setType(OrderPushType.type10.getType()); - highGasOrderPush.setOrderNo(order.getOrderNo()); - highGasOrderPush.setCreateTime(new Date()); - highGasOrderPush.setRequestContent(request.toJSONString()); - highGasOrderPush.setReturnContent(response.toJSONString()); - highGasOrderPushMapper.insert(highGasOrderPush); - - JSONObject couponDetail = response.getJSONObject("ticketDetail"); - JSONArray codeList = response.getJSONArray("codeList"); - - for (Object data : codeList) { - HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); - couponCodeOther.setType(2); - couponCodeOther.setOrderId(order.getId()); - couponCodeOther.setChildOrderId(highChildOrder.getId()); - couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode")); - couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data))); - couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); - couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); - couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd")); - couponCodeOther.setStatus(20); - couponCodeOther.setCreateTime(new Date()); - highCouponCodeOtherMapper.insert(couponCodeOther); - - // 卡卷关联用户 - HighUserCoupon highUserCoupon = new HighUserCoupon(); - highUserCoupon.setOrderId(order.getId()); - highUserCoupon.setChildOrderId(highChildOrder.getId()); - highUserCoupon.setMerchantId(coupon.getMerchantId()); - highUserCoupon.setCouponId(coupon.getId()); - highUserCoupon.setUserId(order.getMemId()); - highUserCoupon.setCreateTime(new Date()); - highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo()); - highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate()); - highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 - highUserCouponMapper.insert(highUserCoupon); - } - } else { - HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); - code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 - code.setReceiveTime(new Date()); - highCouponCodeService.updateCouponCode(code); - - // 卡卷关联用户 - HighUserCoupon highUserCoupon = new HighUserCoupon(); - highUserCoupon.setOrderId(order.getId()); - highUserCoupon.setChildOrderId(highChildOrder.getId()); - highUserCoupon.setMerchantId(code.getMerchantId()); - highUserCoupon.setCouponId(code.getCouponId()); - highUserCoupon.setUserId(order.getMemId()); - highUserCoupon.setCouponCodeId(code.getId()); - highUserCoupon.setCreateTime(new Date()); - highUserCoupon.setQrCodeImg(code.getExt1()); - - // 计算使用有效期 - Calendar userEndTime = Calendar.getInstance(); - userEndTime.setTime(new Date()); - userEndTime.set(Calendar.HOUR_OF_DAY, 23); - userEndTime.set(Calendar.MINUTE, 59); - userEndTime.set(Calendar.SECOND, 59); - userEndTime.add(Calendar.DATE, coupon.getRecycleDay()); - if (userEndTime.getTime().compareTo(code.getUseEndTime()) == 1) { - highUserCoupon.setUseEndTime(code.getUseEndTime()); - } else { - highUserCoupon.setUseEndTime(userEndTime.getTime()); - } - highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 - highUserCouponMapper.insert(highUserCoupon); - } - - // 查询卡券是否有活动 - Map activity = highActivityInfoService.getNewActivityByCouponId(coupon.getId()); - if (activity != null && MapUtils.getLong(activity, "id") != null) { - highActivityUserLotteryNumService.addLotteryNum(MapUtils.getLong(activity, "id"), order.getMemId(), 1); - } - } - - if (highChildOrder.getGoodsType() == 2) { - highChildOrder.setChildOrderStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 - - // 金币 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 , highChildOrder.getChildOrderNo()); - } - - /* if (highChildOrder.getGoodsType() == 3) { - highChildOrder.setChildOrdeStatus(3); - order.setOrderStatus(3); - HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); - - // 来源类型 1:平台自建 2:团油 - if (store.getSourceType().equals(1)) { - - // 预存类型 0:非预存 1:预存门店 - if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) { - Map pushParam = new HashMap<>(); - pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType()); - pushParam.put("storeId", highChildOrder.getGoodsId()); - pushParam.put("price", order.getTotalPrice()); - pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType()); - pushParam.put("sourceId", order.getId()); - pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice()); - pushParam.put("opUserId", order.getMemId()); - pushParam.put("opUserName", order.getMemName()); - // 扣预存款 - this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); - } - - // 打印小票 - printGasOrder(highChildOrder.getGoodsId(), order, false); - - } else if (store.getSourceType().equals(2)) { - // 推送团油订单 - Map paramMap = new HashMap<>(); - paramMap.put("gasId", store.getStoreKey()); - paramMap.put("oilNo", highChildOrder.getGasOilNo()); - paramMap.put("gunNo", highChildOrder.getGasGunNo()); - BigDecimal priceGun = highChildOrder.getGasPriceGun(); - BigDecimal priceVip = highChildOrder.getGasPriceVip(); - paramMap.put("priceGun", priceGun); // 枪单价 - paramMap.put("priceVip", priceVip); // 优惠价 - paramMap.put("driverPhone", order.getMemPhone()); - paramMap.put("thirdSerialNo", order.getOrderNo()); - paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); - - // 油品类型 1:汽油:2:柴油;3:天然气 - if (highChildOrder.getGasOilType() == 1) { - paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); - } else if (highChildOrder.getGasOilType() == 2) { - paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); - } - JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); - // 推送团油订单记录 - HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); - highGasOrderPush.setType(OrderPushType.type1.getType()); - highGasOrderPush.setOrderNo(order.getOrderNo()); - highGasOrderPush.setCreateTime(new Date()); - highGasOrderPush.setCode(orderPushObject.getString("code")); - highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); - highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); - highGasOrderPushMapper.insert(highGasOrderPush); - - if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { - highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); - } - } else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { - - // 推送加好油 - shellGroupService.gasSyncPayment(order.getOrderNo(), - store.getStoreKey(), - order.getPayTime(), - highChildOrder.getTotalPrice(), - highChildOrder.getGasOilNo(), - highChildOrder.getGasGunNo(), - order.getPayablePrice(), - order.getDeductionPrice() - ); - } else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { - // 推送金猪加油 - JSONObject jzOrderObject = jinZhuJiaYouService.payOrder(order.getOrderNo(), highChildOrder.getGasPriceChannelPay()); - if (jzOrderObject == null - || !jzOrderObject.getString("type").equals("OK") - || !jzOrderObject.getInteger("status").equals(200)) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jzOrderObject.getString("title")); - } - } - } -*/ - if (highChildOrder.getGoodsType() == 7) { - HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderNo(highChildOrder.getOrderNo()); - if (actual != null) { - List discountList = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(actual.getId()); - for (HighDiscountPackageDiscountActual discount : discountList) { - highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId()); - } - HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(actual.getDiscountPackageId()); - HighDiscountPackageRecord record = new HighDiscountPackageRecord(); - record.setDiscountPackageId(discountPackage.getId()); - record.setDiscountPackageTitle(discountPackage.getTitle()); - record.setUsingAttribution(discountPackage.getUsingAttribution()); - record.setCompanyId(discountPackage.getCompanyId()); - record.setOrderId(order.getId().intValue()); - record.setChildOrderId(highChildOrder.getId().intValue()); - record.setRecordNo(System.currentTimeMillis() + ""); - record.setSalesType(1); - record.setPrice(order.getPayPrice()); - record.setUserId(order.getMemId().intValue()); - discountPackageRecordService.insertRecord(record); - actual.setAllocationTime(new Date()); - actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配 - discountPackageActualService.updateHighDiscountPackageActual(actual); - } - } - } - } - @Override public Integer getUndoneChildOrder(Long orderId) { HighOrder order = getOrderById(orderId); @@ -830,50 +536,6 @@ public class HighOrderServiceImpl implements HighOrderService { return list; } - @Override - public List getOrderListNotChild(Map map) { - HighOrderExample example = new HighOrderExample(); - HighOrderExample.Criteria criteria = example.createCriteria(); - - if (MapUtils.getLong(map, "memId") != null) { - criteria.andMemIdEqualTo(MapUtils.getLong(map, "memId")); - } - - if (StringUtils.isNotBlank(MapUtils.getString(map, "status"))) { - String[] statuses = MapUtils.getString(map, "status").split(","); - List list = new ArrayList<>(); - for (String status : statuses) { - list.add(Integer.parseInt(status)); - } - criteria.andOrderStatusIn(list); - } - - if (MapUtils.getString(map, "orderNo") != null) { - criteria.andOrderNoEqualTo(MapUtils.getString(map, "orderNo")); - } - - if (MapUtils.getString(map, "phone") != null) { - criteria.andMemPhoneEqualTo(MapUtils.getString(map, "phone")); - } - - if (MapUtils.getInteger(map, "productType") != null) { - criteria.andProductTypeEqualTo(MapUtils.getInteger(map, "productType")); - } - - if (StringUtils.isNotBlank(MapUtils.getString(map, "createTimeS")) && StringUtils.isNotBlank(MapUtils.getString(map, "createTimeE"))) { - criteria.andCreateTimeBetween( - DateUtil.format(MapUtils.getString(map, "createTimeS"), "yyyy-MM-dd HH:mm:ss"), - DateUtil.format(MapUtils.getString(map, "createTimeE"), "yyyy-MM-dd HH:mm:ss")); - } - - if (StringUtils.isNotBlank(MapUtils.getString(map, "refundTimeS")) && StringUtils.isNotBlank(MapUtils.getString(map, "refundTimeE"))) { - criteria.andRefundTimeBetween( - DateUtil.format(MapUtils.getString(map, "refundTimeS"), "yyyy-MM-dd HH:mm:ss"), - DateUtil.format(MapUtils.getString(map, "refundTimeE"), "yyyy-MM-dd HH:mm:ss")); - } - - return highOrderMapper.selectByExample(example); - } @Override @@ -1006,11 +668,6 @@ public class HighOrderServiceImpl implements HighOrderService { return highOrderMapper.getOrderListByIdCode(map); } - @Override - public List getCloseOrder() { - return highOrderMapperExt.getCloseOrder(); - } - @Override public HighOrder getConsumeOrderByDiscountCode(Long discountCodeId) { @@ -1052,65 +709,6 @@ public class HighOrderServiceImpl implements HighOrderService { } } - @Override - @Transactional(propagation = Propagation.REQUIRES_NEW) - public void cancelOrder(Long orderId) { - HighOrder order = getOrderById(orderId); - if (order != null) { - if (order.getOrderStatus() != 1) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); - } - order.setOrderStatus(5); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 - order.setCancelTime(new Date()); - - for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { - // 商品类型 1:卡卷 2:金币充值 - if (highChildOrder.getGoodsType() == 1) { - // 查询卡卷详情 - HighCouponCode couponCode = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); - if (couponCode != null) { - couponCode.setChildOrderId(null); - couponCode.setStatus(1); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 - highCouponCodeService.updateCouponCode(couponCode); - } - } - - if (highChildOrder.getGoodsType() == 7) { - HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderNo(highChildOrder.getOrderNo()); - if (actual != null) { - actual.setChildOrderId(null); - actual.setUserId(null); - actual.setStatus(1); - discountPackageActualService.updateHighDiscountPackageActual(actual); - } - } - - highChildOrder.setChildOrderStatus(5); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 - } - - if (order.getMemDiscountId() != null) { - HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId()); - if (rel != null) { - rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 - rel.setUseTime(null); - highDiscountUserRelService.updateDiscountUserRel(rel); - - HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId()); - code.setStatus(2); - highDiscountAgentCodeService.updateCode(code); - } - } - - if (order.getPayGold() != null) { - // 积分返回 - String remark = "订单" + order.getOrderNo() + "取消,退还积分:" + order.getPayGold(); - highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark , order.getOrderNo()); - } - - updateOrder(order); - } - } - @Override public Long countOrderByUserId(Long memId, Integer status) { @@ -1140,37 +738,11 @@ public class HighOrderServiceImpl implements HighOrderService { return highDiscountUserRelMapper.selectByExample(example).size(); } - @Override - public List getAlreadyPaidMobileOrder() { - return highOrderMapperExt.selectAlreadyPaidMobileOrder(); - } - - @Override - public List getAlreadyPaidKfcOrder() { - return highOrderMapperExt.selectAlreadyPaidKfcOrder(); - } - - @Override - public List getAlreadyPaidCinemaOrder() { - return highOrderMapperExt.selectAlreadyPaidCinemaOrder(); - } - @Override public List getTest() { return highOrderMapperExt.selectTest(); } - @Override - public List> getFinishGasOrder() { - return highOrderMapper.selectFinishGasOrder(); - } - - @Override - public HighChildOrder getChildOrderByPresentation(Long orderId) { - HighChildOrderExample example = new HighChildOrderExample(); - example.createCriteria().andOrderIdEqualTo(orderId).andGiveawayTypeEqualTo(false); - return highChildOrderMapper.selectByExample(example).get(0); - } @Override public List selectDiscountPackageOrderList(Map map) throws Exception { @@ -1267,10 +839,6 @@ public class HighOrderServiceImpl implements HighOrderService { return highOrderMapper.getDateCountByRecharge(); } - @Override - public int getGasTheDayOrderNum(Long userId) { - return 0; - } @Override public TyOrderCountModel TyOrderStatistics(Map map) throws Exception { @@ -1888,341 +1456,9 @@ public class HighOrderServiceImpl implements HighOrderService { return highOrder; } - @Override - @Transactional(propagation = Propagation.REQUIRES_NEW) - public void hltUnionCardPayByThirdProduct(HighUserCard userCard, Long orderId) throws Exception { - String goodsDesc = ""; - String tranDesc = ""; - String instCode = "11101527"; - String businessType = "hisen_consume"; - - // 查询订单信息 - HighOrder order = getOrderById(orderId); - if (order == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); - } - - if (order.getHighChildOrderList().get(0).getGoodsType() == 4) { - goodsDesc = "购买肯德基产品"; - tranDesc = goodsDesc + order.getPayRealPrice() + "元"; - } else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) { - goodsDesc = "购买星巴克产品"; - tranDesc = goodsDesc + order.getPayRealPrice() + "元"; - } else if (order.getHighChildOrderList().get(0).getGoodsType() == 10) { - goodsDesc = "购买会员充值产品"; - tranDesc = goodsDesc + order.getPayRealPrice() + "元"; - } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,请使用其他支付方式"); - } - - // 工会卡支付 - JSONObject consumption = HuiLianTongUnionCardConfig.consumption(order.getOrderNo(), userCard.getCardNo(), order.getPayRealPrice(), businessType, instCode, goodsDesc, tranDesc); - System.out.println("工会卡支付响应参数" + consumption.toJSONString()); - - Map dataMap = new HashMap<>(); - dataMap.put("orderNo", order.getOrderNo()); - dataMap.put("cardType", "ghk"); - dataMap.put("cardNo", userCard.getCardNo()); - dataMap.put("checkPassword", "N"); - dataMap.put("tranAmount", order.getPayRealPrice()); - dataMap.put("tranChannel", "HiSen"); - dataMap.put("businessType", businessType); - dataMap.put("instCode", instCode); - dataMap.put("goodsDesc", goodsDesc); - dataMap.put("tranDesc", tranDesc); - HighGasOrderPush payPush = new HighGasOrderPush(); - payPush.setType(OrderPushType.type5.getType()); - payPush.setOrderNo(order.getOrderNo()); - payPush.setCreateTime(new Date()); - payPush.setCode(consumption.getString("respCode")); - payPush.setRequestContent(JSON.toJSONString(dataMap)); - payPush.setReturnContent(consumption.toJSONString()); - highGasOrderPushMapper.insert(payPush); - - if (!consumption.getString("respCode").equals("0000")) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); - } - JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); - if (!consumptionResult.getBoolean("success")) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); - } - order.setPaySerialNo(consumptionResult.getString("orderId")); // 支付流水号 - order.setOrderStatus(2); - order.setMemCardNo(userCard.getCardNo()); - order.setPayType(4); - - order.setPayTime(new Date()); // 支付时间 - updateOrder(order); - - HighGasOrderPush orderPush = new HighGasOrderPush(); - JSONObject returnObject; - - for (HighChildOrder childOrder : order.getHighChildOrderList()) { - childOrder.setChildOrderStatus(2); - } - if (order.getHighChildOrderList().get(0).getGoodsType() == 4) { - orderPush.setType(OrderPushType.type4.getType()); - returnObject = QianZhuConfig.payKfcOrder(order.getOrderNo()); - } else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) { - orderPush.setType(OrderPushType.type8.getType()); - returnObject = QianZhuConfig.starbucksOrdersPay(order.getOrderNo()); - } else if (order.getHighChildOrderList().get(0).getGoodsType() == 10){ - orderPush.setType(OrderPushType.type9.getType()); - ApiMemberProduct memberProduct = apiMemberProductService.findById(order.getHighChildOrderList().get(0).getGoodsId()); - returnObject = QianZhuConfig.insertV2(memberProduct.getProductId() , order.getOrderNo() , order.getRemarks()); - } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,请使用其他支付方式"); - } - - orderPush.setOrderNo(order.getOrderNo()); - orderPush.setCreateTime(new Date()); - orderPush.setRequestContent(JSON.toJSONString(dataMap)); - orderPush.setReturnContent(returnObject.toJSONString()); - highGasOrderPushMapper.insert(orderPush); - } - - @Override - public List getThirdOrder() { - return highOrderMapper.getThirdOrder(); - } - @Override - public void thirdOrderToRefund(Long orderId) throws Exception { - - HighOrder order = highOrderService.getOrderById(orderId); - - - // 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款 - if (order.getOrderStatus() != 2) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); - } - - - - // 微信退款 - if (order.getPayType() == 2) { - Map param = new HashMap<>(); - param.put("appid", "wx637bd6f7314daa46"); - param.put("mch_id", "1289663601"); - param.put("sub_mch_id", "1614670195"); - param.put("nonce_str", WxUtils.makeNonStr()); - param.put("transaction_id", order.getPaySerialNo()); - param.put("out_refund_no", "HFR" + new Date().getTime()); - param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); - param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); - param.put("sign_type", "HMAC-SHA256"); - - String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5", WXPayConstants.SignType.HMACSHA256); - param.put("sign", signStr); - - String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param)); - OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class); - if (orderRefundModel.getResult_code().equals("SUCCESS")) { - //order.setRefundTime(new Date()); - // order.setRefundNo(orderRefundModel.getOut_refund_no()); - // order.setRefundPrice(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100"))); - order.setOrderStatus(4); - //order.setRefundTime(new Date()); - for (HighChildOrder childOrder : order.getHighChildOrderList()) { - childOrder.setChildOrderStatus(4); - } - updateOrder(order); - } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:" + orderRefundModel.getErr_code() + ",错误描述" + orderRefundModel.getErr_code_des()); - } - } - - // 工会卡退款 - if (order.getPayType() == 4) { - JSONObject jsonObject = HuiLianTongUnionCardConfig.refund("HFR" + new Date().getTime(), order.getOrderNo()); - - if (jsonObject == null) { - jsonObject = HuiLianTongUnionCardConfig.refund("HFR" + new Date().getTime(), order.getOrderNo()); - } - - JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); - - if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) { - // order.setRefundTime(new Date()); - // order.setRefundNo("HFR" + new Date().getTime()); - // order.setRefundPrice(order.getPayRealPrice()); - order.setOrderStatus(4); - // order.setRefundTime(new Date()); - for (HighChildOrder childOrder : order.getHighChildOrderList()) { - childOrder.setChildOrderStatus(4); - } - updateOrder(order); - - } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); - } - - // 商户预充值 帐户退款 - if (order.getPayType() == 7) { - - Map map = new HashMap<>(); - map.put("orderNo" , order.getOrderNo()); - map.put("amountType" , 1); - map.put("sourceType" , 2); - - /* if ( apiAmountRecordService.getApiAmountRecordByList(map).size() == 1) { - - ApiMerchants apiMerchants = apiMerchantsService.findByMchId(order.getMerchId()); - // 插入金额记录 - // 变更前金额 - BigDecimal beforeAmount = apiMerchants.getAmounts(); - // 计算金额 - apiMerchants.setAmounts(apiMerchants.getAmounts().add(order.getPayPrice())); - // 变更后金额 - BigDecimal afterAmount = apiMerchants.getAmounts(); - - apiMerchantsService.updateApiMerchants(apiMerchants); - - ApiAmountRecord apiAmountRecord = new ApiAmountRecord(); - - apiAmountRecord.setCreateTime(new Date()); - apiAmountRecord.setUpdateTime(new Date()); - apiAmountRecord.setMchId(order.getMerchId()); - - apiAmountRecord.setStatus(100); - apiAmountRecord.setAmount(order.getPayPrice()); - apiAmountRecord.setAfterAmount(afterAmount); - apiAmountRecord.setBeforeAmount(beforeAmount); - apiAmountRecord.setAmountType(1); - apiAmountRecord.setSourceType(2); - apiAmountRecord.setSourceOrderNo(order.getOrderNo()); - apiAmountRecord.setSourceId(order.getId()); - apiAmountRecord.setSourceContent(apiMerchants.getMerchantName() + "|订单退款" + order.getPayPrice()); - - apiAmountRecordService.insertAmountRecord(apiAmountRecord); - - Map orderMap = new HashMap<>(); - orderMap.put("orderId" , order.getId()); - - // 查询是否用重复订单 - ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(orderMap); - - apiOrderRecord.setStatus(100); - apiOrderRecord.setRequestTime(new Date()); - apiOrderRecordService.updateOrderRecord(apiOrderRecord); - }*/ - - } - } - - // 银联退款 - if (order.getPayType() == 5) { - // 订单退款 - JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue()); - if (!refund.getString("resultcode").equals("W6")) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg")); - } - //order.setRefundTime(new Date()); - //order.setRefundNo(refund.getString("oriwtorderid")); - //order.setRefundPrice(order.getPayRealPrice()); - order.setOrderStatus(4); - // order.setRefundTime(new Date()); - for (HighChildOrder childOrder : order.getHighChildOrderList()) { - childOrder.setChildOrderStatus(4); - } - updateOrder(order); - } - // 退还积分 - if (order.getPayGold() != null) { - String remark = "订单" + order.getOrderNo() + "退款,退还积分:" + order.getPayGold(); - 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()); - for (HighChildOrder childOrder : order.getHighChildOrderList()) { - childOrder.setChildOrderStatus(4); - } - updateOrder(order); - } - } - - if (order.getMemDiscountId() != null) { - HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId()); - if (rel != null) { - rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 - rel.setUseTime(null); - highDiscountUserRelService.updateDiscountUserRel(rel); - - HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId()); - code.setStatus(2); - highDiscountAgentCodeService.updateCode(code); - } - } - - } - - public String doRefundRequest(String mchId, String data) throws Exception { - - //小程序退款需要调用双向证书的认证 - CloseableHttpClient httpClient = goodsOrderService.readCertificate(mchId); - try { - HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/refund"); // 设置响应头信息 - httpost.addHeader("Connection", "keep-alive"); - httpost.addHeader("Accept", "*/*"); - httpost.addHeader("Content-Type", "text/xml"); - httpost.addHeader("Host", "api.mch.weixin.qq.com"); - httpost.addHeader("X-Requested-With", "XMLHttpRequest"); - httpost.addHeader("Cache-Control", "max-age=0"); - httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); - httpost.setEntity(new StringEntity(data, "UTF-8")); - CloseableHttpResponse response = httpClient.execute(httpost); - try { - HttpEntity entity = response.getEntity(); - String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8"); - EntityUtils.consume(entity); - return jsonStr; - } finally { - response.close(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } finally { - httpClient.close(); - } - } - - @Override - @Transactional(propagation = Propagation.REQUIRES_NEW) - public void thirdCancelOrder(Long orderId) { - HighOrder order = getOrderById(orderId); - if (order != null && order.getOrderStatus() == 1) { - order.setOrderStatus(5); - order.setCancelTime(new Date()); - - for (HighChildOrder childOrder : order.getHighChildOrderList()) { - childOrder.setChildOrderStatus(5); - } - - if (order.getMemDiscountId() != null) { - HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId()); - if (rel != null) { - rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 - rel.setUseTime(null); - highDiscountUserRelService.updateDiscountUserRel(rel); - - HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId()); - code.setStatus(2); - highDiscountAgentCodeService.updateCode(code); - } - } - - if (order.getPayGold() != null) { - // 积分返回 - String remark = "订单" + order.getOrderNo() + "取消,退还积分:" + order.getPayGold(); - highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark , order.getOrderNo()); - } - - updateOrder(order); - } - } - @Override public Long whetherCheck(Long memId, Integer status) { @@ -2234,23 +1470,6 @@ public class HighOrderServiceImpl implements HighOrderService { return highOrderMapper.countByExample(example); } - @Override - public void orderCheck(Long orderId) { - HighOrder highOrder = highOrderMapper.selectByPrimaryKey(orderId); - - highOrder.setWhetherCheck(true); - - if (highOrder.getOrderStatus() == 3) { - highOrderMapper.updateByPrimaryKey(highOrder); - } - - } - - @Override - public List getSelfOilStationOrderList(String goodsId) { - return highOrderMapper.getSelfOilStationOrderList(goodsId); - } - @Override public List integralRebateOrder() { HighOrderExample example = new HighOrderExample(); @@ -2259,64 +1478,6 @@ public class HighOrderServiceImpl implements HighOrderService { return highOrderMapper.selectByExample(example); } - // todo 废弃代码 - @Override - public JSONObject orderSource(Integer goodsType, Long goodsId , String orderNo , Long companyId , Integer productId) { - - JSONObject object = new JSONObject(); - - if (goodsType == 1) { - HighCoupon coupon = highCouponService.getCouponById(goodsId); - - object.put("type" , 1); - object.put("productId", 1); - object.put("companyId", coupon.getCompanyId()); - object.put("remark" , "卡券订单:"+ coupon.getCouponName() + "-" + orderNo + "积分返利:"); - object.put("name" , "购买卡券产品:"+ coupon.getCouponName()); - - } - if (goodsType == 3) { - HighMerchantStore merchantStore = highMerchantStoreService.getMerchantStoreById(goodsId); - object.put("type" , 2); - object.put("productId", 1); - object.put("companyId", merchantStore.getCompanyId()); - object.put("remark" , "在线加油订单" + orderNo + "积分返利:"); - object.put("name" , "购买在线加油产品"); - } - - if (goodsType == 4) { - object.put("type" , 4); - object.put("productId", 2); - object.put("companyId", companyId); - object.put("remark" , "肯德基订单" + orderNo + "积分返利:"); - object.put("name" , "购买肯德基产品"); - } - if (goodsType == 9) { - object.put("type" , 4); - object.put("productId", 1); - object.put("companyId", companyId); - object.put("remark" , "星巴克订单" + orderNo + "积分返利:"); - object.put("name" , "购买星巴克产品"); - } - if (goodsType == 10) { - object.put("type" , 4); - object.put("productId", 3); - object.put("companyId", companyId); - object.put("remark" , "会员充值订单" + orderNo + "积分返利:"); - object.put("name" , "购买会员充值产品"); - } - if (goodsType == 20) { - object.put("type" , 3); - object.put("productId", productId); - object.put("companyId", companyId); - object.put("remark" , "话费充值订单" + orderNo + "积分返利:"); - object.put("name" , "购买话费充值产品"); - } - -// object.put("logoImg" , OrderLogoEnum.getNameByImgUrl(goodsType)); - return object; - } - @Override public List promoteOrderList(String identificationCode) throws Exception { @@ -2335,36 +1496,5 @@ public class HighOrderServiceImpl implements HighOrderService { return list; } - @Override - public List orderListByAgentId(Map map) throws Exception { - return null; - } - - @Override - public void phoneBillOrderMigration(HighOrder highOrder) { - highOrderMapper.insert(highOrder); - HighChildOrder highChildOrder = new HighChildOrder(); - - highChildOrder.setOrderNo(highOrder.getOrderNo()); - highChildOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); - highChildOrder.setChildOrderStatus(highOrder.getOrderStatus()); - highChildOrder.setTotalPrice(highOrder.getTotalPrice()); - highChildOrder.setGoodsPrice(highOrder.getTotalPrice()); - highChildOrder.setGoodsActualPrice(highOrder.getPayPrice()); - highChildOrder.setGoodsName(highOrder.getTitle()); - highChildOrder.setGoodsType(6); - highChildOrder.setSaleCount(1); - highChildOrder.setGiveawayType(false); - highChildOrder.setMemId(highOrder.getMemId()); - highChildOrder.setTotalDeductionPrice(highOrder.getTotalDeductionPrice()); - highChildOrder.setGoodsSpecName("话费充值"); - highChildOrder.setCreateTime(highOrder.getCreateTime()); - highChildOrder.setOrderId(highOrder.getId()); - highChildOrder.setCancelTime(highOrder.getCancelTime()); - highChildOrder.setFinishTime(highOrder.getFinishTime()); - highChildOrder.setRefundTime(highOrder.getRefundTime()); - highChildOrder.setPayTime(highOrder.getPayTime()); - highChildOrderMapper.insert(highChildOrder); - } } diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index 1df59eea..5722bf1d 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -155,3 +155,5 @@ GzPetroUrl = http://43.136.176.177:8080/hd-api/out/ GzPetroAppid = 520000990232626265 GzPetroAppKey = 520000W4S3BRkFhaDsNMM GzPetroAesKey = A8P2sUnM6PsKPwusiFEDFjMu8Hh8wB79 + +# diff --git a/v1/src/main/java/com/v1/controller/WxMsgController.java b/v1/src/main/java/com/v1/controller/WxMsgController.java index 5c99c5a4..d5598eda 100644 --- a/v1/src/main/java/com/v1/controller/WxMsgController.java +++ b/v1/src/main/java/com/v1/controller/WxMsgController.java @@ -130,9 +130,6 @@ public class WxMsgController { String linkContent = ""; String content = ""; - - - log.info("二维码参数:" + eventKey); // 普通消息 if ("text".equals(msgType)) { // todo 处理文本消息 @@ -147,6 +144,7 @@ public class WxMsgController { else if ("event".equals(msgType)) { // 用户关注公众号 if ("subscribe".equals(event)) { + System.out.println("用户关注公众号"); if (eventKey != null && eventKey.length() != 0) { JSONObject object = weChatQrcodeUtils.paramPars(eventKey); // type = 1 推广扫码 @@ -193,6 +191,16 @@ public class WxMsgController { + "油客来自五湖四海,在这里祝您一路顺风。\n\n"; } + // 贵州和重庆 + if (Objects.equals(object.getString("code"), "3")) { + linkContent = + "加满好油,一路畅游!✨✨\n\n" + + "查看中石化操作流程\n\n" + + "查看中石油操作流程\n\n" + + "用心为您着想,诚意为您服务。\uD83C\uDF39\n\n" + + "油客来自五湖四海,在这里祝您一路顺风。\n\n"; + + } } // 4:支付码牌扫码 @@ -323,6 +331,16 @@ public class WxMsgController { + "油客来自五湖四海,在这里祝您一路顺风。\n\n"; } + // 贵州和重庆 + if (Objects.equals(object.getString("code"), "3")) { + linkContent = + "加满好油,一路畅游!✨✨\n\n" + + "查看中石化操作流程\n\n" + + "查看中石油操作流程\n\n" + + "用心为您着想,诚意为您服务。\uD83C\uDF39\n\n" + + "油客来自五湖四海,在这里祝您一路顺风。\n\n"; + + } } // 4:支付码牌扫码 @@ -401,6 +419,7 @@ public class WxMsgController { }else if ("unsubscribe".equals(event)) { // todo 取消关注 业务处理 + System.out.println("用户取消关注!"); }else if ("CLICK".equals(event)) { content = linkContent + "服务热线:400-023-6806"; } diff --git a/v1/src/main/resources/dev/logback.xml b/v1/src/main/resources/dev/logback.xml index 915b7c95..fd71fa54 100644 --- a/v1/src/main/resources/dev/logback.xml +++ b/v1/src/main/resources/dev/logback.xml @@ -178,4 +178,25 @@ + + + + log/wechatPay.log + + log/petroLog/petroLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + diff --git a/v1/src/main/resources/prod/logback.xml b/v1/src/main/resources/prod/logback.xml index fb933002..a4ec6129 100644 --- a/v1/src/main/resources/prod/logback.xml +++ b/v1/src/main/resources/prod/logback.xml @@ -175,4 +175,24 @@ + + + log/wechatPay.log + + log/petroLog/petroLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + +