Search in sources :

Example 16 with DefaultResult

use of com.netsteadfast.greenstep.base.model.DefaultResult in project bamboobsc by billchen198318.

the class OrganizationServiceImpl method findForInKpiOrga.

@Override
public DefaultResult<List<BbOrganization>> findForInKpiOrga(String kpiId) throws ServiceException, Exception {
    if (StringUtils.isBlank(kpiId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<List<BbOrganization>> result = new DefaultResult<List<BbOrganization>>();
    List<BbOrganization> searchList = this.organizationDAO.findForInKpiOrga(kpiId);
    if (searchList != null && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) BbOrganization(com.netsteadfast.greenstep.po.hbm.BbOrganization) ArrayList(java.util.ArrayList) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 17 with DefaultResult

use of com.netsteadfast.greenstep.base.model.DefaultResult in project bamboobsc by billchen198318.

the class EmployeeServiceImpl method findForInKpiEmpl.

@Override
public DefaultResult<List<BbEmployee>> findForInKpiEmpl(String kpiId) throws ServiceException, Exception {
    if (StringUtils.isBlank(kpiId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<List<BbEmployee>> result = new DefaultResult<List<BbEmployee>>();
    List<BbEmployee> searchList = this.employeeDAO.findForInKpiEmpl(kpiId);
    if (searchList != null && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : BbEmployee(com.netsteadfast.greenstep.po.hbm.BbEmployee) SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ArrayList(java.util.ArrayList) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 18 with DefaultResult

use of com.netsteadfast.greenstep.base.model.DefaultResult in project bamboobsc by billchen198318.

the class FormulaServiceImpl method findForSimple.

@Override
public DefaultResult<List<FormulaVO>> findForSimple(boolean trendsFlag) throws ServiceException, Exception {
    DefaultResult<List<FormulaVO>> result = new DefaultResult<List<FormulaVO>>();
    List<FormulaVO> searchList = this.formulaDAO.findForSimple((trendsFlag ? YesNo.YES : YesNo.NO));
    if (searchList != null && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) FormulaVO(com.netsteadfast.greenstep.vo.FormulaVO)

Example 19 with DefaultResult

use of com.netsteadfast.greenstep.base.model.DefaultResult in project bamboobsc by billchen198318.

the class OrganizationLogicServiceImpl method updateParent.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> updateParent(OrganizationVO organization, String parentOid) throws ServiceException, Exception {
    if (organization == null || super.isBlank(organization.getOid()) || super.isBlank(parentOid)) {
        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)));
    organization = this.findOrganizationData(organization.getOid());
    this.deleteParent(organization);
    if ("root".equals(parentOid) || "r".equals(parentOid)) {
        this.createParent(organization, BscConstants.ORGANIZATION_ZERO_ID);
    } else {
        OrganizationVO newParOrganization = this.findOrganizationData(parentOid);
        // 找當前部門的子部門中的資料, 不因該存在要update的新父部門
        if (this.foundChild(organization.getOrgId(), newParOrganization.getOrgId())) {
            throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
        }
        this.createParent(organization, newParOrganization.getOrgId());
    }
    result.setValue(Boolean.TRUE);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) 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 20 with DefaultResult

use of com.netsteadfast.greenstep.base.model.DefaultResult in project bamboobsc by billchen198318.

the class OrganizationLogicServiceImpl method getOrgChartData.

/**
	 * 這個 Method 的 ServiceMethodAuthority 權限給查詢狀態
	 * 這裡的 basePath 只是要取 getTreeData 時參數要用, 再這是沒有用處的
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public DefaultResult<Map<String, Object>> getOrgChartData(String basePath, OrganizationVO currentOrganization) throws ServiceException, Exception {
    if (null != currentOrganization && !super.isBlank(currentOrganization.getOid())) {
        currentOrganization = this.findOrganizationData(currentOrganization.getOid());
    }
    List<Map<String, Object>> treeMap = this.getTreeData(basePath, false, "");
    if (null == treeMap || treeMap.size() < 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
    }
    this.resetTreeMapContentForOrgChartData(treeMap, currentOrganization);
    Map<String, Object> rootMap = new HashMap<String, Object>();
    rootMap.put("name", "Organization / Department hierarchy");
    rootMap.put("title", "hierarchy structure");
    rootMap.put("children", treeMap);
    DefaultResult<Map<String, Object>> result = new DefaultResult<Map<String, Object>>();
    result.setValue(rootMap);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.INSERT_SUCCESS)));
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)

Aggregations

DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)52 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)50 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)48 Transactional (org.springframework.transaction.annotation.Transactional)32 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)29 HashMap (java.util.HashMap)13 List (java.util.List)12 Map (java.util.Map)9 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)7 ArrayList (java.util.ArrayList)7 BaseEntity (com.netsteadfast.greenstep.base.model.BaseEntity)6 IOException (java.io.IOException)6 BaseValueObj (com.netsteadfast.greenstep.base.model.BaseValueObj)5 AggregationMethodVO (com.netsteadfast.greenstep.vo.AggregationMethodVO)3 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)3 MeasureDataVO (com.netsteadfast.greenstep.vo.MeasureDataVO)3 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)3 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)3 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)3 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)3