fix 80384 未符合项 数据权限校验失败
This commit is contained in:
+6
-9
@@ -4,7 +4,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.modules.laws.common.constant.FieldCommon;
|
||||
import com.jero.modules.laws.common.util.CurrentUserUtil;
|
||||
@@ -29,7 +28,6 @@ import org.apache.poi.ss.formula.functions.T;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
@@ -111,7 +109,7 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
|
||||
}
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
//检查所选数据是否均是待整改状态、当前时间大于预计整改完成日期
|
||||
if (this.check(idList)) {
|
||||
if (!this.check(idList)) {
|
||||
throw new JeroBootException(ResultCommon.CANNOT_CLOSE);
|
||||
}
|
||||
lawsEvaluationNotMetService.batchClose(idList);
|
||||
@@ -126,16 +124,15 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
|
||||
List<LawsEvaluationNotMet> notMets = lawsEvaluationNotMetService.listByIds(ids);
|
||||
for (LawsEvaluationNotMet notMet : notMets) {
|
||||
//管理员和设计工程师可以操作未符合项
|
||||
if (!roleIds.contains(FieldCommon.ROLE_ADMIN) || !userId.equals(notMet.getEngineerId())){
|
||||
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
|
||||
if (!roleIds.contains(FieldCommon.ROLE_ADMIN) && !userId.equals(notMet.getEngineerId())){
|
||||
throw new JeroBootException(ResultCommon.NO_PERMISSIONS_PLEASE_SELECT);
|
||||
}
|
||||
String state = notMet.getState();
|
||||
Date expectedTime = notMet.getExpectedTime();
|
||||
// 判断expectedTime是否小于今日
|
||||
boolean isLessThanToday = expectedTime.before(date);
|
||||
if (!state.equals(AssessCommon.TO_BE_RECTIFIED) || !isLessThanToday){
|
||||
//判断是否是待整改,超期
|
||||
if (!state.equals(AssessCommon.TO_BE_RECTIFIED) && !state.equals(AssessCommon.OVERDUE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+15
-10
@@ -2,7 +2,6 @@ package com.jero.modules.projectLibrary.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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;
|
||||
@@ -20,9 +19,7 @@ import com.jero.modules.projectLibrary.common.AssessCommon;
|
||||
import com.jero.modules.projectLibrary.entity.LawsEvaluationNotMet;
|
||||
import com.jero.modules.projectLibrary.mapper.LawsEvaluationNotMetMapper;
|
||||
import com.jero.modules.projectLibrary.service.ILawsEvaluationNotMetService;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -169,18 +166,22 @@ public class LawsEvaluationNotMetServiceImpl extends ServiceImpl<LawsEvaluationN
|
||||
@Override
|
||||
public void editById(LawsEvaluationNotMet lawsEvaluationNotMet) {
|
||||
String id = lawsEvaluationNotMet.getId();
|
||||
checkPermission(id);
|
||||
//保存标准id和来源到未符合项
|
||||
setStandardIdAndSource(lawsEvaluationNotMet);
|
||||
saveOrUpdate(lawsEvaluationNotMet);
|
||||
}
|
||||
|
||||
private void checkPermission(String id) {
|
||||
LawsEvaluationNotMet notMet = this.getById(id);
|
||||
LoginUser loginUser = CurrentUserUtil.getLoginUser();
|
||||
String roleIds = loginUser.getRoleIds();
|
||||
String userId = loginUser.getId();
|
||||
//管理员和设计工程师可以操作未符合项
|
||||
if (!roleIds.contains(FieldCommon.ROLE_ADMIN) || !userId.equals(notMet.getEngineerId())){
|
||||
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
|
||||
if (!roleIds.contains(FieldCommon.ROLE_ADMIN) && !userId.equals(notMet.getEngineerId())){
|
||||
throw new JeroBootException(ResultCommon.NO_PERMISSIONS_PLEASE_SELECT);
|
||||
}
|
||||
//保存标准id和来源到未符合项
|
||||
setStandardIdAndSource(lawsEvaluationNotMet);
|
||||
saveOrUpdate(lawsEvaluationNotMet);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
@@ -190,7 +191,8 @@ public class LawsEvaluationNotMetServiceImpl extends ServiceImpl<LawsEvaluationN
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
checkPermission(id);
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,6 +203,9 @@ public class LawsEvaluationNotMetServiceImpl extends ServiceImpl<LawsEvaluationN
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
for (String id : ids) {
|
||||
checkPermission(id);
|
||||
}
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user