diff --git a/laws-base/laws-base-core/src/main/java/com/jero/common/api/vo/ResultCommon.java b/laws-base/laws-base-core/src/main/java/com/jero/common/api/vo/ResultCommon.java index 34e3a472..af029034 100644 --- a/laws-base/laws-base-core/src/main/java/com/jero/common/api/vo/ResultCommon.java +++ b/laws-base/laws-base-core/src/main/java/com/jero/common/api/vo/ResultCommon.java @@ -160,4 +160,6 @@ public class ResultCommon { //未符合项中有整改中、审批中的数据时,不允许删除 public static final String ASSESS_DELETE_ERROR = "assess.delete.error"; + //项目中有评估中的数据时,不允许删除 + public static final String ASSESS_DELETE_ERROR2 = "assess.delete.error2"; } 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 caa73f7d..2e382a75 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 @@ -1,10 +1,17 @@ package com.jero.modules.projectLibrary.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.modules.projectLibrary.common.AssessCommon; +import com.jero.modules.projectLibrary.entity.LawsAssess; +import com.jero.modules.projectLibrary.entity.LawsEvaluationNotMet; import com.jero.modules.projectLibrary.entity.LawsProjectLibrary; import com.jero.modules.projectLibrary.mapper.LawsProjectLibraryMapper; +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.system.entity.SysUser; import com.jero.modules.system.service.ISysUserService; @@ -17,6 +24,8 @@ import java.util.List; import java.util.Date; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jero.common.system.query.QueryGenerator; + +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -32,9 +41,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @Transactional(rollbackFor = JeroBootException.class) public class LawsProjectLibraryServiceImpl extends ServiceImpl implements ILawsProjectLibraryService { - @Autowired + @Resource private ISysUserService sysUserService; - + @Resource + private ILawsAssessService lawsAssessService; + @Resource + private ILawsEvaluationNotMetService notMetService; /** * 分页查询 */ @@ -76,6 +88,25 @@ public class LawsProjectLibraryServiceImpl extends ServiceImpl 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); + } + } + } removeById(id); } diff --git a/laws-single-startup/src/main/resources/i18n/messages.properties b/laws-single-startup/src/main/resources/i18n/messages.properties index 442091ad..180a4dde 100644 --- a/laws-single-startup/src/main/resources/i18n/messages.properties +++ b/laws-single-startup/src/main/resources/i18n/messages.properties @@ -72,4 +72,5 @@ invalid.esp=\u65E0\u6548\u7684\u4F01\u6807\u8BA1\u5212\uFF0C\u8BF7\u91CD\u65B0\u can.not.edit.abolish.or.archive.es=\u5DF2\u5E9F\u6B62\u6216\u5DF2\u5F52\u6863\u7684\u4F01\u6807\u8BA1\u5212\u4E0D\u80FD\u7F16\u8F91,\u8BF7\u91CD\u65B0\u9009\u62E9 task.urging.error.2=\u6682\u65E0\u8BE5\u6D41\u7A0B\u50AC\u529E\u6743\u9650 horizontal.transgression.select=\u6682\u65E0\u6743\u9650\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9 -assess.delete.error=\u672A\u7B26\u5408\u9879\u4E2D\u6709\u6574\u6539\u4E2D\u3001\u5BA1\u6279\u4E2D\u7684\u6570\u636E\u65F6\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664 \ No newline at end of file +assess.delete.error=\u672A\u7B26\u5408\u9879\u4E2D\u6709\u6574\u6539\u4E2D\u3001\u5BA1\u6279\u4E2D\u7684\u6570\u636E\u65F6\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664 +assess.delete.error2=\u9879\u76EE\u4E2D\u6709\u8BC4\u4F30\u4E2D\u7684\u6570\u636E\u65F6\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664 \ No newline at end of file diff --git a/laws-single-startup/src/main/resources/i18n/messages_en.properties b/laws-single-startup/src/main/resources/i18n/messages_en.properties index 9bb8a5bc..d56363f5 100644 --- a/laws-single-startup/src/main/resources/i18n/messages_en.properties +++ b/laws-single-startup/src/main/resources/i18n/messages_en.properties @@ -77,4 +77,5 @@ invalid.esp=Invalid enterprise standard, please check can.not.edit.abolish.or.archive.es=Can not edit abolished or archived enterprise standards, please check task.urging.error.2=I currently do not have the authority to urge this process horizontal.transgression.select=no permission at the moment please reselect -assess.delete.error=When there is data under rectification or approval in the non compliant items, deletion is not allowed \ No newline at end of file +assess.delete.error=When there is data under rectification or approval in the non compliant items, deletion is not allowed +assess.delete.error2=When there is data under evaluation in the project, deletion is not allowed \ No newline at end of file diff --git a/laws-single-startup/src/main/resources/i18n/messages_zh.properties b/laws-single-startup/src/main/resources/i18n/messages_zh.properties index 7b956f9c..03dfdf3d 100644 --- a/laws-single-startup/src/main/resources/i18n/messages_zh.properties +++ b/laws-single-startup/src/main/resources/i18n/messages_zh.properties @@ -77,4 +77,5 @@ invalid.esp=\u65E0\u6548\u7684\u4F01\u6807\u8BA1\u5212\uFF0C\u8BF7\u91CD\u65B0\u can.not.edit.abolish.or.archive.es=\u5DF2\u5E9F\u6B62\u6216\u5DF2\u5F52\u6863\u7684\u4F01\u6807\u8BA1\u5212\u4E0D\u80FD\u7F16\u8F91,\u8BF7\u91CD\u65B0\u9009\u62E9 task.urging.error.2=\u6682\u65E0\u8BE5\u6D41\u7A0B\u50AC\u529E\u6743\u9650 horizontal.transgression.select=\u6682\u65E0\u6743\u9650\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9 -assess.delete.error=\u672A\u7B26\u5408\u9879\u4E2D\u6709\u6574\u6539\u4E2D\u3001\u5BA1\u6279\u4E2D\u7684\u6570\u636E\u65F6\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664 \ No newline at end of file +assess.delete.error=\u672A\u7B26\u5408\u9879\u4E2D\u6709\u6574\u6539\u4E2D\u3001\u5BA1\u6279\u4E2D\u7684\u6570\u636E\u65F6\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664 +assess.delete.error2=\u9879\u76EE\u4E2D\u6709\u8BC4\u4F30\u4E2D\u7684\u6570\u636E\u65F6\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664 \ No newline at end of file