Search in sources :

Example 46 with DefaultResult

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

the class VisionServiceImpl method findForSimpleByVisId.

@Override
public DefaultResult<VisionVO> findForSimpleByVisId(String visId) throws ServiceException, Exception {
    if (StringUtils.isBlank(visId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<VisionVO> result = new DefaultResult<VisionVO>();
    VisionVO vision = this.visionDAO.findForSimpleByVisId(visId);
    if (vision != null) {
        result.setValue(vision);
    } 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) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 47 with DefaultResult

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

the class KpiServiceImpl method findForMixData.

@Override
public DefaultResult<List<BscMixDataVO>> findForMixData(String visionOid, String orgId, String empId, String nextType, String nextId, List<String> kpiIds) throws ServiceException, Exception {
    DefaultResult<List<BscMixDataVO>> result = new DefaultResult<List<BscMixDataVO>>();
    List<BscMixDataVO> searchList = this.kpiDAO.findForMixData(this.getMixDataQueryParam(visionOid, orgId, empId, nextType, nextId, kpiIds));
    if (null != searchList && 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) ArrayList(java.util.ArrayList) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) BscMixDataVO(com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)

Example 48 with DefaultResult

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

the class EmployeeLogicServiceImpl method createOrgChartData.

/**
	 * 這個 Method 的 ServiceMethodAuthority 權限給查詢狀態
	 * 這裡的 basePath 只是要取 getTreeData 時參數要用, 再這是沒有用處的
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<String> createOrgChartData(String basePath, EmployeeVO currentEmployee) throws ServiceException, Exception {
    if (null != currentEmployee && !super.isBlank(currentEmployee.getOid())) {
        currentEmployee = this.findEmployeeData(currentEmployee.getOid());
    }
    List<Map<String, Object>> treeMap = this.getTreeData(basePath);
    if (null == treeMap || treeMap.size() < 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
    }
    this.resetTreeMapContentForOrgChartData(treeMap, currentEmployee);
    Map<String, Object> rootMap = new HashMap<String, Object>();
    rootMap.put("name", "Employee hierarchy");
    rootMap.put("title", "hierarchy structure");
    rootMap.put("children", treeMap);
    ObjectMapper objectMapper = new ObjectMapper();
    String jsonData = objectMapper.writeValueAsString(rootMap);
    String uploadOid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, jsonData.getBytes(), SimpleUtils.getUUIDStr() + ".json");
    DefaultResult<String> result = new DefaultResult<String>();
    result.setValue(uploadOid);
    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) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 49 with DefaultResult

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

the class EmployeeLogicServiceImpl method getOrgChartData.

/**
	 * 這個 Method 的 ServiceMethodAuthority 權限給查詢狀態
	 * 這裡的 basePath 只是要取 getTreeData 時參數要用, 再這是沒有用處的
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public DefaultResult<Map<String, Object>> getOrgChartData(String basePath, EmployeeVO currentEmployee) throws ServiceException, Exception {
    if (null != currentEmployee && !super.isBlank(currentEmployee.getOid())) {
        currentEmployee = this.findEmployeeData(currentEmployee.getOid());
    }
    List<Map<String, Object>> treeMap = this.getTreeData(basePath);
    if (null == treeMap || treeMap.size() < 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
    }
    this.resetTreeMapContentForOrgChartData(treeMap, currentEmployee);
    Map<String, Object> rootMap = new HashMap<String, Object>();
    rootMap.put("name", "Employee 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)

Example 50 with DefaultResult

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

the class OrganizationLogicServiceImpl method createOrgChartData.

/**
	 * 這個 Method 的 ServiceMethodAuthority 權限給查詢狀態
	 * 這裡的 basePath 只是要取 getTreeData 時參數要用, 再這是沒有用處的
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<String> createOrgChartData(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);
    ObjectMapper objectMapper = new ObjectMapper();
    String jsonData = objectMapper.writeValueAsString(rootMap);
    String uploadOid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, jsonData.getBytes(), SimpleUtils.getUUIDStr() + ".json");
    DefaultResult<String> result = new DefaultResult<String>();
    result.setValue(uploadOid);
    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) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

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