Browse Source

查询授权方基本信息接口添加

dev_shibei_match
zxc 5 years ago
parent
commit
34e2ef0e09
  1. 29
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerAccessTokenInfoFormDTO.java
  2. 56
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAccessTokenInfoResultDTO.java
  3. 16
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java
  4. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java
  5. 12
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java
  6. 17
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java
  7. 22
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml

29
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;
}

56
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;
}

16
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<String>().ok(openAppId);
}
/**
* @Description 查询客户下的小程序基本信息
* @param customerAccessTokenInfoFormDTO
* @author zxc
* @date 2020/8/24 10:26 上午
*/
@PostMapping("getcustomeraccesstokeninfo")
public Result<List<CustomerAccessTokenInfoResultDTO>> getCustomerAccessTokenInfo(@RequestBody CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO){
ValidatorUtils.validateEntity(customerAccessTokenInfoFormDTO, CustomerAccessTokenInfoFormDTO.CustomerAccessTokenInfo.class);
return new Result<List<CustomerAccessTokenInfoResultDTO>>().ok(appLetAuthorizationService.getCustomerAccessTokenInfo(customerAccessTokenInfoFormDTO));
}
}

10
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<AuthorizationInfoEntity> {
*/
List<AuthorizationInfoDTO> getAuthInfoByCustomerId(@Param("customerId") String customerId);
/**
* @Description 查询客户下的小程序基本信息
* @param customerAccessTokenInfoFormDTO
* @author zxc
* @date 2020/8/24 10:26 上午
*/
List<CustomerAccessTokenInfoResultDTO> getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO);
}

12
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<CustomerAccessTokenInfoResultDTO> getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO);
}

17
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<CustomerAccessTokenInfoResultDTO> getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO) {
return authorizationInfoDao.getCustomerAccessTokenInfo(customerAccessTokenInfoFormDTO);
}
}

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

@ -99,4 +99,26 @@
AND EXPIRES_IN_TIME > NOW()
</select>
<!-- 查询客户下的小程序基本信息 -->
<select id="getCustomerAccessTokenInfo" resultType="com.epmet.dto.result.CustomerAccessTokenInfoResultDTO">
SELECT
pc.customer_name AS customerName,
pc.source AS source,
ai.customer_id AS customerId,
ai.authorizer_appid AS authAppId,
ai.authorizer_access_token AS authorizerAccessToken,
ai.authorizer_refresh_token AS authorizerRefreshToken,
ai.expires_in_time AS expiresInTime,
ai.client_type AS clientType
FROM authorization_info ai
LEFT JOIN pa_customer pc ON pc.id = ai.customer_id
WHERE
ai.del_flag = 0
AND pc.del_flag = 0
AND ai.customer_id = #{customerId}
<if test="clientType != null and clientType != '' ">
AND ai.client_type = #{clientType}
</if>
</select>
</mapper>
Loading…
Cancel
Save