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
  * @author ruoyi
37
  * @author ruoyi
38
  */
38
  */
39
 @RestController
39
 @RestController
@@ -59,7 +59,8 @@ public class SysRoleController extends BaseController
59
     @GetMapping("/list")
59
     @GetMapping("/list")
60
     public TableDataInfo list(SysRole role)
60
     public TableDataInfo list(SysRole role)
61
     {
61
     {
62
-        startPage();
62
+//        startPage();
63
+        startPage("desc", "r.create_time");
63
         List<SysRole> list = roleService.selectRoleList(role);
64
         List<SysRole> list = roleService.selectRoleList(role);
64
         return getDataTable(list);
65
         return getDataTable(list);
65
     }
66
     }
@@ -125,7 +126,7 @@ public class SysRoleController extends BaseController
125
             return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
126
             return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
126
         }
127
         }
127
         role.setUpdateBy(getUsername());
128
         role.setUpdateBy(getUsername());
128
-        
129
+
129
         if (roleService.updateRole(role) > 0)
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
     @PreAuthorize("@ss.hasPermi('system:user:list')")
65
     @PreAuthorize("@ss.hasPermi('system:user:list')")
66
     @GetMapping("/list")
66
     @GetMapping("/list")
67
     public TableDataInfo list(SysUser user) {
67
     public TableDataInfo list(SysUser user) {
68
-        startPage();
68
+//        startPage();
69
+        startPage("desc", "u.create_time");
69
         List<SysUser> list = userService.selectUserList(user);
70
         List<SysUser> list = userService.selectUserList(user);
70
         return getDataTable(list);
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
         double round = Arith.round(new BigDecimal(99.98).doubleValue(), 2);
9
         double round = Arith.round(new BigDecimal(99.98).doubleValue(), 2);
10
         System.out.println(round);
10
         System.out.println(round);
11
         System.out.println(new BigDecimal(round).doubleValue());
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
     @ApiOperation("根据部门查询问题")
191
     @ApiOperation("根据部门查询问题")
192
-
193
     @ApiImplicitParams({
192
     @ApiImplicitParams({
194
             @ApiImplicitParam(name = "type", value = "类型1 年度 2 季度 3 月度", dataType = "String", dataTypeClass = Integer.class),
193
             @ApiImplicitParam(name = "type", value = "类型1 年度 2 季度 3 月度", dataType = "String", dataTypeClass = Integer.class),
195
             @ApiImplicitParam(name = "year", value = "年份", dataType = "String", dataTypeClass = String.class)
194
             @ApiImplicitParam(name = "year", value = "年份", dataType = "String", dataTypeClass = String.class)
@@ -197,7 +196,8 @@ public class PostAssessmentRatingController extends BaseController {
197
     @GetMapping("/{type}/{year}")
196
     @GetMapping("/{type}/{year}")
198
     @Anonymous
197
     @Anonymous
199
     public AjaxResult assessmentstatistics(@PathVariable("type") Integer type,@PathVariable("year") String year) {
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
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
9
 import com.ruoyi.postCheck.domain.problemStatistics.ProblemNumberBase;
10
 import com.ruoyi.postCheck.domain.tools.ProblemCategory;
10
 import com.ruoyi.postCheck.domain.tools.ProblemCategory;
11
 import org.apache.ibatis.annotations.MapKey;
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
  * @author csg
18
  * @author csg
26
  * @date 2023-12-23
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
      * @return
77
      * @return
85
      */
78
      */
86
     List<ProblemCategory> problemCategoryByAttribute();
79
     List<ProblemCategory> problemCategoryByAttribute();
80
+
87
     @MapKey("YEAR")
81
     @MapKey("YEAR")
88
     Map<String, Object> getYearStatistics(String year);
82
     Map<String, Object> getYearStatistics(String year);
83
+
89
     @MapKey("QUARTER")
84
     @MapKey("QUARTER")
90
     Map<String, Object> getQuarterStatistics(String year);
85
     Map<String, Object> getQuarterStatistics(String year);
86
+
91
     @MapKey("MONTH")
87
     @MapKey("MONTH")
92
     Map<String, Object> getMonthStatistics(String year);
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
     List<PostCheckedProblem> getProblemByDeptId(Long id);
75
     List<PostCheckedProblem> getProblemByDeptId(Long id);
76
 
76
 
77
     Map<String,Object> assessmentstatistics(Integer type, String year);
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
 import com.ruoyi.postCheck.mapper.PostCheckedProblemMapper;
24
 import com.ruoyi.postCheck.mapper.PostCheckedProblemMapper;
25
 import com.ruoyi.postCheck.mapper.PostPlanInfoMapper;
25
 import com.ruoyi.postCheck.mapper.PostPlanInfoMapper;
26
 import com.ruoyi.postCheck.mapper.PostPlanMapper;
26
 import com.ruoyi.postCheck.mapper.PostPlanMapper;
27
+import io.swagger.annotations.ApiImplicitParam;
27
 import org.springframework.beans.factory.annotation.Autowired;
28
 import org.springframework.beans.factory.annotation.Autowired;
28
 import org.springframework.stereotype.Service;
29
 import org.springframework.stereotype.Service;
29
 import com.ruoyi.postCheck.mapper.PostAssessmentRatingMapper;
30
 import com.ruoyi.postCheck.mapper.PostAssessmentRatingMapper;
@@ -53,6 +54,7 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
53
     private PostPlanMapper postPlanMapper;
54
     private PostPlanMapper postPlanMapper;
54
     @Autowired
55
     @Autowired
55
     private PostAssessmentRulesMapper postAssessmentRulesMapper;
56
     private PostAssessmentRulesMapper postAssessmentRulesMapper;
57
+
56
     /**
58
     /**
57
      * 查询考核评比
59
      * 查询考核评比
58
      *
60
      *
@@ -74,7 +76,7 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
74
     public List<PostAssessmentRating> selectPostAssessmentRatingList(PostAssessmentRating postAssessmentRating) {
76
     public List<PostAssessmentRating> selectPostAssessmentRatingList(PostAssessmentRating postAssessmentRating) {
75
         // type 1 是职能管理部门, 2 生产运营部门
77
         // type 1 是职能管理部门, 2 生产运营部门
76
         Integer type;
78
         Integer type;
77
-        if (postAssessmentRating.getType() == 2){
79
+        if (postAssessmentRating.getType() == 2) {
78
             type = 3;
80
             type = 3;
79
         } else {
81
         } else {
80
             type = 2;
82
             type = 2;
@@ -90,53 +92,53 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
90
             // 1 先查询问题
92
             // 1 先查询问题
91
             BigDecimal postSouce = new BigDecimal("100");
93
             BigDecimal postSouce = new BigDecimal("100");
92
             List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
94
             List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
93
-                    .eq(PostCheckedProblem::getCheckedDeptId,post.getDeptId())
95
+                    .eq(PostCheckedProblem::getCheckedDeptId, post.getDeptId())
94
             );
96
             );
95
             BigDecimal postTotal = postCheckedProblemMapper.getPostTotalByDeptId(post.getDeptId());
97
             BigDecimal postTotal = postCheckedProblemMapper.getPostTotalByDeptId(post.getDeptId());
96
-            if (postCheckedProblems.size() > 0){
98
+            if (postCheckedProblems.size() > 0) {
97
                 // 计算扣除分数
99
                 // 计算扣除分数
98
                 BigDecimal postAfter = new BigDecimal("100");
100
                 BigDecimal postAfter = new BigDecimal("100");
99
                 Set<PostAssessmentRules> collect = postAssessmentRules.stream().filter(d -> d.getType() == type).collect(Collectors.toSet());
101
                 Set<PostAssessmentRules> collect = postAssessmentRules.stream().filter(d -> d.getType() == type).collect(Collectors.toSet());
100
                 for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
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
                 BigDecimal divide = new BigDecimal("0");
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
                 // 计算系数 1-问题总数/需要查的问题数
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
                     postSouce = postAfter.multiply(new BigDecimal("1").subtract(divide));
118
                     postSouce = postAfter.multiply(new BigDecimal("1").subtract(divide));
117
-                }else{
119
+                } else {
118
                     postSouce = new BigDecimal("0");
120
                     postSouce = new BigDecimal("0");
119
                 }
121
                 }
120
-            }else {
122
+            } else {
121
                 postSouce = new BigDecimal("0");
123
                 postSouce = new BigDecimal("0");
122
             }
124
             }
123
             post.setPositionScore(postSouce);
125
             post.setPositionScore(postSouce);
124
             // 计算互评得分
126
             // 计算互评得分
125
 
127
 
126
             List<PostAssessmentRatingOtherInfo> postAssessmentRatingOtherInfos = postAssessmentRatingOtherInfoMapper.selectList(Wrappers.<PostAssessmentRatingOtherInfo>lambdaQuery()
128
             List<PostAssessmentRatingOtherInfo> postAssessmentRatingOtherInfos = postAssessmentRatingOtherInfoMapper.selectList(Wrappers.<PostAssessmentRatingOtherInfo>lambdaQuery()
127
-                    .eq(PostAssessmentRatingOtherInfo::getByDeptId,post.getDeptId())
129
+                    .eq(PostAssessmentRatingOtherInfo::getByDeptId, post.getDeptId())
128
                     .apply(" \"rating_other_id\" in (SELECT \"id\" FROM \"public\".\"post_assessment_rating_other\" WHERE \"type\"  = 1\n)")
130
                     .apply(" \"rating_other_id\" in (SELECT \"id\" FROM \"public\".\"post_assessment_rating_other\" WHERE \"type\"  = 1\n)")
129
                     .orderByAsc(PostAssessmentRatingOtherInfo::getByDeptScore)
131
                     .orderByAsc(PostAssessmentRatingOtherInfo::getByDeptScore)
130
             );
132
             );
131
             BigDecimal peerEvaluationScore = new BigDecimal("100");
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
                 postAssessmentRatingOtherInfos.remove(0);
136
                 postAssessmentRatingOtherInfos.remove(0);
135
                 BigDecimal sum = new BigDecimal("0");
137
                 BigDecimal sum = new BigDecimal("0");
136
                 postAssessmentRatingOtherInfos.forEach(x -> {
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
             post.setPeerEvaluationScore(peerEvaluationScore);
143
             post.setPeerEvaluationScore(peerEvaluationScore);
142
             postAssessmentRatings.add(post);
144
             postAssessmentRatings.add(post);
@@ -201,18 +203,45 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
201
     @Override
203
     @Override
202
     public List<PostCheckedProblem> getProblemByDeptId(Long id) {
204
     public List<PostCheckedProblem> getProblemByDeptId(Long id) {
203
         return postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
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
     @Override
211
     @Override
209
     public Map<String, Object> assessmentstatistics(Integer type, String year) {
212
     public Map<String, Object> assessmentstatistics(Integer type, String year) {
210
         if (type == 1)
213
         if (type == 1)
211
             return postCheckedProblemMapper.getYearStatistics(year);
214
             return postCheckedProblemMapper.getYearStatistics(year);
212
         if (type == 2)
215
         if (type == 2)
213
-            return postCheckedProblemMapper.getQuarterStatistics(year);;
216
+            return postCheckedProblemMapper.getQuarterStatistics(year);
214
         if (type == 3)
217
         if (type == 3)
215
-            return postCheckedProblemMapper.getMonthStatistics(year);;
218
+            return postCheckedProblemMapper.getMonthStatistics(year);
216
         return new HashMap<>();
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
         //TODO 更新业务职责的状态=待审核:只要部门修改数据,人力资源都需要重新审核单据
121
         //TODO 更新业务职责的状态=待审核:只要部门修改数据,人力资源都需要重新审核单据
122
         //1、按区域类型+主表id批量更新明细表状态、审核人、审核时间、未通过理由
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
         return rows;
135
         return rows;
136
     }
136
     }
@@ -168,17 +168,17 @@ public class PostListServiceImpl extends ServiceImpl<PostListMapper, PostList> i
168
 
168
 
169
         //TODO 更新业务职责的状态=待审核:只要部门修改数据,人力资源都需要重新审核单据
169
         //TODO 更新业务职责的状态=待审核:只要部门修改数据,人力资源都需要重新审核单据
170
         //1、按区域类型+主表id批量更新明细表状态、审核人、审核时间、未通过理由
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
         return updateCount;
183
         return updateCount;
184
     }
184
     }
@@ -347,31 +347,44 @@ public class PostListServiceImpl extends ServiceImpl<PostListMapper, PostList> i
347
                 }
347
                 }
348
                 throw new BaseException("以下部门还未审核,请检查!" + typeView);
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
         //1、按区域类型+主表id批量更新明细表状态、审核人、审核时间、未通过理由
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
         if (status == PostListEnum.STATUS_PASS.getValue()) {
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
         else if (status == PostListEnum.STATUS_BACK.getValue()) {
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
         if (updateCount == 0) {
388
         if (updateCount == 0) {
376
             throw new BaseException("更新状态失败,请稍后重试!");
389
             throw new BaseException("更新状态失败,请稍后重试!");
377
         }
390
         }

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

@@ -408,6 +408,7 @@
408
         GROUP BY a."QUARTER"
408
         GROUP BY a."QUARTER"
409
     </select>
409
     </select>
410
 
410
 
411
+
411
     <select id="getYearStatistics" resultType="java.util.Map">
412
     <select id="getYearStatistics" resultType="java.util.Map">
412
         SELECT "YEAR",IFNULL(sum(num), '0') "num"
413
         SELECT "YEAR",IFNULL(sum(num), '0') "num"
413
         FROM (SELECT t."YEAR", (t."sum" - t."two" - t."one") / "total" AS "num"
414
         FROM (SELECT t."YEAR", (t."sum" - t."two" - t."one") / "total" AS "num"
@@ -501,4 +502,174 @@
501
                            )) a
502
                            )) a
502
         GROUP BY a."MONTH"
503
         GROUP BY a."MONTH"
503
     </select>
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
 </mapper>
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
 import java.util.stream.Collectors;
6
 import java.util.stream.Collectors;
7
 
7
 
8
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
8
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
9
+import com.ruoyi.common.exception.base.BaseException;
9
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.stereotype.Service;
11
 import org.springframework.stereotype.Service;
11
 import com.ruoyi.common.annotation.DataScope;
12
 import com.ruoyi.common.annotation.DataScope;
@@ -194,6 +195,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
194
      */
195
      */
195
     @Override
196
     @Override
196
     public int insertDept(SysDept dept) {
197
     public int insertDept(SysDept dept) {
198
+
199
+        String deptCode = dept.getDeptCode();
200
+        if (StringUtils.isBlank(deptCode)) {
201
+            throw new BaseException("请填写部门编码!");
202
+        }
203
+
197
         SysDept info = deptMapper.selectDeptById(dept.getParentId());
204
         SysDept info = deptMapper.selectDeptById(dept.getParentId());
198
         // 如果父节点不为正常状态,则不允许新增子节点
205
         // 如果父节点不为正常状态,则不允许新增子节点
199
         if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
206
         if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
@@ -201,6 +208,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
201
         }
208
         }
202
         dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
209
         dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
203
         dept.setDeptId(Long.parseLong(IdWorker.getIdStr().substring(4)));
210
         dept.setDeptId(Long.parseLong(IdWorker.getIdStr().substring(4)));
211
+
204
         return deptMapper.insertDept(dept);
212
         return deptMapper.insertDept(dept);
205
     }
213
     }
206
 
214
 
@@ -212,6 +220,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
212
      */
220
      */
213
     @Override
221
     @Override
214
     public int updateDept(SysDept dept) {
222
     public int updateDept(SysDept dept) {
223
+
224
+        String deptCode = dept.getDeptCode();
225
+        if (StringUtils.isBlank(deptCode)) {
226
+            throw new BaseException("请填写部门编码!");
227
+        }
228
+
215
         SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
229
         SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
216
         SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
230
         SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
217
         if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
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
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
7
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
8
 import com.ruoyi.common.constant.PostLevelEnum;
8
 import com.ruoyi.common.constant.PostLevelEnum;
9
+import com.ruoyi.common.core.domain.entity.SysDept;
9
 import com.ruoyi.common.exception.base.BaseException;
10
 import com.ruoyi.common.exception.base.BaseException;
10
 import com.ruoyi.common.utils.SecurityUtils;
11
 import com.ruoyi.common.utils.SecurityUtils;
11
 import com.ruoyi.system.domain.UserPostAuthority;
12
 import com.ruoyi.system.domain.UserPostAuthority;
13
+import com.ruoyi.system.mapper.SysDeptMapper;
12
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.stereotype.Service;
15
 import org.springframework.stereotype.Service;
14
 import com.ruoyi.common.constant.UserConstants;
16
 import com.ruoyi.common.constant.UserConstants;
@@ -29,10 +31,13 @@ import org.springframework.util.CollectionUtils;
29
 public class SysPostServiceImpl implements ISysPostService {
31
 public class SysPostServiceImpl implements ISysPostService {
30
     @Autowired
32
     @Autowired
31
     private SysPostMapper postMapper;
33
     private SysPostMapper postMapper;
32
-
33
     @Autowired
34
     @Autowired
34
     private SysUserPostMapper userPostMapper;
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
     @Override
161
     @Override
157
     public int insertPost(SysPost post) {
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
         post.setPostId(Long.parseLong(IdWorker.getIdStr().substring(4)));
186
         post.setPostId(Long.parseLong(IdWorker.getIdStr().substring(4)));
159
         return postMapper.insertPost(post);
187
         return postMapper.insertPost(post);
160
     }
188
     }
@@ -167,6 +195,28 @@ public class SysPostServiceImpl implements ISysPostService {
167
      */
195
      */
168
     @Override
196
     @Override
169
     public int updatePost(SysPost post) {
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
         return postMapper.updatePost(post);
220
         return postMapper.updatePost(post);
171
     }
221
     }
172
 
222
 
@@ -180,7 +230,6 @@ public class SysPostServiceImpl implements ISysPostService {
180
      */
230
      */
181
     @Override
231
     @Override
182
     public List<UserPostAuthority> userPostAuthorityList(Long deptId, Integer postLevel) {
232
     public List<UserPostAuthority> userPostAuthorityList(Long deptId, Integer postLevel) {
183
-
184
         return postMapper.userPostAuthorityList(deptId, postLevel);
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
 import javax.validation.Validator;
6
 import javax.validation.Validator;
7
 
7
 
8
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
8
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
9
+import com.ruoyi.common.exception.base.BaseException;
9
 import org.slf4j.Logger;
10
 import org.slf4j.Logger;
10
 import org.slf4j.LoggerFactory;
11
 import org.slf4j.LoggerFactory;
11
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
@@ -234,7 +235,7 @@ public class SysUserServiceImpl implements ISysUserService {
234
      * @return 结果
235
      * @return 结果
235
      */
236
      */
236
     @Override
237
     @Override
237
-    @Transactional
238
+    @Transactional(rollbackFor = Exception.class)
238
     public int insertUser(SysUser user) {
239
     public int insertUser(SysUser user) {
239
         user.setUserId(Long.parseLong(IdWorker.getIdStr().substring(4)));
240
         user.setUserId(Long.parseLong(IdWorker.getIdStr().substring(4)));
240
         // 新增用户信息
241
         // 新增用户信息
@@ -365,6 +366,9 @@ public class SysUserServiceImpl implements ISysUserService {
365
     public void insertUserPost(SysUser user) {
366
     public void insertUserPost(SysUser user) {
366
         Long[] posts = user.getPostIds();
367
         Long[] posts = user.getPostIds();
367
         if (StringUtils.isNotEmpty(posts)) {
368
         if (StringUtils.isNotEmpty(posts)) {
369
+            if (posts.length > 1) {
370
+                throw new BaseException("每人只能拥有一个岗位!");
371
+            }
368
             // 新增用户与岗位管理
372
             // 新增用户与岗位管理
369
             List<SysUserPost> list = new ArrayList<>(posts.length);
373
             List<SysUserPost> list = new ArrayList<>(posts.length);
370
             for (Long postId : posts) {
374
             for (Long postId : posts) {