Search in sources :

Example 11 with DateRangeScoreVO

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

the class TsaQueryForecastAction method fillLineChartData.

private void fillLineChartData(List<TimeSeriesAnalysisResult> results) throws Exception {
    this.tsa = TimeSeriesAnalysisUtils.getParam(this.getFields().get("tsaOid"));
    List<BbTsaMaCoefficients> coefficientsList = TimeSeriesAnalysisUtils.getCoefficients(this.tsa);
    for (BbTsaMaCoefficients maCoefficients : coefficientsList) {
        Map<String, String> dataMap = new HashMap<String, String>();
        dataMap.put("seq", String.valueOf(maCoefficients.getSeq()));
        dataMap.put("seqValue", String.valueOf(maCoefficients.getSeqValue()));
        this.coefficients.add(dataMap);
    }
    // ==============================================================================
    // 產生 categories 資料
    KpiVO firstKpi = results.get(0).getKpi();
    for (DateRangeScoreVO dateRangeScore : firstKpi.getDateRangeScores()) {
        this.categories.add(dateRangeScore.getDate());
    }
    List<Double> firstForecastNext = results.get(0).getForecastNext();
    for (int i = 0; i < firstForecastNext.size(); i++) {
        this.categories.add("next(" + (i + 1) + ")");
    }
    // 產生 series 資料
    for (int i = 0; results != null && i < results.size(); i++) {
        KpiVO kpi = results.get(i).getKpi();
        List<Double> forecastNext = results.get(i).getForecastNext();
        Map<String, Object> mapData = new HashMap<String, Object>();
        List<Float> rangeScore = new LinkedList<Float>();
        for (DateRangeScoreVO dateRangeScore : kpi.getDateRangeScores()) {
            rangeScore.add(dateRangeScore.getScore());
        }
        for (int j = 0; j < forecastNext.size(); j++) {
            rangeScore.add(Float.parseFloat(Double.toString(forecastNext.get(j))));
        }
        mapData.put("name", kpi.getName());
        mapData.put("data", rangeScore);
        this.series.add(mapData);
    }
// ==============================================================================
}
Also used : HashMap(java.util.HashMap) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) BbTsaMaCoefficients(com.netsteadfast.greenstep.po.hbm.BbTsaMaCoefficients) LinkedList(java.util.LinkedList)

Example 12 with DateRangeScoreVO

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

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

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

the class TimeSeriesAnalysisExcelCommand method putTables.

