Search in sources :

Example 31 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.

the class EmployeeLogicServiceImpl method create.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<EmployeeVO> create(EmployeeVO employee, List<String> organizationOid) throws ServiceException, Exception {
    if (employee == null || super.isBlank(employee.getEmpId())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("empId", employee.getEmpId());
    if (this.getEmployeeService().countByParams(params) > 0) {
        throw new ServiceException("Please change another Id!");
    }
    AccountVO account = this.tranAccount(employee);
    if (this.isAdministrator(account.getAccount())) {
        throw new ServiceException("Please change another Account!");
    }
    DefaultResult<AccountVO> mResult = this.getAccountService().saveObject(account);
    if (mResult.getValue() == null) {
        throw new ServiceException(mResult.getSystemMessage().getValue());
    }
    DefaultResult<EmployeeVO> result = this.getEmployeeService().saveObject(employee);
    employee = result.getValue();
    this.createEmployeeOrganization(employee, organizationOid);
    // create default role
    UserRoleVO userRole = new UserRoleVO();
    userRole.setAccount(employee.getAccount());
    userRole.setRole(this.roleLogicService.getDefaultUserRole());
    userRole.setDescription(employee.getAccount() + " `s role!");
    this.getUserRoleService().saveObject(userRole);
    this.createHierarchy(employee, BscConstants.EMPLOYEE_HIER_ZERO_OID);
    return result;
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) UserRoleVO(com.netsteadfast.greenstep.vo.UserRoleVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 32 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.

the class DegreeFeedbackLogicServiceImpl method fetchEmployee.

private EmployeeVO fetchEmployee(String oid, Map<String, EmployeeVO> tmpBag) throws ServiceException, Exception {
    if (tmpBag.get(oid) != null) {
        return tmpBag.get(oid);
    }
    EmployeeVO employee = this.findEmployeeData(oid);
    tmpBag.put(oid, employee);
    return employee;
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO)

Example 33 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.

the class PdcaLogicServiceImpl method createOwner.

private void createOwner(PdcaVO pdca, List<String> emplOids) throws ServiceException, Exception {
    for (String oid : emplOids) {
        EmployeeVO employee = this.findEmployeeData(oid);
        PdcaOwnerVO pdcaOwner = new PdcaOwnerVO();
        pdcaOwner.setPdcaOid(pdca.getOid());
        pdcaOwner.setEmpId(employee.getEmpId());
        this.pdcaOwnerService.saveObject(pdcaOwner);
    }
}
Also used : PdcaOwnerVO(com.netsteadfast.greenstep.vo.PdcaOwnerVO) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO)

Example 34 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.

the class HistoryItemScoreReportContentQueryUtils method fill2ValueObjectList.

public static List<MonitorItemScoreVO> fill2ValueObjectList(List<BbMonitorItemScore> monitorItemScores) throws ServiceException, Exception {
    List<MonitorItemScoreVO> results = new ArrayList<MonitorItemScoreVO>();
    if (null == monitorItemScores) {
        return results;
    }
    List<VisionVO> basicDataList = getBasicDataList();
    for (BbMonitorItemScore monitorScoreSrc : monitorItemScores) {
        MonitorItemScoreVO monitorScoreDest = new MonitorItemScoreVO();
        monitorItemScoreService.doMapper(monitorScoreSrc, monitorScoreDest, IMonitorItemScoreService.MAPPER_ID_PO2VO);
        String id = monitorScoreSrc.getItemId();
        String name = "";
        String itemType = monitorScoreSrc.getItemType();
        if (MonitorItemType.VISION.equals(itemType)) {
            DefaultResult<VisionVO> visionResult = visionService.findForSimpleByVisId(id);
            if (visionResult.getValue() == null) {
                throw new ServiceException(visionResult.getSystemMessage().getValue());
            }
            VisionVO vision = visionResult.getValue();
            name = getItemNameWithVisionGroup(MonitorItemType.VISION, vision.getVisId(), vision.getTitle(), basicDataList);
        }
        if (MonitorItemType.PERSPECTIVES.equals(itemType)) {
            PerspectiveVO perspective = new PerspectiveVO();
            perspective.setPerId(id);
            DefaultResult<PerspectiveVO> perspectiveResult = perspectiveService.findByUK(perspective);
            if (perspectiveResult.getValue() == null) {
                throw new ServiceException(perspectiveResult.getSystemMessage().getValue());
            }
            perspective = perspectiveResult.getValue();
            name = getItemNameWithVisionGroup(MonitorItemType.PERSPECTIVES, perspective.getPerId(), perspective.getName(), basicDataList);
        }
        if (MonitorItemType.STRATEGY_OF_OBJECTIVES.equals(itemType)) {
            ObjectiveVO objective = new ObjectiveVO();
            objective.setObjId(id);
            DefaultResult<ObjectiveVO> objectiveResult = objectiveService.findByUK(objective);
            if (objectiveResult.getValue() == null) {
                throw new ServiceException(objectiveResult.getSystemMessage().getValue());
            }
            objective = objectiveResult.getValue();
            name = getItemNameWithVisionGroup(MonitorItemType.STRATEGY_OF_OBJECTIVES, objective.getObjId(), objective.getName(), basicDataList);
        }
        if (MonitorItemType.KPI.equals(itemType)) {
            KpiVO kpi = new KpiVO();
            kpi.setId(id);
            DefaultResult<KpiVO> kpiResult = kpiService.findByUK(kpi);
            if (kpiResult.getValue() == null) {
                throw new ServiceException(kpiResult.getSystemMessage().getValue());
            }
            kpi = kpiResult.getValue();
            name = getItemNameWithVisionGroup(MonitorItemType.KPI, kpi.getId(), kpi.getName(), basicDataList);
        }
        monitorScoreDest.setName(name);
        monitorScoreDest.setOrganizationName(monitorScoreSrc.getOrgId());
        monitorScoreDest.setEmployeeName(monitorScoreSrc.getEmpId());
        if (!BscConstants.MEASURE_DATA_ORGANIZATION_FULL.equals(monitorScoreSrc.getOrgId())) {
            OrganizationVO organization = BscBaseLogicServiceCommonSupport.findOrganizationDataByUK(organizationService, monitorScoreSrc.getOrgId());
            monitorScoreDest.setOrganizationName(monitorScoreSrc.getOrgId() + " - " + organization.getName());
        }
        if (!BscConstants.MEASURE_DATA_EMPLOYEE_FULL.equals(monitorScoreSrc.getEmpId())) {
            EmployeeVO employee = BscBaseLogicServiceCommonSupport.findEmployeeDataByEmpId(employeeService, monitorScoreSrc.getEmpId());
            monitorScoreDest.setEmployeeName(monitorScoreSrc.getEmpId() + " - " + employee.getFullName());
        }
        results.add(monitorScoreDest);
    }
    return results;
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) ArrayList(java.util.ArrayList) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) BbMonitorItemScore(com.netsteadfast.greenstep.po.hbm.BbMonitorItemScore) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) MonitorItemScoreVO(com.netsteadfast.greenstep.vo.MonitorItemScoreVO)

Example 35 with EmployeeVO

use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.

the class BscReportSupportUtils method fillKpiEmployees.

/**
	 * 為KPI報表顯示要用的 , 取出KPI所屬的員工
	 * 
	 * @param kpi
	 * @throws ServiceException
	 * @throws Exception
	 */
public static void fillKpiEmployees(KpiVO kpi) throws ServiceException, Exception {
    List<String> appendEmplOids = employeeService.findForAppendEmployeeOidsByKpiEmpl(kpi.getId());
    for (int i = 0; appendEmplOids != null && i < appendEmplOids.size(); i++) {
        EmployeeVO employee = new EmployeeVO();
        employee.setOid(appendEmplOids.get(i));
        DefaultResult<EmployeeVO> result = employeeService.findObjectByOid(employee);
        if (result.getValue() != null) {
            employee = result.getValue();
            kpi.getEmployees().add(employee);
        }
    }
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO)

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