Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/IPostCheckedProblemService.java
#	ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostCheckedProblemServiceImpl.java
#	ruoyi-postcheck/src/main/resources/mapper/postCheck/PostProgrammeMapper.xml
csg6 10 months ago
parent
commit
5e363432e2

+ 6 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/PostProgrammeEnum.java

@@ -17,6 +17,12 @@ public enum PostProgrammeEnum {
17 17
     STATUS_HR_BACK("驳回;", 4),
18 18
 
19 19
 
20
+    // 流转步骤
21
+    STEP_HR("人力资源", 1),
22
+    STEP_ICFA("内控法务", 2),
23
+    STEP_SCHEME("方案入档",3),
24
+
25
+
20 26
     //status_icfa 2-内控法务部审批-状态:1-待审核;3-通过;4-驳回;
21 27
     STATUS_ICFA_WAIT("待审核", 1),
22 28
     STATUS_ICFA_PASS("通过;", 3),

+ 27 - 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/DeptCode.java

@@ -0,0 +1,27 @@
1
+package com.ruoyi.common.enums;
2
+
3
+public enum DeptCode {
4
+
5
+    DEPT_HR("10010712", "人力资源部"),
6
+    DEPT_ICFA("50007343", "内控法务部");
7
+
8
+
9
+    private final String code;
10
+    private final String info;
11
+
12
+    DeptCode(String code, String info)
13
+    {
14
+        this.code = code;
15
+        this.info = info;
16
+    }
17
+
18
+    public String getCode()
19
+    {
20
+        return code;
21
+    }
22
+
23
+    public String getInfo()
24
+    {
25
+        return info;
26
+    }
27
+}

+ 5 - 0
ruoyi-postcheck/pom.xml

@@ -30,6 +30,11 @@
30 30
             <artifactId>ruoyi-common</artifactId>
31 31
         </dependency>
32 32
 
33
+        <!-- system系统模块 -->
34
+        <dependency>
35
+            <groupId>com.ruoyi</groupId>
36
+            <artifactId>ruoyi-system</artifactId>
37
+        </dependency>
33 38
     </dependencies>
34 39
 
35 40
 </project>

+ 42 - 93
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostCheckedHomePageController.java

@@ -3,7 +3,9 @@ package com.ruoyi.postCheck.controller;
3 3
 import com.ruoyi.common.core.controller.BaseController;
4 4
 import com.ruoyi.common.core.domain.AjaxResult;
5 5
 import com.ruoyi.common.utils.Arith;
6
+import com.ruoyi.postCheck.domain.PostAssessmentRating;
6 7
 import com.ruoyi.postCheck.domain.homePage.*;
8
+import com.ruoyi.postCheck.service.IPostAssessmentRatingService;
7 9
 import com.ruoyi.postCheck.service.IPostCheckedProblemService;
8 10
 import io.swagger.annotations.Api;
9 11
 import io.swagger.annotations.ApiImplicitParam;
@@ -14,6 +16,16 @@ import org.springframework.web.bind.annotation.*;
14 16
 
15 17
 import java.math.BigDecimal;
16 18
 import java.util.*;
19
+import java.util.stream.Collectors;
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
17 29
 
18 30
 /**
19 31
  * 岗检问题表Controller
@@ -27,7 +39,8 @@ import java.util.*;
27 39
 public class PostCheckedHomePageController extends BaseController {
28 40
     @Autowired
29 41
     private IPostCheckedProblemService postCheckedProblemService;
30
-
42
+    @Autowired
43
+    private IPostAssessmentRatingService postAssessmentRatingService;
31 44
     /**
32 45
      * 1、责任制清单:post_list表
33 46
      * 2、检查出的问题:post_checked_problem表
@@ -58,61 +71,21 @@ public class PostCheckedHomePageController extends BaseController {
58 71
     @GetMapping("/checkedProblem")
59 72
     public AjaxResult checkedProblem() {
60 73
 //        检查出的问题:post_checked_problem表 按 problem_attribute-问题属性(1-完整问题;2-有效性问题;3-适宜性问题;) 分组 count(id)
61
-        List<PostCheckedProblemView> list = new ArrayList<>();
62
-        PostCheckedProblemView data = new PostCheckedProblemView();
63
-//        data.set
64
-//        data.set
65
-//        data.set
66
-        list.add(data);
67
-        return success(list);
74
+        return success(postCheckedProblemService.checkedProblem());
68 75
     }
69 76
 
70 77
 
71 78
     @ApiOperation("3-人员数量")
72 79
     @GetMapping("/userTotal")
73 80
     public AjaxResult userTotal() {
74
-//        查询人员表:sys_users
75
-        int userCount = 999;
76
-        return success(userCount);
81
+        return success(postCheckedProblemService.userTotal());
77 82
     }
78 83
 
79 84
 
80 85
     @ApiOperation("4-岗检问题整改率(中间饼状图 统计的 岗检问题整改率 和 岗检部门整改率 tab 切换时前端自己计算,不需要提供接口)")
81 86
     @GetMapping("/problemRectification")
82 87
     public AjaxResult problemRectification() {
83
-//        查询问题表:post_checked_problem
84
-//        group by problem_attribute 问题属性(1-完整问题;2-有效性问题;3-适宜性问题;)
85
-//        最好给前端定义一个对象,用Map也可以
86
-        List<Map<Integer, BigDecimal>> dataList = new ArrayList<>();
87
-        Map<Integer, BigDecimal> data1 = new HashMap<>();
88
-        data1.put(0, new BigDecimal(Arith.round(new BigDecimal(0.9).doubleValue(), 2)));
89
-//        data1.put(1, new BigDecimal(0.95));//完整问题
90
-//        data1.put(2, new BigDecimal(0.88));//有效性问题
91
-//        data1.put(3, new BigDecimal(0.86));//适宜性问题
92
-        dataList.add(data1);
93
-
94
-        Map<Integer, BigDecimal> data2 = new HashMap<>();
95
-//        data2.put(0, new BigDecimal(0.9));
96
-        data2.put(1, new BigDecimal(Arith.round(new BigDecimal(0.95).doubleValue(), 2)));//完整问题
97
-//        data2.put(2, new BigDecimal(0.88));//有效性问题
98
-//        data2.put(3, new BigDecimal(0.86));//适宜性问题
99
-        dataList.add(data2);
100
-
101
-
102
-        Map<Integer, BigDecimal> data3 = new HashMap<>();
103
-//        data3.put(0, new BigDecimal(0.9));
104
-//        data3.put(1, new BigDecimal(0.95));//完整问题
105
-        data3.put(2, new BigDecimal(Arith.round(new BigDecimal(0.88).doubleValue(), 2)));//有效性问题
106
-//        data3.put(3, new BigDecimal(0.86));//适宜性问题
107
-        dataList.add(data3);
108
-
109
-        Map<Integer, BigDecimal> data4 = new HashMap<>();
110
-//        data4.put(0, new BigDecimal(0.9));
111
-//        data4.put(1, new BigDecimal(0.95));//完整问题
112
-//        data4.put(2, new BigDecimal(0.88));//有效性问题
113
-        data4.put(3, new BigDecimal(Arith.round(new BigDecimal(0.86).doubleValue(), 2)));//适宜性问题
114
-        dataList.add(data4);
115
-        return success(dataList);
88
+        return success(postCheckedProblemService.problemRectification());
116 89
     }
117 90
 
118 91
 
@@ -122,25 +95,7 @@ public class PostCheckedHomePageController extends BaseController {
122 95
 //        查询问题表:post_checked_problem
123 96
 //        group by checked_dept_id 整改责任部门ID(被检查部门ID)
124 97
 //        最好给前端定义一个对象,用Map也可以
125
-        List<DeptProblemRectificationView> dataList = new ArrayList<>();
126
-        DeptProblemRectificationView data1 = new DeptProblemRectificationView();
127
-        data1.setDeptId(100l);
128
-        data1.setDeptName("测试部门V1");
129
-        data1.setProblemTotal(10);
130
-        data1.setProblemComplete(9);
131
-        data1.setProblemRectificationRate(new BigDecimal(Arith.round(new BigDecimal(0.9).doubleValue(), 2)));
132
-        dataList.add(data1);
133
-
134
-
135
-        DeptProblemRectificationView data2 = new DeptProblemRectificationView();
136
-        data2.setDeptId(101l);
137
-        data2.setDeptName("测试部门V2");
138
-        data2.setProblemTotal(8);
139
-        data2.setProblemComplete(4);
140
-        data2.setProblemRectificationRate(new BigDecimal(Arith.round(new BigDecimal(0.5).doubleValue(), 2)));
141
-        dataList.add(data2);
142
-
143
-        return success(dataList);
98
+        return success(postCheckedProblemService.deptProblemRectification());
144 99
     }
145 100
 
146 101
 
@@ -163,15 +118,7 @@ public class PostCheckedHomePageController extends BaseController {
163 118
 //        select * from "public"."sys_users";
164 119
 //        select * from "public"."sys_user_post";
165 120
 
166
-        List<PostCheckedUnCheckedView> dataList = new ArrayList<>();
167
-        PostCheckedUnCheckedView data1 = new PostCheckedUnCheckedView();
168
-        data1.setDeptId(100l);
169
-        data1.setDeptName("测试部门V1");
170
-        data1.setPostId(1l);
171
-        data1.setPostName("内操岗位");
172
-        data1.setUserCount(99);
173
-        dataList.add(data1);
174
-        return success(dataList);
121
+        return success(postCheckedProblemService.postChecked(1));
175 122
     }
176 123
 
177 124
 
@@ -194,15 +141,7 @@ public class PostCheckedHomePageController extends BaseController {
194 141
 //        select * from "public"."sys_users";
195 142
 //        select * from "public"."sys_user_post";
196 143
 
197
-        List<PostCheckedUnCheckedView> dataList = new ArrayList<>();
198
-        PostCheckedUnCheckedView data1 = new PostCheckedUnCheckedView();
199
-        data1.setDeptId(100l);
200
-        data1.setDeptName("测试部门V1");
201
-        data1.setPostId(1l);
202
-        data1.setPostName("内操岗位");
203
-        data1.setUserCount(99);
204
-        dataList.add(data1);
205
-        return success(dataList);
144
+        return success(postCheckedProblemService.postChecked(2));
206 145
     }
207 146
 
208 147
 
@@ -218,18 +157,28 @@ public class PostCheckedHomePageController extends BaseController {
218 157
 
219 158
 //      部门得分 = (岗检分数 * 0.5 + 互评分数 * 0.5  )
220 159
 //      根据部门得分进行排名计算
221
-
222
-
160
+        PostAssessmentRating postAssessmentRating1 = new PostAssessmentRating();
161
+        postAssessmentRating1.setType(1);
162
+        List<PostAssessmentRating> postAssessmentRatings1 = postAssessmentRatingService.selectPostAssessmentRatingList(postAssessmentRating1);
163
+        PostAssessmentRating postAssessmentRating2 = new PostAssessmentRating();
164
+        postAssessmentRating2.setType(2);
165
+        List<PostAssessmentRating> postAssessmentRatings2 = postAssessmentRatingService.selectPostAssessmentRatingList(postAssessmentRating2);
166
+        postAssessmentRatings1.addAll(postAssessmentRatings2);
223 167
         List<AssessmentRatingView> dataList = new ArrayList<>();
224
-        AssessmentRatingView data1 = new AssessmentRatingView();
225
-        data1.setRating(1);
226
-        data1.setDeptId(100l);
227
-        data1.setDeptName("测试部门V1");
228
-//        data1.setPostId(1l);
229
-//        data1.setPostName("内操岗位");
230
-        data1.setPostCount(6);
231
-        data1.setScore(new BigDecimal(Arith.round(new BigDecimal(99.98).doubleValue(), 2)));
232
-        dataList.add(data1);
233
-        return success(dataList);
168
+        postAssessmentRatings1.forEach(x->{
169
+            AssessmentRatingView data1 = new AssessmentRatingView();
170
+            data1.setDeptId(x.getDeptId());
171
+            data1.setDeptName(x.getDeptIdStr());
172
+            data1.setPostCount(postCheckedProblemService.getPostCountByDeptId(x.getDeptId()));
173
+            data1.setScore(x.getDepartmentScore());
174
+            dataList.add(data1);
175
+        });
176
+        List<AssessmentRatingView> collect = dataList.stream().sorted(Comparator.comparing(AssessmentRatingView::getScore).reversed()).collect(Collectors.toList());
177
+        Integer i = 1;
178
+        for (AssessmentRatingView x : collect) {
179
+            x.setRating(i);
180
+            i++;
181
+        }
182
+        return success(collect);
234 183
     }
235 184
 }

+ 59 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostProgrammeController.java

@@ -2,8 +2,17 @@ package com.ruoyi.postCheck.controller;
2 2
 
3 3
 import java.util.Date;
4 4
 import java.util.List;
5
+import java.util.Optional;
5 6
 import javax.servlet.http.HttpServletResponse;
6 7
 
8
+import com.ruoyi.common.core.domain.entity.SysDept;
9
+import com.ruoyi.common.core.domain.model.LoginUser;
10
+import com.ruoyi.common.enums.DeptCode;
11
+import com.ruoyi.common.utils.SecurityUtils;
12
+import com.ruoyi.common.utils.StringUtils;
13
+import com.ruoyi.system.domain.SysPost;
14
+import com.ruoyi.system.service.ISysDeptService;
15
+import com.ruoyi.system.service.ISysPostService;
7 16
 import org.springframework.security.access.prepost.PreAuthorize;
8 17
 import org.springframework.beans.factory.annotation.Autowired;
9 18
 import org.springframework.web.bind.annotation.GetMapping;
@@ -37,9 +46,16 @@ import io.swagger.annotations.ApiImplicitParam;
37 46
 @RestController
38 47
 @RequestMapping("/postCheck/programme")
39 48
 public class PostProgrammeController extends BaseController {
49
+
40 50
     @Autowired
41 51
     private IPostProgrammeService postProgrammeService;
42 52
 
53
+    @Autowired
54
+    private ISysDeptService sysDeptService;
55
+
56
+    @Autowired
57
+    private ISysPostService sysPostService;
58
+
43 59
     /**
44 60
      * 查询岗检方案列表
45 61
      */
@@ -188,6 +204,26 @@ public class PostProgrammeController extends BaseController {
188 204
     @Log(title = "岗检方案审核-HR", businessType = BusinessType.UPDATE)
189 205
     @PutMapping("/approveHr")
190 206
     public AjaxResult approveHr(Long id, Integer statusHr, String reasonHr) {
207
+        // 判断当前状态
208
+        PostProgramme postProgramme = postProgrammeService.selectPostProgrammeById(id);
209
+        // 审核过得不在审核
210
+
211
+        if (postProgramme.getStatusHr() == 3) {
212
+            return error("审核失败,请勿重复审核!");
213
+        }
214
+        // 判断审核的权限
215
+        LoginUser loginUser = SecurityUtils.getLoginUser();
216
+        // 当前登录用户的部门id 查询岗位id是否在内
217
+        SysDept sysDept = sysDeptService.selectDeptById(loginUser.getDeptId());
218
+        if (!sysDept.getDeptCode().equals(DeptCode.DEPT_HR.getCode())) {
219
+            return error("审核权限有误,请联系管理员!");
220
+        }
221
+
222
+        // 判断岗位是否在权限范围内
223
+        SysPost sysPost = sysPostService.selectPostByDeptId(loginUser.getDeptId());
224
+        if (sysPost.getPostLevel() != 1) {
225
+            return error("审核权限有误,请联系管理员!");
226
+        }
191 227
         return toAjax(postProgrammeService.approveHr(id, statusHr, reasonHr));
192 228
     }
193 229
 
@@ -201,6 +237,29 @@ public class PostProgrammeController extends BaseController {
201 237
     @Log(title = "岗检方案审核-Icfa", businessType = BusinessType.UPDATE)
202 238
     @PutMapping("/approveIcfa")
203 239
     public AjaxResult approveIcfa(Long id, Integer statusIcfa, String reasonIcfa) {
240
+        // 判断当前状态
241
+        PostProgramme postProgramme = postProgrammeService.selectPostProgrammeById(id);
242
+        // 审核过得不在审核
243
+        if (postProgramme.getStatusHr() != 3) {
244
+            return error("审核失败,审核流程有误!!");
245
+        }
246
+
247
+        if (postProgramme.getStatusIcfa() == 3) {
248
+            return error("审核失败,请勿重复审核!");
249
+        }
250
+        // 判断审核的权限
251
+        LoginUser loginUser = SecurityUtils.getLoginUser();
252
+        // 当前登录用户的部门id 查询岗位id是否在内
253
+        SysDept sysDept = sysDeptService.selectDeptById(loginUser.getDeptId());
254
+        if (!sysDept.getDeptCode().equals(DeptCode.DEPT_ICFA.getCode())) {
255
+            return error("审核权限有误,请联系管理员!");
256
+        }
257
+        // 判断岗位是否在权限范围内
258
+        SysPost sysPost = sysPostService.selectPostByDeptId(loginUser.getDeptId());
259
+        if (sysPost.getPostLevel() != 1) {
260
+            return error("审核权限有误,请联系管理员!");
261
+        }
262
+
204 263
         return toAjax(postProgrammeService.approveIcfa(id, statusIcfa, reasonIcfa));
205 264
     }
206 265
 }

+ 4 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/domain/PostProgramme.java

@@ -116,4 +116,8 @@ public class PostProgramme extends BaseEntity {
116 116
     @TableField(value = "dept_name")
117 117
     @Excel(name = "提交部门名称")
118 118
     private String deptName;
119
+
120
+    @ApiModelProperty("步骤:0-初始状态;1-人力资源审核后;2-内控法务部;3-方案入档")
121
+    @TableField(value = "step")
122
+    private Integer step;
119 123
 }

+ 1 - 1
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/mapper/PostAssessmentRatingOtherMapper.java

@@ -69,6 +69,6 @@ public interface PostAssessmentRatingOtherMapper extends BaseMapper<PostAssessme
69 69
 
70 70
     List<Long> getDeptIdList(Long id);
71 71
 
72
-    List<Map<String,String>> getDeptIdListByType(Integer type);
72
+    List<Map<String,Object>> getDeptIdListByType(Integer type);
73 73
 
74 74
 }

+ 7 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/mapper/PostListMapper.java

@@ -6,6 +6,7 @@ import com.ruoyi.postCheck.domain.PostCheckedItems;
6 6
 import com.ruoyi.postCheck.domain.PostList;
7 7
 import com.ruoyi.postCheck.domain.PostListInfo;
8 8
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
9
+import com.ruoyi.postCheck.domain.homePage.PostCheckedUnCheckedView;
9 10
 import org.apache.ibatis.annotations.Param;
10 11
 
11 12
 /**
@@ -89,4 +90,10 @@ public interface PostListMapper extends BaseMapper<PostList> {
89 90
     public int deletePostListInfoByPostListId(Long id);
90 91
 
91 92
     List<PostCheckedItems> contentListByType(@Param("deptId")Long deptId, @Param("postId")Long postId, @Param("type")Integer type);
93
+
94
+    Integer userTotal();
95
+
96
+    List<PostCheckedUnCheckedView> postChecked(Integer status);
97
+
98
+    Integer getPostCountByDeptId(Long deptId);
92 99
 }

+ 17 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/IPostCheckedProblemService.java

@@ -1,13 +1,18 @@
1 1
 package com.ruoyi.postCheck.service;
2 2
 
3
+import java.math.BigDecimal;
3 4
 import java.util.Date;
4 5
 import java.util.List;
6
+import java.util.Map;
5 7
 
6 8
 import com.ruoyi.common.annotation.Log;
7 9
 import com.ruoyi.common.core.domain.AjaxResult;
8 10
 import com.ruoyi.common.enums.BusinessType;
9 11
 import com.ruoyi.postCheck.domain.PostCheckedProblem;
10 12
 import com.baomidou.mybatisplus.extension.service.IService;
13
+import com.ruoyi.postCheck.domain.homePage.DeptProblemRectificationView;
14
+import com.ruoyi.postCheck.domain.homePage.PostCheckedProblemView;
15
+import com.ruoyi.postCheck.domain.homePage.PostCheckedUnCheckedView;
11 16
 import com.ruoyi.postCheck.domain.homePage.PostTotalView;
12 17
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
13 18
 import com.ruoyi.postCheck.domain.tools.ProblemCategory;
@@ -157,6 +162,18 @@ public interface IPostCheckedProblemService extends IService<PostCheckedProblem>
157 162
 
158 163
     PostTotalView totalView();
159 164
 
165
+    PostCheckedProblemView checkedProblem();
166
+
167
+    Integer userTotal();
168
+
169
+    Map<Integer, BigDecimal> problemRectification();
170
+
171
+    List<DeptProblemRectificationView>  deptProblemRectification();
172
+
173
+    List<PostCheckedUnCheckedView> postChecked(Integer i);
174
+
175
+    Integer getPostCountByDeptId(Long deptId);
176
+
160 177
     /**
161 178
      * 按问题属性分组统计问题类别
162 179
      * @return

+ 16 - 10
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostAssessmentRatingServiceImpl.java

@@ -1,7 +1,9 @@
1 1
 package com.ruoyi.postCheck.service.impl;
2 2
 
3 3
 import java.math.BigDecimal;
4
+import java.math.RoundingMode;
4 5
 import java.util.ArrayList;
6
+import java.util.Comparator;
5 7
 import java.util.List;
6 8
 import java.util.Map;
7 9
 import java.util.Optional;
@@ -77,11 +79,11 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
77 79
             type = 2;
78 80
         }
79 81
         List<PostAssessmentRating> postAssessmentRatings = new ArrayList<>();
80
-        List<Map<String, String>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(postAssessmentRating.getType());
82
+        List<Map<String, Object>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(postAssessmentRating.getType());
81 83
         List<PostAssessmentRules> postAssessmentRules = postAssessmentRulesMapper.selectList(Wrappers.lambdaQuery());
82
-        for (Map<String, String> map : deptIdListByType) {
84
+        for (Map<String, Object> map : deptIdListByType) {
83 85
             PostAssessmentRating post = new PostAssessmentRating();
84
-            post.setDeptId(Long.parseLong(map.get("deptId")));
86
+            post.setDeptId(Long.parseLong(map.get("deptId").toString()));
85 87
             post.setDeptIdStr(String.valueOf(map.get("deptName")));
86 88
             // 计算一个部门的岗检得分
87 89
             // 1 先查询问题
@@ -98,14 +100,17 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
98 100
                     Optional<PostAssessmentRules> first = postAssessmentRules.stream().filter(d ->d.getType() == type && d.getDutyType().equals(postCheckedProblem.getDutyType())).findFirst();
99 101
                     if (first.isPresent()){
100 102
                         if (postCheckedProblem.getProblemLevel().equals("1")){
101
-                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelOne())));
103
+                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelOne()!=null?first.get().getProblemLevelOne():"0")));
102 104
                         }else{
103
-                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelTwo())));
105
+                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelTwo()!=null?first.get().getProblemLevelTwo():"0")));
104 106
                         }
105 107
                     }
106 108
                 }
109
+                BigDecimal divide = new BigDecimal("0");
110
+                if (postTotal != null){
111
+                    divide =  new BigDecimal(postCheckedProblems.size()).divide(postTotal.multiply(new BigDecimal(collect.size())),4, RoundingMode.HALF_UP);
112
+                }
107 113
                 // 计算系数 1-问题总数/需要查的问题数
108
-                BigDecimal divide = new BigDecimal(postCheckedProblems.size()).divide(postTotal.multiply(new BigDecimal(collect.size())));
109 114
                 if (divide.compareTo(new BigDecimal("1")) < 0 && divide.compareTo(new BigDecimal("0")) > 0 ){
110 115
                     postSouce = postAfter.multiply(new BigDecimal("1").subtract(divide));
111 116
                 }else{
@@ -119,7 +124,7 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
119 124
 
120 125
             List<PostAssessmentRatingOtherInfo> postAssessmentRatingOtherInfos = postAssessmentRatingOtherInfoMapper.selectList(Wrappers.<PostAssessmentRatingOtherInfo>lambdaQuery()
121 126
                     .eq(PostAssessmentRatingOtherInfo::getByDeptId,post.getDeptId())
122
-                    .apply("and \"rating_other_id\" in (SELECT \"id\" FROM \"public\".\"post_assessment_rating_other\" WHERE \"type\"  = 1\n)")
127
+                    .apply(" \"rating_other_id\" in (SELECT \"id\" FROM \"public\".\"post_assessment_rating_other\" WHERE \"type\"  = 1\n)")
123 128
                     .orderByAsc(PostAssessmentRatingOtherInfo::getByDeptScore)
124 129
             );
125 130
             BigDecimal peerEvaluationScore = new BigDecimal("100");
@@ -128,17 +133,18 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
128 133
                 postAssessmentRatingOtherInfos.remove(0);
129 134
                 BigDecimal sum = new BigDecimal("0");
130 135
                 postAssessmentRatingOtherInfos.forEach(x -> {
131
-                    sum.add(x.getByDeptScore());
136
+                    sum.add(x.getByDeptScore()!=null?x.getByDeptScore():new BigDecimal("0"));
132 137
                 });
133
-                peerEvaluationScore = sum.divide(new BigDecimal(postAssessmentRatingOtherInfos.size()));
138
+                peerEvaluationScore = sum.divide(new BigDecimal(postAssessmentRatingOtherInfos.size()),4, RoundingMode.HALF_UP);
134 139
             }
135 140
             post.setPeerEvaluationScore(peerEvaluationScore);
136 141
             postAssessmentRatings.add(post);
137 142
             // 计算总得分
138 143
             post.setDepartmentScore(post.getPositionScore().add(post.getPeerEvaluationScore()).divide(new BigDecimal("2")));
139 144
         }
145
+        List<PostAssessmentRating> collect = postAssessmentRatings.stream().sorted(Comparator.comparing(PostAssessmentRating::getDepartmentScore).reversed()).collect(Collectors.toList());
140 146
         // 计算  岗检得分
141
-        return postAssessmentRatings;
147
+        return collect;
142 148
     }
143 149
 
144 150
     /**

+ 120 - 1
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostCheckedProblemServiceImpl.java

@@ -2,9 +2,14 @@ package com.ruoyi.postCheck.service.impl;
2 2
 
3 3
 import java.awt.dnd.DropTarget;
4 4
 import java.math.BigDecimal;
5
+import java.math.RoundingMode;
6
+import java.util.ArrayList;
5 7
 import java.util.Date;
8
+import java.util.HashMap;
6 9
 import java.util.List;
10
+import java.util.Map;
7 11
 import java.util.Optional;
12
+import java.util.stream.Collectors;
8 13
 
9 14
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
10 15
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -16,6 +21,9 @@ import com.ruoyi.postCheck.domain.PostAssessmentRules;
16 21
 import com.ruoyi.postCheck.domain.PostList;
17 22
 import com.ruoyi.postCheck.domain.PostPlan;
18 23
 import com.ruoyi.postCheck.domain.PostPlanInfo;
24
+import com.ruoyi.postCheck.domain.homePage.DeptProblemRectificationView;
25
+import com.ruoyi.postCheck.domain.homePage.PostCheckedProblemView;
26
+import com.ruoyi.postCheck.domain.homePage.PostCheckedUnCheckedView;
19 27
 import com.ruoyi.postCheck.domain.homePage.PostTotalView;
20 28
 import com.ruoyi.postCheck.domain.join.PostPlanJoinProblem;
21 29
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
@@ -61,7 +69,6 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
61 69
     private IPostPlanJoinProblemService postPlanJoinProblemService;
62 70
     @Autowired
63 71
     private PostListMapper postListMapper;
64
-
65 72
     /**
66 73
      * 查询岗检问题表
67 74
      *
@@ -499,6 +506,118 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
499 506
         return postTotalView;
500 507
     }
501 508
 
509
+    @Override
510
+    public PostCheckedProblemView checkedProblem() {
511
+        List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.lambdaQuery());
512
+        Integer problemComplete = 0;
513
+        Integer problemSuitable = 0;
514
+        Integer problemEffective = 0;
515
+        //(1-完整问题;2-有效性问题;3-适宜性问题;)
516
+        if (!postCheckedProblems.isEmpty())
517
+            for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
518
+                if (postCheckedProblem.getProblemAttribute()!=null && postCheckedProblem.getProblemAttribute() == 1)
519
+                    problemComplete++;
520
+                if (postCheckedProblem.getProblemAttribute()!=null && postCheckedProblem.getProblemAttribute() == 3)
521
+                    problemEffective++;
522
+                if (postCheckedProblem.getProblemAttribute()!=null && postCheckedProblem.getProblemAttribute() == 2)
523
+                    problemSuitable++;
524
+            }
525
+        PostCheckedProblemView post = new PostCheckedProblemView();
526
+        post.setProblemTotal(postCheckedProblems.size());
527
+        post.setProblemComplete(problemComplete);
528
+        post.setProblemSuitable(problemSuitable);
529
+        post.setProblemEffective(problemEffective);
530
+        return post;
531
+    }
532
+
533
+    @Override
534
+    public Integer userTotal() {
535
+        return postListMapper.userTotal();
536
+    }
537
+
538
+    @Override
539
+    public Map<Integer, BigDecimal> problemRectification() {
540
+        List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.lambdaQuery());
541
+        Integer problemComplete = 0;
542
+        Integer overproblemComplete = 0;
543
+        Integer problemSuitable = 0;
544
+        Integer overproblemSuitable = 0;
545
+        Integer problemEffective = 0;
546
+        Integer overproblemEffective = 0;
547
+        Integer total = 0;
548
+        Integer overtotal = 0;
549
+        //(1-完整问题;2-有效性问题;3-适宜性问题;4 总数)
550
+        if (!postCheckedProblems.isEmpty())
551
+            for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
552
+                if (postCheckedProblem.getProblemAttribute()!=null&&postCheckedProblem.getProblemAttribute() == 1) {
553
+                    problemComplete++;
554
+                    if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
555
+                        overproblemComplete++;
556
+                    }
557
+                }
558
+                if (postCheckedProblem.getProblemAttribute()!=null&&postCheckedProblem.getProblemAttribute() == 3) {
559
+                    problemEffective++;
560
+                    if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
561
+                        overproblemEffective++;
562
+                    }
563
+                }
564
+                if (postCheckedProblem.getProblemAttribute()!=null&&postCheckedProblem.getProblemAttribute() == 2) {
565
+                    problemSuitable++;
566
+                    if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
567
+                        overproblemSuitable++;
568
+                    }
569
+                }
570
+                total++;
571
+                if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
572
+                    overtotal++;
573
+                }
574
+            }
575
+        Map<Integer, BigDecimal> map = new HashMap<>();
576
+        map.put(1, new BigDecimal(overproblemComplete).divide(new BigDecimal(problemComplete),4, RoundingMode.HALF_UP));
577
+        map.put(2, new BigDecimal(overproblemSuitable).divide(new BigDecimal(problemSuitable),4, RoundingMode.HALF_UP));
578
+        map.put(3, new BigDecimal(overproblemEffective).divide(new BigDecimal(problemEffective),4, RoundingMode.HALF_UP));
579
+        map.put(4, new BigDecimal(overtotal).divide(new BigDecimal(total),4, RoundingMode.HALF_UP));
580
+        return map;
581
+
582
+    }
583
+
584
+    @Override
585
+    public List<DeptProblemRectificationView> deptProblemRectification() {
586
+        List<DeptProblemRectificationView> dataList = new ArrayList<>();
587
+        List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.lambdaQuery());
588
+        if (!postCheckedProblems.isEmpty()){
589
+            Map<Long, List<PostCheckedProblem>> postMapListMap = postCheckedProblems.stream().collect(Collectors.groupingBy(PostCheckedProblem::getCheckedDeptId));
590
+            for (Map.Entry<Long, List<PostCheckedProblem>> entry : postMapListMap.entrySet()) {
591
+                DeptProblemRectificationView data1 = new DeptProblemRectificationView();
592
+                data1.setDeptId(entry.getKey());
593
+                data1.setDeptName(postAssessmentRatingMapper.getSysDeptName(entry.getKey()));
594
+                Integer problemTotal = 0;
595
+                Integer problemComplete = 0;
596
+                for (PostCheckedProblem postCheckedProblem : entry.getValue()) {
597
+                    problemTotal++;
598
+                    if (postCheckedProblem.getIsRectificationCompleted()!=null&&postCheckedProblem.getIsRectificationCompleted() == 1){
599
+                        problemComplete++;
600
+                    }
601
+                }
602
+                data1.setProblemTotal(problemTotal);
603
+                data1.setProblemComplete(problemComplete);
604
+                data1.setProblemRectificationRate(new BigDecimal(problemComplete).divide(new BigDecimal(problemTotal),4, RoundingMode.HALF_UP));
605
+                dataList.add(data1);
606
+            }
607
+        }
608
+        return dataList;
609
+    }
610
+
611
+    @Override
612
+    public List<PostCheckedUnCheckedView> postChecked(Integer i) {
613
+        return postListMapper.postChecked(i);
614
+    }
615
+
616
+    @Override
617
+    public Integer getPostCountByDeptId(Long deptId) {
618
+        return postListMapper.getPostCountByDeptId(deptId);
619
+    }
620
+
502 621
     /**
503 622
      * 按问题属性分组统计问题类别
504 623
      *

+ 13 - 35
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostProgrammeServiceImpl.java

@@ -8,6 +8,7 @@ import com.ruoyi.common.constant.PostCheckedProblemEnum;
8 8
 import com.ruoyi.common.constant.PostPlanEnum;
9 9
 import com.ruoyi.common.constant.PostProgrammeEnum;
10 10
 import com.ruoyi.common.utils.DateUtils;
11
+import com.ruoyi.common.utils.SecurityUtils;
11 12
 import org.apache.commons.lang3.StringUtils;
12 13
 import org.springframework.beans.factory.annotation.Autowired;
13 14
 import org.springframework.stereotype.Service;
@@ -24,6 +25,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
24 25
  */
25 26
 @Service
26 27
 public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, PostProgramme> implements IPostProgrammeService {
28
+
27 29
     @Autowired
28 30
     private PostProgrammeMapper postProgrammeMapper;
29 31
 
@@ -116,7 +118,6 @@ public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, P
116 118
         if (id == null || statusHr == null) {
117 119
             return 0;
118 120
         }
119
-
120 121
         //状态错误
121 122
         if (statusHr != PostProgrammeEnum.STATUS_HR_PASS.getValue() && statusHr != PostProgrammeEnum.STATUS_HR_BACK.getValue()) {
122 123
             return 0;
@@ -127,45 +128,26 @@ public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, P
127 128
             return 0;
128 129
         }
129 130
 
130
-        //TODO 待开发:权限和顺序判断
131
-        //TODO 待开发:权限和顺序判断
132
-        //TODO 待开发:权限和顺序判断
133
-        //TODO 待开发:权限和顺序判断
134
-        //TODO 待开发:权限和顺序判断
135
-
136
-        //        1、当前状态是否允许修改
137
-
138
-        //        、、
139
-        //        、、
140
-        //        、、
141
-        //        、、
142
-        //        、、
143
-        //2、当前用户是否有权限
144
-        //、、
145
-        //、、
146
-        //、、
147
-        //、、
148
-        //、、
149
-        //、、
150 131
         PostProgramme data = new PostProgramme();
132
+
151 133
         data.setId(id);
152 134
         data.setStatusHr(statusHr);
153 135
         data.setReasonHr(reasonHr);
154
-
136
+        data.setDateHr(DateUtils.getNowDate());
137
+        data.setStatusHrUserId(SecurityUtils.getUserId());
155 138
         if (statusHr == PostPlanEnum.STATUS_HR_PASS.getValue()) {
156 139
             data.setStatus(PostProgrammeEnum.STATUS_ING.getValue());//审核中
140
+            data.setStep(PostProgrammeEnum.STEP_HR.getValue());
157 141
         } else {
158 142
             data.setStatus(PostPlanEnum.STATUS_BACK.getValue());//驳回
159 143
         }
160
-
161
-
162 144
         return postProgrammeMapper.updatePostProgramme(data);
163 145
     }
164 146
 
165 147
     /**
166 148
      * 审核2:岗检方案审核-Icfa
167 149
      *
168
-     * @param id         主键ID
150
+     * @param id       主键ID
169 151
      * @param statusIcfa 2-内控法务部审批-状态:1-待审核;3-通过;4-驳回;
170 152
      * @param reasonIcfa 2-内控法务部审批-未通过理由
171 153
      * @return
@@ -176,30 +158,26 @@ public class PostProgrammeServiceImpl extends ServiceImpl<PostProgrammeMapper, P
176 158
         if (id == null || statusIcfa == null) {
177 159
             return 0;
178 160
         }
179
-
180 161
         //状态错误
181 162
         if (statusIcfa != PostProgrammeEnum.STATUS_ICFA_PASS.getValue() && statusIcfa != PostProgrammeEnum.STATUS_ICFA_BACK.getValue()) {
182 163
             return 0;
183 164
         }
184
-
185 165
         //未写理由
186 166
         if (statusIcfa == PostProgrammeEnum.STATUS_ICFA_BACK.getValue() && StringUtils.isBlank(reasonIcfa)) {
187 167
             return 0;
188 168
         }
189 169
 
190
-        //TODO 待开发:权限、顺序 判断
191
-        //TODO 待开发:权限、顺序 判断
192
-        //TODO 待开发:权限、顺序 判断
193
-        //TODO 待开发:权限、顺序 判断
194
-        //TODO 待开发:权限、顺序 判断
195
-
196
-
197
-
198 170
         PostProgramme data = new PostProgramme();
171
+
199 172
         data.setId(id);
200 173
         data.setStatusIcfa(statusIcfa);
201 174
         data.setReasonIcfa(reasonIcfa);
202 175
         data.setStatus(statusIcfa);//最终审核结果
176
+        data.setStep(PostProgrammeEnum.STEP_ICFA.getValue());
177
+        data.setStatusIcfaUserId(SecurityUtils.getUserId());
178
+        data.setDateIcfa(DateUtils.getNowDate());
203 179
         return postProgrammeMapper.updatePostProgramme(data);
180
+
181
+
204 182
     }
205 183
 }

+ 1 - 1
ruoyi-postcheck/src/main/resources/mapper/postCheck/PostAssessmentRatingOtherMapper.xml

@@ -178,6 +178,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
178 178
     </select>
179 179
 
180 180
     <select id="getDeptIdListByType" resultType="java.util.Map">
181
-        SELECT "dept_id" as deptId,"dept_name" as deptName FROM "public"."sys_dept" where "type" = #{type};
181
+        SELECT "dept_id" as deptId,"dept_name" as deptName FROM "public"."sys_dept" where "type" = #{type} group by "dept_id","dept_name"
182 182
     </select>
183 183
 </mapper>

+ 25 - 0
ruoyi-postcheck/src/main/resources/mapper/postCheck/PostListMapper.xml

@@ -294,4 +294,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
294 294
         AND t1."post_id" = #{postId}
295 295
         AND t2."type" = #{type}
296 296
     </select>
297
+
298
+    <select id="userTotal" resultType="java.lang.Integer">
299
+        SELECT count(0) FROM "public"."sys_users"
300
+    </select>
301
+
302
+    <select id="postChecked" resultType="com.ruoyi.postCheck.domain.homePage.PostCheckedUnCheckedView">
303
+        SELECT
304
+            t2."checked_dept_id" deptId ,
305
+            t2.checked_post_id postId,
306
+            (select a."post_name" from "public"."sys_post" a WHERE a."post_id" = t2.checked_post_id) AS postName,
307
+            (select aa."dept_name" from "public"."sys_dept" aa WHERE aa."dept_id" = t2.checked_dept_id) AS deptName,
308
+            (select count(0) from "public"."sys_user_post" a LEFT JOIN "public"."sys_users" b ON a."user_id" = b."user_id" WHERE a."post_id" = t2."checked_post_id") AS "userCount"
309
+        FROM "post_plan" t1
310
+                 INNER JOIN "post_plan_info" t2 ON t2."post_plan_id" = t1."id"
311
+        WHERE t1.status = 3 -- 状态:1-待审核;2-审核中;3-通过;4-驳回;
312
+          AND t2."status" = #{status} -- 岗检状态:1-未检;2-已检;
313
+        GROUP BY t2."checked_dept_id", t2."checked_post_id"
314
+        ORDER BY t2."checked_dept_id"
315
+    </select>
316
+
317
+    <select id="getPostCountByDeptId" resultType="java.lang.Integer">
318
+        SELECT COUNT(0) FROM "public"."sys_user_post" sup LEFT JOIN "public"."sys_user_role" sur ON sup."user_id" = sur."user_id"
319
+                                                          LEFT JOIN "public"."sys_role_dept" srd ON sur."role_id" = srd."role_id"
320
+        WHERE srd."dept_id" = #{deptId}
321
+    </select>
297 322
 </mapper>

+ 34 - 1
ruoyi-postcheck/src/main/resources/mapper/postCheck/PostProgrammeMapper.xml

@@ -32,6 +32,35 @@
32 32
     </resultMap>
33 33
 
34 34
     <sql id="selectPostProgrammeVo">
35
+        <!--
36
+        select
37
+            id,
38
+            name,
39
+            submit_date,
40
+            status_hr,
41
+            date_hr,
42
+            reason_hr,
43
+            status_icfa,
44
+            date_icfa,
45
+            reason_icfa,
46
+            remark,
47
+            del_flag,
48
+            create_time,
49
+            create_by,
50
+            update_time,
51
+            update_by,
52
+            create_user_id,
53
+            disk_path,
54
+            dept_id,
55
+            dept_name,
56
+            status,
57
+            status_time,
58
+            status_user_id,
59
+            status_icfa_user_id,
60
+            status_hr_user_id,
61
+            step
62
+        from post_programme
63
+        -->
35 64
         select
36 65
             t1.id,
37 66
             t1.name,
@@ -56,7 +85,8 @@
56 85
             t1.status_time,
57 86
             t1.status_user_id,
58 87
             t1.status_icfa_user_id,
59
-            t1.status_hr_user_id
88
+            t1.status_hr_user_id,
89
+            step
60 90
         from post_programme t1
61 91
     </sql>
62 92
 
@@ -115,6 +145,7 @@
115 145
             <if test="statusUserId != null">status_user_id,</if>
116 146
             <if test="statusIcfaUserId != null">status_icfa_user_id,</if>
117 147
             <if test="statusHrUserId != null">status_hr_user_id,</if>
148
+            <if test="step != null">step,</if>
118 149
         </trim>
119 150
         <trim prefix="values (" suffix=")" suffixOverrides=",">
120 151
             <if test="id != null">#{id},</if>
@@ -141,6 +172,7 @@
141 172
             <if test="statusUserId != null">#{statusUserId},</if>
142 173
             <if test="statusIcfaUserId != null">#{statusIcfaUserId},</if>
143 174
             <if test="statusHrUserId != null">#{statusHrUserId},</if>
175
+            <if test="step != null">#{step},</if>
144 176
         </trim>
145 177
     </insert>
146 178
 
@@ -170,6 +202,7 @@
170 202
             <if test="statusUserId != null">status_user_id = #{statusUserId},</if>
171 203
             <if test="statusIcfaUserId != null">status_icfa_user_id = #{statusIcfaUserId},</if>
172 204
             <if test="statusHrUserId != null">status_hr_user_id = #{statusHrUserId},</if>
205
+            <if test="step != null">step = #{step},</if>
173 206
         </trim>
174 207
         where id = #{id}
175 208
     </update>

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
61 61
 	</select>
62 62
 
63 63
     <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
64
-		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
64
+		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.dept_code,
65 65
 			(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
66 66
 		from sys_dept d
67 67
 		where d.dept_id = #{deptId}