54 Commits

Author SHA1 Message Date
37d92b9dea feat:
1. fix bugs
2026-02-15 11:44:03 +08:00
6d85686270 feat:
1. fix bugs
2026-02-15 11:38:22 +08:00
0656cabe4a feat:
1. fix bugs
2026-02-15 11:30:52 +08:00
d3e09b1cb9 feat:
1. fix bugs
2026-02-15 11:28:00 +08:00
lzqadmin
72a8a318cf 1 2026-02-15 00:42:32 +08:00
lzqadmin
943aa3842a 修改划拨福利包接口名 2026-02-15 00:39:34 +08:00
lzqadmin
25da381c4e 1 2026-02-15 00:29:50 +08:00
lzqadmin
0e06403528 后台excel批量划拨用户福利包优化提示 2026-02-15 00:25:15 +08:00
88a0a5616b feat:
1. add lottery
2026-02-15 00:05:34 +08:00
9a086b86cd feat:
1. add lottery
2026-02-14 22:51:10 +08:00
f5746394fa feat:
1. add lottery
2026-02-14 22:47:51 +08:00
lzqadmin
d4e2bed039 后台excel批量划拨用户福利包 2026-02-14 22:24:22 +08:00
16a9bcfbd8 feat:
1. add lottery
2026-02-14 22:00:02 +08:00
9674374fad feat:
1. add lottery
2026-02-14 21:42:38 +08:00
lzqadmin
8be8964eff 新增抽奖枚举 2026-02-14 20:13:07 +08:00
lzqadmin
2af46a38b1 获取省市区列表-修改提示文案 2026-02-14 19:32:49 +08:00
lzqadmin
e2e9b18503 福利积分 , 现金券 , 佣金流水接口 2026-02-14 17:19:58 +08:00
e1105dae89 feat:
1. add lottery
2026-02-14 16:31:51 +08:00
lzqadmin
f5a9d171e0 兑换福利包 2026-02-14 16:04:04 +08:00
a3752fe7b9 update:
1. update user-point
2026-02-14 14:17:20 +08:00
lzqadmin
5ef97c4da7 地址regionsInfoId 改 regionsId 2026-02-14 13:29:51 +08:00
lzqadmin
d82d91aec5 将积分流水中sourceType改成varchar(256), 新建线下业务模块枚举 2026-02-14 13:15:20 +08:00
lzqadmin
a123ea05e8 佣金账户 2026-02-14 12:24:36 +08:00
lzqadmin
7a429deb99 线上未执行sql , 用户消息 , 用户积分, 佣金账户 , 福利包每日结算 2026-02-14 11:25:58 +08:00
lzqadmin
8530f424c9 整理执行sql文件 2026-02-14 11:11:54 +08:00
lzqadmin
667dc58dc1 common_user_address 建表语句 2026-02-14 10:58:47 +08:00
lzqadmin
884075d3f2 兑换福利包接口更换名字 2026-02-13 23:51:53 +08:00
lzqadmin
5857fe4171 1 2026-02-13 23:47:34 +08:00
lzqadmin
9436ea8942 1 2026-02-13 23:29:54 +08:00
lzqadmin
bd58fd716a 1 2026-02-13 23:02:50 +08:00
lzqadmin
0a2d1a1f32 福利包每日产出, market用户兑换福利包 2026-02-13 23:00:26 +08:00
7fc365ce4c update:
1. update user-point
2026-02-13 21:13:24 +08:00
54a61ec5d5 update:
1. update user-point
2026-02-13 21:08:56 +08:00
c3e3139100 update:
1. update benefit-point
2026-02-13 20:57:25 +08:00
2536dc9528 update:
1. update benefit-point
2026-02-13 20:49:02 +08:00
81db304e16 update:
1. fix bugs
2026-02-13 20:35:12 +08:00
lzqadmin
4582db201a 1 2026-02-13 19:16:31 +08:00
lzqadmin
90928754d9 后台划拨福利积分: 用户到用户 2026-02-13 19:14:58 +08:00
lzqadmin
8ba9609276 将福利积分, 现金券, 福利包移动至 market 2026-02-13 18:45:34 +08:00
2bccdd7177 update:
1. fix bugs
2026-02-13 17:35:40 +08:00
eddfc26a45 feat:
1. 用户积分查询
2026-02-13 15:35:04 +08:00
lzqadmin
b2839ed1d5 积分流水-业务类型修订 2026-02-13 13:44:05 +08:00
lzqadmin
a1ebf5b065 1 2026-02-13 13:34:17 +08:00
lzqadmin
df88450bab 用户积分 , 佣金账号 2026-02-13 13:32:43 +08:00
a8693e77cc feat:
1. notice module
2026-02-12 16:54:18 +08:00
0b6e90acb7 Merge remote-tracking branch 'origin/main' 2026-02-12 15:51:45 +08:00
c3bbf9073a feat:
1. notice module
2026-02-12 15:51:30 +08:00
lzqadmin
64ad185fc4 佣金账户和用户积分修正 2026-02-12 15:42:43 +08:00
28f13a5db3 feat:
1. notice module
2026-02-12 15:29:24 +08:00
a6782b4fa1 feat:
1. notice module
2026-02-12 15:09:31 +08:00
lzqadmin
5344c76cac 用户消息和收货地址菜单 2026-02-12 15:05:39 +08:00
b92b1eaf2c feat:
1. notice module
2026-02-12 14:41:17 +08:00
lzqadmin
7f941fab86 佣金账户 2026-02-12 14:35:04 +08:00
bb7ddf9779 feat:
1. notice module
2026-02-12 14:22:44 +08:00
288 changed files with 13960 additions and 1956 deletions

View File

@@ -0,0 +1,5 @@
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787265, 2019338015981219841, 'userNotice', '用户通知', 'menu', '/common/commonUserNotice', 'iconfont iconicon_voipphone', 1, 1, 0, 1, '', '', 0);
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787266, 2020763647899787265, 'userNotice_add', '新增', 'add', '/common/commonUserNotice/add', 'plus', 1, 2, 1, 1, null, null, 0);
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787267, 2020763647899787265, 'userNotice_edit', '修改', 'edit', '/common/commonUserNotice/edit', 'form', 2, 2, 2, 1, null, null, 0);
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787268, 2020763647899787265, 'userNotice_delete', '删除', 'delete', '/common/notice/remove', 'delete', 3, 2, 3, 1, null, null, 0);
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787269, 2020763647899787265, 'userNotice_view', '查看', 'view', '/common/commonUserNotice/view', 'file-text', 4, 2, 2, 1, null, null, 0);

File diff suppressed because it is too large Load Diff

View File

