Browse Source

修改考核分析报表
修改清单审核

csg6 10 months ago
parent
commit
acf68ab2c0

+ 4 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java

@@ -33,7 +33,7 @@ import com.ruoyi.system.service.ISysUserService;
33 33
 
34 34
 /**
35 35
  * 角色信息
36
- * 
36
+ *
37 37
  * @author ruoyi
38 38
  */
39 39
 @RestController
@@ -59,7 +59,8 @@ public class SysRoleController extends BaseController
59 59
     @GetMapping("/list")
60 60
     public TableDataInfo list(SysRole role)
61 61
     {
62
-        startPage();
62
+//        startPage();
63
+        startPage("desc", "r.create_time");
63 64
         List<SysRole> list = roleService.selectRoleList(role);
64 65
         return getDataTable(list);
65 66
     }
@@ -125,7 +126,7 @@ public class SysRoleController extends BaseController
125 126
             return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
126 127
         }
127 128
         role.setUpdateBy(getUsername());
128
-        
129
+
129 130
         if (roleService.updateRole(role) > 0)
130 131
         {
131 132
             // 更新缓存用户权限

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -65,7 +65,8 @@ public class SysUserController extends BaseController {
65 65
     @PreAuthorize("@ss.hasPermi('system:user:list')")
66 66
     @GetMapping("/list")
67 67
     public TableDataInfo list(SysUser user) {
68
-        startPage();
68
+//        startPage();
69
+        startPage("desc", "u.create_time");
69 70
         List<SysUser> list = userService.selectUserList(user);
70 71
         return getDataTable(list);
71 72
     }

+ 6 - 1
ruoyi-admin/src/test/java/com/post/Test01.java

@@ -9,8 +9,13 @@ public class Test01 {
9 9
         double round = Arith.round(new BigDecimal(99.98).doubleValue(), 2);
10 10
         System.out.println(round);
11 11
         System.out.println(new BigDecimal(round).doubleValue());
12
+
13
+        for (int i = 100; i < 201; i++) {
14
+            System.out.println("insert into post_tools (id, \"type\", \"type_view\") values(" + i + ", 1, " + (2020 + (i - 100)) + ");");
15
+        }
12 16
     }
13
-    public void ss(){
17
+
18
+    public void ss() {
14 19
 
15 20
     }
16 21
 }

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

@@ -189,7 +189,6 @@ public class PostAssessmentRatingController extends BaseController {
189 189
      * 根据部门查询问题
190 190
      */
191 191
     @ApiOperation("根据部门查询问题")
192
-
193 192
     @ApiImplicitParams({
194 193
             @ApiImplicitParam(name = "type", value = "类型1 年度 2 季度 3 月度", dataType = "String", dataTypeClass = Integer.class),
195 194
             @ApiImplicitParam(name = "year", value = "年份", dataType = "String", dataTypeClass = String.class)
@@ -197,7 +196,8 @@ public class PostAssessmentRatingController extends BaseController {
197 196
     @GetMapping("/{type}/{year}")
198 197
     @Anonymous
199 198
     public AjaxResult assessmentstatistics(@PathVariable("type") Integer type,@PathVariable("year") String year) {
200
-        return success(postAssessmentRatingService.assessmentstatistics(type,year));
199
+//        return success(postAssessmentRatingService.assessmentstatistics(type,year));
200
+        return success(postAssessmentRatingService.assessmentstatisticsV2(type,year));
201 201
     }
202 202
 
203 203
 }

+ 13 - 10
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/mapper/PostCheckedProblemMapper.java

@@ -9,14 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
9 9
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
10 10
 import com.ruoyi.postCheck.domain.tools.ProblemCategory;
11 11
 import org.apache.ibatis.annotations.MapKey;
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
12
+import org.apache.ibatis.annotations.Param;
20 13
 
21 14
 
22 15
 /**
@@ -25,8 +18,7 @@ import org.apache.ibatis.annotations.MapKey;
25 18
  * @author csg
26 19
  * @date 2023-12-23
27 20
  */
28
-public interface PostCheckedProblemMapper extends BaseMapper<PostCheckedProblem>
29
-{
21
+public interface PostCheckedProblemMapper extends BaseMapper<PostCheckedProblem> {
30 22
     /**
31 23
      * 查询岗检问题表
32 24
      *
@@ -81,13 +73,24 @@ public interface PostCheckedProblemMapper extends BaseMapper<PostCheckedProblem>
81 73
 
82 74
     /**
83 75
      * 按问题属性分组统计问题类别
76
+     *
84 77
      * @return
85 78
      */
86 79
     List<ProblemCategory> problemCategoryByAttribute();
80
+
87 81
     @MapKey("YEAR")
88 82
     Map<String, Object> getYearStatistics(String year);
83
+
89 84
     @MapKey("QUARTER")
90 85
     Map<String, Object> getQuarterStatistics(String year);
86
+
91 87
     @MapKey("MONTH")
92 88
     Map<String, Object> getMonthStatistics(String year);
89
+
90
+    // 改造返回值=List;改造自动填充值(没有数据的月份自动填充)
91
+    List<Map<String, Object>> getYearStatisticsV2(@Param("beginYear") Integer beginYear, @Param("endYear") Integer endYear);
92
+
93
+    List<Map<String, Object>> getQuarterStatisticsV2(String year);
94
+
95
+    List<Map<String, Object>> getMonthStatisticsV2(String year);
93 96
 }

+ 2 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/IPostAssessmentRatingService.java

@@ -75,4 +75,6 @@ public interface IPostAssessmentRatingService extends IService<PostAssessmentRat
75 75
     List<PostCheckedProblem> getProblemByDeptId(Long id);
76 76
 
77 77
     Map<String,Object> assessmentstatistics(Integer type, String year);
78
+
79
+    List<Map<String, Object>> assessmentstatisticsV2(Integer type, String year);
78 80
 }

+ 51 - 22
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostAssessmentRatingServiceImpl.java

@@ -24,6 +24,7 @@ import com.ruoyi.postCheck.mapper.PostAssessmentRulesMapper;
24 24
 import com.ruoyi.postCheck.mapper.PostCheckedProblemMapper;
25 25
 import com.ruoyi.postCheck.mapper.PostPlanInfoMapper;
26 26
 import com.ruoyi.postCheck.mapper.PostPlanMapper;
27
+import io.swagger.annotations.ApiImplicitParam;
27 28
 import org.springframework.beans.factory.annotation.Autowired;
28 29
 import org.springframework.stereotype.Service;
29 30
 import com.ruoyi.postCheck.mapper.PostAssessmentRatingMapper;
@@ -53,6 +54,7 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
53 54
     private PostPlanMapper postPlanMapper;
54 55
     @Autowired
55 56
     private PostAssessmentRulesMapper postAssessmentRulesMapper;
57
+
56 58
     /**
57 59
      * 查询考核评比
58 60
      *
@@ -74,7 +76,7 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
74 76
     public List<PostAssessmentRating> selectPostAssessmentRatingList(PostAssessmentRating postAssessmentRating) {
75 77
         // type 1 是职能管理部门, 2 生产运营部门
76 78
         Integer type;
77
-        if (postAssessmentRating.getType() == 2){
79
+        if (postAssessmentRating.getType() == 2) {
78 80
             type = 3;
79 81
         } else {
80 82
             type = 2;
@@ -90,53 +92,53 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
90 92
             // 1 先查询问题
91 93
             BigDecimal postSouce = new BigDecimal("100");
92 94
             List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
93
-                    .eq(PostCheckedProblem::getCheckedDeptId,post.getDeptId())
95
+                    .eq(PostCheckedProblem::getCheckedDeptId, post.getDeptId())
94 96
             );
95 97
             BigDecimal postTotal = postCheckedProblemMapper.getPostTotalByDeptId(post.getDeptId());
96
-            if (postCheckedProblems.size() > 0){
98
+            if (postCheckedProblems.size() > 0) {
97 99
                 // 计算扣除分数
98 100
                 BigDecimal postAfter = new BigDecimal("100");
99 101
                 Set<PostAssessmentRules> collect = postAssessmentRules.stream().filter(d -> d.getType() == type).collect(Collectors.toSet());
100 102
                 for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
101
-                    Optional<PostAssessmentRules> first = postAssessmentRules.stream().filter(d ->d.getType() == type && d.getDutyType().equals(postCheckedProblem.getDutyType())).findFirst();
102
-                    if (first.isPresent()){
103
-                        if (postCheckedProblem.getProblemLevel().equals("1")){
104
-                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelOne()!=null?first.get().getProblemLevelOne():"0")));
105
-                        }else{
106
-                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelTwo()!=null?first.get().getProblemLevelTwo():"0")));
103
+                    Optional<PostAssessmentRules> first = postAssessmentRules.stream().filter(d -> d.getType() == type && d.getDutyType().equals(postCheckedProblem.getDutyType())).findFirst();
104
+                    if (first.isPresent()) {
105
+                        if (postCheckedProblem.getProblemLevel().equals("1")) {
106
+                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelOne() != null ? first.get().getProblemLevelOne() : "0")));
107
+                        } else {
108
+                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelTwo() != null ? first.get().getProblemLevelTwo() : "0")));
107 109
                         }
108 110
                     }
109 111
                 }
110 112
                 BigDecimal divide = new BigDecimal("0");
111
-                if (postTotal != null){
112
-                    divide =  new BigDecimal(postCheckedProblems.size()).divide(postTotal.multiply(new BigDecimal(collect.size())),4, RoundingMode.HALF_UP);
113
+                if (postTotal != null) {
114
+                    divide = new BigDecimal(postCheckedProblems.size()).divide(postTotal.multiply(new BigDecimal(collect.size())), 4, RoundingMode.HALF_UP);
113 115
                 }
114 116
                 // 计算系数 1-问题总数/需要查的问题数
115
-                if (divide.compareTo(new BigDecimal("1")) < 0 && divide.compareTo(new BigDecimal("0")) > 0 ){
117
+                if (divide.compareTo(new BigDecimal("1")) < 0 && divide.compareTo(new BigDecimal("0")) > 0) {
116 118
                     postSouce = postAfter.multiply(new BigDecimal("1").subtract(divide));
117
-                }else{
119
+                } else {
118 120
                     postSouce = new BigDecimal("0");
119 121
                 }
120
-            }else {
122
+            } else {
121 123
                 postSouce = new BigDecimal("0");
122 124
             }
123 125
             post.setPositionScore(postSouce);
124 126
             // 计算互评得分
125 127
 
126 128
             List<PostAssessmentRatingOtherInfo> postAssessmentRatingOtherInfos = postAssessmentRatingOtherInfoMapper.selectList(Wrappers.<PostAssessmentRatingOtherInfo>lambdaQuery()
127
-                    .eq(PostAssessmentRatingOtherInfo::getByDeptId,post.getDeptId())
129
+                    .eq(PostAssessmentRatingOtherInfo::getByDeptId, post.getDeptId())
128 130
                     .apply(" \"rating_other_id\" in (SELECT \"id\" FROM \"public\".\"post_assessment_rating_other\" WHERE \"type\"  = 1\n)")
129 131
                     .orderByAsc(PostAssessmentRatingOtherInfo::getByDeptScore)
130 132
             );
131 133
             BigDecimal peerEvaluationScore = new BigDecimal("100");
132
-            if (postAssessmentRatingOtherInfos.size()>0){
133
-                postAssessmentRatingOtherInfos.remove(postAssessmentRatingOtherInfos.size()-1);
134
+            if (postAssessmentRatingOtherInfos.size() > 0) {
135
+                postAssessmentRatingOtherInfos.remove(postAssessmentRatingOtherInfos.size() - 1);
134 136
                 postAssessmentRatingOtherInfos.remove(0);
135 137
                 BigDecimal sum = new BigDecimal("0");
136 138
                 postAssessmentRatingOtherInfos.forEach(x -> {
137
-                    sum.add(x.getByDeptScore()!=null?x.getByDeptScore():new BigDecimal("0"));
139
+                    sum.add(x.getByDeptScore() != null ? x.getByDeptScore() : new BigDecimal("0"));
138 140
                 });
139
-                peerEvaluationScore = sum.divide(new BigDecimal(postAssessmentRatingOtherInfos.size()),4, RoundingMode.HALF_UP);
141
+                peerEvaluationScore = sum.divide(new BigDecimal(postAssessmentRatingOtherInfos.size()), 4, RoundingMode.HALF_UP);
140 142
             }
141 143
             post.setPeerEvaluationScore(peerEvaluationScore);
142 144
             postAssessmentRatings.add(post);
@@ -201,18 +203,45 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
201 203
     @Override
202 204
     public List<PostCheckedProblem> getProblemByDeptId(Long id) {
203 205
         return postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
204
-            .eq(PostCheckedProblem::getCheckedDeptId,id)
206
+                .eq(PostCheckedProblem::getCheckedDeptId, id)
205 207
         );
206 208
     }
207 209
 
210
+
208 211
     @Override
209 212
     public Map<String, Object> assessmentstatistics(Integer type, String year) {
210 213
         if (type == 1)
211 214
             return postCheckedProblemMapper.getYearStatistics(year);
212 215
         if (type == 2)
213
-            return postCheckedProblemMapper.getQuarterStatistics(year);;
216
+            return postCheckedProblemMapper.getQuarterStatistics(year);
214 217
         if (type == 3)
215
-            return postCheckedProblemMapper.getMonthStatistics(year);;
218
+            return postCheckedProblemMapper.getMonthStatistics(year);
216 219
         return new HashMap<>();
217 220
     }
221
+
222
+    //    @ApiImplicitParam(name = "type", value = "类型1 年度 2 季度 3 月度", dataType = "String", dataTypeClass = Integer.class),
223
+//    @ApiImplicitParam(name = "year", value = "年份", dataType = "String", dataTypeClass = String.class)
224
+    @Override
225
+    public List<Map<String, Object>> assessmentstatisticsV2(Integer type, String year) {
226
+        if (type == 1) {
227
+            int endYear = Integer.parseInt(year);
228
+            int beginYear = endYear - 3;
229
+            return postCheckedProblemMapper.getYearStatisticsV2(beginYear, endYear);
230
+        } else if (type == 2) {
231
+            return postCheckedProblemMapper.getQuarterStatisticsV2(year);
232
+        } else if (type == 3) {
233
+            List<Map<String, Object>> monthStatisticsV2 = postCheckedProblemMapper.getMonthStatisticsV2(year);
234
+            return monthStatisticsV2;
235
+        }
236
+
237
+        /*
238
+
239
+
240
+        month
241
+        year
242
+        year
243
+         */
244
+
245
+        return new ArrayList<>();
246
+    }
218 247
 }

+ 43 - 30
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostListServiceImpl.java

@@ -120,17 +120,17 @@ public class PostListServiceImpl extends ServiceImpl<PostListMapper, PostList> i
120 120
 
121 121
         //TODO 更新业务职责的状态=待审核:只要部门修改数据,人力资源都需要重新审核单据
122 122
         //1、按区域类型+主表id批量更新明细表状态、审核人、审核时间、未通过理由
123
-        LambdaUpdateWrapper<PostListInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
123
+        LambdaUpdateWrapper<PostListInfo> infoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
124 124
         //条件
125
-        lambdaUpdateWrapper.eq(PostListInfo::getPostListId, postList.getId());
126
-        lambdaUpdateWrapper.eq(PostListInfo::getType, PostListEnum.TYPE_ONE.getValue());
125
+        infoLambdaUpdateWrapper.eq(PostListInfo::getPostListId, postList.getId());
126
+        infoLambdaUpdateWrapper.eq(PostListInfo::getType, PostListEnum.TYPE_ONE.getValue());
127 127
         //参数
128
-        lambdaUpdateWrapper.set(PostListInfo::getStatus, PostListEnum.STATUS_WAIT.getValue());
129
-        lambdaUpdateWrapper.set(PostListInfo::getStatusTime, null);
130
-        lambdaUpdateWrapper.set(PostListInfo::getStatusByUserId, null);
131
-        lambdaUpdateWrapper.set(PostListInfo::getStatusByUserName, null);
132
-        lambdaUpdateWrapper.set(PostListInfo::getReason, null);
133
-        postListInfoMapper.update(null, lambdaUpdateWrapper);
128
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatus, PostListEnum.STATUS_WAIT.getValue());
129
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatusTime, null);
130
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatusByUserId, null);
131
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatusByUserName, null);
132
+        infoLambdaUpdateWrapper.set(PostListInfo::getReason, null);
133
+        postListInfoMapper.update(null, infoLambdaUpdateWrapper);
134 134
 
