zhangjiansheng 10 months ago
parent
commit
9628419b59

+ 2 - 16
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostCheckedFunctionProblemStatisticsController.java

@@ -198,22 +198,8 @@ public class PostCheckedFunctionProblemStatisticsController extends BaseControll
198 198
 //        GROUP BY problem_category -- 问题类别(职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他)
199 199
 
200 200
 
201
-        List<HistoryProblemNumberView> list = new ArrayList<>();
202
-        HistoryProblemNumberView data = new HistoryProblemNumberView();
203
-        data.setCheckYear(new Date());
204
-//        data.set问题总数
205
-//        data.set完成性
206
-//        data.set适宜性
207
-//        data.set有效性
208
-//        data.set职责权限
209
-//        data.set工作内容
210
-//        data.set工作标准
211
-//        data.set考核奖励
212
-//        data.set任职资格
213
-//        data.set其他
214
-
215
-        list.add(data);
216
-        return success(list);
201
+        Integer type = 1;
202
+        return success(postCheckedProblemService.historyProblemNumberView(type));
217 203
     }
218 204
 
219 205
 /*

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

@@ -14,6 +14,7 @@ import com.ruoyi.postCheck.domain.homePage.PostTotalView;
14 14
 import com.ruoyi.postCheck.domain.problemStatistics.CoverageRateView;
15 15
 import com.ruoyi.postCheck.domain.problemStatistics.DutyTypeProblemStatisticsView;
16 16
 import com.ruoyi.postCheck.domain.problemStatistics.FunctionDeptProblemContrastView;
17
+import com.ruoyi.postCheck.domain.problemStatistics.HistoryProblemNumberView;
17 18
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemAttributeCategoryView;
18 19
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemLevelView;
19 20
 import com.ruoyi.postCheck.domain.tools.ProblemCategory;
@@ -197,4 +198,6 @@ public interface IPostCheckedProblemService extends IService<PostCheckedProblem>
197 198
     List<ProblemLevelView>  problemLevelView(Integer type);
198 199
 
199 200
     List<ProblemAttributeCategoryView> problemAttributeCategoryView(Integer type);
201
+
202
+    List<HistoryProblemNumberView>  historyProblemNumberView(Integer type);
200 203
 }

+ 151 - 3
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostCheckedProblemServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.postCheck.service.impl;
2 2
 
3 3
 import java.math.BigDecimal;
4 4
 import java.math.RoundingMode;
5
+import java.text.SimpleDateFormat;
5 6
 import java.util.ArrayList;
6 7
 import java.util.Date;
7 8
 import java.util.HashMap;
@@ -28,6 +29,7 @@ import com.ruoyi.postCheck.domain.join.PostPlanJoinProblem;
28 29
 import com.ruoyi.postCheck.domain.problemStatistics.CoverageRateView;
29 30
 import com.ruoyi.postCheck.domain.problemStatistics.DutyTypeProblemStatisticsView;
30 31
 import com.ruoyi.postCheck.domain.problemStatistics.FunctionDeptProblemContrastView;
32
+import com.ruoyi.postCheck.domain.problemStatistics.HistoryProblemNumberView;
31 33
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemAttributeCategoryView;
32 34
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemLevelView;
33 35
 import com.ruoyi.postCheck.domain.tools.ProblemCategory;
@@ -49,6 +51,7 @@ import com.ruoyi.postCheck.service.IPostCheckedProblemService;
49 51
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
50 52
 import org.springframework.transaction.annotation.Transactional;
51 53
 import org.springframework.util.CollectionUtils;
54
+import org.springframework.web.context.request.FacesWebRequest;
52 55
 
53 56
 
54 57
 
@@ -894,10 +897,66 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
894 897
         List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
895 898
                 .in(PostCheckedProblem::getCheckedDeptId, deptIds)
896 899
         );
900
+        List<ProblemAttributeCategoryView> list = new ArrayList<>();
901
+        if(postCheckedProblems!=null && postCheckedProblems.size() >0){
902
+            Map<String, List<PostCheckedProblem>> collect = postCheckedProblems.stream().collect(Collectors.groupingBy(PostCheckedProblem::getProblemCategory));
903
+//           问题类别(职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他)
904
+            for (Map.Entry<String, List<PostCheckedProblem>> stringListEntry : collect.entrySet()) {
905
+                List<PostCheckedProblem> value = stringListEntry.getValue();
906
+                if (value!=null&&value.size()>0){
907
+
908
+                    ProblemAttributeCategoryView data = new ProblemAttributeCategoryView();
909
+                    if(stringListEntry.getKey().equals("1")){
910
+                        data.setProblemCategoryType(1);
911
+                        data.setProblemCategoryTypeView("职责权限问题");
912
+                    }
913
+                    if(stringListEntry.getKey().equals("2")){
914
+                        data.setProblemCategoryType(2);
915
+                        data.setProblemCategoryTypeView("工作内容问题");
916
+                    }
917
+                    if(stringListEntry.getKey().equals("3")){
918
+                        data.setProblemCategoryType(3);
919
+                        data.setProblemCategoryTypeView("工作标准问题");
920
+                    }
921
+                    if(stringListEntry.getKey().equals("4")){
922
+                        data.setProblemCategoryType(4);
923
+                        data.setProblemCategoryTypeView("考核奖励问题");
924
+                    }
925
+                    if(stringListEntry.getKey().equals("5")){
926
+                        data.setProblemCategoryType(5);
927
+                        data.setProblemCategoryTypeView("任职资格问题");
928
+                    }
929
+                    if(stringListEntry.getKey().equals("6")){
930
+                        data.setProblemCategoryType(6);
931
+                        data.setProblemCategoryTypeView("其他");
932
+                    }
933
+//        @ApiModelProperty("完整性数量")
934
+                    int problemComplete = 0;
935
+//        @ApiModelProperty("适宜性数量")
936
+                    int problemSuitable = 0;
937
+//        @ApiModelProperty("有效性数量")
938
+                    int problemEffective = 0;
939
+
940
+                    for (PostCheckedProblem postCheckedProblem : value) {
941
+                        if (postCheckedProblem.getProblemAttribute() == 1){
942
+                            problemComplete++;
943
+                        }
944
+                        if (postCheckedProblem.getProblemAttribute() == 2){
945
+                            problemEffective++;
946
+                        }
947
+                        if (postCheckedProblem.getProblemAttribute() == 3){
948
+                            problemSuitable++;
949
+                        }
950
+                    }
951
+                    data.setProblemComplete(problemComplete);// 完整性数量
952
+                    data.setProblemSuitable(problemSuitable);// 适宜性数量
953
+                    data.setProblemEffective(problemEffective);// 有效性数量
954
+                    list.add(data);
955
+                }
956
+            }
957
+        }
897 958
 
898 959
 
899
-        List<ProblemAttributeCategoryView> list = new ArrayList<>();
900
-        ProblemAttributeCategoryView data = new ProblemAttributeCategoryView();
901 960
 //        data.set完成性
902 961
 //        data.set适宜性
903 962
 //        data.set有效性
@@ -908,8 +967,97 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
908 967
 //        data.set任职资格
909 968
 //        data.set其他
910 969
 
911
-        list.add(data);
970
+
912 971
         return null;
913 972
     }
973
+
974
+    @Override
975
+    public List<HistoryProblemNumberView> historyProblemNumberView(Integer type) {
976
+        //         查询问题表
977
+//        select * from "public"."post_checked_problem";
978
+//        GROUP BY problem_attribute -- 问题属性(1-完整问题;2-有效性问题;3-适宜性问题;)
979
+//        GROUP BY problem_category -- 问题类别(职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他)
980
+
981
+
982
+        List<Map<String, Object>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(type);
983
+        if (deptIdListByType == null && deptIdListByType.size() == 0){
984
+            throw new IllegalArgumentException("查询职能部门个数为:0");
985
+        }
986
+        List<String> deptIds = deptIdListByType.stream().map(d -> d.get("deptId").toString()).distinct().collect(Collectors.toList());
987
+        // 查询职能问题数量
988
+        List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
989
+                .in(PostCheckedProblem::getCheckedDeptId, deptIds)
990
+        );
991
+        List<HistoryProblemNumberView> list = new ArrayList<>();
992
+        if (postCheckedProblems!=null && postCheckedProblems.size()>0){
993
+            SimpleDateFormat adf = new SimpleDateFormat("yyyy-MM-dd");
994
+            Map<String, List<PostCheckedProblem>> collect = postCheckedProblems.stream().collect(Collectors.groupingBy(d -> adf.format(d.getCreateTime()), Collectors.toList()));
995
+            HistoryProblemNumberView data = new HistoryProblemNumberView();
996
+            data.setCheckYear(new Date());
997
+            //        @ApiModelProperty("总数量")
998
+            int problemTotal = 0;
999
+//        @ApiModelProperty("完整性数量")
1000
+            int problemComplete = 0;
1001
+//        @ApiModelProperty("适宜性数量")
1002
+            int problemSuitable = 0;
1003
+//        @ApiModelProperty("有效性数量")
1004
+            int problemEffective = 0;
1005
+//        @ApiModelProperty("职责权限问题")
1006
+            int problemCategoryOne = 0;
1007
+//        @ApiModelProperty("工作内容问题")
1008
+            int problemCategoryTwo = 0;
1009
+//        @ApiModelProperty("工作标准问题")
1010
+            int problemCategoryThree = 0;
1011
+//        @ApiModelProperty("考核奖励问题")
1012
+            int problemCategoryFour = 0;
1013
+//        @ApiModelProperty("任职资格问题")
1014
+            int problemCategoryFive = 0;
1015
+//        @ApiModelProperty("其他")
1016
+            int problemCategorySix = 0;
1017
+            for (Map.Entry<String, List<PostCheckedProblem>> stringListEntry : collect.entrySet()) {
1018
+                List<PostCheckedProblem> value = stringListEntry.getValue();
1019
+                if (value!=null && value.size()>0){
1020
+                    for (PostCheckedProblem postCheckedProblem : value) {
1021
+                        problemTotal++;
1022
+                        if (postCheckedProblem.getProblemAttribute() == 1){
1023
+                            problemComplete++;
1024
+                        }
1025
+                        if (postCheckedProblem.getProblemAttribute() == 2){
1026
+                            problemEffective++;
1027
+                        }
1028
+                        if (postCheckedProblem.getProblemAttribute() == 3){
1029
+                            problemSuitable++;
1030
+                        }
1031
+                        if (postCheckedProblem.getProblemCategory() == null )
1032
+                            continue;
1033
+                        if (postCheckedProblem.getProblemCategory().equals("1"))
1034
+                            problemCategoryOne++;
1035
+                        if (postCheckedProblem.getProblemCategory().equals("2"))
1036
+                            problemCategoryTwo++;
1037
+                        if (postCheckedProblem.getProblemCategory().equals("3"))
1038
+                            problemCategoryThree++;
1039
+                        if (postCheckedProblem.getProblemCategory().equals("4"))
1040
+                            problemCategoryFour++;
1041
+                        if (postCheckedProblem.getProblemCategory().equals("5"))
1042
+                            problemCategoryFive++;
1043
+                        if (postCheckedProblem.getProblemCategory().equals("6"))
1044
+                            problemCategorySix++;
1045
+                    }
1046
+                }
1047
+            }
1048
+            data.setProblemTotal(problemTotal);
1049
+            data.setProblemComplete(problemComplete);
1050
+            data.setProblemSuitable(problemSuitable);
1051
+            data.setProblemEffective(problemEffective);
1052
+            data.setProblemCategoryOne(problemCategoryOne);
1053
+            data.setProblemCategoryTwo(problemCategoryTwo);
1054
+            data.setProblemCategoryThree(problemCategoryThree);
1055
+            data.setProblemCategoryFour(problemCategoryFour);
1056
+            data.setProblemCategoryFive(problemCategoryFive);
1057
+            data.setProblemCategorySix(problemCategorySix);
1058
+            list.add(data);
1059
+        }
1060
+        return list;
1061
+    }
914 1062
 }
915 1063