use of com.netsteadfast.greenstep.po.hbm.BbReportRoleView in project bamboobsc by billchen198318.
the class ReportRoleViewLogicServiceImpl method findForOrganization.
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public List<BbOrganization> findForOrganization(String accountId) throws ServiceException, Exception {
if (super.isBlank(accountId)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
List<BbOrganization> searchList = new ArrayList<BbOrganization>();
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_ORGANIZATION);
List<BbReportRoleView> views = this.reportRoleViewService.findListByParams(paramMap);
for (int j = 0; views != null && j < views.size(); j++) {
BbOrganization organization = new BbOrganization();
organization.setOrgId(views.get(j).getIdName());
organization = this.getOrganizationService().findByEntityUK(organization);
if (organization == null) {
continue;
}
boolean isFound = false;
for (BbOrganization entity : searchList) {
if (entity.getOid().equals(organization.getOid())) {
isFound = true;
}
}
if (!isFound) {
searchList.add(organization);
}
}
}
return searchList;
}
use of com.netsteadfast.greenstep.po.hbm.BbReportRoleView in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method delete.
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(EmployeeVO employee) throws ServiceException, Exception {
if (employee == null || super.isBlank(employee.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
employee = this.findEmployeeData(employee.getOid());
AccountVO account = this.findAccountData(employee.getAccount());
if (this.isAdministrator(account.getAccount())) {
throw new ServiceException("Administrator cannot delete!");
}
// check account data for other table use.
this.checkInformationRelated(account, employee);
this.deleteEmployeeOrganization(employee);
// delete user role
Map<String, Object> params = new HashMap<String, Object>();
params.put("account", account.getAccount());
List<TbUserRole> userRoles = this.getUserRoleService().findListByParams(params);
for (int i = 0; userRoles != null && i < userRoles.size(); i++) {
TbUserRole uRole = userRoles.get(i);
this.getUserRoleService().delete(uRole);
}
// delete BB_REPORT_ROLE_VIEW
params.clear();
params.put("idName", account.getAccount());
List<BbReportRoleView> reportRoleViews = this.reportRoleViewService.findListByParams(params);
for (int i = 0; reportRoleViews != null && i < reportRoleViews.size(); i++) {
BbReportRoleView reportRoleView = reportRoleViews.get(i);
this.reportRoleViewService.delete(reportRoleView);
}
// delete from BB_MEASURE_DATA where EMP_ID = :empId
this.measureDataService.deleteForEmpId(employee.getEmpId());
this.monitorItemScoreService.deleteForEmpId(employee.getEmpId());
this.deleteHierarchy(employee);
this.getAccountService().deleteByPKng(account.getOid());
return getEmployeeService().deleteObject(employee);
}
use of com.netsteadfast.greenstep.po.hbm.BbReportRoleView in project bamboobsc by billchen198318.
the class OrganizationLogicServiceImpl method delete.
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(OrganizationVO organization) throws ServiceException, Exception {
if (organization == null || super.isBlank(organization.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
organization = this.findOrganizationData(organization.getOid());
if (this.foundChild(organization)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
}
Map<String, Object> params = new HashMap<String, Object>();
params.put("orgId", organization.getOrgId());
if (this.employeeOrgaService.countByParams(params) > 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
}
if (this.kpiOrgaService.countByParams(params) > 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
}
if (this.pdcaOrgaService.countByParams(params) > 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
}
if (this.pdcaMeasureFreqService.countByParams(params) > 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
}
if (this.tsaMeasureFreqService.countByParams(params) > 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
}
this.deleteParent(organization);
this.swotService.deleteForOrgId(organization.getOrgId());
// delete BB_REPORT_ROLE_VIEW
params.clear();
params.put("idName", organization.getOrgId());
List<BbReportRoleView> reportRoleViews = this.reportRoleViewService.findListByParams(params);
for (int i = 0; reportRoleViews != null && i < reportRoleViews.size(); i++) {
BbReportRoleView reportRoleView = reportRoleViews.get(i);
this.reportRoleViewService.delete(reportRoleView);
}
// delete from BB_MEASURE_DATA where ORG_ID = :orgId
this.measureDataService.deleteForOrgId(organization.getOrgId());
this.monitorItemScoreService.deleteForOrgId(organization.getOrgId());
return this.getOrganizationService().deleteObject(organization);
}
use of com.netsteadfast.greenstep.po.hbm.BbReportRoleView 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;
}
Aggregations