Search in sources :

Example 16 with DateRangeScoreVO

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

the class AggregationMethod method sumDateRange.

public void sumDateRange(KpiVO kpi, String frequency) throws Exception {
    BscReportSupportUtils.loadExpression();
    for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
        float score = 0.0f;
        //int size = 0;
        for (BbMeasureData measureData : kpi.getMeasureDatas()) {
            String date = dateScore.getDate().replaceAll("/", "");
            if (!this.isDateRange(date, frequency, measureData)) {
                continue;
            }
            BscMeasureData data = new BscMeasureData();
            data.setActual(measureData.getActual());
            data.setTarget(measureData.getTarget());
            try {
                Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
                if (value == null) {
                    continue;
                }
                if (!NumberUtils.isNumber(String.valueOf(value))) {
                    continue;
                }
                score += NumberUtils.toFloat(String.valueOf(value), 0.0f);
            //size++;					
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        dateScore.setScore(score);
        dateScore.setFontColor(BscScoreColorUtils.getFontColor(score));
        dateScore.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
        dateScore.setImgIcon(BscReportSupportUtils.getHtmlIcon(kpi, score));
    }
}
Also used : BscMeasureData(com.netsteadfast.greenstep.bsc.model.BscMeasureData) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) BbMeasureData(com.netsteadfast.greenstep.po.hbm.BbMeasureData)

Example 17 with DateRangeScoreVO

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

the class AggregationMethod method countDistinctDateRange.

public void countDistinctDateRange(KpiVO kpi, String frequency) throws Exception {
    BscReportSupportUtils.loadExpression();
    for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
        List<Float> scores = new ArrayList<Float>();
        float score = 0.0f;
        //int size = 0;
        for (BbMeasureData measureData : kpi.getMeasureDatas()) {
            String date = dateScore.getDate().replaceAll("/", "");
            if (!this.isDateRange(date, frequency, measureData)) {
                continue;
            }
            BscMeasureData data = new BscMeasureData();
            data.setActual(measureData.getActual());
            data.setTarget(measureData.getTarget());
            try {
                Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
                if (value == null) {
                    continue;
                }
                if (!NumberUtils.isNumber(String.valueOf(value))) {
                    continue;
                }
                float nowScore = NumberUtils.toFloat(String.valueOf(value), 0.0f);
                if (!scores.contains(nowScore)) {
                    scores.add(nowScore);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        score = Float.valueOf(scores.size());
        dateScore.setScore(score);
        dateScore.setFontColor(BscScoreColorUtils.getFontColor(score));
        dateScore.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
        dateScore.setImgIcon(BscReportSupportUtils.getHtmlIcon(kpi, score));
    }
}
Also used : BscMeasureData(com.netsteadfast.greenstep.bsc.model.BscMeasureData) ArrayList(java.util.ArrayList) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) BbMeasureData(com.netsteadfast.greenstep.po.hbm.BbMeasureData)

Example 18 with DateRangeScoreVO

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

the class AggregationMethod method minDateRange.

public void minDateRange(KpiVO kpi, String frequency) throws Exception {
    BscReportSupportUtils.loadExpression();
    for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
        float score = 0.0f;
        float nowScore = 0.0f;
        int size = 0;
        for (BbMeasureData measureData : kpi.getMeasureDatas()) {
            String date = dateScore.getDate().replaceAll("/", "");
            if (!this.isDateRange(date, frequency, measureData)) {
                continue;
            }
            BscMeasureData data = new BscMeasureData();
            data.setActual(measureData.getActual());
            data.setTarget(measureData.getTarget());
            try {
                Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
                if (value == null) {
                    continue;
                }
                if (!NumberUtils.isNumber(String.valueOf(value))) {
                    continue;
                }
                nowScore = NumberUtils.toFloat(String.valueOf(value), 0.0f);
                if (size < 1) {
                    score = nowScore;
                } else {
                    // Min
                    if (score > nowScore) {
                        score = nowScore;
                    }
                }
                size++;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        dateScore.setScore(score);
        dateScore.setFontColor(BscScoreColorUtils.getFontColor(score));
        dateScore.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
        dateScore.setImgIcon(BscReportSupportUtils.getHtmlIcon(kpi, score));
    }
}
Also used : BscMeasureData(com.netsteadfast.greenstep.bsc.model.BscMeasureData) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) BbMeasureData(com.netsteadfast.greenstep.po.hbm.BbMeasureData)

Example 19 with DateRangeScoreVO

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

the class AggregationMethod method maxDateRange.

public void maxDateRange(KpiVO kpi, String frequency) throws Exception {
    BscReportSupportUtils.loadExpression();
    for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
        float score = 0.0f;
        float nowScore = 0.0f;
        int size = 0;
        for (BbMeasureData measureData : kpi.getMeasureDatas()) {
            String date = dateScore.getDate().replaceAll("/", "");
            if (!this.isDateRange(date, frequency, measureData)) {
                continue;
            }
            BscMeasureData data = new BscMeasureData();
            data.setActual(measureData.getActual());
            data.setTarget(measureData.getTarget());
            try {
                Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
                if (value == null) {
                    continue;
                }
                if (!NumberUtils.isNumber(String.valueOf(value))) {
                    continue;
                }
                nowScore = NumberUtils.toFloat(String.valueOf(value), 0.0f);
                if (size < 1) {
                    score = nowScore;
                } else {
                    // Max
                    if (score < nowScore) {
                        score = nowScore;
                    }
                }
                size++;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        dateScore.setScore(score);
        dateScore.setFontColor(BscScoreColorUtils.getFontColor(score));
        dateScore.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
        dateScore.setImgIcon(BscReportSupportUtils.getHtmlIcon(kpi, score));
    }
}
Also used : BscMeasureData(com.netsteadfast.greenstep.bsc.model.BscMeasureData) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) BbMeasureData(com.netsteadfast.greenstep.po.hbm.BbMeasureData)

Example 20 with DateRangeScoreVO

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

the class AggregationMethod method averageDateRange.

public void averageDateRange(KpiVO kpi, String frequency) throws Exception {
    BscReportSupportUtils.loadExpression();
    for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
        float score = 0.0f;
        int size = 0;
        for (BbMeasureData measureData : kpi.getMeasureDatas()) {
            String date = dateScore.getDate().replaceAll("/", "");
            if (!this.isDateRange(date, frequency, measureData)) {
                continue;
            }
            BscMeasureData data = new BscMeasureData();
            data.setActual(measureData.getActual());
            data.setTarget(measureData.getTarget());
            try {
                Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
                if (value == null) {
                    continue;
                }
                if (!NumberUtils.isNumber(String.valueOf(value))) {
                    continue;
                }
                score += NumberUtils.toFloat(String.valueOf(value), 0.0f);
                size++;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (score != 0.0f && size > 0) {
            score = score / size;
        }
        dateScore.setScore(score);
        dateScore.setFontColor(BscScoreColorUtils.getFontColor(score));
        dateScore.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
        dateScore.setImgIcon(BscReportSupportUtils.getHtmlIcon(kpi, score));
    }
}
Also used : BscMeasureData(com.netsteadfast.greenstep.bsc.model.BscMeasureData) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) BbMeasureData(com.netsteadfast.greenstep.po.hbm.BbMeasureData)

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