Search in sources :

Example 31 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class PeriodTrendsCalUtils method getKpiScoreChange.

public static List<PeriodTrendsData<KpiVO>> getKpiScoreChange(String visionOid1, String startDate1, String endDate1, String startYearDate1, String endYearDate1, String frequency1, String dataFor1, String measureDataOrganizationOid1, String measureDataEmployeeOid1, String visionOid2, String startDate2, String endDate2, String startYearDate2, String endYearDate2, String frequency2, String dataFor2, String measureDataOrganizationOid2, String measureDataEmployeeOid2) throws ServiceException, Exception {
    List<PeriodTrendsData<KpiVO>> result = new ArrayList<PeriodTrendsData<KpiVO>>();
    Context context1 = PerformanceScoreChainUtils.getContext(visionOid1, startDate1, endDate1, startYearDate1, endYearDate1, frequency1, dataFor1, measureDataOrganizationOid1, measureDataEmployeeOid1);
    Context context2 = PerformanceScoreChainUtils.getContext(visionOid2, startDate2, endDate2, startYearDate2, endYearDate2, frequency2, dataFor2, measureDataOrganizationOid2, measureDataEmployeeOid2);
    /*
		SimpleChain chain1 = new SimpleChain();
		SimpleChain chain2 = new SimpleChain();
		ChainResultObj resultObj1 = chain1.getResultFromResource("performanceScoreChain", context1);
		ChainResultObj resultObj2 = chain2.getResultFromResource("performanceScoreChain", context2);
		*/
    fillKpiPeriodTrends(result, PerformanceScoreChainUtils.getResult(context1), PerformanceScoreChainUtils.getResult(context2), frequency1.equals(frequency2));
    return result;
}
Also used : Context(org.apache.commons.chain.Context) PeriodTrendsData(com.netsteadfast.greenstep.bsc.model.PeriodTrendsData) ArrayList(java.util.ArrayList) KpiVO(com.netsteadfast.greenstep.vo.KpiVO)

Example 32 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class DepartmentReportContentQueryAction method getContent.

private void getContent() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    Context context = this.getChainContext();
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("organizationReportHtmlContentChain", context);
    this.body = String.valueOf(resultObj.getValue());
    this.message = resultObj.getMessage();
    if (!StringUtils.isBlank(this.body) && this.body.startsWith("<!-- BSC_PROG003D0003Q -->")) {
        this.success = IS_YES;
    }
}
Also used : Context(org.apache.commons.chain.Context) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain)

Example 33 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class DepartmentReportContentQueryAction method getPdf.

private void getPdf() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    Context context = this.getChainContext();
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("organizationReportPdfContentChain", context);
    this.message = resultObj.getMessage();
    if (resultObj.getValue() instanceof String) {
        this.uploadOid = (String) resultObj.getValue();
        this.success = IS_YES;
    }
}
Also used : Context(org.apache.commons.chain.Context) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain)

Example 34 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class KpiReportContentQueryAction method getChainContext.

@SuppressWarnings("unchecked")
private Context getChainContext() throws Exception {
    Context context = new ContextBase();
    context.put("visionOid", this.getFields().get("visionOid"));
    context.put("startDate", this.getFields().get("startDate"));
    context.put("endDate", this.getFields().get("endDate"));
    context.put("startYearDate", this.getFields().get("startYearDate"));
    context.put("endYearDate", this.getFields().get("endYearDate"));
    context.put("frequency", this.getFields().get("frequency"));
    context.put("dataFor", this.getFields().get("dataFor"));
    context.put("orgId", BscConstants.MEASURE_DATA_ORGANIZATION_FULL);
    context.put("empId", BscConstants.MEASURE_DATA_EMPLOYEE_FULL);
    context.put("account", "");
    context.put("pieCanvasToData", SimpleUtils.deHex(this.defaultString(this.getFields().get("pieCanvasToData"))));
    context.put("barCanvasToData", SimpleUtils.deHex(this.defaultString(this.getFields().get("barCanvasToData"))));
    context.put("uploadSignatureOid", this.getFields().get("uploadSignatureOid"));
    context.put("ngVer", YesNo.NO);
    if ("Y".equals(this.getFields().get("ngVer"))) {
        // 有 javascript click 事件 kpi-report-body-ng.ftl 版本
        context.put("ngVer", YesNo.YES);
    }
    if (!this.isNoSelectId(this.getFields().get("measureDataOrganizationOid"))) {
        OrganizationVO organization = new OrganizationVO();
        organization.setOid(this.getFields().get("measureDataOrganizationOid"));
        DefaultResult<OrganizationVO> result = this.organizationService.findObjectByOid(organization);
        if (result.getValue() == null) {
            throw new ServiceException(result.getSystemMessage().getValue());
        }
        organization = result.getValue();
        context.put("orgId", organization.getOrgId());
    }
    if (!this.isNoSelectId(this.getFields().get("measureDataEmployeeOid"))) {
        EmployeeVO employee = new EmployeeVO();
        employee.setOid(this.getFields().get("measureDataEmployeeOid"));
        DefaultResult<EmployeeVO> result = this.employeeService.findObjectByOid(employee);
        if (result.getValue() == null) {
            throw new ServiceException(result.getSystemMessage().getValue());
        }
        employee = result.getValue();
        context.put("empId", employee.getEmpId());
        context.put("account", employee.getAccount());
    }
    this.setContextForSingleObject(context);
    return context;
}
Also used : Context(org.apache.commons.chain.Context) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) ContextBase(org.apache.commons.chain.impl.ContextBase)

Example 35 with Context

use of org.apache.commons.chain.Context in project bamboobsc by billchen198318.

the class KpiReportContentQueryAction method getExcel.

private void getExcel() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    this.setDateValue();
    this.checkDateRange();
    Context context = this.getChainContext();
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("kpiReportExcelContentChain", context);
    this.message = resultObj.getMessage();
    if (resultObj.getValue() instanceof String) {
        this.uploadOid = (String) resultObj.getValue();
        this.success = IS_YES;
    }
}
Also used : Context(org.apache.commons.chain.Context) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain)

Aggregations

Context (org.apache.commons.chain.Context)49 SimpleChain (com.netsteadfast.greenstep.base.chain.SimpleChain)28 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)27 ContextBase (org.apache.commons.chain.impl.ContextBase)24 Map (java.util.Map)9 LinkedHashMap (java.util.LinkedHashMap)7 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)6 ArrayList (java.util.ArrayList)6 LinkedList (java.util.LinkedList)6 List (java.util.List)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 AppContext (com.netsteadfast.greenstep.base.AppContext)4 HashMap (java.util.HashMap)4 ServletWebContext (org.apache.commons.chain.web.servlet.ServletWebContext)4 ServletActionContext (org.apache.struts.chain.contexts.ServletActionContext)4 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)3 StrategyMapItemsVO (com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO)3 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)3 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)3 ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)2