kongzy
2024-07-12 28aaf2ffa1dbb860a292ba330a7e9362e60e7832
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){
@@ -68,6 +78,7 @@
            }
            fileIds.add(accessoryFile.getId());
        }
        baseMapper.insert(investigation);
        //更新图片过程id
        accessoryFileService.batchUpdateAccessoryFileProcessId(fileIds,investigation.getId());
@@ -89,6 +100,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 +154,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);
        //更新项目状态