|
@@ -9,6 +9,7 @@ import com.diagbot.entity.OpenedProducts;
|
|
|
import com.diagbot.entity.ProductService;
|
|
|
import com.diagbot.entity.ServiceInfo;
|
|
|
import com.diagbot.entity.ServiceToken;
|
|
|
+import com.diagbot.entity.ServiceTokenWithUser;
|
|
|
import com.diagbot.entity.wrapper.ServiceTokenWrapper;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
@@ -61,13 +62,13 @@ public class ServiceTokenFacade extends ServiceTokenServiceImpl {
|
|
|
paramMap.put("appkey", appkey);
|
|
|
paramMap.put("secret", secret);
|
|
|
//ServiceToken st = this.getServiceToken(paramMap);
|
|
|
- QueryWrapper<ServiceToken> qw = new QueryWrapper<>();
|
|
|
- qw.eq("app_key_id", appkey).
|
|
|
- eq("app_key_secret", secret);
|
|
|
- ServiceToken st = this.selectOneRecord(qw);
|
|
|
- if (null == st) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "appkey或secret错误,appkey=【" + appkey + "】," + "secret=【" + secret + "】");
|
|
|
+
|
|
|
+ //获取用户的id
|
|
|
+ List<ServiceTokenWithUser> serviceTokenWithUserList = this.getByAppkeyAndSecret(paramMap);
|
|
|
+ if(ListUtil.isEmpty(serviceTokenWithUserList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "appkey和secret错误或已失效,appkey=【" + appkey + "】," + "secret=【" + secret + "】");
|
|
|
}
|
|
|
+ ServiceTokenWithUser st = serviceTokenWithUserList.get(0);
|
|
|
if (TokenTypeEnum.Trial.getKey() == st.getType()) {
|
|
|
ProductService ps = productServiceFacade.getById(st.getProductServiceId());
|
|
|
if (ps == null) {
|
|
@@ -98,7 +99,10 @@ public class ServiceTokenFacade extends ServiceTokenServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
hasPermissionDTO.setHasPermission(true);
|
|
|
- hasPermissionDTO.setUserId(UserUtils.getCurrentPrincipleID());
|
|
|
+ //获取用户的id
|
|
|
+ if(st.getUserId() != null) {
|
|
|
+ hasPermissionDTO.setUserId(st.getUserId().toString());
|
|
|
+ }
|
|
|
return RespDTO.onSuc(hasPermissionDTO);
|
|
|
}
|
|
|
|