fix 80384 未符合项 数据权限校验失败
This commit is contained in:
+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