feat: 外标引用标准单独查询权限
This commit is contained in:
+1
-9
@@ -2146,15 +2146,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
List<SysUser> userByDepIds = sysUserService.getUserByDepIds(departIdList, user.getUsername());
|
List<SysUser> userByDepIds = sysUserService.getUserByDepIds(departIdList, user.getUsername());
|
||||||
List<LawsOverseasStandard> list = lawsOverseasStandardService.list();
|
List<LawsOverseasStandard> list = lawsOverseasStandardService.list();
|
||||||
List<String> allFbIdList = list.stream().map(LawsOverseasStandard::getId).collect(Collectors.toList());
|
List<String> allFbIdList = list.stream().map(LawsOverseasStandard::getId).collect(Collectors.toList());
|
||||||
LambdaQueryWrapper<LawsTreeNode> treeNodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
List<String> fbIdList = lawsOverseasStandardService.getAllAuthControlFbId();
|
||||||
treeNodeLambdaQueryWrapper.eq(LawsTreeNode::getNodeName, "引进标准");
|
|
||||||
treeNodeLambdaQueryWrapper.eq(LawsTreeNode::getModuleCode, TableNameEnum.FOREIGN_REGULATIONS.getValue());
|
|
||||||
LawsTreeNode node = lawsTreeNodeService.getOne(treeNodeLambdaQueryWrapper);
|
|
||||||
// 获取引进标准的id
|
|
||||||
LambdaQueryWrapper<LawsNodeRelation> nodeRelationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
nodeRelationLambdaQueryWrapper.eq(LawsNodeRelation::getNodeId, node.getId());
|
|
||||||
List<LawsNodeRelation> fbList = lawsNodeRelationService.list(nodeRelationLambdaQueryWrapper);
|
|
||||||
List<String> fbIdList = fbList.stream().map(LawsNodeRelation::getUniqueRelationFlag).collect(Collectors.toList());
|
|
||||||
idSearch = true;
|
idSearch = true;
|
||||||
// 外标判断当前登陆人是不是汽车研究总院及子部门的员工,如果是则根据授权部门进行权限限制
|
// 外标判断当前登陆人是不是汽车研究总院及子部门的员工,如果是则根据授权部门进行权限限制
|
||||||
// 如果不是则需要将引进标准的id从所有id中排除掉
|
// 如果不是则需要将引进标准的id从所有id中排除掉
|
||||||
|
|||||||
+8
@@ -102,4 +102,12 @@ public interface EnterpriseStandardAuthUserService extends IService<EnterpriseSt
|
|||||||
* @param standardId 企标Id
|
* @param standardId 企标Id
|
||||||
*/
|
*/
|
||||||
void isDeleteHorizontalOverstep(String standardId);
|
void isDeleteHorizontalOverstep(String standardId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验外标权限
|
||||||
|
* @param standardId
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean fbDetailPermission(String standardId, String userId);
|
||||||
}
|
}
|
||||||
|
|||||||
+40
@@ -20,13 +20,16 @@ import com.jero.modules.laws.standard.controller.TempAuthRecordQueryDto;
|
|||||||
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
||||||
import com.jero.modules.laws.standard.entity.LawsStandardTempPermission;
|
import com.jero.modules.laws.standard.entity.LawsStandardTempPermission;
|
||||||
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
||||||
|
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
|
||||||
import com.jero.modules.sys.entity.LawsEnterpriseStandardLevel;
|
import com.jero.modules.sys.entity.LawsEnterpriseStandardLevel;
|
||||||
import com.jero.modules.sys.entity.LawsGrade;
|
import com.jero.modules.sys.entity.LawsGrade;
|
||||||
import com.jero.modules.sys.service.ILawsEnterpriseStandardLevelService;
|
import com.jero.modules.sys.service.ILawsEnterpriseStandardLevelService;
|
||||||
import com.jero.modules.sys.service.ILawsGradeService;
|
import com.jero.modules.sys.service.ILawsGradeService;
|
||||||
import com.jero.modules.sys.utils.UserUtils;
|
import com.jero.modules.sys.utils.UserUtils;
|
||||||
|
import com.jero.modules.system.entity.SysDepart;
|
||||||
import com.jero.modules.system.entity.SysUser;
|
import com.jero.modules.system.entity.SysUser;
|
||||||
import com.jero.modules.system.model.DepartIdModel;
|
import com.jero.modules.system.model.DepartIdModel;
|
||||||
|
import com.jero.modules.system.service.ISysDepartService;
|
||||||
import com.jero.modules.system.service.ISysUserDepartService;
|
import com.jero.modules.system.service.ISysUserDepartService;
|
||||||
import com.jero.modules.system.service.ISysUserService;
|
import com.jero.modules.system.service.ISysUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -88,6 +91,12 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl<Enterpris
|
|||||||
@Resource
|
@Resource
|
||||||
private ILawsEnterpriseStandardService esService;
|
private ILawsEnterpriseStandardService esService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILawsOverseasStandardService fbService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysDepartService departService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveTempPermission(LawsStandardTempPermission lawsStandardTempPermission) {
|
public void saveTempPermission(LawsStandardTempPermission lawsStandardTempPermission) {
|
||||||
@@ -494,6 +503,37 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl<Enterpris
|
|||||||
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.YOU_HAVE_NOT_DATA_AUTH, standardId));
|
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.YOU_HAVE_NOT_DATA_AUTH, standardId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean fbDetailPermission(String standardId, String userId) {
|
||||||
|
// 管理员有所有企标的权限
|
||||||
|
SysUser currentUser = sysUserService.getById(userId);
|
||||||
|
// 管理员有所有企标的权限
|
||||||
|
List<String> roleList = sysUserRoleService.getRole(currentUser.getUsername());
|
||||||
|
if (roleList != null && roleList.stream().anyMatch(adminRoleCodeList::contains)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 能够查看所有企标详情的权限
|
||||||
|
if (roleList != null && roleList.stream().anyMatch(enterpriseDetailRoleCodeList::contains)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 判断是不是引用标准,不是引用标准不做权限校验
|
||||||
|
List<String> allAuthControlFbId = fbService.getAllAuthControlFbId();
|
||||||
|
if (!allAuthControlFbId.contains(standardId)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 获取当前用户的所在部门Id
|
||||||
|
// 查询当前用户的部门
|
||||||
|
List<SysDepart> userDepartList = departService.queryUserDeparts(userId);
|
||||||
|
List<String> departIdList = userDepartList.stream().map(SysDepart::getId).collect(Collectors.toList());
|
||||||
|
// 是引用标准就得判断权限
|
||||||
|
LambdaQueryWrapper<EnterpriseStandardAuthDept> adWrapper = new LambdaQueryWrapper<>();
|
||||||
|
adWrapper.in(EnterpriseStandardAuthDept::getAuthDept, departIdList);
|
||||||
|
adWrapper.eq(EnterpriseStandardAuthDept::getStandardId, standardId);
|
||||||
|
adWrapper.isNull(EnterpriseStandardAuthDept::getAuthExpireDate);
|
||||||
|
List<EnterpriseStandardAuthDept> list = authDeptService.list(adWrapper);
|
||||||
|
return !list.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delFlagSet(List<Map<String, Object>> records) {
|
public void delFlagSet(List<Map<String, Object>> records) {
|
||||||
String userId = UserUtils.getUserId();
|
String userId = UserUtils.getUserId();
|
||||||
|
|||||||
+8
@@ -7,16 +7,19 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.api.vo.ResultCommon;
|
import com.jero.common.api.vo.ResultCommon;
|
||||||
import com.jero.common.aspect.annotation.AutoLog;
|
import com.jero.common.aspect.annotation.AutoLog;
|
||||||
|
import com.jero.common.exception.JeroBootException;
|
||||||
import com.jero.common.util.MessageUtils;
|
import com.jero.common.util.MessageUtils;
|
||||||
import com.jero.modules.activiti.process.fb.service.IProcessFbEntryChangeService;
|
import com.jero.modules.activiti.process.fb.service.IProcessFbEntryChangeService;
|
||||||
import com.jero.modules.laws.common.constant.FieldCommon;
|
import com.jero.modules.laws.common.constant.FieldCommon;
|
||||||
import com.jero.modules.laws.common.service.ILawsCommonService;
|
import com.jero.modules.laws.common.service.ILawsCommonService;
|
||||||
import com.jero.modules.laws.customcompare.service.ILawsCustomCompareInfoService;
|
import com.jero.modules.laws.customcompare.service.ILawsCustomCompareInfoService;
|
||||||
|
import com.jero.modules.laws.enterprise.service.EnterpriseStandardAuthUserService;
|
||||||
import com.jero.modules.laws.standard.entity.LawsUpdateRecord;
|
import com.jero.modules.laws.standard.entity.LawsUpdateRecord;
|
||||||
import com.jero.modules.laws.standard.service.ILawsNodeRelationService;
|
import com.jero.modules.laws.standard.service.ILawsNodeRelationService;
|
||||||
import com.jero.modules.laws.standard.service.ILawsUpdateRecordService;
|
import com.jero.modules.laws.standard.service.ILawsUpdateRecordService;
|
||||||
import com.jero.modules.personal.service.ILawsStandardCollectionService;
|
import com.jero.modules.personal.service.ILawsStandardCollectionService;
|
||||||
import com.jero.modules.personal.service.ILawsStandardSharingService;
|
import com.jero.modules.personal.service.ILawsStandardSharingService;
|
||||||
|
import com.jero.modules.sys.utils.UserUtils;
|
||||||
import com.jero.modules.tag.entity.LawsTag;
|
import com.jero.modules.tag.entity.LawsTag;
|
||||||
import com.jero.modules.tag.enums.TableNameEnum;
|
import com.jero.modules.tag.enums.TableNameEnum;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -57,6 +60,8 @@ public class LawsOverseasController {
|
|||||||
private IProcessFbEntryChangeService processFbEntryChangeService;
|
private IProcessFbEntryChangeService processFbEntryChangeService;
|
||||||
@Resource
|
@Resource
|
||||||
private ILawsCustomCompareInfoService customCompareService;
|
private ILawsCustomCompareInfoService customCompareService;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseStandardAuthUserService authUserService;
|
||||||
|
|
||||||
private static final String MODULE_VALUE = TableNameEnum.FOREIGN_REGULATIONS.getValue();
|
private static final String MODULE_VALUE = TableNameEnum.FOREIGN_REGULATIONS.getValue();
|
||||||
|
|
||||||
@@ -141,6 +146,9 @@ public class LawsOverseasController {
|
|||||||
public Result<Map<String,Object>> getByIdAndModule(@RequestParam(name="id", required = false) @ApiParam("主键") String id,
|
public Result<Map<String,Object>> getByIdAndModule(@RequestParam(name="id", required = false) @ApiParam("主键") String id,
|
||||||
@RequestParam(name="type") @ApiParam("类型(1详情,2新增编辑)") String type,
|
@RequestParam(name="type") @ApiParam("类型(1详情,2新增编辑)") String type,
|
||||||
@RequestParam(name="standardNumber", required = false) @ApiParam("标准编号") String standardNumber) {
|
@RequestParam(name="standardNumber", required = false) @ApiParam("标准编号") String standardNumber) {
|
||||||
|
if (!authUserService.fbDetailPermission(id, UserUtils.getUserId())) {
|
||||||
|
throw new JeroBootException("暂无该外标查看权限");
|
||||||
|
}
|
||||||
lawsCommonService.addLookHistory(id, type, MODULE_VALUE, standardNumber);
|
lawsCommonService.addLookHistory(id, type, MODULE_VALUE, standardNumber);
|
||||||
return Result.OK(lawsCommonService.getByIdAndModule(id, MODULE_VALUE, type, standardNumber));
|
return Result.OK(lawsCommonService.getByIdAndModule(id, MODULE_VALUE, type, standardNumber));
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -78,4 +78,9 @@ public interface ILawsOverseasStandardService extends IService<LawsOverseasStand
|
|||||||
* 通过编号查查询
|
* 通过编号查查询
|
||||||
*/
|
*/
|
||||||
LawsOverseasStandard queryByStandardNumber(String standardNumber);
|
LawsOverseasStandard queryByStandardNumber(String standardNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有引进标准的Id
|
||||||
|
*/
|
||||||
|
List<String> getAllAuthControlFbId();
|
||||||
}
|
}
|
||||||
|
|||||||
+31
@@ -3,10 +3,15 @@ package com.jero.modules.laws.standard.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.jero.common.constant.CommonConstant;
|
import com.jero.common.constant.CommonConstant;
|
||||||
|
import com.jero.modules.laws.standard.entity.LawsNodeRelation;
|
||||||
import com.jero.modules.laws.standard.entity.LawsOverseasStandard;
|
import com.jero.modules.laws.standard.entity.LawsOverseasStandard;
|
||||||
|
import com.jero.modules.laws.standard.entity.LawsTreeNode;
|
||||||
import com.jero.modules.laws.standard.mapper.LawsOverseasStandardMapper;
|
import com.jero.modules.laws.standard.mapper.LawsOverseasStandardMapper;
|
||||||
|
import com.jero.modules.laws.standard.service.ILawsNodeRelationService;
|
||||||
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
|
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
|
||||||
|
import com.jero.modules.laws.standard.service.ILawsTreeNodeService;
|
||||||
import com.jero.modules.personal.service.ILawsStandardCollectionService;
|
import com.jero.modules.personal.service.ILawsStandardCollectionService;
|
||||||
|
import com.jero.modules.tag.enums.TableNameEnum;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -14,8 +19,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
import com.jero.common.system.query.QueryGenerator;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -34,6 +43,12 @@ public class LawsOverseasStandardServiceImpl extends ServiceImpl<LawsOverseasSta
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ILawsStandardCollectionService lawsStandardCollectionService;
|
private ILawsStandardCollectionService lawsStandardCollectionService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILawsTreeNodeService lawsTreeNodeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILawsNodeRelationService lawsNodeRelationService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*
|
*
|
||||||
@@ -138,4 +153,20 @@ public class LawsOverseasStandardServiceImpl extends ServiceImpl<LawsOverseasSta
|
|||||||
wrapper.last("limit 1");
|
wrapper.last("limit 1");
|
||||||
return getOne(wrapper);
|
return getOne(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getAllAuthControlFbId() {
|
||||||
|
List<LawsOverseasStandard> list = this.list();
|
||||||
|
List<String> allFbIdList = list.stream().map(LawsOverseasStandard::getId).collect(Collectors.toList());
|
||||||
|
LambdaQueryWrapper<LawsTreeNode> treeNodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
treeNodeLambdaQueryWrapper.eq(LawsTreeNode::getNodeName, "引进标准");
|
||||||
|
treeNodeLambdaQueryWrapper.eq(LawsTreeNode::getModuleCode, TableNameEnum.FOREIGN_REGULATIONS.getValue());
|
||||||
|
LawsTreeNode node = lawsTreeNodeService.getOne(treeNodeLambdaQueryWrapper);
|
||||||
|
// 获取引进标准的id
|
||||||
|
LambdaQueryWrapper<LawsNodeRelation> nodeRelationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
nodeRelationLambdaQueryWrapper.eq(LawsNodeRelation::getNodeId, node.getId());
|
||||||
|
List<LawsNodeRelation> fbList = lawsNodeRelationService.list(nodeRelationLambdaQueryWrapper);
|
||||||
|
List<String> fbIdList = fbList.stream().map(LawsNodeRelation::getUniqueRelationFlag).collect(Collectors.toList());
|
||||||
|
return fbIdList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user