chenshudong il y a 4 mois
Parent
commit
8877bc5f7c

+ 16 - 1
airport-admin/src/main/java/com/sundot/airport/web/controller/attendance/AttendancePostRecordController.java

@@ -355,11 +355,26 @@ public class AttendancePostRecordController extends BaseController {
355 355
     @Log(title = "上岗记录", businessType = BusinessType.INSERT)
356 356
     @PostMapping("/direct")
357 357
     public AjaxResult addDirect(@RequestBody List<AttendancePostRecord> attendancePostRecords) {
358
+        boolean isKeZhang;
359
+        List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
360
+        if (CollUtil.isNotEmpty(roles)) {
361
+            List<String> roleKeyList = roles.stream().map(SysRole::getRoleKey).collect(Collectors.toList());
362
+            if (roleKeyList.contains(RoleTypeEnum.kezhang.getCode())) {
363
+                isKeZhang = true;
364
+                if (isUserRecordLocked(SecurityUtils.getUserId())) {
365
+                    throw new ServiceException("该用户已锁定上岗记录,无法修改");
366
+                }
367
+            } else {
368
+                isKeZhang = false;
369
+            }
370
+        } else {
371
+            isKeZhang = false;
372
+        }
358 373
         // 只处理必要的基础信息,不校验和自动设置岗位、通道等信息
359 374
         AtomicInteger count = new AtomicInteger();
360 375
         attendancePostRecords.forEach(record -> {
361 376
             // 检查该用户是否已经锁定上岗记录
362
-            if (isUserRecordLocked(record.getUserId())) {
377
+            if (!isKeZhang && isUserRecordLocked(record.getUserId())) {
363 378
                 throw new ServiceException("该用户已锁定上岗记录,无法修改");
364 379
             }
365 380
             extracted(record);