From 9a8a4a431c61d22a334003b2e8a52571ea809920 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期一, 24 三月 2025 13:15:34 +0800
Subject: [PATCH] 增加业务类别

---
 assess-system/src/main/java/com/gkhy/assess/system/service/impl/AssInvestigationServiceImpl.java |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/assess-system/src/main/java/com/gkhy/assess/system/service/impl/AssInvestigationServiceImpl.java b/assess-system/src/main/java/com/gkhy/assess/system/service/impl/AssInvestigationServiceImpl.java
index 24f5e55..8b89db3 100644
--- a/assess-system/src/main/java/com/gkhy/assess/system/service/impl/AssInvestigationServiceImpl.java
+++ b/assess-system/src/main/java/com/gkhy/assess/system/service/impl/AssInvestigationServiceImpl.java
@@ -1,9 +1,14 @@
 package com.gkhy.assess.system.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.gkhy.assess.common.enums.DeleteFlagEnum;
 import com.gkhy.assess.common.enums.RequestSourceEnum;
 import com.gkhy.assess.common.exception.ApiException;
 import com.gkhy.assess.system.domain.AssAccessoryFile;
 import com.gkhy.assess.system.domain.AssInvestigation;
+import com.gkhy.assess.system.domain.AssPlanPerson;
 import com.gkhy.assess.system.enums.AccessoryFileTypeEnum;
 import com.gkhy.assess.system.enums.ReportProgressEnum;
 import com.gkhy.assess.system.mapper.AssInvestigationMapper;
@@ -43,6 +48,11 @@
     public Long addInvestigation(AssInvestigation investigation) {
         Long projectId=investigation.getProjectId();
         projectService.checkUserAllowed(projectId);
+        String location=investigation.getLocation();
+        String[] locationArray = location.split(",");
+        if(locationArray.length!=2){
+            throw new ApiException("现场勘验位置格式不正确");
+        }
      //   checkInvestigationCount(projectId);
         investigation.setCreateBy(ShiroUtils.getSysUser().getUsername());
         if(investigation.getIsSafetyCheck()!=null&&investigation.getIsSafetyCheck()==1){
@@ -55,6 +65,9 @@
         accessFiles.addAll(investigation.getCompanyImages());
         accessFiles.addAll(investigation.getDeviceImages());
         accessFiles.addAll(investigation.getInvestingationImages());
+        if(accessFiles.isEmpty()){
+            throw new ApiException("现场勘验照片不能为空");
+        }
         if(investigation.getInvestingationVideos()!=null&& !investigation.getInvestingationVideos().isEmpty()){
             accessFiles.addAll(investigation.getInvestingationVideos());
         }
@@ -68,6 +81,7 @@
             }
             fileIds.add(accessoryFile.getId());
         }
+
         baseMapper.insert(investigation);
         //更新图片过程id
         accessoryFileService.batchUpdateAccessoryFileProcessId(fileIds,investigation.getId());
@@ -89,6 +103,11 @@
             throw new ApiException("现场勘验记录id不能为空!");
         }
         projectService.checkUserAllowed(investigation.getProjectId());
+        String location=investigation.getLocation();
+        String[] locationArray = location.split(",");
+        if(locationArray.length!=2){
+            throw new ApiException("现场勘验位置格式不正确");
+        }
         investigation.setUpdateBy(ShiroUtils.getSysUser().getUsername());
         List<AssAccessoryFile> accessFiles=new ArrayList<>();
         accessFiles.addAll(investigation.getCompanyImages());
@@ -138,6 +157,14 @@
         Long projectId= Long.parseLong(map.get("projectId").toString());
         projectService.checkUserAllowed(projectId);
 
+        LambdaQueryWrapper< AssInvestigation > lambdaQueryWrapper = Wrappers.<AssInvestigation>lambdaQuery()
+                .eq(AssInvestigation::getProjectId, projectId)
+                .eq(AssInvestigation::getDelFlag, DeleteFlagEnum.UN_DELETE);
+
+        Long count= count(lambdaQueryWrapper);
+        if(count<1){
+            throw new ApiException("现场勘验记录不能为空");
+        }
         //校验项目状态
         projectService.checkReportProgress(projectId, ReportProgressEnum.WORK_NOTIFICATION);
         //更新项目状态

--
Gitblit v1.9.2