Search in sources :

Example 16 with AccountVO

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

the class SystemMessagePublishServiceImpl method execute.

@Override
public WebMessagePublishBaseObj execute(SysMsgNoticeConfigVO config, ServletRequest request) throws ServiceException, Exception {
    this.request = request;
    WebMessagePublishBaseObj publishObj = new WebMessagePublishBaseObj();
    String account = request.getParameter("account");
    String refreshUUID = StringUtils.defaultString(request.getParameter("refreshUUID")).trim();
    String sessionId = ((HttpServletRequest) request).getSession().getId();
    AccountVO accountObj = (AccountVO) UserAccountHttpSessionSupport.get((HttpServletRequest) request);
    if (StringUtils.isBlank(this.getId()) || StringUtils.isBlank(account) || accountObj == null) {
        // no login
        return publishObj;
    }
    if (!account.equals(accountObj.getAccount())) {
        // not same account request
        return publishObj;
    }
    List<TbSysMsgNotice> globalSysMsgNoticeList = this.loadGlobalSysMsgNoticeData(config.getMsgId(), "*");
    List<TbSysMsgNotice> accountSysMsgNoticeList = this.loadAccountSysMsgNoticeData(config.getMsgId(), account);
    String globalMsg = this.process(sessionId, refreshUUID, globalSysMsgNoticeList);
    String personalMsg = this.process(sessionId, refreshUUID, accountSysMsgNoticeList);
    publishObj.setIsAuthorize(YesNo.YES);
    publishObj.setLogin(YesNo.YES);
    publishObj.setSuccess(YesNo.YES);
    publishObj.setMessage(globalMsg + personalMsg);
    return publishObj;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) TbSysMsgNotice(com.netsteadfast.greenstep.po.hbm.TbSysMsgNotice) WebMessagePublishBaseObj(com.netsteadfast.greenstep.model.WebMessagePublishBaseObj) AccountVO(com.netsteadfast.greenstep.vo.AccountVO)

Example 17 with AccountVO

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

the class AccountServiceImpl method findForAllMap.

/**
	 * 下拉Select 要用
	 * 
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@Override
public Map<String, String> findForAllMap(boolean pleaseSelect) throws ServiceException, Exception {
    List<AccountVO> searchList = this.findForAll();
    Map<String, String> dataMap = new LinkedHashMap<String, String>();
    if (pleaseSelect) {
        dataMap.put(Constants.HTML_SELECT_NO_SELECT_ID, Constants.HTML_SELECT_NO_SELECT_NAME);
    }
    if (searchList == null || searchList.size() < 1) {
        return dataMap;
    }
    for (AccountVO account : searchList) {
        dataMap.put(account.getOid(), account.getAccount());
    }
    return dataMap;
}
Also used : AccountVO(com.netsteadfast.greenstep.vo.AccountVO) LinkedHashMap(java.util.LinkedHashMap)

Example 18 with AccountVO

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

the class CoreBaseLogicService method findAccountData.

public AccountVO findAccountData(String accountId) throws ServiceException, Exception {
    if (super.isBlank(accountId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    AccountVO accountObj = new AccountVO();
    accountObj.setAccount(accountId);
    DefaultResult<AccountVO> result = this.accountService.findByUK(accountObj);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().toString());
    }
    accountObj = result.getValue();
    return accountObj;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AccountVO(com.netsteadfast.greenstep.vo.AccountVO)

Example 19 with AccountVO

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

the class GreenStepBaseAuthorizingRealm method doGetAuthenticationInfo.

/**
	 * 認證
	 */
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
    GreenStepBaseUsernamePasswordToken token = (GreenStepBaseUsernamePasswordToken) authenticationToken;
    String account = token.getUsername();
    AccountVO accountObj = new AccountVO();
    accountObj.setAccount(account);
    try {
        DefaultResult<AccountVO> result = accountService.findByUK(accountObj);
        if (result.getValue() == null) {
            return null;
        }
        accountObj = result.getValue();
        return new SimpleAuthenticationInfo(accountObj.getAccount(), accountObj.getPassword(), this.getName());
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : SimpleAuthenticationInfo(org.apache.shiro.authc.SimpleAuthenticationInfo) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) AuthenticationException(org.apache.shiro.authc.AuthenticationException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 20 with AccountVO

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

the class GreenStepBaseFormAuthenticationFilter method loginUseCurrentCookieForGeneralPackage.

/**
     * 非 core-web 登入方式 , 給 gsbsc-web, qcharts-web 用的
     * 
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
private boolean loginUseCurrentCookieForGeneralPackage(ServletRequest request, ServletResponse response) throws Exception {
    Map<String, String> dataMap = UserCurrentCookie.getCurrentData((HttpServletRequest) request);
    if (dataMap == null) {
        return false;
    }
    String currentId = dataMap.get("currentId");
    String accountId = dataMap.get("account");
    if (StringUtils.isBlank(currentId) || StringUtils.isBlank(accountId)) {
        return false;
    }
    // 先去 tb_sys_usess 用 current_id與帳戶 去查有沒有存在 db	
    if (this.uSessLogHelper.countByCurrent(accountId, currentId) < 1) {
        // 沒有在 core-web 登入, 所以沒有 TB_SYS_USESS 的資料
        return false;
    }
    // 這理的 captcha 不須要比對了 , 因為不是 core-web 的登入畫面    	
    String captchaStr = "0123";
    request.setAttribute(this.captchaParam, captchaStr);
    ((HttpServletRequest) request).getSession().setAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY, captchaStr);
    ShiroLoginSupport loginSupport = new ShiroLoginSupport();
    AccountVO account = loginSupport.queryUserValidate(accountId);
    loginSupport.forceCreateLoginSubject((HttpServletRequest) request, (HttpServletResponse) response, accountId, captchaStr);
    // set session
    this.setUserSession((HttpServletRequest) request, (HttpServletResponse) response, account);
    return true;
}
Also used : AccountVO(com.netsteadfast.greenstep.vo.AccountVO)

Aggregations

AccountVO (com.netsteadfast.greenstep.vo.AccountVO)26 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)12 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)7 Transactional (org.springframework.transaction.annotation.Transactional)7 Subject (org.apache.shiro.subject.Subject)5 HttpServletRequest (javax.servlet.http.HttpServletRequest)4 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)3 UserRoleVO (com.netsteadfast.greenstep.vo.UserRoleVO)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 AuthenticationException (org.apache.shiro.authc.AuthenticationException)3 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)2 SysCalendarNoteVO (com.netsteadfast.greenstep.vo.SysCalendarNoteVO)2 SysMenuRoleVO (com.netsteadfast.greenstep.vo.SysMenuRoleVO)2 SysMsgNoticeConfigVO (com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO)2 SysMsgNoticeVO (com.netsteadfast.greenstep.vo.SysMsgNoticeVO)2 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)1 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)1 WebMessagePublishBaseObj (com.netsteadfast.greenstep.model.WebMessagePublishBaseObj)1 BbReportRoleView (com.netsteadfast.greenstep.po.hbm.BbReportRoleView)1