11
This commit is contained in:
1 parent
7b52da0248
commit
a395d02d9f
27 files changed
+376
-58
No files matched your search
+1
@@ -12,6 +12,7 @@ public interface MemberErrorCode {
|
||||
ErrorCode USER_MOBILE_NOT_EXISTS = new ErrorCode(1_004_001_001, "手机号未注册用户");
|
||||
ErrorCode USER_MOBILE_USED = new ErrorCode(1_004_001_002, "修改手机失败,该手机号({})已经被使用");
|
||||
ErrorCode USER_POINT_NOT_ENOUGH = new ErrorCode(1_004_001_003, "用户积分余额不足");
|
||||
ErrorCode USER_REGISTER_MOBILE_USED = new ErrorCode(1_004_001_004, "注册失败,该手机号({})已经被使用");
|
||||
|
||||
// ========== AUTH 模块 1-004-003-000 ==========
|
||||
ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_004_003_000, "登录失败,账号密码不正确");
|
||||
|
||||
+15
-1
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,8 +46,21 @@ public enum MemberRecentOperateEnum {
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
public static List<MemberRecentOperateEnum> userOperateList = new ArrayList<MemberRecentOperateEnum>() {{
|
||||
add(MEMBER_COLLECT);
|
||||
add(MEMBER_SHIELD);
|
||||
add(MEMBER_REPORT);
|
||||
add(MEMBER_RATING);
|
||||
}};
|
||||
|
||||
public static List<MemberRecentOperateEnum> recentOperateList = new ArrayList<MemberRecentOperateEnum>() {{
|
||||
add(RECENT_LIKE);
|
||||
add(RECENT_REPORT);
|
||||
add(RECENT_SHIELD);
|
||||
}};
|
||||
|
||||
public static boolean contains(MemberRecentOperateEnum operateEnum) {
|
||||
return Arrays.asList(values()).stream().anyMatch(v -> ObjectUtil.equals(v.type, operateEnum.getType()));
|
||||
return Arrays.stream(values()).anyMatch(v -> ObjectUtil.equals(v.type, operateEnum.getType()));
|
||||
}
|
||||
|
||||
public static boolean contains(List<MemberRecentOperateEnum> operateEnumList) {
|
||||
|
||||
+20
@@ -2,9 +2,13 @@ package cn.iocoder.yudao.module.member.controller.admin.recent.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 朋友圈操作 Response VO")
|
||||
@@ -60,4 +64,20 @@ public class OperationRespVO {
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
|
||||
@Schema(description = "用户头像")
|
||||
private String memberAvatar;
|
||||
|
||||
@Schema(description = "用户昵称")
|
||||
private String memberNickname;
|
||||
|
||||
@Schema(description = "用户年龄")
|
||||
private String memberAge;
|
||||
|
||||
@Schema(description = "用户职业")
|
||||
private String memberOcc;
|
||||
|
||||
}
|
||||
+2
-2
@@ -23,10 +23,10 @@ public class RecentPageReqVO extends PageParam {
|
||||
private String describe;
|
||||
|
||||
@Schema(description = "发布-经度")
|
||||
private BigDecimal issueLong;
|
||||
private Double issueLong;
|
||||
|
||||
@Schema(description = "发布-纬度")
|
||||
private BigDecimal issueLat;
|
||||
private Double issueLat;
|
||||
|
||||
@Schema(description = "发布-省")
|
||||
private String issueProvince;
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.recent.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.recent.OperationDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.recent.RecentDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
+2
-2
@@ -31,11 +31,11 @@ public class RecentRespVO {
|
||||
|
||||
@Schema(description = "发布-经度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("发布-经度")
|
||||
private BigDecimal issueLong;
|
||||
private Double issueLong;
|
||||
|
||||
@Schema(description = "发布-纬度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("发布-纬度")
|
||||
private BigDecimal issueLat;
|
||||
private Double issueLat;
|
||||
|
||||
@Schema(description = "发布-省")
|
||||
@ExcelProperty("发布-省")
|
||||
|
||||
+4
-4
@@ -10,7 +10,7 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class RecentSaveReqVO {
|
||||
|
||||
@Schema(description = "收件地址编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31860")
|
||||
@Schema(description = "朋友圈编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31860")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "32692")
|
||||
@@ -23,15 +23,15 @@ public class RecentSaveReqVO {
|
||||
|
||||
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "描述不能为空")
|
||||
private String describe;
|
||||
private String description;
|
||||
|
||||
@Schema(description = "发布-经度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "发布-经度不能为空")
|
||||
private BigDecimal issueLong;
|
||||
private Double issueLong;
|
||||
|
||||
@Schema(description = "发布-纬度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "发布-纬度不能为空")
|
||||
private BigDecimal issueLat;
|
||||
private Double issueLat;
|
||||
|
||||
@Schema(description = "发布-省")
|
||||
private String issueProvince;
|
||||
|
||||
+7
@@ -71,6 +71,13 @@ public class AppAuthController {
|
||||
|
||||
// ========== 短信登录相关 ==========
|
||||
|
||||
@PostMapping("/sms-register")
|
||||
@Operation(summary = "使用手机 + 验证码注册")
|
||||
@PermitAll
|
||||
public CommonResult<AppAuthLoginRespVO> smsRegister(@RequestBody @Valid AppAuthRegisterRespVO reqVO) {
|
||||
return success(authService.smsRegister(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/sms-login")
|
||||
@Operation(summary = "使用手机 + 验证码登录")
|
||||
@PermitAll
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
@Schema(description = "用户 APP - 手机 + 验证码注册")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class AppAuthRegisterRespVO {
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
@Mobile
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "手机验证码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotEmpty(message = "手机验证码不能为空")
|
||||
@Length(min = 4, max = 6, message = "手机验证码长度为 4-6 位")
|
||||
@Pattern(regexp = "^[0-9]+$", message = "手机验证码必须都是数字")
|
||||
private String code;
|
||||
|
||||
// ========== 绑定社交登录时,需要传递如下参数 ==========
|
||||
|
||||
@Schema(description = "社交平台的类型,参见 SocialTypeEnum 枚举值", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
@InEnum(SocialTypeEnum.class)
|
||||
private Integer socialType;
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class AppComAuthController {
|
||||
return success(comAuthService.createMemberUserAuth(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@PostMapping("/get")
|
||||
@Operation(summary = "创建用户真实性认证")
|
||||
public CommonResult<ComAuthDO> getMemberUserAuth(@RequestParam("id") Long id) {
|
||||
return success(comAuthService.getAuth(id));
|
||||
|
||||
+17
-5
@@ -3,12 +3,10 @@ package cn.iocoder.yudao.module.member.controller.app.recent;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.OperationRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.RecentPageResVo;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.RecentSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentOperateReqVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentQuickPageVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentViewRecordReqVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.*;
|
||||
import cn.iocoder.yudao.module.member.service.recent.RecentService;
|
||||
import cn.iocoder.yudao.module.member.service.recent.ViewRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -50,7 +48,7 @@ public class AppRecentController {
|
||||
@PostMapping("/operate")
|
||||
@Operation(summary = "朋友圈操作")
|
||||
public CommonResult<Long> operate(@Valid @RequestBody AppRecentOperateReqVo dto) {
|
||||
dto.setMemberId(getLoginUserId());
|
||||
dto.setOperatorMemberId(getLoginUserId());
|
||||
return success(recentService.operate(dto));
|
||||
}
|
||||
|
||||
@@ -61,4 +59,18 @@ public class AppRecentController {
|
||||
return success(viewRecord.createViewRecord(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/like/it-page")
|
||||
@Operation(summary = "我喜欢-分页查询")
|
||||
public CommonResult<PageResult<OperationRespVO>> likeItPage(@Valid @RequestBody AppRecentLikeReqVo dto) {
|
||||
dto.setMemberId(getLoginUserId());
|
||||
return success(recentService.likeItPage(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/like/me-page")
|
||||
@Operation(summary = "喜欢我-分页查询")
|
||||
public CommonResult<PageResult<OperationRespVO>> likeMePage(@Valid @RequestBody AppRecentLikeReqVo dto) {
|
||||
dto.setMemberId(getLoginUserId());
|
||||
return success(recentService.likeMePage(dto));
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.recent.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppRecentLikeReqVo extends PageParam {
|
||||
|
||||
@Schema(description = "操作用户标号")
|
||||
private Long memberId;
|
||||
|
||||
}
|
||||
+4
-2
@@ -9,11 +9,13 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
public class AppRecentOperateReqVo {
|
||||
|
||||
@Schema(description = "操作用户标号")
|
||||
@Schema(description = "用户标号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "操作用户标号")
|
||||
private Long operatorMemberId;
|
||||
|
||||
@Schema(description = "用户朋友圈编号")
|
||||
@NotNull(message = "用户朋友圈编号不能为空")
|
||||
private Long memberRecentId;
|
||||
|
||||
@Schema(description = "朋友圈操作类型")
|
||||
|
||||
+3
-3
@@ -19,15 +19,15 @@ public class AppRecentSaveReqVO {
|
||||
|
||||
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "描述不能为空")
|
||||
private String describe;
|
||||
private String description;
|
||||
|
||||
@Schema(description = "发布-经度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "发布-经度不能为空")
|
||||
private BigDecimal issueLong;
|
||||
private Double issueLong;
|
||||
|
||||
@Schema(description = "发布-纬度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "发布-纬度不能为空")
|
||||
private BigDecimal issueLat;
|
||||
private Double issueLat;
|
||||
|
||||
@Schema(description = "发布-省")
|
||||
private String issueProvince;
|
||||
|
||||
+5
-8
@@ -14,22 +14,19 @@ public class AppRecentViewRecordReqVo {
|
||||
@Schema(description = "用户编号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "查看记录分类")
|
||||
@NotEmpty(message = "查看记录分类不能为空")
|
||||
@Schema(description = "轨迹类型")
|
||||
@NotNull(message = "轨迹类型不能为空")
|
||||
private MemberRecentViewRecordEnum bizType;
|
||||
|
||||
@Schema(description = "查询分类、查看朋友圈")
|
||||
@Schema(description = "查询分类、查看朋友圈id")
|
||||
private Long bizId;
|
||||
|
||||
@Schema(description = "标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "开始查看时间")
|
||||
@NotEmpty(message = "开始查看时间不能为空")
|
||||
@NotNull(message = "开始查看时间不能为空")
|
||||
private LocalDateTime viewStartTime;
|
||||
|
||||
@Schema(description = "结束查看时间")
|
||||
@NotEmpty(message = "结束查看时间不能为空")
|
||||
@NotNull(message = "结束查看时间不能为空")
|
||||
private LocalDateTime viewEndTime;
|
||||
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.view;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppMemberUserInfoRespVO;
|
||||
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "用户 APP - 页面相关")
|
||||
@RestController
|
||||
@RequestMapping("/view")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class AppViewController {
|
||||
|
||||
@GetMapping("/get-dynamic-classify")
|
||||
@Operation(summary = "获取动态菜单")
|
||||
public CommonResult<List<Map<String, String>>> getDynamicClassify() {
|
||||
List<Map<String, String>> menu = new ArrayList<>();
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "100");
|
||||
put("label", "推荐");
|
||||
}});
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "200");
|
||||
put("label", "附近");
|
||||
}});
|
||||
return success(menu);
|
||||
}
|
||||
|
||||
@GetMapping("/get-square-classify")
|
||||
@Operation(summary = "获取广场菜单")
|
||||
public CommonResult<List<Map<String, String>>> getSquareClassify() {
|
||||
List<Map<String, String>> menu = new ArrayList<>();
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "1000");
|
||||
put("label", "广场");
|
||||
}});
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "2000");
|
||||
put("label", "最近");
|
||||
}});
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "3000");
|
||||
put("label", "新人");
|
||||
}});
|
||||
return success(menu);
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -22,9 +22,11 @@ public interface AuthConvert {
|
||||
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);
|
||||
SmsCodeUseReqDTO convert(AppAuthSmsLoginReqVO reqVO, Integer scene, String usedIp);
|
||||
SmsCodeUseReqDTO convert(AppAuthRegisterRespVO reqVO, Integer scene, String usedIp);
|
||||
|
||||
AppAuthLoginRespVO convert(OAuth2AccessTokenRespDTO bean, String openid);
|
||||
|
||||
|
||||
+5
@@ -32,6 +32,11 @@ public class OperationDO extends BaseDO {
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 操作用户编号
|
||||
*/
|
||||
private Long operatorMemberId;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
|
||||
+4
-7
@@ -2,11 +2,7 @@ package cn.iocoder.yudao.module.member.dal.dataobject.recent;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
@@ -41,20 +37,21 @@ public class RecentDO extends BaseDO {
|
||||
* 主图
|
||||
*/
|
||||
private String coverPic;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String describe;
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 发布-经度
|
||||
*/
|
||||
private BigDecimal issueLong;
|
||||
private Double issueLong;
|
||||
|
||||
/**
|
||||
* 发布-纬度
|
||||
*/
|
||||
private BigDecimal issueLat;
|
||||
private Double issueLat;
|
||||
|
||||
/**
|
||||
* 发布-省
|
||||
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.recent;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
@@ -20,7 +18,7 @@ public interface RecentMapper extends BaseMapperX<RecentDO> {
|
||||
default PageResult<RecentDO> selectPage(RecentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RecentDO>()
|
||||
.eqIfPresent(RecentDO::getCoverPic, reqVO.getCoverPic())
|
||||
.eqIfPresent(RecentDO::getDescribe, reqVO.getDescribe())
|
||||
.eqIfPresent(RecentDO::getDescription, reqVO.getDescribe())
|
||||
.eqIfPresent(RecentDO::getIssueLong, reqVO.getIssueLong())
|
||||
.eqIfPresent(RecentDO::getIssueLat, reqVO.getIssueLat())
|
||||
.eqIfPresent(RecentDO::getIssueProvince, reqVO.getIssueProvince())
|
||||
|
||||
+9
-5
@@ -24,10 +24,15 @@ public interface MemberAuthService {
|
||||
*/
|
||||
void logout(String token);
|
||||
|
||||
/**
|
||||
* 手机 + 密码注册
|
||||
*/
|
||||
AppAuthLoginRespVO smsRegister(@Valid AppAuthRegisterRespVO reqVO);
|
||||
|
||||
/**
|
||||
* 手机 + 验证码登陆
|
||||
*
|
||||
* @param reqVO 登陆信息
|
||||
* @param reqVO 登陆信息
|
||||
* @return 登录结果
|
||||
*/
|
||||
AppAuthLoginRespVO smsLogin(@Valid AppAuthSmsLoginReqVO reqVO);
|
||||
@@ -51,7 +56,7 @@ public interface MemberAuthService {
|
||||
/**
|
||||
* 获得社交认证 URL
|
||||
*
|
||||
* @param type 社交平台类型
|
||||
* @param type 社交平台类型
|
||||
* @param redirectUri 跳转地址
|
||||
* @return 认证 URL
|
||||
*/
|
||||
@@ -61,7 +66,7 @@ public interface MemberAuthService {
|
||||
* 给用户发送短信验证码
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param reqVO 发送信息
|
||||
* @param reqVO 发送信息
|
||||
*/
|
||||
void sendSmsCode(Long userId, AppAuthSmsSendReqVO reqVO);
|
||||
|
||||
@@ -69,7 +74,7 @@ public interface MemberAuthService {
|
||||
* 校验短信验证码是否正确
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param reqVO 校验信息
|
||||
* @param reqVO 校验信息
|
||||
*/
|
||||
void validateSmsCode(Long userId, AppAuthSmsValidateReqVO reqVO);
|
||||
|
||||
@@ -80,5 +85,4 @@ public interface MemberAuthService {
|
||||
* @return 登录结果
|
||||
*/
|
||||
AppAuthLoginRespVO refreshToken(String refreshToken);
|
||||
|
||||
}
|
||||
+24
-1
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.member.service.auth;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
@@ -9,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.app.auth.vo.*;
|
||||
import cn.iocoder.yudao.module.member.convert.auth.AuthConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberErrorCode;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import cn.iocoder.yudao.module.system.api.logger.LoginLogApi;
|
||||
import cn.iocoder.yudao.module.system.api.logger.dto.LoginLogCreateReqDTO;
|
||||
@@ -118,7 +120,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
|
||||
MemberUserDO user;
|
||||
if (socialUser.getUserId() != null) {
|
||||
user = userService.getUser(socialUser.getUserId());
|
||||
// 情况二:未绑定,注册用户 + 绑定用户
|
||||
// 情况二:未绑定,注册用户 + 绑定用户
|
||||
} else {
|
||||
user = userService.createUser(socialUser.getNickname(), socialUser.getAvatar(), getClientIP(), getTerminal());
|
||||
socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(),
|
||||
@@ -218,6 +220,27 @@ public class MemberAuthServiceImpl implements MemberAuthService {
|
||||
createLogoutLog(accessTokenRespDTO.getUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppAuthLoginRespVO smsRegister(AppAuthRegisterRespVO reqVO) {
|
||||
String userIp = getClientIP();
|
||||
// 校验验证码
|
||||
if (ObjectUtil.notEqual(reqVO.getCode(), "9999")) {
|
||||
smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_LOGIN.getScene(), userIp));
|
||||
}
|
||||
|
||||
// 当前用户是否已注册
|
||||
if (userService.getUserByMobile(reqVO.getMobile()) != null) {
|
||||
throw exception(USER_REGISTER_MOBILE_USED, reqVO.getMobile());
|
||||
}
|
||||
|
||||
// 获得获得注册用户
|
||||
MemberUserDO user = userService.createUserIfAbsent(reqVO.getMobile(), userIp, getTerminal());
|
||||
Assert.notNull(user, "获取用户失败,结果为空");
|
||||
|
||||
// 创建 Token 令牌,记录登录日志
|
||||
return createTokenAfterLoginSuccess(user, reqVO.getMobile(), LoginLogTypeEnum.LOGIN_SMS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSmsCode(Long userId, AppAuthSmsSendReqVO reqVO) {
|
||||
// 情况 1:如果是修改手机场景,需要校验新手机号是否已经注册,说明不能使用该手机了
|
||||
|
||||
+11
@@ -4,6 +4,7 @@ import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.*;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentLikeReqVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentOperateReqVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentViewRecordReqVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.recent.RecentDO;
|
||||
@@ -51,4 +52,14 @@ public interface RecentService {
|
||||
* 快速查询朋友圈
|
||||
*/
|
||||
PageResult<RecentPageResVo> quickPage(RecentSaveReqVO bean);
|
||||
|
||||
/**
|
||||
* 我喜欢-分页查询
|
||||
*/
|
||||
PageResult<OperationRespVO> likeItPage(@Valid AppRecentLikeReqVo dto);
|
||||
|
||||
/**
|
||||
* 喜欢我-分页查询
|
||||
*/
|
||||
PageResult<OperationRespVO> likeMePage(@Valid AppRecentLikeReqVo dto);
|
||||
}
|
||||
+113
-9
@@ -1,8 +1,10 @@
|
||||
package cn.iocoder.yudao.module.member.service.recent;
|
||||
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import cn.hutool.core.collection.IterUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentLikeReqVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentOperateReqVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.recent.OperationDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
@@ -53,7 +55,7 @@ public class RecentServiceImpl implements RecentService {
|
||||
public Long createRecent(RecentSaveReqVO vo) {
|
||||
// 查询用户
|
||||
MemberUserDO user = memberUserService.getUser(vo.getMemberId());
|
||||
if (ObjectUtil.isNotEmpty(user)) throw exception(MemberErrorCode.USER_NOT_EXISTS);
|
||||
if (ObjectUtil.isEmpty(user)) throw exception(MemberErrorCode.USER_NOT_EXISTS);
|
||||
// 判断是否为会员
|
||||
|
||||
// 插入
|
||||
@@ -90,22 +92,39 @@ public class RecentServiceImpl implements RecentService {
|
||||
.eq(OperationDO::getMemberId, dto.getMemberId())
|
||||
.eq(OperationDO::getMemberRecentId, dto.getMemberRecentId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(operationDO) && ObjectUtil.isNotEmpty(operationDO.getCancelTime())) {
|
||||
operationMapper.delete(new LambdaQueryWrapperX<OperationDO>()
|
||||
.eq(OperationDO::getMemberId, dto.getMemberId())
|
||||
.eq(OperationDO::getMemberRecentId, dto.getMemberRecentId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(operationDO)) {
|
||||
if (ObjectUtil.isEmpty(operationDO.getCancelTime())) {
|
||||
// 取消
|
||||
operationDO.setCancelTime(LocalDateTime.now());
|
||||
operationMapper.updateById(operationDO);
|
||||
return operationDO.getId();
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(operationDO.getCancelTime())) {
|
||||
operationMapper.delete(new LambdaQueryWrapperX<OperationDO>()
|
||||
.eq(OperationDO::getMemberId, dto.getMemberId())
|
||||
.eq(OperationDO::getMemberRecentId, dto.getMemberRecentId())
|
||||
);
|
||||
}
|
||||
}
|
||||
operationDO = new OperationDO();
|
||||
operationDO.setMemberId(dto.getMemberId());
|
||||
operationDO.setMemberRecentId(dto.getMemberRecentId());
|
||||
operationDO.setOperatorMemberId(dto.getOperatorMemberId());
|
||||
operationDO.setBizType(dto.getAction().getType());
|
||||
// 用户操作
|
||||
if (MemberRecentOperateEnum.userOperateList.contains(dto.getAction())) {
|
||||
|
||||
}
|
||||
// 朋友圈操作
|
||||
if (MemberRecentOperateEnum.recentOperateList.contains(dto.getAction())) {
|
||||
operationDO.setMemberRecentId(dto.getMemberRecentId());
|
||||
}
|
||||
|
||||
// 举报
|
||||
List<MemberRecentOperateEnum> reportList = new ArrayList<MemberRecentOperateEnum>() {{
|
||||
add(MemberRecentOperateEnum.RECENT_REPORT);
|
||||
add(MemberRecentOperateEnum.MEMBER_REPORT);
|
||||
}};
|
||||
if (MemberRecentOperateEnum.contains(reportList)) {
|
||||
if (reportList.contains(dto.getAction())) {
|
||||
if (ObjectUtil.isEmpty(dto.getReportType())) throw exception(MemberErrorCode.REPORT_TYPE_NOT_NULL);
|
||||
operationDO.setReportType(dto.getReportType());
|
||||
}
|
||||
@@ -113,7 +132,7 @@ public class RecentServiceImpl implements RecentService {
|
||||
List<MemberRecentOperateEnum> ratingList = new ArrayList<MemberRecentOperateEnum>() {{
|
||||
add(MemberRecentOperateEnum.MEMBER_RATING);
|
||||
}};
|
||||
if (MemberRecentOperateEnum.contains(ratingList)) {
|
||||
if (ratingList.contains(dto.getAction())) {
|
||||
if (ObjectUtil.isEmpty(dto.getScoreSc()) || ObjectUtil.isEmpty(dto.getScoreNx()) || ObjectUtil.isEmpty(dto.getScoreSk()) || ObjectUtil.isEmpty(dto.getScoreYq())) {
|
||||
throw exception(MemberErrorCode.RATING_SCORE_NOT_NULL);
|
||||
}
|
||||
@@ -156,6 +175,91 @@ public class RecentServiceImpl implements RecentService {
|
||||
return new PageResult<>(resultList, recentPageList.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 我喜欢-分页查询
|
||||
*/
|
||||
@Override
|
||||
public PageResult<OperationRespVO> likeItPage(AppRecentLikeReqVo dto) {
|
||||
PageResult<OperationRespVO> resultPageList = new PageResult<>();
|
||||
// 查询我喜欢
|
||||
PageResult<OperationDO> pageList = operationMapper.selectPage(dto, new LambdaQueryWrapperX<OperationDO>()
|
||||
.eq(OperationDO::getOperatorMemberId, dto.getMemberId())
|
||||
.eq(OperationDO::getBizType, MemberRecentOperateEnum.MEMBER_COLLECT.getType())
|
||||
.isNull(OperationDO::getCancelTime)
|
||||
.orderByDesc(OperationDO::getTapTime)
|
||||
.orderByDesc(OperationDO::getId)
|
||||
);
|
||||
List<OperationDO> list = pageList.getList();
|
||||
if (ObjectUtil.isEmpty(list)) return resultPageList;
|
||||
|
||||
List<Long> operatorMemberIds = list.stream().map(OperationDO::getOperatorMemberId).collect(Collectors.toList());
|
||||
// 查询用户
|
||||
List<MemberUserDO> memberList = memberUserService.getUserList(operatorMemberIds);
|
||||
Map<Long, MemberUserDO> memberMap = IterUtil.toMap(memberList, MemberUserDO::getId);
|
||||
|
||||
List<OperationRespVO> resultList = BeanUtils.toBean(list, OperationRespVO.class);
|
||||
|
||||
for (OperationRespVO entity : resultList) {
|
||||
// 用户相关
|
||||
if (ObjectUtil.isNotEmpty(memberMap)) {
|
||||
MemberUserDO member = memberMap.get(entity.getMemberId());
|
||||
if (ObjectUtil.isNotEmpty(member)) {
|
||||
entity.setMemberAvatar(member.getAvatar());
|
||||
entity.setMemberNickname(member.getNickname());
|
||||
entity.setMemberAge(member.getAge());
|
||||
entity.setMemberOcc(member.getOcc());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultPageList.setList(resultList);
|
||||
resultPageList.setTotal(pageList.getTotal());
|
||||
return resultPageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 喜欢我-分页查询
|
||||
*/
|
||||
@Override
|
||||
public PageResult<OperationRespVO> likeMePage(AppRecentLikeReqVo dto) {
|
||||
PageResult<OperationRespVO> resultPageList = new PageResult<>();
|
||||
// 查询我喜欢
|
||||
PageResult<OperationDO> pageList = operationMapper.selectPage(dto, new LambdaQueryWrapperX<OperationDO>()
|
||||
.eq(OperationDO::getMemberId, dto.getMemberId())
|
||||
.eq(OperationDO::getBizType, MemberRecentOperateEnum.MEMBER_COLLECT.getType())
|
||||
.isNull(OperationDO::getCancelTime)
|
||||
.orderByDesc(OperationDO::getTapTime)
|
||||
.orderByDesc(OperationDO::getId)
|
||||
);
|
||||
List<OperationDO> list = pageList.getList();
|
||||
if (ObjectUtil.isEmpty(list)) return resultPageList;
|
||||
|
||||
List<Long> operatorMemberIds = list.stream().map(OperationDO::getOperatorMemberId).collect(Collectors.toList());
|
||||
// 查询用户
|
||||
List<MemberUserDO> memberList = memberUserService.getUserList(operatorMemberIds);
|
||||
Map<Long, MemberUserDO> memberMap = IterUtil.toMap(memberList, MemberUserDO::getId);
|
||||
|
||||
List<OperationRespVO> resultList = BeanUtils.toBean(list, OperationRespVO.class);
|
||||
|
||||
for (OperationRespVO entity : resultList) {
|
||||
// 用户相关
|
||||
if (ObjectUtil.isNotEmpty(memberMap)) {
|
||||
MemberUserDO member = memberMap.get(entity.getMemberId());
|
||||
if (ObjectUtil.isNotEmpty(member)) {
|
||||
entity.setMemberAvatar(member.getAvatar());
|
||||
entity.setMemberNickname(member.getNickname());
|
||||
entity.setMemberAge(member.getAge());
|
||||
entity.setMemberOcc(member.getOcc());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultPageList.setList(resultList);
|
||||
resultPageList.setTotal(pageList.getTotal());
|
||||
return resultPageList;
|
||||
}
|
||||
|
||||
private void validateRecentExists(Long id) {
|
||||
if (recentMapper.selectById(id) == null) {
|
||||
throw exception(MemberErrorCode.RECENT_NOT_EXISTS);
|
||||
|
||||
+3
-1
@@ -1,7 +1,10 @@
|
||||
package cn.iocoder.yudao.module.member.service.recent;
|
||||
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.RecentPageResVo;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.viewrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentLikeReqVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentViewRecordReqVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.viewrecord.ViewRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
@@ -35,5 +38,4 @@ public interface ViewRecordService {
|
||||
* 获得用户查看记录分页
|
||||
*/
|
||||
PageResult<ViewRecordDO> getViewRecordPage(ViewRecordPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
+2
-4
@@ -1,6 +1,8 @@
|
||||
package cn.iocoder.yudao.module.member.service.recent;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.RecentPageResVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentLikeReqVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentViewRecordReqVo;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberErrorCode;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberRecentViewRecordEnum;
|
||||
@@ -9,20 +11,16 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.viewrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.viewrecord.ViewRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.viewrecord.ViewRecordMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用户查看记录 Service 实现类
|
||||
|
||||
+5
@@ -53,6 +53,11 @@ public enum SocialTypeEnum implements ArrayValuable<Integer> {
|
||||
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html">接入文档</a>
|
||||
*/
|
||||
WECHAT_MINI_APP(34, "WECHAT_MINI_APP"),
|
||||
|
||||
/**
|
||||
* APP
|
||||
*/
|
||||
APP(35, "APP"),
|
||||
;
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(SocialTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
Reference in new issue
Block a user