diff --git a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/ILawsProjectLibraryService.java b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/ILawsProjectLibraryService.java index 5bc99563..2e775383 100644 --- a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/ILawsProjectLibraryService.java +++ b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/ILawsProjectLibraryService.java @@ -31,7 +31,9 @@ public interface ILawsProjectLibraryService extends IService */ void editById(LawsProjectLibrary lawsProjectLibrary); - /** + void checkPermission(LawsProjectLibrary projectLibrary); + + /** * 通过id删除 */ void deleteById(String id); diff --git a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsAssessServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsAssessServiceImpl.java index 95e6bb2d..b311e72e 100644 --- a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsAssessServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsAssessServiceImpl.java @@ -15,10 +15,12 @@ import com.jero.modules.projectLibrary.common.AssessCommon; import com.jero.modules.projectLibrary.entity.LawsAssess; import com.jero.modules.projectLibrary.entity.LawsAssessResults; import com.jero.modules.projectLibrary.entity.LawsEvaluationNotMet; +import com.jero.modules.projectLibrary.entity.LawsProjectLibrary; import com.jero.modules.projectLibrary.mapper.LawsAssessMapper; import com.jero.modules.projectLibrary.service.ILawsAssessResultsService; import com.jero.modules.projectLibrary.service.ILawsAssessService; import com.jero.modules.projectLibrary.service.ILawsEvaluationNotMetService; +import com.jero.modules.projectLibrary.service.ILawsProjectLibraryService; import com.jero.modules.projectLibrary.vo.DecompositionOrderSourceVO; import com.jero.modules.projectLibrary.vo.LawsAssessAddVo; import com.jero.modules.split.entity.SarFileSplitInfoEO; @@ -66,6 +68,8 @@ public class LawsAssessServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(LawsEvaluationNotMet::getProjectId, lawsAssess.getProjectId()); + queryWrapper.eq(LawsEvaluationNotMet::getProjectId, projectId); queryWrapper.in(LawsEvaluationNotMet::getStandardId, lawsAssess.getStandardId()); List notMetList = notMetService.list(queryWrapper); for (LawsEvaluationNotMet notMet : notMetList) { diff --git a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsProjectLibraryServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsProjectLibraryServiceImpl.java index 2e382a75..7a07b832 100644 --- a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsProjectLibraryServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsProjectLibraryServiceImpl.java @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.jero.common.api.vo.ResultCommon; import com.jero.common.constant.CommonConstant; +import com.jero.common.system.vo.LoginUser; +import com.jero.modules.laws.common.util.CurrentUserUtil; import com.jero.modules.projectLibrary.common.AssessCommon; import com.jero.modules.projectLibrary.entity.LawsAssess; import com.jero.modules.projectLibrary.entity.LawsEvaluationNotMet; @@ -22,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional; import com.jero.common.exception.JeroBootException; import java.util.List; import java.util.Date; +import java.util.Objects; + import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jero.common.system.query.QueryGenerator; @@ -79,15 +83,29 @@ public class LawsProjectLibraryServiceImpl extends ServiceImpl allByProjectIdNotDeleted = lawsAssessService.getAllByProjectIdNotDeleted(id); for (LawsAssess lawsAssess : allByProjectIdNotDeleted) { String processStatus = lawsAssess.getProcessStatus(); @@ -117,6 +135,31 @@ public class LawsProjectLibraryServiceImpl extends ServiceImpl ids) { LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); wrapper.in(LawsProjectLibrary::getId, ids); + List projectLibraryList = this.list(wrapper); + for (LawsProjectLibrary projectLibrary : projectLibraryList) { + checkPermission(projectLibrary); + String id = projectLibrary.getId(); + List allByProjectIdNotDeleted = lawsAssessService.getAllByProjectIdNotDeleted(id); + for (LawsAssess lawsAssess : allByProjectIdNotDeleted) { + String processStatus = lawsAssess.getProcessStatus(); + if (AssessCommon.UNDER_EVALUATION.equals(processStatus)){ + throw new JeroBootException(ResultCommon.ASSESS_DELETE_ERROR2); + } + //未符合项中有整改中、审批中的数据时,不允许删除 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(LawsEvaluationNotMet::getProjectId, lawsAssess.getProjectId()); + queryWrapper.in(LawsEvaluationNotMet::getStandardId, lawsAssess.getStandardId()); + List notMetList = notMetService.list(queryWrapper); + for (LawsEvaluationNotMet notMet : notMetList) { + String state = notMet.getState(); + if (AssessCommon.RECTIFICATION.equals(state)|| + AssessCommon.UNDER_APPROVAL.equals(state)){ + throw new JeroBootException(ResultCommon.ASSESS_DELETE_ERROR); + } + } + } + } + wrapper.set(LawsProjectLibrary::getDelFlag, CommonConstant.DEL_FLAG_1.toString()); update(wrapper); }