Search in sources :

Example 6 with AccountVO

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

the class ShiroLoginSupport method queryUser.

public AccountVO queryUser(String account) throws Exception {
    if (StringUtils.isBlank(account)) {
        return null;
    }
    if (accountService == null) {
        logger.error("no service bean: core.service.AccountService");
        throw new Exception("no service bean: core.service.AccountService");
    }
    AccountVO accountObj = new AccountVO();
    accountObj.setAccount(account);
    DefaultResult<AccountVO> result = accountService.findByUK(accountObj);
    if (result.getValue() == null) {
        return null;
    }
    accountObj = result.getValue();
    return accountObj;
}
Also used : AccountVO(com.netsteadfast.greenstep.vo.AccountVO)

Example 7 with AccountVO

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

the class SystemMessageNoticeLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysMsgNoticeVO> update(SysMsgNoticeVO notice, String accountOid) throws ServiceException, Exception {
    if (notice == null || super.isBlank(notice.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<SysMsgNoticeVO> oldResult = this.sysMsgNoticeService.findObjectByOid(notice);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    notice.setNoticeId(oldResult.getValue().getNoticeId());
    notice.setMsgId(oldResult.getValue().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.updateObject(notice);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) SysMsgNoticeVO(com.netsteadfast.greenstep.vo.SysMsgNoticeVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with AccountVO

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

the class SystemCalendarNoteManagementAction method loadSysCalendarNoteData.

/**
	 * 載入編輯mode需要的資料
	 * 
	 * @throws ServiceException
	 * @throws Exception
	 */
private void loadSysCalendarNoteData() throws ServiceException, Exception {
    this.transformFields2ValueObject(this.sysCalendarNote, new String[] { "oid" });
    DefaultResult<SysCalendarNoteVO> result = this.sysCalendarNoteService.findObjectByOid(sysCalendarNote);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    this.sysCalendarNote = result.getValue();
    AccountVO account = new AccountVO();
    account.setAccount(sysCalendarNote.getAccount());
    DefaultResult<AccountVO> aResult = this.accountService.findByUK(account);
    if (aResult.getValue() == null) {
        throw new ServiceException(aResult.getSystemMessage().getValue());
    }
    account = aResult.getValue();
    this.accountOid = account.getOid();
    this.calendarNoteDate = sysCalendarNote.getDate().substring(0, 4) + "-" + sysCalendarNote.getDate().substring(4, 6) + "-" + sysCalendarNote.getDate().substring(6, 8);
    String[] time = this.sysCalendarNote.getTime().split(Constants.DATETIME_DELIMITER);
    this.startHour = time[0].substring(0, 2);
    this.startMinutes = time[0].substring(2, 4);
    this.endHour = time[1].substring(0, 2);
    this.endMinutes = time[1].substring(2, 4);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysCalendarNoteVO(com.netsteadfast.greenstep.vo.SysCalendarNoteVO) AccountVO(com.netsteadfast.greenstep.vo.AccountVO)

Example 9 with AccountVO

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

the class EmployeeLogicServiceImpl method updatePassword.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<AccountVO> updatePassword(EmployeeVO employee, String newPassword) throws ServiceException, Exception {
    if (employee == null || super.isBlank(employee.getOid()) || super.isBlank(employee.getPassword()) || super.isBlank(newPassword)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    EmployeeVO dbEmployee = this.findEmployeeData(employee.getOid());
    AccountVO account = this.findAccountData(dbEmployee.getAccount());
    if (!account.getPassword().equals(this.getAccountService().tranPassword(employee.getPassword()))) {
        throw new ServiceException("The current password(old password) is incorrect!");
    }
    account.setPassword(this.getAccountService().tranPassword(newPassword));
    return getAccountService().updateObject(account);
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 10 with AccountVO

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

the class EmployeeLogicServiceImpl method tranAccount.

private AccountVO tranAccount(EmployeeVO employee) throws Exception {
    AccountVO account = new AccountVO();
    account.setAccount(employee.getAccount());
    account.setOnJob(YesNo.YES);
    account.setPassword(this.getAccountService().tranPassword(employee.getPassword()));
    return account;
}
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