use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class SystemFormLogicServiceImpl method create.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysFormVO> create(SysFormVO form, String templateOid) throws ServiceException, Exception {
if (null == form || super.isBlank(form.getFormId()) || super.isNoSelectId(templateOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
super.setStringValueMaxLength(form, "description", MAX_DESCRIPTION_LENGTH);
SysFormTemplateVO template = this.findTemplate(templateOid);
form.setTemplateId(template.getTplId());
return this.sysFormService.saveObject(form);
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority 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.base.model.ServiceMethodAuthority 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.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class SystemMessageNoticeLogicServiceImpl method createConfig.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysMsgNoticeConfigVO> createConfig(SysMsgNoticeConfigVO config, String systemOid) throws ServiceException, Exception {
if (super.isBlank(systemOid) || config == null) {
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();
config.setSystem(sys.getSysId());
return this.sysMsgNoticeConfigService.saveObject(config);
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class SystemProgramLogicServiceImpl method delete.
/**
* 刪除 TB_SYS_PROG 資料
*
* @param sysProg
* @return
* @throws ServiceException
* @throws Exception
*/
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(SysProgVO sysProg) throws ServiceException, Exception {
if (sysProg == null || StringUtils.isBlank(sysProg.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<SysProgVO> sysProgResult = this.sysProgService.findObjectByOid(sysProg);
if (sysProgResult.getValue() == null) {
throw new ServiceException(sysProgResult.getSystemMessage().getValue());
}
sysProg = sysProgResult.getValue();
Map<String, Object> params = new HashMap<String, Object>();
params.put("progId", sysProg.getProgId());
if (this.sysMenuService.countByParams(params) > 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
}
// 刪除 TB_SYS_MENU_ROLE 資料
List<TbSysMenuRole> sysMenuRoleList = this.sysMenuRoleService.findListByParams(params);
for (int i = 0; sysMenuRoleList != null && i < sysMenuRoleList.size(); i++) {
TbSysMenuRole sysMenuRole = sysMenuRoleList.get(i);
this.sysMenuRoleService.delete(sysMenuRole);
}
// 刪除名稱語言資料 tb_sys_prog_multi_name
List<TbSysProgMultiName> progMultiNames = this.sysProgMultiNameService.findListByParams(params);
for (int i = 0; progMultiNames != null && i < progMultiNames.size(); i++) {
this.sysProgMultiNameService.delete(progMultiNames.get(i));
}
return this.sysProgService.deleteObject(sysProg);
}
Aggregations