Search in sources :

Example 61 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO 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 62 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO 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 63 with VisionVO

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

the class KpiReportContentQueryAction method fillPerspectivesBarChartData.

private void fillPerspectivesBarChartData(BscStructTreeObj treeObj) throws Exception {
    Map<String, Object> valueMap = new LinkedHashMap<String, Object>();
    List<Map<String, Object>> values = new LinkedList<Map<String, Object>>();
    valueMap.put("key", "Perspectives");
    List<VisionVO> visions = treeObj.getVisions();
    for (VisionVO vision : visions) {
        if (!vision.getOid().equals(this.getFields().get("visionOid"))) {
            continue;
        }
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            Map<String, Object> dataMap = new HashMap<String, Object>();
            dataMap.put("label", perspective.getName());
            dataMap.put("value", perspective.getScore());
            values.add(dataMap);
            this.perspectivesBarChartBgColor.add(perspective.getBgColor());
        }
    }
    valueMap.put("values", values);
    this.perspectivesBarChartValue.add(valueMap);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap)

Example 64 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO 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 65 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO 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

VisionVO (com.netsteadfast.greenstep.vo.VisionVO)66 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)38 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)29 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)22 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)21 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)17 HashMap (java.util.HashMap)16 Map (java.util.Map)8 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)7 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)7 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)7 ArrayList (java.util.ArrayList)7 LinkedList (java.util.LinkedList)7 Transactional (org.springframework.transaction.annotation.Transactional)7 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)6 File (java.io.File)6 FileOutputStream (java.io.FileOutputStream)6 BscMixDataVO (com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Document (com.itextpdf.text.Document)3