Search in sources :

Example 66 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException 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 67 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class FormulaMode method loadReturnModeMapData.

private static void loadReturnModeMapData() {
    returnModeMap.clear();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("type", CODE_TYPE);
    Map<String, String> orderParams = new HashMap<String, String>();
    orderParams.put("code", "ASC");
    try {
        List<TbSysCode> codes = sysCodeService.findListByParams(params, null, orderParams);
        for (TbSysCode code : codes) {
            if (MODE_DEFAULT_CODE.equals(code.getCode())) {
                returnModeMap.put(MODE_DEFAULT, code.getName());
            }
            if (MODE_CUSTOM_CODE.equals(code.getCode())) {
                returnModeMap.put(MODE_CUSTOM, code.getName());
            }
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (returnModeMap.size() != 2) {
        returnModeMap.clear();
        returnModeMap.put(MODE_DEFAULT, MODE_DEFAULT);
        returnModeMap.put(MODE_CUSTOM, MODE_CUSTOM);
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) TbSysCode(com.netsteadfast.greenstep.po.hbm.TbSysCode) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 68 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class TimeSeriesAnalysisUtils method getMeasureFreq.

public static TsaMeasureFreqVO getMeasureFreq(TsaVO tsa) throws ServiceException, Exception {
    TsaMeasureFreqVO measureFreq = new TsaMeasureFreqVO();
    measureFreq.setTsaOid(tsa.getOid());
    DefaultResult<TsaMeasureFreqVO> result = tsaMeasureFreqService.findByUK(measureFreq);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    measureFreq = result.getValue();
    return measureFreq;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) TsaMeasureFreqVO(com.netsteadfast.greenstep.vo.TsaMeasureFreqVO)

Example 69 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class KpiManagementAction method handlerSelectValueForEdit.

private void handlerSelectValueForEdit() throws ServiceException, Exception {
    ObjectiveVO objective = new ObjectiveVO();
    objective.setObjId(this.kpi.getObjId());
    DefaultResult<ObjectiveVO> objResult = this.objectiveService.findByUK(objective);
    if (objResult.getValue() == null) {
        throw new ServiceException(objResult.getSystemMessage().getValue());
    }
    objective = objResult.getValue();
    PerspectiveVO perspective = new PerspectiveVO();
    perspective.setPerId(objective.getPerId());
    DefaultResult<PerspectiveVO> perResult = this.perspectiveService.findByUK(perspective);
    if (perResult.getValue() == null) {
        throw new ServiceException(perResult.getSystemMessage().getValue());
    }
    perspective = perResult.getValue();
    VisionVO vision = new VisionVO();
    vision.setVisId(perspective.getVisId());
    DefaultResult<VisionVO> visResult = this.visionService.findForSimpleByVisId(vision.getVisId());
    if (visResult.getValue() == null) {
        throw new ServiceException(visResult.getSystemMessage().getValue());
    }
    vision = visResult.getValue();
    //		FormulaVO formula = new FormulaVO();
    //		formula.setForId( this.kpi.getForId() );
    //		DefaultResult<FormulaVO> forResult = this.formulaService.findByUK(formula);
    //		if (forResult.getValue()==null) {
    //			throw new ServiceException( forResult.getSystemMessage().getValue() );
    //		}
    //		formula = forResult.getValue();
    //		
    //		FormulaVO trendsFormula = new FormulaVO();
    //		trendsFormula.setForId( this.kpi.getTrendsForId() );
    //		DefaultResult<FormulaVO> trendsForResult = this.formulaService.findByUK(trendsFormula);
    //		if (trendsForResult.getValue()==null) {
    //			throw new ServiceException( trendsForResult.getSystemMessage().getValue() );
    //		}
    //		trendsFormula = trendsForResult.getValue();		
    this.getFields().put("visionOid", vision.getOid());
    this.getFields().put("perspectiveOid", perspective.getOid());
    this.getFields().put("objectiveOid", objective.getOid());
    this.getFields().put("formulaOid", BscFormulaUtils.getFormulaById(this.kpi.getForId()).getOid());
    this.getFields().put("trendsFormulaOid", BscFormulaUtils.getFormulaById(this.kpi.getTrendsForId()).getOid());
    this.getFields().put("aggrMethodOid", AggregationMethodUtils.findSimpleById(this.kpi.getCal()).getOid());
    this.perspectiveMap = this.perspectiveService.findForMapByVisionOid(vision.getOid(), true);
    this.objectiveMap = this.objectiveService.findForMapByPerspectiveOid(perspective.getOid(), true);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 70 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class KpiReportContentQueryAction method loadContentFromUpload.

//	public static void main(String args[]) throws Exception {
//		//CONTENT.txt
//		String jsonStr = FSUtils.readStr("/tmp/CONTENT.txt");
//		Map<String, Object> dataMap = new ObjectMapper().readValue(jsonStr, Map.class);
//		BscStructTreeObj treeObj = new ObjectMapper().readValue( SimpleUtils.deB64((String)dataMap.get("treeObjJsonStr")), BscStructTreeObj.class);
//		ChainResultObj resultObj = new ObjectMapper().readValue( SimpleUtils.deB64((String)dataMap.get("resultObjJsonStr")), ChainResultObj.class);
//		
//	}
/**
	 * 2016-11-01
	 * 主要給 workspace 圖表元件載入用的 
	 * 
	 * @throws ControllerException
	 * @throws AuthorityException
	 * @throws ServiceException
	 * @throws Exception
	 */
private void loadContentFromUpload() throws ControllerException, AuthorityException, ServiceException, Exception {
    String uploadOid = this.getFields().get("uploadOid");
    byte[] content = UploadSupportUtils.getDataBytes(uploadOid);
    String jsonStr = new String(content, Constants.BASE_ENCODING);
    if (StringUtils.isBlank(jsonStr)) {
        throw new Exception("Report json data error.");
    }
    @SuppressWarnings("unchecked") Map<String, Object> dataMap = new ObjectMapper().readValue(jsonStr, Map.class);
    BscStructTreeObj treeObj = new ObjectMapper().readValue(SimpleUtils.deB64((String) dataMap.get("treeObjJsonStr")), BscStructTreeObj.class);
    ChainResultObj resultObj = new ObjectMapper().readValue(SimpleUtils.deB64((String) dataMap.get("resultObjJsonStr")), ChainResultObj.class);
    this.body = String.valueOf(resultObj.getValue());
    this.message = resultObj.getMessage();
    if (!StringUtils.isBlank(this.body) && this.body.startsWith("<!-- BSC_PROG003D0001Q -->")) {
        this.success = IS_YES;
    }
    this.fillPerspectivesPieChartData(treeObj);
    this.fillPerspectivesBarChartData(treeObj);
    this.fillLineChartData(treeObj);
}
Also used : BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AuthorityException(com.netsteadfast.greenstep.base.exception.AuthorityException) ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)291 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)91 Transactional (org.springframework.transaction.annotation.Transactional)89 HashMap (java.util.HashMap)65 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)49 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)48 SysVO (com.netsteadfast.greenstep.vo.SysVO)30 IOException (java.io.IOException)24 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)20 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)19 List (java.util.List)19 Map (java.util.Map)19 ArrayList (java.util.ArrayList)17 LinkedHashMap (java.util.LinkedHashMap)17 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)16 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)15 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)15 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)14 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)13 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)12