Search in sources :

Example 6 with SimpleChain

use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.

the class ObjectivesDashboardAction method getExcel.

@SuppressWarnings("unchecked")
private void getExcel() throws ControllerException, AuthorityException, ServiceException, Exception {
    Context context = this.getContext();
    List<Map<String, Object>> chartDatas = (List<Map<String, Object>>) context.get("chartDatas");
    if (chartDatas == null || chartDatas.size() < 1) {
        super.throwMessage(this.getText("MESSAGE.BSC_PROG003D0005Q_msg1"));
    }
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("objectivesDashboardExcelContentChain", 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) LinkedList(java.util.LinkedList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 7 with SimpleChain

use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.

the class PerspectivesDashboardAction method getExcel.

@SuppressWarnings("unchecked")
private void getExcel() throws ControllerException, AuthorityException, ServiceException, Exception {
    Context context = this.getContext();
    List<Map<String, Object>> chartDatas = (List<Map<String, Object>>) context.get("chartDatas");
    if (chartDatas == null || chartDatas.size() < 1) {
        super.throwMessage(this.getText("MESSAGE.BSC_PROG003D0004Q_msg1"));
    }
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("perspectivesDashboardExcelContentChain", 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) LinkedList(java.util.LinkedList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 8 with SimpleChain

use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.

the class RegionMapRelationKpisAction method renderTableContent.

private void renderTableContent() throws ControllerException, AuthorityException, ServiceException, Exception {
    String year = this.getFields().get("year");
    String orgId = this.getFields().get("orgId");
    List<String> visionOids = this.visionService.findForOidByKpiOrga(orgId);
    if (visionOids == null || visionOids.size() < 1) {
        this.message = SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA) + " , for KPIs.";
        return;
    }
    for (String visionOid : visionOids) {
        Context context = this.getChainContext(visionOid, year);
        SimpleChain chain = new SimpleChain();
        chain.getResultFromResource("performanceScoreChain", context);
        if (context.get("treeObj") == null) {
            continue;
        }
        BscStructTreeObj treeObj = (BscStructTreeObj) context.get("treeObj");
        this.fillRelationKpis(treeObj);
        this.fillCharts(treeObj);
    }
    this.success = IS_YES;
}
Also used : Context(org.apache.commons.chain.Context) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain)

Example 9 with SimpleChain

use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.

the class PdcaReportContentQueryAction method getExcel.

@SuppressWarnings("unchecked")
private void getExcel() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    List<String> bscExcelFileUploadOids = new ArrayList<String>();
    List<ChainResultObj> bscReportResults = null;
    if ("true".equals(this.getFields().get("showBscReport"))) {
        bscReportResults = this.getBscReportContent("kpiReportExcelContentChain");
    }
    for (int i = 0; bscReportResults != null && i < bscReportResults.size(); i++) {
        ChainResultObj resultObj = bscReportResults.get(i);
        if (resultObj.getValue() instanceof String) {
            bscExcelFileUploadOids.add((String) resultObj.getValue());
        }
    }
    Context pdcaContext = new ContextBase();
    pdcaContext.put("pdcaOid", this.getFields().get("pdcaOid"));
    pdcaContext.put("bscExcelFileUploadOids", bscExcelFileUploadOids);
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("pdcaReportExcelContentChain", pdcaContext);
    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) ArrayList(java.util.ArrayList) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain) ContextBase(org.apache.commons.chain.impl.ContextBase)

Example 10 with SimpleChain

use of com.netsteadfast.greenstep.base.chain.SimpleChain in project bamboobsc by billchen198318.

the class PdcaReportContentQueryAction method getBscReportContent.

private List<ChainResultObj> getBscReportContent(String chainId) throws ControllerException, AuthorityException, ServiceException, Exception {
    List<ChainResultObj> results = new ArrayList<ChainResultObj>();
    String pdcaOid = this.getFields().get("pdcaOid");
    // 先找出 bb_pdca_kpis 的最上層 vision
    List<String> visionOids = this.visionService.findForOidByPdcaOid(pdcaOid);
    for (String visionOid : visionOids) {
        PdcaMeasureFreqVO measureFreq = new PdcaMeasureFreqVO();
        measureFreq.setPdcaOid(pdcaOid);
        DefaultResult<PdcaMeasureFreqVO> mfResult = this.pdcaMeasureFreqService.findByUK(measureFreq);
        if (mfResult.getValue() == null) {
            throw new ServiceException(mfResult.getSystemMessage().getValue());
        }
        measureFreq = mfResult.getValue();
        Context context = this.getBscReportChainContext(pdcaOid, visionOid, measureFreq);
        SimpleChain chain = new SimpleChain();
        ChainResultObj resultObj = chain.getResultFromResource(chainId, context);
        results.add(resultObj);
    }
    return results;
}
Also used : Context(org.apache.commons.chain.Context) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) ArrayList(java.util.ArrayList) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain) PdcaMeasureFreqVO(com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO)

Aggregations

SimpleChain (com.netsteadfast.greenstep.base.chain.SimpleChain)29 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)28 Context (org.apache.commons.chain.Context)28 ContextBase (org.apache.commons.chain.impl.ContextBase)8 List (java.util.List)5 Map (java.util.Map)5 ArrayList (java.util.ArrayList)4 LinkedHashMap (java.util.LinkedHashMap)4 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)3 StrategyMapItemsVO (com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO)3 LinkedList (java.util.LinkedList)3 AppContext (com.netsteadfast.greenstep.base.AppContext)2 ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)2 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)2 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)2 HashMap (java.util.HashMap)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 TimeSeriesAnalysisResult (com.netsteadfast.greenstep.bsc.model.TimeSeriesAnalysisResult)1 BbTsaMaCoefficients (com.netsteadfast.greenstep.po.hbm.BbTsaMaCoefficients)1 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)1