From de67ff14960bdf579ee86aa766aea05a841213fb Mon Sep 17 00:00:00 2001
From: hurui <177768073@qq.com>
Date: Tue, 26 Mar 2024 10:39:12 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
bweb/pom.xml | 45 +
bweb/src/main/java/com/BWebApplication.java | 30 +
.../main/java/com/bweb/config/AuthConfig.java | 136 +++
.../java/com/bweb/config/ConfigListener.java | 24 +
.../main/java/com/bweb/config/CorsConfig.java | 49 +
.../java/com/bweb/config/MultipartConfig.java | 26 +
.../java/com/bweb/config/RedisConfig.java | 109 +++
.../java/com/bweb/config/SwaggerConfig.java | 47 +
.../main/java/com/bweb/config/SysConfig.java | 31 +
.../main/java/com/bweb/config/SysConst.java | 19 +
.../com/bweb/controller/CommonController.java | 18 +
.../bweb/controller/FileUploadController.java | 138 +++
bweb/src/main/resources/dev/application.yml | 89 ++
bweb/src/main/resources/dev/config.properties | 2 +
bweb/src/main/resources/dev/logback.xml | 72 ++
bweb/src/main/resources/pre/application.yml | 56 ++
bweb/src/main/resources/pre/config.properties | 2 +
bweb/src/main/resources/pre/logback.xml | 72 ++
bweb/src/main/resources/prod/application.yml | 57 ++
.../src/main/resources/prod/config.properties | 2 +
bweb/src/main/resources/prod/logback.xml | 72 ++
cweb/pom.xml | 45 +
cweb/src/main/java/com/CWebApplication.java | 30 +
.../main/java/com/cweb/config/AuthConfig.java | 169 ++++
.../java/com/cweb/config/ConfigListener.java | 25 +
.../main/java/com/cweb/config/CorsConfig.java | 49 +
.../java/com/cweb/config/MultipartConfig.java | 26 +
.../java/com/cweb/config/RedisConfig.java | 110 +++
.../java/com/cweb/config/SwaggerConfig.java | 47 +
.../main/java/com/cweb/config/SysConfig.java | 31 +
.../main/java/com/cweb/config/SysConst.java | 19 +
.../com/cweb/config/WxMaConfiguration.java | 33 +
.../com/cweb/controller/CommonController.java | 16 +
cweb/src/main/resources/dev/application.yml | 89 ++
cweb/src/main/resources/dev/config.properties | 2 +
cweb/src/main/resources/dev/logback.xml | 72 ++
cweb/src/main/resources/pre/application.yml | 56 ++
cweb/src/main/resources/pre/config.properties | 2 +
cweb/src/main/resources/pre/logback.xml | 72 ++
cweb/src/main/resources/prod/application.yml | 57 ++
.../src/main/resources/prod/config.properties | 2 +
cweb/src/main/resources/prod/logback.xml | 72 ++
openapi/pom.xml | 45 +
.../src/main/java/com/OpenAPiApplication.java | 30 +
.../java/com/openapi/config/AuthConfig.java | 170 ++++
.../com/openapi/config/ConfigListener.java | 23 +
.../java/com/openapi/config/CorsConfig.java | 49 +
.../com/openapi/config/MultipartConfig.java | 26 +
.../java/com/openapi/config/RedisConfig.java | 110 +++
.../com/openapi/config/SwaggerConfig.java | 47 +
.../java/com/openapi/config/SysConfig.java | 31 +
.../java/com/openapi/config/SysConst.java | 19 +
.../src/main/resources/dev/application.yml | 89 ++
.../src/main/resources/dev/config.properties | 2 +
openapi/src/main/resources/dev/logback.xml | 72 ++
.../src/main/resources/pre/application.yml | 56 ++
.../src/main/resources/pre/config.properties | 2 +
openapi/src/main/resources/pre/logback.xml | 72 ++
.../src/main/resources/prod/application.yml | 57 ++
.../src/main/resources/prod/config.properties | 2 +
openapi/src/main/resources/prod/logback.xml | 72 ++
order/pom.xml | 45 +
order/src/main/java/com/OrderApplication.java | 29 +
.../java/com/order/config/AuthConfig.java | 169 ++++
.../java/com/order/config/ConfigListener.java | 23 +
.../java/com/order/config/CorsConfig.java | 49 +
.../com/order/config/MultipartConfig.java | 26 +
.../java/com/order/config/RedisConfig.java | 110 +++
.../com/order/config/SessionKeyCache.java | 53 ++
.../java/com/order/config/SwaggerConfig.java | 47 +
.../main/java/com/order/config/SysConfig.java | 31 +
.../main/java/com/order/config/SysConst.java | 19 +
.../com/order/config/WxMaConfiguration.java | 31 +
.../java/com/order/config/WxMsgConfig.java | 55 ++
order/src/main/resources/dev/application.yml | 89 ++
.../src/main/resources/dev/config.properties | 2 +
order/src/main/resources/dev/logback.xml | 72 ++
order/src/main/resources/pre/application.yml | 56 ++
.../src/main/resources/pre/config.properties | 2 +
order/src/main/resources/pre/logback.xml | 72 ++
order/src/main/resources/prod/application.yml | 57 ++
.../src/main/resources/prod/config.properties | 2 +
order/src/main/resources/prod/logback.xml | 72 ++
pom.xml | 70 ++
schedule/pom.xml | 45 +
schedule/schedule.iml | 8 +
.../java/com/hfkj/ScheduleApplication.java | 30 +
.../main/java/com/hfkj/config/AuthConfig.java | 169 ++++
.../java/com/hfkj/config/ConfigListener.java | 23 +
.../main/java/com/hfkj/config/CorsConfig.java | 49 +
.../java/com/hfkj/config/MultipartConfig.java | 26 +
.../java/com/hfkj/config/RedisConfig.java | 110 +++
.../java/com/hfkj/config/SwaggerConfig.java | 47 +
.../main/java/com/hfkj/config/SysConfig.java | 31 +
.../main/java/com/hfkj/config/SysConst.java | 19 +
.../src/main/resources/dev/application.yml | 92 ++
.../src/main/resources/dev/config.properties | 0
schedule/src/main/resources/dev/logback.xml | 72 ++
.../src/main/resources/pre/application.yml | 59 ++
.../src/main/resources/pre/config.properties | 0
schedule/src/main/resources/pre/logback.xml | 72 ++
.../src/main/resources/prod/application.yml | 59 ++
.../src/main/resources/prod/config.properties | 0
schedule/src/main/resources/prod/logback.xml | 72 ++
service/pom.xml | 246 ++++++
.../main/java/com/hfkj/common/Base64Util.java | 42 +
.../java/com/hfkj/common/QRCodeGenerator.java | 43 +
.../hfkj/common/exception/AppException.java | 10 +
.../hfkj/common/exception/BaseException.java | 23 +
.../hfkj/common/exception/BizException.java | 10 +
.../com/hfkj/common/exception/ErrorCode.java | 160 ++++
.../com/hfkj/common/exception/ErrorHelp.java | 23 +
.../com/hfkj/common/exception/SysCode.java | 24 +
.../hfkj/common/exception/SysException.java | 10 +
.../hfkj/common/pay/entity/AliPayReqInfo.java | 151 ++++
.../com/hfkj/common/pay/entity/OrderType.java | 46 +
.../common/pay/entity/WeChatPayReqInfo.java | 240 +++++
.../common/pay/entity/WechatCallBackInfo.java | 154 ++++
.../pay/entity/WechatPayReturnParam.java | 151 ++++
.../hfkj/common/pay/entity/WechatReturn.java | 77 ++
.../com/hfkj/common/pay/util/HttpReqUtil.java | 329 +++++++
.../java/com/hfkj/common/pay/util/IOUtil.java | 73 ++
.../com/hfkj/common/pay/util/MD5Util.java | 55 ++
.../common/pay/util/MyX509TrustManager.java | 24 +
.../hfkj/common/pay/util/SignatureUtil.java | 358 ++++++++
.../com/hfkj/common/pay/util/XmlUtil.java | 274 ++++++
.../common/pay/util/sdk/IWXPayDomain.java | 42 +
.../com/hfkj/common/pay/util/sdk/WXPay.java | 687 ++++++++++++++
.../hfkj/common/pay/util/sdk/WXPayConfig.java | 103 +++
.../common/pay/util/sdk/WXPayConstants.java | 59 ++
.../hfkj/common/pay/util/sdk/WXPayReport.java | 265 ++++++
.../common/pay/util/sdk/WXPayRequest.java | 256 ++++++
.../hfkj/common/pay/util/sdk/WXPayUtil.java | 294 ++++++
.../common/pay/util/sdk/WXPayXmlUtil.java | 30 +
.../hfkj/common/security/AESEncodeUtil.java | 76 ++
.../com/hfkj/common/security/AuthManager.java | 13 +
.../com/hfkj/common/security/Base64Util.java | 42 +
.../com/hfkj/common/security/CookieUtil.java | 123 +++
.../com/hfkj/common/security/DesUtil.java | 277 ++++++
.../com/hfkj/common/security/LoginCache.java | 60 ++
.../hfkj/common/security/SessionObject.java | 57 ++
.../com/hfkj/common/security/UserCenter.java | 153 ++++
.../com/hfkj/common/security/VerifyCode.java | 44 +
.../common/security/VerifyCodeStorage.java | 29 +
.../hfkj/common/utils/CoordCommonUtil.java | 38 +
.../java/com/hfkj/common/utils/DateUtil.java | 773 ++++++++++++++++
.../java/com/hfkj/common/utils/HttpUtils.java | 311 +++++++
.../com/hfkj/common/utils/HttpsUtils.java | 836 ++++++++++++++++++
.../com/hfkj/common/utils/IDGenerator.java | 63 ++
.../com/hfkj/common/utils/IdCardUtil.java | 99 +++
.../com/hfkj/common/utils/IdentifyUtil.java | 40 +
.../java/com/hfkj/common/utils/MD5Util.java | 69 ++
.../java/com/hfkj/common/utils/MathUtils.java | 25 +
.../hfkj/common/utils/MemberValidateUtil.java | 112 +++
.../java/com/hfkj/common/utils/PageUtil.java | 98 ++
.../java/com/hfkj/common/utils/RedisUtil.java | 533 +++++++++++
.../com/hfkj/common/utils/RequestUtils.java | 38 +
.../hfkj/common/utils/ResponseMsgUtil.java | 70 ++
.../hfkj/common/utils/SpringContextUtil.java | 28 +
.../com/hfkj/common/utils/UnionUtils.java | 487 ++++++++++
.../java/com/hfkj/common/utils/WxUtils.java | 373 ++++++++
.../java/com/hfkj/config/CommonSysConfig.java | 12 +
.../java/com/hfkj/config/CommonSysConst.java | 19 +
.../java/com/hfkj/config/ConfigListener.java | 23 +
.../com/hfkj/dao/SecDictionaryMapper.java | 105 +++
.../com/hfkj/dao/SecDictionaryMapperExt.java | 7 +
.../hfkj/dao/SecDictionarySqlProvider.java | 292 ++++++
.../java/com/hfkj/entity/SecDictionary.java | 156 ++++
.../com/hfkj/entity/SecDictionaryExample.java | 832 +++++++++++++++++
.../com/hfkj/entity/SecDictionaryKey.java | 75 ++
.../java/com/hfkj/model/CommonTreeModel.java | 80 ++
.../java/com/hfkj/model/MenuTreeModel.java | 130 +++
.../java/com/hfkj/model/ResponseData.java | 36 +
.../java/com/hfkj/model/UserInfoModel.java | 6 +
.../com/hfkj/service/FileUploadService.java | 39 +
.../service/impl/FileUploadServiceImpl.java | 118 +++
.../resources/dev/commonConfig.properties | 0
.../resources/pre/commonConfig.properties | 0
.../resources/prod/commonConfig.properties | 0
user/pom.xml | 45 +
user/src/main/java/com/UserApplication.java | 30 +
.../main/java/com/user/config/AuthConfig.java | 169 ++++
.../java/com/user/config/ConfigListener.java | 23 +
.../main/java/com/user/config/CorsConfig.java | 49 +
.../java/com/user/config/MultipartConfig.java | 26 +
.../java/com/user/config/RedisConfig.java | 110 +++
.../java/com/user/config/SwaggerConfig.java | 47 +
.../main/java/com/user/config/SysConfig.java | 31 +
.../main/java/com/user/config/SysConst.java | 19 +
user/src/main/resources/dev/application.yml | 89 ++
user/src/main/resources/dev/config.properties | 2 +
user/src/main/resources/dev/logback.xml | 72 ++
user/src/main/resources/pre/application.yml | 56 ++
user/src/main/resources/pre/config.properties | 2 +
user/src/main/resources/pre/logback.xml | 72 ++
user/src/main/resources/prod/application.yml | 57 ++
.../src/main/resources/prod/config.properties | 2 +
user/src/main/resources/prod/logback.xml | 72 ++
198 files changed, 17287 insertions(+)
create mode 100644 bweb/pom.xml
create mode 100644 bweb/src/main/java/com/BWebApplication.java
create mode 100644 bweb/src/main/java/com/bweb/config/AuthConfig.java
create mode 100644 bweb/src/main/java/com/bweb/config/ConfigListener.java
create mode 100644 bweb/src/main/java/com/bweb/config/CorsConfig.java
create mode 100644 bweb/src/main/java/com/bweb/config/MultipartConfig.java
create mode 100644 bweb/src/main/java/com/bweb/config/RedisConfig.java
create mode 100644 bweb/src/main/java/com/bweb/config/SwaggerConfig.java
create mode 100644 bweb/src/main/java/com/bweb/config/SysConfig.java
create mode 100644 bweb/src/main/java/com/bweb/config/SysConst.java
create mode 100644 bweb/src/main/java/com/bweb/controller/CommonController.java
create mode 100644 bweb/src/main/java/com/bweb/controller/FileUploadController.java
create mode 100644 bweb/src/main/resources/dev/application.yml
create mode 100644 bweb/src/main/resources/dev/config.properties
create mode 100644 bweb/src/main/resources/dev/logback.xml
create mode 100644 bweb/src/main/resources/pre/application.yml
create mode 100644 bweb/src/main/resources/pre/config.properties
create mode 100644 bweb/src/main/resources/pre/logback.xml
create mode 100644 bweb/src/main/resources/prod/application.yml
create mode 100644 bweb/src/main/resources/prod/config.properties
create mode 100644 bweb/src/main/resources/prod/logback.xml
create mode 100644 cweb/pom.xml
create mode 100644 cweb/src/main/java/com/CWebApplication.java
create mode 100644 cweb/src/main/java/com/cweb/config/AuthConfig.java
create mode 100644 cweb/src/main/java/com/cweb/config/ConfigListener.java
create mode 100644 cweb/src/main/java/com/cweb/config/CorsConfig.java
create mode 100644 cweb/src/main/java/com/cweb/config/MultipartConfig.java
create mode 100644 cweb/src/main/java/com/cweb/config/RedisConfig.java
create mode 100644 cweb/src/main/java/com/cweb/config/SwaggerConfig.java
create mode 100644 cweb/src/main/java/com/cweb/config/SysConfig.java
create mode 100644 cweb/src/main/java/com/cweb/config/SysConst.java
create mode 100644 cweb/src/main/java/com/cweb/config/WxMaConfiguration.java
create mode 100644 cweb/src/main/java/com/cweb/controller/CommonController.java
create mode 100644 cweb/src/main/resources/dev/application.yml
create mode 100644 cweb/src/main/resources/dev/config.properties
create mode 100644 cweb/src/main/resources/dev/logback.xml
create mode 100644 cweb/src/main/resources/pre/application.yml
create mode 100644 cweb/src/main/resources/pre/config.properties
create mode 100644 cweb/src/main/resources/pre/logback.xml
create mode 100644 cweb/src/main/resources/prod/application.yml
create mode 100644 cweb/src/main/resources/prod/config.properties
create mode 100644 cweb/src/main/resources/prod/logback.xml
create mode 100644 openapi/pom.xml
create mode 100644 openapi/src/main/java/com/OpenAPiApplication.java
create mode 100644 openapi/src/main/java/com/openapi/config/AuthConfig.java
create mode 100644 openapi/src/main/java/com/openapi/config/ConfigListener.java
create mode 100644 openapi/src/main/java/com/openapi/config/CorsConfig.java
create mode 100644 openapi/src/main/java/com/openapi/config/MultipartConfig.java
create mode 100644 openapi/src/main/java/com/openapi/config/RedisConfig.java
create mode 100644 openapi/src/main/java/com/openapi/config/SwaggerConfig.java
create mode 100644 openapi/src/main/java/com/openapi/config/SysConfig.java
create mode 100644 openapi/src/main/java/com/openapi/config/SysConst.java
create mode 100644 openapi/src/main/resources/dev/application.yml
create mode 100644 openapi/src/main/resources/dev/config.properties
create mode 100644 openapi/src/main/resources/dev/logback.xml
create mode 100644 openapi/src/main/resources/pre/application.yml
create mode 100644 openapi/src/main/resources/pre/config.properties
create mode 100644 openapi/src/main/resources/pre/logback.xml
create mode 100644 openapi/src/main/resources/prod/application.yml
create mode 100644 openapi/src/main/resources/prod/config.properties
create mode 100644 openapi/src/main/resources/prod/logback.xml
create mode 100644 order/pom.xml
create mode 100644 order/src/main/java/com/OrderApplication.java
create mode 100644 order/src/main/java/com/order/config/AuthConfig.java
create mode 100644 order/src/main/java/com/order/config/ConfigListener.java
create mode 100644 order/src/main/java/com/order/config/CorsConfig.java
create mode 100644 order/src/main/java/com/order/config/MultipartConfig.java
create mode 100644 order/src/main/java/com/order/config/RedisConfig.java
create mode 100644 order/src/main/java/com/order/config/SessionKeyCache.java
create mode 100644 order/src/main/java/com/order/config/SwaggerConfig.java
create mode 100644 order/src/main/java/com/order/config/SysConfig.java
create mode 100644 order/src/main/java/com/order/config/SysConst.java
create mode 100644 order/src/main/java/com/order/config/WxMaConfiguration.java
create mode 100644 order/src/main/java/com/order/config/WxMsgConfig.java
create mode 100644 order/src/main/resources/dev/application.yml
create mode 100644 order/src/main/resources/dev/config.properties
create mode 100644 order/src/main/resources/dev/logback.xml
create mode 100644 order/src/main/resources/pre/application.yml
create mode 100644 order/src/main/resources/pre/config.properties
create mode 100644 order/src/main/resources/pre/logback.xml
create mode 100644 order/src/main/resources/prod/application.yml
create mode 100644 order/src/main/resources/prod/config.properties
create mode 100644 order/src/main/resources/prod/logback.xml
create mode 100644 pom.xml
create mode 100644 schedule/pom.xml
create mode 100644 schedule/schedule.iml
create mode 100644 schedule/src/main/java/com/hfkj/ScheduleApplication.java
create mode 100644 schedule/src/main/java/com/hfkj/config/AuthConfig.java
create mode 100644 schedule/src/main/java/com/hfkj/config/ConfigListener.java
create mode 100644 schedule/src/main/java/com/hfkj/config/CorsConfig.java
create mode 100644 schedule/src/main/java/com/hfkj/config/MultipartConfig.java
create mode 100644 schedule/src/main/java/com/hfkj/config/RedisConfig.java
create mode 100644 schedule/src/main/java/com/hfkj/config/SwaggerConfig.java
create mode 100644 schedule/src/main/java/com/hfkj/config/SysConfig.java
create mode 100644 schedule/src/main/java/com/hfkj/config/SysConst.java
create mode 100644 schedule/src/main/resources/dev/application.yml
create mode 100644 schedule/src/main/resources/dev/config.properties
create mode 100644 schedule/src/main/resources/dev/logback.xml
create mode 100644 schedule/src/main/resources/pre/application.yml
create mode 100644 schedule/src/main/resources/pre/config.properties
create mode 100644 schedule/src/main/resources/pre/logback.xml
create mode 100644 schedule/src/main/resources/prod/application.yml
create mode 100644 schedule/src/main/resources/prod/config.properties
create mode 100644 schedule/src/main/resources/prod/logback.xml
create mode 100644 service/pom.xml
create mode 100644 service/src/main/java/com/hfkj/common/Base64Util.java
create mode 100644 service/src/main/java/com/hfkj/common/QRCodeGenerator.java
create mode 100644 service/src/main/java/com/hfkj/common/exception/AppException.java
create mode 100644 service/src/main/java/com/hfkj/common/exception/BaseException.java
create mode 100644 service/src/main/java/com/hfkj/common/exception/BizException.java
create mode 100644 service/src/main/java/com/hfkj/common/exception/ErrorCode.java
create mode 100644 service/src/main/java/com/hfkj/common/exception/ErrorHelp.java
create mode 100644 service/src/main/java/com/hfkj/common/exception/SysCode.java
create mode 100644 service/src/main/java/com/hfkj/common/exception/SysException.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/entity/AliPayReqInfo.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/entity/OrderType.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/entity/WeChatPayReqInfo.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/entity/WechatCallBackInfo.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/entity/WechatPayReturnParam.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/entity/WechatReturn.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/HttpReqUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/IOUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/MD5Util.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/MyX509TrustManager.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/XmlUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/sdk/IWXPayDomain.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/sdk/WXPay.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/sdk/WXPayConfig.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/sdk/WXPayConstants.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/sdk/WXPayReport.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/sdk/WXPayRequest.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/sdk/WXPayUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/pay/util/sdk/WXPayXmlUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/security/AESEncodeUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/security/AuthManager.java
create mode 100644 service/src/main/java/com/hfkj/common/security/Base64Util.java
create mode 100644 service/src/main/java/com/hfkj/common/security/CookieUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/security/DesUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/security/LoginCache.java
create mode 100644 service/src/main/java/com/hfkj/common/security/SessionObject.java
create mode 100644 service/src/main/java/com/hfkj/common/security/UserCenter.java
create mode 100644 service/src/main/java/com/hfkj/common/security/VerifyCode.java
create mode 100644 service/src/main/java/com/hfkj/common/security/VerifyCodeStorage.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/CoordCommonUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/DateUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/HttpUtils.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/HttpsUtils.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/IDGenerator.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/IdCardUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/IdentifyUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/MD5Util.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/MathUtils.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/MemberValidateUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/PageUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/RedisUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/RequestUtils.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/ResponseMsgUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/SpringContextUtil.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/UnionUtils.java
create mode 100644 service/src/main/java/com/hfkj/common/utils/WxUtils.java
create mode 100644 service/src/main/java/com/hfkj/config/CommonSysConfig.java
create mode 100644 service/src/main/java/com/hfkj/config/CommonSysConst.java
create mode 100644 service/src/main/java/com/hfkj/config/ConfigListener.java
create mode 100644 service/src/main/java/com/hfkj/dao/SecDictionaryMapper.java
create mode 100644 service/src/main/java/com/hfkj/dao/SecDictionaryMapperExt.java
create mode 100644 service/src/main/java/com/hfkj/dao/SecDictionarySqlProvider.java
create mode 100644 service/src/main/java/com/hfkj/entity/SecDictionary.java
create mode 100644 service/src/main/java/com/hfkj/entity/SecDictionaryExample.java
create mode 100644 service/src/main/java/com/hfkj/entity/SecDictionaryKey.java
create mode 100644 service/src/main/java/com/hfkj/model/CommonTreeModel.java
create mode 100644 service/src/main/java/com/hfkj/model/MenuTreeModel.java
create mode 100644 service/src/main/java/com/hfkj/model/ResponseData.java
create mode 100644 service/src/main/java/com/hfkj/model/UserInfoModel.java
create mode 100644 service/src/main/java/com/hfkj/service/FileUploadService.java
create mode 100644 service/src/main/java/com/hfkj/service/impl/FileUploadServiceImpl.java
create mode 100644 service/src/main/resources/dev/commonConfig.properties
create mode 100644 service/src/main/resources/pre/commonConfig.properties
create mode 100644 service/src/main/resources/prod/commonConfig.properties
create mode 100644 user/pom.xml
create mode 100644 user/src/main/java/com/UserApplication.java
create mode 100644 user/src/main/java/com/user/config/AuthConfig.java
create mode 100644 user/src/main/java/com/user/config/ConfigListener.java
create mode 100644 user/src/main/java/com/user/config/CorsConfig.java
create mode 100644 user/src/main/java/com/user/config/MultipartConfig.java
create mode 100644 user/src/main/java/com/user/config/RedisConfig.java
create mode 100644 user/src/main/java/com/user/config/SwaggerConfig.java
create mode 100644 user/src/main/java/com/user/config/SysConfig.java
create mode 100644 user/src/main/java/com/user/config/SysConst.java
create mode 100644 user/src/main/resources/dev/application.yml
create mode 100644 user/src/main/resources/dev/config.properties
create mode 100644 user/src/main/resources/dev/logback.xml
create mode 100644 user/src/main/resources/pre/application.yml
create mode 100644 user/src/main/resources/pre/config.properties
create mode 100644 user/src/main/resources/pre/logback.xml
create mode 100644 user/src/main/resources/prod/application.yml
create mode 100644 user/src/main/resources/prod/config.properties
create mode 100644 user/src/main/resources/prod/logback.xml
diff --git a/bweb/pom.xml b/bweb/pom.xml
new file mode 100644
index 0000000..57b112a
--- /dev/null
+++ b/bweb/pom.xml
@@ -0,0 +1,45 @@
+
+
+
+ com.hfkj
+ puhui-go-parent
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ com.hfkj
+ bweb
+
+
+
+ com.hfkj
+ service
+ PACKT-SNAPSHOT
+
+
+
+
+
+
+ src/main/resources/${env}
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/bweb/src/main/java/com/BWebApplication.java b/bweb/src/main/java/com/BWebApplication.java
new file mode 100644
index 0000000..4897626
--- /dev/null
+++ b/bweb/src/main/java/com/BWebApplication.java
@@ -0,0 +1,30 @@
+package com;
+
+import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
+import com.alicp.jetcache.anno.config.EnableMethodCache;
+import com.hfkj.common.utils.SpringContextUtil;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+// @ComponentScan
+@EnableTransactionManagement
+@EnableScheduling
+@EnableMethodCache(basePackages = "com.hfkj")
+@EnableCreateCacheAnnotation
+@ServletComponentScan
+@MapperScan("com.hfkj.dao")
+public class BWebApplication
+{
+ public static void main( String[] args )
+ {
+ ApplicationContext app = SpringApplication.run(BWebApplication.class, args);
+ SpringContextUtil.setApplicationContext(app);
+ }
+
+}
diff --git a/bweb/src/main/java/com/bweb/config/AuthConfig.java b/bweb/src/main/java/com/bweb/config/AuthConfig.java
new file mode 100644
index 0000000..c58319d
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/config/AuthConfig.java
@@ -0,0 +1,136 @@
+package com.bweb.config;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.hfkj.common.security.UserCenter;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+@Configuration
+public class AuthConfig implements WebMvcConfigurer {
+
+ private static Logger log = LoggerFactory.getLogger(AuthConfig.class);
+
+ @Autowired
+ private UserCenter userCenter;
+
+ /**
+ * 获取配置文件debug变量
+ */
+ @Value("${debug}")
+ private boolean debug = false;
+
+ /**
+ * 解决18位long类型数据转json失去精度问题
+ * @param converters
+ */
+ @Override
+ public void configureMessageConverters(List> converters){
+ MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
+
+ ObjectMapper objectMapper = jsonConverter.getObjectMapper();
+ SimpleModule simpleModule = new SimpleModule();
+ simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+ simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+ objectMapper.registerModule(simpleModule);
+
+ converters.add(jsonConverter);
+ }
+
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(new HandlerInterceptorAdapter() {
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
+ Object handler) throws Exception {
+ if(debug){
+ return true;
+ }
+ String token = request.getParameter("Authorization");
+ if (StringUtils.isBlank(token)) {
+ token = request.getHeader("Authorization");
+ }
+ if((StringUtils.isNotBlank(token) && userCenter.isTokenLogin(token)) || userCenter.isLogin(request)){//如果未登录,将无法使用任何接口
+ userCenter.refreshCookie(request, response);
+ return true;
+ } else if(request instanceof StandardMultipartHttpServletRequest) {
+ StandardMultipartHttpServletRequest re = (StandardMultipartHttpServletRequest)request;
+ if(userCenter.isLogin(re.getRequest())){
+ return true;
+ } else {
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }
+ } else{
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }
+ }
+ })
+ .addPathPatterns("/**")
+ .excludePathPatterns("/swagger-resources/**")
+ .excludePathPatterns("/**/api-docs")
+ .excludePathPatterns("/**/springfox-swagger-ui/**")
+ .excludePathPatterns("/**/swagger-ui.html")
+ .excludePathPatterns("/login/userLogin")
+ .excludePathPatterns("/login/logout")
+ .excludePathPatterns("/common/*")
+ .excludePathPatterns("/sms/*")
+ .excludePathPatterns("/coupon/getGuizhouSinopec")
+ .excludePathPatterns("/cmsContent/get*")
+ .excludePathPatterns("/highGoldRec/*")
+ .excludePathPatterns("/test/*")
+ .excludePathPatterns("/openApi/*")
+ ;
+ }
+
+ public String getIpAddress(HttpServletRequest request) {
+ // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址
+ String ip = request.getHeader("X-Forwarded-For");
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("WL-Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_CLIENT_IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getRemoteAddr();
+ }
+ } else if (ip.length() > 15) {
+ String[] ips = ip.split(",");
+ for (int index = 0; index < ips.length; index++) {
+ String strIp = ips[index];
+ if (!("unknown".equalsIgnoreCase(strIp))) {
+ ip = strIp;
+ break;
+ }
+ }
+ }
+ return ip;
+ }
+
+}
diff --git a/bweb/src/main/java/com/bweb/config/ConfigListener.java b/bweb/src/main/java/com/bweb/config/ConfigListener.java
new file mode 100644
index 0000000..fb81053
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/config/ConfigListener.java
@@ -0,0 +1,24 @@
+package com.bweb.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+@WebListener
+public class ConfigListener implements ServletContextListener {
+
+ @Autowired
+ private SysConfig sysConfig;
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+ SysConst.setSysConfig(sysConfig);
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+ }
+
+}
diff --git a/bweb/src/main/java/com/bweb/config/CorsConfig.java b/bweb/src/main/java/com/bweb/config/CorsConfig.java
new file mode 100644
index 0000000..5f46ab3
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/config/CorsConfig.java
@@ -0,0 +1,49 @@
+package com.bweb.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName CorsConfig
+ * @Description: TODO ()
+ * @Author 胡锐
+ * @Date 2020/12/16
+ **/
+@Configuration
+public class CorsConfig extends WebMvcConfigurerAdapter {
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**")
+ .allowedOrigins("*")
+ .allowCredentials(true)
+ .allowedMethods("GET", "POST", "DELETE", "PUT")
+ .maxAge(3600);
+ }
+ private CorsConfiguration buildConfig() {
+ CorsConfiguration corsConfiguration = new CorsConfiguration();
+ List list = new ArrayList<>();
+ list.add("*");
+ corsConfiguration.setAllowedOrigins(list);
+ /*
+ // 请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等)
+ */
+ corsConfiguration.addAllowedOrigin("*");
+ corsConfiguration.addAllowedHeader("*");
+ corsConfiguration.addAllowedMethod("*");
+ return corsConfiguration;
+ }
+ @Bean
+ public CorsFilter corsFilter() {
+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+ source.registerCorsConfiguration("/**", buildConfig());
+ return new CorsFilter(source);
+ }
+}
diff --git a/bweb/src/main/java/com/bweb/config/MultipartConfig.java b/bweb/src/main/java/com/bweb/config/MultipartConfig.java
new file mode 100644
index 0000000..267de74
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/config/MultipartConfig.java
@@ -0,0 +1,26 @@
+package com.bweb.config;
+
+import org.springframework.boot.web.servlet.MultipartConfigFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.servlet.MultipartConfigElement;
+
+@Configuration
+public class MultipartConfig {
+
+ /**
+ * 文件上传配置
+ * @return
+ */
+ @Bean
+ public MultipartConfigElement multipartConfigElement() {
+ MultipartConfigFactory factory = new MultipartConfigFactory();
+ //文件最大
+ factory.setMaxFileSize("300MB"); //KB,MB
+ //设置总上传数据总大小
+ factory.setMaxRequestSize("350MB");
+ return factory.createMultipartConfig();
+ }
+
+}
diff --git a/bweb/src/main/java/com/bweb/config/RedisConfig.java b/bweb/src/main/java/com/bweb/config/RedisConfig.java
new file mode 100644
index 0000000..0c5f530
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/config/RedisConfig.java
@@ -0,0 +1,109 @@
+package com.bweb.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.*;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+
+@Configuration
+@EnableCaching //开启注解
+public class RedisConfig extends CachingConfigurerSupport {
+
+ /**
+ * retemplate相关配置
+ * @param factory
+ * @return
+ */
+ @Bean
+ public RedisTemplate redisTemplate(RedisConnectionFactory factory) {
+
+ RedisTemplate template = new RedisTemplate<>();
+ // 配置连接工厂
+ template.setConnectionFactory(factory);
+
+ //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
+ Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
+
+ ObjectMapper om = new ObjectMapper();
+ // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
+ om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+ // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
+ om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+ jacksonSeial.setObjectMapper(om);
+
+ // 值采用json序列化
+ template.setValueSerializer(jacksonSeial);
+ //使用StringRedisSerializer来序列化和反序列化redis的key值
+ template.setKeySerializer(new StringRedisSerializer());
+
+ // 设置hash key 和value序列化模式
+ template.setHashKeySerializer(new StringRedisSerializer());
+ template.setHashValueSerializer(jacksonSeial);
+ template.afterPropertiesSet();
+
+ return template;
+ }
+
+ /**
+ * 对hash类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public HashOperations hashOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForHash();
+ }
+
+ /**
+ * 对redis字符串类型数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ValueOperations valueOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForValue();
+ }
+
+ /**
+ * 对链表类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ListOperations listOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForList();
+ }
+
+ /**
+ * 对无序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public SetOperations setOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForSet();
+ }
+
+ /**
+ * 对有序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ZSetOperations zSetOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForZSet();
+ }
+}
\ No newline at end of file
diff --git a/bweb/src/main/java/com/bweb/config/SwaggerConfig.java b/bweb/src/main/java/com/bweb/config/SwaggerConfig.java
new file mode 100644
index 0000000..b46dc9a
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/config/SwaggerConfig.java
@@ -0,0 +1,47 @@
+package com.bweb.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+/**
+* SwaggerConfig.java
+* 项目名称:
+* 包:
+* 类名称: SwaggerConfig.java
+* 类描述: 构建restful api接口文档
+* 创建人:
+* 创建时间: 2017 下午4:23:45
+*/
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig
+{
+
+ /**
+ * 描述api的基本信息
+ * 基本信息会展现在文档页面中
+ * @return [api的基本信息]
+ */
+ ApiInfo apiInfo()
+ {
+ return new ApiInfoBuilder().title("hgj-BWeb").description("提供给管理平台的接口").termsOfServiceUrl("").version("1.0.0")
+ .contact(new Contact("", "", "")).build();
+ }
+
+ @Bean
+ public Docket customImplementation()
+ {
+ return new Docket(DocumentationType.SWAGGER_2).select()
+ .apis(RequestHandlerSelectors.basePackage("com"))
+ .build().directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
+ .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class).apiInfo(apiInfo());
+ }
+
+}
diff --git a/bweb/src/main/java/com/bweb/config/SysConfig.java b/bweb/src/main/java/com/bweb/config/SysConfig.java
new file mode 100644
index 0000000..1535c40
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/config/SysConfig.java
@@ -0,0 +1,31 @@
+package com.bweb.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
+
+@Component("sysConfig")
+@ConfigurationProperties
+@PropertySource("classpath:/config.properties")
+public class SysConfig {
+
+ private String fileUrl;
+
+ private String cmsPath;
+
+ public String getFileUrl() {
+ return fileUrl;
+ }
+
+ public void setFileUrl(String fileUrl) {
+ this.fileUrl = fileUrl;
+ }
+
+ public String getCmsPath() {
+ return cmsPath;
+ }
+
+ public void setCmsPath(String cmsPath) {
+ this.cmsPath = cmsPath;
+ }
+}
diff --git a/bweb/src/main/java/com/bweb/config/SysConst.java b/bweb/src/main/java/com/bweb/config/SysConst.java
new file mode 100644
index 0000000..948513a
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/config/SysConst.java
@@ -0,0 +1,19 @@
+package com.bweb.config;
+
+public class SysConst {
+
+ private static SysConfig sysConfig;
+
+ public static void setSysConfig(SysConfig arg){
+ sysConfig = arg;
+ }
+
+ public static SysConfig getSysConfig(){
+ if (null == sysConfig) {
+ //防止空指针异常
+ sysConfig = new SysConfig();
+ return sysConfig;
+ }
+ return sysConfig;
+ }
+}
diff --git a/bweb/src/main/java/com/bweb/controller/CommonController.java b/bweb/src/main/java/com/bweb/controller/CommonController.java
new file mode 100644
index 0000000..fabbb4f
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/controller/CommonController.java
@@ -0,0 +1,18 @@
+package com.bweb.controller;
+
+import io.swagger.annotations.Api;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController
+@RequestMapping(value="/common")
+@Api(value="共用接口")
+public class CommonController {
+
+ Logger log = LoggerFactory.getLogger(CommonController.class);
+
+
+
+}
diff --git a/bweb/src/main/java/com/bweb/controller/FileUploadController.java b/bweb/src/main/java/com/bweb/controller/FileUploadController.java
new file mode 100644
index 0000000..e9b2e31
--- /dev/null
+++ b/bweb/src/main/java/com/bweb/controller/FileUploadController.java
@@ -0,0 +1,138 @@
+package com.bweb.controller;
+
+import com.hfkj.common.utils.DateUtil;
+import com.hfkj.common.utils.ResponseMsgUtil;
+import com.bweb.config.SysConfig;
+import com.hfkj.model.ResponseData;
+import com.hfkj.service.FileUploadService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.multipart.commons.CommonsMultipartResolver;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.*;
+
+@RestController
+@RequestMapping(value="/fileUpload")
+@Api(value="文件上传")
+public class FileUploadController {
+
+ private static Logger log = LoggerFactory.getLogger(FileUploadController.class);
+
+ @Resource
+ private SysConfig sysConfig;
+
+ @Resource
+ private FileUploadService fileUploadService;
+
+ @RequestMapping(value="/uploadfile",method = RequestMethod.POST)
+ @ResponseBody
+ @ApiOperation(value = "文件上传")
+ public ResponseData uploadFile(@RequestParam(value = "files" , required = false) MultipartFile files,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ try {
+ response.setHeader("Access-Control-Allow-Origin", "*");
+ CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(
+ request.getSession().getServletContext());
+ // 判断 request 是否有文件上传,即多部分请求
+ List fileNames = new ArrayList();
+ if (multipartResolver.isMultipart(request)) {
+ // 转换成多部分request
+ MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
+ Iterator iterator = multiRequest.getFileNames();
+
+ while (iterator.hasNext()) {
+ MultipartFile file = multiRequest.getFile(iterator.next());
+ if (file != null) {
+ FileOutputStream out = null;
+ try {
+ String fileType = file.getOriginalFilename()
+ .substring(file.getOriginalFilename().lastIndexOf(".") + 1);
+ String fileName = file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf(".")) + System.currentTimeMillis() + "." + fileType;
+ String childPath = DateUtil.date2String(new Date(), "yyyyMM");
+ String destDirName = sysConfig.getFileUrl() + File.separator + childPath;
+ File dir = new File(destDirName);
+ if (!dir.exists()) {
+ dir.mkdirs();
+ }
+ out = new FileOutputStream(destDirName + File.separator + fileName);
+ out.write(file.getBytes());
+ out.flush();
+ fileNames.add(childPath + "/" + fileName);
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ }
+ }
+ }
+ }
+ return ResponseMsgUtil.success(fileNames);
+
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ return ResponseMsgUtil.exception(e);
+ }
+
+ }
+
+ @RequestMapping(value = "/fileUpload", method = RequestMethod.POST)
+ @ApiOperation(value = "上传文件(新接口)")
+ @ResponseBody
+ public ResponseData fileUpload(@RequestParam(name = "requestFile") MultipartFile requestFile,
+ @RequestParam(value = "uploadType", required = true) String uploadType,
+ HttpServletRequest request
+ ) {
+ try {
+ CommonsMultipartResolver multipartResolver =
+ new CommonsMultipartResolver(request.getSession().getServletContext());
+
+ // 提取文件列表
+ List files = new ArrayList<>();
+ if (multipartResolver.isMultipart(request)) {
+ MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
+ Iterator iterator = multiRequest.getFileNames();
+
+ while (iterator.hasNext()) {
+ MultipartFile file = multiRequest.getFile(iterator.next());
+ files.add(file);
+ }
+ }
+
+ // 定制参数
+ Map paramsMap = new HashMap<>();
+ if ("cmsModule".equals(uploadType)) {
+ paramsMap.put("pathPrefix", sysConfig.getFileUrl());
+ paramsMap.put("childPath", "/CMS/module/");
+ paramsMap.put("fileNameGenerator", "generateFileNameAndTimeStamp");
+ } else if ("cmsPatch".equals(uploadType)) {
+ paramsMap.put("pathPrefix", sysConfig.getFileUrl());
+ paramsMap.put("childPath", "/CMS/html/");
+ paramsMap.put("fileNameGenerator", "generateFileNameAndTimeStamp");
+ } else if ("cmsImg".equals(uploadType)) {
+ paramsMap.put("pathPrefix", sysConfig.getFileUrl());
+ paramsMap.put("childPath", "/CMS/img/");
+ paramsMap.put("fileNameGenerator", "generateFileNameAndTimeStamp");
+ }
+
+ return ResponseMsgUtil.success(fileUploadService.upload(files, paramsMap));
+ } catch (Exception e) {
+ log.error("FileUploadController --> addCategoryModule() error!", e);
+ return ResponseMsgUtil.exception(e);
+ }
+ }
+
+
+}
diff --git a/bweb/src/main/resources/dev/application.yml b/bweb/src/main/resources/dev/application.yml
new file mode 100644
index 0000000..07a5b09
--- /dev/null
+++ b/bweb/src/main/resources/dev/application.yml
@@ -0,0 +1,89 @@
+server:
+ port: 9502
+ servlet:
+ context-path: /brest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/puhui_go?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+ redis:
+ database: 1
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
+
+rocketmq:
+ name-server: 139.9.154.68:9876
+ producer:
+ access-key: huifukeji
+ secret-key: HF123456.
+ #必须指定group
+ group: default-group
+ consumer:
+ access-key: huifukeji
+ secret-key: HF123456.
+
+jetcache:
+ statIntervalMinutes: 15
+ areaInCacheName: false
+ local:
+ default:
+ type: linkedhashmap
+ keyConvertor: fastjson
+ remote:
+ default:
+ type: redis
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ keyConvertor: fastjson
+ broadcastChannel: projectA
+ valueEncoder: java
+ valueDecoder: java
+ poolConfig:
+ minIdle: 5
+ maxIdle: 20
+ maxTotal: 50
diff --git a/bweb/src/main/resources/dev/config.properties b/bweb/src/main/resources/dev/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/bweb/src/main/resources/dev/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/bweb/src/main/resources/dev/logback.xml b/bweb/src/main/resources/dev/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/bweb/src/main/resources/dev/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bweb/src/main/resources/pre/application.yml b/bweb/src/main/resources/pre/application.yml
new file mode 100644
index 0000000..874093a
--- /dev/null
+++ b/bweb/src/main/resources/pre/application.yml
@@ -0,0 +1,56 @@
+server:
+ port: 9301
+ servlet:
+ context-path: /crest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+ redis:
+ database: 1
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/bweb/src/main/resources/pre/config.properties b/bweb/src/main/resources/pre/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/bweb/src/main/resources/pre/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/bweb/src/main/resources/pre/logback.xml b/bweb/src/main/resources/pre/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/bweb/src/main/resources/pre/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bweb/src/main/resources/prod/application.yml b/bweb/src/main/resources/prod/application.yml
new file mode 100644
index 0000000..f3e38c7
--- /dev/null
+++ b/bweb/src/main/resources/prod/application.yml
@@ -0,0 +1,57 @@
+server:
+ port: 9301
+ servlet:
+ context-path: /crest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://127.0.0.1:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+
+ redis:
+ database: 0
+ host: 127.0.0.1
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/bweb/src/main/resources/prod/config.properties b/bweb/src/main/resources/prod/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/bweb/src/main/resources/prod/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/bweb/src/main/resources/prod/logback.xml b/bweb/src/main/resources/prod/logback.xml
new file mode 100644
index 0000000..e509de0
--- /dev/null
+++ b/bweb/src/main/resources/prod/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cweb/pom.xml b/cweb/pom.xml
new file mode 100644
index 0000000..361cfdd
--- /dev/null
+++ b/cweb/pom.xml
@@ -0,0 +1,45 @@
+
+
+
+ com.hfkj
+ puhui-go-parent
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ com.hfkj
+ cweb
+
+
+
+ com.hfkj
+ service
+ PACKT-SNAPSHOT
+
+
+
+
+
+
+ src/main/resources/${env}
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/cweb/src/main/java/com/CWebApplication.java b/cweb/src/main/java/com/CWebApplication.java
new file mode 100644
index 0000000..84183e8
--- /dev/null
+++ b/cweb/src/main/java/com/CWebApplication.java
@@ -0,0 +1,30 @@
+package com;
+
+import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
+import com.alicp.jetcache.anno.config.EnableMethodCache;
+import com.hfkj.common.utils.SpringContextUtil;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+// @ComponentScan
+@EnableTransactionManagement
+@EnableScheduling
+@EnableMethodCache(basePackages = "com.hfkj")
+@EnableCreateCacheAnnotation
+@ServletComponentScan
+@MapperScan("com.hfkj.dao")
+public class CWebApplication
+{
+ public static void main( String[] args )
+ {
+ ApplicationContext app = SpringApplication.run(CWebApplication.class, args);
+ SpringContextUtil.setApplicationContext(app);
+ }
+
+}
diff --git a/cweb/src/main/java/com/cweb/config/AuthConfig.java b/cweb/src/main/java/com/cweb/config/AuthConfig.java
new file mode 100644
index 0000000..989ed17
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/config/AuthConfig.java
@@ -0,0 +1,169 @@
+package com.cweb.config;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.hfkj.common.security.UserCenter;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+@Configuration
+public class AuthConfig implements WebMvcConfigurer {
+
+ private static Logger log = LoggerFactory.getLogger(AuthConfig.class);
+
+ @Resource
+ private UserCenter userCenter;
+
+ /**
+ * 获取配置文件debug变量
+ */
+ @Value("${debug}")
+ private boolean debug = false;
+
+ /**
+ * 解决18位long类型数据转json失去精度问题
+ * @param converters
+ */
+ @Override
+ public void configureMessageConverters(List> converters){
+ MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
+
+ ObjectMapper objectMapper = jsonConverter.getObjectMapper();
+ SimpleModule simpleModule = new SimpleModule();
+ simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+ simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+ objectMapper.registerModule(simpleModule);
+
+ converters.add(jsonConverter);
+ }
+
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(new HandlerInterceptorAdapter() {
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
+ Object handler) throws Exception {
+ if(debug){
+ return true;
+ }
+ String token = request.getParameter("Authorization");
+ if (StringUtils.isBlank(token)) {
+ token = request.getHeader("Authorization");
+ }
+ if((StringUtils.isNotBlank(token) && userCenter.isTokenLogin(token)) || userCenter.isLogin(request)){//如果未登录,将无法使用任何接口
+ userCenter.refreshCookie(request, response);
+ return true;
+ } else if(request instanceof StandardMultipartHttpServletRequest) {
+ StandardMultipartHttpServletRequest re = (StandardMultipartHttpServletRequest)request;
+ if(userCenter.isLogin(re.getRequest())){
+ return true;
+ } else {
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }
+ } else{
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }
+ }
+ })
+ .addPathPatterns("/**")
+ .excludePathPatterns("/swagger-resources/**")
+ .excludePathPatterns("/**/api-docs")
+ .excludePathPatterns("/**/springfox-swagger-ui/**")
+ .excludePathPatterns("/**/swagger-ui.html")
+ .excludePathPatterns("/login/*")
+ .excludePathPatterns("/order/*")
+ .excludePathPatterns("/coupon/getCouponList")
+ .excludePathPatterns("/wechatpay/*")
+ .excludePathPatterns("/coupon/getCouponById")
+ .excludePathPatterns("/discount/getDiscountByQrCode")
+ .excludePathPatterns("/discount/getDiscountById")
+ .excludePathPatterns("/discount/getCouponByDiscount")
+ .excludePathPatterns("/discount/getDiscountByDiscountAgentId")
+ .excludePathPatterns("/highMerchantStore/getMerchantStoreById")
+ .excludePathPatterns("/highMerchantStore/getStoreListByCoupon")
+ .excludePathPatterns("/highMerchantStore/getStoreList")
+ .excludePathPatterns("/highMerchantStore/getMerchantList")
+ .excludePathPatterns("/highMerchantStore/getStoreListByMerchant")
+ .excludePathPatterns("/sms/sendSmsCode")
+ .excludePathPatterns("/sms/getSmsCode")
+ .excludePathPatterns("/activity/getWinLotteryList")
+ .excludePathPatterns("/user/login")
+ .excludePathPatterns("/user/unionPhoneLogin")
+ .excludePathPatterns("/user/getUnionId")
+ .excludePathPatterns("/highUser/setCacheParam")
+ .excludePathPatterns("/highUser/getCacheParam")
+ .excludePathPatterns("/highUser/delCacheParam")
+ .excludePathPatterns("/order/orderToH5Pay")
+ .excludePathPatterns("/order/orderToPay")
+ .excludePathPatterns("/test/*")
+ .excludePathPatterns("/cmsContent/*")
+ .excludePathPatterns("/highGas/*")
+ .excludePathPatterns("/outRechargeOrder/*")
+ .excludePathPatterns("/wechat/*")
+ .excludePathPatterns("/tuanyou/*")
+ .excludePathPatterns("/unionPay/*")
+ .excludePathPatterns("/highGas/*")
+ .excludePathPatterns("/common/*")
+ .excludePathPatterns("/order/qzOrderToPay")
+ .excludePathPatterns("/czOrder/orderRefundNotify")
+ .excludePathPatterns("/cmsContent/*")
+ .excludePathPatterns("/highBrand/*")
+ .excludePathPatterns("/highGoodsType/*")
+ .excludePathPatterns("/sendSms/*")
+ .excludePathPatterns("/test/*")
+ .excludePathPatterns("/sms/*")
+ ;
+ }
+
+ public String getIpAddress(HttpServletRequest request) {
+ // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址
+ String ip = request.getHeader("X-Forwarded-For");
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("WL-Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_CLIENT_IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getRemoteAddr();
+ }
+ } else if (ip.length() > 15) {
+ String[] ips = ip.split(",");
+ for (int index = 0; index < ips.length; index++) {
+ String strIp = ips[index];
+ if (!("unknown".equalsIgnoreCase(strIp))) {
+ ip = strIp;
+ break;
+ }
+ }
+ }
+ return ip;
+ }
+
+}
diff --git a/cweb/src/main/java/com/cweb/config/ConfigListener.java b/cweb/src/main/java/com/cweb/config/ConfigListener.java
new file mode 100644
index 0000000..cb92b19
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/config/ConfigListener.java
@@ -0,0 +1,25 @@
+package com.cweb.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+@WebListener
+public class ConfigListener implements ServletContextListener {
+
+ @Resource
+ private SysConfig sysConfig;
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+ SysConst.setSysConfig(sysConfig);
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+ }
+
+}
diff --git a/cweb/src/main/java/com/cweb/config/CorsConfig.java b/cweb/src/main/java/com/cweb/config/CorsConfig.java
new file mode 100644
index 0000000..14e87c0
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/config/CorsConfig.java
@@ -0,0 +1,49 @@
+package com.cweb.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName CorsConfig
+ * @Description: TODO ()
+ * @Author 胡锐
+ * @Date 2020/12/16
+ **/
+@Configuration
+public class CorsConfig extends WebMvcConfigurerAdapter {
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**")
+ .allowedOrigins("*")
+ .allowCredentials(true)
+ .allowedMethods("GET", "POST", "DELETE", "PUT")
+ .maxAge(3600);
+ }
+ private CorsConfiguration buildConfig() {
+ CorsConfiguration corsConfiguration = new CorsConfiguration();
+ List list = new ArrayList<>();
+ list.add("*");
+ corsConfiguration.setAllowedOrigins(list);
+ /*
+ // 请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等)
+ */
+ corsConfiguration.addAllowedOrigin("*");
+ corsConfiguration.addAllowedHeader("*");
+ corsConfiguration.addAllowedMethod("*");
+ return corsConfiguration;
+ }
+ @Bean
+ public CorsFilter corsFilter() {
+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+ source.registerCorsConfiguration("/**", buildConfig());
+ return new CorsFilter(source);
+ }
+}
diff --git a/cweb/src/main/java/com/cweb/config/MultipartConfig.java b/cweb/src/main/java/com/cweb/config/MultipartConfig.java
new file mode 100644
index 0000000..97794e9
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/config/MultipartConfig.java
@@ -0,0 +1,26 @@
+package com.cweb.config;
+
+import org.springframework.boot.web.servlet.MultipartConfigFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.servlet.MultipartConfigElement;
+
+@Configuration
+public class MultipartConfig {
+
+ /**
+ * 文件上传配置
+ * @return
+ */
+ @Bean
+ public MultipartConfigElement multipartConfigElement() {
+ MultipartConfigFactory factory = new MultipartConfigFactory();
+ //文件最大
+ factory.setMaxFileSize("300MB"); //KB,MB
+ //设置总上传数据总大小
+ factory.setMaxRequestSize("350MB");
+ return factory.createMultipartConfig();
+ }
+
+}
diff --git a/cweb/src/main/java/com/cweb/config/RedisConfig.java b/cweb/src/main/java/com/cweb/config/RedisConfig.java
new file mode 100644
index 0000000..c6db7fc
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/config/RedisConfig.java
@@ -0,0 +1,110 @@
+package com.cweb.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.*;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+
+@Configuration
+@EnableCaching //开启注解
+public class RedisConfig extends CachingConfigurerSupport {
+
+ /**
+ * retemplate相关配置
+ * @param factory
+ * @return
+ */
+ @Bean
+ public RedisTemplate redisTemplate(RedisConnectionFactory factory) {
+
+ RedisTemplate template = new RedisTemplate<>();
+ // 配置连接工厂
+ template.setConnectionFactory(factory);
+
+ //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
+ Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
+
+ ObjectMapper om = new ObjectMapper();
+ // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
+ om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+ // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
+ om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+ jacksonSeial.setObjectMapper(om);
+
+ // 值采用json序列化
+ template.setValueSerializer(jacksonSeial);
+ //使用StringRedisSerializer来序列化和反序列化redis的key值
+ template.setKeySerializer(new StringRedisSerializer());
+
+ // 设置hash key 和value序列化模式
+ template.setHashKeySerializer(new StringRedisSerializer());
+ template.setHashValueSerializer(jacksonSeial);
+ template.afterPropertiesSet();
+
+ return template;
+ }
+
+ /**
+ * 对hash类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public HashOperations hashOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForHash();
+ }
+
+ /**
+ * 对redis字符串类型数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ValueOperations valueOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForValue();
+ }
+
+ /**
+ * 对链表类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ListOperations listOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForList();
+ }
+
+ /**
+ * 对无序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public SetOperations setOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForSet();
+ }
+
+ /**
+ * 对有序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ZSetOperations zSetOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForZSet();
+ }
+
+}
\ No newline at end of file
diff --git a/cweb/src/main/java/com/cweb/config/SwaggerConfig.java b/cweb/src/main/java/com/cweb/config/SwaggerConfig.java
new file mode 100644
index 0000000..95ebf13
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/config/SwaggerConfig.java
@@ -0,0 +1,47 @@
+package com.cweb.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+/**
+* SwaggerConfig.java
+* 项目名称:
+* 包:
+* 类名称: SwaggerConfig.java
+* 类描述: 构建restful api接口文档
+* 创建人:
+* 创建时间: 2017 下午4:23:45
+*/
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig
+{
+
+ /**
+ * 描述api的基本信息
+ * 基本信息会展现在文档页面中
+ * @return [api的基本信息]
+ */
+ ApiInfo apiInfo()
+ {
+ return new ApiInfoBuilder().title("hgj-CWeb").description("提供给用户端的接口").termsOfServiceUrl("").version("1.0.0")
+ .contact(new Contact("", "", "")).build();
+ }
+
+ @Bean
+ public Docket customImplementation()
+ {
+ return new Docket(DocumentationType.SWAGGER_2).select()
+ .apis(RequestHandlerSelectors.basePackage("com"))
+ .build().directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
+ .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class).apiInfo(apiInfo());
+ }
+
+}
diff --git a/cweb/src/main/java/com/cweb/config/SysConfig.java b/cweb/src/main/java/com/cweb/config/SysConfig.java
new file mode 100644
index 0000000..3be648e
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/config/SysConfig.java
@@ -0,0 +1,31 @@
+package com.cweb.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
+
+@Component("sysConfig")
+@ConfigurationProperties
+@PropertySource("classpath:/config.properties")
+public class SysConfig {
+
+ private String fileUrl;
+
+ private String cmsPath;
+
+ public String getFileUrl() {
+ return fileUrl;
+ }
+
+ public void setFileUrl(String fileUrl) {
+ this.fileUrl = fileUrl;
+ }
+
+ public String getCmsPath() {
+ return cmsPath;
+ }
+
+ public void setCmsPath(String cmsPath) {
+ this.cmsPath = cmsPath;
+ }
+}
diff --git a/cweb/src/main/java/com/cweb/config/SysConst.java b/cweb/src/main/java/com/cweb/config/SysConst.java
new file mode 100644
index 0000000..23c919a
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/config/SysConst.java
@@ -0,0 +1,19 @@
+package com.cweb.config;
+
+public class SysConst {
+
+ private static SysConfig sysConfig;
+
+ public static void setSysConfig(SysConfig arg){
+ sysConfig = arg;
+ }
+
+ public static SysConfig getSysConfig(){
+ if (null == sysConfig) {
+ //防止空指针异常
+ sysConfig = new SysConfig();
+ return sysConfig;
+ }
+ return sysConfig;
+ }
+}
diff --git a/cweb/src/main/java/com/cweb/config/WxMaConfiguration.java b/cweb/src/main/java/com/cweb/config/WxMaConfiguration.java
new file mode 100644
index 0000000..b877321
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/config/WxMaConfiguration.java
@@ -0,0 +1,33 @@
+package com.cweb.config;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
+import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.PostConstruct;
+
+@Configuration
+public class WxMaConfiguration {
+
+ private static WxMaService maService;
+
+ public static WxMaService getMaService() {
+ if (maService == null) {
+ throw new IllegalArgumentException(String.format("未找到对应的配置,请核实!"));
+ }
+
+ return maService;
+ }
+
+ @PostConstruct
+ public void init() {
+ /*WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
+ config.setAppid(SysConst.getSysConfig().getWxAppId());
+ config.setSecret(SysConst.getSysConfig().getWxAppSecret());
+
+ maService = new WxMaServiceImpl();
+ maService.setWxMaConfig(config);*/
+ }
+
+}
diff --git a/cweb/src/main/java/com/cweb/controller/CommonController.java b/cweb/src/main/java/com/cweb/controller/CommonController.java
new file mode 100644
index 0000000..ecbfa8b
--- /dev/null
+++ b/cweb/src/main/java/com/cweb/controller/CommonController.java
@@ -0,0 +1,16 @@
+package com.cweb.controller;
+
+import io.swagger.annotations.Api;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController
+@RequestMapping(value="/common")
+@Api(value="共用接口")
+public class CommonController {
+
+ Logger log = LoggerFactory.getLogger(CommonController.class);
+
+}
diff --git a/cweb/src/main/resources/dev/application.yml b/cweb/src/main/resources/dev/application.yml
new file mode 100644
index 0000000..915cda2
--- /dev/null
+++ b/cweb/src/main/resources/dev/application.yml
@@ -0,0 +1,89 @@
+server:
+ port: 9501
+ servlet:
+ context-path: /crest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/puhui_go?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+ redis:
+ database: 1
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
+
+rocketmq:
+ name-server: 139.9.154.68:9876
+ producer:
+ access-key: huifukeji
+ secret-key: HF123456.
+ #必须指定group
+ group: default-group
+ consumer:
+ access-key: huifukeji
+ secret-key: HF123456.
+
+jetcache:
+ statIntervalMinutes: 15
+ areaInCacheName: false
+ local:
+ default:
+ type: linkedhashmap
+ keyConvertor: fastjson
+ remote:
+ default:
+ type: redis
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ keyConvertor: fastjson
+ broadcastChannel: projectA
+ valueEncoder: java
+ valueDecoder: java
+ poolConfig:
+ minIdle: 5
+ maxIdle: 20
+ maxTotal: 50
diff --git a/cweb/src/main/resources/dev/config.properties b/cweb/src/main/resources/dev/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/cweb/src/main/resources/dev/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/cweb/src/main/resources/dev/logback.xml b/cweb/src/main/resources/dev/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/cweb/src/main/resources/dev/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cweb/src/main/resources/pre/application.yml b/cweb/src/main/resources/pre/application.yml
new file mode 100644
index 0000000..874093a
--- /dev/null
+++ b/cweb/src/main/resources/pre/application.yml
@@ -0,0 +1,56 @@
+server:
+ port: 9301
+ servlet:
+ context-path: /crest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+ redis:
+ database: 1
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/cweb/src/main/resources/pre/config.properties b/cweb/src/main/resources/pre/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/cweb/src/main/resources/pre/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/cweb/src/main/resources/pre/logback.xml b/cweb/src/main/resources/pre/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/cweb/src/main/resources/pre/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cweb/src/main/resources/prod/application.yml b/cweb/src/main/resources/prod/application.yml
new file mode 100644
index 0000000..f3e38c7
--- /dev/null
+++ b/cweb/src/main/resources/prod/application.yml
@@ -0,0 +1,57 @@
+server:
+ port: 9301
+ servlet:
+ context-path: /crest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://127.0.0.1:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+
+ redis:
+ database: 0
+ host: 127.0.0.1
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/cweb/src/main/resources/prod/config.properties b/cweb/src/main/resources/prod/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/cweb/src/main/resources/prod/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/cweb/src/main/resources/prod/logback.xml b/cweb/src/main/resources/prod/logback.xml
new file mode 100644
index 0000000..e509de0
--- /dev/null
+++ b/cweb/src/main/resources/prod/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/openapi/pom.xml b/openapi/pom.xml
new file mode 100644
index 0000000..4dd5f11
--- /dev/null
+++ b/openapi/pom.xml
@@ -0,0 +1,45 @@
+
+
+
+ com.hfkj
+ puhui-go-parent
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ com.hfkj
+ openapi
+
+
+
+ com.hfkj
+ service
+ PACKT-SNAPSHOT
+
+
+
+
+
+
+ src/main/resources/${env}
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/openapi/src/main/java/com/OpenAPiApplication.java b/openapi/src/main/java/com/OpenAPiApplication.java
new file mode 100644
index 0000000..a2a4b2a
--- /dev/null
+++ b/openapi/src/main/java/com/OpenAPiApplication.java
@@ -0,0 +1,30 @@
+package com;
+
+import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
+import com.alicp.jetcache.anno.config.EnableMethodCache;
+import com.hfkj.common.utils.SpringContextUtil;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+// @ComponentScan
+@EnableTransactionManagement
+@EnableScheduling
+@EnableMethodCache(basePackages = "com.hfkj")
+@EnableCreateCacheAnnotation
+@ServletComponentScan
+@MapperScan("com.hfkj.dao")
+public class OpenAPiApplication
+{
+ public static void main( String[] args )
+ {
+ ApplicationContext app = SpringApplication.run(OpenAPiApplication.class, args);
+ SpringContextUtil.setApplicationContext(app);
+ }
+
+}
diff --git a/openapi/src/main/java/com/openapi/config/AuthConfig.java b/openapi/src/main/java/com/openapi/config/AuthConfig.java
new file mode 100644
index 0000000..50b0ac2
--- /dev/null
+++ b/openapi/src/main/java/com/openapi/config/AuthConfig.java
@@ -0,0 +1,170 @@
+package com.openapi.config;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.hfkj.common.security.UserCenter;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+@Configuration
+public class AuthConfig implements WebMvcConfigurer {
+
+ private static Logger log = LoggerFactory.getLogger(AuthConfig.class);
+
+ @Resource
+ private UserCenter userCenter;
+
+ /**
+ * 获取配置文件debug变量
+ */
+ @Value("${debug}")
+ private boolean debug = false;
+
+ /**
+ * 解决18位long类型数据转json失去精度问题
+ * @param converters
+ */
+ @Override
+ public void configureMessageConverters(List> converters){
+ MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
+
+ ObjectMapper objectMapper = jsonConverter.getObjectMapper();
+ SimpleModule simpleModule = new SimpleModule();
+ simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+ simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+ objectMapper.registerModule(simpleModule);
+
+ converters.add(jsonConverter);
+ }
+
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(new HandlerInterceptorAdapter() {
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
+ Object handler) throws Exception {
+ if(debug){
+ return true;
+ }
+ return true;
+ /*String token = request.getParameter("Authorization");
+ if (StringUtils.isBlank(token)) {
+ token = request.getHeader("Authorization");
+ }
+ if((StringUtils.isNotBlank(token) && userCenter.isTokenLogin(token)) || userCenter.isLogin(request)){//如果未登录,将无法使用任何接口
+ userCenter.refreshCookie(request, response);
+ return true;
+ } else if(request instanceof StandardMultipartHttpServletRequest) {
+ StandardMultipartHttpServletRequest re = (StandardMultipartHttpServletRequest)request;
+ if(userCenter.isLogin(re.getRequest())){
+ return true;
+ } else {
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }
+ } else{
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }*/
+ }
+ })
+ .addPathPatterns("/**")
+ .excludePathPatterns("/swagger-resources/**")
+ .excludePathPatterns("/**/api-docs")
+ .excludePathPatterns("/**/springfox-swagger-ui/**")
+ .excludePathPatterns("/**/swagger-ui.html")
+ .excludePathPatterns("/login/*")
+ .excludePathPatterns("/order/*")
+ .excludePathPatterns("/coupon/getCouponList")
+ .excludePathPatterns("/wechatpay/*")
+ .excludePathPatterns("/coupon/getCouponById")
+ .excludePathPatterns("/discount/getDiscountByQrCode")
+ .excludePathPatterns("/discount/getDiscountById")
+ .excludePathPatterns("/discount/getCouponByDiscount")
+ .excludePathPatterns("/discount/getDiscountByDiscountAgentId")
+ .excludePathPatterns("/highMerchantStore/getMerchantStoreById")
+ .excludePathPatterns("/highMerchantStore/getStoreListByCoupon")
+ .excludePathPatterns("/highMerchantStore/getStoreList")
+ .excludePathPatterns("/highMerchantStore/getMerchantList")
+ .excludePathPatterns("/highMerchantStore/getStoreListByMerchant")
+ .excludePathPatterns("/sms/sendSmsCode")
+ .excludePathPatterns("/sms/getSmsCode")
+ .excludePathPatterns("/activity/getWinLotteryList")
+ .excludePathPatterns("/user/login")
+ .excludePathPatterns("/user/unionPhoneLogin")
+ .excludePathPatterns("/user/getUnionId")
+ .excludePathPatterns("/highUser/setCacheParam")
+ .excludePathPatterns("/highUser/getCacheParam")
+ .excludePathPatterns("/highUser/delCacheParam")
+ .excludePathPatterns("/order/orderToH5Pay")
+ .excludePathPatterns("/order/orderToPay")
+ .excludePathPatterns("/test/*")
+ .excludePathPatterns("/cmsContent/*")
+ .excludePathPatterns("/highGas/*")
+ .excludePathPatterns("/outRechargeOrder/*")
+ .excludePathPatterns("/wechat/*")
+ .excludePathPatterns("/tuanyou/*")
+ .excludePathPatterns("/unionPay/*")
+ .excludePathPatterns("/highGas/*")
+ .excludePathPatterns("/common/*")
+ .excludePathPatterns("/order/qzOrderToPay")
+ .excludePathPatterns("/czOrder/orderRefundNotify")
+ .excludePathPatterns("/cmsContent/*")
+ .excludePathPatterns("/highBrand/*")
+ .excludePathPatterns("/highGoodsType/*")
+ .excludePathPatterns("/sendSms/*")
+ .excludePathPatterns("/test/*")
+ .excludePathPatterns("/sms/*")
+ ;
+ }
+
+ public String getIpAddress(HttpServletRequest request) {
+ // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址
+ String ip = request.getHeader("X-Forwarded-For");
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("WL-Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_CLIENT_IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getRemoteAddr();
+ }
+ } else if (ip.length() > 15) {
+ String[] ips = ip.split(",");
+ for (int index = 0; index < ips.length; index++) {
+ String strIp = ips[index];
+ if (!("unknown".equalsIgnoreCase(strIp))) {
+ ip = strIp;
+ break;
+ }
+ }
+ }
+ return ip;
+ }
+
+}
diff --git a/openapi/src/main/java/com/openapi/config/ConfigListener.java b/openapi/src/main/java/com/openapi/config/ConfigListener.java
new file mode 100644
index 0000000..5352371
--- /dev/null
+++ b/openapi/src/main/java/com/openapi/config/ConfigListener.java
@@ -0,0 +1,23 @@
+package com.openapi.config;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+@WebListener
+public class ConfigListener implements ServletContextListener {
+
+ @Resource
+ private SysConfig sysConfig;
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+ SysConst.setSysConfig(sysConfig);
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+ }
+
+}
diff --git a/openapi/src/main/java/com/openapi/config/CorsConfig.java b/openapi/src/main/java/com/openapi/config/CorsConfig.java
new file mode 100644
index 0000000..dd7cee3
--- /dev/null
+++ b/openapi/src/main/java/com/openapi/config/CorsConfig.java
@@ -0,0 +1,49 @@
+package com.openapi.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName CorsConfig
+ * @Description: TODO ()
+ * @Author 胡锐
+ * @Date 2020/12/16
+ **/
+@Configuration
+public class CorsConfig extends WebMvcConfigurerAdapter {
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**")
+ .allowedOrigins("*")
+ .allowCredentials(true)
+ .allowedMethods("GET", "POST", "DELETE", "PUT")
+ .maxAge(3600);
+ }
+ private CorsConfiguration buildConfig() {
+ CorsConfiguration corsConfiguration = new CorsConfiguration();
+ List list = new ArrayList<>();
+ list.add("*");
+ corsConfiguration.setAllowedOrigins(list);
+ /*
+ // 请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等)
+ */
+ corsConfiguration.addAllowedOrigin("*");
+ corsConfiguration.addAllowedHeader("*");
+ corsConfiguration.addAllowedMethod("*");
+ return corsConfiguration;
+ }
+ @Bean
+ public CorsFilter corsFilter() {
+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+ source.registerCorsConfiguration("/**", buildConfig());
+ return new CorsFilter(source);
+ }
+}
diff --git a/openapi/src/main/java/com/openapi/config/MultipartConfig.java b/openapi/src/main/java/com/openapi/config/MultipartConfig.java
new file mode 100644
index 0000000..f39edf8
--- /dev/null
+++ b/openapi/src/main/java/com/openapi/config/MultipartConfig.java
@@ -0,0 +1,26 @@
+package com.openapi.config;
+
+import org.springframework.boot.web.servlet.MultipartConfigFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.servlet.MultipartConfigElement;
+
+@Configuration
+public class MultipartConfig {
+
+ /**
+ * 文件上传配置
+ * @return
+ */
+ @Bean
+ public MultipartConfigElement multipartConfigElement() {
+ MultipartConfigFactory factory = new MultipartConfigFactory();
+ //文件最大
+ factory.setMaxFileSize("300MB"); //KB,MB
+ //设置总上传数据总大小
+ factory.setMaxRequestSize("350MB");
+ return factory.createMultipartConfig();
+ }
+
+}
diff --git a/openapi/src/main/java/com/openapi/config/RedisConfig.java b/openapi/src/main/java/com/openapi/config/RedisConfig.java
new file mode 100644
index 0000000..999b0ed
--- /dev/null
+++ b/openapi/src/main/java/com/openapi/config/RedisConfig.java
@@ -0,0 +1,110 @@
+package com.openapi.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.*;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+
+@Configuration
+@EnableCaching //开启注解
+public class RedisConfig extends CachingConfigurerSupport {
+
+ /**
+ * retemplate相关配置
+ * @param factory
+ * @return
+ */
+ @Bean
+ public RedisTemplate redisTemplate(RedisConnectionFactory factory) {
+
+ RedisTemplate template = new RedisTemplate<>();
+ // 配置连接工厂
+ template.setConnectionFactory(factory);
+
+ //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
+ Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
+
+ ObjectMapper om = new ObjectMapper();
+ // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
+ om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+ // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
+ om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+ jacksonSeial.setObjectMapper(om);
+
+ // 值采用json序列化
+ template.setValueSerializer(jacksonSeial);
+ //使用StringRedisSerializer来序列化和反序列化redis的key值
+ template.setKeySerializer(new StringRedisSerializer());
+
+ // 设置hash key 和value序列化模式
+ template.setHashKeySerializer(new StringRedisSerializer());
+ template.setHashValueSerializer(jacksonSeial);
+ template.afterPropertiesSet();
+
+ return template;
+ }
+
+ /**
+ * 对hash类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public HashOperations hashOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForHash();
+ }
+
+ /**
+ * 对redis字符串类型数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ValueOperations valueOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForValue();
+ }
+
+ /**
+ * 对链表类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ListOperations listOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForList();
+ }
+
+ /**
+ * 对无序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public SetOperations setOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForSet();
+ }
+
+ /**
+ * 对有序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ZSetOperations zSetOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForZSet();
+ }
+
+}
diff --git a/openapi/src/main/java/com/openapi/config/SwaggerConfig.java b/openapi/src/main/java/com/openapi/config/SwaggerConfig.java
new file mode 100644
index 0000000..e05c353
--- /dev/null
+++ b/openapi/src/main/java/com/openapi/config/SwaggerConfig.java
@@ -0,0 +1,47 @@
+package com.openapi.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+/**
+* SwaggerConfig.java
+* 项目名称:
+* 包:
+* 类名称: SwaggerConfig.java
+* 类描述: 构建restful api接口文档
+* 创建人:
+* 创建时间: 2017 下午4:23:45
+*/
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig
+{
+
+ /**
+ * 描述api的基本信息
+ * 基本信息会展现在文档页面中
+ * @return [api的基本信息]
+ */
+ ApiInfo apiInfo()
+ {
+ return new ApiInfoBuilder().title("hgj-CWeb").description("提供给用户端的接口").termsOfServiceUrl("").version("1.0.0")
+ .contact(new Contact("", "", "")).build();
+ }
+
+ @Bean
+ public Docket customImplementation()
+ {
+ return new Docket(DocumentationType.SWAGGER_2).select()
+ .apis(RequestHandlerSelectors.basePackage("com"))
+ .build().directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
+ .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class).apiInfo(apiInfo());
+ }
+
+}
diff --git a/openapi/src/main/java/com/openapi/config/SysConfig.java b/openapi/src/main/java/com/openapi/config/SysConfig.java
new file mode 100644
index 0000000..bcddd3b
--- /dev/null
+++ b/openapi/src/main/java/com/openapi/config/SysConfig.java
@@ -0,0 +1,31 @@
+package com.openapi.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
+
+@Component("sysConfig")
+@ConfigurationProperties
+@PropertySource("classpath:/config.properties")
+public class SysConfig {
+
+ private String fileUrl;
+
+ private String cmsPath;
+
+ public String getFileUrl() {
+ return fileUrl;
+ }
+
+ public void setFileUrl(String fileUrl) {
+ this.fileUrl = fileUrl;
+ }
+
+ public String getCmsPath() {
+ return cmsPath;
+ }
+
+ public void setCmsPath(String cmsPath) {
+ this.cmsPath = cmsPath;
+ }
+}
diff --git a/openapi/src/main/java/com/openapi/config/SysConst.java b/openapi/src/main/java/com/openapi/config/SysConst.java
new file mode 100644
index 0000000..343acc6
--- /dev/null
+++ b/openapi/src/main/java/com/openapi/config/SysConst.java
@@ -0,0 +1,19 @@
+package com.openapi.config;
+
+public class SysConst {
+
+ private static SysConfig sysConfig;
+
+ public static void setSysConfig(SysConfig arg){
+ sysConfig = arg;
+ }
+
+ public static SysConfig getSysConfig(){
+ if (null == sysConfig) {
+ //防止空指针异常
+ sysConfig = new SysConfig();
+ return sysConfig;
+ }
+ return sysConfig;
+ }
+}
diff --git a/openapi/src/main/resources/dev/application.yml b/openapi/src/main/resources/dev/application.yml
new file mode 100644
index 0000000..6180e80
--- /dev/null
+++ b/openapi/src/main/resources/dev/application.yml
@@ -0,0 +1,89 @@
+server:
+ port: 9505
+ servlet:
+ context-path: /openapi
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/puhui_go?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+ redis:
+ database: 1
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
+
+rocketmq:
+ name-server: 139.9.154.68:9876
+ producer:
+ access-key: huifukeji
+ secret-key: HF123456.
+ #必须指定group
+ group: default-group
+ consumer:
+ access-key: huifukeji
+ secret-key: HF123456.
+
+jetcache:
+ statIntervalMinutes: 15
+ areaInCacheName: false
+ local:
+ default:
+ type: linkedhashmap
+ keyConvertor: fastjson
+ remote:
+ default:
+ type: redis
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ keyConvertor: fastjson
+ broadcastChannel: projectA
+ valueEncoder: java
+ valueDecoder: java
+ poolConfig:
+ minIdle: 5
+ maxIdle: 20
+ maxTotal: 50
diff --git a/openapi/src/main/resources/dev/config.properties b/openapi/src/main/resources/dev/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/openapi/src/main/resources/dev/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/openapi/src/main/resources/dev/logback.xml b/openapi/src/main/resources/dev/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/openapi/src/main/resources/dev/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/openapi/src/main/resources/pre/application.yml b/openapi/src/main/resources/pre/application.yml
new file mode 100644
index 0000000..874093a
--- /dev/null
+++ b/openapi/src/main/resources/pre/application.yml
@@ -0,0 +1,56 @@
+server:
+ port: 9301
+ servlet:
+ context-path: /crest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+ redis:
+ database: 1
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/openapi/src/main/resources/pre/config.properties b/openapi/src/main/resources/pre/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/openapi/src/main/resources/pre/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/openapi/src/main/resources/pre/logback.xml b/openapi/src/main/resources/pre/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/openapi/src/main/resources/pre/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/openapi/src/main/resources/prod/application.yml b/openapi/src/main/resources/prod/application.yml
new file mode 100644
index 0000000..f3e38c7
--- /dev/null
+++ b/openapi/src/main/resources/prod/application.yml
@@ -0,0 +1,57 @@
+server:
+ port: 9301
+ servlet:
+ context-path: /crest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://127.0.0.1:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+
+ redis:
+ database: 0
+ host: 127.0.0.1
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/openapi/src/main/resources/prod/config.properties b/openapi/src/main/resources/prod/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/openapi/src/main/resources/prod/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/openapi/src/main/resources/prod/logback.xml b/openapi/src/main/resources/prod/logback.xml
new file mode 100644
index 0000000..e509de0
--- /dev/null
+++ b/openapi/src/main/resources/prod/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/order/pom.xml b/order/pom.xml
new file mode 100644
index 0000000..dac2cc8
--- /dev/null
+++ b/order/pom.xml
@@ -0,0 +1,45 @@
+
+
+
+ com.hfkj
+ puhui-go-parent
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ com.hfkj
+ order
+
+
+
+ com.hfkj
+ service
+ PACKT-SNAPSHOT
+
+
+
+
+
+
+ src/main/resources/${env}
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/order/src/main/java/com/OrderApplication.java b/order/src/main/java/com/OrderApplication.java
new file mode 100644
index 0000000..693268a
--- /dev/null
+++ b/order/src/main/java/com/OrderApplication.java
@@ -0,0 +1,29 @@
+package com;
+
+import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
+import com.alicp.jetcache.anno.config.EnableMethodCache;
+import com.hfkj.common.utils.SpringContextUtil;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+// @ComponentScan
+@EnableTransactionManagement
+@EnableScheduling
+@EnableMethodCache(basePackages = "com.hfkj")
+@EnableCreateCacheAnnotation
+@ServletComponentScan
+@MapperScan("com.hfkj.dao")
+public class OrderApplication {
+ public static void main( String[] args )
+ {
+ ApplicationContext app = SpringApplication.run(OrderApplication.class, args);
+ SpringContextUtil.setApplicationContext(app);
+ }
+
+}
diff --git a/order/src/main/java/com/order/config/AuthConfig.java b/order/src/main/java/com/order/config/AuthConfig.java
new file mode 100644
index 0000000..97b9c9a
--- /dev/null
+++ b/order/src/main/java/com/order/config/AuthConfig.java
@@ -0,0 +1,169 @@
+package com.order.config;
+
+import com.hfkj.common.security.UserCenter;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+@Configuration
+public class AuthConfig implements WebMvcConfigurer {
+
+ private static Logger log = LoggerFactory.getLogger(AuthConfig.class);
+
+ @Resource
+ private UserCenter userCenter;
+
+ /**
+ * 获取配置文件debug变量
+ */
+ @Value("${debug}")
+ private boolean debug = false;
+
+ /**
+ * 解决18位long类型数据转json失去精度问题
+ * @param converters
+ */
+ @Override
+ public void configureMessageConverters(List> converters){
+ MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
+
+ ObjectMapper objectMapper = jsonConverter.getObjectMapper();
+ SimpleModule simpleModule = new SimpleModule();
+ simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+ simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+ objectMapper.registerModule(simpleModule);
+
+ converters.add(jsonConverter);
+ }
+
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(new HandlerInterceptorAdapter() {
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
+ Object handler) throws Exception {
+ if(debug){
+ return true;
+ }
+ String token = request.getParameter("Authorization");
+ if (StringUtils.isBlank(token)) {
+ token = request.getHeader("Authorization");
+ }
+ if((StringUtils.isNotBlank(token) && userCenter.isTokenLogin(token)) || userCenter.isLogin(request)){//如果未登录,将无法使用任何接口
+ userCenter.refreshCookie(request, response);
+ return true;
+ } else if(request instanceof StandardMultipartHttpServletRequest) {
+ StandardMultipartHttpServletRequest re = (StandardMultipartHttpServletRequest)request;
+ if(userCenter.isLogin(re.getRequest())){
+ return true;
+ } else {
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }
+ } else{
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }
+ }
+ })
+ .addPathPatterns("/**")
+ .excludePathPatterns("/swagger-resources/**")
+ .excludePathPatterns("/**/api-docs")
+ .excludePathPatterns("/**/springfox-swagger-ui/**")
+ .excludePathPatterns("/**/swagger-ui.html")
+ .excludePathPatterns("/login/*")
+ .excludePathPatterns("/order/*")
+ .excludePathPatterns("/coupon/getCouponList")
+ .excludePathPatterns("/wechatpay/*")
+ .excludePathPatterns("/coupon/getCouponById")
+ .excludePathPatterns("/discount/getDiscountByQrCode")
+ .excludePathPatterns("/discount/getDiscountById")
+ .excludePathPatterns("/discount/getCouponByDiscount")
+ .excludePathPatterns("/discount/getDiscountByDiscountAgentId")
+ .excludePathPatterns("/highMerchantStore/getMerchantStoreById")
+ .excludePathPatterns("/highMerchantStore/getStoreListByCoupon")
+ .excludePathPatterns("/highMerchantStore/getStoreList")
+ .excludePathPatterns("/highMerchantStore/getMerchantList")
+ .excludePathPatterns("/highMerchantStore/getStoreListByMerchant")
+ .excludePathPatterns("/sms/sendSmsCode")
+ .excludePathPatterns("/sms/getSmsCode")
+ .excludePathPatterns("/activity/getWinLotteryList")
+ .excludePathPatterns("/user/login")
+ .excludePathPatterns("/user/unionPhoneLogin")
+ .excludePathPatterns("/user/getUnionId")
+ .excludePathPatterns("/highUser/setCacheParam")
+ .excludePathPatterns("/highUser/getCacheParam")
+ .excludePathPatterns("/highUser/delCacheParam")
+ .excludePathPatterns("/order/orderToH5Pay")
+ .excludePathPatterns("/order/orderToPay")
+ .excludePathPatterns("/test/*")
+ .excludePathPatterns("/cmsContent/*")
+ .excludePathPatterns("/highGas/*")
+ .excludePathPatterns("/outRechargeOrder/*")
+ .excludePathPatterns("/wechat/*")
+ .excludePathPatterns("/tuanyou/*")
+ .excludePathPatterns("/unionPay/*")
+ .excludePathPatterns("/highGas/*")
+ .excludePathPatterns("/common/*")
+ .excludePathPatterns("/order/qzOrderToPay")
+ .excludePathPatterns("/czOrder/orderRefundNotify")
+ .excludePathPatterns("/cmsContent/*")
+ .excludePathPatterns("/highBrand/*")
+ .excludePathPatterns("/highGoodsType/*")
+ .excludePathPatterns("/sendSms/*")
+ .excludePathPatterns("/test/*")
+ .excludePathPatterns("/sms/*")
+ ;
+ }
+
+ public String getIpAddress(HttpServletRequest request) {
+ // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址
+ String ip = request.getHeader("X-Forwarded-For");
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("WL-Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_CLIENT_IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getRemoteAddr();
+ }
+ } else if (ip.length() > 15) {
+ String[] ips = ip.split(",");
+ for (int index = 0; index < ips.length; index++) {
+ String strIp = ips[index];
+ if (!("unknown".equalsIgnoreCase(strIp))) {
+ ip = strIp;
+ break;
+ }
+ }
+ }
+ return ip;
+ }
+
+}
diff --git a/order/src/main/java/com/order/config/ConfigListener.java b/order/src/main/java/com/order/config/ConfigListener.java
new file mode 100644
index 0000000..9ce8eef
--- /dev/null
+++ b/order/src/main/java/com/order/config/ConfigListener.java
@@ -0,0 +1,23 @@
+package com.order.config;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+@WebListener
+public class ConfigListener implements ServletContextListener {
+
+ @Resource
+ private SysConfig sysConfig;
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+ SysConst.setSysConfig(sysConfig);
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+ }
+
+}
diff --git a/order/src/main/java/com/order/config/CorsConfig.java b/order/src/main/java/com/order/config/CorsConfig.java
new file mode 100644
index 0000000..997dbd0
--- /dev/null
+++ b/order/src/main/java/com/order/config/CorsConfig.java
@@ -0,0 +1,49 @@
+package com.order.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName CorsConfig
+ * @Description: TODO ()
+ * @Author 胡锐
+ * @Date 2020/12/16
+ **/
+@Configuration
+public class CorsConfig extends WebMvcConfigurerAdapter {
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**")
+ .allowedOrigins("*")
+ .allowCredentials(true)
+ .allowedMethods("GET", "POST", "DELETE", "PUT")
+ .maxAge(3600);
+ }
+ private CorsConfiguration buildConfig() {
+ CorsConfiguration corsConfiguration = new CorsConfiguration();
+ List list = new ArrayList<>();
+ list.add("*");
+ corsConfiguration.setAllowedOrigins(list);
+ /*
+ // 请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等)
+ */
+ corsConfiguration.addAllowedOrigin("*");
+ corsConfiguration.addAllowedHeader("*");
+ corsConfiguration.addAllowedMethod("*");
+ return corsConfiguration;
+ }
+ @Bean
+ public CorsFilter corsFilter() {
+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+ source.registerCorsConfiguration("/**", buildConfig());
+ return new CorsFilter(source);
+ }
+}
diff --git a/order/src/main/java/com/order/config/MultipartConfig.java b/order/src/main/java/com/order/config/MultipartConfig.java
new file mode 100644
index 0000000..3649115
--- /dev/null
+++ b/order/src/main/java/com/order/config/MultipartConfig.java
@@ -0,0 +1,26 @@
+package com.order.config;
+
+import org.springframework.boot.web.servlet.MultipartConfigFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.servlet.MultipartConfigElement;
+
+@Configuration
+public class MultipartConfig {
+
+ /**
+ * 文件上传配置
+ * @return
+ */
+ @Bean
+ public MultipartConfigElement multipartConfigElement() {
+ MultipartConfigFactory factory = new MultipartConfigFactory();
+ //文件最大
+ factory.setMaxFileSize("300MB"); //KB,MB
+ //设置总上传数据总大小
+ factory.setMaxRequestSize("350MB");
+ return factory.createMultipartConfig();
+ }
+
+}
diff --git a/order/src/main/java/com/order/config/RedisConfig.java b/order/src/main/java/com/order/config/RedisConfig.java
new file mode 100644
index 0000000..8f20900
--- /dev/null
+++ b/order/src/main/java/com/order/config/RedisConfig.java
@@ -0,0 +1,110 @@
+package com.order.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.*;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+
+@Configuration
+@EnableCaching //开启注解
+public class RedisConfig extends CachingConfigurerSupport {
+
+ /**
+ * retemplate相关配置
+ * @param factory
+ * @return
+ */
+ @Bean
+ public RedisTemplate redisTemplate(RedisConnectionFactory factory) {
+
+ RedisTemplate template = new RedisTemplate<>();
+ // 配置连接工厂
+ template.setConnectionFactory(factory);
+
+ //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
+ Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
+
+ ObjectMapper om = new ObjectMapper();
+ // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
+ om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+ // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
+ om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+ jacksonSeial.setObjectMapper(om);
+
+ // 值采用json序列化
+ template.setValueSerializer(jacksonSeial);
+ //使用StringRedisSerializer来序列化和反序列化redis的key值
+ template.setKeySerializer(new StringRedisSerializer());
+
+ // 设置hash key 和value序列化模式
+ template.setHashKeySerializer(new StringRedisSerializer());
+ template.setHashValueSerializer(jacksonSeial);
+ template.afterPropertiesSet();
+
+ return template;
+ }
+
+ /**
+ * 对hash类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public HashOperations hashOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForHash();
+ }
+
+ /**
+ * 对redis字符串类型数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ValueOperations valueOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForValue();
+ }
+
+ /**
+ * 对链表类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ListOperations listOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForList();
+ }
+
+ /**
+ * 对无序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public SetOperations setOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForSet();
+ }
+
+ /**
+ * 对有序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ZSetOperations zSetOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForZSet();
+ }
+
+}
diff --git a/order/src/main/java/com/order/config/SessionKeyCache.java b/order/src/main/java/com/order/config/SessionKeyCache.java
new file mode 100644
index 0000000..88b25c7
--- /dev/null
+++ b/order/src/main/java/com/order/config/SessionKeyCache.java
@@ -0,0 +1,53 @@
+package com.order.config;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class SessionKeyCache {
+
+ private static Map CACHE_DATA = new ConcurrentHashMap<>();
+
+ public static T getData(String key) {
+ CacheData data = CACHE_DATA.get(key);
+ if (data != null){
+ if(data.getExpire() <= 0 || data.getSaveTime() >= System.currentTimeMillis()) {
+ return data.getData();
+ }else{
+ clear(key);
+ }
+ }
+ return null;
+ }
+
+ public static void setData(String key, T data, int expire) {
+ CACHE_DATA.put(key, new CacheData(data, expire));
+ }
+
+ public static void clear(String key) {
+ CACHE_DATA.remove(key);
+ }
+
+ private static class CacheData {
+ CacheData(T t, int expire) {
+ this.data = t;
+ this.expire = expire <= 0 ? 0 : expire*1000;
+ this.saveTime = System.currentTimeMillis() + this.expire;
+ }
+
+ private T data;
+ private long saveTime; // 存活时间
+ private long expire; // 过期时间 小于等于0标识永久存活
+
+ public T getData() {
+ return data;
+ }
+
+ public long getExpire() {
+ return expire;
+ }
+
+ public long getSaveTime() {
+ return saveTime;
+ }
+ }
+}
diff --git a/order/src/main/java/com/order/config/SwaggerConfig.java b/order/src/main/java/com/order/config/SwaggerConfig.java
new file mode 100644
index 0000000..6ca5f23
--- /dev/null
+++ b/order/src/main/java/com/order/config/SwaggerConfig.java
@@ -0,0 +1,47 @@
+package com.order.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+/**
+* SwaggerConfig.java
+* 项目名称:
+* 包:
+* 类名称: SwaggerConfig.java
+* 类描述: 构建restful api接口文档
+* 创建人:
+* 创建时间: 2017 下午4:23:45
+*/
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig
+{
+
+ /**
+ * 描述api的基本信息
+ * 基本信息会展现在文档页面中
+ * @return [api的基本信息]
+ */
+ ApiInfo apiInfo()
+ {
+ return new ApiInfoBuilder().title("hgj-CWeb").description("提供给用户端的接口").termsOfServiceUrl("").version("1.0.0")
+ .contact(new Contact("", "", "")).build();
+ }
+
+ @Bean
+ public Docket customImplementation()
+ {
+ return new Docket(DocumentationType.SWAGGER_2).select()
+ .apis(RequestHandlerSelectors.basePackage("com"))
+ .build().directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
+ .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class).apiInfo(apiInfo());
+ }
+
+}
diff --git a/order/src/main/java/com/order/config/SysConfig.java b/order/src/main/java/com/order/config/SysConfig.java
new file mode 100644
index 0000000..e6b1824
--- /dev/null
+++ b/order/src/main/java/com/order/config/SysConfig.java
@@ -0,0 +1,31 @@
+package com.order.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
+
+@Component("sysConfig")
+@ConfigurationProperties
+@PropertySource("classpath:/config.properties")
+public class SysConfig {
+
+ private String fileUrl;
+
+ private String cmsPath;
+
+ public String getFileUrl() {
+ return fileUrl;
+ }
+
+ public void setFileUrl(String fileUrl) {
+ this.fileUrl = fileUrl;
+ }
+
+ public String getCmsPath() {
+ return cmsPath;
+ }
+
+ public void setCmsPath(String cmsPath) {
+ this.cmsPath = cmsPath;
+ }
+}
diff --git a/order/src/main/java/com/order/config/SysConst.java b/order/src/main/java/com/order/config/SysConst.java
new file mode 100644
index 0000000..07b20b4
--- /dev/null
+++ b/order/src/main/java/com/order/config/SysConst.java
@@ -0,0 +1,19 @@
+package com.order.config;
+
+public class SysConst {
+
+ private static SysConfig sysConfig;
+
+ public static void setSysConfig(SysConfig arg){
+ sysConfig = arg;
+ }
+
+ public static SysConfig getSysConfig(){
+ if (null == sysConfig) {
+ //防止空指针异常
+ sysConfig = new SysConfig();
+ return sysConfig;
+ }
+ return sysConfig;
+ }
+}
diff --git a/order/src/main/java/com/order/config/WxMaConfiguration.java b/order/src/main/java/com/order/config/WxMaConfiguration.java
new file mode 100644
index 0000000..20447be
--- /dev/null
+++ b/order/src/main/java/com/order/config/WxMaConfiguration.java
@@ -0,0 +1,31 @@
+package com.order.config;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.PostConstruct;
+
+@Configuration
+public class WxMaConfiguration {
+
+ private static WxMaService maService;
+
+ public static WxMaService getMaService() {
+ if (maService == null) {
+ throw new IllegalArgumentException(String.format("未找到对应的配置,请核实!"));
+ }
+
+ return maService;
+ }
+
+ @PostConstruct
+ public void init() {
+ /*WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
+ config.setAppid(SysConst.getSysConfig().getWxAppId());
+ config.setSecret(SysConst.getSysConfig().getWxAppSecret());
+
+ maService = new WxMaServiceImpl();
+ maService.setWxMaConfig(config);*/
+ }
+
+}
diff --git a/order/src/main/java/com/order/config/WxMsgConfig.java b/order/src/main/java/com/order/config/WxMsgConfig.java
new file mode 100644
index 0000000..f056903
--- /dev/null
+++ b/order/src/main/java/com/order/config/WxMsgConfig.java
@@ -0,0 +1,55 @@
+package com.order.config;
+
+import cn.binarywang.wx.miniapp.api.WxMaMsgService;
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
+import com.hfkj.common.utils.DateUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+
+public class WxMsgConfig {
+
+ private static Logger log = LoggerFactory.getLogger(WxMsgConfig.class);
+
+ public static void pushOneUser(String orderName , String price , String orderNo , Date payTime , String remark , Long orderId , String openId) {
+
+ try {
+ List list = new ArrayList<>();
+
+ Map m = new HashMap<>();
+
+ m.put("thing1", orderName);
+ m.put("amount2", price + "元");
+ m.put("character_string3", orderNo);
+ m.put("time4", DateUtil.date2String(payTime , "yyyy年MM月dd日 HH:mm:ss"));
+ m.put("thing6", remark);
+
+ for (String key: m.keySet()) {
+ WxMaSubscribeMessage.Data msgElement = new WxMaSubscribeMessage.Data();
+ msgElement.setName(key);
+ msgElement.setValue(m.get(key));
+ list.add(msgElement);
+ }
+
+ WxMaSubscribeMessage subscribeMessage = new WxMaSubscribeMessage();
+ subscribeMessage.setToUser(openId); // 小程序openId
+ subscribeMessage.setTemplateId("oUvaCPeeOg4wH6HTvCcSabU6FnzXUXOBXsqBYAPOV-U");
+ subscribeMessage.setData(list);
+ subscribeMessage.setPage("pages/user/order_details/order_details?id=" + orderId);
+ subscribeMessage.setMiniprogramState("developer");
+
+ final WxMaService wxService = WxMaConfiguration.getMaService();
+ WxMaMsgService maMsgService = wxService.getMsgService();
+ maMsgService.sendSubscribeMsg(subscribeMessage);
+ } catch (Exception e) {
+ log.error(String.valueOf(e));
+ }
+
+ }
+
+
+
+
+}
diff --git a/order/src/main/resources/dev/application.yml b/order/src/main/resources/dev/application.yml
new file mode 100644
index 0000000..85623af
--- /dev/null
+++ b/order/src/main/resources/dev/application.yml
@@ -0,0 +1,89 @@
+server:
+ port: 9503
+ servlet:
+ context-path: /order
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/puhui_go?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+ redis:
+ database: 1
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
+
+rocketmq:
+ name-server: 139.9.154.68:9876
+ producer:
+ access-key: huifukeji
+ secret-key: HF123456.
+ #必须指定group
+ group: default-group
+ consumer:
+ access-key: huifukeji
+ secret-key: HF123456.
+
+jetcache:
+ statIntervalMinutes: 15
+ areaInCacheName: false
+ local:
+ default:
+ type: linkedhashmap
+ keyConvertor: fastjson
+ remote:
+ default:
+ type: redis
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ keyConvertor: fastjson
+ broadcastChannel: projectA
+ valueEncoder: java
+ valueDecoder: java
+ poolConfig:
+ minIdle: 5
+ maxIdle: 20
+ maxTotal: 50
diff --git a/order/src/main/resources/dev/config.properties b/order/src/main/resources/dev/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/order/src/main/resources/dev/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/order/src/main/resources/dev/logback.xml b/order/src/main/resources/dev/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/order/src/main/resources/dev/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/order/src/main/resources/pre/application.yml b/order/src/main/resources/pre/application.yml
new file mode 100644
index 0000000..874093a
--- /dev/null
+++ b/order/src/main/resources/pre/application.yml
@@ -0,0 +1,56 @@
+server:
+ port: 9301
+ servlet:
+ context-path: /crest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+ redis:
+ database: 1
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/order/src/main/resources/pre/config.properties b/order/src/main/resources/pre/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/order/src/main/resources/pre/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/order/src/main/resources/pre/logback.xml b/order/src/main/resources/pre/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/order/src/main/resources/pre/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/order/src/main/resources/prod/application.yml b/order/src/main/resources/prod/application.yml
new file mode 100644
index 0000000..f3e38c7
--- /dev/null
+++ b/order/src/main/resources/prod/application.yml
@@ -0,0 +1,57 @@
+server:
+ port: 9301
+ servlet:
+ context-path: /crest
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://127.0.0.1:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+
+ redis:
+ database: 0
+ host: 127.0.0.1
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/order/src/main/resources/prod/config.properties b/order/src/main/resources/prod/config.properties
new file mode 100644
index 0000000..44ea8fc
--- /dev/null
+++ b/order/src/main/resources/prod/config.properties
@@ -0,0 +1,2 @@
+fileUrl=/home/project/hsg/filesystem
+cmsPath=/home/project/hsg/filesystem/cmsPath
diff --git a/order/src/main/resources/prod/logback.xml b/order/src/main/resources/prod/logback.xml
new file mode 100644
index 0000000..e509de0
--- /dev/null
+++ b/order/src/main/resources/prod/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..4f6d1ed
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,70 @@
+
+
+ 4.0.0
+
+ com.hfkj
+ puhui-go-parent
+ pom
+ 1.0-SNAPSHOT
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.0.5.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 2.6.1
+ 2.9.9
+
+
+
+
+ commons-net
+ commons-net
+ 3.6
+
+
+ net.coobird
+ thumbnailator
+ 0.4.8
+
+
+ junit
+ junit
+ 4.12
+
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ com.github.binarywang
+ weixin-java-mp
+ 3.8.0
+
+
+
+ compile
+
+
+
+ service
+ cweb
+ bweb
+ schedule
+ order
+ user
+ openapi
+
+
+
+
diff --git a/schedule/pom.xml b/schedule/pom.xml
new file mode 100644
index 0000000..4a5f85b
--- /dev/null
+++ b/schedule/pom.xml
@@ -0,0 +1,45 @@
+
+
+
+ com.hfkj
+ puhui-go-parent
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ com.hfkj
+ schedule
+
+
+
+ com.hfkj
+ service
+ PACKT-SNAPSHOT
+
+
+
+
+
+
+ src/main/resources/${env}
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/schedule/schedule.iml b/schedule/schedule.iml
new file mode 100644
index 0000000..e8ce722
--- /dev/null
+++ b/schedule/schedule.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/schedule/src/main/java/com/hfkj/ScheduleApplication.java b/schedule/src/main/java/com/hfkj/ScheduleApplication.java
new file mode 100644
index 0000000..a322fc5
--- /dev/null
+++ b/schedule/src/main/java/com/hfkj/ScheduleApplication.java
@@ -0,0 +1,30 @@
+package com.hfkj;
+
+import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
+import com.alicp.jetcache.anno.config.EnableMethodCache;
+import com.hfkj.common.utils.SpringContextUtil;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+// @ComponentScan
+@EnableTransactionManagement
+@EnableScheduling
+@EnableMethodCache(basePackages = "com.hfkj")
+@EnableCreateCacheAnnotation
+@ServletComponentScan
+@MapperScan("com.hfkj.dao")
+public class ScheduleApplication
+{
+ public static void main( String[] args )
+ {
+ ApplicationContext app = SpringApplication.run(ScheduleApplication.class, args);
+ SpringContextUtil.setApplicationContext(app);
+ }
+
+}
diff --git a/schedule/src/main/java/com/hfkj/config/AuthConfig.java b/schedule/src/main/java/com/hfkj/config/AuthConfig.java
new file mode 100644
index 0000000..49348f7
--- /dev/null
+++ b/schedule/src/main/java/com/hfkj/config/AuthConfig.java
@@ -0,0 +1,169 @@
+package com.hfkj.config;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.hfkj.common.security.UserCenter;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+@Configuration
+public class AuthConfig implements WebMvcConfigurer {
+
+ private static Logger log = LoggerFactory.getLogger(AuthConfig.class);
+
+ @Resource
+ private UserCenter userCenter;
+
+ /**
+ * 获取配置文件debug变量
+ */
+ @Value("${debug}")
+ private boolean debug = false;
+
+ /**
+ * 解决18位long类型数据转json失去精度问题
+ * @param converters
+ */
+ @Override
+ public void configureMessageConverters(List> converters){
+ MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
+
+ ObjectMapper objectMapper = jsonConverter.getObjectMapper();
+ SimpleModule simpleModule = new SimpleModule();
+ simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+ simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+ objectMapper.registerModule(simpleModule);
+
+ converters.add(jsonConverter);
+ }
+
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(new HandlerInterceptorAdapter() {
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
+ Object handler) throws Exception {
+ if(debug){
+ return true;
+ }
+ String token = request.getParameter("Authorization");
+ if (StringUtils.isBlank(token)) {
+ token = request.getHeader("Authorization");
+ }
+ if((StringUtils.isNotBlank(token) && userCenter.isTokenLogin(token)) || userCenter.isLogin(request)){//如果未登录,将无法使用任何接口
+ userCenter.refreshCookie(request, response);
+ return true;
+ } else if(request instanceof StandardMultipartHttpServletRequest) {
+ StandardMultipartHttpServletRequest re = (StandardMultipartHttpServletRequest)request;
+ if(userCenter.isLogin(re.getRequest())){
+ return true;
+ } else {
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }
+ } else{
+ log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
+ response.setStatus(401);
+ return false;
+ }
+ }
+ })
+ .addPathPatterns("/**")
+ .excludePathPatterns("/swagger-resources/**")
+ .excludePathPatterns("/**/api-docs")
+ .excludePathPatterns("/**/springfox-swagger-ui/**")
+ .excludePathPatterns("/**/swagger-ui.html")
+ .excludePathPatterns("/login/*")
+ .excludePathPatterns("/order/*")
+ .excludePathPatterns("/coupon/getCouponList")
+ .excludePathPatterns("/wechatpay/*")
+ .excludePathPatterns("/coupon/getCouponById")
+ .excludePathPatterns("/discount/getDiscountByQrCode")
+ .excludePathPatterns("/discount/getDiscountById")
+ .excludePathPatterns("/discount/getCouponByDiscount")
+ .excludePathPatterns("/discount/getDiscountByDiscountAgentId")
+ .excludePathPatterns("/highMerchantStore/getMerchantStoreById")
+ .excludePathPatterns("/highMerchantStore/getStoreListByCoupon")
+ .excludePathPatterns("/highMerchantStore/getStoreList")
+ .excludePathPatterns("/highMerchantStore/getMerchantList")
+ .excludePathPatterns("/highMerchantStore/getStoreListByMerchant")
+ .excludePathPatterns("/sms/sendSmsCode")
+ .excludePathPatterns("/sms/getSmsCode")
+ .excludePathPatterns("/activity/getWinLotteryList")
+ .excludePathPatterns("/user/login")
+ .excludePathPatterns("/user/unionPhoneLogin")
+ .excludePathPatterns("/user/getUnionId")
+ .excludePathPatterns("/highUser/setCacheParam")
+ .excludePathPatterns("/highUser/getCacheParam")
+ .excludePathPatterns("/highUser/delCacheParam")
+ .excludePathPatterns("/order/orderToH5Pay")
+ .excludePathPatterns("/order/orderToPay")
+ .excludePathPatterns("/test/*")
+ .excludePathPatterns("/cmsContent/*")
+ .excludePathPatterns("/highGas/*")
+ .excludePathPatterns("/outRechargeOrder/*")
+ .excludePathPatterns("/wechat/*")
+ .excludePathPatterns("/tuanyou/*")
+ .excludePathPatterns("/unionPay/*")
+ .excludePathPatterns("/highGas/*")
+ .excludePathPatterns("/common/*")
+ .excludePathPatterns("/order/qzOrderToPay")
+ .excludePathPatterns("/czOrder/orderRefundNotify")
+ .excludePathPatterns("/cmsContent/*")
+ .excludePathPatterns("/highBrand/*")
+ .excludePathPatterns("/highGoodsType/*")
+ .excludePathPatterns("/sendSms/*")
+ .excludePathPatterns("/test/*")
+ .excludePathPatterns("/sms/*")
+ ;
+ }
+
+ public String getIpAddress(HttpServletRequest request) {
+ // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址
+ String ip = request.getHeader("X-Forwarded-For");
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("WL-Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_CLIENT_IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getRemoteAddr();
+ }
+ } else if (ip.length() > 15) {
+ String[] ips = ip.split(",");
+ for (int index = 0; index < ips.length; index++) {
+ String strIp = ips[index];
+ if (!("unknown".equalsIgnoreCase(strIp))) {
+ ip = strIp;
+ break;
+ }
+ }
+ }
+ return ip;
+ }
+
+}
diff --git a/schedule/src/main/java/com/hfkj/config/ConfigListener.java b/schedule/src/main/java/com/hfkj/config/ConfigListener.java
new file mode 100644
index 0000000..35eaeda
--- /dev/null
+++ b/schedule/src/main/java/com/hfkj/config/ConfigListener.java
@@ -0,0 +1,23 @@
+package com.hfkj.config;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+@WebListener
+public class ConfigListener implements ServletContextListener {
+
+ @Resource
+ private SysConfig sysConfig;
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+ SysConst.setSysConfig(sysConfig);
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+ }
+
+}
diff --git a/schedule/src/main/java/com/hfkj/config/CorsConfig.java b/schedule/src/main/java/com/hfkj/config/CorsConfig.java
new file mode 100644
index 0000000..e7b150f
--- /dev/null
+++ b/schedule/src/main/java/com/hfkj/config/CorsConfig.java
@@ -0,0 +1,49 @@
+package com.hfkj.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName CorsConfig
+ * @Description: TODO ()
+ * @Author 胡锐
+ * @Date 2020/12/16
+ **/
+@Configuration
+public class CorsConfig extends WebMvcConfigurerAdapter {
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**")
+ .allowedOrigins("*")
+ .allowCredentials(true)
+ .allowedMethods("GET", "POST", "DELETE", "PUT")
+ .maxAge(3600);
+ }
+ private CorsConfiguration buildConfig() {
+ CorsConfiguration corsConfiguration = new CorsConfiguration();
+ List list = new ArrayList<>();
+ list.add("*");
+ corsConfiguration.setAllowedOrigins(list);
+ /*
+ // 请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等)
+ */
+ corsConfiguration.addAllowedOrigin("*");
+ corsConfiguration.addAllowedHeader("*");
+ corsConfiguration.addAllowedMethod("*");
+ return corsConfiguration;
+ }
+ @Bean
+ public CorsFilter corsFilter() {
+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+ source.registerCorsConfiguration("/**", buildConfig());
+ return new CorsFilter(source);
+ }
+}
diff --git a/schedule/src/main/java/com/hfkj/config/MultipartConfig.java b/schedule/src/main/java/com/hfkj/config/MultipartConfig.java
new file mode 100644
index 0000000..a60902b
--- /dev/null
+++ b/schedule/src/main/java/com/hfkj/config/MultipartConfig.java
@@ -0,0 +1,26 @@
+package com.hfkj.config;
+
+import org.springframework.boot.web.servlet.MultipartConfigFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.servlet.MultipartConfigElement;
+
+@Configuration
+public class MultipartConfig {
+
+ /**
+ * 文件上传配置
+ * @return
+ */
+ @Bean
+ public MultipartConfigElement multipartConfigElement() {
+ MultipartConfigFactory factory = new MultipartConfigFactory();
+ //文件最大
+ factory.setMaxFileSize("300MB"); //KB,MB
+ //设置总上传数据总大小
+ factory.setMaxRequestSize("350MB");
+ return factory.createMultipartConfig();
+ }
+
+}
diff --git a/schedule/src/main/java/com/hfkj/config/RedisConfig.java b/schedule/src/main/java/com/hfkj/config/RedisConfig.java
new file mode 100644
index 0000000..c3dcc94
--- /dev/null
+++ b/schedule/src/main/java/com/hfkj/config/RedisConfig.java
@@ -0,0 +1,110 @@
+package com.hfkj.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.*;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+
+@Configuration
+@EnableCaching //开启注解
+public class RedisConfig extends CachingConfigurerSupport {
+
+ /**
+ * retemplate相关配置
+ * @param factory
+ * @return
+ */
+ @Bean
+ public RedisTemplate redisTemplate(RedisConnectionFactory factory) {
+
+ RedisTemplate template = new RedisTemplate<>();
+ // 配置连接工厂
+ template.setConnectionFactory(factory);
+
+ //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
+ Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
+
+ ObjectMapper om = new ObjectMapper();
+ // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
+ om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+ // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
+ om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+ jacksonSeial.setObjectMapper(om);
+
+ // 值采用json序列化
+ template.setValueSerializer(jacksonSeial);
+ //使用StringRedisSerializer来序列化和反序列化redis的key值
+ template.setKeySerializer(new StringRedisSerializer());
+
+ // 设置hash key 和value序列化模式
+ template.setHashKeySerializer(new StringRedisSerializer());
+ template.setHashValueSerializer(jacksonSeial);
+ template.afterPropertiesSet();
+
+ return template;
+ }
+
+ /**
+ * 对hash类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public HashOperations hashOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForHash();
+ }
+
+ /**
+ * 对redis字符串类型数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ValueOperations valueOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForValue();
+ }
+
+ /**
+ * 对链表类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ListOperations listOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForList();
+ }
+
+ /**
+ * 对无序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public SetOperations setOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForSet();
+ }
+
+ /**
+ * 对有序集合类型的数据操作
+ *
+ * @param redisTemplate
+ * @return
+ */
+ @Bean
+ public ZSetOperations zSetOperations(RedisTemplate redisTemplate) {
+ return redisTemplate.opsForZSet();
+ }
+
+}
diff --git a/schedule/src/main/java/com/hfkj/config/SwaggerConfig.java b/schedule/src/main/java/com/hfkj/config/SwaggerConfig.java
new file mode 100644
index 0000000..b95a4a2
--- /dev/null
+++ b/schedule/src/main/java/com/hfkj/config/SwaggerConfig.java
@@ -0,0 +1,47 @@
+package com.hfkj.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+/**
+* SwaggerConfig.java
+* 项目名称:
+* 包:
+* 类名称: SwaggerConfig.java
+* 类描述: 构建restful api接口文档
+* 创建人:
+* 创建时间: 2017 下午4:23:45
+*/
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig
+{
+
+ /**
+ * 描述api的基本信息
+ * 基本信息会展现在文档页面中
+ * @return [api的基本信息]
+ */
+ ApiInfo apiInfo()
+ {
+ return new ApiInfoBuilder().title("hgj-CWeb").description("提供给用户端的接口").termsOfServiceUrl("").version("1.0.0")
+ .contact(new Contact("", "", "")).build();
+ }
+
+ @Bean
+ public Docket customImplementation()
+ {
+ return new Docket(DocumentationType.SWAGGER_2).select()
+ .apis(RequestHandlerSelectors.basePackage("com"))
+ .build().directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
+ .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class).apiInfo(apiInfo());
+ }
+
+}
diff --git a/schedule/src/main/java/com/hfkj/config/SysConfig.java b/schedule/src/main/java/com/hfkj/config/SysConfig.java
new file mode 100644
index 0000000..084f5ec
--- /dev/null
+++ b/schedule/src/main/java/com/hfkj/config/SysConfig.java
@@ -0,0 +1,31 @@
+package com.hfkj.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
+
+@Component("sysConfig")
+@ConfigurationProperties
+@PropertySource("classpath:/config.properties")
+public class SysConfig {
+
+ private String fileUrl;
+
+ private String cmsPath;
+
+ public String getFileUrl() {
+ return fileUrl;
+ }
+
+ public void setFileUrl(String fileUrl) {
+ this.fileUrl = fileUrl;
+ }
+
+ public String getCmsPath() {
+ return cmsPath;
+ }
+
+ public void setCmsPath(String cmsPath) {
+ this.cmsPath = cmsPath;
+ }
+}
diff --git a/schedule/src/main/java/com/hfkj/config/SysConst.java b/schedule/src/main/java/com/hfkj/config/SysConst.java
new file mode 100644
index 0000000..e4c91e8
--- /dev/null
+++ b/schedule/src/main/java/com/hfkj/config/SysConst.java
@@ -0,0 +1,19 @@
+package com.hfkj.config;
+
+public class SysConst {
+
+ private static SysConfig sysConfig;
+
+ public static void setSysConfig(SysConfig arg){
+ sysConfig = arg;
+ }
+
+ public static SysConfig getSysConfig(){
+ if (null == sysConfig) {
+ //防止空指针异常
+ sysConfig = new SysConfig();
+ return sysConfig;
+ }
+ return sysConfig;
+ }
+}
diff --git a/schedule/src/main/resources/dev/application.yml b/schedule/src/main/resources/dev/application.yml
new file mode 100644
index 0000000..40eb448
--- /dev/null
+++ b/schedule/src/main/resources/dev/application.yml
@@ -0,0 +1,92 @@
+server:
+ port: 9509
+ servlet:
+ context-path: /schedule
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/puhui_go?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+
+ redis:
+ database: 1
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+
+ mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+ pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
+
+rocketmq:
+ name-server: 139.9.154.68:9876
+ producer:
+ access-key: huifukeji
+ secret-key: HF123456.
+ #必须指定group
+ group: default-group
+ consumer:
+ access-key: huifukeji
+ secret-key: HF123456.
+
+jetcache:
+ statIntervalMinutes: 15
+ areaInCacheName: false
+ local:
+ default:
+ type: linkedhashmap
+ keyConvertor: fastjson
+ remote:
+ default:
+ type: redis
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ keyConvertor: fastjson
+ broadcastChannel: projectA
+ valueEncoder: java
+ valueDecoder: java
+ poolConfig:
+ minIdle: 5
+ maxIdle: 20
+ maxTotal: 50
diff --git a/schedule/src/main/resources/dev/config.properties b/schedule/src/main/resources/dev/config.properties
new file mode 100644
index 0000000..e69de29
diff --git a/schedule/src/main/resources/dev/logback.xml b/schedule/src/main/resources/dev/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/schedule/src/main/resources/dev/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/schedule/src/main/resources/pre/application.yml b/schedule/src/main/resources/pre/application.yml
new file mode 100644
index 0000000..db63258
--- /dev/null
+++ b/schedule/src/main/resources/pre/application.yml
@@ -0,0 +1,59 @@
+server:
+ port: 9303
+ servlet:
+ context-path: /schedule
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+
+ redis:
+ database: 0
+ host: 139.9.154.68
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+
+ mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+ pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/schedule/src/main/resources/pre/config.properties b/schedule/src/main/resources/pre/config.properties
new file mode 100644
index 0000000..e69de29
diff --git a/schedule/src/main/resources/pre/logback.xml b/schedule/src/main/resources/pre/logback.xml
new file mode 100644
index 0000000..9382585
--- /dev/null
+++ b/schedule/src/main/resources/pre/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/schedule/src/main/resources/prod/application.yml b/schedule/src/main/resources/prod/application.yml
new file mode 100644
index 0000000..54fea1f
--- /dev/null
+++ b/schedule/src/main/resources/prod/application.yml
@@ -0,0 +1,59 @@
+server:
+ port: 9303
+ servlet:
+ context-path: /schedule
+
+#配置是否为debug模式,debug模式下,不开启权限校验
+debug: false
+
+#datasource数据源设置
+spring:
+ datasource:
+ url: jdbc:mysql://127.0.0.1:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+ username: root
+ password: HF123456.
+ type: com.alibaba.druid.pool.DruidDataSource
+ driver-class-name: com.mysql.jdbc.Driver
+ filters: stat
+ maxActive: 10
+ initialSize: 5
+ maxWait: 60000
+ minIdle: 5
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: select 'x'
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxOpenPreparedStatements: 20
+
+ redis:
+ database: 0
+ host: 127.0.0.1
+ port: 36379
+ password: HF123456.Redis
+ timeout: 1000
+ jedis:
+ pool:
+ max-active: 20
+ max-wait: -1
+ max-idle: 10
+ min-idle: 0
+
+ #配置日期返回至前台为时间戳
+ jackson:
+ serialization:
+ write-dates-as-timestamps: true
+
+mybatis:
+ mapperLocations:
+ - classpath*:sqlmap*/*.xml
+ type-aliases-package:
+ org.springboot.sample.entity
+
+pagehelper:
+ helperDialect: mysql
+ reasonable: true
+ supportMethodsArguments: true
+ params: count=countSql
diff --git a/schedule/src/main/resources/prod/config.properties b/schedule/src/main/resources/prod/config.properties
new file mode 100644
index 0000000..e69de29
diff --git a/schedule/src/main/resources/prod/logback.xml b/schedule/src/main/resources/prod/logback.xml
new file mode 100644
index 0000000..e509de0
--- /dev/null
+++ b/schedule/src/main/resources/prod/logback.xml
@@ -0,0 +1,72 @@
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+ UTF-8
+
+
+
+ log/base.log
+
+ log/base.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/dao.log
+
+ log/dao.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+ log/error.log
+
+ log/error.log.%d.%i
+
+
+ 64 MB
+
+
+
+
+ %d %p (%file:%line\)- %m%n
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/service/pom.xml b/service/pom.xml
new file mode 100644
index 0000000..fb74890
--- /dev/null
+++ b/service/pom.xml
@@ -0,0 +1,246 @@
+
+
+
+ com.hfkj
+ puhui-go-parent
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ service
+ PACKT-SNAPSHOT
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ 2.6.1
+ 2.9.9
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-jdbc
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 1.3.1
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+ com.alicp.jetcache
+ jetcache-starter-redis
+ 2.5.0
+
+
+ org.apache.rocketmq
+ rocketmq-spring-boot-starter
+ 2.2.2
+
+
+ com.github.pagehelper
+ pagehelper-spring-boot-starter
+ 1.2.10
+
+
+ org.aspectj
+ aspectjweaver
+ 1.8.13
+
+
+ tk.mybatis
+ mapper
+ 3.3.0
+
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.3
+
+
+
+
+ mysql
+ mysql-connector-java
+ 5.1.34
+
+
+
+
+ com.alibaba
+ druid
+ 1.0.20
+
+
+
+ io.springfox
+ springfox-swagger2
+ ${springfox-version}
+
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${springfox-version}
+
+
+
+ joda-time
+ joda-time
+ ${joda-time-version}
+
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.25
+
+
+ org.slf4j
+ slf4j-simple
+ 1.7.25
+ provided
+
+
+ org.apache.commons
+ commons-lang3
+ 3.7
+
+
+ org.apache.commons
+ commons-collections4
+ 4.2
+
+
+ commons-codec
+ commons-codec
+ 1.10
+
+
+ commons-logging
+ commons-logging
+ 1.2
+
+
+
+ commons-fileupload
+ commons-fileupload
+ 1.4
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ commons-io
+ commons-io
+ 2.6
+
+
+ com.alibaba
+ fastjson
+ 1.2.7
+
+
+ org.apache.httpcomponents
+ httpmime
+ 4.5.6
+
+
+ com.aliyun
+ aliyun-java-sdk-core
+ 4.1.0
+
+
+
+ dom4j
+ dom4j
+ 1.6.1
+
+
+ org.apache.poi
+ poi
+ 4.1.2
+
+
+ org.apache.poi
+ poi-ooxml
+ 4.1.2
+
+
+ org.apache.poi
+ poi-ooxml-schemas
+ 4.1.2
+
+
+ com.google.zxing
+ javase
+ 3.3.0
+
+
+ com.google.code.gson
+ gson
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.7
+
+
+ com.thoughtworks.xstream
+ xstream
+ 1.4.11.1
+
+
+ com.github.binarywang
+ weixin-java-miniapp
+ 3.8.0
+
+
+ com.alibaba
+ easyexcel
+ 2.2.6
+
+
+ com.sun.jersey
+ jersey-client
+ 1.16
+
+
+
+
+
+ src/main/resources/${env}
+ false
+
+
+
+
diff --git a/service/src/main/java/com/hfkj/common/Base64Util.java b/service/src/main/java/com/hfkj/common/Base64Util.java
new file mode 100644
index 0000000..9c0d71e
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/Base64Util.java
@@ -0,0 +1,42 @@
+package com.hfkj.common;
+
+import java.util.Base64;
+
+public class Base64Util {
+ /**
+ * @param data
+ * @return str
+ * @throws Exception
+ */
+ public static String encode(String data) throws Exception{
+// String encodeBase64 = new BASE64Encoder().encode(data.getBytes("utf-8"));
+ String encodeBase64 = Base64.getEncoder().encodeToString(data.getBytes("utf-8"));
+ String safeBase64Str = encodeBase64.replace('+', '-');
+ safeBase64Str = safeBase64Str.replace('/', '_');
+ safeBase64Str = safeBase64Str.replaceAll("=", "");
+ return safeBase64Str.replaceAll("\\s*", "");
+ }
+
+ /**
+ * @param safeBase64Str
+ * @return str
+ * @throws Exception
+ */
+ public static String decode(final String safeBase64Str) throws Exception{
+ String base64Str = safeBase64Str.replace('-', '+');
+ base64Str = base64Str.replace('_', '/');
+ int mod4 = base64Str.length() % 4;
+ if(mod4 > 0){
+ base64Str += "====".substring(mod4);
+ }
+
+// byte[] ret = new BASE64Decoder().decodeBuffer(base64Str);
+ byte[] ret = Base64.getDecoder().decode(base64Str);
+ return new String(ret, "utf-8");
+ }
+
+ public static void main(String[] args) throws Exception {
+ System.out.println(encode("abcd1234"));
+ System.out.println(decode("YWJjZDEyMzQ"));
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/QRCodeGenerator.java b/service/src/main/java/com/hfkj/common/QRCodeGenerator.java
new file mode 100644
index 0000000..0e08f01
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/QRCodeGenerator.java
@@ -0,0 +1,43 @@
+package com.hfkj.common;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.WriterException;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.QRCodeWriter;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * @Auther: 胡锐
+ * @Description: 生成二维码
+ * @Date: 2021/3/27 12:07
+ */
+public class QRCodeGenerator {
+
+ public static void generateQRCodeImage(String text, int width, int height, String filePath) throws WriterException, IOException {
+ QRCodeWriter qrCodeWriter = new QRCodeWriter();
+
+ BitMatrix bitMatrix = qrCodeWriter.encode(text, BarcodeFormat.QR_CODE, width, height);
+
+ File file = new File(filePath);
+ if(!file.exists()){
+ file.mkdirs();
+ }
+ //Path path = FileSystems.getDefault().getPath(filePath);
+ MatrixToImageWriter.writeToFile(bitMatrix, "PNG", file);
+
+ }
+
+ public static void main(String[] args) {
+ try {
+ generateQRCodeImage("This is my first QR Code", 350, 350, "D:\\/ss/qr1.png");
+ } catch (WriterException e) {
+ System.out.println("Could not generate QR Code, WriterException :: " + e.getMessage());
+ } catch (IOException e) {
+ System.out.println("Could not generate QR Code, IOException :: " + e.getMessage());
+ }
+
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/exception/AppException.java b/service/src/main/java/com/hfkj/common/exception/AppException.java
new file mode 100644
index 0000000..307f7e6
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/exception/AppException.java
@@ -0,0 +1,10 @@
+package com.hfkj.common.exception;
+
+/**
+ * 数据异常,只影响部分功能的异常,例如本应该为x的数据,莫名其妙为Y
+ */
+public class AppException extends BaseException {
+ AppException(String errorCode, String errorMsg) {
+ super(errorCode,errorMsg);
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/exception/BaseException.java b/service/src/main/java/com/hfkj/common/exception/BaseException.java
new file mode 100644
index 0000000..4af58db
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/exception/BaseException.java
@@ -0,0 +1,23 @@
+package com.hfkj.common.exception;
+
+/**
+ * sl框架基础异常,不允许自己new实例,需要同步工具类进行实例化
+ */
+public class BaseException extends RuntimeException {
+ protected String errorCode;
+ protected String errorMsg;
+
+ BaseException(String errorCode, String errorMsg) {
+ super("errorCode="+errorCode+", errorMsg="+errorMsg);
+ this.errorCode = errorCode;
+ this.errorMsg = errorMsg;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public String getErrorMsg() {
+ return errorMsg;
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/exception/BizException.java b/service/src/main/java/com/hfkj/common/exception/BizException.java
new file mode 100644
index 0000000..87b00f8
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/exception/BizException.java
@@ -0,0 +1,10 @@
+package com.hfkj.common.exception;
+
+/**
+ * 用户操作异常
+ */
+public class BizException extends BaseException {
+ BizException(String errorCode, String errorMsg) {
+ super(errorCode,errorMsg);
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/exception/ErrorCode.java b/service/src/main/java/com/hfkj/common/exception/ErrorCode.java
new file mode 100644
index 0000000..b5b9e33
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/exception/ErrorCode.java
@@ -0,0 +1,160 @@
+package com.hfkj.common.exception;
+
+/**
+ *
+ * @ClassName: ErrorCode
+ * @Description:
+ * 代码code规则:
+ * 0000-0999 系统异常
+ * 1000-1999 app异常
+ * 2000-2999 biz异常
+ * 999999 未知异常
+ * @author: 机器猫
+ * @date: 2018年8月12日 上午11:43:30
+ *
+ * @Copyright: 2018 www.shinwoten.com Inc. All rights reserved.
+ */
+public enum ErrorCode {
+
+ //////////////////sys////////////////
+ DB_CONNECT_ERROR("0000","数据库连接异常"),
+ FTP_CONNECT_ERROR("0001","FTP服务器连接失败"),
+ FTP_CONFIG_NOT_FOUND("0002","FTP服务地址路径配置缺失"),
+
+ //////////////////APP///////////////
+ WECHAT_DECRYPT_ERROR("3001","微信解密错误->%s"),
+ WECHAT_LOGIN_ERROR("3002","微信登录失败"),
+ WECHAT_LOGIN_TEACHER_ERROR("3003","当前微信用户不是老师,请联系管理员"),
+ SERVER_BUSY_ERROR("3004","服务器繁忙,请稍后重试"),
+
+ //////////////////业务异常/////////////
+ COMMON_ERROR("2000",""),
+ REQ_PARAMS_ERROR("2001","请求参数校验失败"),
+ PHONE_REGISTER_ERROR("2002","手机号已注册"),
+ VERIFICATION_CODE_ERROR("2003","验证码错误"),
+ SEC_USER_OR_PASSWORD_ERROR("2005","手机号或密码错误"),
+ NOT_FOUND_PHONE("2006","未找到手机号"),
+ OLD_PASSWORD("2007","旧密码错误"),
+ BS_COMPANY_UNAVAILABLE("2013","公司不可用"),
+ NOT_FOUND_USER_ERROR("2016","用户不存在"),
+ NOT_FOUND_COMPANY("2018","未找到公司"),
+ USER_PHONE_HAS_ONE_ERROR("2020","该用户电话已被绑定,请更换"),
+ USER_ROLE_PERMISSION_ALLOT_ERROR("2011","请联系管理员核实用户角色权限是否启用"),
+ COMPANY_REGION_HAS_IN_CITY_ERROR("2031","单位区域必须选择到市级区域"),
+ UN_FIND_ORGANIZATION_ERROR("2032","未找到该部门信息"),
+ COMPANY_ADMIN_USER_ERROR("2033","公司主账号异常"),
+ ORGANIZATION_NAME_IS_EXIST_ERROR("2034","部门名称已经存在"),
+ TOP_ORGANIZATION_DELETE_ERROR("2035","顶级组织不允许删除"),
+ SON_ORGANIZATION_IS_EXIST_ERROR("2036","存在子级部门,不能删除"),
+ ORG_REGION_HAS_IN_REGION_ERROR("2037","区级单位所属区域必须选择到区级"),
+ CMS_CATEGORY_NOT_FOUND("2038", "未找到分类"),
+ CMS_CATEGORY_MODULE_NOT_FOUND("2039", "未找到模板"),
+ CMS_CATEGORY_MODULE_EXISTS("2040", "同一分类下存在相同名称的模板"),
+ CMS_CATEGORY_EXISTS_CHILDREN("2041", "分类存在子级,无法删除"),
+ CMS_CATEGORY_EXISTS("2042", "存在相同编码的分类"),
+ CMS_CREATE_HTML_ERROR("2043", "生成页面错误"),
+ CMS_CONTENT_NOT_FOUND("2044", "未找到内容信息"),
+ CMS_PATCH_NOT_FOUND("2045", "未找到附件"),
+ MENU_TREE_HAS_NOT_ERROR("2041","该主角色没有权限"),
+ PERMISSION_NAME_IS_EXIST_ERROR("2043","该权限名称已经存在"),
+ PERMISSION_CODE_IS_EXIST_ERROR("2044","该权限编码已经存在"),
+ MENU_TYPE_IS_NOT_EDIT_ERROR("2046","菜单类型不允许修改"),
+ MENU_HAS_SON_ERROR("2047","存在子菜单,不能删除"),
+ ROLE_NAME_IS_EXIST_ERROR("2048","该角色名已经存在"),
+ USER_LOGIN_NAME_IS_EXIST_ERROR("2049","该登录用户名已经存在"),
+ USER_ROLE_HAS_ALLOT_ERROR("2050","该角色已分配给用户,不能删除"),
+ COMPANY_NAME_IS_EXIST_ERROR("2055","公司已经存在"),
+ UN_FIND_TOP_ORGANIZATION_ERROR("2051","找不到顶级组织架构"),
+ BASE_ORGANIZATION_HAS_NOT_MANAGE_ERROR("2056","该部门暂无管理员"),
+ BASE_ORGANIZATION_HAS_NOT_PARENT_ERROR("2057","该部门无上级部门"),
+ SEC_USER_EXPIRED("2068","用户身份错误或已过期"),
+ UN_MEMBER_ERROR("2084","未找到用户"),
+ SING_ERROR("2089","签名错误"),
+ REGION_ABBREVIATE_EXIST("2098","地区简称已存在"),
+ NOT_FOUND_CHANNEL("2099","未找到渠道商"),
+ PASSWORD_ERROR("2102","密码错误"),
+ SMS_CODE_ERROR("2103","验证码错误"),
+ ID_CARD_NUM_IS_ERROR("2104","身份证号码错误"),
+ MERCHANT_NOF_FOUND("2105","未找到商户"),
+ MERCHANT_STORE_NOF_FOUND("2106","未找到商户门店"),
+ PHONE_NUM_IS_ERROR("2107","请输入正确的电话号码"),
+ PHONE_NUM_EXISTED("2108","电话号码已被使用"),
+ MERCHANT_STATUS_ERROR("2109","商户状态不正常,请联系管理员"),
+ SELECT_HANDSEL_COUPON_ERROR("2110","请选择赠送卡卷名单"),
+ NOT_FOUND_COUPON("2111","未找到卡券信息"),
+ WRITE_COUPON_NUMBER_ERROR("2112","请填写卡卷数量"),
+ COUPON_UNABLE_UP_SHELF("2113","卡卷状态错误"),
+ NOT_FOUND_APPROVE("2114","未找到审批记录"),
+ APPROVE_PROCESSED("2115","审批已处理"),
+ COUPON_STOCK_ERROR("2116","卡卷库存数量错误"),
+ COUPON_TYPE_ERROR("2117","卡卷类型错误"),
+ COUPON_STATUS_ERROR("2118","卡卷状态错误"),
+ GOODS_PRICE_REFER_ERROR("2119","未找到价格信息"),
+ DISCOUNT_PRICE_BIG_SALES_PRICE_ERROR("2120","折扣价格不能大于原价"),
+ INVALID_TIME_BIG_EFFECTIVE_TIME_ERROR("2121","失效时间不能大于生效时间"),
+ PRICE_REFER_STATUS_ERROR("2122","暂时无法增加,有处于在待编辑、待生效、审批中的价格"),
+ NEED_WRITE_NEW_SALE_PRICE("2123","请填写正确的新销售价格"),
+ NEED_WRITE_DISCOUNT_PRICE("2124","请填写正确的折扣数,折扣数范围【0】 ~ 【10】"),
+ DISCOUNT_PRICE_RANGE("2125","请输入正确的"),
+ TEL_EXISTED("2126","联系方式已被使用"),
+ ORDER_TYPE_ERROR("2127","订单类型错误"),
+ COUPON_STOCK_INSUFFICIENT("2118","卡卷库存数量不足"),
+ NOT_FOUND_ORDER("2119","未找到订单信息"),
+ ORDER_NO_STAY_PAY("2120","订单不处于待支付状态"),
+ NOT_FOUND_COUPON_CODE("2121","销售码不存在"),
+ COUPON_CODE_STATUS("2122","卡券码状态错误"),
+ COUPON_CODE_OVERDUE("2122","卡券码已过期"),
+ COUPON_CODE_NAME("2123","卡券名称已存在"),
+ AGENT_NAME("2124","代理商名称已存在"),
+ NOT_FOUND_DISCOUNT("2125","未找到优惠券信息"),
+ NOT_FOUND_AGENT("2126","未找到代理商信息"),
+ DISCOUNT_STOCK_COUNT_ERROR("2127","优惠券库存数量不足"),
+ RECHARGE_CLOSE("2128","系统已关闭,请稍后充值"),
+ REPEAT_SET_USER_PAY_PWD("2129","已设置支付密码"),
+ NOT_SET_USER_PAY_PWD("2130","未设置支付密码"),
+ NOT_ENTER_USER_PAY_PWD("2131","未输入支付密码"),
+ USER_PAY_PWD_ERROR("2132","支付密码错误"),
+ NO_BIND_PHONE("2133","未绑定手机号"),
+ title_("2134","名称已存在"),
+ ADD_REPEATEDLY("2135","重复添加"),
+
+
+ STATUS_ERROR("3000","状态错误"),
+ ADD_DATA_ERROR("3001","增加数据失败"),
+ UPDATE_DATA_ERROR("3002","修改数据失败"),
+ DELETE_DATA_ERROR("3003","删除数据失败"),
+ COMPETENCE_INSUFFICIENT("3004","权限不足"),
+ REQUEST_ERROR("3005","请求错误"),
+ REQUEST_TIMED_OUT("3006","请求超时,请稍后重试"),
+
+ MSG_EVENT_NULL("2999","消息类型为空"),
+ USE_VISIT_ILLEGAL("4001","用户身份错误"),
+ RC_VISIT_ERROR("2998",""),
+ UNKNOW_ERROR("999999","未知异常"),
+ EXCEL_ERROR("80000","Excel处理异常"),
+ ;//注意:上面为逗号,此次为分号
+
+
+ private String code;
+ private String msg;
+ ErrorCode(String code, String msg){
+ this.code = code;
+ this.msg = msg;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+// public void setCode(String code) {
+// this.code = code;
+// }
+
+ public String getMsg() {
+ return msg;
+ }
+
+// public void setMsg(String msg) {
+// this.msg = msg;
+// }
+}
diff --git a/service/src/main/java/com/hfkj/common/exception/ErrorHelp.java b/service/src/main/java/com/hfkj/common/exception/ErrorHelp.java
new file mode 100644
index 0000000..19716be
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/exception/ErrorHelp.java
@@ -0,0 +1,23 @@
+package com.hfkj.common.exception;
+
+public class ErrorHelp {
+
+ public static BaseException genException(SysCode sc, ErrorCode ec, Object... args){
+ String errorCode = sc.getCode()+ec.getCode();
+ StringBuilder sb = new StringBuilder();
+ if (args != null && args.length != 0) {
+ for(Object o : args){
+ sb.append(o.toString());
+ }
+ }
+ String errorMsg = ec.getMsg()+sb.toString();//@TODO 这里需要处理变参
+ char a = ec.getCode().charAt(0);
+ if (a == '0') {//系统异常
+ return new SysException(errorCode,errorMsg);
+ } else if (a == '1') {//APP异常
+ return new AppException(errorCode,errorMsg);
+ } else {//业务异常
+ return new BizException(errorCode,errorMsg);
+ }
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/exception/SysCode.java b/service/src/main/java/com/hfkj/common/exception/SysCode.java
new file mode 100644
index 0000000..5e0eaa9
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/exception/SysCode.java
@@ -0,0 +1,24 @@
+package com.hfkj.common.exception;
+
+public enum SysCode {
+ System("10","System"),
+ Auth("20","Auth"),
+ MiniProgram("30","小程序");
+
+ private String code;
+ private String name;
+
+ SysCode(String code,String name){
+ this.code = code;
+ this.name = name;
+ }
+
+ public String getCode(){
+ return this.code;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+}
diff --git a/service/src/main/java/com/hfkj/common/exception/SysException.java b/service/src/main/java/com/hfkj/common/exception/SysException.java
new file mode 100644
index 0000000..f0a07dc
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/exception/SysException.java
@@ -0,0 +1,10 @@
+package com.hfkj.common.exception;
+
+/**
+ * 系统异常,例如网络断开,数据库不可访问等影响系统正常运行的异常
+ */
+public class SysException extends BaseException {
+ SysException(String errorCode, String errorMsg) {
+ super(errorCode,errorMsg);
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/entity/AliPayReqInfo.java b/service/src/main/java/com/hfkj/common/pay/entity/AliPayReqInfo.java
new file mode 100644
index 0000000..da9e050
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/entity/AliPayReqInfo.java
@@ -0,0 +1,151 @@
+package com.hfkj.common.pay.entity;
+
+/**
+ * @Description: 支付宝統一下单参数
+ */
+public class AliPayReqInfo {
+ private String timeout_express; //该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。 该参数数值不接受小数点, 如 1.5h,可转换为 90m。 90m
+ private String total_amount; //必填。订单总金额,单位为元,精确到小数点后两位,取值范围[0.01,100000000] 9.00
+ private String seller_id; //收款支付宝用户ID。 如果该值为空,则默认为商户签约账号对应的支付宝用户ID 2088102147948060
+ private String product_code; //销售产品码,商家和支付宝签约的产品码 QUICK_MSECURITY_PAY
+ private String body; //对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 Iphone6 16G
+ private String subject; //必填。商品的标题/交易标题/订单标题/订单关键字等。 大乐透
+ private String out_trade_no; //必填。商户网站唯一订单号 70501111111S001111119
+ private String time_expire; //绝对超时时间,格式为yyyy-MM-dd HH:mm。 2016-12-31 10:05
+ private String goods_type; //商品主类型 :0-虚拟类商品,1-实物类商品 0
+ private String promo_params; //优惠参数
+ private String passback_params; //必填。公用回传参数,如果请求时传递了该参数,则返回给商户时会回传该参数。支付宝只会在同步返回(包括跳转回商户网站)和异步通知时将该参数原样返回。本参数必须进行UrlEncode之后才可以发送给支付宝。 merchantBizType%3d3C%26merchantBizNo%3d2016010101111
+ private String enable_pay_channels; //可用渠道,用户只能在指定渠道范围内支付
+ private String store_id; //商户门店编号 NJ_001
+ private String specified_channel; //指定渠道,目前仅支持传入pcredit
+ private String disable_pay_channels; //禁用渠道,用户不可用指定渠道支付
+ private String business_params; //商户传入业务信息,具体值要和支付宝约定,应用于安全,营销等参数直传场景,格式为json格式
+
+ public String getTimeout_express() {
+ return timeout_express;
+ }
+
+ public void setTimeout_express(String timeout_express) {
+ this.timeout_express = timeout_express;
+ }
+
+ public String getTotal_amount() {
+ return total_amount;
+ }
+
+ public void setTotal_amount(String total_amount) {
+ this.total_amount = total_amount;
+ }
+
+ public String getSeller_id() {
+ return seller_id;
+ }
+
+ public void setSeller_id(String seller_id) {
+ this.seller_id = seller_id;
+ }
+
+ public String getProduct_code() {
+ return product_code;
+ }
+
+ public void setProduct_code(String product_code) {
+ this.product_code = product_code;
+ }
+
+ public String getBody() {
+ return body;
+ }
+
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+ public String getOut_trade_no() {
+ return out_trade_no;
+ }
+
+ public void setOut_trade_no(String out_trade_no) {
+ this.out_trade_no = out_trade_no;
+ }
+
+ public String getTime_expire() {
+ return time_expire;
+ }
+
+ public void setTime_expire(String time_expire) {
+ this.time_expire = time_expire;
+ }
+
+ public String getGoods_type() {
+ return goods_type;
+ }
+
+ public void setGoods_type(String goods_type) {
+ this.goods_type = goods_type;
+ }
+
+ public String getPromo_params() {
+ return promo_params;
+ }
+
+ public void setPromo_params(String promo_params) {
+ this.promo_params = promo_params;
+ }
+
+ public String getPassback_params() {
+ return passback_params;
+ }
+
+ public void setPassback_params(String passback_params) {
+ this.passback_params = passback_params;
+ }
+
+ public String getEnable_pay_channels() {
+ return enable_pay_channels;
+ }
+
+ public void setEnable_pay_channels(String enable_pay_channels) {
+ this.enable_pay_channels = enable_pay_channels;
+ }
+
+ public String getStore_id() {
+ return store_id;
+ }
+
+ public void setStore_id(String store_id) {
+ this.store_id = store_id;
+ }
+
+ public String getSpecified_channel() {
+ return specified_channel;
+ }
+
+ public void setSpecified_channel(String specified_channel) {
+ this.specified_channel = specified_channel;
+ }
+
+ public String getDisable_pay_channels() {
+ return disable_pay_channels;
+ }
+
+ public void setDisable_pay_channels(String disable_pay_channels) {
+ this.disable_pay_channels = disable_pay_channels;
+ }
+
+ public String getBusiness_params() {
+ return business_params;
+ }
+
+ public void setBusiness_params(String business_params) {
+ this.business_params = business_params;
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/entity/OrderType.java b/service/src/main/java/com/hfkj/common/pay/entity/OrderType.java
new file mode 100644
index 0000000..0763530
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/entity/OrderType.java
@@ -0,0 +1,46 @@
+package com.hfkj.common.pay.entity;
+
+public enum OrderType {
+ // 建议将支付频率高的模块放在前面
+ GOODS_ORDER("GOODS_ORDER", "goodsOrderService", "购买商品"),
+ RECHARGE_ORDER("RECHARGE_ORDER", "rechargeOrderService", "充值订单"),
+ KFC_ORDER("KFC", "kfcOrderService", "KFC订单"),
+ CINEMA_ORDER("CINEMA", "cinemaOrderService", "电影票订单"),
+ MOBILE_ORDER("MOBILE", "mobileOrderService", "话费充值订单"),
+ TEST("TEST", "testPayService", "支付测试"),
+ ;
+
+ private String moduleCode;
+ private String service;
+ private String moduleName;
+
+ private OrderType(String moduleCode, String service, String moduleName) {
+ this.moduleCode = moduleCode;
+ this.service = service;
+ this.moduleName = moduleName;
+ }
+
+ public String getModuleCode() {
+ return moduleCode;
+ }
+
+ private void setModuleCode(String moduleCode) {
+ this.moduleCode = moduleCode;
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ private void setService(String service) {
+ this.service = service;
+ }
+
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ private void setModuleName(String moduleName) {
+ this.moduleName = moduleName;
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/entity/WeChatPayReqInfo.java b/service/src/main/java/com/hfkj/common/pay/entity/WeChatPayReqInfo.java
new file mode 100644
index 0000000..da672ce
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/entity/WeChatPayReqInfo.java
@@ -0,0 +1,240 @@
+package com.hfkj.common.pay.entity;
+import java.io.Serializable;
+
+/**
+ * @Description: 微信統一下单参数
+ */
+public class WeChatPayReqInfo implements Serializable {
+
+ private static final long serialVersionUID = -7642108447915413137L;
+ private String appid; // 公众号id 必填
+ private String mch_id; // 商户号 必填
+ private String sub_appid; // 微信支付分配的子商户号 必填
+ private String sub_mch_id; // 微信支付分配的子商户号 必填
+ private String nonce_str; // 随机字符串 必填
+ private String sign; // 签名 必填
+ private String device_info; // 设备号 可以为终端设备号(门店号或收银设备ID),PC网页或公众号内支付可以传"WEB"
+ private String body; // 商品描述 必填
+ private String detail; // 商品详情
+ private String attach; // 附加数据
+ private String out_trade_no; // 商户订单号 必填
+ private String fee_type; // 货币类型 默认为人民币CNY
+ private Integer total_fee; // 总金额 传入int型的数据 必填
+ private String spbill_create_ip; // 终端ip 必填
+ private String time_start; // 交易起始时间 订单生成时间
+ private String time_expire; // 交易结束时间 订单失效时间
+ private String goods_tag; // 订单优惠标记
+ private String notify_url; // 通知url 必填
+ private String trade_type; // 交易类型 JSAPI,NATIVE,APP 必填
+ private String product_id; //商品id trade_type=NATIVE时(即扫码支付),此参数必传
+ private String limit_pay; // 指定支付方式 no_credit--可限制用户不能使用信用卡支付
+ private String openid; // 用户标识(trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识)
+ private String sub_openid; // 用户标识(trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识)
+ private String profit_sharing;
+
+ public String getProfit_sharing() {
+ return profit_sharing;
+ }
+
+ public void setProfit_sharing(String profit_sharing) {
+ this.profit_sharing = profit_sharing;
+ }
+
+ public String getSub_openid() {
+ return sub_openid;
+ }
+
+ public void setSub_openid(String sub_openid) {
+ this.sub_openid = sub_openid;
+ }
+
+ private String scene_info; // 该字段用于统一下单时上报场景信息,目前支持上报实际门店信息 格式{"store_id":// "SZT10000", "store_name":"腾讯大厦腾大餐厅"}
+
+ public static long getSerialVersionUID() {
+ return serialVersionUID;
+ }
+
+ public String getAppid() {
+ return appid;
+ }
+
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
+ public String getMch_id() {
+ return mch_id;
+ }
+
+ public void setMch_id(String mch_id) {
+ this.mch_id = mch_id;
+ }
+
+ public String getNonce_str() {
+ return nonce_str;
+ }
+
+ public void setNonce_str(String nonce_str) {
+ this.nonce_str = nonce_str;
+ }
+
+ public String getSign() {
+ return sign;
+ }
+
+ public void setSign(String sign) {
+ this.sign = sign;
+ }
+
+ public String getDevice_info() {
+ return device_info;
+ }
+
+ public void setDevice_info(String device_info) {
+ this.device_info = device_info;
+ }
+
+ public String getBody() {
+ return body;
+ }
+
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+ public String getDetail() {
+ return detail;
+ }
+
+ public void setDetail(String detail) {
+ this.detail = detail;
+ }
+
+ public String getAttach() {
+ return attach;
+ }
+
+ public void setAttach(String attach) {
+ this.attach = attach;
+ }
+
+ public String getOut_trade_no() {
+ return out_trade_no;
+ }
+
+ public void setOut_trade_no(String out_trade_no) {
+ this.out_trade_no = out_trade_no;
+ }
+
+ public String getFee_type() {
+ return fee_type;
+ }
+
+ public void setFee_type(String fee_type) {
+ this.fee_type = fee_type;
+ }
+
+ public Integer getTotal_fee() {
+ return total_fee;
+ }
+
+ public void setTotal_fee(Integer total_fee) {
+ this.total_fee = total_fee;
+ }
+
+ public String getSpbill_create_ip() {
+ return spbill_create_ip;
+ }
+
+ public void setSpbill_create_ip(String spbill_create_ip) {
+ this.spbill_create_ip = spbill_create_ip;
+ }
+
+ public String getTime_start() {
+ return time_start;
+ }
+
+ public void setTime_start(String time_start) {
+ this.time_start = time_start;
+ }
+
+ public String getTime_expire() {
+ return time_expire;
+ }
+
+ public void setTime_expire(String time_expire) {
+ this.time_expire = time_expire;
+ }
+
+ public String getGoods_tag() {
+ return goods_tag;
+ }
+
+ public void setGoods_tag(String goods_tag) {
+ this.goods_tag = goods_tag;
+ }
+
+ public String getNotify_url() {
+ return notify_url;
+ }
+
+ public void setNotify_url(String notify_url) {
+ this.notify_url = notify_url;
+ }
+
+ public String getTrade_type() {
+ return trade_type;
+ }
+
+ public void setTrade_type(String trade_type) {
+ this.trade_type = trade_type;
+ }
+
+ public String getProduct_id() {
+ return product_id;
+ }
+
+ public void setProduct_id(String product_id) {
+ this.product_id = product_id;
+ }
+
+ public String getLimit_pay() {
+ return limit_pay;
+ }
+
+ public void setLimit_pay(String limit_pay) {
+ this.limit_pay = limit_pay;
+ }
+
+ public String getOpenid() {
+ return openid;
+ }
+
+ public void setOpenid(String openid) {
+ this.openid = openid;
+ }
+
+ public String getScene_info() {
+ return scene_info;
+ }
+
+ public void setScene_info(String scene_info) {
+ this.scene_info = scene_info;
+ }
+
+ public String getSub_mch_id() {
+ return sub_mch_id;
+ }
+
+ public void setSub_mch_id(String sub_mch_id) {
+ this.sub_mch_id = sub_mch_id;
+ }
+
+ public String getSub_appid() {
+ return sub_appid;
+ }
+
+ public void setSub_appid(String sub_appid) {
+ this.sub_appid = sub_appid;
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/entity/WechatCallBackInfo.java b/service/src/main/java/com/hfkj/common/pay/entity/WechatCallBackInfo.java
new file mode 100644
index 0000000..3b73b6b
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/entity/WechatCallBackInfo.java
@@ -0,0 +1,154 @@
+package com.hfkj.common.pay.entity;
+
+/**
+ * 统一下单返回结果
+ * @author phil
+ * @data 2017年6月27日
+ *
+ */
+public class WechatCallBackInfo {
+
+ private static final long serialVersionUID = 9030465964635155064L;
+ private String appid; // 公众号id
+ private String mch_id; // 商户号
+ private String nonce_str; // 随机字符串
+ private String sign; // 签名
+ private String return_code; // 返回状态码
+ private String return_msg; // 返回信息
+ // 以下字段在return_code为SUCCESS的时候有返回(包括父类)
+ private String device_info; // 设备号
+ private String result_code; // 业务结果 SUCCESS/FAIL
+ private String err_code; // 错误代码
+ private String err_code_des; // 错误代码描述
+ // 以下字段在return_code 和result_code都为SUCCESS的时候有返回
+ private String trade_type; // 交易类型
+ private String prepay_id; // 预支付交易会话标识,有效期为2小时
+ private String code_url; // 二维码链接
+
+ public static long getSerialVersionUID() {
+ return serialVersionUID;
+ }
+
+ public String getAppid() {
+ return appid;
+ }
+
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
+ public String getMch_id() {
+ return mch_id;
+ }
+
+ public void setMch_id(String mch_id) {
+ this.mch_id = mch_id;
+ }
+
+ public String getNonce_str() {
+ return nonce_str;
+ }
+
+ public void setNonce_str(String nonce_str) {
+ this.nonce_str = nonce_str;
+ }
+
+ public String getSign() {
+ return sign;
+ }
+
+ public void setSign(String sign) {
+ this.sign = sign;
+ }
+
+ public String getReturn_code() {
+ return return_code;
+ }
+
+ public void setReturn_code(String return_code) {
+ this.return_code = return_code;
+ }
+
+ public String getReturn_msg() {
+ return return_msg;
+ }
+
+ public void setReturn_msg(String return_msg) {
+ this.return_msg = return_msg;
+ }
+
+ public String getDevice_info() {
+ return device_info;
+ }
+
+ public void setDevice_info(String device_info) {
+ this.device_info = device_info;
+ }
+
+ public String getResult_code() {
+ return result_code;
+ }
+
+ public void setResult_code(String result_code) {
+ this.result_code = result_code;
+ }
+
+ public String getErr_code() {
+ return err_code;
+ }
+
+ public void setErr_code(String err_code) {
+ this.err_code = err_code;
+ }
+
+ public String getErr_code_des() {
+ return err_code_des;
+ }
+
+ public void setErr_code_des(String err_code_des) {
+ this.err_code_des = err_code_des;
+ }
+
+ public String getTrade_type() {
+ return trade_type;
+ }
+
+ public void setTrade_type(String trade_type) {
+ this.trade_type = trade_type;
+ }
+
+ public String getPrepay_id() {
+ return prepay_id;
+ }
+
+ public void setPrepay_id(String prepay_id) {
+ this.prepay_id = prepay_id;
+ }
+
+ public String getCode_url() {
+ return code_url;
+ }
+
+ public void setCode_url(String code_url) {
+ this.code_url = code_url;
+ }
+
+ @Override
+ public String toString() {
+ return "WechatCallBackInfo{" +
+ "appid='" + appid + '\'' +
+ ", mch_id='" + mch_id + '\'' +
+ ", nonce_str='" + nonce_str + '\'' +
+ ", sign='" + sign + '\'' +
+ ", return_code='" + return_code + '\'' +
+ ", return_msg='" + return_msg + '\'' +
+ ", device_info='" + device_info + '\'' +
+ ", result_code='" + result_code + '\'' +
+ ", err_code='" + err_code + '\'' +
+ ", err_code_des='" + err_code_des + '\'' +
+ ", trade_type='" + trade_type + '\'' +
+ ", prepay_id='" + prepay_id + '\'' +
+ ", code_url='" + code_url + '\'' +
+ '}';
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/entity/WechatPayReturnParam.java b/service/src/main/java/com/hfkj/common/pay/entity/WechatPayReturnParam.java
new file mode 100644
index 0000000..a0dff02
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/entity/WechatPayReturnParam.java
@@ -0,0 +1,151 @@
+package com.hfkj.common.pay.entity;
+/**
+ *
+ * @Description: 微信支付异步回调参数
+ */
+public class WechatPayReturnParam {
+ private String appid; //是 String(32) wx8888888888888888 微信开放平台审核通过的应用APPID
+ private String attach; //否 String(128) 123456 商家数据包,原样返回
+ private String bank_type; //是 String(16) CMC 银行类型,采用字符串类型的银行标识,银行类型见银行列表
+ private String cash_fee; //是 Int 100 现金支付金额订单现金支付金额,详见支付金额
+ private String fee_type; //否 String(8) CNY 货币类型,符合ISO4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
+ private String is_subscribe; //是 String(1) Y 用户是否关注公众账号,Y-关注,N-未关注
+ private String mch_id; //是 String(32) 1900000109 微信支付分配的商户号
+ private String nonce_str; //是 String(32) 5K8264ILTKCH16CQ2502SI8ZNMTM67VS 随机字符串,不长于32位
+ private String openid; //是 String(128) wxd930ea5d5a258f4f 用户在商户appid下的唯一标识
+ private String out_trade_no; //是 String(32) 1212321211201407033568112322 商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。
+ private String result_code; //是 String(16) SUCCESS SUCCESS/FAIL
+ private String return_code;
+ private String time_end; //是 String(14) 20141030133525 支付完成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规
+ private String total_fee; //是 Int 100 订单总金额,单位为分
+ private String trade_type; //是 String(16) APP APP
+ private String transaction_id; //微信支付订单号
+
+ public String getAppid() {
+ return appid;
+ }
+
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
+ public String getAttach() {
+ return attach;
+ }
+
+ public void setAttach(String attach) {
+ this.attach = attach;
+ }
+
+ public String getBank_type() {
+ return bank_type;
+ }
+
+ public void setBank_type(String bank_type) {
+ this.bank_type = bank_type;
+ }
+
+ public String getCash_fee() {
+ return cash_fee;
+ }
+
+ public void setCash_fee(String cash_fee) {
+ this.cash_fee = cash_fee;
+ }
+
+ public String getFee_type() {
+ return fee_type;
+ }
+
+ public void setFee_type(String fee_type) {
+ this.fee_type = fee_type;
+ }
+
+ public String getIs_subscribe() {
+ return is_subscribe;
+ }
+
+ public void setIs_subscribe(String is_subscribe) {
+ this.is_subscribe = is_subscribe;
+ }
+
+ public String getMch_id() {
+ return mch_id;
+ }
+
+ public void setMch_id(String mch_id) {
+ this.mch_id = mch_id;
+ }
+
+ public String getNonce_str() {
+ return nonce_str;
+ }
+
+ public void setNonce_str(String nonce_str) {
+ this.nonce_str = nonce_str;
+ }
+
+ public String getOpenid() {
+ return openid;
+ }
+
+ public void setOpenid(String openid) {
+ this.openid = openid;
+ }
+
+ public String getOut_trade_no() {
+ return out_trade_no;
+ }
+
+ public void setOut_trade_no(String out_trade_no) {
+ this.out_trade_no = out_trade_no;
+ }
+
+ public String getResult_code() {
+ return result_code;
+ }
+
+ public void setResult_code(String result_code) {
+ this.result_code = result_code;
+ }
+
+ public String getReturn_code() {
+ return return_code;
+ }
+
+ public void setReturn_code(String return_code) {
+ this.return_code = return_code;
+ }
+
+ public String getTime_end() {
+ return time_end;
+ }
+
+ public void setTime_end(String time_end) {
+ this.time_end = time_end;
+ }
+
+ public String getTotal_fee() {
+ return total_fee;
+ }
+
+ public void setTotal_fee(String total_fee) {
+ this.total_fee = total_fee;
+ }
+
+ public String getTrade_type() {
+ return trade_type;
+ }
+
+ public void setTrade_type(String trade_type) {
+ this.trade_type = trade_type;
+ }
+
+ public String getTransaction_id() {
+ return transaction_id;
+ }
+
+ public void setTransaction_id(String transaction_id) {
+ this.transaction_id = transaction_id;
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/entity/WechatReturn.java b/service/src/main/java/com/hfkj/common/pay/entity/WechatReturn.java
new file mode 100644
index 0000000..26ab2fe
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/entity/WechatReturn.java
@@ -0,0 +1,77 @@
+package com.hfkj.common.pay.entity;
+
+public class WechatReturn {
+ private String appid;
+ private String mch_id;
+ private String nonce_str;
+ private String prepay_id;
+ private String result_code;
+ private String return_code;
+ private String return_msg;
+ private String trade_type;
+
+ public String getAppid() {
+ return appid;
+ }
+
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
+ public String getMch_id() {
+ return mch_id;
+ }
+
+ public void setMch_id(String mch_id) {
+ this.mch_id = mch_id;
+ }
+
+ public String getNonce_str() {
+ return nonce_str;
+ }
+
+ public void setNonce_str(String nonce_str) {
+ this.nonce_str = nonce_str;
+ }
+
+ public String getPrepay_id() {
+ return prepay_id;
+ }
+
+ public void setPrepay_id(String prepay_id) {
+ this.prepay_id = prepay_id;
+ }
+
+ public String getResult_code() {
+ return result_code;
+ }
+
+ public void setResult_code(String result_code) {
+ this.result_code = result_code;
+ }
+
+ public String getReturn_code() {
+ return return_code;
+ }
+
+ public void setReturn_code(String return_code) {
+ this.return_code = return_code;
+ }
+
+ public String getReturn_msg() {
+ return return_msg;
+ }
+
+ public void setReturn_msg(String return_msg) {
+ this.return_msg = return_msg;
+ }
+
+ public String getTrade_type() {
+ return trade_type;
+ }
+
+ public void setTrade_type(String trade_type) {
+ this.trade_type = trade_type;
+ }
+
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/util/HttpReqUtil.java b/service/src/main/java/com/hfkj/common/pay/util/HttpReqUtil.java
new file mode 100644
index 0000000..1dd670a
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/util/HttpReqUtil.java
@@ -0,0 +1,329 @@
+package com.hfkj.common.pay.util;
+
+import org.apache.commons.lang3.StringUtils;
+
+import javax.imageio.ImageIO;
+import javax.net.ssl.*;
+import javax.servlet.http.HttpServletRequest;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+
+/**
+ * Http连接工具类
+ *
+ * @author phil
+ * @date 2017年7月2日
+ *
+ */
+public class HttpReqUtil {
+
+ private static int DEFAULT_CONNTIME = 5000;
+ private static int DEFAULT_READTIME = 5000;
+ private static int DEFAULT_UPLOAD_READTIME = 10 * 1000;
+ public static String POST = "POST";
+ public static String GET = "GET";
+ /**
+ * http请求
+ *
+ * @param method
+ * 请求方法GET/POST
+ * @param path
+ * 请求路径
+ * @param timeout
+ * 连接超时时间 默认为5000
+ * @param readTimeout
+ * 读取超时时间 默认为5000
+ * @param data
+ * 数据
+ * @return
+ */
+ private static String defaultConnection(String method, String path, int timeout, int readTimeout, String data, String encoding)
+ throws Exception {
+ String result = "";
+ URL url = new URL(path);
+ if (url != null) {
+ HttpURLConnection conn = getConnection(method, url);
+ conn.setConnectTimeout(timeout == 0 ? DEFAULT_CONNTIME : timeout);
+ conn.setReadTimeout(readTimeout == 0 ? DEFAULT_READTIME : readTimeout);
+ if (data != null && !"".equals(data)) {
+ OutputStream output = conn.getOutputStream();
+ output.write(data.getBytes("UTF-8"));
+ output.flush();
+ output.close();
+ }
+ if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ InputStream input = conn.getInputStream();
+ result = IOUtil.inputStreamToString(input, encoding);
+ input.close();
+ conn.disconnect();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 根据url的协议选择对应的请求方式
+ *
+ * @param method
+ * 请求的方法
+ * @return
+ * @throws IOException
+ */
+ private static HttpURLConnection getConnection(String method, URL url) throws IOException {
+ HttpURLConnection conn = null;
+ if ("https".equals(url.getProtocol())) {
+ SSLContext context = null;
+ try {
+ context = SSLContext.getInstance("SSL", "SunJSSE");
+ context.init(new KeyManager[0], new TrustManager[] { new MyX509TrustManager() },
+ new java.security.SecureRandom());
+ } catch (Exception e) {
+ throw new IOException(e);
+ }
+ HttpsURLConnection connHttps = (HttpsURLConnection) url.openConnection();
+ connHttps.setSSLSocketFactory(context.getSocketFactory());
+ connHttps.setHostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify(String arg0, SSLSession arg1) {
+ return true;
+ }
+ });
+ conn = connHttps;
+ } else {
+ conn = (HttpURLConnection) url.openConnection();
+ }
+ conn.setRequestMethod(method);
+ conn.setUseCaches(false);
+ conn.setDoInput(true);
+ conn.setDoOutput(true);
+ return conn;
+ }
+
+ /**
+ * 设置参数
+ *
+ * @param map
+ * 参数map
+ * @param path
+ * 需要赋值的path
+ * @param charset
+ * 编码格式 默认编码为utf-8(取消默认)
+ * @return 已经赋值好的url 只需要访问即可
+ */
+ public static String setParmas(Map map, String path, String charset) throws Exception {
+ String result = "";
+ boolean hasParams = false;
+ if (path != null && !"".equals(path)) {
+ if (map != null && map.size() > 0) {
+ StringBuilder builder = new StringBuilder();
+ Set> params = map.entrySet();
+ for (Entry entry : params) {
+ String key = entry.getKey().trim();
+ String value = entry.getValue().trim();
+ if (hasParams) {
+ builder.append("&");
+ } else {
+ hasParams = true;
+ }
+ if (charset != null && !"".equals(charset)) {
+ // builder.append(key).append("=").append(URLDecoder.(value,charset));
+ builder.append(key).append("=").append(IOUtil.urlEncode(value, charset));
+ } else {
+ builder.append(key).append("=").append(value);
+ }
+ }
+ result = builder.toString();
+ }
+ }
+ return doUrlPath(path, result).toString();
+ }
+
+ /**
+ * 设置连接参数
+ *
+ * @param path
+ * 路径
+ * @return
+ */
+ private static URL doUrlPath(String path, String query) throws Exception {
+ URL url = new URL(path);
+ if (StringUtils.isEmpty(path)) {
+ return url;
+ }
+ if (StringUtils.isEmpty(url.getQuery())) {
+ if (path.endsWith("?")) {
+ path += query;
+ } else {
+ path = path + "?" + query;
+ }
+ } else {
+ if (path.endsWith("&")) {
+ path += query;
+ } else {
+ path = path + "&" + query;
+ }
+ }
+ return new URL(path);
+ }
+
+ /**
+ * 默认的http请求执行方法,返回
+ *
+ * @param method
+ * 请求的方法 POST/GET
+ * @param path
+ * 请求path 路径
+ * @param map
+ * 请求参数集合
+ * @param data
+ * 输入的数据 允许为空
+ * @return
+ */
+ public static String HttpDefaultExecute(String method, String path, Map map, String data, String encoding) {
+ String result = "";
+ try {
+ String url = setParmas((TreeMap) map, path, "");
+ result = defaultConnection(method, url, DEFAULT_CONNTIME, DEFAULT_READTIME, data, encoding);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ /**
+ * 默认的https执行方法,返回
+ *
+ * @param method
+ * 请求的方法 POST/GET
+ * @param path
+ * 请求path 路径
+ * @param map
+ * 请求参数集合
+ * @param data
+ * 输入的数据 允许为空
+ * @return
+ */
+ public static String HttpsDefaultExecute(String method, String path, Map map, String data, String encoding) {
+ String result = "";
+ try {
+ String url = setParmas((TreeMap) map, path, "");
+ result = defaultConnection(method, url, DEFAULT_CONNTIME, DEFAULT_READTIME, data, encoding);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ /**
+ * 文件路径
+ *
+ * @param mediaUrl
+ * url 例如
+ * http://su.bdimg.com/static/superplus/img/logo_white_ee663702.png
+ * @return logo_white_ee663702.png
+ */
+ private static String getFileName(String mediaUrl) {
+ String result = mediaUrl.substring(mediaUrl.lastIndexOf("/") + 1, mediaUrl.length());
+ return result;
+ }
+
+ /**
+ * 根据内容类型判断文件扩展名
+ *
+ * @param ContentType
+ * 内容类型
+ * @return
+ */
+ private static String getFileExt(String contentType) {
+ String fileExt = "";
+ if (contentType == null) {
+ return null;
+ }
+ if (contentType.contains("image/jpeg")) {
+ fileExt = ".jpg";
+ } else if (contentType.contains("audio/mpeg")) {
+ fileExt = ".mp3";
+ } else if (contentType.contains("audio/amr")) {
+ fileExt = ".amr";
+ } else if (contentType.contains("video/mp4")) {
+ fileExt = ".mp4";
+ } else if (contentType.contains("video/mpeg4")) {
+ fileExt = ".mp4";
+ } else if (contentType.contains("image/png")) {
+ fileExt = ".png";
+ }
+ return fileExt;
+ }
+
+
+
+
+ /**
+ * 改变图片大小、格式
+ *
+ * @param is
+ * @param os
+ * @param size
+ * @param format
+ * @return
+ * @throws IOException
+ */
+ public static OutputStream resizeImage(InputStream inputStream, OutputStream outputStream, int size, String format)
+ throws IOException {
+ BufferedImage prevImage = ImageIO.read(inputStream);
+ double width = prevImage.getWidth();
+ double height = prevImage.getHeight();
+ double percent = size / width;
+ int newWidth = (int) (width * percent);
+ int newHeight = (int) (height * percent);
+ BufferedImage image = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_BGR);
+ Graphics graphics = image.createGraphics();
+ graphics.drawImage(prevImage, 0, 0, newWidth, newHeight, null);
+ ImageIO.write(image, format, outputStream);
+ outputStream.flush();
+ return outputStream;
+ }
+
+ /**
+ * 获取客户端ip
+ *
+ * @param request
+ * @return
+ */
+ public static String getRemortIP(HttpServletRequest request) {
+ String ip = request.getHeader("x-forwarded-for");
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("Proxy-Client-IP");
+ }
+
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("WL-Proxy-Client-IP");
+ }
+
+ // squid的squid.conf 的配制文件中forwarded_for项改为off时
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getRemoteAddr();
+ }
+
+ // 多级反向代理
+ if (ip != null && ip.indexOf(",") > 0 && ip.split(",").length > 1) {
+ ip = ip.split(",")[0];
+ }
+ return ip;
+ }
+
+
+
+
+
+}
+
diff --git a/service/src/main/java/com/hfkj/common/pay/util/IOUtil.java b/service/src/main/java/com/hfkj/common/pay/util/IOUtil.java
new file mode 100644
index 0000000..f8dba18
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/util/IOUtil.java
@@ -0,0 +1,73 @@
+package com.hfkj.common.pay.util;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+/**
+ * IO流工具类
+ * @author 魏真峰
+ */
+public class IOUtil {
+
+ /**
+ * 将输入流转换为字符串
+ *待转换为字符串的输入流
+ * @return 由输入流转换String的字符串
+ * @throws IOException
+ */
+ public static String inputStreamToString(InputStream inputStream, String encoding) throws IOException {
+ if(StringUtils.isEmpty(encoding)) {
+ encoding = "UTF-8";
+ }
+ return IOUtils.toString(inputStream, encoding);
+ }
+
+ /**
+ * 将字符串转换为输入流
+ * 待转换为输入流的字符串
+ * @return
+ * @throws IOException
+ */
+ public static InputStream toInputStream(String inputStr, String encoding) throws IOException {
+ if (StringUtils.isEmpty(inputStr)) {
+ return null;
+ }
+ if(StringUtils.isEmpty(encoding)) {
+ encoding = "UTF-8";
+ }
+ return IOUtils.toInputStream(inputStr, encoding);
+ }
+
+
+ /**
+ * 编码
+ *
+ * @param source
+ * @param encode
+ * @return
+ */
+ public static String urlEncode(String source, String encode) {
+ String result = source;
+ try {
+ result = URLEncoder.encode(source, encode);
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ /**
+ * 将输入流转换字节数组
+ * @return
+ * @throws IOException
+ */
+ public static byte[] inputStreamToByteArray(InputStream inputStream) throws IOException {
+ return IOUtils.toByteArray(inputStream);
+ }
+
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/util/MD5Util.java b/service/src/main/java/com/hfkj/common/pay/util/MD5Util.java
new file mode 100644
index 0000000..720af70
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/util/MD5Util.java
@@ -0,0 +1,55 @@
+package com.hfkj.common.pay.util;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.security.MessageDigest;
+
+/**
+ * MD5加密工具类
+ *
+ * @author phil
+ * @date 2017年7月2日
+ *
+ */
+public class MD5Util {
+
+ private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d",
+ "e", "f" };
+
+ private static String byteArrayToHexString(byte b[]) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < b.length; i++)
+ buffer.append(byteToHexString(b[i]));
+ return buffer.toString();
+ }
+
+ private static String byteToHexString(byte b) {
+ int n = b;
+ if (n < 0)
+ n += 256;
+ int d1 = n / 16;
+ int d2 = n % 16;
+ return hexDigits[d1] + hexDigits[d2];
+ }
+
+ public static String MD5Encode(String origin, String charsetname) {
+ String resultString = null;
+ try {
+ resultString = new String(origin);
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ if(StringUtils.isEmpty(charsetname)) {
+ resultString = byteArrayToHexString(md.digest(resultString.getBytes("UTF-8")));
+ } else {
+ resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname)));
+ }
+ } catch (Exception exception) {
+
+ }
+ return resultString;
+ }
+
+ public static void main(String args[]) {
+ System.out.println(MD5Encode("ceshi", "gbk"));
+ System.out.println(MD5Encode("ceshi", "utf-8"));
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/util/MyX509TrustManager.java b/service/src/main/java/com/hfkj/common/pay/util/MyX509TrustManager.java
new file mode 100644
index 0000000..6fde0b0
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/util/MyX509TrustManager.java
@@ -0,0 +1,24 @@
+package com.hfkj.common.pay.util;
+
+import javax.net.ssl.X509TrustManager;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+/**
+ * 自定义信任管理器
+ *
+ * @author phil
+ * @date 2017年7月2日
+ */
+class MyX509TrustManager implements X509TrustManager {
+
+ public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
+ }
+
+ public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
+ }
+
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+}
diff --git a/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java b/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java
new file mode 100644
index 0000000..07758e1
--- /dev/null
+++ b/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java
@@ -0,0 +1,358 @@
+package com.hfkj.common.pay.util;
+
+import com.hfkj.common.pay.entity.WechatPayReturnParam;
+import com.hfkj.common.pay.entity.WechatReturn;
+import org.apache.commons.lang3.StringUtils;
+import org.dom4j.DocumentException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.SortedMap;
+
+/**
+ *
+ * @Title:
+ * @Description: 微信支付签名工具类
+ * @author: 魏真峰
+ * @param:
+ * @return:
+ * @throws
+ */
+public class SignatureUtil {
+
+ private static Logger logger = LoggerFactory.getLogger(SignatureUtil.class);
+
+ /**
+ * 将字节数组转换为十六进制字符串
+ * @param byteArray
+ * @return
+ */
+ private static String byteToStr(byte[] byteArray) {
+ String strDigest = "";
+ for (int i = 0; i < byteArray.length; i++) {
+ strDigest += byteToHexStr(byteArray[i]);
+ }
+ return strDigest;
+ }
+
+ /**
+ * 将字节转换为十六进制字符串
+ *
+ * @param mByte
+ * @return
+ */
+ private static String byteToHexStr(byte mByte) {
+ char[] Digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+ char[] tempArr = new char[2];
+ tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
+ tempArr[1] = Digit[mByte & 0X0F];
+ return new String(tempArr);
+ }
+
+ /**
+ * 获取签名
+ *
+ * @param o
+ * 待加密的对象 该处仅限于Class
+ * @return
+ */
+ public static String createSign(Object o, String apiKey, String encoding) {
+ String result = notSignParams(o, apiKey);
+ result = MD5Util.MD5Encode(result, encoding).toUpperCase();
+ return result;
+ }
+
+ /**
+ * 签名算法
+ *
+ * @param o
+ * 要参与签名的数据对象
+ * @param apiKey
+ * API密匙
+ * @return 签名
+ * @throws IllegalAccessException
+ */
+ public static String notSignParams(Object o, String apiKey) {
+ ArrayList list = new ArrayList<>();
+ String result = "";
+ try {
+ Class> cls = o.getClass();
+ Field[] fields = cls.getDeclaredFields();
+ list = getFieldList(fields, o);
+ Field[] superFields = cls.getSuperclass().getDeclaredFields(); // 获取父类的私有属性
+ list.addAll(getFieldList(superFields, o));
+ int size = list.size();
+ String[] arrayToSort = list.toArray(new String[size]);
+ Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); // 严格按字母表顺序排序
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < size; i++) {
+ sb.append(arrayToSort[i]);
+ }
+ result = sb.toString();
+ if (apiKey != null && !"".equals(apiKey)) {
+ result += "key=" + apiKey;
+ } else {
+ result = result.substring(0, result.lastIndexOf("&"));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ /**
+ * 将字段集合方法转换
+ *
+ * @param array
+ * @param object
+ * @return
+ * @throws IllegalArgumentException
+ * @throws IllegalAccessException
+ */
+ private static ArrayList getFieldList(Field[] array, Object object)
+ throws IllegalArgumentException, IllegalAccessException {
+ ArrayList list = new ArrayList();
+ for (Field f : array) {
+ f.setAccessible(true);
+ if (f.get(object) != null && f.get(object) != "" && !f.getName().equals("serialVersionUID")
+ && !f.getName().equals("sign")) {
+ if (f.getName().equals("packageStr")) {
+ list.add("package" + "=" + f.get(object) + "&");
+ } else {
+ list.add(f.getName() + "=" + f.get(object) + "&");
+ }
+ }
+ }
+ return list;
+ }
+
+ /**
+ * 通过Map中的所有元素参与签名
+ *
+ * @param map
+ * 待参与签名的map集合
+ * @params apikey apikey中 如果为空则不参与签名,如果不为空则参与签名
+ * @return
+ */
+ public static String createSign(Map