member代码迁移
parent
e919d88554
commit
ac00a2f49e
|
|
@ -1,14 +1,12 @@
|
|||
package com.fjrcloud.community.module.member.convert.auth;
|
||||
package com.fjrcloud.community.module.community.auth;
|
||||
|
||||
import com.fjrcloud.community.framework.common.biz.system.oauth2.dto.OAuth2AccessTokenRespDTO;
|
||||
import com.fjrcloud.community.module.member.controller.app.auth.vo.*;
|
||||
import com.fjrcloud.community.module.member.controller.app.social.vo.AppSocialUserUnbindReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.app.user.vo.AppMemberUserResetPasswordReqVO;
|
||||
import com.fjrcloud.community.module.community.controller.app.auth.vo.*;
|
||||
import com.fjrcloud.community.module.community.controller.app.user.vo.AppMemberUserResetPasswordReqVO;
|
||||
import com.fjrcloud.community.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||
import com.fjrcloud.community.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
import com.fjrcloud.community.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
|
||||
import com.fjrcloud.community.module.system.api.social.dto.SocialUserBindReqDTO;
|
||||
import com.fjrcloud.community.module.system.api.social.dto.SocialUserUnbindReqDTO;
|
||||
import com.fjrcloud.community.module.system.api.social.dto.SocialWxJsapiSignatureRespDTO;
|
||||
import com.fjrcloud.community.module.system.enums.sms.SmsSceneEnum;
|
||||
import org.mapstruct.Mapper;
|
||||
|
|
@ -20,7 +18,6 @@ public interface AuthConvert {
|
|||
AuthConvert INSTANCE = Mappers.getMapper(AuthConvert.class);
|
||||
|
||||
SocialUserBindReqDTO convert(Long userId, Integer userType, AppAuthSocialLoginReqVO reqVO);
|
||||
SocialUserUnbindReqDTO convert(Long userId, Integer userType, AppSocialUserUnbindReqVO reqVO);
|
||||
|
||||
SmsCodeSendReqDTO convert(AppAuthSmsSendReqVO reqVO);
|
||||
SmsCodeUseReqDTO convert(AppMemberUserResetPasswordReqVO reqVO, SmsSceneEnum scene, String usedIp);
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.fjrcloud.community.module.community.controller.admin.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.framework.common.pojo.PageResult;
|
||||
import com.fjrcloud.community.framework.common.util.object.BeanUtils;
|
||||
import com.fjrcloud.community.module.community.controller.admin.user.vo.MemberUserPageReqVO;
|
||||
import com.fjrcloud.community.module.community.controller.admin.user.vo.MemberUserRespVO;
|
||||
import com.fjrcloud.community.module.community.controller.admin.user.vo.MemberUserUpdateReqVO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.community.service.user.MemberUserService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 会员用户")
|
||||
@RestController
|
||||
@RequestMapping("/member/user")
|
||||
@Validated
|
||||
public class MemberUserController {
|
||||
|
||||
@Resource
|
||||
private MemberUserService memberUserService;
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新会员用户")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:update')")
|
||||
public CommonResult<Boolean> updateUser(@Valid @RequestBody MemberUserUpdateReqVO updateReqVO) {
|
||||
memberUserService.updateUser(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员用户")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<MemberUserRespVO> getUser(@RequestParam("id") Long id) {
|
||||
MemberUserDO user = memberUserService.getUser(id);
|
||||
if (user == null) {
|
||||
return success(null);
|
||||
}
|
||||
MemberUserRespVO userVO = BeanUtils.toBean(user, MemberUserRespVO.class);
|
||||
return success(userVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员用户分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<PageResult<MemberUserRespVO>> getUserPage(@Valid MemberUserPageReqVO pageVO) {
|
||||
PageResult<MemberUserDO> pageResult = memberUserService.getUserPage(pageVO);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return success(PageResult.empty());
|
||||
}
|
||||
List<MemberUserRespVO> respVOList = BeanUtils.toBean(pageResult.getList(), MemberUserRespVO.class);
|
||||
PageResult<MemberUserRespVO> result = new PageResult<>(respVOList, pageResult.getTotal());
|
||||
return success(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.admin.user.vo;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fjrcloud.community.framework.common.enums.UserTypeEnum;
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.framework.security.config.SecurityProperties;
|
||||
import com.fjrcloud.community.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.fjrcloud.community.module.member.controller.app.auth.vo.*;
|
||||
import com.fjrcloud.community.module.member.convert.auth.AuthConvert;
|
||||
import com.fjrcloud.community.module.member.service.auth.MemberAuthService;
|
||||
import com.fjrcloud.community.module.community.auth.AuthConvert;
|
||||
import com.fjrcloud.community.module.community.controller.app.auth.vo.*;
|
||||
import com.fjrcloud.community.module.community.service.auth.MemberAuthService;
|
||||
import com.fjrcloud.community.module.system.api.social.SocialClientApi;
|
||||
import com.fjrcloud.community.module.system.api.social.dto.SocialWxJsapiSignatureRespDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth.vo;
|
||||
|
||||
import com.fjrcloud.community.framework.common.validation.InEnum;
|
||||
import com.fjrcloud.community.framework.common.validation.Mobile;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth.vo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fjrcloud.community.framework.common.validation.InEnum;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth.vo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fjrcloud.community.framework.common.validation.InEnum;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth.vo;
|
||||
|
||||
import com.fjrcloud.community.framework.common.validation.InEnum;
|
||||
import com.fjrcloud.community.framework.common.validation.Mobile;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth.vo;
|
||||
|
||||
import com.fjrcloud.community.framework.common.validation.InEnum;
|
||||
import com.fjrcloud.community.framework.common.validation.Mobile;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth.vo;
|
||||
|
||||
import com.fjrcloud.community.framework.common.validation.InEnum;
|
||||
import com.fjrcloud.community.module.system.enums.social.SocialTypeEnum;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.auth.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.auth.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.user;
|
||||
package com.fjrcloud.community.module.community.controller.app.user;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.framework.common.util.object.BeanUtils;
|
||||
import com.fjrcloud.community.module.member.controller.app.user.vo.*;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.member.service.user.MemberUserService;
|
||||
import com.fjrcloud.community.module.community.controller.app.user.vo.*;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.community.service.user.MemberUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.user.vo;
|
||||
|
||||
import com.fjrcloud.community.framework.common.validation.Mobile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.user.vo;
|
||||
|
||||
import com.fjrcloud.community.framework.common.validation.Mobile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.controller.app.user.vo;
|
||||
package com.fjrcloud.community.module.community.controller.app.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.dal.dataobject.user;
|
||||
package com.fjrcloud.community.module.community.dal.dataobject.user;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
|
@ -10,8 +10,6 @@ import com.fjrcloud.community.framework.ip.core.Area;
|
|||
import com.fjrcloud.community.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.fjrcloud.community.framework.mybatis.core.type.LongListTypeHandler;
|
||||
import com.fjrcloud.community.framework.tenant.core.aop.TenantIgnore;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.group.MemberGroupDO;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
import com.fjrcloud.community.module.system.enums.common.SexEnum;
|
||||
import lombok.*;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
|
|
@ -130,7 +128,6 @@ public class MemberUserDO extends BaseDO {
|
|||
/**
|
||||
* 会员级别编号
|
||||
*
|
||||
* 关联 {@link MemberLevelDO#getId()} 字段
|
||||
*/
|
||||
private Long levelId;
|
||||
/**
|
||||
|
|
@ -140,7 +137,6 @@ public class MemberUserDO extends BaseDO {
|
|||
/**
|
||||
* 用户分组编号
|
||||
*
|
||||
* 关联 {@link MemberGroupDO#getId()} 字段
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.dal.dataobject.user;
|
||||
package com.fjrcloud.community.module.community.dal.dataobject.user;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.dal.mysql.user;
|
||||
package com.fjrcloud.community.module.community.dal.mysql.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
|
|
@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||
import com.fjrcloud.community.framework.common.pojo.PageResult;
|
||||
import com.fjrcloud.community.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.fjrcloud.community.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.fjrcloud.community.module.member.controller.admin.user.vo.MemberUserPageReqVO;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.community.controller.admin.user.vo.MemberUserPageReqVO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package com.fjrcloud.community.module.member.dal.mysql.user;
|
||||
package com.fjrcloud.community.module.community.dal.mysql.user;
|
||||
|
||||
import com.fjrcloud.community.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.fjrcloud.community.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserTenantRelDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserTenantRelDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.fjrcloud.community.module.community.enums;
|
||||
|
||||
import com.fjrcloud.community.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* Member 错误码枚举类
|
||||
* <p>
|
||||
* member 系统,使用 1-004-000-000 段
|
||||
*/
|
||||
public interface MemberErrorCodeConstants {
|
||||
|
||||
// ========== 用户相关 1-004-001-000 ============
|
||||
ErrorCode USER_NOT_EXISTS = new ErrorCode(1_004_001_000, "用户不存在");
|
||||
ErrorCode USER_MOBILE_NOT_EXISTS = new ErrorCode(1_004_001_001, "手机号未注册用户");
|
||||
ErrorCode USER_MOBILE_USED = new ErrorCode(1_004_001_002, "修改手机失败,该手机号({})已经被使用");
|
||||
|
||||
|
||||
// ========== AUTH 模块 1-004-003-000 ==========
|
||||
ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_004_003_000, "登录失败,账号密码不正确");
|
||||
ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1_004_003_001, "登录失败,账号被禁用");
|
||||
ErrorCode AUTH_SOCIAL_USER_NOT_FOUND = new ErrorCode(1_004_003_005, "登录失败,解析不到三方登录信息");
|
||||
ErrorCode AUTH_MOBILE_USED = new ErrorCode(1_004_003_007, "手机号已经被使用");
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.framework.web.config;
|
||||
package com.fjrcloud.community.module.community.framework.web.config;
|
||||
|
||||
import com.fjrcloud.community.framework.swagger.config.FjrcloudSwaggerAutoConfiguration;
|
||||
import org.springdoc.core.GroupedOpenApi;
|
||||
|
|
@ -14,12 +14,12 @@ import com.fjrcloud.community.module.community.controller.app.activity.vo.AppAct
|
|||
import com.fjrcloud.community.module.community.dal.dataobject.activity.ActivityRegistrationDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.activity.CommunityActivityDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.community.CommunityDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.community.dal.mysql.activity.ActivityRegistrationMapper;
|
||||
import com.fjrcloud.community.module.community.dal.mysql.activity.ActivityScopeMapper;
|
||||
import com.fjrcloud.community.module.community.dal.mysql.activity.CommunityActivityMapper;
|
||||
import com.fjrcloud.community.module.community.service.community.CommunityService;
|
||||
import com.fjrcloud.community.module.member.api.user.MemberUserApi;
|
||||
import com.fjrcloud.community.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import com.fjrcloud.community.module.community.service.user.MemberUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -33,7 +33,7 @@ import java.util.stream.Collectors;
|
|||
import static com.fjrcloud.community.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.fjrcloud.community.framework.tenant.core.security.TenantSecurityWebFilter.SYSTEM_TENANT_ID;
|
||||
import static com.fjrcloud.community.module.community.enums.ErrorCodeConstants.*;
|
||||
import static com.fjrcloud.community.module.member.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
import static com.fjrcloud.community.module.community.enums.MemberErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 小区活动 Service 实现类
|
||||
|
|
@ -57,7 +57,7 @@ public class CommunityActivityServiceImpl implements CommunityActivityService {
|
|||
private CommunityService communityService;
|
||||
|
||||
@Resource
|
||||
private MemberUserApi memberUserApi;
|
||||
private MemberUserService memberUserService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -221,7 +221,7 @@ public class CommunityActivityServiceImpl implements CommunityActivityService {
|
|||
}
|
||||
|
||||
// 获取会员信息
|
||||
MemberUserRespDTO memberUser = memberUserApi.getUser(memberId);
|
||||
MemberUserDO memberUser = memberUserService.getUser(memberId);
|
||||
if (memberUser == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.fjrcloud.community.module.member.service.auth;
|
||||
package com.fjrcloud.community.module.community.service.auth;
|
||||
|
||||
import com.fjrcloud.community.module.member.controller.app.auth.vo.*;
|
||||
import com.fjrcloud.community.module.community.controller.app.auth.vo.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.service.auth;
|
||||
package com.fjrcloud.community.module.community.service.auth;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.fjrcloud.community.framework.common.biz.system.oauth2.OAuth2TokenCommonApi;
|
||||
|
|
@ -10,12 +10,12 @@ import com.fjrcloud.community.framework.common.enums.UserTypeEnum;
|
|||
import com.fjrcloud.community.framework.common.util.monitor.TracerUtils;
|
||||
import com.fjrcloud.community.framework.common.util.servlet.ServletUtils;
|
||||
import com.fjrcloud.community.framework.tenant.core.context.TenantContextHolder;
|
||||
import com.fjrcloud.community.module.member.controller.app.auth.vo.*;
|
||||
import com.fjrcloud.community.module.member.convert.auth.AuthConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserTenantRelDO;
|
||||
import com.fjrcloud.community.module.member.service.user.MemberUserService;
|
||||
import com.fjrcloud.community.module.member.service.user.MemberUserTenantRelService;
|
||||
import com.fjrcloud.community.module.community.auth.AuthConvert;
|
||||
import com.fjrcloud.community.module.community.controller.app.auth.vo.*;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserTenantRelDO;
|
||||
import com.fjrcloud.community.module.community.service.user.MemberUserService;
|
||||
import com.fjrcloud.community.module.community.service.user.MemberUserTenantRelService;
|
||||
import com.fjrcloud.community.module.system.api.logger.LoginLogApi;
|
||||
import com.fjrcloud.community.module.system.api.logger.dto.LoginLogCreateReqDTO;
|
||||
import com.fjrcloud.community.module.system.api.sms.SmsCodeApi;
|
||||
|
|
@ -39,7 +39,7 @@ import java.util.Objects;
|
|||
import static com.fjrcloud.community.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.fjrcloud.community.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static com.fjrcloud.community.framework.web.core.util.WebFrameworkUtils.getTerminal;
|
||||
import static com.fjrcloud.community.module.member.enums.ErrorCodeConstants.*;
|
||||
import static com.fjrcloud.community.module.community.enums.MemberErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 会员的认证 Service 实现类
|
||||
|
|
@ -14,10 +14,10 @@ import com.fjrcloud.community.module.community.controller.admin.house.vo.HouseSa
|
|||
import com.fjrcloud.community.module.community.controller.app.house.vo.HouseTreeNodeVO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.community.CommunityDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.house.HouseDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.community.dal.mysql.community.CommunityMapper;
|
||||
import com.fjrcloud.community.module.community.dal.mysql.house.HouseMapper;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.member.dal.mysql.user.MemberUserMapper;
|
||||
import com.fjrcloud.community.module.community.dal.mysql.user.MemberUserMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ import com.fjrcloud.community.module.community.controller.admin.memberhouse.vo.M
|
|||
import com.fjrcloud.community.module.community.controller.app.memberhouse.vo.*;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.community.CommunityDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.memberhouse.MemberHouseDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.community.dal.mysql.memberhouse.MemberHouseMapper;
|
||||
import com.fjrcloud.community.module.community.service.community.CommunityService;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.member.service.user.MemberUserService;
|
||||
import com.fjrcloud.community.module.member.service.user.MemberUserTenantRelService;
|
||||
import com.fjrcloud.community.module.community.service.user.MemberUserService;
|
||||
import com.fjrcloud.community.module.community.service.user.MemberUserTenantRelService;
|
||||
import com.fjrcloud.community.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||
import com.fjrcloud.community.module.system.service.oauth2.OAuth2TokenService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -36,7 +36,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import static com.fjrcloud.community.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.fjrcloud.community.module.community.enums.ErrorCodeConstants.*;
|
||||
import static com.fjrcloud.community.module.member.enums.ErrorCodeConstants.USER_MOBILE_NOT_EXISTS;
|
||||
import static com.fjrcloud.community.module.community.enums.MemberErrorCodeConstants.USER_MOBILE_NOT_EXISTS;
|
||||
import static com.fjrcloud.community.module.system.enums.oauth2.OAuth2ClientConstants.CLIENT_ID_DEFAULT;
|
||||
|
||||
/**
|
||||
|
|
@ -215,31 +215,7 @@ public class MemberHouseServiceImpl implements MemberHouseService {
|
|||
return CollUtil.newArrayList();
|
||||
}
|
||||
|
||||
// 2. 按照小区+房屋进行分组,每个房屋只保留最新的一条记录
|
||||
return houseList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
house -> house.getCommunityId() + "_" + house.getBuildingNo() + "_" + house.getUnitNo() + "_" + house.getRoomNo(),
|
||||
Collectors.maxBy((h1, h2) -> {
|
||||
// 优先按状态排序:已认证(1) > 待审核(0) > 驳回(2)
|
||||
int statusCompare = compareStatus(h1.getStatus(), h2.getStatus());
|
||||
if (statusCompare != 0) {
|
||||
return statusCompare;
|
||||
}
|
||||
// 状态相同则按ID降序
|
||||
return h1.getId().compareTo(h2.getId());
|
||||
})
|
||||
))
|
||||
.values().stream()
|
||||
.filter(java.util.Optional::isPresent)
|
||||
.map(java.util.Optional::get)
|
||||
.map(house -> {
|
||||
AppMemberHouseRespVO respVO = BeanUtils.toBean(house, AppMemberHouseRespVO.class);
|
||||
// 查询该房屋的关联人员数量(只统计已认证的)
|
||||
List<MemberHouseDO> relationList = memberHouseMapper.selectListByHouseId(house.getHouseId());
|
||||
respVO.setRelationCount(relationList.size());
|
||||
return respVO;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return BeanUtils.toBean(houseList, AppMemberHouseRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package com.fjrcloud.community.module.member.service.user;
|
||||
package com.fjrcloud.community.module.community.service.user;
|
||||
|
||||
import com.fjrcloud.community.framework.common.enums.TerminalEnum;
|
||||
import com.fjrcloud.community.framework.common.pojo.PageResult;
|
||||
import com.fjrcloud.community.framework.common.validation.Mobile;
|
||||
import com.fjrcloud.community.module.member.controller.admin.user.vo.MemberUserPageReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.admin.user.vo.MemberUserUpdateReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.app.user.vo.*;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.community.controller.admin.user.vo.MemberUserPageReqVO;
|
||||
import com.fjrcloud.community.module.community.controller.admin.user.vo.MemberUserUpdateReqVO;
|
||||
import com.fjrcloud.community.module.community.controller.app.user.vo.*;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.fjrcloud.community.module.member.service.user;
|
||||
package com.fjrcloud.community.module.community.service.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
|
|
@ -12,14 +12,12 @@ import com.fjrcloud.community.framework.common.enums.UserTypeEnum;
|
|||
import com.fjrcloud.community.framework.common.pojo.PageResult;
|
||||
import com.fjrcloud.community.framework.common.util.object.BeanUtils;
|
||||
import com.fjrcloud.community.framework.tenant.core.context.TenantContextHolder;
|
||||
import com.fjrcloud.community.module.member.controller.admin.user.vo.MemberUserPageReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.admin.user.vo.MemberUserUpdateReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.app.user.vo.*;
|
||||
import com.fjrcloud.community.module.member.convert.auth.AuthConvert;
|
||||
import com.fjrcloud.community.module.member.convert.user.MemberUserConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.member.dal.mysql.user.MemberUserMapper;
|
||||
import com.fjrcloud.community.module.member.mq.producer.user.MemberUserProducer;
|
||||
import com.fjrcloud.community.module.community.auth.AuthConvert;
|
||||
import com.fjrcloud.community.module.community.controller.admin.user.vo.MemberUserPageReqVO;
|
||||
import com.fjrcloud.community.module.community.controller.admin.user.vo.MemberUserUpdateReqVO;
|
||||
import com.fjrcloud.community.module.community.controller.app.user.vo.*;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.community.dal.mysql.user.MemberUserMapper;
|
||||
import com.fjrcloud.community.module.system.api.sms.SmsCodeApi;
|
||||
import com.fjrcloud.community.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
import com.fjrcloud.community.module.system.api.social.SocialClientApi;
|
||||
|
|
@ -30,8 +28,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
|
@ -42,7 +38,7 @@ import java.util.List;
|
|||
import static com.fjrcloud.community.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.fjrcloud.community.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static com.fjrcloud.community.framework.tenant.core.security.TenantSecurityWebFilter.SYSTEM_TENANT_ID;
|
||||
import static com.fjrcloud.community.module.member.enums.ErrorCodeConstants.*;
|
||||
import static com.fjrcloud.community.module.community.enums.MemberErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 会员 User Service 实现类
|
||||
|
|
@ -66,9 +62,6 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Resource
|
||||
private MemberUserProducer memberUserProducer;
|
||||
|
||||
@Resource
|
||||
private MemberUserTenantRelService userTenantRelService;
|
||||
|
||||
|
|
@ -127,18 +120,8 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||
if (StrUtil.isEmpty(nickname)) {
|
||||
user.setNickname("用户" + RandomUtil.randomNumbers(6));
|
||||
}
|
||||
|
||||
// 插入数据库
|
||||
memberUserMapper.insert(user);
|
||||
|
||||
// 发送 MQ 消息:用户创建
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
memberUserProducer.sendUserCreateMessage(user.getId());
|
||||
}
|
||||
});
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +253,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||
validateMobileUnique(updateReqVO.getId(), updateReqVO.getMobile());
|
||||
|
||||
// 更新用户信息
|
||||
MemberUserDO updateObj = MemberUserConvert.INSTANCE.convert(updateReqVO);
|
||||
MemberUserDO updateObj = BeanUtils.toBean(updateReqVO, MemberUserDO.class);
|
||||
memberUserMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.fjrcloud.community.module.member.service.user;
|
||||
package com.fjrcloud.community.module.community.service.user;
|
||||
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserTenantRelDO;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserTenantRelDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package com.fjrcloud.community.module.member.service.user;
|
||||
package com.fjrcloud.community.module.community.service.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserTenantRelDO;
|
||||
import com.fjrcloud.community.module.member.dal.mysql.user.MemberUserTenantRelMapper;
|
||||
import com.fjrcloud.community.module.community.dal.dataobject.user.MemberUserTenantRelDO;
|
||||
import com.fjrcloud.community.module.community.dal.mysql.user.MemberUserTenantRelMapper;
|
||||
import com.fjrcloud.community.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import com.fjrcloud.community.module.system.dal.mysql.tenant.TenantMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-community</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>fjrcloud-module-member</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
member 模块,我们放会员业务。
|
||||
例如说:会员中心等等
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-module-system</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-module-infra</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-spring-boot-starter-biz-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 消息队列相关 -->
|
||||
<dependency>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-spring-boot-starter-mq</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fjrcloud.boot</groupId>
|
||||
<artifactId>fjrcloud-spring-boot-starter-biz-ip</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.address;
|
||||
|
||||
import com.fjrcloud.community.module.member.api.address.dto.MemberAddressRespDTO;
|
||||
|
||||
/**
|
||||
* 用户收件地址 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface MemberAddressApi {
|
||||
|
||||
/**
|
||||
* 获得用户收件地址
|
||||
*
|
||||
* @param id 收件地址编号
|
||||
* @param userId 用户编号
|
||||
* @return 用户收件地址
|
||||
*/
|
||||
MemberAddressRespDTO getAddress(Long id, Long userId);
|
||||
|
||||
/**
|
||||
* 获得用户默认收件地址
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @return 用户收件地址
|
||||
*/
|
||||
MemberAddressRespDTO getDefaultAddress(Long userId);
|
||||
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.address;
|
||||
|
||||
import com.fjrcloud.community.module.member.api.address.dto.MemberAddressRespDTO;
|
||||
import com.fjrcloud.community.module.member.convert.address.AddressConvert;
|
||||
import com.fjrcloud.community.module.member.service.address.AddressService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 用户收件地址 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberAddressApiImpl implements MemberAddressApi {
|
||||
|
||||
@Resource
|
||||
private AddressService addressService;
|
||||
|
||||
@Override
|
||||
public MemberAddressRespDTO getAddress(Long id, Long userId) {
|
||||
return AddressConvert.INSTANCE.convert02(addressService.getAddress(userId, id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberAddressRespDTO getDefaultAddress(Long userId) {
|
||||
return AddressConvert.INSTANCE.convert02(addressService.getDefaultUserAddress(userId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.address.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户收件地址 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class MemberAddressRespDTO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 收件人名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 地区编号
|
||||
*/
|
||||
private Integer areaId;
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
private String detailAddress;
|
||||
/**
|
||||
* 是否默认
|
||||
*/
|
||||
private Boolean defaultStatus;
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.config;
|
||||
|
||||
import com.fjrcloud.community.module.member.api.config.dto.MemberConfigRespDTO;
|
||||
|
||||
/**
|
||||
* 用户配置 API 接口
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
public interface MemberConfigApi {
|
||||
|
||||
/**
|
||||
* 获得积分配置
|
||||
*
|
||||
* @return 积分配置
|
||||
*/
|
||||
MemberConfigRespDTO getConfig();
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.config;
|
||||
|
||||
import com.fjrcloud.community.module.member.api.config.dto.MemberConfigRespDTO;
|
||||
import com.fjrcloud.community.module.member.convert.config.MemberConfigConvert;
|
||||
import com.fjrcloud.community.module.member.service.config.MemberConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 用户配置 API 实现类
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberConfigApiImpl implements MemberConfigApi {
|
||||
|
||||
@Resource
|
||||
private MemberConfigService memberConfigService;
|
||||
|
||||
@Override
|
||||
public MemberConfigRespDTO getConfig() {
|
||||
return MemberConfigConvert.INSTANCE.convert01(memberConfigService.getConfig());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.config.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户信息 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class MemberConfigRespDTO {
|
||||
|
||||
/**
|
||||
* 积分抵扣开关
|
||||
*/
|
||||
private Boolean pointTradeDeductEnable;
|
||||
/**
|
||||
* 积分抵扣,单位:分
|
||||
* <p>
|
||||
* 1 积分抵扣多少分
|
||||
*/
|
||||
private Integer pointTradeDeductUnitPrice;
|
||||
/**
|
||||
* 积分抵扣最大值
|
||||
*/
|
||||
private Integer pointTradeDeductMaxPrice;
|
||||
/**
|
||||
* 1 元赠送多少分
|
||||
*/
|
||||
private Integer pointTradeGivePoint;
|
||||
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.level;
|
||||
|
||||
import com.fjrcloud.community.module.member.api.level.dto.MemberLevelRespDTO;
|
||||
import com.fjrcloud.community.module.member.enums.MemberExperienceBizTypeEnum;
|
||||
|
||||
/**
|
||||
* 会员等级 API 接口
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
public interface MemberLevelApi {
|
||||
|
||||
/**
|
||||
* 获得会员等级
|
||||
*
|
||||
* @param id 会员等级编号
|
||||
* @return 会员等级
|
||||
*/
|
||||
MemberLevelRespDTO getMemberLevel(Long id);
|
||||
|
||||
/**
|
||||
* 增加会员经验
|
||||
*
|
||||
* @param userId 会员ID
|
||||
* @param experience 经验
|
||||
* @param bizType 业务类型 {@link MemberExperienceBizTypeEnum}
|
||||
* @param bizId 业务编号
|
||||
*/
|
||||
void addExperience(Long userId, Integer experience, Integer bizType, String bizId);
|
||||
|
||||
/**
|
||||
* 扣减会员经验
|
||||
*
|
||||
* @param userId 会员ID
|
||||
* @param experience 经验
|
||||
* @param bizType 业务类型 {@link MemberExperienceBizTypeEnum}
|
||||
* @param bizId 业务编号
|
||||
*/
|
||||
void reduceExperience(Long userId, Integer experience, Integer bizType, String bizId);
|
||||
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.level;
|
||||
|
||||
import com.fjrcloud.community.module.member.api.level.dto.MemberLevelRespDTO;
|
||||
import com.fjrcloud.community.module.member.convert.level.MemberLevelConvert;
|
||||
import com.fjrcloud.community.module.member.enums.MemberExperienceBizTypeEnum;
|
||||
import com.fjrcloud.community.module.member.service.level.MemberLevelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.fjrcloud.community.module.member.enums.ErrorCodeConstants.EXPERIENCE_BIZ_NOT_SUPPORT;
|
||||
|
||||
/**
|
||||
* 会员等级 API 实现类
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberLevelApiImpl implements MemberLevelApi {
|
||||
|
||||
@Resource
|
||||
private MemberLevelService memberLevelService;
|
||||
|
||||
@Override
|
||||
public MemberLevelRespDTO getMemberLevel(Long id) {
|
||||
return MemberLevelConvert.INSTANCE.convert02(memberLevelService.getLevel(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExperience(Long userId, Integer experience, Integer bizType, String bizId) {
|
||||
MemberExperienceBizTypeEnum bizTypeEnum = MemberExperienceBizTypeEnum.getByType(bizType);
|
||||
if (bizTypeEnum == null) {
|
||||
throw exception(EXPERIENCE_BIZ_NOT_SUPPORT);
|
||||
}
|
||||
memberLevelService.addExperience(userId, experience, bizTypeEnum, bizId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reduceExperience(Long userId, Integer experience, Integer bizType, String bizId) {
|
||||
addExperience(userId, -experience, bizType, bizId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.level.dto;
|
||||
|
||||
import com.fjrcloud.community.framework.common.enums.CommonStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 会员等级 Resp DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class MemberLevelRespDTO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 等级名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 等级
|
||||
*/
|
||||
private Integer level;
|
||||
/**
|
||||
* 升级经验
|
||||
*/
|
||||
private Integer experience;
|
||||
/**
|
||||
* 享受折扣
|
||||
*/
|
||||
private Integer discountPercent;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* 消息队列的消息
|
||||
*/
|
||||
package com.fjrcloud.community.module.member.api.message;
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.message.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 会员用户创建消息
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Data
|
||||
public class MemberUserCreateMessage {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* member API 包,定义并实现提供给其它模块的 API
|
||||
*/
|
||||
package com.fjrcloud.community.module.member.api;
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.point;
|
||||
|
||||
import com.fjrcloud.community.module.member.enums.point.MemberPointBizTypeEnum;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
|
||||
/**
|
||||
* 用户积分的 API 接口
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
public interface MemberPointApi {
|
||||
|
||||
/**
|
||||
* 增加用户积分
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param point 积分
|
||||
* @param bizType 业务类型 {@link MemberPointBizTypeEnum}
|
||||
* @param bizId 业务编号
|
||||
*/
|
||||
void addPoint(Long userId, @Min(value = 1L, message = "积分必须是正数") Integer point,
|
||||
Integer bizType, String bizId);
|
||||
|
||||
/**
|
||||
* 减少用户积分
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param point 积分
|
||||
* @param bizType 业务类型 {@link MemberPointBizTypeEnum}
|
||||
* @param bizId 业务编号
|
||||
*/
|
||||
void reducePoint(Long userId, @Min(value = 1L, message = "积分必须是正数") Integer point,
|
||||
Integer bizType, String bizId);
|
||||
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.point;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.fjrcloud.community.module.member.enums.point.MemberPointBizTypeEnum;
|
||||
import com.fjrcloud.community.module.member.service.point.MemberPointRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.fjrcloud.community.module.member.enums.ErrorCodeConstants.POINT_RECORD_BIZ_NOT_SUPPORT;
|
||||
|
||||
/**
|
||||
* 用户积分的 API 实现类
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberPointApiImpl implements MemberPointApi {
|
||||
|
||||
@Resource
|
||||
private MemberPointRecordService memberPointRecordService;
|
||||
|
||||
@Override
|
||||
public void addPoint(Long userId, Integer point, Integer bizType, String bizId) {
|
||||
Assert.isTrue(point > 0);
|
||||
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
|
||||
if (bizTypeEnum == null) {
|
||||
log.error("[addPoint][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId,
|
||||
POINT_RECORD_BIZ_NOT_SUPPORT);
|
||||
return;
|
||||
}
|
||||
memberPointRecordService.createPointRecord(userId, point, bizTypeEnum, bizId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reducePoint(Long userId, Integer point, Integer bizType, String bizId) {
|
||||
Assert.isTrue(point > 0);
|
||||
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
|
||||
if (bizTypeEnum == null) {
|
||||
throw exception(POINT_RECORD_BIZ_NOT_SUPPORT);
|
||||
}
|
||||
memberPointRecordService.createPointRecord(userId, -point, bizTypeEnum, bizId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.user;
|
||||
|
||||
import com.fjrcloud.community.module.member.api.user.dto.MemberUserRespDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
|
||||
/**
|
||||
* 会员用户的 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface MemberUserApi {
|
||||
|
||||
/**
|
||||
* 获得会员用户信息
|
||||
*
|
||||
* @param id 用户编号
|
||||
* @return 用户信息
|
||||
*/
|
||||
MemberUserRespDTO getUser(Long id);
|
||||
|
||||
/**
|
||||
* 获得会员用户信息们
|
||||
*
|
||||
* @param ids 用户编号的数组
|
||||
* @return 用户信息们
|
||||
*/
|
||||
List<MemberUserRespDTO> getUserList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得会员用户 Map
|
||||
*
|
||||
* @param ids 用户编号的数组
|
||||
* @return 会员用户 Map
|
||||
*/
|
||||
default Map<Long, MemberUserRespDTO> getUserMap(Collection<Long> ids) {
|
||||
List<MemberUserRespDTO> list = getUserList(ids);
|
||||
return convertMap(list, MemberUserRespDTO::getId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 基于用户昵称,模糊匹配用户列表
|
||||
*
|
||||
* @param nickname 用户昵称,模糊匹配
|
||||
* @return 用户信息的列表
|
||||
*/
|
||||
List<MemberUserRespDTO> getUserListByNickname(String nickname);
|
||||
|
||||
/**
|
||||
* 基于手机号,精准匹配用户
|
||||
*
|
||||
* @param mobile 手机号
|
||||
* @return 用户信息
|
||||
*/
|
||||
MemberUserRespDTO getUserByMobile(String mobile);
|
||||
|
||||
/**
|
||||
* 校验用户是否存在
|
||||
*
|
||||
* @param id 用户编号
|
||||
*/
|
||||
void validateUser(Long id);
|
||||
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.user;
|
||||
|
||||
import com.fjrcloud.community.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import com.fjrcloud.community.module.member.convert.user.MemberUserConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.member.service.user.MemberUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.fjrcloud.community.module.member.enums.ErrorCodeConstants.USER_MOBILE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 会员用户的 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberUserApiImpl implements MemberUserApi {
|
||||
|
||||
@Resource
|
||||
private MemberUserService userService;
|
||||
|
||||
@Override
|
||||
public MemberUserRespDTO getUser(Long id) {
|
||||
MemberUserDO user = userService.getUser(id);
|
||||
return MemberUserConvert.INSTANCE.convert2(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberUserRespDTO> getUserList(Collection<Long> ids) {
|
||||
return MemberUserConvert.INSTANCE.convertList2(userService.getUserList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberUserRespDTO> getUserListByNickname(String nickname) {
|
||||
return MemberUserConvert.INSTANCE.convertList2(userService.getUserListByNickname(nickname));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberUserRespDTO getUserByMobile(String mobile) {
|
||||
return MemberUserConvert.INSTANCE.convert2(userService.getUserByMobile(mobile));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateUser(Long id) {
|
||||
MemberUserDO user = userService.getUser(id);
|
||||
if (user == null) {
|
||||
throw exception(USER_MOBILE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.api.user.dto;
|
||||
|
||||
import com.fjrcloud.community.framework.common.enums.CommonStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户信息 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class MemberUserRespDTO {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 帐号状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatar;
|
||||
/**
|
||||
* 手机
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 创建时间(注册时间)
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
// ========== 其它信息 ==========
|
||||
|
||||
/**
|
||||
* 会员级别编号
|
||||
*/
|
||||
private Long levelId;
|
||||
|
||||
/**
|
||||
* 积分
|
||||
*/
|
||||
private Integer point;
|
||||
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.address;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.module.member.controller.admin.address.vo.AddressRespVO;
|
||||
import com.fjrcloud.community.module.member.convert.address.AddressConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.address.MemberAddressDO;
|
||||
import com.fjrcloud.community.module.member.service.address.AddressService;
|
||||
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.validation.annotation.Validated;
|
||||
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 java.util.List;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 用户收件地址")
|
||||
@RestController
|
||||
@RequestMapping("/member/address")
|
||||
@Validated
|
||||
public class AddressController {
|
||||
|
||||
@Resource
|
||||
private AddressService addressService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得用户收件地址列表")
|
||||
@Parameter(name = "userId", description = "用户编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<List<AddressRespVO>> getAddressList(@RequestParam("userId") Long userId) {
|
||||
List<MemberAddressDO> list = addressService.getAddressList(userId);
|
||||
return success(AddressConvert.INSTANCE.convertList2(list));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.address;
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.address.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 用户收件地址 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class AddressBaseVO {
|
||||
|
||||
@Schema(description = "收件人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotNull(message = "收件人名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "手机号不能为空")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "地区编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "15716")
|
||||
@NotNull(message = "地区编码不能为空")
|
||||
private Long areaId;
|
||||
|
||||
@Schema(description = "收件详细地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "收件详细地址不能为空")
|
||||
private String detailAddress;
|
||||
|
||||
@Schema(description = "是否默认", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "是否默认不能为空")
|
||||
private Boolean defaultStatus;
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.address.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户收件地址 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AddressRespVO extends AddressBaseVO {
|
||||
|
||||
@Schema(description = "收件地址编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7380")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.config;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.module.member.controller.admin.config.vo.MemberConfigRespVO;
|
||||
import com.fjrcloud.community.module.member.controller.admin.config.vo.MemberConfigSaveReqVO;
|
||||
import com.fjrcloud.community.module.member.convert.config.MemberConfigConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.config.MemberConfigDO;
|
||||
import com.fjrcloud.community.module.member.service.config.MemberConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 会员设置")
|
||||
@RestController
|
||||
@RequestMapping("/member/config")
|
||||
@Validated
|
||||
public class MemberConfigController {
|
||||
|
||||
@Resource
|
||||
private MemberConfigService memberConfigService;
|
||||
|
||||
@PutMapping("/save")
|
||||
@Operation(summary = "保存会员配置")
|
||||
@PreAuthorize("@ss.hasPermission('member:config:save')")
|
||||
public CommonResult<Boolean> saveConfig(@Valid @RequestBody MemberConfigSaveReqVO saveReqVO) {
|
||||
memberConfigService.saveConfig(saveReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员配置")
|
||||
@PreAuthorize("@ss.hasPermission('member:config:query')")
|
||||
public CommonResult<MemberConfigRespVO> getConfig() {
|
||||
MemberConfigDO config = memberConfigService.getConfig();
|
||||
return success(MemberConfigConvert.INSTANCE.convert(config));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.config.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 会员配置 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MemberConfigBaseVO {
|
||||
|
||||
@Schema(description = "积分抵扣开关", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@NotNull(message = "积分抵扣开发不能为空")
|
||||
private Boolean pointTradeDeductEnable;
|
||||
|
||||
@Schema(description = "积分抵扣,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "13506")
|
||||
@NotNull(message = "积分抵扣不能为空")
|
||||
private Integer pointTradeDeductUnitPrice;
|
||||
|
||||
@Schema(description = "积分抵扣最大值", requiredMode = Schema.RequiredMode.REQUIRED, example = "32428")
|
||||
@NotNull(message = "积分抵扣最大值不能为空")
|
||||
private Integer pointTradeDeductMaxPrice;
|
||||
|
||||
@Schema(description = "1 元赠送多少分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
@NotNull(message = "1 元赠送积分不能为空")
|
||||
private Integer pointTradeGivePoint;
|
||||
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.config.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 会员配置 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberConfigRespVO extends MemberConfigBaseVO {
|
||||
|
||||
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.config.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 会员配置保存 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberConfigSaveReqVO extends MemberConfigBaseVO {
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.group;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.framework.common.pojo.PageResult;
|
||||
import com.fjrcloud.community.module.member.controller.admin.group.vo.*;
|
||||
import com.fjrcloud.community.module.member.convert.group.MemberGroupConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.group.MemberGroupDO;
|
||||
import com.fjrcloud.community.module.member.service.group.MemberGroupService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 用户分组")
|
||||
@RestController
|
||||
@RequestMapping("/member/group")
|
||||
@Validated
|
||||
public class MemberGroupController {
|
||||
|
||||
@Resource
|
||||
private MemberGroupService groupService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户分组")
|
||||
@PreAuthorize("@ss.hasPermission('member:group:create')")
|
||||
public CommonResult<Long> createGroup(@Valid @RequestBody MemberGroupCreateReqVO createReqVO) {
|
||||
return success(groupService.createGroup(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户分组")
|
||||
@PreAuthorize("@ss.hasPermission('member:group:update')")
|
||||
public CommonResult<Boolean> updateGroup(@Valid @RequestBody MemberGroupUpdateReqVO updateReqVO) {
|
||||
groupService.updateGroup(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户分组")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('member:group:delete')")
|
||||
public CommonResult<Boolean> deleteGroup(@RequestParam("id") Long id) {
|
||||
groupService.deleteGroup(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户分组")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:group:query')")
|
||||
public CommonResult<MemberGroupRespVO> getGroup(@RequestParam("id") Long id) {
|
||||
MemberGroupDO group = groupService.getGroup(id);
|
||||
return success(MemberGroupConvert.INSTANCE.convert(group));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@Operation(summary = "获取会员分组精简信息列表", description = "只包含被开启的会员分组,主要用于前端的下拉选项")
|
||||
public CommonResult<List<MemberGroupSimpleRespVO>> getSimpleGroupList() {
|
||||
// 获用户列表,只要开启状态的
|
||||
List<MemberGroupDO> list = groupService.getEnableGroupList();
|
||||
return success(MemberGroupConvert.INSTANCE.convertSimpleList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户分组分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:group:query')")
|
||||
public CommonResult<PageResult<MemberGroupRespVO>> getGroupPage(@Valid MemberGroupPageReqVO pageVO) {
|
||||
PageResult<MemberGroupDO> pageResult = groupService.getGroupPage(pageVO);
|
||||
return success(MemberGroupConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.group.vo;
|
||||
|
||||
import com.fjrcloud.community.framework.common.enums.CommonStatusEnum;
|
||||
import com.fjrcloud.community.framework.common.validation.InEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 用户分组 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MemberGroupBaseVO {
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "购物达人")
|
||||
@NotNull(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.group.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 用户分组创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberGroupCreateReqVO extends MemberGroupBaseVO {
|
||||
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.group.vo;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户分组分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberGroupPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名称", example = "购物达人")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.group.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户分组 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberGroupRespVO extends MemberGroupBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20357")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.group.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 用户分组 Response VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class MemberGroupSimpleRespVO {
|
||||
|
||||
@Schema(description = "编号", example = "6103")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "等级名称", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.group.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 用户分组更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberGroupUpdateReqVO extends MemberGroupBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20357")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.framework.common.pojo.PageResult;
|
||||
import com.fjrcloud.community.module.member.controller.admin.level.vo.experience.MemberExperienceRecordPageReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.admin.level.vo.experience.MemberExperienceRecordRespVO;
|
||||
import com.fjrcloud.community.module.member.convert.level.MemberExperienceRecordConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.level.MemberExperienceRecordDO;
|
||||
import com.fjrcloud.community.module.member.service.level.MemberExperienceRecordService;
|
||||
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.validation.annotation.Validated;
|
||||
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.validation.Valid;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 会员经验记录")
|
||||
@RestController
|
||||
@RequestMapping("/member/experience-record")
|
||||
@Validated
|
||||
public class MemberExperienceRecordController {
|
||||
|
||||
@Resource
|
||||
private MemberExperienceRecordService experienceLogService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员经验记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:experience-record:query')")
|
||||
public CommonResult<MemberExperienceRecordRespVO> getExperienceRecord(@RequestParam("id") Long id) {
|
||||
MemberExperienceRecordDO experienceLog = experienceLogService.getExperienceRecord(id);
|
||||
return success(MemberExperienceRecordConvert.INSTANCE.convert(experienceLog));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员经验记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:experience-record:query')")
|
||||
public CommonResult<PageResult<MemberExperienceRecordRespVO>> getExperienceRecordPage(
|
||||
@Valid MemberExperienceRecordPageReqVO pageVO) {
|
||||
PageResult<MemberExperienceRecordDO> pageResult = experienceLogService.getExperienceRecordPage(pageVO);
|
||||
return success(MemberExperienceRecordConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.module.member.controller.admin.level.vo.level.*;
|
||||
import com.fjrcloud.community.module.member.convert.level.MemberLevelConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
import com.fjrcloud.community.module.member.service.level.MemberLevelService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 会员等级")
|
||||
@RestController
|
||||
@RequestMapping("/member/level")
|
||||
@Validated
|
||||
public class MemberLevelController {
|
||||
|
||||
@Resource
|
||||
private MemberLevelService levelService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建会员等级")
|
||||
@PreAuthorize("@ss.hasPermission('member:level:create')")
|
||||
public CommonResult<Long> createLevel(@Valid @RequestBody MemberLevelCreateReqVO createReqVO) {
|
||||
return success(levelService.createLevel(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新会员等级")
|
||||
@PreAuthorize("@ss.hasPermission('member:level:update')")
|
||||
public CommonResult<Boolean> updateLevel(@Valid @RequestBody MemberLevelUpdateReqVO updateReqVO) {
|
||||
levelService.updateLevel(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除会员等级")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('member:level:delete')")
|
||||
public CommonResult<Boolean> deleteLevel(@RequestParam("id") Long id) {
|
||||
levelService.deleteLevel(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员等级")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:level:query')")
|
||||
public CommonResult<MemberLevelRespVO> getLevel(@RequestParam("id") Long id) {
|
||||
MemberLevelDO level = levelService.getLevel(id);
|
||||
return success(MemberLevelConvert.INSTANCE.convert(level));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@Operation(summary = "获取会员等级精简信息列表", description = "只包含被开启的会员等级,主要用于前端的下拉选项")
|
||||
public CommonResult<List<MemberLevelSimpleRespVO>> getSimpleLevelList() {
|
||||
// 获用户列表,只要开启状态的
|
||||
List<MemberLevelDO> list = levelService.getEnableLevelList();
|
||||
// 排序后,返回给前端
|
||||
return success(MemberLevelConvert.INSTANCE.convertSimpleList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得会员等级列表")
|
||||
@PreAuthorize("@ss.hasPermission('member:level:query')")
|
||||
public CommonResult<List<MemberLevelRespVO>> getLevelList(@Valid MemberLevelListReqVO listReqVO) {
|
||||
List<MemberLevelDO> result = levelService.getLevelList(listReqVO);
|
||||
return success(MemberLevelConvert.INSTANCE.convertList(result));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.framework.common.pojo.PageResult;
|
||||
import com.fjrcloud.community.module.member.controller.admin.level.vo.record.MemberLevelRecordPageReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.admin.level.vo.record.MemberLevelRecordRespVO;
|
||||
import com.fjrcloud.community.module.member.convert.level.MemberLevelRecordConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.level.MemberLevelRecordDO;
|
||||
import com.fjrcloud.community.module.member.service.level.MemberLevelRecordService;
|
||||
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.validation.annotation.Validated;
|
||||
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.validation.Valid;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 会员等级记录")
|
||||
@RestController
|
||||
@RequestMapping("/member/level-record")
|
||||
@Validated
|
||||
public class MemberLevelRecordController {
|
||||
|
||||
@Resource
|
||||
private MemberLevelRecordService levelLogService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员等级记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:level-record:query')")
|
||||
public CommonResult<MemberLevelRecordRespVO> getLevelRecord(@RequestParam("id") Long id) {
|
||||
MemberLevelRecordDO levelLog = levelLogService.getLevelRecord(id);
|
||||
return success(MemberLevelRecordConvert.INSTANCE.convert(levelLog));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员等级记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:level-record:query')")
|
||||
public CommonResult<PageResult<MemberLevelRecordRespVO>> getLevelRecordPage(
|
||||
@Valid MemberLevelRecordPageReqVO pageVO) {
|
||||
PageResult<MemberLevelRecordDO> pageResult = levelLogService.getLevelRecordPage(pageVO);
|
||||
return success(MemberLevelRecordConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.experience;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 会员经验记录 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MemberExperienceRecordBaseVO {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3638")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "业务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12164")
|
||||
@NotNull(message = "业务编号不能为空")
|
||||
private String bizId;
|
||||
|
||||
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "业务类型不能为空")
|
||||
private Integer bizType;
|
||||
|
||||
@Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "增加经验")
|
||||
@NotNull(message = "标题不能为空")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
@NotNull(message = "经验不能为空")
|
||||
private Integer experience;
|
||||
|
||||
@Schema(description = "变更后的经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
@NotNull(message = "变更后的经验不能为空")
|
||||
private Integer totalExperience;
|
||||
|
||||
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "下单增加 100 经验")
|
||||
@NotNull(message = "描述不能为空")
|
||||
private String description;
|
||||
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.experience;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 会员经验记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberExperienceRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户编号", example = "3638")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "业务编号", example = "12164")
|
||||
private String bizId;
|
||||
|
||||
@Schema(description = "业务类型", example = "1")
|
||||
private Integer bizType;
|
||||
|
||||
@Schema(description = "标题", example = "增加经验")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.experience;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 会员经验记录 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberExperienceRecordRespVO extends MemberExperienceRecordBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19610")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.level;
|
||||
|
||||
import com.fjrcloud.community.framework.common.enums.CommonStatusEnum;
|
||||
import com.fjrcloud.community.framework.common.validation.InEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Positive;
|
||||
|
||||
/**
|
||||
* 会员等级 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MemberLevelBaseVO {
|
||||
|
||||
@Schema(description = "等级名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@NotBlank(message = "等级名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "升级经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
@NotNull(message = "升级经验不能为空")
|
||||
@Positive(message = "升级经验必须大于 0")
|
||||
private Integer experience;
|
||||
|
||||
@Schema(description = "等级", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "等级不能为空")
|
||||
@Positive(message = "等级必须大于 0")
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "享受折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "98")
|
||||
@NotNull(message = "享受折扣不能为空")
|
||||
@Range(min = 0, max = 100, message = "享受折扣的范围为 0-100")
|
||||
private Integer discountPercent;
|
||||
|
||||
@Schema(description = "等级图标", example = "https://www.iocoder.cn/yudao.jpg")
|
||||
@URL(message = "等级图标必须是 URL 格式")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "等级背景图", example = "https://www.iocoder.cn/yudao.jpg")
|
||||
@URL(message = "等级背景图必须是 URL 格式")
|
||||
private String backgroundUrl;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.level;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 会员等级创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberLevelCreateReqVO extends MemberLevelBaseVO {
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.level;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 会员等级列表筛选 Request VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class MemberLevelListReqVO {
|
||||
|
||||
@Schema(description = "等级名称", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.level;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 会员等级 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberLevelRespVO extends MemberLevelBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6103")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.level;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 会员等级 Response VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class MemberLevelSimpleRespVO {
|
||||
|
||||
@Schema(description = "编号", example = "6103")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "等级名称", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "等级图标", example = "https://www.iocoder.cn/yudao.jpg")
|
||||
private String icon;
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.level;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 会员等级更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberLevelUpdateReqVO extends MemberLevelBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6103")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.record;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 会员等级记录 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MemberLevelRecordBaseVO {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25923")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "等级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25985")
|
||||
@NotNull(message = "等级编号不能为空")
|
||||
private Long levelId;
|
||||
|
||||
@Schema(description = "会员等级", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "会员等级不能为空")
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "享受折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
||||
@NotNull(message = "享受折扣不能为空")
|
||||
private Integer discountPercent;
|
||||
|
||||
@Schema(description = "升级经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
||||
@NotNull(message = "升级经验不能为空")
|
||||
private Integer experience;
|
||||
|
||||
@Schema(description = "会员此时的经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
||||
@NotNull(message = "会员此时的经验不能为空")
|
||||
private Integer userExperience;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "推广需要")
|
||||
@NotNull(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "升级为金牌会员")
|
||||
@NotNull(message = "描述不能为空")
|
||||
private String description;
|
||||
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.record;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 会员等级记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberLevelRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户编号", example = "25923")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "等级编号", example = "25985")
|
||||
private Long levelId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.level.vo.record;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 会员等级记录 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberLevelRecordRespVO extends MemberLevelRecordBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8741")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.point;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.framework.common.pojo.PageResult;
|
||||
import com.fjrcloud.community.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO;
|
||||
import com.fjrcloud.community.module.member.convert.point.MemberPointRecordConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.member.service.point.MemberPointRecordService;
|
||||
import com.fjrcloud.community.module.member.service.user.MemberUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
import static com.fjrcloud.community.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
|
||||
@Tag(name = "管理后台 - 签到记录")
|
||||
@RestController
|
||||
@RequestMapping("/member/point/record")
|
||||
@Validated
|
||||
public class MemberPointRecordController {
|
||||
|
||||
@Resource
|
||||
private MemberPointRecordService pointRecordService;
|
||||
|
||||
@Resource
|
||||
private MemberUserService memberUserService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户积分记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:query')")
|
||||
public CommonResult<PageResult<MemberPointRecordRespVO>> getPointRecordPage(@Valid MemberPointRecordPageReqVO pageVO) {
|
||||
// 执行分页查询
|
||||
PageResult<MemberPointRecordDO> pageResult = pointRecordService.getPointRecordPage(pageVO);
|
||||
if (CollectionUtils.isEmpty(pageResult.getList())) {
|
||||
return success(PageResult.empty(pageResult.getTotal()));
|
||||
}
|
||||
|
||||
// 拼接结果返回
|
||||
List<MemberUserDO> users = memberUserService.getUserList(
|
||||
convertSet(pageResult.getList(), MemberPointRecordDO::getUserId));
|
||||
return success(MemberPointRecordConvert.INSTANCE.convertPage(pageResult, users));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.point.vo.recrod;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 用户积分记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberPointRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户昵称", example = "张三")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "用户编号", example = "123")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "业务类型", example = "1")
|
||||
private Integer bizType;
|
||||
|
||||
@Schema(description = "积分标题", example = "呵呵")
|
||||
private String title;
|
||||
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.point.vo.recrod;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户积分记录 Response VO")
|
||||
@Data
|
||||
public class MemberPointRecordRespVO {
|
||||
|
||||
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "昵称", example = "张三")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "业务编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "22706")
|
||||
private String bizId;
|
||||
|
||||
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer bizType;
|
||||
|
||||
@Schema(description = "积分标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "积分描述", example = "你猜")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer point;
|
||||
|
||||
@Schema(description = "变动后的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private Integer totalPoint;
|
||||
|
||||
@Schema(description = "发生时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.signin;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.module.member.controller.admin.signin.vo.config.MemberSignInConfigCreateReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.admin.signin.vo.config.MemberSignInConfigRespVO;
|
||||
import com.fjrcloud.community.module.member.controller.admin.signin.vo.config.MemberSignInConfigUpdateReqVO;
|
||||
import com.fjrcloud.community.module.member.convert.signin.MemberSignInConfigConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||
import com.fjrcloud.community.module.member.service.signin.MemberSignInConfigService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
|
||||
// TODO 芋艿:url
|
||||
@Tag(name = "管理后台 - 签到规则")
|
||||
@RestController
|
||||
@RequestMapping("/member/sign-in/config")
|
||||
@Validated
|
||||
public class MemberSignInConfigController {
|
||||
|
||||
@Resource
|
||||
private MemberSignInConfigService signInConfigService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建签到规则")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:create')")
|
||||
public CommonResult<Long> createSignInConfig(@Valid @RequestBody MemberSignInConfigCreateReqVO createReqVO) {
|
||||
return success(signInConfigService.createSignInConfig(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新签到规则")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:update')")
|
||||
public CommonResult<Boolean> updateSignInConfig(@Valid @RequestBody MemberSignInConfigUpdateReqVO updateReqVO) {
|
||||
signInConfigService.updateSignInConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除签到规则")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:delete')")
|
||||
public CommonResult<Boolean> deleteSignInConfig(@RequestParam("id") Long id) {
|
||||
signInConfigService.deleteSignInConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得签到规则")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
|
||||
public CommonResult<MemberSignInConfigRespVO> getSignInConfig(@RequestParam("id") Long id) {
|
||||
MemberSignInConfigDO signInConfig = signInConfigService.getSignInConfig(id);
|
||||
return success(MemberSignInConfigConvert.INSTANCE.convert(signInConfig));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得签到规则列表")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
|
||||
public CommonResult<List<MemberSignInConfigRespVO>> getSignInConfigList() {
|
||||
List<MemberSignInConfigDO> list = signInConfigService.getSignInConfigList();
|
||||
return success(MemberSignInConfigConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.signin;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.CommonResult;
|
||||
import com.fjrcloud.community.framework.common.pojo.PageResult;
|
||||
import com.fjrcloud.community.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
||||
import com.fjrcloud.community.module.member.controller.admin.signin.vo.record.MemberSignInRecordRespVO;
|
||||
import com.fjrcloud.community.module.member.convert.signin.MemberSignInRecordConvert;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||
import com.fjrcloud.community.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import com.fjrcloud.community.module.member.service.signin.MemberSignInRecordService;
|
||||
import com.fjrcloud.community.module.member.service.user.MemberUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.pojo.CommonResult.success;
|
||||
import static com.fjrcloud.community.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
|
||||
@Tag(name = "管理后台 - 签到记录")
|
||||
@RestController
|
||||
@RequestMapping("/member/sign-in/record")
|
||||
@Validated
|
||||
public class MemberSignInRecordController {
|
||||
|
||||
@Resource
|
||||
private MemberSignInRecordService signInRecordService;
|
||||
|
||||
@Resource
|
||||
private MemberUserService memberUserService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得签到记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
|
||||
public CommonResult<PageResult<MemberSignInRecordRespVO>> getSignInRecordPage(@Valid MemberSignInRecordPageReqVO pageVO) {
|
||||
// 执行分页查询
|
||||
PageResult<MemberSignInRecordDO> pageResult = signInRecordService.getSignInRecordPage(pageVO);
|
||||
if (CollectionUtils.isEmpty(pageResult.getList())) {
|
||||
return success(PageResult.empty(pageResult.getTotal()));
|
||||
}
|
||||
|
||||
// 拼接结果返回
|
||||
List<MemberUserDO> users = memberUserService.getUserList(
|
||||
convertSet(pageResult.getList(), MemberSignInRecordDO::getUserId));
|
||||
return success(MemberSignInRecordConvert.INSTANCE.convertPage(pageResult, users));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.signin.vo.config;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.fjrcloud.community.framework.common.enums.CommonStatusEnum;
|
||||
import com.fjrcloud.community.framework.common.validation.InEnum;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.AssertTrue;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.PositiveOrZero;
|
||||
|
||||
/**
|
||||
* 签到规则 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MemberSignInConfigBaseVO {
|
||||
|
||||
@Schema(description = "签到第 x 天", requiredMode = Schema.RequiredMode.REQUIRED, example = "7")
|
||||
@NotNull(message = "签到天数不能为空")
|
||||
private Integer day;
|
||||
|
||||
@Schema(description = "奖励积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
@NotNull(message = "奖励积分不能为空")
|
||||
@PositiveOrZero(message = "奖励积分不能小于 0")
|
||||
private Integer point;
|
||||
|
||||
@Schema(description = "奖励经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
@NotNull(message = "奖励经验不能为空")
|
||||
@PositiveOrZero(message = "奖励经验不能小于 0")
|
||||
private Integer experience;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
private Integer status;
|
||||
|
||||
@AssertTrue(message = "签到奖励积分和经验不能同时为空")
|
||||
@JsonIgnore
|
||||
public boolean isConfigAward() {
|
||||
return ObjUtil.notEqual(point, 0) || ObjUtil.notEqual(experience, 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.signin.vo.config;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "管理后台 - 签到规则创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberSignInConfigCreateReqVO extends MemberSignInConfigBaseVO {
|
||||
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.signin.vo.config;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 签到规则 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberSignInConfigRespVO extends MemberSignInConfigBaseVO {
|
||||
|
||||
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.signin.vo.config;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 签到规则更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberSignInConfigUpdateReqVO extends MemberSignInConfigBaseVO {
|
||||
|
||||
@Schema(description = "规则自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13653")
|
||||
@NotNull(message = "规则自增主键不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
package com.fjrcloud.community.module.member.controller.admin.signin.vo.record;
|
||||
|
||||
import com.fjrcloud.community.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.fjrcloud.community.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 签到记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberSignInRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "签到用户", example = "土豆")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "第几天签到", example = "10")
|
||||
private Integer day;
|
||||
|
||||
@Schema(description = "用户编号", example = "123")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "签到时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue