Search in sources :

Example 36 with VisionVO

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

the class HistoryItemScoreReportContentQueryUtils method getItemNameWithVisionGroup.

private static String getItemNameWithVisionGroup(String itemType, String id, String name, List<VisionVO> basicDataList) throws Exception {
    if (basicDataList.size() < 2) {
        // 沒有1筆以上的 vision 資料, 不需要組出 group 字串
        return name;
    }
    String groupStr = "";
    for (int v = 0; v < basicDataList.size() && "".equals(groupStr); v++) {
        int group = v + 1;
        VisionVO vision = basicDataList.get(v);
        if (MonitorItemType.VISION.equals(itemType) && id.equals(vision.getVisId())) {
            groupStr = String.valueOf(group);
        }
        for (int p = 0; p < vision.getPerspectives().size() && "".equals(groupStr); p++) {
            PerspectiveVO perspective = vision.getPerspectives().get(p);
            if (MonitorItemType.PERSPECTIVES.equals(itemType) && id.equals(perspective.getPerId())) {
                groupStr = String.valueOf(group);
            }
            for (int o = 0; o < perspective.getObjectives().size() && "".equals(groupStr); o++) {
                ObjectiveVO objective = perspective.getObjectives().get(o);
                if (MonitorItemType.STRATEGY_OF_OBJECTIVES.equals(itemType) && id.equals(objective.getObjId())) {
                    groupStr = String.valueOf(group);
                }
                for (int k = 0; k < objective.getKpis().size() && "".equals(groupStr); k++) {
                    KpiVO kpi = objective.getKpis().get(k);
                    if (MonitorItemType.KPI.equals(itemType) && id.equals(kpi.getId())) {
                        groupStr = String.valueOf(group);
                    }
                }
            }
        }
    }
    if ("".equals(groupStr)) {
        return name;
    }
    return name + "(" + groupStr + ")";
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 37 with VisionVO

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

the class ScorecardQueryContentAction method loadPerspectiveCardContent.

private void loadPerspectiveCardContent() throws ServiceException, Exception {
    StringBuilder outContent = new StringBuilder();
    this.message = SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA);
    String uploadOid = this.getFields().get("uploadOid");
    VisionVO vision = BscMobileCardUtils.getVisionCardFromUpload(uploadOid);
    this.rootVision = vision;
    List<PerspectiveVO> perspectives = vision.getPerspectives();
    for (PerspectiveVO perspective : perspectives) {
        outContent.append(BscMobileCardUtils.getPerspectivesCardContent(uploadOid, perspective));
        outContent.append(super.getHtmlBr());
    }
    this.content = outContent.toString();
    if (!StringUtils.isBlank(content)) {
        this.loadColor();
        this.message = this.getText("MESSAGE.ScorecardQueryContentAction_06");
        this.success = IS_YES;
    }
}
Also used : PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 38 with VisionVO

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

the class ScorecardQueryContentAction method loadObjectiveCardContent.

