Browse Source

Merge branch 'dev_thirdplatform' into dev

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
be18379ddc
  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. 17
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java
  8. 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.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO;
import com.epmet.dto.form.GoToAuthFormDTO; import com.epmet.dto.form.GoToAuthFormDTO;
import com.epmet.dto.form.OpenAppIdFormDTO; import com.epmet.dto.form.OpenAppIdFormDTO;
import com.epmet.dto.form.RemoveBindFormDTO; import com.epmet.dto.form.RemoveBindFormDTO;
import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO;
import com.epmet.dto.result.GoToAuthResultDTO; import com.epmet.dto.result.GoToAuthResultDTO;
import com.epmet.service.AppLetAuthorizationService; import com.epmet.service.AppLetAuthorizationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* @Author zxc * @Author zxc
* @CreateTime 2020/7/10 15:48 * @CreateTime 2020/7/10 15:48
@ -59,4 +63,16 @@ public class AppLetAuthorizationController {
return new Result<String>().ok(openAppId); 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.AuthorizationInfoDTO;
import com.epmet.dto.form.AuthorizationInfoFormDTO; import com.epmet.dto.form.AuthorizationInfoFormDTO;
import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; import com.epmet.dto.form.AuthorizerAccessTokenFormDTO;
import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO;
import com.epmet.dto.result.AuthCodeResultDTO; import com.epmet.dto.result.AuthCodeResultDTO;
import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO;
import com.epmet.dto.result.WillOverDueResultDTO; import com.epmet.dto.result.WillOverDueResultDTO;
import com.epmet.entity.AuthorizationInfoEntity; import com.epmet.entity.AuthorizationInfoEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -99,4 +101,12 @@ public interface AuthorizationInfoDao extends BaseDao<AuthorizationInfoEntity> {
*/ */
List<AuthorizationInfoDTO> getAuthInfoByCustomerId(@Param("customerId") String customerId); 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; package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto; 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.GoToAuthFormDTO;
import com.epmet.dto.form.OpenAppIdFormDTO; import com.epmet.dto.form.OpenAppIdFormDTO;
import com.epmet.dto.form.RemoveBindFormDTO; import com.epmet.dto.form.RemoveBindFormDTO;
import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO;
import com.epmet.dto.result.GoToAuthResultDTO; import com.epmet.dto.result.GoToAuthResultDTO;
import java.util.List;
/** /**
* @Author zxc * @Author zxc
* @CreateTime 2020/7/10 15:52 * @CreateTime 2020/7/10 15:52
@ -34,4 +38,12 @@ public interface AppLetAuthorizationService {
*/ */
String getOpenAppId(OpenAppIdFormDTO formDTO); 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.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.constant.ModuleConstant; import com.epmet.constant.ModuleConstant;
import com.epmet.dao.AuthorizationInfoDao;
import com.epmet.dao.BindingAccountDao; import com.epmet.dao.BindingAccountDao;
import com.epmet.dao.CustomerMpDao; import com.epmet.dao.CustomerMpDao;
import com.epmet.dao.OpenPlatformAccountDao; import com.epmet.dao.OpenPlatformAccountDao;
import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO;
import com.epmet.dto.form.GoToAuthFormDTO; import com.epmet.dto.form.GoToAuthFormDTO;
import com.epmet.dto.form.OpenAppIdFormDTO; import com.epmet.dto.form.OpenAppIdFormDTO;
import com.epmet.dto.form.RemoveBindFormDTO; import com.epmet.dto.form.RemoveBindFormDTO;
import com.epmet.dto.result.AuthorizationInfoResultDTO; import com.epmet.dto.result.AuthorizationInfoResultDTO;
import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO;
import com.epmet.dto.result.GoToAuthResultDTO; import com.epmet.dto.result.GoToAuthResultDTO;
import com.epmet.redis.RedisThird; import com.epmet.redis.RedisThird;
import com.epmet.service.AppLetAuthorizationService; 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.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -45,6 +49,8 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic
private RedisThird redisThird; private RedisThird redisThird;
@Autowired @Autowired
private BindingAccountDao bindingAccountDao; private BindingAccountDao bindingAccountDao;
@Autowired
private AuthorizationInfoDao authorizationInfoDao;
@Value("${third.platform.appId}") @Value("${third.platform.appId}")
private String componentAppId; private String componentAppId;
@ -117,4 +123,15 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic
} }
return map.get(ModuleConstant.ERR_MSG).toString(); 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);
}
} }

17
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java

@ -408,20 +408,23 @@ public class CodeServiceImpl implements CodeService {
@Override @Override
public List<ReasonResultDTO> reason(CodeCommonFormDTO formDTO) { public List<ReasonResultDTO> reason(CodeCommonFormDTO formDTO) {
List<ReasonResultDTO> resultList = new ArrayList<>(); List<ReasonResultDTO> resultList = new ArrayList<>();
if (StringUtils.isNotBlank(formDTO.getCodeId())) {
//获取上传代码信息 //获取上传代码信息
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId());
formDTO.setCustomerId(codeCustomerDTO.getCustomerId());
formDTO.setClientType(codeCustomerDTO.getClientType());
}
//是否授权 //是否授权
if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { if (!customerMpService.getAuthFlag(formDTO.getCustomerId(), formDTO.getClientType())) {
throw new RenException("未授权"); throw new RenException("未授权");
} }
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType());
if (null == authInfo) { if (null == authInfo) {
throw new RenException("未授权"); throw new RenException("未授权");
} }
//获取审核结果信息 //获取审核结果信息
List<CodeAuditResultDTO> codeAuditResultList = codeAuditResultService.getAuditFailedList(codeCustomerDTO.getCustomerId(), List<CodeAuditResultDTO> codeAuditResultList = codeAuditResultService.getAuditFailedList(formDTO.getCustomerId(),
codeCustomerDTO.getClientType()); formDTO.getClientType());
codeAuditResultList.forEach(dto -> { codeAuditResultList.forEach(dto -> {
ReasonResultDTO result = new ReasonResultDTO(); ReasonResultDTO result = new ReasonResultDTO();
result.setReason(dto.getReason()); result.setReason(dto.getReason());
@ -500,9 +503,9 @@ public class CodeServiceImpl implements CodeService {
public PageData history(CodeCommonFormDTO formDTO) { public PageData history(CodeCommonFormDTO formDTO) {
PageHelper.startPage(formDTO.getPage(), formDTO.getLimit()); PageHelper.startPage(formDTO.getPage(), formDTO.getLimit());
//获取上传代码信息 //获取上传代码信息
CodeCustomerDTO code = codeCustomerService.get(formDTO.getCodeId()); // CodeCustomerDTO code = codeCustomerService.get(formDTO.getCodeId());
//获取上传代码信息 //获取上传代码信息
List<CodeHistoryResultDTO> list = codeOperationHistoryService.getHistoryList(code.getCustomerId(), code.getClientType()); List<CodeHistoryResultDTO> list = codeOperationHistoryService.getHistoryList(formDTO.getCustomerId(), formDTO.getClientType());
PageInfo<CodeHistoryResultDTO> pageInfo = new PageInfo<>(list); PageInfo<CodeHistoryResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal()); return new PageData<>(list, pageInfo.getTotal());
} }

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

@ -99,4 +99,26 @@
AND EXPIRES_IN_TIME > NOW() AND EXPIRES_IN_TIME > NOW()
</select> </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> </mapper>
Loading…
Cancel
Save