提交 03d34bd2 编写于 作者: zhouweidong's avatar zhouweidong

bug fixed

上级 d7836032
......@@ -75,19 +75,19 @@ public class PermissionFeignService {
if(map!=null){
permissionService.execute(sql,param);
}
List<SYS_PSDEOPPRIV> opprivList=new ArrayList<>();//数据能力
List<SYS_PSDEOPPRIV> datarange_list=new ArrayList<>();//数据能力
List<SYS_PERMISSION> permission_list=new ArrayList<>();//资源
List<SYS_PSSYSUNIRES> unires_list=new ArrayList<>();//统一资源
List<SYS_PSAPPMENUITEM> menu_list=new ArrayList<>();//资源-菜单项集合
if(map.containsKey("permission")){
JSONObject paramsObj = new JSONObject(map);
JSONObject capabilityPermissionObj = paramsObj.getJSONObject("permission");
parseDECapability(capabilityPermissionObj,systemId,permission_list,opprivList);
parseUniRes(capabilityPermissionObj,systemId,permission_list,unires_list);
parseAppMenus(capabilityPermissionObj,systemId,permission_list,menu_list);
JSONObject permissionObj = paramsObj.getJSONObject("permission");
parseDataRange(permissionObj,systemId,permission_list,datarange_list);
parseUniRes(permissionObj,systemId,permission_list,unires_list);
parseAppMenus(permissionObj,systemId,permission_list,menu_list);
}
if(opprivList.size()>0){
opprivService.saveOrUpdateBatch(opprivList);//批量保存数据能力
if(datarange_list.size()>0){
opprivService.saveOrUpdateBatch(datarange_list);//批量保存数据能力
}
if(unires_list.size()>0){
pssysuniresService.saveOrUpdateBatch(unires_list);//批量保存统一资源
......@@ -250,44 +250,44 @@ public class PermissionFeignService {
* @param sysPermission
* @param opprivPermission
*/
public void parseDECapability(JSONObject permission, String systemId, List<SYS_PERMISSION> sysPermission, List<SYS_PSDEOPPRIV> opprivPermission){
public void parseDataRange(JSONObject permission, String systemId, List<SYS_PERMISSION> sysPermission, List<SYS_PSDEOPPRIV> opprivPermission){
JSONArray preDefinedDataRange=permission.getJSONArray("predefineddatarange");
JSONArray entities=permission.getJSONArray("entities");
for(int a=0;a<entities.size();a++){
JSONObject entity=entities.getJSONObject(a);
JSONArray dataSetArray=entity.getJSONArray("dedataset");
JSONArray deActionArray=entity.getJSONArray("deaction");
createDataRange(dataSetArray,preDefinedDataRange,entity,DataSetTag,systemId,sysPermission,opprivPermission);//存储数据集
createDataRange(deActionArray,preDefinedDataRange,entity,DEActionType,systemId,sysPermission,opprivPermission);//存储实体行为
JSONArray dataScope=entity.getJSONArray("datascope");
createDataScope(dataSetArray,dataScope,entity,DataSetTag,systemId,sysPermission,opprivPermission);//存储数据集
createDataScope(deActionArray,dataScope,entity,DEActionType,systemId,sysPermission,opprivPermission);//存储实体行为
}
}
/**
* 根据实体行为或数据集合结合预定于数据类型生成数据范围
* @param deActionArray
* @param preDefinedDataRange
* @param dataScopeArray
* @param entity
* @param permissionType
* @param systemId
* @param ability_list
* @param opprivList
*/
private void createDataRange(JSONArray deActionArray , JSONArray preDefinedDataRange, JSONObject entity , String permissionType, String systemId , List<SYS_PERMISSION> ability_list, List<SYS_PSDEOPPRIV> opprivList){
private void createDataScope(JSONArray deActionArray , JSONArray dataScopeArray, JSONObject entity , String permissionType, String systemId , List<SYS_PERMISSION> ability_list, List<SYS_PSDEOPPRIV> opprivList){
for(int b=0;b<deActionArray.size();b++) {
JSONObject deSource = deActionArray.getJSONObject(b);
String deActionType=deSource.getString("type");
//数据查询与自定义行为不生成预置范围相关数据
if( (permissionType.equalsIgnoreCase(DEActionType) && !deActionType.equalsIgnoreCase("BUILTIN")) || (permissionType.equalsIgnoreCase(DataSetTag)) ) {
JSONObject dataRange =new JSONObject();
createDataRange(entity,deSource,dataRange,permissionType,systemId,ability_list,opprivList);
JSONObject dataScope =new JSONObject();
createDataScope(entity,deSource,dataScope,permissionType,systemId,ability_list,opprivList);
}
else{
for(int c=0;c<preDefinedDataRange.size();c++){
JSONObject dataRange =preDefinedDataRange.getJSONObject(c);
createDataRange(entity,deSource,dataRange,permissionType,systemId,ability_list,opprivList);//实体预置行为及数据集
for(int c=0;c<dataScopeArray.size();c++){
JSONObject dataScope =dataScopeArray.getJSONObject(c);
createDataScope(entity,deSource,dataScope,permissionType,systemId,ability_list,opprivList);//实体预置行为及数据集
}
}
}
......@@ -297,13 +297,13 @@ public class PermissionFeignService {
* 根据实体行为或数据集合结合预定于数据类型生成数据范围
* @param entity
* @param source
* @param dataRange
* @param dataScope
* @param permissionType
* @param systemId
* @param ability_list
* @param opprivList
*/
private void createDataRange(JSONObject entity, JSONObject source , JSONObject dataRange, String permissionType, String systemId , List<SYS_PERMISSION> ability_list, List<SYS_PSDEOPPRIV> opprivList) {
private void createDataScope(JSONObject entity, JSONObject source , JSONObject dataScope, String permissionType, String systemId , List<SYS_PERMISSION> ability_list, List<SYS_PSDEOPPRIV> opprivList) {
String deName=entity.getString("dename");
String deLogicName=entity.getString("delogicname");
......@@ -312,10 +312,10 @@ public class PermissionFeignService {
String moduleName=module.getString("name");
String sourceId=source.getString("id");
String sourceName=source.getString("name");
String dataRangeId=dataRange.getString("id");
String dataRangeName=dataRange.getString("name");
String dataRangeId=dataScope.getString("id");
String dataRangeName=dataScope.getString("name");
String permissionId= DigestUtils.md5DigestAsHex(String.format("%s%s%s%s%s",systemId,moduleId,deName,sourceId,dataRangeId).getBytes());
String permissionId= DigestUtils.md5DigestAsHex(String.format("%s%s%s%s",systemId,deName,sourceId,dataRangeId).getBytes());
String permissionName;
if(!StringUtils.isEmpty(dataRangeName)){
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册