@@ -1,249 +0,0 @@
--- 福利积分 benefit_point
DROP TABLE IF EXISTS benefit_point;
create table benefit_point
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table benefit_point is '用户福利值表';
comment on column benefit_point.id is '主键';
comment on column benefit_point.amount is '金额';
comment on column benefit_point.version is '版本号';
comment on column benefit_point.create_user is '创建人';
comment on column benefit_point.create_dept is '创建部门';
comment on column benefit_point.create_time is '创建时间';
comment on column benefit_point.update_user is '修改人';
comment on column benefit_point.update_time is '修改时间';
comment on column benefit_point.status is '状态';
comment on column benefit_point.is_deleted is '是否已删除';
alter table benefit_point
owner to yicha1lu;
DROP TABLE IF EXISTS benefit_point_log;
create table benefit_point_log
(
id int8 not null primary key,
user_id int8,
user_phone int8,
user_name varchar(128),
amount decimal(14, 2) default 0,
source_id int8,
user_pack_id int8,
source_detail text,
order_id int8,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index inx_umbl_uid
on benefit_point_log (is_complete, user_id , statistical_date , type);
comment on table benefit_point_log is '用户福利值流水表';
comment on column benefit_point_log.id is '主键';
comment on column benefit_point_log.user_id is '用户id';
comment on column benefit_point_log.user_phone is '用户手机号';
comment on column benefit_point_log.user_name is '用户名称';
comment on column benefit_point_log.amount is '金额';
comment on column benefit_point_log.source_id is '来源id';
comment on column benefit_point_log.user_pack_id is '用户积分包id';
comment on column benefit_point_log.source_detail is '来源详情';
comment on column benefit_point_log.order_id is '订单id';
comment on column benefit_point_log.type is '消费类型 1-收入 2-支出';
comment on column benefit_point_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column benefit_point_log.statistical_date is '统计时间';
comment on column benefit_point_log.remark is '备注';
comment on column benefit_point_log.create_user is '创建人';
comment on column benefit_point_log.create_dept is '创建部门';
comment on column benefit_point_log.create_time is '创建时间';
comment on column benefit_point_log.update_user is '修改人';
comment on column benefit_point_log.update_time is '修改时间';
comment on column benefit_point_log.status is '状态';
comment on column benefit_point_log.is_deleted is '是否已删除';
alter table benefit_point_log
owner to yicha1lu;
--- 现金券 cash_coupon
DROP TABLE IF EXISTS cash_coupon;
create table cash_coupon
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table cash_coupon is '用户现金券表';
comment on column cash_coupon.id is '主键';
comment on column cash_coupon.amount is '面额';
comment on column cash_coupon.version is '版本号';
comment on column cash_coupon.create_user is '创建人';
comment on column cash_coupon.create_dept is '创建部门';
comment on column cash_coupon.create_time is '创建时间';
comment on column cash_coupon.update_user is '修改人';
comment on column cash_coupon.update_time is '修改时间';
comment on column cash_coupon.status is '状态';
comment on column cash_coupon.is_deleted is '是否已删除';
alter table cash_coupon
owner to yicha1lu;
DROP TABLE IF EXISTS cash_coupon_log;
create table cash_coupon_log
(
id int8 not null primary key,
user_id int8,
user_phone int8,
user_name varchar(128),
amount decimal(14, 2) default 0,
source_id int8,
source_detail text,
order_id int8,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index inx_umcl_uid
on cash_coupon_log (is_complete, user_id , statistical_date , type);
comment on table cash_coupon_log is '用户现金券流水表';
comment on column cash_coupon_log.id is '主键';
comment on column cash_coupon_log.user_id is '用户id';
comment on column cash_coupon_log.user_phone is '用户手机号';
comment on column cash_coupon_log.user_name is '用户名称';
comment on column cash_coupon_log.amount is '金额';
comment on column cash_coupon_log.source_id is '来源id';
comment on column cash_coupon_log.source_detail is '来源详情';
comment on column cash_coupon_log.order_id is '订单id';
comment on column cash_coupon_log.type is '消费类型 1-收入 2-支出';
comment on column cash_coupon_log.statistical_date is '统计时间';
comment on column cash_coupon_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column cash_coupon_log.remark is '备注';
comment on column cash_coupon_log.create_user is '创建人';
comment on column cash_coupon_log.create_dept is '创建部门';
comment on column cash_coupon_log.create_time is '创建时间';
comment on column cash_coupon_log.update_user is '修改人';
comment on column cash_coupon_log.update_time is '修改时间';
comment on column cash_coupon_log.status is '状态';
comment on column cash_coupon_log.is_deleted is '是否已删除';
alter table cash_coupon_log
owner to yicha1lu;
--- 用户积分 user_point
DROP TABLE IF EXISTS user_point;
create table user_point
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table user_point is '用户商城积分表';
comment on column user_point.amount is '面额';
comment on column user_point.version is '版本号';
comment on column user_point.create_user is '创建人';
comment on column user_point.create_dept is '创建部门';
comment on column user_point.create_time is '创建时间';
comment on column user_point.update_user is '修改人';
comment on column user_point.update_time is '修改时间';
comment on column user_point.is_deleted is '是否已删除';
alter table user_point
owner to yicha1lu;
DROP TABLE IF EXISTS user_point_log;
create table user_point_log
(
id int8 not null primary key,
user_id int8,
user_phone int8,
user_name varchar(128),
amount decimal(14, 2) default 0,
source_id int8,
source_detail text,
order_id int8,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index inx_uapl_uid
on user_point_log (is_complete, user_id , statistical_date , type);
comment on table user_point_log is '用户商城积分流水表';
comment on column user_point_log.id is '主键';
comment on column user_point_log.user_id is '用户id';
comment on column user_point_log.user_phone is '用户手机号';
comment on column user_point_log.user_name is '用户名称';
comment on column user_point_log.amount is '金额';
comment on column user_point_log.source_id is '来源id';
comment on column user_point_log.source_detail is '来源详情';
comment on column user_point_log.order_id is '订单id';
comment on column user_point_log.type is '消费类型 1-收入 2-支出';
comment on column user_point_log.statistical_date is '统计时间';
comment on column user_point_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column user_point_log.remark is '备注';
comment on column user_point_log.create_user is '创建人';
comment on column user_point_log.create_dept is '创建部门';
comment on column user_point_log.create_time is '创建时间';
comment on column user_point_log.update_user is '修改人';
comment on column user_point_log.update_time is '修改时间';
comment on column user_point_log.status is '状态';
comment on column user_point_log.is_deleted is '是否已删除';
alter table user_point_log
owner to yicha1lu;

View File

@@ -28,6 +28,7 @@ package org.springblade;
import org.springblade.common.constant.CommonConstant; import org.springblade.common.constant.CommonConstant;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
@@ -39,6 +40,7 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
@EnableScheduling @EnableScheduling
@EnableRedisHttpSession @EnableRedisHttpSession
@SpringBootApplication @SpringBootApplication
@EnableRetry //重试机制
public class Application { public class Application {
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -0,0 +1,28 @@
package org.springblade.common.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.ThreadPoolExecutor;
@Configuration
@EnableAsync
public class AsyncConfiguration {
// 通知类:短信、邮件、站内信
@Bean("notificationExecutor")
public ThreadPoolTaskExecutor notificationExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(6);
executor.setMaxPoolSize(12);
executor.setQueueCapacity(200);
executor.setThreadNamePrefix("notify-");
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.initialize();
return executor;
}
}

View File

@@ -0,0 +1,26 @@
package org.springblade.common.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
paginationInterceptor.setDbType(DbType.POSTGRE_SQL);
// 可选:设置最大单页限制(防止恶意请求)
paginationInterceptor.setMaxLimit(1000L);
interceptor.addInnerInterceptor(paginationInterceptor);
// 2. 乐观锁插件
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return interceptor;
}
}

View File

@@ -0,0 +1,7 @@
package org.springblade.common.exception;
public class OptimisticLockException extends RuntimeException{
public OptimisticLockException(String message) {
super(message);
}
}

View File

@@ -0,0 +1,192 @@
package org.springblade.job.processor;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.modules.market.eums.MarketBusinessModule;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
import org.springblade.modules.market.pojo.entity.MarketPackageDailySettlementEntity;
import org.springblade.modules.market.service.IMarketBenefitPackageService;
import org.springblade.modules.market.service.IMarketBenefitPointLogService;
import org.springblade.modules.market.service.IMarketBenefitPointService;
import org.springblade.modules.market.service.IMarketPackageDailySettlementService;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
import tech.powerjob.worker.log.OmsLogger;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 福利包每日发放福利积分到用户
*/
@Slf4j
@Component
@AllArgsConstructor
public class BenefitPackageSendPointProcessor implements BasicProcessor {
private final IMarketBenefitPackageService userBenefitPackageService;
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
private final IMarketBenefitPointService benefitPointService;
private final IMarketBenefitPointLogService benefitPointLogService;
@Override
public ProcessResult process(TaskContext context) {
OmsLogger omsLogger = context.getOmsLogger();
try {
omsLogger.info("开始执行定时任务-发放福利积分");
benefitPackageSendPoint();
omsLogger.info("结束执行定时任务-发放福利积分");
} catch (Exception e) {
log.error("任务执行异常", e);
omsLogger.error("任务执行异常: {}", e.getMessage());
return new ProcessResult(false, "系统异常: " + e.getMessage());
}
// 返回结果,该结果会被持久化到数据库,在前端页面直接查看,极为方便
return new ProcessResult(true, "result is success");
}
public void benefitPackageSendPoint() {
// 1. 查询待处理的结算任务
List<MarketPackageDailySettlementEntity> settlementEntityList = userPackageDailySettlementService.list(
Wrappers.lambdaQuery(MarketPackageDailySettlementEntity.class)
.eq(MarketPackageDailySettlementEntity::getStatisticalDate, DateUtil.getToday())
.eq(MarketPackageDailySettlementEntity::getIsComplete, 0)
);
if (settlementEntityList.isEmpty()) {
return; // 提前退出,避免无谓查询
}
// 2. 查询所有状态为“进行中”的福利包
List<MarketBenefitPackageEntity> userBenefitPackageList = userBenefitPackageService.list(
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
.eq(MarketBenefitPackageEntity::getStatus, 2)
);
// 3. 按用户分组(注意:这里创建的是新 List,但后续仍需包装)
Map<Long, List<MarketBenefitPackageEntity>> benefitPackageMap = userBenefitPackageList.stream()
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
// 4. 处理每个结算任务
for (MarketPackageDailySettlementEntity settlementEntity : settlementEntityList) {
Long userId = settlementEntity.getUserId();
List<MarketBenefitPackageEntity> originalList = benefitPackageMap.get(userId);
if (originalList.isEmpty()) {
continue;
}
// 关键:创建可变副本,避免不可变列表问题
List<MarketBenefitPackageEntity> benefitPackageList = new ArrayList<>(originalList);
// 获取用户积分账户
MarketBenefitPointEntity benefitPoint = benefitPointService.getById(userId);
if (benefitPoint == null) {
log.warn("用户积分账户不存在,userId: {}", userId);
continue;
}
BigDecimal lastAmount = benefitPoint.getAmount();
List<MarketBenefitPointLogEntity> pointLogList = new ArrayList<>();
// 处理每个福利包
for (MarketBenefitPackageEntity pkg : benefitPackageList) {
BigDecimal amountOut = pkg.getAmountOut();
BigDecimal amountTotal = pkg.getAmountTotal();
BigDecimal amountDay = pkg.getAmountDay();
// 修正:防止超额发放
BigDecimal newAmountOut = amountOut.add(amountDay);
if (newAmountOut.compareTo(amountTotal) > 0) {
amountDay = amountTotal.subtract(amountOut); // 只发剩余部分
newAmountOut = amountTotal;
pkg.setStatus(3); // 完成
}
// 处理天数
int outDay = pkg.getOutDay() + 1;
if (outDay >= pkg.getDayTotal()) {
outDay = pkg.getDayTotal();
pkg.setStatus(3); // 完成
}
// 记录日志
pointLogList.add(new MarketBenefitPointLogEntity()
.setUserId(userId)
.setAmount(amountDay)
.setLastAmount(lastAmount)
.setFee(BigDecimal.ZERO)
.setSourceType(MarketBusinessModule.BENEFIT_PACKAGE.getCode())
.setSourceId(pkg.getId())
.setSourceDetail(JSONObject.toJSONString(pkg))
.setIsComplete(0)
.setStatisticalDate(new Date())
.setRemark(pkg.getPackageName() + "每日福利积分产出")
);
lastAmount = lastAmount.add(amountDay);
// 更新福利包状态
pkg.setAmountOut(newAmountOut);
pkg.setOutDay(outDay);
}
// 批量保存日志
if (!pointLogList.isEmpty()) {
if (!benefitPointLogService.saveBatch(pointLogList)) {
log.error("福利积分记录失败-批量保存日志, userId: " + userId);
throw new RuntimeException("福利积分记录失败, userId: " + userId);
}
// 标记日志为完成
pointLogList.forEach(log -> log.setIsComplete(1));
benefitPointLogService.updateBatchById(pointLogList);
// 累加总发放积分
BigDecimal sendPoint = pointLogList.stream()
.map(MarketBenefitPointLogEntity::getAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 更新用户积分总额
benefitPoint.setAmount(benefitPoint.getAmount().add(sendPoint));
if (!benefitPointService.updateById(benefitPoint)) {
log.error("更新用户积分失败-更新福利积分, userId: " + userId);
throw new RuntimeException("更新用户积分失败, userId: " + userId);
}
// 更新福利包(使用可变列表)
if (!userBenefitPackageService.updateBatchById(benefitPackageList)) {
log.error("更新福利包失败-更新福利包, userId: " + userId);
throw new RuntimeException("更新福利包失败, userId: " + userId);
}
}
// 更新结算任务
List<Long> packageIds = benefitPackageList.stream()
.map(MarketBenefitPackageEntity::getId)
.collect(Collectors.toList());
settlementEntity.setIsComplete(1);
settlementEntity.setPackageId(packageIds);
userPackageDailySettlementService.updateById(settlementEntity);
}
}
}

View File

@@ -0,0 +1,94 @@
package org.springblade.job.processor;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
import org.springblade.modules.market.pojo.entity.MarketPackageDailySettlementEntity;
import org.springblade.modules.market.service.IMarketBenefitPackageService;
import org.springblade.modules.market.service.IMarketPackageDailySettlementService;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
import tech.powerjob.worker.log.OmsLogger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 福利包每日发放结算记录
*/
@Slf4j
@Component
@AllArgsConstructor
public class InitBenefitPackageSettlementProcessor implements BasicProcessor {
private final IMarketBenefitPackageService userBenefitPackageService;
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
@Override
public ProcessResult process(TaskContext context) {
OmsLogger omsLogger = context.getOmsLogger(); // PowerJob 内置日志,控制台可查
try {
omsLogger.info("开始执行定时任务-初始化用户福利包每天结算记录...");
initUserPackageDailySettlement();
omsLogger.info("结束执行定时任务-初始化用户福利包每天结算记录");
} catch (Exception e) {
log.error("任务执行异常", e);
omsLogger.error("任务执行异常: {}", e.getMessage());
return new ProcessResult(false, "系统异常: " + e.getMessage());
}
// 返回结果,该结果会被持久化到数据库,在前端页面直接查看,极为方便
return new ProcessResult(true, "result is success");
}
public void initUserPackageDailySettlement() {
//用户福利包列表
List<MarketBenefitPackageEntity> benefitPackageList = userBenefitPackageService.list(
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
.eq(MarketBenefitPackageEntity::getStatus, 2)
);
//用户福利包列表-map
Map<Long, List<MarketBenefitPackageEntity>> benefitPackageMap = benefitPackageList.stream().collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
//用户当天发放福利积分记录列表
List<MarketPackageDailySettlementEntity> settlementEntityList = userPackageDailySettlementService.list(
Wrappers.lambdaQuery(MarketPackageDailySettlementEntity.class)
.eq(MarketPackageDailySettlementEntity::getStatisticalDate, DateUtil.getToday())
);
//用户当天发放福利积分记录列表-map
Map<Long, List<MarketPackageDailySettlementEntity>> settlementEntityMap = settlementEntityList.stream().collect(Collectors.groupingBy(MarketPackageDailySettlementEntity::getUserId));
List<MarketPackageDailySettlementEntity> userPackageSettlementList = new ArrayList<>();
benefitPackageMap.forEach((userId, packageList) -> {
if (!settlementEntityMap.containsKey(userId)){
userPackageSettlementList.add(
new MarketPackageDailySettlementEntity()
.setUserId(userId)
.setUserName(packageList.get(0).getUserName())
.setAccount(packageList.get(0).getPhone())
.setStatisticalDate(DateUtil.getToday())
.setPackageId(List.of())
.setIsComplete(0)
);
}
});
userPackageDailySettlementService.saveBatch(userPackageSettlementList);
}
}

View File

@@ -0,0 +1,80 @@
package org.springblade.job.processor;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
import org.springblade.modules.market.pojo.entity.MarketCashCouponEntity;
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
import org.springblade.modules.market.pojo.entity.MarketUserCommissionEntity;
import org.springblade.modules.market.service.IMarketBenefitPointService;
import org.springblade.modules.market.service.IMarketCashCouponService;
import org.springblade.modules.market.service.IMarketInfoService;
import org.springblade.modules.market.service.IMarketUserCommissionService;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
import java.util.List;
@Component
@AllArgsConstructor
public class InitUserAssetsProcessor implements BasicProcessor {
private final IUserService userService;
private final IMarketInfoService marketInfoService;
private final ICommonUserPointService userPointService;
private final IMarketCashCouponService cashCouponService;
private final IMarketBenefitPointService benefitPointService;
private final IMarketUserCommissionService commissionService;
@Override
public ProcessResult process(TaskContext taskContext) throws Exception {
List<User> userList = userService.list(Wrappers.<User>lambdaQuery().eq(User::getUserType, 2).eq(User::getIsDeleted, 0));
userList.forEach(user -> {
MarketInfoEntity marketInfo = marketInfoService.getById(user.getId());
if (marketInfo == null) {
marketInfo = new MarketInfoEntity();
marketInfo.setId(user.getId());
marketInfoService.save(marketInfo);
}
CommonUserPointEntity userPoint = userPointService.getById(user.getId());
if (userPoint == null) {
userPoint = new CommonUserPointEntity();
userPoint.setId(user.getId());
userPointService.save(userPoint);
}
MarketCashCouponEntity cashCoupon = cashCouponService.getById(user.getId());
if (cashCoupon == null) {
cashCoupon = new MarketCashCouponEntity();
cashCoupon.setId(user.getId());
cashCouponService.save(cashCoupon);
}
MarketBenefitPointEntity benefitPoint = benefitPointService.getById(user.getId());
if (benefitPoint == null) {
benefitPoint = new MarketBenefitPointEntity();
benefitPoint.setId(user.getId());
benefitPointService.save(benefitPoint);
}
MarketUserCommissionEntity commission = commissionService.getById(user.getId());
if (commission == null) {
commission = new MarketUserCommissionEntity();
commission.setId(user.getId());
commissionService.save(commission);
}
});
return new ProcessResult(true, "result is success");
}
}

View File

@@ -43,8 +43,8 @@ public class APPCommonController {
@GetMapping("/region-list") @GetMapping("/region-list")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@Operation(summary = "获取省市区列表") @Operation(summary = "获取省市区列表")
public R<List<AppCommonRegionsInfoVO>> findRegionList(@RequestParam @Min(value = 0 , message = "父级id不能小于0") Long pid , public R<List<AppCommonRegionsInfoVO>> findRegionList(@RequestParam @Min(value = 0 , message = "请选择有效地区") Long pid ,
@RequestParam @Min(value = 1 , message = "只能选到省") @Max(value = 4 , message = "只能选到街道") Integer level) { @RequestParam @Min(value = 1 , message = "请选择省、市、区或街道") @Max(value = 4 , message = "请选择省、市、区或街道") Integer level) {
return R.data(commonRegionsInfoService.findRegionList(pid , level)); return R.data(commonRegionsInfoService.findRegionList(pid , level));
} }

View File

@@ -10,18 +10,15 @@ import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.modules.api.request.CreateOrderRequest; import org.springblade.modules.api.request.*;
import org.springblade.modules.api.request.PaymentRequest;
import org.springblade.modules.api.response.CreateOrderResponse; import org.springblade.modules.api.response.CreateOrderResponse;
import org.springblade.modules.api.response.PaymentResponse; import org.springblade.modules.api.response.PaymentResponse;
import org.springblade.modules.api.vo.CommonUserNoticeApiVO; import org.springblade.modules.api.vo.*;
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO; import org.springblade.modules.common.service.*;
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
import org.springblade.modules.common.service.ICommonUserOrderService;
import org.springblade.modules.common.service.ICommonUserNoticeService;
import org.springblade.modules.system.service.IUserService; import org.springblade.modules.system.service.IUserService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
@Hidden @Hidden
@@ -37,6 +34,14 @@ public class APPUserController {
private final ICommonUserNoticeService userNoticeService; private final ICommonUserNoticeService userNoticeService;
private final ICommonUserAddressService addressService;
private final ICommonUserPointService pointService;
private final ICommonLotteryRecordService lotteryRecordService;
private final ICommonLotteryPrizeService lotteryPrizeService;
/** /**
* 是否修改过密码 * 是否修改过密码
@@ -99,6 +104,16 @@ public class APPUserController {
return R.data(pages); return R.data(pages);
} }
/**
* 用户订单列表
*/
@GetMapping("/order-detail")
@ApiOperationSupport(order = 6)
@Operation(summary = "用户订单分页列表")
public R<CommonUserOrderDetailApiVO> orderDetail(Long id) {
return R.data(orderService.orderDetail(id));
}
@GetMapping("/system-notice") @GetMapping("/system-notice")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@@ -124,6 +139,7 @@ public class APPUserController {
return R.data(userNoticeService.userNoticeDetail(id)); return R.data(userNoticeService.userNoticeDetail(id));
} }
@GetMapping("/unread") @GetMapping("/unread")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
@Operation(summary = "用户未读消息数量") @Operation(summary = "用户未读消息数量")
@@ -131,4 +147,71 @@ public class APPUserController {
return R.data(userNoticeService.appUnreadNoticeNum()); return R.data(userNoticeService.appUnreadNoticeNum());
} }
@GetMapping("/user-address")
@ApiOperationSupport(order = 11)
@Operation(summary = "用户收货地址", description = "传入userAddressVO")
public R<List<CommonUserAddressApiVO>> addressList(Query query) {
return R.data(addressService.selectAddressList(Condition.getPage(query), new CommonUserAddressApiVO()));
}
@PostMapping("/submit-address")
@ApiOperationSupport(order = 12)
@Operation(summary = "提交用户收货地址", description = "传入AddressSubmitRequest")
public R<Boolean> submitAddress(@Valid @RequestBody AddressSubmitRequest request) {
return R.status(addressService.submitAddress(request));
}
@DeleteMapping("/delete-address")
@ApiOperationSupport(order = 13)
@Operation(summary = "删除用户收货地址", description = "传入id")
public R<Boolean> removeAddress(@Valid @RequestBody AddressRemoveRequest request) {
return R.status(addressService.removeAddress(request.getIds()));
}
@GetMapping("/user-points")
@ApiOperationSupport(order = 14)
@Operation(summary = "用户积分查询")
public R<BigDecimal> userPoints() {
return R.data(pointService.queryPoint());
}
@GetMapping("/lottery-prizes")
@ApiOperationSupport(order = 15)
@Operation(summary = "奖品列表")
public R<List<CommonLotteryPrizeApiVO>> lotteryPrizes() {
return R.data(lotteryPrizeService.staticList());
}
@GetMapping("/lottery-records")
@ApiOperationSupport(order = 16)
@Operation(summary = "抽奖记录")
public R<IPage<CommonLotteryRecordApiVO>> lotteryRecords(Query query) {
return R.data(lotteryRecordService.selectLotteryRecordApiPage(Condition.getPage(query), new CommonLotteryRecordApiVO()));
}
@PostMapping("/lottery-draw")
@ApiOperationSupport(order = 17)
@Operation(summary = "用户抽奖", description = "传入LotteriesDrawRequest")
public R<CommonLotteryPrizeApiVO> draw(@Valid @RequestBody LotteryDrawRequest request) {
return R.data(lotteryPrizeService.draw(request));
}
@GetMapping("/lottery-rules")
@ApiOperationSupport(order = 18)
@Operation(summary = "抽奖规则")
public R<String> lotteryRules() {
return R.data(lotteryPrizeService.rules());
}
@GetMapping("/lottery-winners")
@ApiOperationSupport(order = 19)
@Operation(summary = "获奖名单")
public R<List<CommonLotteryWinnerApiVO>> lotteryWinners() {
return R.data(lotteryRecordService.lotteryWinners());
}
} }

View File

@@ -11,13 +11,12 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.modules.api.vo.CommonUserNoticeApiVO; import org.springblade.modules.api.request.AcquireBenefitPackageRequest;
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO; import org.springblade.modules.api.vo.*;
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
import org.springblade.modules.common.service.ICommonUserNoticeService; import org.springblade.modules.common.service.ICommonUserNoticeService;
import org.springblade.modules.market.manager.MarketUserManager; import org.springblade.modules.market.manager.MarketUserManager;
import org.springblade.modules.api.vo.MarketBenefitPackageVO; import org.springblade.modules.market.manager.MarketUserPointManager;
import org.springblade.modules.userPackage.service.IUserMarketBenefitPackageService; import org.springblade.modules.market.service.IMarketBenefitPackageService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@@ -29,12 +28,14 @@ import java.util.List;
@Tag(name = "APP福利包接口", description = "APP福利包接口") @Tag(name = "APP福利包接口", description = "APP福利包接口")
public class MarketUserController { public class MarketUserController {
private final IUserMarketBenefitPackageService userMarketBenefitPackageService; private final IMarketBenefitPackageService userMarketBenefitPackageService;
private final MarketUserManager marketUserManager; private final MarketUserManager marketUserManager;
private final ICommonUserNoticeService userNoticeService; private final ICommonUserNoticeService userNoticeService;
private final MarketUserPointManager marketUserPointManager;
@GetMapping("/package-list") @GetMapping("/package-list")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@@ -85,8 +86,9 @@ public class MarketUserController {
return R.data(userNoticeService.userNoticeDetail(id)); return R.data(userNoticeService.userNoticeDetail(id));
} }
@GetMapping("/unread-num")
@ApiOperationSupport(order = 6) @GetMapping("/unread")
@ApiOperationSupport(order = 7)
@Operation(summary = "Market用户未读消息数量") @Operation(summary = "Market用户未读消息数量")
public R<Long> unreadNum() { public R<Long> unreadNum() {
return R.data(userNoticeService.marketUnreadNoticeNum()); return R.data(userNoticeService.marketUnreadNoticeNum());
@@ -94,5 +96,47 @@ public class MarketUserController {
@GetMapping("/benefit-package")
@ApiOperationSupport(order = 8)
@Operation(summary = "福利包列表")
public R<List<MarketPackageTemplateVO>> benefitPackageList() {
return R.data(marketUserManager.benefitPackageList());
}
@PostMapping("/acquire-benefit-package")
@ApiOperationSupport(order = 9)
@Operation(summary = "兑换福利包", description = "传入acquireBenefitPackageRequest")
public R<Boolean> acquireBenefitPackage(@RequestBody AcquireBenefitPackageRequest request) {
return R.status(marketUserManager.acquireBenefitPackage(request));
}
@GetMapping("/user-assets")
@ApiOperationSupport(order = 10)
@Operation(summary = "用户资产查询")
public R<UserAssetsApiVO> userAssets() {
return R.data(marketUserManager.userAssets());
}
@GetMapping("/benefit-point-log")
@ApiOperationSupport(order = 11)
@Operation(summary = "福利积分流水")
public R<IPage<MarketUserBenefitPointLogVO>> benefitPointLogList(Query query , MarketUserBenefitPointLogVO benefitPointLogVO) {
return R.data(marketUserPointManager.benefitPointLogList(Condition.getPage(query) , benefitPointLogVO));
}
@GetMapping("/cash-coupon-log")
@ApiOperationSupport(order = 12)
@Operation(summary = "现金券流水")
public R<IPage<MarketUserCashCouponLogVO>> cashCouponLogList(Query query , MarketUserCashCouponLogVO cashCouponLogVO) {
return R.data(marketUserPointManager.cashCouponLogList(Condition.getPage(query) , cashCouponLogVO));
}
@GetMapping("/user-commission-log")
@ApiOperationSupport(order = 13)
@Operation(summary = "用户佣金流水")
public R<IPage<MarketUserCommissionLogVO>> userCommissionLogList(Query query , MarketUserCommissionLogVO userCommissionLogVO) {
return R.data(marketUserPointManager.userCommissionLogList(Condition.getPage(query) , userCommissionLogVO));
}
} }

View File

@@ -0,0 +1,15 @@
package org.springblade.modules.api.request;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@Accessors(chain = true)
public class AcquireBenefitPackageRequest implements Serializable {
@NotNull(message = "请选择要兑换的福利包")
private Long packId;
}

View File

@@ -0,0 +1,16 @@
package org.springblade.modules.api.request;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class AddressRemoveRequest implements Serializable {
@NotEmpty(message = "至少选择一条地址")
private List<Long> ids;
}

View File

@@ -0,0 +1,29 @@
package org.springblade.modules.api.request;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serializable;
@Data
public class AddressSubmitRequest implements Serializable {
private Long id;
@NotNull(message = "请选择地区")
private Integer regionsId;
@NotEmpty(message = "详细地址必填")
private String detail;
@NotEmpty(message = "联系人必填")
private String consignee;
@NotEmpty(message = "手机号必填")
private String phone;
@NotNull(message = "是否默认必选")
private Integer isDefault;
}

View File

@@ -0,0 +1,15 @@
package org.springblade.modules.api.request;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class LotteryDrawRequest implements Serializable {
@NotNull(message = "无效积分")
private BigDecimal amount;
}

View File

@@ -0,0 +1,16 @@
package org.springblade.modules.api.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
@Data
@AllArgsConstructor
public class CommonLotteryPrizeApiVO implements Serializable {
private Long id;
private String prizeName;
}

View File

@@ -0,0 +1,20 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CommonLotteryRecordApiVO implements Serializable {
private Long id;
private String prizeName;
private BigDecimal pointsUsed;
private Date createTime;
}

View File

@@ -0,0 +1,16 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CommonLotteryWinnerApiVO implements Serializable {
private String prizeName;
private String account;
private String username;
}

View File

@@ -0,0 +1,56 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CommonUserAddressApiVO implements Serializable {
private Long id;
private Long regionsInfoId;
private String province;
private String city;
private String district;
private String street;
private String detail;
private String consignee;
private String phone;
private Integer isDefault;
}

View File

@@ -38,7 +38,7 @@ public class CommonUserNoticeApiVO implements Serializable {
private Long id; private Long id;
private Integer moduleType; private String moduleType;
/** /**
* 是否已读 0-否 1-是 * 是否已读 0-否 1-是
*/ */
@@ -48,6 +48,8 @@ public class CommonUserNoticeApiVO implements Serializable {
*/ */
private String title; private String title;
private String content;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;

View File

@@ -13,7 +13,7 @@ public class CommonUserNoticeDetailApiVO implements Serializable {
private Long id; private Long id;
private Integer moduleType; private String moduleType;
private String title; private String title;

View File

@@ -11,36 +11,18 @@ public class CommonUserOrderApiVO implements Serializable {
private Long id; private Long id;
private String consigneePhone;
private String consignee;
private String orderType; private String orderType;
private String itemCode;
private String itemName; private String itemName;
private String imageUrl; private String imageUrl;
private Integer quantity; private Integer quantity;
private String deliveryAddress;
private String expressCompany;
private String expressNo;
private Integer orderStatus; private Integer orderStatus;
private BigDecimal totalAmount; private BigDecimal totalAmount;
private BigDecimal actualAmount; private BigDecimal actualAmount;
private Integer paymentType;
private Date paymentTime;
private Integer paymentStatus;
} }

View File

@@ -0,0 +1,46 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CommonUserOrderDetailApiVO implements Serializable {
private Long id;
private String consigneePhone;
private String consignee;
private String orderType;
private String itemCode;
private String itemName;
private String imageUrl;
private Integer quantity;
private String deliveryAddress;
private String expressCompany;
private String expressNo;
private Integer orderStatus;
private BigDecimal totalAmount;
private BigDecimal actualAmount;
private Integer paymentType;
private Date paymentTime;
private Integer paymentStatus;
}

View File

@@ -0,0 +1,31 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springblade.core.tool.utils.StringPool;
import java.io.Serializable;
@Data
@Accessors(chain = true)
public class FullRegionInfoVO implements Serializable {
private Integer currentLevel = -1;
private String street = StringPool.EMPTY;
private String district = StringPool.EMPTY;
private String city = StringPool.EMPTY;
private String province = StringPool.EMPTY;
private Long streetId = -1L;
private Long districtId = -1L;
private Long cityId = -1L;
private Long provinceId = -1L;
}

View File

@@ -0,0 +1,54 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 用户积分包信息表 视图实体类
*
* @author BladeX
* @since 2026-02-05
*/
@Data
public class MarketPackageTemplateVO implements Serializable {
private Long id;
private String packageName;
/**
* 最大购买数量
*/
private Integer userLimit;
/**
* 全网最大兑换数量
*/
private Integer maxLimit;
/**
* 产出总天数
*/
private Integer dayLimit;
/**
* 总产出福利积分
*/
private BigDecimal benefitPointAmount;
/**
* 购买赠与福利值
*/
private BigDecimal benefitValueAmount;
/**
* 兑换包需要的福利积分
*/
private BigDecimal benefitPointPrice;
/**
* 兑换包需要的现金券
*/
private BigDecimal cashCouponPrice;
/**
* 已兑换数量
*/
private Integer exchangedQuantity;
}

View File

@@ -0,0 +1,52 @@
package org.springblade.modules.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户福利值流水表 实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@Accessors(chain = true)
public class MarketUserBenefitPointLogVO implements Serializable {
/**
* 金额
*/
private BigDecimal amount;
/**
* 上一笔金额
*/
private BigDecimal lastAmount;
/**
* 手续费
*/
private BigDecimal fee;
/**
* 消费类型 1-收入 2-支出
*/
private Integer type;
/**
* 统计时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date statisticalDate;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,52 @@
package org.springblade.modules.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户福利值流水表 实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@Accessors(chain = true)
public class MarketUserCashCouponLogVO implements Serializable {
/**
* 金额
*/
private BigDecimal amount;
/**
* 上一笔金额
*/
private BigDecimal lastAmount;
/**
* 手续费
*/
private BigDecimal fee;
/**
* 消费类型 1-收入 2-支出
*/
private Integer type;
/**
* 统计时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date statisticalDate;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,52 @@
package org.springblade.modules.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户福利值流水表 实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@Accessors(chain = true)
public class MarketUserCommissionLogVO implements Serializable {
/**
* 金额
*/
private BigDecimal amount;
/**
* 上一笔金额
*/
private BigDecimal lastAmount;
/**
* 手续费
*/
private BigDecimal fee;
/**
* 消费类型 1-收入 2-支出
*/
private Integer type;
/**
* 统计时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date statisticalDate;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,17 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class UserAssetsApiVO implements Serializable {
private BigDecimal withdrawableBalance; // 可提现余额
private BigDecimal benefitPoints; // 福利积分
private BigDecimal cashCouponAmount; // 现金券数量(或 List<CashCoupon>)
}

View File

@@ -0,0 +1,136 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import org.springblade.modules.common.wrapper.CommonLotteryPrizeWrapper;
import org.springblade.modules.common.service.ICommonLotteryPrizeService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 奖品配置表 控制器
*
* @author RayLiu
* @since 2026-02-14
*/
@RestController
@AllArgsConstructor
@RequestMapping("blade-lotteryprize/lotteryPrize")
@Tag(name = "奖品配置表", description = "奖品配置表接口")
public class CommonLotteryPrizeController extends BladeController {
private final ICommonLotteryPrizeService lotteryPrizeService;
/**
* 奖品配置表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入lotteryPrize")
public R<CommonLotteryPrizeVO> detail(CommonLotteryPrizeEntity lotteryPrize) {
CommonLotteryPrizeEntity detail = lotteryPrizeService.getOne(Condition.getQueryWrapper(lotteryPrize));
return R.data(CommonLotteryPrizeWrapper.build().entityVO(detail));
}
/**
* 奖品配置表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入lotteryPrize")
public R<IPage<CommonLotteryPrizeVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> lotteryPrize, Query query) {
IPage<CommonLotteryPrizeEntity> pages = lotteryPrizeService.page(Condition.getPage(query), Condition.getQueryWrapper(lotteryPrize, CommonLotteryPrizeEntity.class));
return R.data(CommonLotteryPrizeWrapper.build().pageVO(pages));
}
/**
* 奖品配置表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入lotteryPrize")
public R<IPage<CommonLotteryPrizeVO>> page(CommonLotteryPrizeVO lotteryPrize, Query query) {
IPage<CommonLotteryPrizeVO> pages = lotteryPrizeService.selectLotteryPrizePage(Condition.getPage(query), lotteryPrize);
return R.data(pages);
}
/**
* 奖品配置表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入lotteryPrize")
public R save(@Valid @RequestBody CommonLotteryPrizeEntity lotteryPrize) {
return R.status(lotteryPrizeService.save(lotteryPrize));
}
/**
* 奖品配置表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入lotteryPrize")
public R update(@Valid @RequestBody CommonLotteryPrizeEntity lotteryPrize) {
return R.status(lotteryPrizeService.updateById(lotteryPrize));
}
/**
* 奖品配置表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入lotteryPrize")
public R submit(@Valid @RequestBody CommonLotteryPrizeEntity lotteryPrize) {
return R.status(lotteryPrizeService.saveOrUpdate(lotteryPrize));
}
/**
* 奖品配置表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(lotteryPrizeService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,161 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import org.springblade.modules.common.excel.CommonLotteryRecordExcel;
import org.springblade.modules.common.wrapper.CommonLotteryRecordWrapper;
import org.springblade.modules.common.service.ICommonLotteryRecordService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/**
* 抽奖记录表 控制器
*
* @author RayLiu
* @since 2026-02-14
*/
@RestController
@AllArgsConstructor
@RequestMapping("blade-lotteryprize/lotteryRecord")
@Tag(name = "抽奖记录表", description = "抽奖记录表接口")
public class CommonLotteryRecordController extends BladeController {
private final ICommonLotteryRecordService lotteryRecordService;
/**
* 抽奖记录表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入lotteryRecord")
public R<CommonLotteryRecordVO> detail(CommonLotteryRecordEntity lotteryRecord) {
CommonLotteryRecordEntity detail = lotteryRecordService.getOne(Condition.getQueryWrapper(lotteryRecord));
return R.data(CommonLotteryRecordWrapper.build().entityVO(detail));
}
/**
* 抽奖记录表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入lotteryRecord")
public R<IPage<CommonLotteryRecordVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> lotteryRecord, Query query) {
IPage<CommonLotteryRecordEntity> pages = lotteryRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(lotteryRecord, CommonLotteryRecordEntity.class));
return R.data(CommonLotteryRecordWrapper.build().pageVO(pages));
}
/**
* 抽奖记录表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入lotteryRecord")
public R<IPage<CommonLotteryRecordVO>> page(CommonLotteryRecordVO lotteryRecord, Query query) {
IPage<CommonLotteryRecordVO> pages = lotteryRecordService.selectLotteryRecordPage(Condition.getPage(query), lotteryRecord);
return R.data(pages);
}
/**
* 抽奖记录表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入lotteryRecord")
public R save(@Valid @RequestBody CommonLotteryRecordEntity lotteryRecord) {
return R.status(lotteryRecordService.save(lotteryRecord));
}
/**
* 抽奖记录表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入lotteryRecord")
public R update(@Valid @RequestBody CommonLotteryRecordEntity lotteryRecord) {
return R.status(lotteryRecordService.updateById(lotteryRecord));
}
/**
* 抽奖记录表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入lotteryRecord")
public R submit(@Valid @RequestBody CommonLotteryRecordEntity lotteryRecord) {
return R.status(lotteryRecordService.saveOrUpdate(lotteryRecord));
}
/**
* 抽奖记录表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(lotteryRecordService.deleteLogic(Func.toLongList(ids)));
}
/**
* 导出数据
*/
@IsAdmin
@GetMapping("/export-lotteryRecord")
@ApiOperationSupport(order = 9)
@Operation(summary = "导出数据", description = "传入lotteryRecord")
public void exportLotteryRecord(@Parameter(hidden = true) @RequestParam Map<String, Object> lotteryRecord, BladeUser bladeUser, HttpServletResponse response) {
QueryWrapper<CommonLotteryRecordEntity> queryWrapper = Condition.getQueryWrapper(lotteryRecord, CommonLotteryRecordEntity.class);
//if (!AuthUtil.isAdministrator()) {
// queryWrapper.lambda().eq(LotteryRecord::getTenantId, bladeUser.getTenantId());
//}
//queryWrapper.lambda().eq(LotteryRecordEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<CommonLotteryRecordExcel> list = lotteryRecordService.exportLotteryRecord(queryWrapper);
ExcelUtil.export(response, "抽奖记录表数据" + DateUtil.time(), "抽奖记录表数据表", list, CommonLotteryRecordExcel.class);
}
}

View File

@@ -32,6 +32,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springblade.core.redis.debounce.RedisDebounce;
import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin; import org.springblade.core.secure.annotation.IsAdmin;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
@@ -164,7 +165,7 @@ public class CommonUserOrderController extends BladeController {
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@Operation(summary = "确认收款", description = "传入order") @Operation(summary = "确认收款", description = "传入order")
public R confirmPayment(@Valid @RequestBody CommonUserOrderEntity order) { public R confirmPayment(@Valid @RequestBody CommonUserOrderEntity order) {
return R.status(orderService.confirmPayment(order)); return R.status(orderService.confirmPayment(order.getId()));
} }

View File

@@ -0,0 +1,118 @@
package org.springblade.modules.common.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
import org.springblade.modules.common.wrapper.CommonUserPointWrapper;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/**
* 用户商城积分表 控制器
*
* @author BladeX
* @since 2026-02-12
*/
@RestController
@AllArgsConstructor
@RequestMapping("/common/user-point")
@Tag(name = "用户商城积分表", description = "用户商城积分表接口")
public class CommonUserPointController extends BladeController {
private final ICommonUserPointService commonUserPointService;
/**
* 用户商城积分表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonUserPoint")
public R<CommonUserPointVO> detail(CommonUserPointEntity commonUserPoint) {
CommonUserPointEntity detail = commonUserPointService.getOne(Condition.getQueryWrapper(commonUserPoint));
return R.data(CommonUserPointWrapper.build().entityVO(detail));
}
/**
* 用户商城积分表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonUserPoint")
public R<IPage<CommonUserPointVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonUserPoint, Query query) {
IPage<CommonUserPointEntity> pages = commonUserPointService.page(Condition.getPage(query), Condition.getQueryWrapper(commonUserPoint, CommonUserPointEntity.class));
return R.data(CommonUserPointWrapper.build().pageVO(pages));
}
/**
* 用户商城积分表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonUserPoint")
public R<IPage<CommonUserPointVO>> page(CommonUserPointVO commonUserPoint, Query query) {
IPage<CommonUserPointVO> pages = commonUserPointService.selectCommonUserPointPage(Condition.getPage(query), commonUserPoint);
return R.data(pages);
}
/**
* 用户商城积分表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonUserPoint")
public R save(@Valid @RequestBody CommonUserPointEntity commonUserPoint) {
return R.status(commonUserPointService.save(commonUserPoint));
}
/**
* 用户商城积分表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonUserPoint")
public R update(@Valid @RequestBody CommonUserPointEntity commonUserPoint) {
return R.status(commonUserPointService.updateById(commonUserPoint));
}
/**
* 用户商城积分表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonUserPoint")
public R submit(@Valid @RequestBody CommonUserPointEntity commonUserPoint) {
return R.status(commonUserPointService.saveOrUpdate(commonUserPoint));
}
/**
* 用户商城积分表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(commonUserPointService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,118 @@
package org.springblade.modules.common.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
import org.springblade.modules.common.wrapper.CommonUserPointLogWrapper;
import org.springblade.modules.common.service.ICommonUserPointLogService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/**
* 用户商城积分流水表 控制器
*
* @author BladeX
* @since 2026-02-12
*/
@RestController
@AllArgsConstructor
@RequestMapping("/common/user-point-log")
@Tag(name = "用户商城积分流水表", description = "用户商城积分流水表接口")
public class CommonUserPointLogController extends BladeController {
private final ICommonUserPointLogService commonUserPointLogService;
/**
* 用户商城积分流水表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonUserPointLog")
public R<CommonUserPointLogVO> detail(CommonUserPointLogEntity commonUserPointLog) {
CommonUserPointLogEntity detail = commonUserPointLogService.getOne(Condition.getQueryWrapper(commonUserPointLog));
return R.data(CommonUserPointLogWrapper.build().entityVO(detail));
}
/**
* 用户商城积分流水表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonUserPointLog")
public R<IPage<CommonUserPointLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonUserPointLog, Query query) {
IPage<CommonUserPointLogEntity> pages = commonUserPointLogService.page(Condition.getPage(query), Condition.getQueryWrapper(commonUserPointLog, CommonUserPointLogEntity.class));
return R.data(CommonUserPointLogWrapper.build().pageVO(pages));
}
/**
* 用户商城积分流水表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonUserPointLog")
public R<IPage<CommonUserPointLogVO>> page(CommonUserPointLogVO commonUserPointLog, Query query) {
IPage<CommonUserPointLogVO> pages = commonUserPointLogService.selectCommonUserPointLogPage(Condition.getPage(query), commonUserPointLog);
return R.data(pages);
}
/**
* 用户商城积分流水表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonUserPointLog")
public R save(@Valid @RequestBody CommonUserPointLogEntity commonUserPointLog) {
return R.status(commonUserPointLogService.save(commonUserPointLog));
}
/**
* 用户商城积分流水表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonUserPointLog")
public R update(@Valid @RequestBody CommonUserPointLogEntity commonUserPointLog) {
return R.status(commonUserPointLogService.updateById(commonUserPointLog));
}
/**
* 用户商城积分流水表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonUserPointLog")
public R submit(@Valid @RequestBody CommonUserPointLogEntity commonUserPointLog) {
return R.status(commonUserPointLogService.saveOrUpdate(commonUserPointLog));
}
/**
* 用户商城积分流水表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(commonUserPointLogService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -3,13 +3,10 @@ package org.springblade.modules.common.convert;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import org.springblade.modules.api.request.AddressSubmitRequest;
import org.springblade.modules.api.request.CreateOrderRequest; import org.springblade.modules.api.request.CreateOrderRequest;
import org.springblade.modules.api.vo.CommonUserNoticeApiVO; import org.springblade.modules.api.vo.*;
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO; import org.springblade.modules.common.pojo.entity.*;
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO; import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO; import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
import org.springblade.modules.mall.pojo.entity.MallProductEntity; import org.springblade.modules.mall.pojo.entity.MallProductEntity;
@@ -27,6 +24,13 @@ public interface AppCommonConvert {
List<AppCommonRegionsInfoVO> convertRegionsInfoListVO(List<CommonRegionsInfoEntity> list); List<AppCommonRegionsInfoVO> convertRegionsInfoListVO(List<CommonRegionsInfoEntity> list);
@Mapping(target = "id", ignore = true) @Mapping(target = "id", ignore = true)
@Mapping(target = "createTime", ignore = true)
@Mapping(target = "createUser", ignore = true)
@Mapping(target = "createDept", ignore = true)
@Mapping(target = "updateTime", ignore = true)
@Mapping(target = "updateUser", ignore = true)
@Mapping(target = "status", ignore = true)
@Mapping(target = "isDeleted", ignore = true)
@Mapping(target = "consigneePhone", source = "request.consigneePhone") @Mapping(target = "consigneePhone", source = "request.consigneePhone")
@Mapping(target = "consignee", source = "request.consignee") @Mapping(target = "consignee", source = "request.consignee")
@Mapping(target = "itemCode", source = "request.itemCode") @Mapping(target = "itemCode", source = "request.itemCode")
@@ -40,6 +44,8 @@ public interface AppCommonConvert {
List<CommonUserOrderApiVO> convertUserOrderEntityListTOApiList(List<CommonUserOrderEntity> entityList); List<CommonUserOrderApiVO> convertUserOrderEntityListTOApiList(List<CommonUserOrderEntity> entityList);
CommonUserOrderDetailApiVO convertOrderDetailApiVO(CommonUserOrderEntity entity);
CommonUserOrderApiVO convertOrderApiVO(CommonUserOrderVO vo); CommonUserOrderApiVO convertOrderApiVO(CommonUserOrderVO vo);
List<CommonUserOrderApiVO> convertOrderApiListVO(List<CommonUserOrderVO> voList); List<CommonUserOrderApiVO> convertOrderApiListVO(List<CommonUserOrderVO> voList);
@@ -49,4 +55,11 @@ public interface AppCommonConvert {
List<CommonUserNoticeApiVO> convertNoticeVOList(List<CommonUserNoticeEntity> list); List<CommonUserNoticeApiVO> convertNoticeVOList(List<CommonUserNoticeEntity> list);
CommonUserNoticeDetailApiVO convertNoticeDetailVO(CommonUserNoticeEntity entity); CommonUserNoticeDetailApiVO convertNoticeDetailVO(CommonUserNoticeEntity entity);
CommonUserAddressApiVO convertAddressToVoList(CommonUserAddressEntity entity);
List<CommonUserAddressApiVO> convertAddressListToVoList(List<CommonUserAddressEntity> list);
CommonUserAddressEntity convertRequestToPo(AddressSubmitRequest request);
} }

View File

@@ -0,0 +1,45 @@
package org.springblade.modules.common.eums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public enum BusinessModule {
SELF_OPERATED_MALL("自营商城", "self_mall"),
ECOSYSTEM_PRODUCT("生态商品", "eco_product"),
TRAVEL_GROUP("旅游团", "travel_group"),
LOTTERY("幸运抽奖", "lottery");
@Getter
private final String displayName;
@Getter
private final String code;
// ========================
// 根据 code 查找(忽略大小写)
// ========================
public static BusinessModule fromCodeIgnoreCase(String code) {
BusinessModule module = fromCodeIgnoreCaseOrNull(code);
if (module == null) {
throw new IllegalArgumentException("未知的业务模块 code: " + code);
}
return module;
}
public static BusinessModule fromCodeIgnoreCaseOrNull(String code) {
if (code == null || code.trim().isEmpty()) {
return null;
}
String normalized = code.trim().toLowerCase();
for (BusinessModule module : values()) {
if (module.code.equals(normalized)) {
return module;
}
}
return null;
}
}

View File

@@ -10,14 +10,14 @@ import java.util.stream.Stream;
@Getter @Getter
public enum OrderStatus { public enum OrderStatus {
PENDING_PAYMENT(0, "📌 订单 %s 尚未支付!请尽快完成付款,以免订单自动取消。"), PENDING_PAYMENT(0, "📌 订单 <id>%s</id> 尚未支付!请尽快完成付款,以免订单自动取消。"),
PAID(1, "✅ 订单 %s 已支付成功!商家正在准备发货(或待您使用),请耐心等待。"), PAID(1, "✅ 订单 <id>%s</id> 已支付成功!商家正在准备发货(或待您使用),请耐心等待。"),
CANCELLED(2, "🗑️ 订单 %s 已取消。如有疑问,可联系客服了解详情。"), CANCELLED(2, "🗑️ 订单 <id>%s</id> 已取消。如有疑问,可联系客服了解详情。"),
SHIPPED(3, "🚚 订单 %s 已发货!(或🎫 电子票已出票)请留意物流信息(或按时使用服务)。"), SHIPPED(3, "🚚 订单 <id>%s</id> 已发货!(或🎫 电子票已出票)请留意物流信息(或按时使用服务)。"),
COMPLETED(4, "🎉 订单 %s 已完成!感谢您的信任,期待再次为您服务~"), COMPLETED(4, "🎉 订单 <id>%s</id> 已完成!感谢您的信任,期待再次为您服务~"),
CLOSED_TIMEOUT(5, "⏰ 订单 %s 因超时未支付已自动关闭。如需购买,请重新下单。"), CLOSED_TIMEOUT(5, "⏰ 订单 <id>%s</id> 因超时未支付已自动关闭。如需购买,请重新下单。"),
REFUNDING(6, "🔄 订单 %s 的退款申请已受理,款项将在1-7个工作日内原路退回,请耐心等待。"), REFUNDING(6, "🔄 订单 <id>%s</id> 的退款申请已受理,款项将在1-7个工作日内原路退回,请耐心等待。"),
REFUNDED(7, "💸 订单 %s 的退款已成功!金额已退至您的原支付账户,请注意查收。"); REFUNDED(7, "💸 订单 <id>%s</id> 的退款已成功!金额已退至您的原支付账户,请注意查收。");
private final int code; private final int code;
private final String userMessageTemplate; private final String userMessageTemplate;
@@ -58,4 +58,5 @@ public enum OrderStatus {
public static OrderStatus fromCodeOrNull(int code) { public static OrderStatus fromCodeOrNull(int code) {
return BY_CODE.get(code); return BY_CODE.get(code);
} }
} }

View File

@@ -0,0 +1,52 @@
package org.springblade.modules.common.eums;
import lombok.Getter;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Getter
public enum UserPointFlowType {
GRANT(1, "🎉 恭喜!您通过【订单 %s】成功获得 %s 积分,已存入您的账户,快去兑换好礼吧!") {
@Override
public String formatUserMessage(String orderId, String points) {
return String.format(this.getUserMessageTemplate(), orderId, points);
}
},
SPEND(2, "🎰 您已使用 %s 积分 参与幸运大抽奖,祝您好运连连,大奖抱回家!") {
@Override
public String formatUserMessage(String orderId, String points) {
// 注意:SPEND 不使用 orderId,但为了统一接口保留参数
return String.format(this.getUserMessageTemplate(), points);
}
};
private final int code;
private final String userMessageTemplate;
private UserPointFlowType(int code, String userMessageTemplate) {
this.code = code;
this.userMessageTemplate = userMessageTemplate;
}
public abstract String formatUserMessage(String orderId, String points);
private static final Map<Integer, UserPointFlowType> BY_CODE = Stream.of(values())
.collect(Collectors.toUnmodifiableMap(UserPointFlowType::getCode, Function.identity()));
public static UserPointFlowType fromCode(int code) {
UserPointFlowType status = BY_CODE.get(code);
if (status == null) {
throw new IllegalArgumentException("无效的订单状态码: " + code);
}
return status;
}
public static UserPointFlowType fromCodeOrNull(int code) {
return BY_CODE.get(code);
}
}

View File

@@ -0,0 +1,21 @@
package org.springblade.modules.common.event;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springblade.modules.common.eums.BusinessModule;
import java.math.BigDecimal;
@AllArgsConstructor
@Getter
public class GrantUserPointEvent {
private final Long orderId;
private final Long userId;
private final BigDecimal point;
private final BusinessModule businessModule;
}

View File

@@ -0,0 +1,17 @@
package org.springblade.modules.common.event;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springblade.modules.common.eums.BusinessModule;
@AllArgsConstructor
@Getter
public class PaymentSuccessEvent {
private final Long orderId;
private final Long userId;
private final BusinessModule businessModule;
}

View File

@@ -0,0 +1,19 @@
package org.springblade.modules.common.event;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springblade.modules.common.eums.BusinessModule;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
public class SpendUserPointEvent {
private Long userId;
private BigDecimal point;
private BusinessModule businessModule;
}

View File

@@ -23,12 +23,13 @@
* <p> * <p>
* Author: Chill Zhuang (bladejava@qq.com) * Author: Chill Zhuang (bladejava@qq.com)
*/ */
package org.springblade.modules.userPackage.excel; package org.springblade.modules.common.excel;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.math.BigDecimal;
import cn.idev.excel.annotation.ExcelProperty; import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth; import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight; import cn.idev.excel.annotation.write.style.ContentRowHeight;
@@ -38,16 +39,16 @@ import java.io.Serial;
/** /**
* 划拨积分记录 Excel实体类 * 抽奖记录表 Excel实体类
* *
* @author BladeX * @author RayLiu
* @since 2026-02-05 * @since 2026-02-14
*/ */
@Data @Data
@ColumnWidth(25) @ColumnWidth(25)
@HeadRowHeight(20) @HeadRowHeight(20)
@ContentRowHeight(18) @ContentRowHeight(18)
public class UserMarketBenefitPackageLogExcel implements Serializable { public class CommonLotteryRecordExcel implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -58,12 +59,6 @@ public class UserMarketBenefitPackageLogExcel implements Serializable {
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("主键") @ExcelProperty("主键")
private Long id; private Long id;
/**
* 统计日期
*/
@ColumnWidth(20)
@ExcelProperty("统计日期")
private Date statisticalDate;
/** /**
* 用户id * 用户id
*/ */
@@ -71,47 +66,17 @@ public class UserMarketBenefitPackageLogExcel implements Serializable {
@ExcelProperty("用户id") @ExcelProperty("用户id")
private Long userId; private Long userId;
/** /**
* 用户手机号 * 中奖奖品ID(null 表示未中奖/谢谢参与)
*/ */
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("用户手机号") @ExcelProperty("中奖奖品ID(null 表示未中奖/谢谢参与)")
private Long phone; private Long prizeId;
/** /**
* 用户名 * 消耗积分
*/ */
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("用户名") @ExcelProperty("消耗积分")
private String userName; private BigDecimal pointsUsed;
/**
* 1-积分兑换 2-后台划拨
*/
@ColumnWidth(20)
@ExcelProperty("1-积分兑换 2-后台划拨")
private Integer type;
/**
* 积分包id
*/
@ColumnWidth(20)
@ExcelProperty("积分包id")
private Long userPackageId;
/**
* 积分包名称
*/
@ColumnWidth(20)
@ExcelProperty("积分包名称")
private String packageName;
/**
* 积分包信息快照
*/
@ColumnWidth(20)
@ExcelProperty("积分包信息快照")
private String packageDetail;
/**
* 赠送数量
*/
@ColumnWidth(20)
@ExcelProperty("赠送数量")
private Integer giveNumber;
/** /**
* 备注 * 备注
*/ */

View File

@@ -0,0 +1,77 @@
package org.springblade.modules.common.listener;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.modules.common.eums.NoticeType;
import org.springblade.modules.common.eums.OrderStatus;
import org.springblade.modules.common.eums.UserPointFlowType;
import org.springblade.modules.common.event.GrantUserPointEvent;
import org.springblade.modules.common.event.PaymentSuccessEvent;
import org.springblade.modules.common.event.SpendUserPointEvent;
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
import org.springblade.modules.common.service.ICommonUserNoticeService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionPhase;
import org.springframework.transaction.event.TransactionalEventListener;
@Slf4j
@Component
@AllArgsConstructor
public class NoticeListener {
private final ICommonUserNoticeService noticeService;
@Async
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void onPaymentSuccess(PaymentSuccessEvent event) {
CommonUserNoticeEntity notice = new CommonUserNoticeEntity();
notice.setUserId(event.getUserId());
notice.setNoticeType(NoticeType.APP_USER.getCode());
notice.setModuleType(event.getBusinessModule().getCode());
notice.setTitle(event.getBusinessModule().getDisplayName());
notice.setContent(OrderStatus.PAID.formatUserMessage(String.valueOf(event.getOrderId())));
noticeService.save(notice);
}
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
public void onPaymentFailure(PaymentSuccessEvent event) {
log.warn("支付事务回滚,orderId={}", event.getOrderId());
}
@Async
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void onGrantUserPoint(GrantUserPointEvent event) {
CommonUserNoticeEntity notice = new CommonUserNoticeEntity();
notice.setUserId(event.getUserId());
notice.setNoticeType(NoticeType.APP_USER.getCode());
notice.setModuleType(event.getBusinessModule().getCode());
notice.setTitle(event.getBusinessModule().getDisplayName());
notice.setContent(UserPointFlowType.GRANT.formatUserMessage(String.valueOf(event.getOrderId()), String.valueOf(event.getPoint())));
noticeService.save(notice);
}
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
public void onGrantUserPointFailure(GrantUserPointEvent event) {
log.warn("用户获取积分事务回滚,orderId={}", event.getOrderId());
}
@Async
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void onSpendUserPoint(SpendUserPointEvent event) {
CommonUserNoticeEntity notice = new CommonUserNoticeEntity();
notice.setUserId(event.getUserId());
notice.setNoticeType(NoticeType.APP_USER.getCode());
notice.setModuleType(event.getBusinessModule().getCode());
notice.setTitle(event.getBusinessModule().getDisplayName());
notice.setContent(UserPointFlowType.SPEND.formatUserMessage(null, String.valueOf(event.getPoint())));
noticeService.save(notice);
}
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
public void onSpendUserPointFailure(SpendUserPointEvent event) {
log.warn("用户获取积分事务回滚,userId={}", event.getUserId());
}
}

View File

@@ -0,0 +1,53 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.mapper;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* 奖品配置表 Mapper 接口
*
* @author RayLiu
* @since 2026-02-14
*/
public interface CommonLotteryPrizeMapper extends BaseMapper<CommonLotteryPrizeEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param lotteryPrize 查询参数
* @return List<LotteryPrizeVO>
*/
List<CommonLotteryPrizeVO> selectLotteryPrizePage(IPage page, CommonLotteryPrizeVO lotteryPrize);
}

View File

@@ -0,0 +1,31 @@
<?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="org.springblade.modules.common.mapper.CommonLotteryPrizeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="lotteryPrizeResultMap" type="org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity">
<result column="id" property="id"/>
<result column="prize_name" property="prizeName"/>
<result column="prize_type" property="prizeType"/>
<result column="prize_value" property="prizeValue"/>
<result column="probability" property="probability"/>
<result column="stock" property="stock"/>
<result column="daily_limit" property="dailyLimit"/>
<result column="sort_order" property="sortOrder"/>
<result column="remark" property="remark"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
<select id="selectLotteryPrizePage" resultMap="lotteryPrizeResultMap">
select * from common_lottery_prize where is_deleted = 0
</select>
</mapper>

View File

@@ -23,11 +23,12 @@
* <p> * <p>
* Author: Chill Zhuang (bladejava@qq.com) * Author: Chill Zhuang (bladejava@qq.com)
*/ */
package org.springblade.modules.userPackage.mapper; package org.springblade.modules.common.mapper;
import org.springblade.modules.userPackage.pojo.entity.UserMarketBenefitPackageEntity; import org.springblade.modules.api.vo.CommonLotteryRecordApiVO;
import org.springblade.modules.userPackage.pojo.vo.UserMarketBenefitPackageVO; import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.userPackage.excel.UserMarketBenefitPackageExcel; import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import org.springblade.modules.common.excel.CommonLotteryRecordExcel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -35,29 +36,30 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
* 用户积分包信息表 Mapper 接口 * 抽奖记录表 Mapper 接口
* *
* @author BladeX * @author RayLiu
* @since 2026-02-05 * @since 2026-02-14
*/ */
public interface UserMarketBenefitPackageMapper extends BaseMapper<UserMarketBenefitPackageEntity> { public interface CommonLotteryRecordMapper extends BaseMapper<CommonLotteryRecordEntity> {
/** /**
* 自定义分页 * 自定义分页
* *
* @param page 分页参数 * @param page 分页参数
* @param userMarketBenefitPackage 查询参数 * @param vo 查询参数
* @return List<UserMarketBenefitPackageVO> * @return List<LotteryRecordVO>
*/ */
List<UserMarketBenefitPackageVO> selectUserMarketBenefitPackagePage(IPage page, UserMarketBenefitPackageVO userMarketBenefitPackage); List<CommonLotteryRecordVO> selectLotteryRecordPage(IPage page, CommonLotteryRecordVO vo);
/** /**
* 获取导出数据 * 获取导出数据
* *
* @param queryWrapper 查询条件 * @param queryWrapper 查询条件
* @return List<UserMarketBenefitPackageExcel> * @return List<LotteryRecordExcel>
*/ */
List<UserMarketBenefitPackageExcel> exportUserMarketBenefitPackage(@Param("ew") Wrapper<UserMarketBenefitPackageEntity> queryWrapper); List<CommonLotteryRecordExcel> exportLotteryRecord(@Param("ew") Wrapper<CommonLotteryRecordEntity> queryWrapper);
} }

View File

@@ -0,0 +1,35 @@
<?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="org.springblade.modules.common.mapper.CommonLotteryRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="lotteryRecordResultMap" type="org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity">
<result column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="prize_id" property="prizeId"/>
<result column="points_used" property="pointsUsed"/>
<result column="remark" property="remark"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
<select id="selectLotteryRecordPage" resultType="org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO">
select * from common_lottery_record where is_deleted = 0
<if test="vo.userId!=null">
and user_id = #{vo.userId}
</if>
order by create_time desc
</select>
<select id="exportLotteryRecord" resultType="org.springblade.modules.common.excel.CommonLotteryRecordExcel">
SELECT * FROM common_lottery_record ${ew.customSqlSegment}
</select>
</mapper>

View File

@@ -6,7 +6,7 @@
<resultMap id="userAddressResultMap" type="org.springblade.modules.common.pojo.entity.CommonUserAddressEntity"> <resultMap id="userAddressResultMap" type="org.springblade.modules.common.pojo.entity.CommonUserAddressEntity">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="user_id" property="userId"/> <result column="user_id" property="userId"/>
<result column="regions_info_id" property="regionsInfoId"/> <result column="regions_id" property="regionsId"/>
<result column="province" property="province"/> <result column="province" property="province"/>
<result column="city" property="city"/> <result column="city" property="city"/>
<result column="district" property="district"/> <result column="district" property="district"/>
@@ -25,8 +25,17 @@
</resultMap> </resultMap>
<select id="selectUserAddressPage" resultMap="userAddressResultMap"> <select id="selectUserAddressPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserAddressVO">
select * from user_address where is_deleted = 0 select
cua.*,
bu.account
from blade_user bu
left join common_user_address cua on cua.user_id = bu.id
where bu.is_deleted = 0 and bu.user_type = 2 and cua.is_deleted = 0
<if test="userAddress.account != null">
and bu.account = #{userAddress.account}
</if>
order by cua.create_time desc
</select> </select>
</mapper> </mapper>

View File

@@ -8,7 +8,6 @@
<result column="user_id" property="userId"/> <result column="user_id" property="userId"/>
<result column="notice_type" property="noticeType"/> <result column="notice_type" property="noticeType"/>
<result column="has_read" property="hasRead"/> <result column="has_read" property="hasRead"/>
<result column="release_time" property="releaseTime"/>
<result column="title" property="title"/> <result column="title" property="title"/>
<result column="content" property="content"/> <result column="content" property="content"/>
<result column="remarks" property="remarks"/> <result column="remarks" property="remarks"/>
@@ -23,19 +22,22 @@
<select id="selectUserNoticePage" resultMap="userNoticeResultMap"> <select id="selectUserNoticePage" resultMap="userNoticeResultMap">
select * from user_notice where is_deleted = 0 select *
from user_notice
where is_deleted = 0
and notice_type in (0, 1, 2)
</select> </select>
<select id="selectAppSystemNoticeVOList" resultType="org.springblade.modules.common.pojo.vo.CommonUserNoticeVO"> <select id="selectAppSystemNoticeVOList" resultType="org.springblade.modules.api.vo.CommonUserNoticeApiVO">
select id, module_type, has_read, title, create_time select id, module_type, has_read, title, content, create_time
from user_notice from user_notice
where notice_type in (0, 1) where notice_type in (0, 1)
and is_deleted = 0 and is_deleted = 0
order by create_time desc order by create_time desc
</select> </select>
<select id="selectAppUserNoticeApiPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserNoticeVO"> <select id="selectAppUserNoticeApiPage" resultType="org.springblade.modules.api.vo.CommonUserNoticeApiVO">
select id, module_type, has_read, title, create_time select id, module_type, has_read, title, content, create_time
from user_notice from user_notice
where user_id = #{userId} where user_id = #{userId}
and notice_type = 3 and notice_type = 3
@@ -43,16 +45,16 @@
order by has_read asc, create_time desc order by has_read asc, create_time desc
</select> </select>
<select id="selectMarketSystemNoticeVOList" resultType="org.springblade.modules.common.pojo.vo.CommonUserNoticeVO"> <select id="selectMarketSystemNoticeVOList" resultType="org.springblade.modules.api.vo.CommonUserNoticeApiVO">
select id, module_type, has_read, title, create_time select id, module_type, has_read, title, content, create_time
from user_notice from user_notice
where notice_type in (0, 2) where notice_type in (0, 2)
and is_deleted = 0 and is_deleted = 0
order by create_time desc order by create_time desc
</select> </select>
<select id="selectMarketUserNoticeApiPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserNoticeVO"> <select id="selectMarketUserNoticeApiPage" resultType="org.springblade.modules.api.vo.CommonUserNoticeApiVO">
select id, module_type, has_read, title, create_time select id, module_type, has_read, title, content, create_time
from user_notice from user_notice
where user_id = #{userId} where user_id = #{userId}
and notice_type = 4 and notice_type = 4

View File

@@ -41,6 +41,19 @@
<if test="order.id != null"> <if test="order.id != null">
and uo.id = #{order.id} and uo.id = #{order.id}
</if> </if>
<if test="order.account != null">
and bu.account = #{order.account}
</if>
<if test="order.paymentStatus !=null">
and uo.payment_status = #{order.paymentStatus}
</if>
<if test="order.paymentType !=null">
and uo.payment_type = #{order.paymentType}
</if>
<if test="order.orderStatus != null">
and uo.order_status = #{order.orderStatus}
</if>
order by create_time desc
</select> </select>
<select id="selectOrderEntityPage" resultType="org.springblade.modules.common.pojo.entity.CommonUserOrderEntity"> <select id="selectOrderEntityPage" resultType="org.springblade.modules.common.pojo.entity.CommonUserOrderEntity">

View File

@@ -0,0 +1,27 @@
package org.springblade.modules.common.mapper;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* 用户商城积分流水表 Mapper 接口
*
* @author BladeX
* @since 2026-02-12
*/
public interface CommonUserPointLogMapper extends BaseMapper<CommonUserPointLogEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param pointLog 查询参数
* @return List<CommonUserPointLogVO>
*/
List<CommonUserPointLogVO> selectCommonUserPointLogPage(IPage page, CommonUserPointLogVO pointLog);
}

View File

@@ -0,0 +1,42 @@
<?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="org.springblade.modules.common.mapper.CommonUserPointLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="commonUserPointLogResultMap" type="org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity">
<result column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="amount" property="amount"/>
<result column="last_amount" property="lastAmount"/>
<result column="source_type" property="sourceType"/>
<result column="source_id" property="sourceId"/>
<result column="source_detail" property="sourceDetail"/>
<result column="type" property="type"/>
<result column="is_complete" property="isComplete"/>
<result column="statistical_date" property="statisticalDate"/>
<result column="remark" property="remark"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
<select id="selectCommonUserPointLogPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserPointLogVO">
select
upl.*,
bu.account
from blade_user bu
left join user_point_log upl on bu.id = upl.user_id
where bu.is_deleted = 0 and upl.is_deleted = 0 and upl.is_complete = 1
<if test="pointLog.account != null">
and bu.account = #{pointLog.account}
</if>
order by upl.id desc
</select>
</mapper>

View File

@@ -0,0 +1,32 @@
package org.springblade.modules.common.mapper;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.math.BigDecimal;
import java.util.List;
/**
* 用户商城积分表 Mapper 接口
*
* @author BladeX
* @since 2026-02-12
*/
public interface CommonUserPointMapper extends BaseMapper<CommonUserPointEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param userPoint 查询参数
* @return List<CommonUserPointVO>
*/
List<CommonUserPointVO> selectCommonUserPointPage(IPage page, CommonUserPointVO userPoint);
int addUserPoint(Long userId, BigDecimal amount, Integer version);
int deductUserPoint(Long userId, BigDecimal amount, Integer version);
}

View File

@@ -0,0 +1,49 @@
<?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="org.springblade.modules.common.mapper.CommonUserPointMapper">
<!-- 通用查询映射结果 -->
<resultMap id="commonUserPointResultMap" type="org.springblade.modules.common.pojo.entity.CommonUserPointEntity">
<result column="id" property="id"/>
<result column="amount" property="amount"/>
<result column="version" property="version"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
<select id="selectCommonUserPointPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserPointVO">
select
up.*,
bu.account
from blade_user bu
left join user_point up on bu.id = up.id
where bu.is_deleted = 0 and bu.user_type = 2 and up.is_deleted = 0
<if test="userPoint.account != null">
and bu.account = #{userPoint.account}
</if>
order by up.id desc
</select>
<update id="addUserPoint">
update
user_point
set amount = amount + #{amount} , version = version + 1
where id = #{userId} and version = #{version}
</update>
<update id="deductUserPoint">
update
user_point
set amount = amount - #{amount} , version = version + 1
where id = #{userId} and version = #{version} and amount >= #{amount}
</update>
</mapper>

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.dto;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 奖品配置表 数据传输对象实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryPrizeDTO extends CommonLotteryPrizeEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.dto;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 抽奖记录表 数据传输对象实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryRecordDTO extends CommonLotteryRecordEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.dto;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 用户商城积分表 数据传输对象实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonUserPointDTO extends CommonUserPointEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.dto;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 用户商城积分流水表 数据传输对象实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonUserPointLogDTO extends CommonUserPointLogEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,93 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.entity;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 奖品配置表 实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@TableName("common_lottery_prize")
@Schema(description = "LotteryPrize对象")
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryPrizeEntity extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 奖品名称
*/
@Schema(description = "奖品名称")
private String prizeName;
/**
* 奖品类型
*/
@Schema(description = "奖品类型")
private Integer prizeType;
/**
* 奖品内容
*/
@Schema(description = "奖品内容")
private String prizeValue;
/**
* 中奖概率(如 0.05 = 5%)
*/
@Schema(description = "中奖概率(如 0.05 = 5%)")
private BigDecimal probability;
/**
* 总库存(-1 表示无限)
*/
@Schema(description = "总库存(-1 表示无限)")
private Integer stock;
/**
* 每日发放上限
*/
@Schema(description = "每日发放上限")
private Integer dailyLimit;
/**
* 排序(用于前端展示顺序)
*/
@Schema(description = "排序(用于前端展示顺序)")
private Integer sortOrder;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}

View File

@@ -0,0 +1,73 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.entity;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 抽奖记录表 实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@TableName("common_lottery_record")
@Schema(description = "LotteryRecord对象")
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryRecordEntity extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
@Schema(description = "用户id")
private Long userId;
/**
* 中奖奖品ID(null 表示未中奖/谢谢参与)
*/
@Schema(description = "中奖奖品ID(null 表示未中奖/谢谢参与)")
private Long prizeId;
/**
* 消耗积分
*/
@Schema(description = "消耗积分")
private BigDecimal pointsUsed;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}

View File

@@ -29,6 +29,7 @@ import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial; import java.io.Serial;
@@ -39,9 +40,10 @@ import java.io.Serial;
* @since 2026-02-05 * @since 2026-02-05
*/ */
@Data @Data
@TableName("user_address") @TableName("common_user_address")
@Schema(description = "UserAddress对象") @Schema(description = "UserAddress对象")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class CommonUserAddressEntity extends BaseEntity { public class CommonUserAddressEntity extends BaseEntity {
@Serial @Serial
@@ -56,7 +58,7 @@ public class CommonUserAddressEntity extends BaseEntity {
* 地区信息id * 地区信息id
*/ */
@Schema(description = "地区信息id") @Schema(description = "地区信息id")
private Long regionsInfoId; private Long regionsId;
/** /**
* 省份 * 省份
*/ */

View File

@@ -28,7 +28,9 @@ package org.springblade.modules.common.pojo.entity;
import lombok.Data; import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date; import java.util.Date;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseEntity;
@@ -65,7 +67,7 @@ public class CommonUserNoticeEntity extends BaseEntity {
* 业务类型 * 业务类型
*/ */
@Schema(description = "业务类型") @Schema(description = "业务类型")
private Integer moduleType; private String moduleType;
/** /**
* 是否已读 0-否 1-是 * 是否已读 0-否 1-是
*/ */

View File

@@ -34,6 +34,9 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serializable; import java.io.Serializable;
import java.io.Serial; import java.io.Serial;
@@ -46,18 +49,12 @@ import java.io.Serial;
@Data @Data
@TableName("user_order") @TableName("user_order")
@Schema(description = "Order对象") @Schema(description = "Order对象")
public class CommonUserOrderEntity implements Serializable { @EqualsAndHashCode(callSuper = true)
public class CommonUserOrderEntity extends BaseEntity {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
/** /**
* 用户id * 用户id
@@ -149,40 +146,5 @@ public class CommonUserOrderEntity implements Serializable {
*/ */
@Schema(description = "支付凭证编号") @Schema(description = "支付凭证编号")
private String paymentTrack; private String paymentTrack;
/**
* 创建人
*/
@Schema(description = "创建人")
private Long createUser;
/**
* 创建部门
*/
@Schema(description = "创建部门")
private Long createDept;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private Date createTime;
/**
* 修改人
*/
@Schema(description = "修改人")
private Long updateUser;
/**
* 修改时间
*/
@Schema(description = "修改时间")
private Date updateTime;
/**
* 状态
*/
@Schema(description = "状态")
private Integer status;
/**
*
*/
@Schema(description = "")
private Integer isDeleted;
} }

View File

@@ -0,0 +1,40 @@
package org.springblade.modules.common.pojo.entity;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 用户商城积分表 实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@TableName("user_point")
@Schema(description = "CommonUserPoint对象")
@EqualsAndHashCode(callSuper = true)
public class CommonUserPointEntity extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 面额
*/
@Schema(description = "面额")
private BigDecimal amount;
/**
* 版本号
*/
@Version
@Schema(description = "版本号")
private Integer version;
}

View File

@@ -0,0 +1,86 @@
package org.springblade.modules.common.pojo.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.util.Date;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springblade.core.mp.base.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serial;
/**
* 用户商城积分流水表 实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@TableName("user_point_log")
@Schema(description = "CommonUserPointLog对象")
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class CommonUserPointLogEntity extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
@Schema(description = "用户id")
private Long userId;
/**
* 金额
*/
@Schema(description = "金额")
private BigDecimal amount;
/**
* 上一笔金额
*/
@Schema(description = "上一笔金额")
private BigDecimal lastAmount;
/**
*
* 来源类型
*/
@Schema(description = "来源类型")
private String sourceType;
/**
* 来源id
*/
@Schema(description = "来源id")
private Long sourceId;
/**
* 来源详情
*/
@Schema(description = "来源详情")
private String sourceDetail;
/**
* 消费类型 1-收入 2-支出
*/
@Schema(description = "消费类型 1-收入 2-支出")
private Integer type;
/**
* 是否完成 0-未完成 1-已完成
*/
@Schema(description = "是否完成 0-未完成 1-已完成")
private Integer isComplete;
/**
* 统计时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@Schema(description = "统计时间")
private Date statisticalDate;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.vo;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 奖品配置表 视图实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryPrizeVO extends CommonLotteryPrizeEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.vo;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 抽奖记录表 视图实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryRecordVO extends CommonLotteryRecordEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -42,4 +42,6 @@ public class CommonUserAddressVO extends CommonUserAddressEntity {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String account;
} }

View File

@@ -39,9 +39,8 @@ import java.io.Serial;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class CommonUserNoticeVO extends CommonUserNoticeEntity { public class CommonUserNoticeVO extends CommonUserNoticeEntity {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Integer noticeRange;
} }

View File

@@ -0,0 +1,47 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.vo;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 用户商城积分流水表 视图实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonUserPointLogVO extends CommonUserPointLogEntity {
@Serial
private static final long serialVersionUID = 1L;
private String account;
}

View File

@@ -0,0 +1,47 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.vo;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 用户商城积分表 视图实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonUserPointVO extends CommonUserPointEntity {
@Serial
private static final long serialVersionUID = 1L;
private String account;
}

View File

@@ -23,39 +23,36 @@
* <p> * <p>
* Author: Chill Zhuang (bladejava@qq.com) * Author: Chill Zhuang (bladejava@qq.com)
*/ */
package org.springblade.modules.userPackage.service; package org.springblade.modules.common.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import org.springblade.modules.api.request.LotteryDrawRequest;
import org.springblade.modules.userPackage.pojo.entity.UserMarketBenefitPackageLogEntity; import org.springblade.modules.api.vo.CommonLotteryPrizeApiVO;
import org.springblade.modules.userPackage.pojo.vo.UserMarketBenefitPackageLogVO; import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.userPackage.excel.UserMarketBenefitPackageLogExcel; import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import java.util.List; import java.util.List;
/** /**
* 划拨积分记录 服务类 * 奖品配置表 服务类
* *
* @author BladeX * @author RayLiu
* @since 2026-02-05 * @since 2026-02-14
*/ */
public interface IUserMarketBenefitPackageLogService extends BaseService<UserMarketBenefitPackageLogEntity> { public interface ICommonLotteryPrizeService extends BaseService<CommonLotteryPrizeEntity> {
/** /**
* 自定义分页 * 自定义分页
* *
* @param page 分页参数 * @param page 分页参数
* @param userMarketBenefitPackageLog 查询参数 * @param lotteryPrize 查询参数
* @return IPage<UserMarketBenefitPackageLogVO> * @return IPage<LotteryPrizeVO>
*/ */
IPage<UserMarketBenefitPackageLogVO> selectUserMarketBenefitPackageLogPage(IPage<UserMarketBenefitPackageLogVO> page, UserMarketBenefitPackageLogVO userMarketBenefitPackageLog); IPage<CommonLotteryPrizeVO> selectLotteryPrizePage(IPage<CommonLotteryPrizeVO> page, CommonLotteryPrizeVO lotteryPrize);
CommonLotteryPrizeApiVO draw(LotteryDrawRequest request);
/** List<CommonLotteryPrizeApiVO> staticList();
* 导出数据
*
* @param queryWrapper 查询条件
* @return List<UserMarketBenefitPackageLogExcel>
*/
List<UserMarketBenefitPackageLogExcel> exportUserMarketBenefitPackageLog(Wrapper<UserMarketBenefitPackageLogEntity> queryWrapper);
String rules();
} }

View File

@@ -23,41 +23,49 @@
* <p> * <p>
* Author: Chill Zhuang (bladejava@qq.com) * Author: Chill Zhuang (bladejava@qq.com)
*/ */
package org.springblade.modules.userPackage.service; package org.springblade.modules.common.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springblade.modules.api.vo.MarketBenefitPackageVO; import org.springblade.modules.api.vo.CommonLotteryRecordApiVO;
import org.springblade.modules.userPackage.pojo.entity.UserMarketBenefitPackageEntity; import org.springblade.modules.api.vo.CommonLotteryWinnerApiVO;
import org.springblade.modules.userPackage.pojo.vo.UserMarketBenefitPackageVO; import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.userPackage.excel.UserMarketBenefitPackageExcel; import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import org.springblade.modules.common.excel.CommonLotteryRecordExcel;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
* 用户积分包信息表 服务类 * 抽奖记录表 服务类
* *
* @author BladeX * @author RayLiu
* @since 2026-02-05 * @since 2026-02-14
*/ */
public interface IUserMarketBenefitPackageService extends BaseService<UserMarketBenefitPackageEntity> { public interface ICommonLotteryRecordService extends BaseService<CommonLotteryRecordEntity> {
/** /**
* 自定义分页 * 自定义分页
* *
* @param page 分页参数 * @param page 分页参数
* @param userMarketBenefitPackage 查询参数 * @param lotteryRecord 查询参数
* @return IPage<UserMarketBenefitPackageVO> * @return IPage<LotteryRecordVO>
*/ */
IPage<UserMarketBenefitPackageVO> selectUserMarketBenefitPackagePage(IPage<UserMarketBenefitPackageVO> page, UserMarketBenefitPackageVO userMarketBenefitPackage); IPage<CommonLotteryRecordVO> selectLotteryRecordPage(IPage<CommonLotteryRecordVO> page, CommonLotteryRecordVO lotteryRecord);
/** /**
* 导出数据 * 导出数据
* *
* @param queryWrapper 查询条件 * @param queryWrapper 查询条件
* @return List<UserMarketBenefitPackageExcel> * @return List<LotteryRecordExcel>
*/ */
List<UserMarketBenefitPackageExcel> exportUserMarketBenefitPackage(Wrapper<UserMarketBenefitPackageEntity> queryWrapper); List<CommonLotteryRecordExcel> exportLotteryRecord(Wrapper<CommonLotteryRecordEntity> queryWrapper);
IPage<CommonLotteryRecordApiVO> selectLotteryRecordApiPage(IPage<CommonLotteryRecordApiVO> page, CommonLotteryRecordApiVO vo);
Boolean addRecord(Long userId, BigDecimal amount);
List<CommonLotteryWinnerApiVO> lotteryWinners();
IPage<MarketBenefitPackageVO> findUserPackList(IPage<UserMarketBenefitPackageEntity> page, MarketBenefitPackageVO userMarketBenefitPackage , Long userId);
} }

View File

@@ -27,6 +27,8 @@ package org.springblade.modules.common.service;
import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import org.springblade.modules.api.vo.FullRegionInfoVO;
import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity; import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO; import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
import org.springblade.modules.common.pojo.vo.CommonRegionsInfoVO; import org.springblade.modules.common.pojo.vo.CommonRegionsInfoVO;
@@ -51,4 +53,6 @@ public interface ICommonRegionsInfoService extends BaseService<CommonRegionsInfo
IPage<CommonRegionsInfoVO> selectRegionsInfoPage(IPage<CommonRegionsInfoVO> page, CommonRegionsInfoVO regionsInfo); IPage<CommonRegionsInfoVO> selectRegionsInfoPage(IPage<CommonRegionsInfoVO> page, CommonRegionsInfoVO regionsInfo);
List<AppCommonRegionsInfoVO> findRegionList(@Min(value = 0) Long pid, @Max(value = 4 ) @Min(value = 0) Integer level); List<AppCommonRegionsInfoVO> findRegionList(@Min(value = 0) Long pid, @Max(value = 4 ) @Min(value = 0) Integer level);
FullRegionInfoVO queryFullInfo( Long regionId);
} }

View File

@@ -25,11 +25,16 @@
*/ */
package org.springblade.modules.common.service; package org.springblade.modules.common.service;
import jakarta.validation.Valid;
import org.springblade.modules.api.request.AddressSubmitRequest;
import org.springblade.modules.api.vo.CommonUserAddressApiVO;
import org.springblade.modules.common.pojo.entity.CommonUserAddressEntity; import org.springblade.modules.common.pojo.entity.CommonUserAddressEntity;
import org.springblade.modules.common.pojo.vo.CommonUserAddressVO; import org.springblade.modules.common.pojo.vo.CommonUserAddressVO;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import java.util.List;
/** /**
* 用户地址表 服务类 * 用户地址表 服务类
* *
@@ -46,4 +51,9 @@ public interface ICommonUserAddressService extends BaseService<CommonUserAddress
*/ */
IPage<CommonUserAddressVO> selectUserAddressPage(IPage<CommonUserAddressVO> page, CommonUserAddressVO userAddress); IPage<CommonUserAddressVO> selectUserAddressPage(IPage<CommonUserAddressVO> page, CommonUserAddressVO userAddress);
List<CommonUserAddressApiVO> selectAddressList(IPage<CommonUserAddressApiVO> page, CommonUserAddressApiVO commonUserAddressVO);
boolean submitAddress(AddressSubmitRequest request);
boolean removeAddress(List<Long> ids);
} }

View File

@@ -25,7 +25,6 @@
*/ */
package org.springblade.modules.common.service; package org.springblade.modules.common.service;
import jakarta.validation.Valid;
import org.springblade.modules.api.vo.CommonUserNoticeApiVO; import org.springblade.modules.api.vo.CommonUserNoticeApiVO;
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO; import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO;
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity; import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
@@ -51,8 +50,7 @@ public interface ICommonUserNoticeService extends BaseService<CommonUserNoticeEn
*/ */
IPage<CommonUserNoticeVO> selectUserNoticePage(IPage<CommonUserNoticeVO> page, CommonUserNoticeVO userNotice); IPage<CommonUserNoticeVO> selectUserNoticePage(IPage<CommonUserNoticeVO> page, CommonUserNoticeVO userNotice);
boolean saveUserNotice(CommonUserNoticeVO userNotice);
boolean saveUserNotice(@Valid CommonUserNoticeVO userNotice);
IPage<CommonUserNoticeApiVO> selectAppUserNoticeApiPage(IPage<CommonUserNoticeApiVO> page, CommonUserNoticeApiVO vo); IPage<CommonUserNoticeApiVO> selectAppUserNoticeApiPage(IPage<CommonUserNoticeApiVO> page, CommonUserNoticeApiVO vo);

View File

@@ -26,12 +26,12 @@
package org.springblade.modules.common.service; package org.springblade.modules.common.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import jakarta.validation.Valid;
import org.springblade.modules.api.request.CreateOrderRequest; import org.springblade.modules.api.request.CreateOrderRequest;
import org.springblade.modules.api.request.PaymentRequest; import org.springblade.modules.api.request.PaymentRequest;
import org.springblade.modules.api.response.CreateOrderResponse; import org.springblade.modules.api.response.CreateOrderResponse;
import org.springblade.modules.api.response.PaymentResponse; import org.springblade.modules.api.response.PaymentResponse;
import org.springblade.modules.api.vo.CommonUserOrderApiVO; import org.springblade.modules.api.vo.CommonUserOrderApiVO;
import org.springblade.modules.api.vo.CommonUserOrderDetailApiVO;
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity; import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO; import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
import org.springblade.modules.common.excel.CommonUserOrderExcel; import org.springblade.modules.common.excel.CommonUserOrderExcel;
@@ -70,5 +70,8 @@ public interface ICommonUserOrderService extends IService<CommonUserOrderEntity>
IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder); IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder);
boolean confirmPayment(CommonUserOrderEntity order); CommonUserOrderDetailApiVO orderDetail(Long id);
boolean confirmPayment(Long id);
} }

View File

@@ -0,0 +1,54 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.math.BigDecimal;
/**
* 用户商城积分流水表 服务类
*
* @author BladeX
* @since 2026-02-12
*/
public interface ICommonUserPointLogService extends BaseService<CommonUserPointLogEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param commonUserPointLog 查询参数
* @return IPage<CommonUserPointLogVO>
*/
IPage<CommonUserPointLogVO> selectCommonUserPointLogPage(IPage<CommonUserPointLogVO> page, CommonUserPointLogVO commonUserPointLog);
Boolean recordPointChangeLog(CommonUserPointEntity commonUserPoint, BigDecimal lastAmount, String sourceType, BigDecimal amount, Integer type, Long sourceId, String sourceDetail);
}

View File

@@ -0,0 +1,33 @@
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.math.BigDecimal;
/**
* 用户商城积分表 服务类
*
* @author BladeX
* @since 2026-02-12
*/
public interface ICommonUserPointService extends BaseService<CommonUserPointEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param commonUserPoint 查询参数
* @return IPage<CommonUserPointVO>
*/
IPage<CommonUserPointVO> selectCommonUserPointPage(IPage<CommonUserPointVO> page, CommonUserPointVO commonUserPoint);
BigDecimal queryPoint();
void grantPointsByUserOrder(CommonUserOrderEntity order);
void spendPointsForLottery(BigDecimal amount, Long userId);
}

View File

@@ -0,0 +1,149 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.service.impl;
import io.jsonwebtoken.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.redis.debounce.DebounceClient;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.api.request.LotteryDrawRequest;
import org.springblade.modules.api.vo.CommonLotteryPrizeApiVO;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import org.springblade.modules.common.mapper.CommonLotteryPrizeMapper;
import org.springblade.modules.common.service.ICommonLotteryPrizeService;
import org.springblade.modules.common.service.ICommonLotteryRecordService;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springblade.modules.market.eums.MarketBusinessModule;
import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
import org.springblade.modules.market.service.IMarketCashCouponService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 奖品配置表 服务实现类
*
* @author RayLiu
* @since 2026-02-14
*/
@Slf4j
@Service
@AllArgsConstructor
public class CommonLotteryPrizeServiceImpl extends BaseServiceImpl<CommonLotteryPrizeMapper, CommonLotteryPrizeEntity> implements ICommonLotteryPrizeService {
private final DebounceClient debounceClient;
private final ICommonUserPointService userPointService;
private final IMarketCashCouponService cashCouponService;
private final ICommonLotteryRecordService lotteryRecordService;
private static final List<CommonLotteryPrizeApiVO> STATIC_PRIZE_LIST = List.of(
new CommonLotteryPrizeApiVO(0L, "谢谢参与"),
new CommonLotteryPrizeApiVO(1L, "100积分"),
new CommonLotteryPrizeApiVO(2L, "1000积分"),
new CommonLotteryPrizeApiVO(3L, "生态礼包"),
new CommonLotteryPrizeApiVO(4L, "黑茶礼盒"),
new CommonLotteryPrizeApiVO(5L, "幸运锦鲤")
);
private static final CommonLotteryPrizeApiVO PRIZE = new CommonLotteryPrizeApiVO(0L, "谢谢参与");
private static final String RULES = """
活动名称:幸运大抽奖
活动时间:即日起至2026年8月31日 23:59(北京时间)
参与方式:
- 消耗 100 积分 即可参与一次抽奖;
奖品说明:
• 谢谢参与:未中奖,感谢支持;
• 100积分:中奖后立即到账;
• 1000积分:中奖后立即到账;
• 生态礼包:内含精选生态商品组合,包邮到家;
• 黑茶礼盒:高品质黑茶礼盒一份,典雅包装,适合馈赠;
• 幸运锦鲤:超级大奖!包含实物礼包+专属权益,详情请留意中奖通知。
发放规则:
- 积分类奖品:即时到账;
- 实物奖品(生态礼包、黑茶礼盒、幸运锦鲤):中奖后3个工作日内联系您,请保持手机畅通并及时填写收货信息,逾期视为放弃。
温馨提示:
1. 抽奖结果由系统随机生成,公平公正;
2. 禁止使用外挂、脚本等作弊行为,一经发现将取消资格;
3. 本活动最终解释权归平台所有。
""";
@Override
public IPage<CommonLotteryPrizeVO> selectLotteryPrizePage(IPage<CommonLotteryPrizeVO> page, CommonLotteryPrizeVO lotteryPrize) {
return page.setRecords(baseMapper.selectLotteryPrizePage(page, lotteryPrize));
}
@Override
@Transactional(rollbackFor = Exception.class)
public CommonLotteryPrizeApiVO draw(LotteryDrawRequest request) {
Long userId = AuthUtil.getUserId();
String key = "lottery:" + userId;
if (debounceClient.tryDebounce(key, 3, TimeUnit.SECONDS)) {
Assert.isTrue(request.getAmount().compareTo(BigDecimal.valueOf(100)) == 0 || request.getAmount().compareTo(BigDecimal.valueOf(1000)) == 0, "无效积分");
userPointService.spendPointsForLottery(request.getAmount(), userId);
Boolean addCashCoupon = cashCouponService.addCashCoupon(new MarketCashCouponApiDTO().setAmount(request.getAmount()).setUserId(userId).setSourceType(MarketBusinessModule.LOTTERY));
if (!addCashCoupon) {
log.error("新增现金券失败");
throw new RuntimeException("操作失败");
}
Boolean addedRecord = lotteryRecordService.addRecord(userId, request.getAmount());
if (!addedRecord) {
log.error("新增抽奖记录失败");
throw new RuntimeException("操作失败");
}
} else {
long remaining = debounceClient.getRemainingTime(key, TimeUnit.SECONDS);
throw new RuntimeException("操作过于频繁,请" + remaining + "秒后重试");
}
return PRIZE;
}
@Override
public List<CommonLotteryPrizeApiVO> staticList() {
return STATIC_PRIZE_LIST;
}
@Override
public String rules() {
return RULES;
}
}

View File

@@ -0,0 +1,97 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.service.impl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.api.vo.CommonLotteryRecordApiVO;
import org.springblade.modules.api.vo.CommonLotteryWinnerApiVO;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import org.springblade.modules.common.excel.CommonLotteryRecordExcel;
import org.springblade.modules.common.mapper.CommonLotteryRecordMapper;
import org.springblade.modules.common.service.ICommonLotteryRecordService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import java.math.BigDecimal;
import java.util.List;
/**
* 抽奖记录表 服务实现类
*
* @author RayLiu
* @since 2026-02-14
*/
@Service
public class CommonLotteryRecordServiceImpl extends BaseServiceImpl<CommonLotteryRecordMapper, CommonLotteryRecordEntity> implements ICommonLotteryRecordService {
@Override
public IPage<CommonLotteryRecordVO> selectLotteryRecordPage(IPage<CommonLotteryRecordVO> page, CommonLotteryRecordVO lotteryRecord) {
return page.setRecords(baseMapper.selectLotteryRecordPage(page, lotteryRecord));
}
@Override
public List<CommonLotteryRecordExcel> exportLotteryRecord(Wrapper<CommonLotteryRecordEntity> queryWrapper) {
List<CommonLotteryRecordExcel> lotteryRecordList = baseMapper.exportLotteryRecord(queryWrapper);
//lotteryRecordList.forEach(lotteryRecord -> {
// lotteryRecord.setTypeName(DictCache.getValue(DictEnum.YES_NO, LotteryRecord.getType()));
//});
return lotteryRecordList;
}
@Override
public IPage<CommonLotteryRecordApiVO> selectLotteryRecordApiPage(IPage<CommonLotteryRecordApiVO> page, CommonLotteryRecordApiVO vo) {
CommonLotteryRecordVO lotteryRecord = new CommonLotteryRecordVO();
lotteryRecord.setUserId(AuthUtil.getUserId());
List<CommonLotteryRecordVO> voList = baseMapper.selectLotteryRecordPage(page, lotteryRecord);
List<CommonLotteryRecordApiVO> list = voList.stream().map(record -> {
CommonLotteryRecordApiVO apiVO = new CommonLotteryRecordApiVO();
apiVO.setId(record.getId());
apiVO.setPrizeName(record.getPrizeId() == null ? "谢谢参与。" : "中奖了!");
apiVO.setPointsUsed(record.getPointsUsed());
apiVO.setCreateTime(record.getCreateTime());
return apiVO;
}).toList();
return page.setRecords(list);
}
@Override
public Boolean addRecord(Long userId, BigDecimal amount) {
CommonLotteryRecordEntity lotteryRecord = new CommonLotteryRecordEntity();
lotteryRecord.setUserId(userId);
lotteryRecord.setPointsUsed(amount);
return save(lotteryRecord);
}
@Override
public List<CommonLotteryWinnerApiVO> lotteryWinners() {
return List.of();
}
}

View File

@@ -26,6 +26,7 @@
package org.springblade.modules.common.service.impl; package org.springblade.modules.common.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.modules.api.vo.FullRegionInfoVO;
import org.springblade.modules.common.convert.AppCommonConvert; import org.springblade.modules.common.convert.AppCommonConvert;
import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity; import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO; import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
@@ -35,6 +36,8 @@ import org.springblade.modules.common.service.ICommonRegionsInfoService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.util.Assert;
import java.util.List; import java.util.List;
/** /**
@@ -64,4 +67,29 @@ public class CommonRegionsInfoServiceImpl extends BaseServiceImpl<CommonRegionsI
return AppCommonConvert.INSTANCE.convertRegionsInfoListVO(regionsInfoList); return AppCommonConvert.INSTANCE.convertRegionsInfoListVO(regionsInfoList);
} }
@Override
public FullRegionInfoVO queryFullInfo(Long regionId) {
CommonRegionsInfoEntity regionInfo = getById(regionId);
Assert.notNull(regionInfo, "无效地区");
Assert.isTrue(regionInfo.getLevel() > 0 && regionInfo.getLevel() < 5, "无效地区");
FullRegionInfoVO result = new FullRegionInfoVO().setCurrentLevel(regionInfo.getLevel());
switch (regionInfo.getLevel()) {
case 4:
result.setStreet(regionInfo.getName()).setStreetId(regionId);
regionInfo = getById(regionInfo.getPid());
case 3:
result.setDistrict(regionInfo.getName()).setDistrictId(regionId);
regionInfo = getById(regionInfo.getPid());
case 2:
result.setCity(regionInfo.getName()).setCityId(regionId);
regionInfo = getById(regionInfo.getPid());
case 1:
result.setProvince(regionInfo.getName()).setProvinceId(regionId);
break;
default:
throw new RuntimeException("无效地区");
}
return result;
}
} }

View File

@@ -25,13 +25,26 @@
*/ */
package org.springblade.modules.common.service.impl; package org.springblade.modules.common.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.api.request.AddressSubmitRequest;
import org.springblade.modules.api.vo.CommonUserAddressApiVO;
import org.springblade.modules.api.vo.FullRegionInfoVO;
import org.springblade.modules.common.convert.AppCommonConvert;
import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
import org.springblade.modules.common.pojo.entity.CommonUserAddressEntity; import org.springblade.modules.common.pojo.entity.CommonUserAddressEntity;
import org.springblade.modules.common.pojo.vo.CommonUserAddressVO; import org.springblade.modules.common.pojo.vo.CommonUserAddressVO;
import org.springblade.modules.common.mapper.CommonUserAddressMapper; import org.springblade.modules.common.mapper.CommonUserAddressMapper;
import org.springblade.modules.common.service.ICommonRegionsInfoService;
import org.springblade.modules.common.service.ICommonUserAddressService; import org.springblade.modules.common.service.ICommonUserAddressService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.util.Assert;
import java.util.List;
import java.util.function.Predicate;
/** /**
* 用户地址表 服务实现类 * 用户地址表 服务实现类
@@ -40,11 +53,53 @@ import org.springblade.core.mp.base.BaseServiceImpl;
* @since 2026-02-05 * @since 2026-02-05
*/ */
@Service @Service
@AllArgsConstructor
public class CommonUserAddressServiceImpl extends BaseServiceImpl<CommonUserAddressMapper, CommonUserAddressEntity> implements ICommonUserAddressService { public class CommonUserAddressServiceImpl extends BaseServiceImpl<CommonUserAddressMapper, CommonUserAddressEntity> implements ICommonUserAddressService {
private final ICommonRegionsInfoService regionInfoService;
@Override @Override
public IPage<CommonUserAddressVO> selectUserAddressPage(IPage<CommonUserAddressVO> page, CommonUserAddressVO userAddress) { public IPage<CommonUserAddressVO> selectUserAddressPage(IPage<CommonUserAddressVO> page, CommonUserAddressVO userAddress) {
return page.setRecords(baseMapper.selectUserAddressPage(page, userAddress)); return page.setRecords(baseMapper.selectUserAddressPage(page, userAddress));
} }
@Override
public List<CommonUserAddressApiVO> selectAddressList(IPage<CommonUserAddressApiVO> page, CommonUserAddressApiVO commonUserAddressVO) {
List<CommonUserAddressEntity> addressList = list(Wrappers.lambdaQuery(CommonUserAddressEntity.class)
.eq(CommonUserAddressEntity::getUserId, AuthUtil.getUserId())
.orderByDesc(CommonUserAddressEntity::getIsDefault , CommonUserAddressEntity::getId));
return AppCommonConvert.INSTANCE.convertAddressListToVoList(addressList);
}
@Override
public boolean submitAddress(AddressSubmitRequest request) {
FullRegionInfoVO regionInfo = regionInfoService.queryFullInfo(Long.valueOf(request.getRegionsId()));
Assert.isTrue(regionInfo.getCurrentLevel() == 4, "请选择所属街道");
Assert.isTrue(isMobile(request.getPhone()), "手机号码格式不正确");
Assert.isTrue(request.getConsignee().length() < 100 , "名字不能超过100个字");
CommonUserAddressEntity address = AppCommonConvert.INSTANCE.convertRequestToPo(request);
address
.setProvince(regionInfo.getProvince())
.setCity(regionInfo.getCity())
.setDistrict(regionInfo.getDistrict())
.setUserId(AuthUtil.getUserId())
.setStreet(regionInfo.getStreet());
if (request.getIsDefault() == 1) {
update(Wrappers.lambdaUpdate(CommonUserAddressEntity.class).eq(CommonUserAddressEntity::getUserId, AuthUtil.getUserId()).set(CommonUserAddressEntity::getIsDefault, 0));
}
return saveOrUpdate(address);
}
@Override
public boolean removeAddress(List<Long> ids) {
return removeByIds(ids);
}
private Boolean isMobile(String phone){
Predicate<String> isPhoneValid = p -> p.matches("^1[3-9]\\d{9}$");
return isPhoneValid.test(phone);
}
} }

View File

@@ -36,7 +36,6 @@ import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO; import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
import org.springblade.modules.common.mapper.CommonUserNoticeMapper; import org.springblade.modules.common.mapper.CommonUserNoticeMapper;
import org.springblade.modules.common.service.ICommonUserNoticeService; import org.springblade.modules.common.service.ICommonUserNoticeService;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService; import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -44,7 +43,6 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@@ -65,64 +63,10 @@ public class CommonUserNoticeServiceImpl extends BaseServiceImpl<CommonUserNotic
return page.setRecords(baseMapper.selectUserNoticePage(page, userNotice)); return page.setRecords(baseMapper.selectUserNoticePage(page, userNotice));
} }
@Transactional(rollbackFor = RuntimeException.class)
@Override @Override
public boolean saveUserNotice(CommonUserNoticeVO userNotice) { public boolean saveUserNotice(CommonUserNoticeVO userNotice) {
Assert.notNull(userNotice.getNoticeType(), "通知类型不能为空"); Assert.isTrue(userNotice.getNoticeType() != NoticeType.MARKET_USER.getCode() && userNotice.getNoticeType() != NoticeType.APP_USER.getCode(), "无效消息类型");
Assert.notNull(userNotice.getTitle(), "标题不能为空"); return save(userNotice);
Assert.notNull(userNotice.getContent(), "内容不能为空");
if (userNotice.getNoticeRange() == 0) {
User user = userService.getById(userNotice.getUserId());
Assert.notNull(user, "用户不存在");
return save(
new CommonUserNoticeEntity()
.setUserId(userNotice.getUserId())
.setTitle(userNotice.getTitle())
.setContent(userNotice.getContent())
.setNoticeType(userNotice.getNoticeType())
.setHasRead(0)
);
} else if (userNotice.getNoticeRange() == 1) {
long count = userService.count(
Wrappers.lambdaQuery(User.class)
.eq(User::getUserType, 2)
);
// 向上取整
long pageNun = (count + PAGE_SIZE - 1) / PAGE_SIZE;
List<CommonUserNoticeEntity> noticeList = new ArrayList<>();
for (int i = 0; i < pageNun; i++) {
List<Long> userIdList = userService.list(
Wrappers.lambdaQuery(User.class)
.eq(User::getUserType, 2)
.orderByAsc(User::getId)
.last("limit " + PAGE_SIZE + " offset " + i * PAGE_SIZE)
).stream().map(User::getId).toList();
userIdList.forEach(userId -> {
noticeList.add(
new CommonUserNoticeEntity()
.setUserId(userId)
.setTitle(userNotice.getTitle())
.setContent(userNotice.getContent())
.setNoticeType(userNotice.getNoticeType())
.setHasRead(0)
);
});
if (!saveBatch(noticeList)) {
throw new RuntimeException("批量保存用户通知失败");
} else {
noticeList.clear();
}
}
} else {
throw new RuntimeException("通知范围错误");
}
return Boolean.TRUE;
} }
@Override @Override
@@ -162,10 +106,12 @@ public class CommonUserNoticeServiceImpl extends BaseServiceImpl<CommonUserNotic
public CommonUserNoticeDetailApiVO userNoticeDetail(Long id) { public CommonUserNoticeDetailApiVO userNoticeDetail(Long id) {
CommonUserNoticeEntity notice = getById(id); CommonUserNoticeEntity notice = getById(id);
Assert.notNull(notice, "无效消息"); Assert.notNull(notice, "无效消息");
Assert.isTrue(Objects.equals(notice.getUserId(), AuthUtil.getUserId()), "无效消息"); if (notice.getNoticeType() != NoticeType.GLOBAL.getCode() && notice.getNoticeType() != NoticeType.APP_SYSTEM.getCode() && notice.getNoticeType() != NoticeType.MARKET_SYSTEM.getCode()) {
if (notice.getHasRead() == 0) { Assert.isTrue(Objects.equals(notice.getUserId(), AuthUtil.getUserId()), "无效消息");
notice.setHasRead(1); if (notice.getHasRead() == 0) {
updateById(notice); notice.setHasRead(1);
updateById(notice);
}
} }
return AppCommonConvert.INSTANCE.convertNoticeDetailVO(notice); return AppCommonConvert.INSTANCE.convertNoticeDetailVO(notice);
} }

