Commit 707d52a5 authored by tianbo's avatar tianbo

隐患数据权限修改

parent a0a5554a
...@@ -55,6 +55,8 @@ public class PermissionInterceptor implements Interceptor { ...@@ -55,6 +55,8 @@ public class PermissionInterceptor implements Interceptor {
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
private String falseCondition = " 1=2";
@Override @Override
public Object intercept(Invocation invocation) throws Throwable { public Object intercept(Invocation invocation) throws Throwable {
StatementHandler statementHandler = PluginUtils.realTarget(invocation.getTarget()); StatementHandler statementHandler = PluginUtils.realTarget(invocation.getTarget());
...@@ -190,7 +192,7 @@ public class PermissionInterceptor implements Interceptor { ...@@ -190,7 +192,7 @@ public class PermissionInterceptor implements Interceptor {
dataAuthorization.entrySet().stream().filter(map -> !ValidationUtil.isEmpty(map.getValue())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); dataAuthorization.entrySet().stream().filter(map -> !ValidationUtil.isEmpty(map.getValue())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
// 没有配置数据权限直接返回 false 条件 // 没有配置数据权限直接返回 false 条件
if (ValidationUtil.isEmpty(nonEmptyDataAuthorization)) { if (ValidationUtil.isEmpty(nonEmptyDataAuthorization)) {
authSql = " 1=2"; authSql = falseCondition;
} else { } else {
// 解析数据权限sql // 解析数据权限sql
authSql = parseDataAuthorization(nonEmptyDataAuthorization, reginParams, mainTableAlias, boundSql); authSql = parseDataAuthorization(nonEmptyDataAuthorization, reginParams, mainTableAlias, boundSql);
...@@ -302,7 +304,8 @@ public class PermissionInterceptor implements Interceptor { ...@@ -302,7 +304,8 @@ public class PermissionInterceptor implements Interceptor {
getRuleValue(rule, reginParam, boundSql)) + "'"; getRuleValue(rule, reginParam, boundSql)) + "'";
} else { } else {
// 包含 // 包含
authSql = mainTableAlias + "." + rule.getRuleColumn() + " like '" + getRuleValue(rule, reginParam, boundSql) + "'"; authSql = mainTableAlias + "." + rule.getRuleColumn() + " like '%" + getRuleValue(rule,
reginParam, boundSql) + "%'";
} }
} else { } else {
// =; >; >=; <; <=; != // =; >; >=; <; <=; !=
...@@ -336,6 +339,26 @@ public class PermissionInterceptor implements Interceptor { ...@@ -336,6 +339,26 @@ public class PermissionInterceptor implements Interceptor {
String attrName = ruleValue.substring(2, ruleValue.length() - 1); String attrName = ruleValue.substring(2, ruleValue.length() - 1);
ruleValue = ValidationUtil.isEmpty(map.get(attrName)) ? "" : map.get(attrName).toString(); ruleValue = ValidationUtil.isEmpty(map.get(attrName)) ? "" : map.get(attrName).toString();
} }
// 从查询参数中获取json字段参数值
if (rule.getRuleColumn().contains("->")) {
Map<String, Object> map;
Map<String, Object> map2 = Maps.newHashMap();
if (boundSql.getParameterObject() instanceof Map) {
map = (Map<String, Object>) boundSql.getParameterObject();
for(Map.Entry<String, Object> entry : map.entrySet()) {
if (entry.getValue() instanceof Map) {
map2.putAll((Map<? extends String, ?>) entry.getValue());
}
}
map.putAll(map2);
} else {
map = Bean.BeantoMap(boundSql.getParameterObject());
}
if(map.containsKey(ruleValue)) {
ruleValue = ValidationUtil.isEmpty(map.get(ruleValue)) ? falseCondition : map.get(ruleValue).toString();
}
}
return ruleValue; return ruleValue;
} }
} }
...@@ -1917,10 +1917,11 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1917,10 +1917,11 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
pageParam.put("leadPeopleId", jcsUserId); pageParam.put("leadPeopleId", jcsUserId);
// 登录人为整改责任人 // 登录人为整改责任人
pageParam.put("reformLeaderId", jcsUserId); pageParam.put("reformLeaderId", jcsUserId);
// 登录人单位
pageParam.put("bizOrgCode", person.get("bizOrgCode").toString().substring(0, 6));
} }
} }
Page page = new Page(pageParam.getParamPageCurrent(), pageParam.getParamPageSize()); Page page = new Page(pageParam.getParamPageCurrent(), pageParam.getParamPageSize());
IPage<LatentDanger> iPage = this.baseMapper.selectPageByParam(page, (Map<String, Object>) pageParam); IPage<LatentDanger> iPage = this.baseMapper.selectPageByParam(page, (Map<String, Object>) pageParam);
if (iPage.getCurrent() != pageParam.getParamPageCurrent()) { if (iPage.getCurrent() != pageParam.getParamPageCurrent()) {
......
...@@ -288,13 +288,17 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService { ...@@ -288,13 +288,17 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
result.put("bizId", hiddenDangerDto.getCheckInputId()); result.put("bizId", hiddenDangerDto.getCheckInputId());
result.put("bizName", hiddenDangerDto.getInputItemName()); result.put("bizName", hiddenDangerDto.getInputItemName());
result.put("routeId", plan.getRouteId()); result.put("routeId", plan.getRouteId());
result.put("accompanyingUserId", plan.getLeadPeopleIds()); result.put("accompanyingUserId", plan.getLeadPeopleIds()); // 检查陪同人id
result.put("accompanyingUserName", plan.getLeadPeopleNames()); result.put("accompanyingUserName", plan.getLeadPeopleNames()); // 检查陪同人名称
result.put("checkUnitId",plan.getCheckUnitId()); result.put("checkUnitId",plan.getCheckUnitId());
result.put("checkUnitName",plan.getCheckUnitName()); result.put("checkUnitName",plan.getCheckUnitName());
result.put("leadPeopleId", plan.getLeadPeopleIds()); result.put("leadPeopleId", plan.getLeadPeopleIds()); // 牵头人id
result.put("leadPeopleName", plan.getLeadPeopleNames()); result.put("leadPeopleName", plan.getLeadPeopleNames()); // 牵头人名称
// TODO tb 将机场单位bizOrgCode保存起来用于数据过滤 result.put("makerUserId", plan.getMakerUserId()); // 计划制定人id
result.put("makerUserName", plan.getMakerUserName()); // 计划制定人名称
result.put("userId", plan.getUserId()); // 检查参与人id
result.put("userIdName", plan.getUserName()); // 检查参与人名称
// 将机场单位bizOrgCode保存起来用于按机场单位数据过滤
FeignClientResult<Map<String, Object>> companyResult = jcsFeignClient.getCompanyById(point.getOriginalId()); FeignClientResult<Map<String, Object>> companyResult = jcsFeignClient.getCompanyById(point.getOriginalId());
if (!ValidationUtil.isEmpty(companyResult)) { if (!ValidationUtil.isEmpty(companyResult)) {
result.put("bizOrgCode", companyResult.getResult().get("bizOrgCode")); result.put("bizOrgCode", companyResult.getResult().get("bizOrgCode"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment