use of com.netsteadfast.greenstep.vo.DateRangeScoreVO in project bamboobsc by billchen198318.
the class PersonalReportPdfCommand method createBody.
private void createBody(PdfPTable table, VisionVO vision) throws Exception {
String bgColor = "#ffffff";
String fnColor = "#000000";
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
int kx = 0;
for (KpiVO kpi : objective.getKpis()) {
PdfPCell cell = new PdfPCell();
if (kx == 0) {
cell.addElement(new Phrase(objective.getName(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
cell.setRowspan(objective.getRow());
table.addCell(cell);
}
cell = new PdfPCell();
cell.addElement(new Phrase(kpi.getName(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(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, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(kpi.getWeight() + "%", this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(1);
table.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase(kpi.getFormula().getName(), this.getFont(fnColor, true)));
this.setCellBackgroundColor(cell, bgColor);
cell.setColspan(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(), true)));
this.setCellBackgroundColor(cell, dateRangeScore.getBgColor());
cell.setColspan(1);
table.addCell(cell);
kx++;
}
}
}
}
use of com.netsteadfast.greenstep.vo.DateRangeScoreVO in project bamboobsc by billchen198318.
the class PeriodTrendsCalUtils method fillKpiPeriodTrendsDateRangeScore.
private static void fillKpiPeriodTrendsDateRangeScore(PeriodTrendsData<KpiVO> periodData) throws Exception {
for (int i = 0; i < periodData.getCurrent().getDateRangeScores().size(); i++) {
DateRangeScoreVO currentRangeScore = periodData.getCurrent().getDateRangeScores().get(i);
DateRangeScoreVO previousRangeScore = periodData.getPrevious().getDateRangeScores().get(i);
periodData.getDateRangeLabels().add(currentRangeScore.getDate() + "(C) / " + previousRangeScore.getDate() + "(P)");
float score = 0.0f;
Object ans = BscFormulaUtils.parseKPIPeroidScoreChangeValue(periodData.getCurrent().getTrendsFormula(), currentRangeScore.getScore(), previousRangeScore.getScore());
String change = String.valueOf(ans);
if (NumberUtils.isNumber(String.valueOf(change))) {
score = NumberUtils.toFloat(change);
}
periodData.getDateRangeScores().add(NumberUtils.toFloat(BscReportSupportUtils.parse2(score)));
periodData.getCurrentDateRangeScores().add(currentRangeScore.getScore());
periodData.getPreviousDateRangeScores().add(previousRangeScore.getScore());
}
if (periodData.getDateRangeLabels().size() > 1) {
periodData.setCanChart(YesNo.YES);
}
}
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);
}
// ==============================================================================
}
use of com.netsteadfast.greenstep.vo.DateRangeScoreVO in project bamboobsc by billchen198318.
the class OrganizationReportExcelCommand method createMainBody.
private int createMainBody(XSSFWorkbook wb, XSSFSheet sh, int row, VisionVO vision) throws Exception {
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#ffffff")));
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFont = wb.createFont();
cellFont.setBold(false);
cellFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#000000")));
cellStyle.setFont(cellFont);
cellStyle.setWrapText(true);
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
int mrRow = row;
for (int px = 0; px < vision.getPerspectives().size(); px++) {
PerspectiveVO perspective = vision.getPerspectives().get(px);
for (int ox = 0; ox < perspective.getObjectives().size(); ox++) {
ObjectiveVO objective = perspective.getObjectives().get(ox);
for (int kx = 0; kx < objective.getKpis().size(); kx++) {
KpiVO kpi = objective.getKpis().get(kx);
Row contentRow = sh.createRow(row++);
Cell cell1 = contentRow.createCell(0);
cell1.setCellValue(perspective.getName());
cell1.setCellStyle(cellStyle);
Cell titleCell2 = contentRow.createCell(1);
titleCell2.setCellValue(objective.getName());
titleCell2.setCellStyle(cellStyle);
Cell titleCell3 = contentRow.createCell(2);
titleCell3.setCellValue(kpi.getName());
titleCell3.setCellStyle(cellStyle);
Cell titleCell4 = contentRow.createCell(3);
titleCell4.setCellValue(kpi.getWeight() + "%");
titleCell4.setCellStyle(cellStyle);
Cell titleCell5 = contentRow.createCell(4);
titleCell5.setCellValue("max: " + kpi.getMax() + "\n" + "target: " + kpi.getTarget() + "\n" + "min: " + kpi.getMin() + "\n" + "unit: " + kpi.getUnit());
titleCell5.setCellStyle(cellStyle);
DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(0);
XSSFCellStyle cellStyle2 = wb.createCellStyle();
cellStyle2.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getBgColor())));
cellStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFont2 = wb.createFont();
cellFont2.setBold(false);
cellFont2.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getFontColor())));
cellStyle2.setFont(cellFont2);
cellStyle2.setWrapText(true);
cellStyle2.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyle2.setBorderBottom(BorderStyle.THIN);
cellStyle2.setBorderTop(BorderStyle.THIN);
cellStyle2.setBorderRight(BorderStyle.THIN);
cellStyle2.setBorderLeft(BorderStyle.THIN);
Cell titleCell6 = contentRow.createCell(5);
titleCell6.setCellValue(BscReportSupportUtils.parse2(dateRangeScore.getScore()));
titleCell6.setCellStyle(cellStyle2);
}
}
}
for (int px = 0; px < vision.getPerspectives().size(); px++) {
PerspectiveVO perspective = vision.getPerspectives().get(px);
// 2016-12-13 old work with POI 3.12
//sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow + perspective.getRow()-1, 0, 0));
// 2016-12-13 new work with POI 3.15
int mrRow1 = mrRow + perspective.getRow() - 1;
if (mrRow1 > mrRow) {
sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow1, 0, 0));
}
for (int ox = 0; ox < perspective.getObjectives().size(); ox++) {
ObjectiveVO objective = perspective.getObjectives().get(ox);
// 2016-12-13 old work with POI 3.12
//sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow + objective.getRow()-1, 1, 1));
// 2016-12-13 new work with POI 3.15
int mrRow2 = mrRow + objective.getRow() - 1;
if (mrRow2 > mrRow) {
sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow2, 1, 1));
}
mrRow += objective.getKpis().size();
}
}
return row++;
}
use of com.netsteadfast.greenstep.vo.DateRangeScoreVO in project bamboobsc by billchen198318.
the class PersonalReportExcelCommand method createMainBody.
private int createMainBody(XSSFWorkbook wb, XSSFSheet sh, int row, VisionVO vision, Context context) throws Exception {
int mrRow = row;
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#ffffff")));
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFont = wb.createFont();
cellFont.setBold(false);
cellFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#000000")));
cellStyle.setFont(cellFont);
cellStyle.setWrapText(true);
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setWrapText(true);
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
for (KpiVO kpi : objective.getKpis()) {
int kCol = 0;
Row contentRow = sh.createRow(row++);
contentRow.setHeight((short) 1000);
Cell contentCell1 = contentRow.createCell(kCol++);
contentCell1.setCellValue(objective.getName());
contentCell1.setCellStyle(cellStyle);
Cell contentCell2 = contentRow.createCell(kCol++);
contentCell2.setCellValue(kpi.getName());
contentCell2.setCellStyle(cellStyle);
Cell contentCell3 = contentRow.createCell(kCol++);
contentCell3.setCellValue("max: " + kpi.getMax() + "\n" + "target: " + kpi.getTarget() + "\n" + "min: " + kpi.getMin() + "\n" + "unit: " + kpi.getUnit());
contentCell3.setCellStyle(cellStyle);
Cell contentCell4 = contentRow.createCell(kCol++);
contentCell4.setCellValue(kpi.getWeight() + "%");
contentCell4.setCellStyle(cellStyle);
Cell contentCell5 = contentRow.createCell(kCol++);
contentCell5.setCellValue(kpi.getFormula().getName());
contentCell5.setCellStyle(cellStyle);
// 只顯示一筆日期分數資料
DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(0);
XSSFCellStyle cellStyleScore = wb.createCellStyle();
cellStyleScore.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getBgColor())));
cellStyleScore.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellScoreFont = wb.createFont();
cellScoreFont.setBold(false);
cellScoreFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getFontColor())));
cellStyleScore.setFont(cellScoreFont);
cellStyleScore.setWrapText(true);
cellStyleScore.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyleScore.setBorderBottom(BorderStyle.THIN);
cellStyleScore.setBorderTop(BorderStyle.THIN);
cellStyleScore.setBorderRight(BorderStyle.THIN);
cellStyleScore.setBorderLeft(BorderStyle.THIN);
Cell contentCell6 = contentRow.createCell(kCol++);
contentCell6.setCellValue(BscReportSupportUtils.parse2(dateRangeScore.getScore()));
contentCell6.setCellStyle(cellStyleScore);
}
}
}
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
int rowspan = objective.getRow();
if (objective.getRow() > 1) {
// 2016-12-13 old work with POI 3.12
//sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow+rowspan-1, 0, 0));
// 2016-12-13 new work with POI 3.15
int mrRow1 = mrRow + rowspan - 1;
if (mrRow1 > mrRow) {
sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow1, 0, 0));
}
}
mrRow += rowspan;
}
}
return row;
}
Aggregations