Search in sources :

Example 1 with SysCodeVO

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

the class SystemSettingConfigureUtils method updateParam1.

public static void updateParam1(String code, String value) throws ServiceException, Exception {
    SysCodeVO sysCode = new SysCodeVO();
    sysCode.setType(CODE_TYPE);
    sysCode.setCode(code);
    DefaultResult<SysCodeVO> result = sysCodeService.findByUK(sysCode);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    sysCode = result.getValue();
    sysCode.setParam1(value);
    result = sysCodeService.updateObject(sysCode);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysCodeVO(com.netsteadfast.greenstep.vo.SysCodeVO)

Example 2 with SysCodeVO

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

the class SystemSettingConfigureUtils method getCode.

public static SysCodeVO getCode(String code) {
    SysCodeVO sysCode = new SysCodeVO();
    sysCode.setType(CODE_TYPE);
    sysCode.setCode(code);
    try {
        DefaultResult<SysCodeVO> result = sysCodeService.findByUK(sysCode);
        if (result.getValue() != null) {
            sysCode = result.getValue();
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return sysCode;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysCodeVO(com.netsteadfast.greenstep.vo.SysCodeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 3 with SysCodeVO

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

the class RoleLogicServiceImpl method getDefaultUserRole.

/**
	 * 使用者設的role-id(角色), 它設定在 tb_sys_code中
	 * 
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
public String getDefaultUserRole() throws ServiceException, Exception {
    String role = "";
    SysCodeVO sysCode = new SysCodeVO();
    sysCode.setType(DEFAULT_ROLE_CODE_TYPE);
    sysCode.setCode(DEFAULT_ROLE_CODE);
    DefaultResult<SysCodeVO> result = this.sysCodeService.findByUK(sysCode);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    sysCode = result.getValue();
    role = sysCode.getParam1();
    if (super.isBlank(role)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("role", role);
    if (this.roleService.countByParams(params) != 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    return role;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) SysCodeVO(com.netsteadfast.greenstep.vo.SysCodeVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)

Aggregations

ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)3 SysCodeVO (com.netsteadfast.greenstep.vo.SysCodeVO)3 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 HashMap (java.util.HashMap)1