Commit a33627eb authored by 万成波's avatar 万成波

积分模块

parent f1d981da
......@@ -37,6 +37,12 @@
<groupId>com.tangguo</groupId>
<artifactId>safe-campus-moment</artifactId>
</dependency>
<!-- 积分模块 -->
<dependency>
<groupId>com.tangguo</groupId>
<artifactId>safe-campus-points</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -27,7 +27,7 @@ import com.tangguo.common.core.page.TableDataInfo;
*/
@Api(tags="动态评论记录管理")
@RestController
@RequestMapping("/comment/comment")
@RequestMapping("/bbs/moment/comment")
public class BbsMomentCommentController extends BaseController {
@Resource
......
package com.tangguo.controller;
import com.tangguo.common.annotation.Log;
import com.tangguo.common.core.controller.BaseController;
import com.tangguo.common.core.domain.AjaxResult;
import com.tangguo.common.core.page.TableDataInfo;
import com.tangguo.common.enums.BusinessType;
import com.tangguo.domain.BbsPointsGoods;
import com.tangguo.service.IBbsPointsGoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 积分商品Controller
*
* @author ruoyi
* @date 2025-08-28
*/
@Api(tags = "积分商品管理")
@RestController
@RequestMapping("/bbs/moment/goods")
public class BbsPointsGoodsController extends BaseController {
@Resource
private IBbsPointsGoodsService bbsPointsGoodsService;
/**
* 查询积分商品列表
*/
@ApiOperation("查询积分商品列表")
@PreAuthorize("@ss.hasPermi('goods:goods:list')")
@GetMapping("/list")
public TableDataInfo list(BbsPointsGoods bbsPointsGoods) {
startPage();
List<BbsPointsGoods> list = bbsPointsGoodsService.selectBbsPointsGoodsList(bbsPointsGoods);
return getDataTable(list);
}
/**
* 获取积分商品详细信息
*/
@ApiOperation("获取积分商品详细信息")
@PreAuthorize("@ss.hasPermi('goods:goods:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(bbsPointsGoodsService.getById(id));
}
/**
* 新增积分商品
*/
@ApiOperation("新增积分商品")
@PreAuthorize("@ss.hasPermi('goods:goods:add')")
@Log(title = "积分商品", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BbsPointsGoods goods) {
this.bbsPointsGoodsService.addGoods(goods);
return AjaxResult.success();
}
/**
* 修改积分商品
*/
@ApiOperation("修改积分商品")
@PreAuthorize("@ss.hasPermi('goods:goods:edit')")
@Log(title = "积分商品", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BbsPointsGoods goods) {
this.bbsPointsGoodsService.editGoods(goods);
return AjaxResult.success();
}
/**
* 删除积分商品
*/
@ApiOperation("删除积分商品")
@PreAuthorize("@ss.hasPermi('goods:goods:remove')")
@Log(title = "积分商品", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) {
this.bbsPointsGoodsService.deleteGoods(id);
return AjaxResult.success();
}
}
package com.tangguo.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 商品上下架状态
*
* @author 谈笑
* @createTime 2025-08-28 16:32:15 星期四
*/
@Getter
@AllArgsConstructor
public enum ShowStatus {
SJ(1, "上架"), XJ(0, "下架");
private final int status;
private final String desc;
}
package com.tangguo.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tangguo.domain.BbsPointsGoods;
/**
* 积分商品Service接口
*
* @author ruoyi
* @date 2025-08-28
*/
public interface IBbsPointsGoodsService extends IService<BbsPointsGoods> {
/**
* 查询积分商品列表
*
* @param bbsPointsGoods 积分商品
* @return 积分商品集合
*/
List<BbsPointsGoods> selectBbsPointsGoodsList(BbsPointsGoods bbsPointsGoods);
/**
* 添加积分商品
*
* @param goods 积分商品
*/
void addGoods(BbsPointsGoods goods);
/**
* 修改积分商品
*
* @param goods 积分商品
*/
void editGoods(BbsPointsGoods goods);
/**
* 删除积分商品
*
* @param goodsId 积分商品Id
*/
void deleteGoods(Long goodsId);
}
......@@ -111,6 +111,9 @@ public class BbsGradeServiceImpl extends ServiceImpl<BbsGradeMapper, BbsGrade> i
List<BbsGrade> dbGrades = this.list();
for (BbsGrade g : dbGrades) {
if (g.getId().equals(dbGrade.getId())) {
continue;
}
if (!(e1 < g.getMinPoints() || s1 > g.getMaxPoints())) {
throw new ServiceException("修改失败,当前等级积分范围和等级【" + g.getName() + "】积分范围冲突。");
}
......@@ -122,7 +125,7 @@ public class BbsGradeServiceImpl extends ServiceImpl<BbsGradeMapper, BbsGrade> i
updGrade.setSort(grade.getSort());
updGrade.setMinPoints(grade.getMinPoints());
updGrade.setMaxPoints(grade.getMaxPoints());
this.save(updGrade);
this.updateById(updGrade);
}
......
package com.tangguo.service.impl;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tangguo.common.exception.ServiceException;
import com.tangguo.common.utils.StringUtils;
import com.tangguo.domain.BbsPointsGoods;
import com.tangguo.mapper.BbsPointsGoodsMapper;
import com.tangguo.service.IBbsPointsGoodsService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
/**
* 积分商品Service业务层处理
*
* @author ruoyi
* @date 2025-08-28
*/
@Service
public class BbsPointsGoodsServiceImpl extends ServiceImpl<BbsPointsGoodsMapper, BbsPointsGoods> implements IBbsPointsGoodsService {
@Resource
private BbsPointsGoodsMapper bbsPointsGoodsMapper;
/**
* 查询积分商品列表
*
* @param goods 积分商品
* @return 积分商品
*/
@Override
public List<BbsPointsGoods> selectBbsPointsGoodsList(BbsPointsGoods goods) {
LambdaQueryWrapper<BbsPointsGoods> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(BbsPointsGoods::getCreateTime);
lqw.like(StringUtils.isNotBlank(goods.getName()), BbsPointsGoods::getName, goods.getName());
lqw.eq(StringUtils.isNotBlank(goods.getCode()), BbsPointsGoods::getCode, goods.getCode());
lqw.eq(StringUtils.isNotBlank(goods.getImgsUrl()), BbsPointsGoods::getImgsUrl, goods.getImgsUrl());
lqw.eq(goods.getSalesPrice() != null, BbsPointsGoods::getSalesPrice, goods.getSalesPrice());
lqw.eq(goods.getExchangePoints() != null, BbsPointsGoods::getExchangePoints, goods.getExchangePoints());
lqw.eq(goods.getStockNum() != null, BbsPointsGoods::getStockNum, goods.getStockNum());
lqw.eq(goods.getSalesNum() != null, BbsPointsGoods::getSalesNum, goods.getSalesNum());
lqw.eq(goods.getShowStatus() != null, BbsPointsGoods::getShowStatus, goods.getShowStatus());
return bbsPointsGoodsMapper.selectList(lqw);
}
/**
* 添加积分商品
*
* @param goods 积分商品
*/
@Override
public void addGoods(BbsPointsGoods goods) {
long nameCount = this.count(
Wrappers.lambdaQuery(BbsPointsGoods.class).eq(BbsPointsGoods::getName, goods.getName())
);
if (nameCount > 0) {
throw new ServiceException("添加失败,当前商品名称已存在。");
}
BbsPointsGoods addGoods = new BbsPointsGoods();
addGoods.setName(goods.getName());
addGoods.setCode(IdUtil.fastSimpleUUID());
addGoods.setImgsUrl(goods.getImgsUrl());
addGoods.setSalesPrice(goods.getSalesPrice());
addGoods.setExchangePoints(goods.getExchangePoints());
addGoods.setStockNum(goods.getStockNum());
addGoods.setSalesNum(0);
addGoods.setShowStatus(goods.getShowStatus());
this.save(addGoods);
}
/**
* 修改积分商品
*
* @param goods 积分商品
*/
@Override
public void editGoods(BbsPointsGoods goods) {
BbsPointsGoods dbGoods = this.getById(goods.getId());
if (Objects.isNull(dbGoods)) {
throw new ServiceException("修改失败,未查询到当前商品数据。");
}
if (!dbGoods.getName().equals(goods.getName())) {
long nameCount = this.count(
Wrappers.lambdaQuery(BbsPointsGoods.class).eq(BbsPointsGoods::getName, goods.getName())
);
if (nameCount > 0) {
throw new ServiceException("修改失败,当前商品名称已存在。");
}
}
BbsPointsGoods addGoods = new BbsPointsGoods();
addGoods.setId(dbGoods.getId());
addGoods.setName(goods.getName());
addGoods.setImgsUrl(goods.getImgsUrl());
addGoods.setSalesPrice(goods.getSalesPrice());
addGoods.setExchangePoints(goods.getExchangePoints());
addGoods.setStockNum(goods.getStockNum());
addGoods.setShowStatus(goods.getShowStatus());
this.updateById(addGoods);
}
/**
* 删除积分商品
*
* @param goodsId 积分商品Id
*/
@Override
public void deleteGoods(Long goodsId) {
this.removeById(goodsId);
}
}
package com.tangguo.controller;
import com.tangguo.common.annotation.Log;
import com.tangguo.common.core.controller.BaseController;
import com.tangguo.common.core.domain.AjaxResult;
import com.tangguo.common.core.page.TableDataInfo;
import com.tangguo.common.enums.BusinessType;
import com.tangguo.common.utils.poi.ExcelUtil;
import com.tangguo.domain.BbsPointsSetting;
import com.tangguo.service.IBbsPointsSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
* 积分规则配置Controller
*
* @author ruoyi
* @date 2025-08-29
*/
@Api(tags = "积分规则配置管理")
@RestController
@RequestMapping("/points/points")
public class BbsPointsSettingController extends BaseController {
@Resource
private IBbsPointsSettingService bbsPointsSettingService;
/**
* 查询积分规则配置列表
*/
@ApiOperation("查询积分规则配置列表")
@PreAuthorize("@ss.hasPermi('points:points:list')")
@GetMapping("/list")
public TableDataInfo list(BbsPointsSetting bbsPointsSetting) {
startPage();
List<BbsPointsSetting> list = bbsPointsSettingService.selectBbsPointsSettingList(bbsPointsSetting);
return getDataTable(list);
}
/**
* 导出积分规则配置列表
*/
@ApiOperation("导出积分规则配置列表")
@PreAuthorize("@ss.hasPermi('points:points:export')")
@Log(title = "积分规则配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BbsPointsSetting bbsPointsSetting) {
List<BbsPointsSetting> list = bbsPointsSettingService.selectBbsPointsSettingList(bbsPointsSetting);
ExcelUtil<BbsPointsSetting> util = new ExcelUtil<BbsPointsSetting>(BbsPointsSetting.class);
util.exportExcel(response, list, "积分规则配置数据");
}
/**
* 获取积分规则配置详细信息
*/
@ApiOperation("获取积分规则配置详细信息")
@PreAuthorize("@ss.hasPermi('points:points:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(bbsPointsSettingService.getById(id));
}
/**
* 新增积分规则配置
*/
@ApiOperation("新增积分规则配置")
@PreAuthorize("@ss.hasPermi('points:points:add')")
@Log(title = "积分规则配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BbsPointsSetting bbsPointsSetting) {
return toAjax(bbsPointsSettingService.save(bbsPointsSetting));
}
/**
* 修改积分规则配置
*/
@ApiOperation("修改积分规则配置")
@PreAuthorize("@ss.hasPermi('points:points:edit')")
@Log(title = "积分规则配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BbsPointsSetting bbsPointsSetting) {
return toAjax(bbsPointsSettingService.updateById(bbsPointsSetting));
}
/**
* 删除积分规则配置
*/
@ApiOperation("删除积分规则配置")
@PreAuthorize("@ss.hasPermi('points:points:remove')")
@Log(title = "积分规则配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(bbsPointsSettingService.removeByIds(Arrays.asList(ids)));
}
}
package com.tangguo.controller;
import com.tangguo.common.annotation.Log;
import com.tangguo.common.core.controller.BaseController;
import com.tangguo.common.core.domain.AjaxResult;
import com.tangguo.common.core.page.TableDataInfo;
import com.tangguo.common.enums.BusinessType;
import com.tangguo.common.utils.poi.ExcelUtil;
import com.tangguo.domain.BbsUserPoints;
import com.tangguo.service.IBbsUserPointsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
* 用户积分Controller
*
* @author ruoyi
* @date 2025-08-29
*/
@Api(tags = "用户积分管理")
@RestController
@RequestMapping("/points/points")
public class BbsUserPointsController extends BaseController {
@Resource
private IBbsUserPointsService bbsUserPointsService;
/**
* 查询用户积分列表
*/
@ApiOperation("查询用户积分列表")
@PreAuthorize("@ss.hasPermi('points:points:list')")
@GetMapping("/list")
public TableDataInfo list(BbsUserPoints bbsUserPoints) {
startPage();
List<BbsUserPoints> list = bbsUserPointsService.selectBbsUserPointsList(bbsUserPoints);
return getDataTable(list);
}
/**
* 导出用户积分列表
*/
@ApiOperation("导出用户积分列表")
@PreAuthorize("@ss.hasPermi('points:points:export')")
@Log(title = "用户积分", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BbsUserPoints bbsUserPoints) {
List<BbsUserPoints> list = bbsUserPointsService.selectBbsUserPointsList(bbsUserPoints);
ExcelUtil<BbsUserPoints> util = new ExcelUtil<BbsUserPoints>(BbsUserPoints.class);
util.exportExcel(response, list, "用户积分数据");
}
/**
* 获取用户积分详细信息
*/
@ApiOperation("获取用户积分详细信息")
@PreAuthorize("@ss.hasPermi('points:points:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(bbsUserPointsService.getById(id));
}
/**
* 新增用户积分
*/
@ApiOperation("新增用户积分")
@PreAuthorize("@ss.hasPermi('points:points:add')")
@Log(title = "用户积分", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BbsUserPoints bbsUserPoints) {
return toAjax(bbsUserPointsService.save(bbsUserPoints));
}
/**
* 修改用户积分
*/
@ApiOperation("修改用户积分")
@PreAuthorize("@ss.hasPermi('points:points:edit')")
@Log(title = "用户积分", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BbsUserPoints bbsUserPoints) {
return toAjax(bbsUserPointsService.updateById(bbsUserPoints));
}
/**
* 删除用户积分
*/
@ApiOperation("删除用户积分")
@PreAuthorize("@ss.hasPermi('points:points:remove')")
@Log(title = "用户积分", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(bbsUserPointsService.removeByIds(Arrays.asList(ids)));
}
}
package com.tangguo.controller;
import com.tangguo.common.annotation.Log;
import com.tangguo.common.core.controller.BaseController;
import com.tangguo.common.core.domain.AjaxResult;
import com.tangguo.common.core.page.TableDataInfo;
import com.tangguo.common.enums.BusinessType;
import com.tangguo.common.utils.poi.ExcelUtil;
import com.tangguo.domain.BbsUserPointsExchange;
import com.tangguo.service.IBbsUserPointsExchangeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
* 用户积分兑换Controller
*
* @author ruoyi
* @date 2025-08-29
*/
@Api(tags = "用户积分兑换管理")
@RestController
@RequestMapping("/points/points")
public class BbsUserPointsExchangeController extends BaseController {
@Resource
private IBbsUserPointsExchangeService bbsUserPointsExchangeService;
/**
* 查询用户积分兑换列表
*/
@ApiOperation("查询用户积分兑换列表")
@PreAuthorize("@ss.hasPermi('points:points:list')")
@GetMapping("/list")
public TableDataInfo list(BbsUserPointsExchange bbsUserPointsExchange) {
startPage();
List<BbsUserPointsExchange> list = bbsUserPointsExchangeService.selectBbsUserPointsExchangeList(bbsUserPointsExchange);
return getDataTable(list);
}
/**
* 导出用户积分兑换列表
*/
@ApiOperation("导出用户积分兑换列表")
@PreAuthorize("@ss.hasPermi('points:points:export')")
@Log(title = "用户积分兑换", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BbsUserPointsExchange bbsUserPointsExchange) {
List<BbsUserPointsExchange> list = bbsUserPointsExchangeService.selectBbsUserPointsExchangeList(bbsUserPointsExchange);
ExcelUtil<BbsUserPointsExchange> util = new ExcelUtil<BbsUserPointsExchange>(BbsUserPointsExchange.class);
util.exportExcel(response, list, "用户积分兑换数据");
}
/**
* 获取用户积分兑换详细信息
*/
@ApiOperation("获取用户积分兑换详细信息")
@PreAuthorize("@ss.hasPermi('points:points:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(bbsUserPointsExchangeService.getById(id));
}
/**
* 新增用户积分兑换
*/
@ApiOperation("新增用户积分兑换")
@PreAuthorize("@ss.hasPermi('points:points:add')")
@Log(title = "用户积分兑换", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BbsUserPointsExchange bbsUserPointsExchange) {
return toAjax(bbsUserPointsExchangeService.save(bbsUserPointsExchange));
}
/**
* 修改用户积分兑换
*/
@ApiOperation("修改用户积分兑换")
@PreAuthorize("@ss.hasPermi('points:points:edit')")
@Log(title = "用户积分兑换", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BbsUserPointsExchange bbsUserPointsExchange) {
return toAjax(bbsUserPointsExchangeService.updateById(bbsUserPointsExchange));
}
/**
* 删除用户积分兑换
*/
@ApiOperation("删除用户积分兑换")
@PreAuthorize("@ss.hasPermi('points:points:remove')")
@Log(title = "用户积分兑换", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(bbsUserPointsExchangeService.removeByIds(Arrays.asList(ids)));
}
}
package com.tangguo.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tangguo.common.annotation.Excel;
import com.tangguo.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
/**
* 积分规则配置对象 bbs_points_setting
*
* @author ruoyi
* @date 2025-08-29
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("bbs_points_setting")
@ApiModel(value = "BbsPointsSetting", description = "积分规则配置实体")
public class BbsPointsSetting extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
@TableId(type = IdType.AUTO)
@ApiModelProperty("ID")
private Long id;
/** 设置类型:ADD 增加积分、DEC 减少积分 */
@Excel(name = "设置类型:ADD 增加积分、DEC 减少积分")
@ApiModelProperty("设置类型:ADD 增加积分、DEC 减少积分")
private String type;
/** 应用名称 */
@Excel(name = "应用名称")
@ApiModelProperty("应用名称")
private String agentName;
/** 应用ID */
@Excel(name = "应用ID")
@ApiModelProperty("应用ID")
private String agentId;
/** 行为名称 */
@Excel(name = "行为名称")
@ApiModelProperty("行为名称")
private String operateName;
/** 行为编码 */
@Excel(name = "行为编码")
@ApiModelProperty("行为编码")
private String operateCode;
/** 行为积分 */
@Excel(name = "行为积分")
@ApiModelProperty("行为积分")
private Integer operatePoints;
/** 行为上限次数(周) */
@Excel(name = "行为上限次数", readConverterExp = "周=")
@ApiModelProperty("行为上限次数(周)")
private Integer limitCount;
/** 启用状态:0 禁用、1 启用 */
@Excel(name = "启用状态:0 禁用、1 启用")
@ApiModelProperty("启用状态:0 禁用、1 启用")
private Integer enableStatus;
}
package com.tangguo.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tangguo.common.annotation.Excel;
import com.tangguo.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
/**
* 用户积分对象 bbs_user_points
*
* @author ruoyi
* @date 2025-08-29
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("bbs_user_points")
@ApiModel(value = "BbsUserPoints", description = "用户积分实体")
public class BbsUserPoints extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
@TableId(type = IdType.AUTO)
@ApiModelProperty("ID")
private Long id;
/** 用户姓名 */
@Excel(name = "用户姓名")
@ApiModelProperty("用户姓名")
private String nikeName;
/** 用户名 */
@Excel(name = "用户名")
@ApiModelProperty("用户名")
private String userName;
/** 累计积分 */
@Excel(name = "累计积分")
@ApiModelProperty("累计积分")
private Integer accumulatedPoints;
/** 当前积分 */
@Excel(name = "当前积分")
@ApiModelProperty("当前积分")
private Integer currentPoints;
}
package com.tangguo.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tangguo.common.annotation.Excel;
import com.tangguo.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
/**
* 用户积分明细对象 bbs_user_points_detail
*
* @author ruoyi
* @date 2025-08-29
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("bbs_user_points_detail")
@ApiModel(value = "BbsUserPointsDetail", description = "用户积分明细实体")
public class BbsUserPointsDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
@TableId(type = IdType.AUTO)
@ApiModelProperty("ID")
private Long id;
/** 用户名 */
@Excel(name = "用户名")
@ApiModelProperty("用户名")
private String userName;
/** 明细名称 */
@Excel(name = "明细名称")
@ApiModelProperty("明细名称")
private String detailName;
/** 明细编码 */
@Excel(name = "明细编码")
@ApiModelProperty("明细编码")
private String detailCode;
/** 明细积分 */
@Excel(name = "明细积分")
@ApiModelProperty("明细积分")
private Integer detailPoints;
/** 计算前积分 */
@Excel(name = "计算前积分")
@ApiModelProperty("计算前积分")
private Integer beforePoints;
/** 计算后积分 */
@Excel(name = "计算后积分")
@ApiModelProperty("计算后积分")
private Integer afterPoints;
/** 积分明细描述 */
@Excel(name = "积分明细描述")
@ApiModelProperty("积分明细描述")
private String description;
}
......@@ -12,21 +12,19 @@ import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* 积分商品对象 bbs_points_goods
* 用户积分兑换对象 bbs_user_points_exchange
*
* @author ruoyi
* @date 2025-08-28
* @date 2025-08-29
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("bbs_points_goods")
@ApiModel(value = "BbsPointsGoods", description = "积分商品实体")
public class BbsPointsGoods extends BaseEntity {
@TableName("bbs_user_points_exchange")
@ApiModel(value = "BbsUserPointsExchange", description = "用户积分兑换实体")
public class BbsUserPointsExchange extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
......@@ -34,44 +32,39 @@ public class BbsPointsGoods extends BaseEntity {
@ApiModelProperty("ID")
private Long id;
/** 用户姓名 */
@Excel(name = "用户姓名")
@ApiModelProperty("用户姓名")
private String nikeName;
/** 用户名 */
@Excel(name = "用户名")
@ApiModelProperty("用户名")
private String userName;
/** 用户等级名称 */
@Excel(name = "用户等级名称")
@ApiModelProperty("用户等级名称")
private String userGradeName;
/** 商品名称 */
@Excel(name = "商品名称")
@ApiModelProperty("商品名称")
private String name;
private String goodsName;
/** 商品编码 */
@Excel(name = "商品编码")
@ApiModelProperty("商品编码")
private String code;
/** 商品图片地址 */
@Excel(name = "商品图片地址")
@ApiModelProperty("商品图片地址")
private String imgsUrl;
/** 销售价格 */
@Excel(name = "销售价格")
@ApiModelProperty("销售价格")
private BigDecimal salesPrice;
/** 兑换积分 */
@Excel(name = "兑换积分")
@ApiModelProperty("兑换积分")
private Integer exchangePoints;
/** 库存数量 */
@Excel(name = "库存数量")
@ApiModelProperty("库存数量")
private Integer stockNum;
private String goodsCode;
/** 已兑数量 */
@Excel(name = "已兑数量")
@ApiModelProperty("已兑数量")
private Integer salesNum;
/** 商品兑换积分 */
@Excel(name = "商品兑换积分")
@ApiModelProperty("商品兑换积分")
private Integer goodsExchangePoints;
/** 上架状态:0 下架、1 上架 */
@Excel(name = "上架状态:0 下架、1 上架")
@ApiModelProperty("上架状态:0 下架、1 上架")
private Integer showStatus;
/** 用户剩余积分 */
@Excel(name = "用户剩余积分")
@ApiModelProperty("用户剩余积分")
private Integer userRemainingPoints;
}
package com.tangguo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tangguo.domain.BbsPointsSetting;
/**
* 积分规则配置Mapper接口
*
* @author ruoyi
* @date 2025-08-29
*/
public interface BbsPointsSettingMapper extends BaseMapper<BbsPointsSetting> {
}
package com.tangguo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tangguo.domain.BbsUserPointsDetail;
/**
* 用户积分明细Mapper接口
*
* @author ruoyi
* @date 2025-08-29
*/
public interface BbsUserPointsDetailMapper extends BaseMapper<BbsUserPointsDetail> {
}
package com.tangguo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tangguo.domain.BbsUserPointsExchange;
/**
* 用户积分兑换Mapper接口
*
* @author ruoyi
* @date 2025-08-29
*/
public interface BbsUserPointsExchangeMapper extends BaseMapper<BbsUserPointsExchange> {
}
package com.tangguo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tangguo.domain.BbsPointsGoods;
import com.tangguo.domain.BbsUserPoints;
/**
* 积分商品Mapper接口
* 用户积分Mapper接口
*
* @author ruoyi
* @date 2025-08-28
* @date 2025-08-29
*/
public interface BbsPointsGoodsMapper extends BaseMapper<BbsPointsGoods> {
public interface BbsUserPointsMapper extends BaseMapper<BbsUserPoints> {
}
package com.tangguo.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tangguo.domain.BbsPointsSetting;
/**
* 积分规则配置Service接口
*
* @author ruoyi
* @date 2025-08-29
*/
public interface IBbsPointsSettingService extends IService<BbsPointsSetting> {
/**
* 查询积分规则配置列表
*
* @param bbsPointsSetting 积分规则配置
* @return 积分规则配置集合
*/
List<BbsPointsSetting> selectBbsPointsSettingList(BbsPointsSetting bbsPointsSetting);
}
package com.tangguo.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tangguo.domain.BbsUserPointsDetail;
/**
* 用户积分明细Service接口
*
* @author ruoyi
* @date 2025-08-29
*/
public interface IBbsUserPointsDetailService extends IService<BbsUserPointsDetail> {
/**
* 查询用户积分明细列表
*
* @param bbsUserPointsDetail 用户积分明细
* @return 用户积分明细集合
*/
List<BbsUserPointsDetail> selectBbsUserPointsDetailList(BbsUserPointsDetail bbsUserPointsDetail);
}
package com.tangguo.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tangguo.domain.BbsUserPointsExchange;
/**
* 用户积分兑换Service接口
*
* @author ruoyi
* @date 2025-08-29
*/
public interface IBbsUserPointsExchangeService extends IService<BbsUserPointsExchange> {
/**
* 查询用户积分兑换列表
*
* @param bbsUserPointsExchange 用户积分兑换
* @return 用户积分兑换集合
*/
List<BbsUserPointsExchange> selectBbsUserPointsExchangeList(BbsUserPointsExchange bbsUserPointsExchange);
}
package com.tangguo.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tangguo.domain.BbsUserPoints;
/**
* 用户积分Service接口
*
* @author ruoyi
* @date 2025-08-29
*/
public interface IBbsUserPointsService extends IService<BbsUserPoints> {
/**
* 查询用户积分列表
*
* @param bbsUserPoints 用户积分
* @return 用户积分集合
*/
List<BbsUserPoints> selectBbsUserPointsList(BbsUserPoints bbsUserPoints);
}
package com.tangguo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tangguo.domain.BbsPointsSetting;
import com.tangguo.mapper.BbsPointsSettingMapper;
import com.tangguo.service.IBbsPointsSettingService;
import org.springframework.stereotype.Service;
import com.tangguo.common.utils.StringUtils;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 积分规则配置Service业务层处理
*
* @author ruoyi
* @date 2025-08-29
*/
@Service
public class BbsPointsSettingServiceImpl extends ServiceImpl<BbsPointsSettingMapper, BbsPointsSetting> implements IBbsPointsSettingService {
@Resource
private BbsPointsSettingMapper bbsPointsSettingMapper;
/**
* 查询积分规则配置列表
*
* @param bbsPointsSetting 积分规则配置
* @return 积分规则配置
*/
@Override
public List<BbsPointsSetting> selectBbsPointsSettingList(BbsPointsSetting bbsPointsSetting) {
return bbsPointsSettingMapper.selectList(buildQueryWrapper(bbsPointsSetting));
}
private LambdaQueryWrapper<BbsPointsSetting> buildQueryWrapper(BbsPointsSetting query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<BbsPointsSetting> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(BbsPointsSetting::getCreateTime);
lqw.eq(StringUtils.isNotBlank(query.getType()), BbsPointsSetting::getType, query.getType());
lqw.like(StringUtils.isNotBlank(query.getAgentName()), BbsPointsSetting::getAgentName, query.getAgentName());
lqw.eq(StringUtils.isNotBlank(query.getAgentId()), BbsPointsSetting::getAgentId, query.getAgentId());
lqw.like(StringUtils.isNotBlank(query.getOperateName()), BbsPointsSetting::getOperateName, query.getOperateName());
lqw.eq(StringUtils.isNotBlank(query.getOperateCode()), BbsPointsSetting::getOperateCode, query.getOperateCode());
lqw.eq(query.getOperatePoints() != null, BbsPointsSetting::getOperatePoints, query.getOperatePoints());
lqw.eq(query.getLimitCount() != null, BbsPointsSetting::getLimitCount, query.getLimitCount());
lqw.eq(query.getEnableStatus() != null, BbsPointsSetting::getEnableStatus, query.getEnableStatus());
return lqw;
}
}
package com.tangguo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tangguo.domain.BbsUserPointsDetail;
import com.tangguo.mapper.BbsUserPointsDetailMapper;
import com.tangguo.service.IBbsUserPointsDetailService;
import org.springframework.stereotype.Service;
import com.tangguo.common.utils.StringUtils;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
/**
* 用户积分明细Service业务层处理
*
* @author ruoyi
* @date 2025-08-29
*/
@Service
public class BbsUserPointsDetailServiceImpl extends ServiceImpl<BbsUserPointsDetailMapper, BbsUserPointsDetail> implements IBbsUserPointsDetailService {
@Resource
private BbsUserPointsDetailMapper bbsUserPointsDetailMapper;
/**
* 查询用户积分明细列表
*
* @param bbsUserPointsDetail 用户积分明细
* @return 用户积分明细
*/
@Override
public List<BbsUserPointsDetail> selectBbsUserPointsDetailList(BbsUserPointsDetail bbsUserPointsDetail) {
return bbsUserPointsDetailMapper.selectList(buildQueryWrapper(bbsUserPointsDetail));
}
private LambdaQueryWrapper<BbsUserPointsDetail> buildQueryWrapper(BbsUserPointsDetail query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<BbsUserPointsDetail> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(BbsUserPointsDetail::getCreateTime);
lqw.like(StringUtils.isNotBlank(query.getUserName()), BbsUserPointsDetail::getUserName, query.getUserName());
lqw.like(StringUtils.isNotBlank(query.getDetailName()), BbsUserPointsDetail::getDetailName, query.getDetailName());
lqw.eq(StringUtils.isNotBlank(query.getDetailCode()), BbsUserPointsDetail::getDetailCode, query.getDetailCode());
lqw.eq(query.getDetailPoints() != null, BbsUserPointsDetail::getDetailPoints, query.getDetailPoints());
lqw.eq(query.getBeforePoints() != null, BbsUserPointsDetail::getBeforePoints, query.getBeforePoints());
lqw.eq(query.getAfterPoints() != null, BbsUserPointsDetail::getAfterPoints, query.getAfterPoints());
lqw.eq(StringUtils.isNotBlank(query.getDescription()), BbsUserPointsDetail::getDescription, query.getDescription());
return lqw;
}
}
package com.tangguo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tangguo.domain.BbsUserPointsExchange;
import com.tangguo.mapper.BbsUserPointsExchangeMapper;
import com.tangguo.service.IBbsUserPointsExchangeService;
import org.springframework.stereotype.Service;
import com.tangguo.common.utils.StringUtils;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
/**
* 用户积分兑换Service业务层处理
*
* @author ruoyi
* @date 2025-08-29
*/
@Service
public class BbsUserPointsExchangeServiceImpl extends ServiceImpl<BbsUserPointsExchangeMapper, BbsUserPointsExchange> implements IBbsUserPointsExchangeService {
@Resource
private BbsUserPointsExchangeMapper bbsUserPointsExchangeMapper;
/**
* 查询用户积分兑换列表
*
* @param bbsUserPointsExchange 用户积分兑换
* @return 用户积分兑换
*/
@Override
public List<BbsUserPointsExchange> selectBbsUserPointsExchangeList(BbsUserPointsExchange bbsUserPointsExchange) {
return bbsUserPointsExchangeMapper.selectList(buildQueryWrapper(bbsUserPointsExchange));
}
private LambdaQueryWrapper<BbsUserPointsExchange> buildQueryWrapper(BbsUserPointsExchange query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<BbsUserPointsExchange> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(BbsUserPointsExchange::getCreateTime);
lqw.like(StringUtils.isNotBlank(query.getNikeName()), BbsUserPointsExchange::getNikeName, query.getNikeName());
lqw.like(StringUtils.isNotBlank(query.getUserName()), BbsUserPointsExchange::getUserName, query.getUserName());
lqw.like(StringUtils.isNotBlank(query.getUserGradeName()), BbsUserPointsExchange::getUserGradeName, query.getUserGradeName());
lqw.like(StringUtils.isNotBlank(query.getGoodsName()), BbsUserPointsExchange::getGoodsName, query.getGoodsName());
lqw.eq(StringUtils.isNotBlank(query.getGoodsCode()), BbsUserPointsExchange::getGoodsCode, query.getGoodsCode());
lqw.eq(query.getGoodsExchangePoints() != null, BbsUserPointsExchange::getGoodsExchangePoints, query.getGoodsExchangePoints());
lqw.eq(query.getUserRemainingPoints() != null, BbsUserPointsExchange::getUserRemainingPoints, query.getUserRemainingPoints());
return lqw;
}
}
package com.tangguo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tangguo.domain.BbsUserPoints;
import com.tangguo.mapper.BbsUserPointsMapper;
import com.tangguo.service.IBbsUserPointsService;
import org.springframework.stereotype.Service;
import com.tangguo.common.utils.StringUtils;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 用户积分Service业务层处理
*
* @author ruoyi
* @date 2025-08-29
*/
@Service
public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, BbsUserPoints> implements IBbsUserPointsService {
@Resource
private BbsUserPointsMapper bbsUserPointsMapper;
/**
* 查询用户积分列表
*
* @param bbsUserPoints 用户积分
* @return 用户积分
*/
@Override
public List<BbsUserPoints> selectBbsUserPointsList(BbsUserPoints bbsUserPoints) {
return bbsUserPointsMapper.selectList(buildQueryWrapper(bbsUserPoints));
}
private LambdaQueryWrapper<BbsUserPoints> buildQueryWrapper(BbsUserPoints query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<BbsUserPoints> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(BbsUserPoints::getCreateTime);
lqw.like(StringUtils.isNotBlank(query.getNikeName()), BbsUserPoints::getNikeName, query.getNikeName());
lqw.like(StringUtils.isNotBlank(query.getUserName()), BbsUserPoints::getUserName, query.getUserName());
lqw.eq(query.getAccumulatedPoints() != null, BbsUserPoints::getAccumulatedPoints, query.getAccumulatedPoints());
lqw.eq(query.getCurrentPoints() != null, BbsUserPoints::getCurrentPoints, query.getCurrentPoints());
return lqw;
}
}
......@@ -2,8 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tangguo.mapper.BbsPointsGoodsMapper">
<mapper namespace="com.tangguo.mapper.BbsPointsSettingMapper">
</mapper>
<?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.tangguo.mapper.BbsUserPointsDetailMapper">
</mapper>
<?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.tangguo.mapper.BbsUserPointsExchangeMapper">
</mapper>
<?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.tangguo.mapper.BbsUserPointsMapper">
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment