Search in sources :

Example 6 with ObjectiveVO

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

the class ScoreCalculationCommand method processObjectivesScore.

private void processObjectivesScore(List<VisionVO> visions) throws Exception {
    for (VisionVO vision : visions) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            for (ObjectiveVO objective : perspective.getObjectives()) {
                float score = 0.0f;
                for (KpiVO kpi : objective.getKpis()) {
                    score += kpi.getScore() * this.getWeightPercentage(kpi.getWeight());
                }
                objective.setScore(score);
                objective.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
                objective.setFontColor(BscScoreColorUtils.getFontColor(score));
            /*
					objective.setImgIcon( 
							BscReportSupportUtils.getHtmlIconBase(
									"OBJECTIVES", 
									objective.getTarget(), 
									objective.getMin(), 
									score, 
									"", 
									"", 
									0)
					);
					*/
            }
        }
    }
}
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 7 with ObjectiveVO

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

the class ScoreCalculationCommand method processKpisScore.

private void processKpisScore(List<VisionVO> visions) throws Exception {
    //long beg = System.currentTimeMillis();
    for (VisionVO vision : visions) {
        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
						float score = this.calculationMeasureData(kpi);
						kpi.setScore(score);
						kpi.setBgColor( BscScoreColorUtils.getBackgroundColor(score) );
						kpi.setFontColor( BscScoreColorUtils.getFontColor(score) );
						*/
                    // 2015-04-11 add
                    ScoreCalculationCallableData data = new ScoreCalculationCallableData();
                    data.setDefaultMode(true);
                    data.setKpi(kpi);
                    data = kpiCalculationPool.submit(new ScoreCalculationCallable(data)).get();
                }
                kpiCalculationPool.shutdown();
            }
        }
    }
//long end = System.currentTimeMillis();
//System.out.println( this.getClass().getName() + " use time(MS) = " + (end-beg) );		
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) 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)

Example 8 with ObjectiveVO

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

the class KpiManagementAction method handlerSelectValueForEdit.

