Search in sources :

Example 6 with TbUserRole

use of com.netsteadfast.greenstep.po.hbm.TbUserRole in project bamboobsc by billchen198318.

the class ReportRoleViewLogicServiceImpl method findForEmployeeMap.

@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public Map<String, String> findForEmployeeMap(boolean pleaseSelect, String accountId) throws ServiceException, Exception {
    if (super.isBlank(accountId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    Map<String, String> dataMap = new LinkedHashMap<String, String>();
    if (pleaseSelect) {
        dataMap.put(Constants.HTML_SELECT_NO_SELECT_ID, Constants.HTML_SELECT_NO_SELECT_NAME);
    }
    List<TbUserRole> roles = this.getUserRoles(accountId);
    for (int i = 0; roles != null && i < roles.size(); i++) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("role", roles.get(i).getRole());
        paramMap.put("type", ReportRoleViewTypes.IS_EMPLOYEE);
        List<BbReportRoleView> views = this.reportRoleViewService.findListByParams(paramMap);
        for (int j = 0; views != null && j < views.size(); j++) {
            paramMap.clear();
            paramMap.put("account", views.get(j).getIdName());
            List<BbEmployee> employees = this.getEmployeeService().findListByParams(paramMap);
            for (int e = 0; employees != null && e < employees.size(); e++) {
                BbEmployee employee = employees.get(e);
                if (dataMap.get(employee.getOid()) != null) {
                    continue;
                }
                dataMap.put(employee.getOid(), employee.getFullName());
            }
        }
    }
    return dataMap;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) BbReportRoleView(com.netsteadfast.greenstep.po.hbm.BbReportRoleView) TbUserRole(com.netsteadfast.greenstep.po.hbm.TbUserRole) LinkedHashMap(java.util.LinkedHashMap) BbEmployee(com.netsteadfast.greenstep.po.hbm.BbEmployee) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)

Aggregations

TbUserRole (com.netsteadfast.greenstep.po.hbm.TbUserRole)6 HashMap (java.util.HashMap)6 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)3 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)3 BbReportRoleView (com.netsteadfast.greenstep.po.hbm.BbReportRoleView)3 LinkedHashMap (java.util.LinkedHashMap)3 TbRolePermission (com.netsteadfast.greenstep.po.hbm.TbRolePermission)2 SimpleAuthorizationInfo (org.apache.shiro.authz.SimpleAuthorizationInfo)2 BbEmployee (com.netsteadfast.greenstep.po.hbm.BbEmployee)1 BbOrganization (com.netsteadfast.greenstep.po.hbm.BbOrganization)1 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)1 ArrayList (java.util.ArrayList)1 Transactional (org.springframework.transaction.annotation.Transactional)1