feat:很多东西
This commit is contained in:
1 parent
a395d02d9f
commit
45d6e2b1ce
30 files changed
+990
-47
No files matched your search
@@ -93,4 +93,29 @@ CREATE TABLE `member_com_auth`
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户通用认证';
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户通用认证';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for member_photo
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `member_photo`;
|
||||
CREATE TABLE `member_photo`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户相册id',
|
||||
`biz_type` varchar(32) NOT NULL COMMENT '上传途径',
|
||||
`address` bigint NOT NULL COMMENT '资源地址',
|
||||
`tag-json` varchar(512) DEFAULT NULL COMMENT 'tag-json',
|
||||
`issue_long` double precision DEFAULT NULL COMMENT '发布-经度',
|
||||
`issue_lat` double precision DEFAULT NULL COMMENT '发布-纬度',
|
||||
`issue_province` varchar(64) DEFAULT NULL COMMENT '发布-省',
|
||||
`issue_city` varchar(64) DEFAULT NULL COMMENT '发布-市',
|
||||
`issue_district` varchar(64) DEFAULT NULL COMMENT '发布-区',
|
||||
`issue_address` varchar(256) DEFAULT NULL COMMENT '发布-详细地址',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户相册';
|
||||
+4
@@ -61,4 +61,8 @@ public interface MemberErrorCode {
|
||||
ErrorCode RATING_SCORE_NOT_NULL = new ErrorCode(2_001_000_003, "评价分数不能为空");
|
||||
ErrorCode VIEW_RECORD_NOT_EXISTS = new ErrorCode(2_001_000_004, "用户查看记录不存在");
|
||||
ErrorCode COM_AUTH_NOT_EXISTS = new ErrorCode(2_001_000_005, "通用认证不存在");
|
||||
|
||||
//========== 用户图片、视频资源管理 1-004-013-000 ==========
|
||||
ErrorCode PHOTO_NOT_EXISTS = new ErrorCode(1_004_013_000, "用户资源不存在");
|
||||
ErrorCode PHOTO_TYPE_NOT_SUPPORT = new ErrorCode(1_004_013_001, "只有[{}]能删除");
|
||||
}
|
||||
+1
@@ -18,6 +18,7 @@ public enum MemberRecentSceneEnum {
|
||||
SQUARE_SQUARE("3", "广场-广场"),
|
||||
SQUARE_NEW_TIME("4", "广场-最近"),
|
||||
SQUARE_NEW_PERSON("4", "广场-新人"),
|
||||
USER("5", "查询用户朋友圈"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.member.enums.photo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 个人资源上传途径
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PhotoBizTypeEnum {
|
||||
USER_PHOTO("1", "个人相册"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.member.enums.photo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PhotoResourceTypeEnum {
|
||||
IMAGE("1", "图片"),
|
||||
VIDEO("2", "视频"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.photo;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.photo.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.photo.PhotoDO;
|
||||
import cn.iocoder.yudao.module.member.service.photo.PhotoService;
|
||||
|
||||
@Tag(name = "管理后台 - 用户相册")
|
||||
@RestController
|
||||
@RequestMapping("/member/photo")
|
||||
@Validated
|
||||
public class PhotoController {
|
||||
|
||||
@Resource
|
||||
private PhotoService photoService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户相册")
|
||||
@PreAuthorize("@ss.hasPermission('member:photo:create')")
|
||||
public CommonResult<Long> createPhoto(@Valid @RequestBody PhotoSaveReqVO createReqVO) {
|
||||
return success(photoService.createPhoto(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户相册")
|
||||
@PreAuthorize("@ss.hasPermission('member:photo:update')")
|
||||
public CommonResult<Boolean> updatePhoto(@Valid @RequestBody PhotoSaveReqVO updateReqVO) {
|
||||
photoService.updatePhoto(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户相册")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('member:photo:delete')")
|
||||
public CommonResult<Boolean> deletePhoto(@RequestParam("id") Long id) {
|
||||
photoService.deletePhoto(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户相册")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:photo:query')")
|
||||
public CommonResult<PhotoRespVO> getPhoto(@RequestParam("id") Long id) {
|
||||
PhotoDO photo = photoService.getPhoto(id);
|
||||
return success(BeanUtils.toBean(photo, PhotoRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户相册分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:photo:query')")
|
||||
public CommonResult<PageResult<PhotoRespVO>> getPhotoPage(@Valid PhotoPageReqVO pageReqVO) {
|
||||
PageResult<PhotoDO> pageResult = photoService.getPhotoPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PhotoRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出用户相册 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('member:photo:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPhotoExcel(@Valid PhotoPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PhotoDO> list = photoService.getPhotoPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "用户相册.xls", "数据", PhotoRespVO.class, BeanUtils.toBean(list, PhotoRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.photo.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.member.enums.photo.PhotoResourceTypeEnum;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.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 PhotoPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户编号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "上传途径")
|
||||
private String bizType;
|
||||
|
||||
@Schema(description = "资源类型")
|
||||
private PhotoResourceTypeEnum resourceType;
|
||||
|
||||
@Schema(description = "资源地址")
|
||||
private Long address;
|
||||
|
||||
@Schema(description = "tag_json")
|
||||
private String tagJson;
|
||||
|
||||
@Schema(description = "发布-经度")
|
||||
private Double issueLong;
|
||||
|
||||
@Schema(description = "发布-纬度")
|
||||
private Double issueLat;
|
||||
|
||||
@Schema(description = "发布-省")
|
||||
private String issueProvince;
|
||||
|
||||
@Schema(description = "发布-市")
|
||||
private String issueCity;
|
||||
|
||||
@Schema(description = "发布-区")
|
||||
private String issueDistrict;
|
||||
|
||||
@Schema(description = "发布-详细地址")
|
||||
private String issueAddress;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.photo.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")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PhotoRespVO {
|
||||
|
||||
@Schema(description = "用户相册id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11045")
|
||||
@ExcelProperty("用户相册id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "上传途径", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("上传途径")
|
||||
private String bizType;
|
||||
|
||||
@Schema(description = "资源类型")
|
||||
private String resourceType;
|
||||
|
||||
@Schema(description = "资源地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("资源地址")
|
||||
private Long address;
|
||||
|
||||
@Schema(description = "tag")
|
||||
@ExcelProperty("tag-json")
|
||||
private String tagJson;
|
||||
|
||||
@Schema(description = "发布-经度")
|
||||
@ExcelProperty("发布-经度")
|
||||
private Double issueLong;
|
||||
|
||||
@Schema(description = "发布-纬度")
|
||||
@ExcelProperty("发布-纬度")
|
||||
private Double issueLat;
|
||||
|
||||
@Schema(description = "发布-省")
|
||||
@ExcelProperty("发布-省")
|
||||
private String issueProvince;
|
||||
|
||||
@Schema(description = "发布-市")
|
||||
@ExcelProperty("发布-市")
|
||||
private String issueCity;
|
||||
|
||||
@Schema(description = "发布-区")
|
||||
@ExcelProperty("发布-区")
|
||||
private String issueDistrict;
|
||||
|
||||
@Schema(description = "发布-详细地址")
|
||||
@ExcelProperty("发布-详细地址")
|
||||
private String issueAddress;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.photo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户相册新增/修改 Request VO")
|
||||
@Data
|
||||
public class PhotoSaveReqVO {
|
||||
|
||||
@Schema(description = "用户相册id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11045")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "上传途径", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "上传途径不能为空")
|
||||
private String bizType;
|
||||
|
||||
@Schema(description = "资源类型")
|
||||
private String resourceType;
|
||||
|
||||
@Schema(description = "资源地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "资源地址不能为空")
|
||||
private Long address;
|
||||
|
||||
@Schema(description = "tag")
|
||||
private String tagJson;
|
||||
|
||||
@Schema(description = "发布-经度")
|
||||
private Double issueLong;
|
||||
|
||||
@Schema(description = "发布-纬度")
|
||||
private Double issueLat;
|
||||
|
||||
@Schema(description = "发布-省")
|
||||
private String issueProvince;
|
||||
|
||||
@Schema(description = "发布-市")
|
||||
private String issueCity;
|
||||
|
||||
@Schema(description = "发布-区")
|
||||
private String issueDistrict;
|
||||
|
||||
@Schema(description = "发布-详细地址")
|
||||
private String issueAddress;
|
||||
|
||||
}
|
||||
+10
@@ -1,11 +1,18 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.recent.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -16,6 +23,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@ToString(callSuper = true)
|
||||
public class RecentPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户编号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "主图")
|
||||
private String coverPic;
|
||||
|
||||
|
||||
+18
-11
@@ -1,6 +1,5 @@
|
||||
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;
|
||||
@@ -11,19 +10,27 @@ public class RecentPageResVo extends RecentDO {
|
||||
@Schema(description = "用户朋友圈编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号")
|
||||
private Long memberId;
|
||||
@Schema(description = "用户信息")
|
||||
private MemberVo member;
|
||||
|
||||
@Schema(description = "用户头像")
|
||||
private String memberAvatar;
|
||||
@Data
|
||||
public static class MemberVo {
|
||||
|
||||
@Schema(description = "用户昵称")
|
||||
private String memberNickname;
|
||||
@Schema(description = "用户编号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "用户年龄")
|
||||
private String memberAge;
|
||||
@Schema(description = "用户头像")
|
||||
private String memberAvatar;
|
||||
|
||||
@Schema(description = "用户职业")
|
||||
private String memberOcc;
|
||||
@Schema(description = "用户昵称")
|
||||
private String memberNickname;
|
||||
|
||||
@Schema(description = "用户年龄")
|
||||
private String memberAge;
|
||||
|
||||
@Schema(description = "用户职业")
|
||||
private String memberOcc;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.photo;
|
||||
|
||||
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.photo.vo.PhotoPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.photo.vo.PhotoRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.photo.vo.AppCountResVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.photo.vo.AppUploadReqVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.photo.PhotoDO;
|
||||
import cn.iocoder.yudao.module.member.enums.photo.PhotoBizTypeEnum;
|
||||
import cn.iocoder.yudao.module.member.service.photo.PhotoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "用户 App - 用户相册")
|
||||
@RestController
|
||||
@RequestMapping("/member/photo")
|
||||
@Validated
|
||||
public class AppPhotoController {
|
||||
|
||||
@Resource
|
||||
private PhotoService photoService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户相册分页")
|
||||
public CommonResult<PageResult<PhotoRespVO>> getPhotoPage(@Valid PhotoPageReqVO pageReqVO) {
|
||||
pageReqVO.setMemberId(getLoginUserId());
|
||||
pageReqVO.setBizType(PhotoBizTypeEnum.USER_PHOTO.getType());
|
||||
PageResult<PhotoDO> pageResult = photoService.getPhotoPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PhotoRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/upload")
|
||||
@Operation(summary = "上传资源")
|
||||
public CommonResult<Long> appUpload(@Valid @RequestBody AppUploadReqVo dto) {
|
||||
dto.setMemberId(getLoginUserId());
|
||||
dto.setBizType(PhotoBizTypeEnum.USER_PHOTO.getType());
|
||||
return success(photoService.appUpload(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/count")
|
||||
@Operation(summary = "资源总数")
|
||||
public CommonResult<AppCountResVo> count() {
|
||||
return success(photoService.count(getLoginUserId()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "资源删除")
|
||||
public CommonResult<Boolean> count(@RequestParam("id") Long id) {
|
||||
photoService.appDeletePhoto(getLoginUserId(), id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.photo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppCountResVo {
|
||||
|
||||
private Long total;
|
||||
|
||||
private Long imageTotal;
|
||||
|
||||
private Long videoTotal;
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.photo.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.member.enums.photo.PhotoResourceTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class AppUploadReqVo {
|
||||
|
||||
@Schema(description = "用户编号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "上传途径")
|
||||
private String bizType;
|
||||
|
||||
@Schema(description = "资源类型")
|
||||
@NotEmpty(message = "上传途径不能为空")
|
||||
private PhotoResourceTypeEnum resourceType;
|
||||
|
||||
@Schema(description = "资源地址")
|
||||
@NotNull(message = "资源地址不能为空")
|
||||
private Long address;
|
||||
|
||||
@Schema(description = "发布-经度")
|
||||
private Double issueLong;
|
||||
|
||||
@Schema(description = "发布-纬度")
|
||||
private Double issueLat;
|
||||
|
||||
@Schema(description = "发布-省")
|
||||
private String issueProvince;
|
||||
|
||||
@Schema(description = "发布-市")
|
||||
private String issueCity;
|
||||
|
||||
@Schema(description = "发布-区")
|
||||
private String issueDistrict;
|
||||
|
||||
@Schema(description = "发布-详细地址")
|
||||
private String issueAddress;
|
||||
|
||||
}
|
||||
+22
-1
@@ -34,7 +34,7 @@ public class AppRecentController {
|
||||
@PostMapping("/quick-page")
|
||||
@Operation(summary = "快速查询朋友圈")
|
||||
public CommonResult<PageResult<RecentPageResVo>> quickPage(@Valid @RequestBody AppRecentQuickPageVO dto) {
|
||||
dto.setMemberId(getLoginUserId());
|
||||
dto.setOperationMemberId(getLoginUserId());
|
||||
return success(recentService.quickPage(BeanUtils.toBean(dto, RecentSaveReqVO.class)));
|
||||
}
|
||||
|
||||
@@ -45,6 +45,13 @@ public class AppRecentController {
|
||||
return success(recentService.createRecent(BeanUtils.toBean(dto, RecentSaveReqVO.class)));
|
||||
}
|
||||
|
||||
@GetMapping("/get-recent")
|
||||
@Operation(summary = "查看朋友圈")
|
||||
public CommonResult<RecentPageResVo> getByRecentId(@RequestParam("recentId") Long recentId) {
|
||||
return success(recentService.getByRecentId(recentId, getLoginUserId()));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/operate")
|
||||
@Operation(summary = "朋友圈操作")
|
||||
public CommonResult<Long> operate(@Valid @RequestBody AppRecentOperateReqVo dto) {
|
||||
@@ -73,4 +80,18 @@ public class AppRecentController {
|
||||
return success(recentService.likeMePage(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/dynamic-page")
|
||||
@Operation(summary = "我的动态")
|
||||
public CommonResult<PageResult<RecentPageResVo>> dynamicPage(@Valid @RequestBody AppRecentLikeReqVo dto) {
|
||||
dto.setMemberId(getLoginUserId());
|
||||
return success(recentService.dynamicPage(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/evaluate-page")
|
||||
@Operation(summary = "我的评价")
|
||||
public CommonResult<PageResult<OperationRespVO>> evaluatePage(@Valid @RequestBody AppRecentLikeReqVo dto) {
|
||||
dto.setMemberId(getLoginUserId());
|
||||
return success(recentService.evaluatePage(dto));
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -10,6 +10,9 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
public class AppRecentQuickPageVO extends PageParam {
|
||||
|
||||
@Schema(description = "操作人用户id")
|
||||
private Long operationMemberId;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long memberId;
|
||||
|
||||
|
||||
+7
@@ -47,6 +47,13 @@ public class AppMemberUserController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-wechat")
|
||||
@Operation(summary = "修改微信信息")
|
||||
public CommonResult<Boolean> updateUserWechat(@RequestBody @Valid AppMemberUserWechatUpdateReqVO reqVO) {
|
||||
userService.updateUserWechat(getLoginUserId(), reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-mobile")
|
||||
@Operation(summary = "修改用户手机")
|
||||
public CommonResult<Boolean> updateUserMobile(@RequestBody @Valid AppMemberUserUpdateMobileReqVO reqVO) {
|
||||
|
||||
+21
-9
@@ -1,23 +1,35 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.user.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "用户 App - 会员用户更新 Request VO")
|
||||
@Data
|
||||
public class AppMemberUserUpdateReqVO {
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/x.png")
|
||||
@URL(message = "头像必须是 URL 格式")
|
||||
@Schema(description = "头像")
|
||||
@URL(message = "头像必须是URL格式")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer sex;
|
||||
@Schema(description = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "身高(cm)")
|
||||
private Double height;
|
||||
|
||||
@Schema(description = "体重(kg)")
|
||||
private Double weight;
|
||||
|
||||
@Schema(description = "职业")
|
||||
private Double occ;
|
||||
|
||||
@Schema(description = "个人介绍")
|
||||
private Double description;
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class AppMemberUserWechatUpdateReqVO {
|
||||
|
||||
@Schema(description = "微信号")
|
||||
@NotNull(message = "微信号不能为空")
|
||||
private String wechatNum;
|
||||
|
||||
@Schema(description = "微信二维码")
|
||||
private String wechatQrCode;
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.photo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 用户相册 DO
|
||||
*
|
||||
* @author 聊天交友
|
||||
*/
|
||||
@TableName("member_photo")
|
||||
@KeySequence("member_photo_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PhotoDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 用户相册id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long memberId;
|
||||
|
||||
/**
|
||||
* 上传途径
|
||||
*/
|
||||
private String bizType;
|
||||
|
||||
/**
|
||||
* 资源类型
|
||||
*/
|
||||
private String resourceType;
|
||||
|
||||
/**
|
||||
* 资源地址
|
||||
*/
|
||||
private Long address;
|
||||
|
||||
/**
|
||||
* tag-json
|
||||
*/
|
||||
private String tagJson;
|
||||
|
||||
/**
|
||||
* 发布-经度
|
||||
*/
|
||||
private Double issueLong;
|
||||
|
||||
/**
|
||||
* 发布-纬度
|
||||
*/
|
||||
private Double issueLat;
|
||||
|
||||
/**
|
||||
* 发布-省
|
||||
*/
|
||||
private String issueProvince;
|
||||
|
||||
/**
|
||||
* 发布-市
|
||||
*/
|
||||
private String issueCity;
|
||||
|
||||
/**
|
||||
* 发布-区
|
||||
*/
|
||||
private String issueDistrict;
|
||||
|
||||
/**
|
||||
* 发布-详细地址
|
||||
*/
|
||||
private String issueAddress;
|
||||
|
||||
}
|
||||
+25
@@ -109,6 +109,31 @@ public class MemberUserDO extends TenantBaseDO {
|
||||
*/
|
||||
private String occ;
|
||||
|
||||
/**
|
||||
* 身高(cm)
|
||||
*/
|
||||
private Double height;
|
||||
|
||||
/**
|
||||
* 体重(kg)
|
||||
*/
|
||||
private String weight;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 微信号
|
||||
*/
|
||||
private String wechatNum;
|
||||
|
||||
/**
|
||||
* 微信二维码
|
||||
*/
|
||||
private String wechatQrCode;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.photo;
|
||||
|
||||
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;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.photo.PhotoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.photo.vo.*;
|
||||
|
||||
/**
|
||||
* 用户相册 Mapper
|
||||
*
|
||||
* @author 聊天交友
|
||||
*/
|
||||
@Mapper
|
||||
public interface PhotoMapper extends BaseMapperX<PhotoDO> {
|
||||
|
||||
default PageResult<PhotoDO> selectPage(PhotoPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PhotoDO>()
|
||||
.eqIfPresent(PhotoDO::getBizType, reqVO.getBizType())
|
||||
.eqIfPresent(PhotoDO::getAddress, reqVO.getAddress())
|
||||
.eqIfPresent(PhotoDO::getTagJson, reqVO.getTagJson())
|
||||
.eqIfPresent(PhotoDO::getIssueLong, reqVO.getIssueLong())
|
||||
.eqIfPresent(PhotoDO::getIssueLat, reqVO.getIssueLat())
|
||||
.eqIfPresent(PhotoDO::getIssueProvince, reqVO.getIssueProvince())
|
||||
.eqIfPresent(PhotoDO::getIssueCity, reqVO.getIssueCity())
|
||||
.eqIfPresent(PhotoDO::getIssueDistrict, reqVO.getIssueDistrict())
|
||||
.eqIfPresent(PhotoDO::getIssueAddress, reqVO.getIssueAddress())
|
||||
.betweenIfPresent(PhotoDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PhotoDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -17,6 +17,7 @@ public interface RecentMapper extends BaseMapperX<RecentDO> {
|
||||
|
||||
default PageResult<RecentDO> selectPage(RecentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RecentDO>()
|
||||
.eqIfPresent(RecentDO::getMemberId, reqVO.getMemberId())
|
||||
.eqIfPresent(RecentDO::getCoverPic, reqVO.getCoverPic())
|
||||
.eqIfPresent(RecentDO::getDescription, reqVO.getDescribe())
|
||||
.eqIfPresent(RecentDO::getIssueLong, reqVO.getIssueLong())
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.member.service.photo;
|
||||
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.photo.vo.*;
|
||||
import cn.iocoder.yudao.module.member.controller.app.photo.vo.AppCountResVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.photo.vo.AppUploadReqVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.photo.PhotoDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 用户相册 Service 接口
|
||||
*/
|
||||
public interface PhotoService {
|
||||
|
||||
/**
|
||||
* 创建用户相册
|
||||
*/
|
||||
Long createPhoto(@Valid PhotoSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 用户相册统计
|
||||
*/
|
||||
AppCountResVo count(Long memberId);
|
||||
|
||||
/**
|
||||
* 上传资源类型
|
||||
*/
|
||||
Long appUpload(@Valid AppUploadReqVo dto);
|
||||
|
||||
/**
|
||||
* 更新用户相册
|
||||
*/
|
||||
void updatePhoto(@Valid PhotoSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户相册
|
||||
*/
|
||||
void deletePhoto(Long id);
|
||||
|
||||
/**
|
||||
* app删除用户相册
|
||||
*/
|
||||
void appDeletePhoto(Long operateMemberId, Long id);
|
||||
|
||||
/**
|
||||
* 获得用户相册
|
||||
*/
|
||||
PhotoDO getPhoto(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户相册分页
|
||||
*/
|
||||
PageResult<PhotoDO> getPhotoPage(PhotoPageReqVO pageReqVO);
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package cn.iocoder.yudao.module.member.service.photo;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.app.photo.vo.AppCountResVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.photo.vo.AppUploadReqVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberErrorCode;
|
||||
import cn.iocoder.yudao.module.member.enums.photo.PhotoBizTypeEnum;
|
||||
import cn.iocoder.yudao.module.member.enums.photo.PhotoResourceTypeEnum;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.photo.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.photo.PhotoDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.photo.PhotoMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 用户相册 Service 实现类
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PhotoServiceImpl implements PhotoService {
|
||||
|
||||
@Resource
|
||||
private PhotoMapper photoMapper;
|
||||
|
||||
@Resource
|
||||
private MemberUserService memberUserService;
|
||||
|
||||
@Override
|
||||
public Long createPhoto(PhotoSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PhotoDO photo = BeanUtils.toBean(createReqVO, PhotoDO.class);
|
||||
photoMapper.insert(photo);
|
||||
// 返回
|
||||
return photo.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传资源类型
|
||||
*/
|
||||
@Override
|
||||
public Long appUpload(AppUploadReqVo dto) {
|
||||
PhotoDO photo = BeanUtils.toBean(dto, PhotoDO.class);
|
||||
photoMapper.insert(photo);
|
||||
return photo.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePhoto(PhotoSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePhotoExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PhotoDO updateObj = BeanUtils.toBean(updateReqVO, PhotoDO.class);
|
||||
photoMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePhoto(Long id) {
|
||||
// 校验存在
|
||||
validatePhotoExists(id);
|
||||
// 删除
|
||||
photoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* app删除用户相册
|
||||
*/
|
||||
@Override
|
||||
public void appDeletePhoto(Long operateMemberId, Long id) {
|
||||
validatePhotoExists(id);
|
||||
PhotoDO detail = photoMapper.selectById(id);
|
||||
if (ObjectUtil.notEqual(operateMemberId, detail.getMemberId())) {
|
||||
// 查询用户
|
||||
MemberUserDO user = memberUserService.getUser(detail.getMemberId());
|
||||
throw exception(MemberErrorCode.PHOTO_TYPE_NOT_SUPPORT, user.getName());
|
||||
}
|
||||
// 删除
|
||||
photoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validatePhotoExists(Long id) {
|
||||
if (photoMapper.selectById(id) == null) {
|
||||
throw exception(MemberErrorCode.PHOTO_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PhotoDO getPhoto(Long id) {
|
||||
return photoMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PhotoDO> getPhotoPage(PhotoPageReqVO pageReqVO) {
|
||||
return photoMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户相册统计
|
||||
*/
|
||||
@Override
|
||||
public AppCountResVo count(Long memberId) {
|
||||
AppCountResVo countResVo = new AppCountResVo();
|
||||
Long imageCount = photoMapper.selectCount(new LambdaQueryWrapperX<PhotoDO>()
|
||||
.eqIfPresent(PhotoDO::getMemberId, memberId)
|
||||
.eqIfPresent(PhotoDO::getBizType, PhotoBizTypeEnum.USER_PHOTO.getType())
|
||||
.eqIfPresent(PhotoDO::getResourceType, PhotoResourceTypeEnum.IMAGE.getType())
|
||||
);
|
||||
Long videoCount = photoMapper.selectCount(new LambdaQueryWrapperX<PhotoDO>()
|
||||
.eqIfPresent(PhotoDO::getMemberId, memberId)
|
||||
.eqIfPresent(PhotoDO::getBizType, PhotoBizTypeEnum.USER_PHOTO.getType())
|
||||
.eqIfPresent(PhotoDO::getResourceType, PhotoResourceTypeEnum.VIDEO.getType())
|
||||
);
|
||||
countResVo.setImageTotal(imageCount);
|
||||
countResVo.setVideoTotal(videoCount);
|
||||
countResVo.setTotal(imageCount + videoCount);
|
||||
return countResVo;
|
||||
}
|
||||
}
|
||||
-2
@@ -28,8 +28,6 @@ import static cn.iocoder.yudao.module.member.enums.MemberErrorCode.USER_POINT_NO
|
||||
|
||||
/**
|
||||
* 积分记录 Service 实现类
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
|
||||
+15
@@ -23,6 +23,11 @@ public interface RecentService {
|
||||
*/
|
||||
Long createRecent(@Valid RecentSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 查看朋友圈
|
||||
*/
|
||||
RecentPageResVo getByRecentId(Long recentId, Long loginUserId);
|
||||
|
||||
/**
|
||||
* 更新朋友圈
|
||||
*/
|
||||
@@ -62,4 +67,14 @@ public interface RecentService {
|
||||
* 喜欢我-分页查询
|
||||
*/
|
||||
PageResult<OperationRespVO> likeMePage(@Valid AppRecentLikeReqVo dto);
|
||||
|
||||
/**
|
||||
* 我的动态
|
||||
*/
|
||||
PageResult<RecentPageResVo> dynamicPage(@Valid AppRecentLikeReqVo dto);
|
||||
|
||||
/**
|
||||
* 我的评价
|
||||
*/
|
||||
PageResult<OperationRespVO> evaluatePage(@Valid AppRecentLikeReqVo dto);
|
||||
}
|
||||
+76
-21
@@ -1,6 +1,6 @@
|
||||
package cn.iocoder.yudao.module.member.service.recent;
|
||||
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.IterUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -65,6 +65,20 @@ public class RecentServiceImpl implements RecentService {
|
||||
return recent.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看朋友圈
|
||||
*/
|
||||
@Override
|
||||
public RecentPageResVo getByRecentId(Long recentId, Long loginUserId) {
|
||||
validateRecentExists(recentId);
|
||||
// 查询朋友圈
|
||||
RecentDO recent = recentMapper.selectById(recentId);
|
||||
RecentPageResVo result = BeanUtil.toBean(recent, RecentPageResVo.class);
|
||||
// 查询发送朋友圈用户
|
||||
convertRecentPageResVoSetupMember(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRecent(RecentSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
@@ -160,7 +174,8 @@ public class RecentServiceImpl implements RecentService {
|
||||
public PageResult<RecentPageResVo> getRecentPage(RecentPageReqVO pageReqVO) {
|
||||
PageResult<RecentDO> recentPageList = recentMapper.selectPage(pageReqVO);
|
||||
List<RecentPageResVo> resultList = BeanUtils.toBean(recentPageList.getList(), RecentPageResVo.class);
|
||||
disposeRecentList(resultList, pageReqVO);
|
||||
// 为RecentPageResVo设置Member信息
|
||||
convertRecentPageResVoSetupMember(resultList);
|
||||
return new PageResult<>(resultList, recentPageList.getTotal());
|
||||
}
|
||||
|
||||
@@ -169,9 +184,11 @@ public class RecentServiceImpl implements RecentService {
|
||||
*/
|
||||
@Override
|
||||
public PageResult<RecentPageResVo> quickPage(RecentSaveReqVO bean) {
|
||||
PageResult<RecentDO> recentPageList = recentMapper.selectPage(new RecentPageReqVO());
|
||||
RecentPageReqVO result = BeanUtil.toBean(bean, RecentPageReqVO.class);
|
||||
PageResult<RecentDO> recentPageList = recentMapper.selectPage(result);
|
||||
List<RecentPageResVo> resultList = BeanUtils.toBean(recentPageList.getList(), RecentPageResVo.class);
|
||||
disposeRecentList(resultList, null);
|
||||
// 为RecentPageResVo设置Member信息
|
||||
convertRecentPageResVoSetupMember(resultList);
|
||||
return new PageResult<>(resultList, recentPageList.getTotal());
|
||||
}
|
||||
|
||||
@@ -260,34 +277,72 @@ public class RecentServiceImpl implements RecentService {
|
||||
return resultPageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的动态
|
||||
*/
|
||||
@Override
|
||||
public PageResult<RecentPageResVo> dynamicPage(AppRecentLikeReqVo dto) {
|
||||
List<RecentPageResVo> resultList = new ArrayList<>();
|
||||
|
||||
RecentPageReqVO dtoQuery = new RecentPageReqVO();
|
||||
PageResult<RecentDO> pageList = recentMapper.selectPage(dtoQuery);
|
||||
if (ObjectUtil.isEmpty(pageList)) return new PageResult<>();
|
||||
resultList = BeanUtil.copyToList(pageList.getList(), RecentPageResVo.class);
|
||||
// 添加用户信息
|
||||
convertRecentPageResVoSetupMember(resultList);
|
||||
return new PageResult<RecentPageResVo>(resultList, pageList.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的评价
|
||||
*/
|
||||
@Override
|
||||
public PageResult<OperationRespVO> evaluatePage(AppRecentLikeReqVo dto) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void validateRecentExists(Long id) {
|
||||
if (recentMapper.selectById(id) == null) {
|
||||
throw exception(MemberErrorCode.RECENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void disposeRecentList(List<RecentPageResVo> list, RecentPageReqVO dto) {
|
||||
/**
|
||||
* 为RecentPageResVo设置Member信息
|
||||
*/
|
||||
private void convertRecentPageResVoSetupMember(List<RecentPageResVo> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
Map<Long, MemberUserDO> memberMap = new HashMap<>();
|
||||
// 查询人员
|
||||
List<Long> memberIds = list.stream().map(RecentDO::getMemberId).distinct().collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(memberIds)) {
|
||||
List<MemberUserDO> memberList = memberUserService.getUserList(memberIds);
|
||||
if (ObjectUtil.isNotEmpty(memberList)) {
|
||||
memberMap = CollStreamUtil.toIdentityMap(memberList, MemberUserDO::getId);
|
||||
}
|
||||
}
|
||||
for (RecentPageResVo v : list) {
|
||||
List<Long> memberIds = list.stream().map(RecentPageResVo::getMemberId).collect(Collectors.toList());
|
||||
List<MemberUserDO> memberList = memberUserService.getUserList(memberIds);
|
||||
Map<Long, MemberUserDO> memberMap = IterUtil.toMap(memberList, MemberUserDO::getId);
|
||||
for (RecentPageResVo entity : list) {
|
||||
// 用户相关
|
||||
if (ObjectUtil.isNotEmpty(memberMap)) {
|
||||
MemberUserDO targetMember = memberMap.get(v.getMemberId());
|
||||
if (ObjectUtil.isNotEmpty(targetMember)) {
|
||||
v.setMemberAvatar(targetMember.getAvatar());
|
||||
v.setMemberNickname(targetMember.getNickname());
|
||||
v.setMemberAge(targetMember.getAge());
|
||||
v.setMemberOcc(targetMember.getOcc());
|
||||
MemberUserDO member = memberMap.get(entity.getMemberId());
|
||||
if (ObjectUtil.isNotEmpty(member)) {
|
||||
RecentPageResVo.MemberVo memberVO = new RecentPageResVo.MemberVo();
|
||||
memberVO.setMemberId(member.getId());
|
||||
memberVO.setMemberAvatar(member.getAvatar());
|
||||
memberVO.setMemberNickname(member.getNickname());
|
||||
memberVO.setMemberAge(member.getAge());
|
||||
memberVO.setMemberOcc(member.getOcc());
|
||||
entity.setMember(memberVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void convertRecentPageResVoSetupMember(RecentPageResVo detail) {
|
||||
if (ObjectUtil.isEmpty(detail)) return;
|
||||
MemberUserDO member = memberUserService.getUser(detail.getMemberId());
|
||||
if (ObjectUtil.isNotEmpty(member)) {
|
||||
RecentPageResVo.MemberVo memberVO = new RecentPageResVo.MemberVo();
|
||||
memberVO.setMemberId(member.getId());
|
||||
memberVO.setMemberAvatar(member.getAvatar());
|
||||
memberVO.setMemberNickname(member.getNickname());
|
||||
memberVO.setMemberAge(member.getAge());
|
||||
memberVO.setMemberOcc(member.getOcc());
|
||||
detail.setMember(memberVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-2
@@ -90,6 +90,11 @@ public interface MemberUserService {
|
||||
*/
|
||||
void updateUser(Long userId, AppMemberUserUpdateReqVO reqVO);
|
||||
|
||||
/**
|
||||
*【会员】修改微信信息
|
||||
*/
|
||||
void updateUserWechat(Long loginUserId, @Valid AppMemberUserWechatUpdateReqVO dto);
|
||||
|
||||
/**
|
||||
* 【会员】修改手机,基于手机验证码
|
||||
*
|
||||
@@ -102,7 +107,7 @@ public interface MemberUserService {
|
||||
* 【会员】修改手机,基于微信小程序的授权码
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param reqVO 请求信息
|
||||
* @param reqVO 请求信息
|
||||
*/
|
||||
void updateUserMobileByWeixin(Long userId, AppMemberUserUpdateMobileByWeixinReqVO reqVO);
|
||||
|
||||
@@ -186,5 +191,4 @@ public interface MemberUserService {
|
||||
* @return 更新结果
|
||||
*/
|
||||
boolean updateUserPoint(Long userId, Integer point);
|
||||
|
||||
}
|
||||
+6
@@ -146,6 +146,12 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
memberUserMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserWechat(Long loginUserId, AppMemberUserWechatUpdateReqVO dto) {
|
||||
MemberUserDO updateObj = BeanUtils.toBean(dto, MemberUserDO.class).setId(loginUserId);
|
||||
memberUserMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateUserMobile(Long userId, AppMemberUserUpdateMobileReqVO reqVO) {
|
||||
|
||||
Reference in new issue
Block a user