Compare commits
12 Commits
23d1028e13
...
44af6d3b60
Author | SHA1 | Date |
---|---|---|
|
44af6d3b60 | |
|
2ab7a54774 | |
|
1479666516 | |
|
6b42b596de | |
|
700ded15ec | |
|
d5ff1265d7 | |
|
56402b081b | |
|
17edba85e5 | |
|
5f5b9ec9ab | |
|
c755d11609 | |
|
f02c000855 | |
|
60949dfa90 |
|
@ -1,14 +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.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.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 社区
|
||||
|
@ -40,23 +45,15 @@ public class CommunityController {
|
|||
return communityService.listByPage(communityListPageRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我创建的社区
|
||||
*/
|
||||
@ApiOperation(value = "我创建的社区")
|
||||
@PostMapping("myCreate")
|
||||
public R<Object> getMyCreateCommunity(@RequestBody @Valid PageDomain pageDomain) {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 我加入的社区
|
||||
*/
|
||||
@ApiOperation(value = "我加入的社区")
|
||||
@GetMapping("myJoin")
|
||||
public R<Object> getMyJoinCommunity() {
|
||||
return R.ok();
|
||||
@PostMapping("myJoin")
|
||||
public TableDataInfo getMyJoinCommunity(@RequestBody JoinCommunityListPageRes joinCommunityListPageRes) {
|
||||
|
||||
return communityService.getMyJoinCommunity(joinCommunityListPageRes);
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,11 +75,28 @@ public class CommunityController {
|
|||
*/
|
||||
@ApiOperation(value = "加入社区")
|
||||
@PostMapping("join")
|
||||
public R<Object> joinCommunity(@Valid JoinCommunityRes joinCommunityRes) {
|
||||
public R<Object> joinCommunity(@RequestBody @Valid JoinCommunityRes joinCommunityRes) {
|
||||
|
||||
return communityService.joinCommunity(joinCommunityRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出社区
|
||||
*/
|
||||
@ApiOperation(value = "退出社区")
|
||||
@PostMapping("quit")
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除社区
|
||||
*
|
||||
|
@ -95,8 +109,22 @@ public class CommunityController {
|
|||
@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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否加入社区
|
||||
*/
|
||||
@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";
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class Community extends BaseEntity {
|
|||
private Integer communityTag;
|
||||
|
||||
/**
|
||||
* 社区类型
|
||||
* 社区类型 0免费 1付费
|
||||
*/
|
||||
@ApiModelProperty(value = "社区类型")
|
||||
private Integer type;
|
||||
|
@ -67,10 +67,10 @@ public class Community extends BaseEntity {
|
|||
private Double price;
|
||||
|
||||
/**
|
||||
* 有效期类型
|
||||
* 有效期天数
|
||||
*/
|
||||
@ApiModelProperty(value = "有效期类型")
|
||||
private Integer validityType;
|
||||
@ApiModelProperty(value = "有效期天数")
|
||||
private Integer validityDay;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,13 +7,12 @@ 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 lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 社区
|
||||
* 社区用户
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
@ -21,31 +20,66 @@ import lombok.NoArgsConstructor;
|
|||
@ApiModel(value = "社区用户")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CommunityUser extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty(value = "社区用户id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "租户id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区id")
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户类型 0普通用户 1群主
|
||||
*/
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 邀请类型id
|
||||
*/
|
||||
private Long inviteId;
|
||||
|
||||
/**
|
||||
* 加入社区时的价格
|
||||
*/
|
||||
private Double communityPrice;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 是否拉黑 0否 1是
|
||||
*/
|
||||
private String isBlank;
|
||||
|
||||
/**
|
||||
* 拉黑原因
|
||||
*/
|
||||
private String blackReason;
|
||||
|
||||
/**
|
||||
* 拉黑结束时间
|
||||
*/
|
||||
private Date blankEndTime;
|
||||
|
||||
}
|
||||
|
|
|
@ -19,19 +19,6 @@ public class Invite extends BaseEntity {
|
|||
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id - 租户id
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long tenantId;
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private Long communityId;
|
||||
/**
|
||||
* 被邀请人
|
||||
*/
|
||||
private Long inviteeUserId;
|
||||
/**
|
||||
* 受邀类型 0普通 1管理员
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -26,5 +26,11 @@ public class CommunityListPageRes extends PageDomain {
|
|||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 搜索内容
|
||||
*/
|
||||
@ApiModelProperty(value = "搜索内容")
|
||||
private String searchContent;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,13 @@ import javax.validation.constraints.NotNull;
|
|||
@ApiModel(value = "社区请求参数")
|
||||
public class CommunityRes {
|
||||
|
||||
|
||||
/**
|
||||
* 社区图片
|
||||
*/
|
||||
@ApiModelProperty(value = "社区图片")
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 社区名称
|
||||
*/
|
||||
|
@ -22,10 +29,17 @@ public class CommunityRes {
|
|||
@NotBlank(message = "社区名称不能为空")
|
||||
private String communityName;
|
||||
|
||||
/**
|
||||
* 社区标签id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区标签", required = true)
|
||||
@NotNull(message = "社区标签不能为空")
|
||||
private Integer communityTag;
|
||||
|
||||
/**
|
||||
* 社区类型
|
||||
*/
|
||||
@ApiModelProperty(value = "社区类型", required = true)
|
||||
@ApiModelProperty(value = "社区类型 0免费 1付费", required = true)
|
||||
@NotNull(message = "社区类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
|
@ -37,11 +51,11 @@ public class CommunityRes {
|
|||
private Double price;
|
||||
|
||||
/**
|
||||
* 有效期类型
|
||||
* 有效期天数
|
||||
*/
|
||||
@ApiModelProperty(value = "有效期类型", required = true)
|
||||
@NotNull(message = "有效期类型不能为空")
|
||||
private Integer validityType;
|
||||
@ApiModelProperty(value = "有效期天数", required = true)
|
||||
@NotNull(message = "有效期天数")
|
||||
private Integer validityDay;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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,24 @@
|
|||
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 JoinCommunityListPageRes extends PageDomain {
|
||||
|
||||
/**
|
||||
* 搜索内容
|
||||
*/
|
||||
@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;
|
||||
|
||||
|
||||
}
|
|
@ -52,10 +52,16 @@ public class CommunityVo {
|
|||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
* 用户头像
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 创建天数
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -16,14 +16,15 @@ import java.util.Map;
|
|||
public interface CommunityMapper extends BaseMapper<Community> {
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
Community getByTenantIdAndCommunityId(@NotNull(message = "租户id不能为空")
|
||||
@Param("tenantId")
|
||||
Long tenantId,
|
||||
@NotNull(message = "社区id不能为空")
|
||||
@Param("communityId")
|
||||
Long communityId);
|
||||
@Param("tenantId")
|
||||
Long tenantId,
|
||||
@NotNull(message = "社区id不能为空")
|
||||
@Param("communityId")
|
||||
Long communityId);
|
||||
|
||||
/**
|
||||
* 查询所有社区加入人数, 以map形式返回,key为社区id,value为加入人数
|
||||
*
|
||||
* @return map
|
||||
*/
|
||||
@MapKey("id")
|
||||
|
@ -32,6 +33,7 @@ public interface CommunityMapper extends BaseMapper<Community> {
|
|||
|
||||
/**
|
||||
* 查询所有社区发布数量,以map形式返回,key为社区id,value为发布数量
|
||||
*
|
||||
* @return map
|
||||
*/
|
||||
@MapKey("id")
|
||||
|
@ -39,5 +41,24 @@ public interface CommunityMapper extends BaseMapper<Community> {
|
|||
Map<Long, Map<String, Object>> selectCommunityPublishNum();
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<Community> selectPageByCommunityTag(@Param("page") Page<Community> page, @Param("communityTag") Long communityTag);
|
||||
List<Community> selectPageByCommunityTag(@Param("page")
|
||||
Page<Community> page,
|
||||
@Param("communityTag")
|
||||
Long communityTag,
|
||||
@Param("searchContent")
|
||||
String searchContent);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<Community> getMyJoinCommunity(@Param("page")
|
||||
Page<Community> page,
|
||||
@Param("userId")
|
||||
Long userId,
|
||||
@Param("searchContent")
|
||||
String searchContent);
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -2,10 +2,12 @@ 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.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;
|
||||
|
@ -25,4 +27,21 @@ public interface CommunityService extends IService<Community> {
|
|||
* @param joinCommunityRes 加入社区信息
|
||||
*/
|
||||
R<Object> joinCommunity(JoinCommunityRes joinCommunityRes);
|
||||
|
||||
/**
|
||||
* 我加入的社区
|
||||
*/
|
||||
TableDataInfo getMyJoinCommunity(JoinCommunityListPageRes joinCommunityListPageRes);
|
||||
|
||||
Community getByTenantIdAndCommunityId(Long userId, Long communityId);
|
||||
|
||||
/**
|
||||
* 退出社区
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -8,13 +8,17 @@ 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;
|
||||
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.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.CommunityMapper;
|
||||
|
@ -30,6 +34,7 @@ import java.time.LocalDate;
|
|||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
@ -39,79 +44,50 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
private final RedisCache redisCache;
|
||||
|
||||
@Override
|
||||
public TableDataInfo listByPage(CommunityListPageRes communityListPageRes) {
|
||||
|
||||
// 查询社区加入人数,以map形式返回,key为社区id,value为加入人数
|
||||
Map<Long, Integer> communityJoinNumMap = new HashMap<>();
|
||||
Map<Long, Map<String, Object>> joinMap = baseMapper.selectCommunityJoinNum();
|
||||
if (joinMap != null && !joinMap.isEmpty()) {
|
||||
joinMap.forEach((key, value) -> {
|
||||
communityJoinNumMap.put(key, Integer.valueOf(value.get("joinNum").toString()));
|
||||
});
|
||||
}
|
||||
|
||||
// 查询社区发布数,以map形式返回,key为社区id,value为发布数
|
||||
Map<Long, Integer> communityPublishNumMap = new HashMap<>();
|
||||
Map<Long, Map<String, Object>> publishMap = baseMapper.selectCommunityPublishNum();
|
||||
if (publishMap != null && !publishMap.isEmpty()) {
|
||||
publishMap.forEach((key, value) -> {
|
||||
communityPublishNumMap.put(key, Integer.valueOf(value.get("publishNum").toString()));
|
||||
});
|
||||
}
|
||||
|
||||
Page<Community> page = new Page<>(communityListPageRes.getPageNum(), communityListPageRes.getPageSize());
|
||||
|
||||
|
||||
boolean isAsc = Objects.equals(communityListPageRes.getIsAsc(), "asc");
|
||||
|
||||
if (StringUtils.isBlank(communityListPageRes.getOrderByColumn())) {
|
||||
communityListPageRes.setOrderByColumn("create_time");
|
||||
}
|
||||
OrderItem orderItem = new OrderItem(communityListPageRes.getOrderByColumn(), isAsc);
|
||||
OrderItem orderItem = new OrderItem("create_time", false);
|
||||
page.addOrder(orderItem);
|
||||
|
||||
List<Community> communityList;
|
||||
if (Objects.isNull(communityListPageRes.getUserId())) {
|
||||
communityList = baseMapper.selectPageByCommunityTag(page, communityListPageRes.getCommunityTag());
|
||||
communityList = baseMapper.selectPageByCommunityTag(page, communityListPageRes.getCommunityTag(), communityListPageRes.getSearchContent());
|
||||
} else {
|
||||
baseMapper.selectPage(page, null);
|
||||
baseMapper.selectPage(page, new LambdaQueryWrapper<Community>()
|
||||
.like(StringUtils.isNotBlank(communityListPageRes.getSearchContent()), Community::getCommunityName, communityListPageRes.getSearchContent())
|
||||
.like(StringUtils.isNotBlank(communityListPageRes.getSearchContent()), Community::getDescription, communityListPageRes.getSearchContent()));
|
||||
communityList = page.getRecords();
|
||||
}
|
||||
|
||||
List<CommunityVo> communityVoList = new ArrayList<>();
|
||||
|
||||
LocalDate currentLocalDate = LocalDate.now(ZoneId.systemDefault());
|
||||
for (Community community : communityList) {
|
||||
CommunityVo communityVo = new CommunityVo();
|
||||
BeanUtil.copyProperties(community, communityVo);
|
||||
// 当前时间和创建时间差
|
||||
Date createTime = community.getCreateTime();
|
||||
LocalDate createLocalDate = createTime.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
long daysBetween = ChronoUnit.DAYS.between(createLocalDate, currentLocalDate);
|
||||
communityVo.setUserId(community.getTenantId());
|
||||
communityVo.setCreateDay(daysBetween);
|
||||
communityVo.setJoinNum(communityJoinNumMap.getOrDefault(community.getId(), 0));
|
||||
communityVo.setPublishNum(communityPublishNumMap.getOrDefault(community.getId(), 0));
|
||||
communityVoList.add(communityVo);
|
||||
}
|
||||
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setRows(communityVoList);
|
||||
tableDataInfo.setTotal(page.getTotal());
|
||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
|
||||
return tableDataInfo;
|
||||
return this.getCommunityVoTableDataInfo(communityList, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addCommunity(CommunityRes communityRes) {
|
||||
Community community = new Community();
|
||||
BeanUtil.copyProperties(communityRes, community);
|
||||
baseMapper.insert(community);
|
||||
try {
|
||||
Community community = new Community();
|
||||
BeanUtil.copyProperties(communityRes, community);
|
||||
if (Objects.equals(communityRes.getType(), 0)) {
|
||||
community.setPrice(0.0);
|
||||
}
|
||||
baseMapper.insert(community);
|
||||
|
||||
communityUserMapper.insert(CommunityUser
|
||||
.builder()
|
||||
.tenantId(SecurityUtils.getUserId())
|
||||
.communityId(community.getId())
|
||||
.userId(SecurityUtils.getUserId())
|
||||
.userType(1)
|
||||
.build());
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage(), HttpStatus.SHOW_ERROR_MSG);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -151,11 +127,129 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
|
||||
sysUserService.updateUser(user);
|
||||
|
||||
communityUserMapper.insert(new CommunityUser(null, tenantId, communityId, SecurityUtils.getUserId()));
|
||||
Calendar now = Calendar.getInstance();
|
||||
Date startTime = now.getTime();
|
||||
now.add(Calendar.DAY_OF_YEAR, community.getValidityDay());
|
||||
Date endTime = now.getTime();
|
||||
|
||||
CommunityUser cu = CommunityUser.builder()
|
||||
.tenantId(tenantId)
|
||||
.communityId(communityId)
|
||||
.userId(SecurityUtils.getUserId())
|
||||
.userType(0)
|
||||
.communityPrice(price)
|
||||
.startTime(startTime)
|
||||
.endTime(endTime)
|
||||
.build();
|
||||
|
||||
communityUserMapper.insert(cu);
|
||||
|
||||
|
||||
return R.ok("加入成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo getMyJoinCommunity(JoinCommunityListPageRes joinCommunityListPageRes) {
|
||||
Page<Community> page = new Page<>(joinCommunityListPageRes.getPageNum(), joinCommunityListPageRes.getPageSize());
|
||||
OrderItem orderItem = new OrderItem("create_time", false);
|
||||
page.addOrder(orderItem);
|
||||
|
||||
String searchContent = joinCommunityListPageRes.getSearchContent();
|
||||
List<Community> communityList = baseMapper.getMyJoinCommunity(page, SecurityUtils.getUserId(), searchContent);
|
||||
|
||||
|
||||
return this.getCommunityVoTableDataInfo(communityList, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Community getByTenantIdAndCommunityId(Long userId, Long communityId) {
|
||||
return baseMapper.getByTenantIdAndCommunityId(userId, communityId);
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
||||
|
||||
// 查询社区加入人数,以map形式返回,key为社区id,value为加入人数
|
||||
Map<String, Object> communityJoinNumMap = redisCache.getCacheMap("communityJoinNumMap");
|
||||
if (communityJoinNumMap.isEmpty()) {
|
||||
Map<Long, Map<String, Object>> joinMap = baseMapper.selectCommunityJoinNum();
|
||||
if (joinMap != null && !joinMap.isEmpty()) {
|
||||
joinMap.forEach((key, value) -> {
|
||||
communityJoinNumMap.put(key.toString(), Integer.valueOf(value.get("joinNum").toString()));
|
||||
});
|
||||
redisCache.setCacheMap("communityJoinNumMap", communityJoinNumMap);
|
||||
} else {
|
||||
redisCache.setCacheMap("communityJoinNumMap", new HashMap<>());
|
||||
}
|
||||
redisCache.expire("communityJoinNumMap", 1, TimeUnit.HOURS);
|
||||
}
|
||||
|
||||
// 查询社区发布数,以map形式返回,key为社区id,value为发布数
|
||||
Map<String, Object> communityPublishNumMap = redisCache.getCacheMap("communityPublishNumMap");
|
||||
if (communityPublishNumMap.isEmpty()) {
|
||||
Map<Long, Map<String, Object>> publishMap = baseMapper.selectCommunityPublishNum();
|
||||
if (publishMap != null && !publishMap.isEmpty()) {
|
||||
publishMap.forEach((key, value) -> {
|
||||
communityPublishNumMap.put(key.toString(), Integer.valueOf(value.get("publishNum").toString()));
|
||||
});
|
||||
redisCache.setCacheMap("communityPublishNumMap", communityPublishNumMap);
|
||||
} else {
|
||||
redisCache.setCacheMap("communityPublishNumMap", new HashMap<>());
|
||||
}
|
||||
redisCache.expire("communityPublishNumMap", 1, TimeUnit.HOURS);
|
||||
}
|
||||
|
||||
|
||||
List<CommunityVo> communityVoList = new ArrayList<>();
|
||||
|
||||
LocalDate currentLocalDate = LocalDate.now(ZoneId.systemDefault());
|
||||
for (Community community : communityList) {
|
||||
CommunityVo communityVo = new CommunityVo();
|
||||
BeanUtil.copyProperties(community, communityVo);
|
||||
// 当前时间和创建时间差
|
||||
Date createTime = community.getCreateTime();
|
||||
LocalDate createLocalDate = createTime.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
long daysBetween = ChronoUnit.DAYS.between(createLocalDate, currentLocalDate);
|
||||
SysUser sysUser = sysUserService.selectUserById(community.getTenantId());
|
||||
communityVo.setUserId(community.getTenantId());
|
||||
communityVo.setAvatar(sysUser.getAvatar());
|
||||
communityVo.setNickName(sysUser.getNickName());
|
||||
communityVo.setCreateDay(daysBetween);
|
||||
communityVo.setJoinNum((Integer) communityJoinNumMap.getOrDefault(community.getId().toString(), 0));
|
||||
communityVo.setPublishNum((Integer) communityPublishNumMap.getOrDefault(community.getId().toString(), 0));
|
||||
communityVoList.add(communityVo);
|
||||
}
|
||||
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setRows(communityVoList);
|
||||
tableDataInfo.setTotal(total);
|
||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,16 +10,21 @@ import com.mcwl.common.utils.ShareCodeUtils;
|
|||
import com.mcwl.communityCenter.constant.InviteConstant;
|
||||
import com.mcwl.communityCenter.constant.StatusConstant;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.CommunityUser;
|
||||
import com.mcwl.communityCenter.domain.Invite;
|
||||
import com.mcwl.communityCenter.domain.InviteCodeMapping;
|
||||
import com.mcwl.communityCenter.mapper.CommunityUserMapper;
|
||||
import com.mcwl.communityCenter.mapper.InviteMapper;
|
||||
import com.mcwl.communityCenter.service.CommunityService;
|
||||
import com.mcwl.communityCenter.service.CommunityUserService;
|
||||
import com.mcwl.communityCenter.service.InviteCodeMappingService;
|
||||
import com.mcwl.communityCenter.service.InviteService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
|
@ -32,6 +37,8 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
|
|||
|
||||
private final InviteMapper inviteMapper;
|
||||
|
||||
private final CommunityUserMapper communityUserMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public String getInviteCode(Long communityId) {
|
||||
|
@ -66,16 +73,24 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
|
|||
public R<Object> acceptInvite(Long communityId, String inviteCode) {
|
||||
|
||||
// 解析邀请码
|
||||
Long userId = ShareCodeUtils.codeToId(inviteCode);
|
||||
Long userId;
|
||||
try {
|
||||
userId = ShareCodeUtils.codeToId(inviteCode);
|
||||
} catch (Exception e) {
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "邀请码有误");
|
||||
}
|
||||
|
||||
if (Objects.isNull(userId)) {
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"邀请码有误");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "邀请码有误");
|
||||
}
|
||||
|
||||
// 判断是否是同一个人
|
||||
if (Objects.equals(userId, SecurityUtils.getUserId())) {
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"不能邀请自己");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "不能邀请自己");
|
||||
}
|
||||
|
||||
Community community = communityService.getByTenantIdAndCommunityId(userId, communityId);
|
||||
|
||||
// 查询邀请码
|
||||
InviteCodeMapping inviteCodeMapping = inviteCodeMappingService.lambdaQuery()
|
||||
.eq(InviteCodeMapping::getUserId, userId)
|
||||
|
@ -85,13 +100,13 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
|
|||
.one();
|
||||
|
||||
if (Objects.isNull(inviteCodeMapping)) {
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"没查询到该邀请码");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "没查询到该邀请码");
|
||||
}
|
||||
|
||||
// 判断是否已经邀请过
|
||||
Invite inv = inviteMapper.isInvite(userId, communityId, SecurityUtils.getUserId());
|
||||
if (Objects.nonNull(inv)) {
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"不能重复邀请");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "不能重复邀请");
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,12 +114,26 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
|
|||
inviteCodeMappingService.updateById(inviteCodeMapping);
|
||||
|
||||
Invite invite = new Invite();
|
||||
invite.setTenantId(userId);
|
||||
invite.setCommunityId(communityId);
|
||||
invite.setInviteeUserId(SecurityUtils.getUserId());
|
||||
invite.setType(InviteConstant.INVITE_ADMIN);
|
||||
invite.setFeeType(InviteConstant.INVITE_FEE);
|
||||
baseMapper.insert(invite);
|
||||
|
||||
Calendar now = Calendar.getInstance();
|
||||
Date startTime = now.getTime();
|
||||
now.add(Calendar.DAY_OF_YEAR, community.getValidityDay());
|
||||
Date endTime = now.getTime();
|
||||
|
||||
communityUserMapper.insert(CommunityUser
|
||||
.builder()
|
||||
.tenantId(userId)
|
||||
.communityId(communityId)
|
||||
.userId(SecurityUtils.getUserId())
|
||||
.userType(0)
|
||||
.inviteId(invite.getId())
|
||||
.startTime(startTime)
|
||||
.endTime(endTime)
|
||||
.build());
|
||||
|
||||
return R.ok(null, "邀请成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,22 @@
|
|||
<id property="id" column="id" javaType="java.lang.Long" /> <!-- 键字段 -->
|
||||
<result property="publishNum" column="publish_num" javaType="java.lang.Integer" /> <!-- 值字段 -->
|
||||
</resultMap>
|
||||
<update id="quitCommunity">
|
||||
update cc_community_user
|
||||
set del_flag = '1'
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and user_id = #{userId}
|
||||
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,
|
||||
|
@ -20,7 +36,7 @@
|
|||
community_name,
|
||||
type,
|
||||
price,
|
||||
validity_type
|
||||
validity_day
|
||||
from cc_community
|
||||
where tenant_id = #{tenantId}
|
||||
and id = #{communityId}
|
||||
|
@ -28,18 +44,16 @@
|
|||
</select>
|
||||
|
||||
<select id="selectCommunityJoinNum" resultMap="CommunityJoinNumMap">
|
||||
select c.id as id, COALESCE(count(*), 0) as join_num
|
||||
from cc_community c
|
||||
join cc_invite i on c.id = i.community_id
|
||||
where c.del_flag = '0'
|
||||
and i.del_flag = '0'
|
||||
group by i.community_id
|
||||
select cu.community_id as id, COALESCE(count(*), 0) as join_num
|
||||
from cc_community_user cu
|
||||
where cu.del_flag = '0'
|
||||
group by cu.community_id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectCommunityPublishNum" resultMap="CommunityPublishNumMap">
|
||||
select c.id as id, COALESCE(count(*), 0) as publish_num
|
||||
select p.community_id as id, COALESCE(count(*), 0) as publish_num
|
||||
from cc_community c
|
||||
join cc_publish p on c.id = p.community_id
|
||||
join cc_question q on c.id = q.community_id
|
||||
|
@ -58,7 +72,7 @@
|
|||
community_tag,
|
||||
type,
|
||||
price,
|
||||
validity_type,
|
||||
validity_day,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
|
@ -66,8 +80,36 @@
|
|||
from cc_community
|
||||
<where>
|
||||
<if test="communityTag != null">
|
||||
and c.community_tag = #{communityTag}
|
||||
and community_tag = #{communityTag}
|
||||
</if>
|
||||
<if test="searchContent != null and searchContent != ''">
|
||||
and (community_name like concat('%', #{searchContent}, '%')
|
||||
or `description` like concat('%', #{searchContent}, '%'))
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getMyJoinCommunity" resultType="com.mcwl.communityCenter.domain.Community">
|
||||
select c.id,
|
||||
c.tenant_id,
|
||||
c.image_url,
|
||||
c.community_name,
|
||||
c.description,
|
||||
c.community_tag,
|
||||
c.type,
|
||||
c.price,
|
||||
c.validity_day,
|
||||
c.create_by,
|
||||
c.create_time,
|
||||
c.update_by,
|
||||
c.update_time
|
||||
from cc_community c
|
||||
join cc_community_user cu on c.id = cu.community_id
|
||||
where cu.user_id = #{userId}
|
||||
and c.del_flag = '0'
|
||||
and cu.del_flag = '0'
|
||||
<if test="searchContent != null and searchContent != ''">
|
||||
and (c.community_name like concat('%', #{searchContent}, '%')
|
||||
or c.description like concat('%', #{searchContent}, '%'))
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
|
@ -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>
|
|
@ -5,27 +5,40 @@
|
|||
<mapper namespace="com.mcwl.communityCenter.mapper.InviteMapper">
|
||||
|
||||
<select id="selectInviteIds" resultType="java.lang.Long">
|
||||
select invitee_user_id
|
||||
from cc_invite
|
||||
select user_id
|
||||
from cc_community_user
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and invite_id is not null
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
<select id="isInvite" resultType="com.mcwl.communityCenter.domain.Invite">
|
||||
select id, tenant_id, community_id, invitee_user_id, type, fee_type, create_by, create_time, update_by, update_time, del_flag, remark
|
||||
from cc_invite
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and invitee_user_id = #{userId}
|
||||
and del_flag = '0'
|
||||
select i.id,
|
||||
invite_type,
|
||||
fee_type
|
||||
from cc_community_user cu
|
||||
left join cc_invite i on cu.invite_id = i.id
|
||||
where cu.tenant_id = #{tenantId}
|
||||
and cu.community_id = #{communityId}
|
||||
and cu.user_id = #{userId}
|
||||
and cu.invite_id is not null
|
||||
and cu.del_flag = '0'
|
||||
and i.del_flag = '0'
|
||||
</select>
|
||||
<select id="selectByTenantIdAndCommunityIdAndInviteeUserId"
|
||||
resultType="com.mcwl.communityCenter.domain.Invite">
|
||||
select id, tenant_id, community_id, invitee_user_id, type, fee_type, create_by, create_time, update_by, update_time, del_flag, remark
|
||||
from cc_invite
|
||||
select i.id,
|
||||
tenant_id,
|
||||
community_id,
|
||||
fee_type,
|
||||
remark
|
||||
from cc_community_user cu
|
||||
left join cc_invite i on cu.invite_id = i.id
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and invitee_user_id = #{inviteeUserId}
|
||||
and del_flag = '0'
|
||||
and user_id = #{inviteeUserId}
|
||||
and cu.invite_id is not null
|
||||
and cu.del_flag = '0'
|
||||
and i.del_flag = '0'
|
||||
</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;
|
||||
|
@ -18,7 +23,7 @@ import com.mcwl.framework.web.service.TokenService;
|
|||
|
||||
/**
|
||||
* token过滤器 验证token有效性
|
||||
*
|
||||
*
|
||||
* @author mcwl
|
||||
*/
|
||||
@Component
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
||||
|
|
|
@ -191,12 +191,12 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
|||
return;
|
||||
}
|
||||
|
||||
// 保存提成表
|
||||
Commission commission = new Commission();
|
||||
commission.setUserId(inviterUserId);
|
||||
commission.setAmount(amount);
|
||||
commission.setWallet(sysUser.getWallet());
|
||||
commissionService.save(commission);
|
||||
// 保存提成
|
||||
this.saveCommission(amount, sysUser);
|
||||
|
||||
// 保存商品收入
|
||||
this.saveCommission(price, sysUser);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -703,16 +703,10 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
|||
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_INVITER_USER.getName(), commissionRationInviterUser);
|
||||
}
|
||||
|
||||
Double rationMerchant = redisCache.getCacheObject(CommissionRationMerchant);
|
||||
Double rationInviterUser = redisCache.getCacheObject(commissionRationInviterUser);
|
||||
|
||||
rationMerchant = rationMerchant == null ? 0.0 : rationMerchant;
|
||||
rationInviterUser = rationInviterUser == null ? 0.0 : rationInviterUser;
|
||||
|
||||
// 将模型价格、抽取商家金额比例、佣金配给邀请者用户比例转换为BigDecimal类型
|
||||
BigDecimal priceBigDecimal = new BigDecimal(price.toString());
|
||||
BigDecimal rationMerchantBigDecimal = new BigDecimal(rationMerchant.toString());
|
||||
BigDecimal rationInviterUserBigDecimal = new BigDecimal(rationInviterUser.toString());
|
||||
BigDecimal rationMerchantBigDecimal = new BigDecimal(CommissionRationMerchant);
|
||||
BigDecimal rationInviterUserBigDecimal = new BigDecimal(commissionRationInviterUser);
|
||||
|
||||
// 邀请人获取的金额 = 模型价格 * 抽取商家金额比例 * 邀请人提成比例
|
||||
BigDecimal inviterUserAmount = priceBigDecimal
|
||||
|
@ -758,5 +752,13 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
|||
return map;
|
||||
}
|
||||
|
||||
private void saveCommission(double price, SysUser sysUser) {
|
||||
Commission commission = new Commission();
|
||||
commission.setUserId(sysUser.getInviterUserId());
|
||||
commission.setAmount(price);
|
||||
commission.setWallet(sysUser.getWallet());
|
||||
commissionService.save(commission);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.mcwl.common.constant.DictConstants;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.Report;
|
||||
import com.mcwl.resource.domain.WorkFlow;
|
||||
|
@ -67,7 +68,9 @@ public class ReportServiceImpl implements ReportService {
|
|||
}
|
||||
|
||||
Page<Report> reportPage = reportMapper.selectPage(page, reportLambdaQueryWrapper);
|
||||
|
||||
if (StringUtils.isEmpty(reportPage.getRecords())){
|
||||
return R.ok(reportPage);
|
||||
}
|
||||
for (Report record : reportPage.getRecords()) {
|
||||
record.setNickName(sysUserMapper.selectUserById(record.getUserId()).getNickName());
|
||||
//翻译举报类型
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ public class SysUserPayAccountLogServiceImpl extends ServiceImpl<SysUserPayAccou
|
|||
Page<SysUserPayAccountLog> page = new Page<>(withdrawalPageRes.getPageNum(), withdrawalPageRes.getPageSize());
|
||||
|
||||
baseMapper.selectPage(page, new LambdaQueryWrapper<SysUserPayAccountLog>()
|
||||
.select(SysUserPayAccountLog::getAmount, SysUserPayAccountLog::getAccount, SysUserPayAccountLog::getCreateTime)
|
||||
.select(SysUserPayAccountLog::getAmount, SysUserPayAccountLog::getAccount,
|
||||
SysUserPayAccountLog::getWallet, SysUserPayAccountLog::getCreateTime)
|
||||
.eq(SysUserPayAccountLog::getUserId, userId)
|
||||
.orderByDesc(SysUserPayAccountLog::getCreateTime));
|
||||
|
||||
|
|
|
@ -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