feat(memberCenter): 添加会员等级和相关功能
parent
17edba85e5
commit
6b42b596de
|
@ -117,4 +117,14 @@ public class CommunityController {
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否加入社区
|
||||
*/
|
||||
@ApiOperation(value = "是否加入社区")
|
||||
@PostMapping("isJoin")
|
||||
public R<Object> isJoinCommunity(@RequestBody @Valid JoinCommunityRes joinCommunityRes) {
|
||||
|
||||
return communityService.isJoinCommunity(joinCommunityRes);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
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.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.dto.*;
|
||||
import com.mcwl.communityCenter.service.CommunityService;
|
||||
import com.mcwl.communityCenter.service.CommunityUserService;
|
||||
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;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 社区用户
|
||||
*/
|
||||
@Api(tags = "社区用户")
|
||||
@RestController
|
||||
@RequestMapping("communityUser")
|
||||
@RequiredArgsConstructor
|
||||
public class CommunityUserController {
|
||||
|
||||
private final CommunityUserService communityUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 社区用户列表
|
||||
*/
|
||||
@ApiOperation(value = "社区用户列表")
|
||||
@PostMapping("list")
|
||||
public TableDataInfo getCommunityUserList(@RequestBody @Valid CommunityUserListPageRes communityUserListPageRes) {
|
||||
|
||||
return communityUserService.getCommunityUserList(communityUserListPageRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉黑
|
||||
*/
|
||||
@ApiOperation(value = "拉黑")
|
||||
@PostMapping("black")
|
||||
public R<Object> black(@RequestBody @Valid BlackListRes blackListRes) {
|
||||
|
||||
return communityUserService.black(blackListRes);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.mcwl.web.controller.memberCenter;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.memberCenter.domain.Benefit;
|
||||
import com.mcwl.memberCenter.domain.dto.BenefitDto;
|
||||
import com.mcwl.memberCenter.domain.vo.BenefitVo;
|
||||
import com.mcwl.memberCenter.enums.MemberBenefitTypeEnum;
|
||||
import com.mcwl.memberCenter.service.BenefitService;
|
||||
import com.mcwl.memberCenter.service.MemberBenefitService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/***
|
||||
* 权益
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("benefit")
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "会员中心")
|
||||
public class BenefitController {
|
||||
|
||||
private final BenefitService benefitService;
|
||||
|
||||
/**
|
||||
* 权益列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:benefit:list')")
|
||||
@ApiOperation(value = "权益列表")
|
||||
@GetMapping("list")
|
||||
public R<List<BenefitVo>> list() {
|
||||
List<Benefit> benefitList = benefitService.list();
|
||||
List<BenefitVo> benefitVoList = new ArrayList<>();
|
||||
for (Benefit benefit : benefitList) {
|
||||
BenefitVo benefitVo = BeanUtil.copyProperties(benefit, BenefitVo.class);
|
||||
benefitVo.setBenefitType(benefit.getBenefitType().getValue());
|
||||
benefitVoList.add(benefitVo);
|
||||
}
|
||||
|
||||
return R.ok(benefitVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加权益
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:benefit:add')")
|
||||
@ApiOperation(value = "添加权益")
|
||||
@PostMapping("add")
|
||||
public void add(@RequestBody @Valid BenefitDto benefitDto) {
|
||||
|
||||
benefitDto.setId(null);
|
||||
Benefit benefit = BeanUtil.copyProperties(benefitDto, Benefit.class);
|
||||
benefitService.save(benefit);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 权益详情
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:benefit:query')")
|
||||
@ApiOperation(value = "权益详情")
|
||||
@GetMapping("detail")
|
||||
public R<BenefitVo> detail(Long id) {
|
||||
Benefit benefit = benefitService.getById(id);
|
||||
BenefitVo benefitVo = BeanUtil.copyProperties(benefit, BenefitVo.class);
|
||||
benefitVo.setBenefitType(benefit.getBenefitType().getValue());
|
||||
return R.ok(benefitVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改权益
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:benefit:edit')")
|
||||
@ApiOperation(value = "修改权益")
|
||||
@PostMapping("update")
|
||||
public void update(@RequestBody @Valid BenefitDto benefitDto) {
|
||||
|
||||
Benefit benefit = BeanUtil.copyProperties(benefitDto, Benefit.class);
|
||||
benefitService.updateById(benefit);
|
||||
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('system:benefit:remove')")
|
||||
@ApiOperation(value = "删除权益")
|
||||
@GetMapping("delete")
|
||||
public void delete(@NotNull(message = "id不能为空") Long id) {
|
||||
benefitService.removeById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.mcwl.web.controller.memberCenter;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.memberCenter.domain.MemberBenefit;
|
||||
import com.mcwl.memberCenter.domain.dto.MemberBenefitDto;
|
||||
import com.mcwl.memberCenter.domain.vo.MemberBenefitVO;
|
||||
import com.mcwl.memberCenter.service.MemberBenefitService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/***
|
||||
* 会员权益关联
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("memberBenefit")
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "会员中心")
|
||||
public class MemberBenefitController {
|
||||
|
||||
private final MemberBenefitService memberBenefitService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取会员等级及权益列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:memberBenefit:list')")
|
||||
@GetMapping("getMemberBenefitList")
|
||||
@ApiOperation(value = "获取会员等级及权益列表")
|
||||
public R<List<MemberBenefitVO>> getMemberBenefitList() {
|
||||
|
||||
return R.ok(memberBenefitService.getMemberBenefitList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会员等级权益
|
||||
*/
|
||||
@ApiOperation(value = "查询会员权益")
|
||||
@GetMapping("getMemberBenefit")
|
||||
public R<MemberBenefitVO> getMemberBenefit(@Valid
|
||||
@NotNull(message = "会员等级id不能为空")
|
||||
@ApiParam(value = "会员等级id", required = true)
|
||||
Long memberLevelId) {
|
||||
|
||||
return R.ok(memberBenefitService.getMemberBenefit(memberLevelId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加会员权益
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:memberBenefit:add')")
|
||||
@ApiOperation(value = "会员绑定权益")
|
||||
@PostMapping("addMemberBenefit")
|
||||
public R<Object> addMemberBenefit(@RequestBody @Valid MemberBenefitDto memberBenefitDto) {
|
||||
memberBenefitService.addMemberBenefit(memberBenefitDto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('system:memberBenefit:edit')")
|
||||
@ApiOperation(value = "修改会员权益")
|
||||
@PostMapping("updateMemberBenefit")
|
||||
public R<Object> updateMemberBenefit(@RequestBody @Valid MemberBenefit memberBenefit) {
|
||||
|
||||
return R.ok(memberBenefitService.updateById(memberBenefit));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除会员权益")
|
||||
@GetMapping("deleteMemberBenefit")
|
||||
public R<Object> deleteMemberBenefit(@Valid @NotNull(message = "会员权益id不能为空") Long id) {
|
||||
|
||||
return R.ok(memberBenefitService.removeById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,19 +1,21 @@
|
|||
package com.mcwl.web.controller.memberCenter;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.memberCenter.domain.MemberBenefit;
|
||||
import com.mcwl.memberCenter.domain.MemberLevel;
|
||||
import com.mcwl.memberCenter.service.MemberBenefitService;
|
||||
import com.mcwl.memberCenter.domain.dto.AddMemberLevelDto;
|
||||
import com.mcwl.memberCenter.domain.dto.EditMemberLevelDto;
|
||||
import com.mcwl.memberCenter.domain.vo.MemberLevelVo;
|
||||
import com.mcwl.memberCenter.service.MemberLevelService;
|
||||
import com.mcwl.memberCenter.domain.vo.MemberBenefitVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -28,31 +30,80 @@ public class MemberLevelController {
|
|||
|
||||
private final MemberLevelService memberLevelService;
|
||||
|
||||
private final MemberBenefitService memberBenefitService;
|
||||
|
||||
/**
|
||||
* 添加会员等级
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:memberLevel:add')")
|
||||
@PostMapping("addMemberLevel")
|
||||
@ApiOperation(value = "添加会员等级")
|
||||
public R<Object> add(@RequestBody @Valid AddMemberLevelDto addMemberLevelDto) {
|
||||
MemberLevel memberLevel = BeanUtil.copyProperties(addMemberLevelDto, MemberLevel.class);
|
||||
memberLevelService.save(memberLevel);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员等级列表
|
||||
*
|
||||
* @return 会员等级列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:memberLevel:list')")
|
||||
@GetMapping("list")
|
||||
@ApiOperation(value = "获取会员等级列表")
|
||||
public R<List<MemberLevel>> list() {
|
||||
public R<List<MemberLevelVo>> list() {
|
||||
|
||||
List<MemberLevel> memberLevelList = memberLevelService.list();
|
||||
List<MemberLevelVo> memberLevelListVo = new ArrayList<>();
|
||||
for (MemberLevel memberLevel : memberLevelList) {
|
||||
MemberLevelVo memberLevelVo = BeanUtil.copyProperties(memberLevel, MemberLevelVo.class);
|
||||
memberLevelVo.setSubscriptionPeriod(memberLevel.getSubscriptionPeriod().getValue());
|
||||
memberLevelListVo.add(memberLevelVo);
|
||||
}
|
||||
|
||||
return R.ok(memberLevelList);
|
||||
return R.ok(memberLevelListVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员等级
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:memberLevel:query')")
|
||||
@GetMapping("getMemberLevel")
|
||||
@ApiOperation(value = "获取会员等级")
|
||||
public R<MemberLevelVo> getMemberLevel(@Valid
|
||||
@NotNull(message = "会员等级id不能为空")
|
||||
@ApiParam(value = "会员等级id", required = true)
|
||||
Long id) {
|
||||
MemberLevel memberLevel = memberLevelService.getById(id);
|
||||
MemberLevelVo memberLevelVo = BeanUtil.copyProperties(memberLevel, MemberLevelVo.class);
|
||||
memberLevelVo.setSubscriptionPeriod(memberLevel.getSubscriptionPeriod().getValue());
|
||||
return R.ok(memberLevelVo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取会员等级及权益列表
|
||||
* 修改会员等级
|
||||
*/
|
||||
@GetMapping("getMemberBenefitList")
|
||||
@ApiOperation(value = "获取会员等级及权益列表")
|
||||
public R<List<MemberBenefitVO>> getMemberBenefitList() {
|
||||
// @PreAuthorize("@ss.hasPermi('system:memberLevel:edit')")
|
||||
@PostMapping("updateMemberLevel")
|
||||
@ApiOperation(value = "修改会员等级")
|
||||
public R<Object> update(@RequestBody @Valid EditMemberLevelDto editMemberLevelDto) {
|
||||
memberLevelService.updateById(BeanUtil.copyProperties(editMemberLevelDto, MemberLevel.class));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
return R.ok(memberBenefitService.getMemberBenefitList());
|
||||
/**
|
||||
* 删除会员等级
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:memberLevel:remove')")
|
||||
@GetMapping("deleteMemberLevel")
|
||||
@ApiOperation(value = "删除会员等级")
|
||||
public R<Object> delete(@Valid
|
||||
@NotNull(message = "会员等级id不能为空")
|
||||
@ApiParam(value = "会员等级id", required = true)
|
||||
Long id) {
|
||||
memberLevelService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
@ -48,6 +49,7 @@ public class PromotionController {
|
|||
/**
|
||||
* 创建活动
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:promotion:add')")
|
||||
@PostMapping("createPromotion")
|
||||
@ApiOperation(value = "创建活动")
|
||||
public R<Object> createPromotion(@RequestBody @Valid PromotionDto promotionDto) {
|
||||
|
@ -100,6 +102,29 @@ public class PromotionController {
|
|||
return promotionService.joinPromotion(promotionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改活动
|
||||
*/
|
||||
// @PostMapping("updatePromotion")
|
||||
// @ApiOperation(value = "修改活动")
|
||||
// public R<Object> updatePromotion(@RequestBody @Valid PromotionDto promotionDto) {
|
||||
//
|
||||
// return promotionService.updatePromotion(promotionDto);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 删除活动
|
||||
*/
|
||||
@GetMapping("deletePromotion")
|
||||
@ApiOperation(value = "删除活动")
|
||||
public R<Object> deletePromotion(@Valid
|
||||
@NotNull(message = "活动ID不能为空")
|
||||
@ApiParam("活动ID")
|
||||
Long promotionId) {
|
||||
promotionService.removeById(promotionId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
// private boolean isSubscribe(Long userId, Promotion promotion) {
|
||||
// if (promotion.getActivityType() == PromotionEnum.SUBSCRIBE) {
|
||||
// // 获取当前用户最新的订阅或续订
|
||||
|
|
|
@ -64,16 +64,16 @@ public class InvitationController {
|
|||
* @return 邀请列表
|
||||
*/
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value = "获取邀请列表")
|
||||
public R<List<Invitation>> list(@Valid
|
||||
@NotNull(message = "用户id不能为空")
|
||||
@ApiParam("用户id") Long userId) {
|
||||
List<Invitation> list = invitationService.lambdaQuery()
|
||||
.eq(Invitation::getUserId, userId)
|
||||
.list();
|
||||
return R.ok(list);
|
||||
}
|
||||
// @GetMapping("/list")
|
||||
// @ApiOperation(value = "获取邀请列表")
|
||||
// public R<List<Invitation>> list(@Valid
|
||||
// @NotNull(message = "用户id不能为空")
|
||||
// @ApiParam("用户id") Long userId) {
|
||||
// List<Invitation> list = invitationService.lambdaQuery()
|
||||
// .eq(Invitation::getUserId, userId)
|
||||
// .list();
|
||||
// return R.ok(list);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -66,4 +66,10 @@ public class CodeMQConfig {
|
|||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue sysMsgQueue() {
|
||||
return new Queue(QueueConstants.SYS_MSG_QUEUE, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.dto.SysAdviceDto;
|
||||
import com.mcwl.resource.domain.vo.AdviceVo;
|
||||
import com.mcwl.resource.domain.vo.AttentionAdviceVo;
|
||||
import com.mcwl.resource.domain.vo.CommentAdviceVo;
|
||||
|
@ -10,9 +11,7 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
@ -29,6 +28,21 @@ public class SysAdviceController {
|
|||
|
||||
private final ISysAdviceService sysAdviceService;
|
||||
|
||||
/**
|
||||
* 发送系统消息
|
||||
*
|
||||
@NotNull(message = "消息内容不能为空")
|
||||
@ApiParam(value = "消息内容", required = true)
|
||||
String adviceContent
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:advice:add')")
|
||||
@PostMapping("sendSysMsg")
|
||||
@ApiOperation(value = "添加系统消息")
|
||||
public R<String> sendSysMsg(@Valid @RequestBody SysAdviceDto sysAdviceDto) {
|
||||
sysAdviceService.sendSysMsg(sysAdviceDto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 已读
|
||||
|
|
|
@ -37,7 +37,8 @@ public class QueueConstants {
|
|||
// 工作流评论点赞队列
|
||||
public static final String WORK_FLOW_COMMENT_LIKE_QUEUE = "workFlowCommentLikeQueue";
|
||||
|
||||
|
||||
// 系统消息队列
|
||||
public static final String SYS_MSG_QUEUE = "sysMsgQueue";
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -67,6 +67,19 @@ public class CommunityUser extends BaseEntity {
|
|||
*/
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 是否拉黑 0否 1是
|
||||
*/
|
||||
private String isBlank;
|
||||
|
||||
/**
|
||||
* 拉黑原因
|
||||
*/
|
||||
private String blackReason;
|
||||
|
||||
/**
|
||||
* 拉黑结束时间
|
||||
*/
|
||||
private Date blankEndTime;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.mcwl.communityCenter.domain.dto;
|
||||
|
||||
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 BlackListRes {
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区id", required = true)
|
||||
@NotNull(message = "社区id不能为空")
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 拉黑用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "拉黑用户id", required = true)
|
||||
@NotNull(message = "拉黑用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 拉黑时长
|
||||
*/
|
||||
@ApiModelProperty(value = "拉黑时长", required = true)
|
||||
@NotNull(message = "拉黑时长不能为空")
|
||||
private Integer blackDay;
|
||||
|
||||
/**
|
||||
* 拉黑原因
|
||||
*/
|
||||
@ApiModelProperty(value = "拉黑原因", required = true)
|
||||
@NotBlank(message = "拉黑原因不能为空")
|
||||
private String blackReason;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
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
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "社区用户列表分页请求参数")
|
||||
public class CommunityUserListPageRes extends PageDomain {
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区id", required = true)
|
||||
@NotNull(message = "社区id不能为空")
|
||||
private Long communityId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 搜索内容
|
||||
*/
|
||||
@ApiModelProperty(value = "搜索内容")
|
||||
private String searchContent;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
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 CommunityUserVo {
|
||||
|
||||
/**
|
||||
* 社区用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区用户id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区id")
|
||||
private Long communityId;
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickName;
|
||||
|
||||
|
||||
/**
|
||||
* 加入类型
|
||||
*/
|
||||
@ApiModelProperty(value = "加入类型")
|
||||
private String joinType;
|
||||
|
||||
/**
|
||||
* 首次加入时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "首次加入时间")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 最后活动时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "最后活动时间")
|
||||
private Date loginDate;
|
||||
|
||||
/**
|
||||
* 到期时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "到期时间")
|
||||
private Date endTime;
|
||||
|
||||
|
||||
}
|
|
@ -33,6 +33,8 @@ public class CustomTenantHandler implements TenantLineHandler {
|
|||
tables.add("cc_question");
|
||||
// 提问评论表
|
||||
tables.add("cc_question_comment");
|
||||
// 社区用户表
|
||||
tables.add("cc_community_user");
|
||||
|
||||
// 输出表名
|
||||
log.info("多租户表:{}", tables);
|
||||
|
|
|
@ -58,4 +58,7 @@ public interface CommunityMapper extends BaseMapper<Community> {
|
|||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void quitCommunity(Long tenantId, Long communityId, Long userId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void deleteCommunity(Long tenantId, Long communityId);
|
||||
}
|
||||
|
|
|
@ -2,12 +2,16 @@ 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.CommunityUser;
|
||||
import com.mcwl.communityCenter.domain.dto.CommunityUserListPageRes;
|
||||
import com.mcwl.communityCenter.domain.vo.CommunityUserVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
|
@ -17,4 +21,20 @@ public interface CommunityUserMapper extends BaseMapper<CommunityUser> {
|
|||
CommunityUser selectByTenantIdAndCommunityIdAndUserId(@Param("tenantId") Long tenantId,
|
||||
@Param("communityId") Long communityId,
|
||||
@Param("userId") Long userId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
Integer getJoinNum(Long tenantId, Long communityId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
int isJoinCommunity(@Param("tenantId")
|
||||
Long tenantId,
|
||||
@Param("communityId")
|
||||
Long communityId,
|
||||
@Param("userId")
|
||||
Long userId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<CommunityUserVo> getCommunityUserList(Page<CommunityUser> page,
|
||||
@Param("communityUserListPageRes")
|
||||
CommunityUserListPageRes communityUserListPageRes);
|
||||
}
|
||||
|
|
|
@ -39,4 +39,9 @@ public interface CommunityService extends IService<Community> {
|
|||
* 退出社区
|
||||
*/
|
||||
R<Object> quitCommunity(Long tenantId, Long communityId);
|
||||
|
||||
/**
|
||||
* 判断是否加入社区
|
||||
*/
|
||||
R<Object> isJoinCommunity(JoinCommunityRes joinCommunityRes);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,22 @@ 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 javax.validation.Valid;
|
||||
|
||||
public interface CommunityUserService extends IService<CommunityUser> {
|
||||
|
||||
/**
|
||||
* 获取社区用户列表
|
||||
*/
|
||||
TableDataInfo getCommunityUserList(CommunityUserListPageRes communityUserListPageRes);
|
||||
|
||||
/**
|
||||
* 拉黑
|
||||
*/
|
||||
R<Object> black(@Valid BlackListRes blackListRes);
|
||||
}
|
||||
|
|
|
@ -167,11 +167,24 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<Object> quitCommunity(Long tenantId, Long communityId) {
|
||||
Integer communityJoinNum = communityUserMapper.getJoinNum(tenantId, communityId);
|
||||
|
||||
baseMapper.quitCommunity(tenantId, communityId, SecurityUtils.getUserId());
|
||||
|
||||
if (communityJoinNum == 1) {
|
||||
baseMapper.deleteCommunity(tenantId, communityId);
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Object> isJoinCommunity(JoinCommunityRes joinCommunityRes) {
|
||||
int isJoinCommunity = communityUserMapper.isJoinCommunity(joinCommunityRes.getTenantId(), joinCommunityRes.getCommunityId(), SecurityUtils.getUserId());
|
||||
return R.ok(isJoinCommunity);
|
||||
}
|
||||
|
||||
private TableDataInfo getCommunityVoTableDataInfo(List<Community> communityList, Long total) {
|
||||
|
||||
|
|
|
@ -13,8 +13,11 @@ 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.vo.CommunityUserVo;
|
||||
import com.mcwl.communityCenter.domain.vo.CommunityVo;
|
||||
import com.mcwl.communityCenter.mapper.CommunityMapper;
|
||||
import com.mcwl.communityCenter.mapper.CommunityUserMapper;
|
||||
|
@ -24,6 +27,7 @@ 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.*;
|
||||
|
@ -33,5 +37,46 @@ import java.util.*;
|
|||
public class CommunityUserServiceImpl extends ServiceImpl<CommunityUserMapper, CommunityUser> implements CommunityUserService {
|
||||
|
||||
|
||||
/**
|
||||
* 社区用户列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo getCommunityUserList(CommunityUserListPageRes communityUserListPageRes) {
|
||||
Page<CommunityUser> page = new Page<>(communityUserListPageRes.getPageNum(), communityUserListPageRes.getPageSize());
|
||||
page.addOrder(new OrderItem("create_time", false));
|
||||
|
||||
List<CommunityUserVo> communityUserList = baseMapper.getCommunityUserList(page, communityUserListPageRes);
|
||||
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setRows(communityUserList);
|
||||
tableDataInfo.setTotal(page.getTotal());
|
||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Object> black(BlackListRes blackListRes) {
|
||||
Long communityId = blackListRes.getCommunityId();
|
||||
Long userId = blackListRes.getUserId();
|
||||
Integer blackDay = blackListRes.getBlackDay();
|
||||
String blackReason = blackListRes.getBlackReason();
|
||||
|
||||
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, "该用户不在该社区中");
|
||||
}
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, blackDay);
|
||||
|
||||
communityUser.setIsBlank("1");
|
||||
communityUser.setBlankEndTime(calendar.getTime());
|
||||
communityUser.setBlackReason(blackReason);
|
||||
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,14 @@
|
|||
and del_flag = '0';
|
||||
</update>
|
||||
|
||||
<update id="deleteCommunity">
|
||||
update cc_community
|
||||
set del_flag = '1'
|
||||
where tenant_id = #{tenantId}
|
||||
and id = #{communityId}
|
||||
and del_flag = '0';
|
||||
</update>
|
||||
|
||||
<select id="getByTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Community">
|
||||
select id,
|
||||
tenant_id,
|
||||
|
|
|
@ -16,4 +16,42 @@
|
|||
and user_id = #{userId}
|
||||
and del_flag = '0';
|
||||
</select>
|
||||
<select id="getJoinNum" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from cc_community_user
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and del_flag = '0';
|
||||
</select>
|
||||
<select id="isJoinCommunity" resultType="java.lang.Integer">
|
||||
select COALESCE(count(*), 0)
|
||||
from cc_community_user
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and user_id = #{userId}
|
||||
and del_flag = '0';
|
||||
</select>
|
||||
<select id="getCommunityUserList" resultType="com.mcwl.communityCenter.domain.vo.CommunityUserVo">
|
||||
select cu.id,
|
||||
cu.tenant_id,
|
||||
cu.community_id,
|
||||
cu.user_id,
|
||||
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}
|
||||
<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() >= cu.blank_end_time)
|
||||
and cu.is_blank = '0'
|
||||
and cu.del_flag = '0'
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,10 +1,15 @@
|
|||
package com.mcwl.framework.security.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.mcwl.framework.web.service;
|
||||
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.domain.model.LoginUser;
|
||||
import com.mcwl.common.enums.UserStatus;
|
||||
|
@ -48,13 +49,13 @@ public class UserDetailsServiceImpl implements UserDetailsService, OtherUserDeta
|
|||
|
||||
if (StringUtils.isNull(user)) {
|
||||
log.info("登录用户:{} 不存在.", username);
|
||||
throw new ServiceException(MessageUtils.message("user.not.exists"));
|
||||
throw new ServiceException(MessageUtils.message("user.not.exists"), HttpStatus.SHOW_ERROR_MSG);
|
||||
} else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||
log.info("登录用户:{} 已被删除.", username);
|
||||
throw new ServiceException(MessageUtils.message("user.password.delete"));
|
||||
throw new ServiceException(MessageUtils.message("user.password.delete"), HttpStatus.SHOW_ERROR_MSG);
|
||||
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
||||
log.info("登录用户:{} 已被停用.", username);
|
||||
throw new ServiceException(MessageUtils.message("user.blocked"));
|
||||
throw new ServiceException(MessageUtils.message("user.blocked"), HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
|
||||
// passwordService.validate(user);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.memberCenter.domain;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import com.mcwl.memberCenter.enums.MemberBenefitTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -27,7 +28,7 @@ public class Benefit extends BaseEntity {
|
|||
/**
|
||||
* 权益类型
|
||||
*/
|
||||
private String benefitType;
|
||||
private MemberBenefitTypeEnum benefitType;
|
||||
/**
|
||||
* 权益折扣,当权益类型为折扣时,记录折扣具体数值
|
||||
*/
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import com.mcwl.memberCenter.enums.MemberBenefitTypeEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -13,15 +15,19 @@ import lombok.EqualsAndHashCode;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("mem_member_benefit")
|
||||
@ApiModel(description = "会员权益关联")
|
||||
public class MemberBenefit extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty(value = "id", required = true)
|
||||
private Long id;
|
||||
|
||||
// 会员等级id
|
||||
@ApiModelProperty(value = "会员等级id")
|
||||
private Long memberLevelId;
|
||||
|
||||
// 权益id
|
||||
@ApiModelProperty(value = "权益id")
|
||||
private Long benefitId;
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package com.mcwl.memberCenter.domain.dto;
|
||||
|
||||
import com.mcwl.memberCenter.enums.MemberPeriodicEnum;
|
||||
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(description = "添加会员等级请求对象")
|
||||
public class AddMemberLevelDto {
|
||||
|
||||
// 会员名称
|
||||
@NotBlank(message = "会员名称不能为空")
|
||||
@ApiModelProperty(value = "会员名称", required = true)
|
||||
private String memberName;
|
||||
|
||||
// 会员价格
|
||||
@NotNull(message = "会员价格不能为空")
|
||||
@ApiModelProperty(value = "会员价格", required = true)
|
||||
private Double unitPrice;
|
||||
|
||||
// 会员原价
|
||||
@NotNull(message = "会员原价不能为空")
|
||||
@ApiModelProperty(value = "会员原价", required = true)
|
||||
private Double originalPrice;
|
||||
|
||||
// 订阅周期(年,季度,月,包月)
|
||||
@NotNull(message = "订阅周期不能为空")
|
||||
@ApiModelProperty(value = "订阅周期(年 year,季度 quarter,月 month,包月 continueMonth)", required = true)
|
||||
private MemberPeriodicEnum subscriptionPeriod;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.mcwl.memberCenter.domain.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import com.mcwl.memberCenter.enums.MemberBenefitTypeEnum;
|
||||
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(description = "权益")
|
||||
public class BenefitDto {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 权益名称
|
||||
*/
|
||||
@ApiModelProperty(value = "权益名称", required = true)
|
||||
@NotBlank(message = "权益名称不能为空")
|
||||
private String benefitName;
|
||||
/**
|
||||
* 权益描述
|
||||
*/
|
||||
@ApiModelProperty(value = "权益描述")
|
||||
private String benefitDesc;
|
||||
/**
|
||||
* 权益类型
|
||||
*/
|
||||
@ApiModelProperty(value = "权益类型", required = true)
|
||||
@NotNull(message = "权益类型不能为空")
|
||||
private MemberBenefitTypeEnum benefitType;
|
||||
/**
|
||||
* 权益折扣,当权益类型为折扣时,记录折扣具体数值
|
||||
*/
|
||||
@ApiModelProperty(value = "权益折扣,当权益类型为折扣时,记录折扣具体数值", required = true)
|
||||
@NotNull(message = "权益折扣不能为空")
|
||||
private Double benefitDiscount;
|
||||
/**
|
||||
* 权益排序
|
||||
*/
|
||||
@ApiModelProperty(value = "权益排序")
|
||||
private Integer benefitOrder;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.mcwl.memberCenter.domain.dto;
|
||||
|
||||
import com.mcwl.memberCenter.enums.MemberPeriodicEnum;
|
||||
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(description = "修改会员等级请求对象")
|
||||
public class EditMemberLevelDto {
|
||||
|
||||
@NotNull(message = "会员等级id不能为空")
|
||||
@ApiModelProperty(value = "会员等级id", required = true)
|
||||
private Long id;
|
||||
|
||||
// 会员名称
|
||||
@NotBlank(message = "会员名称不能为空")
|
||||
@ApiModelProperty(value = "会员名称", required = true)
|
||||
private String memberName;
|
||||
|
||||
// 会员价格
|
||||
@NotNull(message = "会员价格不能为空")
|
||||
@ApiModelProperty(value = "会员价格", required = true)
|
||||
private Double unitPrice;
|
||||
|
||||
// 会员原价
|
||||
@NotNull(message = "会员原价不能为空")
|
||||
@ApiModelProperty(value = "会员原价", required = true)
|
||||
private Double originalPrice;
|
||||
|
||||
// 订阅周期(年,季度,月,包月)
|
||||
@NotNull(message = "订阅周期不能为空")
|
||||
@ApiModelProperty(value = "订阅周期(年 year,季度 quarter,月 month,包月 continueMonth)", required = true)
|
||||
private MemberPeriodicEnum subscriptionPeriod;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.mcwl.memberCenter.domain.dto;
|
||||
|
||||
import com.mcwl.common.domain.IdsParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员权益关联表
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "会员权益关联")
|
||||
public class MemberBenefitDto {
|
||||
|
||||
// 会员等级id
|
||||
@NotNull(message = "会员等级id不能为空")
|
||||
@ApiModelProperty(value = "会员等级id", required = true)
|
||||
private Long memberLevelId;
|
||||
|
||||
// 权益id
|
||||
@NotNull(message = "权益id数组不能为空")
|
||||
@ApiModelProperty(value = "权益id数组", required = true)
|
||||
private List<Long> benefitIds;
|
||||
|
||||
|
||||
}
|
|
@ -2,8 +2,10 @@ package com.mcwl.memberCenter.domain.dto;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import com.mcwl.memberCenter.enums.PromotionEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
@ -19,7 +21,7 @@ import java.util.Date;
|
|||
@Data
|
||||
public class PromotionDto {
|
||||
|
||||
@TableId
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
@ -32,14 +34,16 @@ public class PromotionDto {
|
|||
* 活动开始时间 校验时间格式
|
||||
*/
|
||||
@NotNull(message = "活动开始时间不能为空")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@NotNull(message = "活动结束时间不能为空")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
|
@ -58,11 +62,13 @@ public class PromotionDto {
|
|||
/**
|
||||
* 活动的详细描述
|
||||
*/
|
||||
@ApiModelProperty(value = "活动的详细描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 适用会员等级 可选字段,用于指定哪些会员等级可以享受此活动(可以用逗号分隔的会员等级ID)
|
||||
*/
|
||||
@ApiModelProperty(value = "适用会员等级 可选字段,用于指定哪些会员等级可以享受此活动(可以用逗号分隔的会员等级ID)")
|
||||
private String memberLevelIds;
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.mcwl.memberCenter.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import com.mcwl.memberCenter.enums.MemberBenefitTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 权益vo
|
||||
*/
|
||||
@Data
|
||||
public class BenefitVo {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 权益名称
|
||||
*/
|
||||
private String benefitName;
|
||||
/**
|
||||
* 权益描述
|
||||
*/
|
||||
private String benefitDesc;
|
||||
/**
|
||||
* 权益类型
|
||||
*/
|
||||
private String benefitType;
|
||||
/**
|
||||
* 权益折扣,当权益类型为折扣时,记录折扣具体数值
|
||||
*/
|
||||
private Double benefitDiscount;
|
||||
/**
|
||||
* 权益排序
|
||||
*/
|
||||
private Integer benefitOrder;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.mcwl.memberCenter.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import com.mcwl.memberCenter.enums.MemberPeriodicEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 会员等级vo
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "会员等级vo")
|
||||
public class MemberLevelVo {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
// 会员名称
|
||||
@ApiModelProperty(value = "会员名称")
|
||||
private String memberName;
|
||||
|
||||
// 会员价格
|
||||
@ApiModelProperty(value = "会员价格")
|
||||
private Double unitPrice;
|
||||
|
||||
// 会员原价
|
||||
@ApiModelProperty(value = "会员原价")
|
||||
private Double originalPrice;
|
||||
|
||||
// 订阅周期(年,季度,月,包月)
|
||||
@ApiModelProperty(value = "订阅周期(年,季度,月,包月)")
|
||||
private String subscriptionPeriod;
|
||||
}
|
|
@ -3,10 +3,12 @@ package com.mcwl.memberCenter.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.memberCenter.domain.MemberBenefit;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 会员权益关联 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberBenefitMapper extends BaseMapper<MemberBenefit> {
|
||||
void deleteByMemberLevelId(@Param("memberLevelId") Long memberLevelId);
|
||||
}
|
||||
|
|
|
@ -2,12 +2,21 @@ package com.mcwl.memberCenter.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.memberCenter.domain.MemberBenefit;
|
||||
import com.mcwl.memberCenter.domain.dto.MemberBenefitDto;
|
||||
import com.mcwl.memberCenter.domain.vo.MemberBenefitVO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
public interface MemberBenefitService extends IService<MemberBenefit> {
|
||||
|
||||
|
||||
List<MemberBenefitVO> getMemberBenefitList();
|
||||
|
||||
MemberBenefitVO getMemberBenefit(Long memberLevelId);
|
||||
|
||||
void addMemberBenefit(MemberBenefitDto memberBenefitDto);
|
||||
|
||||
void deleteByMemberLevelId(Long memberLevelId);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.mcwl.common.core.page.PageDomain;
|
|||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.memberCenter.domain.MemberPromotion;
|
||||
import com.mcwl.memberCenter.domain.Promotion;
|
||||
import com.mcwl.memberCenter.domain.dto.PromotionDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -21,4 +22,6 @@ public interface PromotionService extends IService<Promotion> {
|
|||
TableDataInfo getMyPromotionList(PageDomain pageDomain);
|
||||
|
||||
R<Object> joinPromotion(Long promotionId);
|
||||
|
||||
// R<Object> updatePromotion(PromotionDto promotionDto);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.mcwl.memberCenter.domain.Benefit;
|
||||
import com.mcwl.memberCenter.domain.MemberBenefit;
|
||||
import com.mcwl.memberCenter.domain.MemberLevel;
|
||||
import com.mcwl.memberCenter.domain.dto.MemberBenefitDto;
|
||||
import com.mcwl.memberCenter.domain.vo.MemberBenefitVO;
|
||||
import com.mcwl.memberCenter.enums.MemberBenefitTypeEnum;
|
||||
import com.mcwl.memberCenter.mapper.MemberBenefitMapper;
|
||||
|
@ -16,6 +17,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
@ -27,7 +29,7 @@ public class MemberBenefitServiceImpl extends ServiceImpl<MemberBenefitMapper, M
|
|||
|
||||
@Override
|
||||
public List<MemberBenefitVO> getMemberBenefitList() {
|
||||
List<MemberBenefitVO> memberBenefitVOList = initList();
|
||||
List<MemberBenefitVO> memberBenefitVOList = new ArrayList<>();
|
||||
|
||||
List<MemberLevel> memberLevelList = memberLevelService.list();
|
||||
for (MemberLevel memberLevel : memberLevelList) {
|
||||
|
@ -51,12 +53,46 @@ public class MemberBenefitServiceImpl extends ServiceImpl<MemberBenefitMapper, M
|
|||
return memberBenefitVOList;
|
||||
}
|
||||
|
||||
private List<MemberBenefitVO> initList() {
|
||||
List<MemberBenefitVO> memberBenefitVOList = new ArrayList<>();
|
||||
@Override
|
||||
public MemberBenefitVO getMemberBenefit(Long memberLevelId) {
|
||||
|
||||
// 查询会员权益关联表
|
||||
List<MemberBenefit> memberBenefitList = baseMapper.selectList(new LambdaQueryWrapper<MemberBenefit>()
|
||||
.eq(MemberBenefit::getMemberLevelId, memberLevelId));
|
||||
|
||||
// 封装数据
|
||||
MemberBenefitVO memberBenefitVO = new MemberBenefitVO();
|
||||
memberBenefitVO.setMemberLevelName("会员权益");
|
||||
memberBenefitVO.setMemberBenefitList(benefitService.getBenefitList());
|
||||
memberBenefitVOList.add(memberBenefitVO);
|
||||
return memberBenefitVOList;
|
||||
memberBenefitVO.setMemberLevelName(memberLevelService.getById(memberLevelId).getMemberName());
|
||||
|
||||
// 查询权益
|
||||
List<Benefit> benefitList = benefitService.listByIds(memberBenefitList
|
||||
.stream()
|
||||
.map(MemberBenefit::getBenefitId)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
memberBenefitVO.setMemberBenefitList(benefitList);
|
||||
|
||||
return memberBenefitVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMemberBenefit(MemberBenefitDto memberBenefitDto) {
|
||||
Long memberLevelId = memberBenefitDto.getMemberLevelId();
|
||||
List<Long> benefitIds = memberBenefitDto.getBenefitIds();
|
||||
baseMapper.deleteByMemberLevelId(memberLevelId);
|
||||
|
||||
for (Long benefitId : benefitIds) {
|
||||
MemberBenefit memberBenefit = new MemberBenefit();
|
||||
memberBenefit.setMemberLevelId(memberLevelId);
|
||||
memberBenefit.setBenefitId(benefitId);
|
||||
baseMapper.insert(memberBenefit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByMemberLevelId(Long memberLevelId) {
|
||||
baseMapper.deleteByMemberLevelId(memberLevelId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.mcwl.common.utils.SecurityUtils;
|
|||
import com.mcwl.memberCenter.domain.Member;
|
||||
import com.mcwl.memberCenter.domain.MemberPromotion;
|
||||
import com.mcwl.memberCenter.domain.Promotion;
|
||||
import com.mcwl.memberCenter.domain.dto.PromotionDto;
|
||||
import com.mcwl.memberCenter.domain.vo.PromotionVo;
|
||||
import com.mcwl.memberCenter.enums.PromotionEnum;
|
||||
import com.mcwl.memberCenter.mapper.MemberPromotionMapper;
|
||||
|
@ -188,6 +189,23 @@ public class PromotionServiceImpl extends ServiceImpl<PromotionMapper, Promotion
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新促销活动
|
||||
*/
|
||||
// @Override
|
||||
// public R<Object> updatePromotion(PromotionDto promotionDto) {
|
||||
//
|
||||
// Date startTime = promotionDto.getStartTime();
|
||||
// Date endTime = promotionDto.getEndTime();
|
||||
// if (startTime.after(endTime)) {
|
||||
// return R.fail(HttpStatus.SHOW_ERROR_MSG,"活动开始时间不能大于结束时间");
|
||||
// }
|
||||
// Promotion promotion = new Promotion();
|
||||
//
|
||||
// BeanUtil.copyProperties(promotionDto, promotion);
|
||||
// baseMapper.updateById(promotion);
|
||||
// return R.ok();
|
||||
// }
|
||||
|
||||
private boolean isJoinPromotion(Long userId, Long promotionId) {
|
||||
MemberPromotion memberPromotion = memberPromotionService.lambdaQuery()
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?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.memberCenter.mapper.MemberBenefitMapper">
|
||||
|
||||
<delete id="deleteByMemberLevelId">
|
||||
delete
|
||||
from mem_member_benefit
|
||||
where member_level_id = #{memberLevelId}
|
||||
</delete>
|
||||
</mapper>
|
|
@ -12,12 +12,12 @@
|
|||
</select>
|
||||
|
||||
<select id="getEarningsDisplay" resultType="com.mcwl.myInvitation.domain.dto.EarningsDisplay">
|
||||
select inv.user_invite_id as userId, count(con.id) as count
|
||||
from inv_invitation inv
|
||||
select inv.user_id as userId, count(con.id) as count
|
||||
from sys_user inv
|
||||
left join inv_consume con
|
||||
on inv.user_invite_id = con.user_id
|
||||
where inv.user_id = #{userId}
|
||||
group by inv.user_invite_id
|
||||
on inv.user_id = con.user_id
|
||||
where inv.inviter_user_id = #{userId}
|
||||
group by inv.user_id
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.resource.consumer;
|
||||
|
||||
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
|
@ -22,6 +23,8 @@ import org.springframework.transaction.support.TransactionSynchronization;
|
|||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -97,7 +100,7 @@ public class LikeConsumer {
|
|||
});
|
||||
} catch (Exception e) {
|
||||
log.error("模型点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("模型点赞消息出错");
|
||||
throw new ServiceException("模型点赞消息出错", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +140,7 @@ public class LikeConsumer {
|
|||
});
|
||||
} catch (Exception e) {
|
||||
log.error("模型评论点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("模型评论点赞消息出错");
|
||||
throw new ServiceException("模型评论点赞消息出错", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,7 +180,7 @@ public class LikeConsumer {
|
|||
});
|
||||
} catch (Exception e) {
|
||||
log.error("图片点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("图片点赞消息出错");
|
||||
throw new ServiceException("图片点赞消息出错", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +220,7 @@ public class LikeConsumer {
|
|||
});
|
||||
} catch (Exception e) {
|
||||
log.error("图片评论点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("图片评论点赞消息出错");
|
||||
throw new ServiceException("图片评论点赞消息出错", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,7 +261,7 @@ public class LikeConsumer {
|
|||
});
|
||||
} catch (Exception e) {
|
||||
log.error("工作流点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("工作流点赞消息出错");
|
||||
throw new ServiceException("工作流点赞消息出错", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,7 +301,7 @@ public class LikeConsumer {
|
|||
});
|
||||
} catch (Exception e) {
|
||||
log.error("工作流评论点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("工作流评论点赞消息出错");
|
||||
throw new ServiceException("工作流评论点赞消息出错", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +309,7 @@ public class LikeConsumer {
|
|||
private void modelLike(Long userId, Long modelId) {
|
||||
ModelProduct model = modelMapper.selectById(modelId);
|
||||
if (Objects.isNull(model)) {
|
||||
throw new ServiceException("该模型不存在或已下架");
|
||||
throw new ServiceException("该模型不存在或已下架", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
ModelLike modelLike = modelLikeMapper.getLike(userId, modelId);
|
||||
if (Objects.nonNull(modelLike)) {
|
||||
|
@ -371,7 +374,7 @@ public class LikeConsumer {
|
|||
private void modelCommentLike(Long userId, Long commentId) {
|
||||
ModelComment modelComment = modelCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(modelComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
throw new ServiceException("该评论不存在", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
ModelCommentLike modelCommentLike = modelCommentLikeMapper.getLikeComment(userId, commentId);
|
||||
if (Objects.nonNull(modelCommentLike)) {
|
||||
|
@ -437,7 +440,7 @@ public class LikeConsumer {
|
|||
private void imageLike(Long userId, Long imageId) {
|
||||
ModelImage modelImage = modelImageMapper.selectById(imageId);
|
||||
if (Objects.isNull(modelImage)) {
|
||||
throw new ServiceException("该图片不存在或已下架");
|
||||
throw new ServiceException("该图片不存在或已下架", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
ModelImageLike modelImageLike = modelImageLikeMapper.getLikeImage(userId, imageId);
|
||||
if (Objects.nonNull(modelImageLike)) {
|
||||
|
@ -502,7 +505,7 @@ public class LikeConsumer {
|
|||
private void imageCommentLike(Long userId, Long commentId) {
|
||||
ModelImageComment modelImageComment = modelImageCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(modelImageComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
throw new ServiceException("该评论不存在", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
ModelImageCommentLike modelImageCommentLike = modelImageCommentLikeMapper.getLikeImageComment(userId, commentId);
|
||||
if (Objects.nonNull(modelImageCommentLike)) {
|
||||
|
@ -568,7 +571,7 @@ public class LikeConsumer {
|
|||
private void workFLowLike(Long userId, Long modelId) {
|
||||
WorkFlow workFlow = workFlowMapper.selectById(modelId);
|
||||
if (Objects.isNull(workFlow)) {
|
||||
throw new ServiceException("该工作流不存在或已下架");
|
||||
throw new ServiceException("该工作流不存在或已下架", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
WorkFlowLike workFlowLike = workFlowLikeMapper.getLike(userId, modelId);
|
||||
if (Objects.nonNull(workFlowLike)) {
|
||||
|
@ -633,7 +636,7 @@ public class LikeConsumer {
|
|||
private void workFlowCommentLike(Long userId, Long commentId) {
|
||||
WorkFlowComment workFlowComment = workFlowCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(workFlowComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
throw new ServiceException("该评论不存在", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
WorkFlowCommentLike workFlowCommentLike = workFlowCommentLikeMapper.getLikeComment(userId, commentId);
|
||||
if (Objects.nonNull(workFlowCommentLike)) {
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package com.mcwl.resource.consumer;
|
||||
|
||||
|
||||
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.resource.domain.*;
|
||||
import com.mcwl.resource.domain.dto.SysAdviceDto;
|
||||
import com.mcwl.resource.service.ISysAdviceService;
|
||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class MsgConsumer {
|
||||
|
||||
private final ISysAdviceService sysAdviceService;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 发送系统通知消息
|
||||
*/
|
||||
@RabbitListener(queues = QueueConstants.SYS_MSG_QUEUE, ackMode = "MANUAL")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void sendSysMsg(SysAdviceDto sysAdviceDto, Channel channel, Message message) {
|
||||
try {
|
||||
SysUser adminUser = sysUserService.selectUserByUserName("admin");
|
||||
Long sendId = adminUser.getUserId();
|
||||
List<SysUser> sysUserList = sysUserService.list();
|
||||
List<SysAdvice> sysAdviceList = new ArrayList<>();
|
||||
for (SysUser sysUser : sysUserList) {
|
||||
Long receiverId = sysUser.getUserId();
|
||||
SysAdvice sysAdvice = new SysAdvice();
|
||||
sysAdvice.setSenderId(sendId);
|
||||
sysAdvice.setReceiverId(receiverId);
|
||||
sysAdvice.setTitle(sysAdviceDto.getTitle());
|
||||
sysAdvice.setContent(sysAdviceDto.getContent());
|
||||
sysAdvice.setIsRead(0);
|
||||
sysAdvice.setType(AdviceEnum.SYSTEM_NOTICE);
|
||||
sysAdviceList.add(sysAdvice);
|
||||
}
|
||||
sysAdviceService.saveBatch(sysAdviceList);
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
log.error("系统通知消息时出错: {}", e.getMessage(), e);
|
||||
try {
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
} catch (IOException ex) {
|
||||
log.error("消息确认失败: {}", ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.mcwl.resource.domain.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 消息通知
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "发送系统消息")
|
||||
public class SysAdviceDto {
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@NotBlank(message = "标题不能为空")
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@NotBlank(message = "内容不能为空")
|
||||
@ApiModelProperty(value = "内容")
|
||||
private String content;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.handler.impl;
|
|||
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -59,7 +60,7 @@ public class ImageCommentLikeHandler implements IMessageHandler {
|
|||
private void like(Long userId, Long commentId) {
|
||||
ModelImageComment modelImageComment = modelImageCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(modelImageComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
throw new ServiceException("该评论不存在", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
ModelImageCommentLike modelImageCommentLike = modelImageCommentLikeMapper.getLikeImageComment(userId, commentId);
|
||||
if (Objects.nonNull(modelImageCommentLike)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.handler.impl;
|
|||
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -56,7 +57,7 @@ public class ImageLikeHandler implements IMessageHandler {
|
|||
private void like(Long userId, Long imageId) {
|
||||
ModelImage modelImage = modelImageMapper.selectById(imageId);
|
||||
if (Objects.isNull(modelImage)) {
|
||||
throw new ServiceException("该图片不存在或已下架");
|
||||
throw new ServiceException("该图片不存在或已下架", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
ModelImageLike modelImageLike = modelImageLikeMapper.getLikeImage(userId, imageId);
|
||||
if (Objects.nonNull(modelImageLike)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.handler.impl;
|
|||
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -55,7 +56,7 @@ public class ModelCommentLikeHandler implements IMessageHandler {
|
|||
private void like(Long userId, Long commentId) {
|
||||
ModelComment modelComment = modelCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(modelComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
throw new ServiceException("该评论不存在", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
ModelCommentLike modelCommentLike = modelCommentLikeMapper.getLikeComment(userId, commentId);
|
||||
if (Objects.nonNull(modelCommentLike)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.handler.impl;
|
|||
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -56,7 +57,7 @@ public class ModelLikeHandler implements IMessageHandler {
|
|||
private void like(Long userId, Long modelId) {
|
||||
ModelProduct model = modelMapper.selectById(modelId);
|
||||
if (Objects.isNull(model)) {
|
||||
throw new ServiceException("该模型不存在或已下架");
|
||||
throw new ServiceException("该模型不存在或已下架", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
ModelLike modelLike = modelLikeMapper.getLike(userId, modelId);
|
||||
if (Objects.nonNull(modelLike)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.handler.impl;
|
|||
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -58,7 +59,7 @@ public class WorkFlowCommentLikeHandler implements IMessageHandler {
|
|||
private void like(Long userId, Long commentId) {
|
||||
WorkFlowComment workFlowComment = workFlowCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(workFlowComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
throw new ServiceException("该评论不存在", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
WorkFlowCommentLike workFlowCommentLike = workFlowCommentLikeMapper.getLikeComment(userId, commentId);
|
||||
if (Objects.nonNull(workFlowCommentLike)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.handler.impl;
|
|||
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -54,7 +55,7 @@ public class WorkFlowLikeHandler implements IMessageHandler {
|
|||
private void like(Long userId, Long modelId) {
|
||||
WorkFlow workFlow = workFlowMapper.selectById(modelId);
|
||||
if (Objects.isNull(workFlow)) {
|
||||
throw new ServiceException("该工作流不存在或已下架");
|
||||
throw new ServiceException("该工作流不存在或已下架", HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
WorkFlowLike workFlowLike = workFlowLikeMapper.getLike(userId, modelId);
|
||||
if (Objects.nonNull(workFlowLike)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.resource.domain.SysAdvice;
|
||||
import com.mcwl.resource.domain.dto.SysAdviceDto;
|
||||
import com.mcwl.resource.domain.vo.AdviceVo;
|
||||
import com.mcwl.resource.domain.vo.AttentionAdviceVo;
|
||||
import com.mcwl.resource.domain.vo.CommentAdviceVo;
|
||||
|
@ -34,4 +35,6 @@ public interface ISysAdviceService extends IService<SysAdvice> {
|
|||
void readAll();
|
||||
|
||||
List<AdviceVo> getOfficialMsg();
|
||||
|
||||
void sendSysMsg(SysAdviceDto sysAdviceDto);
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.SysAdvice;
|
||||
import com.mcwl.resource.domain.WorkFlow;
|
||||
import com.mcwl.resource.domain.dto.SysAdviceDto;
|
||||
import com.mcwl.resource.domain.vo.AdviceVo;
|
||||
import com.mcwl.resource.domain.vo.AttentionAdviceVo;
|
||||
import com.mcwl.resource.domain.vo.CommentAdviceVo;
|
||||
|
@ -23,6 +25,7 @@ import com.mcwl.resource.service.WorkFlowService;
|
|||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -44,6 +47,8 @@ public class SysAdviceServiceImpl extends ServiceImpl<SysAdviceMapper, SysAdvice
|
|||
|
||||
private final ModelImageService modelImageService;
|
||||
|
||||
private final RabbitTemplate rabbitTemplate;
|
||||
|
||||
private final Map<Long, ModelProduct> modelProductMap = new ConcurrentHashMap<>();
|
||||
private final Map<Long, WorkFlow> workFlowMap = new ConcurrentHashMap<>();
|
||||
private final Map<Long, ModelImage> modelImageMap = new ConcurrentHashMap<>();
|
||||
|
@ -265,6 +270,13 @@ public class SysAdviceServiceImpl extends ServiceImpl<SysAdviceMapper, SysAdvice
|
|||
return BeanUtil.copyToList(sysAdviceList, AdviceVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSysMsg(SysAdviceDto sysAdviceDto) {
|
||||
|
||||
rabbitTemplate.convertAndSend(QueueConstants.SYS_MSG_QUEUE, sysAdviceDto);
|
||||
|
||||
}
|
||||
|
||||
public void postConstruct() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
|
|
|
@ -147,4 +147,6 @@ public interface SysUserMapper
|
|||
Integer getUserCount();
|
||||
|
||||
Integer getMonthUserCount();
|
||||
|
||||
List<SysUser> selectAllList();
|
||||
}
|
||||
|
|
|
@ -226,4 +226,6 @@ public interface ISysUserService
|
|||
Integer getMonthUserCount();
|
||||
|
||||
UserDataVo getUserData();
|
||||
|
||||
List<SysUser> list();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.core.token.TokenService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -357,7 +358,8 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@Override
|
||||
public int updateUserStatus(SysUser user)
|
||||
{
|
||||
return userMapper.updateUser(user);
|
||||
int i = userMapper.updateUser(user);
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -735,4 +737,10 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
.monthUserCount(this.getUserCount())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysUser> list() {
|
||||
return userMapper.selectAllList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,6 +191,11 @@
|
|||
where create_time >= DATE_FORMAT(NOW(), '%Y-%m-01')
|
||||
AND create_time < DATE_FORMAT(NOW(), '%Y-%m-01') + INTERVAL 1 MONTH
|
||||
</select>
|
||||
<select id="selectAllList" resultType="com.mcwl.common.core.domain.entity.SysUser">
|
||||
select user_id, avatar, brief, nick_name, name, background_img, inviter_user_id
|
||||
from sys_user
|
||||
where del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
|
|
Loading…
Reference in New Issue