View File

@@ -29,26 +29,33 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.jsonwebtoken.lang.Assert; import io.jsonwebtoken.lang.Assert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.redis.debounce.RedisDebounce;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.api.request.CreateOrderRequest; import org.springblade.modules.api.request.CreateOrderRequest;
import org.springblade.modules.api.request.PaymentRequest; import org.springblade.modules.api.request.PaymentRequest;
import org.springblade.modules.api.response.CreateOrderResponse; import org.springblade.modules.api.response.CreateOrderResponse;
import org.springblade.modules.api.response.PaymentResponse; import org.springblade.modules.api.response.PaymentResponse;
import org.springblade.modules.api.vo.CommonUserOrderApiVO; import org.springblade.modules.api.vo.CommonUserOrderApiVO;
import org.springblade.modules.api.vo.CommonUserOrderDetailApiVO;
import org.springblade.modules.common.convert.AppCommonConvert; import org.springblade.modules.common.convert.AppCommonConvert;
import org.springblade.modules.common.eums.BusinessModule;
import org.springblade.modules.common.eums.OrderStatus; import org.springblade.modules.common.eums.OrderStatus;
import org.springblade.modules.common.eums.PaymentStatus; import org.springblade.modules.common.eums.PaymentStatus;
import org.springblade.modules.common.event.PaymentSuccessEvent;
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity; import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO; import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
import org.springblade.modules.common.excel.CommonUserOrderExcel; import org.springblade.modules.common.excel.CommonUserOrderExcel;
import org.springblade.modules.common.mapper.CommonUserOrderMapper; import org.springblade.modules.common.mapper.CommonUserOrderMapper;
import org.springblade.modules.common.service.ICommonUserOrderService; import org.springblade.modules.common.service.ICommonUserOrderService;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springblade.modules.mall.pojo.entity.MallProductEntity; import org.springblade.modules.mall.pojo.entity.MallProductEntity;
import org.springblade.modules.mall.service.IMallProductService; import org.springblade.modules.mall.service.IMallProductService;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
@@ -69,6 +76,10 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
private final IMallProductService productService; private final IMallProductService productService;
private final ApplicationEventPublisher eventPublisher;
private final ICommonUserPointService userPointService;
@Override @Override
public IPage<CommonUserOrderVO> selectOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order) { public IPage<CommonUserOrderVO> selectOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order) {
@@ -92,22 +103,24 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
if (!request.getIsOfflinePayment()) { if (!request.getIsOfflinePayment()) {
discount = BigDecimal.valueOf(new Random().nextInt(99) + 1, 2); discount = BigDecimal.valueOf(new Random().nextInt(99) + 1, 2);
} }
return switch (orderType) { return switch (BusinessModule.fromCodeIgnoreCaseOrNull(orderType)) {
case "MALL" -> { case SELF_OPERATED_MALL -> {
MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode())); MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode()));
Assert.notNull(product, "无效商品"); Assert.notNull(product, "无效商品");
CommonUserOrderEntity order = AppCommonConvert.INSTANCE.convertMallProductToOrder(request, product); CommonUserOrderEntity order = AppCommonConvert.INSTANCE.convertMallProductToOrder(request, product);
BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN); BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN);
BigDecimal actualAmount = totalAmount.subtract(discount); BigDecimal actualAmount = totalAmount.subtract(discount);
order.setOrderType(BusinessModule.SELF_OPERATED_MALL.getCode());
order.setUserId(AuthUtil.getUserId()); order.setUserId(AuthUtil.getUserId());
order.setTotalAmount(totalAmount); order.setTotalAmount(totalAmount);
order.setActualAmount(actualAmount); order.setActualAmount(actualAmount);
order.setOrderType(orderType); order.setOrderType(orderType);
order.setPaymentType(request.getIsOfflinePayment() ? request.getPaymentType() : null); order.setPaymentType(request.getIsOfflinePayment() ? request.getPaymentType() : null);
save(order); order.setCreateTime(new Date());
this.save(order);
yield new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount); yield new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
} }
case "FILTER" -> { case TRAVEL_GROUP -> {
yield new CreateOrderResponse("", BigDecimal.ZERO, BigDecimal.ZERO, discount); yield new CreateOrderResponse("", BigDecimal.ZERO, BigDecimal.ZERO, discount);
} }
default -> throw new IllegalArgumentException("不支持的订单类型: " + request.getOrderType()); default -> throw new IllegalArgumentException("不支持的订单类型: " + request.getOrderType());
@@ -116,10 +129,10 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
@Override @Override
public PaymentResponse pay(PaymentRequest request) { public PaymentResponse pay(PaymentRequest request) {
//todo先判断是否为线下支付,如果是线下支付则立即返回
CommonUserOrderEntity order = getById(Long.valueOf(request.getOrderId())); CommonUserOrderEntity order = getById(Long.valueOf(request.getOrderId()));
Assert.notNull(order, "无效订单"); Assert.notNull(order, "无效订单");
Assert.isTrue(order.getPaymentType() != 99, "线下订单不能重复支付"); Assert.isTrue(order.getPaymentType() != 99, "线下订单不能重复支付");
//todo: 继续支付逻辑
return null; return null;
} }
@@ -133,17 +146,40 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
} }
@Override @Override
public boolean confirmPayment(CommonUserOrderEntity order) { public CommonUserOrderDetailApiVO orderDetail(Long id) {
return update(Wrappers.<CommonUserOrderEntity>lambdaUpdate() CommonUserOrderEntity order = getById(id);
Assert.notNull(order, "无效订单");
return AppCommonConvert.INSTANCE.convertOrderDetailApiVO(order);
}
@Override
@Transactional(rollbackFor = Exception.class)
@RedisDebounce(key = "order:confirm", param = "#id", interval = 20, includeRemainingTime = true, message = "操作过于频繁")
public boolean confirmPayment(Long id) {
boolean updated = update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()
.set(CommonUserOrderEntity::getOrderStatus, OrderStatus.PAID.getCode()) .set(CommonUserOrderEntity::getOrderStatus, OrderStatus.PAID.getCode())
.set(CommonUserOrderEntity::getPaymentStatus, PaymentStatus.PAID.getCode()) .set(CommonUserOrderEntity::getPaymentStatus, PaymentStatus.PAID.getCode())
.set(CommonUserOrderEntity::getPaymentTime, new Date()) .set(CommonUserOrderEntity::getPaymentTime, new Date())
.eq(CommonUserOrderEntity::getId, order.getId()) .eq(CommonUserOrderEntity::getId, id)
.eq(CommonUserOrderEntity::getPaymentType, 99) .eq(CommonUserOrderEntity::getPaymentType, 99)
.eq(CommonUserOrderEntity::getOrderStatus, 0) .eq(CommonUserOrderEntity::getOrderStatus, 0)
.eq(CommonUserOrderEntity::getPaymentStatus, 0) .eq(CommonUserOrderEntity::getPaymentStatus, 0)
.eq(CommonUserOrderEntity::getIsDeleted, 0) .eq(CommonUserOrderEntity::getIsDeleted, 0)
); );
if (!updated) {
// 可能已被处理过,或状态不符 → 幂等返回 true(避免报错)
log.warn("订单 {} 无需处理或已处理", id);
return true; // ⭐ 幂等:已成功过就不要再失败
}
CommonUserOrderEntity order = getById(id);
if (order == null) {
throw new IllegalStateException("订单更新成功但查询不到,id=" + id);
}
userPointService.grantPointsByUserOrder(order);
eventPublisher.publishEvent(new PaymentSuccessEvent(id, order.getUserId(), BusinessModule.SELF_OPERATED_MALL));
return true;
} }

