Search in sources :

Example 6 with EmployeeVO

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;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) RoleVO(com.netsteadfast.greenstep.vo.RoleVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with EmployeeVO

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);
    }
}
Also used : PdcaItemOwnerVO(com.netsteadfast.greenstep.vo.PdcaItemOwnerVO) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO)

Example 8 with EmployeeVO

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);
        }
    }
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) List(java.util.List) LinkedList(java.util.LinkedList) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Example 9 with EmployeeVO

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);
    }
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 10 with EmployeeVO

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);
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)48 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)21 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)15 HashMap (java.util.HashMap)13 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)7 LinkedHashMap (java.util.LinkedHashMap)5 Transactional (org.springframework.transaction.annotation.Transactional)5 Map (java.util.Map)4 BbEmployee (com.netsteadfast.greenstep.po.hbm.BbEmployee)3 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)3 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)3 List (java.util.List)3 Context (org.apache.commons.chain.Context)3 ContextBase (org.apache.commons.chain.impl.ContextBase)3 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)2 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)2 BbOrganization (com.netsteadfast.greenstep.po.hbm.BbOrganization)2 BbPdcaDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaDoc)2 BbPdcaItem (com.netsteadfast.greenstep.po.hbm.BbPdcaItem)2 BbPdcaItemDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaItemDoc)2