feat: 起草部门的人员具有所有企标的查看编辑权限
This commit is contained in:
+4
-1
@@ -149,7 +149,10 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
// 筛选出用于查询的字段
|
// 筛选出用于查询的字段
|
||||||
List<LawsTag> fieldListCondition = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getValue()
|
List<LawsTag> fieldListCondition = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getValue()
|
||||||
.equals(lawsTag.getIsQuery().toString())).collect(Collectors.toList());
|
.equals(lawsTag.getIsQuery().toString())).collect(Collectors.toList());
|
||||||
|
// 加一个create_by字段
|
||||||
|
LawsTag createByTag = new LawsTag();
|
||||||
|
createByTag.setDbFieldName(FieldCommon.CREATE_BY);
|
||||||
|
fieldListSelect.add(createByTag);
|
||||||
// 获取分页参数
|
// 获取分页参数
|
||||||
Integer pageNo = Integer.valueOf(parameterMap.get("pageNo").toString());
|
Integer pageNo = Integer.valueOf(parameterMap.get("pageNo").toString());
|
||||||
Integer pageSize = Integer.valueOf(parameterMap.get("pageSize").toString());
|
Integer pageSize = Integer.valueOf(parameterMap.get("pageSize").toString());
|
||||||
|
|||||||
+13
-3
@@ -156,6 +156,7 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl<Enterpris
|
|||||||
// 只有创建人和管理员才有维护的权限
|
// 只有创建人和管理员才有维护的权限
|
||||||
String userId = UserUtils.getUserId();
|
String userId = UserUtils.getUserId();
|
||||||
SysUser currentUser = sysUserService.getById(userId);
|
SysUser currentUser = sysUserService.getById(userId);
|
||||||
|
String username = currentUser.getUsername();
|
||||||
// 起草部门的人也有维护的权限
|
// 起草部门的人也有维护的权限
|
||||||
List<DepartIdModel> departIdModels = sysUserDepartService.queryDepartIdsOfUser(userId);
|
List<DepartIdModel> departIdModels = sysUserDepartService.queryDepartIdsOfUser(userId);
|
||||||
List<String> departNames = departIdModels.stream().map(DepartIdModel::getTitle).collect(Collectors.toList());
|
List<String> departNames = departIdModels.stream().map(DepartIdModel::getTitle).collect(Collectors.toList());
|
||||||
@@ -172,7 +173,7 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl<Enterpris
|
|||||||
}
|
}
|
||||||
for (Map<String, Object> map : records) {
|
for (Map<String, Object> map : records) {
|
||||||
String createBy = (String) map.get(FieldCommon.CREATE_BY);
|
String createBy = (String) map.get(FieldCommon.CREATE_BY);
|
||||||
if (userId.equals(createBy)) {
|
if (username.equals(createBy)) {
|
||||||
map.put(FieldCommon.EDIT_FLAG, true);
|
map.put(FieldCommon.EDIT_FLAG, true);
|
||||||
} else {
|
} else {
|
||||||
map.put(FieldCommon.EDIT_FLAG, false);
|
map.put(FieldCommon.EDIT_FLAG, false);
|
||||||
@@ -245,18 +246,27 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl<Enterpris
|
|||||||
if (StringUtils.isBlank(ids)) {
|
if (StringUtils.isBlank(ids)) {
|
||||||
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "ids不能为空");
|
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "ids不能为空");
|
||||||
}
|
}
|
||||||
|
List<String> idList = Arrays.asList(ids.split(","));
|
||||||
// 管理员有所有权限
|
// 管理员有所有权限
|
||||||
SysUser currentUser = sysUserService.getById(userId);
|
SysUser currentUser = sysUserService.getById(userId);
|
||||||
|
String username = currentUser.getUsername();
|
||||||
|
// 起草部门的人有所有权限
|
||||||
|
List<DepartIdModel> departIdModels = sysUserDepartService.queryDepartIdsOfUser(userId);
|
||||||
|
List<String> departNames = departIdModels.stream().map(DepartIdModel::getTitle).collect(Collectors.toList());
|
||||||
|
if (departNames.contains(draftDepartName)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当前用户的角色roleCode
|
// 获取当前用户的角色roleCode
|
||||||
List<String> roleList = sysUserRoleService.getRole(currentUser.getUsername());
|
List<String> roleList = sysUserRoleService.getRole(currentUser.getUsername());
|
||||||
if (roleList != null && roleList.contains(FieldCommon.ROLE_ADMIN)) {
|
if (roleList != null && roleList.contains(FieldCommon.ROLE_ADMIN)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 创建人可以删除
|
// 创建人可以删除
|
||||||
List<LawsEnterpriseStandard> list = enterpriseStandardService.list(new LambdaQueryWrapper<LawsEnterpriseStandard>().in(LawsEnterpriseStandard::getId, ids));
|
List<LawsEnterpriseStandard> list = enterpriseStandardService.list(new LambdaQueryWrapper<LawsEnterpriseStandard>().in(LawsEnterpriseStandard::getId, idList));
|
||||||
// 如果不是创建人,则直接返回false
|
// 如果不是创建人,则直接返回false
|
||||||
for (LawsEnterpriseStandard es : list) {
|
for (LawsEnterpriseStandard es : list) {
|
||||||
if (!es.getCreateBy().equals(userId)) {
|
if (!es.getCreateBy().equals(username)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user