use of com.netsteadfast.greenstep.vo.PerspectiveVO in project bamboobsc by billchen198318.
the class PersonalReportPdfCommand method createBody.
private void createBody(PdfPTable table, VisionVO vision) throws Exception {
String bgColor = "#ffffff";
String fnColor = "#000000";
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
int kx = 0;
for (KpiVO kpi : objective.getKpis()) {
PdfPCell cell = new PdfPCell();
if (kx == 0) {
cell.addElement(new Phrase(objective.getName(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
cell.setRowspan(objective.getRow());
table.addCell(cell);
}
cell = new PdfPCell();
cell.addElement(new Phrase(kpi.getName(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("max: " + kpi.getMax() + "\n" + "target: " + kpi.getTarget() + "\n" + "min: " + kpi.getMin() + "\n" + "unit: " + kpi.getUnit(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(kpi.getWeight() + "%", this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(kpi.getFormula().getName(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
// 只顯示一筆日期分數資料
DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(0);
cell = new PdfPCell();
cell.addElement(new Phrase(BscReportSupportUtils.parse2(dateRangeScore.getScore()), this.getFont(dateRangeScore.getFontColor(), true)));
this.setCellBackgroundColor(cell, dateRangeScore.getBgColor());
cell.setColspan(1);
table.addCell(cell);
kx++;
}
}
}
}
use of com.netsteadfast.greenstep.vo.PerspectiveVO 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.PerspectiveVO 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.PerspectiveVO in project bamboobsc by billchen198318.
the class PerspectiveServiceImpl method findForMapByVisionOid.
@Override
public Map<String, String> findForMapByVisionOid(String visionOid, boolean pleaseSelect) throws ServiceException, Exception {
Map<String, String> dataMap = this.providedSelectZeroDataMap(pleaseSelect);
List<PerspectiveVO> searchList = this.findForListByVisionOid(visionOid);
if (searchList == null || searchList.size() < 1) {
return dataMap;
}
for (PerspectiveVO p : searchList) {
dataMap.put(p.getOid(), p.getName());
}
return dataMap;
}
use of com.netsteadfast.greenstep.vo.PerspectiveVO 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)
);
*/
}
}
}
Aggregations