Search in sources :

Example 1 with PerspectiveVO

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++;
            }
        }
    }
}
Also used : PdfPCell(com.itextpdf.text.pdf.PdfPCell) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) Phrase(com.itextpdf.text.Phrase)

Example 2 with PerspectiveVO

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;
}
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 3 with PerspectiveVO

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));
                }
            }
        }
    }
}
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 4 with PerspectiveVO

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;
}
Also used : PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO)

Example 5 with PerspectiveVO

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)
				);
				*/
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Aggregations

PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)58 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)44 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)38 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)33 HashMap (java.util.HashMap)17 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)15 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)8 DateRangeScoreVO (com.netsteadfast.greenstep.vo.DateRangeScoreVO)8 LinkedList (java.util.LinkedList)8 Map (java.util.Map)8 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)6 ArrayList (java.util.ArrayList)6 Transactional (org.springframework.transaction.annotation.Transactional)6 Phrase (com.itextpdf.text.Phrase)4 PdfPCell (com.itextpdf.text.pdf.PdfPCell)4 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)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