Search in sources :

Example 1 with VisionVO

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

the class ProcessBscTreeItemsCommand method execute.

@Override
public boolean execute(Context context) throws Exception {
    if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
        return false;
    }
    String host = StringUtils.defaultString((String) context.get("http")) + ApplicationSiteUtils.getHost(Constants.getMainSystem()) + "/" + ApplicationSiteUtils.getContextPathFromMap(Constants.getMainSystem()) + "/";
    String iconImg = IconUtils.getMenuIcon(host, "STAR");
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    List<Map<String, Object>> items = new LinkedList<Map<String, Object>>();
    for (VisionVO vision : treeObj.getVisions()) {
        Map<String, Object> visionDataMap = new HashMap<String, Object>();
        visionDataMap.put("type", "parent");
        visionDataMap.put("name", vision.getTitle());
        visionDataMap.put("id", BscConstants.KPI_TREE_NOT_ITEM + vision.getOid());
        items.add(visionDataMap);
        List<Map<String, Object>> perspectiveItems = new LinkedList<Map<String, Object>>();
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            Map<String, Object> perspectiveDataMap = new HashMap<String, Object>();
            perspectiveDataMap.put("type", "parent");
            perspectiveDataMap.put("name", perspective.getName());
            perspectiveDataMap.put("id", BscConstants.KPI_TREE_NOT_ITEM + perspective.getOid());
            perspectiveItems.add(perspectiveDataMap);
            visionDataMap.put("children", perspectiveItems);
            List<Map<String, Object>> objectivesStrategyList = new LinkedList<Map<String, Object>>();
            for (ObjectiveVO objective : perspective.getObjectives()) {
                Map<String, Object> objectiveMap = new HashMap<String, Object>();
                objectiveMap.put("type", "parent");
                objectiveMap.put("name", objective.getName());
                objectiveMap.put("id", BscConstants.KPI_TREE_NOT_ITEM + objective.getOid());
                objectivesStrategyList.add(objectiveMap);
                perspectiveDataMap.put("children", objectivesStrategyList);
                List<Map<String, Object>> kpiList = new LinkedList<Map<String, Object>>();
                for (KpiVO kpi : objective.getKpis()) {
                    Map<String, Object> kpiMap = new HashMap<String, Object>();
                    kpiMap.put("type", "Leaf");
                    kpiMap.put("name", iconImg + kpi.getName());
                    kpiMap.put("id", kpi.getOid());
                    kpiList.add(kpiMap);
                    objectiveMap.put("children", kpiList);
                }
            }
        }
    }
    this.setResult(context, items);
    if (null == items || items.size() < 1) {
        this.setMessage(context, SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
    }
    return false;
}
Also used : HashMap(java.util.HashMap) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) HashMap(java.util.HashMap) Map(java.util.Map) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) LinkedList(java.util.LinkedList)

Example 2 with VisionVO

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

the class WeightBodyCommand method autoAllocation.

private void autoAllocation(BscStructTreeObj treeObj) throws Exception {
    int scale = 2;
    for (VisionVO vision : treeObj.getVisions()) {
        for (int px = 0; px < vision.getPerspectives().size(); px++) {
            PerspectiveVO perspective = vision.getPerspectives().get(px);
            int round = BigDecimal.ROUND_DOWN;
            if ((px + 1) == vision.getPerspectives().size()) {
                round = BigDecimal.ROUND_UP;
            }
            perspective.setWeight(MAX_WEIGHT_VALUE.divide(new BigDecimal(vision.getPerspectives().size()), scale, round));
            for (int ox = 0; ox < perspective.getObjectives().size(); ox++) {
                ObjectiveVO objective = perspective.getObjectives().get(ox);
                round = BigDecimal.ROUND_DOWN;
                if ((ox + 1) == perspective.getObjectives().size()) {
                    round = BigDecimal.ROUND_UP;
                }
                objective.setWeight(MAX_WEIGHT_VALUE.divide(new BigDecimal(perspective.getObjectives().size()), scale, round));
                for (int kx = 0; kx < objective.getKpis().size(); kx++) {
                    KpiVO kpi = objective.getKpis().get(kx);
                    round = BigDecimal.ROUND_DOWN;
                    if ((kx + 1) == objective.getKpis().size()) {
                        round = BigDecimal.ROUND_UP;
                    }
                    kpi.setWeight(MAX_WEIGHT_VALUE.divide(new BigDecimal(objective.getKpis().size()), scale, round));
                }
            }
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) BigDecimal(java.math.BigDecimal)

Example 3 with VisionVO

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

the class ScoreCalculationCommand method processPerspectivesScore.

private void processPerspectivesScore(List<VisionVO> visions) throws Exception {
    for (VisionVO vision : visions) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            float score = 0.0f;
            for (ObjectiveVO objective : perspective.getObjectives()) {
                score += objective.getScore() * this.getWeightPercentage(objective.getWeight());
            }
            perspective.setScore(score);
            perspective.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
            perspective.setFontColor(BscScoreColorUtils.getFontColor(score));
        /*
				perspective.setImgIcon( 
						BscReportSupportUtils.getHtmlIconBase(
								"PERSPECTIVES", 
								perspective.getTarget(), 
								perspective.getMin(), 
								score, 
								"", 
								"", 
								0)
				);
				*/
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 4 with VisionVO

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

the class ScoreCalculationCommand method processObjectivesScore.

private void processObjectivesScore(List<VisionVO> visions) throws Exception {
    for (VisionVO vision : visions) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            for (ObjectiveVO objective : perspective.getObjectives()) {
                float score = 0.0f;
                for (KpiVO kpi : objective.getKpis()) {
                    score += kpi.getScore() * this.getWeightPercentage(kpi.getWeight());
                }
                objective.setScore(score);
                objective.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
                objective.setFontColor(BscScoreColorUtils.getFontColor(score));
            /*
					objective.setImgIcon( 
							BscReportSupportUtils.getHtmlIconBase(
									"OBJECTIVES", 
									objective.getTarget(), 
									objective.getMin(), 
									score, 
									"", 
									"", 
									0)
					);
					*/
            }
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 5 with VisionVO

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

the class ScoreCalculationCommand method processVisionsScore.

private void processVisionsScore(List<VisionVO> visions) throws Exception {
    for (VisionVO vision : visions) {
        float score = 0.0f;
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            score += perspective.getScore() * this.getWeightPercentage(perspective.getWeight());
        }
        vision.setScore(score);
        vision.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
        vision.setFontColor(BscScoreColorUtils.getFontColor(score));
    }
}
Also used : 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