private void loadObjectiveCardContent() throws ServiceException, Exception {
    StringBuilder outContent = new StringBuilder();
    this.message = SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA);
    String uploadOid = this.getFields().get("uploadOid");
    String perspectiveOid = super.defaultString(this.getFields().get("perspectiveOid"));
    VisionVO vision = BscMobileCardUtils.getVisionCardFromUpload(uploadOid);
    List<PerspectiveVO> perspectives = vision.getPerspectives();
    for (PerspectiveVO perspective : perspectives) {
        if (perspectiveOid.equals(perspective.getOid())) {
            this.rootPerspective = perspective;
            List<ObjectiveVO> objectives = perspective.getObjectives();
            for (ObjectiveVO objective : objectives) {
                outContent.append(BscMobileCardUtils.getObjectivesCardContent(uploadOid, objective));
                outContent.append(super.getHtmlBr());
            }
        }
    }
    this.content = outContent.toString();
    if (!StringUtils.isBlank(content)) {
        this.loadColor();
        this.message = this.getText("MESSAGE.ScorecardQueryContentAction_06");
        this.success = IS_YES;
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 39 with VisionVO

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

the class KpiReportExcelCommand method createExcel.

private String createExcel(Context context) throws Exception {
    String visionOid = (String) context.get("visionOid");
    VisionVO vision = null;
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    for (VisionVO visionObj : treeObj.getVisions()) {
        if (visionObj.getOid().equals(visionOid)) {
            vision = visionObj;
        }
    }
    BscReportPropertyUtils.loadData();
    // 2015-04-18 add
    BscReportSupportUtils.loadExpression();
    String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
    String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;
    int row = 24;
    if (context.get("pieCanvasToData") == null || context.get("barCanvasToData") == null) {
        row = 0;
    }
    XSSFWorkbook wb = new XSSFWorkbook();
    XSSFSheet sh = wb.createSheet();
    row += this.createHead(wb, sh, row, vision);
    row = this.createMainBody(wb, sh, row, vision);
    // 空一列
    row = row + 1;
    row = this.createDateRange(wb, sh, row, vision, context);
    if (context.get("pieCanvasToData") != null && context.get("barCanvasToData") != null) {
        this.putCharts(wb, sh, context);
    }
    this.putSignature(wb, sh, row + 1, context);
    FileOutputStream out = new FileOutputStream(fileFullPath);
    wb.write(out);
    out.close();
    wb = null;
    File file = new File(fileFullPath);
    String oid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "kpi-report.xlsx");
    file = null;
    return oid;
}
Also used : XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) FileOutputStream(java.io.FileOutputStream) XSSFWorkbook(org.apache.poi.xssf.usermodel.XSSFWorkbook) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) File(java.io.File)

Example 40 with VisionVO

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

the class KpiDateRangeScoreCommand method execute.

/*
	private static final String QUARTER_1 = "Q1";
	private static final String QUARTER_2 = "Q2";
	private static final String QUARTER_3 = "Q3";
	private static final String QUARTER_4 = "Q4";
	private static final String HALF_YEAR_FIRST = "first";
	private static final String HALF_YEAR_LAST = "last";
	*/
@Override
public boolean execute(Context context) throws Exception {
    if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
        return false;
    }
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    String frequency = (String) context.get("frequency");
    String startYearDate = StringUtils.defaultString((String) context.get("startYearDate")).trim();
    String endYearDate = StringUtils.defaultString((String) context.get("endYearDate")).trim();
    String startDate = StringUtils.defaultString((String) context.get("startDate")).trim();
    String endDate = StringUtils.defaultString((String) context.get("endDate")).trim();
    //long beg = System.currentTimeMillis();
    for (VisionVO vision : treeObj.getVisions()) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            for (ObjectiveVO objective : perspective.getObjectives()) {
                // 2015-04-11 add
                ExecutorService kpiCalculationPool = Executors.newFixedThreadPool(SimpleUtils.getAvailableProcessors(objective.getKpis().size()));
                for (KpiVO kpi : objective.getKpis()) {
                    /* 2015-04-11 rem
						if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(frequency) 
								|| BscMeasureDataFrequency.FREQUENCY_WEEK.equals(frequency) 
								|| BscMeasureDataFrequency.FREQUENCY_MONTH.equals(frequency) ) {
							this.fillDateRangeMonth(kpi, frequency, startDate, endDate);
						} else {
							this.fillDateRangeYear(kpi, frequency, startYearDate, endYearDate);
						}
						*/
                    // 2015-04-11 add
                    ScoreCalculationCallableData data = new ScoreCalculationCallableData();
                    data.setDefaultMode(false);
                    data.setKpi(kpi);
                    data.setFrequency(frequency);
                    data.setDate1(startYearDate);
                    data.setDate2(endYearDate);
                    if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_WEEK.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_MONTH.equals(frequency)) {
                        data.setDate1(startDate);
                        data.setDate2(endDate);
                    }
                    data = kpiCalculationPool.submit(new ScoreCalculationCallable(data)).get();
                }
                kpiCalculationPool.shutdown();
            }
        }
    }
    //System.out.println( this.getClass().getName() + " use time(MS) = " + (end-beg) );
    return false;
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) ExecutorService(java.util.concurrent.ExecutorService) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) ScoreCalculationCallableData(com.netsteadfast.greenstep.bsc.support.ScoreCalculationCallableData) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) ScoreCalculationCallable(com.netsteadfast.greenstep.bsc.support.ScoreCalculationCallable) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

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