Browse Source

Merge remote-tracking branch 'origin/master'

csg6 10 months ago
parent
commit
bccdb4d44a

+ 55 - 72
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostCheckedFunctionProblemStatisticsController.java

@@ -198,94 +198,77 @@ 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
-/*
220 205
     @ApiOperation("7-部门详情")
221 206
     @GetMapping("/deptDetaailView")
222
-    public AjaxResult deptDetaailView() {
207
+    public AjaxResult deptDetaailView(CheckedProblemDeptDetaailView notParam) { //notParam不是参数-是返回信息-方便接口联调
223 208
 //         查询问题表
224 209
 //        select * from "public"."post_checked_problem";
225 210
 //        group by duty_type 职责类别:1-业务职责;2-党建及党风廉政;3-安全环保职责;4-合规保密职;
226 211
 //        GROUP BY problem_attribute -- 问题属性(1-完整问题;2-有效性问题;3-适宜性问题;)
227 212
 
228 213
 
229
-        List<DeptDetaailView> list = new ArrayList<>();
230
-
231
-        //TODO 第一步:得到4个职责类别:1-业务职责;2-党建及党风廉政;3-安全环保职责;4-合规保密职;
232
-        //TODO 第二步:遍历职责类别 -> (总数和已完成数)设置问题属性(1-完整问题;2-有效性问题;3-适宜性问题;)
233
-        DeptDetaailView data1 = new DeptDetaailView();
234
-//        data4.setdutyTypeOne //业务职责
235
-        List<DeptDetaailView.ProblemAttributeInner> children1 = new ArrayList<>();
236
-        DeptDetaailView.ProblemAttributeInner child1 = new DeptDetaailView.ProblemAttributeInner();
237
-//        child1.set完整性数量") private Integer problemComplete;
238
-//        child1.set适宜性数量") private Integer problemSuitable;
239
-//        child1.set有效性数量") private Integer problemEffective;
240
-//        child1.set已完成完整性数量") private Integer problemCompleteChecked;
241
-//        child1.set已完成适宜性数量") private Integer problemSuitableChecked;
242
-//        child1.set已完成有效性数量") private Integer problemEffectiveChecked;
243
-        children1.add(child1);
244
-        data1.setChildren(children1);
214
+        List<CheckedProblemDeptDetaailView> list = new ArrayList<>();
215
+
216
+        //TODO 第一步:得到各个部门ID、部门名称、问题总数量、重要问题数量、一般问题数量、统计时间
217
+        //TODO 第二步:得到4个职责类别的问题数量及整改完成数量(1-业务职责;2-党建及党风廉政;3-安全环保职责;4-合规保密职;)
218
+        //TODO 第三步:设置部门的整改率:遍历职责类别计算整改率
219
+
220
+
221
+        CheckedProblemDeptDetaailView data1 = new CheckedProblemDeptDetaailView();
222
+        data1.setDeptId(1l); //部门ID
223
+        data1.setDeptName("测试部门名称1");// 部门名称
224
+        data1.setProblemTotal(10); //问题数量
225
+        data1.setProblemLeveTwo(2); //重要问题
226
+        data1.setProblemLeveOne(8); //一般问题
227
+        data1.setStatisticsTime(new Date());// 统计时间
228
+
229
+//        List<CheckedProblemDeptDetaailView.ProblemAttributeInner> children1 = new ArrayList<>();
230
+        CheckedProblemDeptDetaailView.ProblemAttributeInner child1 = new CheckedProblemDeptDetaailView.ProblemAttributeInner();
231
+        child1.setProblemComplete(1); //child1.set完整性数量
232
+        child1.setProblemSuitable(2); //child1.set适宜性数量
233
+        child1.setProblemEffective(3);//child1.set有效性数量
234
+        //children1.add(child1);
235
+        //data1.setChildren(children1);
236
+        data1.getChildren().add(child1);
245 237
         list.add(data1);
246 238
 
247
-        DeptDetaailView data2 = new DeptDetaailView();
248
-//        data4.setdutyTypeTwo 党建及党风廉政
249
-        List<DeptDetaailView.ProblemAttributeInner> children2 = new ArrayList<>();
250
-        DeptDetaailView.ProblemAttributeInner child2 = new DeptDetaailView.ProblemAttributeInner();
251
-//        child2.set完整性数量") private Integer problemComplete;
252
-//        child2.set适宜性数量") private Integer problemSuitable;
253
-//        child2.set有效性数量") private Integer problemEffective;
254
-//        child2.set已完成完整性数量") private Integer problemCompleteChecked;
255
-//        child2.set已完成适宜性数量") private Integer problemSuitableChecked;
256
-//        child2.set已完成有效性数量") private Integer problemEffectiveChecked;
257
-        children1.add(child2);
258
-        data2.setChildren(children2);
239
+        CheckedProblemDeptDetaailView data2 = new CheckedProblemDeptDetaailView();
240
+        data2.setDeptId(2l); //部门ID
241
+        data2.setDeptName("测试部门名称2");// 部门名称
242
+        data2.setProblemTotal(9); //问题数量
243
+        data2.setProblemLeveTwo(2); //重要问题
244
+        data2.setProblemLeveOne(7); //一般问题
245
+        data2.setStatisticsTime(new Date());// 统计时间
246
+        CheckedProblemDeptDetaailView.ProblemAttributeInner child2 = new CheckedProblemDeptDetaailView.ProblemAttributeInner();
247
+        data2.getChildren().add(child2);
259 248
         list.add(data2);
260 249
 
261
-        DeptDetaailView data3 = new DeptDetaailView();
262
-//        data4.setdutyTypeThree 安全环保职责
263
-        List<DeptDetaailView.ProblemAttributeInner> children3 = new ArrayList<>();
264
-        DeptDetaailView.ProblemAttributeInner child3 = new DeptDetaailView.ProblemAttributeInner();
265
-//        child3.set完整性数量") private Integer problemComplete;
266
-//        child3.set适宜性数量") private Integer problemSuitable;
267
-//        child3.set有效性数量") private Integer problemEffective;
268
-//        child3.set已完成完整性数量") private Integer problemCompleteChecked;
269
-//        child3.set已完成适宜性数量") private Integer problemSuitableChecked;
270
-//        child3.set已完成有效性数量") private Integer problemEffectiveChecked;
271
-        children1.add(child3);
272
-        data3.setChildren(children3);
250
+        CheckedProblemDeptDetaailView data3 = new CheckedProblemDeptDetaailView();
251
+        data3.setDeptId(3l); //部门ID
252
+        data3.setDeptName("测试部门名称3");// 部门名称
253
+        data3.setProblemTotal(8); //问题数量
254
+        data3.setProblemLeveTwo(3); //重要问题
255
+        data3.setProblemLeveOne(5); //一般问题
256
+        data3.setStatisticsTime(new Date());// 统计时间
257
+        CheckedProblemDeptDetaailView.ProblemAttributeInner child3 = new CheckedProblemDeptDetaailView.ProblemAttributeInner();
258
+        data3.getChildren().add(child3);
273 259
         list.add(data3);
274 260
 
275
-        DeptDetaailView data4 = new DeptDetaailView();
276
-//        data4.setdutyTypeFour 合规保密职
277
-        List<DeptDetaailView.ProblemAttributeInner> children4 = new ArrayList<>();
278
-        DeptDetaailView.ProblemAttributeInner child4 = new DeptDetaailView.ProblemAttributeInner();
279
-//        child4.set完整性数量") private Integer problemComplete;
280
-//        child4.set适宜性数量") private Integer problemSuitable;
281
-//        child4.set有效性数量") private Integer problemEffective;
282
-//        child4.set已完成完整性数量") private Integer problemCompleteChecked;
283
-//        child4.set已完成适宜性数量") private Integer problemSuitableChecked;
284
-//        child4.set已完成有效性数量") private Integer problemEffectiveChecked;
285
-        children1.add(child4);
286
-        data4.setChildren(children4);
261
+        CheckedProblemDeptDetaailView data4 = new CheckedProblemDeptDetaailView();
262
+        data4.setDeptId(4l); //部门ID
263
+        data4.setDeptName("测试部门名称4");// 部门名称
264
+        data4.setProblemTotal(6); //问题数量
265
+        data4.setProblemLeveTwo(1); //重要问题
266
+        data4.setProblemLeveOne(5); //一般问题
267
+        data4.setStatisticsTime(new Date());// 统计时间
268
+        CheckedProblemDeptDetaailView.ProblemAttributeInner child4 = new CheckedProblemDeptDetaailView.ProblemAttributeInner();
269
+        data4.getChildren().add(child4);
287 270
         list.add(data4);
288
-        return success(list);
271
+        Integer type = 1;
272
+        return success(postCheckedProblemService.deptDetaailView(type));
289 273
     }
290
-    */
291 274
 }

+ 10 - 27
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostCheckedProductionProblemStatisticsController.java

@@ -64,13 +64,8 @@ public class PostCheckedProductionProblemStatisticsController extends BaseContro
64 64
 //        is_rectification_completed = 1 整改情况-是否完成(1-Yes;2-No;)
65 65
 
66 66
 
67
-        List<CoverageRateView> list = new ArrayList<>();
68
-        CoverageRateView data = new CoverageRateView();
69
-        data.setProblemTotal(6);
70
-        data.setProblemComplete(5);
71
-
72
-        list.add(data);
73
-        return success(list);
67
+        Integer type = 2;
68
+        return success(postCheckedProblemService.coverageRateView(type));
74 69
     }
75 70
 
76 71
     @ApiOperation("3-岗检问题职责类别占比")
@@ -81,15 +76,8 @@ public class PostCheckedProductionProblemStatisticsController extends BaseContro
81 76
 //        group by duty_type 职责类别:1-业务职责;2-党建及党风廉政;3-安全环保职责;4-合规保密职;
82 77
 
83 78
 
84
-        List<DutyTypeProblemStatisticsView> list = new ArrayList<>();
85
-        DutyTypeProblemStatisticsView data = new DutyTypeProblemStatisticsView();
86
-        data.setDutyTypeOne(1);
87
-        data.setDutyTypeTwo(2);
88
-        data.setDutyTypeThree(3);
89
-        data.setDutyTypeFour(4);
90
-
91
-        list.add(data);
92
-        return success(list);
79
+        Integer type = 2;
80
+        return success(postCheckedProblemService.dutyTypeProblemStatisticsView(type));
93 81
     }
