Browse Source

Merge remote-tracking branch 'origin/dev_thirdplatform' into dev_thirdplatform

dev_shibei_match
sunyuchao 5 years ago
parent
commit
8d21a3cc3f
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  2. 11
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java
  3. 116
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthResultRecordDTO.java
  4. 8
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java
  5. 40
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BindingAccountDTO.java
  6. 96
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BusinessInfoDTO.java
  7. 144
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditRecordDTO.java
  8. 6
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java
  9. 4
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java
  10. 2
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java
  11. 96
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniCategoryInfoDTO.java
  12. 121
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniInfoDTO.java
  13. 96
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniNetworkInfoDTO.java
  14. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenPlatformAccountDTO.java
  15. 129
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaInfoDTO.java
  16. 6
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java
  17. 8
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java
  18. 7
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java
  19. 2
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java
  20. 40
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BindingAccountFormDTO.java
  21. 60
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BusinessInfoFormDTO.java
  22. 115
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeAuditRecordFormDTO.java
  23. 3
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java
  24. 2
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java
  25. 48
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateOpenFormDTO.java
  26. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GoToAuthFormDTO.java
  27. 60
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniCategoryInfoFormDTO.java
  28. 76
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniInfoFormDTO.java
  29. 60
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniNetworkInfoFormDTO.java
  30. 95
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PaInfoFormDTO.java
  31. 3
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java
  32. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthCodeResultDTO.java
  33. 2
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java
  34. 36
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateOpenResultDTO.java
  35. 25
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerIdAndClientResultDTO.java
  36. 45
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GoToAuthResultDTO.java
  37. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateAndAppIdResultDTO.java
  38. 5
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java
  39. 2
      epmet-module/epmet-third/epmet-third-server/pom.xml
  40. 37
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java
  41. 33
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/TencentAuthTypeConstant.java
  42. 35
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java
  43. 6
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java
  44. 7
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java
  45. 34
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java
  46. 39
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java
  47. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java
  48. 6
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java
  49. 23
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java
  50. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java
  51. 27
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java
  52. 41
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java
  53. 44
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BusinessInfoDao.java
  54. 41
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditRecordDao.java
  55. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java
  56. 20
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java
  57. 21
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java
  58. 12
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java
  59. 32
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java
  60. 44
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniCategoryInfoDao.java
  61. 50
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java
  62. 44
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniNetworkInfoDao.java
  63. 34
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java
  64. 42
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaInfoDao.java
  65. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java
  66. 86
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthResultRecordEntity.java
  67. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java
  68. 29
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BindingAccountEntity.java
  69. 66
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BusinessInfoEntity.java
  70. 114
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditRecordEntity.java
  71. 6
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java
  72. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java
  73. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java
  74. 66
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniCategoryInfoEntity.java
  75. 91
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniInfoEntity.java
  76. 66
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniNetworkInfoEntity.java
  77. 17
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenPlatformAccountEntity.java
  78. 99
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaInfoEntity.java
  79. 6
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java
  80. 43
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java
  81. 20
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java
  82. 6
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java
  83. 60
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java
  84. 391
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java
  85. 122
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java
  86. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java
  87. 9
      epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml
  88. 41
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml
  89. 6
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml
  90. 62
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml
  91. 11
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml
  92. 24
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml
  93. 27
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BusinessInfoDao.xml
  94. 35
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditRecordDao.xml
  95. 22
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml
  96. 45
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml
  97. 33
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml
  98. 22
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml
  99. 42
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml
  100. 13
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -49,5 +49,6 @@ public interface NumConstant {
String THREE_STR = "3";
String FOUR_STR = "4";
String FIVE_STR = "5";
String POSITIVE_EIGHT_STR = "+8";
}

11
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java