private void putTables(XSSFWorkbook wb, XSSFSheet sh, Context context) throws Exception {
    TsaVO tsa = (TsaVO) context.get("tsa");
    @SuppressWarnings("unchecked") List<BbTsaMaCoefficients> coefficients = (List<BbTsaMaCoefficients>) context.get("coefficients");
    @SuppressWarnings("unchecked") List<TimeSeriesAnalysisResult> tsaResults = (List<TimeSeriesAnalysisResult>) context.get("tsaResults");
    XSSFFont cellHeadFont = wb.createFont();
    cellHeadFont.setBold(true);
    XSSFCellStyle cellHeadStyle = wb.createCellStyle();
    cellHeadStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#f5f5f5")));
    cellHeadStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    cellHeadStyle.setBorderBottom(BorderStyle.THIN);
    cellHeadStyle.setBorderTop(BorderStyle.THIN);
    cellHeadStyle.setBorderRight(BorderStyle.THIN);
    cellHeadStyle.setBorderLeft(BorderStyle.THIN);
    cellHeadStyle.setFont(cellHeadFont);
    XSSFCellStyle cellHeadStyleBlank = wb.createCellStyle();
    cellHeadStyleBlank.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#ffffff")));
    cellHeadStyleBlank.setFont(cellHeadFont);
    XSSFCellStyle cellHeadStyle2 = wb.createCellStyle();
    cellHeadStyle2.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#ffffff")));
    cellHeadStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    cellHeadStyle2.setBorderBottom(BorderStyle.THIN);
    cellHeadStyle2.setBorderTop(BorderStyle.THIN);
    cellHeadStyle2.setBorderRight(BorderStyle.THIN);
    cellHeadStyle2.setBorderLeft(BorderStyle.THIN);
    sh.setColumnWidth(0, 12000);
    int row = 0;
    // ==============================================================
    Row nowRow = sh.createRow(row);
    Cell cellTitle = nowRow.createCell(0);
    cellTitle.setCellStyle(cellHeadStyleBlank);
    cellTitle.setCellValue("Forecast analysis - " + context.get("visionName"));
    row++;
    // ==============================================================
    nowRow = sh.createRow(row);
    Cell cell0a = nowRow.createCell(0);
    cell0a.setCellStyle(cellHeadStyleBlank);
    cell0a.setCellValue("Frequency: " + context.get("frequencyName") + " , Date range: " + context.get("date1") + " - " + context.get("date2") + " , " + "Measure data type for: " + context.get("dataFor") + " , " + context.get("organizationName") + context.get("employeeName"));
    row++;
    // ==============================================================
    nowRow = sh.createRow(row);
    Cell cell0b = nowRow.createCell(0);
    cell0b.setCellStyle(cellHeadStyleBlank);
    cell0b.setCellValue("");
    row++;
    // ==============================================================
    nowRow = sh.createRow(row);
    Cell cell1 = nowRow.createCell(0);
    cell1.setCellStyle(cellHeadStyleBlank);
    cell1.setCellValue("Param infornation");
    row++;
    // ==============================================================
    nowRow = sh.createRow(row);
    Cell cell2_a = nowRow.createCell(0);
    cell2_a.setCellStyle(cellHeadStyle);
    cell2_a.setCellValue("Item");
    Cell cell2_b = nowRow.createCell(1);
    cell2_b.setCellStyle(cellHeadStyle);
    cell2_b.setCellValue("Value");
    row++;
    // ==============================================================	
    nowRow = sh.createRow(row);
    Cell cell3_a = nowRow.createCell(0);
    cell3_a.setCellStyle(cellHeadStyle2);
    cell3_a.setCellValue("Param name");
    Cell cell3_b = nowRow.createCell(1);
    cell3_b.setCellStyle(cellHeadStyle2);
    cell3_b.setCellValue(tsa.getName());
    row++;
    // ==============================================================	
    nowRow = sh.createRow(row);
    Cell cell4_a = nowRow.createCell(0);
    cell4_a.setCellStyle(cellHeadStyle2);
    cell4_a.setCellValue("Integration order");
    Cell cell4_b = nowRow.createCell(1);
    cell4_b.setCellStyle(cellHeadStyle2);
    cell4_b.setCellValue(tsa.getIntegrationOrder());
    row++;
    // ==============================================================	
    nowRow = sh.createRow(row);
    Cell cell5_a = nowRow.createCell(0);
    cell5_a.setCellStyle(cellHeadStyle2);
    cell5_a.setCellValue("Forecast next");
    Cell cell5_b = nowRow.createCell(1);
    cell5_b.setCellStyle(cellHeadStyle2);
    cell5_b.setCellValue(tsa.getForecastNext());
    row++;
    // ==============================================================	
    nowRow = sh.createRow(row);
    Cell cell6_a = nowRow.createCell(0);
    cell6_a.setCellStyle(cellHeadStyle2);
    cell6_a.setCellValue("Description");
    Cell cell6_b = nowRow.createCell(1);
    cell6_b.setCellStyle(cellHeadStyle2);
    cell6_b.setCellValue(StringUtils.defaultString(tsa.getDescription()).trim());
    row++;
    // ==============================================================
    for (int i = 0; coefficients != null && i < coefficients.size(); i++) {
        BbTsaMaCoefficients coefficient = coefficients.get(i);
        nowRow = sh.createRow(row);
        Cell cell7x_a = nowRow.createCell(0);
        cell7x_a.setCellStyle(cellHeadStyle2);
        cell7x_a.setCellValue("Coefficient (" + (i + 1) + ")");
        Cell cell7x_b = nowRow.createCell(1);
        cell7x_b.setCellStyle(cellHeadStyle2);
        cell7x_b.setCellValue(String.valueOf(coefficient.getSeqValue()));
        row++;
    }
    // ==============================================================
    nowRow = sh.createRow(row);
    Cell cellTitle3a = nowRow.createCell(0);
    cellTitle3a.setCellStyle(cellHeadStyleBlank);
    cellTitle3a.setCellValue("");
    row++;
    // 填寫標題
    nowRow = sh.createRow(row);
    Cell cellTitle2a = nowRow.createCell(0);
    cellTitle2a.setCellStyle(cellHeadStyle);
    cellTitle2a.setCellValue("KPIs");
    int j = 1;
    TimeSeriesAnalysisResult firstResult = tsaResults.get(0);
    for (int i = 0; i < firstResult.getKpi().getDateRangeScores().size(); i++) {
        DateRangeScoreVO dateRangeScore = firstResult.getKpi().getDateRangeScores().get(i);
        Cell cellTitle2a_dateRange = nowRow.createCell(j);
        j++;
        cellTitle2a_dateRange.setCellStyle(cellHeadStyle);
        cellTitle2a_dateRange.setCellValue(dateRangeScore.getDate());
    }
    for (int i = 0; i < firstResult.getForecastNext().size(); i++) {
        Cell cellTitle2a_dateRange = nowRow.createCell(j);
        j++;
        cellTitle2a_dateRange.setCellStyle(cellHeadStyle);
        cellTitle2a_dateRange.setCellValue("next(" + (i + 1) + ")");
    }
    row++;
    // 填寫 Date Range score 與 Forecast next score
    for (int i = 0; i < tsaResults.size(); i++) {
        nowRow = sh.createRow(row);
        j = 0;
        TimeSeriesAnalysisResult resultModel = tsaResults.get(i);
        Cell cell_kpi = nowRow.createCell(j);
        cell_kpi.setCellStyle(cellHeadStyle);
        cell_kpi.setCellValue(resultModel.getKpi().getName());
        j++;
        for (int n = 0; n < resultModel.getKpi().getDateRangeScores().size(); n++) {
            DateRangeScoreVO dateRangeScore = resultModel.getKpi().getDateRangeScores().get(n);
            Cell cell_dateRangeScore = nowRow.createCell(j);
            cell_dateRangeScore.setCellStyle(cellHeadStyle2);
            cell_dateRangeScore.setCellValue(dateRangeScore.getScore());
            j++;
        }
        for (int n = 0; n < resultModel.getForecastNext().size(); n++) {
            double forecastScore = resultModel.getForecastNext().get(n);
            Cell cell_forecastScore = nowRow.createCell(j);
            cell_forecastScore.setCellStyle(cellHeadStyle2);
            cell_forecastScore.setCellValue(forecastScore);
            j++;
        }
        row++;
    }
}
Also used : DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) TsaVO(com.netsteadfast.greenstep.vo.TsaVO) BbTsaMaCoefficients(com.netsteadfast.greenstep.po.hbm.BbTsaMaCoefficients) TimeSeriesAnalysisResult(com.netsteadfast.greenstep.bsc.model.TimeSeriesAnalysisResult) XSSFColor(org.apache.poi.xssf.usermodel.XSSFColor) XSSFCellStyle(org.apache.poi.xssf.usermodel.XSSFCellStyle) XSSFFont(org.apache.poi.xssf.usermodel.XSSFFont) List(java.util.List) Row(org.apache.poi.ss.usermodel.Row) Cell(org.apache.poi.ss.usermodel.Cell)

