pull/2/head
parent
42091eedca
commit
7870f79674
|
@ -8,6 +8,8 @@ import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
|||
import cn.iocoder.yudao.module.member.controller.admin.user.dto.AdminUserQueryDTO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.AdminUserInfoRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUpdateStatusReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserUpdatePasswordReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.auth.vo.AppAuthResetPasswordReqVO;
|
||||
import cn.iocoder.yudao.module.member.convert.user.UserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
|
@ -60,6 +62,12 @@ public class AdminUserController {
|
|||
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
||||
return success(avatar);
|
||||
}
|
||||
@PostMapping("/update-password")
|
||||
@Operation(summary = "修改密码", description = "修改密码")
|
||||
public CommonResult<Boolean> resetPassword(@RequestBody @Valid MemberUserUpdatePasswordReqVO reqVO) {
|
||||
userService.updateUserPassword(reqVO.getId(),reqVO.getPassword());
|
||||
return success(true);
|
||||
}
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "修改用户状态")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:update')")
|
||||
|
@ -67,6 +75,7 @@ public class AdminUserController {
|
|||
userService.updateUserStatus(reqVO.getId(), reqVO.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得基本信息")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 用户更新密码 Request VO")
|
||||
@Data
|
||||
public class MemberUserUpdatePasswordReqVO {
|
||||
|
||||
@Schema(description = "用户编号", required = true, example = "1024")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "密码", required = true, example = "123456")
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
private String password;
|
||||
|
||||
}
|
|
@ -30,6 +30,11 @@ public class AppAuthSmsLoginReqVO {
|
|||
@NotEmpty(message = "手机号不能为空")
|
||||
@Mobile
|
||||
private String mobile;
|
||||
/**
|
||||
* 推广员id
|
||||
*/
|
||||
@Schema(description = "推广员id", required = true, example = "张三")
|
||||
private Long promoterId;
|
||||
|
||||
@Schema(description = "手机验证码", required = true, example = "1024")
|
||||
@NotEmpty(message = "手机验证码不能为空")
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.controller.app.user;
|
|||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoReqVO;
|
||||
|
@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoRespVO;
|
|||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO;
|
||||
import cn.iocoder.yudao.module.member.convert.user.UserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.service.promoter.PromoterService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -35,6 +37,9 @@ public class AppUserController {
|
|||
@Resource
|
||||
private MemberUserService userService;
|
||||
|
||||
@Resource
|
||||
private PromoterService promoterService;
|
||||
|
||||
@PutMapping("/update-nickname")
|
||||
@Operation(summary = "修改用户昵称")
|
||||
@PreAuthenticated
|
||||
|
@ -59,7 +64,13 @@ public class AppUserController {
|
|||
@PreAuthenticated
|
||||
public CommonResult<AppUserInfoRespVO> getUserInfo() {
|
||||
MemberUserDO user = userService.getUser(getLoginUserId());
|
||||
return success(UserConvert.INSTANCE.convert(user));
|
||||
AppUserInfoRespVO appUserInfoRespVO = UserConvert.INSTANCE.convert(user);
|
||||
if(promoterService.checkIsPromoterByUserId(getLoginUserId())){
|
||||
appUserInfoRespVO.setUserType(UserTypeEnum.PROMOTER);
|
||||
}else{
|
||||
appUserInfoRespVO.setUserType(UserTypeEnum.MEMBER);
|
||||
}
|
||||
return success(appUserInfoRespVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update-mobile")
|
||||
|
|
|
@ -130,7 +130,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
|
|||
if (user != null) {
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_EXISTS);
|
||||
}
|
||||
MemberUserDO memberUserDO = userService.createUserIfAbsent(reqVO.getMobile(),reqVO.getRealName(), userIp);
|
||||
MemberUserDO memberUserDO = userService.createUserIfAbsent(reqVO.getMobile(),reqVO.getRealName(), userIp,reqVO.getPromoterId());
|
||||
return memberUserDO.getId();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,15 @@ public interface PromoterService {
|
|||
*/
|
||||
PromoterDO getPromoter(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 获得推广员
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 推广员
|
||||
*/
|
||||
Boolean checkIsPromoterByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 获得推广员列表
|
||||
*
|
||||
|
|
|
@ -108,6 +108,17 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
return promoterMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得推广员
|
||||
*
|
||||
* @param userId@return 推广员
|
||||
*/
|
||||
@Override
|
||||
public Boolean checkIsPromoterByUserId(Long userId) {
|
||||
Long count = this.promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId,userId));
|
||||
return count>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PromoterDO> getPromoterList(Collection<Long> ids) {
|
||||
return promoterMapper.selectBatchIds(ids);
|
||||
|
|
|
@ -43,6 +43,16 @@ public interface MemberUserService {
|
|||
*/
|
||||
MemberUserDO createUserIfAbsent(@Mobile String mobile, String realName,String registerIp);
|
||||
|
||||
/**
|
||||
* 基于手机号创建用户。
|
||||
* 如果用户已经存在,则直接进行返回
|
||||
*
|
||||
* @param mobile 手机号
|
||||
* @param registerIp 注册 IP
|
||||
* @return 用户对象
|
||||
*/
|
||||
MemberUserDO createUserIfAbsent(@Mobile String mobile, String realName,String registerIp,Long promoterId);
|
||||
|
||||
/**
|
||||
* 更新用户的最后登陆信息
|
||||
*
|
||||
|
@ -81,7 +91,13 @@ public interface MemberUserService {
|
|||
* @return 头像url
|
||||
*/
|
||||
String updateUserAvatar(Long userId, InputStream inputStream) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*
|
||||
* @param id 用户编号
|
||||
* @param password 密码
|
||||
*/
|
||||
void updateUserPassword(Long id, String password);
|
||||
void updateUserStatus(Long id, Integer status) ;
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,10 +68,31 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||
return user;
|
||||
}
|
||||
// 用户不存在,则进行创建
|
||||
return this.createUser(mobile, realName, registerIp);
|
||||
return this.createUser(mobile, realName, registerIp,null);
|
||||
}
|
||||
|
||||
private MemberUserDO createUser(String mobile,String realName, String registerIp) {
|
||||
/**
|
||||
* 基于手机号创建用户。
|
||||
* 如果用户已经存在,则直接进行返回
|
||||
*
|
||||
* @param mobile 手机号
|
||||
* @param realName
|
||||
* @param registerIp 注册 IP
|
||||
* @param promoterId
|
||||
* @return 用户对象
|
||||
*/
|
||||
@Override
|
||||
public MemberUserDO createUserIfAbsent(String mobile, String realName, String registerIp, Long promoterId) {
|
||||
// 用户已经存在
|
||||
MemberUserDO user = memberUserMapper.selectByMobile(mobile);
|
||||
if (user != null) {
|
||||
return user;
|
||||
}
|
||||
// 用户不存在,则进行创建
|
||||
return this.createUser(mobile, realName, registerIp,promoterId);
|
||||
}
|
||||
|
||||
private MemberUserDO createUser(String mobile, String realName, String registerIp,Long promoterId) {
|
||||
// 生成密码
|
||||
String password = IdUtil.fastSimpleUUID();
|
||||
// 插入用户
|
||||
|
@ -81,6 +102,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||
user.setPassword(encodePassword(password)); // 加密密码
|
||||
user.setRegisterIp(registerIp);
|
||||
user.setPromoterId(promoterId);
|
||||
memberUserMapper.insert(user);
|
||||
return user;
|
||||
}
|
||||
|
@ -123,6 +145,24 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||
memberUserMapper.updateById(MemberUserDO.builder().id(userId).avatar(avatar).build());
|
||||
return avatar;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*
|
||||
* @param id 用户编号
|
||||
* @param password 密码
|
||||
*/
|
||||
@Override
|
||||
public void updateUserPassword(Long id, String password) {
|
||||
// 校验用户存在
|
||||
this.checkUserExists(id);
|
||||
// 更新密码
|
||||
MemberUserDO userDO = new MemberUserDO();
|
||||
userDO.setId(id);
|
||||
userDO.setPassword(encodePassword(password));
|
||||
memberUserMapper.updateById(userDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserStatus(Long id, Integer status) {
|
||||
// 校验用户存在
|
||||
|
|
|
@ -1,35 +1,25 @@
|
|||
package cn.iocoder.yudao.module.system.controller.app.tenant;
|
||||
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantRespVO;
|
||||
import cn.iocoder.yudao.module.system.convert.tenant.TenantConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 租户")
|
||||
@Tag(name = "用户APP - 租户")
|
||||
@RestController
|
||||
@RequestMapping("/system/tenant")
|
||||
@RequestMapping("/tenant")
|
||||
public class AppTenantController {
|
||||
|
||||
@Resource
|
||||
|
@ -40,7 +30,6 @@ public class AppTenantController {
|
|||
@GetMapping("/get")
|
||||
@Operation(summary = "获得租户")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:tenant:query')")
|
||||
public CommonResult<TenantRespVO> getTenant(@RequestParam("id") Long id) {
|
||||
TenantDO tenant = tenantService.getTenant(id);
|
||||
return success(TenantConvert.INSTANCE.convert(tenant));
|
||||
|
|
|
@ -1,25 +1,65 @@
|
|||
package cn.iocoder.yudao.module.system.controller.app.tenant.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantBaseVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 租户 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TenantRespVO extends TenantBaseVO {
|
||||
public class TenantRespVO {
|
||||
|
||||
@Schema(description = "租户编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "租户名", required = true, example = "芋道")
|
||||
@NotNull(message = "租户名不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
@Schema(description = "简介", example = "https://www.iocoder.cn")
|
||||
private String introduction;
|
||||
|
||||
/**
|
||||
* 服务电话
|
||||
*/
|
||||
@Schema(description = "服务电话", example = "https://www.iocoder.cn")
|
||||
private String serviceMobile;
|
||||
|
||||
/**
|
||||
* 服务时间
|
||||
*/
|
||||
@Schema(description = "服务时间", example = "https://www.iocoder.cn")
|
||||
private String serviceTime;
|
||||
|
||||
/**
|
||||
* 微信客服地址
|
||||
*/
|
||||
@Schema(description = "微信客服地址", example = "https://www.iocoder.cn")
|
||||
private String wxKfUrl;
|
||||
|
||||
/**
|
||||
* 通知公告
|
||||
*/
|
||||
@Schema(description = "通知公告", example = "https://www.iocoder.cn")
|
||||
private String notice;
|
||||
|
||||
/**
|
||||
* logo
|
||||
*/
|
||||
@Schema(description = "logo", example = "https://www.iocoder.cn")
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 商品提成
|
||||
*/
|
||||
@Schema(description = "商品提成")
|
||||
private Integer goodsCommission;
|
||||
/**
|
||||
* 会员充值提成
|
||||
*/
|
||||
@Schema(description = "会员充值提成")
|
||||
private Integer memberCommission;
|
||||
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ yudao:
|
|||
permit-all_urls:
|
||||
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录
|
||||
- /admin-api/notice/wxpay/**
|
||||
- /app-api/tenant/get
|
||||
websocket:
|
||||
enable: true # websocket的开关
|
||||
path: /websocket/message # 路径
|
||||
|
|
|
@ -5,8 +5,8 @@ ENV = 'development'
|
|||
VUE_APP_TITLE = 创盈商户管理系统
|
||||
|
||||
# 芋道管理系统/开发环境
|
||||
VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/admin-api'
|
||||
#VUE_APP_BASE_API = 'http://192.168.1.147:48080'
|
||||
#VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/admin-api'
|
||||
VUE_APP_BASE_API = 'http://192.168.2.71:48080'
|
||||
|
||||
# 路由懒加载
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
|
|
@ -6,11 +6,12 @@ VUE_APP_TITLE = 创盈商户管理系统
|
|||
|
||||
# 创盈管理系统/生产环境
|
||||
VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/admin-api'
|
||||
#VUE_APP_BASE_API = 'http://192.168.2.71:48080'
|
||||
|
||||
# 根据服务器或域名修改
|
||||
PUBLIC_PATH = 'https://cmx.bskies.cc:8000/cy-admin'
|
||||
#PUBLIC_PATH = 'https://cmx.bskies.cc:8000/cy-admin'
|
||||
# 二级部署路径
|
||||
VUE_APP_APP_NAME ='cy-admin'
|
||||
#VUE_APP_APP_NAME ='cy-admin'
|
||||
|
||||
# 多租户的开关
|
||||
VUE_APP_TENANT_ENABLE = true
|
||||
|
|
Loading…
Reference in New Issue