135 135
         return rows;
136 136
     }
@@ -168,17 +168,17 @@ public class PostListServiceImpl extends ServiceImpl<PostListMapper, PostList> i
168 168
 
169 169
         //TODO 更新业务职责的状态=待审核:只要部门修改数据,人力资源都需要重新审核单据
170 170
         //1、按区域类型+主表id批量更新明细表状态、审核人、审核时间、未通过理由
171
-        LambdaUpdateWrapper<PostListInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
171
+        LambdaUpdateWrapper<PostListInfo> infoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
172 172
         //条件
173
-        lambdaUpdateWrapper.eq(PostListInfo::getPostListId, postList.getId());
174
-        lambdaUpdateWrapper.eq(PostListInfo::getType, PostListEnum.TYPE_ONE.getValue());
173
+        infoLambdaUpdateWrapper.eq(PostListInfo::getPostListId, postList.getId());
174
+        infoLambdaUpdateWrapper.eq(PostListInfo::getType, PostListEnum.TYPE_ONE.getValue());
175 175
         //参数
176
-        lambdaUpdateWrapper.set(PostListInfo::getStatus, PostListEnum.STATUS_WAIT.getValue());
177
-        lambdaUpdateWrapper.set(PostListInfo::getStatusTime, null);
178
-        lambdaUpdateWrapper.set(PostListInfo::getStatusByUserId, null);
179
-        lambdaUpdateWrapper.set(PostListInfo::getStatusByUserName, null);
180
-        lambdaUpdateWrapper.set(PostListInfo::getReason, null);
181
-        postListInfoMapper.update(null, lambdaUpdateWrapper);
176
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatus, PostListEnum.STATUS_WAIT.getValue());
177
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatusTime, null);
178
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatusByUserId, null);
179
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatusByUserName, null);
180
+        infoLambdaUpdateWrapper.set(PostListInfo::getReason, null);
181
+        postListInfoMapper.update(null, infoLambdaUpdateWrapper);
182 182
 
