From 3df978ae8008dddbd98591d015ba5da2122d981a Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 23 Mar 2023 09:28:58 +0800 Subject: [PATCH 1/7] =?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/dev/application.yml | 10 +++++----- hai-bweb/src/main/resources/pre/application.yml | 6 +++--- hai-cweb/src/main/resources/dev/application.yml | 10 +++++----- hai-cweb/src/main/resources/pre/application.yml | 6 +++--- hai-msg/src/main/resources/dev/application.yml | 10 +++++----- hai-msg/src/main/resources/pre/application.yml | 2 +- hai-order/src/main/resources/dev/application.yml | 10 +++++----- hai-schedule/src/main/resources/dev/application.yml | 10 +++++----- hai-schedule/src/main/resources/pre/application.yml | 6 +++--- hai-user/src/main/resources/dev/application.yml | 10 +++++----- v1/src/main/resources/dev/application.yml | 10 +++++----- v1/src/main/resources/pre/application.yml | 4 ++-- v1/src/main/resources/prod/application.yml | 8 ++++---- 13 files changed, 51 insertions(+), 51 deletions(-) diff --git a/hai-bweb/src/main/resources/dev/application.yml b/hai-bweb/src/main/resources/dev/application.yml index 0d938fe0..43daefd7 100644 --- a/hai-bweb/src/main/resources/dev/application.yml +++ b/hai-bweb/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 0 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 36000000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 @@ -54,7 +54,7 @@ spring: # default: # topic: topic rocketmq: - name-server: 139.159.177.244:9876 + name-server: 139.9.154.68:9876 producer: #必须指定group group: default-group @@ -78,7 +78,7 @@ jetcache: remote: default: type: redis - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis keyConvertor: fastjson diff --git a/hai-bweb/src/main/resources/pre/application.yml b/hai-bweb/src/main/resources/pre/application.yml index 4be7791f..4c006c06 100644 --- a/hai-bweb/src/main/resources/pre/application.yml +++ b/hai-bweb/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 1 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 diff --git a/hai-cweb/src/main/resources/dev/application.yml b/hai-cweb/src/main/resources/dev/application.yml index fcf33ab6..afd8f20a 100644 --- a/hai-cweb/src/main/resources/dev/application.yml +++ b/hai-cweb/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 0 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 @@ -59,7 +59,7 @@ spring: serialization: write-dates-as-timestamps: true rocketmq: - name-server: 139.159.177.244:9876 + name-server: 139.9.154.68:9876 producer: #必须指定group group: default-group @@ -84,7 +84,7 @@ jetcache: remote: default: type: redis - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis keyConvertor: fastjson diff --git a/hai-cweb/src/main/resources/pre/application.yml b/hai-cweb/src/main/resources/pre/application.yml index b33ccd34..0558f94d 100644 --- a/hai-cweb/src/main/resources/pre/application.yml +++ b/hai-cweb/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 1 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 diff --git a/hai-msg/src/main/resources/dev/application.yml b/hai-msg/src/main/resources/dev/application.yml index b0380cc4..704efb23 100644 --- a/hai-msg/src/main/resources/dev/application.yml +++ b/hai-msg/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 0 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 36000000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 @@ -54,7 +54,7 @@ spring: # default: # topic: topic rocketmq: - name-server: 139.159.177.244:9876 + name-server: 139.9.154.68:9876 producer: #必须指定group group: default-group @@ -78,7 +78,7 @@ jetcache: remote: default: type: redis - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis keyConvertor: fastjson diff --git a/hai-msg/src/main/resources/pre/application.yml b/hai-msg/src/main/resources/pre/application.yml index f77d597c..04fdad86 100644 --- a/hai-msg/src/main/resources/pre/application.yml +++ b/hai-msg/src/main/resources/pre/application.yml @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 1 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 diff --git a/hai-order/src/main/resources/dev/application.yml b/hai-order/src/main/resources/dev/application.yml index 461f5aa3..381a73cc 100644 --- a/hai-order/src/main/resources/dev/application.yml +++ b/hai-order/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: true #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 0 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 @@ -60,7 +60,7 @@ spring: write-dates-as-timestamps: true rocketmq: - name-server: 139.159.177.244:9876 + name-server: 139.9.154.68:9876 producer: #必须指定group group: default-group @@ -81,7 +81,7 @@ jetcache: remote: default: type: redis - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis keyConvertor: fastjson diff --git a/hai-schedule/src/main/resources/dev/application.yml b/hai-schedule/src/main/resources/dev/application.yml index 6b9870f5..5e7e3f8f 100644 --- a/hai-schedule/src/main/resources/dev/application.yml +++ b/hai-schedule/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 0 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 @@ -59,7 +59,7 @@ spring: serialization: write-dates-as-timestamps: true rocketmq: - name-server: 139.159.177.244:9876 + name-server: 139.9.154.68:9876 producer: #必须指定group group: default-group @@ -84,7 +84,7 @@ jetcache: remote: default: type: redis - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis keyConvertor: fastjson diff --git a/hai-schedule/src/main/resources/pre/application.yml b/hai-schedule/src/main/resources/pre/application.yml index 557b43cf..3d54dc6f 100644 --- a/hai-schedule/src/main/resources/pre/application.yml +++ b/hai-schedule/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hsg_prod?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 + url: jdbc:mysql://139.9.154.68:3306/hsg_prod?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -30,7 +30,7 @@ spring: redis: database: 0 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -44,7 +44,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 diff --git a/hai-user/src/main/resources/dev/application.yml b/hai-user/src/main/resources/dev/application.yml index d1974ca2..ba307093 100644 --- a/hai-user/src/main/resources/dev/application.yml +++ b/hai-user/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 0 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 @@ -54,7 +54,7 @@ spring: # default: # topic: topic rocketmq: - name-server: 139.159.177.244:9876 + name-server: 139.9.154.68:9876 producer: #必须指定group group: default-group @@ -83,7 +83,7 @@ jetcache: remote: default: type: redis - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis keyConvertor: fastjson diff --git a/v1/src/main/resources/dev/application.yml b/v1/src/main/resources/dev/application.yml index 2bb187e4..57d3a763 100644 --- a/v1/src/main/resources/dev/application.yml +++ b/v1/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: true #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/hsg_2.0?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 0 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 @@ -54,7 +54,7 @@ spring: # default: # topic: topic rocketmq: - name-server: 139.159.177.244:9876 + name-server: 139.9.154.68:9876 producer: #必须指定group group: default-group @@ -83,7 +83,7 @@ jetcache: remote: default: type: redis - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis keyConvertor: fastjson diff --git a/v1/src/main/resources/pre/application.yml b/v1/src/main/resources/pre/application.yml index ef24999b..2dc5cc1a 100644 --- a/v1/src/main/resources/pre/application.yml +++ b/v1/src/main/resources/pre/application.yml @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 1 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 diff --git a/v1/src/main/resources/prod/application.yml b/v1/src/main/resources/prod/application.yml index a7a61c2d..c5903a61 100644 --- a/v1/src/main/resources/prod/application.yml +++ b/v1/src/main/resources/prod/application.yml @@ -29,7 +29,7 @@ spring: maxOpenPreparedStatements: 20 redis: database: 0 - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis timeout: 1000 @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://139.159.177.244:8083/mqtt + url: ws://139.9.154.68:8083/mqtt #用户名 username: printer_provider #密码 @@ -54,7 +54,7 @@ spring: # default: # topic: topic rocketmq: - name-server: 139.159.177.244:9876 + name-server: 139.9.154.68:9876 producer: #必须指定group group: default-group @@ -83,7 +83,7 @@ jetcache: remote: default: type: redis - host: 139.159.177.244 + host: 139.9.154.68 port: 36379 password: HF123456.Redis keyConvertor: fastjson From 8b01a109970170810adee351a673c82811e99555 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 24 Mar 2023 10:11:57 +0800 Subject: [PATCH 2/7] =?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 --- .../com/cweb/controller/WechatController.java | 35 ------------------- .../java/com/hai/enum_type/LoginPlatform.java | 1 + .../java/com/hai/service/HighUserService.java | 6 ++++ .../hai/service/impl/HighUserServiceImpl.java | 16 +++++++++ .../com/web/controller/LoginController.java | 2 +- .../src/main/java/com/web/type/LoginType.java | 2 ++ 6 files changed, 26 insertions(+), 36 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 17e3421a..8b21d5a3 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -365,43 +365,8 @@ public class WechatController { return ResponseMsgUtil.success(so); } - - } catch (Exception e) { return ResponseMsgUtil.exception(e); } } - - @RequestMapping(value = "/verifyWx", method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "微信签名") - public ResponseData verifyWx(@RequestParam(value = "url", required = true) String url) { - - try { - - Map params = new HashMap<>(); - params.put("appid", SysConst.getSysConfig().getWxH5AppId()); - params.put("secret", SysConst.getSysConfig().getWxH5AppSecret()); - params.put("grant_type", "client_credential"); - - JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params); - - Map map = new HashMap<>(); - map.put("noncestr",WxUtils.makeNonStr()); - map.put("jsapi_ticket",accessTokenObject.getString("ticket")); - map.put("timestamp", new Date().getTime()); - map.put("url",url); - - Map objectMap = new HashMap<>(); - objectMap.put("appId" , params.get("appId")); - objectMap.put("timestamp" , map.get("timestamp")); - objectMap.put("nonceStr" , map.get("nonceStr")); - objectMap.put("signature" , WxUtils.getSHA1(map)); - - return ResponseMsgUtil.success(objectMap); - } catch (Exception e) { - return null; - } - - } } diff --git a/hai-service/src/main/java/com/hai/enum_type/LoginPlatform.java b/hai-service/src/main/java/com/hai/enum_type/LoginPlatform.java index 11bcd20b..0c974adb 100644 --- a/hai-service/src/main/java/com/hai/enum_type/LoginPlatform.java +++ b/hai-service/src/main/java/com/hai/enum_type/LoginPlatform.java @@ -12,6 +12,7 @@ public enum LoginPlatform { H5("H5", "H5客户端"), WXAPPLETS("WXAPPLETS", "微信小程序"), UNIONPAY("UNIONPAY", "云闪付"), + HUIPAY("HUIPAY", "惠支付"), ; private String code; diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index 95528a44..8ced6049 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -30,6 +30,12 @@ public interface HighUserService { */ SessionObject loginAndRegister(LoginPlatform platForm, String phone, Long popularizeUserId, Map other, HttpServletRequest request, HttpServletResponse response) throws Exception; + /** + * 查询用户列表 + * @param param + * @return + */ + List getUserList(Map param); /** * * @Title: getListUser 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 d89f2fdf..c0ded440 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 @@ -140,6 +140,22 @@ public class HighUserServiceImpl implements HighUserService { return so; } + @Override + public List getUserList(Map param) { + HighUserExample example = new HighUserExample(); + HighUserExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0); + + if (StringUtils.isNotBlank(MapUtils.getString(param, "openId"))) { + criteria.andOpenIdEqualTo(MapUtils.getString(param, "openId")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(param, "openIdH5"))) { + criteria.andOpenIdH5EqualTo(MapUtils.getString(param, "openIdH5")); + } + + return highUserMapper.selectByExample(example); + } + @Override public List getListUser(Map map) { HighUserExample example = new HighUserExample(); diff --git a/hai-user/src/main/java/com/web/controller/LoginController.java b/hai-user/src/main/java/com/web/controller/LoginController.java index ffdbfef3..4d4fdd3c 100644 --- a/hai-user/src/main/java/com/web/controller/LoginController.java +++ b/hai-user/src/main/java/com/web/controller/LoginController.java @@ -1 +1 @@ -package com.web.controller; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; 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.security.UserCenter; import com.hai.common.utils.*; import com.hai.config.UnionUserConfig; import com.hai.config.WxMaConfiguration; import com.hai.enum_type.LoginPlatform; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.service.HighUserService; import com.web.type.LoginType; import com.hai.enum_type.RedisFileFolder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.Map; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/login") @Api(value = "登录业务") public class LoginController { private static Logger log = LoggerFactory.getLogger(LoginController.class); @Resource private RedisUtil redisUtil; @Resource private HighUserService userService; @Resource private UserCenter userCenter; @Resource private WxMaConfiguration wxMaConfiguration; @Resource private UnionUserConfig unionUserConfig; @RequestMapping(value = "/phone", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "手机号登录") public ResponseData phone(@RequestBody JSONObject body, HttpServletRequest request, HttpServletResponse response) { try { if (body == null || StringUtils.isBlank(body.getString("platform")) || StringUtils.isBlank(body.getString("type")) || StringUtils.isBlank(body.getString("phone")) ) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } String phone = body.getString("phone"); // 客户端 LoginPlatform platform = LoginPlatform.getDataByType(body.getString("platform")); if (platform == null) { log.error("LoginController --> phone() error!", "未知客户端"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); } // 校验手机号格式 if (MemberValidateUtil.validatePhone(phone) == false) { log.error("LoginController --> phone() error!", "请输入正确的手机号"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); } // 登录类型 LoginType loginType = LoginType.getDataByType(body.getString("type")); if (loginType == null) { log.error("LoginController --> phone() error!", "未知登录类型;" + body.getString("type")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知登录类型"); } if (body.getString("type").equals(LoginType.SMS.getCode())) { if (StringUtils.isBlank(body.getString("smsCode"))) { log.error("LoginController --> phone() error!", "请输入短信验证码"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入短信验证码"); } // 手机号的验证码 Object phoneCodeObject = redisUtil.get(RedisFileFolder.SMS_CODE.getCode() + phone); if (phoneCodeObject == null) { log.error("LoginController --> phone() error!", "短信验证码错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); } if (!body.getString("smsCode").equals(phoneCodeObject.toString())) { log.error("LoginController --> phone() error!", "短信验证码错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); } redisUtil.del(RedisFileFolder.SMS_CODE.getCode() + phone); return ResponseMsgUtil.success(userService.loginAndRegister(platform, phone, body.getLong("popularizeUserId"), new HashMap<>(), request, response)); } throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "登录失败"); } catch (Exception e) { log.error("LoginController --> phone() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxMiniHandleCode", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "微信小程序code解析") public ResponseData wxMiniHandleCode(@RequestBody JSONObject body) { try { if (body == null|| StringUtils.isBlank(body.getString("code"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } //请求微信api,获取用户session_key以及openId WxMaJscode2SessionResult session = WxMaConfiguration.getMaService().jsCode2SessionInfo(body.getString("code")); //保存小程序用户登录的openId及sessionKey信息 redisUtil.hset("WX_OPENID_SESSION_REDIS", session.getOpenid(), session); JSONObject jo = new JSONObject(); jo.put("openId", session.getOpenid()); return ResponseMsgUtil.success(jo); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxMini", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "微信小程序") public ResponseData wxMini(@RequestBody JSONObject body,HttpServletRequest request, HttpServletResponse response) { try { if (body == null || StringUtils.isBlank(body.getString("encryptedData")) || StringUtils.isBlank(body.getString("iv")) || StringUtils.isBlank(body.getString("openId"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } String encryptedData = body.getString("encryptedData").replace(" ", "+"); String iv = body.getString("iv").replace(" ", "+"); //请求微信api,获取用户session_key以及openId Object skObject = redisUtil.hget("WX_OPENID_SESSION_REDIS", body.getString("openId")); if (skObject == null) { throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_LOGIN_ERROR); } WxMaJscode2SessionResult session = (WxMaJscode2SessionResult) skObject; WxMaPhoneNumberInfo phoneNoInfo = WxMaConfiguration .getMaService() .getUserService() .getPhoneNoInfo(session.getSessionKey(), encryptedData, iv); if (phoneNoInfo == null || StringUtils.isEmpty(phoneNoInfo.getPurePhoneNumber())) { log.error("LoginController --> wxMini() error!", "登录失败! 用户手机号解析失败"); throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "登录失败! 用户手机号解析失败"); } Map other = new HashMap<>(); other.put("openId", session.getOpenid()); return ResponseMsgUtil.success(userService.loginAndRegister(LoginPlatform.WXAPPLETS, phoneNoInfo.getPurePhoneNumber(), body.getLong("popularizeUserId"), other, request, response)); } catch (Exception e) { log.error("LoginController --> wxMini() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/union", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "银联授权手机号登录接口") public ResponseData union(@RequestBody JSONObject body,HttpServletRequest request, HttpServletResponse response) { try { if (body == null || StringUtils.isBlank(body.getString("code"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } // 获取应用访问令牌 String backendToken = unionUserConfig.getBackendToken(); // 获取授权访问令牌 JSONObject token = unionUserConfig.getAccessToken(backendToken, body.getString("code")); if (token == null || !token.getString("resp").equals("00")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, token.getString("msg")); } // 获取用户手机号 JSONObject userMobile = unionUserConfig.getUserMobile(backendToken, token.getJSONObject("params").getString("accessToken"), token.getJSONObject("params").getString("openId")); if (userMobile == null || !userMobile.getString("resp").equals("00")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, userMobile.getString("msg")); } // 解密,获取手机号 String mobile = UnionUtils.getDecryptedValue(userMobile.getJSONObject("params").getString("mobile"), unionUserConfig.getRsaKey()); Map other = new HashMap<>(); other.put("unionId", token.getJSONObject("params").getString("openId")); other.put("unionUnionId", token.getJSONObject("params").getString("unionId")); return ResponseMsgUtil.success(userService.loginAndRegister(LoginPlatform.UNIONPAY, mobile, body.getLong("popularizeUserId"), other, request, response)); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/out", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "退出登录") public ResponseData out(HttpServletRequest request, HttpServletResponse response) { try { HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); if (userInfoModel == null) { log.error("CoresController --> outLogin() error!", "用户身份错误或已过期"); throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); } userCenter.remove(request, response); return ResponseMsgUtil.success("退出登录成功"); } catch (Exception e) { log.error("CoresController --> outLogin() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file +package com.web.controller; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; 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.security.UserCenter; import com.hai.common.utils.*; import com.hai.config.UnionUserConfig; import com.hai.config.WxMaConfiguration; import com.hai.entity.HighUser; import com.hai.enum_type.LoginPlatform; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.service.HighUserService; import com.web.type.LoginType; import com.hai.enum_type.RedisFileFolder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/login") @Api(value = "登录业务") public class LoginController { private static Logger log = LoggerFactory.getLogger(LoginController.class); @Resource private RedisUtil redisUtil; @Resource private HighUserService userService; @Resource private UserCenter userCenter; @Resource private WxMaConfiguration wxMaConfiguration; @Resource private UnionUserConfig unionUserConfig; @RequestMapping(value = "/phone", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "手机号登录") public ResponseData phone(@RequestBody JSONObject body, HttpServletRequest request, HttpServletResponse response) { try { if (body == null || StringUtils.isBlank(body.getString("platform")) || StringUtils.isBlank(body.getString("type")) || StringUtils.isBlank(body.getString("phone")) ) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } String phone = body.getString("phone"); // 客户端 LoginPlatform platform = LoginPlatform.getDataByType(body.getString("platform")); if (platform == null) { log.error("LoginController --> phone() error!", "未知客户端"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); } // 校验手机号格式 if (MemberValidateUtil.validatePhone(phone) == false) { log.error("LoginController --> phone() error!", "请输入正确的手机号"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); } // 登录类型 LoginType loginType = LoginType.getDataByType(body.getString("type")); if (loginType == null) { log.error("LoginController --> phone() error!", "未知登录类型;" + body.getString("type")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知登录类型"); } if (body.getString("type").equals(LoginType.SMS.getCode())) { if (StringUtils.isBlank(body.getString("smsCode"))) { log.error("LoginController --> phone() error!", "请输入短信验证码"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入短信验证码"); } // 手机号的验证码 Object phoneCodeObject = redisUtil.get(RedisFileFolder.SMS_CODE.getCode() + phone); if (phoneCodeObject == null) { log.error("LoginController --> phone() error!", "短信验证码错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); } if (!body.getString("smsCode").equals(phoneCodeObject.toString())) { log.error("LoginController --> phone() error!", "短信验证码错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); } redisUtil.del(RedisFileFolder.SMS_CODE.getCode() + phone); return ResponseMsgUtil.success(userService.loginAndRegister(platform, phone, body.getLong("popularizeUserId"), new HashMap<>(), request, response)); } throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "登录失败"); } catch (Exception e) { log.error("LoginController --> phone() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/openId", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "openId登录") public ResponseData openId(@RequestBody JSONObject body,HttpServletRequest request, HttpServletResponse response) { try { if (body == null || StringUtils.isBlank(body.getString("platform")) || StringUtils.isBlank(body.getString("type")) || StringUtils.isBlank(body.getString("openId")) ) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } // 客户端 LoginPlatform platform = LoginPlatform.getDataByType(body.getString("platform")); if (platform == null) { log.error("LoginController --> phone() error!", "未知客户端"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); } // 登录类型 LoginType loginType = LoginType.getDataByType(body.getString("type")); if (loginType == null) { log.error("LoginController --> phone() error!", "未知登录类型;" + body.getString("type")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知登录类型"); } if (body.getString("type").equals(LoginType.WECHAT_MP_OPENID.getCode())) { Map param = new HashMap<>(); param.put("openId", body.getString("openId")); List userList = userService.getUserList(param); if (userList.size() > 0) { HighUser user = userList.get(0); if (StringUtils.isNotBlank(user.getPhone())){ return ResponseMsgUtil.success(userService.loginAndRegister(platform, user.getPhone(), body.getLong("popularizeUserId"), new HashMap<>(), request, response)); } } return ResponseMsgUtil.success(null); } else if (body.getString("type").equals(LoginType.WECHAT_MA_OPENID.getCode())) { Map param = new HashMap<>(); param.put("openIdH5", body.getString("openId")); List userList = userService.getUserList(param); if (userList.size() > 0) { HighUser user = userList.get(0); if (StringUtils.isNotBlank(user.getPhone())) { return ResponseMsgUtil.success(userService.loginAndRegister(platform, user.getPhone(), body.getLong("popularizeUserId"), new HashMap<>(), request, response)); } } return ResponseMsgUtil.success(null); } throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "登录失败"); } catch (Exception e) { log.error("LoginController --> phone() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxMiniHandleCode", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "微信小程序code解析") public ResponseData wxMiniHandleCode(@RequestBody JSONObject body) { try { if (body == null|| StringUtils.isBlank(body.getString("code"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } //请求微信api,获取用户session_key以及openId WxMaJscode2SessionResult session = WxMaConfiguration.getMaService().jsCode2SessionInfo(body.getString("code")); //保存小程序用户登录的openId及sessionKey信息 redisUtil.hset("WX_OPENID_SESSION_REDIS", session.getOpenid(), session); JSONObject jo = new JSONObject(); jo.put("openId", session.getOpenid()); return ResponseMsgUtil.success(jo); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxMini", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "微信小程序") public ResponseData wxMini(@RequestBody JSONObject body,HttpServletRequest request, HttpServletResponse response) { try { if (body == null || StringUtils.isBlank(body.getString("encryptedData")) || StringUtils.isBlank(body.getString("iv")) || StringUtils.isBlank(body.getString("openId"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } String encryptedData = body.getString("encryptedData").replace(" ", "+"); String iv = body.getString("iv").replace(" ", "+"); //请求微信api,获取用户session_key以及openId Object skObject = redisUtil.hget("WX_OPENID_SESSION_REDIS", body.getString("openId")); if (skObject == null) { throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_LOGIN_ERROR); } WxMaJscode2SessionResult session = (WxMaJscode2SessionResult) skObject; WxMaPhoneNumberInfo phoneNoInfo = WxMaConfiguration .getMaService() .getUserService() .getPhoneNoInfo(session.getSessionKey(), encryptedData, iv); if (phoneNoInfo == null || StringUtils.isEmpty(phoneNoInfo.getPurePhoneNumber())) { log.error("LoginController --> wxMini() error!", "登录失败! 用户手机号解析失败"); throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "登录失败! 用户手机号解析失败"); } Map other = new HashMap<>(); other.put("openId", session.getOpenid()); return ResponseMsgUtil.success(userService.loginAndRegister(LoginPlatform.WXAPPLETS, phoneNoInfo.getPurePhoneNumber(), body.getLong("popularizeUserId"), other, request, response)); } catch (Exception e) { log.error("LoginController --> wxMini() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/union", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "银联授权手机号登录接口") public ResponseData union(@RequestBody JSONObject body,HttpServletRequest request, HttpServletResponse response) { try { if (body == null || StringUtils.isBlank(body.getString("code"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } // 获取应用访问令牌 String backendToken = unionUserConfig.getBackendToken(); // 获取授权访问令牌 JSONObject token = unionUserConfig.getAccessToken(backendToken, body.getString("code")); if (token == null || !token.getString("resp").equals("00")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, token.getString("msg")); } // 获取用户手机号 JSONObject userMobile = unionUserConfig.getUserMobile(backendToken, token.getJSONObject("params").getString("accessToken"), token.getJSONObject("params").getString("openId")); if (userMobile == null || !userMobile.getString("resp").equals("00")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, userMobile.getString("msg")); } // 解密,获取手机号 String mobile = UnionUtils.getDecryptedValue(userMobile.getJSONObject("params").getString("mobile"), unionUserConfig.getRsaKey()); Map other = new HashMap<>(); other.put("unionId", token.getJSONObject("params").getString("openId")); other.put("unionUnionId", token.getJSONObject("params").getString("unionId")); return ResponseMsgUtil.success(userService.loginAndRegister(LoginPlatform.UNIONPAY, mobile, body.getLong("popularizeUserId"), other, request, response)); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/out", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "退出登录") public ResponseData out(HttpServletRequest request, HttpServletResponse response) { try { HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); if (userInfoModel == null) { log.error("CoresController --> outLogin() error!", "用户身份错误或已过期"); throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); } userCenter.remove(request, response); return ResponseMsgUtil.success("退出登录成功"); } catch (Exception e) { log.error("CoresController --> outLogin() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-user/src/main/java/com/web/type/LoginType.java b/hai-user/src/main/java/com/web/type/LoginType.java index dd949857..6bf93cc3 100644 --- a/hai-user/src/main/java/com/web/type/LoginType.java +++ b/hai-user/src/main/java/com/web/type/LoginType.java @@ -10,6 +10,8 @@ import java.util.Objects; **/ public enum LoginType { SMS("SMS", "短信登录"), + WECHAT_MA_OPENID("WECHAT_MA_OPENID", "微信小程序openId"), + WECHAT_MP_OPENID("WECHAT_MP_OPENID", "微信公众号openId"), ; private String code; From 38fc6ea5f6d86a0b4ea13387d328e983d1fe07f2 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 28 Mar 2023 09:53:34 +0800 Subject: [PATCH 3/7] =?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 --- .../HighDiscountAgentRelController.java | 30 +++++++++++++++++++ .../impl/HighDiscountUserRelServiceImpl.java | 4 +++ 2 files changed, 34 insertions(+) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java index 79847183..53665372 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java @@ -1,8 +1,10 @@ package com.bweb.controller; +import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.bweb.config.SysConst; +import com.bweb.model.ExportHighOrderModel; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hai.common.Base64Util; @@ -19,6 +21,7 @@ import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.CommonSysConst; import com.hai.entity.*; import com.hai.enum_type.QrCodeType; +import com.hai.model.HighOrderModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; import com.hai.service.*; @@ -32,9 +35,11 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.io.File; import java.net.URLEncoder; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -159,6 +164,31 @@ public class HighDiscountAgentRelController { } } + @RequestMapping(value="/exportReceive",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出领取记录") + public ResponseData exportReceive(@RequestParam(name = "id", required = true) Long id) { + try { + HighDiscountAgentRel rel = highDiscountAgentRelService.getRelById(id); + if (rel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "数据不存在"); + } + + String fileUrl = SysConst.getSysConfig().getFileUrl() + "/temporary/"; + String pathName = System.currentTimeMillis()+".xlsx"; + File file = new File(fileUrl); + if (!file.exists()) { + file.mkdirs(); + } + // EasyExcel.write(fileUrl+pathName).sheet("sheet1").doWrite(dataList); + return ResponseMsgUtil.success(pathName); + + } catch (Exception e) { + log.error("HighDiscountController -> getReceiveLink() error!",e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/getDiscountAgentList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询列表") 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 2f02ed4c..1522f2ed 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 @@ -258,6 +258,10 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic HighDiscountUserRelExample example = new HighDiscountUserRelExample(); HighDiscountUserRelExample.Criteria criteria = example.createCriteria(); + if (MapUtils.getInteger(map, "platform") != null) { + criteria.andDiscountPlatformEqualTo(MapUtils.getInteger(map, "platform")); + } + if (MapUtils.getLong(map, "userId") != null) { criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); } From 9170a7ca25d52f5103c985fda0f94c01294605b9 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 28 Mar 2023 18:04:57 +0800 Subject: [PATCH 4/7] =?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 --- .../HighDiscountAgentRelController.java | 149 ++++++++++++------ .../dao/HighDiscountAgentCodeMapperExt.java | 106 ++++++------- .../hai/model/DiscountUseConditionModel.java | 58 +++++++ .../service/HighDiscountAgentCodeService.java | 3 +- .../HighDiscountAgentCodeServiceImpl.java | 30 ++-- .../resources/dev/commonConfig.properties | 4 +- 6 files changed, 228 insertions(+), 122 deletions(-) create mode 100644 hai-service/src/main/java/com/hai/model/DiscountUseConditionModel.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java index 53665372..35e088fa 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java @@ -17,13 +17,16 @@ import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; +import com.hai.common.utils.PageUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.CommonSysConst; import com.hai.entity.*; import com.hai.enum_type.QrCodeType; +import com.hai.model.DiscountUseConditionModel; import com.hai.model.HighOrderModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; +import com.hai.order.model.OrderCouponModel; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -164,31 +167,6 @@ public class HighDiscountAgentRelController { } } - @RequestMapping(value="/exportReceive",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "导出领取记录") - public ResponseData exportReceive(@RequestParam(name = "id", required = true) Long id) { - try { - HighDiscountAgentRel rel = highDiscountAgentRelService.getRelById(id); - if (rel == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "数据不存在"); - } - - String fileUrl = SysConst.getSysConfig().getFileUrl() + "/temporary/"; - String pathName = System.currentTimeMillis()+".xlsx"; - File file = new File(fileUrl); - if (!file.exists()) { - file.mkdirs(); - } - // EasyExcel.write(fileUrl+pathName).sheet("sheet1").doWrite(dataList); - return ResponseMsgUtil.success(pathName); - - } catch (Exception e) { - log.error("HighDiscountController -> getReceiveLink() error!",e); - return ResponseMsgUtil.exception(e); - } - } - @RequestMapping(value="/getDiscountAgentList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询列表") @@ -235,10 +213,10 @@ public class HighDiscountAgentRelController { @RequestMapping(value="/getDiscountUseConditionList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询优惠券使用情况") - public ResponseData getDiscountUseConditionList(@RequestParam(name = "discountId", required = false) Long discountId, - @RequestParam(name = "discountName", required = false) String discountName, - @RequestParam(name = "storeName", required = false) String storeName, - @RequestParam(name = "status", required = false) Integer status, + public ResponseData getDiscountUseConditionList(@RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "discountId", required = false) Long discountId, + @RequestParam(name = "status", required = false) String status, + @RequestParam(name = "userPhone", required = false) String userPhone, @RequestParam(name = "receiveTimeS", required = false) Long receiveTimeS, @RequestParam(name = "receiveTimeE", required = false) Long receiveTimeE, @RequestParam(name = "useTimeS", required = false) Long useTimeS, @@ -251,17 +229,18 @@ public class HighDiscountAgentRelController { try { SessionObject sessionObject = userCenter.getSessionObject(request); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); - if (userInfoModel.getHighAgent() == null) { - log.error("HighCouponController -> insertCoupon() error!","该主角色没有权限"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); - } Map map = new HashMap<>(); - map.put("agentId", userInfoModel.getHighAgent().getId()); + if (userInfoModel.getBsCompany() != null) { + map.put("agentId", agentId); + } else if (userInfoModel.getHighAgent() != null) { + map.put("agentId", userInfoModel.getHighAgent().getId()); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); + } map.put("discountId", discountId); - map.put("discountName", discountName); - map.put("storeName", storeName); map.put("status", status); + map.put("userPhone", userPhone); map.put("receiveTimeS", receiveTimeS); map.put("receiveTimeE", receiveTimeE); map.put("useTimeS", useTimeS); @@ -278,28 +257,77 @@ public class HighDiscountAgentRelController { } } - @RequestMapping(value="/getDiscountCodeById",method = RequestMethod.GET) + @RequestMapping(value="/exportDiscountUseCondition",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "查询优惠券码 详情") - public ResponseData getDiscountCodeById(@RequestParam(name = "couponCodeId", required = true) Long couponCodeId) { + @ApiOperation(value = "查询优惠券使用情况") + public ResponseData exportDiscountUseCondition(@RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "discountId", required = false) Long discountId, + @RequestParam(name = "status", required = false) String status, + @RequestParam(name = "userPhone", required = false) String userPhone, + @RequestParam(name = "receiveTimeS", required = false) Long receiveTimeS, + @RequestParam(name = "receiveTimeE", required = false) Long receiveTimeE, + @RequestParam(name = "useTimeS", required = false) Long useTimeS, + @RequestParam(name = "useTimeE", required = false) Long useTimeE, + @RequestParam(name = "idS", required = false) Long idS, + @RequestParam(name = "idE", required = false) Long idE, + HttpServletRequest request) { try { + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + Map map = new HashMap<>(); - HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(couponCodeId); - if (code != null) { - HighDiscountAgentRel rel = highDiscountAgentRelService.getRelById(code.getDiscountAgentId()); - code.setHighDiscount(highDiscountService.getDiscountById(rel.getDiscountId())); - code.setHighAgent(highAgentService.findByAgentMsgId(rel.getAgentId())); - code.setHighOrder(highOrderService.getConsumeOrderByDiscountCode(code.getId())); - return ResponseMsgUtil.success(code); + if (userInfoModel.getBsCompany() != null) { + map.put("agentId", agentId); + } else if (userInfoModel.getHighAgent() != null) { + map.put("agentId", userInfoModel.getHighAgent().getId()); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); } - return ResponseMsgUtil.success(null); + map.put("discountId", discountId); + map.put("status", status); + map.put("userPhone", userPhone); + map.put("receiveTimeS", receiveTimeS); + map.put("receiveTimeE", receiveTimeE); + map.put("useTimeS", useTimeS); + map.put("useTimeE", useTimeE); + map.put("idS", idS); + map.put("idE", idE); + + String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; + EasyExcel.write(SysConst.getSysConfig().getFileUrl() + fileName, DiscountUseConditionModel.class) + .sheet("sheet1") + .doWrite(highDiscountAgentCodeService.getDiscountUseConditionList(map)); + + return ResponseMsgUtil.success(fileName); } catch (Exception e) { - log.error("HighDiscountController -> getDiscountCodeById() error!",e); + log.error("HighDiscountController -> getDiscountUseConditionList() error!",e); return ResponseMsgUtil.exception(e); } } + @RequestMapping(value="/getDiscountCodeById",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询优惠券码 详情") + public ResponseData getDiscountCodeById(@RequestParam(name = "couponCodeId", required = true) Long couponCodeId) { + try { + + HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(couponCodeId); + if (code != null) { + HighDiscountAgentRel rel = highDiscountAgentRelService.getRelById(code.getDiscountAgentId()); + code.setHighDiscount(highDiscountService.getDiscountById(rel.getDiscountId())); + code.setHighAgent(highAgentService.findByAgentMsgId(rel.getAgentId())); + code.setHighOrder(highOrderService.getConsumeOrderByDiscountCode(code.getId())); + return ResponseMsgUtil.success(code); + } + return ResponseMsgUtil.success(null); + + } catch (Exception e) { + log.error("HighDiscountController -> getDiscountCodeById() error!",e); + return ResponseMsgUtil.exception(e); + } +} + @RequestMapping(value="/getDiscountStatus",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "修改状态") @@ -327,4 +355,29 @@ public class HighDiscountAgentRelController { } } + @RequestMapping(value="/exportDiscountReceive",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出领取记录") + public ResponseData exportDiscountReceive(@RequestParam(name = "id", required = true) Long id) { + try { + HighDiscountAgentRel rel = highDiscountAgentRelService.getRelById(id); + if (rel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "数据不存在"); + } + + String fileUrl = SysConst.getSysConfig().getFileUrl() + "/temporary/"; + String pathName = System.currentTimeMillis()+".xlsx"; + File file = new File(fileUrl); + if (!file.exists()) { + file.mkdirs(); + } + // EasyExcel.write(fileUrl+pathName).sheet("sheet1").doWrite(dataList); + return ResponseMsgUtil.success(pathName); + + } catch (Exception e) { + log.error("HighDiscountController -> getReceiveLink() error!",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java index 5c72d708..91006c2e 100644 --- a/hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java @@ -1,6 +1,7 @@ package com.hai.dao; import com.hai.entity.HighDiscountAgentCode; +import com.hai.model.DiscountUseConditionModel; import org.apache.ibatis.annotations.*; import org.apache.ibatis.type.JdbcType; @@ -32,61 +33,56 @@ public interface HighDiscountAgentCodeMapperExt { void insertListCode(@Param(value = "list") List discountAgentCodeList); @Select({""}) - List> getDiscountUseConditionList(@Param("param") Map param); + " select * FROM ( " + + " select " + + " a.id discountAgentCodeId, " + + " c.discount_name discountName, " + + " case c.discount_type when 1 then '满减' when 2 then '抵扣' when 3 then '折扣' else '未知' end discountType, " + + " c.discount_price discountPrice, " + + " insert(b.phone, 4, 4, '****') userPhone, " + + " b.create_time receiveTime, " + + " b.use_end_time useEndTime, " + + " b.use_time useTime, " + + " case a.`status` " + + " when 1 then '待领取' " + + " when 2 then '待使用' " + + " when 3 then '已使用' " + + " when 4 then '已过期' " + + " when 5 then '已分配' " + + " end discountUseStatus, " + + " d.order_no orderNo, " + + " d.total_price orderTotalPrice, " + + " (d.total_price - d.pay_price) orderDiscountPrice, " + + " d.pay_price orderPayPrice " + + " from (select id,status,discount_agent_id from high_discount_agent_code " + + " where discount_agent_id in (select id from high_discount_agent_rel where agent_id = #{param.agentId}" + + " and discount_id = #{param.discountId} )) a " + + " " + + " LEFT JOIN (select ur.discount_agent_code_id,ur.id,ur.create_time,ur.use_time,ur.use_end_time,u.phone " + + " from high_discount_user_rel ur " + + " LEFT JOIN high_user u on u.id = ur.user_id " + + " ) b on b.discount_agent_code_id = a.id " + + " " + + " LEFT JOIN (select mem_discount_id,order_no,total_price,pay_price " + + " from high_order where mem_discount_id is not null and order_status in (2,3) GROUP BY mem_discount_id) d on d.mem_discount_id = b.id " + + " " + + " LEFT JOIN (select a.id, b.id discount_id,b.discount_name,b.discount_type,b.discount_price " + + " from high_discount_agent_rel a, high_discount b where a.discount_id = b.id GROUP BY a.id) c on c.id = a.discount_agent_id " + + " " + + " where 1 = 1 " + + " ORDER BY a.id desc " + + " " + + " ) discountData " + + " where 1 = 1 " + + " = #{param.receiveTimeS} ]]> " + + " " + + " = #{param.useTimeS} ]]> " + + " " + + " = #{param.idS} ]]> " + + " " + + " " + + "" }) + List getDiscountUseConditionList(@Param("param") Map param); @Select(" select * from high_discount_agent_code where discount_agent_id = #{discountAgentId} and status = 1 limit #{num} " ) @Results({ diff --git a/hai-service/src/main/java/com/hai/model/DiscountUseConditionModel.java b/hai-service/src/main/java/com/hai/model/DiscountUseConditionModel.java new file mode 100644 index 00000000..4d71b7d4 --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/DiscountUseConditionModel.java @@ -0,0 +1,58 @@ +package com.hai.model; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @className: DiscountUseConditionModel + * @author: HuRui + * @date: 2023/3/28 + **/ +@Data +public class DiscountUseConditionModel { + + @ColumnWidth(15) + @ExcelProperty("优惠券编码") + private Long discountAgentCodeId; + @ColumnWidth(25) + @ExcelProperty("优惠券名称") + private String discountName; + @ColumnWidth(15) + @ExcelProperty("优惠券类型") + private String discountType; + @ColumnWidth(15) + @ExcelProperty("优惠券价格") + private BigDecimal discountPrice; + @ColumnWidth(15) + @ExcelProperty("优惠券状态") + private String discountUseStatus; + @ColumnWidth(15) + @ExcelProperty("客户电话") + private String userPhone; + @ColumnWidth(20) + @ExcelProperty("领取时间") + private Date receiveTime; + @ColumnWidth(20) + @ExcelProperty("过期时间") + private Date useEndTime; + @ColumnWidth(20) + @ExcelProperty("使用时间") + private Date useTime; + @ColumnWidth(25) + @ExcelProperty("交易订单号") + private String orderNo; + @ColumnWidth(15) + @ExcelProperty("交易金额") + private BigDecimal orderTotalPrice; + @ColumnWidth(15) + @ExcelProperty("交易优惠") + private BigDecimal orderDiscountPrice; + @ColumnWidth(15) + @ExcelProperty("交易实付") + private BigDecimal orderPayPrice; + +} diff --git a/hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java b/hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java index 169237b3..3e20f95c 100644 --- a/hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java +++ b/hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java @@ -1,6 +1,7 @@ package com.hai.service; import com.hai.entity.HighDiscountAgentCode; +import com.hai.model.DiscountUseConditionModel; import io.swagger.models.auth.In; import java.util.List; @@ -46,7 +47,7 @@ public interface HighDiscountAgentCodeService { * @param map * @return */ - List> getDiscountUseConditionList(Map map); + List getDiscountUseConditionList(Map map) throws Exception; /** * @Author Sum1Dream diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java index c3918ae1..49c5b38d 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java @@ -12,6 +12,7 @@ import com.hai.dao.HighCouponCodeMapper; import com.hai.dao.HighCouponCodeOtherMapper; import com.hai.dao.HighDiscountAgentCodeMapper; import com.hai.entity.*; +import com.hai.model.DiscountUseConditionModel; import com.hai.model.HighUserModel; import com.hai.service.*; import org.apache.commons.collections4.MapUtils; @@ -119,24 +120,21 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe } @Override - public List> getDiscountUseConditionList(Map map) { - try { - if (MapUtils.getLong(map, "receiveTimeS") != null) { - map.put("receiveTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "receiveTimeS")), "yyyy-MM-dd HH:mm:ss")); - } - if (MapUtils.getLong(map, "receiveTimeE") != null) { - map.put("receiveTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "receiveTimeE")), "yyyy-MM-dd HH:mm:ss")); - } + public List getDiscountUseConditionList(Map map) throws Exception { + if (MapUtils.getLong(map, "receiveTimeS") != null) { + map.put("receiveTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "receiveTimeS")), "yyyy-MM-dd HH:mm:ss")); + } + if (MapUtils.getLong(map, "receiveTimeE") != null) { + map.put("receiveTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "receiveTimeE")), "yyyy-MM-dd HH:mm:ss")); + } - if (MapUtils.getLong(map, "useTimeS") != null) { - map.put("useTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "useTimeS")), "yyyy-MM-dd HH:mm:ss")); - } - if (MapUtils.getLong(map, "useTimeE") != null) { - map.put("useTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "useTimeE")), "yyyy-MM-dd HH:mm:ss")); - } - } catch (Exception e) { - e.printStackTrace(); + if (MapUtils.getLong(map, "useTimeS") != null) { + map.put("useTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "useTimeS")), "yyyy-MM-dd HH:mm:ss")); } + if (MapUtils.getLong(map, "useTimeE") != null) { + map.put("useTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "useTimeE")), "yyyy-MM-dd HH:mm:ss")); + } + return highDiscountAgentCodeMapper.getDiscountUseConditionList(map); } diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index ec3f971c..71cd949b 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -110,8 +110,8 @@ unionRsaKey=891f6775fba7f12cc23df7c75e02b39b891f6775fba7f12c #url -#fileUrl=/home/project/hsg/filesystem/ -fileUrl=/Volumes/work/filesystem/ +fileUrl=/home/project/hsg/filesystem/ +#fileUrl=/Volumes/work/filesystem/ #wx wxAppId=wx8d49e2f83025229d From 94d44b5790168afe0b9c17b7b5c6a8bbd8cf0084 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 28 Mar 2023 19:32:27 +0800 Subject: [PATCH 5/7] =?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 --- .../src/main/java/com/web/controller/OrderPayController.java | 3 +++ .../src/main/java/com/hai/common/pay/WechatPayUtil.java | 4 ++++ 2 files changed, 7 insertions(+) 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 f9cb676b..9183bc9c 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -9,6 +9,7 @@ import com.hai.common.pay.entity.WeChatPayReqInfo; import com.hai.common.pay.util.MD5Util; import com.hai.common.security.AESEncodeUtil; import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.UnionPayConfig; import com.hai.config.WxOrderConfig; @@ -270,6 +271,8 @@ public class OrderPayController { weChatPayReqInfo.setTrade_type("JSAPI"); // 交易类型 weChatPayReqInfo.setAttach(null); // 附件参数 weChatPayReqInfo.setProfit_sharing(profitSharing); // 是否分账 Y:是 N:否 + weChatPayReqInfo.setTime_start(DateUtil.date2String(order.getCreateTime(), "yyyyMMddHHmmss")); + weChatPayReqInfo.setTime_expire(DateUtil.date2String(DateUtil.addMinute(order.getCreateTime(), 10), "yyyyMMddHHmmss")); //附加数据,区分订单类型 Map payMap = new HashMap<>(); diff --git a/hai-service/src/main/java/com/hai/common/pay/WechatPayUtil.java b/hai-service/src/main/java/com/hai/common/pay/WechatPayUtil.java index f8bfb563..cf139b1e 100644 --- a/hai-service/src/main/java/com/hai/common/pay/WechatPayUtil.java +++ b/hai-service/src/main/java/com/hai/common/pay/WechatPayUtil.java @@ -1,5 +1,8 @@ package com.hai.common.pay; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; import com.hai.common.pay.entity.WeChatPayReqInfo; import com.hai.common.pay.entity.WechatCallBackInfo; import com.hai.common.pay.util.HttpReqUtil; @@ -73,6 +76,7 @@ public class WechatPayUtil { } else { log.error("微信支付 -> 组装支付参数:支付信息错误"); log.error("错误信息:" + unifiedOrderResultXmL); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,请稍后重新提交订单支付!"); } return sortedMap; From b69c81718237d87ead2aa61d8f808b53e6a09b58 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 29 Mar 2023 09:50:43 +0800 Subject: [PATCH 6/7] =?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 --- .../src/main/java/com/web/controller/OrderPayController.java | 5 +++++ hai-service/src/main/java/com/hai/common/utils/DateUtil.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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 9183bc9c..fd948f14 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; +import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.SortedMap; @@ -122,6 +123,10 @@ public class OrderPayController { log.error("wxPay ERROR", "订单不处于待支付状态"); throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); } + if (DateUtil.getSecondDiff(order.getCreateTime(), DateUtil.addDate(order.getCreateTime(), 10)) < 10) { + log.error("wxPay ERROR", "订单待支付时间小于10秒,请重新下单支付"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单待支付时间小于10秒,请重新下单支付"); + } Integer openIdType = body.getInteger("openIdType"); // 是否分账 diff --git a/hai-service/src/main/java/com/hai/common/utils/DateUtil.java b/hai-service/src/main/java/com/hai/common/utils/DateUtil.java index cbc578f6..a1ef0be8 100644 --- a/hai-service/src/main/java/com/hai/common/utils/DateUtil.java +++ b/hai-service/src/main/java/com/hai/common/utils/DateUtil.java @@ -413,7 +413,7 @@ public class DateUtil { * @return: java.util.Date * @throws */ - public static Date addDate(Date date,int day) throws ParseException { + public static Date addDate(Date date,int day) { long time = date.getTime(); // 得到指定日期的毫秒数 long longTime = (long)day; long addDay = longTime*24*60*60*1000; // 要加上的天数转换成毫秒数 @@ -577,7 +577,7 @@ public class DateUtil { * @return: int * @throws */ - public static long getMinutesDiff(Date oldTime, Date newTime) throws Exception{ + public static long getMinutesDiff(Date oldTime, Date newTime) { long oldTimeStamp = oldTime.getTime(); long newTimeStamp = newTime.getTime(); From fa988e237fdea0cfa1f864d731fb318e294d2a83 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 29 Mar 2023 09:53:50 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4diam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/web/controller/OrderPayController.java | 5 ----- 1 file changed, 5 deletions(-) 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 fd948f14..fd5e79fb 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -123,11 +123,6 @@ public class OrderPayController { log.error("wxPay ERROR", "订单不处于待支付状态"); throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); } - if (DateUtil.getSecondDiff(order.getCreateTime(), DateUtil.addDate(order.getCreateTime(), 10)) < 10) { - log.error("wxPay ERROR", "订单待支付时间小于10秒,请重新下单支付"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单待支付时间小于10秒,请重新下单支付"); - } - Integer openIdType = body.getInteger("openIdType"); // 是否分账 String profitSharing = "N";