|
@@ -2,15 +2,11 @@ package com.fdkankan.manage.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
|
-import com.fdkankan.manage.entity.JySceneAuth;
|
|
|
-import com.fdkankan.manage.entity.JySceneUserAuth;
|
|
|
-import com.fdkankan.manage.entity.JyUser;
|
|
|
+import com.fdkankan.manage.entity.*;
|
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.mapper.IJySceneUserAuthMapper;
|
|
|
-import com.fdkankan.manage.service.IJySceneAuthService;
|
|
|
-import com.fdkankan.manage.service.IJySceneUserAuthService;
|
|
|
+import com.fdkankan.manage.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.fdkankan.manage.service.IJyUserService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -34,6 +30,10 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
|
|
|
IJyUserService jyUserService;
|
|
|
@Autowired
|
|
|
IJySceneAuthService jySceneAuthService;
|
|
|
+ @Autowired
|
|
|
+ ISceneProService sceneProService;
|
|
|
+ @Autowired
|
|
|
+ IScenePlusService scenePlusService;
|
|
|
|
|
|
@Override
|
|
|
public Object getAuthList(String num) {
|
|
@@ -68,17 +68,34 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
|
|
|
|
|
|
@Override
|
|
|
public void addAuth(JySceneUserAuth param) {
|
|
|
+ if(StringUtils.isBlank(param.getNum()) ){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ ScenePro pro = sceneProService.getByNum(param.getNum());
|
|
|
+ ScenePlus plus = scenePlusService.getByNum(param.getNum());
|
|
|
+ if(pro == null && plus == null){
|
|
|
+ throw new BusinessException(ResultCode.SCENE_NOT_EXITS);
|
|
|
+ }
|
|
|
+
|
|
|
jySceneAuthService.updateAuthTypeByNum(param.getNum(),param.getAuthType());
|
|
|
if(param.getAuthType() == 1){
|
|
|
return;
|
|
|
}
|
|
|
- if(StringUtils.isBlank(param.getRyId()) || StringUtils.isBlank(param.getNum()) ){
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(param.getRyId()) ){
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
JyUser jyUser = jyUserService.getByRyId(param.getRyId());
|
|
|
if(jyUser == null){
|
|
|
throw new BusinessException(ResultCode.JY_ID_NO_EXIST);
|
|
|
}
|
|
|
+ if(pro != null && pro.getUserId().equals(jyUser.getUserId())){
|
|
|
+ throw new BusinessException(ResultCode.AUTH_ERROR);
|
|
|
+ }
|
|
|
+ if(plus != null && plus.getUserId().equals(jyUser.getUserId())){
|
|
|
+ throw new BusinessException(ResultCode.AUTH_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
JySceneUserAuth auth = this.getByNumAndJyId(jyUser.getId(),param.getNum());
|
|
|
if(auth != null){
|
|
|
param.setId(auth.getId());
|