Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6965f74a57
@ -1,106 +1,82 @@
|
||||
package com.ruoyi.member.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.member.domain.MemberPoints;
|
||||
import com.ruoyi.member.service.IMemberPointsService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 博主积分变动明细Controller
|
||||
*
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-03-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/member/points")
|
||||
public class MemberPointsController extends BaseController
|
||||
{
|
||||
public class MemberPointsController extends BaseController {
|
||||
@Autowired
|
||||
private IMemberPointsService memberPointsService;
|
||||
|
||||
/**
|
||||
* 查询博主积分变动明细列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:points:list')")
|
||||
* 分页查询积分变动明细
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param pageNum 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
* @author PQZ
|
||||
* @date 15:24 2025/3/29
|
||||
**/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(MemberPoints memberPoints)
|
||||
{
|
||||
|
||||
List<MemberPoints> list = memberPointsService.list();
|
||||
public AjaxResult list(@RequestParam(name = "userId") Long userId,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<MemberPoints> page = new Page<>(pageNum, pageSize);
|
||||
IPage<MemberPoints> list = memberPointsService.queryListPage(userId, page);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出博主积分变动明细列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:points:export')")
|
||||
@Log(title = "博主积分变动明细", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MemberPoints memberPoints)
|
||||
{
|
||||
List<MemberPoints> list = memberPointsService.list();
|
||||
ExcelUtil<MemberPoints> util = new ExcelUtil<MemberPoints>(MemberPoints.class);
|
||||
util.exportExcel(response, list, "博主积分变动明细数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取博主积分变动明细详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:points:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(memberPointsService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增博主积分变动明细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:points:add')")
|
||||
* 新增博主积分变动记录
|
||||
*
|
||||
* @param memberPoints {@link MemberPoints}
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
* @author PQZ
|
||||
* @date 15:29 2025/3/29
|
||||
**/
|
||||
@Log(title = "博主积分变动明细", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MemberPoints memberPoints)
|
||||
{
|
||||
return toAjax(memberPointsService.save(memberPoints));
|
||||
public AjaxResult add(@RequestBody MemberPoints memberPoints) {
|
||||
memberPointsService.savePoints(memberPoints);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改博主积分变动明细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:points:edit')")
|
||||
@Log(title = "博主积分变动明细", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MemberPoints memberPoints)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody MemberPoints memberPoints) {
|
||||
return toAjax(memberPointsService.updateById(memberPoints));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除博主积分变动明细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:points:remove')")
|
||||
@Log(title = "博主积分变动明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||
return toAjax(memberPointsService.removeByIds(list));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class MemberPoints extends DlBaseEntity
|
||||
|
||||
/** 剩余 */
|
||||
@Excel(name = "剩余")
|
||||
private Long balance;
|
||||
private Integer balance;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
|
@ -1,18 +1,28 @@
|
||||
package com.ruoyi.member.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.member.domain.MemberPoints;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.member.domain.MemberPoints;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 博主积分变动明细Mapper接口
|
||||
*
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-03-17
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberPointsMapper extends BaseMapper<MemberPoints>
|
||||
{
|
||||
public interface MemberPointsMapper extends BaseMapper<MemberPoints> {
|
||||
|
||||
/**
|
||||
* 根据用户id查询积分变动明细
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.member.domain.MemberPoints>
|
||||
* @author PQZ
|
||||
* @date 15:25 2025/3/29
|
||||
**/
|
||||
IPage<MemberPoints> queryListPage(Long userId, Page<MemberPoints> page);
|
||||
}
|
||||
|
@ -31,19 +31,35 @@ public interface IMemberCardService extends IService<MemberCard> {
|
||||
/**
|
||||
* 会员开卡处理
|
||||
*
|
||||
* @param order 订单
|
||||
* @param userId 用户id
|
||||
* @param userType 用户类型
|
||||
* @param cardId 卡id
|
||||
* @param cycle 时间
|
||||
* @param orderId 订单id
|
||||
* @author PQZ
|
||||
* @date 16:18 2025/3/26
|
||||
* @date 18:06 2025/3/31
|
||||
**/
|
||||
void dealMemberCard(MemberOrder order);
|
||||
void dealMemberCard(Long userId, String userType, String cardId, String cycle, String orderId);
|
||||
|
||||
/**
|
||||
* 查当前会员权益列表
|
||||
*
|
||||
* @param userType 用户类型
|
||||
* @param userId 用户id
|
||||
* @author vinjor-M
|
||||
* @date 11:26 2025/3/26
|
||||
* @param userType 用户类型
|
||||
* @param userId 用户id
|
||||
**/
|
||||
Map<String,Map<String, ViewRightsVO>> selectMemberRights(Long userId, String userType);
|
||||
**/
|
||||
Map<String, Map<String, ViewRightsVO>> selectMemberRights(Long userId, String userType);
|
||||
|
||||
/**
|
||||
* 获取报名次数
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param userType 类型
|
||||
* @return java.lang.Integer
|
||||
* @author PQZ
|
||||
* @date 17:27 2025/3/31
|
||||
**/
|
||||
Integer getCardReport(Long userId, String userType);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.ruoyi.member.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.member.domain.MemberPoints;
|
||||
|
||||
@ -13,5 +15,33 @@ import java.util.List;
|
||||
*/
|
||||
public interface IMemberPointsService extends IService<MemberPoints> {
|
||||
|
||||
// void dealMemberPoints(Long userId);
|
||||
/**
|
||||
* 分页查询积分变动明细
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.member.domain.MemberPoints>
|
||||
* @author PQZ
|
||||
* @date 15:24 2025/3/29
|
||||
**/
|
||||
IPage<MemberPoints> queryListPage(Long userId, Page<MemberPoints> page);
|
||||
|
||||
/**
|
||||
* 新增积分变动记录
|
||||
*
|
||||
* @param memberPoints {@link MemberPoints}
|
||||
* @author PQZ
|
||||
* @date 15:29 2025/3/29
|
||||
**/
|
||||
void savePoints(MemberPoints memberPoints);
|
||||
|
||||
/**
|
||||
* 获取积分
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return java.lang.Integer
|
||||
* @author PQZ
|
||||
* @date 16:11 2025/3/31
|
||||
**/
|
||||
Integer getBloggerBalance(Long userId);
|
||||
}
|
||||
|
@ -23,5 +23,14 @@ public interface IMemberRightsService extends IService<MemberRights> {
|
||||
* @author PQZ
|
||||
* @date 15:45 2025/3/27
|
||||
**/
|
||||
void dealRights(Long userId, String userType,List<CardRightsVO> rights);
|
||||
void dealRights(Long userId, String userType, List<CardRightsVO> rights);
|
||||
|
||||
/**
|
||||
* @param userId 用户id
|
||||
* @param carId 卡id
|
||||
* @return java.lang.Integer
|
||||
* @author PQZ
|
||||
* @date 17:15 2025/3/31
|
||||
**/
|
||||
Integer getReport(Long userId, String carId);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.base.domain.BaseCard;
|
||||
import com.ruoyi.base.service.IBaseCardService;
|
||||
import com.ruoyi.base.vo.BaseCardVO;
|
||||
import com.ruoyi.common.config.DlRightsConfig;
|
||||
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.constant.DictConstants;
|
||||
@ -71,39 +72,43 @@ public class MemberCardServiceImpl extends ServiceImpl<MemberCardMapper, MemberC
|
||||
/**
|
||||
* 会员开卡处理
|
||||
*
|
||||
* @param order {@link MemberOrder}
|
||||
* @param userId 用户id
|
||||
* @param userType 用户类型
|
||||
* @param cardId 卡id
|
||||
* @param cycle 时间
|
||||
* @param orderId 订单id
|
||||
* @author PQZ
|
||||
* @date 16:19 2025/3/26
|
||||
* @date 18:06 2025/3/31
|
||||
**/
|
||||
@Override
|
||||
public void dealMemberCard(MemberOrder order) {
|
||||
public void dealMemberCard(Long userId, String userType, String cardId, String cycle, String orderId) {
|
||||
/*1、数据初始化*/
|
||||
//查询会员卡
|
||||
BaseCardVO card = baseCardService.queryByCardId(order.getGoodsId());
|
||||
BaseCardVO card = baseCardService.queryByCardId(cardId);
|
||||
//查询当前时间是否存在有效会员卡
|
||||
List<MemberCard> cardList = checkMemberCard(order.getGoodsId(), order.getUserId());
|
||||
List<MemberCard> cardList = checkMemberCard(cardId, userId);
|
||||
|
||||
/*2、计算到期时间*/
|
||||
Date startTime;
|
||||
Date endTime;
|
||||
if (cardList.isEmpty()){
|
||||
if (cardList.isEmpty()) {
|
||||
//计算到期时间
|
||||
startTime = new Date();
|
||||
endTime = getEndTime(startTime, order.getGoodsCycle());
|
||||
endTime = getEndTime(startTime, cycle);
|
||||
//新增时需要处理会员权益
|
||||
rightsService.dealRights(order.getUserId(),order.getUserType(),card.getRights());
|
||||
rightsService.dealRights(userId, userType, card.getRights());
|
||||
} else {
|
||||
startTime = cardList.get(0).getEndDate();
|
||||
endTime = getEndTime(startTime,order.getGoodsCycle());
|
||||
endTime = getEndTime(startTime, cycle);
|
||||
}
|
||||
|
||||
/*3、保存会员开卡记录*/
|
||||
//初始化会员开通记录
|
||||
MemberCard memberCard = new MemberCard();
|
||||
memberCard.setUserId(order.getUserId());
|
||||
memberCard.setUserType(order.getUserType());
|
||||
memberCard.setCardId(order.getGoodsId());
|
||||
memberCard.setOrderId(order.getId());
|
||||
memberCard.setUserId(userId);
|
||||
memberCard.setUserType(userType);
|
||||
memberCard.setCardId(cardId);
|
||||
memberCard.setOrderId(orderId);
|
||||
memberCard.setCardName(card.getCardName());
|
||||
memberCard.setStartDate(startTime);
|
||||
memberCard.setEndDate(endTime);
|
||||
@ -153,6 +158,9 @@ public class MemberCardServiceImpl extends ServiceImpl<MemberCardMapper, MemberC
|
||||
case "03":
|
||||
calendar.add(Calendar.YEAR, 1);
|
||||
break;
|
||||
case "04":
|
||||
calendar.add(Calendar.YEAR, 100);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("无效的时间类型: " + type);
|
||||
}
|
||||
@ -202,6 +210,35 @@ public class MemberCardServiceImpl extends ServiceImpl<MemberCardMapper, MemberC
|
||||
return rtnMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当日可报名次数
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param userType 类型
|
||||
* @return java.lang.Integer
|
||||
* @author PQZ
|
||||
* @date 17:27 2025/3/31
|
||||
**/
|
||||
@Override
|
||||
public Integer getCardReport(Long userId, String userType) {
|
||||
//查询当前用户在当前时间有无正在服役的会员卡
|
||||
Date time = new Date();
|
||||
LambdaQueryWrapper<MemberCard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper
|
||||
.eq(MemberCard::getUserType, userType)
|
||||
.eq(MemberCard::getUserId, userId)
|
||||
.eq(DlBaseEntity::getDelFlag, 0)
|
||||
.lt(MemberCard::getStartDate, time)
|
||||
.ge(MemberCard::getEndDate, time)
|
||||
.orderByDesc(DlBaseEntity::getCreateTime);
|
||||
List<MemberCard> memberCards = list(lambdaQueryWrapper);
|
||||
if (memberCards.isEmpty()) {
|
||||
return 0;
|
||||
} else {
|
||||
return rightsService.getReport(memberCards.get(0).getUserId(), memberCards.get(0).getCardId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param memberRightsMap 会员权益map
|
||||
* @param item 这个权益
|
||||
|
@ -68,7 +68,7 @@ public class MemberOrderServiceImpl extends ServiceImpl<MemberOrderMapper,Member
|
||||
MemberOrder memberOrder = getOne(lambdaQueryWrapper);
|
||||
/*2、处理不同类型订单*/
|
||||
if ("01".equals(memberOrder.getOrderType())) {
|
||||
cardService.dealMemberCard(memberOrder);
|
||||
cardService.dealMemberCard(memberOrder.getUserId(),memberOrder.getUserType(),memberOrder.getGoodsId(),memberOrder.getGoodsCycle(),memberOrder.getId());
|
||||
} else {
|
||||
couponService.dealMemberCoupon(memberOrder);
|
||||
}
|
||||
|
@ -1,25 +1,98 @@
|
||||
package com.ruoyi.member.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.config.DlRightsConfig;
|
||||
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||
import com.ruoyi.member.domain.MemberPoints;
|
||||
import com.ruoyi.member.mapper.MemberPointsMapper;
|
||||
import com.ruoyi.member.service.IMemberPointsService;
|
||||
import io.lettuce.core.LMoveArgs;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.member.mapper.MemberPointsMapper;
|
||||
import com.ruoyi.member.domain.MemberPoints;
|
||||
import com.ruoyi.member.service.IMemberPointsService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 博主积分变动明细Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-03-17
|
||||
*/
|
||||
@Service
|
||||
public class MemberPointsServiceImpl extends ServiceImpl<MemberPointsMapper,MemberPoints> implements IMemberPointsService
|
||||
{
|
||||
public class MemberPointsServiceImpl extends ServiceImpl<MemberPointsMapper, MemberPoints> implements IMemberPointsService {
|
||||
@Autowired
|
||||
private MemberPointsMapper memberPointsMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询积分变动明细
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.member.domain.MemberPoints>
|
||||
* @author PQZ
|
||||
* @date 15:24 2025/3/29
|
||||
**/
|
||||
@Override
|
||||
public IPage<MemberPoints> queryListPage(Long userId, Page<MemberPoints> page) {
|
||||
return memberPointsMapper.queryListPage(userId,page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增积分变动记录
|
||||
*
|
||||
* @param memberPoints {@link MemberPoints}
|
||||
* @author PQZ
|
||||
* @date 15:29 2025/3/29
|
||||
**/
|
||||
@Override
|
||||
public void savePoints(MemberPoints memberPoints) {
|
||||
//查询当前用户最近变动记录
|
||||
LambdaQueryWrapper<MemberPoints> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DlBaseEntity::getDelFlag,0)
|
||||
.eq(MemberPoints::getUserId,memberPoints.getUserId())
|
||||
.orderByDesc(DlBaseEntity::getCreateTime);
|
||||
List<MemberPoints> list = list(lambdaQueryWrapper);
|
||||
//如果没有记录则为初始新增
|
||||
if (list.isEmpty()) {
|
||||
memberPoints.setBalance(memberPoints.getPoints());
|
||||
} else {
|
||||
//如果有记录则取最新记录中的剩余值进行计算后得出新值
|
||||
Integer oldBalance = list.get(0).getBalance();
|
||||
Integer newBalance;
|
||||
if ("1".equals(memberPoints.getType())) {
|
||||
newBalance = oldBalance + memberPoints.getPoints();
|
||||
} else {
|
||||
newBalance = oldBalance - memberPoints.getPoints();
|
||||
}
|
||||
memberPoints.setBalance(newBalance);
|
||||
}
|
||||
save(memberPoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取积分
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return java.lang.Integer
|
||||
* @author PQZ
|
||||
* @date 16:11 2025/3/31
|
||||
**/
|
||||
@Override
|
||||
public Integer getBloggerBalance(Long userId) {
|
||||
LambdaQueryWrapper<MemberPoints> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper
|
||||
.eq(MemberPoints::getUserId,userId)
|
||||
.eq(DlBaseEntity::getDelFlag,0)
|
||||
.orderByDesc(DlBaseEntity::getCreateTime);
|
||||
List<MemberPoints> list = list(lambdaQueryWrapper);
|
||||
if (list.isEmpty()){
|
||||
return 0;
|
||||
} else {
|
||||
return list.get(0).getBalance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.ruoyi.member.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.base.vo.CardRightsVO;
|
||||
import com.ruoyi.common.config.DlRightsConfig;
|
||||
import com.ruoyi.member.domain.MemberCard;
|
||||
import com.ruoyi.member.domain.MemberRights;
|
||||
import com.ruoyi.member.mapper.MemberRightsMapper;
|
||||
@ -11,6 +13,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 会员权益(定时任务重置剩余值),用户id、会员卡id、权益对应1Service业务层处理
|
||||
@ -22,6 +25,8 @@ import java.util.List;
|
||||
public class MemberRightsServiceImpl extends ServiceImpl<MemberRightsMapper, MemberRights> implements IMemberRightsService {
|
||||
@Autowired
|
||||
private MemberRightsMapper memberRightsMapper;
|
||||
@Autowired
|
||||
private DlRightsConfig dlRightsConfig;
|
||||
|
||||
|
||||
/**
|
||||
@ -49,4 +54,30 @@ public class MemberRightsServiceImpl extends ServiceImpl<MemberRightsMapper, Mem
|
||||
});
|
||||
saveBatch(saveList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询报名上限
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param cardId 卡id
|
||||
* @return java.lang.Integer
|
||||
* @author PQZ
|
||||
* @date 17:15 2025/3/31
|
||||
**/
|
||||
@Override
|
||||
public Integer getReport(Long userId, String cardId) {
|
||||
LambdaQueryWrapper<MemberRights> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper
|
||||
.eq(MemberRights::getUserId,userId)
|
||||
.eq(MemberRights::getCardId,cardId);
|
||||
List<MemberRights> rights = list(lambdaQueryWrapper);
|
||||
if (rights.isEmpty()){
|
||||
return dlRightsConfig.getReport();
|
||||
} else {
|
||||
List<MemberRights> filterRights = rights.stream()
|
||||
.filter(item -> "report".equals(item.getRightsCode()))
|
||||
.collect(Collectors.toList());
|
||||
return filterRights.get(0).getRemaining();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,7 @@ import com.ruoyi.constant.DictConstants;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.member.domain.MemberUser;
|
||||
import com.ruoyi.member.mapper.MemberUserMapper;
|
||||
import com.ruoyi.member.service.IMemberBusiCardService;
|
||||
import com.ruoyi.member.service.IMemberCardService;
|
||||
import com.ruoyi.member.service.IMemberUserService;
|
||||
import com.ruoyi.member.service.*;
|
||||
import com.ruoyi.member.vo.MemberUserVO;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -51,6 +49,10 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
|
||||
private SysUserMapper userMapper;
|
||||
@Autowired
|
||||
private DlRightsConfig dlRightsConfig;
|
||||
@Resource
|
||||
private IMemberAddressService addressService;
|
||||
@Resource
|
||||
private IMemberPointsService pointsService;
|
||||
|
||||
|
||||
/**
|
||||
@ -83,8 +85,6 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
|
||||
result.setEvaluates(evaluateService.listByToUserId(userId));
|
||||
//会员开通记录
|
||||
result.setCards(cardService.listByUserId(userId, "01"));
|
||||
// //会员发布通告
|
||||
// result.setNotices(noticeService.listByUserId(userId));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -102,8 +102,14 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
|
||||
MemberUserVO result = memberUserMapper.queryByUserId(userId, "02");
|
||||
//名片信息
|
||||
result.setBusiCards(busiCardService.queryListByUserId(userId));
|
||||
//报名的通告
|
||||
// result.setNoticeVos(noticeService.queryListByUserId(userId));
|
||||
//积分
|
||||
result.setPointsBalance(pointsService.getBloggerBalance(userId));
|
||||
//报名
|
||||
result.setReport(cardService.getCardReport(userId,"02"));
|
||||
//地址信息
|
||||
result.setAddresses(addressService.listByUserId(userId));
|
||||
//会员开通记录
|
||||
result.setCards(cardService.listByUserId(userId, "02"));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -146,6 +152,9 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
|
||||
//插入用户扩展信息表数据
|
||||
this.save(new MemberUser(DictConstants.USER_TYPE_TGZ,user,dlRightsConfig.getAddNotice()));
|
||||
this.save(new MemberUser(DictConstants.USER_TYPE_BZ,user,null));
|
||||
//开通会员卡
|
||||
cardService.dealMemberCard(user.getUserId(),"01","67def5ba1e4c60754e68defb3fb027a5","04",null);
|
||||
cardService.dealMemberCard(user.getUserId(),"02","7530cf7b7a5d0100a7b41605d1642ef1","04",null);
|
||||
}else {
|
||||
//,查到了
|
||||
if(!"0".equals(wxUser.getStatus())){
|
||||
|
@ -4,6 +4,7 @@ import com.ruoyi.busi.domain.BusiEvaluate;
|
||||
import com.ruoyi.busi.domain.BusiNotice;
|
||||
import com.ruoyi.busi.vo.BusiEvaluateVO;
|
||||
import com.ruoyi.busi.vo.BusiNoticeVo;
|
||||
import com.ruoyi.member.domain.MemberAddress;
|
||||
import com.ruoyi.member.domain.MemberBusiCard;
|
||||
import com.ruoyi.member.domain.MemberCard;
|
||||
import com.ruoyi.member.domain.MemberUser;
|
||||
@ -29,8 +30,12 @@ public class MemberUserVO extends MemberUser {
|
||||
List<MemberCard> cards;
|
||||
/**通告主发布的通告列表*/
|
||||
List<BusiNotice> notices;
|
||||
/**博主报名的通告列表*/
|
||||
List<BusiNoticeVo> noticeVos;
|
||||
/**名片信息*/
|
||||
List<MemberBusiCard> busiCards;
|
||||
/**地址信息*/
|
||||
List<MemberAddress> addresses;
|
||||
/**积分*/
|
||||
int pointsBalance;
|
||||
/**报名次数*/
|
||||
int report;
|
||||
}
|
||||
|
@ -153,4 +153,5 @@ wx-app:
|
||||
# 普通用户权益值
|
||||
dl-rights:
|
||||
# 每月发布通告额度
|
||||
addNotice: 3
|
||||
addNotice: 3
|
||||
report: 5
|
@ -24,5 +24,10 @@
|
||||
select id, user_id, from_code, type, title, points, balance, remark, creator, create_time, updater, update_time, del_flag from dl_member_points
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="queryListPage" parameterType="MemberPoints" resultMap="MemberPointsResult">
|
||||
<include refid="selectMemberPointsVo"/>
|
||||
<where>
|
||||
<if test="entity.userId != null"> and user_id = #{entity.userId}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -10,5 +10,7 @@ import org.springframework.stereotype.Component;
|
||||
public class DlRightsConfig {
|
||||
/** 每月发布通告额度 */
|
||||
private Integer addNotice;
|
||||
/** 每日可报名次数上限*/
|
||||
private Integer report;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user