183 183
         return updateCount;
184 184
     }
@@ -347,31 +347,44 @@ public class PostListServiceImpl extends ServiceImpl<PostListMapper, PostList> i
347 347
                 }
348 348
                 throw new BaseException("以下部门还未审核,请检查!" + typeView);
349 349
             }
350
+
351
+            LambdaUpdateWrapper<PostList> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
352
+            lambdaUpdateWrapper.eq(PostList::getId, id);
353
+            lambdaUpdateWrapper.set(PostList::getStatus, PostListEnum.STATUS_PASS.getValue());
354
+            postListMapper.update(null, lambdaUpdateWrapper);
355
+        }
356
+        //非人力资源审核,将外层状态设置为审核中
357
+        else {
358
+            LambdaUpdateWrapper<PostList> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
359
+            lambdaUpdateWrapper.eq(PostList::getId, id);
360
+            lambdaUpdateWrapper.set(PostList::getStatus, PostListEnum.STATUS_WAIT.getValue());
361
+            postListMapper.update(null, lambdaUpdateWrapper);
362
+
350 363
         }
351 364
 
352 365
 
353 366
         //1、按区域类型+主表id批量更新明细表状态、审核人、审核时间、未通过理由
354
-        LambdaUpdateWrapper<PostListInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
367
+        LambdaUpdateWrapper<PostListInfo> infoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
355 368
         //条件
