From 654718293ce7e31e4d042677ead8b095ab9652dc Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 15 Aug 2022 11:30:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=9D=E8=B4=B9=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cweb/controller/WechatController.java | 35 +++++++++---------- .../java/com/hai/common/utils/WxUtils.java | 2 +- .../BsDistributionUserRelServiceImpl.java | 10 ++++-- .../service/impl/HighOrderServiceImpl.java | 5 +++ .../hai/service/impl/HighUserServiceImpl.java | 2 +- .../v1/controller/GzSinopecController.java | 6 ++-- .../v1/controller/HighOrderController.java | 13 +++++-- .../controller/RechargeProductController.java | 8 ++--- .../controller/SelfOilStationController.java | 2 +- 9 files changed, 49 insertions(+), 34 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index eea4a0b2..52d9aef1 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -253,6 +253,14 @@ public class WechatController { try { + // 获取手机号验证码 + String phoneSmsCode = (String) redisUtil.get("SMS_"+ phone); + + // 验证码校验 + if (!(StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,code))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误"); + } + // 根据手机号查询用户 HighUser user = highUserService.findByPhone(phone); @@ -270,25 +278,14 @@ public class WechatController { user.setInfoCompleteStatus(1); highUserService.insertUser(user , popularizeUserId , regionId); } - - // 获取手机号验证码 - String phoneSmsCode = (String) redisUtil.get("SMS_"+ phone); - - // 验证码校验 - if (StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,code)) { - // 定义个人所有数据 - HighUserModel highUserModel = new HighUserModel(); - HighUser detailData = highUserService.getDetailDataByUser(user.getId()); - detailData.setPassword(null); - highUserModel.setHighUser(detailData); - SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel); - userCenter.save(request, response, so); - return ResponseMsgUtil.success(so); - } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误"); - } - - + // 定义个人所有数据 + HighUserModel highUserModel = new HighUserModel(); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); + SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel); + userCenter.save(request, response, so); + return ResponseMsgUtil.success(so); } catch (Exception e) { return ResponseMsgUtil.exception(e); diff --git a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java index 0dd5ae31..7652c17d 100644 --- a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java +++ b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java @@ -484,7 +484,7 @@ public class WxUtils { Arrays.sort(keyArray); StringBuilder sb = new StringBuilder(); for (String k : keyArray) { - if (k.equals(WXPayConstants.FIELD_SIGN)) { + if (k.equals(WXPayConstants.FIELD_SIGN) || k.equals("apiKey")) { continue; } if (data.get(k) != null) // 参数值为空,则不参与签名 diff --git a/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java index 5b7a3a0a..4a9b291e 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java @@ -35,6 +35,7 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe public void insertDistributionRebate(Long userId, Long popularizeUserId , String regionId) { HighUser user = highUserService.findByUserId(userId); + HighUser pUser = highUserService.findByUserId(popularizeUserId); // 定义分销关联关系 BsDistributionUserRel distributionUserRel = new BsDistributionUserRel(); @@ -45,12 +46,15 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe BsDistributionUserRel popularizeUser = findDistributionUserRel(map); + if (popularizeUser != null) { + distributionUserRel.setAgentId(popularizeUser.getAgentId()); + distributionUserRel.setAgentName(popularizeUser.getAgentName()); + } + distributionUserRel.setUserId(userId); distributionUserRel.setUserName(user.getName()); - distributionUserRel.setAgentId(popularizeUser.getAgentId()); - distributionUserRel.setAgentName(popularizeUser.getAgentName()); distributionUserRel.setPopularizeUserId(popularizeUserId); - distributionUserRel.setPopularizeUserName(popularizeUser.getUserName()); + distributionUserRel.setPopularizeUserName(pUser.getName()); distributionUserRel.setCreateTime(new Date()); distributionUserRel.setUpdateTime(new Date()); distributionUserRel.setStatus(100); 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 fe8b4dd9..fb45c0b7 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 @@ -1608,6 +1608,11 @@ public class HighOrderServiceImpl implements HighOrderService { if (MapUtils.getString(map, "merchId") != null) { criteria.andMerchIdEqualTo(MapUtils.getString(map, "merchId")); } + 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")); + } example.setOrderByClause("create_time desc"); List list = highOrderMapper.selectByExample(example); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index 140787f0..63c79c4a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -228,7 +228,7 @@ public class HighUserServiceImpl implements HighUserService { new Thread(()-> { // 绑定推广关联关系 distributionUserRelService.insertDistributionRebate(highUser.getId() , popularizeUserId , regionId); - }); + }).start(); } @Override diff --git a/v1/src/main/java/com/v1/controller/GzSinopecController.java b/v1/src/main/java/com/v1/controller/GzSinopecController.java index d501f428..ef035b1a 100644 --- a/v1/src/main/java/com/v1/controller/GzSinopecController.java +++ b/v1/src/main/java/com/v1/controller/GzSinopecController.java @@ -107,7 +107,7 @@ public class GzSinopecController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } // 查询电子卡券类型 @@ -186,7 +186,7 @@ public class GzSinopecController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } if (object.getInteger("count") > 5) { @@ -287,7 +287,7 @@ public class GzSinopecController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(object.getString("couNo")); diff --git a/v1/src/main/java/com/v1/controller/HighOrderController.java b/v1/src/main/java/com/v1/controller/HighOrderController.java index e1cdfa14..5bebb71b 100644 --- a/v1/src/main/java/com/v1/controller/HighOrderController.java +++ b/v1/src/main/java/com/v1/controller/HighOrderController.java @@ -71,6 +71,9 @@ public class HighOrderController { } if (StringUtils.isBlank(object.getString("apiKey")) || + StringUtils.isBlank(object.getString("merchId")) || + StringUtils.isBlank(object.getString("createTimeS")) || + StringUtils.isBlank(object.getString("createTimeE")) || StringUtils.isBlank(object.getString("merchId")) || StringUtils.isBlank(object.getString("timetable")) || StringUtils.isBlank(object.getString("sign")) @@ -90,6 +93,8 @@ public class HighOrderController { map.put("apiKey" , object.getString("apiKey")); map.put("timetable" , object.getString("timetable")); map.put("merchId" , object.getString("merchId")); + map.put("createTimeS" , object.getString("createTimeS")); + map.put("createTimeE" , object.getString("createTimeE")); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { log.error("getRechargeProduct error!", "签名校验失败!"); @@ -98,7 +103,7 @@ public class HighOrderController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } Map postMap = new HashMap<>(); @@ -133,6 +138,8 @@ public class HighOrderController { if (StringUtils.isBlank(object.getString("apiKey")) || StringUtils.isBlank(object.getString("merchId")) || + StringUtils.isBlank(object.getString("createTimeS")) || + StringUtils.isBlank(object.getString("createTimeE")) || StringUtils.isBlank(object.getString("timetable")) || StringUtils.isBlank(object.getString("sign")) ) { @@ -151,6 +158,8 @@ public class HighOrderController { map.put("apiKey" , object.getString("apiKey")); map.put("timetable" , object.getString("timetable")); map.put("merchId" , object.getString("merchId")); + map.put("createTimeS" , object.getString("createTimeS")); + map.put("createTimeE" , object.getString("createTimeE")); if (!secConfigService.isSignVerify(map , object.getString("sign"))) { log.error("getRechargeProduct error!", "签名校验失败!"); @@ -159,7 +168,7 @@ public class HighOrderController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } Map postMap = new HashMap<>(); diff --git a/v1/src/main/java/com/v1/controller/RechargeProductController.java b/v1/src/main/java/com/v1/controller/RechargeProductController.java index 86f3c2a4..fc06573b 100644 --- a/v1/src/main/java/com/v1/controller/RechargeProductController.java +++ b/v1/src/main/java/com/v1/controller/RechargeProductController.java @@ -106,7 +106,7 @@ public class RechargeProductController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } return ResponseMsgUtil.success(apiMerchantsService.getMerchProduct(apiMerchants.getId() , object.getInteger("rechargeType"))); @@ -164,7 +164,7 @@ public class RechargeProductController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } return ResponseMsgUtil.success(apiMerchants.getAmounts()); @@ -224,7 +224,7 @@ public class RechargeProductController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(map); @@ -322,7 +322,7 @@ public class RechargeProductController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } apiOpenService.createOrder(object , apiMerchants , apiProductConfig); diff --git a/v1/src/main/java/com/v1/controller/SelfOilStationController.java b/v1/src/main/java/com/v1/controller/SelfOilStationController.java index f52c15d4..70622e40 100644 --- a/v1/src/main/java/com/v1/controller/SelfOilStationController.java +++ b/v1/src/main/java/com/v1/controller/SelfOilStationController.java @@ -100,7 +100,7 @@ public class SelfOilStationController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } SecConfig config = secConfigService.findByCodeType(object.getString("merchId"));