From eda85fdd27121c534239c229b6c07e3165d9b386 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 20 Mar 2023 10:47:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hai-bweb/src/main/resources/prod/logback.xml | 20 +++++++ .../main/java/com/cweb/config/AuthConfig.java | 1 + .../cweb/controller/HighCouponController.java | 8 +-- .../src/main/resources/prod-9401/logback.xml | 21 +++++++ hai-cweb/src/main/resources/prod/logback.xml | 21 +++++++ hai-order/src/main/resources/prod/logback.xml | 20 +++++++ .../com/hai/config/ChongQingCNPCService.java | 2 +- .../java/com/hai/config/CommonSysConfig.java | 3 + .../com/hai/config/HuiLianTongConfig.java | 8 +-- .../main/java/com/hai/config/StreamUtil.java | 34 ++++++++++++ .../impl/HighDiscountAgentRelServiceImpl.java | 1 - .../resources/dev/commonConfig.properties | 1 + .../prod-9401/commonConfig.properties | 1 + .../resources/prod/commonConfig.properties | 2 + .../web/controller/DiscountController.java | 55 +++++++++++++++++++ 15 files changed, 186 insertions(+), 12 deletions(-) create mode 100644 hai-service/src/main/java/com/hai/config/StreamUtil.java diff --git a/hai-bweb/src/main/resources/prod/logback.xml b/hai-bweb/src/main/resources/prod/logback.xml index 4526f38b..09b50572 100644 --- a/hai-bweb/src/main/resources/prod/logback.xml +++ b/hai-bweb/src/main/resources/prod/logback.xml @@ -109,6 +109,23 @@ + + log/chongQingCNPC.log + + log/ChongQingCNPC/ChongQingCNPC.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + @@ -134,4 +151,7 @@ + + + diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index 01a1ca7b..a13efa27 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -128,6 +128,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/notify/*") .excludePathPatterns("/highOrder/getOrderByOrderNo") .excludePathPatterns("/coupon/getUserCouponByOrderNo") + .excludePathPatterns("/activity/getActivityByCoupon") .excludePathPatterns("/unionPay/*") .excludePathPatterns("/highGas/*") .excludePathPatterns("/common/*") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java index 00dacaa0..eeb02db6 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -1,5 +1,6 @@ package com.cweb.controller; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.github.pagehelper.PageHelper; @@ -220,17 +221,12 @@ public class HighCouponController { @ApiOperation(value = "根据订单号 查询用户卡券") public ResponseData getUserCouponByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo, HttpServletRequest request) { try { - // 用户 - SessionObject sessionObject = userCenter.getSessionObject(request); - HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); - HighOrder order = orderService.getOrderByOrderNo(orderNo); if (order == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); } - // 查询最新一张可用的卡券 - HighUserCoupon newCoupon = highUserCouponService.getUserCouponByOrder(userInfoModel.getHighUser().getId(), order.getId()); + HighUserCoupon newCoupon = highUserCouponService.getUserCouponByOrder(order.getMemId(), order.getId()); if (newCoupon != null) { Map map = new HashMap<>(); diff --git a/hai-cweb/src/main/resources/prod-9401/logback.xml b/hai-cweb/src/main/resources/prod-9401/logback.xml index 516350df..cf80426f 100644 --- a/hai-cweb/src/main/resources/prod-9401/logback.xml +++ b/hai-cweb/src/main/resources/prod-9401/logback.xml @@ -57,6 +57,24 @@ UTF-8 + + + log/chongQingCNPC.log + + log/ChongQingCNPC/ChongQingCNPC.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + @@ -69,4 +87,7 @@ + + + diff --git a/hai-cweb/src/main/resources/prod/logback.xml b/hai-cweb/src/main/resources/prod/logback.xml index 516350df..cf80426f 100644 --- a/hai-cweb/src/main/resources/prod/logback.xml +++ b/hai-cweb/src/main/resources/prod/logback.xml @@ -57,6 +57,24 @@ UTF-8 + + + log/chongQingCNPC.log + + log/ChongQingCNPC/ChongQingCNPC.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + @@ -69,4 +87,7 @@ + + + diff --git a/hai-order/src/main/resources/prod/logback.xml b/hai-order/src/main/resources/prod/logback.xml index f9435509..550c4194 100644 --- a/hai-order/src/main/resources/prod/logback.xml +++ b/hai-order/src/main/resources/prod/logback.xml @@ -143,6 +143,22 @@ + + log/chongQingCNPC.log + + log/ChongQingCNPC/ChongQingCNPC.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + @@ -175,4 +191,8 @@ + + + + diff --git a/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java b/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java index 0b258e85..ea2f58cc 100644 --- a/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java +++ b/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java @@ -144,7 +144,7 @@ public class ChongQingCNPCService { public static void main(String[] args) { //System.out.println(AESTool.Decrypt("A9D356D4614F874586EAF8678C8C3E7D8CD0EEF031ADA44DDAA3B342CE4BBE44F115AABE27324A6A1F049619139A1A889FCA0FB48EB6E1EA4B1B50F041961B2D686FE8B9696C02DF95BA99B342747D67ECC7847646C87993CF924F33C1308829","n2j30jxhl3rhuoci")); - System.out.println(AESTool.Decrypt("FD65F7651FF24F67FCCC2690F03650ABEEEFA7681C9C98A45BF82C7E17776A728B68E6E6C87A4C9F444A6D64CCB025604AC6E8CD4ACB2D2EF266857191370B205FFBAA95958C4801050E3B4AE2057220","n2j30jxhl3rhuoci")); + System.out.println(AESTool.Decrypt("0E14C37B5657B48857A7D3AEFB8E24BACCA40AFF00B073FC22B4116FC97BAED3CBF38FDC5196FDF595637701FDEC1CDDA0AE518707D91B16DA65A63848AF6DB117D2F6E31A09074EB0E42422C6B3B15B96D230680D9E97E4324A384AA8E60F6E","5ojd0nkdqb1ff84t")); //System.out.println(AESTool.Decrypt("3549AD565800370205265D7518D26E5F40C90A61FDEB5DD73966126A5D25F5E9","5ojldakiz343a6yk")); } } diff --git a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java index 2ecf6789..083a869a 100644 --- a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java +++ b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java @@ -13,6 +13,8 @@ public class CommonSysConfig { // 嗨森逛域名 private String hsgDomainName; + // 惠支付 + private String hzfDomainName; // 加油站默认图片 private String gasDefaultOilStationImg; @@ -61,6 +63,7 @@ public class CommonSysConfig { private String huiliantongAppNo; private String huiliantongAppkey; private String huiliantongAppsecret; + private String huiliantongSinopecDistributorId; private String huiliantongDistributorId; private String huiliantongSinopecUrl; 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 905e2b87..a8116b57 100644 --- a/hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java +++ b/hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java @@ -57,7 +57,7 @@ public class HuiLianTongConfig { public static JSONObject getHltFuelCoupList() throws Exception { Map map = new HashMap<>(); map.put("serviceType", "01"); - map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId()); + map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongSinopecDistributorId() ); return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl() + "/getHltFuelCoupList", map); } @@ -76,7 +76,7 @@ public class HuiLianTongConfig { map.put("distCouCount", distCouCount); map.put("couTypeCode", couTypeCode); map.put("phone", phone); - map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId()); + map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongSinopecDistributorId()); log.info("============请求任务Start============="); log.info("下单购买加油券-请求参数: " + JSON.toJSONString(map)); @@ -96,7 +96,7 @@ public class HuiLianTongConfig { public static JSONObject getPayOrderByCouNo(String couNo) throws Exception { Map map = new HashMap<>(); map.put("couNo", couNo); - map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId()); + map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongSinopecDistributorId()); log.info("============请求任务Start============="); log.info("购买加油券充值订单-请求参数: " + JSON.toJSONString(map)); @@ -116,7 +116,7 @@ public class HuiLianTongConfig { public static JSONObject costRechargeOrder(String rechargeOrderId) throws Exception { Map map = new HashMap<>(); map.put("rechargeOrderId", rechargeOrderId); - map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId()); + map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongSinopecDistributorId()); log.info("============请求任务Start============="); diff --git a/hai-service/src/main/java/com/hai/config/StreamUtil.java b/hai-service/src/main/java/com/hai/config/StreamUtil.java new file mode 100644 index 00000000..f2ddeede --- /dev/null +++ b/hai-service/src/main/java/com/hai/config/StreamUtil.java @@ -0,0 +1,34 @@ +package com.hai.config; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.function.Predicate; + +/** + * + * @ClassName: StreamUtil + * @Description:TODO(List Steam) + * @author: 胡锐 + * @date: 2019年3月25日 下午4:14:00 + * + * @Copyright: 2019 www.shinwoten.com Inc. All rights reserved. + */ +public class StreamUtil { + + /** + * + * @Title: distinctByKey + * @Description: TODO(对象 去重) + * @author: 胡锐 + * @param: @param keyExtractor + * @param: @return + * @return: Predicate + * @throws + */ + public static Predicate distinctByKey(Function keyExtractor) { + Map seen = new ConcurrentHashMap<>(); + return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; + } + +} diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java index bfbd7ab7..f32466ac 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java @@ -72,7 +72,6 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ // 生成二维码 String qrCodeUrl = CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000011&key=&code=" + Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(map))); code.setExt1(qrCodeUrl); - code.setExt2("2"); // 生成二维码地址 highDiscountAgentCodeService.updateCode(code); } diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index 0e2682ef..297601eb 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -1,4 +1,5 @@ hsgDomainName=https://hsgcs.dctpay.com +hzfDomainName=https://gratia-pay.dctpay.com gasDefaultOilStationImg=https://hsgcs.dctpay.com/filesystem/default/default_oil_station.jpg # ChongQingCNPC configuration parameters diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index 5ac4e69b..05fb505c 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -1,4 +1,5 @@ hsgDomainName=https://hsg.dctpay.com +hzfDomainName=https://pay.dctpay.com gasDefaultOilStationImg=https://hsg.dctpay.com/filesystem/default/default_oil_station.jpg # ChongQingCNPC configuration parameters diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index 2904c483..d17d2e30 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -1,4 +1,5 @@ hsgDomainName=https://hsg.dctpay.com +hzfDomainName=https://pay.dctpay.com gasDefaultOilStationImg=https://hsg.dctpay.com/filesystem/default/default_oil_station.jpg gasDefaultOilStationImg2=https://hsg.dctpay.com/filesystem/default/default_oil_station2.jpg @@ -49,6 +50,7 @@ huiliantongUrl=https://gzapi.deepermobile.com.cn huiliantongAppNo=guizhouhuilt huiliantongAppkey=e0ja2Ex%2BmQ2hIPF6x%2BHA%3D huiliantongAppsecret=52662415DDCE55C7BA34223BCF53877A +huiliantongSinopecDistributorId=aNId4A3X huiliantongDistributorId=1JnL8YMV huiliantongSinopecUrl=fuelCoupons diff --git a/hai-user/src/main/java/com/web/controller/DiscountController.java b/hai-user/src/main/java/com/web/controller/DiscountController.java index e5328409..497f81a2 100644 --- a/hai-user/src/main/java/com/web/controller/DiscountController.java +++ b/hai-user/src/main/java/com/web/controller/DiscountController.java @@ -7,7 +7,9 @@ import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.UserCenter; +import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.CommonSysConst; import com.hai.entity.HighDiscountUserRel; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; @@ -190,4 +192,57 @@ public class DiscountController { } } + @RequestMapping(value="/queryHzfDiscountList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询【惠支付】优惠列表") + public ResponseData queryHzfDiscountList(@RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize) { + try { + HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); + } + Map param = new HashMap<>(); + param.put("phone", userInfoModel.getHighUser().getPhone()); + param.put("status", status); + param.put("pageNum", pageNum); + param.put("pageSize", pageSize); + + JSONObject response = HttpsUtils.doGet(CommonSysConst.getSysConfig().getHzfDomainName()+"/crest/storeDiscountActivityPartakeUser/getDiscountListByPhone", param); + if (!response.getString("return_code").equals("000000")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getString("return_msg")); + } + return ResponseMsgUtil.success(response.getJSONObject("return_data")); + + } catch (Exception e) { + log.error("HighDiscountController -> queryHzfDiscountList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryHzfDiscountTotalNum",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询【惠支付】优惠总次数") + public ResponseData queryHzfDiscountTotalNum() { + try { + HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); + } + Map param = new HashMap<>(); + param.put("phone", userInfoModel.getHighUser().getPhone()); + + JSONObject response = HttpsUtils.doGet(CommonSysConst.getSysConfig().getHzfDomainName() + "/crest/storeDiscountActivityPartakeUser/getDiscountSurplusTotalNum", param); + if (!response.getString("return_code").equals("000000")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getString("return_msg")); + } + return ResponseMsgUtil.success(response.getInteger("return_data")); + + } catch (Exception e) { + log.error("HighDiscountController -> queryHzfDiscountList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + }