web页面权限分配

This commit is contained in:
ly19960718 2021-06-18 10:21:24 +08:00
parent c33f2f5737
commit a04dc526b2
8 changed files with 135 additions and 27 deletions

View File

@ -174,12 +174,22 @@ public class IndexAuditController extends DefaultBaseController {
return indexAuditService.listPage(page);
}
@ApiOperation(value = "指标审核表统计", notes = "指标审核表统计接口")
// @ApiOperation(value = "指标审核表统计", notes = "指标审核表统计接口")
// @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
// @GetMapping("count")
// SuccessResultData<Integer> count() {
// Map<String, Object> params = requestParams();
// return new SuccessResultData<>(indexAuditService.count(params));
// }
@ApiOperation(value = "指标审核表统计(分权限统计)", notes = "指标审核表统计")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("count")
SuccessResultData<Integer> count() {
@GetMapping("count-auth")
public Map<String,Object> countAuth() {
Map<String, Object> params = requestParams();
return new SuccessResultData<>(indexAuditService.count(params));
return indexAuditService.countAuditIndex(params);
}
}

View File

@ -53,6 +53,7 @@ public class indexWebController extends DefaultBaseController {
ModelAndView mv = new ModelAndView("index");
mv.addObject("systemTitle",serverProperties.getSystemTitle());
mv.addObject("userParams",this.initUserParams());
mv.addObject("departmentId","");
return mv;
}
@ -85,28 +86,12 @@ public class indexWebController extends DefaultBaseController {
UserInfoBO currentUser = securityComponent.getCurrentUser();
params.put("userName",currentUser.getUserName());
params.put("userUserName",currentUser.getUserUsername());
params.put("departmentId",this.initDepartmentId(currentUser));
return params;
}
public List<String> initWebButton(UserInfoBO currentUser){
List<String> list = new ArrayList<>();
List<RolePO> roles = currentUser.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;
}
public String initDepartmentId(UserInfoBO currentUser){
List<DepartmentPO> departments = currentUser.getDepartments();

View File

@ -3,6 +3,8 @@ package com.tenlion.twoduty.pojo.dtos.indexaudit;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
*
* @ClassName: IndexAuditDTO
@ -33,6 +35,10 @@ public class IndexAuditDTO {
@ApiModelProperty(name = "gmtCreate", value = "上报时间")
private String gmtCreate;
@ApiModelProperty(name = "显示按钮", value = "显示按钮")
private List<String> buttonIsShow;
public String getIndexAuditId() {
return indexAuditId == null ? "" : indexAuditId.trim();
}
@ -105,4 +111,12 @@ public class IndexAuditDTO {
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public List<String> getButtonIsShow() {
return buttonIsShow;
}
public void setButtonIsShow(List<String> buttonIsShow) {
this.buttonIsShow = buttonIsShow;
}
}

View File

@ -20,6 +20,13 @@ import java.util.Map;
**/
public interface IIndexAuditService {
/**
* 指标审核统计
* @param params
* @return
*/
Map<String,Object> countAuditIndex(Map<String,Object> params);
/**
* 审核接口
* @param token

View File

@ -1,13 +1,18 @@
package com.tenlion.twoduty.service.indexaudit.impl;
import com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibDTO;
import com.tenlion.twoduty.pojo.vos.indexaudit.AuditVO;
import com.tenlion.twoduty.pojo.vos.indexauditlog.IndexAuditLogVO;
import com.tenlion.twoduty.service.indexauditlog.IIndexAuditLogService;
import com.tenlion.twoduty.service.indexlib.IIndexLibService;
import com.tenlion.twoduty.utils.AuditStatusEnum;
import ink.wgink.common.base.DefaultBaseService;
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.SuccessResultList;
import ink.wgink.service.department.service.IDepartmentUserService;
import ink.wgink.util.map.HashMapUtil;
import ink.wgink.util.UUIDUtil;
import com.tenlion.twoduty.dao.indexaudit.IIndexAuditDao;
@ -39,6 +44,19 @@ public class IndexAuditServiceImpl extends DefaultBaseService implements IIndexA
@Autowired
private IIndexAuditLogService iIndexAuditLogService;
@Autowired
private IDepartmentUserService departmentUserService;
@Autowired
private IIndexLibService indexLibService;
/**
* 市局角色
*/
private final static String ROLE_CODE_1 ="0001";
/**
* 旗县角色
*/
private final static String ROLE_CODE_2 ="0002";
@ -179,7 +197,14 @@ public class IndexAuditServiceImpl extends DefaultBaseService implements IIndexA
@Override
public List<IndexAuditDTO> list(Map<String, Object> params) {
return indexAuditDao.list(params);
this.setAuth(params);
this.setIndexLib(params);
List<String> buttonList = this.setButton();
List<IndexAuditDTO> list = indexAuditDao.list(params);
for (IndexAuditDTO indexAuditDTO : list) {
indexAuditDTO.setButtonIsShow(buttonList);
}
return list;
}
@Override
@ -215,5 +240,69 @@ public class IndexAuditServiceImpl extends DefaultBaseService implements IIndexA
iIndexAuditLogService.save(indexAuditLogVO);
}
public void setAuth(Map<String,Object> params){
Object departmentId = params.get("departmentId");
UserInfoBO currentUser = securityComponent.getCurrentUser();
List<RolePO> roles = currentUser.getRoles();
for (RolePO role : roles) {
if(ROLE_CODE_1.equals(role.getRoleCode())){
if(departmentId != null && !StringUtils.isBlank(departmentId.toString())){
List<String> strings = departmentUserService.listUserId(departmentId.toString());
params.put("creators",strings);
}
break;
}
if(ROLE_CODE_2.equals(role.getRoleCode())){
List<String> list = new ArrayList<>(1);
list.add(currentUser.getUserId());
params.put("creators",list);
break;
}
}
}
public List<String> setButton(){
List<String> list = new ArrayList<>(6);
UserInfoBO currentUser = securityComponent.getCurrentUser();
List<RolePO> roles = currentUser.getRoles();
for (RolePO role : roles) {
if(ROLE_CODE_1.equals(role.getRoleCode())){
list.add("1");
break;
}
if(ROLE_CODE_2.equals(role.getRoleCode())){
break;
}
}
return list;
}
public void setIndexLib(Map<String,Object> params){
List<String> list = new ArrayList<>();
List<IndexLibDTO> webIndexLibId = indexLibService.getWebIndexLibId(params.get("indexLibIdParentId").toString());
for (IndexLibDTO indexLibDTO : webIndexLibId) {
list.add(indexLibDTO.getIndexLibId());
}
params.put("indexLibIds",list);
}
public Map<String,Object> countAuditIndex(Map<String,Object> params){
Map<String,Object> result = new HashMap<>(4);
this.setIndexLib(params);
this.setAuth(params);
params.put("indexAuditStatus","0");
result.put("checkPendingNum",this.count(params));
params.put("indexAuditStatus","1");
result.put("checkPassNum",this.count(params));
params.put("indexAuditStatus","2");
result.put("checkArchivesNum",this.count(params));
params.put("indexAuditStatus","-1");
result.put("checkNoPassNum",this.count(params));
return result;
}
}

View File

@ -226,11 +226,11 @@
#{indexLibIds[${index}]}
</foreach>
</if>
<if test="indexAuditIds != null and indexAuditIds.size > 0">
<if test="creators != null and creators.size > 0">
AND
t1.index_audit_id IN
<foreach collection="indexAuditIds" index="index" open="(" separator="," close=")">
#{indexAuditIds[${index}]}
t1.creator IN
<foreach collection="creators" index="index" open="(" separator="," close=")">
#{creators[${index}]}
</foreach>
</if>
</select>

View File

@ -127,8 +127,11 @@
},
{field: 'cz', width: 140, title: '操作', align:'center',fixed: 'right',
templet: function(row) {
var buttonIsShow = row['buttonIsShow']
var rowData = '<div class="layui-btn-group">';
if(buttonIsShow.indexOf("1") > -1){
rowData +='<button type="button" class="layui-btn layui-btn-xs" lay-event="audit">审核</button>';
}
rowData +='<button type="button" class="layui-btn layui-btn-xs" lay-event="log">日志</button>';
rowData +='<button type="button" class="layui-btn layui-btn-xs" lay-event="show">详情</button>';
rowData +='</div>';

View File

@ -190,7 +190,7 @@
<div class="footer">
<!-- 版权所有:杭锦旗纪委监察局 备案号蒙ICP备 14000612 技术支持内蒙古成迈信息科技有限公司0471-5316868-->
</div>
<input type="hidden" th:value="${userParams.departmentId}" class="hide-input">
<!--<input type="hidden" th:value="${userParams.departmentId}" class="hide-input">-->
</div>
<script src="assets/web/js/jquery-2.1.4.min.js"></script>
<script src="assets/web/js/jquery.SuperSlide.2.1.1.js"></script>