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);
}
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);
}
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();
}
}
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;
}
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;
}
Aggregations