Browse Source

问题整改状态调整

csg6 10 months ago
parent
commit
72bcec7d14

+ 26 - 33
ruoyi-common/src/main/java/com/ruoyi/common/constant/PostCheckedProblemEnum.java

@@ -4,39 +4,32 @@ package com.ruoyi.common.constant;
4 4
  * 岗检问题状态枚举
5 5
  */
6 6
 public enum PostCheckedProblemEnum {
7
-    //状态:
8
-    // 1-待指定整改人(问题录入完成时);
9
-    // 2-待填写方案(部门管理员指定整改人后);
10
-//            3-方案填写完成;
11
-    // 10-部门审核通过;
12
-    // 11-部门审核驳回;
13
-    // 20-专业部门人审核(非必填)通过;
14
-    // 21-专业部门人审核驳回(非必填);
15
-    // 30-整改人待上传实施(整改人上传实施图片)
16
-//            31-上传实施照片完成;
17
-    // 40-复查部门人审核通过;
18
-    // 41-复查部门人审核驳回
19
-
20
-
21
-
22
-
23
-
24
-
25
-    ADD("待指定整改人(问题录入完成时);", 1),
26
-    EDIT_ONE("待填写方案(部门管理员指定整改人后);", 2),
27
-    EDIT_ONE_OVER("方案填写完成", 2),
28
-
29
-    DEPT_PASS("部门审核通过;", 10),
30
-    DEPT_BACK("部门审核驳回;", 11),
31
-
32
-    ZHUAN_YE_PASS("专业部门人审核(非必填)通过;", 20),
33
-    ZHUAN_YE_BACK("专业部门人审核驳回(非必填);", 21),
34
-
35
-    EDIT_TWO("整改人待上传实施(整改人上传实施图片)", 30),
36
-    EDIT_TWO_OVER("上传实施照片完成", 30),
37
-
38
-    FU_CHA_PASS("复查部门人审核通过;", 40),
39
-    FU_CHA_BACK("复查部门人审核驳回", 41);
7
+//	  1-待指定整改人(问题录入完成时);2-待填写方案(部门管理员指定整改人后);
8
+//    10-待部门审核;11-部门审核驳回;
9
+//    20-待专业部门人审核(非必填);21-专业部门人审核驳回(非必填);
10
+//    30-待整改人待上传实施(整改人上传实施图片);
11
+//    40-待复查部门人审核;41-复查部门人审核通过;42-复查部门人审核驳回
12
+
13
+    ADD("待指定整改人(问题录入完成时)", 1),
14
+    EDIT_WAIT_ONR("待填写方案(部门管理员指定整改人后)", 2),
15
+//    EDIT_ONE_OVER("方案填写完成", 2),
16
+
17
+    DEPT_WAIT("待部门审核", 10),
18
+    //TODO 前台传过来的审核状态,数据库并不保存,部门审核通过后,单据流转到专业部门待审核或者方案待填写
19
+    DEPT_PASS("部门审核通过", 11),
20
+    DEPT_BACK("部门审核驳回", 12),
21
+
22
+    ZHUAN_ZY_WAIT("待专业部门人审核(非必填)", 20),
23
+    //TODO 前台传过来的审核状态,数据库并不保存,专业部门审核通过后,单据流转到待整改人待上传实施
24
+    ZHUAN_ZY_PASS("专业部门人审核通过(非必填)", 21),
25
+    ZHUAN_ZY_BACK("专业部门人审核驳回(非必填);", 22),
26
+
27
+    EDIT_WAIT_TWO("待整改人待上传实施(整改人上传实施图片)", 30),
28
+    EDIT_TWO_OVER("上传实施照片完成", 31),
29
+
30
+    FU_CHA_WAIT("待复查部门人审核;", 40),
31
+    FU_CHA_PASS("复查部门人审核通过;", 41),
32
+    FU_CHA_BACK("复查部门人审核驳回", 42);
40 33
 
41 34
     private String name;
42 35
     private Integer value;

+ 6 - 9
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostCheckedProblemController.java

@@ -89,7 +89,7 @@ public class PostCheckedProblemController extends BaseController {
89 89
     public TableDataInfo list(PostCheckedProblem postCheckedProblem) {
90 90
 
91 91
 //        startPage();
92
-        startPage("desc","t1.create_time");
92
+        startPage("desc", "t1.create_time");
93 93
         List<PostCheckedProblem> list = postCheckedProblemService.selectPostCheckedProblemList(postCheckedProblem);
94 94
         return getDataTable(list);
95 95
     }
@@ -277,13 +277,13 @@ public class PostCheckedProblemController extends BaseController {
277 277
             @ApiImplicitParam(name = "problemCause", value = "问题原因", dataType = "String", dataTypeClass = String.class),
278 278
             @ApiImplicitParam(name = "isImmediatelyCorrected", value = "是否立行立改(1-Yes;2-No;)", dataType = "Integer", dataTypeClass = Integer.class),
279 279
             @ApiImplicitParam(name = "rectificationMeasure", value = "整改措施/建议", dataType = "String", dataTypeClass = String.class),
280
-            @ApiImplicitParam(name = "rectificationResponsibleUserId", value = "整改责任人ID", dataType = "Long", dataTypeClass = Long.class),
280
+//            @ApiImplicitParam(name = "rectificationResponsibleUserId", value = "整改责任人ID", dataType = "Long", dataTypeClass = Long.class),
281 281
             @ApiImplicitParam(name = "rectificationPeriod", value = "整改期限", dataType = "Date", dataTypeClass = Date.class),
282 282
     })
283 283
     @Log(title = "方案整改", businessType = BusinessType.UPDATE)
284 284
     @PutMapping("/updateRectificationMeasure")
285
-    public AjaxResult updateRectificationMeasure(Long id, String problemCause, Integer isImmediatelyCorrected, String rectificationMeasure, Long rectificationResponsibleUserId, Date rectificationPeriod) {
286
-        return toAjax(postCheckedProblemService.updateRectificationMeasure(id, problemCause, isImmediatelyCorrected, rectificationMeasure, rectificationResponsibleUserId, rectificationPeriod));
285
+    public AjaxResult updateRectificationMeasure(Long id, String problemCause, Integer isImmediatelyCorrected, String rectificationMeasure, Date rectificationPeriod) {
286
+        return toAjax(postCheckedProblemService.updateRectificationMeasure(id, problemCause, isImmediatelyCorrected, rectificationMeasure, rectificationPeriod));
287 287
     }
288 288
 
289 289
 
@@ -299,7 +299,6 @@ public class PostCheckedProblemController extends BaseController {
299 299
     }
300 300
 
301 301
 
302
-
303 302
     @ApiOperation("步骤4->审核1:部门经理审核")
304 303
     @ApiImplicitParams({
305 304
             @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
@@ -309,11 +308,10 @@ public class PostCheckedProblemController extends BaseController {
309 308
     @Log(title = "审核1:部门经理审核", businessType = BusinessType.UPDATE)
310 309
     @PutMapping("/setDeptApproveTime")
311 310
     public AjaxResult setDeptApproveTime(Long id, Integer status, String reason) {
312
-        return toAjax(postCheckedProblemService.setDeptApproveTime(id, status,  reason));
311
+        return toAjax(postCheckedProblemService.setDeptApproveTime(id, status, reason));
313 312
     }
314 313
 
315 314
 
316
-
317 315
     @ApiOperation("步骤5->审核2:专业部门审核人审核")
318 316
     @ApiImplicitParams({
319 317
             @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
@@ -323,7 +321,7 @@ public class PostCheckedProblemController extends BaseController {
323 321
     @Log(title = "审核2:专业部门审核人审核", businessType = BusinessType.UPDATE)
324 322
     @PutMapping("/setSpecialityDepartmentReviewTime")
325 323
     public AjaxResult setSpecialityDepartmentReviewTime(Long id, Integer status, String reason) {
326
-        return toAjax(postCheckedProblemService.setSpecialityDepartmentReviewTime(id, status,  reason));
324
+        return toAjax(postCheckedProblemService.setSpecialityDepartmentReviewTime(id, status, reason));
327 325
     }
328 326
 
329 327
 
@@ -367,7 +365,6 @@ public class PostCheckedProblemController extends BaseController {
367 365
     }
368 366
 
369 367
 
370
-
371 368
     @ApiOperation("Tools-1、按问题属性分组统计问题类别")
372 369
     @GetMapping("/problemCategoryByAttribute")
373 370
     public AjaxResult problemCategoryByAttribute(ProblemCategory noParam) {

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

@@ -101,11 +101,11 @@ public interface IPostCheckedProblemService extends IService<PostCheckedProblem>
101 101
      * @param problemCause                   问题原因
102 102
      * @param isImmediatelyCorrected         是否立行立改(1-Yes;2-No;)
103 103
      * @param rectificationMeasure           整改措施/建议
104
-     * @param rectificationResponsibleUserId 整改责任人ID
104
+     * param rectificationResponsibleUserId 整改责任人ID
105 105
      * @param rectificationPeriod            整改期限
106 106
      * @return
107 107
      */
108
-    int updateRectificationMeasure(Long id, String problemCause, Integer isImmediatelyCorrected, String rectificationMeasure, Long rectificationResponsibleUserId, Date rectificationPeriod);
108
+    int updateRectificationMeasure(Long id, String problemCause, Integer isImmediatelyCorrected, String rectificationMeasure,Date rectificationPeriod);
109 109
 
110 110
     /**
111 111
      * 指定专业部门的审核人

+ 351 - 73
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostCheckedProblemServiceImpl.java

@@ -11,11 +11,17 @@ import java.util.Map;
11 11
 import java.util.Optional;
12 12
 import java.util.stream.Collectors;
13 13
 
14
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
15
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
14 16
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
15 17
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
18
+import com.ruoyi.common.constant.HttpStatus;
16 19
 import com.ruoyi.common.constant.PostCheckedProblemEnum;
20
+import com.ruoyi.common.core.domain.AjaxResult;
21
+import com.ruoyi.common.core.domain.model.LoginUser;
17 22
 import com.ruoyi.common.exception.base.BaseException;
18 23
 import com.ruoyi.common.utils.DateUtils;
24
+import com.ruoyi.common.utils.SecurityUtils;
19 25
 import com.ruoyi.postCheck.domain.PostAssessmentRating;
20 26
 import com.ruoyi.postCheck.domain.PostAssessmentRules;
21 27
 import com.ruoyi.postCheck.domain.PostList;
@@ -41,7 +47,9 @@ import com.ruoyi.postCheck.mapper.PostListMapper;
41 47
 import com.ruoyi.postCheck.mapper.PostPlanInfoMapper;
42 48
 import com.ruoyi.postCheck.mapper.PostPlanMapper;
43 49
 import com.ruoyi.postCheck.service.IPostPlanJoinProblemService;
44
-//import io.swagger.annotations.ApiModelProperty;
50
+import com.ruoyi.system.domain.SysPost;
51
+import com.ruoyi.system.domain.UserPostAuthority;
52
+import com.ruoyi.system.service.ISysPostService;
45 53
 import io.swagger.annotations.ApiModelProperty;
46 54
 import org.apache.commons.lang3.StringUtils;
47 55
 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,14 +63,6 @@ import org.springframework.util.CollectionUtils;
55 63
 import org.springframework.web.context.request.FacesWebRequest;
56 64
 
57 65
 
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66 66
 /**
67 67
  * 岗检问题表Service业务层处理
68 68
  *
@@ -88,6 +88,9 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
88 88
     @Autowired
89 89
     private PostAssessmentRatingOtherMapper postAssessmentRatingOtherMapper;
90 90
 
91
+    @Autowired
92
+    private ISysPostService sysPostService;
93
+
91 94
     /**
92 95
      * 查询岗检问题表
93 96
      *
@@ -140,10 +143,7 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
140 143
         int count = 0;
141 144
         for (PostCheckedProblem postCheckedProblem : postCheckedProblemList) {
142 145
             count++;
143
-            //TODO 自增主键修改为-MyBatis-Plus雪花算法(截取5位解决VUE精度丢失BUG)-系统登录日志
144
-//            if (postCheckedProblem.getId() == null)
145 146
             postCheckedProblem.setId(Long.parseLong(IdWorker.getIdStr().substring(4)));
146
-            // postCheckedProblem.setCreateTime(DateUtils.getNowDate());
147 147
             postCheckedProblem.setCreateDefault();
148 148
 
149 149
             postCheckedProblem.setProblemNo("GJ-" + DateUtils.getTime());
@@ -152,6 +152,7 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
152 152
             postCheckedProblem.setCheckedDeptId(checkedDeptId);
153 153
             //检查时间取值=岗检计划的开始时间
154 154
             postCheckedProblem.setCheckTime(checkTime);
155
+            postCheckedProblem.setStatus(PostCheckedProblemEnum.ADD.getValue());
155 156
 
156 157
             int insertCount = postCheckedProblemMapper.insertPostCheckedProblem(postCheckedProblem);
157 158
             if (insertCount == 0) {
@@ -161,6 +162,43 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
161 162
         return 1;
162 163
     }
163 164
 
165
+    /**
166
+     * 修改岗检问题表
167
+     *
168
+     * @param postCheckedProblemList 岗检问题集合
169
+     * @return 结果
170
+     */
171
+    @Override
172
+    @Transactional(rollbackFor = Exception.class)
173
+    public int updatePostCheckedProblem(List<PostCheckedProblem> postCheckedProblemList) {
174
+        if (CollectionUtils.isEmpty(postCheckedProblemList)) {
175
+            return 0;
176
+        }
177
+        int count = 0;
178
+        for (PostCheckedProblem postCheckedProblem : postCheckedProblemList) {
179
+            count++;
180
+            //只允许新增状态单据修改
181
+            PostCheckedProblem dataDb = postCheckedProblemMapper.selectById(postCheckedProblem.getId());
182
+            if (dataDb == null) {
183
+                throw new BaseException("id错误或为空,请检查!");
184
+            }
185
+            Integer status = dataDb.getStatus();
186
+            if (status != null && status != PostCheckedProblemEnum.ADD.getValue()) {
187
+                throw new BaseException("当前状态无法修改,请检查!");
188
+            }
189
+
190
+            // postCheckedProblem.setUpdateTime(DateUtils.getNowDate());
191
+
192
+            postCheckedProblem.setUpdateDefault();
193
+            postCheckedProblem.setStatus(PostCheckedProblemEnum.ADD.getValue());
194
+            int updateCount = postCheckedProblemMapper.updatePostCheckedProblem(postCheckedProblem);
195
+            if (updateCount == 0) {
196
+                throw new BaseException("第" + count + "行更新失败请检查!");
197
+            }
198
+        }
199
+        return 1;
200
+    }
201
+
164 202
     public void jobInspectionScore(List<PostCheckedProblem> postCheckedProblemList) {
165 203
         /**
166 204
          * 业务职责有效性 1
@@ -231,35 +269,6 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
231 269
 
232 270
 
233 271
     /**
234
-     * 修改岗检问题表
235
-     *
236
-     * @param postCheckedProblemList 岗检问题集合
237
-     * @return 结果
238
-     */
239
-    @Override
240
-    @Transactional(rollbackFor = Exception.class)
241
-    public int updatePostCheckedProblem(List<PostCheckedProblem> postCheckedProblemList) {
242
-        if (CollectionUtils.isEmpty(postCheckedProblemList)) {
243
-            return 0;
244
-        }
245
-        int count = 0;
246
-        for (PostCheckedProblem postCheckedProblem : postCheckedProblemList) {
247
-            count++;
248
-            if (postCheckedProblem.getId() == null) {
249
-                throw new BaseException("id为空请检查!");
250
-            }
251
-            // postCheckedProblem.setUpdateTime(DateUtils.getNowDate());
252
-            postCheckedProblem.setUpdateDefault();
253
-            int updateCount = postCheckedProblemMapper.updatePostCheckedProblem(postCheckedProblem);
254
-            if (updateCount == 0) {
255
-                throw new BaseException("第" + count + "行更新失败请检查!");
256
-            }
257
-        }
258
-        return 1;
259
-    }
260
-
261
-
262
-    /**
263 272
      * 批量删除岗检问题表
264 273
      *
265 274
      * @param ids 需要删除的岗检问题表主键
@@ -292,48 +301,153 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
292 301
     @Transactional(rollbackFor = Exception.class)
293 302
     public int setRectificationResponsibleUserId(String ids, Long rectificationResponsibleUserId) {
294 303
         if (StringUtils.isBlank(ids) || rectificationResponsibleUserId == null) {
295
-            return 0;
304
+//            return 0;
305
+            throw new BaseException("参数不全,请检查!");
296 306
         }
307
+        //TODO 审核权限:部门经理操作
308
+        LoginUser loginUser = SecurityUtils.getLoginUser();
309
+        Long userId = loginUser.getUserId();
310
+        Long deptId = loginUser.getDeptId();
311
+
312
+
297 313
         String[] idArr = ids.split(",");
298 314
         if (idArr.length == 0) {
299
-            return 0;
315
+            throw new BaseException("id错误或为空,请检查!");
300 316
         }
317
+
318
+
319
+        String errorMsg = "";
320
+        List<PostCheckedProblem> dataList = new ArrayList<>(idArr.length);
321
+        int index = 0;
322
+        for (String idStr : idArr) {
323
+            index++;
324
+            Long id = Long.parseLong(idStr);
325
+
326
+            PostCheckedProblem dataDB = postCheckedProblemMapper.selectById(id);
327
+            if (dataDB == null) {
328
+                errorMsg += "【第" + index + "行】id错误或为空,请检查!";
329
+                continue;
330
+            }
331
+            Integer status = dataDB.getStatus();
332
+            if (status != null && status != PostCheckedProblemEnum.ADD.getValue()) {
333
+                errorMsg += "【第" + index + "行】当前状态无法指定整改责任人,请检查!";
334
+                continue;
335
+            }
336
+
337
+            Long checkedDeptId = dataDB.getCheckedDeptId();//责任部门ID
338
+            if (!checkedDeptId.equals(deptId)) {
339
+                errorMsg += "【第" + index + "行】请切换问题责任部门经理操作01!";
340
+                continue;
341
+            }
342
+
343
+            // 当前登录用户是否为部门经理级别
344
+            boolean userHaveAuthority = sysPostService.userHaveAuthority(deptId);
345
+            if (!userHaveAuthority) {
346
+                errorMsg += "【第" + index + "行】请切换问题责任部门经理操作02!";
347
+                continue;
348
+            }
349
+            dataList.add(dataDB);
350
+        }
351
+        if (StringUtils.isNotBlank(errorMsg)) {
352
+            throw new BaseException(errorMsg);
353
+        }
354
+
355
+
356
+        PostCheckedProblem updateData = new PostCheckedProblem();
357
+        updateData.setStatus(PostCheckedProblemEnum.EDIT_WAIT_ONR.getValue());//待填写方案
358
+        updateData.setRectificationResponsibleUserId(rectificationResponsibleUserId);//整改责任人
359
+        LambdaUpdateWrapper<PostCheckedProblem> updateWrapper = new LambdaUpdateWrapper<>();
360
+        updateWrapper.in(PostCheckedProblem::getId, idArr);
361
+        int updateCount = postCheckedProblemMapper.update(updateData, updateWrapper);
362
+        if (updateCount != idArr.length) {
363
+            throw new BaseException("更新行数与请求行数不匹配,请检查!");
364
+        }
365
+        return updateCount;
366
+
367
+
368
+        /*
301 369
         int count = 0;
302 370
         for (String idStr : idArr) {
371
+            index++;
303 372
             Long id = Long.parseLong(idStr);
373
+
374
+            PostCheckedProblem dataDB = postCheckedProblemMapper.selectById(id);
375
+            if (dataDB == null) {
376
+                throw new BaseException("id错误或为空,请检查!");
377
+            }
378
+            Integer status = dataDB.getStatus();
379
+            if (status != null && status != PostCheckedProblemEnum.ADD.getValue()) {
380
+                throw new BaseException("当前状态无法指定整改责任人,请检查!");
381
+            }
382
+
383
+            Long checkedDeptId = dataDB.getCheckedDeptId();//责任部门ID
384
+            if (!checkedDeptId.equals(deptId)) {
385
+                throw new BaseException("请切换问题责任部门经理操作【第" + index + "行】!");
386
+            }
387
+
388
+            // 当前登录用户是否为部门经理级别
389
+            boolean userHaveAuthority = sysPostService.userHaveAuthority(deptId);
390
+            if (!userHaveAuthority) {
391
+                throw new BaseException("请切换问题责任部门经理操作【第" + index + "行】!");
392
+            }
393
+
394
+
304 395
             PostCheckedProblem data = new PostCheckedProblem();
305 396
             data.setId(id);
306
-            data.setStatus(PostCheckedProblemEnum.EDIT_ONE.getValue());//待填写方案
397
+            data.setStatus(PostCheckedProblemEnum.EDIT_WAIT_ONR.getValue());//待填写方案
307 398
             data.setRectificationResponsibleUserId(rectificationResponsibleUserId);
308 399
             count += postCheckedProblemMapper.updatePostCheckedProblem(data);
309 400
         }
310 401
         return count;
402
+        * */
311 403
     }
312 404
 
313 405
     /**
314
-     * 方案整改:整改实施人填写方案
406
+     * 方案整改:整改责任人填写方案
315 407
      *
316
-     * @param id                             问题主键
317
-     * @param problemCause                   问题原因
318
-     * @param isImmediatelyCorrected         是否立行立改(1-Yes;2-No;)
319
-     * @param rectificationMeasure           整改措施/建议
320
-     * @param rectificationResponsibleUserId 整改责任人ID
321
-     * @param rectificationPeriod            整改期限
408
+     * @param id                     问题主键
409
+     * @param problemCause           问题原因
410
+     * @param isImmediatelyCorrected 是否立行立改(1-Yes;2-No;)
411
+     * @param rectificationMeasure   整改措施/建议
412
+     *                               param rectificationResponsibleUserId 整改责任人ID
413
+     * @param rectificationPeriod    整改期限
322 414
      * @return
323 415
      */
324 416
     @Override
325
-    public int updateRectificationMeasure(Long id, String problemCause, Integer isImmediatelyCorrected, String rectificationMeasure, Long rectificationResponsibleUserId, Date rectificationPeriod) {
417
+//    public int updateRectificationMeasure(Long id, String problemCause, Integer isImmediatelyCorrected, String rectificationMeasure, Long rectificationResponsibleUserId, Date rectificationPeriod) {
418
+    public int updateRectificationMeasure(Long id, String problemCause, Integer isImmediatelyCorrected, String rectificationMeasure, Date rectificationPeriod) {
326 419
 
327
-        if (id == null || StringUtils.isBlank(problemCause) || isImmediatelyCorrected == null || StringUtils.isBlank(rectificationMeasure) || rectificationResponsibleUserId == null || rectificationPeriod == null) {
328
-            return 0;
420
+//        if (id == null || StringUtils.isBlank(problemCause) || isImmediatelyCorrected == null || StringUtils.isBlank(rectificationMeasure) || rectificationResponsibleUserId == null || rectificationPeriod == null) {
421
+        if (id == null || StringUtils.isBlank(problemCause) || isImmediatelyCorrected == null || StringUtils.isBlank(rectificationMeasure) || rectificationPeriod == null) {
422
+//            return 0;
423
+            throw new BaseException("参数不全,请检查!");
424
+        }
425
+        //TODO 审核权限:部门经理操作
426
+        LoginUser loginUser = SecurityUtils.getLoginUser();
427
+        Long userId = loginUser.getUserId();
428
+        Long deptId = loginUser.getDeptId();
429
+        PostCheckedProblem dataDB = postCheckedProblemMapper.selectById(id);
430
+        if (dataDB == null) {
431
+            throw new BaseException("id错误或为空,请检查!");
432
+        }
433
+        Integer status = dataDB.getStatus();
434
+        if (status != PostCheckedProblemEnum.EDIT_WAIT_ONR.getValue()) {
435
+            throw new BaseException("当前状态不允许此操作,请检查!【" + status + "】");
329 436
         }
437
+
438
+        Long rectificationResponsibleUserId = dataDB.getRectificationResponsibleUserId();
439
+        if (!rectificationResponsibleUserId.equals(userId)) {
440
+            throw new BaseException("请切换整改责任人账号操作!");
441
+        }
442
+
330 443
         PostCheckedProblem data = new PostCheckedProblem();
331 444
         data.setId(id);
332 445
         data.setProblemCause(problemCause);
333 446
         data.setIsImmediatelyCorrected(isImmediatelyCorrected);
334 447
         data.setRectificationMeasure(rectificationMeasure);
335
-        data.setRectificationResponsibleUserId(rectificationResponsibleUserId);
448
+//        data.setRectificationResponsibleUserId(rectificationResponsibleUserId);
336 449
         data.setRectificationPeriod(rectificationPeriod);
450
+        data.setStatus(PostCheckedProblemEnum.DEPT_WAIT.getValue());//DEPT_WAIT("待部门审核", 10),
337 451
 
338 452
         return postCheckedProblemMapper.updatePostCheckedProblem(data);
339 453
     }
@@ -348,11 +462,34 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
348 462
     @Override
349 463
     public int setSpecialityDepartmentReviewerId(Long id, Long specialityDepartmentReviewerId) {
350 464
         if (id == null || specialityDepartmentReviewerId == null) {
351
-            return 0;
465
+//            return 0;
466
+            throw new BaseException("参数不全,请检查!");
467
+        }
468
+        //TODO 审核权限:部门经理操作
469
+        LoginUser loginUser = SecurityUtils.getLoginUser();
470
+        Long userId = loginUser.getUserId();
471
+        Long deptId = loginUser.getDeptId();
472
+        PostCheckedProblem dataDB = postCheckedProblemMapper.selectById(id);
473
+        if (dataDB == null) {
474
+            throw new BaseException("id错误或为空,请检查!");
352 475
         }
476
+        Integer status = dataDB.getStatus();
477
+        if (status != PostCheckedProblemEnum.ADD.getValue()
478
+                && status != PostCheckedProblemEnum.EDIT_WAIT_ONR.getValue()
479
+                && status != PostCheckedProblemEnum.DEPT_WAIT.getValue()
480
+        ) {
481
+            throw new BaseException("当前状态不允许此操作,请检查!【" + status + "】");
482
+        }
483
+        Long rectificationResponsibleUserId = dataDB.getRectificationResponsibleUserId();
484
+        if (!rectificationResponsibleUserId.equals(userId)) {
485
+            throw new BaseException("请切换整改责任人账号操作!");
486
+        }
487
+
488
+
353 489
         PostCheckedProblem data = new PostCheckedProblem();
354 490
         data.setId(id);
355 491
         data.setSpecialityDepartmentReviewerId(specialityDepartmentReviewerId);
492
+//        data.setStatus(PostCheckedProblemEnum);
356 493
         return postCheckedProblemMapper.updatePostCheckedProblem(data);
357 494
     }
358 495
 
@@ -368,25 +505,71 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
368 505
     @Override
369 506
     public int setDeptApproveTime(Long id, Integer status, String reason) {
370 507
         if (id == null || status == null) {
371
-            return 0;
508
+//            return 0;
509
+            throw new BaseException("参数不全,请检查!");
372 510
         }
373 511
 
374 512
         //状态错误
375 513
         if (status != PostCheckedProblemEnum.DEPT_PASS.getValue() && status != PostCheckedProblemEnum.DEPT_BACK.getValue()) {
376
-            return 0;
514
+//            return 0;
515
+            throw new BaseException("状态参数错误,请检查!【" + status + "】");
377 516
         }
378 517
 
379
-
380 518
         //驳回时必须填写原因
381 519
         if (status == PostCheckedProblemEnum.DEPT_BACK.getValue() && StringUtils.isBlank(reason)) {
382
-            return 0;
520
+            throw new BaseException("未通过理由为空,请检查!");
383 521
         }
384 522
 
523
+        //TODO 审核权限:部门经理操作
524
+        LoginUser loginUser = SecurityUtils.getLoginUser();
525
+        Long userId = loginUser.getUserId();
526
+        Long deptId = loginUser.getDeptId();
527
+        PostCheckedProblem dataDb = postCheckedProblemMapper.selectById(id);
528
+        if (dataDb == null) {
529
+            throw new BaseException("id错误或为空,请检查!");
530
+        }
531
+
532
+        Integer statusDB = dataDb.getStatus();
533
+        if (statusDB != PostCheckedProblemEnum.DEPT_WAIT.getValue()) {
534
+            throw new BaseException("当前状态不允许此操作,请检查!【" + statusDB + "】");
535
+        }
536
+
537
+        Long checkedDeptId = dataDb.getCheckedDeptId();//责任部门ID
538
+        if (!checkedDeptId.equals(deptId)) {
539
+            throw new BaseException("请切换问题责任部门经理操作01!");
540
+        }
541
+
542
+        // 当前登录用户是否为部门经理级别
543
+        boolean userHaveAuthority = sysPostService.userHaveAuthority(deptId);
544
+        if (!userHaveAuthority) {
545
+            throw new BaseException("请切换问题责任部门经理操作02!");
546
+        }
547
+
548
+
549
+        //专业部门的审核人ID
550
+        Long specialityDepartmentReviewerId = dataDb.getSpecialityDepartmentReviewerId();
551
+
385 552
         PostCheckedProblem data = new PostCheckedProblem();
386 553
         data.setId(id);
387
-        data.setStatus(status);
388 554
         data.setReason(reason);
389 555
         data.setDeptApproveTime(new Date());
556
+        //通过
557
+        if (status == PostCheckedProblemEnum.DEPT_PASS.getValue()) {
558
+            // ZHUAN_ZY_WAIT("待专业部门人审核(非必填)", 20),
559
+            if (specialityDepartmentReviewerId != null) {
560
+                data.setStatus(PostCheckedProblemEnum.ZHUAN_ZY_WAIT.getValue());
561
+            }
562
+            //EDIT_WAIT("待整改人待上传实施(整改人上传实施图片)", 30),
563
+            else {
564
+                data.setStatus(PostCheckedProblemEnum.EDIT_WAIT_TWO.getValue());
565
+            }
566
+        }
567
+        //驳回
568
+        else if (status == PostCheckedProblemEnum.DEPT_BACK.getValue()) {
569
+            data.setStatus(PostCheckedProblemEnum.DEPT_BACK.getValue());
570
+        }
571
+
572
+
390 573
         return postCheckedProblemMapper.updatePostCheckedProblem(data);
391 574
     }
392 575
 
@@ -401,25 +584,54 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
401 584
     @Override
402 585
     public int setSpecialityDepartmentReviewTime(Long id, Integer status, String reason) {
403 586
         if (id == null || status == null) {
404
-            return 0;
587
+//            return 0;
588
+            throw new BaseException("参数不全,请检查!");
405 589
         }
406 590
 
407 591
         //状态错误
408
-        if (status != PostCheckedProblemEnum.ZHUAN_YE_PASS.getValue() && status != PostCheckedProblemEnum.ZHUAN_YE_BACK.getValue()) {
409
-            return 0;
592
+        if (status != PostCheckedProblemEnum.ZHUAN_ZY_PASS.getValue() && status != PostCheckedProblemEnum.ZHUAN_ZY_BACK.getValue()) {
593
+//            return 0;
594
+            throw new BaseException("状态参数错误,请检查!【" + status + "】");
410 595
         }
411 596
 
412 597
 
413 598
         //驳回时必须填写原因
414
-        if (status == PostCheckedProblemEnum.ZHUAN_YE_BACK.getValue() && StringUtils.isBlank(reason)) {
415
-            return 0;
599
+        if (status == PostCheckedProblemEnum.ZHUAN_ZY_BACK.getValue() && StringUtils.isBlank(reason)) {
600
+//            return 0;
601
+            throw new BaseException("未通过理由为空,请检查!");
602
+        }
603
+
604
+        //TODO 审核权限:部门经理操作
605
+        LoginUser loginUser = SecurityUtils.getLoginUser();
606
+        Long userId = loginUser.getUserId();
607
+        Long deptId = loginUser.getDeptId();
608
+        PostCheckedProblem dataDb = postCheckedProblemMapper.selectById(id);
609
+        if (dataDb == null) {
610
+            throw new BaseException("id错误或为空,请检查!");
611
+        }
612
+
613
+        Integer statusDB = dataDb.getStatus();
614
+        if (statusDB != PostCheckedProblemEnum.ZHUAN_ZY_WAIT.getValue()) {
615
+            throw new BaseException("当前状态不允许此操作,请检查!【" + statusDB + "】");
416 616
         }
417 617
 
618
+        Long specialityDepartmentReviewerId = dataDb.getSpecialityDepartmentReviewerId();
619
+        if (!specialityDepartmentReviewerId.equals(userId)) {
620
+            throw new BaseException("请切换专业部门审核人操作!");
621
+        }
622
+
623
+
418 624
         PostCheckedProblem data = new PostCheckedProblem();
419 625
         data.setId(id);
420
-        data.setStatus(status);
421 626
         data.setReason(reason);
422 627
         data.setSpecialityDepartmentReviewTime(new Date());
628
+
629
+        if (status == PostCheckedProblemEnum.ZHUAN_ZY_PASS.getValue()) {
630
+            data.setStatus(PostCheckedProblemEnum.EDIT_WAIT_TWO.getValue());
631
+        } else if (status == PostCheckedProblemEnum.ZHUAN_ZY_BACK.getValue()) {
632
+            data.setStatus(PostCheckedProblemEnum.ZHUAN_ZY_BACK.getValue());
633
+        }
634
+
423 635
         return postCheckedProblemMapper.updatePostCheckedProblem(data);
424 636
     }
425 637
 
@@ -436,16 +648,38 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
436 648
     public int updateRectificationCompletionImg(Long id, Integer isRectificationCompleted, Date rectificationCompletionTime, String rectificationCompletionImg) {
437 649
 
438 650
         if (id == null || isRectificationCompleted == null || StringUtils.isBlank(rectificationCompletionImg)) {
439
-            return 0;
651
+//            return 0;
652
+            throw new BaseException("参数不全,请检查!");
440 653
         }
441 654
         if (rectificationCompletionTime == null)
442 655
             rectificationCompletionTime = new Date();
443 656
 
657
+
658
+        //TODO 审核权限:部门经理操作
659
+        LoginUser loginUser = SecurityUtils.getLoginUser();
660
+        Long userId = loginUser.getUserId();
661
+        Long deptId = loginUser.getDeptId();
662
+        PostCheckedProblem dataDb = postCheckedProblemMapper.selectById(id);
663
+        if (dataDb == null) {
664
+            throw new BaseException("id错误或为空,请检查!");
665
+        }
666
+        Integer status = dataDb.getStatus();
667
+        if (status != PostCheckedProblemEnum.EDIT_WAIT_TWO.getValue()) {
668
+            throw new BaseException("当前状态不允许此操作,请检查!【" + status + "】");
669
+        }
670
+
671
+        Long rectificationResponsibleUserId = dataDb.getRectificationResponsibleUserId();
672
+        if (!rectificationResponsibleUserId.equals(userId)) {
673
+            throw new BaseException("请切换整改责任人账号操作!");
674
+        }
675
+
676
+
444 677
         PostCheckedProblem data = new PostCheckedProblem();
445 678
         data.setId(id);
446 679
         data.setIsRectificationCompleted(isRectificationCompleted);
447 680
         data.setRectificationCompletionTime(rectificationCompletionTime);
448 681
         data.setRectificationCompletionImg(rectificationCompletionImg);
682
+        data.setStatus(PostCheckedProblemEnum.EDIT_TWO_OVER.getValue());
449 683
 
450 684
         return postCheckedProblemMapper.updatePostCheckedProblem(data);
451 685
     }
@@ -460,11 +694,33 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
460 694
     @Override
461 695
     public int setReviewDepartmentReviewerId(Long id, Long reviewDepartmentReviewerId) {
462 696
         if (id == null || reviewDepartmentReviewerId == null) {
463
-            return 0;
697
+//            return 0;
698
+            throw new BaseException("参数不全,请检查!");
464 699
         }
700
+
701
+        //TODO 审核权限:部门经理操作
702
+        LoginUser loginUser = SecurityUtils.getLoginUser();
703
+        Long userId = loginUser.getUserId();
704
+        Long deptId = loginUser.getDeptId();
705
+        PostCheckedProblem dataDb = postCheckedProblemMapper.selectById(id);
706
+        if (dataDb == null) {
707
+            throw new BaseException("id错误或为空,请检查!");
708
+        }
709
+        Integer status = dataDb.getStatus();
710
+        if (status != PostCheckedProblemEnum.EDIT_WAIT_TWO.getValue()
711
+                && status != PostCheckedProblemEnum.EDIT_TWO_OVER.getValue()
712
+        ) {
713
+            throw new BaseException("当前状态不允许此操作,请检查!【" + status + "】");
714
+        }
715
+        Long rectificationResponsibleUserId = dataDb.getRectificationResponsibleUserId();
716
+        if (!rectificationResponsibleUserId.equals(userId)) {
717
+            throw new BaseException("请切换整改责任人账号操作!");
718
+        }
719
+
465 720
         PostCheckedProblem data = new PostCheckedProblem();
466 721
         data.setId(id);
467 722
         data.setReviewDepartmentReviewerId(reviewDepartmentReviewerId);
723
+        data.setStatus(PostCheckedProblemEnum.FU_CHA_WAIT.getValue());
468 724
         return postCheckedProblemMapper.updatePostCheckedProblem(data);
469 725
     }
470 726
 
@@ -479,26 +735,48 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
479 735
     @Override
480 736
     public int setReviewDepartmentReviewerTime(Long id, Integer status, String reviewConclusion, String reason) {
481 737
         if (id == null || status == null) {
482
-            return 0;
738
+//            return 0;
739
+            throw new BaseException("参数不全,请检查!");
483 740
         }
484 741
 
485 742
         //状态错误
486 743
         if (status != PostCheckedProblemEnum.FU_CHA_PASS.getValue() && status != PostCheckedProblemEnum.FU_CHA_BACK.getValue()) {
487
-            return 0;
744
+//            return 0;
745
+            throw new BaseException("状态参数错误,请检查!【" + status + "】");
488 746
         }
489 747
 
490 748
 
491 749
         //驳回时必须填写原因
492 750
         if (status == PostCheckedProblemEnum.FU_CHA_BACK.getValue() && StringUtils.isBlank(reason)) {
493
-            return 0;
751
+//            return 0;
752
+            throw new BaseException("未通过理由为空,请检查!");
753
+        }
754
+
755
+        //TODO 审核权限:部门经理操作
756
+        LoginUser loginUser = SecurityUtils.getLoginUser();
757
+        Long userId = loginUser.getUserId();
758
+        Long deptId = loginUser.getDeptId();
759
+        PostCheckedProblem dataDb = postCheckedProblemMapper.selectById(id);
760
+        if (dataDb == null) {
761
+            throw new BaseException("id错误或为空,请检查!");
762
+        }
763
+        Integer statusDB = dataDb.getStatus();
764
+        if (statusDB != PostCheckedProblemEnum.FU_CHA_WAIT.getValue()) {
765
+            throw new BaseException("当前状态不允许此操作,请检查!【" + status + "】");
766
+        }
767
+
768
+        //复查部门的审核人ID
769
+        Long reviewDepartmentReviewerId = dataDb.getReviewDepartmentReviewerId();
770
+        if (!reviewDepartmentReviewerId.equals(userId)) {
771
+            throw new BaseException("请切换复查人账号操作!");
494 772
         }
495 773
 
496 774
         PostCheckedProblem data = new PostCheckedProblem();
497 775
         data.setId(id);
498
-        data.setStatus(status);
499 776
         data.setReviewConclusion(reviewConclusion);
500 777
         data.setReason(reason);
501 778
         data.setReviewDepartmentReviewerTime(new Date());
779
+        data.setStatus(status);
502 780
         return postCheckedProblemMapper.updatePostCheckedProblem(data);
503 781
     }
504 782