fix 80266 车型项目库-如果项目库中有数据,删除后,数据全部同步删除嘛?

This commit is contained in:
lijiarao
2024-02-04 16:45:46 +08:00
parent 6cafb32ee0
commit 1a927723d2
5 changed files with 41 additions and 5 deletions
@@ -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";
}
@@ -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<LawsProjectLibraryMapper, LawsProjectLibrary> implements ILawsProjectLibraryService {
@Autowired
@Resource
private ISysUserService sysUserService;
@Resource
private ILawsAssessService lawsAssessService;
@Resource
private ILawsEvaluationNotMetService notMetService;
/**
* 分页查询
*/
@@ -76,6 +88,25 @@ public class LawsProjectLibraryServiceImpl extends ServiceImpl<LawsProjectLibrar
@Override
public void deleteById(String id) {
LawsProjectLibrary projectLibrary = getById(id);
List<LawsAssess> 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<LawsEvaluationNotMet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(LawsEvaluationNotMet::getProjectId, lawsAssess.getProjectId());
queryWrapper.in(LawsEvaluationNotMet::getStandardId, lawsAssess.getStandardId());
List<LawsEvaluationNotMet> 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);
}
@@ -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
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
@@ -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
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
@@ -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
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