use of com.netsteadfast.greenstep.bsc.model.BscStructTreeObj in project bamboobsc by billchen198318.
the class KpiReportBodyCommand method execute.
@Override
public boolean execute(Context context) throws Exception {
if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
return false;
}
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);
}
BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
Map<String, Object> parameter = new HashMap<String, Object>();
parameter.put("treeObj", treeObj);
parameter.put("date1", date1);
parameter.put("date2", date2);
parameter.put("frequency", BscMeasureDataFrequency.getFrequencyMap(false).get(frequency));
parameter.put("headContent", "");
this.fillHeadContent(context, parameter);
this.fillReportProperty(parameter);
String templateResourceSrc = templateResource;
if (YesNo.YES.equals((String) context.get("ngVer"))) {
// 有 javascript click 事件的版本
templateResourceSrc = templateResource_NG;
}
String nextType = (String) context.get("nextType");
String nextId = (String) context.get("nextId");
if (BscConstants.HEAD_FOR_PER_ID.equals(nextType) && !StringUtils.isBlank(nextId)) {
templateResourceSrc = templateResource_NG_PER;
}
if (BscConstants.HEAD_FOR_OBJ_ID.equals(nextType) && !StringUtils.isBlank(nextId)) {
templateResourceSrc = templateResource_NG_OBJ;
}
if (BscConstants.HEAD_FOR_KPI_ID.equals(nextType) && !StringUtils.isBlank(nextId)) {
templateResourceSrc = templateResource_NG_KPI;
}
this.setImgIconBaseAndKpiInfo(treeObj);
String content = TemplateUtils.processTemplate("resourceTemplate", KpiReportBodyCommand.class.getClassLoader(), templateResourceSrc, parameter);
this.setResult(context, content);
return false;
}
use of com.netsteadfast.greenstep.bsc.model.BscStructTreeObj in project bamboobsc by billchen198318.
the class KpiReportExcelCommand method createExcel.
private String createExcel(Context context) throws Exception {
String visionOid = (String) context.get("visionOid");
VisionVO vision = null;
BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
for (VisionVO visionObj : treeObj.getVisions()) {
if (visionObj.getOid().equals(visionOid)) {
vision = visionObj;
}
}
BscReportPropertyUtils.loadData();
// 2015-04-18 add
BscReportSupportUtils.loadExpression();
String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;
int row = 24;
if (context.get("pieCanvasToData") == null || context.get("barCanvasToData") == null) {
row = 0;
}
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sh = wb.createSheet();
row += this.createHead(wb, sh, row, vision);
row = this.createMainBody(wb, sh, row, vision);
// 空一列
row = row + 1;
row = this.createDateRange(wb, sh, row, vision, context);
if (context.get("pieCanvasToData") != null && context.get("barCanvasToData") != null) {
this.putCharts(wb, sh, context);
}
this.putSignature(wb, sh, row + 1, context);
FileOutputStream out = new FileOutputStream(fileFullPath);
wb.write(out);
out.close();
wb = null;
File file = new File(fileFullPath);
String oid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "kpi-report.xlsx");
file = null;
return oid;
}
use of com.netsteadfast.greenstep.bsc.model.BscStructTreeObj in project bamboobsc by billchen198318.
the class KpiDateRangeScoreCommand method execute.
/*
private static final String QUARTER_1 = "Q1";
private static final String QUARTER_2 = "Q2";
private static final String QUARTER_3 = "Q3";
private static final String QUARTER_4 = "Q4";
private static final String HALF_YEAR_FIRST = "first";
private static final String HALF_YEAR_LAST = "last";
*/
@Override
public boolean execute(Context context) throws Exception {
if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
return false;
}
BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
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();
//long beg = System.currentTimeMillis();
for (VisionVO vision : treeObj.getVisions()) {
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
// 2015-04-11 add
ExecutorService kpiCalculationPool = Executors.newFixedThreadPool(SimpleUtils.getAvailableProcessors(objective.getKpis().size()));
for (KpiVO kpi : objective.getKpis()) {
/* 2015-04-11 rem
if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(frequency)
|| BscMeasureDataFrequency.FREQUENCY_WEEK.equals(frequency)
|| BscMeasureDataFrequency.FREQUENCY_MONTH.equals(frequency) ) {
this.fillDateRangeMonth(kpi, frequency, startDate, endDate);
} else {
this.fillDateRangeYear(kpi, frequency, startYearDate, endYearDate);
}
*/
// 2015-04-11 add
ScoreCalculationCallableData data = new ScoreCalculationCallableData();
data.setDefaultMode(false);
data.setKpi(kpi);
data.setFrequency(frequency);
data.setDate1(startYearDate);
data.setDate2(endYearDate);
if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_WEEK.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_MONTH.equals(frequency)) {
data.setDate1(startDate);
data.setDate2(endDate);
}
data = kpiCalculationPool.submit(new ScoreCalculationCallable(data)).get();
}
kpiCalculationPool.shutdown();
}
}
}
//System.out.println( this.getClass().getName() + " use time(MS) = " + (end-beg) );
return false;
}
use of com.netsteadfast.greenstep.bsc.model.BscStructTreeObj in project bamboobsc by billchen198318.
the class KpiReportCoffeeChartJsonDataCommand method execute.
@Override
public boolean execute(Context context) throws Exception {
if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
return false;
}
BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
this.setJsonData(context, treeObj);
return false;
}
use of com.netsteadfast.greenstep.bsc.model.BscStructTreeObj in project bamboobsc by billchen198318.
the class LoadStrategyMapItemsForNewCommand method execute.
@Override
public boolean execute(Context context) throws Exception {
if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
return false;
}
BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
String visionOid = (String) context.get("visionOid");
VisionVO vision = null;
for (VisionVO obj : treeObj.getVisions()) {
if (obj.getOid().equals(visionOid)) {
vision = obj;
}
}
StrategyMapItemsVO mapItems = this.fillStrategyMapItems(vision);
this.setResult(context, mapItems);
return false;
}
Aggregations