Java Code Examples for org.jeecg.modules.system.entity.SysUser#getUsername()

The following examples show how to use org.jeecg.modules.system.entity.SysUser#getUsername() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoginController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 用户信息
 *
 * @param sysUser
 * @param result
 * @return
 */
private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result) {
	String syspassword = sysUser.getPassword();
	String username = sysUser.getUsername();
	// 生成token
	String token = JwtUtil.sign(username, syspassword);
       // 设置token缓存有效时间
	redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);

	//------------------------------------------------------------------------------------------
	LoginUser vo = new LoginUser();
	BeanUtils.copyProperties(sysUser,vo);
	vo.setPassword(SecureUtil.md5(sysUser.getPassword()));
	redisUtil.set(CacheConstant.SYS_USERS_CACHE_JWT +":" +token, vo);
	//------------------------------------------------------------------------------------------
	redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);

	// 获取用户部门信息
	JSONObject obj = new JSONObject();
	List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
	obj.put("departs", departs);
	if (departs == null || departs.size() == 0) {
		obj.put("multi_depart", 0);
	} else if (departs.size() == 1) {
		sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
		obj.put("multi_depart", 1);
	} else {
		obj.put("multi_depart", 2);
	}
	obj.put("token", token);
	obj.put("userInfo", sysUser);
	obj.put("sysAllDictItems", sysDictService.queryAllDictItems());
	result.setResult(obj);
	result.success("登录成功");
	return result;
}
 
Example 2
Source File: LoginController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * 用户信息
 *
 * @param sysUser
 * @param result
 * @return
 */
private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result) {
	String syspassword = sysUser.getPassword();
	String username = sysUser.getUsername();
	// 生成token
	String token = JwtUtil.sign(username, syspassword);
       // 设置token缓存有效时间
	redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
	redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);

	// 获取用户部门信息
	JSONObject obj = new JSONObject();
	List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
	obj.put("departs", departs);
	if (departs == null || departs.size() == 0) {
		obj.put("multi_depart", 0);
	} else if (departs.size() == 1) {
		sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
		obj.put("multi_depart", 1);
	} else {
		obj.put("multi_depart", 2);
	}
	obj.put("token", token);
	obj.put("userInfo", sysUser);
	result.setResult(obj);
	result.success("登录成功");
	return result;
}
 
Example 3
Source File: LoginController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 用户信息
 *
 * @param sysUser
 * @param result
 * @return
 */
private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result) {
	String syspassword = sysUser.getPassword();
	String username = sysUser.getUsername();
	// 生成token
	String token = JwtUtil.sign(username, syspassword);
       // 设置token缓存有效时间
	redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
	redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);

	// 获取用户部门信息
	JSONObject obj = new JSONObject();
	List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
	obj.put("departs", departs);
	if (departs == null || departs.size() == 0) {
		obj.put("multi_depart", 0);
	} else if (departs.size() == 1) {
		sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
		obj.put("multi_depart", 1);
	} else {
		obj.put("multi_depart", 2);
	}
	obj.put("token", token);
	obj.put("userInfo", sysUser);
	result.setResult(obj);
	result.success("登录成功");
	return result;
}
 
Example 4
Source File: LoginController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 用户信息
 *
 * @param sysUser
 * @param result
 * @return
 */
private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result) {
	String syspassword = sysUser.getPassword();
	String username = sysUser.getUsername();
	// 生成token
	String token = JwtUtil.sign(username, syspassword);
       // 设置token缓存有效时间
	redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
	redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);

	// 获取用户部门信息
	JSONObject obj = new JSONObject();
	List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
	obj.put("departs", departs);
	if (departs == null || departs.size() == 0) {
		obj.put("multi_depart", 0);
	} else if (departs.size() == 1) {
		sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
		obj.put("multi_depart", 1);
	} else {
		obj.put("multi_depart", 2);
	}
	obj.put("token", token);
	obj.put("userInfo", sysUser);
	obj.put("sysAllDictItems", sysDictService.queryAllDictItems());
	result.setResult(obj);
	result.success("登录成功");
	return result;
}