use of com.netsteadfast.greenstep.vo.ObjectiveVO in project bamboobsc by billchen198318.
the class LoadBscStructTreeCommand method processKpi.
private void processKpi(BscStructTreeObj treeObj, List<BscMixDataVO> mixDatas) throws Exception {
//Map<String, String> calculationMap = BscKpiCode.getCalculationMap(false);
Map<String, String> managementMap = BscKpiCode.getManagementMap(false);
for (VisionVO vision : treeObj.getVisions()) {
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
for (BscMixDataVO mixData : mixDatas) {
if (!vision.getVisId().equals(mixData.getVisId()) || !perspective.getPerId().equals(mixData.getPerId()) || !objective.getObjId().equals(mixData.getObjId())) {
continue;
}
boolean found = false;
for (int i = 0; i < objective.getKpis().size(); i++) {
if (objective.getKpis().get(i).getId().equals(mixData.getKpiId())) {
found = true;
}
}
if (!found) {
KpiVO kpi = new KpiVO();
kpi.setOid(mixData.getKpiOid());
kpi.setId(mixData.getKpiId());
kpi.setCal(mixData.getKpiCal());
kpi.setCompareType(mixData.getKpiCompareType());
kpi.setDataType(mixData.getKpiDataType());
kpi.setDescription(mixData.getKpiDescription());
kpi.setForId(mixData.getForId());
kpi.setManagement(mixData.getKpiManagement());
kpi.setMax(mixData.getKpiMax());
kpi.setMin(mixData.getKpiMin());
kpi.setName(mixData.getKpiName());
kpi.setObjId(mixData.getObjId());
kpi.setOrgaMeasureSeparate(mixData.getKpiOrgaMeasureSeparate());
kpi.setTarget(mixData.getKpiTarget());
kpi.setUnit(mixData.getKpiUnit());
kpi.setUserMeasureSeparate(mixData.getKpiUserMeasureSeparate());
kpi.setWeight(mixData.getKpiWeight());
kpi.setManagementName(managementMap.get(kpi.getManagement()));
//kpi.setCalculationName( calculationMap.get(kpi.getCal()) );
kpi.setCalculationName(AggregationMethodUtils.getNameByAggrId(kpi.getCal()));
kpi.setQuasiRange(mixData.getKpiQuasiRange());
kpi.setActivate(mixData.getKpiActivate());
FormulaVO formula = new FormulaVO();
formula.setOid(mixData.getForOid());
formula.setForId(mixData.getForId());
formula.setName(mixData.getForName());
formula.setType(mixData.getForType());
formula.setReturnMode(mixData.getForReturnMode());
formula.setReturnVar(mixData.getForReturnVar());
formula.setExpression(mixData.getForExpression());
kpi.setFormula(formula);
AggregationMethodVO aggr = new AggregationMethodVO();
aggr.setOid(mixData.getAggrOid());
aggr.setAggrId(mixData.getAggrId());
aggr.setName(mixData.getAggrName());
aggr.setType(mixData.getAggrType());
aggr.setExpression1(mixData.getAggrExpression1());
aggr.setExpression2(mixData.getAggrExpression2());
kpi.setAggregationMethod(aggr);
FormulaVO trendsFormula = new FormulaVO();
trendsFormula.setOid(mixData.getTrendsForOid());
trendsFormula.setForId(mixData.getTrendsForId());
trendsFormula.setName(mixData.getTrendsForName());
trendsFormula.setType(mixData.getTrendsForType());
trendsFormula.setReturnMode(mixData.getTrendsForReturnMode());
trendsFormula.setReturnVar(mixData.getTrendsForReturnVar());
trendsFormula.setExpression(mixData.getTrendsForExpression());
kpi.setTrendsFormula(trendsFormula);
objective.getKpis().add(kpi);
}
}
}
}
}
}
use of com.netsteadfast.greenstep.vo.ObjectiveVO in project bamboobsc by billchen198318.
the class LoadBscStructTreeCommand method processObjective.
private void processObjective(BscStructTreeObj treeObj, List<BscMixDataVO> mixDatas) throws Exception {
for (VisionVO vision : treeObj.getVisions()) {
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (BscMixDataVO mixData : mixDatas) {
if (!vision.getVisId().equals(mixData.getVisId()) || !perspective.getPerId().equals(mixData.getPerId())) {
continue;
}
boolean found = false;
for (int i = 0; i < perspective.getObjectives().size(); i++) {
if (perspective.getObjectives().get(i).getObjId().equals(mixData.getObjId())) {
found = true;
}
}
if (!found) {
ObjectiveVO objective = new ObjectiveVO();
objective.setOid(mixData.getObjOid());
objective.setObjId(mixData.getObjId());
objective.setPerId(mixData.getPerId());
objective.setName(mixData.getObjName());
objective.setWeight(mixData.getObjWeight());
objective.setTarget(mixData.getObjTarget());
objective.setMin(mixData.getObjMin());
objective.setDescription(mixData.getObjDescription());
perspective.getObjectives().add(objective);
}
}
}
}
}
use of com.netsteadfast.greenstep.vo.ObjectiveVO in project bamboobsc by billchen198318.
the class LoadMeasureDataCommand method execute.
@SuppressWarnings("unchecked")
@Override
public boolean execute(Context context) throws Exception {
measureDataService = (IMeasureDataService<MeasureDataVO, BbMeasureData, String>) AppContext.getBean("bsc.service.MeasureDataService");
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();
startDate = startDate.replaceAll("/", "").replaceAll("-", "");
endDate = endDate.replaceAll("/", "").replaceAll("-", "");
String date1 = startDate;
String date2 = endDate;
if (BscMeasureDataFrequency.FREQUENCY_QUARTER.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_HALF_OF_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_YEAR.equals(frequency)) {
date1 = startYearDate + "0101";
date2 = endYearDate + "12" + SimpleUtils.getMaxDayOfMonth(Integer.parseInt(endYearDate), 12);
}
String measureDataOrgaId = (String) context.get("orgId");
String measureDataEmplId = (String) context.get("empId");
if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
return false;
}
BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
for (VisionVO vision : treeObj.getVisions()) {
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
for (KpiVO kpi : objective.getKpis()) {
this.fillMeasureData(kpi, frequency, date1, date2, measureDataOrgaId, measureDataEmplId);
}
}
}
}
return false;
}
use of com.netsteadfast.greenstep.vo.ObjectiveVO 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;
}
use of com.netsteadfast.greenstep.vo.ObjectiveVO in project bamboobsc by billchen198318.
the class KpiReportPdfCommand method createDateRange.
private void createDateRange(PdfPTable table, VisionVO vision, Context context, int maxRows) throws Exception {
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();
String date1 = startDate;
String date2 = endDate;
if (BscMeasureDataFrequency.FREQUENCY_QUARTER.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_HALF_OF_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_YEAR.equals(frequency)) {
date1 = startYearDate + "/01/01";
date2 = endYearDate + "/12/" + SimpleUtils.getMaxDayOfMonth(Integer.parseInt(endYearDate), 12);
}
Map<String, Object> headContentMap = new HashMap<String, Object>();
this.fillHeadContent(context, headContentMap);
String content = "Frequency: " + BscMeasureDataFrequency.getFrequencyMap(false).get(frequency) + " Date range: " + date1 + " ~ " + date2 + "\n" + StringUtils.defaultString((String) headContentMap.get("headContent"));
PdfPCell cell = null;
cell = new PdfPCell();
cell.addElement(new Phrase(content, this.getFont(BscReportPropertyUtils.getFontColor(), false)));
this.setCellBackgroundColor(cell, BscReportPropertyUtils.getBackgroundColor());
cell.setColspan(maxRows);
table.addCell(cell);
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
for (KpiVO kpi : objective.getKpis()) {
cell = new PdfPCell();
cell.addElement(new Phrase(kpi.getName(), this.getFont(kpi.getFontColor(), false)));
this.setCellBackgroundColor(cell, kpi.getBgColor());
cell.setColspan(4);
cell.setRowspan(2);
table.addCell(cell);
for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
cell = new PdfPCell();
cell.addElement(new Phrase(dateScore.getDate(), this.getFont(dateScore.getFontColor(), false)));
this.setCellBackgroundColor(cell, dateScore.getBgColor());
table.addCell(cell);
}
for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
Image image = Image.getInstance(BscReportSupportUtils.getByteIcon(kpi, dateScore.getScore()));
image.setWidthPercentage(20f);
cell = new PdfPCell();
cell.addElement(new Phrase(BscReportSupportUtils.parse2(dateScore.getScore()), this.getFont(dateScore.getFontColor(), false)));
cell.addElement(image);
this.setCellBackgroundColor(cell, dateScore.getBgColor());
table.addCell(cell);
}
}
}
}
}
Aggregations