From 85bfb9351803d97a33329d507f30a2f78bf1fc75 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期一, 28 九月 2026 10:53:14 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/main'

---
 talent-card-server/src/main/java/com/talentcard/server/business/portal/BenefitVerificationCodeController.java |   47 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/talent-card-server/src/main/java/com/talentcard/server/business/portal/BenefitVerificationCodeController.java b/talent-card-server/src/main/java/com/talentcard/server/business/portal/BenefitVerificationCodeController.java
index ba864ab..64a7992 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/business/portal/BenefitVerificationCodeController.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/business/portal/BenefitVerificationCodeController.java
@@ -6,15 +6,22 @@
 import com.talentcard.server.request.BenefitVerificationCodeRequest;
 import com.talentcard.server.service.BenefitVerificationCodeService;
 import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import jakarta.validation.Valid;
+import org.springframework.http.CacheControl;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-@Tag(name = "小程序-权益核销码", description = "小程序生成电影票、酒店权益5分钟核销码")
+@Tag(name = "小程序-权益核销码", description = "小程序查询电影票、酒店权益额度并生成动态核销码")
 @RestController
 @RequestMapping("/api/app/benefit-verification-codes")
 public class BenefitVerificationCodeController {
@@ -24,7 +31,41 @@
         this.service = service;
     }
 
-    @Operation(summary = "生成权益核销码", description = "根据主卡/亲属附属卡共享额度、商户剩余券或酒店库存生成5分钟有效核销码")
+    @Operation(summary = "获取电影票兑换码二维码", description = "返回电影票固定兑换码二维码,核销或电影券有效期结束后失效")
+    @GetMapping(value = "/{claimId}/image", produces = MediaType.IMAGE_PNG_VALUE)
+    public ResponseEntity<byte[]> movieImage(
+            @Parameter(description = "电影票领取记录ID", required = true) @PathVariable Long claimId) {
+        return ResponseEntity.ok()
+                .cacheControl(CacheControl.noStore())
+                .body(service.movieCodeImage(claimId));
+    }
+
+    @Operation(summary = "获取观影权益兑换码二维码", description = "票包兑换码二维码,出示给影城扫码核销;已核销或过期后失效")
+    @GetMapping(value = "/ticket-package-claims/{claimId}/image", produces = MediaType.IMAGE_PNG_VALUE)
+    public ResponseEntity<byte[]> ticketPackageImage(
+            @Parameter(description = "票包领取记录ID", required = true) @PathVariable Long claimId) {
+        return ResponseEntity.ok()
+                .cacheControl(CacheControl.noStore())
+                .body(service.ticketPackageCodeImage(claimId));
+    }
+
+    @Operation(summary = "查询权益可用次数", description = "按主卡或亲属附属卡、人才卡等级和商户配置查询当前可用权益次数,不生成核销码")
+    @GetMapping("/quota")
+    public ApiResponse<Map<String, Object>> quota(
+            @Parameter(description = "权益类型:MOVIE_TICKET电影票、HOTEL酒店", required = true)
+            @RequestParam String benefitType,
+            @Parameter(description = "人才用户ID;未传cardId时必填")
+            @RequestParam(required = false) Long talentId,
+            @Parameter(description = "人才卡ID;支持主卡或亲属附属卡")
+            @RequestParam(required = false) Long cardId,
+            @Parameter(description = "商户ID", required = true)
+            @RequestParam Long merchantId
+    ) {
+        return ApiResponse.success(service.quota(new BenefitVerificationCodeRequest(
+                benefitType, talentId, cardId, merchantId)));
+    }
+
+    @Operation(summary = "生成权益核销码", description = "电影票生成固定兑换码,酒店生成60秒动态核销码")
     @PostMapping
     public ApiResponse<Map<String, Object>> create(
             @Valid @RequestBody BenefitVerificationCodeRequest request,
@@ -32,4 +73,4 @@
     ) {
         return ApiResponse.success(service.generate(request, idempotencyKey));
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.7.1