diff --git a/src/main/java/com/tenlion/twoduty/controller/api/indexaudit/IndexAuditController.java b/src/main/java/com/tenlion/twoduty/controller/api/indexaudit/IndexAuditController.java index 0a31c9f..d526bcd 100644 --- a/src/main/java/com/tenlion/twoduty/controller/api/indexaudit/IndexAuditController.java +++ b/src/main/java/com/tenlion/twoduty/controller/api/indexaudit/IndexAuditController.java @@ -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 count() { +// Map params = requestParams(); +// return new SuccessResultData<>(indexAuditService.count(params)); +// } + + + @ApiOperation(value = "指标审核表统计(分权限统计)", notes = "指标审核表统计") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @GetMapping("count") - SuccessResultData count() { + @GetMapping("count-auth") + public Map countAuth() { Map params = requestParams(); - return new SuccessResultData<>(indexAuditService.count(params)); + return indexAuditService.countAuditIndex(params); } + } \ No newline at end of file diff --git a/src/main/java/com/tenlion/twoduty/controller/route/indexWebController.java b/src/main/java/com/tenlion/twoduty/controller/route/indexWebController.java index 4b10c17..bfee282 100644 --- a/src/main/java/com/tenlion/twoduty/controller/route/indexWebController.java +++ b/src/main/java/com/tenlion/twoduty/controller/route/indexWebController.java @@ -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 initWebButton(UserInfoBO currentUser){ - List list = new ArrayList<>(); - List 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 departments = currentUser.getDepartments(); diff --git a/src/main/java/com/tenlion/twoduty/pojo/dtos/indexaudit/IndexAuditDTO.java b/src/main/java/com/tenlion/twoduty/pojo/dtos/indexaudit/IndexAuditDTO.java index 44ef2d1..42fbe83 100644 --- a/src/main/java/com/tenlion/twoduty/pojo/dtos/indexaudit/IndexAuditDTO.java +++ b/src/main/java/com/tenlion/twoduty/pojo/dtos/indexaudit/IndexAuditDTO.java @@ -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 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 getButtonIsShow() { + return buttonIsShow; + } + + public void setButtonIsShow(List buttonIsShow) { + this.buttonIsShow = buttonIsShow; + } } diff --git a/src/main/java/com/tenlion/twoduty/service/indexaudit/IIndexAuditService.java b/src/main/java/com/tenlion/twoduty/service/indexaudit/IIndexAuditService.java index 67c5b40..68e3fe9 100644 --- a/src/main/java/com/tenlion/twoduty/service/indexaudit/IIndexAuditService.java +++ b/src/main/java/com/tenlion/twoduty/service/indexaudit/IIndexAuditService.java @@ -20,6 +20,13 @@ import java.util.Map; **/ public interface IIndexAuditService { + /** + * 指标审核统计 + * @param params + * @return + */ + Map countAuditIndex(Map params); + /** * 审核接口 * @param token diff --git a/src/main/java/com/tenlion/twoduty/service/indexaudit/impl/IndexAuditServiceImpl.java b/src/main/java/com/tenlion/twoduty/service/indexaudit/impl/IndexAuditServiceImpl.java index 845e72d..4b1d1db 100644 --- a/src/main/java/com/tenlion/twoduty/service/indexaudit/impl/IndexAuditServiceImpl.java +++ b/src/main/java/com/tenlion/twoduty/service/indexaudit/impl/IndexAuditServiceImpl.java @@ -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 list(Map params) { - return indexAuditDao.list(params); + this.setAuth(params); + this.setIndexLib(params); + List buttonList = this.setButton(); + List 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 params){ + Object departmentId = params.get("departmentId"); + UserInfoBO currentUser = securityComponent.getCurrentUser(); + List roles = currentUser.getRoles(); + for (RolePO role : roles) { + if(ROLE_CODE_1.equals(role.getRoleCode())){ + if(departmentId != null && !StringUtils.isBlank(departmentId.toString())){ + List strings = departmentUserService.listUserId(departmentId.toString()); + params.put("creators",strings); + } + break; + } + if(ROLE_CODE_2.equals(role.getRoleCode())){ + List list = new ArrayList<>(1); + list.add(currentUser.getUserId()); + params.put("creators",list); + break; + } + } + } + + public List setButton(){ + List list = new ArrayList<>(6); + UserInfoBO currentUser = securityComponent.getCurrentUser(); + List 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 params){ + List list = new ArrayList<>(); + List webIndexLibId = indexLibService.getWebIndexLibId(params.get("indexLibIdParentId").toString()); + for (IndexLibDTO indexLibDTO : webIndexLibId) { + list.add(indexLibDTO.getIndexLibId()); + } + params.put("indexLibIds",list); + } + + + public Map countAuditIndex(Map params){ + Map 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; + } + } \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/indexaudit/index-audit-mapper.xml b/src/main/resources/mybatis/mapper/indexaudit/index-audit-mapper.xml index 0901864..0e46331 100644 --- a/src/main/resources/mybatis/mapper/indexaudit/index-audit-mapper.xml +++ b/src/main/resources/mybatis/mapper/indexaudit/index-audit-mapper.xml @@ -226,11 +226,11 @@ #{indexLibIds[${index}]} - + AND - t1.index_audit_id IN - - #{indexAuditIds[${index}]} + t1.creator IN + + #{creators[${index}]} diff --git a/src/main/resources/static/route/indexaudit/list_1.html b/src/main/resources/static/route/indexaudit/list_1.html index a0d9d15..fdbd6d5 100644 --- a/src/main/resources/static/route/indexaudit/list_1.html +++ b/src/main/resources/static/route/indexaudit/list_1.html @@ -127,8 +127,11 @@ }, {field: 'cz', width: 140, title: '操作', align:'center',fixed: 'right', templet: function(row) { + var buttonIsShow = row['buttonIsShow'] var rowData = '
'; - rowData +=''; + if(buttonIsShow.indexOf("1") > -1){ + rowData +=''; + } rowData +=''; rowData +=''; rowData +='
'; diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 0e1c659..dcde989 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -190,7 +190,7 @@ - +