|
@@ -2,13 +2,11 @@ package com.sundot.airport.web.controller.check;
|
|
2
|
|
2
|
|
|
3
|
import java.util.Collections;
|
3
|
import java.util.Collections;
|
|
4
|
import java.util.List;
|
4
|
import java.util.List;
|
|
5
|
-import java.util.stream.Collectors;
|
|
|
|
6
|
import javax.servlet.http.HttpServletResponse;
|
5
|
import javax.servlet.http.HttpServletResponse;
|
|
7
|
|
6
|
|
|
8
|
import cn.hutool.core.collection.CollUtil;
|
7
|
import cn.hutool.core.collection.CollUtil;
|
|
9
|
-import com.sundot.airport.common.core.domain.entity.SysRole;
|
|
|
|
10
|
-import com.sundot.airport.common.enums.RoleTypeEnum;
|
|
|
|
11
|
-import com.sundot.airport.common.utils.SecurityUtils;
|
|
|
|
|
|
8
|
+import com.sundot.airport.common.core.domain.DataPermissionResult;
|
|
|
|
9
|
+import com.sundot.airport.web.core.utils.DataPermissionUtils;
|
|
12
|
import org.springframework.security.access.prepost.PreAuthorize;
|
10
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
11
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
14
|
import org.springframework.web.bind.annotation.GetMapping;
|
12
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -46,25 +44,21 @@ public class CheckCorrectionController extends BaseController {
|
|
46
|
@PreAuthorize("@ss.hasPermi('check:checkCorrection:list')")
|
44
|
@PreAuthorize("@ss.hasPermi('check:checkCorrection:list')")
|
|
47
|
@GetMapping("/list")
|
45
|
@GetMapping("/list")
|
|
48
|
public TableDataInfo list(CheckCorrection checkCorrection) {
|
46
|
public TableDataInfo list(CheckCorrection checkCorrection) {
|
|
49
|
- startPage();
|
|
|
|
50
|
- List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
|
|
|
|
51
|
- if (CollUtil.isEmpty(roles)) {
|
|
|
|
52
|
- return getDataTable(Collections.emptyList());
|
|
|
|
53
|
- }
|
|
|
|
54
|
- List<String> roleKeyList = roles.stream().map(SysRole::getRoleKey).collect(Collectors.toList());
|
|
|
|
55
|
- if (roleKeyList.contains(RoleTypeEnum.admin.getCode())) {
|
|
|
|
56
|
-
|
|
|
|
57
|
- } else if (roleKeyList.contains(RoleTypeEnum.test.getCode()) || roleKeyList.contains(RoleTypeEnum.zhijianke.getCode())) {
|
|
|
|
58
|
-
|
|
|
|
59
|
- } else if (roleKeyList.contains(RoleTypeEnum.jingli.getCode()) || roleKeyList.contains(RoleTypeEnum.xingzheng.getCode())) {
|
|
|
|
60
|
- checkCorrection.setCheckedBrigadeId(SecurityUtils.getLoginUser().getDeptId());
|
|
|
|
61
|
- } else if (roleKeyList.contains(RoleTypeEnum.kezhang.getCode())) {
|
|
|
|
62
|
- checkCorrection.setCheckedDepartmentId(SecurityUtils.getLoginUser().getDeptId());
|
|
|
|
63
|
- } else if (roleKeyList.contains(RoleTypeEnum.banzuzhang.getCode())) {
|
|
|
|
64
|
- return getDataTable(Collections.emptyList());
|
|
|
|
65
|
- } else {
|
|
|
|
66
|
- return getDataTable(Collections.emptyList());
|
|
|
|
|
|
47
|
+ DataPermissionResult dataPermission = DataPermissionUtils.getDataPermission(getUserId(), getDeptId(), getLoginUser());
|
|
|
|
48
|
+ switch (dataPermission.getPermissionType()) {
|
|
|
|
49
|
+ case BRIGADE:
|
|
|
|
50
|
+ checkCorrection.setCheckedBrigadeId(dataPermission.getValue());
|
|
|
|
51
|
+ break;
|
|
|
|
52
|
+ case DEPARTMENT:
|
|
|
|
53
|
+ checkCorrection.setCheckedDepartmentId(dataPermission.getValue());
|
|
|
|
54
|
+ break;
|
|
|
|
55
|
+ case TEAM:
|
|
|
|
56
|
+ case SELF:
|
|
|
|
57
|
+ return getDataTable(Collections.emptyList());
|
|
|
|
58
|
+ default:
|
|
|
|
59
|
+ break;
|
|
67
|
}
|
60
|
}
|
|
|
|
61
|
+ startPage();
|
|
68
|
List<CheckCorrection> list = checkCorrectionService.selectCheckCorrectionList(checkCorrection);
|
62
|
List<CheckCorrection> list = checkCorrectionService.selectCheckCorrectionList(checkCorrection);
|
|
69
|
return getDataTable(list);
|
63
|
return getDataTable(list);
|
|
70
|
}
|
64
|
}
|
|
@@ -77,24 +71,22 @@ public class CheckCorrectionController extends BaseController {
|
|
77
|
@PostMapping("/export")
|
71
|
@PostMapping("/export")
|
|
78
|
public void export(HttpServletResponse response, CheckCorrection checkCorrection) {
|
72
|
public void export(HttpServletResponse response, CheckCorrection checkCorrection) {
|
|
79
|
List<CheckCorrection> list = Collections.emptyList();
|
73
|
List<CheckCorrection> list = Collections.emptyList();
|
|
80
|
- List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
|
|
|
|
81
|
- if (CollUtil.isNotEmpty(roles)) {
|
|
|
|
82
|
- List<String> roleKeyList = roles.stream().map(SysRole::getRoleKey).collect(Collectors.toList());
|
|
|
|
83
|
- if (roleKeyList.contains(RoleTypeEnum.admin.getCode())) {
|
|
|
|
84
|
- list = checkCorrectionService.selectCheckCorrectionList(checkCorrection);
|
|
|
|
85
|
- } else if (roleKeyList.contains(RoleTypeEnum.test.getCode()) || roleKeyList.contains(RoleTypeEnum.zhijianke.getCode())) {
|
|
|
|
|
|
74
|
+ DataPermissionResult dataPermission = DataPermissionUtils.getDataPermission(getUserId(), getDeptId(), getLoginUser());
|
|
|
|
75
|
+ switch (dataPermission.getPermissionType()) {
|
|
|
|
76
|
+ case ALL:
|
|
|
|
77
|
+ case STATION:
|
|
86
|
list = checkCorrectionService.selectCheckCorrectionList(checkCorrection);
|
78
|
list = checkCorrectionService.selectCheckCorrectionList(checkCorrection);
|
|
87
|
- } else if (roleKeyList.contains(RoleTypeEnum.jingli.getCode()) || roleKeyList.contains(RoleTypeEnum.xingzheng.getCode())) {
|
|
|
|
88
|
- checkCorrection.setCheckedBrigadeId(SecurityUtils.getLoginUser().getDeptId());
|
|
|
|
|
|
79
|
+ break;
|
|
|
|
80
|
+ case BRIGADE:
|
|
|
|
81
|
+ checkCorrection.setCheckedBrigadeId(dataPermission.getValue());
|
|
89
|
list = checkCorrectionService.selectCheckCorrectionList(checkCorrection);
|
82
|
list = checkCorrectionService.selectCheckCorrectionList(checkCorrection);
|
|
90
|
- } else if (roleKeyList.contains(RoleTypeEnum.kezhang.getCode())) {
|
|
|
|
91
|
- checkCorrection.setCheckedDepartmentId(SecurityUtils.getLoginUser().getDeptId());
|
|
|
|
|
|
83
|
+ break;
|
|
|
|
84
|
+ case DEPARTMENT:
|
|
|
|
85
|
+ checkCorrection.setCheckedDepartmentId(dataPermission.getValue());
|
|
92
|
list = checkCorrectionService.selectCheckCorrectionList(checkCorrection);
|
86
|
list = checkCorrectionService.selectCheckCorrectionList(checkCorrection);
|
|
93
|
- } else if (roleKeyList.contains(RoleTypeEnum.banzuzhang.getCode())) {
|
|
|
|
94
|
- list = Collections.emptyList();
|
|
|
|
95
|
- } else {
|
|
|
|
96
|
- list = Collections.emptyList();
|
|
|
|
97
|
- }
|
|
|
|
|
|
87
|
+ break;
|
|
|
|
88
|
+ default:
|
|
|
|
89
|
+ break;
|
|
98
|
}
|
90
|
}
|
|
99
|
ExcelUtil<CheckCorrection> util = new ExcelUtil<CheckCorrection>(CheckCorrection.class);
|
91
|
ExcelUtil<CheckCorrection> util = new ExcelUtil<CheckCorrection>(CheckCorrection.class);
|
|
100
|
util.exportExcel(response, list, "问题整改数据");
|
92
|
util.exportExcel(response, list, "问题整改数据");
|