|
@@ -2,6 +2,8 @@ package com.fdkankan.manage.controller;
|
|
|
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
|
import com.fdkankan.manage.common.ResultData;
|
|
|
import com.fdkankan.manage.entity.*;
|
|
@@ -10,12 +12,11 @@ import com.fdkankan.manage.service.*;
|
|
|
import com.fdkankan.manage.vo.request.CaseNumType;
|
|
|
import com.fdkankan.manage.vo.request.CaseParam;
|
|
|
import com.sun.corba.se.spi.oa.OADestroyed;
|
|
|
+import io.netty.util.internal.UnstableApi;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -44,24 +45,73 @@ public class CaseController {
|
|
|
IScenePlusService scenePlusService;
|
|
|
@Autowired
|
|
|
IJySceneAuthService jySceneAuthService;
|
|
|
+ @Autowired
|
|
|
+ ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ IJyPlatformService jyPlatformService;
|
|
|
+
|
|
|
@PostMapping("/list")
|
|
|
public ResultData pageList(@RequestBody CaseParam param){
|
|
|
- if(param.getIsShare() == 0){
|
|
|
- return ResultData.ok(caseService.pageList(param));
|
|
|
- }
|
|
|
- List<JySceneAuth> sceneAuths = sceneAuthService.getAllCase();
|
|
|
- List<Integer> caseIds = sceneAuths.stream().map(JySceneAuth::getCaseId).collect(Collectors.toList());
|
|
|
|
|
|
+ List<Integer> caseIdAll = new ArrayList<>();
|
|
|
+
|
|
|
+ SysUser byId = sysUserService.getById(Long.valueOf(StpUtil.getLoginId().toString()));
|
|
|
JyUser jyUser = jyUserService.getBySysId(StpUtil.getLoginId());
|
|
|
+ if(jyUser == null){
|
|
|
+ throw new BusinessException(ResultCode.JY_ID_NO_EXIST);
|
|
|
+ }
|
|
|
+ //过滤本平台的案件
|
|
|
+ if(byId.getRoleId() == 45L || byId.getRoleId() == 48L){
|
|
|
+ List<JyUser> userIds = jyUserService.getByUserPlatform(jyUser.getPlatformId());
|
|
|
+ List<Long> sysUserIds = userIds.stream().map(JyUser::getSysUserId).collect(Collectors.toList());
|
|
|
+ param.setSysUserIds(sysUserIds);
|
|
|
+ }
|
|
|
+ if(byId.getRoleId() == 47L){
|
|
|
+ param.setSysUserIds(Arrays.asList(byId.getId()));
|
|
|
+ }
|
|
|
|
|
|
- List<JySceneUserAuth> jySceneUserAuths = jySceneUserAuthService.getByJyUserId(jyUser.getId());
|
|
|
- List<Integer> caseIds2 = jySceneUserAuths.stream().map(JySceneUserAuth::getCaseId).collect(Collectors.toList());
|
|
|
+ List<Integer> openCaseIds = new ArrayList<>();
|
|
|
+ List<Integer> authCaseIds = new ArrayList<>();
|
|
|
+ HashMap<Integer,JySceneUserAuth> authHashMap = new HashMap<>();
|
|
|
+ if(param.getIsShare() == 1){
|
|
|
+ if(byId.getRoleId() !=1 && jyUser.getPlatformId() != null ){
|
|
|
+ openCaseIds = jySceneAuthService.getCaseIdListByPlatform(jyUser.getPlatformId(), 1);
|
|
|
+ if(!openCaseIds.isEmpty()){
|
|
|
+ caseIdAll.addAll(openCaseIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<JySceneUserAuth> jySceneUserAuths = jySceneUserAuthService.getByJyUserId(jyUser.getId());
|
|
|
+ jySceneUserAuths.stream().filter(e ->e.getCaseId() != null).forEach( e-> authHashMap.put(e.getCaseId(),e));
|
|
|
+ authCaseIds = jySceneUserAuths.stream().map(JySceneUserAuth::getCaseId).collect(Collectors.toList());
|
|
|
+ if(!authCaseIds.isEmpty()){
|
|
|
+ caseIdAll.addAll(authCaseIds);
|
|
|
+ }
|
|
|
+ param.setCaseIds(caseIdAll);
|
|
|
+ if(caseIdAll.isEmpty()){
|
|
|
+ return ResultData.ok(PageInfo.PageInfo(new Page<>(param.getPageNum(),param.getPageSize())));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Page<Case> page = caseService.pageList(param);
|
|
|
+ Date date = new Date();
|
|
|
+ for (Case record : page.getRecords()) {
|
|
|
+ if(openCaseIds.contains(record.getCaseId())){
|
|
|
+ record.setIsOpen(true);
|
|
|
+ }
|
|
|
|
|
|
- List<Integer> caseIdAll = new ArrayList<>();
|
|
|
- caseIdAll.addAll(caseIds);
|
|
|
- caseIdAll.addAll(caseIds2);
|
|
|
- param.setCaseIds(caseIdAll);
|
|
|
- return ResultData.ok(caseService.pageList(param));
|
|
|
+ if(authHashMap.containsKey(record.getCaseId())){
|
|
|
+ JySceneUserAuth jySceneUserAuth = authHashMap.get(record.getCaseId());
|
|
|
+ if(jySceneUserAuth.getIsAuthor() == 1 || jySceneUserAuth.getCanAuthLook() == 1 || jySceneUserAuth.getCanEditLook() == 1){
|
|
|
+ record.setIsAuth(true);
|
|
|
+ }
|
|
|
+ if(jySceneUserAuth.getEditAuth() == 1 ||
|
|
|
+ (jySceneUserAuth.getEditAuth() == 2 && jySceneUserAuth.getEditEndTime().getTime() >date.getTime())){
|
|
|
+ record.setIsEdit(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultData.ok(PageInfo.PageInfo(page));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/sceneList")
|