@ -26,7 +26,7 @@ import lombok.Data;
* 授权回调url反参表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
public class AuthCodeDTO implements Serializable {
@ -43,6 +43,11 @@ public class AuthCodeDTO implements Serializable {
*/
private String customerId;
/**
* resi居民端work工作端
*/
private String clientType;
/**
* 授权方APPID
*/
@ -54,9 +59,9 @@ public class AuthCodeDTO implements Serializable {
private String authCode;
/**
* 有效期 10min
* 到期时间
*/
private Integer expiresIn;
private Date expiresInTime;
/**
*

116
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthResultRecordDTO.java

@ -0,0 +1,116 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 授权结果记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-15
*/
@Data
public class AuthResultRecordDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* resi居民端work工作端
*/
private String clientType;
/**
* 第三方平台AppId 第三方平台AppId
*/
private String componentAppId;
/**
* 微信返回创建时间 微信返回创建时间
*/
private Date wechatCreateTime;
/**
* 通知类型
*/
private String infoType;
/**
* 授权方AppId
*/
private String authorizerAppId;
/**
* 授权码auth_code
*/
private String authorizationCode;
/**
* 授权码过期时间
*/
private Date expiresInTime;
/**
* 预授权码
*/
private String preAuthCode;
/**
* 删除状态
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

8
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java

@ -26,7 +26,7 @@ import lombok.Data;
* 授权信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
public class AuthorizationInfoDTO implements Serializable {
@ -49,14 +49,14 @@ public class AuthorizationInfoDTO implements Serializable {
private String authorizerAppid;
/**
* 接口调用令牌在授权的公众号/小程序具备 API 权限时才有此返回值
* 接口调用令牌在授权的公众号/小程序具备 API 权限时才有此返回值第三方和微信交互使用
*/
private String authorizerAccessToken;
/**
* authorizer_access_token 的有效期在授权的公众号/小程序具备API权限时才有此返回值单位
* 到期时间
*/
private Integer expiresIn;
private Date expiresInTime;
/**
* 刷新令牌在授权的公众号具备API权限时才有此返回值刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token一旦丢失只能让用户重新授权才能再次拿到新的刷新令牌用户重新授权后之前的刷新令牌会失效

40
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/RefreshAuthorizerAccessTokenDTO.java → epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BindingAccountDTO.java

@ -23,68 +23,68 @@ import lombok.Data;
/**
* 获取/刷新接口调用令牌记录
* 公众号/小程序绑定开放平台帐号
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
public class RefreshAuthorizerAccessTokenDTO implements Serializable {
public class BindingAccountDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
* id ID
*/
private String id;
/**
* 授权方令牌
* 开放平台账号ID 开放平台账号ID
*/
private String authorizerAccessToken;
private String openPlatformAccountId;
/**
* 有效期单位
* 公众号/小程序APPID授权方APPID 授权方APPID
*/
private Integer expiresIn;
private String authAppId;
/**
* 刷新令牌
* 客户ID 客户ID
*/
private String authorizerRefreshToken;
private String customerId;
/**
* 授权方APPID
* 客户端 居民端resi工作端work
*/
private String authAppid;
private String clientType;
/**
* 客户ID
*
*/
private String customerId;
private Integer delFlag;
/**
*
* 乐观锁
*/
private Integer delFlag;
private Integer revision;
/**
*
* 创建人
*/
private String createdBy;
/**
*
* 创建时间
*/
private Date createdTime;
/**
*
* 更新人
*/
private String updatedBy;
/**
*
* 更新时间
*/
private Date updatedTime;

96
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BusinessInfoDTO.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 功能开通状况表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
public class BusinessInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 主表ID
*/
private String primaryId;
/**
* 功能类型 open_store是否开通微信门店功能 open_scan是否开通微信扫商品功能 open_pay是否开通微信支付功能 open_card是否开通微信卡券功能 open_shake是否开通微信摇一摇功能
*/
private String funcType;
/**
* 开通状态 0未开通1已开通
*/
private Integer openStatus;
/**
* 删除状态 0:正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

144
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditRecordDTO.java

@ -0,0 +1,144 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 代码审核记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-15
*/
@Data
public class CodeAuditRecordDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 模板ID
*/
private String templateId;
/**
* 客户端类型resi居民端work工作端
*/
private String clientType;
/**
* 授权方AppId
*/
private String authAppId;
/**
* 小程序的原始 ID
*/
private String toUserName;
/**
* 发送方帐号一个 OpenID此时发送方是系统帐号
*/
private String fromUserName;
/**
* 消息创建时间 整型时间戳
*/
private Date wechatCreateTime;
/**
* 消息类型 event
*/
private String msgType;
/**
* 事件类型
weapp_audit_success审核通过
weapp_audit_fail审核不通过
weapp_audit_delay审核延后
*/
private String event;
/**
* 审核成功时的时间戳
*/
private Date succTime;
/**
* 审核不通过的时间戳
*/
private Date failTime;
/**
* 审核延后时的时间戳
*/
private Date delayTime;
/**
* 审核不通过的原因
*/
private String reason;
/**
* 审核不通过的截图示例 | 分隔的 media_id 的列表可通过获取永久素材接口拉取截图内容
*/
private String screenShot;
/**
* 删除状态
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

6
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java

@ -26,7 +26,7 @@ import lombok.Data;
* 第三方平台调用凭证
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
public class ComponentAccessTokenDTO implements Serializable {
@ -44,9 +44,9 @@ public class ComponentAccessTokenDTO implements Serializable {
private String componentAccessToken;
/**
* 令牌有效期 单位s 最长 60*60*2
* 令牌到期时间
*/
private Integer expiresIn;
private Date expiresInTime;
/**
* 删除状态 0正常 1删除

4
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java

@ -26,7 +26,7 @@ import lombok.Data;
* 微信发送的ticket表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-08
* @since v1.0.0 2020-07-14
*/
@Data
public class ComponentVerifyTicketDTO implements Serializable {
@ -41,7 +41,7 @@ public class ComponentVerifyTicketDTO implements Serializable {
/**
* 第三方平台ID
*/
private String appid;
private String componentAppId;
/**
* component_verify_ticket

2
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java

@ -26,7 +26,7 @@ import lombok.Data;
* 授权给开发者的权限集列表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
public class FuncInfoDTO implements Serializable {

96
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniCategoryInfoDTO.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 小程序配置类目信息表 小程序配置类目信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
public class MiniCategoryInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 主表ID
*/
private String primaryId;
/**
* 类目排序 first , second
*/
private String categorySort;
/**
* 类目名称 资讯文娱......
*/
private String categoryName;
/**
* 删除状态
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

121
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniInfoDTO.java

@ -0,0 +1,121 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 小程序信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
public class MiniInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 昵称
*/
private String nickName;
/**
* 头像
*/
private String headImg;
/**
* 小程序类型 默认为 0
*/
private String serviceTypeInfo;
/**
* 小程序认证类型 小程序认证类型
*/
private String verifyTypeInfo;
/**
* 原始 ID
*/
private String userName;
/**
* 主体名称
*/
private String principalName;
/**
* 账号介绍
*/
private String signature;
/**
* 二维码图片的 URL
*/
private String qrcodeUrl;
/**
* 删除状态 0正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

96
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniNetworkInfoDTO.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 小程序配置合法域名信息表 小程序配置合法域名信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
public class MiniNetworkInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 主表ID
*/
private String primaryId;
/**
* 类型
*/
private String networkType;
/**
* 域名 RequestDomainWsRequestDomainUploadDomainDownloadDomain
*/
private String url;
/**
* 删除状态
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

26
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizerRefreshTokenDTO.java → epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenPlatformAccountDTO.java

@ -23,35 +23,41 @@ import lombok.Data;
/**
* 授权方的刷新令牌表
* 开放平台账号表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
public class AuthorizerRefreshTokenDTO implements Serializable {
public class OpenPlatformAccountDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
* id ID
*/
private String id;
/**
* 授权方的刷新令牌
* openId 所创建的开放平台帐号的 appid
*/
private String openAppId;
/**
* 客户ID 客户ID
*/
private String authorizerRefreshToken;
private String customerId;
/**
* 授权方appid
*
*/
private String authorizerAppid;
private Integer delFlag;
/**
* 删除标识 0-1-
* 乐观锁
*/
private String delFlag;
private Integer revision;
/**
* 创建人

129
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaInfoDTO.java

@ -0,0 +1,129 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 公众号信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
public class PaInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 昵称
*/
private String nickName;
/**
* 头像
*/
private String headImg;
/**
* 公众号类型 0订阅号
1由历史老帐号升级后的订阅号
2服务号
*/
private String serviceTypeInfo;
/**
* 公众号认证类型 -1未认证
0微信认证
1新浪微博认证
2腾讯微博认证
3已资质认证通过但还未通过名称认证
4已资质认证通过还未通过名称认证但通过了新浪微博认证
5已资质认证通过还未通过名称认证但通过了腾讯微博认证
*/
private String verifyTypeInfo;
/**
* 原始ID
*/
private String userName;
/**
* 主体名称
*/
private String principalName;
/**
* 公众号所设置的微信号可能为空 公众号所设置的微信号可能为空
*/
private String alias;
/**
* 二维码图片的 URL
*/
private String qrcodeUrl;
/**
* 删除状态 0正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

6
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java

@ -26,7 +26,7 @@ import lombok.Data;
* 预授权码历史记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
public class PreAuthTokenDTO implements Serializable {
@ -44,9 +44,9 @@ public class PreAuthTokenDTO implements Serializable {
private String preAuthToken;
/**
* 预授权码有效期 单位s 最长 60*60*2
* 预授权码有效期
*/
private Integer expiresIn;
private Date expiresInTime;
/**
* 删除状态 0正常 1删除

8
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
@ -18,6 +19,11 @@ public class AuthCodeFormDTO implements Serializable {
*/
private String customerId;
/**
* resi居民端work工作端
*/
private String clientType;
/**
* 授权方AppId
*/
@ -31,7 +37,7 @@ public class AuthCodeFormDTO implements Serializable {
/**
* 有效期 10min
*/
private Integer expiresIn;
private Date expiresInTime;
/**
* 删除状态 0正常 1已删除

7
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
@ -31,7 +32,7 @@ public class AuthorizationInfoFormDTO implements Serializable {
/**
* authorizer_access_token 的有效期在授权的公众号/小程序具备API权限时才有此返回值单位
*/
private Integer expiresIn;
private Date expiresInTime;
/**
* 刷新令牌在授权的公众号具备API权限时才有此返回值刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token一旦丢失只能让用户重新授权才能再次拿到新的刷新令牌用户重新授权后之前的刷新令牌会失效
@ -39,8 +40,10 @@ public class AuthorizationInfoFormDTO implements Serializable {
private String authorizerRefreshToken;
/**
*
* 客户端类型 resi居民端work工作端
*/
private String clientType;
private Integer delFlag = 0;
private String createdBy = "APP_USER";

2
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java

@ -22,7 +22,7 @@ public class AuthorizerAccessTokenFormDTO implements Serializable {
/**
* 有效期单位
*/
private Integer expiresIn;
private Date expiresInTime;
/**
* 刷新令牌

40
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BindingAccountFormDTO.java

@ -0,0 +1,40 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/13 17:58
*/
@Data
public class BindingAccountFormDTO implements Serializable {
private static final long serialVersionUID = 7969402941219659678L;
/**
* 开放平台账号ID 开放平台账号ID
*/
private String openPlatformAccountId;
/**
* 公众号/小程序APPID授权方APPID 授权方APPID
*/
private String authAppId;
/**
* 客户ID 客户ID
*/
private String customerId;
/**
* 客户端 居民端resi工作端work
*/
private String clientType;
private Integer delFlag = 0;
private Integer revision = 0;
private String createdBy = "APP_USER";
private String updatedBy = "APP_USER";
}

60
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BusinessInfoFormDTO.java

@ -0,0 +1,60 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/14 15:54
*/
@Data
public class BusinessInfoFormDTO implements Serializable {
private static final long serialVersionUID = 570372083578341740L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 主表ID
*/
private String primaryId;
/**
* 功能类型 open_store是否开通微信门店功能 open_scan是否开通微信扫商品功能 open_pay是否开通微信支付功能 open_card是否开通微信卡券功能 open_shake是否开通微信摇一摇功能
*/
private String funcType;
/**
* 开通状态 0未开通1已开通
*/
private Integer openStatus;
/**
* 删除状态 0:正常1删除
*/
private Integer delFlag = 0;
/**
* 乐观锁
*/
private Integer revision = 0;
/**
* 创建人
*/
private String createdBy = "APP_USER";
/**
* 更新人
*/
private String updatedBy = "APP_USER";
}

115
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeAuditRecordFormDTO.java

@ -0,0 +1,115 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @CreateTime 2020/7/15 14:13
*/
@Data
public class CodeAuditRecordFormDTO implements Serializable {
private static final long serialVersionUID = 2295533266066734315L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 模板ID
*/
private String templateId;
/**
* 客户端类型resi居民端work工作端
*/
private String clientType;
/**
* 授权方AppId
*/
private String authAppId;
/**
* 小程序的原始 ID
*/
private String toUserName;
/**
* 发送方帐号一个 OpenID此时发送方是系统帐号
*/
private String fromUserName;
/**
* 消息创建时间 整型时间戳
*/
private Date wechatCreateTime;
/**
* 消息类型 event
*/
private String msgType;
/**
* 事件类型
weapp_audit_success审核通过
weapp_audit_fail审核不通过
weapp_audit_delay审核延后
*/
private String event;
/**
* 审核成功时的时间戳
*/
private Date succTime;
/**
* 审核不通过的时间戳
*/
private Date failTime;
/**
* 审核延后时的时间戳
*/
private Date delayTime;
/**
* 审核不通过的原因
*/
private String reason;
/**
* 审核不通过的截图示例 | 分隔的 media_id 的列表可通过获取永久素材接口拉取截图内容
*/
private String screenShot;
/**
* 删除状态
*/
private Integer delFlag = 0;
/**
* 乐观锁
*/
private Integer revision = 0;
/**
* 创建人
*/
private String createdBy = "APP_USER";
/**
* 更新人
*/
private String updatedBy = "APP_USER";
}

3
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
@ -21,7 +22,7 @@ public class ComponentAccessTokenFormDTO implements Serializable {
/**
* 令牌有效期 单位s 最长 60*60*2
*/
private Integer expiresIn;
private Date expiresInTime;
/**
* 删除状态 0正常 1删除

2
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java

@ -22,7 +22,7 @@ public class ComponentVerifyTicketFormDTO implements Serializable {
/**
* 第三方平台ID
*/
private String appid;
private String componentAppId;
/**
* component_verify_ticket

48
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateOpenFormDTO.java

@ -0,0 +1,48 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/13 17:36
*/
@Data
public class CreateOpenFormDTO implements Serializable {
private static final long serialVersionUID = 7656834022953140875L;
private String id;
/**
* openId 所创建的开放平台帐号的 appid
*/
private String openid;
/**
* 客户ID 客户ID
*/
private String customerId;
/**
* 乐观锁
*/
private Integer revision = 0;
/**
* 创建者
*/
private String createdBy = "APP_USER";
/**
* 修改者
*/
private String updatedBy = "APP_USER";
/**
* 是否已删除(0-未删除1-已删除)
*/
private String delFlag = "0";
}

26
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GoToAuthFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/13 10:30
*/
@Data
public class GoToAuthFormDTO implements Serializable {
private static final long serialVersionUID = 4171794043794295829L;
public interface GoToAuth extends CustomerClientShowGroup{}
/**
* 客户端类型 resi居民端 work工作端
*/
@NotBlank(message = "客户端类型不能为空",groups = {GoToAuth.class})
private String clientType;
}

60
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniCategoryInfoFormDTO.java

@ -0,0 +1,60 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/14 15:53
*/
@Data
public class MiniCategoryInfoFormDTO implements Serializable {
private static final long serialVersionUID = 9211011906485259736L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 主表ID
*/
private String primaryId;
/**
* 类目排序 first , second
*/
private String categorySort;
/**
* 类目名称 资讯文娱......
*/
private String categoryName;
/**
* 删除状态
*/
private Integer delFlag = 0;
/**
* 乐观锁
*/
private Integer revision = 0;
/**
* 创建人
*/
private String createdBy = "APP_USER";
/**
* 更新人
*/
private String updatedBy = "APP_USER";
}

76
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniInfoFormDTO.java

@ -0,0 +1,76 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/14 15:20
*/
@Data
public class MiniInfoFormDTO implements Serializable {
private static final long serialVersionUID = 2970966756786695782L;
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 昵称
*/
private String nickName;
/**
* 头像
*/
private String headImg;
/**
* 小程序类型 默认为 0
*/
private String serviceTypeInfo;
/**
* 小程序认证类型 小程序认证类型
*/
private String verifyTypeInfo;
/**
* 原始 ID
*/
private String userName;
/**
* 主体名称
*/
private String principalName;
/**
* 账号介绍
*/
private String signature;
/**
* 二维码图片的 URL
*/
private String qrcodeUrl;
private Integer delFlag = 0;
private Integer revision = 0;
private String createdBy = "APP_USER";
private String updatedBy = "APP_USER";
}

60
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniNetworkInfoFormDTO.java

@ -0,0 +1,60 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/14 15:52
*/
@Data
public class MiniNetworkInfoFormDTO implements Serializable {
private static final long serialVersionUID = -2171502778870475956L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 主表ID
*/
private String primaryId;
/**
* 类型
*/
private String networkType;
/**
* 域名 RequestDomainWsRequestDomainUploadDomainDownloadDomain
*/
private String url;
/**
* 删除状态
*/
private Integer delFlag = 0;
/**
* 乐观锁
*/
private Integer revision = 0;
/**
* 创建人
*/
private String createdBy = "APP_USER";
/**
* 更新人
*/
private String updatedBy = "APP_USER";
}

95
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PaInfoFormDTO.java

@ -0,0 +1,95 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/14 15:27
*/
@Data
public class PaInfoFormDTO implements Serializable {
private static final long serialVersionUID = 2495498009170200556L;
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 昵称
*/
private String nickName;
/**
* 头像
*/
private String headImg;
/**
* 公众号类型 0订阅号
1由历史老帐号升级后的订阅号
2服务号
*/
private String serviceTypeInfo;
/**
* 公众号认证类型 -1未认证
0微信认证
1新浪微博认证
2腾讯微博认证
3已资质认证通过但还未通过名称认证
4已资质认证通过还未通过名称认证但通过了新浪微博认证
5已资质认证通过还未通过名称认证但通过了腾讯微博认证
*/
private String verifyTypeInfo;
/**
* 原始ID
*/
private String userName;
/**
* 主体名称
*/
private String principalName;
/**
* 公众号所设置的微信号可能为空 公众号所设置的微信号可能为空
*/
private String alias;
/**
* 二维码图片的 URL
*/
private String qrcodeUrl;
/**
* 删除状态 0正常1删除
*/
private Integer delFlag = 0;
/**
* 乐观锁
*/
private Integer revision = 0;
/**
* 创建人
*/
private String createdBy = "APP_USER";
/**
* 更新人
*/
private String updatedBy = "APP_USER";
}

3
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
@ -21,7 +22,7 @@ public class PreAuthTokenFormDTO implements Serializable {
/**
* 预授权码有效期 单位s 最长 60*60*2
*/
private Integer expiresIn;
private Date expiresInTime;
/**
* 删除状态 0正常 1删除

26
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthCodeResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/15 10:00
*/
@Data
public class AuthCodeResultDTO implements Serializable {
private static final long serialVersionUID = 4642988014737245076L;
/**
* 客户Id
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
}

2
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java

@ -29,7 +29,7 @@ public class AuthorizationInfoResultDTO implements Serializable {
/**
* authorizer_access_token 的有效期在授权的公众号/小程序具备API权限时才有此返回值单位
*/
private Integer expires_in;
private String expires_in;
/**
* 刷新令牌在授权的公众号具备API权限时才有此返回值刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token

36
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateOpenResultDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/13 16:17
*/
@Data
public class CreateOpenResultDTO implements Serializable {
private static final long serialVersionUID = -7130231978776634403L;
private String id;
/**
* 所创建的开放平台帐号的 appid
*/
private String openAppId;
/**
* 错误信息
*/
private String errMsg;
/**
* 返回码
* 0ok
* -1system error 系统错误
* 40013invalid appid appid 无效
* 89000account has bound open 该公众号/小程序 已经绑定了开放平台帐号
*/
private Integer errCode;
}

25
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerIdAndClientResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/15 15:44
*/
@Data
public class CustomerIdAndClientResultDTO implements Serializable {
private static final long serialVersionUID = -7427184790539679353L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型
*/
private String clientType;
}

45
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GoToAuthResultDTO.java

@ -0,0 +1,45 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/10 15:55
*/
@Data
public class GoToAuthResultDTO implements Serializable {
private static final long serialVersionUID = -8759961913652933215L;
/**
* 第三方AppId
*/
@JsonIgnore
private String componentAppId;
/**
* 预授权码
*/
@JsonIgnore
private String preAuthCode;
/**
* 回调地址获取 授权码和过期时间
*/
@JsonIgnore
private String redirectUri;
/**
* 客户ID
*/
@JsonIgnore
private String customerId;
/**
* 反参拼好的url包括回调地址
*/
private String url;
}

26
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateAndAppIdResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @CreateTime 2020/7/15 15:56
*/
@Data
public class TemplateAndAppIdResultDTO implements Serializable {
private static final long serialVersionUID = -3875904833509300177L;
/**
* 模板ID
*/
private String templateId;
/**
* 授权方AppId
*/
private String authAppId;
}

5
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java

@ -33,5 +33,10 @@ public class WillOverDueResultDTO implements Serializable {
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
}

2
epmet-module/epmet-third/epmet-third-server/pom.xml

@ -176,7 +176,7 @@
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr>
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>

37
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java

@ -16,7 +16,10 @@ public interface ModuleConstant {
String INFO_TYPE = "InfoType";
String TICKET_UNDERLINE_KEY = "component_verify_ticket";
String TICKET_KEY = "ComponentVerifyTicket";
String APP_ID = "AppId";
String AUTHORIZATION_CODE_HUMP = "AuthorizationCode";
String UNAUTHORIZED = "unauthorized";
String AUTHORIZED = "authorized";
String NULL_CHAR = "";
String SUCCESS = "success";
@ -40,6 +43,40 @@ public interface ModuleConstant {
//授权回调URL 如下
String AUTH_CODE = "auth_code";
String ERR_CODE = "errcode";
String ERR_MSG = "errmsg";
String OPEN_APP_ID = "open_appid";
String LOW_APP_ID = "appid";
String CUSTOMER_ID = "customerId";
String CLIENT = "client";
//创建开放平台账号
String ACCESS_TOKEN = "access_token";
//获取并保存授权方账号基本信息 如下
String COMPONENT_APP_ID = "component_appid";
String AUTHORIZER_APP_ID = "authorizer_appid";
String AUTHORIZER_INFO = "authorizer_info";
String MINI_PROGRAM_INFO = "miniprograminfo";
String BUSINESS_INFO = "business_info";
String CATEGORIES = "categories";
String NETWORK = "network";
//代码审核结果推送 如下
String EVENT = "Event";
String WEAPP_AUDIT_SUCCESS = "weapp_audit_success"; //审核通过
String WEAPP_AUDIT_FAIL = "weapp_audit_fail"; //审核不通过
String WEAPP_AUDIT_DELAY = "weapp_audit_delay"; //审核延后
String DELAY = "delay";
String AUDIT_SUCCESS = "audit_success";
String AUDIT_FAILED = "audit_failed";
int FORTY_THOUSAND_AND_THIRTEEN = 40013;
int EIGHTY_NINE_THOUSAND = 89000;
int EIGHTY_NINE_THOUSAND_AND_ONE = 89001;
int EIGHTY_NINE_THOUSAND_AND_THREE = 89003;
int EIGHTY_NINE_THOUSAND_AND_FOUR = 89004;
}

33
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/TencentAuthTypeConstant.java

@ -0,0 +1,33 @@
package com.epmet.constant;
/**
* @Author zxc
* @CreateTime 2020/7/13 9:08
*/
public interface TencentAuthTypeConstant {
/**
* 公众号认证类型
*/
String AUTH_MINUS_ONE = "未认证";
String AUTH_ZERO = "微信认证";
String AUTH_ONE = "新浪微博认证";
String AUTH_TWO = "腾讯微博认证";
String AUTH_THREE = "已资质认证通过但还未通过名称认证";
String AUTH_FOUR = "已资质认证通过、还未通过名称认证,但通过了新浪微博认证";
String AUTH_FIVE = "已资质认证通过、还未通过名称认证,但通过了腾讯微博认证";
/**
* 公众号类型
*/
String ZERO = "订阅号";
String ONE = "由历史老帐号升级后的订阅号";
String TWO = "服务号";
/**
* 小程序认证类型
*/
String MINI_AUTH_MINUS_ONE = "未认证";
String MINI_AUTH_ZERO = "微信认证";
}

35
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java

@ -7,7 +7,7 @@ package com.epmet.constant;
public interface ThirdApiConstant {
/**
*
* 获取预授权码
*/
String API_CREATE_PREAUTHCODE_URL = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode";
@ -23,4 +23,37 @@ public interface ThirdApiConstant {
String API_AUTHORIZER_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token";
/**
* 授权回调url
*/
String API_REDIRECT_URL = "https://epmet-dev.elinkservice.cn/api/third/redirectauthcode";
/**
* 反参授权回调url
*/
String API_RETURN_REDIRECT_URL = "https://epmet-dev.elinkservice.cn/api/third/redirectauthcode?client=%s&customerId=%s";
/**
* 授权注册页面扫码授权
* component_appid:第三方AppId
* pre_auth_code预授权码
* redirect_uri回调url获取授权码
*/
String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s";
/**
* 创建开放平台帐号并绑定公众号/小程序
*/
String API_CREATE_OPEN = "https://api.weixin.qq.com/cgi-bin/open/create";
/**
* 公众号/小程序绑定到开放平台帐号下
*/
String API_BIND_OPEN = "https://api.weixin.qq.com/cgi-bin/open/bind?";
/**
* 获取授权方的帐号基本信息
*/
String API_GET_AUTHORIZER_INFO = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info";
}

6
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java

@ -9,12 +9,12 @@ public interface ThirdPlatformConstant {
/**
* 第三方平台appId
*/
String PLATFORM_APP_ID = "****************";
// String PLATFORM_APP_ID = "****************";
/**
* 第三方平台 secret
*/
String PLATFORM_APP_SECRET = "****************";
// String PLATFORM_APP_SECRET = "****************";
/**
* 第三方平台 消息加解密Key
@ -24,6 +24,6 @@ public interface ThirdPlatformConstant {
/**
* 第三方平台 消息校验Token
*/
String PLATFORM_COMPONENT_TOKEN = "****************";
// String PLATFORM_COMPONENT_TOKEN = "****************";
}

7
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java

@ -27,7 +27,12 @@ public interface ThirdRedisKeyConstant {
String ACCESS_TOKEN_REDIS_KEY = "epmet:wechartthird:componentaccesstoken";
/**
* authorizer_refresh_token 刷新令牌获取授权信息时得到
* authorizer_refresh_token 刷新令牌获取授权信息时得到 第三方和微信交互使用的
*/
String THIRD_AUTHORIZER_REFRESH_TOKEN_REDIS_KEY = "epmet:wechartthird:thirdauthorizerrefreshtoken";
/**
* 第三方 授权方交互使用的
*/
String AUTHORIZER_REFRESH_TOKEN_REDIS_KEY = "epmet:wechartthird:authorizerrefreshtoken";

34
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java

@ -46,4 +46,38 @@ public interface ThirdRunTimeInfoConstant {
String END_GET_AUTH_INFO = "=====================结束获取【authorization_info】=====================";
String CREATE_AND_BIND_SUCCESS = "创建开放平台帐号并绑定公众号/小程序";
String BIND_SUCCESS = "绑定公众号/小程序到开放平台";
/**
* 对应错误码-1
*/
String SYSTEM_ERROR = "系统错误";
/**
* 对应错误码40013
*/
String INVALID_APP_ID = "appId 或 openAppId 无效";
/**
* 对应错误码89000
*/
String ACCOUNT_HAS_BOUND_OPEN = "该公众号/小程序 已经绑定了开放平台帐号";
/**
* 对应错误码89001
*/
String NOT_SAME_CONTRACTOR = "Authorizer 与开放平台帐号主体不相同";
/**
* 对应错误码89003
*/
String NOT_ALLOWED_OPERATE = "该开放平台帐号并非通过 api 创建,不允许操作";
/**
* 对应错误码89004
*/
String TO_LIMIT = "该开放平台帐号所绑定的公众号/小程序已达上限(100 个)";
}

39
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java

@ -0,0 +1,39 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.GoToAuthFormDTO;
import com.epmet.dto.result.GoToAuthResultDTO;
import com.epmet.service.AppLetAuthorizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author zxc
* @CreateTime 2020/7/10 15:48
*/
@RestController
@RequestMapping("auth")
public class AppLetAuthorizationController {
@Autowired
private AppLetAuthorizationService appLetAuthorizationService;
/**
* @Description 小程序点击去授权的时候
* @param tokenDto
* @author zxc
*/
@PostMapping("gotoauth")
public Result<GoToAuthResultDTO> goToAuth(@LoginUser TokenDto tokenDto, @RequestBody GoToAuthFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
GoToAuthResultDTO goToAuthResultDTO = appLetAuthorizationService.goToAuth(tokenDto,formDTO);
return new Result().ok(goToAuthResultDTO);
}
}

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java

@ -1,12 +1,10 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.ComponentVerifyTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@ -28,8 +26,9 @@ public class AuthRedirectController {
* @param
* @author zxc
*/
public Result redirectUri(HttpServletRequest request, HttpServletResponse response, @LoginUser TokenDto tokenDto, @RequestParam("authAppId")String authAppId){
componentVerifyTicketService.redirectUri(request,response,tokenDto,authAppId);
@GetMapping("redirect")
public Result redirectUri(HttpServletRequest request, HttpServletResponse response){
componentVerifyTicketService.redirectUri(request,response);
return new Result();
}

6
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java

@ -2,6 +2,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.ComponentVerifyTicketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -9,6 +10,7 @@ import org.springframework.web.bind.annotation.*;
* @Author zxc
* @CreateTime 2020/7/8 15:06
*/
@Slf4j
@RestController
@RequestMapping("wechatthird")
public class WeChatNotifyController {
@ -24,7 +26,9 @@ public class WeChatNotifyController {
*/
@PostMapping("componentaccesstoken")
public Result getComponentAccessToken() {
log.info("开始获取【component_access_token】......");
componentVerifyTicketService.getComponentAccessToken();
log.info("已成功获取到【component_access_token】......");
return new Result();
}
@ -45,7 +49,9 @@ public class WeChatNotifyController {
*/
@PostMapping("refreshtoken")
public Result refreshToken(){
log.info("开始刷新/获取接口调用令牌......");
componentVerifyTicketService.refreshToken();
log.info("刷新/获取接口调用令牌......成功了");
return new Result();
}

23
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java

@ -19,8 +19,10 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.AuthCodeFormDTO;
import com.epmet.dto.result.AuthCodeResultDTO;
import com.epmet.entity.AuthCodeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 授权回调url反参表
@ -31,6 +33,27 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AuthCodeDao extends BaseDao<AuthCodeEntity> {
/**
* @Description 插入 授权码
* @param formDTO
* @author zxc
*/
void insertRedirectAuthCode(AuthCodeFormDTO formDTO);
/**
* @Description 根据authCode查询客户ID和客户端类型
* @param authCode
* @author zxc
*/
AuthCodeResultDTO selectCustomerIdByAuthCode(@Param("authCode")String authCode);
/**
* @Description 回填 auth_code表 authAppId
* @param customerId
* @param clientType
* @param authAppId
* @author zxc
*/
void updateAppId(@Param("customerId")String customerId,@Param("clientType")String clientType,@Param("authAppId")String authAppId);
}

8
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizerRefreshTokenDao.java → epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java

@ -18,16 +18,16 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.AuthorizerRefreshTokenEntity;
import com.epmet.entity.AuthResultRecordEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 授权方的刷新令牌表
* 授权结果记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-08
* @since v1.0.0 2020-07-15
*/
@Mapper
public interface AuthorizerRefreshTokenDao extends BaseDao<AuthorizerRefreshTokenEntity> {
public interface AuthResultRecordDao extends BaseDao<AuthResultRecordEntity> {
}

27
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java

@ -19,10 +19,14 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.AuthorizationInfoFormDTO;
import com.epmet.dto.form.AuthorizerAccessTokenFormDTO;
import com.epmet.dto.result.WillOverDueResultDTO;
import com.epmet.entity.AuthorizationInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 授权信息表
*
@ -44,6 +48,27 @@ public interface AuthorizationInfoDao extends BaseDao<AuthorizationInfoEntity> {
* @param customerId
* @author zxc
*/
void updateOldAuthorizationInfo(@Param("customerId")String customerId);
void updateOldAuthorizationInfo(@Param("customerId")String customerId,@Param("clientType")String clientType);
/**
* @Description 查询即将过期的 authorizer_access_token
* @param
* @author zxc
*/
List<WillOverDueResultDTO> checkWillOverDue();
/**
* @Description 插入 authorizer_access_token
* @param refreshAccessToken
* @author zxc
*/
void insertAuthorizerAccessToken(AuthorizerAccessTokenFormDTO refreshAccessToken);
/**
* @Description 逻辑删除 授权方的authorizer_access_token
* @param customerId
* @author zxc
*/
void updateOldAuthorizerAccessToken(@Param("customerId")String customerId,@Param("clientType")String clientType);
}

41
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java

@ -0,0 +1,41 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.BindingAccountFormDTO;
import com.epmet.entity.BindingAccountEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 公众号/小程序绑定开放平台帐号表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-13
*/
@Mapper
public interface BindingAccountDao extends BaseDao<BindingAccountEntity> {
/**
* @Description 插入 公众号/小程序绑定开放平台帐号表
* @param formDTO
* @author zxc
*/
void insertBindingAccount(BindingAccountFormDTO formDTO);
}

44
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BusinessInfoDao.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.BusinessInfoFormDTO;
import com.epmet.entity.BusinessInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 功能开通状况表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-13
*/
@Mapper
public interface BusinessInfoDao extends BaseDao<BusinessInfoEntity> {
/**
* @Description 功能开通信息插入
* @param businessInfoList
* @author zxc
*/
void insertBusinessInfo(@Param("businessInfoList") List<BusinessInfoFormDTO> businessInfoList);
}

41
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditRecordDao.java

@ -0,0 +1,41 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.CodeAuditRecordFormDTO;
import com.epmet.entity.CodeAuditRecordEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 代码审核记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-15
*/
@Mapper
public interface CodeAuditRecordDao extends BaseDao<CodeAuditRecordEntity> {
/**
* @Description 插入代码审核结果
* @param formDTO
* @author zxc
*/
void insertCodeAuditRecord(CodeAuditRecordFormDTO formDTO);
}

13
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java

@ -20,14 +20,23 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.CodeAuditResultEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 代码审核j结果
* 代码审核结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Mapper
public interface CodeAuditResultDao extends BaseDao<CodeAuditResultEntity> {
/**
* @Description 更新 代码审核结果中的审核状态
* @param customerId
* @param codeCustomerId
* @author zxc
*/
void updateAuditResult(@Param("customerId")String customerId,@Param("codeCustomerId")String codeCustomerId,@Param("codeResult")String codeResult);
}

20
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java

@ -18,8 +18,11 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.CodeAuditRecordFormDTO;
import com.epmet.dto.result.TemplateAndAppIdResultDTO;
import com.epmet.entity.CodeCustomerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 客户代码关联表
@ -29,5 +32,20 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CodeCustomerDao extends BaseDao<CodeCustomerEntity> {
/**
* @Description 根据客户id和客户端类型获取 代码模板ID和授权方AppId
* @param customerId
* @param clientType
* @author zxc
*/
TemplateAndAppIdResultDTO selectTemplateAndAppId(@Param("customerId")String customerId,@Param("clientType")String clientType);
/**
* @Description 查询 code_customer 表ID
* @param codeAuditRecord
* @author zxc
*/
String selectCodeCustomerId(CodeAuditRecordFormDTO codeAuditRecord);
}

21
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java

@ -22,6 +22,8 @@ import com.epmet.dto.form.ComponentAccessTokenFormDTO;
import com.epmet.entity.ComponentAccessTokenEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 第三方平台调用凭证
*
@ -38,6 +40,25 @@ public interface ComponentAccessTokenDao extends BaseDao<ComponentAccessTokenEnt
*/
void insertComponentAccessToken(ComponentAccessTokenFormDTO formDTO);
/**
* @Description 逻辑删除旧的 component_access_token信息
* @param
* @author zxc
*/
void updateOldComponentAccessToken();
/**
* @Description 查询component_access_token 数量
* @param
* @author zxc
*/
Integer selectAccessTokenCount();
/**
* @Description 查询即将过期component_access_token的数量
* @param
* @author zxc
*/
Integer selectWillOverTokenCount();
}

12
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java

@ -31,6 +31,18 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ComponentVerifyTicketDao extends BaseDao<ComponentVerifyTicketEntity> {
/**
* @Description 插入 票据component_verify_ticket
* @param formDTO
* @author zxc
*/
void insertComponentVerifyTicket(ComponentVerifyTicketFormDTO formDTO);
/**
* @Description 逻辑删除 component_verify_ticket
* @param
* @author zxc
*/
void updateOldComponentVerifyTicket();
}

32
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java

@ -19,11 +19,13 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerMpDTO;
import com.epmet.dto.form.AuthCodeFormDTO;
import com.epmet.entity.CustomerMpEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Param;
/**
* 客户小程序关系表
@ -49,4 +51,34 @@ public interface CustomerMpDao extends BaseDao<CustomerMpEntity> {
* @Description 查询所有客户小程序的授权信息
**/
List<CustomerMpDTO> selectAll();
/**
* @Description 查询授权的数量
* @param customerId
* @author zxc
*/
Integer selectAuthCount(@Param("customerId")String customerId);
/**
* @Description 回填customer_mp的appId
* @param formDTO
* @author zxc
*/
void updateAppIDByCustomerIdAndClient(AuthCodeFormDTO formDTO);
/**
* @Description 修改小程序授权的状态
* @param authAppId
* @author zxc
*/
void updateAuthorizationFlag(@Param("authAppId")String authAppId);
/**
* @Description 根据 客户Id和授权方AppId查询clientType
* @param customerId
* @param authAppId
* @author zxc
*/
String selectClientTypeByCustomerIdAndAuthId(@Param("customerId")String customerId,@Param("authAppId")String authAppId);
}

44
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniCategoryInfoDao.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.MiniCategoryInfoFormDTO;
import com.epmet.entity.MiniCategoryInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小程序配置类目信息表 小程序配置类目信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-13
*/
@Mapper
public interface MiniCategoryInfoDao extends BaseDao<MiniCategoryInfoEntity> {
/**
* @Description 小程序配置的类目信息插入
* @param miniCategoryInfoList
* @author zxc
*/
void insertCategoryInfo(@Param("miniCategoryInfoList") List<MiniCategoryInfoFormDTO> miniCategoryInfoList);
}

50
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java

@ -0,0 +1,50 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.MiniInfoFormDTO;
import com.epmet.dto.result.CustomerIdAndClientResultDTO;
import com.epmet.entity.MiniInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 小程序信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-13
*/
@Mapper
public interface MiniInfoDao extends BaseDao<MiniInfoEntity> {
/**
* @Description 插入小程序信息
* @param formDTO
* @author zxc
*/
void insertMiniInfo(MiniInfoFormDTO formDTO);
/**
* @Description 根据原始ID查询 customerId clientType
* @param toUserName
* @author zxc
*/
CustomerIdAndClientResultDTO selectCustomerIdAndClientByToUserName(@Param("toUserName")String toUserName);
}

44
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniNetworkInfoDao.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.MiniNetworkInfoFormDTO;
import com.epmet.entity.MiniNetworkInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小程序配置合法域名信息表 小程序配置合法域名信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-13
*/
@Mapper
public interface MiniNetworkInfoDao extends BaseDao<MiniNetworkInfoEntity> {
/**
* @Description 小程序配置的合法域名信息插入
* @param networkInfoList
* @author zxc
*/
void insertNetworkInfo(@Param("networkInfoList") List<MiniNetworkInfoFormDTO> networkInfoList);
}

34
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java → epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java

@ -18,42 +18,34 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.AuthorizerAccessTokenFormDTO;
import com.epmet.dto.result.WillOverDueResultDTO;
import com.epmet.entity.RefreshAuthorizerAccessTokenEntity;
import com.epmet.dto.form.CreateOpenFormDTO;
import com.epmet.dto.result.CreateOpenResultDTO;
import com.epmet.entity.OpenPlatformAccountEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 获取/刷新接口调用令牌记录表
* 开放平台账号表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-08
* @since v1.0.0 2020-07-13
*/
@Mapper
public interface RefreshAuthorizerAccessTokenDao extends BaseDao<RefreshAuthorizerAccessTokenEntity> {
public interface OpenPlatformAccountDao extends BaseDao<OpenPlatformAccountEntity> {
/**
* @Description 查询即将过期的 authorizer_access_token
* @param
* @Description 插入开放平台账号
* @param coForm
* @author zxc
*/
List<WillOverDueResultDTO> checkWillOverDue();
void insertOpenPlatFormAccount(CreateOpenFormDTO coForm);
/**
* @Description 插入 authorizer_access_token
* @param refreshAccessToken
* @author zxc
*/
void insertAuthorizerAccessToken(AuthorizerAccessTokenFormDTO refreshAccessToken);
/**
* @Description 逻辑删除 授权方的authorizer_access_token
* @Description 根据客户Id查询已绑定开放平台的账号ID
* @param customerId
* @author zxc
*/
void updateOldAuthorizerAccessToken(@Param("customerId")String customerId);
String selectOpenAppIdByCustomerId(@Param("customerId")String customerId);
}

42
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaInfoDao.java

@ -0,0 +1,42 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.PaInfoFormDTO;
import com.epmet.entity.PaInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 公众号信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-13
*/
@Mapper
public interface PaInfoDao extends BaseDao<PaInfoEntity> {
/**
* @Description 公众号信息插入
* @param formDTO
* @author zxc
*/
void insertPaInfo(PaInfoFormDTO formDTO);
}

11
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 授权回调url反参表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -43,6 +43,11 @@ public class AuthCodeEntity extends BaseEpmetEntity {
*/
private String customerId;
/**
* resi居民端work工作端
*/
private String clientType;
/**
* 授权方APPID
*/
@ -54,8 +59,8 @@ public class AuthCodeEntity extends BaseEpmetEntity {
private String authCode;
/**
* 有效期 10min
* 到期时间
*/
private Integer expiresIn;
private Date expiresInTime;
}

86
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthResultRecordEntity.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 授权结果记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("auth_result_record")
public class AuthResultRecordEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* resi居民端work工作端
*/
private String clientType;
/**
* 第三方平台AppId 第三方平台AppId
*/
private String componentAppId;
/**
* 微信返回创建时间 微信返回创建时间
*/
private Date wechatCreateTime;
/**
* 通知类型
*/
private String infoType;
/**
* 授权方AppId
*/
private String authorizerAppId;
/**
* 授权码auth_code
*/
private String authorizationCode;
/**
* 授权码过期时间
*/
private Date expiresInTime;
/**
* 预授权码
*/
private String preAuthCode;
}

8
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 授权信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -49,14 +49,14 @@ public class AuthorizationInfoEntity extends BaseEpmetEntity {
private String authorizerAppid;
/**
* 接口调用令牌在授权的公众号/小程序具备 API 权限时才有此返回值
* 接口调用令牌在授权的公众号/小程序具备 API 权限时才有此返回值第三方和微信交互使用
*/
private String authorizerAccessToken;
/**
* authorizer_access_token 的有效期在授权的公众号/小程序具备API权限时才有此返回值单位
* 到期时间
*/
private Integer expiresIn;
private Date expiresInTime;
/**
* 刷新令牌在授权的公众号具备API权限时才有此返回值刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token一旦丢失只能让用户重新授权才能再次拿到新的刷新令牌用户重新授权后之前的刷新令牌会失效

29
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/RefreshAuthorizerAccessTokenEntity.java → epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BindingAccountEntity.java

@ -26,41 +26,36 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 获取/刷新接口调用令牌记录
* 公众号/小程序绑定开放平台帐号
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("refresh_authorizer_access_token")
public class RefreshAuthorizerAccessTokenEntity extends BaseEpmetEntity {
@TableName("binding_account")
public class BindingAccountEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 授权方令牌
* 开放平台账号ID 开放平台账号ID
*/
private String authorizerAccessToken;
private String openPlatformAccountId;
/**
* 有效期单位
* 公众号/小程序APPID授权方APPID 授权方APPID
*/
private Integer expiresIn;
private String authAppId;
/**
* 刷新令牌
* 客户ID 客户ID
*/
private String authorizerRefreshToken;
/**
* 授权方APPID
*/
private String authAppid;
private String customerId;
/**
* 客户ID
* 客户端 居民端resi工作端work
*/
private String customerId;
private String clientType;
}

66
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BusinessInfoEntity.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 功能开通状况表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("business_info")
public class BusinessInfoEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 主表ID 主表ID
*/
private String primaryId;
/**
* 功能类型 open_store是否开通微信门店功能 open_scan是否开通微信扫商品功能 open_pay是否开通微信支付功能 open_card是否开通微信卡券功能 open_shake是否开通微信摇一摇功能
*/
private String funcType;
/**
* 开通状态 0未开通1已开通
*/
private Integer openStatus;
}

114
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditRecordEntity.java

@ -0,0 +1,114 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 代码审核记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("code_audit_record")
public class CodeAuditRecordEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 模板ID
*/
private String templateId;
/**
* 客户端类型resi居民端work工作端
*/
private String clientType;
/**
* 授权方AppId
*/
private String authAppId;
/**
* 小程序的原始 ID
*/
private String toUserName;
/**
* 发送方帐号一个 OpenID此时发送方是系统帐号
*/
private String fromUserName;
/**
* 消息创建时间 整型时间戳
*/
private Date wechatCreateTime;
/**
* 消息类型 event
*/
private String msgType;
/**
* 事件类型
weapp_audit_success审核通过
weapp_audit_fail审核不通过
weapp_audit_delay审核延后
*/
private String event;
/**
* 审核成功时的时间戳
*/
private Date succTime;
/**
* 审核不通过的时间戳
*/
private Date failTime;
/**
* 审核延后时的时间戳
*/
private Date delayTime;
/**
* 审核不通过的原因
*/
private String reason;
/**
* 审核不通过的截图示例 | 分隔的 media_id 的列表可通过获取永久素材接口拉取截图内容
*/
private String screenShot;
}

6
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 第三方平台调用凭证
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -44,8 +44,8 @@ public class ComponentAccessTokenEntity extends BaseEpmetEntity {
private String componentAccessToken;
/**
* 令牌有效期 单位s 最长 60*60*2
* 令牌到期时间
*/
private Integer expiresIn;
private Date expiresInTime;
}

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 微信发送的ticket表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-08
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 授权给开发者的权限集列表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)

66
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniCategoryInfoEntity.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 小程序配置类目信息表 小程序配置类目信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("mini_category_info")
public class MiniCategoryInfoEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 主表ID
*/
private String primaryId;
/**
* 类目排序 first , second
*/
private String categorySort;
/**
* 类目名称 资讯文娱......
*/
private String categoryName;
}

91
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniInfoEntity.java

@ -0,0 +1,91 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 小程序信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("mini_info")
public class MiniInfoEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 昵称
*/
private String nickName;
/**
* 头像
*/
private String headImg;
/**
* 小程序类型 默认为 0
*/
private String serviceTypeInfo;
/**
* 小程序认证类型 小程序认证类型
*/
private String verifyTypeInfo;
/**
* 原始 ID
*/
private String userName;
/**
* 主体名称
*/
private String principalName;
/**
* 账号介绍
*/
private String signature;
/**
* 二维码图片的 URL
*/
private String qrcodeUrl;
}

66
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniNetworkInfoEntity.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 小程序配置合法域名信息表 小程序配置合法域名信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("mini_network_info")
public class MiniNetworkInfoEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 主表ID 主表ID
*/
private String primaryId;
/**
* 类型
*/
private String networkType;
/**
* 域名 RequestDomainWsRequestDomainUploadDomainDownloadDomain
*/
private String url;
}

17
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizerRefreshTokenEntity.java → epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenPlatformAccountEntity.java

@ -26,26 +26,27 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 授权方的刷新令牌表
* 开放平台账号表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("authorizer_refresh_token")
public class AuthorizerRefreshTokenEntity extends BaseEpmetEntity {
@TableName("open_platform_account")
public class OpenPlatformAccountEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 授权方的刷新令牌
* openId 所创建的开放平台帐号的 appid
*/
private String authorizerRefreshToken;
private String openAppId;
/**
* 授权方appid
* 客户ID 客户ID
*/
private String authorizerAppid;
private String customerId;
}

99
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaInfoEntity.java

@ -0,0 +1,99 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 公众号信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("pa_info")
public class PaInfoEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户端类型 resi居民端work工作端
*/
private String clientType;
/**
* 昵称
*/
private String nickName;
/**
* 头像
*/
private String headImg;
/**
* 公众号类型 0订阅号
1由历史老帐号升级后的订阅号
2服务号
*/
private String serviceTypeInfo;
/**
* 公众号认证类型 -1未认证
0微信认证
1新浪微博认证
2腾讯微博认证
3已资质认证通过但还未通过名称认证
4已资质认证通过还未通过名称认证但通过了新浪微博认证
5已资质认证通过还未通过名称认证但通过了腾讯微博认证
*/
private String verifyTypeInfo;
/**
* 原始ID
*/
private String userName;
/**
* 主体名称
*/
private String principalName;
/**
* 公众号所设置的微信号可能为空 公众号所设置的微信号可能为空
*/
private String alias;
/**
* 二维码图片的 URL
*/
private String qrcodeUrl;
}

6
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 预授权码历史记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
* @since v1.0.0 2020-07-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -44,8 +44,8 @@ public class PreAuthTokenEntity extends BaseEpmetEntity {
private String preAuthToken;
/**
* 预授权码有效期 单位s 最长 60*60*2
* 预授权码有效期
*/
private Integer expiresIn;
private Date expiresInTime;
}

43
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.ThirdRedisKeyConstant;
import com.epmet.dto.form.AuthCodeFormDTO;
import com.epmet.dto.form.AuthorizationInfoFormDTO;
import com.epmet.dto.form.AuthorizerAccessTokenFormDTO;
import com.epmet.dto.result.AuthorizationInfoResultDTO;
import lombok.extern.slf4j.Slf4j;
@ -37,15 +38,14 @@ public class RedisThird {
/**
* @Description 获取 component_verify_ticket
* @param key
* @author zxc
*/
public String getComponentVerifyTicket(String key){
public String getComponentVerifyTicket(){
return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.TICKET_REDIS_KEY).toString();
}
/**
* @Description 缓存 component_access_token 有效期1小时59分钟 官网有效期2H
* @Description 缓存 component_access_token 有效期 官网有效期2H
* @param accessToken
* @author zxc
*/
@ -56,38 +56,36 @@ public class RedisThird {
/**
* @Description 获取 component_access_token
* @param key
* @author zxc
*/
public String getComponentAccessToken(String key){
return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY+key).toString();
public String getComponentAccessToken(){
return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY).toString();
}
/**
* @Description 缓存 pre_auth_code 有效期 (官方有效期 10分钟)
* @param authCode pre_auth_code 预授权码
* @param expiresIn expires_in 有效期
* @author zxc
*/
public void setPreAuthCode(String authCode,Integer expiresIn){
redisUtils.set(ThirdRedisKeyConstant.PRE_AUTH_CODE_REDIS_KEY+ModuleConstant.PRE_AUTH_CODE,authCode,-1);
public void setPreAuthCode(String authCode){
redisUtils.set(ThirdRedisKeyConstant.PRE_AUTH_CODE_REDIS_KEY,authCode,-1);
}
/**
* @Description 缓存 刷新令牌
* @Description 缓存 刷新令牌 授权信息不包括 授权给开发者的权限集列表
* 在授权的公众号具备API权限时才有此返回值刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token
* 一旦丢失只能让用户重新授权才能再次拿到新的刷新令牌用户重新授权后之前的刷新令牌会失效
* @param refreshAccessToken
* @param authInfoDTO
* @author zxc
*/
public void setAuthorizerRefreshToken(AuthorizerAccessTokenFormDTO refreshAccessToken){
String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + ThirdRedisKeyConstant.COLON + refreshAccessToken.getCustomerId()+ThirdRedisKeyConstant.COLON+refreshAccessToken.getAuthAppid();
redisUtils.set(key,refreshAccessToken,-1);
public void setAuthorizerRefreshToken(AuthorizationInfoFormDTO authInfoDTO){
String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + ThirdRedisKeyConstant.COLON + authInfoDTO.getCustomerId()+ThirdRedisKeyConstant.COLON+authInfoDTO.getClientType();
redisUtils.set(key,authInfoDTO,-1);
}
/**
* @Description 获取刷新
* @param key
* @param key = epmet:wechartthird:authorizerrefreshtoken:customerId:clientType
* @author zxc
*/
public String getAuthorizerRefreshToken(String key){
@ -100,7 +98,7 @@ public class RedisThird {
* @author zxc
*/
public void setAuthCode(AuthCodeFormDTO formDTO){
String key = ThirdRedisKeyConstant.AUTH_CODE_REDIS_KEY+ThirdRedisKeyConstant.COLON+formDTO.getCustomerId();
String key = ThirdRedisKeyConstant.AUTH_CODE_REDIS_KEY+ThirdRedisKeyConstant.COLON+formDTO.getCustomerId()+ThirdRedisKeyConstant.COLON+formDTO.getClientType();
redisUtils.set(key,formDTO,-1);
}
@ -115,7 +113,7 @@ public class RedisThird {
}
/**
* @Description 缓存授权信息
* @Description 缓存授权信息完整的包括 授权给开发者的权限集列表
* @param authInfo
* @author zxc
*/
@ -123,4 +121,15 @@ public class RedisThird {
redisUtils.set(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY,authInfo,-1);
}
/**
* @Description 缓存 刷新后的 授权方令牌 authorizer_access_token 刷新令牌 authorizer_refresh_token
* @param refreshAccessToken
* @param clientType
* @author zxc
*/
/*public void setAuthorizerRefreshToken(AuthorizerAccessTokenFormDTO refreshAccessToken,String clientType){
String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + ThirdRedisKeyConstant.COLON + refreshAccessToken.getCustomerId()+ThirdRedisKeyConstant.COLON+clientType;
redisUtils.set(key,refreshAccessToken,-1);
}*/
}

20
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java

@ -0,0 +1,20 @@
package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.GoToAuthFormDTO;
import com.epmet.dto.result.GoToAuthResultDTO;
/**
* @Author zxc
* @CreateTime 2020/7/10 15:52
*/
public interface AppLetAuthorizationService {
/**
* @Description 小程序点击去授权的时候
* @param tokenDto
* @author zxc
*/
GoToAuthResultDTO goToAuth(TokenDto tokenDto, GoToAuthFormDTO formDTO);
}

6
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java

@ -1,7 +1,5 @@
package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -29,7 +27,7 @@ public interface ComponentVerifyTicketService {
* @Description 每个预授权码有效期为 10 分钟需要先获取令牌才能调用 获取预授权码
* @author zxc
*/
void preAuthCode();
String preAuthCode();
/**
* @Description 获取/刷新接口调用令牌
@ -43,6 +41,6 @@ public interface ComponentVerifyTicketService {
* @param
* @author zxc
*/
void redirectUri(HttpServletRequest request, HttpServletResponse response, TokenDto tokenDto,String authAppId);
void redirectUri(HttpServletRequest request, HttpServletResponse response);
}

60
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java

@ -0,0 +1,60 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.ThirdApiConstant;
import com.epmet.dao.ComponentAccessTokenDao;
import com.epmet.dao.PaCustomerAgencyDao;
import com.epmet.dto.form.GoToAuthFormDTO;
import com.epmet.dto.result.GoToAuthResultDTO;
import com.epmet.redis.RedisThird;
import com.epmet.service.AppLetAuthorizationService;
import com.epmet.service.ComponentVerifyTicketService;
import com.google.gson.JsonObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @Author zxc
* @CreateTime 2020/7/10 15:52
*/
@Slf4j
@Service
public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationService {
@Autowired
private PaCustomerAgencyDao paCustomerAgencyDao;
@Autowired
private ComponentVerifyTicketService componentVerifyTicketService;
@Autowired
private ComponentAccessTokenDao componentAccessTokenDao;
@Autowired
private RedisThird redisThird;
@Value("${third.platform.appId}")
private String componentAppId;
/**
* @Description 小程序点击去授权的时候
* @param tokenDto
* @author zxc
*/
@Override
public GoToAuthResultDTO goToAuth(TokenDto tokenDto, GoToAuthFormDTO formDTO) {
GoToAuthResultDTO result = new GoToAuthResultDTO();
String userId = tokenDto.getUserId();
String customerId = paCustomerAgencyDao.getCustomerIdByUserId(userId);
//获取预授权码
String preAuthCode = componentVerifyTicketService.preAuthCode();
String redirectUrl = String.format(ThirdApiConstant.API_RETURN_REDIRECT_URL, formDTO.getClientType(), customerId);
String authUrl = String.format(ThirdApiConstant.API_AUTH_REGISTER_URL, componentAppId, preAuthCode, redirectUrl);
result.setUrl(authUrl);
return result;
}
}

391
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java

@ -5,14 +5,15 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.client.config.utils.IOUtils;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.ThirdApiConstant;
import com.epmet.constant.ThirdRunTimeInfoConstant;
import com.epmet.dao.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AuthCodeResultDTO;
import com.epmet.dto.result.AuthorizationInfoResultDTO;
import com.epmet.dto.result.CreateOpenResultDTO;
import com.epmet.dto.result.WillOverDueResultDTO;
import com.epmet.redis.RedisThird;
import com.epmet.service.ComponentVerifyTicketService;
@ -22,7 +23,9 @@ import com.epmet.util.XmlUtil;
import com.github.pagehelper.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -31,9 +34,11 @@ import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import static com.epmet.constant.ThirdPlatformConstant.*;
import static com.epmet.constant.ThirdRunTimeInfoConstant.*;
/**
@ -59,9 +64,30 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
@Autowired
private FuncInfoDao funcInfoDao;
@Autowired
private PaCustomerAgencyDao paCustomerAgencyDao;
private CustomerMpDao customerMpDao;
@Autowired
private RefreshAuthorizerAccessTokenDao refreshAuthorizerAccessTokenDao;
private PaInfoDao paInfoDao;
@Autowired
private OpenPlatformAccountDao openPlatformAccountDao;
@Autowired
private BindingAccountDao bindingAccountDao;
@Autowired
private MiniInfoDao miniInfoDao;
@Autowired
private MiniNetworkInfoDao miniNetworkInfoDao;
@Autowired
private MiniCategoryInfoDao miniCategoryInfoDao;
@Autowired
private BusinessInfoDao businessInfoDao;
@Value("${third.platform.appId}")
private String componentAppId;
@Value("${third.platform.appSecret}")
private String appSecret;
@Value("${third.platform.aesKey}")
private String aesKey;
@Value("${third.platform.token}")
private String token;
/**
* @Description 获得授权事件的票据
@ -98,7 +124,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
if(StringUtil.isEmpty(encrypt)) {
msg = fromXML;
} else {
wxcpt = new WXBizMsgCrypt(PLATFORM_COMPONENT_TOKEN,PLATFORM_AES_KEY, PLATFORM_APP_ID);
wxcpt = new WXBizMsgCrypt(token,aesKey, componentAppId);
// 解密消息
msg = wxcpt.decryptMsg(msgSignature, timeStamp, nonce, fromXML);
}
@ -108,30 +134,49 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
String infotype = result.get(ModuleConstant.INFO_TYPE); //获取infotype,注:微信开放平台文档中标明固定为:"component_verify_ticket",但参考其他代码,还包含authorized???
log.info(infotype);
switch (infotype){
case ModuleConstant.TICKET_UNDERLINE_KEY: //验证票据
case ModuleConstant.TICKET_UNDERLINE_KEY: //接收票据 【component_verify_ticket】
String ComponentVerifyTicket = result.get(ModuleConstant.TICKET_KEY);
// 缓存 ticket
redisThird.setComponentVerifyTicket(ComponentVerifyTicket);
// 存数据库
ComponentVerifyTicketFormDTO ticketFormDTO = new ComponentVerifyTicketFormDTO();
ticketFormDTO.setAppid(PLATFORM_APP_ID);
ticketFormDTO.setComponentAppId(componentAppId);
ticketFormDTO.setComponentVerifyTicket(ComponentVerifyTicket);
//先逻辑删
ticketDao.updateOldComponentVerifyTicket();
ticketDao.insertComponentVerifyTicket(ticketFormDTO);
log.info(ModuleConstant.TICKET_UNDERLINE_KEY+":"+ComponentVerifyTicket);
break;
case ModuleConstant.AUTHORIZED: //授权成功
// 更改customer_mp 授权信息,appId,并绑定
String authAppId = result.get(ModuleConstant.APP_ID);
String authCode = result.get(ModuleConstant.AUTHORIZATION_CODE_HUMP);
AuthCodeResultDTO authCodeResultDTO = authCodeDao.selectCustomerIdByAuthCode(authCode);
String clientType = authCodeResultDTO.getClientType();
String customerId = authCodeResultDTO.getCustomerId();
this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authAppId,clientType);
this.authInfoByAuthCode(authCode, customerId,clientType);
authCodeDao.updateAppId(customerId,clientType,authAppId);
this.saveAuthAccountInfo(customerId,authAppId,clientType);
// customerMpDao.updateAuthorizationFlag(authAppId);
case ModuleConstant.UNAUTHORIZED://用户取消授权
return ModuleConstant.NULL_CHAR;
return ModuleConstant.SUCCESS;
}
} catch (Exception e) {
log.error(e.getMessage());
return ModuleConstant.NULL_CHAR;
return ModuleConstant.SUCCESS;
}
log.info(ThirdRunTimeInfoConstant.END_TICKET);
Integer tokenCount = componentAccessTokenDao.selectAccessTokenCount();
if (tokenCount == NumConstant.ZERO){
this.getComponentAccessToken();
}
return ModuleConstant.SUCCESS;
}
/**
* @Description 定时获取 (令牌component_access_token)
* @Description 定时获取 (令牌component_access_token) 第三方与微信交互使用的component_access_token
* 每十分钟执行一次,判断是否有马上超时的15分钟以内算马上超时
* @param
* @author zxc
*/
@ -140,35 +185,39 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
public void getComponentAccessToken() {
log.info(ThirdRunTimeInfoConstant.START_GET_COMPONENT_ACCESS_TOKEN);
Map<String, String> reMap;
try {
// 核心定时器
String componentVerifyTicket = redisThird.getComponentVerifyTicket(ModuleConstant.TICKET_UNDERLINE_KEY);
JSONObject jsonObject = new JSONObject();
jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID);
jsonObject.put(ModuleConstant.COMPONENT_APPSECRET, PLATFORM_APP_SECRET);
jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket);
String post = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_COMPONENT_TOKEN_URL, JSON.toJSONString(jsonObject)).getData();
HashMap<String, String> hashMap = JSON.parseObject(post, HashMap.class);
String componentAccessToken = hashMap.get(ModuleConstant.COMPONENT_ACCESS_TOKEN);
String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN);
if (StringUtils.isNotEmpty(componentAccessToken)) {
//令牌信息存DB
ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO();
formDTO.setComponentAccessToken(componentAccessToken);
formDTO.setExpiresIn(Integer.valueOf(expiresIn));
//先逻辑删,在插入
log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN);
componentAccessTokenDao.updateOldComponentAccessToken();
componentAccessTokenDao.insertComponentAccessToken(formDTO);
//存缓存
redisThird.setComponentAccessToken(componentAccessToken);
} else {
throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN);
//距离超时时间小于15分钟的数量
Integer tokenCount = componentAccessTokenDao.selectWillOverTokenCount();
if (tokenCount > NumConstant.ZERO) {
try {
String componentVerifyTicket = redisThird.getComponentVerifyTicket();
JSONObject jsonObject = new JSONObject();
jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId);
jsonObject.put(ModuleConstant.COMPONENT_APPSECRET, appSecret);
jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket);
String post = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_COMPONENT_TOKEN_URL, JSON.toJSONString(jsonObject)).getData();
HashMap<String, String> hashMap = JSON.parseObject(post, HashMap.class);
String componentAccessToken = hashMap.get(ModuleConstant.COMPONENT_ACCESS_TOKEN);
String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN);
Date expiresInTime = this.countExpirationTime(expiresIn);
if (StringUtils.isNotEmpty(componentAccessToken)) {
//令牌信息存DB
ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO();
formDTO.setComponentAccessToken(componentAccessToken);
formDTO.setExpiresInTime(expiresInTime);
//先逻辑删,在插入
log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN);
componentAccessTokenDao.updateOldComponentAccessToken();
componentAccessTokenDao.insertComponentAccessToken(formDTO);
//存缓存
redisThird.setComponentAccessToken(componentAccessToken);
} else {
throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN);
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN);
}
log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN);
}
/**
@ -178,28 +227,29 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void preAuthCode() {
public String preAuthCode() {
log.info(START_GET_PRE_AUTH_CODE);
String preAuthCode = "";
try {
String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN);
String accessToken = redisThird.getComponentAccessToken();
JSONObject jsonObject = new JSONObject();
jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID);
jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId);
String post = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData();
log.info(String.format(POST_RESULT,post));
HashMap<String, String> hashMap = JSON.parseObject(post, HashMap.class);
String preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE);
preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE);
String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN);
int ex = Integer.valueOf(expiresIn) - NumConstant.SIXTY;
Date expiresInTime = this.countExpirationTime(expiresIn);
if (StringUtils.isNotEmpty(preAuthCode)) {
//预授权码 存DB
PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO();
formDTO.setPreAuthToken(preAuthCode);
formDTO.setExpiresIn(ex);
formDTO.setExpiresInTime(expiresInTime);
//先逻辑删除,在插入DB
preAuthTokenDao.updateOldPreAuthCode();
preAuthTokenDao.insertPreAuthToken(formDTO);
//预授权码 放入缓存
redisThird.setPreAuthCode(preAuthCode,ex);
redisThird.setPreAuthCode(preAuthCode);
} else {
throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE);
}
@ -207,6 +257,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
e.printStackTrace();
}
log.info(END_GET_PRE_AUTH_CODE);
return preAuthCode;
}
/**
@ -214,40 +265,33 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
* @author zxc
*/
@Transactional(rollbackFor = Exception.class)
public AuthorizationInfoResultDTO authInfoByAuthCode(String authCode,String authAppId,String customerId) {
public AuthorizationInfoResultDTO authInfoByAuthCode(String authCode,String customerId,String clientType) {
log.info(START_GET_AUTH_INFO);
AuthorizationInfoResultDTO authorizationInfoResultDTO = new AuthorizationInfoResultDTO();
// 获取令牌【component_access_token】
String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN);
String accessToken = redisThird.getComponentAccessToken();
// 使用授权码获取授权信息
JSONObject jsonObject = new JSONObject();
jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID);
jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId);
jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, authCode);
String authInfo = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)).getData();
HashMap<String,Map> hashMap = JSON.parseObject(authInfo, HashMap.class);
Map map = hashMap.get(ModuleConstant.AUTHORIZATION_INFO);
authorizationInfoResultDTO = mapToEntity(map, AuthorizationInfoResultDTO.class);
String expiresIn = authorizationInfoResultDTO.getExpires_in();
Date expiresInTime = this.countExpirationTime(expiresIn);
//授权信息分为两张表,基础信息authorization_info,授权列表func_info
// 1. 基础信息
AuthorizationInfoFormDTO authInfoDTO = new AuthorizationInfoFormDTO();
authInfoDTO.setAuthorizerAppid(authorizationInfoResultDTO.getAuthorizer_appid());
authInfoDTO.setAuthorizerAccessToken(authorizationInfoResultDTO.getAuthorizer_access_token());
authInfoDTO.setAuthorizerRefreshToken(authorizationInfoResultDTO.getAuthorizer_refresh_token());
authInfoDTO.setExpiresIn(Integer.valueOf(authorizationInfoResultDTO.getExpires_in()));
authInfoDTO.setExpiresInTime(expiresInTime);
authInfoDTO.setCustomerId(customerId);
authInfoDTO.setClientType(clientType);
//先逻辑删除,在插入
authorizationInfoDao.updateOldAuthorizationInfo(customerId);
authorizationInfoDao.updateOldAuthorizationInfo(customerId,clientType);
authorizationInfoDao.insertAuthorizationInfo(authInfoDTO);
// 获取/刷新接口调用令牌记录表 插入
AuthorizerAccessTokenFormDTO refreshAccessToken = new AuthorizerAccessTokenFormDTO();
refreshAccessToken.setAuthAppid(authAppId);
refreshAccessToken.setCustomerId(customerId);
refreshAccessToken.setAuthorizerAccessToken(authorizationInfoResultDTO.getAuthorizer_access_token());
refreshAccessToken.setAuthorizerRefreshToken(authorizationInfoResultDTO.getAuthorizer_refresh_token());
refreshAccessToken.setExpiresIn(Integer.valueOf(authorizationInfoResultDTO.getExpires_in()));
//先逻辑删除,再插入
refreshAuthorizerAccessTokenDao.updateOldAuthorizerAccessToken(customerId);
refreshAuthorizerAccessTokenDao.insertAuthorizerAccessToken(refreshAccessToken);
// 2. 权限列表
log.info(START_INSERT_FUNC_INFO);
List<FuncInfoFormDTO> funcInfos = new ArrayList<>();
@ -270,7 +314,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
// 授权信息放入缓存
redisThird.setAuthInfo(authorizationInfoResultDTO);
//authorizer_refresh_token 放入缓存
redisThird.setAuthorizerRefreshToken(refreshAccessToken);
redisThird.setAuthorizerRefreshToken(authInfoDTO);
log.info(END_GET_AUTH_INFO);
return authorizationInfoResultDTO;
}
@ -283,14 +327,18 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
@Transactional(rollbackFor = Exception.class)
@Override
public void refreshToken() {
List<WillOverDueResultDTO> willOverDueResultDTOS = refreshAuthorizerAccessTokenDao.checkWillOverDue();
//查询 即将过期的 authorizer_access_token
List<WillOverDueResultDTO> willOverDueResultDTOS = authorizationInfoDao.checkWillOverDue();
if (willOverDueResultDTOS.size() != NumConstant.ZERO && null != willOverDueResultDTOS){
willOverDueResultDTOS.forEach(willOverDueDTO -> {
String authAppId = willOverDueDTO.getAuthAppId();
String customerId = willOverDueDTO.getCustomerId();
String clientType = willOverDueDTO.getClientType();
JSONObject jsonObject = new JSONObject();
//授权方AppId
jsonObject.put(ModuleConstant.AUTHORIZER_APPID,willOverDueDTO.getAuthAppId());
jsonObject.put(ModuleConstant.AUTHORIZER_APPID,authAppId);
//第三方平台AppId
jsonObject.put(ModuleConstant.COMPONENT_APPID,PLATFORM_APP_ID);
jsonObject.put(ModuleConstant.COMPONENT_APPID,componentAppId);
jsonObject.put(ModuleConstant.AUTHORIZER_REFRESH_TOKEN,willOverDueDTO.getAuthorizerRefreshToken());
String data = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_AUTHORIZER_TOKEN_URL, JSON.toJSONString(jsonObject)).getData();
Map map = JSON.parseObject(data, HashMap.class);
@ -298,56 +346,230 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString();
String expiresIn = map.get(ModuleConstant.EXPIRES_IN).toString();
String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString();
Date expiresInTime = this.countExpirationTime(expiresIn);
//更新DB
AuthorizerAccessTokenFormDTO formDTO = new AuthorizerAccessTokenFormDTO();
AuthorizationInfoFormDTO authorizationInfo = new AuthorizationInfoFormDTO();
BeanUtils.copyProperties(formDTO,authorizationInfo);
authorizationInfo.setAuthorizerAppid(authAppId);
formDTO.setAuthorizerAccessToken(authorizerAccessToken);
formDTO.setAuthorizerRefreshToken(authorizerRefreshToken);
formDTO.setExpiresIn(Integer.valueOf(expiresIn));
formDTO.setCustomerId(willOverDueDTO.getCustomerId());
formDTO.setAuthAppid(willOverDueDTO.getAuthAppId());
formDTO.setExpiresInTime(expiresInTime);
formDTO.setCustomerId(customerId);
formDTO.setAuthAppid(authAppId);
//先逻辑删除,在插入
refreshAuthorizerAccessTokenDao.updateOldAuthorizerAccessToken(willOverDueDTO.getCustomerId());
refreshAuthorizerAccessTokenDao.insertAuthorizerAccessToken(formDTO);
authorizationInfoDao.updateOldAuthorizerAccessToken(willOverDueDTO.getCustomerId(),clientType);
authorizationInfoDao.insertAuthorizerAccessToken(formDTO);
//缓存 refreshAuthorizerAccessToken
redisThird.setAuthorizerRefreshToken(formDTO);
redisThird.setAuthorizerRefreshToken(authorizationInfo);
});
}
}
/**
* @Description 授权回调URL
* @Description 授权回调URL,回调时并获取授权信息
* @param
* @author zxc
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void redirectUri(HttpServletRequest request, HttpServletResponse response, TokenDto tokenDto,String authAppId) {
String userId = tokenDto.getUserId();
String customerId = paCustomerAgencyDao.getCustomerIdByUserId(userId);
public void redirectUri(HttpServletRequest request, HttpServletResponse response) {
try {
request.setCharacterEncoding(ModuleConstant.UTF8);
response.setCharacterEncoding(ModuleConstant.UTF8);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
response.setCharacterEncoding(ModuleConstant.UTF8);
String customerId = request.getParameter(ModuleConstant.CUSTOMER_ID);
String client = request.getParameter(ModuleConstant.CLIENT);
String authCode = request.getParameter(ModuleConstant.AUTH_CODE);
String expiresIn = request.getParameter(ModuleConstant.EXPIRES_IN);
Date expiresInTime = this.countExpirationTime(expiresIn);
// AuthorizationInfoResultDTO authorizationInfo = this.authInfoByAuthCode(authCode, customerId,client);
//authCode存数据库
AuthCodeFormDTO formDTO = new AuthCodeFormDTO();
formDTO.setAuthCode(authCode);
formDTO.setExpiresIn(Integer.valueOf(expiresIn));
formDTO.setAuthAppId(authAppId);
formDTO.setExpiresInTime(expiresInTime);
formDTO.setClientType(client);
//授权方AppId
// formDTO.setAuthAppId(authorizationInfo.getAuthorizer_appid());
formDTO.setCustomerId(customerId);
// this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authorizationInfo.getAuthorizer_appid(),client);
authCodeDao.insertRedirectAuthCode(formDTO);
//authCode存缓存
redisThird.setAuthCode(formDTO);
// 获取授权信息
AuthorizationInfoResultDTO authorizationInfoResultDTO = this.authInfoByAuthCode(authCode, authAppId, customerId);
}
/**
* @Description 获取授权方的帐号基本信息并保存
* @param customerId
* @param authAppId
* @author zxc
*/
@Transactional(rollbackFor = Exception.class)
public void saveAuthAccountInfo(String customerId, String authAppId,String clientType) {
JSONObject jsonObject = new JSONObject();
jsonObject.put(ModuleConstant.COMPONENT_APP_ID,componentAppId);
jsonObject.put(ModuleConstant.AUTHORIZER_APP_ID,authAppId);
String data = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_GET_AUTHORIZER_INFO, JSON.toJSONString(jsonObject)).getData();
Map<String,Map> map = JSON.parseObject(data, Map.class);
Map authorizerInfo = map.get(ModuleConstant.AUTHORIZER_INFO);
// 存在 “miniprograminfo” 字段为小程序,不存在为公众号
boolean keyExist = authorizerInfo.containsKey(ModuleConstant.MINI_PROGRAM_INFO);
if (keyExist == true){
MiniInfoFormDTO miniInfoFormDTO = this.mapToEntity(authorizerInfo, MiniInfoFormDTO.class);
miniInfoFormDTO.setCustomerId(customerId);
miniInfoFormDTO.setClientType(clientType);
//基础信息插入
miniInfoDao.insertMiniInfo(miniInfoFormDTO);
String primaryId = miniInfoFormDTO.getId();
//todo 功能的开通状况信息插入
List<BusinessInfoFormDTO> businessInfoList = new ArrayList<>();
Map businessInfo = (Map) authorizerInfo.get(ModuleConstant.BUSINESS_INFO);
businessInfo.forEach((key, value) -> {
BusinessInfoFormDTO businessInfoForm = new BusinessInfoFormDTO();
businessInfoForm.setCustomerId(customerId);
businessInfoForm.setClientType(clientType);
businessInfoForm.setFuncType(key.toString());
businessInfoForm.setOpenStatus(Integer.valueOf(value.toString()));
businessInfoForm.setPrimaryId(primaryId);
businessInfoList.add(businessInfoForm);
});
businessInfoDao.insertBusinessInfo(businessInfoList);
//todo 小程序配置的合法域名信息插入
Map miniProgramInfo = (Map) authorizerInfo.get(ModuleConstant.MINI_PROGRAM_INFO);
List<MiniNetworkInfoFormDTO> networkInfoList = new ArrayList<>();
Map networkInfo = (Map) miniProgramInfo.get(ModuleConstant.NETWORK);
networkInfo.forEach((key,value) -> {
MiniNetworkInfoFormDTO miniNetworkInfoForm = new MiniNetworkInfoFormDTO();
miniNetworkInfoForm .setCustomerId(customerId);
miniNetworkInfoForm.setClientType(clientType);
miniNetworkInfoForm.setNetworkType(key.toString());
miniNetworkInfoForm.setUrl(value.toString());
miniNetworkInfoForm.setPrimaryId(primaryId);
networkInfoList.add(miniNetworkInfoForm);
});
miniNetworkInfoDao.insertNetworkInfo(networkInfoList);
//todo 小程序配置的类目信息插入
List<MiniCategoryInfoFormDTO> categoryInfoList = new ArrayList<>();
List<Map> categories = (List<Map>) miniProgramInfo.get(ModuleConstant.CATEGORIES);
categories.forEach(category -> {
category.forEach((key,value) -> {
MiniCategoryInfoFormDTO categoryInfo = new MiniCategoryInfoFormDTO();
categoryInfo.setCustomerId(customerId);
categoryInfo.setClientType(clientType);
categoryInfo.setCategorySort(key.toString());
categoryInfo.setCategoryName(value.toString());
categoryInfo.setPrimaryId(primaryId);
categoryInfoList.add(categoryInfo);
});
});
miniCategoryInfoDao.insertCategoryInfo(categoryInfoList);
}else {
PaInfoFormDTO paInfoFormDTO = this.mapToEntity(authorizerInfo, PaInfoFormDTO.class);
//公众号基本信息插入
paInfoDao.insertPaInfo(paInfoFormDTO);
String primaryId = paInfoFormDTO.getId();
//todo 功能的开通状况信息插入
List<BusinessInfoFormDTO> businessInfoList = new ArrayList<>();
Map businessInfo = (Map) authorizerInfo.get(ModuleConstant.BUSINESS_INFO);
businessInfo.forEach((key, value) -> {
BusinessInfoFormDTO businessInfoForm = new BusinessInfoFormDTO();
businessInfoForm.setCustomerId(customerId);
businessInfoForm.setClientType(clientType);
businessInfoForm.setFuncType(key.toString());
businessInfoForm.setOpenStatus(Integer.valueOf(value.toString()));
businessInfoForm.setPrimaryId(primaryId);
businessInfoList.add(businessInfoForm);
});
businessInfoDao.insertBusinessInfo(businessInfoList);
}
}
/**
* @Description 1.创建开放平台账号并绑定 2.回填 customer_mp appId
* @param
* @author zxc
*/
@Transactional(rollbackFor = Exception.class)
public void updateCustomerMpAppIdAndCreateOpenPlatform(String customerId,String authAppId,String clientType){
Integer notAuthCount = customerMpDao.selectAuthCount(customerId);
String openPlatformId = null;
if (notAuthCount==NumConstant.ZERO){
//没有任何一个小程序/公众号授权,【先创建,再绑定】
JSONObject jsonObject = new JSONObject();
jsonObject.put(ModuleConstant.APP_ID,authAppId);
String data = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_CREATE_OPEN, JSON.toJSONString(jsonObject)).getData();
Map<String,String> map = JSON.parseObject(data, Map.class);
CreateOpenResultDTO createOpen = new CreateOpenResultDTO();
createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE)));
createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG));
createOpen.setOpenAppId(map.get(ModuleConstant.OPEN_APP_ID));
switch (createOpen.getErrCode()){
case NumConstant.ONE:
log.info(CREATE_AND_BIND_SUCCESS);
break;
case NumConstant.ONE_NEG:
throw new RenException(SYSTEM_ERROR);
case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN:
throw new RenException(INVALID_APP_ID);
case ModuleConstant.EIGHTY_NINE_THOUSAND:
throw new RenException(ACCOUNT_HAS_BOUND_OPEN);
}
CreateOpenFormDTO coForm = new CreateOpenFormDTO();
coForm.setOpenid(map.get(ModuleConstant.OPEN_APP_ID));
coForm.setCustomerId(customerId);
//插入 open_platform_account 表
openPlatformAccountDao.insertOpenPlatFormAccount(coForm);
openPlatformId = coForm.getId();
}else if (notAuthCount>NumConstant.ZERO){
String openAppId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId);
JSONObject jsonObject = new JSONObject();
jsonObject.put(ModuleConstant.LOW_APP_ID,componentAppId);
jsonObject.put(ModuleConstant.OPEN_APP_ID,openAppId);
String data = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_BIND_OPEN, JSON.toJSONString(jsonObject)).getData();
Map<String,String> map = JSON.parseObject(data, Map.class);
CreateOpenResultDTO createOpen = new CreateOpenResultDTO();
createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE)));
createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG));
switch (createOpen.getErrCode()){
case NumConstant.ONE:
log.info(BIND_SUCCESS);
break;
case NumConstant.ONE_NEG:
throw new RenException(SYSTEM_ERROR);
case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN:
throw new RenException(INVALID_APP_ID);
case ModuleConstant.EIGHTY_NINE_THOUSAND:
throw new RenException(ACCOUNT_HAS_BOUND_OPEN);
case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_ONE:
throw new RenException(NOT_SAME_CONTRACTOR);
case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_THREE:
throw new RenException(NOT_ALLOWED_OPERATE);
case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_FOUR:
throw new RenException(TO_LIMIT);
}
}
AuthCodeFormDTO formDTO = new AuthCodeFormDTO();
formDTO.setClientType(clientType);
formDTO.setAuthAppId(authAppId);
formDTO.setCustomerId(customerId);
//回填customer_mp的appId 只需以上三个字段
customerMpDao.updateAppIDByCustomerIdAndClient(formDTO);
//插入 binding_account
BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO();
bindingAccount.setOpenPlatformAccountId(openPlatformId);
bindingAccount.setAuthAppId(authAppId);
bindingAccount.setClientType(clientType);
bindingAccount.setCustomerId(customerId);
bindingAccountDao.insertBindingAccount(bindingAccount);
}
/**
* @Description map Entity
* @param map
@ -377,4 +599,17 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
}
return t;
}
/**
* @Description 转换过期时间
* @param expiresIn
* @author zxc
*/
public Date countExpirationTime(String expiresIn){
long now = LocalDateTime.now().toEpochSecond(ZoneOffset.of(NumConstant.POSITIVE_EIGHT_STR));
long expiresInTime = now + Long.valueOf(expiresIn);
LocalDateTime localDateTime = Instant.ofEpochMilli(expiresInTime).atZone(ZoneOffset.ofHours(NumConstant.EIGHT)).toLocalDateTime();
Date date = Date.from(localDateTime.atZone(ZoneOffset.ofHours(NumConstant.EIGHT)).toInstant());
return date;
}
}

