Compare commits

..

No commits in common. "5eb778c21cea69caba05ffd847bc2ce68e77e0fd" and "4e09f1055ec4aafff86821ae9565a86751d72984" have entirely different histories.

102 changed files with 315 additions and 2540 deletions

BIN
blob

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1008 KiB

After

Width:  |  Height:  |  Size: 4.2 MiB

View File

@ -1,43 +0,0 @@
package com.mcwl.web.controller.communityCenter;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.CommunityDetailVo;
import com.mcwl.communityCenter.service.CommunityAdviceService;
import com.mcwl.communityCenter.service.CommunityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/**
*
*/
@Api(tags = "社区通知")
@RestController
@RequestMapping("communityAdvice")
@RequiredArgsConstructor
public class CommunityAdviceController {
private final CommunityAdviceService communityAdviceService;
/**
*
*/
@ApiOperation(value = "获取通知列表")
@PostMapping("adviceList")
public TableDataInfo getCommunityAdviceList(@RequestBody CommunityAdvicePageRes communityAdvicePageRes) {
return communityAdviceService.getCommunityAdviceList(communityAdvicePageRes);
}
}

View File

@ -1,13 +1,18 @@
package com.mcwl.web.controller.communityCenter;
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.TableDataInfo;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.CommunityDetailVo;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.dto.CommunityListPageRes;
import com.mcwl.communityCenter.domain.dto.CommunityRes;
import com.mcwl.communityCenter.domain.dto.JoinCommunityListPageRes;
import com.mcwl.communityCenter.domain.dto.JoinCommunityRes;
import com.mcwl.communityCenter.service.CommunityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
@ -15,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Objects;
/**
*
@ -39,28 +45,6 @@ public class CommunityController {
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("编辑成功");
}
/**
*
@ -75,12 +59,15 @@ public class CommunityController {
/**
*
*
* @param communityRes
* @return
*/
@ApiOperation(value = "添加社区")
@PostMapping("addCommunity")
public R<Object> addCommunity(@RequestBody @Valid AddCommunityRes addCommunityRes) {
communityService.addCommunity(addCommunityRes);
return R.ok("社区添加成功");
@PostMapping("add")
public R<Object> addCommunity(@RequestBody @Valid CommunityRes communityRes) {
communityService.addCommunity(communityRes);
return R.ok();
}
/**
@ -98,32 +85,37 @@ public class CommunityController {
*/
@ApiOperation(value = "退出社区")
@PostMapping("quit")
public R<Object> quitCommunity(@RequestBody @Valid QuitCommunityRes quitCommunityRes) {
Long tenantId = quitCommunityRes.getTenantId();
Long communityId = quitCommunityRes.getCommunityId();
public R<Object> quitCommunity(@ApiParam(value = "租户id", required = true)
@NotNull(message = "租户id不能为空")
@Valid
Long tenantId,
@ApiParam(value = "社区id", required = true)
@NotNull(message = "社区id不能为空")
@Valid
Long communityId) {
return communityService.quitCommunity(tenantId, communityId);
}
//
// /**
// * 删除社区
// *
// * @param id 社区id
// * @return 删除结果
// */
// @ApiOperation(value = "删除社区")
// @GetMapping("delete")
// public R<Object> deleteCommunity(@NotNull(message = "id不能为空")
// @ApiParam(value = "id", required = true)
// @Valid
// Long id) {
// Community community = communityService.getById(id);
// if (Objects.isNull(community)) {
// return R.fail(HttpStatus.SHOW_ERROR_MSG, "该社区不存在");
// }
// communityService.removeById(id);
// return R.ok();
// }
/**
*
*
* @param id id
* @return
*/
@ApiOperation(value = "删除社区")
@GetMapping("delete")
public R<Object> deleteCommunity(@NotNull(message = "id不能为空")
@ApiParam(value = "id", required = true)
@Valid
Long id) {
Community community = communityService.getById(id);
if (Objects.isNull(community)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "该社区不存在");
}
communityService.removeById(id);
return R.ok();
}
/**
*

View File

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

@ -1,52 +0,0 @@
package com.mcwl.web.controller.communityCenter;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.IncomeInfo;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.IncomeInfoVo;
import com.mcwl.communityCenter.service.IncomeInfoService;
import com.mcwl.communityCenter.service.PublishCollectService;
import com.mcwl.communityCenter.service.PublishService;
import com.mcwl.communityCenter.service.QuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
*
*/
@Api(tags = "收益明细")
@RestController
@RequiredArgsConstructor
@RequestMapping("incomeInfo")
public class IncomeInfoController {
private final IncomeInfoService incomeInfoService;
/**
*
*/
@ApiOperation(value = "明细列表")
@PostMapping("incomeList")
public TableDataInfo incomeList(@Valid @RequestBody IncomeInfoListPageRes incomeInfoListPageRes) {
return incomeInfoService.incomeList(incomeInfoListPageRes);
}
/**
*
*/
@ApiOperation(value = "社区收益")
@GetMapping("communityIncome")
public R<IncomeInfoVo> communityIncome() {
return incomeInfoService.communityIncome();
}
}

View File

@ -1,26 +1,11 @@
package com.mcwl.web.controller.communityCenter;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.dto.MyPublishCollectPageRes;
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.service.PublishCollectService;
import com.mcwl.communityCenter.service.PublishService;
import com.mcwl.communityCenter.service.QuestionService;
import com.mcwl.communityCenter.service.impl.PublishCommentLikeServiceImpl;
import com.mcwl.communityCenter.service.impl.PublishServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/**
*
*/
@ -30,17 +15,17 @@ import javax.validation.Valid;
@RequestMapping("personHome")
public class PersonHomeController {
private final PublishService publishService;
/**
*
*
*/
@PostMapping("getPersonHomeList")
@ApiOperation(value = "个人主页列表")
public TableDataInfo getPersonHomeList(@RequestBody @Valid PersonHomePageRes personHomePageRes) {
@RequestMapping("list")
public R<Object> list(){
return publishService.getPersonHomeList(personHomePageRes);
return R.ok();
}
}

View File

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

View File

@ -5,7 +5,9 @@ import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.dto.PublishDetailRes;
import com.mcwl.communityCenter.domain.dto.PublishPageRes;
import com.mcwl.communityCenter.domain.dto.PublishRes;
import com.mcwl.communityCenter.domain.vo.PublishVo;
import com.mcwl.communityCenter.service.PublishService;
import io.swagger.annotations.Api;
@ -104,14 +106,4 @@ public class PublishController {
return R.ok();
}
/**
* /
*/
@ApiOperation(value = "收藏/取消收藏")
@PostMapping("collect")
public R<Object> collectPublish(@RequestBody @Valid PublishCollectRes publishCollectRes) {
publishService.collectPublish(publishCollectRes);
return R.ok();
}
}

View File

@ -57,12 +57,6 @@ public class QuestionController {
// 付费类型为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();
SysUser sysUser = sysUserService.selectUserById(userId);
Double wallet = sysUser.getWallet();

View File

@ -178,8 +178,7 @@ public class Constants
public static final String[] JOB_WHITELIST_STR = {
"com.mcwl.quartz.task",
"com.mcwl.memberCenter.task",
"com.mcwl.pay.task",
"com.mcwl.communityCenter.task"
"com.mcwl.pay.task"
};
/**

View File

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

View File

@ -7,7 +7,9 @@ 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.*;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
@ -15,8 +17,7 @@ import lombok.*;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("cc_community_file")
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CommunityFile extends BaseEntity {
@TableId

View File

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

View File

@ -1,44 +0,0 @@
package com.mcwl.communityCenter.domain;
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 lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("cc_income_info")
public class IncomeInfo extends BaseEntity {
@TableId
private Long id;
/**
* id
*/
@TableField(fill = FieldFill.INSERT)
private Long tenantId;
/**
* id
*/
private Long communityId;
/**
* 0 1
*/
private Integer type;
/**
*
*/
private Double amount;
}

View File

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

View File

@ -1,44 +0,0 @@
package com.mcwl.communityCenter.domain;
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 lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("cc_publish_collect")
public class PublishCollect extends BaseEntity {
@TableId
private Long id;
/**
* id
*/
@TableField(fill = FieldFill.INSERT)
private Long tenantId;
/**
* id
*/
private Long communityId;
/**
* id
*/
private Long publishId;
/**
* id
*/
private Long userId;
}

View File

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

View File

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

View File

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

View File

@ -14,12 +14,6 @@ import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "拉黑请求参数")
public class BlackListRes {
/**
* id
*/
@ApiModelProperty(value = "租户id", required = true)
@NotNull(message = "租户id不能为空")
private Long tenantId;
/**
* id

View File

@ -1,24 +0,0 @@
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;
/**
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "社区通知列表分页请求参数")
public class CommunityAdvicePageRes extends PageDomain {
/**
* 0 1 2 3
*/
@ApiModelProperty(value = "通知类型 0社区通知 1回复我的 2待我回复 3点赞")
private Integer adviceType;
}

