Selaa lähdekoodia

考核规则审核

zwj 10 kuukautta sitten
vanhempi
commit
869c5fe050

+ 84 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostAssessmentRulesController.java

@@ -4,6 +4,14 @@ import java.math.BigDecimal;
4 4
 import java.util.Date;
5 5
 import java.util.List;
6 6
 import javax.servlet.http.HttpServletResponse;
7
+
8
+import com.ruoyi.common.core.domain.entity.SysDept;
9
+import com.ruoyi.common.core.domain.model.LoginUser;
10
+import com.ruoyi.common.enums.DeptCode;
11
+import com.ruoyi.common.utils.SecurityUtils;
12
+import com.ruoyi.system.domain.SysPost;
13
+import com.ruoyi.system.service.ISysDeptService;
14
+import com.ruoyi.system.service.ISysPostService;
7 15
 import org.springframework.security.access.prepost.PreAuthorize;
8 16
 import org.springframework.beans.factory.annotation.Autowired;
9 17
 import org.springframework.web.bind.annotation.GetMapping;
@@ -41,6 +49,13 @@ public class PostAssessmentRulesController extends BaseController
41 49
     @Autowired
42 50
     private IPostAssessmentRulesService postAssessmentRulesService;
43 51
 
52
+    @Autowired
53
+    private ISysDeptService sysDeptService;
54
+
55
+    @Autowired
56
+    private ISysPostService sysPostService;
57
+
58
+
44 59
     /**
45 60
      * 查询考核规则列表
46 61
      */
@@ -167,6 +182,75 @@ public class PostAssessmentRulesController extends BaseController
167 182
     @Log(title = "考核规则审核", businessType = BusinessType.UPDATE)
168 183
     @PutMapping("/statusApprove")
169 184
     public AjaxResult statusApprove(Long id, Integer status, String statusReason) {
185
+
186
+        // 判断审核的权限
187
+        LoginUser loginUser = SecurityUtils.getLoginUser();
188
+        // 当前登录用户的部门id 查询岗位id是否在内
189
+        SysDept sysDept = sysDeptService.selectDeptById(loginUser.getDeptId());
190
+        if (!sysDept.getDeptCode().equals(DeptCode.DEPT_ICFA.getCode())) {
191
+            return error("审核权限有误,请联系管理员!");
192
+        }
193
+        // 判断岗位是否在权限范围内
194
+        SysPost sysPost = sysPostService.selectPostByDeptId(loginUser.getDeptId());
195
+        if (sysPost.getPostLevel() != 1) {
196
+            return error("审核权限有误,请联系管理员!");
197
+        }
198
+
199
+        return toAjax(postAssessmentRulesService.statusApprove(id, status,  statusReason));
200
+    }
201
+
202
+
203
+
204
+    @ApiOperation("考核规则审核-职能")
205
+    @ApiImplicitParams({
206
+            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
207
+            @ApiImplicitParam(name = "status", value = "状态:3-通过;4-驳回;", dataType = "Integer", dataTypeClass = Integer.class),
208
+            @ApiImplicitParam(name = "reason", value = "未通过理由", dataType = "String", dataTypeClass = String.class),
209
+    })
210
+    @Log(title = "考核规则审核-职能", businessType = BusinessType.UPDATE)
211
+    @PutMapping("/statusFunctions")
212
+    public AjaxResult statusFunctions(Long id, Integer status, String statusReason) {
213
+
214
+        // 判断审核的权限
215
+        LoginUser loginUser = SecurityUtils.getLoginUser();
216
+        // 当前登录用户的部门id 查询岗位id是否在内
217
+        SysDept sysDept = sysDeptService.selectDeptById(loginUser.getDeptId());
218
+        if (!sysDept.getDeptCode().equals(DeptCode.DEPT_ICFA.getCode())) {
219
+            return error("审核权限有误,请联系管理员!");
220
+        }
221
+        // 判断岗位是否在权限范围内
222
+        SysPost sysPost = sysPostService.selectPostByDeptId(loginUser.getDeptId());
223
+        if (sysPost.getPostLevel() != 1) {
224
+            return error("审核权限有误,请联系管理员!");
225
+        }
226
+
227
+        return toAjax(postAssessmentRulesService.statusApprove(id, status,  statusReason));
228
+    }
229
+
230
+
231
+    @ApiOperation("考核规则审核-生产")
232
+    @ApiImplicitParams({
233
+            @ApiImplicitParam(name = "id", value = "主键", dataType = "Long", dataTypeClass = Long.class),
234
+            @ApiImplicitParam(name = "status", value = "状态:3-通过;4-驳回;", dataType = "Integer", dataTypeClass = Integer.class),
235
+            @ApiImplicitParam(name = "reason", value = "未通过理由", dataType = "String", dataTypeClass = String.class),
236
+    })
237
+    @Log(title = "考核规则审核-生产", businessType = BusinessType.UPDATE)
238
+    @PutMapping("/statusProduction")
239
+    public AjaxResult statusProduction(Long id, Integer status, String statusReason) {
240
+
241
+        // 判断审核的权限
242
+        LoginUser loginUser = SecurityUtils.getLoginUser();
243
+        // 当前登录用户的部门id 查询岗位id是否在内
244
+        SysDept sysDept = sysDeptService.selectDeptById(loginUser.getDeptId());
245
+        if (!sysDept.getDeptCode().equals(DeptCode.DEPT_ICFA.getCode())) {
246
+            return error("审核权限有误,请联系管理员!");
247
+        }
248
+        // 判断岗位是否在权限范围内
249
+        SysPost sysPost = sysPostService.selectPostByDeptId(loginUser.getDeptId());
250
+        if (sysPost.getPostLevel() != 1) {
251
+            return error("审核权限有误,请联系管理员!");
252
+        }
253
+
170 254
         return toAjax(postAssessmentRulesService.statusApprove(id, status,  statusReason));
171 255
     }
172 256
 }

+ 7 - 1
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostAssessmentRulesServiceImpl.java

@@ -5,6 +5,8 @@ import java.util.List;
5 5
 
6 6
 import com.ruoyi.common.constant.PostAssessmentRulesEnum;
7 7
 import com.ruoyi.common.constant.PostCheckedReportEnum;
8
+import com.ruoyi.common.core.domain.entity.SysUser;
9
+import com.ruoyi.common.core.domain.model.LoginUser;
8 10
 import com.ruoyi.common.utils.DateUtils;
9 11
 import com.ruoyi.common.utils.SecurityUtils;
10 12
 import com.ruoyi.postCheck.domain.PostCheckedReport;
@@ -133,12 +135,16 @@ public class PostAssessmentRulesServiceImpl extends ServiceImpl<PostAssessmentRu
133 135
         if (status == PostCheckedReportEnum.STATUS_BACK.getValue() && StringUtils.isBlank(statusReason)) {
134 136
             return 0;
135 137
         }
136
-
138
+        LoginUser loginUser = SecurityUtils.getLoginUser();
139
+        SysUser sysUser = loginUser.getUser();
137 140
         PostAssessmentRules data = new PostAssessmentRules();
138 141
         data.setId(id);
139 142
         data.setStatus(status);
140 143
         data.setStatusApproveTime(new Date());
141 144
         data.setStatusReason(statusReason);
145
+        data.setStatusByUserId(sysUser.getUserId());
146
+        data.setStatusByUserName(sysUser.getUserName());
147
+        data.setStatusApproveTime(DateUtils.getNowDate());
142 148
         return postAssessmentRulesMapper.updatePostAssessmentRules(data);
143 149
     }
144 150
 }