private void handlerSelectValueForEdit() throws ServiceException, Exception {
    ObjectiveVO objective = new ObjectiveVO();
    objective.setObjId(this.kpi.getObjId());
    DefaultResult<ObjectiveVO> objResult = this.objectiveService.findByUK(objective);
    if (objResult.getValue() == null) {
        throw new ServiceException(objResult.getSystemMessage().getValue());
    }
    objective = objResult.getValue();
    PerspectiveVO perspective = new PerspectiveVO();
    perspective.setPerId(objective.getPerId());
    DefaultResult<PerspectiveVO> perResult = this.perspectiveService.findByUK(perspective);
    if (perResult.getValue() == null) {
        throw new ServiceException(perResult.getSystemMessage().getValue());
    }
    perspective = perResult.getValue();
    VisionVO vision = new VisionVO();
    vision.setVisId(perspective.getVisId());
    DefaultResult<VisionVO> visResult = this.visionService.findForSimpleByVisId(vision.getVisId());
    if (visResult.getValue() == null) {
        throw new ServiceException(visResult.getSystemMessage().getValue());
    }
    vision = visResult.getValue();
    //		FormulaVO formula = new FormulaVO();
    //		formula.setForId( this.kpi.getForId() );
    //		DefaultResult<FormulaVO> forResult = this.formulaService.findByUK(formula);
    //		if (forResult.getValue()==null) {
    //			throw new ServiceException( forResult.getSystemMessage().getValue() );
    //		}
    //		formula = forResult.getValue();
    //		
    //		FormulaVO trendsFormula = new FormulaVO();
    //		trendsFormula.setForId( this.kpi.getTrendsForId() );
    //		DefaultResult<FormulaVO> trendsForResult = this.formulaService.findByUK(trendsFormula);
    //		if (trendsForResult.getValue()==null) {
    //			throw new ServiceException( trendsForResult.getSystemMessage().getValue() );
    //		}
    //		trendsFormula = trendsForResult.getValue();		
    this.getFields().put("visionOid", vision.getOid());
    this.getFields().put("perspectiveOid", perspective.getOid());
    this.getFields().put("objectiveOid", objective.getOid());
    this.getFields().put("formulaOid", BscFormulaUtils.getFormulaById(this.kpi.getForId()).getOid());
    this.getFields().put("trendsFormulaOid", BscFormulaUtils.getFormulaById(this.kpi.getTrendsForId()).getOid());
    this.getFields().put("aggrMethodOid", AggregationMethodUtils.findSimpleById(this.kpi.getCal()).getOid());
    this.perspectiveMap = this.perspectiveService.findForMapByVisionOid(vision.getOid(), true);
    this.objectiveMap = this.objectiveService.findForMapByPerspectiveOid(perspective.getOid(), true);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 9 with ObjectiveVO

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

the class OrganizationReportExcelCommand method createMainBody.

private int createMainBody(XSSFWorkbook wb, XSSFSheet sh, int row, VisionVO vision) throws Exception {
    XSSFCellStyle cellStyle = wb.createCellStyle();
    cellStyle.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#ffffff")));
    cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    XSSFFont cellFont = wb.createFont();
    cellFont.setBold(false);
    cellFont.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor("#000000")));
    cellStyle.setFont(cellFont);
    cellStyle.setWrapText(true);
    cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    cellStyle.setBorderBottom(BorderStyle.THIN);
    cellStyle.setBorderTop(BorderStyle.THIN);
    cellStyle.setBorderRight(BorderStyle.THIN);
    cellStyle.setBorderLeft(BorderStyle.THIN);
    int mrRow = row;
    for (int px = 0; px < vision.getPerspectives().size(); px++) {
        PerspectiveVO perspective = vision.getPerspectives().get(px);
        for (int ox = 0; ox < perspective.getObjectives().size(); ox++) {
            ObjectiveVO objective = perspective.getObjectives().get(ox);
            for (int kx = 0; kx < objective.getKpis().size(); kx++) {
                KpiVO kpi = objective.getKpis().get(kx);
                Row contentRow = sh.createRow(row++);
                Cell cell1 = contentRow.createCell(0);
                cell1.setCellValue(perspective.getName());
                cell1.setCellStyle(cellStyle);
                Cell titleCell2 = contentRow.createCell(1);
                titleCell2.setCellValue(objective.getName());
                titleCell2.setCellStyle(cellStyle);
                Cell titleCell3 = contentRow.createCell(2);
                titleCell3.setCellValue(kpi.getName());
                titleCell3.setCellStyle(cellStyle);
                Cell titleCell4 = contentRow.createCell(3);
                titleCell4.setCellValue(kpi.getWeight() + "%");
                titleCell4.setCellStyle(cellStyle);
                Cell titleCell5 = contentRow.createCell(4);
                titleCell5.setCellValue("max: " + kpi.getMax() + "\n" + "target: " + kpi.getTarget() + "\n" + "min: " + kpi.getMin() + "\n" + "unit: " + kpi.getUnit());
                titleCell5.setCellStyle(cellStyle);
                DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(0);
                XSSFCellStyle cellStyle2 = wb.createCellStyle();
                cellStyle2.setFillForegroundColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getBgColor())));
                cellStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
                XSSFFont cellFont2 = wb.createFont();
                cellFont2.setBold(false);
                cellFont2.setColor(new XSSFColor(SimpleUtils.getColorRGB4POIColor(dateRangeScore.getFontColor())));
                cellStyle2.setFont(cellFont2);
                cellStyle2.setWrapText(true);
                cellStyle2.setVerticalAlignment(VerticalAlignment.CENTER);
                cellStyle2.setBorderBottom(BorderStyle.THIN);
                cellStyle2.setBorderTop(BorderStyle.THIN);
                cellStyle2.setBorderRight(BorderStyle.THIN);
                cellStyle2.setBorderLeft(BorderStyle.THIN);
                Cell titleCell6 = contentRow.createCell(5);
                titleCell6.setCellValue(BscReportSupportUtils.parse2(dateRangeScore.getScore()));
                titleCell6.setCellStyle(cellStyle2);
            }
        }
    }
    for (int px = 0; px < vision.getPerspectives().size(); px++) {
        PerspectiveVO perspective = vision.getPerspectives().get(px);
        // 2016-12-13 old work with POI 3.12
        //sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow + perspective.getRow()-1, 0, 0));
        // 2016-12-13 new work with POI 3.15
        int mrRow1 = mrRow + perspective.getRow() - 1;
        if (mrRow1 > mrRow) {
            sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow1, 0, 0));
        }
        for (int ox = 0; ox < perspective.getObjectives().size(); ox++) {
            ObjectiveVO objective = perspective.getObjectives().get(ox);
            // 2016-12-13 old work with POI 3.12
            //sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow + objective.getRow()-1, 1, 1));
            // 2016-12-13 new work with POI 3.15
            int mrRow2 = mrRow + objective.getRow() - 1;
            if (mrRow2 > mrRow) {
                sh.addMergedRegion(new CellRangeAddress(mrRow, mrRow2, 1, 1));
            }
            mrRow += objective.getKpis().size();
        }
    }
    return row++;
}
Also used : XSSFColor(org.apache.poi.xssf.usermodel.XSSFColor) XSSFCellStyle(org.apache.poi.xssf.usermodel.XSSFCellStyle) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) XSSFFont(org.apache.poi.xssf.usermodel.XSSFFont) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) DateRangeScoreVO(com.netsteadfast.greenstep.vo.DateRangeScoreVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) Row(org.apache.poi.ss.usermodel.Row) CellRangeAddress(org.apache.poi.ss.util.CellRangeAddress) Cell(org.apache.poi.ss.usermodel.Cell)

Example 10 with ObjectiveVO

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

the class LoadBscStructTreeCommand method calculateRowspan.

private void calculateRowspan(BscStructTreeObj treeObj) throws Exception {
    for (VisionVO vision : treeObj.getVisions()) {
        int vRow = 0;
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            int pRow = 0;
            for (ObjectiveVO objective : perspective.getObjectives()) {
                vRow += objective.getKpis().size();
                pRow += objective.getKpis().size();
                objective.setRow(objective.getKpis().size());
            }
            perspective.setRow(pRow);
        }
        vision.setRow(vRow);
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Aggregations

ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)50 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)44 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)34 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)29 HashMap (java.util.HashMap)15 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)13 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)8 DateRangeScoreVO (com.netsteadfast.greenstep.vo.DateRangeScoreVO)8 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 LinkedList (java.util.LinkedList)6 Phrase (com.itextpdf.text.Phrase)4 PdfPCell (com.itextpdf.text.pdf.PdfPCell)4 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)4 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)4 Cell (org.apache.poi.ss.usermodel.Cell)4 Row (org.apache.poi.ss.usermodel.Row)4 CellRangeAddress (org.apache.poi.ss.util.CellRangeAddress)4 XSSFCellStyle (org.apache.poi.xssf.usermodel.XSSFCellStyle)4 XSSFColor (org.apache.poi.xssf.usermodel.XSSFColor)4