use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.
the class ReportRoleViewLogicServiceImpl method create.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> create(String roleOid, List<String> emplOids, List<String> orgaOids) throws ServiceException, Exception {
if (super.isNoSelectId(roleOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
RoleVO role = new RoleVO();
role.setOid(roleOid);
DefaultResult<RoleVO> rResult = this.getRoleService().findObjectByOid(role);
if (rResult.getValue() == null) {
throw new ServiceException(rResult.getSystemMessage().getValue());
}
role = rResult.getValue();
this.deleteByRole(role.getRole());
for (int i = 0; emplOids != null && i < emplOids.size(); i++) {
EmployeeVO employee = this.findEmployeeData(emplOids.get(i));
this.createReportRoleView(role.getRole(), ReportRoleViewTypes.IS_EMPLOYEE, employee.getAccount());
}
for (int i = 0; orgaOids != null && i < orgaOids.size(); i++) {
OrganizationVO organization = this.findOrganizationData(orgaOids.get(i));
this.createReportRoleView(role.getRole(), ReportRoleViewTypes.IS_ORGANIZATION, organization.getOrgId());
}
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setValue(Boolean.TRUE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
return result;
}
use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.
the class PdcaLogicServiceImpl method createItemOwner.
private void createItemOwner(PdcaItemVO pdcaItem) throws ServiceException, Exception {
for (String oid : pdcaItem.getEmployeeOids()) {
EmployeeVO employee = this.findEmployeeData(oid);
PdcaItemOwnerVO itemOwner = new PdcaItemOwnerVO();
itemOwner.setPdcaOid(pdcaItem.getPdcaOid());
itemOwner.setItemOid(pdcaItem.getOid());
itemOwner.setEmpId(employee.getEmpId());
this.pdcaItemOwnerService.saveObject(itemOwner);
}
}
use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method resetTreeMapContentForOrgChartData.
@SuppressWarnings("unchecked")
private void resetTreeMapContentForOrgChartData(List<Map<String, Object>> childMapList, EmployeeVO currentEmployee) throws Exception {
for (Map<String, Object> nodeMap : childMapList) {
// 與 node.get("oid") 一樣
String nodeEmployeeOid = String.valueOf(nodeMap.get("id"));
// 去除 OrgChart 不需要的資料
nodeMap.remove("type");
nodeMap.remove("id");
nodeMap.remove("name");
nodeMap.remove("oid");
EmployeeVO nodeEmployee = this.findEmployeeData(nodeEmployeeOid);
// OrgChart 需要的資料, nodeMap 需要填入 name 與 title
if (currentEmployee != null && !super.isBlank(currentEmployee.getOid()) && currentEmployee.getOid().equals(nodeEmployeeOid)) {
// 有帶入當前員工來區別顏色
nodeMap.put("name", "<font color='#8A0808'>" + nodeEmployee.getEmpId() + " - " + nodeEmployee.getFullName() + "</font>");
nodeMap.put("title", "<font color='#8A0808'>" + (super.isBlank(nodeEmployee.getJobTitle()) ? "no job description" : nodeEmployee.getJobTitle().trim()) + "</font>");
} else {
nodeMap.put("name", nodeEmployee.getEmpId() + " - " + nodeEmployee.getFullName());
nodeMap.put("title", (super.isBlank(nodeEmployee.getJobTitle()) ? "no job description" : nodeEmployee.getJobTitle().trim()));
}
if (nodeMap.get("children") != null && (nodeMap.get("children") instanceof List<?>)) {
// 還有孩子項目資料
this.resetTreeMapContentForOrgChartData((List<Map<String, Object>>) nodeMap.get("children"), currentEmployee);
}
}
}
use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method initHierarchyForFirst.
/**
* for upgrade 0.7.1 need data
*
* @throws ServiceException
* @throws Exception
*/
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public void initHierarchyForFirst() throws ServiceException, Exception {
List<EmployeeVO> employeeList = this.getEmployeeService().findListVOByParams(null);
if (null == employeeList || employeeList.size() < 1) {
return;
}
Map<String, Object> paramMap = new HashMap<String, Object>();
for (EmployeeVO employee : employeeList) {
paramMap.clear();
paramMap.put("empOid", employee.getOid());
if (this.employeeHierService.countByParams(paramMap) > 0) {
continue;
}
this.createHierarchy(employee, BscConstants.EMPLOYEE_HIER_ZERO_OID);
}
}
use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method updatePassword.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<AccountVO> updatePassword(EmployeeVO employee, String newPassword) throws ServiceException, Exception {
if (employee == null || super.isBlank(employee.getOid()) || super.isBlank(employee.getPassword()) || super.isBlank(newPassword)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
EmployeeVO dbEmployee = this.findEmployeeData(employee.getOid());
AccountVO account = this.findAccountData(dbEmployee.getAccount());
if (!account.getPassword().equals(this.getAccountService().tranPassword(employee.getPassword()))) {
throw new ServiceException("The current password(old password) is incorrect!");
}
account.setPassword(this.getAccountService().tranPassword(newPassword));
return getAccountService().updateObject(account);
}
Aggregations