Search in sources :

Example 16 with BbMeasureData

use of com.netsteadfast.greenstep.po.hbm.BbMeasureData in project bamboobsc by billchen198318.

the class AggregationMethod method countDistinct.

public float countDistinct(KpiVO kpi) throws Exception {
    List<BbMeasureData> measureDatas = kpi.getMeasureDatas();
    List<Float> scores = new ArrayList<Float>();
    for (BbMeasureData measureData : measureDatas) {
        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();
        }
    }
    return Float.valueOf(scores.size());
}
Also used : BscMeasureData(com.netsteadfast.greenstep.bsc.model.BscMeasureData) ArrayList(java.util.ArrayList) BbMeasureData(com.netsteadfast.greenstep.po.hbm.BbMeasureData)

Example 17 with BbMeasureData

use of com.netsteadfast.greenstep.po.hbm.BbMeasureData 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 18 with BbMeasureData

use of com.netsteadfast.greenstep.po.hbm.BbMeasureData 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 19 with BbMeasureData

use of com.netsteadfast.greenstep.po.hbm.BbMeasureData 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

BbMeasureData (com.netsteadfast.greenstep.po.hbm.BbMeasureData)19 BscMeasureData (com.netsteadfast.greenstep.bsc.model.BscMeasureData)15 DateRangeScoreVO (com.netsteadfast.greenstep.vo.DateRangeScoreVO)9 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)2 CustomeOperational (com.netsteadfast.greenstep.base.model.CustomeOperational)1 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)1 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)1 MeasureDataVO (com.netsteadfast.greenstep.vo.MeasureDataVO)1 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)1 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)1 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)1