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

格式化

上级 3c47f7fa
......@@ -10,7 +10,6 @@ TARGET=PSDESERVICEAPI
<#assign itemCodeNameLC = itemCodeName?lower_case>
<#assign deCodeName = de.getCodeName()>
<#assign deCodeNameLC = deCodeName?lower_case>
<#assign dePKCodeNameLC = srfcaseformat(de.getKeyPSDEField().getCodeName(),'l_u2lC')>
<#assign dePKCodeName = (dePKCodeNameLC)?cap_first>
<#assign deModelCodeNameLC = de.getPSSystemModule().getCodeName()?lower_case>
......@@ -31,10 +30,8 @@ import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
......@@ -49,20 +46,15 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import ${pubPkgCodeName}.${itemSysApiCodeNameLC}.dto.*;
import ${pubPkgCodeName}.${itemSysApiCodeNameLC}.mapping.*;
import ${pubPkgCodeName}.core.${deModelCodeNameLC}.domain.${deCodeName};
import ${pubPkgCodeName}.core.${deModelCodeNameLC}.service.I${deCodeName}Service;
import ${pubPkgCodeName}.core.${deModelCodeNameLC}.filter.${deCodeName}SearchContext;
<#if item.getPSDEServiceAPIRSs()??>
<#list item.getPSDEServiceAPIRSs() as apider>
<#assign deapide=apider.getMinorPSDEServiceAPI().getPSDataEntity()>
......@@ -254,11 +246,7 @@ public class ${itemCodeName}Resource {
}
<#elseif deaction.codeName?lower_case == 'checkkey'>
<#if noDEPrefield>
<@outputHasAnyAuthorityAnnotation '${sys.codeName}-${de.codeName}-${deaction.codeName}-all'/>
<#else>
@PreAuthorize("hasPermission('','checkkey',{'${deStorageMode}',this.${itemCodeNameLC}Mapping,#${itemCodeNameLC}dto})")
</#if>
@ApiOperation(value = "${deaction.getLogicName()}", tags = {"${itemCodeName}" }, notes = "${deaction.getLogicName()}")
@RequestMapping(method = RequestMethod.${reqMtd}, value = "${fullPath}/${deactionCodeName?lower_case}")
public ResponseEntity<Boolean> checkKey(${etParams}) {
......
......@@ -120,43 +120,6 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
}
/**
* save校验
* @param deStorageMode
* @param entityList
* @param dataRangeList
* @return
*/
private boolean saveBatchActionPermissionValid(String deStorageMode, List<EntityBase> entityList, JSONArray dataRangeList) {
if(entityList==null || entityList.size()==0)
return false;
EntityBase tempEntity=entityList.get(0);
Map<String,String> permissionField=getPermissionField(tempEntity);
String keyFieldName=permissionField.get(keyFieldTag);
List createList=new ArrayList();
List<String> updateList =new ArrayList();
for(EntityBase entity : entityList){
Object id = entity.get(keyFieldName);
if(ObjectUtils.isEmpty(id))
createList.add(entity);
else
updateList.add(String.valueOf(id));
}
if(updateList.size()>0){
boolean isUpdate = otherBatchActionPermissionValidRouter(deStorageMode, tempEntity ,updateList, dataRangeList);
if(!isUpdate)
return false;
}
if(createList.size()>0){
boolean isCreate=createBatchActionPermissionValid(entityList,dataRangeList);
if(!isCreate)
return false;
}
return true;
}
/**
* 实体行为权限检查 :用于检查当前用户是否拥有实体的新建、编辑、删除权限
*
......@@ -217,6 +180,43 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
}
/**
* save校验
* @param deStorageMode
* @param entityList
* @param dataRangeList
* @return
*/
private boolean saveBatchActionPermissionValid(String deStorageMode, List<EntityBase> entityList, JSONArray dataRangeList) {
if(entityList==null || entityList.size()==0)
return false;
EntityBase tempEntity=entityList.get(0);
Map<String,String> permissionField=getPermissionField(tempEntity);
String keyFieldName=permissionField.get(keyFieldTag);
List createList=new ArrayList();
List<String> updateList =new ArrayList();
for(EntityBase entity : entityList){
Object id = entity.get(keyFieldName);
if(ObjectUtils.isEmpty(id))
createList.add(entity);
else
updateList.add(String.valueOf(id));
}
if(updateList.size()>0){
boolean isUpdate = otherBatchActionPermissionValidRouter(deStorageMode, tempEntity ,updateList, dataRangeList);
if(!isUpdate)
return false;
}
if(createList.size()>0){
boolean isCreate=createBatchActionPermissionValid(entityList,dataRangeList);
if(!isCreate)
return false;
}
return true;
}
/**
* 批处理新建权限校验
* @param entityList
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册