View File

@ -1,33 +0,0 @@
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

@ -1,41 +0,0 @@
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;
/**
*
*
*/
@Data
@ApiModel(value = "社区文件列表请求参数")
@ApiModel(value = "社区请求参数")
@EqualsAndHashCode(callSuper = true)
public class CommunityFilePageListRes extends PageDomain {

View File

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

View File

@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
@ -30,32 +29,11 @@ public class CommunityUploadFileRes {
private Long communityId;
/**
* url
*
*/
@ApiModelProperty(value = "文件url", required = true)
@NotBlank(message = "文件url不能为空")
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;
@ApiModelProperty(value = "文件", required = true)
@NotNull(message = "文件不能为空")
private MultipartFile file;

View File

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

View File

@ -1,35 +0,0 @@
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

@ -1,74 +0,0 @@
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

@ -1,32 +0,0 @@
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 IncomeInfoListPageRes extends PageDomain {
/**
*
*/
@ApiModelProperty(value = "搜索内容")
private String searchContent;
/**
*
*/
@ApiModelProperty(value = "收益类型")
private Integer type;
}

View File

@ -1,27 +0,0 @@
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
@ApiModel(value = "收益明细请求参数")
public class IncomeInfoRes {
@NotNull(message = "社区id不能为空")
@ApiModelProperty(value = "社区id", required = true)
private Long communityId;
@NotNull(message = "租户id不能为空")
@ApiModelProperty(value = "租户id", required = true)
private Long tenantId;
}

View File

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

View File

@ -1,40 +0,0 @@
package com.mcwl.communityCenter.domain.dto;
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 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 MyPublishCollectPageRes 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;
}

View File

@ -1,28 +0,0 @@
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 MyPublishPageRes extends PageDomain {
@NotNull(message = "社区id不能为空")
@ApiModelProperty(value = "社区id", required = true)
private Long communityId;
@NotNull(message = "租户id不能为空")
@ApiModelProperty(value = "租户id", required = true)
private Long tenantId;
}

View File

@ -1,41 +0,0 @@
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

@ -1,40 +0,0 @@
package com.mcwl.communityCenter.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* /
*/
@Data
@ApiModel(value = "收藏/取消收藏请求参数")
@NoArgsConstructor
@AllArgsConstructor
public class PublishCollectRes {
/**
* 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 publishId;
}

View File

@ -2,29 +2,25 @@ 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
@ApiModel(value = "发布详情请求参数")
public class PublishDetailRes {
@ApiModelProperty(value = "发布id", required = true)
@ApiParam(value = "发布id", required = true)
@NotNull(message = "发布id不能为空")
private Long publishId;
private Long id;
@ApiModelProperty(value = "租户id", required = true)
@ApiParam(value = "租户id", required = true)
@NotNull(message = "租户id不能为空")
private Long tenantId;
@ApiModelProperty(value = "社区id", required = true)
@ApiParam(value = "社区id", required = true)
@NotNull(message = "社区id不能为空")
private Long communityId;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,74 +0,0 @@
package com.mcwl.communityCenter.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
*
*/
@Data
@ApiModel(value = "社区通知返回数据")
public class CommunityAdviceVo {
/**
* id
*/
@ApiModelProperty(value = "社区id")
private Long id;
/**
* id
*/
@ApiModelProperty(value = "租户id")
private Long tenantId;
/**
*
*/
@ApiModelProperty(value = "发送人")
private Long sendUserId;
/**
*
*/
@ApiModelProperty(value = "发送人名称")
private String sendUserName;
/**
*
*/
@ApiModelProperty(value = "发送人头像")
private String sendUserAvatar;
/**
*
*/
@ApiModelProperty(value = "标题")
private String title;
/**
*
*/
@ApiModelProperty(value = "内容")
private String content;
/**
*
*/
@ApiModelProperty(value = "是否已读")
private Integer isRead;
/**
*
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}

View File

@ -5,65 +5,13 @@ 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 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,6 +34,12 @@ public class CommunityFileVo {
@ApiModelProperty(value = "社区id")
private Long communityId;
/**
*
*/
@ApiModelProperty(value = "文件路径")
private String fileUrl;
/**
*
*/

View File

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

View File

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

View File

@ -1,28 +0,0 @@
package com.mcwl.communityCenter.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* vo
*/
@Data
@ApiModel(description = "收益金额")
public class IncomeAmountVo {
/**
*
*/
@ApiModelProperty(value = "今日收益")
private Double todayIncome;
/**
*
*/
@ApiModelProperty(value = "昨日收益")
private Double yesterdayIncome;
}

View File

@ -1,58 +0,0 @@
package com.mcwl.communityCenter.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.util.Date;
/**
* vo
*/
@Data
@Builder
@ApiModel(description = "收益列表vo")
public class IncomeInfoListVo {
/**
*
*/
@ApiModelProperty(value = "用户名称")
private String userName;
/**
*
*/
@ApiModelProperty(value = "用户头像")
private String avatar;
/**
*
*/
@ApiModelProperty(value = "社区名称")
private String communityName;
/**
*
*/
@ApiModelProperty(value = "收益类型")
private Integer type;
/**
*
*/
@ApiModelProperty(value = "收益金额")
private Double amount;
/**
*
*/
@ApiModelProperty(value = "收益时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}

View File

@ -1,38 +0,0 @@
package com.mcwl.communityCenter.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.util.Date;
/**
* vo
*/
@Data
@Builder
@ApiModel(description = "收益vo")
public class IncomeInfoVo {
/**
*
*/
@ApiModelProperty(value = "社区收益")
private IncomeAmountVo communityIncome;
/**
*
*/
@ApiModelProperty(value = "问答收益")
private IncomeAmountVo questionIncome;
/**
*
*/
@ApiModelProperty(value = "累计收益")
private Double totalIncome;
}

View File

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

View File

@ -21,36 +21,20 @@ public class CustomTenantHandler implements TenantLineHandler {
* .
*/
static {
// 通知表
tables.add("cc_advice");
// 发布评论表
tables.add("cc_comment");
// 评论点赞表
tables.add("cc_comment_like");
// 社区表
tables.add("cc_community");
// 社区文件表
tables.add("cc_community_file");
// 社区文件下载记录表
tables.add("cc_community_file_log");
// 社区用户表
tables.add("cc_community_user");
// 收益明细
tables.add("cc_income_info");
// 邀请表
tables.add("cc_invite");
// 发布表
tables.add("cc_publish");
// 收藏表
tables.add("cc_publish_collect");
// 发布点赞表
tables.add("cc_publish_like");
// 提问表
tables.add("cc_question");
// 提问评论表
tables.add("cc_question_comment");
// 社区用户表
tables.add("cc_community_user");
// 输出表名
log.info("多租户表:{}", tables);

View File

@ -1,20 +1,10 @@
package com.mcwl.communityCenter.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityAdvice;
import com.mcwl.communityCenter.domain.dto.CommunityAdvicePageRes;
import com.mcwl.communityCenter.domain.vo.CommunityAdviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface CommunityAdviceMapper extends BaseMapper<CommunityAdvice> {
List<CommunityAdviceVo> getCommunityAdviceList(Page<CommunityAdvice> page,
@Param("communityAdvicePageRes") CommunityAdvicePageRes communityAdvicePageRes);
}

View File

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

View File

@ -20,9 +20,4 @@ public interface CommunityFileMapper extends BaseMapper<CommunityFile> {
@InterceptorIgnore(tenantLine = "true")
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,8 +4,6 @@ import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.Mapper;
import org.apache.ibatis.annotations.Param;
@ -55,14 +53,12 @@ public interface CommunityMapper extends BaseMapper<Community> {
Page<Community> page,
@Param("userId")
Long userId,
@Param("joinCommunityListPageRes")
JoinCommunityListPageRes joinCommunityListPageRes);
@Param("searchContent")
String searchContent);
@InterceptorIgnore(tenantLine = "true")
void quitCommunity(@Param("tenantId") Long tenantId,
@Param("communityId") Long communityId,
@Param("userId") Long userId);
void quitCommunity(Long tenantId, Long communityId, Long userId);
@InterceptorIgnore(tenantLine = "true")
void deleteCommunity(@Param("tenantId") Long tenantId, @Param("communityId") Long communityId);
void deleteCommunity(Long tenantId, Long communityId);
}

View File

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.domain.dto.CommunityUserListPageRes;
import com.mcwl.communityCenter.domain.dto.UnBlackListRes;
import com.mcwl.communityCenter.domain.vo.CommunityUserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -24,7 +23,7 @@ public interface CommunityUserMapper extends BaseMapper<CommunityUser> {
@Param("userId") Long userId);
@InterceptorIgnore(tenantLine = "true")
Integer getJoinNum(@Param("tenantId") Long tenantId, @Param("communityId") Long communityId);
Integer getJoinNum(Long tenantId, Long communityId);
@InterceptorIgnore(tenantLine = "true")
int isJoinCommunity(@Param("tenantId")
@ -38,17 +37,4 @@ public interface CommunityUserMapper extends BaseMapper<CommunityUser> {
List<CommunityUserVo> getCommunityUserList(Page<CommunityUser> page,
@Param("communityUserListPageRes")
CommunityUserListPageRes communityUserListPageRes);
@InterceptorIgnore(tenantLine = "true")
CommunityUser selectCommunityUser(@Param("tenantId") Long tenantId,
@Param("communityId") Long communityId,
@Param("userId") Long userId);
@InterceptorIgnore(tenantLine = "true")
void updateBlackCommunityUser(@Param("blackCommunityUser") CommunityUser blackCommunityUser);
@InterceptorIgnore(tenantLine = "true")
List<CommunityUser> getAllCommunityUser();
void updateManageCommunityUser(@Param("manageCommunityUser") CommunityUser manageCommunityUser);
}

View File

@ -1,34 +0,0 @@
package com.mcwl.communityCenter.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.IncomeInfo;
import com.mcwl.communityCenter.domain.PublishCollect;
import com.mcwl.communityCenter.domain.dto.IncomeInfoListPageRes;
import com.mcwl.communityCenter.domain.dto.IncomeInfoRes;
import com.mcwl.communityCenter.domain.dto.MyPublishCollectPageRes;
import com.mcwl.communityCenter.domain.vo.IncomeAmountVo;
import com.mcwl.communityCenter.domain.vo.IncomeInfoListVo;
import com.mcwl.communityCenter.domain.vo.PublishVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface IncomeInfoMapper extends BaseMapper<IncomeInfo> {
@InterceptorIgnore(tenantLine = "true")
IncomeAmountVo communityIncome(@Param("userId") Long userId);
@InterceptorIgnore(tenantLine = "true")
IncomeAmountVo questionIncome(@Param("userId") Long userId);
Double totalIncome();
@InterceptorIgnore(tenantLine = "true")
List<IncomeInfoListVo> incomeList(Page<IncomeInfo> page,
@Param("incomeInfoListPageRes") IncomeInfoListPageRes incomeInfoListPageRes,
@Param("userId") Long userId);
}

View File

@ -38,7 +38,5 @@ public interface InviteMapper extends BaseMapper<Invite> {
* @return
*/
@InterceptorIgnore(tenantLine = "true")
Invite selectByTenantIdAndCommunityIdAndInviteeUserId(@Param("tenantId") Long tenantId,
@Param("communityId") Long communityId,
@Param("inviteeUserId") Long inviteeUserId);
Invite selectByTenantIdAndCommunityIdAndInviteeUserId(Long tenantId, Long communityId, Long inviteeUserId);
}

View File

@ -1,35 +0,0 @@
package com.mcwl.communityCenter.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.Publish;
import com.mcwl.communityCenter.domain.PublishCollect;
import com.mcwl.communityCenter.domain.dto.MyPublishCollectPageRes;
import com.mcwl.communityCenter.domain.dto.PublishCollectRes;
import com.mcwl.communityCenter.domain.dto.PublishPageRes;
import com.mcwl.communityCenter.domain.vo.PublishVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface PublishCollectMapper extends BaseMapper<PublishCollect> {
@InterceptorIgnore(tenantLine = "true")
List<PublishVo> myCollectList(Page<PublishCollect> page,
@Param("myPublishCollectPageRes") MyPublishCollectPageRes myPublishCollectPageRes,
@Param("userId") Long userId);
@InterceptorIgnore(tenantLine = "true")
void savePublishCollect(@Param("publishCollect") PublishCollect publishCollect);
@InterceptorIgnore(tenantLine = "true")
PublishCollect getPublishCollect(@Param("publishCollectRes") PublishCollectRes publishCollectRes,
@Param("userId") Long userId);
@InterceptorIgnore(tenantLine = "true")
void updatePublishCollect(@Param("publishCollect") PublishCollect publishCollect);
}

View File

@ -5,9 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.Publish;
import com.mcwl.communityCenter.domain.dto.MyPublishPageRes;
import com.mcwl.communityCenter.domain.dto.PublishPageRes;
import com.mcwl.communityCenter.domain.vo.PublishVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;
@ -46,13 +44,5 @@ public interface PublishMapper extends BaseMapper<Publish> {
void elitePublish(@Param("communityId") Long communityId, @Param("publishId") Long publishId);
@InterceptorIgnore(tenantLine = "true")
List<Publish> publishList(Page<Publish> page, @Param("publishPageRes") PublishPageRes publishPageRes);
@InterceptorIgnore(tenantLine = "true")
List<PublishVo> myPublishList(Page<Publish> page,
@Param("myPublishPageRes") MyPublishPageRes myPublishPageRes,
@Param("userId") Long userId);
@InterceptorIgnore(tenantLine = "true")
void insertPublish(@Param("publish") Publish publish);
List<Publish> publishList(Page<Publish> page,@Param("publishPageRes") PublishPageRes publishPageRes);
}

View File

@ -5,12 +5,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.Question;
import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import javax.validation.constraints.NotNull;
import java.util.List;
@Mapper
public interface QuestionMapper extends BaseMapper<Question> {
@ -39,9 +37,4 @@ public interface QuestionMapper extends BaseMapper<Question> {
@NotNull(message = "社区不能为空")
@Param("communityId")
Long communityId);
@InterceptorIgnore(tenantLine = "true")
List<Question> myQuestionList(Page<Question> page,
@Param("questionPageRes") QuestionPageRes questionPageRes,
@Param("userId") Long userId);
}

View File

@ -1,13 +1,8 @@
package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityAdvice;
import com.mcwl.communityCenter.domain.dto.CommunityAdvicePageRes;
import javax.validation.Valid;
public interface CommunityAdviceService extends IService<CommunityAdvice> {
TableDataInfo getCommunityAdviceList(@Valid CommunityAdvicePageRes communityAdvicePageRes);
}

View File

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

View File

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

View File

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

View File

@ -3,14 +3,14 @@ package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityUser;
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.CommunityUserManageRes;
import com.mcwl.communityCenter.domain.dto.UnBlackListRes;
import javax.validation.Valid;
import java.util.List;
public interface CommunityUserService extends IService<CommunityUser> {
@ -23,12 +23,4 @@ public interface CommunityUserService extends IService<CommunityUser> {
*
*/
R<Object> black(@Valid BlackListRes blackListRes);
List<CommunityUser> getAllCommunityUser();
void updateBlankCommunityUser(CommunityUser communityUser);
R<Object> unBlack(@Valid UnBlackListRes unBlackListRes);
R<Object> manage(@Valid CommunityUserManageRes communityUserManageRes);
}

View File

@ -1,20 +0,0 @@
package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.IncomeInfo;
import com.mcwl.communityCenter.domain.Publish;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.IncomeInfoVo;
import com.mcwl.communityCenter.domain.vo.PublishVo;
import javax.validation.Valid;
public interface IncomeInfoService extends IService<IncomeInfo> {
R<IncomeInfoVo> communityIncome();
TableDataInfo incomeList(@Valid IncomeInfoListPageRes incomeInfoListPageRes);
}

View File

@ -1,24 +0,0 @@
package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Publish;
import com.mcwl.communityCenter.domain.PublishCollect;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.PublishVo;
import javax.validation.Valid;
public interface PublishCollectService extends IService<PublishCollect> {
TableDataInfo myCollectList(@Valid MyPublishCollectPageRes myPublishCollectPageRes);
void savePublishCollect(PublishCollect publishCollect);
PublishCollect getPublishCollect(PublishCollectRes publishCollectRes, Long userId);
void updatePublishCollect(PublishCollect publishCollect);
}

View File

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

View File

@ -7,7 +7,9 @@ import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.Publish;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.dto.PublishDetailRes;
import com.mcwl.communityCenter.domain.dto.PublishPageRes;
import com.mcwl.communityCenter.domain.dto.PublishRes;
import com.mcwl.communityCenter.domain.vo.PublishVo;
import javax.validation.Valid;
@ -33,10 +35,4 @@ public interface PublishService extends IService<Publish> {
void elitePublish(Long communityId, Long publishId);
TableDataInfo publishList(PublishPageRes publishPageRes);
TableDataInfo myPublishList(MyPublishPageRes myPublishPageRes);
void collectPublish(@Valid PublishCollectRes publishCollectRes);
TableDataInfo getPersonHomeList(@Valid PersonHomePageRes personHomePageRes);
}

View File

@ -34,6 +34,4 @@ public interface QuestionService extends IService<Question> {
// AjaxResult reply(QuestionReplyRes questionReplyRes);
TableDataInfo listImage(@Valid QuestionPageRes questionPageRes);
TableDataInfo myQuestionList(@Valid QuestionPageRes questionPageRes);
}

View File

@ -1,38 +1,17 @@
package com.mcwl.communityCenter.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityAdvice;
import com.mcwl.communityCenter.domain.dto.CommunityAdvicePageRes;
import com.mcwl.communityCenter.domain.vo.CommunityAdviceVo;
import com.mcwl.communityCenter.mapper.CommunityAdviceMapper;
import com.mcwl.communityCenter.mapper.CommunityMapper;
import com.mcwl.communityCenter.service.CommunityAdviceService;
import com.mcwl.communityCenter.service.CommunityService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CommunityAdviceServiceImpl extends ServiceImpl<CommunityAdviceMapper, CommunityAdvice>
implements CommunityAdviceService {
@Override
public TableDataInfo getCommunityAdviceList(CommunityAdvicePageRes communityAdvicePageRes) {
Page<CommunityAdvice> page = new Page<>(communityAdvicePageRes.getPageNum(), communityAdvicePageRes.getPageSize());
List<CommunityAdviceVo> communityAdviceList = baseMapper.getCommunityAdviceList(page, communityAdvicePageRes);
// 封装分页信息
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(communityAdviceList);
rspData.setTotal(page.getTotal());
return rspData;
}
}

View File

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

View File

@ -1,29 +1,21 @@
package com.mcwl.communityCenter.service.impl;
import cn.hutool.Hutool;
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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.obs.ObsUtils;
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.vo.CommunityFileVo;
import com.mcwl.communityCenter.domain.vo.DownloadFileUserVo;
import com.mcwl.communityCenter.mapper.CommunityFileMapper;
import com.mcwl.communityCenter.mapper.CommunityUserMapper;
import com.mcwl.communityCenter.service.CommunityFileLogService;
import com.mcwl.communityCenter.service.CommunityFileService;
import com.mcwl.communityCenter.service.CommunityUserService;
import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -41,35 +33,26 @@ public class CommunityFileServiceImpl extends ServiceImpl<CommunityFileMapper, C
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
public R<String> upload(CommunityUploadFileRes communityUploadFileRes) {
public void upload(CommunityUploadFileRes communityUploadFileRes) {
Long tenantId = communityUploadFileRes.getTenantId();
Long communityId = communityUploadFileRes.getCommunityId();
Long currentUserId = SecurityUtils.getUserId();
CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, currentUserId);
if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员");
}
CommunityFile communityFile = BeanUtil.toBean(communityUploadFileRes, CommunityFile.class);
communityFile.setUserId(currentUserId);
MultipartFile file = communityUploadFileRes.getFile();
Map<String, String> map = obsUtils.uploadFile(file);
String filename = file.getOriginalFilename();
long fileSize = file.getSize();
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);
return R.ok();
}
@Override
@ -79,14 +62,17 @@ public class CommunityFileServiceImpl extends ServiceImpl<CommunityFileMapper, C
for (CommunityFileVo communityFileVo : communityFileList) {
DownloadFileUserVo downloadFileUserVo = new DownloadFileUserVo();
Long tenantId = communityFileVo.getTenantId();
Long communityId = communityFileVo.getCommunityId();
Long fileId = communityFileVo.getId();
List<String> avatarList = communityFileLogService.getUserAvatarList(tenantId, communityId, fileId);
Integer count = communityFileLogService.getDownloadCount(tenantId, communityId, fileId);
List<String> avatarList = communityFileLogService.getUserAvatarList(communityFileVo.getTenantId(),
communityFileVo.getCommunityId(),
communityFileVo.getId());
Integer count = communityFileLogService.getDownloadCount(communityFileVo.getTenantId(),
communityFileVo.getCommunityId(),
communityFileVo.getId());
downloadFileUserVo.setAvatarList(avatarList);
downloadFileUserVo.setCount(count);
communityFileVo.setDownloadFileUser(downloadFileUserVo);
}
// 封装返回
@ -97,35 +83,4 @@ public class CommunityFileServiceImpl extends ServiceImpl<CommunityFileMapper, C
tableDataInfo.setMsg("查询成功");
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,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R;
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.redis.RedisCache;
import com.mcwl.common.exception.ServiceException;
@ -17,8 +18,10 @@ import com.mcwl.communityCenter.constant.AdviceConstant;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityAdvice;
import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.CommunityDetailVo;
import com.mcwl.communityCenter.domain.dto.CommunityListPageRes;
import com.mcwl.communityCenter.domain.dto.CommunityRes;
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.mapper.CommunityAdviceMapper;
import com.mcwl.communityCenter.mapper.CommunityMapper;
@ -71,11 +74,11 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
@Override
@Transactional(rollbackFor = Exception.class)
public void addCommunity(AddCommunityRes addCommunityRes) {
public void addCommunity(CommunityRes communityRes) {
try {
Community community = new Community();
BeanUtil.copyProperties(addCommunityRes, community);
if (Objects.equals(addCommunityRes.getType(), 0)) {
BeanUtil.copyProperties(communityRes, community);
if (Objects.equals(communityRes.getType(), 0)) {
community.setPrice(0.0);
}
baseMapper.insert(community);
@ -85,7 +88,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
.tenantId(SecurityUtils.getUserId())
.communityId(community.getId())
.userId(SecurityUtils.getUserId())
.userType(2)
.userType(1)
.build());
} catch (Exception e) {
@ -132,7 +135,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
Calendar now = Calendar.getInstance();
Date startTime = now.getTime();
now.add(Calendar.YEAR, community.getValidityDay());
now.add(Calendar.DAY_OF_YEAR, community.getValidityDay());
Date endTime = now.getTime();
CommunityUser cu = CommunityUser.builder()
@ -167,9 +170,11 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
@Override
public TableDataInfo getMyJoinCommunity(JoinCommunityListPageRes joinCommunityListPageRes) {
Page<Community> page = new Page<>(joinCommunityListPageRes.getPageNum(), joinCommunityListPageRes.getPageSize());
page.addOrder(new OrderItem("create_time", false));
OrderItem orderItem = new OrderItem("create_time", false);
page.addOrder(orderItem);
List<Community> communityList = baseMapper.getMyJoinCommunity(page, SecurityUtils.getUserId(), joinCommunityListPageRes);
String searchContent = joinCommunityListPageRes.getSearchContent();
List<Community> communityList = baseMapper.getMyJoinCommunity(page, SecurityUtils.getUserId(), searchContent);
return this.getCommunityVoTableDataInfo(communityList, page.getTotal());
@ -183,27 +188,9 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
@Override
@Transactional(rollbackFor = Exception.class)
public R<Object> quitCommunity(Long tenantId, Long communityId) {
Long userId = SecurityUtils.getUserId();
Community community = baseMapper.getByTenantIdAndCommunityId(tenantId, communityId);
if (Objects.isNull(community)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "社区不存在");
}
CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, userId);
if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"您不是该社区成员");
}
Integer communityJoinNum = communityUserMapper.getJoinNum(tenantId, communityId);
if (communityUser.getUserType() == 2 && communityJoinNum > 1) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"社区还有成员,无法退出");
}
baseMapper.quitCommunity(tenantId, communityId, userId);
baseMapper.quitCommunity(tenantId, communityId, SecurityUtils.getUserId());
if (communityJoinNum == 1) {
baseMapper.deleteCommunity(tenantId, communityId);
@ -218,18 +205,6 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
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) {
@ -268,7 +243,8 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
LocalDate currentLocalDate = LocalDate.now(ZoneId.systemDefault());
for (Community community : communityList) {
CommunityVo communityVo = BeanUtil.toBean(community, CommunityVo.class);
CommunityVo communityVo = new CommunityVo();
BeanUtil.copyProperties(community, communityVo);
// 当前时间和创建时间差
Date createTime = community.getCreateTime();
LocalDate createLocalDate = createTime.toInstant()
@ -276,10 +252,6 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
.toLocalDate();
long daysBetween = ChronoUnit.DAYS.between(createLocalDate, currentLocalDate);
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.setAvatar(sysUser.getAvatar());
communityVo.setNickName(sysUser.getNickName());

View File

@ -1,24 +1,35 @@
package com.mcwl.communityCenter.service.impl;
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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus;
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.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.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.CommunityUserManageRes;
import com.mcwl.communityCenter.domain.dto.UnBlackListRes;
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.service.CommunityService;
import com.mcwl.communityCenter.service.CommunityUserService;
import lombok.RequiredArgsConstructor;
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.*;
@Service
@ -32,7 +43,7 @@ public class CommunityUserServiceImpl extends ServiceImpl<CommunityUserMapper, C
@Override
public TableDataInfo getCommunityUserList(CommunityUserListPageRes communityUserListPageRes) {
Page<CommunityUser> page = new Page<>(communityUserListPageRes.getPageNum(), communityUserListPageRes.getPageSize());
// page.addOrder(new OrderItem("cu.create_time", false));
page.addOrder(new OrderItem("create_time", false));
List<CommunityUserVo> communityUserList = baseMapper.getCommunityUserList(page, communityUserListPageRes);
@ -46,128 +57,26 @@ public class CommunityUserServiceImpl extends ServiceImpl<CommunityUserMapper, C
@Override
public R<Object> black(BlackListRes blackListRes) {
Long tenantId = blackListRes.getTenantId();
Long communityId = blackListRes.getCommunityId();
Long userId = blackListRes.getUserId();
Integer blackDay = blackListRes.getBlackDay();
String blackReason = blackListRes.getBlackReason();
// 拉黑用户
CommunityUser blackCommunityUser = baseMapper.selectCommunityUser(
tenantId, communityId, userId
);
// 当前用户
CommunityUser currentCommunityUser = baseMapper.selectCommunityUser(
tenantId, communityId, SecurityUtils.getUserId()
);
if (currentCommunityUser.getUserType() == 0) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是群主/管理员,无法拉黑");
}
if (Objects.isNull(blackCommunityUser)) {
CommunityUser communityUser = baseMapper.selectOne(new LambdaQueryWrapper<CommunityUser>()
.eq(CommunityUser::getCommunityId, communityId)
.eq(CommunityUser::getUserId, userId));
if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户不在该社区中");
}
if ("1".equals(blackCommunityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户已拉黑");
}
if (blackCommunityUser.getUserType() != 0) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "该用户是群主/管理员,无法拉黑");
}
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, blackDay);
blackCommunityUser.setIsBlack("1");
blackCommunityUser.setBlackEndTime(calendar.getTime());
blackCommunityUser.setBlackReason(blackReason);
baseMapper.updateBlackCommunityUser(blackCommunityUser);
communityUser.setIsBlank("1");
communityUser.setBlankEndTime(calendar.getTime());
communityUser.setBlackReason(blackReason);
return R.ok();
}
@Override
public List<CommunityUser> getAllCommunityUser() {
return baseMapper.getAllCommunityUser();
}
@Override
public void updateBlankCommunityUser(CommunityUser 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

@ -1,82 +0,0 @@
package com.mcwl.communityCenter.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R;
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.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.communityCenter.constant.AdviceConstant;
import com.mcwl.communityCenter.domain.*;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.IncomeAmountVo;
import com.mcwl.communityCenter.domain.vo.IncomeInfoListVo;
import com.mcwl.communityCenter.domain.vo.IncomeInfoVo;
import com.mcwl.communityCenter.domain.vo.QuestionVo;
import com.mcwl.communityCenter.mapper.*;
import com.mcwl.communityCenter.service.IncomeInfoService;
import com.mcwl.communityCenter.service.QuestionService;
import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Service
@RequiredArgsConstructor
public class IncomeInfoServiceImpl extends ServiceImpl<IncomeInfoMapper, IncomeInfo> implements IncomeInfoService {
/**
*
*/
@Override
public R<IncomeInfoVo> communityIncome() {
// 社区收益
IncomeAmountVo communityIncome = baseMapper.communityIncome(SecurityUtils.getUserId());
// 问答收益
IncomeAmountVo questionIncome = baseMapper.questionIncome(SecurityUtils.getUserId());
// 累计收益
Double totalIncome = baseMapper.totalIncome();
IncomeInfoVo incomeInfoVo = IncomeInfoVo.builder()
.communityIncome(communityIncome)
.questionIncome(questionIncome)
.totalIncome(totalIncome)
.build();
return R.ok(incomeInfoVo);
}
@Override
public TableDataInfo incomeList(IncomeInfoListPageRes incomeInfoListPageRes) {
Page<IncomeInfo> page = this.initPage(incomeInfoListPageRes);
List<IncomeInfoListVo> incomeInfoList = baseMapper.incomeList(page, incomeInfoListPageRes, SecurityUtils.getUserId());
// 封装分页信息
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(incomeInfoList);
rspData.setTotal(page.getTotal());
return rspData;
}
private Page<IncomeInfo> initPage(PageDomain pageDomain) {
return new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
}
}

View File

@ -120,7 +120,7 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
Calendar now = Calendar.getInstance();
Date startTime = now.getTime();
now.add(Calendar.YEAR, community.getValidityDay());
now.add(Calendar.DAY_OF_YEAR, community.getValidityDay());
Date endTime = now.getTime();
communityUserMapper.insert(CommunityUser
@ -128,7 +128,7 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
.tenantId(userId)
.communityId(communityId)
.userId(SecurityUtils.getUserId())
.userType(1)
.userType(0)
.inviteId(invite.getId())
.startTime(startTime)
.endTime(endTime)

View File

@ -1,91 +0,0 @@
package com.mcwl.communityCenter.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R;
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.utils.SecurityUtils;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.Publish;
import com.mcwl.communityCenter.domain.PublishCollect;
import com.mcwl.communityCenter.domain.Question;
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.mapper.CommunityMapper;
import com.mcwl.communityCenter.mapper.InviteMapper;
import com.mcwl.communityCenter.mapper.PublishCollectMapper;
import com.mcwl.communityCenter.mapper.PublishMapper;
import com.mcwl.communityCenter.service.PublishCollectService;
import com.mcwl.communityCenter.service.PublishCommentService;
import com.mcwl.communityCenter.service.PublishService;
import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@RequiredArgsConstructor
public class PublishCollectServiceImpl extends ServiceImpl<PublishCollectMapper, PublishCollect> implements PublishCollectService {
private final PublishCommentService publishCommentService;
@Override
public TableDataInfo myCollectList(MyPublishCollectPageRes myPublishCollectPageRes) {
Page<PublishCollect> page = initPage(myPublishCollectPageRes);
page.addOrder(new OrderItem("p.create_time", false));
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();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(personHomeVoList);
rspData.setTotal(page.getTotal());
return rspData;
}
@Override
public void savePublishCollect(PublishCollect publishCollect) {
baseMapper.savePublishCollect(publishCollect);
}
@Override
public PublishCollect getPublishCollect(PublishCollectRes publishCollectRes, Long userId) {
return baseMapper.getPublishCollect(publishCollectRes, userId);
}
@Override
public void updatePublishCollect(PublishCollect publishCollect) {
baseMapper.updatePublishCollect(publishCollect);
}
private Page<PublishCollect> initPage(PageDomain pageDomain) {
return new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
}
}

View File

@ -8,7 +8,6 @@ import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.domain.Publish;
import com.mcwl.communityCenter.domain.dto.CommentDelRes;
import com.mcwl.communityCenter.domain.dto.CommentDetailRes;
@ -16,7 +15,6 @@ import com.mcwl.communityCenter.domain.dto.CommentRes;
import com.mcwl.communityCenter.domain.vo.CommentVo;
import com.mcwl.communityCenter.domain.PublishComment;
import com.mcwl.communityCenter.domain.PublishCommentLike;
import com.mcwl.communityCenter.mapper.CommunityUserMapper;
import com.mcwl.communityCenter.mapper.PublishCommentLikeMapper;
import com.mcwl.communityCenter.mapper.PublishCommentMapper;
import com.mcwl.communityCenter.mapper.PublishMapper;
@ -54,10 +52,8 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
private final PublishMapper publishMapper;
private final CommunityUserMapper communityUserMapper;
@Override
public R<List<CommentVo>> getComment(CommentDetailRes commentDetailRes) {
public R<Object> getComment(CommentDetailRes commentDetailRes) {
Long tenantId = commentDetailRes.getTenantId();
Long communityId = commentDetailRes.getCommunityId();
Long operatorId = commentDetailRes.getOperatorId();
@ -84,16 +80,6 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
Long communityId = commentRes.getCommunityId();
Long operatorId = commentRes.getOperatorId();
CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, SecurityUtils.getUserId());
if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"评论失败,您不是该社区成员");
}
if ("1".equals(communityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"评论失败,您已被拉黑");
}
Publish publish = publishMapper.selectByIdAndTenantIdAndCommunityId(operatorId, tenantId, communityId);
if (Objects.isNull(publish)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"评论失败,该内容不存在");
@ -101,7 +87,7 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
PublishComment publishComment = new PublishComment();
BeanUtil.copyProperties(commentRes, publishComment);
publishComment.setPublishId(operatorId);
publishComment.setOperatorId(operatorId);
publishComment.setUserId(SecurityUtils.getUserId());
publishComment.setType(0);

View File

@ -29,8 +29,6 @@ public class PublishLikeServiceImpl extends ServiceImpl<PublishLikeMapper, Publi
private final CommunityAdviceMapper communityAdviceMapper;
private final CommunityUserMapper communityUserMapper;
@Override
public void like(PublishLikeRes publishLikeRes) {
@ -43,19 +41,6 @@ public class PublishLikeServiceImpl extends ServiceImpl<PublishLikeMapper, Publi
throw new ServiceException("点赞失败,该内容不存在", HttpStatus.SHOW_ERROR_MSG);
}
CommunityUser communityUser = communityUserMapper.selectCommunityUser(publishLikeRes.getTenantId(),
publishLikeRes.getCommunityId(), SecurityUtils.getUserId());
if (Objects.isNull(communityUser)) {
throw new ServiceException("点赞失败,您不是该社区成员", HttpStatus.SHOW_ERROR_MSG);
}
if ("1".equals(communityUser.getIsBlack())) {
throw new ServiceException("点赞失败,您已被拉黑", HttpStatus.SHOW_ERROR_MSG);
}
PublishLike publishLike = baseMapper.selectPublishLike(publishLikeRes, SecurityUtils.getUserId());
if (Objects.isNull(publishLike)) {

View File

@ -10,27 +10,26 @@ import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
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.exception.BusinessException;
import com.mcwl.common.exception.ServiceException;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.communityCenter.constant.AdviceConstant;
import com.mcwl.communityCenter.domain.*;
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.Community;
import com.mcwl.communityCenter.domain.Publish;
import com.mcwl.communityCenter.domain.Question;
import com.mcwl.communityCenter.domain.dto.PublishDetailRes;
import com.mcwl.communityCenter.domain.dto.PublishPageRes;
import com.mcwl.communityCenter.domain.dto.PublishRes;
import com.mcwl.communityCenter.domain.vo.PublishVo;
import com.mcwl.communityCenter.mapper.*;
import com.mcwl.communityCenter.service.*;
import com.mcwl.communityCenter.mapper.CommunityMapper;
import com.mcwl.communityCenter.mapper.InviteMapper;
import com.mcwl.communityCenter.mapper.PublishMapper;
import com.mcwl.communityCenter.mapper.QuestionMapper;
import com.mcwl.communityCenter.service.PublishService;
import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import nonapi.io.github.classgraph.concurrency.AutoCloseableExecutorService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.temporal.ValueRange;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
@ -44,30 +43,15 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
private final CommunityMapper communityMapper;
private final CommunityUserMapper communityUserMapper;
private final PublishCollectService publishCollectService;
private final PublishCommentService publishCommentService;
private final PublishMapper publishMapper;
private final PublishLikeMapper publishLikeMapper;
private final CommunityAdviceMapper communityAdviceMapper;
private final QuestionService questionService;
@Override
public PublishVo getDetail(PublishDetailRes publishDetailRes) {
Long publishId = publishDetailRes.getPublishId();
Long id = publishDetailRes.getId();
Long tenantId = publishDetailRes.getTenantId();
Long communityId = publishDetailRes.getCommunityId();
// 根据id和租户id和社区id查询发布信息
Publish publish = baseMapper.selectByIdAndTenantIdAndCommunityId(publishId, tenantId, communityId);
Publish publish = baseMapper.selectByIdAndTenantIdAndCommunityId(id, tenantId, communityId);
if (Objects.isNull(publish)) {
return null;
@ -89,27 +73,26 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
Community community = communityMapper.getByTenantIdAndCommunityId(publishRes.getTenantId(), publishRes.getCommunityId());
if (Objects.isNull(community)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "用户社区未创建");
return R.fail(HttpStatus.SHOW_ERROR_MSG,"用户社区未创建");
}
CommunityUser communityUser = communityUserMapper.selectCommunityUser(publishRes.getTenantId(), publishRes.getCommunityId(), userId);
Set<Long> invites = inviteMapper.selectInviteIds(publishRes.getTenantId(), publishRes.getCommunityId());
if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员");
// 判断用户是否是群主
if (!Objects.equals(userId, publishRes.getTenantId())) {
// 判断用户是否被邀请
if (invites.isEmpty() || !invites.contains(userId)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"您没有被邀请");
}
}
if ("1".equals(communityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您已被拉黑");
}
Publish publish = new Publish();
BeanUtil.copyProperties(publishRes, publish);
publish.setUserId(userId);
if (Objects.isNull(publish.getPublishTime())) {
publish.setPublishTime(new Date());
}
baseMapper.insertPublish(publish);
baseMapper.insert(publish);
return R.ok();
}
@ -117,7 +100,6 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
public TableDataInfo getPublishList(PublishPageRes publishPageRes) {
Page<Publish> page = this.initPage(publishPageRes);
page.addOrder(new OrderItem("create_time", false));
// 根据租户id和社区id查询分页数据
baseMapper.selectByTenantIdAndCommunityIdPage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
@ -149,7 +131,6 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
public TableDataInfo publishImage(PublishPageRes publishPageRes) {
Page<Publish> page = this.initPage(publishPageRes);
page.addOrder(new OrderItem("create_time", false));
// 根据租户id和社区id和fileUrl不为空查询分页数据
baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
@ -179,7 +160,6 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
@Override
public TableDataInfo publishFile(PublishPageRes publishPageRes) {
Page<Publish> page = this.initPage(publishPageRes);
page.addOrder(new OrderItem("create_time", false));
// 根据租户id和社区id和imageUrl不为空查询分页数据
baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
@ -214,140 +194,21 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
@Override
public TableDataInfo publishList(PublishPageRes publishPageRes) {
Page<Publish> page = this.initPage(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.setRows(publishVoList);
tableDataInfo.setRows(publishList);
tableDataInfo.setTotal(page.getTotal());
tableDataInfo.setCode(HttpStatus.SUCCESS);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
}
@Override
public TableDataInfo myPublishList(MyPublishPageRes myPublishPageRes) {
Page<Publish> page = this.initPage(myPublishPageRes);
page.addOrder(new OrderItem("p.create_time", false));
private Page<Publish> initPage(PublishPageRes publishPageRes) {
Page<Publish> page = new Page<>(publishPageRes.getPageNum(), publishPageRes.getPageSize());
page.addOrder(new OrderItem("create_time", false));
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.setRows(personHomeVoList);
tableDataInfo.setTotal(page.getTotal());
tableDataInfo.setCode(HttpStatus.SUCCESS);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void collectPublish(PublishCollectRes publishCollectRes) {
Long tenantId = publishCollectRes.getTenantId();
Long communityId = publishCollectRes.getCommunityId();
Long publishId = publishCollectRes.getPublishId();
Long userId = SecurityUtils.getUserId();
Publish publish = publishMapper.selectByIdAndTenantIdAndCommunityId(publishId, tenantId, communityId);
if (Objects.isNull(publish)) {
throw new ServiceException("该内容不存在", HttpStatus.SHOW_ERROR_MSG);
}
PublishCollect publishCollect = publishCollectService.getPublishCollect(publishCollectRes, userId);
if (Objects.isNull(publishCollect)) {
publishCollect = new PublishCollect();
publishCollect.setTenantId(tenantId);
publishCollect.setCommunityId(communityId);
publishCollect.setPublishId(publishId);
publishCollect.setUserId(userId);
publishCollectService.savePublishCollect(publishCollect);
this.addCollectAdvice(publish);
return;
}
if (publishCollect.getDelFlag().equals("0")) {
publishCollect.setDelFlag("2");
} else {
publishCollect.setDelFlag("0");
}
publishCollectService.updatePublishCollect(publishCollect);
this.addCollectAdvice(publish);
}
private void addCollectAdvice(Publish publish) {
CommunityAdvice communityAdvice = new CommunityAdvice();
communityAdvice.setTenantId(publish.getTenantId());
communityAdvice.setCommunityId(publish.getCommunityId());
communityAdvice.setSendUserId(SecurityUtils.getUserId());
communityAdvice.setAdviceType(AdviceConstant.COMMUNITY_NOTICE);
communityAdvice.setUserId(publish.getUserId());
communityAdvice.setContent(StringUtils.format("{}收藏了你发布的{}",
SecurityUtils.getLoginUser().getUser().getNickName(), publish.getContent()));
communityAdviceMapper.insert(communityAdvice);
}
@Override
public TableDataInfo getPersonHomeList(PersonHomePageRes personHomePageRes) {
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));
}
}
private Page<Publish> initPage(PageDomain pageDomain) {
return new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
return page;
}
}

View File

@ -12,7 +12,10 @@ import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.communityCenter.constant.AdviceConstant;
import com.mcwl.communityCenter.domain.*;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityAdvice;
import com.mcwl.communityCenter.domain.Question;
import com.mcwl.communityCenter.domain.QuestionComment;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.QuestionCommentVo;
import com.mcwl.communityCenter.domain.vo.QuestionVo;
@ -39,8 +42,6 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
private final CommunityAdviceMapper communityAdviceMapper;
private final CommunityUserMapper communityUserMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public R<Object> comment(QuestionCommentRes questionCommentRes) {
@ -55,14 +56,6 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
return R.fail(HttpStatus.SHOW_ERROR_MSG, "提问不存在");
}
CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, SecurityUtils.getUserId());
if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员,不能评论");
}
if ("1".equals(communityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"您已被拉黑");
}
QuestionComment questionComment = new QuestionComment();
BeanUtil.copyProperties(questionCommentRes, questionComment);
questionComment.setUserId(SecurityUtils.getUserId());
@ -169,7 +162,11 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
Page<QuestionComment> page = new Page<>(questionCommentPageRes.getPageNum(), questionCommentPageRes.getPageSize());
page.addOrder(new OrderItem("create_time", false));
if (StringUtils.isBlank(questionCommentPageRes.getOrderByColumn())) {
questionCommentPageRes.setOrderByColumn("create_time");
}
OrderItem orderItem = OrderItem.desc(questionCommentPageRes.getOrderByColumn());
page.addOrder(orderItem);
return page;

View File

@ -14,15 +14,20 @@ import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.communityCenter.constant.AdviceConstant;
import com.mcwl.communityCenter.constant.StatusConstant;
import com.mcwl.communityCenter.domain.*;
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.QuestionCommentVo;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityAdvice;
import com.mcwl.communityCenter.domain.Invite;
import com.mcwl.communityCenter.domain.Question;
import com.mcwl.communityCenter.domain.dto.QuestionDetailRes;
import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
import com.mcwl.communityCenter.domain.dto.QuestionReplyRes;
import com.mcwl.communityCenter.domain.dto.QuestionRes;
import com.mcwl.communityCenter.domain.vo.QuestionVo;
import com.mcwl.communityCenter.mapper.*;
import com.mcwl.communityCenter.mapper.CommunityAdviceMapper;
import com.mcwl.communityCenter.mapper.CommunityMapper;
import com.mcwl.communityCenter.mapper.InviteMapper;
import com.mcwl.communityCenter.mapper.QuestionMapper;
import com.mcwl.communityCenter.service.CommunityService;
import com.mcwl.communityCenter.service.QuestionCommentService;
import com.mcwl.communityCenter.service.QuestionService;
import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
@ -48,10 +53,6 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
private final InviteMapper inviteMapper;
private final CommunityUserMapper communityUserMapper;
private final QuestionCommentService questionCommentService;
/**
*
*
@ -73,14 +74,14 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
return R.fail(HttpStatus.SHOW_ERROR_MSG, "租户或社区不存在");
}
//提问人userId是否在社区中
CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, userId);
if (Objects.isNull(communityUser)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员,不能提问");
if (Objects.equals(questionUserId, userId)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不能提问自己的问题");
}
if ("1".equals(communityUser.getIsBlack())) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您已被拉黑");
//提问人userId是否在社区中
Invite invite = inviteMapper.selectByTenantIdAndCommunityIdAndInviteeUserId(tenantId, communityId, userId);
if (Objects.isNull(invite)) {
return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员,不能提问");
}
Question question = new Question();
@ -234,49 +235,15 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
return rspData;
}
@Override
public TableDataInfo myQuestionList(QuestionPageRes questionPageRes) {
Page<Question> page = initPage(questionPageRes);
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();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(personHomeVoList);
rspData.setTotal(page.getTotal());
return rspData;
}
private Page<Question> initPage(QuestionPageRes questionPageRes) {
Page<Question> page = new Page<>(questionPageRes.getPageNum(), questionPageRes.getPageSize());
page.addOrder(new OrderItem("create_time", false));
OrderItem orderItem = new OrderItem();
if (StringUtils.isBlank(questionPageRes.getOrderByColumn())) {
questionPageRes.setOrderByColumn("create_time");
}
orderItem.setColumn(questionPageRes.getOrderByColumn());
orderItem.setAsc(Objects.equals(questionPageRes.getIsAsc(), "asc"));
page.addOrder(orderItem);
return page;
}

View File

@ -1,39 +0,0 @@
package com.mcwl.communityCenter.task;
import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.service.CommunityUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.List;
@Component("communityUserTask")
@RequiredArgsConstructor
public class CommunityUserTask {
private final CommunityUserService communityUserService;
/**
* 30 0 0/30 * * * ? *
*/
public void pullOutBlackUser() {
List<CommunityUser> communityUserList = communityUserService.getAllCommunityUser();
for (CommunityUser communityUser : communityUserList) {
String isBlank = communityUser.getIsBlack();
if ("1".equals(isBlank) && communityUser.getBlackEndTime().getTime() < System.currentTimeMillis()) {
communityUser.setIsBlack("0");
communityUser.setBlackEndTime(null);
communityUser.setBlackReason(null);
communityUserService.updateBlankCommunityUser(communityUser);
}
}
}
}

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.CommunityAdviceMapper">
<select id="getCommunityAdviceList" resultType="com.mcwl.communityCenter.domain.vo.CommunityAdviceVo">
select a.*,
u.nick_name as send_user_name,
u.avatar as send_user_avatar
from cc_advice a left join sys_user u on
a.tenant_id = u.user_id
where a.del_flag = '0'
<if test="communityAdvicePageRes.adviceType != null">
and a.advice_type = #{communityAdvicePageRes.adviceType}
</if>
order by a.create_time desc
</select>
</mapper>

View File

@ -3,12 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<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 su.avatar

View File

@ -17,12 +17,4 @@
</if>
order by cf.create_time desc
</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>

View File

@ -86,9 +86,7 @@
and (community_name like concat('%', #{searchContent}, '%')
or `description` like concat('%', #{searchContent}, '%'))
</if>
and del_flag = '0'
</where>
</select>
<select id="getMyJoinCommunity" resultType="com.mcwl.communityCenter.domain.Community">
select c.id,
@ -109,15 +107,9 @@
where cu.user_id = #{userId}
and c.del_flag = '0'
and cu.del_flag = '0'
<if test="joinCommunityListPageRes.isMyCreate == 1">
and c.tenant_id = #{userId}
</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 test="searchContent != null and searchContent != ''">
and (c.community_name like concat('%', #{searchContent}, '%')
or c.description like concat('%', #{searchContent}, '%'))
</if>
</select>
</mapper>

View File

@ -3,40 +3,17 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.CommunityUserMapper">
<update id="updateBlackCommunityUser">
update cc_community_user
set is_black = #{blackCommunityUser.isBlack},
black_reason = #{blackCommunityUser.blackReason},
black_end_time = #{blackCommunityUser.blackEndTime}
where tenant_id = #{blackCommunityUser.tenantId}
and community_id = #{blackCommunityUser.communityId}
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';
</update>
<select id="selectByTenantIdAndCommunityIdAndUserId"
resultType="com.mcwl.communityCenter.domain.CommunityUser">
select *
select id,
tenant_id,
community_id,
user_id
from cc_community_user
where tenant_id = #{tenantId}
and community_id = #{communityId}
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';
</select>
<select id="getJoinNum" resultType="java.lang.Integer">
@ -44,8 +21,6 @@
from cc_community_user
where tenant_id = #{tenantId}
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';
</select>
<select id="isJoinCommunity" resultType="java.lang.Integer">
@ -54,8 +29,6 @@
where tenant_id = #{tenantId}
and community_id = #{communityId}
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';
</select>
<select id="getCommunityUserList" resultType="com.mcwl.communityCenter.domain.vo.CommunityUserVo">
@ -63,64 +36,22 @@
cu.tenant_id,
cu.community_id,
cu.user_id,
cu.user_type,
cu.is_black,
u.avatar,
u.nick_name,
IF(cu.community_price != 0, '收费', '免费') AS join_type,
cu.start_time,
u.login_date,
cu.end_time
from cc_community_user cu
left join sys_user u on cu.user_id = u.user_id
<where>
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 != ''">
and u.nick_name like concat('%', #{communityUserListPageRes.searchContent}, '%')
</if>
and (cu.blank_end_time is null or NOW() &gt;= cu.blank_end_time)
and cu.is_blank = '0'
and cu.del_flag = '0'
</where>
order by cu.user_type desc, cu.is_black, cu.create_time
</select>
<select id="selectCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser">
select id,
tenant_id,
community_id,
user_id,
user_type,
invite_id,
community_price,
start_time,
end_time,
is_black,
black_reason,
black_end_time
from cc_community_user
where tenant_id = #{tenantId}
and community_id = #{communityId}
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 id="getAllCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser">
select id,
tenant_id,
community_id,
user_id,
user_type,
invite_id,
community_price,
start_time,
end_time,
is_black,
black_reason,
black_end_time
from cc_community_user
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>
</mapper>

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.IncomeInfoMapper">
<select id="communityIncome" resultType="com.mcwl.communityCenter.domain.vo.IncomeAmountVo">
SELECT SUM(IF(DATE(create_time) = CURDATE(), amount, 0)) AS today_income,
SUM(IF(DATE(create_time) = CURDATE() - INTERVAL 1 DAY, amount, 0)) AS yesterday_income
FROM cc_income_info
WHERE tenant_id = #{userId}
AND type = 0
AND del_flag = '0'
</select>
<select id="questionIncome" resultType="com.mcwl.communityCenter.domain.vo.IncomeAmountVo">
SELECT SUM(IF(DATE(create_time) = CURDATE(), amount, 0)) AS today_income,
SUM(IF(DATE(create_time) = CURDATE() - INTERVAL 1 DAY, amount, 0)) AS yesterday_income
FROM cc_income_info
WHERE tenant_id = #{userId}
AND type = 1
AND del_flag = '0'
</select>
<select id="totalIncome" resultType="java.lang.Double">
SELECT SUM(amount)
FROM cc_income_info
WHERE del_flag = '0'
</select>
<select id="incomeList" resultType="com.mcwl.communityCenter.domain.vo.IncomeInfoListVo">
SELECT u.nick_name as user_name,
u.avatar as avatar,
c.community_name as community_name,
ii.type as type,
ii.amount as amount,
ii.create_time as create_time
FROM cc_income_info ii
left join cc_community c
on ii.tenant_id = c.tenant_id
and ii.community_id = c.id
left join sys_user u on c.tenant_id = u.user_id
where ii.tenant_id = #{userId}
<if test="incomeInfoListPageRes.type != null ">
and ii.type = #{incomeInfoListPageRes.type}
</if>
<if test="incomeInfoListPageRes.searchContent != null and incomeInfoListPageRes.searchContent != ''">
and (u.nick_name like concat('%', #{incomeInfoListPageRes.searchContent}, '%')
or c.community_name like concat('%', #{incomeInfoListPageRes.searchContent}, '%'))
</if>
and ii.del_flag = '0'
order by ii.create_time desc
</select>
</mapper>

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.PublishCollectMapper">
<insert id="savePublishCollect">
insert into cc_publish_collect(tenant_id, community_id, publish_id, user_id)
values (#{publishCollect.tenantId}, #{publishCollect.communityId}, #{publishCollect.publishId}, #{publishCollect.userId})
</insert>
<update id="updatePublishCollect">
update cc_publish_collect
set del_flag = #{publishCollect.delFlag}
where tenant_id = #{publishCollect.tenantId}
and community_id = #{publishCollect.communityId}
and publish_id = #{publishCollect.publishId}
and user_id = #{publishCollect.userId}
</update>
<select id="myCollectList" resultType="com.mcwl.communityCenter.domain.vo.PublishVo">
select p.*, IF(pc.id is not null, 1, 0) as is_collect
from cc_publish p left join cc_publish_collect pc
on p.id = pc.publish_id
and p.tenant_id = pc.tenant_id
and p.community_id = pc.community_id
<where>
and pc.tenant_id = #{myPublishCollectPageRes.tenantId}
and pc.community_id = #{myPublishCollectPageRes.communityId}
and pc.user_id = #{userId}
and pc.del_flag = '0'
</where>
</select>
<select id="getPublishCollect" resultType="com.mcwl.communityCenter.domain.PublishCollect">
select *
from cc_publish_collect
where tenant_id = #{publishCollectRes.tenantId}
and community_id = #{publishCollectRes.communityId}
and publish_id = #{publishCollectRes.publishId}
and user_id = #{userId}
</select>
</mapper>

View File

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

View File

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

View File

@ -3,12 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<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 cc_publish
set is_elite = !is_elite
@ -71,9 +65,9 @@
create_time
from cc_publish
where tenant_id = #{tenantId}
and community_id = #{communityId}
and del_flag = '0'
and image_url is not null
and community_id = #{communityId}
and del_flag = '0'
and image_url is not null
</select>
<select id="selectByTenantIdAndCommunityIdAndNotNullFilePage"
resultType="com.mcwl.communityCenter.domain.Publish">
@ -103,28 +97,12 @@
and tenant_id = #{publishPageRes.tenantId}
and community_id = #{publishPageRes.communityId}
and del_flag = '0'
<if test="publishPageRes.type != null">
<if test="publishPageRes.type == 0">
and user_id = #{publishPageRes.tenantId}
</if>
<if test="publishPageRes.type == 1">
and is_elite = 1
</if>
<if test="publishPageRes.type == 0">
and user_id = #{publishPageRes.tenantId}
</if>
<if test="publishPageRes.type == 1">
and is_elite = 1
</if>
</where>
order by create_time desc
</select>
<select id="myPublishList" resultType="com.mcwl.communityCenter.domain.vo.PublishVo">
select p.*, IF(pc.id is not null, 1, 0) as is_collect
from cc_publish p left join cc_publish_collect pc
on p.id = pc.publish_id
and p.tenant_id = pc.tenant_id
and p.community_id = pc.community_id
<where>
and p.tenant_id = #{myPublishPageRes.tenantId}
and p.community_id = #{myPublishPageRes.communityId}
and p.user_id = #{userId}
and p.del_flag = '0'
</where>
</select>
</mapper>

View File

@ -57,12 +57,4 @@
and question_url is not null
order by amount desc, create_time desc
</select>
<select id="myQuestionList" resultType="com.mcwl.communityCenter.domain.Question">
select *
from cc_question
where del_flag = '0'
and tenant_id = #{questionPageRes.tenantId}
and community_id = #{questionPageRes.communityId}
and question_user_id = #{userId}
</select>
</mapper>

Some files were not shown because too many files have changed in this diff Show More