Compare commits
3 Commits
new/v2.0.0
...
9cd9841f09
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cd9841f09 | ||
|
|
f0d4b595f4 | ||
|
|
56203a5895 |
@@ -1,33 +1,58 @@
|
||||
CREATE TABLE `cai_draw_sku_info`
|
||||
CREATE TABLE `cai_prize_info`
|
||||
(
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '子账户ID',
|
||||
`sku_type` tinyint not null comment '奖品类型',
|
||||
`sku_price` bigint(20) not null default 0 comment '奖品价值估算',
|
||||
`sku_name` varchar(255) not null comment '奖品名称',
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '奖品ID',
|
||||
`prize_name` varchar(100) NOT NULL COMMENT '奖品名称',
|
||||
`prize_desc` varchar(500) DEFAULT '' COMMENT '奖品描述',
|
||||
`prize_img` varchar(255) DEFAULT '' COMMENT '奖品图片地址',
|
||||
`win_probability` decimal(5, 4) NOT NULL COMMENT '中奖率(0-1,如0.0100表示1%)',
|
||||
`guarantee_draws` int NOT NULL DEFAULT 0 COMMENT '保底抽数(0表示无保底,谢谢惠顾奖无效)',
|
||||
`min_win_draws` int NOT NULL DEFAULT 0 COMMENT '最低中奖抽数(0表示无限制,谢谢惠顾奖无效)',
|
||||
`stock` int NOT NULL DEFAULT 0 COMMENT '奖品库存(谢谢惠顾奖填0,不校验)',
|
||||
`prize_type` tinyint not null comment '奖品类型 1-谢谢惠顾 2-普通奖 3-大奖',
|
||||
`prize_price` bigint(20) not null default 0 comment '奖品价值估算',
|
||||
`auto_give` tinyint not null default 0 comment '是否自动兑奖',
|
||||
|
||||
|
||||
`usercode` varchar(100) NOT NULL COMMENT '用户',
|
||||
`message` varchar(100) NOT NULL COMMENT '账户明细说明',
|
||||
`action_type` varchar(36) DEFAULT NULL COMMENT '触发来源 1-充值 2-分销 3-抽奖',
|
||||
`tar_user_id` bigint DEFAULT NULL COMMENT '目标ID,用户、抽奖ID',
|
||||
`tar_usercode` varchar(20) DEFAULT NULL COMMENT '目标用户Code,有用户才有用',
|
||||
`tar_name` varchar(255) DEFAULT NULL COMMENT '目标名称,用户名称,抽奖名称',
|
||||
`tar_price` bigint DEFAULT NULL COMMENT '礼物价值',
|
||||
`tar_img` varchar(255) DEFAULT NULL COMMENT '目标提前缓存的',
|
||||
`tar_json` JSON DEFAULT NULL COMMENT '目标额外字段',
|
||||
`change_value` bigint NOT NULL DEFAULT '0.00' COMMENT '变化值,为正 或者为负',
|
||||
`operate_ip` varchar(15) DEFAULT '' COMMENT '操作IP',
|
||||
`is_admin` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否为后台用户手动调整',
|
||||
`trace_link_type` varchar(36) DEFAULT NULL COMMENT '跟踪类型 1-充值 2-分销 3-抽奖',
|
||||
`trace_id` varchar(50) DEFAULT NULL COMMENT '跟踪ID 订单号-礼物ID',
|
||||
`give_flag` tinyint NOT NULL DEFAULT '0' COMMENT '是否兑换',
|
||||
`give_time` datetime comment '兑换时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `user_id` (`user_id`) USING BTREE
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci
|
||||
ROW_FORMAT = DYNAMIC COMMENT ='抽奖奖池';
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='奖品基础表';
|
||||
|
||||
|
||||
CREATE TABLE `cai_prize_online`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '奖品ID',
|
||||
`prize_id` bigint NOT NULL COMMENT '奖品ID',
|
||||
`gender` tinyint(1) NOT NULL DEFAULT '0' COMMENT '性别 1-女 2-男',
|
||||
`prize_name` varchar(100) NOT NULL COMMENT '奖品名称',
|
||||
`prize_desc` varchar(500) DEFAULT '' COMMENT '奖品描述',
|
||||
`prize_img` varchar(255) DEFAULT '' COMMENT '奖品图片地址',
|
||||
`win_probability` decimal(5, 4) NOT NULL COMMENT '中奖率(0-1,如0.0100表示1%)',
|
||||
`guarantee_draws` int NOT NULL DEFAULT 0 COMMENT '保底抽数(0表示无保底,谢谢惠顾奖无效)',
|
||||
`min_win_draws` int NOT NULL DEFAULT 0 COMMENT '最低中奖抽数(0表示无限制,谢谢惠顾奖无效)',
|
||||
`stock` int NOT NULL DEFAULT 0 COMMENT '奖品库存(谢谢惠顾奖填0,不校验)',
|
||||
`prize_type` tinyint not null comment '奖品类型 1-谢谢惠顾 2-普通奖 3-大奖',
|
||||
`prize_price` bigint(20) not null default 0 comment '奖品价值估算',
|
||||
`auto_give` tinyint not null default 0 comment '是否自动兑奖',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='已发布奖品表';
|
||||
|
||||
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values(2003344862891581442, '抽奖奖品', '1738072642014617602', '1', 'prizeInfo', 'cai/prizeInfo/index', 1, 0, 'C', '0', '0', 'cai:prizeInfo:list', '#', 'admin', sysdate(), '', null, '抽奖奖品菜单');
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values(2003344862891581443, '抽奖奖品查询', 2003344862891581442, '1', '#', '', 1, 0, 'F', '0', '0', 'cai:prizeInfo:query', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values(2003344862891581444, '抽奖奖品新增', 2003344862891581442, '2', '#', '', 1, 0, 'F', '0', '0', 'cai:prizeInfo:add', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values(2003344862891581445, '抽奖奖品修改', 2003344862891581442, '3', '#', '', 1, 0, 'F', '0', '0', 'cai:prizeInfo:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values(2003344862891581446, '抽奖奖品删除', 2003344862891581442, '4', '#', '', 1, 0, 'F', '0', '0', 'cai:prizeInfo:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.ruoyi.cai.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.cai.domain.PrizeInfo;
|
||||
import com.ruoyi.cai.service.PrizeInfoService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 抽奖奖品
|
||||
*
|
||||
* @author 77
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cai/prizeInfo")
|
||||
public class PrizeInfoController extends BaseController {
|
||||
|
||||
private final PrizeInfoService prizeInfoService;
|
||||
|
||||
/**
|
||||
* 查询抽奖奖品列表
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<PrizeInfo> list(PrizeInfo bo, PageQuery pageQuery) {
|
||||
Page<PrizeInfo> page = prizeInfoService.page(pageQuery.build(), Wrappers.lambdaQuery(PrizeInfo.class));
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取抽奖奖品详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeInfo:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<PrizeInfo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(prizeInfoService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增抽奖奖品
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeInfo:add")
|
||||
@Log(title = "抽奖奖品", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody PrizeInfo bo) {
|
||||
return toAjax(prizeInfoService.save(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改抽奖奖品
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeInfo:edit")
|
||||
@Log(title = "抽奖奖品", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PrizeInfo bo) {
|
||||
return toAjax(prizeInfoService.updateById(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除抽奖奖品
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeInfo:remove")
|
||||
@Log(title = "抽奖奖品", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(prizeInfoService.removeBatchByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.ruoyi.cai.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.cai.domain.PrizeOnline;
|
||||
import com.ruoyi.cai.service.PrizeOnlineService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 已发布奖品
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cai/prizeOnline")
|
||||
public class PrizeOnlineController extends BaseController {
|
||||
|
||||
private final PrizeOnlineService prizeOnlineService;
|
||||
|
||||
/**
|
||||
* 查询已发布奖品列表
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeOnline:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<PrizeOnline> list(PrizeOnline bo, PageQuery pageQuery) {
|
||||
Page<PrizeOnline> page = prizeOnlineService.page(pageQuery.build(), Wrappers.lambdaQuery(PrizeOnline.class));
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已发布奖品详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeOnline:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<PrizeOnline> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(prizeOnlineService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增已发布奖品
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeOnline:add")
|
||||
@Log(title = "已发布奖品", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody PrizeOnline bo) {
|
||||
return toAjax(prizeOnlineService.save(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改已发布奖品
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeOnline:edit")
|
||||
@Log(title = "已发布奖品", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PrizeOnline bo) {
|
||||
return toAjax(prizeOnlineService.updateById(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除已发布奖品
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("cai:prizeOnline:remove")
|
||||
@Log(title = "已发布奖品", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(prizeOnlineService.removeBatchByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
}
|
||||
75
ruoyi-cai/src/main/java/com/ruoyi/cai/domain/PrizeInfo.java
Normal file
75
ruoyi-cai/src/main/java/com/ruoyi/cai/domain/PrizeInfo.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.ruoyi.cai.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 抽奖奖品对象 cai_prize_info
|
||||
*
|
||||
* @author 77
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
@Data
|
||||
@TableName("cai_prize_info")
|
||||
public class PrizeInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 奖品ID
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 奖品名称
|
||||
*/
|
||||
private String prizeName;
|
||||
/**
|
||||
* 奖品描述
|
||||
*/
|
||||
private String prizeDesc;
|
||||
/**
|
||||
* 奖品图片地址
|
||||
*/
|
||||
private String prizeImg;
|
||||
/**
|
||||
* 中奖率(0-1,如0.0100表示1%)
|
||||
*/
|
||||
private BigDecimal winProbability;
|
||||
/**
|
||||
* 保底抽数(0表示无保底)
|
||||
*/
|
||||
private Long guaranteeDraws;
|
||||
/**
|
||||
* 最低中奖抽数(0表示无限制)
|
||||
*/
|
||||
private Long minWinDraws;
|
||||
/**
|
||||
* 奖品库存(谢谢惠顾奖填0)
|
||||
*/
|
||||
private Long stock;
|
||||
/**
|
||||
* 奖品类型 1-谢谢惠顾 2-普通奖 3-大奖
|
||||
*/
|
||||
private Long prizeType;
|
||||
/**
|
||||
* 奖品价值估算
|
||||
*/
|
||||
private Long prizePrice;
|
||||
/**
|
||||
* 是否自动兑奖
|
||||
*/
|
||||
private Boolean autoGive;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.ruoyi.cai.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 已发布奖品对象 cai_prize_online
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
@Data
|
||||
@TableName("cai_prize_online")
|
||||
public class PrizeOnline implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 奖品ID
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 奖品ID
|
||||
*/
|
||||
private Long prizeId;
|
||||
/**
|
||||
* 性别 1-女 2-男
|
||||
*/
|
||||
private Integer gender;
|
||||
/**
|
||||
* 奖品名称
|
||||
*/
|
||||
private String prizeName;
|
||||
/**
|
||||
* 奖品描述
|
||||
*/
|
||||
private String prizeDesc;
|
||||
/**
|
||||
* 奖品图片地址
|
||||
*/
|
||||
private String prizeImg;
|
||||
/**
|
||||
* 中奖率(0-1,如0.0100表示1%)
|
||||
*/
|
||||
private BigDecimal winProbability;
|
||||
/**
|
||||
* 保底抽数(0表示无保底,谢谢惠顾奖无效)
|
||||
*/
|
||||
private Integer guaranteeDraws;
|
||||
/**
|
||||
* 最低中奖抽数(0表示无限制,谢谢惠顾奖无效)
|
||||
*/
|
||||
private Integer minWinDraws;
|
||||
/**
|
||||
* 奖品库存(谢谢惠顾奖填0,不校验)
|
||||
*/
|
||||
private Long stock;
|
||||
/**
|
||||
* 奖品类型 1-谢谢惠顾 2-普通奖 3-大奖
|
||||
*/
|
||||
private Integer prizeType;
|
||||
/**
|
||||
* 奖品价值估算
|
||||
*/
|
||||
private Long prizePrice;
|
||||
/**
|
||||
* 是否自动兑奖
|
||||
*/
|
||||
private Boolean autoGive;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -19,6 +19,16 @@ public enum GenderEnum {
|
||||
this.defaultAvatar = defaultAvatar;
|
||||
}
|
||||
|
||||
public static boolean isSelect(Integer code){
|
||||
if(GenderEnum.WOMEN.getCode().equals(code)){
|
||||
return true;
|
||||
}
|
||||
if(GenderEnum.MAN.getCode().equals(code)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static GenderEnum getByCode(Integer code){
|
||||
GenderEnum[] values = GenderEnum.values();
|
||||
for (GenderEnum value : values) {
|
||||
|
||||
@@ -62,6 +62,12 @@ public enum SystemConfigEnum {
|
||||
V12_XIAOCHENGXU_ORG_ID("gh_62790d4f9c57", "V12德商小程序原始id",SystemConfigGroupEnum.PAY),
|
||||
V12_XIAOCHENGXU_PATH("pages/zf/index?", "V12德商小程序页面路径",SystemConfigGroupEnum.PAY),
|
||||
V12_WX_APP_ID("wxae39c7eed3221d26", "微信开放平台ID",SystemConfigGroupEnum.PAY),
|
||||
/**
|
||||
* 抽奖和积分
|
||||
*/
|
||||
OPEN_DRAW("1","是否开启积分抽奖",SystemConfigGroupEnum.DRAW,new BooleanSystemConfigCheck()),
|
||||
WOMEN_DRAW_POINT("100","女用户抽奖分数",SystemConfigGroupEnum.DRAW,new NumberSystemConfigCheck()),
|
||||
MEN_DRAW_POINT("100","男用户抽奖分数",SystemConfigGroupEnum.DRAW,new NumberSystemConfigCheck()),
|
||||
/**
|
||||
* 域名配置
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@ public enum SystemConfigGroupEnum {
|
||||
BUSINESS,
|
||||
SECURITY,
|
||||
PAY,
|
||||
DOMAIN
|
||||
DOMAIN,
|
||||
DRAW
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
package com.ruoyi.cai.lottery;
|
||||
|
||||
import com.ruoyi.cai.domain.Account;
|
||||
import com.ruoyi.cai.domain.PointChangeLog;
|
||||
import com.ruoyi.cai.domain.PrizeOnline;
|
||||
import com.ruoyi.cai.domain.User;
|
||||
import com.ruoyi.cai.enums.GenderEnum;
|
||||
import com.ruoyi.cai.enums.SystemConfigEnum;
|
||||
import com.ruoyi.cai.manager.IdManager;
|
||||
import com.ruoyi.cai.manager.SystemConfigManager;
|
||||
import com.ruoyi.cai.service.AccountService;
|
||||
import com.ruoyi.cai.service.PrizeOnlineService;
|
||||
import com.ruoyi.cai.service.UserService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RBucket;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* 抽奖核心服务(优化版)
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class LotteryService {
|
||||
|
||||
// 固定配置
|
||||
private static final Long THANKS_PRIZE_ID = 0L;
|
||||
private static final String USER_DRAW_COUNT_KEY = "user:draw:count:%s";
|
||||
private static final long USER_DRAW_COUNT_EXPIRE = 7 * 24 * 60 * 60; // 用户累计抽数缓存过期时间:7天
|
||||
private static final double RANDOM_MAX = 10000; // 概率放大倍数,提升随机数精度
|
||||
private static final long LOCK_TIMEOUT = 500; // 锁超时时间500ms(非阻塞获取)
|
||||
|
||||
// 每个用户的独立锁:key=userId,value=ReentrantLock
|
||||
private final ConcurrentHashMap<Long, ReentrantLock> userLockMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Autowired
|
||||
private PrizeOnlineService prizeOnlineService;
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
@Autowired
|
||||
private SystemConfigManager systemConfigManager;
|
||||
|
||||
private Integer getDrawPoint(Integer gender){
|
||||
if(GenderEnum.WOMEN.getCode().equals(gender)){
|
||||
Integer womenDrawPoint = systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.WOMEN_DRAW_POINT);
|
||||
return womenDrawPoint;
|
||||
}
|
||||
return systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.MEN_DRAW_POINT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户抽奖(核心方法,优化后)
|
||||
* @param userId 用户ID
|
||||
* @return 中奖奖品
|
||||
*/
|
||||
public PrizeOnline draw(Long userId) {
|
||||
boolean openDraw = systemConfigManager.getSystemConfigOfBool(SystemConfigEnum.OPEN_DRAW);
|
||||
if(!openDraw){
|
||||
throw new ServiceException("暂未开启积分抽奖,请等待活动通知");
|
||||
}
|
||||
User user = userService.getById(userId);
|
||||
if(user == null){
|
||||
throw new ServiceException("用户不存在");
|
||||
}
|
||||
boolean select = GenderEnum.isSelect(user.getGender());
|
||||
if(select){
|
||||
throw new ServiceException("请选择性别后在抽奖");
|
||||
}
|
||||
Account account = accountService.getByUserId(user.getId());
|
||||
Integer drawPoint = getDrawPoint(user.getGender());
|
||||
if(account.getPoints() < drawPoint){
|
||||
throw new ServiceException("积分不足");
|
||||
}
|
||||
ReentrantLock userLock = userLockMap.computeIfAbsent(userId, k -> new ReentrantLock());
|
||||
try {
|
||||
boolean lockAcquired = userLock.tryLock(LOCK_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||
if (!lockAcquired) {
|
||||
log.warn("用户{}抽奖请求太频繁,获取锁失败", userId);
|
||||
throw new ServiceException("您的请求太频繁,请稍后再试");
|
||||
}
|
||||
try {
|
||||
Account accountNew = accountService.getByUserId(user.getId());
|
||||
if(accountNew.getPoints() < drawPoint){
|
||||
throw new ServiceException("积分不足");
|
||||
}
|
||||
PrizeOnline winPrize = doDrawLogic(user,drawPoint);
|
||||
return winPrize;
|
||||
} finally {
|
||||
userLock.unlock();
|
||||
// 6. 清理未使用的锁(防止内存溢出)
|
||||
cleanUnusedLock(userId);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
log.error("用户{}抽奖获取锁被中断", userId, e);
|
||||
Thread.currentThread().interrupt(); // 恢复中断状态
|
||||
throw new ServiceException("抽奖请求处理中,请稍后再试");
|
||||
} catch (Exception e) {
|
||||
log.error("用户{}抽奖失败", userId, e);
|
||||
throw new ServiceException("抽奖失败,请重新刷新页面后在尝试");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实际抽奖逻辑(抽离出来,便于维护)
|
||||
*/
|
||||
private PrizeOnline doDrawLogic(User user,Integer drawPoint) {
|
||||
Long userId = user.getId();
|
||||
// 步骤1:获取用户当前累计抽数(缓存+数据库兜底)
|
||||
int currentContinuousDraws = getContinuousDraws(userId);
|
||||
int newContinuousDraws = currentContinuousDraws + 1;
|
||||
log.info("用户{}当前累计抽数:{},本次抽数:{}", userId, currentContinuousDraws, newContinuousDraws);
|
||||
// 步骤2:获取有效奖品列表(启用状态,排除谢谢惠顾)
|
||||
List<PrizeOnline> validPrizes = prizeOnlineService.selectPrizeOnlineList(user.getGender());
|
||||
if (validPrizes.isEmpty()) {
|
||||
throw new ServiceException("无有效奖品,请刷新页面后再次抽奖");
|
||||
}
|
||||
// 步骤3:执行抽奖规则(保底→最低抽数过滤→概率抽奖)
|
||||
PrizeOnline winPrize = null;
|
||||
// 3.1 保底规则判断(优先触发)
|
||||
winPrize = checkGuaranteeRule(validPrizes, newContinuousDraws);
|
||||
// 3.2 未触发保底,执行概率抽奖(含最低中奖抽数过滤)
|
||||
if (winPrize == null) {
|
||||
winPrize = executeProbabilityDraw(validPrizes, newContinuousDraws);
|
||||
}
|
||||
// 步骤4:处理中奖结果,确定最终奖品ID和累计抽数重置
|
||||
if(winPrize == null){
|
||||
winPrize = new PrizeOnline(); // TODO 谢谢惠顾
|
||||
}
|
||||
// 步骤5:持久化抽奖记录+更新缓存
|
||||
winPrizeAfter(winPrize, user, drawPoint, newContinuousDraws);
|
||||
// 步骤6:返回中奖奖品
|
||||
return winPrize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保底规则判断
|
||||
* @param validPrizes 有效奖品列表
|
||||
* @param currentDraws 当前累计抽数
|
||||
* @return 保底中奖的奖品(无则返回null)
|
||||
*/
|
||||
private PrizeOnline checkGuaranteeRule(List<PrizeOnline> validPrizes, int currentDraws) {
|
||||
// 按保底抽数升序排序,优先触发保底抽数小的奖品
|
||||
validPrizes.sort(Comparator.comparingInt(PrizeOnline::getGuaranteeDraws));
|
||||
for (PrizeOnline prize : validPrizes) {
|
||||
int guaranteeDraws = prize.getGuaranteeDraws();
|
||||
if (guaranteeDraws > 0 && currentDraws >= guaranteeDraws) {
|
||||
log.info("触发保底规则,用户抽中奖品:{}", prize.getPrizeName());
|
||||
return prize;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行概率抽奖(含最低中奖抽数过滤)
|
||||
* @param validPrizes 有效奖品列表
|
||||
* @param currentDraws 当前累计抽数
|
||||
* @return 中奖奖品(无则返回null)
|
||||
*/
|
||||
private PrizeOnline executeProbabilityDraw(List<PrizeOnline> validPrizes, int currentDraws) {
|
||||
// 步骤1:过滤出满足最低中奖抽数的奖品
|
||||
List<PrizeOnline> filterPrizes = filterByMinWinDraws(validPrizes, currentDraws);
|
||||
if (filterPrizes.isEmpty()) {
|
||||
log.info("无满足最低中奖抽数的奖品,返回谢谢惠顾");
|
||||
return null;
|
||||
}
|
||||
// 步骤2:计算奖品的概率总和(放大为整数,提升精度)
|
||||
double totalProbability = 0.0;
|
||||
Map<PrizeOnline, Double> prizeProbMap = new LinkedHashMap<>(); // 保留顺序
|
||||
for (PrizeOnline prize : filterPrizes) {
|
||||
double prob = prize.getWinProbability().doubleValue();
|
||||
if (prob < 0 || prob > 1) {
|
||||
log.warn("奖品{}中奖率{}非法,默认设为0", prize.getPrizeName(), prob);
|
||||
prob = 0.0;
|
||||
}
|
||||
prizeProbMap.put(prize, prob);
|
||||
totalProbability += prob;
|
||||
}
|
||||
|
||||
// 步骤3:若总概率为0,直接返回null
|
||||
if (totalProbability <= 0) {
|
||||
log.info("满足条件的奖品总中奖率为0,返回谢谢惠顾");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 步骤4:生成随机数(放大10000倍,转为整数计算,减少浮点误差)
|
||||
int randomNum = new Random().nextInt((int) (totalProbability * RANDOM_MAX));
|
||||
int currentNum = 0;
|
||||
|
||||
// 步骤5:匹配中奖奖品
|
||||
for (Map.Entry<PrizeOnline, Double> entry : prizeProbMap.entrySet()) {
|
||||
PrizeOnline prize = entry.getKey();
|
||||
double prob = entry.getValue();
|
||||
int probInt = (int) (prob * RANDOM_MAX);
|
||||
currentNum += probInt;
|
||||
if (randomNum < currentNum) {
|
||||
log.info("概率抽奖抽中奖品:{}", prize.getPrizeName());
|
||||
return prize;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤出满足最低中奖抽数的奖品
|
||||
*/
|
||||
private List<PrizeOnline> filterByMinWinDraws(List<PrizeOnline> prizes, int currentDraws) {
|
||||
List<PrizeOnline> filterList = new ArrayList<>();
|
||||
for (PrizeOnline prize : prizes) {
|
||||
if (currentDraws >= prize.getMinWinDraws()) {
|
||||
filterList.add(prize);
|
||||
}
|
||||
}
|
||||
return filterList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户累计抽数(缓存优先,数据库兜底)
|
||||
*/
|
||||
private int getContinuousDraws(Long userId) {
|
||||
String cacheKey = String.format(USER_DRAW_COUNT_KEY, userId);
|
||||
// 1. 从Redis缓存获取
|
||||
RBucket<Integer> bucket = redissonClient.getBucket(cacheKey);
|
||||
Integer cacheCount = bucket.get();
|
||||
if (cacheCount != null) {
|
||||
return cacheCount;
|
||||
}
|
||||
// 2. 缓存未命中,从数据库查询最后一次累计抽数
|
||||
// Integer dbCount = userDrawRecordMapper.selectLastContinuousDraws(userId);
|
||||
Integer dbCount = 0;
|
||||
int finalCount = dbCount == null ? 0 : dbCount;
|
||||
// 3. 存入缓存(设置过期时间)
|
||||
bucket.set(finalCount, USER_DRAW_COUNT_EXPIRE, java.util.concurrent.TimeUnit.SECONDS);
|
||||
return finalCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存抽奖记录(事务控制)
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void winPrizeAfter(PrizeOnline prizeOnline, User user,Integer drawPoint, int continuousDraws) {
|
||||
// 扣减积分
|
||||
String traceId = IdManager.nextIdStr();
|
||||
PointChangeLog pointChangeLog = accountService.drawPoint(prizeOnline, user, drawPoint, traceId);
|
||||
// 记录用户抽奖记录
|
||||
// UserDrawRecord record = new UserDrawRecord();
|
||||
// record.setUserId(userId);
|
||||
// record.setPrizeId(prizeId);
|
||||
// record.setDrawTime(LocalDateTime.now());
|
||||
// record.setContinuousDraws(continuousDraws);
|
||||
// userDrawRecordMapper.insert(record);
|
||||
// 更新缓存
|
||||
String cacheKey = String.format(USER_DRAW_COUNT_KEY, user.getId());
|
||||
RBucket<Integer> bucket = redissonClient.getBucket(cacheKey);
|
||||
bucket.set(continuousDraws, USER_DRAW_COUNT_EXPIRE, java.util.concurrent.TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理长时间未使用的用户锁(可选,防止内存溢出)
|
||||
* 这里简单实现:若锁未被持有,则移除(可根据业务增加时间判断)
|
||||
*/
|
||||
private void cleanUnusedLock(Long userId) {
|
||||
ReentrantLock lock = userLockMap.get(userId);
|
||||
if (lock != null && !lock.isLocked()) {
|
||||
userLockMap.remove(userId);
|
||||
log.debug("清理用户{}的锁", userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.cai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cai.domain.PrizeInfo;
|
||||
|
||||
/**
|
||||
* 抽奖奖品Mapper接口
|
||||
*
|
||||
* @author 77
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
public interface PrizeInfoMapper extends BaseMapper<PrizeInfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.cai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cai.domain.PrizeOnline;
|
||||
|
||||
/**
|
||||
* 已发布奖品Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
public interface PrizeOnlineMapper extends BaseMapper<PrizeOnline> {
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.ruoyi.cai.enums.ConsumeLogType;
|
||||
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
||||
import com.ruoyi.cai.ws.bean.Room;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 用户账户Service接口
|
||||
@@ -31,6 +32,9 @@ public interface AccountService extends IService<Account> {
|
||||
|
||||
void withdrawFail(Long userId, Long incomeCoin, Long traceId);
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
PointChangeLog drawPoint(PrizeOnline prizeOnline, User user, Integer drawPoint, String traceId);
|
||||
|
||||
PointRecordLog rechargePoint(RechargeOrder rechargeOrder, User user);
|
||||
|
||||
void recharge(ConsumeLog consumeLog);
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.ruoyi.cai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cai.domain.PointChangeLog;
|
||||
import com.ruoyi.cai.domain.PrizeOnline;
|
||||
import com.ruoyi.cai.domain.User;
|
||||
|
||||
/**
|
||||
* 积分记录Service接口
|
||||
@@ -18,4 +20,6 @@ public interface PointChangeLogService extends IService<PointChangeLog> {
|
||||
void adminChange(Long userId, Long givePoint);
|
||||
|
||||
void adminInvite(Long userId, Long givePoint, Long inviteUserId, String traceId);
|
||||
|
||||
PointChangeLog drawPoint(PrizeOnline prizeOnline, User user, Integer drawPoint, String traceId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.cai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cai.domain.PrizeInfo;
|
||||
|
||||
/**
|
||||
* 抽奖奖品Service接口
|
||||
*
|
||||
* @author 77
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
public interface PrizeInfoService extends IService<PrizeInfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.cai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cai.domain.PrizeOnline;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 已发布奖品Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
public interface PrizeOnlineService extends IService<PrizeOnline> {
|
||||
|
||||
List<PrizeOnline> selectPrizeOnlineList(Integer gender);
|
||||
}
|
||||
@@ -222,6 +222,17 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Autowired
|
||||
private PointChangeLogService pointChangeLogService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public PointChangeLog drawPoint(PrizeOnline prizeOnline, User user, Integer drawPoint, String traceId){
|
||||
boolean bb = baseMapper.decrPoint(user.getId(), Long.valueOf(drawPoint));
|
||||
if(!bb){
|
||||
throw new ServiceException("积分不足");
|
||||
}
|
||||
PointChangeLog pointChangeLog = pointChangeLogService.drawPoint(prizeOnline, user, drawPoint, traceId);
|
||||
return pointChangeLog;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public PointRecordLog rechargePoint(RechargeOrder rechargeOrder, User user){
|
||||
@@ -229,6 +240,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
return null;
|
||||
}
|
||||
log.info("开始赠送积分 orderNo={}", rechargeOrder.getOrderNo());
|
||||
baseMapper.incrPoint(rechargeOrder.getUserId(), rechargeOrder.getGivePoint());
|
||||
pointChangeLogService.rechargeOrderChange(rechargeOrder.getOrderNo(), rechargeOrder.getUserId(),rechargeOrder.getGivePoint());
|
||||
PointRecordLog pointRecordLog = pointRecordLogService.initOrder(rechargeOrder, user);
|
||||
return pointRecordLog;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.cai.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cai.domain.PointChangeLog;
|
||||
import com.ruoyi.cai.domain.PrizeOnline;
|
||||
import com.ruoyi.cai.domain.User;
|
||||
import com.ruoyi.cai.enums.point.PointChangeLogActionTypeEnum;
|
||||
import com.ruoyi.cai.enums.point.PointChangeTraceTypeEnum;
|
||||
@@ -9,6 +10,7 @@ import com.ruoyi.cai.mapper.AccountMapper;
|
||||
import com.ruoyi.cai.mapper.PointChangeLogMapper;
|
||||
import com.ruoyi.cai.service.PointChangeLogService;
|
||||
import com.ruoyi.cai.service.UserService;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -105,4 +107,21 @@ public class PointChangeLogServiceImpl extends ServiceImpl<PointChangeLogMapper,
|
||||
pointChangeLog.setTraceId(traceId);
|
||||
this.save(pointChangeLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointChangeLog drawPoint(PrizeOnline prizeOnline, User user, Integer drawPoint, String traceId) {
|
||||
PointChangeLog pointChangeLog = new PointChangeLog();
|
||||
pointChangeLog.setActionType(PointChangeLogActionTypeEnum.USE.getCode());
|
||||
pointChangeLog.setUserId(user.getId());
|
||||
pointChangeLog.setUsercode(user.getUsercode());
|
||||
String message = String.format("抽中【%s】", prizeOnline.getPrizeName());
|
||||
pointChangeLog.setMessage(message);
|
||||
pointChangeLog.setChangeValue(Long.valueOf(drawPoint));
|
||||
pointChangeLog.setOperateIp(ServletUtils.getClientIP());
|
||||
pointChangeLog.setIsAdmin(false);
|
||||
pointChangeLog.setTraceLinkType(PointChangeTraceTypeEnum.USE.getCode());
|
||||
pointChangeLog.setTraceId(traceId);
|
||||
this.save(pointChangeLog);
|
||||
return pointChangeLog;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class PointRecordLogServiceImpl extends ServiceImpl<PointRecordLogMapper,
|
||||
if(!pointRecordLog.getOneJoin()){
|
||||
return;
|
||||
}
|
||||
pointChangeLogService.adminInvite(pointRecordLog.getOneUserId(),pointRecordLog.getOnePoints(),pointRecordLog.getSourceUserId(),traceId);
|
||||
pointChangeLogService.rechargeOrderInviteChange(pointRecordLog.getOneUserId(),pointRecordLog.getOnePoints(),pointRecordLog.getSourceUserId(),traceId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.cai.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cai.domain.PrizeInfo;
|
||||
import com.ruoyi.cai.mapper.PrizeInfoMapper;
|
||||
import com.ruoyi.cai.service.PrizeInfoService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 抽奖奖品Service业务层处理
|
||||
*
|
||||
* @author 77
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class PrizeInfoServiceImpl extends ServiceImpl<PrizeInfoMapper,PrizeInfo> implements PrizeInfoService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.cai.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cai.domain.PrizeOnline;
|
||||
import com.ruoyi.cai.mapper.PrizeOnlineMapper;
|
||||
import com.ruoyi.cai.service.PrizeOnlineService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 已发布奖品Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-12-23
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class PrizeOnlineServiceImpl extends ServiceImpl<PrizeOnlineMapper,PrizeOnline> implements PrizeOnlineService {
|
||||
|
||||
@Override
|
||||
public List<PrizeOnline> selectPrizeOnlineList(Integer gender){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class RechargeOrderServiceImpl extends ServiceImpl<RechargeOrderMapper,Re
|
||||
consumeLog.setType(ConsumeLogType.RECHARGE.getCode());
|
||||
consumeLog.setAmount(rechargeOrder.getRechargeCoin());
|
||||
accountService.recharge(consumeLog);
|
||||
PointRecordLog pointRecordLog = accountService.rechargePoint(rechargeOrder, user);
|
||||
PointRecordLog pointRecordLog = accountService.rechargePoint(rechargeOrder, user); // 处理充值积分
|
||||
RechargeConsumerResp resp = new RechargeConsumerResp();
|
||||
resp.setSuccess(true);
|
||||
resp.setConsumeLogId(consumeLog.getId());
|
||||
|
||||
@@ -39,9 +39,7 @@ public class PayTrdV14Service implements PayTrdService {
|
||||
v14PayResp.setPrice(payOrderInfoDTO.getPrice());
|
||||
v14PayResp.setSubject(payOrderInfoDTO.getSubject());
|
||||
v14PayResp.setOrderNo(payOrderInfoDTO.getOrderNo());
|
||||
String notifyUrl = payTrdConfig.getNotifyUrl();
|
||||
String api = notifyUrl.replace("https://", "").replace("http://", "");
|
||||
v14PayResp.setApi(api);
|
||||
v14PayResp.setApi("apidjwklqw.mvsdiv.cn");
|
||||
return PayReturnResp.createEfps(v14PayResp);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class LoginLogByFileUtil {
|
||||
private static final String LOG_FILE_PATH = "/home/server/api/logs/sys-console.log";
|
||||
private static final int COMMAND_TIMEOUT_MS = 5000;
|
||||
private static final int COMMAND_TIMEOUT_MS = 9000;
|
||||
private static final Charset LOG_FILE_CHARSET = StandardCharsets.UTF_8; // 确认日志为UTF-8编码
|
||||
private static final int MAX_LOG_LINES = 10;
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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.ruoyi.cai.mapper.PrizeInfoMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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.ruoyi.cai.mapper.PrizeOnlineMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user