Example 15 with DateRangeScoreVO

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

the class PersonalAndOrganizationReportDateRangeScoreCommand method setDateRangeScore.

private void setDateRangeScore(KpiVO kpi, String dateType, String year) throws Exception {
    float score = 0.0f;
    // year
    String date = year + "0101";
    if ("2".equals(dateType)) {
        // second helf-year
        date = year + "0701";
    }
    for (BbMeasureData measureData : kpi.getMeasureDatas()) {
        if (date.equals(measureData.getDate())) {
            BscMeasureData data = new BscMeasureData();
            data.setActual(measureData.getActual());
            data.setTarget(measureData.getTarget());
            Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
            // 2016-07-01
            if (NumberUtils.isNumber(String.valueOf(value))) {
                score = NumberUtils.toFloat(String.valueOf(value), 0.0f);
            }
        }
    }
    DateRangeScoreVO dateRangeScore = new DateRangeScoreVO();
    dateRangeScore.setDate(date);
    dateRangeScore.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
    dateRangeScore.setFontColor(BscScoreColorUtils.getFontColor(score));
    dateRangeScore.setTarget(kpi.getTarget());
    dateRangeScore.setMin(kpi.getMin());
    dateRangeScore.setScore(score);
    dateRangeScore.setImgIcon("");
    kpi.getDateRangeScores().add(dateRangeScore);
}
Also used : BscMeasureData(com.netsteadfast.greenstep.bsc.model.BscMeasureData) BbMeasureData(com.netsteadfast.greenstep.po.hbm.BbMeasureData) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO)

Aggregations

DateRangeScoreVO (com.netsteadfast.greenstep.vo.DateRangeScoreVO)21 BbMeasureData (com.netsteadfast.greenstep.po.hbm.BbMeasureData)9 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)9 BscMeasureData (com.netsteadfast.greenstep.bsc.model.BscMeasureData)8 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)8 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)8 HashMap (java.util.HashMap)5 Cell (org.apache.poi.ss.usermodel.Cell)4 Row (org.apache.poi.ss.usermodel.Row)4 XSSFCellStyle (org.apache.poi.xssf.usermodel.XSSFCellStyle)4 XSSFColor (org.apache.poi.xssf.usermodel.XSSFColor)4 XSSFFont (org.apache.poi.xssf.usermodel.XSSFFont)4 Phrase (com.itextpdf.text.Phrase)3 PdfPCell (com.itextpdf.text.pdf.PdfPCell)3 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)3 CellRangeAddress (org.apache.poi.ss.util.CellRangeAddress)3 BbTsaMaCoefficients (com.netsteadfast.greenstep.po.hbm.BbTsaMaCoefficients)2 List (java.util.List)2 Image (com.itextpdf.text.Image)1