Search in sources :

Example 31 with ObjectiveVO

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

the class ScorecardQueryContentAction method loadObjectiveCardContent.

private void loadObjectiveCardContent() throws ServiceException, Exception {
    StringBuilder outContent = new StringBuilder();
    this.message = SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA);
    String uploadOid = this.getFields().get("uploadOid");
    String perspectiveOid = super.defaultString(this.getFields().get("perspectiveOid"));
    VisionVO vision = BscMobileCardUtils.getVisionCardFromUpload(uploadOid);
    List<PerspectiveVO> perspectives = vision.getPerspectives();
    for (PerspectiveVO perspective : perspectives) {
        if (perspectiveOid.equals(perspective.getOid())) {
            this.rootPerspective = perspective;
            List<ObjectiveVO> objectives = perspective.getObjectives();
            for (ObjectiveVO objective : objectives) {
                outContent.append(BscMobileCardUtils.getObjectivesCardContent(uploadOid, objective));
                outContent.append(super.getHtmlBr());
            }
        }
    }
    this.content = outContent.toString();
    if (!StringUtils.isBlank(content)) {
        this.loadColor();
        this.message = this.getText("MESSAGE.ScorecardQueryContentAction_06");
        this.success = IS_YES;
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 32 with ObjectiveVO

use of com.netsteadfast.greenstep.vo.ObjectiveVO 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 33 with ObjectiveVO

use of com.netsteadfast.greenstep.vo.ObjectiveVO 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 34 with ObjectiveVO

use of com.netsteadfast.greenstep.vo.ObjectiveVO 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 35 with ObjectiveVO

use of com.netsteadfast.greenstep.vo.ObjectiveVO 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)

Aggregations

ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)50 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)44 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)34 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)29 HashMap (java.util.HashMap)15 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)13 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)8 DateRangeScoreVO (com.netsteadfast.greenstep.vo.DateRangeScoreVO)8 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 LinkedList (java.util.LinkedList)6 Phrase (com.itextpdf.text.Phrase)4 PdfPCell (com.itextpdf.text.pdf.PdfPCell)4 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)4 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)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 XSSFColor (org.apache.poi.xssf.usermodel.XSSFColor)4