From 34e2ef0e094cd8d35415d766f1f7a733b8411d1c Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 24 Aug 2020 10:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=88=E6=9D=83=E6=96=B9?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/CustomerAccessTokenInfoFormDTO.java | 29 ++++++++++ .../CustomerAccessTokenInfoResultDTO.java | 56 +++++++++++++++++++ .../AppLetAuthorizationController.java | 16 ++++++ .../com/epmet/dao/AuthorizationInfoDao.java | 10 ++++ .../service/AppLetAuthorizationService.java | 12 ++++ .../impl/AppLetAuthorizationServiceImpl.java | 17 ++++++ .../resources/mapper/AuthorizationInfoDao.xml | 22 ++++++++ 7 files changed, 162 insertions(+) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerAccessTokenInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAccessTokenInfoResultDTO.java diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerAccessTokenInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerAccessTokenInfoFormDTO.java new file mode 100644 index 0000000000..6f544e6f11 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerAccessTokenInfoFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/8/24 10:03 上午 + */ +@Data +public class CustomerAccessTokenInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 6514918025012507710L; + + public interface CustomerAccessTokenInfo{} + + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空",groups = {CustomerAccessTokenInfo.class}) + private String customerId; + + /** + * 客户端类型 + */ + private String clientType; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAccessTokenInfoResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAccessTokenInfoResultDTO.java new file mode 100644 index 0000000000..33e8129004 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAccessTokenInfoResultDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/8/24 10:08 上午 + */ +@Data +public class CustomerAccessTokenInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 7008455455787166150L; + + /** + * 客户名称 + */ + private String customerName; + + /** + * 环境类型 + */ + private String source; + + /** + * 客户ID + */ + private String customerId; + + /** + * 授权方AppId + */ + private String authAppId; + + /** + * 授权方的 accessToken + */ + private String authorizerAccessToken; + + /** + * 授权方的 refreshToken + */ + private String authorizerRefreshToken; + + /** + * accessToken过期事件 + */ + private String expiresInTime; + + /** + * 客户端类型 + */ + private String clientType; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java index 64a4bb3376..95ffd611af 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java @@ -4,14 +4,18 @@ 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.CustomerAccessTokenInfoFormDTO; import com.epmet.dto.form.GoToAuthFormDTO; import com.epmet.dto.form.OpenAppIdFormDTO; import com.epmet.dto.form.RemoveBindFormDTO; +import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO; import com.epmet.dto.result.GoToAuthResultDTO; import com.epmet.service.AppLetAuthorizationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * @Author zxc * @CreateTime 2020/7/10 15:48 @@ -59,4 +63,16 @@ public class AppLetAuthorizationController { return new Result().ok(openAppId); } + /** + * @Description 查询客户下的小程序基本信息 + * @param customerAccessTokenInfoFormDTO + * @author zxc + * @date 2020/8/24 10:26 上午 + */ + @PostMapping("getcustomeraccesstokeninfo") + public Result> getCustomerAccessTokenInfo(@RequestBody CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO){ + ValidatorUtils.validateEntity(customerAccessTokenInfoFormDTO, CustomerAccessTokenInfoFormDTO.CustomerAccessTokenInfo.class); + return new Result>().ok(appLetAuthorizationService.getCustomerAccessTokenInfo(customerAccessTokenInfoFormDTO)); + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java index 88ba820fba..b5c24edf2f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java @@ -21,7 +21,9 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.AuthorizationInfoDTO; import com.epmet.dto.form.AuthorizationInfoFormDTO; import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; +import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO; import com.epmet.dto.result.AuthCodeResultDTO; +import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO; import com.epmet.dto.result.WillOverDueResultDTO; import com.epmet.entity.AuthorizationInfoEntity; import org.apache.ibatis.annotations.Mapper; @@ -99,4 +101,12 @@ public interface AuthorizationInfoDao extends BaseDao { */ List getAuthInfoByCustomerId(@Param("customerId") String customerId); + /** + * @Description 查询客户下的小程序基本信息 + * @param customerAccessTokenInfoFormDTO + * @author zxc + * @date 2020/8/24 10:26 上午 + */ + List getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO); + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java index 0d00e16505..3a4167ea99 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java @@ -1,11 +1,15 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO; import com.epmet.dto.form.GoToAuthFormDTO; import com.epmet.dto.form.OpenAppIdFormDTO; import com.epmet.dto.form.RemoveBindFormDTO; +import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO; import com.epmet.dto.result.GoToAuthResultDTO; +import java.util.List; + /** * @Author zxc * @CreateTime 2020/7/10 15:52 @@ -34,4 +38,12 @@ public interface AppLetAuthorizationService { */ String getOpenAppId(OpenAppIdFormDTO formDTO); + /** + * @Description 查询客户下的小程序基本信息 + * @param customerAccessTokenInfoFormDTO + * @author zxc + * @date 2020/8/24 10:26 上午 + */ + List getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO); + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java index 069b6d0f40..823697b5bb 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java @@ -8,13 +8,16 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.constant.ModuleConstant; +import com.epmet.dao.AuthorizationInfoDao; import com.epmet.dao.BindingAccountDao; import com.epmet.dao.CustomerMpDao; import com.epmet.dao.OpenPlatformAccountDao; +import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO; import com.epmet.dto.form.GoToAuthFormDTO; import com.epmet.dto.form.OpenAppIdFormDTO; import com.epmet.dto.form.RemoveBindFormDTO; import com.epmet.dto.result.AuthorizationInfoResultDTO; +import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO; import com.epmet.dto.result.GoToAuthResultDTO; import com.epmet.redis.RedisThird; import com.epmet.service.AppLetAuthorizationService; @@ -25,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Map; /** @@ -45,6 +49,8 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic private RedisThird redisThird; @Autowired private BindingAccountDao bindingAccountDao; + @Autowired + private AuthorizationInfoDao authorizationInfoDao; @Value("${third.platform.appId}") private String componentAppId; @@ -117,4 +123,15 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic } return map.get(ModuleConstant.ERR_MSG).toString(); } + + /** + * @Description 查询客户下的小程序基本信息 + * @param customerAccessTokenInfoFormDTO + * @author zxc + * @date 2020/8/24 10:26 上午 + */ + @Override + public List getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO) { + return authorizationInfoDao.getCustomerAccessTokenInfo(customerAccessTokenInfoFormDTO); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml index b06647013c..61f441b6b8 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -99,4 +99,26 @@ AND EXPIRES_IN_TIME > NOW() + + + \ No newline at end of file