Search in sources :

Example 1 with FormulaVO

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

the class FormulaServiceImpl method findForSimple.

@Override
public DefaultResult<List<FormulaVO>> findForSimple(boolean trendsFlag) throws ServiceException, Exception {
    DefaultResult<List<FormulaVO>> result = new DefaultResult<List<FormulaVO>>();
    List<FormulaVO> searchList = this.formulaDAO.findForSimple((trendsFlag ? YesNo.YES : YesNo.NO));
    if (searchList != null && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) FormulaVO(com.netsteadfast.greenstep.vo.FormulaVO)

Example 2 with FormulaVO

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

the class FormulaServiceImpl method findForMap.

@Override
public Map<String, String> findForMap(boolean pleaseSelect, boolean trendsFlag) throws ServiceException, Exception {
    Map<String, String> dataMap = this.providedSelectZeroDataMap(pleaseSelect);
    List<FormulaVO> searchList = this.formulaDAO.findForSimple((trendsFlag ? YesNo.YES : YesNo.NO));
    for (int i = 0; searchList != null && i < searchList.size(); i++) {
        FormulaVO formula = searchList.get(i);
        dataMap.put(formula.getOid(), formula.getName());
    }
    return dataMap;
}
Also used : FormulaVO(com.netsteadfast.greenstep.vo.FormulaVO)

Example 3 with FormulaVO

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

the class FormulaSaveOrUpdateAction method delete.

private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
    FormulaVO formula = new FormulaVO();
    this.transformFields2ValueObject(formula, new String[] { "oid" });
    DefaultResult<Boolean> result = this.formulaLogicService.delete(formula);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null && result.getValue()) {
        this.success = IS_YES;
    }
}
Also used : FormulaVO(com.netsteadfast.greenstep.vo.FormulaVO)

Example 4 with FormulaVO

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

Example 5 with FormulaVO

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

the class BscFormulaUtils method getFormulaById.

@SuppressWarnings("unchecked")
public static FormulaVO getFormulaById(String forId) throws ServiceException, Exception {
    IFormulaService<FormulaVO, BbFormula, String> formulaService = (IFormulaService<FormulaVO, BbFormula, String>) AppContext.getBean("bsc.service.FormulaService");
    FormulaVO formula = new FormulaVO();
    formula.setForId(forId);
    DefaultResult<FormulaVO> forResult = formulaService.findByUK(formula);
    if (forResult.getValue() == null) {
        throw new ServiceException(forResult.getSystemMessage().getValue());
    }
    formula = forResult.getValue();
    return formula;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) IFormulaService(com.netsteadfast.greenstep.bsc.service.IFormulaService) BbFormula(com.netsteadfast.greenstep.po.hbm.BbFormula) FormulaVO(com.netsteadfast.greenstep.vo.FormulaVO)

Aggregations

FormulaVO (com.netsteadfast.greenstep.vo.FormulaVO)10 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)3 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)2 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)1 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)1 BscMeasureData (com.netsteadfast.greenstep.bsc.model.BscMeasureData)1 IFormulaService (com.netsteadfast.greenstep.bsc.service.IFormulaService)1 BscMixDataVO (com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)1 BbFormula (com.netsteadfast.greenstep.po.hbm.BbFormula)1 AggregationMethodVO (com.netsteadfast.greenstep.vo.AggregationMethodVO)1 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)1 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)1 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1