Search in sources :

Example 21 with ChainResultObj

use of com.netsteadfast.greenstep.base.model.ChainResultObj 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 22 with ChainResultObj

use of com.netsteadfast.greenstep.base.model.ChainResultObj in project bamboobsc by billchen198318.

the class PerformanceScoreChainUtils method createOrUpdateMonitorItemScore.

public static void createOrUpdateMonitorItemScore(String dateVal, Context context) throws ServiceException, Exception {
    ChainResultObj result = getResult(context);
    if (result.getValue() == null || ((BscStructTreeObj) result.getValue()).getVisions() == null || ((BscStructTreeObj) result.getValue()).getVisions().size() == 0) {
        logger.warn("No data!");
        return;
    }
    //String dateVal = SimpleUtils.getStrYMD("");
    String frequency = (String) context.get("frequency");
    String orgId = (String) context.get("orgId");
    String empId = (String) context.get("empId");
    List<VisionVO> visions = ((BscStructTreeObj) result.getValue()).getVisions();
    for (VisionVO vision : visions) {
        List<PerspectiveVO> perspectives = vision.getPerspectives();
        MonitorItemScoreVO visionMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.VISION, vision.getVisId());
        //visionMonitorItemScore.setScore( BscReportSupportUtils.parse2(vision.getScore()) );
        setScore(visionMonitorItemScore, vision.getScore());
        saveOrUpdateMonitorItemScore(visionMonitorItemScore);
        for (PerspectiveVO perspective : perspectives) {
            List<ObjectiveVO> objectives = perspective.getObjectives();
            MonitorItemScoreVO perspectiveMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.PERSPECTIVES, perspective.getPerId());
            //perspectiveMonitorItemScore.setScore( BscReportSupportUtils.parse2(perspective.getScore()) );
            setScore(perspectiveMonitorItemScore, perspective.getScore());
            saveOrUpdateMonitorItemScore(perspectiveMonitorItemScore);
            for (ObjectiveVO objective : objectives) {
                List<KpiVO> kpis = objective.getKpis();
                MonitorItemScoreVO objectiveMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.STRATEGY_OF_OBJECTIVES, objective.getObjId());
                //objectiveMonitorItemScore.setScore( BscReportSupportUtils.parse2(objective.getScore()) );
                setScore(objectiveMonitorItemScore, objective.getScore());
                saveOrUpdateMonitorItemScore(objectiveMonitorItemScore);
                for (KpiVO kpi : kpis) {
                    MonitorItemScoreVO kpiMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.KPI, kpi.getId());
                    //kpiMonitorItemScore.setScore( BscReportSupportUtils.parse2(kpi.getScore()) );
                    setScore(kpiMonitorItemScore, kpi.getScore());
                    saveOrUpdateMonitorItemScore(kpiMonitorItemScore);
                }
            }
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) MonitorItemScoreVO(com.netsteadfast.greenstep.vo.MonitorItemScoreVO)

Example 23 with ChainResultObj

use of com.netsteadfast.greenstep.base.model.ChainResultObj in project bamboobsc by billchen198318.

the class PerformanceScoreChainUtils method getResult.

public static ChainResultObj getResult(Context context) throws ServiceException, Exception {
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("performanceScoreChain", context);
    return resultObj;
}
Also used : ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain)

Example 24 with ChainResultObj

use of com.netsteadfast.greenstep.base.model.ChainResultObj 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)

Example 25 with ChainResultObj

use of com.netsteadfast.greenstep.base.model.ChainResultObj in project bamboobsc by billchen198318.

the class RegionMapViewAction method renderInfowindowContent.

private void renderInfowindowContent() throws ServiceException, Exception {
    StringBuilder outStr = new StringBuilder();
    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.setPageMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA) + " , for KPIs.");
        return;
    }
    for (String visionOid : visionOids) {
        Context context = this.getChainContext(visionOid, year);
        SimpleChain chain = new SimpleChain();
        ChainResultObj resultObj = chain.getResultFromResource("kpiReportHtmlContentChain", context);
        outStr.append(String.valueOf(resultObj.getValue()));
    }
    this.content = outStr.toString();
}
Also used : Context(org.apache.commons.chain.Context) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain)

Aggregations

ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)34 SimpleChain (com.netsteadfast.greenstep.base.chain.SimpleChain)28 Context (org.apache.commons.chain.Context)27 ContextBase (org.apache.commons.chain.impl.ContextBase)8 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)7 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)6 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 Map (java.util.Map)5 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)4 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)4 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)4 LinkedHashMap (java.util.LinkedHashMap)4 LinkedList (java.util.LinkedList)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)3 StrategyMapItemsVO (com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO)3 HashMap (java.util.HashMap)3 AppContext (com.netsteadfast.greenstep.base.AppContext)2