122
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java

@ -1,19 +1,35 @@
package com.epmet.service.impl;
import com.alibaba.nacos.client.config.utils.IOUtils;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.ThirdRunTimeInfoConstant;
import com.epmet.dao.CodeAuditRecordDao;
import com.epmet.dao.CodeAuditResultDao;
import com.epmet.dao.CodeCustomerDao;
import com.epmet.dao.MiniInfoDao;
import com.epmet.dto.form.CodeAuditRecordFormDTO;
import com.epmet.dto.result.CustomerIdAndClientResultDTO;
import com.epmet.dto.result.TemplateAndAppIdResultDTO;
import com.epmet.exception.AesException;
import com.epmet.service.WarrantService;
import com.epmet.util.WXBizMsgCrypt;
import com.epmet.util.WXXmlToMapUtil;
import com.epmet.util.XmlUtil;
import com.github.pagehelper.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
/**
* @Author zxc
@ -22,30 +38,92 @@ import java.io.IOException;
@Slf4j
@Service
public class WarrantServiceImpl implements WarrantService {
@Value("${third.platform.appId}")
private String componentAppId;
@Value("${third.platform.appSecret}")
private String appSecret;
@Value("${third.platform.aesKey}")
private String aesKey;
@Value("${third.platform.token}")
private String token;
@Autowired
private ComponentVerifyTicketServiceImpl componentVerifyTicketService;
@Autowired
private CodeAuditRecordDao codeAuditRecordDao;
@Autowired
private MiniInfoDao miniInfoDao;
@Autowired
private CodeCustomerDao codeCustomerDao;
@Autowired
private CodeAuditResultDao codeAuditResultDao;
/**
* @Description 1.保存代码审核结果 2.更新代码上传结果
* @param request
* @param appid
* @param response
* @author zxc
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void acceptMessageAndEvent(HttpServletRequest request, String appid, HttpServletResponse response)throws IOException, DocumentException, AesException {
String msgSignature = request.getParameter("msg_signature");
log.info("第三方平台全网发布-------------{appid}/callback-----------验证开始。。。。msg_signature=" + msgSignature);
request.setCharacterEncoding(ModuleConstant.UTF8);
String msgSignature = request.getParameter(ModuleConstant.MSG_SIGNATURE);
String timeStamp = request.getParameter(ModuleConstant.TIMESTAMP);
String nonce = request.getParameter(ModuleConstant.NONCE);
if (!StringUtils.isNotBlank(msgSignature)) {
return;// 微信推送给第三方开放平台的消息一定是加过密的,无消息加密无法解密消息
}
StringBuilder sb =new StringBuilder();
BufferedReader in = request.getReader();
String line;
while ((line = in.readLine()) !=null) {
sb.append(line);
}
in.close();
InputStream inputStream;
String postData = null;
inputStream = request.getInputStream();
postData= IOUtils.toString(inputStream,ModuleConstant.UTF8);
//从XML中获取<Encrypt></Encrypt>标签内的密文文本
String encrypt = XmlUtil.toXml(postData);
log.info(String.format(ThirdRunTimeInfoConstant.ENCRYPT,encrypt));
//格式化密文文本,否则没有<ToUserName>标签,会解密失败,参考官方的加解密代码JAVA版本
String format = "<xml><ToUserName><![CDATA[toUser]]></ToUserName><Encrypt><![CDATA[%1$s]]></Encrypt></xml>";
String fromXML = String.format(format, encrypt);
String xml = sb.toString();
Document doc = DocumentHelper.parseText(xml);
Element rootElt = doc.getRootElement();
String toUserName = rootElt.elementText("ToUserName");
//微信全网测试账号
// if (StringUtils.equalsIgnoreCase(toUserName, APPID)) {
log.info("全网发布接入检测消息反馈开始---------------APPID=" + appid +"------------------------toUserName=" + toUserName);
// checkWeixinAllNetworkCheck(request, response, xml);
// }
String msg = ""; //解密后的明文
WXBizMsgCrypt wxcpt;
if(StringUtil.isEmpty(encrypt)) {
msg = fromXML;
} else {
wxcpt = new WXBizMsgCrypt(token,aesKey, componentAppId);
// 解密消息
msg = wxcpt.decryptMsg(msgSignature, timeStamp, nonce, fromXML);
}
log.info(String.format(ThirdRunTimeInfoConstant.MSG,msg));
// 将xml转为map
Map<String, Object> result = WXXmlToMapUtil.multilayerXmlToMap(msg);
CodeAuditRecordFormDTO codeAuditRecord = componentVerifyTicketService.mapToEntity(result, CodeAuditRecordFormDTO.class);
String toUserName = codeAuditRecord.getToUserName();//小程序原始ID
CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName);
String clientType = customerIdAndClientResultDTO.getClientType();
String customerId = customerIdAndClientResultDTO.getCustomerId();
TemplateAndAppIdResultDTO templateAndAppId = codeCustomerDao.selectTemplateAndAppId(customerId, clientType);
String authAppId = templateAndAppId.getAuthAppId();
String templateId = templateAndAppId.getTemplateId();
codeAuditRecord.setClientType(clientType);
codeAuditRecord.setCustomerId(customerId);
codeAuditRecord.setAuthAppId(authAppId);
codeAuditRecord.setTemplateId(templateId);
//插入 代码审核 记录
codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord);
// 修改 code_audit_result 中的代码审核结果
String event = codeAuditRecord.getEvent();
String codeResult = null;
switch (event){
case ModuleConstant.WEAPP_AUDIT_SUCCESS:
codeResult = ModuleConstant.AUDIT_SUCCESS;
case ModuleConstant.WEAPP_AUDIT_FAIL:
codeResult = ModuleConstant.AUDIT_FAILED;
case ModuleConstant.WEAPP_AUDIT_DELAY:
codeResult = ModuleConstant.DELAY;
}
String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord);
codeAuditResultDao.updateAuditResult(customerId,codeCustomerId,codeResult);
}
}

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java

@ -37,7 +37,7 @@ public class WXXmlToMapUtil {
private static final Logger logger = LoggerFactory.getLogger(WXXmlToMapUtil.class);
/**
* XML格式字符串转换为Map
* XML格式字符串转换为Map<String,String>
*
* @param xml XML字符串
* @return XML数据转换后的Map

9
epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml

@ -97,4 +97,11 @@ ribbon:
pagehelper:
helper-dialect: mysql
reasonable: false
reasonable: false
third:
platform:
appId: wx9681884b28ed7927
appSecret: xxx
aesKey: xxx
componentToken: xcsfdfdff
token: developerToken

41
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml

@ -3,28 +3,15 @@
<mapper namespace="com.epmet.dao.AuthCodeDao">
<resultMap type="com.epmet.entity.AuthCodeEntity" id="authCodeMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="authAppid" column="AUTH_APPID"/>
<result property="authCode" column="AUTH_CODE"/>
<result property="expiresIn" column="EXPIRES_IN"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<insert id="insertRedirectAuthCode" parameterType="com.epmet.dto.form.AuthCodeFormDTO">
INSERT INTO auth_code ( ID, CUSTOMER_ID, AUTH_APPID, AUTH_CODE, EXPIRES_IN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
INSERT INTO auth_code ( ID, CUSTOMER_ID, CLIENT_TYPE, AUTH_CODE, EXPIRES_IN_TIME, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
(
REPLACE ( UUID(), '-', '' ),
#{customerId},
#{authAppId},
#{clientType}
#{authCode},
#{expiresIn},
#{expiresInTime},
#{delFlag},
#{createdBy},
NOW(),
@ -33,4 +20,26 @@
)
</insert>
<!-- 回填 auth_code表 authAppId -->
<update id="updateAppId">
UPDATE auth_code
SET auth_appid = #{authAppId}
WHERE
del_flag = 0
AND customer_id = #{customerId}
AND client_type = #{clientType}
</update>
<!-- 根据authCode查询客户ID和客户端类型 -->
<select id="selectCustomerIdByAuthCode" resultType="com.epmet.dto.result.AuthCodeResultDTO">
SELECT
customer_id AS customerId,
client_type AS clientType
FROM
auth_code
WHERE
del_flag = 0
AND auth_code = #{authCode}
</select>
</mapper>

6
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.AuthResultRecordDao">
</mapper>

62
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml

@ -3,31 +3,18 @@
<mapper namespace="com.epmet.dao.AuthorizationInfoDao">
<resultMap type="com.epmet.entity.AuthorizationInfoEntity" id="authorizationInfoMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="authorizerAppid" column="AUTHORIZER_APPID"/>
<result property="authorizerAccessToken" column="AUTHORIZER_ACCESS_TOKEN"/>
<result property="expiresIn" column="EXPIRES_IN"/>
<result property="authorizerRefreshToken" column="AUTHORIZER_REFRESH_TOKEN"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 插入 授权信息 -->
<insert id="insertAuthorizationInfo" parameterType="com.epmet.dto.form.AuthorizationInfoFormDTO">
INSERT INTO authorization_info ( ID, CUSTOMER_ID, AUTHORIZER_APPID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN, AUTHORIZER_REFRESH_TOKEN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
INSERT INTO authorization_info ( ID, CUSTOMER_ID, AUTHORIZER_APPID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN_TIME, AUTHORIZER_REFRESH_TOKEN, CLIENT_TYPE, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
(
REPLACE ( UUID(), '-', '' ),
#{customerId},
#{authorizerAppid},
#{authorizerAccessToken},
#{expiresIn},
#{expiresInTime},
#{authorizerRefreshToken},
#{clientType}
#{delFlag},
#{createdBy},
NOW(),
@ -38,7 +25,48 @@
<!-- 逻辑删除授权信息 -->
<update id="updateOldAuthorizationInfo">
update authorization_info set del_flag = 0 where customer_id = #{customerId}
update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType}
</update>
<!-- 询即将过期的 authorizer_access_token -->
<select id="checkWillOverDue" resultType="com.epmet.dto.result.WillOverDueResultDTO">
SELECT
authorizer_access_token AS authorizerAccessToken,
authorizer_refresh_token AS authorizerRefreshToken,
authorizer_appid AS authAppId,
customer_id AS customerId,
client_type AS clientType
FROM
authorization_info
WHERE
del_flag = 0
AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) <![CDATA[ <= ]]> 900
AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) > 0
</select>
<!-- 插入 authorizer_access_token -->
<insert id="insertAuthorizerAccessToken" parameterType="com.epmet.dto.form.AuthorizerAccessTokenFormDTO">
INSERT INTO authorization_info ( ID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN_TIME, AUTHORIZER_REFRESH_TOKEN, AUTHORIZER_APPID, CUSTOMER_ID,CLIENT_TYPE, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
(
REPLACE ( UUID(), '-', '' ),
#{authorizerAccessToken},
#{expiresInTime},
#{authorizerRefreshToken},
#{authAppid},
#{customerId},
#{clientType},
#{delFlag},
#{createdBy},
NOW(),
#{updatedBy},
NOW()
)
</insert>
<!-- 逻辑删 authorizer_access_token -->
<update id="updateOldAuthorizerAccessToken">
update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType}
</update>
</mapper>

11
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml

@ -3,16 +3,5 @@
<mapper namespace="com.epmet.dao.AuthorizerRefreshTokenDao">
<resultMap type="com.epmet.entity.AuthorizerRefreshTokenEntity" id="authorizerRefreshTokenMap">
<result property="id" column="ID"/>
<result property="authorizerRefreshToken" column="AUTHORIZER_REFRESH_TOKEN"/>
<result property="authorizerAppid" column="AUTHORIZER_APPID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

24
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.BindingAccountDao">
<!-- 插入 公众号/小程序绑定开放平台帐号表 -->
<insert id="insertBindingAccount">
INSERT INTO binding_account ( ID, OPEN_PLATFORM_ACCOUNT_ID, AUTH_APP_ID, CUSTOMER_ID, CLIENT_TYPE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
(
REPLACE ( UUID(), '-', '' ),
#{openPlatformAccountId},
#{authAppId},
#{customerId},
#{clientType},
#{delFlag},
#{revision},
#{createDBy},
NOW(),
#{updatedBy},
NOW()
)
</insert>
</mapper>

27
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BusinessInfoDao.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.BusinessInfoDao">
<!-- 功能开通信息插入 -->
<insert id="insertBusinessInfo">
INSERT INTO business_info ( ID, CUSTOMER_ID, CLIENT_TYPE, PRIMARY_ID, FUNC_TYPE, OPEN_STATUS, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
<foreach collection="businessInfoList" item="business" separator=",">
(
REPLACE ( UUID(), '-', '' ),
#{business.customerId},
#{business.clientType},
#{business.primaryId},
#{business.funcType},
#{business.openStatus},
#{business.delFlag},
#{business.revision},
#{business.createdBy},
NOW(),
#{business.updatedBy},
NOW()
)
</foreach>
</insert>
</mapper>

35
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditRecordDao.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.CodeAuditRecordDao">
<!-- 插入代码审核结果 -->
<insert id="insertCodeAuditRecord">
INSERT INTO code_audit_result ( ID, CUSTOMER_ID, TEMPLATE_ID, CLIENT_TYPE, AUTH_APP_ID, TO_USER_NAME, FROM_USER_NAME, WECHAT_CREATE_TIME,
MSG_TYPE, EVENT, SUCC_TIME, FAIL_TIME, DELAY_TIME, REASON, SCREEN_SHOT, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
VALUES
(
REPLACE ( UUID(), '-', '' ),
#{customerId},
#{templateId},
#{clientType},
#{authAppId},
#{toUserName},
#{fromUserName},
#{wechatCreateTime},
#{msgType},
#{event},
IFNULL(#{succTime},NULL),
IFNULL(#{failTime},NULL),
IFNULL(#{delayTime},NULL),
IFNULL(#{reason},NULL),
IFNULL(#{screenShot},NULL),
#{delFlag},
#{revision},
#{createdBy},
NOW(),
#{updatedBy},
NOW()
)
</insert>
</mapper>

22
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml

@ -3,20 +3,14 @@
<mapper namespace="com.epmet.dao.CodeAuditResultDao">
<resultMap type="com.epmet.entity.CodeAuditResultEntity" id="codeAuditResultMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="codeId" column="CODE_ID"/>
<result property="auditId" column="AUDIT_ID"/>
<result property="result" column="RESULT"/>
<result property="reason" column="REASON"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 更新 代码审核结果中的审核状态 -->
<update id="updateAuditResult">
UPDATE code_audit_result
SET result = #{codeResult}
WHERE del_flag = '0'
AND customer_id = #{customerId}
AND template_id = #{templateId}
</update>
</mapper>

45
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml

@ -3,25 +3,32 @@
<mapper namespace="com.epmet.dao.CodeCustomerDao">
<resultMap type="com.epmet.entity.CodeCustomerEntity" id="codeCustomerMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="customerName" column="CUSTOMER_NAME"/>
<result property="accessTokenId" column="ACCESS_TOKEN_ID"/>
<result property="templateId" column="TEMPLATE_ID"/>
<result property="type" column="TYPE"/>
<result property="appId" column="APP_ID"/>
<result property="extJson" column="EXT_JSON"/>
<result property="userVersion" column="USER_VERSION"/>
<result property="userDesc" column="USER_DESC"/>
<result property="status" column="STATUS"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 根据客户id和客户端类型获取 代码模板ID和授权方AppId -->
<select id="selectTemplateAndAppId" resultType="com.epmet.dto.result.TemplateAndAppIdResultDTO">
SELECT
template_id AS templateId,
app_id AS authAppId
FROM
code_customer
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND client_type = #{clientType}
</select>
<!-- 查询 code_customer 表ID -->
<select id="selectCodeCustomerId" resultType="java.lang.String">
SELECT
id AS id
FROM
code_customer
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND client_type = #{clientType}
AND app_id = #{authAppId}
AND template_id = #{templateId}
</select>
</mapper>

33
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml

@ -3,25 +3,14 @@
<mapper namespace="com.epmet.dao.ComponentAccessTokenDao">
<resultMap type="com.epmet.entity.ComponentAccessTokenEntity" id="componentAccessTokenMap">
<result property="id" column="ID"/>
<result property="componentAccessToken" column="COMPONENT_ACCESS_TOKEN"/>
<result property="expiresIn" column="EXPIRES_IN"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 插入component_access_token信息 -->
<insert id="insertComponentAccessToken" parameterType="com.epmet.dto.form.ComponentAccessTokenFormDTO">
INSERT INTO component_access_token ( ID, COMPONENT_ACCESS_TOKEN, EXPIRES_IN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
INSERT INTO component_access_token ( ID, COMPONENT_ACCESS_TOKEN, EXPIRES_IN_TIME, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
(
REPLACE ( UUID(), '-', '' ),
#{componentAccessToken},
#{expiresIn},
#{expiresInTime},
#{delFlag},
#{createdBy},
NOW(),
@ -30,8 +19,26 @@
)
</insert>
<!-- 逻辑删除旧的 component_access_token信息 -->
<update id="updateOldComponentAccessToken">
update component_access_token set del_flag = 1
</update>
<!-- 查询component_access_token 数量 -->
<select id="selectAccessTokenCount" resultType="java.lang.Integer">
select count(id) from component_access_token
</select>
<!-- 查询即将过期【component_access_token】的数量 -->
<select id="selectWillOverTokenCount" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
refresh_authorizer_access_token
WHERE
del_flag = 0
AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) <![CDATA[ <= ]]> 900
AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) > 0
</select>
</mapper>

22
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml

@ -3,24 +3,13 @@
<mapper namespace="com.epmet.dao.ComponentVerifyTicketDao">
<resultMap type="com.epmet.entity.ComponentVerifyTicketEntity" id="componentVerifyTicketMap">
<result property="id" column="ID"/>
<result property="appid" column="APPID"/>
<result property="typeInfo" column="TYPE_INFO"/>
<result property="componentVerifyTicket" column="COMPONENT_VERIFY_TICKET"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 插入 票据【component_verify_ticket】 -->
<insert id="insertComponentVerifyTicket" parameterType="com.epmet.dto.form.ComponentVerifyTicketFormDTO">
INSERT INTO component_verify_ticket ( ID, APPID, TYPE_INFO, COMPONENT_VERIFY_TICKET, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
INSERT INTO component_verify_ticket ( ID, COMPONENT_APP_ID, TYPE_INFO, COMPONENT_VERIFY_TICKET, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
(
REPLACE ( UUID(), '-', '' ),
#{appid},
#{componentAppId},
#{typeInfo},
#{componentVerifyTicket},
#{delFlag},
@ -31,5 +20,10 @@
)
</insert>
<!-- 逻辑删除 【component_verify_ticket】 -->
<update id="updateOldComponentVerifyTicket">
update component_verify_ticket set del_flag = 1
</update>
</mapper>

42
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml

@ -18,6 +18,48 @@
ORDER BY
client ASC
</select>
<!-- 查询授权的数量 -->
<select id="selectAuthCount" resultType="java.lang.Integer">
SELECT
COUNT(*) AS notAuthCount
FROM
customer_mp
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND app_id NOT NULL
AND authorization_flag = 0
</select>
<!-- 回填customer_mp的appId -->
<update id="updateAppIDByCustomerIdAndClient" parameterType="com.epmet.dto.form.AuthCodeFormDTO">
UPDATE customer_mp
SET app_id = #{authAppId},authorization_flag = 1
WHERE
customer_id = #{customerId}
AND del_flag = '0'
AND client = #{client}
</update>
<!-- 修改小程序授权的状态 -->
<update id="updateAuthorizationFlag">
UPDATE customer_mp
SET authorization_flag = 1
WHERE
app_id = #{authAppId}
</update>
<!-- 根据 客户Id和授权方AppId查询clientType -->
<select id="selectClientTypeByCustomerIdAndAuthId" resultType="java.lang.String">
SELECT
client_type AS clientType
FROM
customer_mp
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND app_id = #{authAppId}
</select>
<select id="selectAll" resultType="com.epmet.dto.CustomerMpDTO">
SELECT

13
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml

@ -3,19 +3,6 @@
<mapper namespace="com.epmet.dao.FuncInfoDao">
<resultMap type="com.epmet.entity.FuncInfoEntity" id="funcInfoMap">
<result property="id" column="ID"/>
<result property="funcscopeCategory" column="FUNCSCOPE_CATEGORY"/>
<result property="funcscopeId" column="FUNCSCOPE_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="authorizationInfoAppid" column="AUTHORIZATION_INFO_APPID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 插入授权列表信息 -->
<insert id="insertFuncInfo" parameterType="com.epmet.dto.form.FuncInfoFormDTO">
<foreach collection="funcInfoList" item="func" separator=",">

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save