|
@@ -17,6 +17,7 @@ import com.fdkankan.jp.xspace.common.rabbitmq.dto.SceneXspaceMqDTO;
|
|
import com.fdkankan.jp.xspace.dto.XspacePageDTO;
|
|
import com.fdkankan.jp.xspace.dto.XspacePageDTO;
|
|
import com.fdkankan.jp.xspace.entity.ScenePlus;
|
|
import com.fdkankan.jp.xspace.entity.ScenePlus;
|
|
import com.fdkankan.jp.xspace.entity.SceneXspace;
|
|
import com.fdkankan.jp.xspace.entity.SceneXspace;
|
|
|
|
+import com.fdkankan.jp.xspace.entity.SysUser;
|
|
import com.fdkankan.jp.xspace.entity.User;
|
|
import com.fdkankan.jp.xspace.entity.User;
|
|
import com.fdkankan.jp.xspace.mapper.ISceneXspaceMapper;
|
|
import com.fdkankan.jp.xspace.mapper.ISceneXspaceMapper;
|
|
import com.fdkankan.jp.xspace.service.IScenePlusService;
|
|
import com.fdkankan.jp.xspace.service.IScenePlusService;
|
|
@@ -66,15 +67,7 @@ public class SceneXspaceServiceImpl extends ServiceImpl<ISceneXspaceMapper, Scen
|
|
private FYunFileServiceInterface fYunFileService;
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public PageInfo pageXspace(XspacePageDTO param, User user) {
|
|
|
|
- Set<Long> roleIds = userRoleService.getByUser(user);
|
|
|
|
- if(!roleIds.contains(5L)){//平台管理员可以看到所有
|
|
|
|
- if(roleIds.contains(6L)){//公司管理员可以看到同一公司下所有
|
|
|
|
- param.setCompanyId(user.getCompanyId());
|
|
|
|
- }else{//普通员工只能看到自己的
|
|
|
|
- param.setUserId(user.getId());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ public PageInfo pageXspace(XspacePageDTO param, SysUser user) {
|
|
Page<XspaceVO> xspaceVOPage = this.baseMapper.pageXspace(new Page(param.getPageNum(), param.getPageSize()), param);
|
|
Page<XspaceVO> xspaceVOPage = this.baseMapper.pageXspace(new Page(param.getPageNum(), param.getPageSize()), param);
|
|
xspaceVOPage.getRecords().stream().forEach(v->{
|
|
xspaceVOPage.getRecords().stream().forEach(v->{
|
|
v.setWebSite(String.format(webSiteFormat, v.getNum(), v.getSerial()));
|
|
v.setWebSite(String.format(webSiteFormat, v.getNum(), v.getSerial()));
|
|
@@ -83,28 +76,12 @@ public class SceneXspaceServiceImpl extends ServiceImpl<ISceneXspaceMapper, Scen
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Result delete(List<Long> ids, User user) {
|
|
|
|
|
|
+ public Result delete(List<Long> ids, SysUser user) {
|
|
|
|
|
|
List<SceneXspace> sceneXspaces = this.listByIds(ids);
|
|
List<SceneXspace> sceneXspaces = this.listByIds(ids);
|
|
if(CollUtil.isEmpty(sceneXspaces)){
|
|
if(CollUtil.isEmpty(sceneXspaces)){
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
- //校验数据
|
|
|
|
- Set<Long> userIds = sceneXspaces.stream().map(x -> x.getUserId()).collect(Collectors.toSet());
|
|
|
|
- Set<Long> roleIds = userRoleService.getByUser(user);
|
|
|
|
- boolean notPermission = false;
|
|
|
|
- if(!roleIds.contains(5L)){//平台管理员可以看到所有
|
|
|
|
- if(roleIds.contains(6L)){//公司管理员可以看到同一公司下所有
|
|
|
|
- List<User> users = userService.listByIds(userIds);
|
|
|
|
- notPermission = users.stream().anyMatch(u -> !u.getCompanyId().equals(user.getCompanyId()));
|
|
|
|
- }else{//普通员工只能删除自己的
|
|
|
|
- notPermission = userIds.stream().anyMatch(id -> !id.equals(user.getId()));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(notPermission){
|
|
|
|
- return Result.failure(ResultCode.NOT_PERMISSION);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
sceneXspaces.stream().forEach(x->{
|
|
sceneXspaces.stream().forEach(x->{
|
|
x.setUpdater(user.getId());
|
|
x.setUpdater(user.getId());
|
|
x.setRecStatus(RecStatus.DISABLE.code());
|
|
x.setRecStatus(RecStatus.DISABLE.code());
|
|
@@ -119,7 +96,7 @@ public class SceneXspaceServiceImpl extends ServiceImpl<ISceneXspaceMapper, Scen
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Result sync(List<String> nums, User user) {
|
|
|
|
|
|
+ public Result sync(List<String> nums, SysUser user) {
|
|
|
|
|
|
// List<String> canSyncList = nums;//实际需要同步的场景集合
|
|
// List<String> canSyncList = nums;//实际需要同步的场景集合
|
|
// if(CollUtil.isNotEmpty(syncList)){
|
|
// if(CollUtil.isNotEmpty(syncList)){
|
|
@@ -148,13 +125,13 @@ public class SceneXspaceServiceImpl extends ServiceImpl<ISceneXspaceMapper, Scen
|
|
//平台管理员:能查看全部场景数据并且支持同步全部得数据 (平台管理员同步后的场景还是归属于之前这个场景的归属者)
|
|
//平台管理员:能查看全部场景数据并且支持同步全部得数据 (平台管理员同步后的场景还是归属于之前这个场景的归属者)
|
|
//公司管理员:仅能看到自己的场景并且同步自己的场景数据
|
|
//公司管理员:仅能看到自己的场景并且同步自己的场景数据
|
|
//公司员工:仅能看到自己的场景并且同步自己的场景数据
|
|
//公司员工:仅能看到自己的场景并且同步自己的场景数据
|
|
- Set<Long> roleIds = userRoleService.getByUser(user);
|
|
|
|
- if(!roleIds.contains(5L)){
|
|
|
|
- List<String> notPermisionNums = scenePlusList.stream().filter(p->!p.getUserId().equals(user.getId())).map(p->p.getNum()).collect(Collectors.toList());
|
|
|
|
- if(CollUtil.isNotEmpty(notPermisionNums)){
|
|
|
|
- throw new BusinessException(ResultCode.NOT_PERMISSION.code(), JSON.toJSONString(notPermisionNums));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// Set<Long> roleIds = userRoleService.getByUser(user);
|
|
|
|
+// if(!roleIds.contains(5L)){
|
|
|
|
+// List<String> notPermisionNums = scenePlusList.stream().filter(p->!p.getUserId().equals(user.getId())).map(p->p.getNum()).collect(Collectors.toList());
|
|
|
|
+// if(CollUtil.isNotEmpty(notPermisionNums)){
|
|
|
|
+// throw new BusinessException(ResultCode.NOT_PERMISSION.code(), JSON.toJSONString(notPermisionNums));
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
|
|
|
|
List<SceneXspace> sceneXspaceList = scenePlusList.stream().map(p -> {
|
|
List<SceneXspace> sceneXspaceList = scenePlusList.stream().map(p -> {
|