Search in sources :

Example 11 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO 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 12 with VisionVO

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

the class KpiReportContentQueryAction method fillPerspectivesPieChartData.

private void fillPerspectivesPieChartData(BscStructTreeObj treeObj) throws Exception {
    List<VisionVO> visions = treeObj.getVisions();
    for (VisionVO vision : visions) {
        if (!vision.getOid().equals(this.getFields().get("visionOid"))) {
            continue;
        }
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            Map<String, Object> dataMap = new HashMap<String, Object>();
            dataMap.put("label", perspective.getName());
            dataMap.put("value", perspective.getScore());
            this.perspectivesPieChartValue.add(dataMap);
            this.perspectivesPieChartBgColor.add(perspective.getBgColor());
        }
    }
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 13 with VisionVO

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

the class OrganizationReportExcelCommand 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();
    String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
    String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;
    int row = 0;
    XSSFWorkbook wb = new XSSFWorkbook();
    XSSFSheet sh = wb.createSheet();
    row += this.createHead(wb, sh, row, vision, context);
    row = this.createMainBody(wb, sh, row, vision);
    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, "department-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 14 with VisionVO

use of com.netsteadfast.greenstep.vo.VisionVO 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)

Example 15 with VisionVO

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

the class LoadBscStructTreeCommand method processKpi.

private void processKpi(BscStructTreeObj treeObj, List<BscMixDataVO> mixDatas) throws Exception {
    //Map<String, String> calculationMap = BscKpiCode.getCalculationMap(false);
    Map<String, String> managementMap = BscKpiCode.getManagementMap(false);
    for (VisionVO vision : treeObj.getVisions()) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            for (ObjectiveVO objective : perspective.getObjectives()) {
                for (BscMixDataVO mixData : mixDatas) {
                    if (!vision.getVisId().equals(mixData.getVisId()) || !perspective.getPerId().equals(mixData.getPerId()) || !objective.getObjId().equals(mixData.getObjId())) {
                        continue;
                    }
                    boolean found = false;
                    for (int i = 0; i < objective.getKpis().size(); i++) {
                        if (objective.getKpis().get(i).getId().equals(mixData.getKpiId())) {
                            found = true;
                        }
                    }
                    if (!found) {
                        KpiVO kpi = new KpiVO();
                        kpi.setOid(mixData.getKpiOid());
                        kpi.setId(mixData.getKpiId());
                        kpi.setCal(mixData.getKpiCal());
                        kpi.setCompareType(mixData.getKpiCompareType());
                        kpi.setDataType(mixData.getKpiDataType());
                        kpi.setDescription(mixData.getKpiDescription());
                        kpi.setForId(mixData.getForId());
                        kpi.setManagement(mixData.getKpiManagement());
                        kpi.setMax(mixData.getKpiMax());
                        kpi.setMin(mixData.getKpiMin());
                        kpi.setName(mixData.getKpiName());
                        kpi.setObjId(mixData.getObjId());
                        kpi.setOrgaMeasureSeparate(mixData.getKpiOrgaMeasureSeparate());
                        kpi.setTarget(mixData.getKpiTarget());
                        kpi.setUnit(mixData.getKpiUnit());
                        kpi.setUserMeasureSeparate(mixData.getKpiUserMeasureSeparate());
                        kpi.setWeight(mixData.getKpiWeight());
                        kpi.setManagementName(managementMap.get(kpi.getManagement()));
                        //kpi.setCalculationName( calculationMap.get(kpi.getCal()) );
                        kpi.setCalculationName(AggregationMethodUtils.getNameByAggrId(kpi.getCal()));
                        kpi.setQuasiRange(mixData.getKpiQuasiRange());
                        kpi.setActivate(mixData.getKpiActivate());
                        FormulaVO formula = new FormulaVO();
                        formula.setOid(mixData.getForOid());
                        formula.setForId(mixData.getForId());
                        formula.setName(mixData.getForName());
                        formula.setType(mixData.getForType());
                        formula.setReturnMode(mixData.getForReturnMode());
                        formula.setReturnVar(mixData.getForReturnVar());
                        formula.setExpression(mixData.getForExpression());
                        kpi.setFormula(formula);
                        AggregationMethodVO aggr = new AggregationMethodVO();
                        aggr.setOid(mixData.getAggrOid());
                        aggr.setAggrId(mixData.getAggrId());
                        aggr.setName(mixData.getAggrName());
                        aggr.setType(mixData.getAggrType());
                        aggr.setExpression1(mixData.getAggrExpression1());
                        aggr.setExpression2(mixData.getAggrExpression2());
                        kpi.setAggregationMethod(aggr);
                        FormulaVO trendsFormula = new FormulaVO();
                        trendsFormula.setOid(mixData.getTrendsForOid());
                        trendsFormula.setForId(mixData.getTrendsForId());
                        trendsFormula.setName(mixData.getTrendsForName());
                        trendsFormula.setType(mixData.getTrendsForType());
                        trendsFormula.setReturnMode(mixData.getTrendsForReturnMode());
                        trendsFormula.setReturnVar(mixData.getTrendsForReturnVar());
                        trendsFormula.setExpression(mixData.getTrendsForExpression());
                        kpi.setTrendsFormula(trendsFormula);
                        objective.getKpis().add(kpi);
                    }
                }
            }
        }
    }
}
Also used : AggregationMethodVO(com.netsteadfast.greenstep.vo.AggregationMethodVO) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) FormulaVO(com.netsteadfast.greenstep.vo.FormulaVO) BscMixDataVO(com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)

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