csg6 il y a 10 mois
Parent
commit
b75aaf81ec

+ 20 - 1
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostCheckedProblemController.java

@@ -3,6 +3,9 @@ package com.ruoyi.postCheck.controller;
3 3
 import java.util.Date;
4 4
 import java.util.List;
5 5
 import javax.servlet.http.HttpServletResponse;
6
+
7
+import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
8
+import com.ruoyi.postCheck.domain.tools.ProblemCategory;
6 9
 import io.swagger.annotations.*;
7 10
 import org.springframework.security.access.prepost.PreAuthorize;
8 11
 import org.springframework.beans.factory.annotation.Autowired;
@@ -84,7 +87,9 @@ public class PostCheckedProblemController extends BaseController {
84 87
     @PreAuthorize("@ss.hasPermi('postCheck:postCheckedProblem:list')")
85 88
     @GetMapping("/list")
86 89
     public TableDataInfo list(PostCheckedProblem postCheckedProblem) {
87
-        startPage();
90
+
91
+//        startPage();
92
+        startPage("desc","t1.create_time");
88 93
         List<PostCheckedProblem> list = postCheckedProblemService.selectPostCheckedProblemList(postCheckedProblem);
89 94
         return getDataTable(list);
90 95
     }
@@ -361,4 +366,18 @@ public class PostCheckedProblemController extends BaseController {
361 366
         return toAjax(postCheckedProblemService.setReviewDepartmentReviewerTime(id, status, reviewConclusion, reason));
362 367
     }
363 368
 
369
+
370
+
371
+    @ApiOperation("Tools-1、按问题属性分组统计问题类别")
372
+    @GetMapping("/problemCategoryByAttribute")
373
+    public AjaxResult problemCategoryByAttribute(ProblemCategory noParam) {
374
+
375
+// GROUP BY problem_attribute -- 问题属性(1-完整问题;2-有效性问题;3-适宜性问题;)
376
+// GROUP BY problem_category -- 问题类别(职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他)
377
+
378
+        List<ProblemCategory> problemCategoryByAttributeList = postCheckedProblemService.problemCategoryByAttribute();
379
+
380
+        return success(problemCategoryByAttributeList);
381
+    }
382
+
364 383
 }

+ 66 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/domain/tools/ProblemCategory.java

@@ -0,0 +1,66 @@
1
+package com.ruoyi.postCheck.domain.tools;
2
+
3
+import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+@ApiModel(value = "按问题属性分组统计问题类别")
9
+@Data
10
+public class ProblemCategory extends ProblemNumberBase {
11
+
12
+    @ApiModelProperty("问题属性(1-完整问题;2-有效性问题;3-适宜性问题;)")
13
+    private Integer problemAttribute;
14
+    @ApiModelProperty("问题属性显示名称")
15
+    private String problemAttributeView;
16
+
17
+//        @ApiModelProperty("职责权限问题")
18
+//        private Integer problemCategoryOne;
19
+
20
+//        @ApiModelProperty("工作内容问题")
21
+//        private Integer problemCategoryTwo;
22
+
23
+//        @ApiModelProperty("工作标准问题")
24
+//        private Integer problemCategoryThree;
25
+
26
+//        @ApiModelProperty("考核奖励问题")
27
+//        private Integer problemCategoryFour;
28
+
29
+//        @ApiModelProperty("任职资格问题")
30
+//        private Integer problemCategoryFive;
31
+
32
+//        @ApiModelProperty("其他")
33
+//        private Integer problemCategorySix;
34
+
35
+//        @ApiModelProperty("总数量")
36
+//        private Integer problemTotal;
37
+
38
+    public void setProblemAttribute(Integer problemAttribute) {
39
+        this.problemAttribute = problemAttribute;
40
+
41
+        if (problemAttribute != null)
42
+            switch (problemAttribute) {
43
+                case 1: {
44
+                    setProblemAttributeView("完整问题");
45
+
46
+                    break;
47
+                }
48
+                case 2: {
49
+                    setProblemAttributeView("有效性问题");
50
+
51
+                    break;
52
+                }
53
+                case 3: {
54
+                    setProblemAttributeView("适宜性问题");
55
+
56
+                    break;
57
+                }
58
+
59
+                default:
60
+                    setProblemAttributeView("Other");
61
+                    break;
62
+            }
63
+    }
64
+
65
+
66
+}

+ 8 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/mapper/PostCheckedProblemMapper.java

@@ -4,6 +4,8 @@ import java.math.BigDecimal;
4 4
 import java.util.List;
5 5
 import com.ruoyi.postCheck.domain.PostCheckedProblem;
6 6
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
7
+import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
8
+import com.ruoyi.postCheck.domain.tools.ProblemCategory;
7 9
 
8 10
 /**
9 11
  * 岗检问题表Mapper接口
@@ -64,4 +66,10 @@ public interface PostCheckedProblemMapper extends BaseMapper<PostCheckedProblem>
64 66
     BigDecimal getPostTotalByDeptId(Long deptId);
65 67
 
66 68
     Integer selectCheckedPostCount(int status);
69
+
70
+    /**
71
+     * 按问题属性分组统计问题类别
72
+     * @return
73
+     */
74
+    List<ProblemCategory> problemCategoryByAttribute();
67 75
 }

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

@@ -9,6 +9,8 @@ import com.ruoyi.common.enums.BusinessType;
9 9
 import com.ruoyi.postCheck.domain.PostCheckedProblem;
10 10
 import com.baomidou.mybatisplus.extension.service.IService;
11 11
 import com.ruoyi.postCheck.domain.homePage.PostTotalView;
12
+import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
13
+import com.ruoyi.postCheck.domain.tools.ProblemCategory;
12 14
 import io.swagger.annotations.ApiImplicitParam;
13 15
 import io.swagger.annotations.ApiImplicitParams;
14 16
 import io.swagger.annotations.ApiOperation;
@@ -154,4 +156,10 @@ public interface IPostCheckedProblemService extends IService<PostCheckedProblem>
154 156
 
155 157
 
156 158
     PostTotalView totalView();
159
+
160
+    /**
161
+     * 按问题属性分组统计问题类别
162
+     * @return
163
+     */
164
+    List<ProblemCategory> problemCategoryByAttribute();
157 165
 }

+ 91 - 22
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostCheckedProblemServiceImpl.java

@@ -18,12 +18,15 @@ import com.ruoyi.postCheck.domain.PostPlan;
18 18
 import com.ruoyi.postCheck.domain.PostPlanInfo;
19 19
 import com.ruoyi.postCheck.domain.homePage.PostTotalView;
20 20
 import com.ruoyi.postCheck.domain.join.PostPlanJoinProblem;
21
+import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
22
+import com.ruoyi.postCheck.domain.tools.ProblemCategory;
21 23
 import com.ruoyi.postCheck.mapper.PostAssessmentRatingMapper;
22 24
 import com.ruoyi.postCheck.mapper.PostAssessmentRulesMapper;
23 25
 import com.ruoyi.postCheck.mapper.PostListMapper;
24 26
 import com.ruoyi.postCheck.mapper.PostPlanInfoMapper;
25 27
 import com.ruoyi.postCheck.mapper.PostPlanMapper;
26 28
 import com.ruoyi.postCheck.service.IPostPlanJoinProblemService;
29
+import io.swagger.annotations.ApiModelProperty;
27 30
 import lombok.Data;
28 31
 import org.apache.commons.lang3.StringUtils;
29 32
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,14 +39,6 @@ import org.springframework.transaction.annotation.Transactional;
36 39
 import org.springframework.util.CollectionUtils;
37 40
 
38 41
 
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47 42
 /**
48 43
  * 岗检问题表Service业务层处理
49 44
  *
@@ -66,6 +61,7 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
66 61
     private IPostPlanJoinProblemService postPlanJoinProblemService;
67 62
     @Autowired
68 63
     private PostListMapper postListMapper;
64
+
69 65
     /**
70 66
      * 查询岗检问题表
71 67
      *
@@ -157,7 +153,7 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
157 153
         PostPlanInfo postPlanInfo = postPlanInfoMapper.selectById(planInfoId);
158 154
         PostPlan postPlan = postPlanMapper.selectById(postPlanInfo.getPostPlanId());
159 155
         List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
160
-                        .eq(PostCheckedProblem::getCheckedDeptId,departmentId)
156
+                .eq(PostCheckedProblem::getCheckedDeptId, departmentId)
161 157
                 .between(PostCheckedProblem::getCreateTime, postPlan.getStartTime(), postPlan.getEndTime())
162 158
 
163 159
         );
@@ -173,37 +169,37 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
173 169
             Optional<PostAssessmentRules> first = postAssessmentRules.stream().filter(d -> d.getDutyType().equals(postCheckedProblem.getDutyType())).findFirst();
174 170
             if (first.isPresent() && score.compareTo(new BigDecimal("0")) > 0) {
175 171
                 // 计算岗检得分
176
-                if (postCheckedProblem.getProblemLevel().equals("1")){
172
+                if (postCheckedProblem.getProblemLevel().equals("1")) {
177 173
                     score = score.subtract(first.get().getProblemLevelOne());
178
-                }else if(postCheckedProblem.getProblemLevel().equals("2")){
174
+                } else if (postCheckedProblem.getProblemLevel().equals("2")) {
179 175
                     score = score.subtract(first.get().getProblemLevelTwo());
180 176
                 }
181 177
             }
182 178
         }
183 179
 
184 180
         // todo 公式计算
185
-        if (postCheckedProblems.size()>0){
181
+        if (postCheckedProblems.size() > 0) {
186 182
             BigDecimal bigDecimal = new BigDecimal("1");
187 183
             List<PostPlanInfo> postPlanInfos = postPlanInfoMapper.selectList(Wrappers.<PostPlanInfo>lambdaQuery()
188
-                    .eq(PostPlanInfo::getPostPlanId,postPlan.getId())
184
+                    .eq(PostPlanInfo::getPostPlanId, postPlan.getId())
189 185
             );
190
-            if (postPlanInfos.size() <= 0){
186
+            if (postPlanInfos.size() <= 0) {
191 187
                 score = new BigDecimal("0");
192
-            }else{
188
+            } else {
193 189
                 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){
190
+                if (divide.compareTo(new BigDecimal("0")) <= 0 || divide.compareTo(new BigDecimal("1")) > 0) {
195 191
                     score = new BigDecimal("0");
196
-                }else{
192
+                } else {
197 193
                     score = bigDecimal.subtract(divide);
198 194
                 }
199 195
             }
200
-        }else{
196
+        } else {
201 197
             score = new BigDecimal("0");
202 198
         }
203
-        postAssessmentRatingMapper.update(null,Wrappers.<PostAssessmentRating>lambdaUpdate()
204
-                .set(PostAssessmentRating::getPositionScore,score)
205
-                .eq(PostAssessmentRating::getDeptId,departmentId)
206
-                .eq(PostAssessmentRating::getPlanId,postPlan.getId())
199
+        postAssessmentRatingMapper.update(null, Wrappers.<PostAssessmentRating>lambdaUpdate()
200
+                .set(PostAssessmentRating::getPositionScore, score)
201
+                .eq(PostAssessmentRating::getDeptId, departmentId)
202
+                .eq(PostAssessmentRating::getPlanId, postPlan.getId())
207 203
         );
208 204
     }
209 205
 
@@ -502,5 +498,78 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
502 498
         postTotalView.setUncheckedPostCount(uncheckedPostCount);
503 499
         return postTotalView;
504 500
     }
501
+
502
+    /**
503
+     * 按问题属性分组统计问题类别
504
+     *
505
+     * @return
506
+     */
507
+    @Override
508
+    public List<ProblemCategory> problemCategoryByAttribute() {
509
+//        @ApiModelProperty("职责权限问题")
510
+//        private Integer problemCategoryOne;
511
+//        @ApiModelProperty("工作内容问题")
512
+//        private Integer problemCategoryTwo;
513
+//        @ApiModelProperty("工作标准问题")
514
+//        private Integer problemCategoryThree;
515
+//        @ApiModelProperty("考核奖励问题")
516
+//        private Integer problemCategoryFour;
517
+//        @ApiModelProperty("任职资格问题")
518
+//        private Integer problemCategoryFive;
519
+//        @ApiModelProperty("其他")
520
+//        private Integer problemCategorySix;
521
+//        @ApiModelProperty("总数量")
522
+//        private Integer problemTotal;
523
+
524
+        List<ProblemCategory> list = postCheckedProblemMapper.problemCategoryByAttribute();
525
+        ProblemCategory totalData = new ProblemCategory();
526
+        totalData.setProblemAttribute(999);
527
+        totalData.setProblemAttributeView("总计");
528
+        int problemCategoryOne = 0;
529
+        int problemCategoryTwo = 0;
530
+        int problemCategoryThree = 0;
531
+        int problemCategoryFour = 0;
532
+        int problemCategoryFive = 0;
533
+        int problemCategorySix = 0;
534
+        for (ProblemCategory data : list) {
535
+//            Integer problemAttribute = data.getProblemAttribute();
536
+//            switch (problemAttribute) {
537
+//                case 1: {
538
+//                    setProblemAttributeView("完整问题");
539
+//
540
+//                    break;
541
+//                }
542
+//                case 2: {
543
+//                    setProblemAttributeView("有效性问题");
544
+//
545
+//                    break;
546
+//                }
547
+//                case 3: {
548
+//                    setProblemAttributeView("适宜性问题");
549
+//
550
+//                    break;
551
+//                }
552
+//
553
+//                default:
554
+//                    setProblemAttributeView("Other");
555
+//                    break;
556
+//            }
557
+
558
+            problemCategoryOne += data.getProblemCategoryOne();
559
+            problemCategoryTwo += data.getProblemCategoryTwo();
560
+            problemCategoryThree += data.getProblemCategoryThree();
561
+            problemCategoryFour += data.getProblemCategoryFour();
562
+            problemCategoryFive += data.getProblemCategoryFive();
563
+            problemCategorySix += data.getProblemCategorySix();
564
+        }
565
+        totalData.setProblemCategoryOne(problemCategoryOne);
566
+        totalData.setProblemCategoryTwo(problemCategoryTwo);
567
+        totalData.setProblemCategoryThree(problemCategoryThree);
568
+        totalData.setProblemCategoryFour(problemCategoryFour);
569
+        totalData.setProblemCategoryFive(problemCategoryFive);
570
+        totalData.setProblemCategorySix(problemCategorySix);
571
+        list.add(totalData);
572
+        return list;
573
+    }
505 574
 }
