use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method getTreeData.
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public List<Map<String, Object>> getTreeData(String basePath) throws ServiceException, Exception {
List<Map<String, Object>> items = new LinkedList<Map<String, Object>>();
List<EmployeeVO> empList = this.getEmployeeService().findForJoinHier();
if (empList == null || empList.size() < 1) {
return items;
}
for (EmployeeVO emp : empList) {
// 先放沒有父親的員工資料
if (!(super.isBlank(emp.getSupOid()) || BscConstants.EMPLOYEE_HIER_ZERO_OID.equals(emp.getSupOid()))) {
continue;
}
Map<String, Object> parentDataMap = new LinkedHashMap<String, Object>();
parentDataMap.put("type", "parent");
parentDataMap.put("id", emp.getOid());
parentDataMap.put("name", IconUtils.getMenuIcon(basePath, TREE_ICON_ID) + StringEscapeUtils.escapeHtml4(this.getTreeShowName(emp)));
parentDataMap.put("oid", emp.getOid());
items.add(parentDataMap);
}
// 再開始放孩子
for (int ix = 0; ix < items.size(); ix++) {
Map<String, Object> parentDataMap = items.get(ix);
String oid = (String) parentDataMap.get("oid");
this.getTreeData(basePath, parentDataMap, empList, oid);
}
return items;
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method updateSupervisor.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> updateSupervisor(EmployeeVO employee, String supervisorOid) throws ServiceException, Exception {
if (employee == null || super.isBlank(employee.getOid()) || super.isBlank(supervisorOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setValue(Boolean.FALSE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
employee = this.findEmployeeData(employee.getOid());
this.deleteHierarchy(employee);
if ("root".equals(supervisorOid) || "r".equals(supervisorOid)) {
this.createHierarchy(employee, BscConstants.EMPLOYEE_HIER_ZERO_OID);
} else {
EmployeeVO newHierEmployee = this.findEmployeeData(supervisorOid);
// 找當前員工的的資料, 不因該存在要update的新關聯主管
if (this.foundChild(employee.getOid(), newHierEmployee.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
this.createHierarchy(employee, newHierEmployee.getOid());
}
result.setValue(Boolean.TRUE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
return result;
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority 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.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class AggregationMethodLogicServiceImpl method delete.
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(AggregationMethodVO aggregationMethod) throws ServiceException, Exception {
if (null == aggregationMethod || super.isBlank(aggregationMethod.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
AggregationMethodVO oldAggregationMethod = AggregationMethodUtils.findSimpleByOid(aggregationMethod.getOid());
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("cal", oldAggregationMethod.getAggrId());
if (this.kpiService.countByParams(paramMap) > 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
}
return this.aggregationMethodService.deleteObject(aggregationMethod);
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class DegreeFeedbackLogicServiceImpl method confirmTask.
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public void confirmTask(String projectOid, String taskId, String reason, String confirm) throws ServiceException, Exception {
if (super.isBlank(projectOid) || super.isBlank(taskId) || super.isBlank(confirm)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DegreeFeedbackProjectVO project = new DegreeFeedbackProjectVO();
project.setOid(projectOid);
DefaultResult<DegreeFeedbackProjectVO> result = this.degreeFeedbackProjectService.findObjectByOid(project);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().toString());
}
project = result.getValue();
this.completeTask(taskId, this.getProcessFlowParam(projectOid, confirm, reason));
List<BusinessProcessManagementTaskVO> tasks = this.queryTaskByVariableProjectOid(projectOid);
if (null != tasks && tasks.size() > 0) {
return;
}
// 流程跑完了, 更新專案flag , 讓專案發佈
if (YesNo.YES.equals(confirm)) {
project.setPublishFlag(YesNo.YES);
this.degreeFeedbackProjectService.updateObject(project);
}
}
Aggregations