|
|
@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
|
|
8
|
8
|
|
|
9
|
9
|
import cn.hutool.core.collection.CollUtil;
|
|
10
|
10
|
import cn.hutool.core.util.ObjUtil;
|
|
|
11
|
+import cn.hutool.core.util.StrUtil;
|
|
11
|
12
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
12
|
13
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
13
|
14
|
import com.sundot.airport.check.domain.CheckCorrection;
|
|
|
@@ -351,6 +352,9 @@ public class CheckRecordServiceImpl extends ServiceImpl<CheckRecordMapper, Check
|
|
351
|
352
|
@Transactional(rollbackFor = Exception.class)
|
|
352
|
353
|
@Override
|
|
353
|
354
|
public int insertOrUpdateCheckRecord(CheckRecord checkRecord, boolean isLaunch) {
|
|
|
355
|
+ if (isLaunch) {
|
|
|
356
|
+ checkParam(checkRecord);
|
|
|
357
|
+ }
|
|
354
|
358
|
int result;
|
|
355
|
359
|
if (ObjUtil.isEmpty(checkRecord.getId())) {
|
|
356
|
360
|
if (CollUtil.isNotEmpty(checkRecord.getCheckProjectItemList())) {
|
|
|
@@ -412,6 +416,63 @@ public class CheckRecordServiceImpl extends ServiceImpl<CheckRecordMapper, Check
|
|
412
|
416
|
}
|
|
413
|
417
|
|
|
414
|
418
|
/**
|
|
|
419
|
+ * 检查参数
|
|
|
420
|
+ *
|
|
|
421
|
+ * @param checkRecord 检查记录
|
|
|
422
|
+ */
|
|
|
423
|
+ private static void checkParam(CheckRecord checkRecord) {
|
|
|
424
|
+ if (ObjUtil.isEmpty(checkRecord.getCheckerId()) || StrUtil.isEmpty(checkRecord.getCheckerName())) {
|
|
|
425
|
+ throw new ServiceException("检查人不能为空");
|
|
|
426
|
+ }
|
|
|
427
|
+ if (StrUtil.isEmpty(checkRecord.getTerminlCode()) || StrUtil.isEmpty(checkRecord.getTerminlName())
|
|
|
428
|
+ || StrUtil.isEmpty(checkRecord.getRegionalCode()) || StrUtil.isEmpty(checkRecord.getRegionalName())
|
|
|
429
|
+ || StrUtil.isEmpty(checkRecord.getChannelCode()) || StrUtil.isEmpty(checkRecord.getChannelName())) {
|
|
|
430
|
+ throw new ServiceException("检查地点不能为空");
|
|
|
431
|
+ }
|
|
|
432
|
+ if (ObjUtil.isEmpty(checkRecord.getCheckTime())) {
|
|
|
433
|
+ throw new ServiceException("检查时间不能为空");
|
|
|
434
|
+ }
|
|
|
435
|
+ if (StrUtil.isEmpty(checkRecord.getCheckedLevel()) || StrUtil.isEmpty(checkRecord.getCheckedLevelDesc())) {
|
|
|
436
|
+ throw new ServiceException("被检查级别不能为空");
|
|
|
437
|
+ }
|
|
|
438
|
+ if (StrUtil.equals(checkRecord.getCheckedLevel(), CheckLevelEnum.PERSONNEL_LEVEL.getCode()) &&
|
|
|
439
|
+ (ObjUtil.isEmpty(checkRecord.getCheckedPersonnelId()) || StrUtil.isEmpty(checkRecord.getCheckedPersonnelName()))) {
|
|
|
440
|
+ throw new ServiceException("被检查人不能为空");
|
|
|
441
|
+ }
|
|
|
442
|
+ if (StrUtil.equals(checkRecord.getCheckedLevel(), CheckLevelEnum.TEAM_LEVEL.getCode()) &&
|
|
|
443
|
+ (ObjUtil.isEmpty(checkRecord.getCheckedTeamId()) || StrUtil.isEmpty(checkRecord.getCheckedTeamName()))) {
|
|
|
444
|
+ throw new ServiceException("被检查班组不能为空");
|
|
|
445
|
+ }
|
|
|
446
|
+ if (StrUtil.equals(checkRecord.getCheckedLevel(), CheckLevelEnum.DEPARTMENT_LEVEL.getCode()) &&
|
|
|
447
|
+ (ObjUtil.isEmpty(checkRecord.getCheckedDepartmentId()) || StrUtil.isEmpty(checkRecord.getCheckedDepartmentName()))) {
|
|
|
448
|
+ throw new ServiceException("被检查科室不能为空");
|
|
|
449
|
+ }
|
|
|
450
|
+ if (StrUtil.equals(checkRecord.getCheckedLevel(), CheckLevelEnum.BRIGADE_LEVEL.getCode()) &&
|
|
|
451
|
+ (ObjUtil.isEmpty(checkRecord.getCheckedBrigadeId()) || StrUtil.isEmpty(checkRecord.getCheckedBrigadeName()))) {
|
|
|
452
|
+ throw new ServiceException("被检查大队不能为空");
|
|
|
453
|
+ }
|
|
|
454
|
+ if (CollUtil.isNotEmpty(checkRecord.getCheckProjectItemList())) {
|
|
|
455
|
+ List<CheckProjectItem> unQualifiedList = checkRecord.getCheckProjectItemList().stream().filter(checkProjectItem -> StrUtil.equals(CheckScoreLevelEnum.UNQUALIFIED.getCode(), checkProjectItem.getScoreLevel())).collect(Collectors.toList());
|
|
|
456
|
+ if (CollUtil.isNotEmpty(unQualifiedList)) {
|
|
|
457
|
+ if (ObjUtil.isEmpty(checkRecord.getResponsibleUserId()) && StrUtil.isEmpty(checkRecord.getResponsibleUserName())) {
|
|
|
458
|
+ throw new ServiceException("负责人不能为空");
|
|
|
459
|
+ }
|
|
|
460
|
+ if (ObjUtil.isEmpty(checkRecord.getRectificationDeadline())) {
|
|
|
461
|
+ throw new ServiceException("整改期限不能为空");
|
|
|
462
|
+ }
|
|
|
463
|
+ if (StrUtil.isEmpty(checkRecord.getRectificationSuggestions())) {
|
|
|
464
|
+ throw new ServiceException("整改要求不能为空");
|
|
|
465
|
+ }
|
|
|
466
|
+ unQualifiedList.forEach(checkProjectItem -> {
|
|
|
467
|
+ if (CollUtil.isEmpty(checkProjectItem.getCheckUserList()) && StringUtils.isEmpty(checkProjectItem.getProblemDescription())) {
|
|
|
468
|
+ throw new ServiceException("不合格人员及问题描述不能同时为空");
|
|
|
469
|
+ }
|
|
|
470
|
+ });
|
|
|
471
|
+ }
|
|
|
472
|
+ }
|
|
|
473
|
+ }
|
|
|
474
|
+
|
|
|
475
|
+ /**
|
|
415
|
476
|
* 处理被检查部门信息
|
|
416
|
477
|
*
|
|
417
|
478
|
* @param checkRecord 检查单
|