356
-        lambdaUpdateWrapper.eq(PostListInfo::getPostListId, id);
357
-        lambdaUpdateWrapper.eq(PostListInfo::getType, type);
369
+        infoLambdaUpdateWrapper.eq(PostListInfo::getPostListId, id);
370
+        infoLambdaUpdateWrapper.eq(PostListInfo::getType, type);
358 371
         //参数
359
-        lambdaUpdateWrapper.set(PostListInfo::getStatus, status);
360
-        lambdaUpdateWrapper.set(PostListInfo::getStatusTime, new Date());
372
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatus, status);
373
+        infoLambdaUpdateWrapper.set(PostListInfo::getStatusTime, new Date());
361 374
 
362 375
         //通过-参数
363 376
         if (status == PostListEnum.STATUS_PASS.getValue()) {
364
-            lambdaUpdateWrapper.set(PostListInfo::getStatusByUserId, SecurityUtils.getUserId());
365
-            lambdaUpdateWrapper.set(PostListInfo::getStatusByUserName, SecurityUtils.getLoginUser().getUser().getNickName());
366
-            lambdaUpdateWrapper.set(PostListInfo::getReason, null);
377
+            infoLambdaUpdateWrapper.set(PostListInfo::getStatusByUserId, SecurityUtils.getUserId());
378
+            infoLambdaUpdateWrapper.set(PostListInfo::getStatusByUserName, SecurityUtils.getLoginUser().getUser().getNickName());
379
+            infoLambdaUpdateWrapper.set(PostListInfo::getReason, null);
367 380
         }
