feat(coupon): 添加优惠券领取后有效期配置功能
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good

- 在数据库插入和更新操作中添加 valid_days_after_claim 字段支持
- 在使用优惠券时增加对优惠券全局有效性和领取记录过期时间的验证逻辑
- 添加对已过期领取记录的筛选和错误提示处理
- 新增优惠券使用请求、状态枚举和异常类的测试用例
- 实现优惠券配置的完整有效期验证流程
This commit is contained in:
2026-02-14 14:59:10 +08:00
parent 143185926c
commit 09d142aa98
10 changed files with 196 additions and 13 deletions

View File

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
import com.ycwl.basic.constant.BaseContextHandler;
import com.ycwl.basic.mapper.SourceMapper;
import com.ycwl.basic.mapper.VideoMapper;
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
@@ -95,6 +96,12 @@ public class AppOrderV2Controller {
request.setFaceId(video.getFaceId());
}
case RECORDING_SET, PHOTO_SET, AI_CAM_PHOTO_SET -> request.setFaceId(Long.valueOf(productItem.getProductId()));
case PHOTO -> {
MemberSourceEntity ms = sourceMapper.getMemberSourceByMemberAndSourceId(currentUserId, Long.valueOf(productItem.getProductId()));
if (ms != null) {
request.setFaceId(ms.getFaceId());
}
}
}
}
@@ -141,6 +148,9 @@ public class AppOrderV2Controller {
Integer _count = sourceMapper.countUser(aiPhotoSetReqQuery);
product.setQuantity(_count);
break;
case PHOTO:
product.setQuantity(1);
break;
default:
log.warn("未知的商品类型,跳过重复购买检查: productType={}", product.getProductType());
break;