use of com.netsteadfast.greenstep.vo.PerspectiveVO in project bamboobsc by billchen198318.
the class HistoryItemScoreReportContentQueryUtils method getBasicDataList.
private static List<VisionVO> getBasicDataList() throws ServiceException, Exception {
List<VisionVO> visions = new LinkedList<VisionVO>();
List<VisionVO> visionsTempList = new ArrayList<VisionVO>();
Map<String, String> visionMap = visionService.findForMap(false);
for (Map.Entry<String, String> visionEntry : visionMap.entrySet()) {
DefaultResult<VisionVO> visionResult = visionService.findForSimple(visionEntry.getKey());
if (visionResult.getValue() == null) {
throw new ServiceException(visionResult.getSystemMessage().getValue());
}
VisionVO vision = visionResult.getValue();
visionsTempList.add(vision);
}
Map<String, Object> paramMap = new HashMap<String, Object>();
for (VisionVO vision : visionsTempList) {
paramMap.clear();
paramMap.put("visId", vision.getVisId());
List<PerspectiveVO> perspectivesList = perspectiveService.findListVOByParams(paramMap);
for (int p = 0; perspectivesList != null && p < perspectivesList.size(); p++) {
PerspectiveVO perspective = perspectivesList.get(p);
vision.getPerspectives().add(perspective);
paramMap.clear();
paramMap.put("perId", perspective.getPerId());
List<ObjectiveVO> objectivesList = objectiveService.findListVOByParams(paramMap);
for (int o = 0; objectivesList != null && o < objectivesList.size(); o++) {
ObjectiveVO objective = objectivesList.get(o);
perspective.getObjectives().add(objective);
paramMap.clear();
paramMap.put("objId", objective.getObjId());
List<KpiVO> kpiList = kpiService.findListVOByParams(paramMap);
if (kpiList != null && kpiList.size() > 0) {
objective.getKpis().addAll(kpiList);
}
}
}
}
// 必須有 KPI 才能放到回傳的 visions
for (int v = 0; v < visionsTempList.size(); v++) {
boolean isFoundData = true;
VisionVO vision = visionsTempList.get(v);
for (int p = 0; p < vision.getPerspectives().size() && isFoundData; p++) {
PerspectiveVO perspective = vision.getPerspectives().get(p);
for (int o = 0; o < perspective.getObjectives().size() && isFoundData; o++) {
ObjectiveVO objective = perspective.getObjectives().get(o);
if (objective.getKpis() == null || objective.getKpis().size() < 1) {
isFoundData = false;
}
}
}
if (isFoundData) {
visions.add(vision);
}
}
return visions;
}
use of com.netsteadfast.greenstep.vo.PerspectiveVO in project bamboobsc by billchen198318.
the class HistoryItemScoreReportContentQueryUtils method getItemNameWithVisionGroup.
private static String getItemNameWithVisionGroup(String itemType, String id, String name, List<VisionVO> basicDataList) throws Exception {
if (basicDataList.size() < 2) {
// 沒有1筆以上的 vision 資料, 不需要組出 group 字串
return name;
}
String groupStr = "";
for (int v = 0; v < basicDataList.size() && "".equals(groupStr); v++) {
int group = v + 1;
VisionVO vision = basicDataList.get(v);
if (MonitorItemType.VISION.equals(itemType) && id.equals(vision.getVisId())) {
groupStr = String.valueOf(group);
}
for (int p = 0; p < vision.getPerspectives().size() && "".equals(groupStr); p++) {
PerspectiveVO perspective = vision.getPerspectives().get(p);
if (MonitorItemType.PERSPECTIVES.equals(itemType) && id.equals(perspective.getPerId())) {
groupStr = String.valueOf(group);
}
for (int o = 0; o < perspective.getObjectives().size() && "".equals(groupStr); o++) {
ObjectiveVO objective = perspective.getObjectives().get(o);
if (MonitorItemType.STRATEGY_OF_OBJECTIVES.equals(itemType) && id.equals(objective.getObjId())) {
groupStr = String.valueOf(group);
}
for (int k = 0; k < objective.getKpis().size() && "".equals(groupStr); k++) {
KpiVO kpi = objective.getKpis().get(k);
if (MonitorItemType.KPI.equals(itemType) && id.equals(kpi.getId())) {
groupStr = String.valueOf(group);
}
}
}
}
}
if ("".equals(groupStr)) {
return name;
}
return name + "(" + groupStr + ")";
}
use of com.netsteadfast.greenstep.vo.PerspectiveVO in project bamboobsc by billchen198318.
the class KpiReportCoffeeChartJsonDataCommand method setJsonData.
private void setJsonData(Context context, BscStructTreeObj treeObj) throws Exception {
if (treeObj == null || treeObj.getVisions() == null || treeObj.getVisions().size() != 1) {
return;
}
List<Map<String, Object>> rootList = new ArrayList<Map<String, Object>>();
Map<String, Object> rootDataMap = new HashMap<String, Object>();
List<Map<String, Object>> perspectivesDatas = new ArrayList<Map<String, Object>>();
List<VisionVO> visions = treeObj.getVisions();
VisionVO vision = visions.get(0);
for (PerspectiveVO perspective : vision.getPerspectives()) {
Map<String, Object> perspectiveDataMap = new HashMap<String, Object>();
List<Map<String, Object>> perspectiveChildren = new ArrayList<Map<String, Object>>();
perspectiveDataMap.put("name", this.getName(perspective.getName(), perspective.getScore()));
perspectiveDataMap.put("children", perspectiveChildren);
perspectiveDataMap.put("colour", perspective.getBgColor());
perspectiveDataMap.put("fontColor", perspective.getFontColor());
perspectiveDataMap.put("score", perspective.getScore());
perspectivesDatas.add(perspectiveDataMap);
for (ObjectiveVO objective : perspective.getObjectives()) {
Map<String, Object> objectiveDataMap = new HashMap<String, Object>();
List<Map<String, Object>> objectiveChildren = new ArrayList<Map<String, Object>>();
objectiveDataMap.put("name", this.getName(objective.getName(), objective.getScore()));
objectiveDataMap.put("children", objectiveChildren);
objectiveDataMap.put("colour", objective.getBgColor());
objectiveDataMap.put("fontColor", objective.getFontColor());
objectiveDataMap.put("score", objective.getScore());
perspectiveChildren.add(objectiveDataMap);
for (KpiVO kpi : objective.getKpis()) {
Map<String, Object> indicatorsDataMap = new HashMap<String, Object>();
indicatorsDataMap.put("name", this.getName(kpi.getName(), kpi.getScore()));
indicatorsDataMap.put("colour", kpi.getBgColor());
indicatorsDataMap.put("fontColor", kpi.getFontColor());
indicatorsDataMap.put("score", kpi.getScore());
objectiveChildren.add(indicatorsDataMap);
}
}
}
rootDataMap.put("name", this.getName(vision.getTitle(), vision.getScore()));
rootDataMap.put("children", perspectivesDatas);
rootDataMap.put("colour", vision.getBgColor());
rootDataMap.put("fontColor", vision.getFontColor());
rootDataMap.put("score", vision.getScore());
rootList.add(rootDataMap);
String jsonDataStr = ((JSONArray) JSONSerializer.toJSON(rootList)).toString();
this.setResult(context, jsonDataStr);
}
use of com.netsteadfast.greenstep.vo.PerspectiveVO in project bamboobsc by billchen198318.
the class KpiReportExcelCommand method createDateRange.
private int createDateRange(XSSFWorkbook wb, XSSFSheet sh, int row, VisionVO vision, Context context) 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);
XSSFCellStyle cellStyleLabel = wb.createCellStyle();
cellStyleLabel.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(BscReportPropertyUtils.getBackgroundColor())));
cellStyleLabel.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFontLabel = wb.createFont();
cellFontLabel.setBold(false);
cellFontLabel.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(BscReportPropertyUtils.getFontColor())));
cellStyleLabel.setFont(cellFontLabel);
cellStyleLabel.setWrapText(true);
//cellStyleLabel.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyleLabel.setBorderBottom(BorderStyle.THIN);
cellStyleLabel.setBorderTop(BorderStyle.THIN);
cellStyleLabel.setBorderRight(BorderStyle.THIN);
cellStyleLabel.setBorderLeft(BorderStyle.THIN);
int cols = 4 + vision.getPerspectives().get(0).getObjectives().get(0).getKpis().get(0).getDateRangeScores().size();
int cell = 0;
for (int i = 0; i < cols; i++) {
String content = "Frequency: " + BscMeasureDataFrequency.getFrequencyMap(false).get(frequency) + " Date range: " + date1 + " ~ " + date2 + "\n" + StringUtils.defaultString((String) headContentMap.get("headContent"));
Row headRow = sh.createRow(row);
headRow.setHeight((short) 700);
Cell headCell1 = headRow.createCell(cell);
headCell1.setCellValue(content);
headCell1.setCellStyle(cellStyleLabel);
}
sh.addMergedRegion(new CellRangeAddress(row, row, 0, cols - 1));
row++;
int kpiCols = 4;
int kpiRows = 2;
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
for (KpiVO kpi : objective.getKpis()) {
cell = 0;
for (int r = 0; r < kpiRows; r++) {
Row contentRow = sh.createRow(row++);
contentRow.setHeight((short) 400);
for (int c = 0; c < kpiCols; c++) {
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(kpi.getBgColor())));
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFont = wb.createFont();
cellFont.setBold(false);
cellFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(kpi.getFontColor())));
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);
Cell contentCell1 = contentRow.createCell(c);
contentCell1.setCellValue(kpi.getName());
contentCell1.setCellStyle(cellStyle);
}
cell = 4;
if (r == 0) {
for (int d = 0; d < kpi.getDateRangeScores().size(); d++) {
DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(d);
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getBgColor())));
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFont = wb.createFont();
cellFont.setBold(false);
cellFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getFontColor())));
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);
Cell contentCell1 = contentRow.createCell(cell++);
contentCell1.setCellValue(dateRangeScore.getDate());
contentCell1.setCellStyle(cellStyle);
}
}
if (r == 1) {
for (int d = 0; d < kpi.getDateRangeScores().size(); d++) {
DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(d);
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getBgColor())));
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFont = wb.createFont();
cellFont.setBold(false);
cellFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getFontColor())));
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);
Cell contentCell1 = contentRow.createCell(cell++);
contentCell1.setCellValue(" " + BscReportSupportUtils.parse2(dateRangeScore.getScore()));
contentCell1.setCellStyle(cellStyle);
byte[] imgBytes = BscReportSupportUtils.getByteIcon(kpi, dateRangeScore.getScore());
if (null != imgBytes) {
SimpleUtils.setCellPicture(wb, sh, imgBytes, contentCell1.getRowIndex(), contentCell1.getColumnIndex());
}
}
}
}
sh.addMergedRegion(new CellRangeAddress(row - 2, row - 1, 0, kpiCols - 1));
}
}
}
return row++;
}
use of com.netsteadfast.greenstep.vo.PerspectiveVO in project bamboobsc by billchen198318.
the class KpiReportExcelCommand method createMainBody.
private int createMainBody(XSSFWorkbook wb, XSSFSheet sh, int row, VisionVO vision) throws Exception {
Map<String, String> managementMap = BscKpiCode.getManagementMap(false);
//Map<String, String> calculationMap = BscKpiCode.getCalculationMap(false);
int itemCols = 4;
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++);
contentRow.setHeight((short) 4000);
int cell = 0;
for (int i = 0; i < itemCols; i++) {
String content = this.getItemsContent(perspective.getName(), perspective.getScore(), perspective.getWeight(), perspective.getTarget(), perspective.getMin());
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(perspective.getBgColor())));
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFont = wb.createFont();
cellFont.setBold(false);
cellFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(perspective.getFontColor())));
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);
Cell contentCell1 = contentRow.createCell(cell++);
contentCell1.setCellValue("\n" + content);
contentCell1.setCellStyle(cellStyle);
if (i == 0 && ox == 0) {
byte[] imgBytes = BscReportSupportUtils.getByteIconBase("PERSPECTIVES", perspective.getTarget(), perspective.getMin(), perspective.getScore(), "", "", 0);
if (null != imgBytes) {
SimpleUtils.setCellPicture(wb, sh, imgBytes, contentCell1.getRowIndex(), contentCell1.getColumnIndex());
}
}
}
for (int i = 0; i < itemCols; i++) {
String content = this.getItemsContent(objective.getName(), objective.getScore(), objective.getWeight(), objective.getTarget(), objective.getMin());
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(objective.getBgColor())));
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFont = wb.createFont();
cellFont.setBold(false);
cellFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(objective.getFontColor())));
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);
Cell contentCell1 = contentRow.createCell(cell++);
contentCell1.setCellValue("\n" + content);
contentCell1.setCellStyle(cellStyle);
if (i == 0 && kx == 0) {
byte[] imgBytes = BscReportSupportUtils.getByteIconBase("OBJECTIVES", objective.getTarget(), objective.getMin(), objective.getScore(), "", "", 0);
if (null != imgBytes) {
SimpleUtils.setCellPicture(wb, sh, imgBytes, contentCell1.getRowIndex(), contentCell1.getColumnIndex());
}
}
}
for (int i = 0; i < itemCols; i++) {
//String content = this.getKpisContent(kpi, managementMap, calculationMap);
String content = this.getKpisContent(kpi, managementMap);
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(kpi.getBgColor())));
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont cellFont = wb.createFont();
cellFont.setBold(false);
cellFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(kpi.getFontColor())));
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);
Cell contentCell1 = contentRow.createCell(cell++);
contentCell1.setCellValue("\n" + content);
contentCell1.setCellStyle(cellStyle);
if (i == 0) {
byte[] imgBytes = BscReportSupportUtils.getByteIconBase("KPI", kpi.getTarget(), kpi.getMin(), kpi.getScore(), kpi.getCompareType(), kpi.getManagement(), kpi.getQuasiRange());
if (null != imgBytes) {
SimpleUtils.setCellPicture(wb, sh, imgBytes, contentCell1.getRowIndex(), contentCell1.getColumnIndex());
}
}
}
}
}
}
for (int px = 0; px < vision.getPerspectives().size(); px++) {
PerspectiveVO perspective = vision.getPerspectives().get(px);
sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow + perspective.getRow() - 1, 0, 3));
for (int ox = 0; ox < perspective.getObjectives().size(); ox++) {
ObjectiveVO objective = perspective.getObjectives().get(ox);
sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow + objective.getRow() - 1, 4, 7));
for (int kx = 0; kx < objective.getKpis().size(); kx++) {
sh.addMergedRegion(new CellRangeAddress(mrRow + kx, mrRow + kx, 8, 11));
}
mrRow += objective.getKpis().size();
}
}
return row++;
}
Aggregations