Commit 9bbf23c7 by 水库浪子

移除单元测试相关功能

1 parent f8c66105
......@@ -24,11 +24,7 @@ import java.util.List;
public class WeCorpAccountController extends BaseController
{
@Autowired
<<<<<<< Updated upstream:linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCorpAccountController.java
private IWeCorpAccountService weCorpAccountService;
=======
private IWeCorpAccountService wxCorpAccountService;
>>>>>>> Stashed changes:linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WxCorpAccountController.java
/**
* 查询企业id相关配置列表
......
......@@ -127,13 +127,10 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>
......
......@@ -5,5 +5,20 @@ package com.linkwechat.common.exception.wecom;
* @author: My
* @create: 2020-08-26 16:52
**/
public class WeComException {
public class WeComException extends RuntimeException {
private static final long serialVersionUID = 1L;
protected final String message;
public WeComException(String message)
{
this.message = message;
}
@Override
public String getMessage()
{
return message;
}
}
......@@ -23,6 +23,7 @@
<artifactId>linkwe-common</artifactId>
</dependency>
</dependencies>
......
......@@ -2,7 +2,10 @@ package com.linkwechat.wecom.domain;
import com.linkwechat.common.annotation.Excel;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 企业id相关配置对象 wx_corp_account
......@@ -11,6 +14,9 @@ import lombok.Data;
* @date 2020-08-24
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeCorpAccount extends BaseEntity
{
private static final long serialVersionUID = 1L;
......
......@@ -7,5 +7,5 @@ package com.linkwechat.wecom.service;
**/
public interface IWeAccessTokenService {
String findToken();
public String findToken();
}
\ No newline at end of file
package com.linkwechat.wecom.service.impl;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.redis.RedisCache;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeAccessTokenClient;
import com.linkwechat.wecom.domain.dto.WeAccessTokenDtoDto;
import com.linkwechat.wecom.domain.WeCorpAccount;
import com.linkwechat.wecom.domain.dto.WeAccessTokenDtoDto;
import com.linkwechat.wecom.service.IWeAccessTokenService;
import com.linkwechat.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.concurrent.TimeUnit;
/**
* @description: 微信token相关接口
* @author: My
* @author: HaoN
* @create: 2020-08-26 14:43
**/
@Service
......@@ -26,7 +31,7 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService {
@Autowired
private RedisCache redisCache;
private RedisCache redisCache;
......@@ -39,9 +44,10 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService {
= iWxCorpAccountService.findValidWeCorpAccount();
if(null == wxCorpAccount){
//返回错误异常,让用户绑定企业id相关信息
throw new WeComException("无可用的corpid和secret");
}
String weAccessToken = (String) redisCache.getCacheObject(WeConstans.WE_ACCESS_TOKEN);
String weAccessToken =redisCache.getCacheObject(WeConstans.WE_ACCESS_TOKEN);
//为空,请求微信服务器同时缓存到redis中
if(StringUtils.isEmpty(weAccessToken)){
......@@ -51,10 +57,8 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService {
redisCache.setCacheObject(WeConstans.WE_ACCESS_TOKEN,accessToken.getAccess_token(),accessToken.getExpires_in().intValue(), TimeUnit.SECONDS);
weAccessToken=accessToken.getAccess_token();
}
}
return weAccessToken;
}
......
......@@ -205,12 +205,7 @@
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${springboot.vaerion}</version>
<scope>test</scope>
</dependency>
</dependencies>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!