Search in sources :

Example 31 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.

the class BscMobileCardUtils method getDashboardScore.

public static VisionVO getDashboardScore(String visionOid, String frequency, String startDate, String endDate) throws ServiceException, Exception {
    String startYear = "";
    String endYear = "";
    if (BscMeasureDataFrequency.FREQUENCY_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_HALF_OF_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_QUARTER.equals(frequency)) {
        startYear = startDate.substring(0, 4);
        endYear = endDate.substring(0, 4);
    }
    ChainResultObj result = PerformanceScoreChainUtils.getResult(visionOid, startDate, endDate, startYear, endYear, frequency, BscConstants.MEASURE_DATA_FOR_ALL, "", "");
    if (result.getValue() == null || ((BscStructTreeObj) result.getValue()).getVisions() == null || ((BscStructTreeObj) result.getValue()).getVisions().size() == 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
    }
    BscStructTreeObj resultObj = (BscStructTreeObj) result.getValue();
    VisionVO visionObj = resultObj.getVisions().get(0);
    return visionObj;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 32 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.

the class KpiReportCoffeeChartJsonDataCommand method setJsonData.

private void setJsonData(Context context, BscStructTreeObj treeObj) throws Exception {
    if (treeObj == null || treeObj.getVisions() == null || treeObj.getVisions().size() != 1) {
        return;
    }
    List<Map<String, Object>> rootList = new ArrayList<Map<String, Object>>();
    Map<String, Object> rootDataMap = new HashMap<String, Object>();
    List<Map<String, Object>> perspectivesDatas = new ArrayList<Map<String, Object>>();
    List<VisionVO> visions = treeObj.getVisions();
    VisionVO vision = visions.get(0);
    for (PerspectiveVO perspective : vision.getPerspectives()) {
        Map<String, Object> perspectiveDataMap = new HashMap<String, Object>();
        List<Map<String, Object>> perspectiveChildren = new ArrayList<Map<String, Object>>();
        perspectiveDataMap.put("name", this.getName(perspective.getName(), perspective.getScore()));
        perspectiveDataMap.put("children", perspectiveChildren);
        perspectiveDataMap.put("colour", perspective.getBgColor());
        perspectiveDataMap.put("fontColor", perspective.getFontColor());
        perspectiveDataMap.put("score", perspective.getScore());
        perspectivesDatas.add(perspectiveDataMap);
        for (ObjectiveVO objective : perspective.getObjectives()) {
            Map<String, Object> objectiveDataMap = new HashMap<String, Object>();
            List<Map<String, Object>> objectiveChildren = new ArrayList<Map<String, Object>>();
            objectiveDataMap.put("name", this.getName(objective.getName(), objective.getScore()));
            objectiveDataMap.put("children", objectiveChildren);
            objectiveDataMap.put("colour", objective.getBgColor());
            objectiveDataMap.put("fontColor", objective.getFontColor());
            objectiveDataMap.put("score", objective.getScore());
            perspectiveChildren.add(objectiveDataMap);
            for (KpiVO kpi : objective.getKpis()) {
                Map<String, Object> indicatorsDataMap = new HashMap<String, Object>();
                indicatorsDataMap.put("name", this.getName(kpi.getName(), kpi.getScore()));
                indicatorsDataMap.put("colour", kpi.getBgColor());
                indicatorsDataMap.put("fontColor", kpi.getFontColor());
                indicatorsDataMap.put("score", kpi.getScore());
                objectiveChildren.add(indicatorsDataMap);
            }
        }
    }
    rootDataMap.put("name", this.getName(vision.getTitle(), vision.getScore()));
    rootDataMap.put("children", perspectivesDatas);
    rootDataMap.put("colour", vision.getBgColor());
    rootDataMap.put("fontColor", vision.getFontColor());
    rootDataMap.put("score", vision.getScore());
    rootList.add(rootDataMap);
    String jsonDataStr = ((JSONArray) JSONSerializer.toJSON(rootList)).toString();
    this.setResult(context, jsonDataStr);
}
Also used : HashMap(java.util.HashMap) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) ArrayList(java.util.ArrayList) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) JSONArray(net.sf.json.JSONArray) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) HashMap(java.util.HashMap) Map(java.util.Map)

Example 33 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.

the class KpiReportBodyCommand method setImgIconBaseAndKpiInfo.

private void setImgIconBaseAndKpiInfo(BscStructTreeObj treeObj) throws ServiceException, Exception {
    BscReportSupportUtils.loadExpression();
    List<VisionVO> visions = treeObj.getVisions();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    for (VisionVO vision : visions) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            perspective.setImgIcon(BscReportSupportUtils.getHtmlIconBase("PERSPECTIVES", perspective.getTarget(), perspective.getMin(), perspective.getScore(), "", "", 0));
            for (ObjectiveVO objective : perspective.getObjectives()) {
                objective.setImgIcon(BscReportSupportUtils.getHtmlIconBase("OBJECTIVES", objective.getTarget(), objective.getMin(), objective.getScore(), "", "", 0));
                for (KpiVO kpi : objective.getKpis()) {
                    kpi.setImgIcon(BscReportSupportUtils.getHtmlIconBase("KPI", kpi.getTarget(), kpi.getMin(), kpi.getScore(), kpi.getCompareType(), kpi.getManagement(), kpi.getQuasiRange()));
                    BscReportSupportUtils.fillKpiEmployees(kpi);
                    BscReportSupportUtils.fillKpiOrganizations(kpi);
                    // KPI attachment documents
                    paramMap.clear();
                    paramMap.put("kpiId", kpi.getId());
                    List<KpiAttacVO> attacs = kpiAttacService.findListVOByParams(paramMap);
                    for (int i = 0; attacs != null && i < attacs.size(); i++) {
                        KpiAttacVO attac = attacs.get(i);
                        DefaultResult<SysUploadVO> uploadResult = sysUploadService.findForNoByteContent(attac.getUploadOid());
                        if (uploadResult.getValue() != null) {
                            attac.setShowName(uploadResult.getValue().getShowName());
                        } else {
                            attac.setShowName("unknown-" + attac.getUploadOid());
                        }
                        kpi.getAttachments().add(attac);
                    }
                }
            }
        }
    }
}
Also used : HashMap(java.util.HashMap) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) SysUploadVO(com.netsteadfast.greenstep.vo.SysUploadVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) KpiAttacVO(com.netsteadfast.greenstep.vo.KpiAttacVO)

Example 34 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.

the class ScorecardQueryContentAction method loadVisionCardContent.

private void loadVisionCardContent() throws ServiceException, Exception {
    this.checkDateRange();
    this.setDateValue();
    StringBuilder outContent = new StringBuilder();
    String frequency = this.getFields().get("frequency");
    this.message = SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA);
    List<VisionVO> visionScores = BscMobileCardUtils.getVisionCard(frequency, this.getFields().get("startDate"), this.getFields().get("endDate"));
    String dateStr1 = this.getFields().get("startDate");
    String dateStr2 = this.getFields().get("endDate");
    if (BscMeasureDataFrequency.FREQUENCY_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_HALF_OF_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_QUARTER.equals(frequency)) {
        dateStr1 = dateStr1.substring(0, 4);
        dateStr2 = dateStr2.substring(0, 4);
    }
    for (VisionVO vision : visionScores) {
        outContent.append(BscMobileCardUtils.getVisionCardContent(vision, BscMeasureDataFrequency.getFrequencyMap(false).get(frequency), dateStr1, dateStr2));
        outContent.append(super.getHtmlBr());
    }
    this.content = outContent.toString();
    if (!StringUtils.isBlank(content)) {
        this.message = this.getText("MESSAGE.ScorecardQueryContentAction_06");
        this.success = IS_YES;
    }
}
Also used : VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 35 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.

the class HistoryItemScoreReportContentQueryUtils method getBasicDataList.

private static List<VisionVO> getBasicDataList() throws ServiceException, Exception {
    List<VisionVO> visions = new LinkedList<VisionVO>();
    List<VisionVO> visionsTempList = new ArrayList<VisionVO>();
    Map<String, String> visionMap = visionService.findForMap(false);
    for (Map.Entry<String, String> visionEntry : visionMap.entrySet()) {
        DefaultResult<VisionVO> visionResult = visionService.findForSimple(visionEntry.getKey());
        if (visionResult.getValue() == null) {
            throw new ServiceException(visionResult.getSystemMessage().getValue());
        }
        VisionVO vision = visionResult.getValue();
        visionsTempList.add(vision);
    }
    Map<String, Object> paramMap = new HashMap<String, Object>();
    for (VisionVO vision : visionsTempList) {
        paramMap.clear();
        paramMap.put("visId", vision.getVisId());
        List<PerspectiveVO> perspectivesList = perspectiveService.findListVOByParams(paramMap);
        for (int p = 0; perspectivesList != null && p < perspectivesList.size(); p++) {
            PerspectiveVO perspective = perspectivesList.get(p);
            vision.getPerspectives().add(perspective);
            paramMap.clear();
            paramMap.put("perId", perspective.getPerId());
            List<ObjectiveVO> objectivesList = objectiveService.findListVOByParams(paramMap);
            for (int o = 0; objectivesList != null && o < objectivesList.size(); o++) {
                ObjectiveVO objective = objectivesList.get(o);
                perspective.getObjectives().add(objective);
                paramMap.clear();
                paramMap.put("objId", objective.getObjId());
                List<KpiVO> kpiList = kpiService.findListVOByParams(paramMap);
                if (kpiList != null && kpiList.size() > 0) {
                    objective.getKpis().addAll(kpiList);
                }
            }
        }
    }
    // 必須有 KPI 才能放到回傳的 visions
    for (int v = 0; v < visionsTempList.size(); v++) {
        boolean isFoundData = true;
        VisionVO vision = visionsTempList.get(v);
        for (int p = 0; p < vision.getPerspectives().size() && isFoundData; p++) {
            PerspectiveVO perspective = vision.getPerspectives().get(p);
            for (int o = 0; o < perspective.getObjectives().size() && isFoundData; o++) {
                ObjectiveVO objective = perspective.getObjectives().get(o);
                if (objective.getKpis() == null || objective.getKpis().size() < 1) {
                    isFoundData = false;
                }
            }
        }
        if (isFoundData) {
            visions.add(vision);
        }
    }
    return visions;
}
Also used : HashMap(java.util.HashMap) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) ArrayList(java.util.ArrayList) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) LinkedList(java.util.LinkedList) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

VisionVO (com.netsteadfast.greenstep.vo.VisionVO)66 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)38 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)29 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)22 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)21 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)17 HashMap (java.util.HashMap)16 Map (java.util.Map)8 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)7 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)7 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)7 ArrayList (java.util.ArrayList)7 LinkedList (java.util.LinkedList)7 Transactional (org.springframework.transaction.annotation.Transactional)7 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)6 File (java.io.File)6 FileOutputStream (java.io.FileOutputStream)6 BscMixDataVO (com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Document (com.itextpdf.text.Document)3