Search in sources :

Example 46 with ObjectiveVO

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

the class PerformanceScoreChainUtils method createOrUpdateMonitorItemScore.

public static void createOrUpdateMonitorItemScore(String dateVal, Context context) throws ServiceException, Exception {
    ChainResultObj result = getResult(context);
    if (result.getValue() == null || ((BscStructTreeObj) result.getValue()).getVisions() == null || ((BscStructTreeObj) result.getValue()).getVisions().size() == 0) {
        logger.warn("No data!");
        return;
    }
    //String dateVal = SimpleUtils.getStrYMD("");
    String frequency = (String) context.get("frequency");
    String orgId = (String) context.get("orgId");
    String empId = (String) context.get("empId");
    List<VisionVO> visions = ((BscStructTreeObj) result.getValue()).getVisions();
    for (VisionVO vision : visions) {
        List<PerspectiveVO> perspectives = vision.getPerspectives();
        MonitorItemScoreVO visionMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.VISION, vision.getVisId());
        //visionMonitorItemScore.setScore( BscReportSupportUtils.parse2(vision.getScore()) );
        setScore(visionMonitorItemScore, vision.getScore());
        saveOrUpdateMonitorItemScore(visionMonitorItemScore);
        for (PerspectiveVO perspective : perspectives) {
            List<ObjectiveVO> objectives = perspective.getObjectives();
            MonitorItemScoreVO perspectiveMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.PERSPECTIVES, perspective.getPerId());
            //perspectiveMonitorItemScore.setScore( BscReportSupportUtils.parse2(perspective.getScore()) );
            setScore(perspectiveMonitorItemScore, perspective.getScore());
            saveOrUpdateMonitorItemScore(perspectiveMonitorItemScore);
            for (ObjectiveVO objective : objectives) {
                List<KpiVO> kpis = objective.getKpis();
                MonitorItemScoreVO objectiveMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.STRATEGY_OF_OBJECTIVES, objective.getObjId());
                //objectiveMonitorItemScore.setScore( BscReportSupportUtils.parse2(objective.getScore()) );
                setScore(objectiveMonitorItemScore, objective.getScore());
                saveOrUpdateMonitorItemScore(objectiveMonitorItemScore);
                for (KpiVO kpi : kpis) {
                    MonitorItemScoreVO kpiMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.KPI, kpi.getId());
                    //kpiMonitorItemScore.setScore( BscReportSupportUtils.parse2(kpi.getScore()) );
                    setScore(kpiMonitorItemScore, kpi.getScore());
                    saveOrUpdateMonitorItemScore(kpiMonitorItemScore);
                }
            }
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) MonitorItemScoreVO(com.netsteadfast.greenstep.vo.MonitorItemScoreVO)

Example 47 with ObjectiveVO

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

the class PerformanceScoreChainUtils method clearExpressionContentOut.

/**
	 * 清除 公式 與 歸類方法 的表達式內容
	 * 
	 * @param vision
	 * @throws Exception
	 */
