use of org.apache.commons.chain.impl.ContextBase 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 org.apache.commons.chain.impl.ContextBase 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 org.apache.commons.chain.impl.ContextBase in project bamboobsc by billchen198318.
the class KpisDashboardAction method getContext.
@SuppressWarnings("unchecked")
private Context getContext() throws Exception {
List<Map<String, Object>> chartDatas = new LinkedList<Map<String, Object>>();
Enumeration<String> paramNames = this.getHttpServletRequest().getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = paramNames.nextElement();
String value = this.getHttpServletRequest().getParameter(paramName);
if (paramName.startsWith("BSC_PROG003D0006Q_meterGaugeChartDatas:")) {
Map<String, Object> dataMap = (Map<String, Object>) new ObjectMapper().readValue(value, LinkedHashMap.class);
chartDatas.add(dataMap);
}
}
Context context = new ContextBase();
context.put("chartDatas", chartDatas);
context.put("dateRangeLabel", this.getHttpServletRequest().getParameter("BSC_PROG003D0006Q_dateRangeLabel"));
context.put("barChartsData", this.getHttpServletRequest().getParameter("BSC_PROG003D0006Q_kpisBarChartsData"));
return context;
}
use of org.apache.commons.chain.impl.ContextBase in project bamboobsc by billchen198318.
the class DepartmentReportContentQueryAction method getChainContext.
@SuppressWarnings("unchecked")
private Context getChainContext() throws Exception {
Context context = new ContextBase();
context.put("visionOid", this.getFields().get("visionOid"));
context.put("frequency", this.getFields().get("frequency"));
context.put("startYearDate", this.getFields().get("year"));
context.put("endYearDate", this.getFields().get("year"));
context.put("dateType", this.getFields().get("dateType"));
context.put("dataFor", BscConstants.MEASURE_DATA_FOR_ORGANIZATION);
OrganizationVO organization = new OrganizationVO();
organization.setOid(this.getFields().get("organizationOid"));
DefaultResult<OrganizationVO> result = this.organizationService.findObjectByOid(organization);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
organization = result.getValue();
context.put("empId", BscConstants.MEASURE_DATA_EMPLOYEE_FULL);
context.put("orgId", organization.getOrgId());
context.put("uploadSignatureOid", this.getFields().get("uploadSignatureOid"));
return context;
}
use of org.apache.commons.chain.impl.ContextBase 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