|
@@ -252,27 +252,13 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
|
|
|
throw new BusinessException(ResultCode.JY_ID_NO_EXIST);
|
|
|
}
|
|
|
|
|
|
- Long sceneUserId = null;
|
|
|
+ Long sceneUserId = getUserId(param.getNum(),param.getCaseId());
|
|
|
JySceneUserAuth jySceneUserAuth = null;
|
|
|
if(StringUtils.isNotBlank(param.getNum())){
|
|
|
- ScenePlus plus = scenePlusService.getByNum(param.getNum());
|
|
|
- if(plus == null){
|
|
|
- throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
|
|
|
- }
|
|
|
caseService.checkNumInCase(param.getNum());
|
|
|
- sceneUserId = plus.getUserId();
|
|
|
jySceneUserAuth = jySceneUserAuthService.getByNumAndJyUserId(jyUser.getId(), param.getNum(),param.getAuthType());
|
|
|
}
|
|
|
if(param.getCaseId() != null){
|
|
|
- Case caseEntity = caseService.getById(param.getCaseId());
|
|
|
- if(caseEntity == null){
|
|
|
- throw new BusinessException(ResultCode.CASE_NOT_EXIST);
|
|
|
- }
|
|
|
- JyUser jyUser2 = jyUserService.getBySysId(caseEntity.getSysUserId());
|
|
|
- if(jyUser2 == null){
|
|
|
- throw new BusinessException(ResultCode.USER_NOT_EXIST);
|
|
|
- }
|
|
|
- sceneUserId = jyUser2.getUserId();
|
|
|
jySceneUserAuth = jySceneUserAuthService.getByCaseIdAndJyUserId(jyUser.getId(), param.getCaseId(),param.getAuthType());
|
|
|
}
|
|
|
|
|
@@ -414,26 +400,7 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
|
|
|
if(StringUtils.isNotBlank(param.getNum()) && param.getCaseId() !=null){
|
|
|
param.setCaseId(null);
|
|
|
}
|
|
|
- Long sceneUserId = null;
|
|
|
- if(StringUtils.isNotBlank(param.getNum())){
|
|
|
- ScenePlus plus = scenePlusService.getByNum(param.getNum());
|
|
|
- if(plus == null){
|
|
|
- throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
|
|
|
- }
|
|
|
- caseService.checkNumInCase(param.getNum());
|
|
|
- sceneUserId = plus.getUserId();
|
|
|
- }
|
|
|
- if(param.getCaseId() != null){
|
|
|
- Case caseEntity = caseService.getById(param.getCaseId());
|
|
|
- if(caseEntity == null){
|
|
|
- throw new BusinessException(ResultCode.CASE_NOT_EXIST);
|
|
|
- }
|
|
|
- JyUser jyUser2 = jyUserService.getBySysId(caseEntity.getSysUserId());
|
|
|
- if(jyUser2 == null){
|
|
|
- throw new BusinessException(ResultCode.USER_NOT_EXIST);
|
|
|
- }
|
|
|
- sceneUserId = jyUser2.getUserId();
|
|
|
- }
|
|
|
+ Long sceneUserId = getUserId(param.getNum(),param.getCaseId());
|
|
|
|
|
|
CheckOtherVo vo = new CheckOtherVo();
|
|
|
SysUser byId = sysUserService.getById(Long.valueOf(StpUtil.getLoginId().toString()));
|
|
@@ -475,30 +442,62 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
|
|
|
@Autowired
|
|
|
IJyUserPlatformService jyUserPlatformService;
|
|
|
|
|
|
+ private Long getUserId(String num ,Integer caseId){
|
|
|
+ if(StringUtils.isNotBlank(num)){
|
|
|
+ ScenePlus plus = scenePlusService.getByNum(num);
|
|
|
+ if( plus == null){
|
|
|
+ throw new BusinessException(ResultCode.SCENE_NOT_EXITS);
|
|
|
+ }
|
|
|
+ return plus.getUserId();
|
|
|
+ }
|
|
|
+ if(caseId != null){
|
|
|
+ Case caseEntity = caseService.getById(caseId);
|
|
|
+ if(caseEntity == null){
|
|
|
+ throw new BusinessException(ResultCode.CASE_NOT_EXIST);
|
|
|
+ }
|
|
|
+ JyUser jyUser2 = jyUserService.getBySysId(caseEntity.getSysUserId());
|
|
|
+ if(jyUser2 == null){
|
|
|
+ throw new BusinessException(ResultCode.USER_NOT_EXIST);
|
|
|
+ }
|
|
|
+ return jyUser2.getUserId();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private JySceneAuth getBySceneAuth(String num ,Integer caseId){
|
|
|
+ if(StringUtils.isNotBlank(num)){
|
|
|
+ return jySceneAuthService.getByNum(num);
|
|
|
+ }
|
|
|
+ if(caseId != null){
|
|
|
+ return jySceneAuthService.getByCaseId(caseId);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
- public Object checkNumAuth(String num,String token,String clientIP,String userName,String password) {
|
|
|
- if(StringUtils.isBlank(num)){
|
|
|
+ public Object checkNumAuth(String num,Integer caseId,String token,String clientIP,String userName,String password) {
|
|
|
+ if(StringUtils.isBlank(num) && caseId == null){
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
- log.info("checkNumAuth-----------num:{},token:{},userName:{},password:{}",num,token,userName,password);
|
|
|
- ScenePro pro = sceneProService.getByNum(num);
|
|
|
- ScenePlus plus = scenePlusService.getByNum(num);
|
|
|
- if(pro == null && plus == null){
|
|
|
- throw new BusinessException(ResultCode.SCENE_NOT_EXITS);
|
|
|
- }
|
|
|
- Long sceneUserId = pro == null ? plus.getUserId():pro.getUserId();
|
|
|
+ log.info("checkNumAuth-----------num:{},caseId:{},token:{},userName:{},password:{}",num,caseId,token,userName,password);
|
|
|
+ Long sceneUserId = getUserId(num,caseId);
|
|
|
+ JySceneAuth jySceneAuth = getBySceneAuth(num,caseId);
|
|
|
SceneAuthVo sceneAuthVo = new SceneAuthVo();
|
|
|
|
|
|
- JySceneAuth jySceneAuth = jySceneAuthService.getByNum(num);
|
|
|
+ //公开场景案件,指针对同平台
|
|
|
if(jySceneAuth!=null && jySceneAuth.getAuthType() == 1){
|
|
|
sceneAuthVo.setViewAuth(true);
|
|
|
}
|
|
|
- List<Case> caseList = caseService.getCaseByNum(num);
|
|
|
- for (Case aCase : caseList) {
|
|
|
- JySceneAuth jySceneAuth1 = jySceneAuthService.getByCaseId(aCase.getCaseId());
|
|
|
- if(jySceneAuth1!=null && jySceneAuth1.getAuthType() == 1){
|
|
|
- sceneAuthVo.setViewAuth(true);
|
|
|
- break;
|
|
|
+
|
|
|
+ List<Case> caseList = null;
|
|
|
+ if(StringUtils.isNotBlank(num)){
|
|
|
+ caseList = caseService.getCaseByNum(num);
|
|
|
+ for (Case aCase : caseList) {
|
|
|
+ JySceneAuth jySceneAuth1 = jySceneAuthService.getByCaseId(aCase.getCaseId());
|
|
|
+ if(jySceneAuth1!=null && jySceneAuth1.getAuthType() == 1){
|
|
|
+ sceneAuthVo.setViewAuth(true);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -553,26 +552,20 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
|
|
|
if(jySceneAuth != null ){
|
|
|
JySceneUserAuth jySceneUserAuth = jySceneUserAuthService.getByNumAndJyUserId(jyUser.getId(), num,jySceneAuth.getAuthType());
|
|
|
setFlag(jySceneUserAuth,sceneAuthVo);
|
|
|
- }
|
|
|
- if(!caseList.isEmpty()){
|
|
|
- for (Case aCase : caseList) {
|
|
|
- JySceneUserAuth jySceneUserAuth = jySceneUserAuthService.getByCaseIdAndJyUserId(jyUser.getId(), aCase.getCaseId(),jySceneAuth.getAuthType());
|
|
|
- setFlag(jySceneUserAuth,sceneAuthVo);
|
|
|
+ if(caseList != null && !caseList.isEmpty()){
|
|
|
+ for (Case aCase : caseList) {
|
|
|
+ jySceneUserAuth = jySceneUserAuthService.getByCaseIdAndJyUserId(jyUser.getId(), aCase.getCaseId(),jySceneAuth.getAuthType());
|
|
|
+ setFlag(jySceneUserAuth,sceneAuthVo);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(pro != null && jyUser.getUserId().equals(pro.getUserId())){
|
|
|
- sceneAuthVo.setViewAuth(true);
|
|
|
- sceneAuthVo.setEditAuth(true);
|
|
|
- sceneAuthVo.setIsAuthor(true);
|
|
|
- }
|
|
|
- if(plus != null && jyUser.getUserId().equals(plus.getUserId())){
|
|
|
+ if(jyUser.getUserId().equals(sceneUserId)){
|
|
|
sceneAuthVo.setViewAuth(true);
|
|
|
sceneAuthVo.setEditAuth(true);
|
|
|
sceneAuthVo.setIsAuthor(true);
|
|
|
}
|
|
|
if(!sceneAuthVo.getViewAuth()){
|
|
|
-
|
|
|
List<JyUserShare> jyUserShares = jyUserShareService.getByJyUserId(jyUser.getId());
|
|
|
List<Integer> mainUserIds = jyUserShares.stream().map(JyUserShare::getMainJyUserId).collect(Collectors.toList());
|
|
|
HashMap<Integer,Long> roleMap = new HashMap<>();
|
|
@@ -593,7 +586,6 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
return sceneAuthVo;
|
|
|
}
|