Search in sources :

Example 1 with SysMsgNoticeConfigVO

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

the class SystemMessageNoticeLogicServiceImpl method create.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysMsgNoticeVO> create(SysMsgNoticeVO notice, String configOid, String accountOid) throws ServiceException, Exception {
    if (super.isBlank(configOid) || notice == null) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysMsgNoticeConfigVO config = new SysMsgNoticeConfigVO();
    config.setOid(configOid);
    DefaultResult<SysMsgNoticeConfigVO> configResult = this.sysMsgNoticeConfigService.findObjectByOid(config);
    if (configResult.getValue() == null) {
        throw new ServiceException(configResult.getSystemMessage().getValue());
    }
    config = configResult.getValue();
    notice.setMsgId(config.getMsgId());
    notice.setToAccount("*");
    if (!super.isNoSelectId(accountOid) && !"*".equals(accountOid)) {
        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();
        notice.setToAccount(account.getAccount());
    }
    if (super.defaultString(notice.getMessage()).length() > MAX_MESSAGE_LENGTH) {
        notice.setMessage(notice.getMessage().substring(0, MAX_MESSAGE_LENGTH));
    }
    return this.sysMsgNoticeService.saveObject(notice);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysMsgNoticeConfigVO(com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with SysMsgNoticeConfigVO

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

the class SystemMessageNoticeLogicServiceImpl method updateConfig.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysMsgNoticeConfigVO> updateConfig(SysMsgNoticeConfigVO config, String systemOid) throws ServiceException, Exception {
    if (config == null || super.isBlank(config.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysVO sys = new SysVO();
    sys.setOid(systemOid);
    DefaultResult<SysVO> sysResult = this.sysService.findObjectByOid(sys);
    if (sysResult.getValue() == null) {
        throw new ServiceException(sysResult.getSystemMessage().getValue());
    }
    sys = sysResult.getValue();
    DefaultResult<SysMsgNoticeConfigVO> oldResult = this.sysMsgNoticeConfigService.findObjectByOid(config);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    config.setMsgId(oldResult.getValue().getMsgId());
    config.setSystem(sys.getSysId());
    return this.sysMsgNoticeConfigService.updateObject(config);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) SysMsgNoticeConfigVO(com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with SysMsgNoticeConfigVO

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

the class SystemMessageNoticeConfigManagementAction method loadSysMsgNoticeConfigData.

private void loadSysMsgNoticeConfigData() throws ServiceException, Exception {
    this.transformFields2ValueObject(this.sysMsgNoticeConfig, new String[] { "oid" });
    DefaultResult<SysMsgNoticeConfigVO> result = this.sysMsgNoticeConfigService.findObjectByOid(sysMsgNoticeConfig);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    sysMsgNoticeConfig = result.getValue();
    SysVO sys = new SysVO();
    sys.setSysId(sysMsgNoticeConfig.getSystem());
    DefaultResult<SysVO> sysResult = this.sysService.findByUK(sys);
    if (sysResult.getValue() != null) {
        this.selectValue = sysResult.getValue().getOid();
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysMsgNoticeConfigVO(com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO) SysVO(com.netsteadfast.greenstep.vo.SysVO)

Example 4 with SysMsgNoticeConfigVO

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

the class SystemMessageNoticeConfigSaveOrUpdateAction method delete.

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

Example 5 with SysMsgNoticeConfigVO

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

the class SystemMessageNoticeConfigSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysMsgNoticeConfigVO config = new SysMsgNoticeConfigVO();
    this.transformFields2ValueObject(config, new String[] { "oid", "className" });
    DefaultResult<SysMsgNoticeConfigVO> result = this.systemMessageNoticeLogicService.updateConfig(config, this.getFields().get("systemOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() == null) {
        return;
    }
    this.success = IS_YES;
}
Also used : SysMsgNoticeConfigVO(com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO)

Aggregations

SysMsgNoticeConfigVO (com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO)7 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)4 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)2 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)2 SysVO (com.netsteadfast.greenstep.vo.SysVO)2 Transactional (org.springframework.transaction.annotation.Transactional)2 SysMsgNoticeVO (com.netsteadfast.greenstep.vo.SysMsgNoticeVO)1