94 82
 
95 83
     @ApiOperation("4-岗检问题级别占比")
@@ -99,14 +87,8 @@ public class PostCheckedProductionProblemStatisticsController extends BaseContro
99 87
 //        select * from "public"."post_checked_problem";
100 88
 //        group by problem_level   问题等级(一般、重要)
101 89
 
102
-        List<ProblemLevelView> list = new ArrayList<>();
103
-        ProblemLevelView data = new ProblemLevelView();
104
-        data.setProblemLeveOne(2);
105
-        data.setProblemLeveTwo(1);
106
-
107
-
108
-        list.add(data);
109
-        return success(list);
90
+        Integer type = 2;
91
+        return success(postCheckedProblemService.problemLevelView(type));
110 92
     }
111 93
 
112 94
 
@@ -197,7 +179,8 @@ public class PostCheckedProductionProblemStatisticsController extends BaseContro
197 179
         list.add(data6);
198 180
 
199 181
 
200
-        return success(list);
182
+        Integer type = 2;
183
+        return success(postCheckedProblemService.problemAttributeCategoryView(type));
201 184
     }
202 185
 
203 186
 
@@ -224,8 +207,8 @@ public class PostCheckedProductionProblemStatisticsController extends BaseContro
224 207
 //        data.set任职资格
225 208
 //        data.set其他
226 209
 
227
-        list.add(data);
228
-        return success(list);
210
+        Integer type = 2;
211
+        return success(postCheckedProblemService.historyProblemNumberView(type));
229 212
     }
230 213
 
231 214
 

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

@@ -11,9 +11,11 @@ import com.ruoyi.postCheck.domain.homePage.DeptProblemRectificationView;
11 11
 import com.ruoyi.postCheck.domain.homePage.PostCheckedProblemView;
12 12
 import com.ruoyi.postCheck.domain.homePage.PostCheckedUnCheckedView;
13 13
 import com.ruoyi.postCheck.domain.homePage.PostTotalView;
14
+import com.ruoyi.postCheck.domain.problemStatistics.CheckedProblemDeptDetaailView;
14 15
 import com.ruoyi.postCheck.domain.problemStatistics.CoverageRateView;
15 16
 import com.ruoyi.postCheck.domain.problemStatistics.DutyTypeProblemStatisticsView;
16 17
 import com.ruoyi.postCheck.domain.problemStatistics.FunctionDeptProblemContrastView;
18
+import com.ruoyi.postCheck.domain.problemStatistics.HistoryProblemNumberView;
17 19
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemAttributeCategoryView;
18 20
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemLevelView;
19 21
 import com.ruoyi.postCheck.domain.tools.ProblemCategory;
@@ -197,4 +199,8 @@ public interface IPostCheckedProblemService extends IService<PostCheckedProblem>
197 199
     List<ProblemLevelView>  problemLevelView(Integer type);
198 200
 
199 201
     List<ProblemAttributeCategoryView> problemAttributeCategoryView(Integer type);
202
+
203
+    List<HistoryProblemNumberView>  historyProblemNumberView(Integer type);
204
+
205
+    List<CheckedProblemDeptDetaailView>  deptDetaailView(Integer type);
200 206
 }

+ 269 - 24
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;
@@ -25,9 +26,11 @@ import com.ruoyi.postCheck.domain.homePage.PostCheckedProblemView;
25 26
 import com.ruoyi.postCheck.domain.homePage.PostCheckedUnCheckedView;
