Search in sources :

Example 1 with BbPerspective

use of com.netsteadfast.greenstep.po.hbm.BbPerspective in project bamboobsc by billchen198318.

the class SwotDataProvideCommand method execute.

@Override
public boolean execute(Context context) throws Exception {
    String visionOid = (String) context.get("visionOid");
    String organizationOid = (String) context.get("organizationOid");
    VisionVO vision = this.findVision(visionOid);
    OrganizationVO organization = this.findOrganization(organizationOid);
    if (StringUtils.isBlank(vision.getVisId()) || StringUtils.isBlank(organization.getOrgId())) {
        this.setMessage(context, SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
        return false;
    }
    Map<String, Object> params = new HashMap<String, Object>();
    Map<String, String> orderParams = new HashMap<String, String>();
    params.put("visId", vision.getVisId());
    orderParams.put("perId", "asc");
    List<BbPerspective> perspectives = this.perspectiveService.findListByParams(params, null, orderParams);
    if (perspectives == null || perspectives.size() < 1) {
        this.setMessage(context, SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
        return false;
    }
    params.put("orgId", organization.getOrgId());
    List<BbSwot> swots = this.swotService.findListByParams(params, null, orderParams);
    SwotDataVO swotData = new SwotDataVO();
    swotData.setVision(vision);
    swotData.setOrganization(organization);
    swotData.setContents(swots);
    swotData.setPerspectives(perspectives);
    this.initIssues(swotData, vision.getVisId(), organization.getOrgId());
    this.setResult(context, swotData);
    return false;
}
Also used : HashMap(java.util.HashMap) BbSwot(com.netsteadfast.greenstep.po.hbm.BbSwot) SwotDataVO(com.netsteadfast.greenstep.bsc.vo.SwotDataVO) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) BbPerspective(com.netsteadfast.greenstep.po.hbm.BbPerspective) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 2 with BbPerspective

use of com.netsteadfast.greenstep.po.hbm.BbPerspective in project bamboobsc by billchen198318.

the class SwotDataProvideCommand method initIssues.

private void initIssues(SwotDataVO swotData, String visId, String orgId) throws Exception {
    String sep = BscConstants.SWOT_TEXT_INPUT_ID_SEPARATE;
    for (BbPerspective perspective : swotData.getPerspectives()) {
        SwotIssuesVO issues = new SwotIssuesVO();
        BbSwot sMain = null;
        BbSwot wMain = null;
        BbSwot oMain = null;
        BbSwot tMain = null;
        String sStr = "";
        String wStr = "";
        String oStr = "";
        String tStr = "";
        String sId = "BSC_PROG002D0008Q";
        String wId = "BSC_PROG002D0008Q";
        String oId = "BSC_PROG002D0008Q";
        String tId = "BSC_PROG002D0008Q";
        for (String type : BscSwotCode.CODES) {
            if (BscSwotCode.STRENGTHS_CODE.equals(type)) {
                sMain = this.getIssuesMain(perspective.getPerId(), type, swotData.getContents());
                if (sMain != null) {
                    sStr = StringUtils.defaultString(sMain.getIssues());
                }
                sId += sep + type + sep + visId + sep + perspective.getPerId() + sep + orgId;
            }
            if (BscSwotCode.WEAKNESSES_CODE.equals(type)) {
                wMain = this.getIssuesMain(perspective.getPerId(), type, swotData.getContents());
                if (wMain != null) {
                    wStr = StringUtils.defaultString(wMain.getIssues());
                }
                wId += sep + type + sep + visId + sep + perspective.getPerId() + sep + orgId;
            }
            if (BscSwotCode.OPPORTUNITIES_CODE.equals(type)) {
                oMain = this.getIssuesMain(perspective.getPerId(), type, swotData.getContents());
                if (oMain != null) {
                    oStr = StringUtils.defaultString(oMain.getIssues());
                }
                oId += sep + type + sep + visId + sep + perspective.getPerId() + sep + orgId;
            }
            if (BscSwotCode.THREATS_CODE.equals(type)) {
                tMain = this.getIssuesMain(perspective.getPerId(), type, swotData.getContents());
                if (tMain != null) {
                    tStr = StringUtils.defaultString(tMain.getIssues());
                }
                tId += sep + type + sep + visId + sep + perspective.getPerId() + sep + orgId;
            }
        }
        issues.setPerspectiveName(perspective.getName());
        issues.setStrengthsMain(sMain);
        issues.setStrengths(sStr);
        issues.setWeaknessesMain(wMain);
        issues.setWeaknesses(wStr);
        issues.setOpportunitiesMain(oMain);
        issues.setOpportunities(oStr);
        issues.setThreatsMain(tMain);
        issues.setThreats(tStr);
        issues.setStrengthsTextId(sId);
        issues.setWeaknessesTextId(wId);
        issues.setOpportunitiesTextId(oId);
        issues.setThreatsTextId(tId);
        swotData.getIssues().add(issues);
    }
}
Also used : BbSwot(com.netsteadfast.greenstep.po.hbm.BbSwot) BbPerspective(com.netsteadfast.greenstep.po.hbm.BbPerspective) SwotIssuesVO(com.netsteadfast.greenstep.bsc.vo.SwotIssuesVO)

Example 3 with BbPerspective

use of com.netsteadfast.greenstep.po.hbm.BbPerspective in project bamboobsc by billchen198318.

the class WeightLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> update(List<PerspectiveVO> perspectives, List<ObjectiveVO> objectives, List<KpiVO> kpis) throws ServiceException, Exception {
    if (perspectives == null || perspectives.size() < 1 || objectives == null || objectives.size() < 1 || kpis == null || kpis.size() < 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    for (PerspectiveVO perspective : perspectives) {
        BbPerspective entity = this.perspectiveService.findByPKng(perspective.getOid());
        entity.setWeight(perspective.getWeight());
        this.perspectiveService.update(entity);
    }
    for (ObjectiveVO objective : objectives) {
        BbObjective entity = this.objectiveService.findByPKng(objective.getOid());
        entity.setWeight(objective.getWeight());
        this.objectiveService.update(entity);
    }
    for (KpiVO kpi : kpis) {
        BbKpi entity = this.kpiService.findByPKng(kpi.getOid());
        entity.setWeight(kpi.getWeight());
        this.kpiService.update(entity);
    }
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    result.setValue(Boolean.TRUE);
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) BbObjective(com.netsteadfast.greenstep.po.hbm.BbObjective) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) BbPerspective(com.netsteadfast.greenstep.po.hbm.BbPerspective) BbKpi(com.netsteadfast.greenstep.po.hbm.BbKpi) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

BbPerspective (com.netsteadfast.greenstep.po.hbm.BbPerspective)3 BbSwot (com.netsteadfast.greenstep.po.hbm.BbSwot)2 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)1 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)1 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)1 SwotDataVO (com.netsteadfast.greenstep.bsc.vo.SwotDataVO)1 SwotIssuesVO (com.netsteadfast.greenstep.bsc.vo.SwotIssuesVO)1 BbKpi (com.netsteadfast.greenstep.po.hbm.BbKpi)1 BbObjective (com.netsteadfast.greenstep.po.hbm.BbObjective)1 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)1 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)1 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)1 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)1 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)1 HashMap (java.util.HashMap)1 Transactional (org.springframework.transaction.annotation.Transactional)1