feat(communityCenter): 增加是否点赞

master
yang 2025-04-21 15:35:55 +08:00
parent 906a56c431
commit 9c7e6ea4a1
74 changed files with 1111 additions and 285 deletions

BIN
blob

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 MiB

After

Width:  |  Height:  |  Size: 1008 KiB

View File

@ -1,15 +1,13 @@
package com.mcwl.web.controller.communityCenter; package com.mcwl.web.controller.communityCenter;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.dto.*; import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.CommunityDetailVo;
import com.mcwl.communityCenter.service.CommunityService; import com.mcwl.communityCenter.service.CommunityService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -17,7 +15,6 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Objects;
/** /**
* *
@ -42,6 +39,28 @@ public class CommunityController {
return communityService.listByPage(communityListPageRes); return communityService.listByPage(communityListPageRes);
} }
@ApiOperation(value = "社区详情")
@GetMapping("detail")
public R<CommunityDetailVo> getCommunityDetail(@Valid
@ApiParam(value = "社区id", required = true)
@NotNull(message = "社区id不能为空")
Long communityId) {
CommunityDetailVo communityDetailVo = communityService.getCommunityDetail(communityId);
return R.ok(communityDetailVo);
}
/**
*
*/
@ApiOperation(value = "编辑社区")
@PostMapping("edit")
public R<Object> editCommunity(@RequestBody @Valid EditCommunityRes editCommunityRes) {
communityService.editCommunity(editCommunityRes);
return R.ok("编辑成功");
}
/** /**
* *
@ -56,15 +75,12 @@ public class CommunityController {
/** /**
* *
*
* @param communityRes
* @return
*/ */
@ApiOperation(value = "添加社区") @ApiOperation(value = "添加社区")
@PostMapping("add") @PostMapping("addCommunity")
public R<Object> addCommunity(@RequestBody @Valid CommunityRes communityRes) { public R<Object> addCommunity(@RequestBody @Valid AddCommunityRes addCommunityRes) {
communityService.addCommunity(communityRes); communityService.addCommunity(addCommunityRes);
return R.ok(); return R.ok("社区添加成功");
} }
/** /**

View File

@ -11,8 +11,10 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/** /**
* *
@ -27,16 +29,6 @@ public class CommunityFileController {
private final CommunityFileLogService communityFileLogService; private final CommunityFileLogService communityFileLogService;
/**
*
*/
@ApiOperation(value = "社区文件上传")
@PostMapping("/upload")
public R<Object> upload(@RequestBody @Valid CommunityUploadFileRes communityUploadFileRes) {
communityFileService.upload(communityUploadFileRes);
return R.ok();
}
/** /**
* *
*/ */
@ -47,5 +39,23 @@ public class CommunityFileController {
} }
/**
*
*/
@ApiOperation(value = "社区文件上传")
@PostMapping("/upload")
public R<String> upload(@RequestBody @Valid CommunityUploadFileRes communityUploadFileRes) {
return communityFileService.upload(communityUploadFileRes);
}
/**
*
*/
@ApiOperation(value = "社区文件下载")
@PostMapping("/download")
public R<String> download(@RequestBody @Valid CommunityDownloadFileRes communityDownloadFileRes) {
return communityFileService.download(communityDownloadFileRes);
}
} }

View File

@ -50,5 +50,25 @@ public class CommunityUserController {
return communityUserService.black(blackListRes); return communityUserService.black(blackListRes);
} }
/**
*
*/
@ApiOperation(value = "取消拉黑")
@PostMapping("unBlack")
public R<Object> unBlack(@RequestBody @Valid UnBlackListRes unBlackListRes) {
return communityUserService.unBlack(unBlackListRes);
}
/**
* /
*/
@ApiOperation(value = "管理/取消管理")
@PostMapping("manage")
public R<Object> manage(@RequestBody @Valid CommunityUserManageRes communityUserManageRes) {
return communityUserService.manage(communityUserManageRes);
}
} }

View File

@ -4,6 +4,7 @@ import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.dto.MyPublishCollectPageRes; import com.mcwl.communityCenter.domain.dto.MyPublishCollectPageRes;
import com.mcwl.communityCenter.domain.dto.MyPublishPageRes; import com.mcwl.communityCenter.domain.dto.MyPublishPageRes;
import com.mcwl.communityCenter.domain.dto.PersonHomePageRes;
import com.mcwl.communityCenter.domain.dto.QuestionPageRes; import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
import com.mcwl.communityCenter.service.PublishCollectService; import com.mcwl.communityCenter.service.PublishCollectService;
import com.mcwl.communityCenter.service.PublishService; import com.mcwl.communityCenter.service.PublishService;
@ -31,39 +32,14 @@ public class PersonHomeController {
private final PublishService publishService; private final PublishService publishService;
private final QuestionService questionService;
private final PublishCollectService publishCollectService;
/** /**
* *
*/ */
@PostMapping("myPublishList") @PostMapping("getPersonHomeList")
@ApiOperation(value = "我发布的文章列表") @ApiOperation(value = "个人主页列表")
public TableDataInfo myPublishList(@RequestBody @Valid MyPublishPageRes myPublishPageRes) { public TableDataInfo getPersonHomeList(@RequestBody @Valid PersonHomePageRes personHomePageRes) {
return publishService.myPublishList(myPublishPageRes); return publishService.getPersonHomeList(personHomePageRes);
}
/**
*
*/
@PostMapping("myQuestionList")
@ApiOperation(value = "我的问答列表")
public TableDataInfo myQuestionList(@RequestBody @Valid QuestionPageRes questionPageRes) {
return questionService.myQuestionList(questionPageRes);
}
/**
*
*/
@PostMapping("myCollectList")
@ApiOperation(value = "我的收藏")
public TableDataInfo myCollectList(@RequestBody @Valid MyPublishCollectPageRes myPublishCollectPageRes) {
return publishCollectService.myCollectList(myPublishCollectPageRes);
} }

View File

@ -6,6 +6,7 @@ import com.mcwl.common.core.domain.R;
import com.mcwl.communityCenter.domain.dto.CommentDelRes; import com.mcwl.communityCenter.domain.dto.CommentDelRes;
import com.mcwl.communityCenter.domain.dto.CommentDetailRes; import com.mcwl.communityCenter.domain.dto.CommentDetailRes;
import com.mcwl.communityCenter.domain.dto.CommentRes; import com.mcwl.communityCenter.domain.dto.CommentRes;
import com.mcwl.communityCenter.domain.vo.CommentVo;
import com.mcwl.communityCenter.service.PublishCommentService; import com.mcwl.communityCenter.service.PublishCommentService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
/** /**
* *
@ -52,7 +54,7 @@ public class PublishCommentController extends BaseController {
*/ */
@ApiOperation(value = "获取评论详情") @ApiOperation(value = "获取评论详情")
@PostMapping("/detail") @PostMapping("/detail")
public R<Object> getComment(@RequestBody @Valid CommentDetailRes commentDetailRes) { public R<List<CommentVo>> getComment(@RequestBody @Valid CommentDetailRes commentDetailRes) {
return publishCommentService.getComment(commentDetailRes); return publishCommentService.getComment(commentDetailRes);
} }

View File

@ -57,6 +57,12 @@ public class QuestionController {
// 付费类型为1时判断钱包余额是否充足 // 付费类型为1时判断钱包余额是否充足
if (Objects.equals(type, 1)) { if (Objects.equals(type, 1)) {
if (amount < 10) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"付费金额不能小于10");
}
if (amount > 1000) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"付费金额不能大于1000");
}
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
SysUser sysUser = sysUserService.selectUserById(userId); SysUser sysUser = sysUserService.selectUserById(userId);
Double wallet = sysUser.getWallet(); Double wallet = sysUser.getWallet();

View File

@ -51,6 +51,7 @@ public class ObsUtils {
map.put("path",putObjectResult.getObjectUrl()); map.put("path",putObjectResult.getObjectUrl());
map.put("objectKey",putObjectResult.getObjectKey()); map.put("objectKey",putObjectResult.getObjectKey());
map.put("size",multipartFile.getSize()+""); map.put("size",multipartFile.getSize()+"");
map.put("fileName",multipartFile.getOriginalFilename());
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -7,9 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.mcwl.common.core.domain.BaseEntity; import com.mcwl.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Builder; import lombok.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
/** /**
* *
@ -17,7 +15,8 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("cc_community_file") @TableName("cc_community_file")
@Builder @NoArgsConstructor
@AllArgsConstructor
public class CommunityFile extends BaseEntity { public class CommunityFile extends BaseEntity {
@TableId @TableId

View File

@ -70,7 +70,7 @@ public class CommunityUser extends BaseEntity {
/** /**
* 0 1 * 0 1
*/ */
private String isBlank; private String isBlack;
/** /**
* *
@ -80,6 +80,6 @@ public class CommunityUser extends BaseEntity {
/** /**
* *
*/ */
private Date blankEndTime; private Date blackEndTime;
} }

View File