View File

@@ -0,0 +1,45 @@
package org.springblade.modules.common.service.impl;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
import org.springblade.modules.common.mapper.CommonUserPointLogMapper;
import org.springblade.modules.common.service.ICommonUserPointLogService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import java.math.BigDecimal;
/**
* 用户商城积分流水表 服务实现类
*
* @author BladeX
* @since 2026-02-12
*/
@Service
public class CommonUserPointLogServiceImpl extends BaseServiceImpl<CommonUserPointLogMapper, CommonUserPointLogEntity> implements ICommonUserPointLogService {
@Override
public IPage<CommonUserPointLogVO> selectCommonUserPointLogPage(IPage<CommonUserPointLogVO> page, CommonUserPointLogVO commonUserPointLog) {
return page.setRecords(baseMapper.selectCommonUserPointLogPage(page, commonUserPointLog));
}
@Override
public Boolean recordPointChangeLog(CommonUserPointEntity commonUserPoint, BigDecimal lastAmount, String sourceType, BigDecimal amount, Integer type, Long sourceId, String sourceDetail) {
CommonUserPointLogEntity userPointLog = new CommonUserPointLogEntity();
userPointLog.setType(type);
userPointLog.setUserId(commonUserPoint.getId());
userPointLog.setAmount(amount);
userPointLog.setSourceType(sourceType);
userPointLog.setSourceId(sourceId);
userPointLog.setSourceDetail(sourceDetail);
userPointLog.setIsComplete(1);
userPointLog.setStatisticalDate(DateUtil.getToday());
userPointLog.setLastAmount(lastAmount);
return save(userPointLog);
}
}

View File

@@ -0,0 +1,100 @@
package org.springblade.modules.common.service.impl;
import com.alibaba.fastjson2.JSON;
import io.jsonwebtoken.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.common.eums.BusinessModule;
import org.springblade.modules.common.eums.UserPointFlowType;
import org.springblade.modules.common.event.GrantUserPointEvent;
import org.springblade.modules.common.event.SpendUserPointEvent;
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
import org.springblade.modules.common.mapper.CommonUserPointMapper;
import org.springblade.modules.common.service.ICommonUserPointLogService;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import static org.springblade.modules.common.eums.BusinessModule.LOTTERY;
import static org.springblade.modules.common.eums.BusinessModule.SELF_OPERATED_MALL;
/**
* 用户积分表 服务实现类
*
* @author BladeX
* @since 2026-02-12
*/
@Slf4j
@Service
@AllArgsConstructor
public class CommonUserPointServiceImpl extends BaseServiceImpl<CommonUserPointMapper, CommonUserPointEntity> implements ICommonUserPointService {
private final ICommonUserPointLogService userPointLogService;
private final ApplicationEventPublisher eventPublisher;
@Override
public IPage<CommonUserPointVO> selectCommonUserPointPage(IPage<CommonUserPointVO> page, CommonUserPointVO commonUserPoint) {
return page.setRecords(baseMapper.selectCommonUserPointPage(page, commonUserPoint));
}
@Override
public BigDecimal queryPoint() {
CommonUserPointEntity userPoint = getById(AuthUtil.getUserId());
return userPoint.getAmount();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void grantPointsByUserOrder(CommonUserOrderEntity order) {
Assert.notNull(order, "无效订单");
Assert.isTrue(order.getId() != null && order.getUserId() != null && order.getActualAmount() != null && order.getActualAmount().compareTo(BigDecimal.ZERO) > 0, "无效订单");
BigDecimal pointsAmount;
String sourceType;
switch (BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType())) {
case SELF_OPERATED_MALL -> {
pointsAmount = order.getActualAmount().multiply(BigDecimal.valueOf(0.3));
sourceType = SELF_OPERATED_MALL.getCode();
}
default -> throw new RuntimeException("无效订单类型");
}
CommonUserPointEntity userPoint = getById(order.getUserId());
BigDecimal lastAmount = userPoint.getAmount();
int i = baseMapper.addUserPoint(order.getUserId(), pointsAmount, userPoint.getVersion());
if (i > 0) {
if (userPointLogService.recordPointChangeLog(userPoint, lastAmount, sourceType.toUpperCase(), pointsAmount, UserPointFlowType.GRANT.getCode(), order.getId(), JSON.toJSONString(order))) {
eventPublisher.publishEvent(new GrantUserPointEvent(order.getId(), order.getUserId(), pointsAmount, BusinessModule.fromCodeIgnoreCaseOrNull(sourceType)));
return;
}
}
throw new RuntimeException("奖励用户积分失败");
}
@Override
@Transactional(rollbackFor = Exception.class)
public void spendPointsForLottery(BigDecimal amount, Long userId) {
Assert.isTrue(amount.compareTo(BigDecimal.valueOf(100)) == 0 || amount.compareTo(BigDecimal.valueOf(1000)) == 0, "无效积分");
Assert.notNull(userId, "无效用户");
CommonUserPointEntity userPoint = getById(userId);
Assert.isTrue(userPoint.getAmount().compareTo(amount) >= 0, "积分不足");
BigDecimal lastAmount = userPoint.getAmount();
int i = baseMapper.deductUserPoint(userId, amount, userPoint.getVersion());
if (i > 0) {
if (userPointLogService.recordPointChangeLog(userPoint, lastAmount, LOTTERY.getCode().toUpperCase(), amount.negate(), UserPointFlowType.SPEND.getCode(), null, null)) {
eventPublisher.publishEvent(new SpendUserPointEvent(userId, amount, LOTTERY));
return;
}
}
throw new RuntimeException("消费用户积分失败");
}
}

