Search in sources :

Example 56 with ServiceMethodAuthority

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);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysFormTemplateVO(com.netsteadfast.greenstep.vo.SysFormTemplateVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 57 with ServiceMethodAuthority

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);
}
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 58 with ServiceMethodAuthority

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);
}
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 59 with ServiceMethodAuthority

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);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 60 with ServiceMethodAuthority

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);
}
Also used : TbSysMenuRole(com.netsteadfast.greenstep.po.hbm.TbSysMenuRole) TbSysProgMultiName(com.netsteadfast.greenstep.po.hbm.TbSysProgMultiName) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) SysProgVO(com.netsteadfast.greenstep.vo.SysProgVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)95 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)91 Transactional (org.springframework.transaction.annotation.Transactional)84 HashMap (java.util.HashMap)32 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)31 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)29 SysVO (com.netsteadfast.greenstep.vo.SysVO)13 LinkedHashMap (java.util.LinkedHashMap)13 Map (java.util.Map)12 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)7 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)7 BaseEntity (com.netsteadfast.greenstep.base.model.BaseEntity)6 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)6 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)6 IOException (java.io.IOException)6 BaseValueObj (com.netsteadfast.greenstep.base.model.BaseValueObj)5 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)5 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)5 UserRoleVO (com.netsteadfast.greenstep.vo.UserRoleVO)5 BbReportRoleView (com.netsteadfast.greenstep.po.hbm.BbReportRoleView)4