@ -46,10 +46,15 @@ public class Publish extends BaseEntity {
private String imageUrl; private String imageUrl;
/** /**
* * url
*/ */
private String fileUrl; private String fileUrl;
/**
*
*/
private String fileName;
/** /**
* *
*/ */

View File

@ -13,7 +13,7 @@ import lombok.EqualsAndHashCode;
@ApiModel(description = "评论区评论") @ApiModel(description = "评论区评论")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("cc_comment") @TableName("cc_publish_comment")
public class PublishComment extends BaseEntity { public class PublishComment extends BaseEntity {
/** /**
* id * id
@ -32,10 +32,10 @@ public class PublishComment extends BaseEntity {
@ApiModelProperty(value = "社区id") @ApiModelProperty(value = "社区id")
private Long communityId; private Long communityId;
/** /**
* id * id
*/ */
@ApiModelProperty(value = "运营id") @ApiModelProperty(value = "发布id")
private Long operatorId; private Long publishId;
/** /**
* id * id
*/ */

View File

@ -19,7 +19,7 @@ import lombok.EqualsAndHashCode;
@ApiModel(description = "评论点赞") @ApiModel(description = "评论点赞")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("cc_comment_like") @TableName("cc_publish_comment_like")
public class PublishCommentLike extends BaseEntity { public class PublishCommentLike extends BaseEntity {
/** /**

View File

@ -53,18 +53,6 @@ public class Question extends BaseEntity {
*/ */
private String questionUrl; private String questionUrl;
// /**
// * 回复内容
// */
// @ApiModelProperty(value = "答复内容")
// private String reply;
//
// /**
// * 回复时间
// */
// @ApiModelProperty(value = "答复时间")
// private Date replyTime;
/** /**
* *
*/ */

View File

@ -1,6 +1,5 @@
package com.mcwl.communityCenter.domain.dto; package com.mcwl.communityCenter.domain.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -13,7 +12,7 @@ import javax.validation.constraints.NotNull;
*/ */
@Data @Data
@ApiModel(value = "社区请求参数") @ApiModel(value = "社区请求参数")
public class CommunityRes { public class AddCommunityRes {
/** /**
@ -57,6 +56,12 @@ public class CommunityRes {
@NotNull(message = "有效期天数") @NotNull(message = "有效期天数")
private Integer validityDay; private Integer validityDay;
/**
*
*/
@ApiModelProperty(value = "描述")
private String description;
} }

View File

@ -0,0 +1,33 @@
package com.mcwl.communityCenter.domain.dto;
import com.mcwl.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
/**
*
*/
@Data
@ApiModel(value = "社区详情请求参数")
public class CommunityDetailRes {
/**
* id
*/
@ApiModelProperty(value = "租户id", required = true)
@NotNull(message = "租户id不能为空")
private Long tenantId;
/**
* id
*/
@ApiModelProperty(value = "社区id", required = true)
@NotNull(message = "社区id不能为空")
private Long communityId;
}

View File

@ -0,0 +1,41 @@
package com.mcwl.communityCenter.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
*
*/
@Data
@ApiModel(value = "社区文件下载请求参数")
public class CommunityDownloadFileRes {
/**
* id
*/
@ApiModelProperty(value = "租户id", required = true)
@NotNull(message = "租户id不能为空")
private Long tenantId;
/**
* id
*/
@ApiModelProperty(value = "社区id", required = true)
@NotNull(message = "社区id不能为空")
private Long communityId;
/**
* id
*/
@ApiModelProperty(value = "文件id", required = true)
@NotNull(message = "文件id不能为空")
private Long fileId;
}

View File

@ -10,10 +10,10 @@ import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
/** /**
* *
*/ */
@Data @Data
@ApiModel(value = "社区请求参数") @ApiModel(value = "社区文件列表请求参数")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class CommunityFilePageListRes extends PageDomain { public class CommunityFilePageListRes extends PageDomain {

View File

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
/** /**
@ -29,11 +30,32 @@ public class CommunityUploadFileRes {
private Long communityId; private Long communityId;
/** /**
* * url
*/ */
@ApiModelProperty(value = "文件", required = true) @ApiModelProperty(value = "文件url", required = true)
@NotNull(message = "文件不能为空") @NotBlank(message = "文件url不能为空")
private MultipartFile file; private String fileUrl;
/**
* key
*/
@ApiModelProperty(value = "文件对象key", required = true)
@NotBlank(message = "文件对象key不能为空")
private String objectKey;
/**
*
*/
@ApiModelProperty(value = "文件名", required = true)
@NotBlank(message = "文件名不能为空")
private String fileName;
/**
*
*/
@ApiModelProperty(value = "文件大小", required = true)
@NotNull(message = "文件大小不能为空")
private Long fileSize;

View File

@ -15,6 +15,12 @@ import javax.validation.constraints.NotNull;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "社区用户列表分页请求参数") @ApiModel(value = "社区用户列表分页请求参数")
public class CommunityUserListPageRes extends PageDomain { public class CommunityUserListPageRes extends PageDomain {
/**
* id
*/
@ApiModelProperty(value = "租户id", required = true)
@NotNull(message = "租户id不能为空")
private Long tenantId;
/** /**
* id * id

View File

@ -0,0 +1,35 @@
package com.mcwl.communityCenter.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* /
*/
@Data
@ApiModel(value = "管理/取消管理请求参数")
public class CommunityUserManageRes {
/**
* id
*/
@ApiModelProperty(value = "租户id", required = true)
@NotNull(message = "租户id不能为空")
private Long tenantId;
/**
* id
*/
@ApiModelProperty(value = "社区id", required = true)
@NotNull(message = "社区id不能为空")
private Long communityId;
/**
* id
*/
@ApiModelProperty(value = "用户id", required = true)
@NotNull(message = "用户id不能为空")
private Long userId;
}

View File

@ -0,0 +1,74 @@
package com.mcwl.communityCenter.domain.dto;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.mcwl.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
*
*/
@Data
@ApiModel(value = "编辑社区参数")
public class EditCommunityRes {
@ApiModelProperty(value = "社区id", required = true)
@NotNull(message = "社区id不能为空")
private Long id;
/**
*
*/
@ApiModelProperty(value = "社区图片")
private String imageUrl;
/**
*
*/
@ApiModelProperty(value = "社区名称", required = true)
@NotBlank(message = "社区名称不能为空")
private String communityName;
/**
*
*/
@ApiModelProperty(value = "描述")
private String description;
/**
* id
*/
@ApiModelProperty(value = "社区标签", required = true)
@NotNull(message = "社区标签不能为空")
private Integer communityTag;
/**
* 0 1
*/
@ApiModelProperty(value = "社区类型", required = true)
@NotNull(message = "社区类型不能为空")
private Integer type;
/**
*
*/
@ApiModelProperty(value = "价格", required = true)
@NotNull(message = "价格不能为空")
private Double price;
/**
*
*/
@ApiModelProperty(value = "有效期天数", required = true)
@NotNull(message = "有效期天数")
private Integer validityDay;
}

View File

@ -2,6 +2,7 @@ package com.mcwl.communityCenter.domain.dto;
import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -17,11 +18,11 @@ import javax.validation.constraints.NotNull;
public class IncomeInfoListPageRes extends PageDomain { public class IncomeInfoListPageRes extends PageDomain {
@NotNull(message = "社区id不能为空") @NotNull(message = "社区id不能为空")
@ApiParam(value = "社区id", required = true) @ApiModelProperty(value = "社区id", required = true)
private Long communityId; private Long communityId;
@NotNull(message = "租户id不能为空") @NotNull(message = "租户id不能为空")
@ApiParam(value = "租户id", required = true) @ApiModelProperty(value = "租户id", required = true)
private Long tenantId; private Long tenantId;
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.communityCenter.domain.dto;
import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -16,11 +17,11 @@ import javax.validation.constraints.NotNull;
public class IncomeInfoRes { public class IncomeInfoRes {
@NotNull(message = "社区id不能为空") @NotNull(message = "社区id不能为空")
@ApiParam(value = "社区id", required = true) @ApiModelProperty(value = "社区id", required = true)
private Long communityId; private Long communityId;
@NotNull(message = "租户id不能为空") @NotNull(message = "租户id不能为空")
@ApiParam(value = "租户id", required = true) @ApiModelProperty(value = "租户id", required = true)
private Long tenantId; private Long tenantId;
} }

View File

@ -14,6 +14,12 @@ import lombok.EqualsAndHashCode;
@ApiModel(value = "社区列表分页请求参数") @ApiModel(value = "社区列表分页请求参数")
public class JoinCommunityListPageRes extends PageDomain { public class JoinCommunityListPageRes extends PageDomain {
/**
* 0 1
*/
@ApiModelProperty(value = "是否包含我创建的社区 0否 1是 默认0")
private Integer isMyCreate = 0;
/** /**
* *
*/ */

View File

@ -2,6 +2,7 @@ package com.mcwl.communityCenter.domain.dto;
import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -17,11 +18,11 @@ import javax.validation.constraints.NotNull;
public class MyPublishPageRes extends PageDomain { public class MyPublishPageRes extends PageDomain {
@NotNull(message = "社区id不能为空") @NotNull(message = "社区id不能为空")
@ApiParam(value = "社区id", required = true) @ApiModelProperty(value = "社区id", required = true)
private Long communityId; private Long communityId;
@NotNull(message = "租户id不能为空") @NotNull(message = "租户id不能为空")
@ApiParam(value = "租户id", required = true) @ApiModelProperty(value = "租户id", required = true)
private Long tenantId; private Long tenantId;
} }

View File

@ -0,0 +1,41 @@
package com.mcwl.communityCenter.domain.dto;
import com.mcwl.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
/**
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "个人主页分页请求参数")
public class PersonHomePageRes extends PageDomain {
/**
* id
*/
@NotNull(message = "租户id不能为空")
@ApiModelProperty(value = "租户id", required = true)
private Long tenantId;
/**
* id
*/
@NotNull(message = "社区id不能为空")
@ApiModelProperty(value = "社区id", required = true)
private Long communityId;
/**
* 0 1 2
*/
@NotNull(message = "类型不能为空")
@ApiModelProperty(value = "类型 0 我的发布 1 我的问答 2 我的收藏", required = true)
private Integer type;
}

View File

@ -2,7 +2,9 @@ package com.mcwl.communityCenter.domain.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ -11,6 +13,8 @@ import javax.validation.constraints.NotNull;
*/ */
@Data @Data
@ApiModel(value = "收藏/取消收藏请求参数") @ApiModel(value = "收藏/取消收藏请求参数")
@NoArgsConstructor
@AllArgsConstructor
public class PublishCollectRes { public class PublishCollectRes {
/** /**

View File

@ -2,6 +2,7 @@ package com.mcwl.communityCenter.domain.dto;
import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -15,15 +16,15 @@ import javax.validation.constraints.NotNull;
@ApiModel(value = "发布详情请求参数") @ApiModel(value = "发布详情请求参数")
public class PublishDetailRes { public class PublishDetailRes {
@ApiParam(value = "发布id", required = true) @ApiModelProperty(value = "发布id", required = true)
@NotNull(message = "发布id不能为空") @NotNull(message = "发布id不能为空")
private Long id; private Long publishId;
@ApiParam(value = "租户id", required = true) @ApiModelProperty(value = "租户id", required = true)
@NotNull(message = "租户id不能为空") @NotNull(message = "租户id不能为空")
private Long tenantId; private Long tenantId;
@ApiParam(value = "社区id", required = true) @ApiModelProperty(value = "社区id", required = true)
@NotNull(message = "社区id不能为空") @NotNull(message = "社区id不能为空")
private Long communityId; private Long communityId;

View File

@ -2,7 +2,9 @@ package com.mcwl.communityCenter.domain.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ -11,6 +13,8 @@ import javax.validation.constraints.NotNull;
*/ */
@Data @Data
@ApiModel(value = "点赞/取消点赞请求参数") @ApiModel(value = "点赞/取消点赞请求参数")
@NoArgsConstructor
@AllArgsConstructor
public class PublishLikeRes { public class PublishLikeRes {
/** /**

View File

@ -15,15 +15,14 @@ import javax.validation.constraints.NotNull;
public class PublishPageRes extends PageDomain { public class PublishPageRes extends PageDomain {
@NotNull(message = "社区id不能为空") @NotNull(message = "社区id不能为空")
@ApiParam(value = "社区id", required = true) @ApiModelProperty(value = "社区id", required = true)
private Long communityId; private Long communityId;
@NotNull(message = "租户id不能为空") @NotNull(message = "租户id不能为空")
@ApiParam(value = "租户id", required = true) @ApiModelProperty(value = "租户id", required = true)
private Long tenantId; private Long tenantId;
@NotNull(message = "类型不能为空") @ApiModelProperty(value = "类型 0只看星主 1精选", required = true)
@ApiParam(value = "类型 0只看星主 1精选 2问答", required = true)
private Integer type; private Integer type;
} }

View File

@ -39,11 +39,17 @@ public class PublishRes {
private String imageUrl; private String imageUrl;
/** /**
* * url
*/ */
@ApiModelProperty(value = "发布文件") @ApiModelProperty(value = "文件url")
private String fileUrl; private String fileUrl;
/**
*
*/
@ApiModelProperty(value = "文件名")
private String fileName;
/** /**
* - * -
*/ */

View File

@ -0,0 +1,36 @@
package com.mcwl.communityCenter.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
*
*/
@Data
@ApiModel(value = "取消拉黑请求参数")
public class UnBlackListRes {
/**
* id
*/
@ApiModelProperty(value = "租户id", required = true)
@NotNull(message = "租户id不能为空")
private Long tenantId;
/**
* id
*/
@ApiModelProperty(value = "社区id", required = true)
@NotNull(message = "社区id不能为空")
private Long communityId;
/**
* id
*/
@ApiModelProperty(value = "拉黑用户id", required = true)
@NotNull(message = "拉黑用户id不能为空")
private Long userId;
}

View File

@ -27,6 +27,18 @@ public class CommentVo {
@ApiModelProperty(value = "评论id") @ApiModelProperty(value = "评论id")
private Long id; private Long id;
/**
* id
*/
@ApiModelProperty(value = "租户id")
private Long tenantId;
/**
* id
*/
@ApiModelProperty(value = "社区id")
private Long communityId;
/** /**
* id * id
*/ */
@ -45,6 +57,12 @@ public class CommentVo {
@ApiModelProperty(value = "用户头像") @ApiModelProperty(value = "用户头像")
private String userAvatar; private String userAvatar;
/**
* id
*/
@ApiModelProperty(value = "父评论id")
private Long parentId;
/** /**
* *
*/ */

View File

@ -5,13 +5,65 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/** /**
* *
*/ */
@Data @Data
@ApiModel(value = "社区详情返回数据") @ApiModel(value = "社区详情返回数据")
public class CommunityDetailVo { public class CommunityDetailVo {
/**
* id
*/
@ApiModelProperty(value = "社区id")
private Long id;
/**
*
*/
@ApiModelProperty(value = "社区图片")
private String imageUrl;
/**
*
*/
@ApiModelProperty(value = "社区名称")
private String communityName;
/**
* id
*/
@ApiModelProperty(value = "社区标签")
@NotNull(message = "社区标签不能为空")
private Integer communityTag;
/**
*
*/
@ApiModelProperty(value = "社区类型 0免费 1付费")
@NotNull(message = "社区类型不能为空")
private Integer type;
/**
*
*/
@ApiModelProperty(value = "价格")
@NotNull(message = "价格不能为空")
private Double price;
/**
*
*/
@ApiModelProperty(value = "有效期天数")
@NotNull(message = "有效期天数")
private Integer validityDay;
/**
*
*/
@ApiModelProperty(value = "描述")
private String description;
} }

View File

@ -34,12 +34,6 @@ public class CommunityFileVo {
@ApiModelProperty(value = "社区id") @ApiModelProperty(value = "社区id")
private Long communityId; private Long communityId;
/**
*
*/
@ApiModelProperty(value = "文件路径")
private String fileUrl;
/** /**
* *
*/ */

View File

@ -39,6 +39,12 @@ public class CommunityUserVo {
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "用户id")
private Long userId; private Long userId;
/**
* 0 1 2
*/
@ApiModelProperty(value = "用户类型 0成员 1管理员 2群主")
private Integer userType;
/** /**
* *
*/ */
@ -51,6 +57,12 @@ public class CommunityUserVo {
@ApiModelProperty(value = "用户昵称") @ApiModelProperty(value = "用户昵称")
private String nickName; private String nickName;
/**
*
*/
@ApiModelProperty(value = "是否拉黑")
private String isBlack;
/** /**
* *
@ -65,13 +77,6 @@ public class CommunityUserVo {
@ApiModelProperty(value = "首次加入时间") @ApiModelProperty(value = "首次加入时间")
private Date startTime; private Date startTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(value = "最后活动时间")
private Date loginDate;
/** /**
* *
*/ */

View File

@ -21,6 +21,18 @@ public class CommunityVo {
@ApiModelProperty(value = "社区id") @ApiModelProperty(value = "社区id")
private Long id; private Long id;
/**
* id
*/
@ApiModelProperty(value = "租户id")
private Long tenantId;
/**
*
*/
@ApiModelProperty(value = "用户类型")
private Integer userType;
/** /**
* *
*/ */

View File

@ -0,0 +1,92 @@
package com.mcwl.communityCenter.domain.vo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mcwl.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* vo
*/
@Data
@ApiModel(description = "个人中心vo")
public class PersonHomeVo {
@ApiModelProperty(value = "id")
private Long id;
/**
* id
*/
@ApiModelProperty(value = "租户id")
private Long tenantId;
/**
* id
*/
@ApiModelProperty(value = "社区id")
private Long communityId;
/**
*
*/
@ApiModelProperty(value = "内容")
private String content;
/**
* url
*/
@ApiModelProperty(value = "文件url")
private String fileUrl;
/**
*
*/
@ApiModelProperty(value = "文件名")
private String fileName;
/**
* url
*/
@ApiModelProperty(value = "图片url")
private String imageUrl;
/**
*
*/
@ApiModelProperty(value = "点赞数")
private Integer likeNum;
/**
*
*/
@ApiModelProperty(value = "是否收藏")
private Integer isCollect;
/**
*
*/
@ApiModelProperty(value = "评论")
private List<CommentVo> commentList;
/**
*
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

View File

@ -1,5 +1,6 @@
package com.mcwl.communityCenter.domain.vo; package com.mcwl.communityCenter.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -63,16 +64,22 @@ public class PublishVo {
private String imageUrl; private String imageUrl;
/** /**
* * url
*/ */
@ApiModelProperty(value = "发布文件") @ApiModelProperty(value = "文件url")
private String fileUrl; private String fileUrl;
/** /**
* - *
*/ */
@ApiModelProperty(value = "发布时间 - 定时发布") @ApiModelProperty(value = "文件名")
private Date publishTime; private String fileName;
/**
*
*/
@ApiModelProperty(value = "是否点赞")
private Integer isLike;
/** /**
* *
@ -98,6 +105,10 @@ public class PublishVo {
@ApiModelProperty(value = "收藏") @ApiModelProperty(value = "收藏")
private Integer isCollect; private Integer isCollect;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
} }

View File

@ -24,4 +24,7 @@ public interface CommunityFileLogMapper extends BaseMapper<CommunityFileLog> {
Integer getDownloadCount(@Param("tenantId") Long tenantId, Integer getDownloadCount(@Param("tenantId") Long tenantId,
@Param("communityId") Long communityId, @Param("communityId") Long communityId,
@Param("communityFileId") Long communityFileId); @Param("communityFileId") Long communityFileId);
@InterceptorIgnore(tenantLine = "true")
void saveCommunityFileLog(@Param("communityFileLog") CommunityFileLog communityFileLog);
} }

View File

@ -20,4 +20,9 @@ public interface CommunityFileMapper extends BaseMapper<CommunityFile> {
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
List<CommunityFileVo> getCommunityFileList(Page<CommunityFile> page, @Param("communityFilePageListRes") CommunityFilePageListRes communityFilePageListRes); List<CommunityFileVo> getCommunityFileList(Page<CommunityFile> page, @Param("communityFilePageListRes") CommunityFilePageListRes communityFilePageListRes);
@InterceptorIgnore(tenantLine = "true")
CommunityFile selectCommunityFile(@Param("tenantId") Long tenantId,
@Param("communityId") Long communityId,
@Param("fileId") Long fileId);
} }

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.Community; import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.dto.EditCommunityRes;
import com.mcwl.communityCenter.domain.dto.JoinCommunityListPageRes;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -53,8 +55,8 @@ public interface CommunityMapper extends BaseMapper<Community> {
Page<Community> page, Page<Community> page,
@Param("userId") @Param("userId")
Long userId, Long userId,
@Param("searchContent") @Param("joinCommunityListPageRes")
String searchContent); JoinCommunityListPageRes joinCommunityListPageRes);
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
void quitCommunity(@Param("tenantId") Long tenantId, void quitCommunity(@Param("tenantId") Long tenantId,

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.Community; import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityUser; import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.domain.dto.CommunityUserListPageRes; import com.mcwl.communityCenter.domain.dto.CommunityUserListPageRes;
import com.mcwl.communityCenter.domain.dto.UnBlackListRes;
import com.mcwl.communityCenter.domain.vo.CommunityUserVo; import com.mcwl.communityCenter.domain.vo.CommunityUserVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -44,8 +45,10 @@ public interface CommunityUserMapper extends BaseMapper<CommunityUser> {
@Param("userId") Long userId); @Param("userId") Long userId);
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
void updateCommunityUser(@Param("blackCommunityUser") CommunityUser blackCommunityUser); void updateBlackCommunityUser(@Param("blackCommunityUser") CommunityUser blackCommunityUser);
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
List<CommunityUser> getAllCommunityUser(); List<CommunityUser> getAllCommunityUser();
void updateManageCommunityUser(@Param("manageCommunityUser") CommunityUser manageCommunityUser);
} }

View File

@ -27,7 +27,7 @@ public interface PublishCollectMapper extends BaseMapper<PublishCollect> {
void savePublishCollect(@Param("publishCollect") PublishCollect publishCollect); void savePublishCollect(@Param("publishCollect") PublishCollect publishCollect);
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
PublishCollect getPublishCollect(@Param("publishCollect") PublishCollectRes publishCollectRes, PublishCollect getPublishCollect(@Param("publishCollectRes") PublishCollectRes publishCollectRes,
@Param("userId") Long userId); @Param("userId") Long userId);
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")

View File

@ -52,4 +52,7 @@ public interface PublishMapper extends BaseMapper<Publish> {
List<PublishVo> myPublishList(Page<Publish> page, List<PublishVo> myPublishList(Page<Publish> page,
@Param("myPublishPageRes") MyPublishPageRes myPublishPageRes, @Param("myPublishPageRes") MyPublishPageRes myPublishPageRes,
@Param("userId") Long userId); @Param("userId") Long userId);
@InterceptorIgnore(tenantLine = "true")
void insertPublish(@Param("publish") Publish publish);
} }

View File

@ -11,4 +11,6 @@ public interface CommunityFileLogService extends IService<CommunityFileLog> {
List<String> getUserAvatarList(Long tenantId, Long communityId, Long communityFileId); List<String> getUserAvatarList(Long tenantId, Long communityId, Long communityFileId);
Integer getDownloadCount(Long tenantId, Long communityId, Long communityFileId); Integer getDownloadCount(Long tenantId, Long communityId, Long communityFileId);
void saveCommunityFileLog(CommunityFileLog communityFileLog);
} }

View File

@ -1,14 +1,20 @@
package com.mcwl.communityCenter.service; package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.CommunityFile; import com.mcwl.communityCenter.domain.CommunityFile;
import com.mcwl.communityCenter.domain.dto.*; import com.mcwl.communityCenter.domain.dto.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
public interface CommunityFileService extends IService<CommunityFile> { public interface CommunityFileService extends IService<CommunityFile> {
void upload(CommunityUploadFileRes communityUploadFileRes); R<String> upload(CommunityUploadFileRes communityUploadFileRes);
TableDataInfo getCommunityFileList(CommunityFilePageListRes communityFilePageListRes); TableDataInfo getCommunityFileList(CommunityFilePageListRes communityFilePageListRes);
R<String> download(@Valid CommunityDownloadFileRes communityDownloadFileRes);
} }

View File

@ -2,25 +2,21 @@ package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Community; import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.dto.CommunityListPageRes; import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.dto.CommunityRes; import com.mcwl.communityCenter.domain.vo.CommunityDetailVo;
import com.mcwl.communityCenter.domain.dto.JoinCommunityListPageRes;
import com.mcwl.communityCenter.domain.dto.JoinCommunityRes;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull;
public interface CommunityService extends IService<Community> { public interface CommunityService extends IService<Community> {
TableDataInfo listByPage(CommunityListPageRes communityListPageRes); TableDataInfo listByPage(CommunityListPageRes communityListPageRes);
/** /**
* *
* @param communityRes * @param addCommunityRes
*/ */
void addCommunity(CommunityRes communityRes); void addCommunity(AddCommunityRes addCommunityRes);
/** /**
* *
@ -44,4 +40,8 @@ public interface CommunityService extends IService<Community> {
* *
*/ */
R<Object> isJoinCommunity(JoinCommunityRes joinCommunityRes); R<Object> isJoinCommunity(JoinCommunityRes joinCommunityRes);
CommunityDetailVo getCommunityDetail(Long communityId);
void editCommunity(@Valid EditCommunityRes editCommunityRes);
} }

View File

@ -3,12 +3,11 @@ package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityUser; import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.domain.dto.BlackListRes; import com.mcwl.communityCenter.domain.dto.BlackListRes;
import com.mcwl.communityCenter.domain.dto.CommunityListPageRes;
import com.mcwl.communityCenter.domain.dto.CommunityRes;
import com.mcwl.communityCenter.domain.dto.CommunityUserListPageRes; import com.mcwl.communityCenter.domain.dto.CommunityUserListPageRes;
import com.mcwl.communityCenter.domain.dto.CommunityUserManageRes;
import com.mcwl.communityCenter.domain.dto.UnBlackListRes;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List; import java.util.List;
@ -27,5 +26,9 @@ public interface CommunityUserService extends IService<CommunityUser> {
List<CommunityUser> getAllCommunityUser(); List<CommunityUser> getAllCommunityUser();
void updateCommunityUser(CommunityUser communityUser); void updateBlankCommunityUser(CommunityUser communityUser);
R<Object> unBlack(@Valid UnBlackListRes unBlackListRes);
R<Object> manage(@Valid CommunityUserManageRes communityUserManageRes);
} }

View File

@ -28,7 +28,7 @@ public interface PublishCommentService extends IService<PublishComment> {
* @param commentDetailRes * @param commentDetailRes
* @return * @return
*/ */
R<Object> getComment(CommentDetailRes commentDetailRes); R<List<CommentVo>> getComment(CommentDetailRes commentDetailRes);
R<Object> addComment(CommentRes commentRes); R<Object> addComment(CommentRes commentRes);

View File

@ -37,4 +37,6 @@ public interface PublishService extends IService<Publish> {
TableDataInfo myPublishList(MyPublishPageRes myPublishPageRes); TableDataInfo myPublishList(MyPublishPageRes myPublishPageRes);
void collectPublish(@Valid PublishCollectRes publishCollectRes); void collectPublish(@Valid PublishCollectRes publishCollectRes);
TableDataInfo getPersonHomeList(@Valid PersonHomePageRes personHomePageRes);
} }

View File

@ -28,4 +28,9 @@ public class CommunityFileLogServiceImpl extends ServiceImpl<CommunityFileLogMap
return baseMapper.getDownloadCount(tenantId, communityId, communityFileId); return baseMapper.getDownloadCount(tenantId, communityId, communityFileId);
} }
@Override
public void saveCommunityFileLog(CommunityFileLog communityFileLog) {
baseMapper.saveCommunityFileLog(communityFileLog);
}
} }

View File

@ -1,21 +1,29 @@
package com.mcwl.communityCenter.service.impl; package com.mcwl.communityCenter.service.impl;
import cn.hutool.Hutool;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.io.file.FileNameUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.obs.ObsUtils; import com.mcwl.common.utils.obs.ObsUtils;
import com.mcwl.communityCenter.domain.CommunityFile; import com.mcwl.communityCenter.domain.CommunityFile;
import com.mcwl.communityCenter.domain.CommunityFileLog;
import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.domain.dto.*; import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.CommunityFileVo; import com.mcwl.communityCenter.domain.vo.CommunityFileVo;
import com.mcwl.communityCenter.domain.vo.DownloadFileUserVo; import com.mcwl.communityCenter.domain.vo.DownloadFileUserVo;
import com.mcwl.communityCenter.mapper.CommunityFileMapper; import com.mcwl.communityCenter.mapper.CommunityFileMapper;
import com.mcwl.communityCenter.mapper.CommunityUserMapper;
import com.mcwl.communityCenter.service.CommunityFileLogService; import com.mcwl.communityCenter.service.CommunityFileLogService;
import com.mcwl.communityCenter.service.CommunityFileService; import com.mcwl.communityCenter.service.CommunityFileService;
import com.mcwl.communityCenter.service.CommunityUserService;
import com.mcwl.system.service.ISysUserService; import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,26 +41,35 @@ public class CommunityFileServiceImpl extends ServiceImpl<CommunityFileMapper, C
private final CommunityFileLogService communityFileLogService; private final CommunityFileLogService communityFileLogService;
private final CommunityUserMapper communityUserMapper;
private static final String[] UN_UPLOAD_FILE_TYPE = new String[]{
"bmp", "dib",
"jpg", "jpeg", "jpe", "jfif",
"gif",
"tif", "tiff",
"png",
"heic",
"webp"
};
@Override @Override
public void upload(CommunityUploadFileRes communityUploadFileRes) { public R<String> upload(CommunityUploadFileRes communityUploadFileRes) {
Long tenantId = communityUploadFileRes.getTenantId(); Long tenantId = communityUploadFileRes.getTenantId();
Long communityId = communityUploadFileRes.getCommunityId(); Long communityId = communityUploadFileRes.getCommunityId();
MultipartFile file = communityUploadFileRes.getFile(); Long currentUserId = SecurityUtils.getUserId();
Map<String, String> map = obsUtils.uploadFile(file);
String filename = file.getOriginalFilename(); CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, currentUserId);
long fileSize = file.getSize(); if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员");
}
CommunityFile communityFile = BeanUtil.toBean(communityUploadFileRes, CommunityFile.class);
communityFile.setUserId(currentUserId);
CommunityFile communityFile = CommunityFile.builder()
.tenantId(tenantId)
.communityId(communityId)
.userId(SecurityUtils.getUserId())
.fileUrl(map.get("path"))
.objectKey(map.get("objectKey"))
.fileName(filename)
.fileSize(fileSize)
.build();
baseMapper.insert(communityFile); baseMapper.insert(communityFile);
return R.ok();
} }
@Override @Override
@ -62,17 +79,14 @@ public class CommunityFileServiceImpl extends ServiceImpl<CommunityFileMapper, C
for (CommunityFileVo communityFileVo : communityFileList) { for (CommunityFileVo communityFileVo : communityFileList) {
DownloadFileUserVo downloadFileUserVo = new DownloadFileUserVo(); DownloadFileUserVo downloadFileUserVo = new DownloadFileUserVo();
List<String> avatarList = communityFileLogService.getUserAvatarList(communityFileVo.getTenantId(), Long tenantId = communityFileVo.getTenantId();
communityFileVo.getCommunityId(), Long communityId = communityFileVo.getCommunityId();
communityFileVo.getId()); Long fileId = communityFileVo.getId();
Integer count = communityFileLogService.getDownloadCount(communityFileVo.getTenantId(), List<String> avatarList = communityFileLogService.getUserAvatarList(tenantId, communityId, fileId);
communityFileVo.getCommunityId(), Integer count = communityFileLogService.getDownloadCount(tenantId, communityId, fileId);
communityFileVo.getId());
downloadFileUserVo.setAvatarList(avatarList); downloadFileUserVo.setAvatarList(avatarList);
downloadFileUserVo.setCount(count); downloadFileUserVo.setCount(count);
communityFileVo.setDownloadFileUser(downloadFileUserVo); communityFileVo.setDownloadFileUser(downloadFileUserVo);
} }
// 封装返回 // 封装返回
@ -83,4 +97,35 @@ public class CommunityFileServiceImpl extends ServiceImpl<CommunityFileMapper, C
tableDataInfo.setMsg("查询成功"); tableDataInfo.setMsg("查询成功");
return tableDataInfo; return tableDataInfo;
} }
@Override
public R<String> download(CommunityDownloadFileRes communityDownloadFileRes) {
Long tenantId = communityDownloadFileRes.getTenantId();
Long communityId = communityDownloadFileRes.getCommunityId();
Long fileId = communityDownloadFileRes.getFileId();
Long currentUserId = SecurityUtils.getUserId();
CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, currentUserId);
if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员");
}
CommunityFile communityFile = baseMapper.selectCommunityFile(tenantId, communityId, fileId);
if (Objects.isNull(communityFile)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "文件不存在");
}
CommunityFileLog communityFileLog = new CommunityFileLog();
communityFileLog.setTenantId(tenantId);
communityFileLog.setCommunityId(communityId);
communityFileLog.setCommunityFileId(fileId);
communityFileLog.setDownloadUserId(currentUserId);
communityFileLogService.saveCommunityFileLog(communityFileLog);
return R.ok(communityFile.getFileUrl());
}
} }

View File

@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.core.redis.RedisCache; import com.mcwl.common.core.redis.RedisCache;
import com.mcwl.common.exception.ServiceException; import com.mcwl.common.exception.ServiceException;
@ -18,10 +17,8 @@ import com.mcwl.communityCenter.constant.AdviceConstant;
import com.mcwl.communityCenter.domain.Community; import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityAdvice; import com.mcwl.communityCenter.domain.CommunityAdvice;
import com.mcwl.communityCenter.domain.CommunityUser; import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.domain.dto.CommunityListPageRes; import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.dto.CommunityRes; import com.mcwl.communityCenter.domain.vo.CommunityDetailVo;
import com.mcwl.communityCenter.domain.dto.JoinCommunityListPageRes;
import com.mcwl.communityCenter.domain.dto.JoinCommunityRes;
import com.mcwl.communityCenter.domain.vo.CommunityVo; import com.mcwl.communityCenter.domain.vo.CommunityVo;
import com.mcwl.communityCenter.mapper.CommunityAdviceMapper; import com.mcwl.communityCenter.mapper.CommunityAdviceMapper;
import com.mcwl.communityCenter.mapper.CommunityMapper; import com.mcwl.communityCenter.mapper.CommunityMapper;
@ -74,11 +71,11 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addCommunity(CommunityRes communityRes) { public void addCommunity(AddCommunityRes addCommunityRes) {
try { try {
Community community = new Community(); Community community = new Community();
BeanUtil.copyProperties(communityRes, community); BeanUtil.copyProperties(addCommunityRes, community);
if (Objects.equals(communityRes.getType(), 0)) { if (Objects.equals(addCommunityRes.getType(), 0)) {
community.setPrice(0.0); community.setPrice(0.0);
} }
baseMapper.insert(community); baseMapper.insert(community);
@ -135,7 +132,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
Date startTime = now.getTime(); Date startTime = now.getTime();
now.add(Calendar.DAY_OF_YEAR, community.getValidityDay()); now.add(Calendar.YEAR, community.getValidityDay());
Date endTime = now.getTime(); Date endTime = now.getTime();
CommunityUser cu = CommunityUser.builder() CommunityUser cu = CommunityUser.builder()
@ -170,11 +167,9 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
@Override @Override
public TableDataInfo getMyJoinCommunity(JoinCommunityListPageRes joinCommunityListPageRes) { public TableDataInfo getMyJoinCommunity(JoinCommunityListPageRes joinCommunityListPageRes) {
Page<Community> page = new Page<>(joinCommunityListPageRes.getPageNum(), joinCommunityListPageRes.getPageSize()); Page<Community> page = new Page<>(joinCommunityListPageRes.getPageNum(), joinCommunityListPageRes.getPageSize());
OrderItem orderItem = new OrderItem("create_time", false); page.addOrder(new OrderItem("create_time", false));
page.addOrder(orderItem);
String searchContent = joinCommunityListPageRes.getSearchContent(); List<Community> communityList = baseMapper.getMyJoinCommunity(page, SecurityUtils.getUserId(), joinCommunityListPageRes);
List<Community> communityList = baseMapper.getMyJoinCommunity(page, SecurityUtils.getUserId(), searchContent);
return this.getCommunityVoTableDataInfo(communityList, page.getTotal()); return this.getCommunityVoTableDataInfo(communityList, page.getTotal());
@ -223,6 +218,18 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
return R.ok(isJoinCommunity); return R.ok(isJoinCommunity);
} }
@Override
public CommunityDetailVo getCommunityDetail(Long communityId) {
Community community = baseMapper.selectById(communityId);
return BeanUtil.toBean(community, CommunityDetailVo.class);
}
@Override
public void editCommunity(EditCommunityRes editCommunityRes) {
Community community = BeanUtil.toBean(editCommunityRes, Community.class);
baseMapper.updateById(community);
}
private TableDataInfo getCommunityVoTableDataInfo(List<Community> communityList, Long total) { private TableDataInfo getCommunityVoTableDataInfo(List<Community> communityList, Long total) {
@ -261,8 +268,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
LocalDate currentLocalDate = LocalDate.now(ZoneId.systemDefault()); LocalDate currentLocalDate = LocalDate.now(ZoneId.systemDefault());
for (Community community : communityList) { for (Community community : communityList) {
CommunityVo communityVo = new CommunityVo(); CommunityVo communityVo = BeanUtil.toBean(community, CommunityVo.class);
BeanUtil.copyProperties(community, communityVo);
// 当前时间和创建时间差 // 当前时间和创建时间差
Date createTime = community.getCreateTime(); Date createTime = community.getCreateTime();
LocalDate createLocalDate = createTime.toInstant() LocalDate createLocalDate = createTime.toInstant()
@ -270,6 +276,10 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
.toLocalDate(); .toLocalDate();
long daysBetween = ChronoUnit.DAYS.between(createLocalDate, currentLocalDate); long daysBetween = ChronoUnit.DAYS.between(createLocalDate, currentLocalDate);
SysUser sysUser = sysUserService.selectUserById(community.getTenantId()); SysUser sysUser = sysUserService.selectUserById(community.getTenantId());
CommunityUser communityUser = communityUserMapper.selectCommunityUser(community.getTenantId(), community.getId(), SecurityUtils.getUserId());
if (Objects.nonNull(communityUser)) {
communityVo.setUserType(communityUser.getUserType());
}
communityVo.setUserId(community.getTenantId()); communityVo.setUserId(community.getTenantId());
communityVo.setAvatar(sysUser.getAvatar()); communityVo.setAvatar(sysUser.getAvatar());
communityVo.setNickName(sysUser.getNickName()); communityVo.setNickName(sysUser.getNickName());

View File

@ -1,35 +1,24 @@
package com.mcwl.communityCenter.service.impl; package com.mcwl.communityCenter.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityUser; import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.domain.dto.BlackListRes; import com.mcwl.communityCenter.domain.dto.BlackListRes;
import com.mcwl.communityCenter.domain.dto.CommunityListPageRes;
import com.mcwl.communityCenter.domain.dto.CommunityRes;
import com.mcwl.communityCenter.domain.dto.CommunityUserListPageRes; import com.mcwl.communityCenter.domain.dto.CommunityUserListPageRes;
import com.mcwl.communityCenter.domain.dto.CommunityUserManageRes;
import com.mcwl.communityCenter.domain.dto.UnBlackListRes;
import com.mcwl.communityCenter.domain.vo.CommunityUserVo; import com.mcwl.communityCenter.domain.vo.CommunityUserVo;
import com.mcwl.communityCenter.domain.vo.CommunityVo;
import com.mcwl.communityCenter.mapper.CommunityMapper;
import com.mcwl.communityCenter.mapper.CommunityUserMapper; import com.mcwl.communityCenter.mapper.CommunityUserMapper;
import com.mcwl.communityCenter.service.CommunityService;
import com.mcwl.communityCenter.service.CommunityUserService; import com.mcwl.communityCenter.service.CommunityUserService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
@Service @Service
@ -43,7 +32,7 @@ public class CommunityUserServiceImpl extends ServiceImpl<CommunityUserMapper, C
@Override @Override
public TableDataInfo getCommunityUserList(CommunityUserListPageRes communityUserListPageRes) { public TableDataInfo getCommunityUserList(CommunityUserListPageRes communityUserListPageRes) {
Page<CommunityUser> page = new Page<>(communityUserListPageRes.getPageNum(), communityUserListPageRes.getPageSize()); Page<CommunityUser> page = new Page<>(communityUserListPageRes.getPageNum(), communityUserListPageRes.getPageSize());
page.addOrder(new OrderItem("create_time", false)); // page.addOrder(new OrderItem("cu.create_time", false));
List<CommunityUserVo> communityUserList = baseMapper.getCommunityUserList(page, communityUserListPageRes); List<CommunityUserVo> communityUserList = baseMapper.getCommunityUserList(page, communityUserListPageRes);
@ -82,7 +71,7 @@ public class CommunityUserServiceImpl extends ServiceImpl<CommunityUserMapper, C
return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户不在该社区中"); return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户不在该社区中");
} }
if ("1".equals(blackCommunityUser.getIsBlank())) { if ("1".equals(blackCommunityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户已拉黑"); return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户已拉黑");
} }
@ -93,11 +82,11 @@ public class CommunityUserServiceImpl extends ServiceImpl<CommunityUserMapper, C
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, blackDay); calendar.add(Calendar.DATE, blackDay);
blackCommunityUser.setIsBlank("1"); blackCommunityUser.setIsBlack("1");
blackCommunityUser.setBlankEndTime(calendar.getTime()); blackCommunityUser.setBlackEndTime(calendar.getTime());
blackCommunityUser.setBlackReason(blackReason); blackCommunityUser.setBlackReason(blackReason);
baseMapper.updateCommunityUser(blackCommunityUser); baseMapper.updateBlackCommunityUser(blackCommunityUser);
return R.ok(); return R.ok();
@ -109,7 +98,76 @@ public class CommunityUserServiceImpl extends ServiceImpl<CommunityUserMapper, C
} }
@Override @Override
public void updateCommunityUser(CommunityUser communityUser) { public void updateBlankCommunityUser(CommunityUser communityUser) {
baseMapper.updateCommunityUser(communityUser); baseMapper.updateBlackCommunityUser(communityUser);
}
@Override
public R<Object> unBlack(UnBlackListRes unBlackListRes) {
Long tenantId = unBlackListRes.getTenantId();
Long communityId = unBlackListRes.getCommunityId();
Long unBlankUserId = unBlackListRes.getUserId();
Long currentUserId = SecurityUtils.getUserId();
// 当前用户
CommunityUser currentCommunityUser = baseMapper.selectCommunityUser(tenantId, communityId, currentUserId);
if (Objects.isNull(currentCommunityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区用户");
}
if (Objects.equals(currentCommunityUser.getUserType(), 0)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是群主/管理员,无法取消拉黑");
}
// 被取消拉黑的用户
CommunityUser unBlackCommunityUser = baseMapper.selectCommunityUser(tenantId, communityId, unBlankUserId);
if (Objects.isNull(unBlackCommunityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户不在该社区中");
}
CommunityUser communityUser = BeanUtil.toBean(unBlackCommunityUser, CommunityUser.class);
communityUser.setIsBlack("0");
communityUser.setBlackReason(null);
communityUser.setBlackEndTime(null);
baseMapper.updateBlackCommunityUser(communityUser);
return R.ok("取消成功");
}
@Override
public R<Object> manage(CommunityUserManageRes communityUserManageRes) {
Long tenantId = communityUserManageRes.getTenantId();
Long communityId = communityUserManageRes.getCommunityId();
Long manageUserId = communityUserManageRes.getUserId();
Long currentUserId = SecurityUtils.getUserId();
// 当前用户
CommunityUser currentCommunityUser = baseMapper.selectCommunityUser(tenantId, communityId, currentUserId);
if (Objects.isNull(currentCommunityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区用户");
}
if (!Objects.equals(currentCommunityUser.getUserType(), 2)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是群主,无法设置管理");
}
// 设置管理的用户
CommunityUser manageCommunityUser = baseMapper.selectCommunityUser(tenantId, communityId, manageUserId);
if (Objects.isNull(manageCommunityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户不在该社区中");
}
if (Objects.equals(manageCommunityUser.getUserType(), 2)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户已经是群主");
}
if (Objects.equals(manageCommunityUser.getUserType(), 1)) {
manageCommunityUser.setUserType(0);
} else {
manageCommunityUser.setUserType(1);
}
baseMapper.updateManageCommunityUser(manageCommunityUser);
return R.ok("设置成功");
} }
} }

View File

@ -63,6 +63,7 @@ public class IncomeInfoServiceImpl extends ServiceImpl<IncomeInfoMapper, IncomeI
@Override @Override
public TableDataInfo incomeList(IncomeInfoListPageRes incomeInfoListPageRes) { public TableDataInfo incomeList(IncomeInfoListPageRes incomeInfoListPageRes) {
Page<IncomeInfo> page = this.initPage(incomeInfoListPageRes); Page<IncomeInfo> page = this.initPage(incomeInfoListPageRes);
page.addOrder(new OrderItem("ii.create_time", false));
List<IncomeInfoListVo> incomeInfoList = baseMapper.incomeList(page, incomeInfoListPageRes); List<IncomeInfoListVo> incomeInfoList = baseMapper.incomeList(page, incomeInfoListPageRes);
@ -76,9 +77,7 @@ public class IncomeInfoServiceImpl extends ServiceImpl<IncomeInfoMapper, IncomeI
} }
private Page<IncomeInfo> initPage(PageDomain pageDomain) { private Page<IncomeInfo> initPage(PageDomain pageDomain) {
Page<IncomeInfo> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize()); return new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
page.addOrder(new OrderItem("create_time", false));
return page;
} }
} }

View File

@ -120,7 +120,7 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
Date startTime = now.getTime(); Date startTime = now.getTime();
now.add(Calendar.DAY_OF_YEAR, community.getValidityDay()); now.add(Calendar.YEAR, community.getValidityDay());
Date endTime = now.getTime(); Date endTime = now.getTime();
communityUserMapper.insert(CommunityUser communityUserMapper.insert(CommunityUser

View File

@ -15,12 +15,15 @@ import com.mcwl.communityCenter.domain.Publish;
import com.mcwl.communityCenter.domain.PublishCollect; import com.mcwl.communityCenter.domain.PublishCollect;
import com.mcwl.communityCenter.domain.Question; import com.mcwl.communityCenter.domain.Question;
import com.mcwl.communityCenter.domain.dto.*; import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.CommentVo;
import com.mcwl.communityCenter.domain.vo.PersonHomeVo;
import com.mcwl.communityCenter.domain.vo.PublishVo; import com.mcwl.communityCenter.domain.vo.PublishVo;
import com.mcwl.communityCenter.mapper.CommunityMapper; import com.mcwl.communityCenter.mapper.CommunityMapper;
import com.mcwl.communityCenter.mapper.InviteMapper; import com.mcwl.communityCenter.mapper.InviteMapper;
import com.mcwl.communityCenter.mapper.PublishCollectMapper; import com.mcwl.communityCenter.mapper.PublishCollectMapper;
import com.mcwl.communityCenter.mapper.PublishMapper; import com.mcwl.communityCenter.mapper.PublishMapper;
import com.mcwl.communityCenter.service.PublishCollectService; import com.mcwl.communityCenter.service.PublishCollectService;
import com.mcwl.communityCenter.service.PublishCommentService;
import com.mcwl.communityCenter.service.PublishService; import com.mcwl.communityCenter.service.PublishService;
import com.mcwl.system.service.ISysUserService; import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -32,18 +35,35 @@ import java.util.*;
@RequiredArgsConstructor @RequiredArgsConstructor
public class PublishCollectServiceImpl extends ServiceImpl<PublishCollectMapper, PublishCollect> implements PublishCollectService { public class PublishCollectServiceImpl extends ServiceImpl<PublishCollectMapper, PublishCollect> implements PublishCollectService {
private final PublishCommentService publishCommentService;
@Override @Override
public TableDataInfo myCollectList(MyPublishCollectPageRes myPublishCollectPageRes) { public TableDataInfo myCollectList(MyPublishCollectPageRes myPublishCollectPageRes) {
Page<PublishCollect> page = initPage(myPublishCollectPageRes); Page<PublishCollect> page = initPage(myPublishCollectPageRes);
page.addOrder(new OrderItem("p.create_time", false));
List<PublishVo> publishVoList = baseMapper.myCollectList(page, myPublishCollectPageRes, SecurityUtils.getUserId()); List<PublishVo> publishVoList = baseMapper.myCollectList(page, myPublishCollectPageRes, SecurityUtils.getUserId());
List<PersonHomeVo> personHomeVoList = new ArrayList<>();
for (PublishVo publishVo : publishVoList) {
PersonHomeVo personHomeVo = BeanUtil.toBean(publishVo, PersonHomeVo.class);
CommentDetailRes commentDetailRes = new CommentDetailRes();
commentDetailRes.setTenantId(myPublishCollectPageRes.getTenantId());
commentDetailRes.setCommunityId(myPublishCollectPageRes.getCommunityId());
commentDetailRes.setOperatorId(publishVo.getId());
List<CommentVo> commentVoList = publishCommentService.getComment(commentDetailRes).getData();
personHomeVo.setCommentList(commentVoList);
personHomeVoList.add(personHomeVo);
}
// 封装分页信息 // 封装分页信息
TableDataInfo rspData = new TableDataInfo(); TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS); rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功"); rspData.setMsg("查询成功");
rspData.setRows(publishVoList); rspData.setRows(personHomeVoList);
rspData.setTotal(page.getTotal()); rspData.setTotal(page.getTotal());
return rspData; return rspData;
} }
@ -64,9 +84,7 @@ public class PublishCollectServiceImpl extends ServiceImpl<PublishCollectMapper,
} }
private Page<PublishCollect> initPage(PageDomain pageDomain) { private Page<PublishCollect> initPage(PageDomain pageDomain) {
Page<PublishCollect> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize()); return new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
page.addOrder(new OrderItem("create_time", false));
return page;
} }

View File

@ -57,7 +57,7 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
private final CommunityUserMapper communityUserMapper; private final CommunityUserMapper communityUserMapper;
@Override @Override
public R<Object> getComment(CommentDetailRes commentDetailRes) { public R<List<CommentVo>> getComment(CommentDetailRes commentDetailRes) {
Long tenantId = commentDetailRes.getTenantId(); Long tenantId = commentDetailRes.getTenantId();
Long communityId = commentDetailRes.getCommunityId(); Long communityId = commentDetailRes.getCommunityId();
Long operatorId = commentDetailRes.getOperatorId(); Long operatorId = commentDetailRes.getOperatorId();
@ -90,7 +90,7 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
return R.fail(HttpStatus.SHOW_ERROR_MSG,"评论失败,您不是该社区成员"); return R.fail(HttpStatus.SHOW_ERROR_MSG,"评论失败,您不是该社区成员");
} }
if ("1".equals(communityUser.getIsBlank())) { if ("1".equals(communityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"评论失败,您已被拉黑"); return R.fail(HttpStatus.SHOW_ERROR_MSG,"评论失败,您已被拉黑");
} }
@ -101,7 +101,7 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
PublishComment publishComment = new PublishComment(); PublishComment publishComment = new PublishComment();
BeanUtil.copyProperties(commentRes, publishComment); BeanUtil.copyProperties(commentRes, publishComment);
publishComment.setOperatorId(operatorId); publishComment.setPublishId(operatorId);
publishComment.setUserId(SecurityUtils.getUserId()); publishComment.setUserId(SecurityUtils.getUserId());
publishComment.setType(0); publishComment.setType(0);

View File

@ -51,7 +51,7 @@ public class PublishLikeServiceImpl extends ServiceImpl<PublishLikeMapper, Publi
throw new ServiceException("点赞失败,您不是该社区成员", HttpStatus.SHOW_ERROR_MSG); throw new ServiceException("点赞失败,您不是该社区成员", HttpStatus.SHOW_ERROR_MSG);
} }
if ("1".equals(communityUser.getIsBlank())) { if ("1".equals(communityUser.getIsBlack())) {
throw new ServiceException("点赞失败,您已被拉黑", HttpStatus.SHOW_ERROR_MSG); throw new ServiceException("点赞失败,您已被拉黑", HttpStatus.SHOW_ERROR_MSG);
} }

View File

@ -19,16 +19,18 @@ import com.mcwl.common.utils.StringUtils;
import com.mcwl.communityCenter.constant.AdviceConstant; import com.mcwl.communityCenter.constant.AdviceConstant;
import com.mcwl.communityCenter.domain.*; import com.mcwl.communityCenter.domain.*;
import com.mcwl.communityCenter.domain.dto.*; import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.CommentVo;
import com.mcwl.communityCenter.domain.vo.PersonHomeVo;
import com.mcwl.communityCenter.domain.vo.PublishVo; import com.mcwl.communityCenter.domain.vo.PublishVo;
import com.mcwl.communityCenter.mapper.*; import com.mcwl.communityCenter.mapper.*;
import com.mcwl.communityCenter.service.PublishCollectService; import com.mcwl.communityCenter.service.*;
import com.mcwl.communityCenter.service.PublishService;
import com.mcwl.system.service.ISysUserService; import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import nonapi.io.github.classgraph.concurrency.AutoCloseableExecutorService; import nonapi.io.github.classgraph.concurrency.AutoCloseableExecutorService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.temporal.ValueRange;
import java.util.*; import java.util.*;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
@ -46,19 +48,26 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
private final PublishCollectService publishCollectService; private final PublishCollectService publishCollectService;
private final PublishCommentService publishCommentService;
private final PublishMapper publishMapper; private final PublishMapper publishMapper;
private final PublishLikeMapper publishLikeMapper;
private final CommunityAdviceMapper communityAdviceMapper; private final CommunityAdviceMapper communityAdviceMapper;
private final QuestionService questionService;
@Override @Override
public PublishVo getDetail(PublishDetailRes publishDetailRes) { public PublishVo getDetail(PublishDetailRes publishDetailRes) {
Long id = publishDetailRes.getId(); Long publishId = publishDetailRes.getPublishId();
Long tenantId = publishDetailRes.getTenantId(); Long tenantId = publishDetailRes.getTenantId();
Long communityId = publishDetailRes.getCommunityId(); Long communityId = publishDetailRes.getCommunityId();
// 根据id和租户id和社区id查询发布信息 // 根据id和租户id和社区id查询发布信息
Publish publish = baseMapper.selectByIdAndTenantIdAndCommunityId(id, tenantId, communityId); Publish publish = baseMapper.selectByIdAndTenantIdAndCommunityId(publishId, tenantId, communityId);
if (Objects.isNull(publish)) { if (Objects.isNull(publish)) {
return null; return null;
@ -90,7 +99,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员"); return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员");
} }
if ("1".equals(communityUser.getIsBlank())) { if ("1".equals(communityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您已被拉黑"); return R.fail(HttpStatus.SHOW_ERROR_MSG, "您已被拉黑");
} }
@ -100,7 +109,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
if (Objects.isNull(publish.getPublishTime())) { if (Objects.isNull(publish.getPublishTime())) {
publish.setPublishTime(new Date()); publish.setPublishTime(new Date());
} }
baseMapper.insert(publish); baseMapper.insertPublish(publish);
return R.ok(); return R.ok();
} }
@ -108,6 +117,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
public TableDataInfo getPublishList(PublishPageRes publishPageRes) { public TableDataInfo getPublishList(PublishPageRes publishPageRes) {
Page<Publish> page = this.initPage(publishPageRes); Page<Publish> page = this.initPage(publishPageRes);
page.addOrder(new OrderItem("create_time", false));
// 根据租户id和社区id查询分页数据 // 根据租户id和社区id查询分页数据
baseMapper.selectByTenantIdAndCommunityIdPage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId()); baseMapper.selectByTenantIdAndCommunityIdPage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
@ -139,6 +149,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
public TableDataInfo publishImage(PublishPageRes publishPageRes) { public TableDataInfo publishImage(PublishPageRes publishPageRes) {
Page<Publish> page = this.initPage(publishPageRes); Page<Publish> page = this.initPage(publishPageRes);
page.addOrder(new OrderItem("create_time", false));
// 根据租户id和社区id和fileUrl不为空查询分页数据 // 根据租户id和社区id和fileUrl不为空查询分页数据
baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId()); baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
@ -168,6 +179,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
@Override @Override
public TableDataInfo publishFile(PublishPageRes publishPageRes) { public TableDataInfo publishFile(PublishPageRes publishPageRes) {
Page<Publish> page = this.initPage(publishPageRes); Page<Publish> page = this.initPage(publishPageRes);
page.addOrder(new OrderItem("create_time", false));
// 根据租户id和社区id和imageUrl不为空查询分页数据 // 根据租户id和社区id和imageUrl不为空查询分页数据
baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId()); baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
@ -202,11 +214,38 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
@Override @Override
public TableDataInfo publishList(PublishPageRes publishPageRes) { public TableDataInfo publishList(PublishPageRes publishPageRes) {
Page<Publish> page = this.initPage(publishPageRes); Page<Publish> page = this.initPage(publishPageRes);
page.addOrder(new OrderItem("create_time", false));
List<Publish> publishList = baseMapper.publishList(page, publishPageRes); List<Publish> publishList = baseMapper.publishList(page, publishPageRes);
List<PublishVo> publishVoList = BeanUtil.copyToList(publishList, PublishVo.class);
for (PublishVo publishVo : publishVoList) {
SysUser sysUser = sysUserService.selectUserById(publishVo.getUserId());
publishVo.setUserName(sysUser.getNickName());
publishVo.setAvatar(sysUser.getAvatar());
PublishLikeRes publishLikeRes = new PublishLikeRes(publishVo.getTenantId(), publishVo.getCommunityId(), publishVo.getId());
PublishLike publishLike = publishLikeMapper.selectPublishLike(publishLikeRes, SecurityUtils.getUserId());
if (Objects.nonNull(publishLike)) {
publishVo.setIsLike(1);
} else {
publishVo.setIsLike(0);
}
PublishCollectRes publishCollectRes = new PublishCollectRes(publishVo.getTenantId(), publishVo.getCommunityId(), publishVo.getId());
PublishCollect publishCollect = publishCollectService.getPublishCollect(publishCollectRes, SecurityUtils.getUserId());
if (Objects.nonNull(publishCollect)) {
publishVo.setIsCollect(1);
} else {
publishVo.setIsCollect(0);
}
}
// 封装返回 // 封装返回
TableDataInfo tableDataInfo = new TableDataInfo(); TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(publishList); tableDataInfo.setRows(publishVoList);
tableDataInfo.setTotal(page.getTotal()); tableDataInfo.setTotal(page.getTotal());
tableDataInfo.setCode(HttpStatus.SUCCESS); tableDataInfo.setCode(HttpStatus.SUCCESS);
tableDataInfo.setMsg("查询成功"); tableDataInfo.setMsg("查询成功");
@ -216,11 +255,28 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
@Override @Override
public TableDataInfo myPublishList(MyPublishPageRes myPublishPageRes) { public TableDataInfo myPublishList(MyPublishPageRes myPublishPageRes) {
Page<Publish> page = this.initPage(myPublishPageRes); Page<Publish> page = this.initPage(myPublishPageRes);
page.addOrder(new OrderItem("p.create_time", false));
List<PublishVo> publishVoList = baseMapper.myPublishList(page, myPublishPageRes, SecurityUtils.getUserId()); List<PublishVo> publishVoList = baseMapper.myPublishList(page, myPublishPageRes, SecurityUtils.getUserId());
List<PersonHomeVo> personHomeVoList = new ArrayList<>();
for (PublishVo publishVo : publishVoList) {
PersonHomeVo personHomeVo = BeanUtil.toBean(publishVo, PersonHomeVo.class);
CommentDetailRes commentDetailRes = new CommentDetailRes();
commentDetailRes.setTenantId(myPublishPageRes.getTenantId());
commentDetailRes.setCommunityId(myPublishPageRes.getCommunityId());
commentDetailRes.setOperatorId(publishVo.getId());
List<CommentVo> commentVoList = publishCommentService.getComment(commentDetailRes).getData();
personHomeVo.setCommentList(commentVoList);
personHomeVoList.add(personHomeVo);
}
// 封装返回 // 封装返回
TableDataInfo tableDataInfo = new TableDataInfo(); TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(publishVoList); tableDataInfo.setRows(personHomeVoList);
tableDataInfo.setTotal(page.getTotal()); tableDataInfo.setTotal(page.getTotal());
tableDataInfo.setCode(HttpStatus.SUCCESS); tableDataInfo.setCode(HttpStatus.SUCCESS);
tableDataInfo.setMsg("查询成功"); tableDataInfo.setMsg("查询成功");
@ -279,10 +335,20 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
communityAdviceMapper.insert(communityAdvice); communityAdviceMapper.insert(communityAdvice);
} }
private Page<Publish> initPage(PageDomain pageDomain) { @Override
Page<Publish> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize()); public TableDataInfo getPersonHomeList(PersonHomePageRes personHomePageRes) {
page.addOrder(new OrderItem("create_time", false)); Integer type = personHomePageRes.getType();
switch (type) {
case 1:
return questionService.myQuestionList(BeanUtil.toBean(personHomePageRes, QuestionPageRes.class));
case 2:
return publishCollectService.myCollectList(BeanUtil.toBean(personHomePageRes, MyPublishCollectPageRes.class));
default:
return this.myPublishList(BeanUtil.toBean(personHomePageRes, MyPublishPageRes.class));
}
}
return page; private Page<Publish> initPage(PageDomain pageDomain) {
return new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
} }
} }

View File

@ -59,7 +59,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
if (Objects.isNull(communityUser)) { if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员,不能评论"); return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员,不能评论");
} }
if ("1".equals(communityUser.getIsBlank())) { if ("1".equals(communityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"您已被拉黑"); return R.fail(HttpStatus.SHOW_ERROR_MSG,"您已被拉黑");
} }
@ -169,11 +169,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
Page<QuestionComment> page = new Page<>(questionCommentPageRes.getPageNum(), questionCommentPageRes.getPageSize()); Page<QuestionComment> page = new Page<>(questionCommentPageRes.getPageNum(), questionCommentPageRes.getPageSize());
if (StringUtils.isBlank(questionCommentPageRes.getOrderByColumn())) { page.addOrder(new OrderItem("create_time", false));
questionCommentPageRes.setOrderByColumn("create_time");
}
OrderItem orderItem = OrderItem.desc(questionCommentPageRes.getOrderByColumn());
page.addOrder(orderItem);
return page; return page;

View File

@ -15,13 +15,14 @@ import com.mcwl.common.utils.StringUtils;
import com.mcwl.communityCenter.constant.AdviceConstant; import com.mcwl.communityCenter.constant.AdviceConstant;
import com.mcwl.communityCenter.constant.StatusConstant; import com.mcwl.communityCenter.constant.StatusConstant;
import com.mcwl.communityCenter.domain.*; import com.mcwl.communityCenter.domain.*;
import com.mcwl.communityCenter.domain.dto.QuestionDetailRes; import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.dto.QuestionPageRes; import com.mcwl.communityCenter.domain.vo.CommentVo;
import com.mcwl.communityCenter.domain.dto.QuestionReplyRes; import com.mcwl.communityCenter.domain.vo.PersonHomeVo;
import com.mcwl.communityCenter.domain.dto.QuestionRes; import com.mcwl.communityCenter.domain.vo.QuestionCommentVo;
import com.mcwl.communityCenter.domain.vo.QuestionVo; import com.mcwl.communityCenter.domain.vo.QuestionVo;
import com.mcwl.communityCenter.mapper.*; import com.mcwl.communityCenter.mapper.*;
import com.mcwl.communityCenter.service.CommunityService; import com.mcwl.communityCenter.service.CommunityService;
import com.mcwl.communityCenter.service.QuestionCommentService;
import com.mcwl.communityCenter.service.QuestionService; import com.mcwl.communityCenter.service.QuestionService;
import com.mcwl.system.service.ISysUserService; import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -49,6 +50,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
private final CommunityUserMapper communityUserMapper; private final CommunityUserMapper communityUserMapper;
private final QuestionCommentService questionCommentService;
/** /**
* *
* *
@ -70,18 +73,14 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
return R.fail(HttpStatus.SHOW_ERROR_MSG, "租户或社区不存在"); return R.fail(HttpStatus.SHOW_ERROR_MSG, "租户或社区不存在");
} }
if (Objects.equals(questionUserId, userId)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不能提问自己的问题");
}
//提问人userId是否在社区中 //提问人userId是否在社区中
CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, userId); CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, userId);
if (Objects.isNull(communityUser)) { if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员,不能提问"); return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员,不能提问");
} }
if ("1".equals(communityUser.getIsBlank())) { if ("1".equals(communityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"您已被拉黑"); return R.fail(HttpStatus.SHOW_ERROR_MSG, "您已被拉黑");
} }
Question question = new Question(); Question question = new Question();
@ -239,13 +238,38 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
public TableDataInfo myQuestionList(QuestionPageRes questionPageRes) { public TableDataInfo myQuestionList(QuestionPageRes questionPageRes) {
Page<Question> page = initPage(questionPageRes); Page<Question> page = initPage(questionPageRes);
List<Question> questionList = baseMapper.myQuestionList(page, questionPageRes, SecurityUtils.getUserId()); List<Question> questionList = baseMapper.myQuestionList(page, questionPageRes, SecurityUtils.getUserId());
List<PersonHomeVo> personHomeVoList = new ArrayList<>();
for (Question question : questionList) {
PersonHomeVo personHomeVo = BeanUtil.toBean(question, PersonHomeVo.class);
personHomeVo.setImageUrl(question.getQuestionUrl());
List<CommentVo> commentList = new ArrayList<>();
QuestionCommentPageRes questionCommentPageRes = new QuestionCommentPageRes();
questionCommentPageRes.setTenantId(questionPageRes.getTenantId());
questionCommentPageRes.setCommunityId(questionPageRes.getCommunityId());
questionCommentPageRes.setQuestionId(question.getId());
questionCommentPageRes.setPageNum(1);
questionCommentPageRes.setPageSize(10);
TableDataInfo tableDataInfo = questionCommentService.listByPage(questionCommentPageRes);
List<QuestionCommentVo> questionCommentList = (List<QuestionCommentVo>) tableDataInfo.getRows();
for (QuestionCommentVo questionCommentVo : questionCommentList) {
CommentVo commentVo = BeanUtil.toBean(questionCommentVo, CommentVo.class);
SysUser sysUser = sysUserService.selectUserById(questionCommentVo.getUserId());
commentVo.setUserName(sysUser.getNickName());
commentVo.setUserAvatar(sysUser.getAvatar());
commentList.add(commentVo);
}
personHomeVo.setCommentList(commentList);
personHomeVoList.add(personHomeVo);
}
// 封装分页信息 // 封装分页信息
TableDataInfo rspData = new TableDataInfo(); TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS); rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功"); rspData.setMsg("查询成功");
rspData.setRows(questionList); rspData.setRows(personHomeVoList);
rspData.setTotal(page.getTotal()); rspData.setTotal(page.getTotal());
return rspData; return rspData;
} }

View File

@ -23,12 +23,12 @@ public class CommunityUserTask {
List<CommunityUser> communityUserList = communityUserService.getAllCommunityUser(); List<CommunityUser> communityUserList = communityUserService.getAllCommunityUser();
for (CommunityUser communityUser : communityUserList) { for (CommunityUser communityUser : communityUserList) {
String isBlank = communityUser.getIsBlank(); String isBlank = communityUser.getIsBlack();
if ("1".equals(isBlank) && communityUser.getBlankEndTime().getTime() < System.currentTimeMillis()) { if ("1".equals(isBlank) && communityUser.getBlackEndTime().getTime() < System.currentTimeMillis()) {
communityUser.setIsBlank("0"); communityUser.setIsBlack("0");
communityUser.setBlankEndTime(null); communityUser.setBlackEndTime(null);
communityUser.setBlackReason(null); communityUser.setBlackReason(null);
communityUserService.updateCommunityUser(communityUser); communityUserService.updateBlankCommunityUser(communityUser);
} }
} }

View File

@ -3,6 +3,12 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.CommunityFileLogMapper"> <mapper namespace="com.mcwl.communityCenter.mapper.CommunityFileLogMapper">
<insert id="saveCommunityFileLog">
insert into cc_community_file_log
(tenant_id, community_id, community_file_id, download_user_id)
values (#{communityFileLog.tenantId}, #{communityFileLog.communityId}, #{communityFileLog.communityFileId},
#{communityFileLog.downloadUserId})
</insert>
<select id="getUserAvatarList" resultType="java.lang.String"> <select id="getUserAvatarList" resultType="java.lang.String">
select su.avatar select su.avatar

View File

@ -17,4 +17,12 @@
</if> </if>
order by cf.create_time desc order by cf.create_time desc
</select> </select>
<select id="selectCommunityFile" resultType="com.mcwl.communityCenter.domain.CommunityFile">
select *
from cc_community_file
where tenant_id = #{tenantId}
and community_id = #{communityId}
and id = #{fileId}
and del_flag = '0'
</select>
</mapper> </mapper>

View File

@ -109,9 +109,15 @@
where cu.user_id = #{userId} where cu.user_id = #{userId}
and c.del_flag = '0' and c.del_flag = '0'
and cu.del_flag = '0' and cu.del_flag = '0'
<if test="searchContent != null and searchContent != ''"> <if test="joinCommunityListPageRes.isMyCreate == 1">
and (c.community_name like concat('%', #{searchContent}, '%') and c.tenant_id = #{userId}
or c.description like concat('%', #{searchContent}, '%')) </if>
<if test="joinCommunityListPageRes.isMyCreate == 0">
and c.tenant_id != #{userId}
</if>
<if test="joinCommunityListPageRes.searchContent != null and joinCommunityListPageRes.searchContent != ''">
and (c.community_name like concat('%', #{joinCommunityListPageRes.searchContent}, '%')
or c.description like concat('%', #{joinCommunityListPageRes.searchContent}, '%'))
</if> </if>
</select> </select>
</mapper> </mapper>

View File

@ -3,27 +3,40 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.CommunityUserMapper"> <mapper namespace="com.mcwl.communityCenter.mapper.CommunityUserMapper">
<update id="updateCommunityUser"> <update id="updateBlackCommunityUser">
update cc_community_user update cc_community_user
set is_blank = #{blackCommunityUser.isBlank}, set is_black = #{blackCommunityUser.isBlack},
start_time = #{blackCommunityUser.startTime}, black_reason = #{blackCommunityUser.blackReason},
end_time = #{blackCommunityUser.endTime} black_end_time = #{blackCommunityUser.blackEndTime}
where tenant_id = #{blackCommunityUser.tenantId} where tenant_id = #{blackCommunityUser.tenantId}
and community_id = #{blackCommunityUser.communityId} and community_id = #{blackCommunityUser.communityId}
and user_id = #{blackCommunityUser.userId} and user_id = #{blackCommunityUser.userId}
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null))
and del_flag = '0';
</update>
<update id="updateManageCommunityUser">
update cc_community_user
set user_type = #{manageCommunityUser.userType}
where tenant_id = #{manageCommunityUser.tenantId}
and community_id = #{manageCommunityUser.communityId}
and user_id = #{manageCommunityUser.userId}
and (black_end_time is null or NOW() &gt;= black_end_time)
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null))
and del_flag = '0'; and del_flag = '0';
</update> </update>
<select id="selectByTenantIdAndCommunityIdAndUserId" <select id="selectByTenantIdAndCommunityIdAndUserId"
resultType="com.mcwl.communityCenter.domain.CommunityUser"> resultType="com.mcwl.communityCenter.domain.CommunityUser">
select id, select *
tenant_id,
community_id,
user_id
from cc_community_user from cc_community_user
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and community_id = #{communityId} and community_id = #{communityId}
and user_id = #{userId} and user_id = #{userId}
and (black_end_time is null or NOW() &gt;= black_end_time)
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null))
and del_flag = '0'; and del_flag = '0';
</select> </select>
<select id="getJoinNum" resultType="java.lang.Integer"> <select id="getJoinNum" resultType="java.lang.Integer">
@ -31,6 +44,8 @@
from cc_community_user from cc_community_user
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and community_id = #{communityId} and community_id = #{communityId}
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null))
and del_flag = '0'; and del_flag = '0';
</select> </select>
<select id="isJoinCommunity" resultType="java.lang.Integer"> <select id="isJoinCommunity" resultType="java.lang.Integer">
@ -39,6 +54,8 @@
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and community_id = #{communityId} and community_id = #{communityId}
and user_id = #{userId} and user_id = #{userId}
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null))
and del_flag = '0'; and del_flag = '0';
</select> </select>
<select id="getCommunityUserList" resultType="com.mcwl.communityCenter.domain.vo.CommunityUserVo"> <select id="getCommunityUserList" resultType="com.mcwl.communityCenter.domain.vo.CommunityUserVo">
@ -46,22 +63,26 @@
cu.tenant_id, cu.tenant_id,
cu.community_id, cu.community_id,
cu.user_id, cu.user_id,
cu.user_type,
cu.is_black,
u.avatar, u.avatar,
u.nick_name, u.nick_name,
IF(cu.community_price != 0, '收费', '免费') AS join_type, IF(cu.community_price != 0, '收费', '免费') AS join_type,
cu.start_time, cu.start_time,
u.login_date,
cu.end_time cu.end_time
from cc_community_user cu from cc_community_user cu
left join sys_user u on cu.user_id = u.user_id left join sys_user u on cu.user_id = u.user_id
<where> <where>
cu.community_id = #{communityUserListPageRes.communityId} cu.community_id = #{communityUserListPageRes.communityId}
and cu.tenant_id = #{communityUserListPageRes.tenantId}
and cu.del_flag = '0'
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= cu.start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00')&lt;= cu.end_time) or (start_time is null and end_time is null))
<if test="communityUserListPageRes.searchContent != null and communityUserListPageRes.searchContent != ''"> <if test="communityUserListPageRes.searchContent != null and communityUserListPageRes.searchContent != ''">
and u.nick_name like concat('%', #{communityUserListPageRes.searchContent}, '%') and u.nick_name like concat('%', #{communityUserListPageRes.searchContent}, '%')
</if> </if>
and (cu.blank_end_time is null or NOW() &gt;= cu.blank_end_time)
and cu.del_flag = '0'
</where> </where>
order by cu.user_type desc, cu.is_black, cu.create_time
</select> </select>
<select id="selectCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser"> <select id="selectCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser">
select id, select id,
@ -73,13 +94,16 @@
community_price, community_price,
start_time, start_time,
end_time, end_time,
is_blank, is_black,
black_reason, black_reason,
blank_end_time black_end_time
from cc_community_user from cc_community_user
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and community_id = #{communityId} and community_id = #{communityId}
and user_id = #{userId} and user_id = #{userId}
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null))
and (black_end_time is null or NOW() &gt;= black_end_time)
</select> </select>
<select id="getAllCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser"> <select id="getAllCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser">
select id, select id,
@ -91,10 +115,12 @@
community_price, community_price,
start_time, start_time,
end_time, end_time,
is_blank, is_black,
black_reason, black_reason,
blank_end_time black_end_time
from cc_community_user from cc_community_user
where del_flag = '0' where del_flag = '0'
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null))
</select> </select>
</mapper> </mapper>

View File

@ -5,7 +5,7 @@
<mapper namespace="com.mcwl.communityCenter.mapper.PublishCollectMapper"> <mapper namespace="com.mcwl.communityCenter.mapper.PublishCollectMapper">
<insert id="savePublishCollect"> <insert id="savePublishCollect">
insert into cc_publish_collect(tenant_id, community_id, publish_id, user_id) insert into cc_publish_collect(tenant_id, community_id, publish_id, user_id)
values (#{publishCollect.tenantId}, #{publishCollect.communityId}, #{publishCollect.publishId}, #{userId}) values (#{publishCollect.tenantId}, #{publishCollect.communityId}, #{publishCollect.publishId}, #{publishCollect.userId})
</insert> </insert>
<update id="updatePublishCollect"> <update id="updatePublishCollect">
update cc_publish_collect update cc_publish_collect
@ -23,8 +23,8 @@
and p.tenant_id = pc.tenant_id and p.tenant_id = pc.tenant_id
and p.community_id = pc.community_id and p.community_id = pc.community_id
<where> <where>
and pc.tenant_id = #{myPublishPageRes.tenantId} and pc.tenant_id = #{myPublishCollectPageRes.tenantId}
and pc.community_id = #{myPublishPageRes.communityId} and pc.community_id = #{myPublishCollectPageRes.communityId}
and pc.user_id = #{userId} and pc.user_id = #{userId}
and pc.del_flag = '0' and pc.del_flag = '0'
</where> </where>

View File

@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.PublishCommentLikeMapper"> <mapper namespace="com.mcwl.communityCenter.mapper.PublishCommentLikeMapper">
<update id="updateDelFlagById"> <update id="updateDelFlagById">
update cc_comment_like update cc_publish_comment_like
set del_flag = #{publishCommentLike.delFlag} set del_flag = #{publishCommentLike.delFlag}
where tenant_id = #{publishCommentLike.tenantId} where tenant_id = #{publishCommentLike.tenantId}
and community_id = #{publishCommentLike.communityId} and community_id = #{publishCommentLike.communityId}
@ -13,13 +13,13 @@
<select id="selectByTenantIdAndCommunityIdAndCommentId" <select id="selectByTenantIdAndCommunityIdAndCommentId"
resultType="com.mcwl.communityCenter.domain.PublishCommentLike"> resultType="com.mcwl.communityCenter.domain.PublishCommentLike">
select * from cc_comment_like select * from cc_publish_comment_like
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and community_id = #{communityId} and community_id = #{communityId}
and comment_id = #{commentId} and comment_id = #{commentId}
</select> </select>
<select id="selectLike" resultType="com.mcwl.communityCenter.domain.PublishCommentLike"> <select id="selectLike" resultType="com.mcwl.communityCenter.domain.PublishCommentLike">
select * from cc_comment_like select * from cc_publish_comment_like
where tenant_id = #{publishCommentLikeRes.tenantId} where tenant_id = #{publishCommentLikeRes.tenantId}
and community_id = #{publishCommentLikeRes.communityId} and community_id = #{publishCommentLikeRes.communityId}
and publish_id = #{publishCommentLikeRes.publishId} and publish_id = #{publishCommentLikeRes.publishId}

View File

@ -4,10 +4,10 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.PublishCommentMapper"> <mapper namespace="com.mcwl.communityCenter.mapper.PublishCommentMapper">
<update id="deleteByIdAndTenantIdAndCommunityIdAndOperatorId"> <update id="deleteByIdAndTenantIdAndCommunityIdAndOperatorId">
update cc_comment set del_flag = '2' update cc_publish_comment set del_flag = '2'
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and community_id = #{communityId} and community_id = #{communityId}
and operator_id = #{operatorId} and publish_id = #{operatorId}
and type = 0 and type = 0
</update> </update>
@ -16,17 +16,17 @@
select id, select id,
tenant_id, tenant_id,
community_id, community_id,
operator_id, publish_id,
user_id, user_id,
content, content,
parent_id, parent_id,
type, type,
like_num, like_num,
create_time create_time
from cc_comment from cc_publish_comment
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and community_id = #{communityId} and community_id = #{communityId}
and operator_id = #{operatorId} and publish_id = #{operatorId}
and type = 0 and type = 0
and del_flag = '0' and del_flag = '0'
order by create_time order by create_time
@ -36,17 +36,17 @@
select id, select id,
tenant_id, tenant_id,
community_id, community_id,
operator_id, publish_id,
user_id, user_id,
content, content,
parent_id, parent_id,
type, type,
like_num, like_num,
create_time create_time
from cc_comment from cc_publish_comment
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and community_id = #{communityId} and community_id = #{communityId}
and operator_id = #{operatorId} and publish_id = #{operatorId}
and type = 0 and type = 0
and del_flag = '0' and del_flag = '0'
</select> </select>

View File

@ -3,6 +3,12 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.PublishMapper"> <mapper namespace="com.mcwl.communityCenter.mapper.PublishMapper">
<insert id="insertPublish">
insert into cc_publish
(tenant_id, community_id, user_id, content, image_url, file_url, file_name, publish_time)
values (#{publish.tenantId}, #{publish.communityId}, #{publish.userId}, #{publish.content}, #{publish.imageUrl},
#{publish.fileUrl}, #{publish.fileName}, #{publish.publishTime})
</insert>
<update id="elitePublish"> <update id="elitePublish">
update cc_publish update cc_publish
set is_elite = !is_elite set is_elite = !is_elite
@ -65,9 +71,9 @@
create_time create_time
from cc_publish from cc_publish
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and community_id = #{communityId} and community_id = #{communityId}
and del_flag = '0' and del_flag = '0'
and image_url is not null and image_url is not null
</select> </select>
<select id="selectByTenantIdAndCommunityIdAndNotNullFilePage" <select id="selectByTenantIdAndCommunityIdAndNotNullFilePage"
resultType="com.mcwl.communityCenter.domain.Publish"> resultType="com.mcwl.communityCenter.domain.Publish">
@ -97,11 +103,13 @@
and tenant_id = #{publishPageRes.tenantId} and tenant_id = #{publishPageRes.tenantId}
and community_id = #{publishPageRes.communityId} and community_id = #{publishPageRes.communityId}
and del_flag = '0' and del_flag = '0'
<if test="publishPageRes.type == 0"> <if test="publishPageRes.type != null">
and user_id = #{publishPageRes.tenantId} <if test="publishPageRes.type == 0">
</if> and user_id = #{publishPageRes.tenantId}
<if test="publishPageRes.type == 1"> </if>
and is_elite = 1 <if test="publishPageRes.type == 1">
and is_elite = 1
</if>
</if> </if>
</where> </where>
</select> </select>

View File

@ -21,18 +21,17 @@ import com.mcwl.common.utils.StringUtils;
* @author mcwl * @author mcwl
*/ */
@Component @Component
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable {
{
private static final long serialVersionUID = -8970718410437077606L; private static final long serialVersionUID = -8970718410437077606L;
@Override @Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
throws IOException throws IOException {
{
int code = HttpStatus.UNAUTHORIZED; int code = HttpStatus.UNAUTHORIZED;
System.out.println("e = " + e);
if (e.getCause() != null) { if (e.getCause() != null) {
if (e.getCause() instanceof RedisCommandTimeoutException) { if (e.getCause() instanceof RedisCommandTimeoutException) {
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.warn("网络超时,请检查网络稍后重试"))); ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.SHOW_ERROR_MSG, "网络超时,请检查网络稍后重试")));
} }
} }
String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());