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;
}
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));
}
}
}
}
}
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)
);
*/
}
}
}
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)
);
*/
}
}
}
}
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));
}
}
Aggregations