26 27
 import com.ruoyi.postCheck.domain.homePage.PostTotalView;
27 28
 import com.ruoyi.postCheck.domain.join.PostPlanJoinProblem;
29
+import com.ruoyi.postCheck.domain.problemStatistics.CheckedProblemDeptDetaailView;
28 30
 import com.ruoyi.postCheck.domain.problemStatistics.CoverageRateView;
29 31
 import com.ruoyi.postCheck.domain.problemStatistics.DutyTypeProblemStatisticsView;
30 32
 import com.ruoyi.postCheck.domain.problemStatistics.FunctionDeptProblemContrastView;
33
+import com.ruoyi.postCheck.domain.problemStatistics.HistoryProblemNumberView;
31 34
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemAttributeCategoryView;
32 35
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemLevelView;
33 36
 import com.ruoyi.postCheck.domain.tools.ProblemCategory;
@@ -49,6 +52,7 @@ import com.ruoyi.postCheck.service.IPostCheckedProblemService;
49 52
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
50 53
 import org.springframework.transaction.annotation.Transactional;
51 54
 import org.springframework.util.CollectionUtils;
55
+import org.springframework.web.context.request.FacesWebRequest;
52 56
 
53 57
 
54 58
 
@@ -743,16 +747,16 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
743 747
         if (postCheckedProblems != null && postCheckedProblems.size() > 0) {
744 748
             for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
745 749
                 problemTotal++;
746
-                if (postCheckedProblem.getProblemAttribute() == 1){
750
+                if (postCheckedProblem.getProblemAttribute() == 1) {
747 751
                     problemComplete++;
748 752
                 }
749
-                if (postCheckedProblem.getProblemAttribute() == 2){
753
+                if (postCheckedProblem.getProblemAttribute() == 2) {
750 754
                     problemEffective++;
751 755
                 }
752
-                if (postCheckedProblem.getProblemAttribute() == 3){
756
+                if (postCheckedProblem.getProblemAttribute() == 3) {
753 757
                     problemSuitable++;
754 758
                 }
755
-                if (postCheckedProblem.getProblemCategory() == null )
759
+                if (postCheckedProblem.getProblemCategory() == null)
756 760
                     continue;
757 761
                 if (postCheckedProblem.getProblemCategory().equals("1"))
758 762
                     problemCategoryOne++;
@@ -787,8 +791,8 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
787 791
 //        status = 40    状态:1-待指定整改人(问题录入完成时);2-待填写方案(部门管理员指定整改人后);3-方案填写完成;10-部门审核通过;11-部门审核驳回;20-专业部门人审核(非必填)通过;21-专业部门人审核驳回(非必填);30-整改人待上传实施(整改人上传实施图片);31-上传实施照片完成;40-复查部门人审核通过;41-复查部门人审核驳回
788 792
 //        is_rectification_completed = 1 整改情况-是否完成(1-Yes;2-No;)
789 793
         List<Map<String, Object>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(type);
790
-        if (deptIdListByType == null && deptIdListByType.size() == 0){
791
-            throw new IllegalArgumentException("查询职能部门个数为:0");
794
+        if (deptIdListByType == null || deptIdListByType.size() == 0) {
795
+            return new ArrayList<>();
792 796
         }
793 797
         List<String> deptIds = deptIdListByType.stream().map(d -> d.get("deptId").toString()).distinct().collect(Collectors.toList());
794 798
         // 查询职能问题数量
@@ -796,10 +800,10 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
796 800
                 .in(PostCheckedProblem::getCheckedDeptId, deptIds)
797 801
         );
798 802
         List<CoverageRateView> list = new ArrayList<>();
799
-        if (postCheckedProblems!=null && postCheckedProblems.size()>0){
803
+        if (postCheckedProblems != null && postCheckedProblems.size() > 0) {
800 804
             CoverageRateView data = new CoverageRateView();
801 805
             data.setProblemTotal(postCheckedProblems.size());
802
-            List<PostCheckedProblem> collect = postCheckedProblems.stream().filter(d -> d.getIsRectificationCompleted().equals(1)).collect(Collectors.toList());
806
+            List<PostCheckedProblem> collect = postCheckedProblems.stream().filter(d -> d.getIsRectificationCompleted() != null && d.getIsRectificationCompleted().equals(1)).collect(Collectors.toList());
803 807
             data.setProblemComplete(collect.size());
804 808
             list.add(data);
805 809
         }
@@ -809,8 +813,8 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
809 813
     @Override
810 814
     public List<DutyTypeProblemStatisticsView> dutyTypeProblemStatisticsView(Integer type) {
811 815
         List<Map<String, Object>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(type);
812
-        if (deptIdListByType == null && deptIdListByType.size() == 0){
813
-            throw new IllegalArgumentException("查询职能部门个数为:0");
816
+        if (deptIdListByType == null || deptIdListByType.size() == 0) {
817
+            return new ArrayList<>();
814 818
         }
815 819
         List<String> deptIds = deptIdListByType.stream().map(d -> d.get("deptId").toString()).distinct().collect(Collectors.toList());
816 820
         // 查询职能问题数量
@@ -818,18 +822,18 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
818 822
                 .in(PostCheckedProblem::getCheckedDeptId, deptIds)
819 823
         );
820 824
         List<DutyTypeProblemStatisticsView> list = new ArrayList<>();
821
-        if (postCheckedProblems!=null && postCheckedProblems.size()>0){
825
+        if (postCheckedProblems != null && postCheckedProblems.size() > 0) {
822 826
 //            @ApiModelProperty("业务职责")
823
-             Integer dutyTypeOne = 0;
827
+            Integer dutyTypeOne = 0;
824 828
 
825 829
 //            @ApiModelProperty("党建及党风廉政")
826
-             Integer dutyTypeTwo = 0;
830
+            Integer dutyTypeTwo = 0;
827 831
 
828 832
 //            @ApiModelProperty("安全环保职责")
829
-             Integer dutyTypeThree = 0;
833
+            Integer dutyTypeThree = 0;
830 834
 
831 835
 //            @ApiModelProperty("合规保密职")
832
-             Integer dutyTypeFour = 0;
836
+            Integer dutyTypeFour = 0;
833 837
             for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
834 838
                 if (postCheckedProblem.getDutyType() == 1)
835 839
                     dutyTypeOne++;
@@ -858,8 +862,8 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
858 862
 //        select * from "public"."post_checked_problem";
859 863
 //        group by problem_level   问题等级(一般、重要)
860 864
         List<Map<String, Object>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(type);
861
-        if (deptIdListByType == null && deptIdListByType.size() == 0){
862
-            throw new IllegalArgumentException("查询职能部门个数为:0");
865
+        if (deptIdListByType == null || deptIdListByType.size() == 0) {
866
+            return new ArrayList<>();
863 867
         }
864 868
         List<String> deptIds = deptIdListByType.stream().map(d -> d.get("deptId").toString()).distinct().collect(Collectors.toList());
865 869
         // 查询职能问题数量
@@ -867,7 +871,7 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
867 871
                 .in(PostCheckedProblem::getCheckedDeptId, deptIds)
868 872
         );
869 873
         List<ProblemLevelView> list = new ArrayList<>();
870
-        if (postCheckedProblems!=null && postCheckedProblems.size()>0){
874
+        if (postCheckedProblems != null && postCheckedProblems.size() > 0) {
871 875
             List<PostCheckedProblem> collect = postCheckedProblems.stream().filter(d -> d.getProblemLevel() != null && d.getProblemLevel().equals("2")).collect(Collectors.toList());
872 876
             ProblemLevelView data = new ProblemLevelView();
873 877
             data.setProblemLeveOne(collect.size());
@@ -879,25 +883,81 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
879 883
     }
880 884
 
881 885
     @Override
882
-    public  List<ProblemAttributeCategoryView> problemAttributeCategoryView(Integer type) {
886
+    public List<ProblemAttributeCategoryView> problemAttributeCategoryView(Integer type) {
883 887
         //         查询问题表
884 888
 //        select * from "public"."post_checked_problem";
885 889
 //        GROUP BY problem_attribute -- 问题属性(1-完整问题;2-有效性问题;3-适宜性问题;)
886 890
 //        GROUP BY problem_category -- 问题类别(职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他)
887 891
 
888 892
         List<Map<String, Object>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(type);
889
-        if (deptIdListByType == null && deptIdListByType.size() == 0){
890
-            throw new IllegalArgumentException("查询职能部门个数为:0");
893
+        if (deptIdListByType == null || deptIdListByType.size() == 0) {
894
+            return new ArrayList<>();
891 895
         }
892 896
         List<String> deptIds = deptIdListByType.stream().map(d -> d.get("deptId").toString()).distinct().collect(Collectors.toList());
893 897
         // 查询职能问题数量
894 898
         List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
895 899
                 .in(PostCheckedProblem::getCheckedDeptId, deptIds)
896 900
         );
901
+        List<ProblemAttributeCategoryView> list = new ArrayList<>();
902
+        if (postCheckedProblems != null && postCheckedProblems.size() > 0) {
903
+            Map<String, List<PostCheckedProblem>> collect = postCheckedProblems.stream().collect(Collectors.groupingBy(PostCheckedProblem::getProblemCategory));
904
+//           问题类别(职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他)
905
+            for (Map.Entry<String, List<PostCheckedProblem>> stringListEntry : collect.entrySet()) {
906
+                List<PostCheckedProblem> value = stringListEntry.getValue();
907
+                if (value != null && value.size() > 0) {
908
+
909
+                    ProblemAttributeCategoryView data = new ProblemAttributeCategoryView();
910
+                    if (stringListEntry.getKey().equals("1")) {
911
+                        data.setProblemCategoryType(1);
912
+                        data.setProblemCategoryTypeView("职责权限问题");
913
+                    }
914
+                    if (stringListEntry.getKey().equals("2")) {
915
+                        data.setProblemCategoryType(2);
916
+                        data.setProblemCategoryTypeView("工作内容问题");
917
+                    }
918
+                    if (stringListEntry.getKey().equals("3")) {
919
+                        data.setProblemCategoryType(3);
920
+                        data.setProblemCategoryTypeView("工作标准问题");
921
+                    }
922
+                    if (stringListEntry.getKey().equals("4")) {
923
+                        data.setProblemCategoryType(4);
924
+                        data.setProblemCategoryTypeView("考核奖励问题");
925
+                    }
926
+                    if (stringListEntry.getKey().equals("5")) {
927
+                        data.setProblemCategoryType(5);
928
+                        data.setProblemCategoryTypeView("任职资格问题");
929
+                    }
930
+                    if (stringListEntry.getKey().equals("6")) {
931
+                        data.setProblemCategoryType(6);
932
+                        data.setProblemCategoryTypeView("其他");
933
+                    }
934
+//        @ApiModelProperty("完整性数量")
935
+                    int problemComplete = 0;
936
+//        @ApiModelProperty("适宜性数量")
937
+                    int problemSuitable = 0;
938
+//        @ApiModelProperty("有效性数量")
939
+                    int problemEffective = 0;
940
+
941
+                    for (PostCheckedProblem postCheckedProblem : value) {
942
+                        if (postCheckedProblem.getProblemAttribute() == 1) {
943
+                            problemComplete++;
944
+                        }
945
+                        if (postCheckedProblem.getProblemAttribute() == 2) {
946
+                            problemEffective++;
947
+                        }
948
+                        if (postCheckedProblem.getProblemAttribute() == 3) {
949
+                            problemSuitable++;
950
+                        }
951
+                    }
952
+                    data.setProblemComplete(problemComplete);// 完整性数量
953
+                    data.setProblemSuitable(problemSuitable);// 适宜性数量
954
+                    data.setProblemEffective(problemEffective);// 有效性数量
955
+                    list.add(data);
956
+                }
957
+            }
958
+        }
897 959
 
898 960
 
899
-        List<ProblemAttributeCategoryView> list = new ArrayList<>();
900
-        ProblemAttributeCategoryView data = new ProblemAttributeCategoryView();
901 961
 //        data.set完成性
902 962
 //        data.set适宜性
903 963
 //        data.set有效性
@@ -908,7 +968,192 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
908 968
 //        data.set任职资格
909 969
 //        data.set其他
910 970
 
911
-        list.add(data);
971
+
972
+        return list;
973
+    }
974
+
975
+    @Override
976
+    public List<HistoryProblemNumberView> historyProblemNumberView(Integer type) {
977
+        //         查询问题表
978
+//        select * from "public"."post_checked_problem";
979
+//        GROUP BY problem_attribute -- 问题属性(1-完整问题;2-有效性问题;3-适宜性问题;)
980
+//        GROUP BY problem_category -- 问题类别(职责权限问题、工作内容问题、工作标准问题、考核奖励问题、任职资格问题、其他)
981
+
982
+
983
+        List<Map<String, Object>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(type);
984
+        if (deptIdListByType == null || deptIdListByType.size() == 0) {
985
+            return new ArrayList<>();
986
+        }
987
+        List<String> deptIds = deptIdListByType.stream().map(d -> d.get("deptId").toString()).distinct().collect(Collectors.toList());
988
+        // 查询职能问题数量
989
+        List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
990
+                .in(PostCheckedProblem::getCheckedDeptId, deptIds)
991
+        );
992
+        List<HistoryProblemNumberView> list = new ArrayList<>();
993
+        if (postCheckedProblems != null && postCheckedProblems.size() > 0) {
994
+            SimpleDateFormat adf = new SimpleDateFormat("yyyy-MM-dd");
995
+            Map<String, List<PostCheckedProblem>> collect = postCheckedProblems.stream().collect(Collectors.groupingBy(d -> adf.format(d.getCreateTime()), Collectors.toList()));
996
+            HistoryProblemNumberView data = new HistoryProblemNumberView();
997
+            data.setCheckYear(new Date());
998
+            //        @ApiModelProperty("总数量")
999
+            int problemTotal = 0;
1000
+//        @ApiModelProperty("完整性数量")
1001
+            int problemComplete = 0;
1002
+//        @ApiModelProperty("适宜性数量")
1003
+            int problemSuitable = 0;
1004
+//        @ApiModelProperty("有效性数量")
1005
+            int problemEffective = 0;
1006
+//        @ApiModelProperty("职责权限问题")
1007
+            int problemCategoryOne = 0;
1008
+//        @ApiModelProperty("工作内容问题")
1009
+            int problemCategoryTwo = 0;
1010
+//        @ApiModelProperty("工作标准问题")
1011
+            int problemCategoryThree = 0;
1012
+//        @ApiModelProperty("考核奖励问题")
1013
+            int problemCategoryFour = 0;
1014
+//        @ApiModelProperty("任职资格问题")
1015
+            int problemCategoryFive = 0;
1016
+//        @ApiModelProperty("其他")
1017
+            int problemCategorySix = 0;
1018
+            for (Map.Entry<String, List<PostCheckedProblem>> stringListEntry : collect.entrySet()) {
1019
+                List<PostCheckedProblem> value = stringListEntry.getValue();
1020
+                if (value != null && value.size() > 0) {
1021
+                    for (PostCheckedProblem postCheckedProblem : value) {
1022
+                        problemTotal++;
1023
+                        if (postCheckedProblem.getProblemAttribute() == 1) {
1024
+                            problemComplete++;
1025
+                        }
1026
+                        if (postCheckedProblem.getProblemAttribute() == 2) {
1027
+                            problemEffective++;
1028
+                        }
1029
+                        if (postCheckedProblem.getProblemAttribute() == 3) {
1030
+                            problemSuitable++;
1031
+                        }
1032
+                        if (postCheckedProblem.getProblemCategory() == null)
1033
+                            continue;
1034
+                        if (postCheckedProblem.getProblemCategory().equals("1"))
1035
+                            problemCategoryOne++;
1036
+                        if (postCheckedProblem.getProblemCategory().equals("2"))
1037
+                            problemCategoryTwo++;
1038
+                        if (postCheckedProblem.getProblemCategory().equals("3"))
1039
+                            problemCategoryThree++;
1040
+                        if (postCheckedProblem.getProblemCategory().equals("4"))
1041
+                            problemCategoryFour++;
1042
+                        if (postCheckedProblem.getProblemCategory().equals("5"))
1043
+                            problemCategoryFive++;
1044
+                        if (postCheckedProblem.getProblemCategory().equals("6"))
1045
+                            problemCategorySix++;
1046
+                    }
1047
+                }
1048
+            }
1049
+            data.setProblemTotal(problemTotal);
1050
+            data.setProblemComplete(problemComplete);
1051
+            data.setProblemSuitable(problemSuitable);
1052
+            data.setProblemEffective(problemEffective);
1053
+            data.setProblemCategoryOne(problemCategoryOne);
1054
+            data.setProblemCategoryTwo(problemCategoryTwo);
1055
+            data.setProblemCategoryThree(problemCategoryThree);
1056
+            data.setProblemCategoryFour(problemCategoryFour);
1057
+            data.setProblemCategoryFive(problemCategoryFive);
1058
+            data.setProblemCategorySix(problemCategorySix);
1059
+            list.add(data);
1060
+        }
1061
+        return list;
1062
+    }
1063
+
1064
+    @Override
1065
+    public List<CheckedProblemDeptDetaailView> deptDetaailView(Integer type) {
1066
+        List<Map<String, Object>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(type);
1067
+        if (deptIdListByType == null || deptIdListByType.size() == 0) {
1068
+            return new ArrayList<>();
1069
+        }
1070
+        List<String> deptIds = deptIdListByType.stream().map(d -> d.get("deptId").toString()).distinct().collect(Collectors.toList());
1071
+        // 查询职能问题数量
1072
+        List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
1073
+                .in(PostCheckedProblem::getCheckedDeptId, deptIds)
1074
+        );
1075
+
1076
+        List<CheckedProblemDeptDetaailView> list = new ArrayList<>();
1077
+
1078
+        //TODO 第一步:得到各个部门ID、部门名称、问题总数量、重要问题数量、一般问题数量、统计时间
1079
+        //TODO 第二步:得到4个职责类别的问题数量及整改完成数量(1-业务职责;2-党建及党风廉政;3-安全环保职责;4-合规保密职;)
1080
+        //TODO 第三步:设置部门的整改率:遍历职责类别计算整改率
1081
+        if (postCheckedProblems != null && postCheckedProblems.size() > 0) {
1082
+            Map<Long, List<PostCheckedProblem>> deptMap = postCheckedProblems.stream().collect(Collectors.groupingBy(PostCheckedProblem::getCheckedDeptId));
1083
+            for (Map.Entry<Long, List<PostCheckedProblem>> longListEntry : deptMap.entrySet()) {
1084
+                Long key = longListEntry.getKey();
1085
+                List<PostCheckedProblem> value = longListEntry.getValue();
1086
+                CheckedProblemDeptDetaailView data1 = new CheckedProblemDeptDetaailView();
1087
+                data1.setDeptId(key); //部门ID
1088
+                data1.setDeptName(postAssessmentRatingMapper.getSysDeptName(key));// 部门名称
1089
+                int problemTotal = 0;
1090
+//    @ApiModelProperty("一般")
1091
+                Integer problemLeveOne = 0;
1092
+//    @ApiModelProperty("重要")
1093
+                Integer problemLeveTwo = 0;
1094
+                for (PostCheckedProblem postCheckedProblem : value) {
1095
+                    problemTotal++;
1096
+                    if (postCheckedProblem.getProblemLevel().equals("1")){
1097
+                        problemLeveOne++;
1098
+                    }
1099
+                    if (postCheckedProblem.getProblemLevel().equals("2")){
1100
+                        problemLeveTwo++;
1101
+                    }
1102
+                }
1103
+                data1.setProblemTotal(problemTotal); //问题数量
1104
+                data1.setProblemLeveTwo(problemLeveTwo); //重要问题
1105
+                data1.setProblemLeveOne(problemLeveOne); //一般问题
1106
+                Map<Integer, List<PostCheckedProblem>> dutyMap = value.stream().collect(Collectors.groupingBy(PostCheckedProblem::getDutyType));
1107
+
1108
+
1109
+                for (Map.Entry<Integer, List<PostCheckedProblem>> integerListEntry : dutyMap.entrySet()) {
1110
+                    //        @ApiModelProperty("完整性数量")
1111
+                    int problemComplete = 0;
1112
+//        @ApiModelProperty("适宜性数量")
1113
+                    int problemSuitable = 0;
1114
+//        @ApiModelProperty("有效性数量")
1115
+                    int problemEffective = 0;
1116
+                    Integer duty = integerListEntry.getKey();
1117
+                    CheckedProblemDeptDetaailView.ProblemAttributeInner child1 = new CheckedProblemDeptDetaailView.ProblemAttributeInner();
1118
+                    child1.setDutyType(duty);
1119
+                    List<PostCheckedProblem> postCheckedProblemList = integerListEntry.getValue();
1120
+                    for (PostCheckedProblem postCheckedProblem : postCheckedProblemList) {
1121
+                        if (postCheckedProblem.getProblemAttribute() == 1) {
1122
+                            problemComplete++;
1123
+                        }
1124
+                        if (postCheckedProblem.getProblemAttribute() == 2) {
1125
+                            problemEffective++;
1126
+                        }
1127
+                        if (postCheckedProblem.getProblemAttribute() == 3) {
1128
+                            problemSuitable++;
1129
+                        }
1130
+                    }
1131
+                    child1.setProblemComplete(problemComplete);
1132
+                    child1.setProblemEffective(problemEffective);
1133
+                    child1.setProblemSuitable(problemSuitable);
1134
+                }
1135
+                list.add(data1);
1136
+            }
1137
+        }
1138
+
1139
+
1140
+//        data1.setDeptId(1l); //部门ID
1141
+//        data1.setDeptName("测试部门名称1");// 部门名称
1142
+//        data1.setProblemTotal(10); //问题数量
1143
+//        data1.setProblemLeveTwo(2); //重要问题
1144
+//        data1.setProblemLeveOne(8); //一般问题
1145
+//        data1.setStatisticsTime(new Date());// 统计时间
1146
+//
1147
+//        List<CheckedProblemDeptDetaailView.ProblemAttributeInner> children1 = new ArrayList<>();
1148
+//        CheckedProblemDeptDetaailView.ProblemAttributeInner child1 = new CheckedProblemDeptDetaailView.ProblemAttributeInner();
1149
+//        child1.setProblemComplete(1); //child1.set完整性数量
1150
+//        child1.setProblemSuitable(2); //child1.set适宜性数量
1151
+//        child1.setProblemEffective(3);//child1.set有效性数量
1152
+//        //children1.add(child1);
1153
+//        //data1.setChildren(children1);
1154
+//        data1.getChildren().add(child1);
1155
+
1156
+
912 1157
         return null;
913 1158
     }
914 1159
 }