use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.
the class PeriodTrendsCalUtils method generateKpiPeriodTrendsExcel.
public static String generateKpiPeriodTrendsExcel(List<PeriodTrendsData<KpiVO>> periodDatas, String currentPeriodDateRange, String previousPeriodDateRange) throws Exception {
Context context = new ContextBase();
context.put("periodDatas", periodDatas);
context.put("currentPeriodDateRange", currentPeriodDateRange);
context.put("previousPeriodDateRange", previousPeriodDateRange);
SimpleChain chain = new SimpleChain();
ChainResultObj resultObj = chain.getResultFromResource("kpiPeriodTrendsExcelCommandExcelContentChain", context);
if (!(resultObj.getValue() instanceof String)) {
throw new java.lang.IllegalStateException("kpiPeriodTrendsExcelCommandExcelContentChain error!");
}
return (String) resultObj.getValue();
}
use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.
the class TimeSeriesAnalysisUtils method getResultForExcel.
public static String getResultForExcel(String tsaOid, String visionOid, String startDate, String endDate, String startYearDate, String endYearDate, String frequency, String dataFor, String measureDataOrganizationOid, String measureDataEmployeeOid) throws ServiceException, Exception {
Map<String, Object> dataMap = getResultWithVision(tsaOid, visionOid, startDate, endDate, startYearDate, endYearDate, frequency, dataFor, measureDataOrganizationOid, measureDataEmployeeOid);
List<TimeSeriesAnalysisResult> tsaResults = (List<TimeSeriesAnalysisResult>) dataMap.get("result");
VisionVO vision = (VisionVO) dataMap.get("vision");
TsaVO tsa = getParam(tsaOid);
List<BbTsaMaCoefficients> coefficients = getCoefficients(tsa);
Context context = new ContextBase();
context.put("tsaResults", tsaResults);
context.put("tsa", tsa);
context.put("coefficients", coefficients);
// for show only.
context.put("visionName", vision.getTitle());
if (BscMeasureDataFrequency.FREQUENCY_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_HALF_OF_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_QUARTER.equals(frequency)) {
context.put("date1", startYearDate);
context.put("date2", endYearDate);
} else {
context.put("date1", startDate);
context.put("date2", endDate);
}
context.put("frequencyName", BscMeasureDataFrequency.getFrequencyMap(false).get(frequency));
context.put("dataFor", dataFor);
context.put("organizationName", "");
context.put("employeeName", "");
if (!Constants.HTML_SELECT_NO_SELECT_ID.equals(measureDataOrganizationOid) && !StringUtils.isBlank(measureDataOrganizationOid)) {
context.put("organizationName", BscBaseLogicServiceCommonSupport.findOrganizationData(organizationService, measureDataOrganizationOid).getName());
}
if (!Constants.HTML_SELECT_NO_SELECT_ID.equals(measureDataEmployeeOid) && !StringUtils.isBlank(measureDataEmployeeOid)) {
context.put("employeeName", BscBaseLogicServiceCommonSupport.findEmployeeData(employeeService, measureDataEmployeeOid).getFullName());
}
SimpleChain chain = new SimpleChain();
ChainResultObj resultObj = chain.getResultFromResource("timeSeriesAnalysisExcelCommandContentChain", context);
if (!(resultObj.getValue() instanceof String)) {
throw new java.lang.IllegalStateException("timeSeriesAnalysisExcelCommandContentChain error!");
}
return (String) resultObj.getValue();
}
use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.
the class KpiReportContentQueryAction method getContent.
private void getContent() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
this.setDateValue();
this.checkDateRange();
Context context = this.getChainContext();
SimpleChain chain = new SimpleChain();
ChainResultObj resultObj = chain.getResultFromResource("kpiReportHtmlContentChain", context);
this.body = String.valueOf(resultObj.getValue());
this.message = resultObj.getMessage();
if (!StringUtils.isBlank(this.body) && this.body.startsWith("<!-- BSC_PROG003D0001Q -->")) {
this.success = IS_YES;
}
if (context.get("treeObj") == null) {
return;
}
BscStructTreeObj treeObj = (BscStructTreeObj) context.get("treeObj");
this.fillPerspectivesPieChartData(treeObj);
this.fillPerspectivesBarChartData(treeObj);
this.fillLineChartData(treeObj);
if (YesNo.YES.equals(this.getFields().get("nobody"))) {
// 不要有 HTML版本的輸出, 通常是給 dashboard 用的
this.body = "";
}
// ------------------------------------------------------------------
if (YesNo.YES.equals(this.getFields().get("saveResultJson")) && treeObj.getVisions() != null && treeObj.getVisions().size() == 1) {
ObjectMapper objectMapper = new ObjectMapper();
Map<String, Object> dataMap = new HashMap<String, Object>();
dataMap.put("treeObjJsonStr", SimpleUtils.toB64(objectMapper.writeValueAsString(treeObj)));
dataMap.put("resultObjJsonStr", SimpleUtils.toB64(objectMapper.writeValueAsString(resultObj)));
String jsonData = objectMapper.writeValueAsString(dataMap);
this.uploadOid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, jsonData.getBytes(), SimpleUtils.getUUIDStr() + ".json");
}
// ------------------------------------------------------------------
}
use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.
the class KpiReportContentQueryAction method getPdf.
private void getPdf() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
this.setDateValue();
this.checkDateRange();
Context context = this.getChainContext();
SimpleChain chain = new SimpleChain();
ChainResultObj resultObj = chain.getResultFromResource("kpiReportPdfContentChain", context);
this.message = resultObj.getMessage();
if (resultObj.getValue() instanceof String) {
this.uploadOid = (String) resultObj.getValue();
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.
the class DepartmentReportContentQueryAction method getExcel.
private void getExcel() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
Context context = this.getChainContext();
SimpleChain chain = new SimpleChain();
ChainResultObj resultObj = chain.getResultFromResource("organizationReportExcelContentChain", context);
this.message = resultObj.getMessage();
if (resultObj.getValue() instanceof String) {
this.uploadOid = (String) resultObj.getValue();
this.success = IS_YES;
}
}
Aggregations