Search in sources :

Example 1 with AggregationMethodVO

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

the class AggregationMethodServiceImpl method findForMap.

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

Example 2 with AggregationMethodVO

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

the class AggregationMethodServiceImpl method findSimpleById.

@Override
public DefaultResult<AggregationMethodVO> findSimpleById(String aggrId) throws ServiceException, Exception {
    if (StringUtils.isBlank(aggrId) || super.isNoSelectId(aggrId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    AggregationMethodVO aggr = this.aggregationMethodDAO.findSimpleById(aggrId);
    DefaultResult<AggregationMethodVO> result = new DefaultResult<AggregationMethodVO>();
    if (aggr != null && !StringUtils.isBlank(aggr.getOid())) {
        result.setValue(aggr);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) AggregationMethodVO(com.netsteadfast.greenstep.vo.AggregationMethodVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 3 with AggregationMethodVO

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

the class AggregationMethodSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    AggregationMethodVO aggr = new AggregationMethodVO();
    this.transformFields2ValueObject(aggr, new String[] { "oid", "aggrId", "name", "type", "expression1", "expression2", "description" });
    DefaultResult<AggregationMethodVO> result = this.aggregationMethodLogicService.update(aggr);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : AggregationMethodVO(com.netsteadfast.greenstep.vo.AggregationMethodVO)

Example 4 with AggregationMethodVO

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

the class AggregationMethodLogicServiceImpl method delete.

@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(AggregationMethodVO aggregationMethod) throws ServiceException, Exception {
    if (null == aggregationMethod || super.isBlank(aggregationMethod.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    AggregationMethodVO oldAggregationMethod = AggregationMethodUtils.findSimpleByOid(aggregationMethod.getOid());
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("cal", oldAggregationMethod.getAggrId());
    if (this.kpiService.countByParams(paramMap) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }
    return this.aggregationMethodService.deleteObject(aggregationMethod);
}
Also used : AggregationMethodVO(com.netsteadfast.greenstep.vo.AggregationMethodVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with AggregationMethodVO

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

AggregationMethodVO (com.netsteadfast.greenstep.vo.AggregationMethodVO)12 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)6 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)3 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)3 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)2 HashMap (java.util.HashMap)2 Transactional (org.springframework.transaction.annotation.Transactional)2 BscMixDataVO (com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)1 FormulaVO (com.netsteadfast.greenstep.vo.FormulaVO)1 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)1 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)1 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)1 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)1 List (java.util.List)1