View File

@@ -0,0 +1,59 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import java.util.Objects;
/**
* 奖品配置表 包装类,返回视图层所需的字段
*
* @author RayLiu
* @since 2026-02-14
*/
public class CommonLotteryPrizeWrapper extends BaseEntityWrapper<CommonLotteryPrizeEntity, CommonLotteryPrizeVO> {
public static CommonLotteryPrizeWrapper build() {
return new CommonLotteryPrizeWrapper();
}
@Override
public CommonLotteryPrizeVO entityVO(CommonLotteryPrizeEntity lotteryPrize) {
CommonLotteryPrizeVO lotteryPrizeVO = Objects.requireNonNull(BeanUtil.copyProperties(lotteryPrize, CommonLotteryPrizeVO.class));
//User createUser = UserCache.getUser(lotteryPrize.getCreateUser());
//User updateUser = UserCache.getUser(lotteryPrize.getUpdateUser());
//lotteryPrizeVO.setCreateUserName(createUser.getName());
//lotteryPrizeVO.setUpdateUserName(updateUser.getName());
return lotteryPrizeVO;
}
}

View File

@@ -0,0 +1,59 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import java.util.Objects;
/**
* 抽奖记录表 包装类,返回视图层所需的字段
*
* @author RayLiu
* @since 2026-02-14
*/
public class CommonLotteryRecordWrapper extends BaseEntityWrapper<CommonLotteryRecordEntity, CommonLotteryRecordVO> {
public static CommonLotteryRecordWrapper build() {
return new CommonLotteryRecordWrapper();
}
@Override
public CommonLotteryRecordVO entityVO(CommonLotteryRecordEntity lotteryRecord) {
CommonLotteryRecordVO lotteryRecordVO = Objects.requireNonNull(BeanUtil.copyProperties(lotteryRecord, CommonLotteryRecordVO.class));
//User createUser = UserCache.getUser(lotteryRecord.getCreateUser());
//User updateUser = UserCache.getUser(lotteryRecord.getUpdateUser());
//lotteryRecordVO.setCreateUserName(createUser.getName());
//lotteryRecordVO.setUpdateUserName(updateUser.getName());
return lotteryRecordVO;
}
}

