zhangjiansheng 10 kuukautta sitten
vanhempi
commit
888136d236

+ 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
 }

+ 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 io.swagger.annotations.ApiImplicitParam;
13 18
 import io.swagger.annotations.ApiImplicitParams;
@@ -154,4 +159,16 @@ public interface IPostCheckedProblemService extends IService<PostCheckedProblem>
154 159
 
155 160
 
156 161
     PostTotalView totalView();
162
+
163
+    PostCheckedProblemView checkedProblem();
164
+
165
+    Integer userTotal();
166
+
167
+    Map<Integer, BigDecimal> problemRectification();
168
+
169
+    List<DeptProblemRectificationView>  deptProblemRectification();
170
+
171
+    List<PostCheckedUnCheckedView> postChecked(Integer i);
172
+
173
+    Integer getPostCountByDeptId(Long deptId);
157 174
 }

+ 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
     /**

+ 136 - 14
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.mapper.PostAssessmentRatingMapper;
@@ -24,6 +32,7 @@ import com.ruoyi.postCheck.mapper.PostListMapper;
24 32
 import com.ruoyi.postCheck.mapper.PostPlanInfoMapper;
25 33
 import com.ruoyi.postCheck.mapper.PostPlanMapper;
26 34
 import com.ruoyi.postCheck.service.IPostPlanJoinProblemService;
35
+import io.swagger.annotations.ApiModelProperty;
27 36
 import lombok.Data;
28 37
 import org.apache.commons.lang3.StringUtils;
29 38
 import org.springframework.beans.factory.annotation.Autowired;
@@ -66,6 +75,7 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
66 75
     private IPostPlanJoinProblemService postPlanJoinProblemService;
67 76
     @Autowired
68 77
     private PostListMapper postListMapper;
78
+
69 79
     /**
70 80
      * 查询岗检问题表
71 81
      *
@@ -157,7 +167,7 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
157 167
         PostPlanInfo postPlanInfo = postPlanInfoMapper.selectById(planInfoId);
158 168
         PostPlan postPlan = postPlanMapper.selectById(postPlanInfo.getPostPlanId());
159 169
         List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
160
-                        .eq(PostCheckedProblem::getCheckedDeptId,departmentId)
170
+                .eq(PostCheckedProblem::getCheckedDeptId, departmentId)
161 171
                 .between(PostCheckedProblem::getCreateTime, postPlan.getStartTime(), postPlan.getEndTime())
162 172
 
163 173
         );
@@ -173,37 +183,37 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
173 183
             Optional<PostAssessmentRules> first = postAssessmentRules.stream().filter(d -> d.getDutyType().equals(postCheckedProblem.getDutyType())).findFirst();
174 184
             if (first.isPresent() && score.compareTo(new BigDecimal("0")) > 0) {
175 185
                 // 计算岗检得分
176
-                if (postCheckedProblem.getProblemLevel().equals("1")){
186
+                if (postCheckedProblem.getProblemLevel().equals("1")) {
177 187
                     score = score.subtract(first.get().getProblemLevelOne());
178
-                }else if(postCheckedProblem.getProblemLevel().equals("2")){
188
+                } else if (postCheckedProblem.getProblemLevel().equals("2")) {
179 189
                     score = score.subtract(first.get().getProblemLevelTwo());
180 190
                 }
181 191
             }
182 192
         }
183 193
 
184 194
         // todo 公式计算
185
-        if (postCheckedProblems.size()>0){
195
+        if (postCheckedProblems.size() > 0) {
186 196
             BigDecimal bigDecimal = new BigDecimal("1");
187 197
             List<PostPlanInfo> postPlanInfos = postPlanInfoMapper.selectList(Wrappers.<PostPlanInfo>lambdaQuery()
188
-                    .eq(PostPlanInfo::getPostPlanId,postPlan.getId())
198
+                    .eq(PostPlanInfo::getPostPlanId, postPlan.getId())
189 199
             );
190
-            if (postPlanInfos.size() <= 0){
200
+            if (postPlanInfos.size() <= 0) {
191 201
                 score = new BigDecimal("0");
192
-            }else{
202
+            } else {
193 203
                 BigDecimal divide = new BigDecimal(postCheckedProblems.size()).divide(new BigDecimal(postPlanInfos.size()).multiply(new BigDecimal("6")));
194
-                if (divide.compareTo(new BigDecimal("0"))<=0 || divide.compareTo(new BigDecimal("1")) > 0){
204
+                if (divide.compareTo(new BigDecimal("0")) <= 0 || divide.compareTo(new BigDecimal("1")) > 0) {
195 205
                     score = new BigDecimal("0");
196
-                }else{
206
+                } else {
197 207
                     score = bigDecimal.subtract(divide);
198 208
                 }
199 209
             }
200
-        }else{
210
+        } else {
201 211
             score = new BigDecimal("0");
202 212
         }
203
-        postAssessmentRatingMapper.update(null,Wrappers.<PostAssessmentRating>lambdaUpdate()
204
-                .set(PostAssessmentRating::getPositionScore,score)
205
-                .eq(PostAssessmentRating::getDeptId,departmentId)
206
-                .eq(PostAssessmentRating::getPlanId,postPlan.getId())
213
+        postAssessmentRatingMapper.update(null, Wrappers.<PostAssessmentRating>lambdaUpdate()
214
+                .set(PostAssessmentRating::getPositionScore, score)
215
+                .eq(PostAssessmentRating::getDeptId, departmentId)
216
+                .eq(PostAssessmentRating::getPlanId, postPlan.getId())
207 217
         );
208 218
     }
209 219
 
@@ -502,5 +512,117 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
502 512
         postTotalView.setUncheckedPostCount(uncheckedPostCount);
503 513
         return postTotalView;
504 514
     }
515
+
516
+    @Override
517
+    public PostCheckedProblemView checkedProblem() {
518
+        List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.lambdaQuery());
519
+        Integer problemComplete = 0;
520
+        Integer problemSuitable = 0;
521
+        Integer problemEffective = 0;
522
+        //(1-完整问题;2-有效性问题;3-适宜性问题;)
523
+        if (!postCheckedProblems.isEmpty())
524
+            for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
525
+                if (postCheckedProblem.getProblemAttribute()!=null && postCheckedProblem.getProblemAttribute() == 1)
526
+                    problemComplete++;
527
+                if (postCheckedProblem.getProblemAttribute()!=null && postCheckedProblem.getProblemAttribute() == 3)
528
+                    problemEffective++;
529
+                if (postCheckedProblem.getProblemAttribute()!=null && postCheckedProblem.getProblemAttribute() == 2)
530
+                    problemSuitable++;
531
+            }
532
+        PostCheckedProblemView post = new PostCheckedProblemView();
533
+        post.setProblemTotal(postCheckedProblems.size());
534
+        post.setProblemComplete(problemComplete);
535
+        post.setProblemSuitable(problemSuitable);
536
+        post.setProblemEffective(problemEffective);
537
+        return post;
538
+    }
539
+
540
+    @Override
541
+    public Integer userTotal() {
542
+        return postListMapper.userTotal();
543
+    }
544
+
545
+    @Override
546
+    public Map<Integer, BigDecimal> problemRectification() {
547
+        List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.lambdaQuery());
548
+        Integer problemComplete = 0;
549
+        Integer overproblemComplete = 0;
550
+        Integer problemSuitable = 0;
551
+        Integer overproblemSuitable = 0;
552
+        Integer problemEffective = 0;
553
+        Integer overproblemEffective = 0;
554
+        Integer total = 0;
555
+        Integer overtotal = 0;
556
+        //(1-完整问题;2-有效性问题;3-适宜性问题;4 总数)
557
+        if (!postCheckedProblems.isEmpty())
558
+            for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
559
+                if (postCheckedProblem.getProblemAttribute()!=null&&postCheckedProblem.getProblemAttribute() == 1) {
560
+                    problemComplete++;
561
+                    if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
562
+                        overproblemComplete++;
563
+                    }
564
+                }
565
+                if (postCheckedProblem.getProblemAttribute()!=null&&postCheckedProblem.getProblemAttribute() == 3) {
566
+                    problemEffective++;
567
+                    if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
568
+                        overproblemEffective++;
569
+                    }
570
+                }
571
+                if (postCheckedProblem.getProblemAttribute()!=null&&postCheckedProblem.getProblemAttribute() == 2) {
572
+                    problemSuitable++;
573
+                    if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
574
+                        overproblemSuitable++;
575
+                    }
576
+                }
577
+                total++;
578
+                if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
579
+                    overtotal++;
580
+                }
581
+            }
582
+        Map<Integer, BigDecimal> map = new HashMap<>();
583
+        map.put(1, new BigDecimal(overproblemComplete).divide(new BigDecimal(problemComplete),4, RoundingMode.HALF_UP));
584
+        map.put(2, new BigDecimal(overproblemSuitable).divide(new BigDecimal(problemSuitable),4, RoundingMode.HALF_UP));
585
+        map.put(3, new BigDecimal(overproblemEffective).divide(new BigDecimal(problemEffective),4, RoundingMode.HALF_UP));
586
+        map.put(4, new BigDecimal(overtotal).divide(new BigDecimal(total),4, RoundingMode.HALF_UP));
587
+        return map;
588
+
589
+    }
590
+
591
+    @Override
592
+    public List<DeptProblemRectificationView> deptProblemRectification() {
593
+        List<DeptProblemRectificationView> dataList = new ArrayList<>();
594
+        List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.lambdaQuery());
595
+        if (!postCheckedProblems.isEmpty()){
596
+            Map<Long, List<PostCheckedProblem>> postMapListMap = postCheckedProblems.stream().collect(Collectors.groupingBy(PostCheckedProblem::getCheckedDeptId));
597
+            for (Map.Entry<Long, List<PostCheckedProblem>> entry : postMapListMap.entrySet()) {
598
+                DeptProblemRectificationView data1 = new DeptProblemRectificationView();
599
+                data1.setDeptId(entry.getKey());
600
+                data1.setDeptName(postAssessmentRatingMapper.getSysDeptName(entry.getKey()));
601
+                Integer problemTotal = 0;
602
+                Integer problemComplete = 0;
603
+                for (PostCheckedProblem postCheckedProblem : entry.getValue()) {
604
+                    problemTotal++;
605
+                    if (postCheckedProblem.getIsRectificationCompleted()!=null&&postCheckedProblem.getIsRectificationCompleted() == 1){
606
+                        problemComplete++;
607
+                    }
608
+                }
609
+                data1.setProblemTotal(problemTotal);
610
+                data1.setProblemComplete(problemComplete);
611
+                data1.setProblemRectificationRate(new BigDecimal(problemComplete).divide(new BigDecimal(problemTotal),4, RoundingMode.HALF_UP));
612
+                dataList.add(data1);
613
+            }
614
+        }
615
+        return dataList;
616
+    }
617
+
618
+    @Override
619
+    public List<PostCheckedUnCheckedView> postChecked(Integer i) {
620
+        return postListMapper.postChecked(i);
621
+    }
622
+
623
+    @Override
624
+    public Integer getPostCountByDeptId(Long deptId) {
625
+        return postListMapper.getPostCountByDeptId(deptId);
626
+    }
505 627
 }
506 628
 

+ 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

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