Search in sources :

Example 26 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage 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)

Example 27 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class StrategyMapLogicServiceImpl method create.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> create(String visionOid, Map<String, Object> jsonData) throws ServiceException, Exception {
    this.delete(visionOid);
    VisionVO vision = new VisionVO();
    vision.setOid(visionOid);
    DefaultResult<VisionVO> vResult = this.visionService.findObjectByOid(vision);
    if (vResult.getValue() == null) {
        // 沒 TB_VISION 資料, 不用清 STRATEGY MAP 			
        throw new ServiceException(vResult.getSystemMessage().getValue());
    }
    vision = vResult.getValue();
    StrategyMapVO strategyMap = new StrategyMapVO();
    strategyMap.setVisId(vision.getVisId());
    DefaultResult<StrategyMapVO> smResult = strategyMapService.saveObject(strategyMap);
    if (smResult.getValue() == null) {
        throw new ServiceException(smResult.getSystemMessage().getValue());
    }
    strategyMap = smResult.getValue();
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setValue(Boolean.TRUE);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    this.saveNodesAndConnections(strategyMap, jsonData);
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) StrategyMapVO(com.netsteadfast.greenstep.vo.StrategyMapVO) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 28 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class StrategyMapLogicServiceImpl method delete.

@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(String visionOid) throws ServiceException, Exception {
    if (super.isBlank(visionOid) || super.isNoSelectId(visionOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setValue(Boolean.TRUE);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.DELETE_SUCCESS)));
    VisionVO vision = new VisionVO();
    vision.setOid(visionOid);
    DefaultResult<VisionVO> vResult = this.visionService.findObjectByOid(vision);
    if (vResult.getValue() == null) {
        // 沒 TB_VISION 資料, 不用清 STRATEGY MAP 			
        return result;
    }
    vision = vResult.getValue();
    StrategyMapVO strategyMap = new StrategyMapVO();
    strategyMap.setVisId(vision.getVisId());
    DefaultResult<StrategyMapVO> smResult = this.strategyMapService.findByUK(strategyMap);
    if (smResult.getValue() == null) {
        // 沒有 BB_STRATEGY_MAP 資料
        return result;
    }
    strategyMap = smResult.getValue();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("masterOid", strategyMap.getOid());
    List<BbStrategyMapNodes> nodes = this.strategyMapNodesService.findListByParams(params);
    List<BbStrategyMapConns> conns = this.strategyMapConnsService.findListByParams(params);
    for (int i = 0; nodes != null && i < nodes.size(); i++) {
        strategyMapNodesService.delete(nodes.get(i));
    }
    for (int i = 0; conns != null && i < conns.size(); i++) {
        strategyMapConnsService.delete(conns.get(i));
    }
    return strategyMapService.deleteObject(strategyMap);
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) BbStrategyMapConns(com.netsteadfast.greenstep.po.hbm.BbStrategyMapConns) HashMap(java.util.HashMap) StrategyMapVO(com.netsteadfast.greenstep.vo.StrategyMapVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) BbStrategyMapNodes(com.netsteadfast.greenstep.po.hbm.BbStrategyMapNodes) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 29 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class RoleLogicServiceImpl method updateUserRole.

/**
	 * 更新帳戶的role
	 * 
	 * @param accountOid
	 * @param roles
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> updateUserRole(String accountOid, List<String> roles) throws ServiceException, Exception {
    if (super.isBlank(accountOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    AccountVO account = new AccountVO();
    account.setOid(accountOid);
    DefaultResult<AccountVO> aResult = this.accountService.findObjectByOid(account);
    if (aResult.getValue() == null) {
        throw new ServiceException(aResult.getSystemMessage().getValue());
    }
    account = aResult.getValue();
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setValue(false);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
    this.deleteUserRoleByAccount(account);
    for (int i = 0; roles != null && i < roles.size(); i++) {
        String roleOid = roles.get(i).trim();
        if (super.isBlank(roleOid)) {
            continue;
        }
        RoleVO role = new RoleVO();
        role.setOid(roleOid);
        DefaultResult<RoleVO> rResult = this.roleService.findObjectByOid(role);
        if (rResult.getValue() == null) {
            throw new ServiceException(rResult.getSystemMessage().getValue());
        }
        role = rResult.getValue();
        UserRoleVO userRole = new UserRoleVO();
        userRole.setAccount(account.getAccount());
        userRole.setRole(role.getRole());
        userRole.setDescription("");
        DefaultResult<UserRoleVO> urResult = this.userRoleService.saveObject(userRole);
        if (urResult.getValue() == null) {
            throw new ServiceException(urResult.getSystemMessage().getValue());
        }
    }
    result.setValue(true);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) UserRoleVO(com.netsteadfast.greenstep.vo.UserRoleVO) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) UserRoleVO(com.netsteadfast.greenstep.vo.UserRoleVO) SysMenuRoleVO(com.netsteadfast.greenstep.vo.SysMenuRoleVO) RoleVO(com.netsteadfast.greenstep.vo.RoleVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 30 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class SysMailHelperServiceImpl method findForJobList.

@Override
public DefaultResult<List<TbSysMailHelper>> findForJobList(String mailId, String successFlag) throws ServiceException, Exception {
    if (StringUtils.isBlank(mailId) || StringUtils.isBlank(successFlag)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<List<TbSysMailHelper>> result = new DefaultResult<List<TbSysMailHelper>>();
    List<TbSysMailHelper> searchList = this.sysMailHelperDAO.findForJobList(mailId, successFlag);
    if (searchList != null && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : TbSysMailHelper(com.netsteadfast.greenstep.po.hbm.TbSysMailHelper) SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Aggregations

SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)53 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)50 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)49 Transactional (org.springframework.transaction.annotation.Transactional)34 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)31 HashMap (java.util.HashMap)13 List (java.util.List)12 Map (java.util.Map)10 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)7 BaseEntity (com.netsteadfast.greenstep.base.model.BaseEntity)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 BaseValueObj (com.netsteadfast.greenstep.base.model.BaseValueObj)5 AggregationMethodVO (com.netsteadfast.greenstep.vo.AggregationMethodVO)3 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)3 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)3 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)3 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)3 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)3 BigDecimal (java.math.BigDecimal)3