use of com.netsteadfast.greenstep.vo.AccountVO in project bamboobsc by billchen198318.
the class ShiroLoginSupport method forceCreateLoginSubject.
public Subject forceCreateLoginSubject(HttpServletRequest request, HttpServletResponse response, String accountId, String captchaStr) throws Exception {
AccountVO account = this.queryUser(accountId);
if (account == null) {
logger.warn("no accountId: " + accountId);
throw new Exception("no accountId: " + accountId);
}
request.getSession().setAttribute(GreenStepBaseFormAuthenticationFilter.DEFAULT_CAPTCHA_PARAM, captchaStr);
GreenStepBaseUsernamePasswordToken token = new GreenStepBaseUsernamePasswordToken();
token.setCaptcha(captchaStr);
token.setUsername(account.getAccount());
token.setPassword(account.getPassword().toCharArray());
Subject subject = this.getSubject(request, response);
subject.login(token);
return subject;
}
use of com.netsteadfast.greenstep.vo.AccountVO in project bamboobsc by billchen198318.
the class ShiroLoginSupport method forceCreateLoginSubject.
public Subject forceCreateLoginSubject(String accountId) throws Exception {
AccountVO account = this.queryUser(accountId);
if (account == null) {
logger.warn("no accountId: " + accountId);
throw new Exception("no accountId: " + accountId);
}
Subject subject = SecurityUtils.getSubject();
GreenStepBaseUsernamePasswordToken token = new GreenStepBaseUsernamePasswordToken();
token.setCaptcha("0123");
token.setUsername(account.getAccount());
token.setPassword(account.getPassword().toCharArray());
subject.login(token);
return subject;
}
use of com.netsteadfast.greenstep.vo.AccountVO in project bamboobsc by billchen198318.
the class GreenStepBaseFormAuthenticationFilter method queryUser.
private AccountVO queryUser(String account) throws Exception {
if (StringUtils.isBlank(account)) {
return null;
}
AccountVO accountObj = new AccountVO();
accountObj.setAccount(account);
DefaultResult<AccountVO> result = accountService.findByUK(accountObj);
if (result.getValue() == null) {
return null;
}
accountObj = result.getValue();
return accountObj;
}
use of com.netsteadfast.greenstep.vo.AccountVO in project bamboobsc by billchen198318.
the class SystemMessageNoticeManagementAction method loadSysMsgNoticeData.
private void loadSysMsgNoticeData() throws ServiceException, Exception {
this.transformFields2ValueObject(this.sysMsgNotice, new String[] { "oid" });
DefaultResult<SysMsgNoticeVO> result = this.sysMsgNoticeService.findObjectByOid(this.sysMsgNotice);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
this.sysMsgNotice = result.getValue();
String[] dateTmp = sysMsgNotice.getDate().split(Constants.DATETIME_DELIMITER);
this.date1 = dateTmp[0].substring(0, 4) + "-" + dateTmp[0].substring(4, 6) + "-" + dateTmp[0].substring(6, 8);
this.date2 = dateTmp[1].substring(0, 4) + "-" + dateTmp[1].substring(4, 6) + "-" + dateTmp[1].substring(6, 8);
String[] time = sysMsgNotice.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);
SysMsgNoticeConfigVO config = new SysMsgNoticeConfigVO();
config.setMsgId(sysMsgNotice.getMsgId());
DefaultResult<SysMsgNoticeConfigVO> configResult = this.sysMsgNoticeConfigService.findByUK(config);
if (configResult.getValue() == null) {
throw new ServiceException(configResult.getSystemMessage().getValue());
}
config = configResult.getValue();
this.selectConfigOid = config.getOid();
AccountVO account = new AccountVO();
if (!"*".equals(sysMsgNotice.getToAccount())) {
account.setAccount(sysMsgNotice.getToAccount());
DefaultResult<AccountVO> aResult = this.accountService.findByUK(account);
if (aResult.getValue() == null) {
throw new ServiceException(aResult.getSystemMessage().getValue());
}
account = aResult.getValue();
this.selectAccountOid = account.getOid();
}
}
use of com.netsteadfast.greenstep.vo.AccountVO in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method create.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<EmployeeVO> create(EmployeeVO employee, List<String> organizationOid) throws ServiceException, Exception {
if (employee == null || super.isBlank(employee.getEmpId())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
Map<String, Object> params = new HashMap<String, Object>();
params.put("empId", employee.getEmpId());
if (this.getEmployeeService().countByParams(params) > 0) {
throw new ServiceException("Please change another Id!");
}
AccountVO account = this.tranAccount(employee);
if (this.isAdministrator(account.getAccount())) {
throw new ServiceException("Please change another Account!");
}
DefaultResult<AccountVO> mResult = this.getAccountService().saveObject(account);
if (mResult.getValue() == null) {
throw new ServiceException(mResult.getSystemMessage().getValue());
}
DefaultResult<EmployeeVO> result = this.getEmployeeService().saveObject(employee);
employee = result.getValue();
this.createEmployeeOrganization(employee, organizationOid);
// create default role
UserRoleVO userRole = new UserRoleVO();
userRole.setAccount(employee.getAccount());
userRole.setRole(this.roleLogicService.getDefaultUserRole());
userRole.setDescription(employee.getAccount() + " `s role!");
this.getUserRoleService().saveObject(userRole);
this.createHierarchy(employee, BscConstants.EMPLOYEE_HIER_ZERO_OID);
return result;
}
Aggregations