web页面权限分配

This commit is contained in:
ly19960718 2021-06-17 17:10:45 +08:00
parent a9bf47642a
commit 7b70ad1521
4 changed files with 51 additions and 3 deletions

View File

@ -159,7 +159,12 @@ public class IndexAuditController extends DefaultBaseController {
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String") @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "indexAuditStatus", value = "审核状态", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "departmentId", value = "单位ID,为单位", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "indexLibIdParentId", value = "指标分类ID", paramType = "query", dataType = "String"),
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage") @GetMapping("listpage")

View File

@ -86,7 +86,6 @@ public class indexWebController extends DefaultBaseController {
params.put("userName",currentUser.getUserName()); params.put("userName",currentUser.getUserName());
params.put("userUserName",currentUser.getUserUsername()); params.put("userUserName",currentUser.getUserUsername());
params.put("departmentId",this.initDepartmentId(currentUser)); params.put("departmentId",this.initDepartmentId(currentUser));
params.put("initButton",this.initWebButton(currentUser));
return params; return params;
} }

View File

@ -4,6 +4,8 @@ import com.tenlion.twoduty.pojo.dtos.indextemplate.IndexTemplateDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/** /**
* *
* @ClassName: IndexLibDTO * @ClassName: IndexLibDTO
@ -41,6 +43,8 @@ public class IndexLibDTO {
private String indexTemplateListPath; private String indexTemplateListPath;
@ApiModelProperty(name = "indexTemplateShowPath", value = "查看路径") @ApiModelProperty(name = "indexTemplateShowPath", value = "查看路径")
private String indexTemplateShowPath; private String indexTemplateShowPath;
@ApiModelProperty(name = "initButton", value = "初始化按钮参数 1上报 2查看列表")
private List<String> initButton;
@ -147,4 +151,13 @@ public class IndexLibDTO {
public void setIndexTemplateShowPath(String indexTemplateShowPath) { public void setIndexTemplateShowPath(String indexTemplateShowPath) {
this.indexTemplateShowPath = indexTemplateShowPath; this.indexTemplateShowPath = indexTemplateShowPath;
} }
public List<String> getInitButton() {
return initButton;
}
public void setInitButton(List<String> initButton) {
this.initButton = initButton;
}
} }

View File

@ -8,6 +8,8 @@ import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.common.component.SecurityComponent; import ink.wgink.common.component.SecurityComponent;
import ink.wgink.exceptions.ParamsException; import ink.wgink.exceptions.ParamsException;
import ink.wgink.pojo.ListPage; import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.bos.UserInfoBO;
import ink.wgink.pojo.pos.RolePO;
import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.map.HashMapUtil; import ink.wgink.util.map.HashMapUtil;
@ -44,6 +46,15 @@ public class IndexLibServiceImpl extends DefaultBaseService implements IIndexLib
@Autowired @Autowired
private SecurityComponent securityComponent; private SecurityComponent securityComponent;
/**
* 市局角色
*/
private final static String ROLE_CODE_1 ="0001";
/**
* 旗县角色
*/
private final static String ROLE_CODE_2 ="0002";
/** /**
* 获取web显示的指标 * 获取web显示的指标
* @param indexLibParentId * @param indexLibParentId
@ -256,7 +267,12 @@ public class IndexLibServiceImpl extends DefaultBaseService implements IIndexLib
@Override @Override
public List<IndexLibDTO> list(Map<String, Object> params) { public List<IndexLibDTO> list(Map<String, Object> params) {
return indexLibDao.list(params); List<IndexLibDTO> list = indexLibDao.list(params);
List<String> button = this.initWebButton();
for (IndexLibDTO indexLibDTO : list) {
indexLibDTO.setInitButton(button);
}
return list;
} }
@Override @Override
@ -291,4 +307,19 @@ public class IndexLibServiceImpl extends DefaultBaseService implements IIndexLib
return count == null ? 0 : count; return count == null ? 0 : count;
} }
public List<String> initWebButton(){
List<String> list = new ArrayList<>();
List<RolePO> roles = securityComponent.getCurrentUser().getRoles();
if(roles.size() == 0){
return list;
}
for (RolePO role : roles) {
if(ROLE_CODE_2.equals(role.getRoleCode())){
list.add("1");
list.add("2");
}
}
return list;
}
} }