View File

@@ -0,0 +1,59 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
import java.util.Objects;
/**
* 用户商城积分流水表 包装类,返回视图层所需的字段
*
* @author BladeX
* @since 2026-02-12
*/
public class CommonUserPointLogWrapper extends BaseEntityWrapper<CommonUserPointLogEntity, CommonUserPointLogVO> {
public static CommonUserPointLogWrapper build() {
return new CommonUserPointLogWrapper();
}
@Override
public CommonUserPointLogVO entityVO(CommonUserPointLogEntity commonUserPointLog) {
CommonUserPointLogVO commonUserPointLogVO = Objects.requireNonNull(BeanUtil.copyProperties(commonUserPointLog, CommonUserPointLogVO.class));
//User createUser = UserCache.getUser(commonUserPointLog.getCreateUser());
//User updateUser = UserCache.getUser(commonUserPointLog.getUpdateUser());
//commonUserPointLogVO.setCreateUserName(createUser.getName());
//commonUserPointLogVO.setUpdateUserName(updateUser.getName());
return commonUserPointLogVO;
}
}

View File

@@ -0,0 +1,59 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
import java.util.Objects;
/**
* 用户商城积分表 包装类,返回视图层所需的字段
*
* @author BladeX
* @since 2026-02-12
*/
public class CommonUserPointWrapper extends BaseEntityWrapper<CommonUserPointEntity, CommonUserPointVO> {
public static CommonUserPointWrapper build() {
return new CommonUserPointWrapper();
}
@Override
public CommonUserPointVO entityVO(CommonUserPointEntity commonUserPoint) {
CommonUserPointVO commonUserPointVO = Objects.requireNonNull(BeanUtil.copyProperties(commonUserPoint, CommonUserPointVO.class));
//User createUser = UserCache.getUser(commonUserPoint.getCreateUser());
//User updateUser = UserCache.getUser(commonUserPoint.getUpdateUser());
//commonUserPointVO.setCreateUserName(createUser.getName());
//commonUserPointVO.setUpdateUserName(updateUser.getName());
return commonUserPointVO;
}
}

View File

