use of com.netsteadfast.greenstep.vo.PerspectiveVO 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.PerspectiveVO 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);
}
}
}
}
}
use of com.netsteadfast.greenstep.vo.PerspectiveVO in project bamboobsc by billchen198318.
the class LoadStrategyMapItemsForNewCommand method fillStrategyMapItems.
private StrategyMapItemsVO fillStrategyMapItems(VisionVO vision) throws Exception {
StrategyMapItemsVO mapItems = new StrategyMapItemsVO();
int w = 190;
int top = 10;
for (PerspectiveVO perspective : vision.getPerspectives()) {
int left = 10;
for (ObjectiveVO objective : perspective.getObjectives()) {
String idName = objective.getObjId();
/**
* 1em = 16px
*
* <div class="w" id="phone1">PHONE INTERVIEW 1<div class="ep"></div></div>
* #phone1 { left:35em; top:12em; width:7em; }
*
*/
String div = "<div class=\"w\" id=\"" + idName + "\">" + objective.getName() + "<div class=\"ep\"></div></div>";
String css = "#" + idName + " { left:" + left + "px; top:" + top + "px; width:" + w + "px; }";
mapItems.getDiv().add(div);
mapItems.getCss().add(css);
left += (w + 80);
}
top += 120;
}
return mapItems;
}
use of com.netsteadfast.greenstep.vo.PerspectiveVO in project bamboobsc by billchen198318.
the class WeightLogicServiceImpl method update.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> update(List<PerspectiveVO> perspectives, List<ObjectiveVO> objectives, List<KpiVO> kpis) throws ServiceException, Exception {
if (perspectives == null || perspectives.size() < 1 || objectives == null || objectives.size() < 1 || kpis == null || kpis.size() < 1) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
for (PerspectiveVO perspective : perspectives) {
BbPerspective entity = this.perspectiveService.findByPKng(perspective.getOid());
entity.setWeight(perspective.getWeight());
this.perspectiveService.update(entity);
}
for (ObjectiveVO objective : objectives) {
BbObjective entity = this.objectiveService.findByPKng(objective.getOid());
entity.setWeight(objective.getWeight());
this.objectiveService.update(entity);
}
for (KpiVO kpi : kpis) {
BbKpi entity = this.kpiService.findByPKng(kpi.getOid());
entity.setWeight(kpi.getWeight());
this.kpiService.update(entity);
}
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
result.setValue(Boolean.TRUE);
return result;
}
use of com.netsteadfast.greenstep.vo.PerspectiveVO in project bamboobsc by billchen198318.
the class BscMobileCardUtils method getVisionCard.
public static List<VisionVO> getVisionCard(String frequency, String startDate, String endDate) throws ServiceException, Exception {
List<VisionVO> visionScores = new ArrayList<VisionVO>();
Map<String, String> visions = visionService.findForMap(false);
if (null == visions || visions.size() < 1) {
return visionScores;
}
Context context = new ContextBase();
context.put("startDate", startDate);
context.put("endDate", endDate);
context.put("startYearDate", startDate.substring(0, 4));
context.put("endYearDate", endDate.substring(0, 4));
context.put("frequency", frequency);
context.put("dataFor", BscConstants.MEASURE_DATA_FOR_ALL);
context.put("orgId", BscConstants.MEASURE_DATA_ORGANIZATION_FULL);
context.put("empId", BscConstants.MEASURE_DATA_EMPLOYEE_FULL);
for (Map.Entry<String, String> entry : visions.entrySet()) {
String visionOid = entry.getKey();
context.put("visionOid", visionOid);
SimpleChain chain = new SimpleChain();
ChainResultObj resultObj = chain.getResultFromResource("performanceScoreChain", context);
BscStructTreeObj treeObj = (BscStructTreeObj) resultObj.getValue();
for (int i = 0; treeObj.getVisions() != null && i < treeObj.getVisions().size(); i++) {
VisionVO vision = treeObj.getVisions().get(i);
vision.setContent(" ".getBytes());
DefaultResult<VisionVO> vResult = visionService.findObjectByOid(vision);
if (vResult.getValue() != null) {
// 計算分數chain 取出的vision資料沒有放 content 欄位, 但這邊要用到, 所以取出content欄位
vision.setContent(new String(vResult.getValue().getContent(), Constants.BASE_ENCODING).getBytes());
}
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
for (KpiVO kpi : objective.getKpis()) {
// 產生報表不需要以下欄位
kpi.getAggregationMethod().setDescription(" ");
kpi.getAggregationMethod().setExpression1(" ");
kpi.getAggregationMethod().setExpression2(" ");
kpi.getFormula().setExpression(" ");
}
}
}
visionScores.add(vision);
}
}
return visionScores;
}
Aggregations