public static void clearExpressionContentOut(VisionVO vision) throws Exception {
    if (null == vision) {
        return;
    }
    for (PerspectiveVO perspective : vision.getPerspectives()) {
        for (ObjectiveVO objective : perspective.getObjectives()) {
            for (KpiVO kpi : objective.getKpis()) {
                kpi.getFormula().setExpression("");
                kpi.getFormula().setDescription("");
                kpi.getTrendsFormula().setExpression("");
                kpi.getTrendsFormula().setDescription("");
                kpi.getAggregationMethod().setExpression1("");
                kpi.getAggregationMethod().setExpression2("");
                kpi.getAggregationMethod().setDescription("");
            }
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO)

Example 48 with ObjectiveVO

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

the class KpiReportContentQueryAction method fillLineChartData.

private void fillLineChartData(BscStructTreeObj treeObj) throws Exception {
    // 給 09 - Dashboard 用的 , 判斷 用第1筆的資料來組  categories 的變數
    int c = 0;
    List<VisionVO> visions = treeObj.getVisions();
    for (VisionVO vision : visions) {
        if (!vision.getOid().equals(this.getFields().get("visionOid"))) {
            continue;
        }
        // 在  Dashboard 查詢時, 一定要選 vision, 所以只會有一個 vision , 給 09 - Dashboard 用的 
        this.subTitle = vision.getTitle();
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            // 給 04 - Perspectives Dashboard 用的
            this.perspectiveItems.add(perspective);
            for (ObjectiveVO objective : perspective.getObjectives()) {
                for (KpiVO kpi : objective.getKpis()) {
                    Map<String, String> labelMap = new HashMap<String, String>();
                    List<List<Object>> dataList = new LinkedList<List<Object>>();
                    labelMap.put("label", kpi.getName());
                    this.lineChartNames.add(labelMap);
                    for (DateRangeScoreVO entry : kpi.getDateRangeScores()) {
                        List<Object> dateScoreList = new LinkedList<Object>();
                        dateScoreList.add(entry.getDate().replaceAll("/", "-"));
                        dateScoreList.add(entry.getScore());
                        dataList.add(dateScoreList);
                    }
                    this.lineChartValues.add(dataList);
                    // ----------------------------------------------------------------------
                    // 給 09 - Dashboard 用的 
                    // 給 Dashboard 頁面 trend line chart 用的資料
                    Map<String, Object> mapData = new HashMap<String, Object>();
                    List<Float> rangeScore = new LinkedList<Float>();
                    for (DateRangeScoreVO dateRangeScore : kpi.getDateRangeScores()) {
                        if (c == 0) {
                            // 用第1筆的資料來組  categories 就可已了
                            categories.add(dateRangeScore.getDate());
                        }
                        rangeScore.add(dateRangeScore.getScore());
                    }
                    mapData.put("name", kpi.getName());
                    mapData.put("data", rangeScore);
                    this.series.add(mapData);
                    c++;
                // ----------------------------------------------------------------------
                }
            }
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) LinkedList(java.util.LinkedList) List(java.util.List) LinkedList(java.util.LinkedList)

Example 49 with ObjectiveVO

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

the class ObjectiveManagementAction method loadObjectiveData.

private void loadObjectiveData() throws ServiceException, Exception {
    this.transformFields2ValueObject(this.objective, new String[] { "oid" });
    DefaultResult<ObjectiveVO> result = this.objectiveService.findObjectByOid(objective);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    this.objective = result.getValue();
    PerspectiveVO perspective = new PerspectiveVO();
    perspective.setPerId(this.objective.getPerId());
    DefaultResult<PerspectiveVO> pResult = this.perspectiveService.findByUK(perspective);
    if (pResult.getValue() == null) {
        throw new ServiceException(pResult.getSystemMessage().getValue());
    }
    perspective = pResult.getValue();
    this.getFields().put("perspectiveOid", perspective.getOid());
    VisionVO vision = new VisionVO();
    vision.setVisId(perspective.getVisId());
    DefaultResult<VisionVO> vResult = this.visionService.findForSimpleByVisId(vision.getVisId());
    if (vResult.getValue() == null) {
        throw new ServiceException(vResult.getSystemMessage().getValue());
    }
    vision = vResult.getValue();
    this.getFields().put("visionOid", vision.getOid());
    this.perspectiveMap = this.perspectiveService.findForMapByVisionOid(vision.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 50 with ObjectiveVO

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

the class RegionMapRelationKpisAction method fillRelationKpis.

private void fillRelationKpis(BscStructTreeObj treeObj) throws Exception {
    List<VisionVO> visions = treeObj.getVisions();
    for (VisionVO vision : visions) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            for (ObjectiveVO objective : perspective.getObjectives()) {
                for (KpiVO kpi : objective.getKpis()) {
                    boolean isFound = false;
                    for (Map<String, Object> founds : this.relationKpis) {
                        if (kpi.getId().equals(founds.get("id"))) {
                            isFound = true;
                        }
                    }
                    if (isFound) {
                        continue;
                    }
                    Map<String, Object> paramMap = new HashMap<String, Object>();
                    paramMap.put("id", kpi.getId());
                    paramMap.put("name", kpi.getName());
                    paramMap.put("score", NumberUtils.toFloat(BscReportSupportUtils.parse2(kpi.getScore())));
                    paramMap.put("bgColor", kpi.getBgColor());
                    paramMap.put("fontColor", kpi.getFontColor());
                    paramMap.put("target", kpi.getTarget());
                    paramMap.put("min", kpi.getMin());
                    this.relationKpis.add(paramMap);
                }
            }
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) HashMap(java.util.HashMap) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Aggregations

ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)50 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)44 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)34 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)29 HashMap (java.util.HashMap)15 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)13 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)8 DateRangeScoreVO (com.netsteadfast.greenstep.vo.DateRangeScoreVO)8 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 LinkedList (java.util.LinkedList)6 Phrase (com.itextpdf.text.Phrase)4 PdfPCell (com.itextpdf.text.pdf.PdfPCell)4 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)4 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)4 Cell (org.apache.poi.ss.usermodel.Cell)4 Row (org.apache.poi.ss.usermodel.Row)4 CellRangeAddress (org.apache.poi.ss.util.CellRangeAddress)4 XSSFCellStyle (org.apache.poi.xssf.usermodel.XSSFCellStyle)4 XSSFColor (org.apache.poi.xssf.usermodel.XSSFColor)4