506 575
 

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

@@ -92,10 +92,12 @@
92 92
             t1.duty_type,
93 93
 
94 94
             t2."dept_name" as checkedDeptName,
95
-            t3."post_name" as checkedPostName
95
+            t3."post_name" as checkedPostName,
96
+            t4."nick_name" AS rectificationResponsibleUserName
96 97
         from post_checked_problem t1
97 98
         LEFT JOIN "sys_dept" t2 ON t2."dept_id" = t1."checked_dept_id"
98 99
         LEFT JOIN "sys_post" t3 ON t3."post_id" = t1."checked_post_id"
100
+        LEFT JOIN "public"."sys_users" t4 ON  t4."user_id" = t1."rectification_responsible_user_id"
99 101
     </sql>
100 102
 
101 103
     <select id="selectPostCheckedProblemList" parameterType="PostCheckedProblem" resultMap="PostCheckedProblemResult">
@@ -305,4 +307,56 @@
305 307
         FROM "public"."post_plan" a INNER JOIN "public"."post_plan_info" ppi ON a."id"  = ppi."post_plan_id" WHERE ppi."status" = #{status}
306 308
 
307 309
     </select>
310
+
311
+    <!--按问题属性分组统计问题类别-->
312
+    <select id="problemCategoryByAttribute" resultType="ProblemCategory">
313
+        SELECT
314
+            problem_attribute,
315
+            COUNT(t1.id) AS problemTotal,
316
+            SUM(
317
+                 case
318
+                    when t1.problem_category = 1 then 1
319
+                    else 0
320
+                 END
321
+            ) AS problemCategoryOne,
322
+
323
+            SUM(
324
+                 case
325
+                    when t1.problem_category = 2 then 1
326
+                    else 0
327
+                 END
328
+            ) AS problemCategoryTwo,
329
+
330
+            SUM(
331
+                 case
332
+                    when t1.problem_category = 3 then 1
333
+                    else 0
334
+                 END
335
+            ) AS problemCategoryThree,
336
+
337
+
338
+            SUM(
339
+                 case
340
+                    when t1.problem_category = 4 then 1
341
+                    else 0
342
+                 END
343
+            ) AS problemCategoryFour,
344
+
345
+            SUM(
346
+                 case
347
+                    when t1.problem_category = 5 then 1
348
+                    else 0
349
+                 END
350
+            ) AS problemCategoryFive,
351
+
352
+            SUM(
353
+                 case
354
+                    when t1.problem_category = 6 then 1
355
+                    else 0
356
+                 END
357
+            ) AS problemCategorySix
358
+        FROM post_checked_problem t1
359
+        GROUP BY problem_attribute
360
+        ORDER BY t1.problem_attribute
361
+    </select>
308 362
 </mapper>