@@ -0,0 +1,114 @@
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageVO;
import org.springblade.modules.market.wrapper.MarketBenefitPackageWrapper;
import org.springblade.modules.market.service.IMarketBenefitPackageService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 用户积分包信息表 控制器
*
* @author BladeX
* @since 2026-02-05
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-package/")
@Tag(name = "用户积分包信息表", description = "用户积分包信息表接口")
public class MarketBenefitPackageController extends BladeController {
private final IMarketBenefitPackageService userMarketBenefitPackageService;
/**
* 用户积分包信息表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入userMarketBenefitPackage")
public R<MarketBenefitPackageVO> detail(MarketBenefitPackageEntity userMarketBenefitPackage) {
MarketBenefitPackageEntity detail = userMarketBenefitPackageService.getOne(Condition.getQueryWrapper(userMarketBenefitPackage));
return R.data(MarketBenefitPackageWrapper.build().entityVO(detail));
}
/**
* 用户积分包信息表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
public R<IPage<MarketBenefitPackageVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userMarketBenefitPackage, Query query) {
IPage<MarketBenefitPackageEntity> pages = userMarketBenefitPackageService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackage, MarketBenefitPackageEntity.class).orderByDesc("id"));
return R.data(MarketBenefitPackageWrapper.build().pageVO(pages));
}
/**
* 用户积分包信息表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
public R<IPage<MarketBenefitPackageVO>> page(MarketBenefitPackageVO userMarketBenefitPackage, Query query) {
IPage<MarketBenefitPackageVO> pages = userMarketBenefitPackageService.selectUserMarketBenefitPackagePage(Condition.getPage(query), userMarketBenefitPackage);
return R.data(pages);
}
/**
* 用户积分包信息表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入userMarketBenefitPackage")
public R save(@Valid @RequestBody MarketBenefitPackageEntity userMarketBenefitPackage) {
return R.status(userMarketBenefitPackageService.save(userMarketBenefitPackage));
}
/**
* 用户积分包信息表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入userMarketBenefitPackage")
public R update(@Valid @RequestBody MarketBenefitPackageEntity userMarketBenefitPackage) {
return R.status(userMarketBenefitPackageService.updateById(userMarketBenefitPackage));
}
/**
* 用户积分包信息表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入userMarketBenefitPackage")
public R submit(@Valid @RequestBody MarketBenefitPackageEntity userMarketBenefitPackage) {
return R.status(userMarketBenefitPackageService.saveOrUpdate(userMarketBenefitPackage));
}
/**
* 用户积分包信息表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(userMarketBenefitPackageService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,114 @@
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageLogEntity;
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageLogVO;
import org.springblade.modules.market.wrapper.MarketBenefitPackageLogWrapper;
import org.springblade.modules.market.service.IMarketBenefitPackageLogService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 划拨积分记录 控制器
*
* @author BladeX
* @since 2026-02-05
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-package-log")
@Tag(name = "划拨积分记录", description = "划拨积分记录接口")
public class MarketBenefitPackageLogController extends BladeController {
private final IMarketBenefitPackageLogService userMarketBenefitPackageLogService;
/**
* 划拨积分记录 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入userMarketBenefitPackageLog")
public R<MarketBenefitPackageLogVO> detail(MarketBenefitPackageLogEntity userMarketBenefitPackageLog) {
MarketBenefitPackageLogEntity detail = userMarketBenefitPackageLogService.getOne(Condition.getQueryWrapper(userMarketBenefitPackageLog));
return R.data(MarketBenefitPackageLogWrapper.build().entityVO(detail));
}
/**
* 划拨积分记录 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入userMarketBenefitPackageLog")
public R<IPage<MarketBenefitPackageLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userMarketBenefitPackageLog, Query query) {
IPage<MarketBenefitPackageLogEntity> pages = userMarketBenefitPackageLogService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackageLog, MarketBenefitPackageLogEntity.class).orderByDesc("id"));
return R.data(MarketBenefitPackageLogWrapper.build().pageVO(pages));
}
/**
* 划拨积分记录 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入userMarketBenefitPackageLog")
public R<IPage<MarketBenefitPackageLogVO>> page(MarketBenefitPackageLogVO userMarketBenefitPackageLog, Query query) {
IPage<MarketBenefitPackageLogVO> pages = userMarketBenefitPackageLogService.selectUserMarketBenefitPackageLogPage(Condition.getPage(query), userMarketBenefitPackageLog);
return R.data(pages);
}
/**
* 划拨积分记录 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入userMarketBenefitPackageLog")
public R save(@Valid @RequestBody MarketBenefitPackageLogEntity userMarketBenefitPackageLog) {
return R.status(userMarketBenefitPackageLogService.save(userMarketBenefitPackageLog));
}
/**
* 划拨积分记录 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入userMarketBenefitPackageLog")
public R update(@Valid @RequestBody MarketBenefitPackageLogEntity userMarketBenefitPackageLog) {
return R.status(userMarketBenefitPackageLogService.updateById(userMarketBenefitPackageLog));
}
/**
* 划拨积分记录 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入userMarketBenefitPackageLog")
public R submit(@Valid @RequestBody MarketBenefitPackageLogEntity userMarketBenefitPackageLog) {
return R.status(userMarketBenefitPackageLogService.saveOrUpdate(userMarketBenefitPackageLog));
}
/**
* 划拨积分记录 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(userMarketBenefitPackageLogService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,133 @@
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.market.pojo.vo.MarketImportBenefitPackageError;
import org.springblade.modules.market.request.AllocatePackRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageTemplateEntity;
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageTemplateVO;
import org.springblade.modules.market.wrapper.MarketBenefitPackageTemplateWrapper;
import org.springblade.modules.market.service.IMarketBenefitPackageTemplateService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 积分包信息表 控制器
*
* @author BladeX
* @since 2026-02-05
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-package-template")
@Tag(name = "积分包信息表", description = "积分包信息表接口")
public class MarketBenefitPackageTemplateController extends BladeController {
private final IMarketBenefitPackageTemplateService userMarketBenefitPackageTemplateService;
/**
* 积分包信息表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入userMarketBenefitPackageTemplate")
public R<MarketBenefitPackageTemplateVO> detail(MarketBenefitPackageTemplateEntity userMarketBenefitPackageTemplate) {
MarketBenefitPackageTemplateEntity detail = userMarketBenefitPackageTemplateService.getOne(Condition.getQueryWrapper(userMarketBenefitPackageTemplate));
return R.data(MarketBenefitPackageTemplateWrapper.build().entityVO(detail));
}
/**
* 积分包信息表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入userMarketBenefitPackageTemplate")
public R<IPage<MarketBenefitPackageTemplateVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userMarketBenefitPackageTemplate, Query query) {
IPage<MarketBenefitPackageTemplateEntity> pages = userMarketBenefitPackageTemplateService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackageTemplate, MarketBenefitPackageTemplateEntity.class).orderByDesc("id"));
return R.data(MarketBenefitPackageTemplateWrapper.build().pageVO(pages));
}
/**
* 积分包信息表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入userMarketBenefitPackageTemplate")
public R<IPage<MarketBenefitPackageTemplateVO>> page(MarketBenefitPackageTemplateVO userMarketBenefitPackageTemplate, Query query) {
IPage<MarketBenefitPackageTemplateVO> pages = userMarketBenefitPackageTemplateService.selectUserMarketBenefitPackageTemplatePage(Condition.getPage(query), userMarketBenefitPackageTemplate);
return R.data(pages);
}
/**
* 积分包信息表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入userMarketBenefitPackageTemplate")
public R save(@Valid @RequestBody MarketBenefitPackageTemplateEntity userMarketBenefitPackageTemplate) {
return R.status(userMarketBenefitPackageTemplateService.save(userMarketBenefitPackageTemplate));
}
/**
* 积分包信息表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入userMarketBenefitPackageTemplate")
public R update(@Valid @RequestBody MarketBenefitPackageTemplateEntity userMarketBenefitPackageTemplate) {
return R.status(userMarketBenefitPackageTemplateService.updateById(userMarketBenefitPackageTemplate));
}
/**
* 积分包信息表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入userMarketBenefitPackageTemplate")
public R submit(@Valid @RequestBody MarketBenefitPackageTemplateEntity userMarketBenefitPackageTemplate) {
return R.status(userMarketBenefitPackageTemplateService.saveOrUpdate(userMarketBenefitPackageTemplate));
}
/**
* 积分包信息表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(userMarketBenefitPackageTemplateService.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/allocate-benefit-package")
@ApiOperationSupport(order = 5)
@Operation(summary = "划拨福利包")
public R allocatePackToUser(@Valid @RequestBody AllocatePackRequest request) {
return R.status(userMarketBenefitPackageTemplateService.allocatePackToUser(request));
}
@PostMapping("import-benefit-package")
@ApiOperationSupport(order = 6)
@Operation(summary = "导入福利包", description = "传入excel")
public R<List<MarketImportBenefitPackageError>> importBenefitPackage(MultipartFile file) {
return R.data(userMarketBenefitPackageTemplateService.importBenefitPackage(file));
}
}

View File

@@ -0,0 +1,124 @@
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.market.manager.MarketUserPointManager;
import org.springblade.modules.market.request.BenefitPointTransferRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
import org.springblade.modules.market.pojo.vo.MarketBenefitPointVO;
import org.springblade.modules.market.wrapper.MarketBenefitPointWrapper;
import org.springblade.modules.market.service.IMarketBenefitPointService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 用户福利值表 控制器
*
* @author BladeX
* @since 2026-02-12
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-point")
@Tag(name = "用户福利值表", description = "用户福利值表接口")
public class MarketBenefitPointController extends BladeController {
private final IMarketBenefitPointService marketBenefitPointService;
private final MarketUserPointManager marketUserPointManager;
/**
* 用户福利值表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonBenefitPoint")
public R<MarketBenefitPointVO> detail(MarketBenefitPointEntity commonBenefitPoint) {
MarketBenefitPointEntity detail = marketBenefitPointService.getOne(Condition.getQueryWrapper(commonBenefitPoint));
return R.data(MarketBenefitPointWrapper.build().entityVO(detail));
}
/**
* 用户福利值表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonBenefitPoint")
public R<IPage<MarketBenefitPointVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonBenefitPoint, Query query) {
IPage<MarketBenefitPointEntity> pages = marketBenefitPointService.page(Condition.getPage(query), Condition.getQueryWrapper(commonBenefitPoint, MarketBenefitPointEntity.class));
return R.data(MarketBenefitPointWrapper.build().pageVO(pages));
}
/**
* 用户福利值表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonBenefitPoint")
public R<IPage<MarketBenefitPointVO>> page(MarketBenefitPointVO commonBenefitPoint, Query query) {
IPage<MarketBenefitPointVO> pages = marketBenefitPointService.selectCommonBenefitPointPage(Condition.getPage(query), commonBenefitPoint);
return R.data(pages);
}
/**
* 用户福利值表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonBenefitPoint")
public R save(@Valid @RequestBody MarketBenefitPointEntity commonBenefitPoint) {
return R.status(marketBenefitPointService.save(commonBenefitPoint));
}
/**
* 用户福利值表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonBenefitPoint")
public R update(@Valid @RequestBody MarketBenefitPointEntity commonBenefitPoint) {
return R.status(marketBenefitPointService.updateById(commonBenefitPoint));
}
/**
* 用户福利值表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonBenefitPoint")
public R submit(@Valid @RequestBody MarketBenefitPointEntity commonBenefitPoint) {
return R.status(marketBenefitPointService.saveOrUpdate(commonBenefitPoint));
}
/**
* 用户福利值表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(marketBenefitPointService.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/transfer")
@ApiOperationSupport(order = 8)
@Operation(summary = "划拨福利积分", description = "传入request")
public R transfer(@RequestBody BenefitPointTransferRequest request) {
return R.status(marketUserPointManager.transfer(request));
}
}

View File

@@ -0,0 +1,112 @@
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.vo.MarketBenefitPointLogVO;
import org.springblade.modules.market.wrapper.MarketBenefitPointLogWrapper;
import org.springblade.modules.market.service.IMarketBenefitPointLogService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 用户福利值流水表 控制器
*
* @author BladeX
* @since 2026-02-12
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-point-log")
@Tag(name = "用户福利值流水表", description = "用户福利值流水表接口")
public class MarketBenefitPointLogController extends BladeController {
private final IMarketBenefitPointLogService marketBenefitPointLogService;
/**
* 用户福利值流水表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonBenefitPointLog")
public R<MarketBenefitPointLogVO> detail(MarketBenefitPointLogEntity commonBenefitPointLog) {
MarketBenefitPointLogEntity detail = marketBenefitPointLogService.getOne(Condition.getQueryWrapper(commonBenefitPointLog));
return R.data(MarketBenefitPointLogWrapper.build().entityVO(detail));
}
/**
* 用户福利值流水表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonBenefitPointLog")
public R<IPage<MarketBenefitPointLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonBenefitPointLog, Query query) {
IPage<MarketBenefitPointLogEntity> pages = marketBenefitPointLogService.page(Condition.getPage(query), Condition.getQueryWrapper(commonBenefitPointLog, MarketBenefitPointLogEntity.class));
return R.data(MarketBenefitPointLogWrapper.build().pageVO(pages));
}
/**
* 用户福利值流水表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonBenefitPointLog")
public R<IPage<MarketBenefitPointLogVO>> page(MarketBenefitPointLogVO commonBenefitPointLog, Query query) {
IPage<MarketBenefitPointLogVO> pages = marketBenefitPointLogService.selectCommonBenefitPointLogPage(Condition.getPage(query), commonBenefitPointLog);
return R.data(pages);
}
/**
* 用户福利值流水表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonBenefitPointLog")
public R save(@Valid @RequestBody MarketBenefitPointLogEntity commonBenefitPointLog) {
return R.status(marketBenefitPointLogService.save(commonBenefitPointLog));
}
/**
* 用户福利值流水表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonBenefitPointLog")
public R update(@Valid @RequestBody MarketBenefitPointLogEntity commonBenefitPointLog) {
return R.status(marketBenefitPointLogService.updateById(commonBenefitPointLog));
}
/**
* 用户福利值流水表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonBenefitPointLog")
public R submit(@Valid @RequestBody MarketBenefitPointLogEntity commonBenefitPointLog) {
return R.status(marketBenefitPointLogService.saveOrUpdate(commonBenefitPointLog));
}
/**
* 用户福利值流水表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(marketBenefitPointLogService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,111 @@
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.entity.MarketCashCouponEntity;
import org.springblade.modules.market.pojo.vo.MarketCashCouponVO;
import org.springblade.modules.market.wrapper.MarketCashCouponWrapper;
import org.springblade.modules.market.service.IMarketCashCouponService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 用户现金券表 控制器
*
* @author BladeX
* @since 2026-02-12
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/cash-coupon")
@Tag(name = "用户现金券表", description = "用户现金券表接口")
public class MarketCashCouponController extends BladeController {
private final IMarketCashCouponService marketCashCouponService;
/**
* 用户现金券表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonCashCoupon")
public R<MarketCashCouponVO> detail(MarketCashCouponEntity commonCashCoupon) {
MarketCashCouponEntity detail = marketCashCouponService.getOne(Condition.getQueryWrapper(commonCashCoupon));
return R.data(MarketCashCouponWrapper.build().entityVO(detail));
}
/**
* 用户现金券表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonCashCoupon")
public R<IPage<MarketCashCouponVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonCashCoupon, Query query) {
IPage<MarketCashCouponEntity> pages = marketCashCouponService.page(Condition.getPage(query), Condition.getQueryWrapper(commonCashCoupon, MarketCashCouponEntity.class));
return R.data(MarketCashCouponWrapper.build().pageVO(pages));
}
/**
* 用户现金券表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonCashCoupon")
public R<IPage<MarketCashCouponVO>> page(MarketCashCouponVO commonCashCoupon, Query query) {
IPage<MarketCashCouponVO> pages = marketCashCouponService.selectCommonCashCouponPage(Condition.getPage(query), commonCashCoupon);
return R.data(pages);
}
/**
* 用户现金券表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonCashCoupon")
public R save(@Valid @RequestBody MarketCashCouponEntity commonCashCoupon) {
return R.status(marketCashCouponService.save(commonCashCoupon));
}
/**
* 用户现金券表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonCashCoupon")
public R update(@Valid @RequestBody MarketCashCouponEntity commonCashCoupon) {
return R.status(marketCashCouponService.updateById(commonCashCoupon));
}
/**
* 用户现金券表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonCashCoupon")
public R submit(@Valid @RequestBody MarketCashCouponEntity commonCashCoupon) {
return R.status(marketCashCouponService.saveOrUpdate(commonCashCoupon));
}
/**
* 用户现金券表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(marketCashCouponService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,112 @@
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.market.pojo.entity.MarketCashCouponLogEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.vo.MarketCashCouponLogVO;
import org.springblade.modules.market.wrapper.MarketCashCouponLogWrapper;
import org.springblade.modules.market.service.IMarketCashCouponLogService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 用户现金券流水表 控制器
*
* @author BladeX
* @since 2026-02-12
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/cash-coupon-log")
@Tag(name = "用户现金券流水表", description = "用户现金券流水表接口")
public class MarketCashCouponLogController extends BladeController {
private final IMarketCashCouponLogService marketCashCouponLogService;
/**
* 用户现金券流水表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonCashCouponLog")
public R<MarketCashCouponLogVO> detail(MarketCashCouponLogEntity commonCashCouponLog) {
MarketCashCouponLogEntity detail = marketCashCouponLogService.getOne(Condition.getQueryWrapper(commonCashCouponLog));
return R.data(MarketCashCouponLogWrapper.build().entityVO(detail));
}
/**
* 用户现金券流水表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonCashCouponLog")
public R<IPage<MarketCashCouponLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonCashCouponLog, Query query) {
IPage<MarketCashCouponLogEntity> pages = marketCashCouponLogService.page(Condition.getPage(query), Condition.getQueryWrapper(commonCashCouponLog, MarketCashCouponLogEntity.class));
return R.data(MarketCashCouponLogWrapper.build().pageVO(pages));
}
/**
* 用户现金券流水表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonCashCouponLog")
public R<IPage<MarketCashCouponLogVO>> page(MarketCashCouponLogVO commonCashCouponLog, Query query) {
IPage<MarketCashCouponLogVO> pages = marketCashCouponLogService.selectCommonCashCouponLogPage(Condition.getPage(query), commonCashCouponLog);
return R.data(pages);
}
/**
* 用户现金券流水表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonCashCouponLog")
public R save(@Valid @RequestBody MarketCashCouponLogEntity commonCashCouponLog) {
return R.status(marketCashCouponLogService.save(commonCashCouponLog));
}
/**
* 用户现金券流水表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonCashCouponLog")
public R update(@Valid @RequestBody MarketCashCouponLogEntity commonCashCouponLog) {
return R.status(marketCashCouponLogService.updateById(commonCashCouponLog));
}
/**
* 用户现金券流水表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonCashCouponLog")
public R submit(@Valid @RequestBody MarketCashCouponLogEntity commonCashCouponLog) {
return R.status(marketCashCouponLogService.saveOrUpdate(commonCashCouponLog));
}
/**
* 用户现金券流水表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(marketCashCouponLogService.deleteLogic(Func.toLongList(ids)));
}
}

Some files were not shown because too many files have changed in this diff Show More