368 381
         //驳回-参数
369 382
         else if (status == PostListEnum.STATUS_BACK.getValue()) {
370
-            lambdaUpdateWrapper.set(PostListInfo::getStatusByUserId, null);
371
-            lambdaUpdateWrapper.set(PostListInfo::getStatusByUserName, null);
372
-            lambdaUpdateWrapper.set(PostListInfo::getReason, reason);
383
+            infoLambdaUpdateWrapper.set(PostListInfo::getStatusByUserId, null);
384
+            infoLambdaUpdateWrapper.set(PostListInfo::getStatusByUserName, null);
385
+            infoLambdaUpdateWrapper.set(PostListInfo::getReason, reason);
373 386
         }
374
-        int updateCount = postListInfoMapper.update(null, lambdaUpdateWrapper);
387
+        int updateCount = postListInfoMapper.update(null, infoLambdaUpdateWrapper);
375 388
         if (updateCount == 0) {
376 389
             throw new BaseException("更新状态失败,请稍后重试!");
377 390
         }

+ 171 - 0
ruoyi-postcheck/src/main/resources/mapper/postCheck/PostCheckedProblemMapper.xml

@@ -408,6 +408,7 @@
408 408
         GROUP BY a."QUARTER"
409 409
     </select>
410 410
 
411
+
411 412
     <select id="getYearStatistics" resultType="java.util.Map">
412 413
         SELECT "YEAR",IFNULL(sum(num), '0') "num"
413 414
         FROM (SELECT t."YEAR", (t."sum" - t."two" - t."one") / "total" AS "num"
@@ -501,4 +502,174 @@
501 502
                            )) a
502 503
         GROUP BY a."MONTH"
503 504
     </select>
505
+
506
+    <select id="getYearStatisticsV2" resultType="java.util.Map">
507
+        SELECT
508
+            tools."type_view" AS "YEAR",
509
+            ROUND(IFNULL(t1."num", 0), 2)  AS "num"
510
+        FROM post_tools tools
511
+        LEFT JOIN (
512
+            SELECT "YEAR",IFNULL(sum(num), '0') "num"
513
+            FROM (SELECT t."YEAR", (t."sum" - t."two" - t."one") / "total" AS "num"
514
+                  FROM (SELECT EXTRACT(
515
+                                       YEAR
516
+                                       FROM
517
+                                       pp."create_time"
518
+                                   )       "YEAR",
519
+                               sum(pr."full_score"),
520
+                               COUNT(0)    total,
521
+                               SUM(CASE
522
+                                   pp."problem_level"
523
+                                       WHEN 2 THEN pr."problem_level_two"
524
+                                       ELSE '0'
525
+                                   END) AS "two",
526
+                               sum(CASE
527
+                                   pp."problem_level"
528
+                                       WHEN 1 THEN pr."problem_level_one"
529
+                                       ELSE '0'
530
+                                   END) AS "one"
531
+                        FROM "public"."post_checked_problem" pp
532
+                                 INNER JOIN "public"."post_assessment_rules" pr ON
533
+                                    pp."duty_type" = pr."duty_type"
534
+                                AND pr."type" = 1
535
+                        GROUP BY EXTRACT(
536
+                                         YEAR
537
+                                         FROM
538
+                                         pp."create_time"
539
+                                     )) t
540
+                  union all
541
+                  SELECT EXTRACT(
542
+                                 YEAR
543
+                                 FROM
544
+                                 "create_time"
545
+                             ) AS                        "YEAR",
546
+                         sum("by_dept_score") / count(0) "num"
547
+
548
+                  FROM "public"."post_assessment_rating_other_info"
549
+                  GROUP BY EXTRACT(
550
+                                   YEAR
551
+                                   FROM
552
+                                   "create_time"
553
+                               )) a
554
+            GROUP BY a."YEAR"
555
+        )t1 ON t1."YEAR"  = tools."type_view"
556
+        WHERE tools."type" = 1
557
+        AND tools."type_view" >= #{beginYear}
558
+        AND tools."type_view" <![CDATA[<= ]]> #{endYear}
559
+        ORDER BY tools."type_view" DESC
560
+    </select>
561
+
562
+    <select id="getQuarterStatisticsV2" resultType="java.util.Map">
563
+        SELECT
564
+            tools."type_view" AS "QUARTER",
565
+            IFNULL (ROUND(t1."num", 0) , 0) AS "num"
566
+        FROM post_tools tools
567
+        LEFT JOIN (
568
+            SELECT "QUARTER",IFNULL(sum(num), '0') "num"
569
+            FROM (SELECT t."QUARTER", (t."sum" - t."two" - t."one") / "total" AS "num"
570
+                  FROM (SELECT EXTRACT(
571
+                                       QUARTER
572
+                                       FROM
573
+                                       pp."create_time"
574
+                                   )       "QUARTER",
575
+                               sum(pr."full_score"),
576
+                               COUNT(0)    total,
577
+                               SUM(CASE
578
+                                   pp."problem_level"
579
+                                       WHEN 2 THEN pr."problem_level_two"
580
+                                       ELSE '0'
581
+                                   END) AS "two",
582
+                               sum(CASE
583
+                                   pp."problem_level"
584
+                                       WHEN 1 THEN pr."problem_level_one"
585
+                                       ELSE '0'
586
+                                   END) AS "one"
587
+                        FROM "public"."post_checked_problem" pp
588
+                                 INNER JOIN "public"."post_assessment_rules" pr ON
589
+                                    pp."duty_type" = pr."duty_type"
590
+                                AND pr."type" = 1
591
+                        WHERE to_date(pp."create_time", 'YYYY') = to_date(#{year}, 'YYYY')
592
+                        GROUP BY EXTRACT(
593
+                                         QUARTER
594
+                                         FROM
595
+                                         pp."create_time"
596
+                                     )) t
597
+                  union all
598
+                  SELECT EXTRACT(
599
+                                 QUARTER
600
+                                 FROM
601
+                                 "create_time"
602
+                             ) AS                        "QUARTER",
603
+                         sum("by_dept_score") / count(0) "num"
604
+
605
+                  FROM "public"."post_assessment_rating_other_info"
606
+                  WHERE to_date("create_time", 'YYYY') = to_date(#{year}, 'YYYY')
607
+                  GROUP BY EXTRACT(
608
+                                   QUARTER
609
+                                   FROM
610
+                                   "create_time"
611
+                               )) a
612
+            GROUP BY a."QUARTER"
613
+        ) t1 ON t1."QUARTER" = tools."type_view"
614
+        WHERE tools."type" = 2
615
+        ORDER BY tools."type_view"
616
+    </select>
617
+
618
+    <select id="getMonthStatisticsV2" resultType="java.util.Map">
619
+        SELECT
620
+            tools."type_view" AS "MONTH",
621
+            IFNULL (round(t1."num", 2),0) AS "num"
622
+        FROM post_tools tools
623
+        LEFT JOIN (
624
+            SELECT
625
+                "MONTH",
626
+                IFNULL(sum(num), '0') "num"
627
+            FROM (SELECT t."MONTH", (t."sum" - t."two" - t."one") / "total" AS "num"
628
+                  FROM (SELECT EXTRACT(
629
+                                       MONTH
630
+                                       FROM
631
+                                       pp."create_time"
632
+                                   )       "MONTH",
633
+                               sum(pr."full_score"),
634
+                               COUNT(0)    total,
635
+                               SUM(CASE
636
+                                   pp."problem_level"
637
+                                       WHEN 2 THEN pr."problem_level_two"
638
+                                       ELSE '0'
639
+                                   END) AS "two",
640
+                               sum(CASE
641
+                                   pp."problem_level"
642
+                                       WHEN 1 THEN pr."problem_level_one"
643
+                                       ELSE '0'
644
+                                   END) AS "one"
645
+                        FROM "public"."post_checked_problem" pp
646
+                                 INNER JOIN "public"."post_assessment_rules" pr ON
647
+                                    pp."duty_type" = pr."duty_type"
648
+                                AND pr."type" = 1
649
+                        WHERE to_date(pp."create_time", 'YYYY') = to_date(#{year}, 'YYYY')
650
+                        GROUP BY EXTRACT(
651
+                                         MONTH
652
+                                         FROM
653
+                                         pp."create_time"
654
+                                     )) t
655
+                  union all
656
+                  SELECT EXTRACT(
657
+                                 MONTH
658
+                                 FROM
659
+                                 "create_time"
660
+                             ) AS                        "MONTH",
661
+                         sum("by_dept_score") / count(0) "num"
662
+
663
+                  FROM "public"."post_assessment_rating_other_info"
664
+                  WHERE to_date("create_time", 'YYYY') = to_date(#{year}, 'YYYY')
665
+                  GROUP BY EXTRACT(
666
+                                   MONTH
667
+                                   FROM
668
+                                   "create_time"
669
+                               )) a
670
+            GROUP BY a."MONTH"
671
+        )t1 ON t1."MONTH" = tools."type_view"
672
+        WHERE tools."type" = 3
673
+        ORDER BY tools."type_view"
674
+    </select>
504 675
 </mapper>

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@@ -6,6 +6,7 @@ import java.util.List;
6 6
 import java.util.stream.Collectors;
7 7
 
8 8
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
9
+import com.ruoyi.common.exception.base.BaseException;
9 10
 import org.springframework.beans.factory.annotation.Autowired;
10 11
 import org.springframework.stereotype.Service;
11 12
 import com.ruoyi.common.annotation.DataScope;
@@ -194,6 +195,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
194 195
      */
195 196
     @Override
196 197
     public int insertDept(SysDept dept) {
198
+
199
+        String deptCode = dept.getDeptCode();
200
+        if (StringUtils.isBlank(deptCode)) {
201
+            throw new BaseException("请填写部门编码!");
202
+        }
203
+
197 204
         SysDept info = deptMapper.selectDeptById(dept.getParentId());
198 205
         // 如果父节点不为正常状态,则不允许新增子节点
199 206
         if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
@@ -201,6 +208,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
201 208
         }
202 209
         dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
203 210
         dept.setDeptId(Long.parseLong(IdWorker.getIdStr().substring(4)));
211
+
204 212
         return deptMapper.insertDept(dept);
205 213
     }
206 214
 
@@ -212,6 +220,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
212 220
      */
213 221
     @Override
214 222
     public int updateDept(SysDept dept) {
223
+
224
+        String deptCode = dept.getDeptCode();
225
+        if (StringUtils.isBlank(deptCode)) {
226
+            throw new BaseException("请填写部门编码!");
227
+        }
228
+
215 229
         SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
216 230
         SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
217 231
         if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {

+ 51 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java

@@ -6,9 +6,11 @@ import java.util.stream.Collectors;
6 6
 
7 7
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
8 8
 import com.ruoyi.common.constant.PostLevelEnum;
9
+import com.ruoyi.common.core.domain.entity.SysDept;
9 10
 import com.ruoyi.common.exception.base.BaseException;
10 11
 import com.ruoyi.common.utils.SecurityUtils;
11 12
 import com.ruoyi.system.domain.UserPostAuthority;
13
+import com.ruoyi.system.mapper.SysDeptMapper;
12 14
 import org.springframework.beans.factory.annotation.Autowired;
13 15
 import org.springframework.stereotype.Service;
14 16
 import com.ruoyi.common.constant.UserConstants;
@@ -29,10 +31,13 @@ import org.springframework.util.CollectionUtils;
29 31
 public class SysPostServiceImpl implements ISysPostService {
30 32
     @Autowired
31 33
     private SysPostMapper postMapper;
32
-
33 34
     @Autowired
34 35
     private SysUserPostMapper userPostMapper;
35 36
 
37
+    @Autowired
38
+    private SysDeptMapper sysDeptMapper;
39
+
40
+
36 41
     /**
37 42
      * 查询岗位信息集合
38 43
      *
@@ -155,6 +160,29 @@ public class SysPostServiceImpl implements ISysPostService {
155 160
      */
156 161
     @Override
157 162
     public int insertPost(SysPost post) {
163
+
164
+        Long deptId = post.getDeptId();
165
+        Integer postLevel = post.getPostLevel();
166
+        String postCode = post.getPostCode();
167
+        if (deptId == null || postLevel == null || StringUtils.isBlank(postCode)) {
168
+            throw new BaseException("部门ID、岗位编码、岗位级别等必选参数为空,请检查!");
169
+        }
170
+
171
+        if (postLevel != PostLevelEnum.DEFAULT.getValue() && postLevel != PostLevelEnum.SET_MANAGER.getValue()) {
172
+            throw new BaseException("无效的岗位级别,请检查!");
173
+        }
174
+
175
+        SysDept sysDept = sysDeptMapper.selectDeptById(deptId);
176
+        if (sysDept == null) {
177
+            throw new BaseException("无效的部门ID,请检查!");
178
+        } else {
179
+            String status = sysDept.getStatus();//部门状态(0正常 1停用)
180
+            if (status == null || "1".equals(status)) {
181
+                throw new BaseException("部门状态异常,请检查!");
182
+            }
183
+        }
184
+
185
+
158 186
         post.setPostId(Long.parseLong(IdWorker.getIdStr().substring(4)));
159 187
         return postMapper.insertPost(post);
160 188
     }
@@ -167,6 +195,28 @@ public class SysPostServiceImpl implements ISysPostService {
167 195
      */
168 196
     @Override
169 197
     public int updatePost(SysPost post) {
198
+
199
+        Long deptId = post.getDeptId();
200
+        Integer postLevel = post.getPostLevel();
201
+        String postCode = post.getPostCode();
202
+        if (deptId == null || postLevel == null || StringUtils.isBlank(postCode)) {
203
+            throw new BaseException("部门ID、岗位编码、岗位级别等必选参数为空,请检查!");
204
+        }
205
+
206
+        if (postLevel != PostLevelEnum.DEFAULT.getValue() && postLevel != PostLevelEnum.SET_MANAGER.getValue()) {
207
+            throw new BaseException("无效的岗位级别,请检查!");
208
+        }
209
+
210
+        SysDept sysDept = sysDeptMapper.selectDeptById(deptId);
211
+        if (sysDept == null) {
212
+            throw new BaseException("无效的部门ID,请检查!");
213
+        } else {
214
+            String status = sysDept.getStatus();//部门状态(0正常 1停用)
215
+            if (status == null || "1".equals(status)) {
216
+                throw new BaseException("部门状态异常,请检查!");
217
+            }
218
+        }
219
+
170 220
         return postMapper.updatePost(post);
171 221
     }
172 222
 
@@ -180,7 +230,6 @@ public class SysPostServiceImpl implements ISysPostService {
180 230
      */
181 231
     @Override
182 232
     public List<UserPostAuthority> userPostAuthorityList(Long deptId, Integer postLevel) {
183
-
184 233
         return postMapper.userPostAuthorityList(deptId, postLevel);
185 234
     }
186 235
 

+ 5 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
6 6
 import javax.validation.Validator;
7 7
 
8 8
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
9
+import com.ruoyi.common.exception.base.BaseException;
9 10
 import org.slf4j.Logger;
10 11
 import org.slf4j.LoggerFactory;
11 12
 import org.springframework.beans.factory.annotation.Autowired;
@@ -234,7 +235,7 @@ public class SysUserServiceImpl implements ISysUserService {
234 235
      * @return 结果
235 236
      */
236 237
     @Override
237
-    @Transactional
238
+    @Transactional(rollbackFor = Exception.class)
238 239
     public int insertUser(SysUser user) {
239 240
         user.setUserId(Long.parseLong(IdWorker.getIdStr().substring(4)));
240 241
         // 新增用户信息
@@ -365,6 +366,9 @@ public class SysUserServiceImpl implements ISysUserService {
365 366
     public void insertUserPost(SysUser user) {
366 367
         Long[] posts = user.getPostIds();
367 368
         if (StringUtils.isNotEmpty(posts)) {
369
+            if (posts.length > 1) {
370
+                throw new BaseException("每人只能拥有一个岗位!");
371
+            }
368 372
             // 新增用户与岗位管理
369 373
             List<SysUserPost> list = new ArrayList<>(posts.length);
370 374
             for (Long postId : posts) {