Search in sources :

Example 36 with PerspectiveVO

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

the class ScorecardQueryContentAction method handlerDashboardChartData.

private void handlerDashboardChartData() throws Exception {
    if (this.rootVision == null) {
        return;
    }
    // 準備要顯示 highcharts 要用的資料
    // 給 Dashboard 頁面 trend line chart 用的資料
    int c = 0;
    for (PerspectiveVO perspective : this.rootVision.getPerspectives()) {
        for (ObjectiveVO objective : perspective.getObjectives()) {
            for (KpiVO kpi : objective.getKpis()) {
                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) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) LinkedList(java.util.LinkedList)

Example 37 with PerspectiveVO

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

the class KpiReportPdfCommand method createBody.

private void createBody(PdfPTable table, VisionVO vision) throws Exception {
    Map<String, String> managementMap = BscKpiCode.getManagementMap(false);
    //Map<String, String> calculationMap = BscKpiCode.getCalculationMap(false);		
    PdfPCell cell = null;
    for (PerspectiveVO perspective : vision.getPerspectives()) {
        Image pImage = Image.getInstance(BscReportSupportUtils.getByteIconBase("PERSPECTIVES", perspective.getTarget(), perspective.getMin(), perspective.getScore(), "", "", 0));
        pImage.setWidthPercentage(10f);
        String content = this.getItemsContent(perspective.getName(), perspective.getScore(), perspective.getWeight(), perspective.getTarget(), perspective.getMin());
        cell = new PdfPCell();
        cell.addElement(pImage);
        cell.addElement(new Phrase("\n" + content, this.getFont(perspective.getFontColor(), false)));
        this.setCellBackgroundColor(cell, perspective.getBgColor());
        cell.setRowspan(perspective.getRow());
        table.addCell(cell);
        for (ObjectiveVO objective : perspective.getObjectives()) {
            Image oImage = Image.getInstance(BscReportSupportUtils.getByteIconBase("OBJECTIVES", objective.getTarget(), objective.getMin(), objective.getScore(), "", "", 0));
            oImage.setWidthPercentage(10f);
            content = this.getItemsContent(objective.getName(), objective.getScore(), objective.getWeight(), objective.getTarget(), objective.getMin());
            cell = new PdfPCell();
            cell.addElement(oImage);
            cell.addElement(new Phrase("\n" + content, this.getFont(objective.getFontColor(), false)));
            this.setCellBackgroundColor(cell, objective.getBgColor());
            cell.setRowspan(objective.getRow());
            table.addCell(cell);
            for (KpiVO kpi : objective.getKpis()) {
                /*
					content = this.getKpisContent(
							kpi, 
							managementMap, 
							calculationMap);	
					*/
                Image kImage = Image.getInstance(BscReportSupportUtils.getByteIconBase("KPI", kpi.getTarget(), kpi.getMin(), kpi.getScore(), kpi.getCompareType(), kpi.getManagement(), kpi.getQuasiRange()));
                kImage.setWidthPercentage(10f);
                content = this.getKpisContent(kpi, managementMap);
                cell = new PdfPCell();
                cell.addElement(kImage);
                cell.addElement(new Phrase("\n" + content, this.getFont(kpi.getFontColor(), false)));
                this.setCellBackgroundColor(cell, kpi.getBgColor());
                table.addCell(cell);
            }
        }
    }
}
Also used : PdfPCell(com.itextpdf.text.pdf.PdfPCell) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) Phrase(com.itextpdf.text.Phrase) BufferedImage(java.awt.image.BufferedImage) Image(com.itextpdf.text.Image)

Example 38 with PerspectiveVO

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

the class KpiDateRangeScoreCommand method execute.

/*
	private static final String QUARTER_1 = "Q1";
	private static final String QUARTER_2 = "Q2";
	private static final String QUARTER_3 = "Q3";
	private static final String QUARTER_4 = "Q4";
	private static final String HALF_YEAR_FIRST = "first";
	private static final String HALF_YEAR_LAST = "last";
	*/
@Override
public boolean execute(Context context) throws Exception {
    if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
        return false;
    }
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    String frequency = (String) context.get("frequency");
    String startYearDate = StringUtils.defaultString((String) context.get("startYearDate")).trim();
    String endYearDate = StringUtils.defaultString((String) context.get("endYearDate")).trim();
    String startDate = StringUtils.defaultString((String) context.get("startDate")).trim();
    String endDate = StringUtils.defaultString((String) context.get("endDate")).trim();
    //long beg = System.currentTimeMillis();
    for (VisionVO vision : treeObj.getVisions()) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            for (ObjectiveVO objective : perspective.getObjectives()) {
                // 2015-04-11 add
                ExecutorService kpiCalculationPool = Executors.newFixedThreadPool(SimpleUtils.getAvailableProcessors(objective.getKpis().size()));
                for (KpiVO kpi : objective.getKpis()) {
                    /* 2015-04-11 rem
						if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(frequency) 
								|| BscMeasureDataFrequency.FREQUENCY_WEEK.equals(frequency) 
								|| BscMeasureDataFrequency.FREQUENCY_MONTH.equals(frequency) ) {
							this.fillDateRangeMonth(kpi, frequency, startDate, endDate);
						} else {
							this.fillDateRangeYear(kpi, frequency, startYearDate, endYearDate);
						}
						*/
                    // 2015-04-11 add
                    ScoreCalculationCallableData data = new ScoreCalculationCallableData();
                    data.setDefaultMode(false);
                    data.setKpi(kpi);
                    data.setFrequency(frequency);
                    data.setDate1(startYearDate);
                    data.setDate2(endYearDate);
                    if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_WEEK.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_MONTH.equals(frequency)) {
                        data.setDate1(startDate);
                        data.setDate2(endDate);
                    }
                    data = kpiCalculationPool.submit(new ScoreCalculationCallable(data)).get();
                }
                kpiCalculationPool.shutdown();
            }
        }
    }
    //System.out.println( this.getClass().getName() + " use time(MS) = " + (end-beg) );
    return false;
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) ExecutorService(java.util.concurrent.ExecutorService) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) ScoreCalculationCallableData(com.netsteadfast.greenstep.bsc.support.ScoreCalculationCallableData) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) ScoreCalculationCallable(com.netsteadfast.greenstep.bsc.support.ScoreCalculationCallable) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 39 with PerspectiveVO

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

the class OrganizationReportPdfCommand method createBody.

private void createBody(PdfPTable table, VisionVO vision) throws Exception {
    String bgColor = "#ffffff";
    String fnColor = "#000000";
    PdfPCell cell = null;
    for (PerspectiveVO perspective : vision.getPerspectives()) {
        cell = new PdfPCell();
        cell.addElement(new Phrase(perspective.getName(), this.getFont(fnColor, false)));
        this.setCellBackgroundColor(cell, bgColor);
        cell.setRowspan(perspective.getRow());
        table.addCell(cell);
        for (ObjectiveVO objective : perspective.getObjectives()) {
            cell = new PdfPCell();
            cell.addElement(new Phrase(objective.getName(), this.getFont(fnColor, false)));
            this.setCellBackgroundColor(cell, bgColor);
            cell.setRowspan(objective.getRow());
            table.addCell(cell);
            for (KpiVO kpi : objective.getKpis()) {
                cell = new PdfPCell();
                cell.addElement(new Phrase(kpi.getName(), this.getFont(fnColor, false)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setRowspan(1);
                table.addCell(cell);
                cell = new PdfPCell();
                cell.addElement(new Phrase(kpi.getWeight() + "%", this.getFont(fnColor, false)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setRowspan(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, false)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setRowspan(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(), false)));
                this.setCellBackgroundColor(cell, dateRangeScore.getBgColor());
                cell.setRowspan(1);
                table.addCell(cell);
            }
        }
    }
}
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 40 with PerspectiveVO

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

the class LoadBscStructTreeCommand method processPerspective.

private void processPerspective(BscStructTreeObj treeObj, List<BscMixDataVO> mixDatas) throws Exception {
    for (VisionVO vision : treeObj.getVisions()) {
        for (BscMixDataVO mixData : mixDatas) {
            if (!vision.getVisId().equals(mixData.getVisId())) {
                continue;
            }
            boolean found = false;
            for (int i = 0; i < vision.getPerspectives().size(); i++) {
                if (vision.getPerspectives().get(i).getPerId().equals(mixData.getPerId())) {
                    found = true;
                }
            }
            if (!found) {
                PerspectiveVO perspective = new PerspectiveVO();
                perspective.setOid(mixData.getPerOid());
                perspective.setPerId(mixData.getPerId());
                perspective.setVisId(mixData.getVisId());
                perspective.setName(mixData.getPerName());
                perspective.setWeight(mixData.getPerWeight());
                perspective.setTarget(mixData.getPerTarget());
                perspective.setMin(mixData.getPerMin());
                perspective.setDescription(mixData.getPerDescription());
                vision.getPerspectives().add(perspective);
            }
        }
    }
}
Also used : PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) BscMixDataVO(com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)

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