main
parent
5829e925ef
commit
e9b9b61016
|
|
@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.mdd.common.aop.NotPower;
|
||||
import com.mdd.common.aop.NotLogin;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.common.entity.AppUser;
|
||||
import com.mdd.common.entity.system.SystemAuthAdmin;
|
||||
import com.mdd.common.enums.ErrorEnum;
|
||||
import com.mdd.common.exception.LoginException;
|
||||
import com.mdd.common.mapper.AppUserMapper;
|
||||
import com.mdd.common.mapper.system.SystemAuthAdminMapper;
|
||||
import com.mdd.common.util.StringUtils;
|
||||
import com.mdd.common.util.YmlUtils;
|
||||
|
|
@ -33,6 +35,9 @@ public class LikeAdminInterceptor implements HandlerInterceptor {
|
|||
@Resource
|
||||
SystemAuthAdminMapper systemAuthAdminMapper;
|
||||
|
||||
@Resource
|
||||
AppUserMapper appUserMapper;
|
||||
|
||||
/**
|
||||
* 前置处理器
|
||||
*
|
||||
|
|
@ -139,8 +144,8 @@ public class LikeAdminInterceptor implements HandlerInterceptor {
|
|||
// 令牌校验
|
||||
String token = StpUtil.getTokenValue();
|
||||
if (StringUtils.isNull(token) || StringUtils.isBlank(token)) {
|
||||
Integer errCode = ErrorEnum.TOKEN_EMPTY.getCode();
|
||||
String errMsg = ErrorEnum.TOKEN_EMPTY.getMsg();
|
||||
Integer errCode = ErrorEnum.TOKEN_INVALID.getCode();
|
||||
String errMsg = ErrorEnum.TOKEN_INVALID.getMsg();
|
||||
throw new LoginException(errCode, errMsg);
|
||||
}
|
||||
|
||||
|
|
@ -160,30 +165,38 @@ public class LikeAdminInterceptor implements HandlerInterceptor {
|
|||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
AppUser appUser = appUserMapper.selectOne(
|
||||
new QueryWrapper<AppUser>()
|
||||
.select("id,username")
|
||||
.eq("id", Integer.parseInt(id.toString()))
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
// 删除校验
|
||||
if (StringUtils.isNull(adminUser)) {
|
||||
if (StringUtils.isNull(adminUser) && StringUtils.isNull(appUser)) {
|
||||
Integer errCode = ErrorEnum.TOKEN_INVALID.getCode();
|
||||
String errMsg = ErrorEnum.TOKEN_INVALID.getMsg();
|
||||
throw new LoginException(errCode, errMsg);
|
||||
}
|
||||
|
||||
// 禁用校验
|
||||
if (adminUser.getIsDisable().equals(1)) {
|
||||
Integer errCode = ErrorEnum.LOGIN_DISABLE_ERROR.getCode();
|
||||
String errMsg = ErrorEnum.LOGIN_DISABLE_ERROR.getMsg();
|
||||
throw new LoginException(errCode, errMsg);
|
||||
}
|
||||
if (StringUtils.isNotNull(adminUser)) {
|
||||
// 禁用校验
|
||||
if (adminUser.getIsDisable().equals(1)) {
|
||||
Integer errCode = ErrorEnum.LOGIN_DISABLE_ERROR.getCode();
|
||||
String errMsg = ErrorEnum.LOGIN_DISABLE_ERROR.getMsg();
|
||||
throw new LoginException(errCode, errMsg);
|
||||
}
|
||||
|
||||
// 写入线程
|
||||
LikeAdminThreadLocal.put("adminId", id);
|
||||
LikeAdminThreadLocal.put("username", adminUser.getUsername());
|
||||
LikeAdminThreadLocal.put("roleIds", adminUser.getRoleIds());
|
||||
LikeAdminThreadLocal.put("deptIds", adminUser.getDeptIds());
|
||||
LikeAdminThreadLocal.put("postIds", adminUser.getPostIds());
|
||||
// 写入线程
|
||||
LikeAdminThreadLocal.put("adminId", id);
|
||||
LikeAdminThreadLocal.put("username", adminUser.getUsername());
|
||||
LikeAdminThreadLocal.put("roleIds", adminUser.getRoleIds());
|
||||
LikeAdminThreadLocal.put("deptIds", adminUser.getDeptIds());
|
||||
LikeAdminThreadLocal.put("postIds", adminUser.getPostIds());
|
||||
|
||||
// 权限校验
|
||||
if (!adminUser.getId().equals(1)) {
|
||||
this.checkAuth(method, reqUri);
|
||||
// 权限校验
|
||||
if (!adminUser.getId().equals(1)) {
|
||||
this.checkAuth(method, reqUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.mdd.admin.config;
|
||||
|
||||
import com.mdd.admin.utils.SmsUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @description: 短信配置
|
||||
* @author: hwlin
|
||||
*/
|
||||
@Configuration
|
||||
public class SmsConfig {
|
||||
@Value("${config.aliyun.sms.defaultConnectTimeout}")
|
||||
private String defaultConnectTimeout;
|
||||
|
||||
@Value("${config.aliyun.sms.defaultReadTimeout}")
|
||||
private String defaultReadTimeout;
|
||||
|
||||
@Value("${config.aliyun.sms.accessKeyId}")
|
||||
private String accessKeyId;
|
||||
|
||||
@Value("${config.aliyun.sms.accessKeySecret}")
|
||||
private String accessKeySecret;
|
||||
|
||||
@Value("${config.aliyun.sms.signName}")
|
||||
private String signName;
|
||||
|
||||
@Bean
|
||||
public SmsUtil smsUtil() {
|
||||
return new SmsUtil(defaultConnectTimeout, defaultReadTimeout, accessKeyId, accessKeySecret,signName);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.mdd.admin.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.mdd.admin.service.ILoginService;
|
||||
import com.mdd.admin.validate.CodeArg;
|
||||
import com.mdd.admin.validate.commons.IdValidate;
|
||||
import com.mdd.admin.validate.login.LoginPhoneValidate;
|
||||
import com.mdd.admin.validate.login.RegisterValidate;
|
||||
import com.mdd.admin.vo.LoginTokenVo;
|
||||
import com.mdd.common.aop.NotLogin;
|
||||
import com.mdd.common.aop.NotPower;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/appLogin")
|
||||
@Api(tags = "app登录")
|
||||
public class AppLoginController {
|
||||
|
||||
@Resource
|
||||
ILoginService iLoginService;
|
||||
|
||||
@NotLogin
|
||||
@PostMapping("/register")
|
||||
@ApiOperation(value="注册账号")
|
||||
public AjaxResult<Object> register(@Validated @RequestBody RegisterValidate registerValidate) {
|
||||
iLoginService.register(registerValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@NotLogin
|
||||
@PostMapping("/mobileLogin")
|
||||
@ApiOperation(value="手机登录")
|
||||
public AjaxResult<LoginTokenVo> mobileLogin(@Validated @RequestBody LoginPhoneValidate loginPhoneValidate) {
|
||||
String mobile = loginPhoneValidate.getMobile();
|
||||
String code = loginPhoneValidate.getCode();
|
||||
LoginTokenVo vo = iLoginService.mobileLogin(mobile, code);
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@ApiOperation("获取验证码")
|
||||
@PostMapping("/code")
|
||||
public AjaxResult<String> code(@RequestBody CodeArg arg){
|
||||
return iLoginService.code(arg.getMobile());
|
||||
}
|
||||
|
||||
@NotPower
|
||||
@PostMapping("/logout")
|
||||
@ApiOperation(value="退出登录")
|
||||
public AjaxResult<Object> logout(HttpServletRequest request) {
|
||||
StpUtil.logout();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/* @NotLogin
|
||||
@PostMapping("/mnpLogin")
|
||||
@ApiOperation(value="微信登录")
|
||||
public AjaxResult<LoginTokenVo> mnpLogin(@Validated @RequestBody LoginCodeValidate loginCodeValidate) {
|
||||
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
||||
String code = loginCodeValidate.getCode();
|
||||
|
||||
LoginTokenVo vo = iLoginService.mnpLogin(code, terminal);
|
||||
return AjaxResult.success(vo);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.mdd.admin.controller;
|
||||
|
||||
import com.mdd.admin.aop.Log;
|
||||
import com.mdd.admin.service.IAppUserService;
|
||||
import com.mdd.admin.validate.commons.IdValidate;
|
||||
import com.mdd.admin.validate.AppUserCreateValidate;
|
||||
import com.mdd.admin.validate.AppUserUpdateValidate;
|
||||
import com.mdd.admin.validate.AppUserSearchValidate;
|
||||
import com.mdd.admin.validate.commons.PageValidate;
|
||||
import com.mdd.admin.vo.AppUserListedVo;
|
||||
import com.mdd.admin.vo.AppUserDetailVo;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.validator.annotation.IDMust;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/appUser")
|
||||
@Api(tags = "用户信息管理")
|
||||
public class AppUserController {
|
||||
|
||||
@Resource
|
||||
IAppUserService iAppUserService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value="用户信息列表")
|
||||
public AjaxResult<PageResult<AppUserListedVo>> list(@Validated PageValidate pageValidate,
|
||||
@Validated AppUserSearchValidate searchValidate) {
|
||||
PageResult<AppUserListedVo> list = iAppUserService.list(pageValidate, searchValidate);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperation(value="用户信息详情")
|
||||
public AjaxResult<AppUserDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
AppUserDetailVo detail = iAppUserService.detail(id);
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
||||
@Log(title = "用户信息新增")
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value="用户信息新增")
|
||||
public AjaxResult<Object> add(@Validated @RequestBody AppUserCreateValidate createValidate) {
|
||||
iAppUserService.add(createValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "用户信息编辑")
|
||||
@PostMapping("/edit")
|
||||
@ApiOperation(value="用户信息编辑")
|
||||
public AjaxResult<Object> edit(@Validated @RequestBody AppUserUpdateValidate updateValidate) {
|
||||
iAppUserService.edit(updateValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "用户信息删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperation(value="用户信息删除")
|
||||
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
|
||||
iAppUserService.del(idValidate.getId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.mdd.admin.service;
|
||||
|
||||
import com.mdd.admin.validate.commons.PageValidate;
|
||||
import com.mdd.admin.validate.AppUserCreateValidate;
|
||||
import com.mdd.admin.validate.AppUserUpdateValidate;
|
||||
import com.mdd.admin.validate.AppUserSearchValidate;
|
||||
import com.mdd.admin.vo.AppUserListedVo;
|
||||
import com.mdd.admin.vo.AppUserDetailVo;
|
||||
import com.mdd.common.core.PageResult;
|
||||
|
||||
/**
|
||||
* 用户信息服务接口类
|
||||
* @author LikeAdmin
|
||||
*/
|
||||
public interface IAppUserService {
|
||||
|
||||
/**
|
||||
* 用户信息列表
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<AppUserListedVo>
|
||||
*/
|
||||
PageResult<AppUserListedVo> list(PageValidate pageValidate, AppUserSearchValidate searchValidate);
|
||||
|
||||
/**
|
||||
* 用户信息详情
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param id 主键ID
|
||||
* @return AppUserDetailVo
|
||||
*/
|
||||
AppUserDetailVo detail(Integer id);
|
||||
|
||||
/**
|
||||
* 用户信息新增
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
void add(AppUserCreateValidate createValidate);
|
||||
|
||||
/**
|
||||
* 用户信息编辑
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
void edit(AppUserUpdateValidate updateValidate);
|
||||
|
||||
/**
|
||||
* 用户信息删除
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param id 主键ID
|
||||
*/
|
||||
void del(Integer id);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.mdd.admin.service;
|
||||
|
||||
|
||||
import com.mdd.admin.validate.login.RegisterValidate;
|
||||
import com.mdd.admin.vo.LoginTokenVo;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* 登录服务接口类
|
||||
*/
|
||||
public interface ILoginService {
|
||||
|
||||
/**
|
||||
* 账号注册
|
||||
*
|
||||
* @author fzr
|
||||
*/
|
||||
void register(RegisterValidate registerValidate);
|
||||
|
||||
/**
|
||||
* 手机登录
|
||||
*
|
||||
* @author fzr
|
||||
* @param mobile 手机号
|
||||
* @param code 验证码
|
||||
* @return LoginTokenVo
|
||||
*/
|
||||
LoginTokenVo mobileLogin(String mobile, String code);
|
||||
|
||||
AjaxResult<String> code(String mobile);
|
||||
|
||||
/**
|
||||
* 微信登录
|
||||
*
|
||||
* @author fzr
|
||||
* @param code 微信code
|
||||
* @param terminal 终端
|
||||
* @return LoginTokenVo
|
||||
*/
|
||||
// LoginTokenVo mnpLogin(String code, Integer terminal);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
package com.mdd.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mdd.admin.validate.commons.PageValidate;
|
||||
import com.mdd.admin.service.IAppUserService;
|
||||
import com.mdd.admin.validate.AppUserCreateValidate;
|
||||
import com.mdd.admin.validate.AppUserUpdateValidate;
|
||||
import com.mdd.admin.validate.AppUserSearchValidate;
|
||||
import com.mdd.admin.vo.AppUserListedVo;
|
||||
import com.mdd.admin.vo.AppUserDetailVo;
|
||||
import com.mdd.common.config.GlobalConfig;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.entity.AppUser;
|
||||
import com.mdd.common.mapper.AppUserMapper;
|
||||
import com.mdd.common.util.ListUtils;
|
||||
import com.mdd.common.util.TimeUtils;
|
||||
import com.mdd.common.util.UrlUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户信息实现类
|
||||
* @author LikeAdmin
|
||||
*/
|
||||
@Service
|
||||
public class AppUserServiceImpl implements IAppUserService {
|
||||
|
||||
@Resource
|
||||
AppUserMapper appUserMapper;
|
||||
|
||||
/**
|
||||
* 用户信息列表
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<AppUserListedVo>
|
||||
*/
|
||||
@Override
|
||||
public PageResult<AppUserListedVo> list(PageValidate pageValidate, AppUserSearchValidate searchValidate) {
|
||||
Integer page = pageValidate.getPageNo();
|
||||
Integer limit = pageValidate.getPageSize();
|
||||
|
||||
QueryWrapper<AppUser> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_delete", 0);
|
||||
queryWrapper.orderByDesc("id");
|
||||
|
||||
appUserMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
||||
"=:sn:int",
|
||||
"=:avatar:str",
|
||||
"like:nickname:str",
|
||||
"like:username:str",
|
||||
"like:mobile:str",
|
||||
"=:sex:int",
|
||||
"=:address:str",
|
||||
});
|
||||
|
||||
IPage<AppUser> iPage = appUserMapper.selectPage(new Page<>(page, limit), queryWrapper);
|
||||
|
||||
List<AppUserListedVo> list = new LinkedList<>();
|
||||
for(AppUser item : iPage.getRecords()) {
|
||||
AppUserListedVo vo = new AppUserListedVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
vo.setAvatar(UrlUtils.toAbsoluteUrl(item.getAvatar()));
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime()));
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息详情
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param id 主键参数
|
||||
* @return AppUser
|
||||
*/
|
||||
@Override
|
||||
public AppUserDetailVo detail(Integer id) {
|
||||
AppUser model = appUserMapper.selectOne(
|
||||
new QueryWrapper<AppUser>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在");
|
||||
|
||||
AppUserDetailVo vo = new AppUserDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
vo.setAvatar(UrlUtils.toAbsoluteUrl(model.getAvatar()));
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息新增
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void add(AppUserCreateValidate createValidate) {
|
||||
AppUser model = new AppUser();
|
||||
model.setSn(createValidate.getSn());
|
||||
model.setAvatar(UrlUtils.toRelativeUrl(createValidate.getAvatar()));
|
||||
model.setNickname(createValidate.getNickname());
|
||||
model.setUsername(createValidate.getUsername());
|
||||
model.setMobile(createValidate.getMobile());
|
||||
model.setSex(createValidate.getSex());
|
||||
model.setAddress(createValidate.getAddress());
|
||||
model.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
appUserMapper.insert(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息编辑
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void edit(AppUserUpdateValidate updateValidate) {
|
||||
AppUser model = appUserMapper.selectOne(
|
||||
new QueryWrapper<AppUser>()
|
||||
.eq("id", updateValidate.getId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setId(updateValidate.getId());
|
||||
model.setSn(updateValidate.getSn());
|
||||
model.setAvatar(UrlUtils.toRelativeUrl(updateValidate.getAvatar()));
|
||||
model.setNickname(updateValidate.getNickname());
|
||||
model.setUsername(updateValidate.getUsername());
|
||||
model.setMobile(updateValidate.getMobile());
|
||||
model.setSex(updateValidate.getSex());
|
||||
model.setAddress(updateValidate.getAddress());
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
appUserMapper.updateById(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息删除
|
||||
*
|
||||
* @author LikeAdmin
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
public void del(Integer id) {
|
||||
AppUser model = appUserMapper.selectOne(
|
||||
new QueryWrapper<AppUser>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setIsDelete(1);
|
||||
model.setDeleteTime(System.currentTimeMillis() / 1000);
|
||||
appUserMapper.updateById(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
package com.mdd.admin.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.mdd.admin.service.ILoginService;
|
||||
import com.mdd.admin.utils.SmsUtil;
|
||||
import com.mdd.admin.validate.login.RegisterValidate;
|
||||
import com.mdd.admin.vo.LoginTokenVo;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.common.entity.AppUser;
|
||||
import com.mdd.common.exception.OperateException;
|
||||
import com.mdd.common.mapper.AppUserMapper;
|
||||
import com.mdd.common.util.RedisUtils;
|
||||
import com.mdd.common.util.ToolUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 登录服务实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LoginServiceImpl implements ILoginService {
|
||||
|
||||
@Resource
|
||||
AppUserMapper appUserMapper;
|
||||
|
||||
Integer terminal = 88;
|
||||
|
||||
@Resource
|
||||
private SmsUtil smsUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 注册账号
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void register(RegisterValidate entity) {
|
||||
AppUser model = appUserMapper.selectOne(new QueryWrapper<AppUser>()
|
||||
.select("id,sn,username")
|
||||
.eq("mobile", entity.getMobile())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.isNull(model, "手机号已存在,换一个吧!");
|
||||
|
||||
String sn = this.__generateSn();
|
||||
|
||||
AppUser user = new AppUser();
|
||||
BeanUtils.copyProperties(entity,user);
|
||||
user.setSn(sn);
|
||||
user.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
user.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
appUserMapper.insert(user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 手机号登录
|
||||
*
|
||||
* @author fzr
|
||||
* @param mobile 手机号
|
||||
* @param code 验证码
|
||||
* @return LoginTokenVo
|
||||
*/
|
||||
@Override
|
||||
public LoginTokenVo mobileLogin(String mobile, String code) {
|
||||
// 校验验证码
|
||||
Object sceneCode = RedisUtils.get("app_code_" + mobile);
|
||||
if (sceneCode == null || !sceneCode.equals(code)) {
|
||||
throw new OperateException("验证码错误!");
|
||||
}
|
||||
|
||||
// 查询手机号
|
||||
AppUser user = appUserMapper.selectOne(new QueryWrapper<AppUser>()
|
||||
.select("id,username,mobile")
|
||||
.eq("mobile", mobile)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(user, "账号不存在!");
|
||||
|
||||
return this.__loginToken(user.getId(), user.getMobile());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult code(String mobile) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
stringBuilder.append(random.nextInt(10));
|
||||
}
|
||||
//五分钟
|
||||
RedisUtils.set("app_code_" + mobile, stringBuilder.toString(), 60*5);
|
||||
|
||||
// 发送短信验证码:效验是否登录还是修改密码
|
||||
try {
|
||||
SendSmsResponse sendSmsResponse = smsUtil.sendSms(mobile, stringBuilder.toString());
|
||||
System.out.println("发送短信返回值:" + JSON.toJSONString(sendSmsResponse));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.success(stringBuilder.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成用户编号
|
||||
*
|
||||
* @author fzr
|
||||
* @return Integer
|
||||
*/
|
||||
private String __generateSn() {
|
||||
Integer sn;
|
||||
String no = "jxp_";
|
||||
while (true) {
|
||||
sn = Integer.parseInt(ToolUtils.randomInt(6));
|
||||
no = no + sn;
|
||||
AppUser snModel = appUserMapper.selectOne(new QueryWrapper<AppUser>()
|
||||
.select("id,sn")
|
||||
.eq("sn", no)
|
||||
.last("limit 1"));
|
||||
if (snModel == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return no;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理录令牌
|
||||
*
|
||||
* @author fzr
|
||||
* @param userId 用户ID
|
||||
* @param mobile 用户手机
|
||||
* @return LoginTokenVo
|
||||
*/
|
||||
private LoginTokenVo __loginToken(Integer userId, String mobile) {
|
||||
// 实现账号登录
|
||||
StpUtil.login(userId, String.valueOf(terminal));
|
||||
|
||||
// 返回登录信息
|
||||
LoginTokenVo vo = new LoginTokenVo();
|
||||
vo.setId(userId);
|
||||
vo.setMobile(mobile);
|
||||
vo.setToken(StpUtil.getTokenValue());
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package com.mdd.admin.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.aliyuncs.DefaultAcsClient;
|
||||
import com.aliyuncs.IAcsClient;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
import com.aliyuncs.profile.IClientProfile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 发送短信工具类
|
||||
* @author hwlin
|
||||
* @version 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
public class SmsUtil {
|
||||
@Value("${config.aliyun.sms.smsCode}")
|
||||
private String smsCode;
|
||||
|
||||
//产品名称:云通信短信API产品,固定值
|
||||
private static final String product = "Dysmsapi";
|
||||
//产品域名,开发者无需替换,固定值
|
||||
private static final String domain = "dysmsapi.aliyuncs.com";
|
||||
|
||||
private String defaultConnectTimeout;
|
||||
|
||||
private String defaultReadTimeout;
|
||||
|
||||
private String accessKeyId;
|
||||
|
||||
private String accessKeySecret;
|
||||
|
||||
private String signName;
|
||||
|
||||
public SmsUtil(String defaultConnectTimeout, String defaultReadTimeout, String accessKeyId, String accessKeySecret, String signName){
|
||||
this.defaultConnectTimeout = defaultConnectTimeout;
|
||||
this.defaultReadTimeout = defaultReadTimeout;
|
||||
this.accessKeyId = accessKeyId;
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
this.signName = signName;
|
||||
}
|
||||
/**
|
||||
* 发送短信的方法
|
||||
* @param phone 接收短信的手机号
|
||||
* @param smsCode 模板中的变量替换JSON串,例如验证码
|
||||
*/
|
||||
public SendSmsResponse sendSms(String phone, String code) throws ClientException {
|
||||
//可自助调整超时时间
|
||||
System.setProperty("sun.net.client.defaultConnectTimeout", defaultConnectTimeout);
|
||||
System.setProperty("sun.net.client.defaultReadTimeout", defaultReadTimeout);
|
||||
//初始化acsClient,暂不支持region化
|
||||
IClientProfile profile = DefaultProfile.getProfile("cn-shanghai", accessKeyId, accessKeySecret);
|
||||
DefaultProfile.addEndpoint("cn-shanghai", "cn-shanghai", product, domain);
|
||||
IAcsClient acsClient = new DefaultAcsClient(profile);
|
||||
|
||||
//组装请求对象-具体描述见控制台-文档部分内容
|
||||
SendSmsRequest request = new SendSmsRequest();
|
||||
//必填:待发送手机号
|
||||
request.setPhoneNumbers(phone);
|
||||
//必填:短信签名-可在短信控制台中找到
|
||||
request.setSignName(signName);
|
||||
//短信模板-可在短信控制台中找到
|
||||
request.setTemplateCode(smsCode);
|
||||
|
||||
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
||||
// smsCOde为随机验证码
|
||||
request.setTemplateParam("{\"code\":\"" + code + "\"}");
|
||||
|
||||
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
|
||||
//request.setSmsUpExtendCode("90997");
|
||||
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
|
||||
// request.setOutId("yourOutId");
|
||||
//hint 此处可能会抛出异常,注意catch
|
||||
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
|
||||
log.info("发送短信状态:{}", sendSmsResponse.getCode());
|
||||
log.info("发送短信消息:{}", sendSmsResponse.getMessage());
|
||||
return sendSmsResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param phone 接收短信的手机号
|
||||
* @param type 模板编号
|
||||
* @param map 模板中变量map
|
||||
*/
|
||||
public SendSmsResponse sendSms(String phone, String type, Map<String,Object> map) throws ClientException {
|
||||
//可自助调整超时时间
|
||||
System.setProperty("sun.net.client.defaultConnectTimeout", defaultConnectTimeout);
|
||||
System.setProperty("sun.net.client.defaultReadTimeout", defaultReadTimeout);
|
||||
//初始化acsClient,暂不支持region化
|
||||
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
|
||||
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
|
||||
IAcsClient acsClient = new DefaultAcsClient(profile);
|
||||
|
||||
//组装请求对象-具体描述见控制台-文档部分内容
|
||||
SendSmsRequest request = new SendSmsRequest();
|
||||
//必填:待发送手机号
|
||||
request.setPhoneNumbers(phone);
|
||||
//必填:短信签名-可在短信控制台中找到s
|
||||
request.setSignName(signName);
|
||||
//必填:短信模板-可在短信控制台中找到
|
||||
request.setTemplateCode(type);
|
||||
|
||||
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
||||
// smsCOde为随机验证码
|
||||
request.setTemplateParam(JSON.toJSONString(map));
|
||||
|
||||
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
|
||||
//request.setSmsUpExtendCode("90997");
|
||||
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
|
||||
// request.setOutId("yourOutId");
|
||||
//hint 此处可能会抛出异常,注意catch
|
||||
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
|
||||
log.info("发送短信状态:{}", sendSmsResponse.getCode());
|
||||
log.info("发送短信消息:{}", sendSmsResponse.getMessage());
|
||||
return sendSmsResponse;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.mdd.admin.validate;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Data
|
||||
@ApiModel("用户信息创建参数")
|
||||
public class AppUserCreateValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "sn参数缺失")
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String sn;
|
||||
|
||||
@NotNull(message = "avatar参数缺失")
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@NotNull(message = "nickname参数缺失")
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@NotNull(message = "username参数缺失")
|
||||
@ApiModelProperty(value = "用户账号")
|
||||
private String username;
|
||||
|
||||
@NotNull(message = "mobile参数缺失")
|
||||
@ApiModelProperty(value = "用户电话")
|
||||
private String mobile;
|
||||
|
||||
@NotNull(message = "sex参数缺失")
|
||||
@ApiModelProperty(value = "用户性别: [1=男, 2=女]")
|
||||
private Integer sex;
|
||||
|
||||
@NotNull(message = "address参数缺失")
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.mdd.admin.validate;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("用户信息搜素参数")
|
||||
public class AppUserSearchValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String sn;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "用户账号")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "用户电话")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "用户性别: [1=男, 2=女]")
|
||||
private Integer sex;
|
||||
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.mdd.admin.validate;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
import com.mdd.common.validator.annotation.IDMust;
|
||||
|
||||
/**
|
||||
* 用户信息参数
|
||||
* @author LikeAdmin
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("用户信息更新参数")
|
||||
public class AppUserUpdateValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@IDMust(message = "id参数必传且需大于0")
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@NotNull(message = "sn参数缺失")
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String sn;
|
||||
|
||||
@NotNull(message = "avatar参数缺失")
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@NotNull(message = "nickname参数缺失")
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@NotNull(message = "username参数缺失")
|
||||
@ApiModelProperty(value = "用户账号")
|
||||
private String username;
|
||||
|
||||
@NotNull(message = "mobile参数缺失")
|
||||
@ApiModelProperty(value = "用户电话")
|
||||
private String mobile;
|
||||
|
||||
@NotNull(message = "sex参数缺失")
|
||||
@ApiModelProperty(value = "用户性别: [1=男, 2=女]")
|
||||
private Integer sex;
|
||||
|
||||
@NotNull(message = "address参数缺失")
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.mdd.admin.validate;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author byw
|
||||
* @Date 2020-04-08 15:52:21
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "CodeArg")
|
||||
public class CodeArg {
|
||||
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String mobile;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.mdd.admin.validate.login;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@ApiModel("微信登录参数")
|
||||
public class LoginCodeValidate {
|
||||
|
||||
@NotNull(message = "code参数缺失")
|
||||
@ApiModelProperty(value = "微信code", required = true)
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.mdd.admin.validate.login;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
@Data
|
||||
@ApiModel("手机号登录参数")
|
||||
public class LoginPhoneValidate {
|
||||
|
||||
@NotNull(message = "mobile参数缺失")
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
@Length(min = 11, max = 11, message = "手机号只能为11位")
|
||||
@Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误")
|
||||
@ApiModelProperty(value = "手机号", required = true)
|
||||
private String mobile;
|
||||
|
||||
@NotNull(message = "code参数缺失")
|
||||
@NotEmpty(message = "code不能为空")
|
||||
@Length(min = 4, max = 6, message = "验证码长度不符合")
|
||||
@ApiModelProperty(value = "验证码", required = true)
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.mdd.admin.validate.login;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@ApiModel("账号登录参数")
|
||||
public class LoginPwdValidate {
|
||||
|
||||
@NotNull(message = "username参数缺失")
|
||||
@NotEmpty(message = "账号不能为空")
|
||||
@ApiModelProperty(value = "登录账号", required = true)
|
||||
private String username;
|
||||
|
||||
@NotNull(message = "password参数缺失")
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
@ApiModelProperty(value = "登录密码", required = true)
|
||||
private String password;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.mdd.admin.validate.login;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("扫码登录验证")
|
||||
public class LoginScanValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "code参数缺失")
|
||||
@NotEmpty(message = "code不能为空")
|
||||
@ApiModelProperty(value = "微信code", required = true)
|
||||
private String code;
|
||||
|
||||
@NotNull(message = "二维码已失效或不存在,请重新操作")
|
||||
@NotEmpty(message = "二维码已失效或不存在,请重新操作")
|
||||
@ApiModelProperty(value = "state码", required = true)
|
||||
private String state;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.mdd.admin.validate.login;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("注册账号参数")
|
||||
public class RegisterValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
@ApiModelProperty(value = "用户名", required = true)
|
||||
private String username;
|
||||
|
||||
@NotBlank(message = "头像不能为空")
|
||||
@ApiModelProperty(value = "头像", required = true)
|
||||
private String avatar;
|
||||
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@ApiModelProperty(value = "手机号", required = true)
|
||||
private String mobile;
|
||||
|
||||
@NotNull(message = "性别不能为空")
|
||||
@ApiModelProperty(value = "性别1男2女", required = true)
|
||||
private Integer sex;
|
||||
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.mdd.admin.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("用户信息详情Vo")
|
||||
public class AppUserDetailVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String sn;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "用户账号")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "用户电话")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "用户性别: [1=男, 2=女]")
|
||||
private Integer sex;
|
||||
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.mdd.admin.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("用户信息列表Vo")
|
||||
public class AppUserListedVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String sn;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "用户账号")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "用户电话")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "用户性别: [1=男, 2=女]")
|
||||
private Integer sex;
|
||||
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.mdd.admin.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "系统登录Vo")
|
||||
public class LoginTokenVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "登录令牌")
|
||||
private String token;
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ public class UserVo implements Serializable {
|
|||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户编码")
|
||||
private Integer sn;
|
||||
private String sn;
|
||||
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
private String avatar;
|
||||
|
|
|
|||
|
|
@ -87,4 +87,18 @@ sa-token:
|
|||
is-share: false # 多人同登账号共用token
|
||||
token-style: random-64 # token生成的风格
|
||||
is-print: false # 打印版本字符画
|
||||
is-log: false # 是否输出操作日志
|
||||
is-log: false # 是否输出操作日志
|
||||
|
||||
config:
|
||||
#短信短信配置
|
||||
aliyun:
|
||||
sms:
|
||||
#ID和Secret是通用的,在控制台可以查看到
|
||||
accessKeyId: LTAI5tM1LeE2pkiS3qEFQkfb
|
||||
accessKeySecret: fEZZyFvWkETS8Clm73f7qmY9ohcTpc
|
||||
#短信签名-可在短信控制台中找到
|
||||
signName: 丙煜
|
||||
#配置超时时间
|
||||
defaultConnectTimeout: 10000
|
||||
defaultReadTimeout: 10000
|
||||
smsCode: SMS_465690552
|
||||
|
|
@ -173,6 +173,11 @@
|
|||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- EasyExcel -->
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package com.mdd.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("用户信息实体")
|
||||
public class AppUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String sn;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "用户账号")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "用户电话")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "用户性别: [1=男, 2=女]")
|
||||
private Integer sex;
|
||||
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "是否删除: [0=否, 1=是]")
|
||||
private Integer isDelete;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Long updateTime;
|
||||
|
||||
@ApiModelProperty(value = "删除时间")
|
||||
private Long deleteTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.mdd.common.mapper;
|
||||
|
||||
import com.mdd.common.core.basics.IBaseMapper;
|
||||
import com.mdd.common.entity.AppUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 用户信息Mapper
|
||||
* @author LikeAdmin
|
||||
*/
|
||||
@Mapper
|
||||
public interface AppUserMapper extends IBaseMapper<AppUser> {
|
||||
}
|
||||
Loading…
Reference in New Issue