You've already forked FrameTour-BE
feat(pricing): 实现优惠券打印功能
- 新增 AppVoucherController 控制器处理打印请求 - 实现 VoucherPrintService 接口和 VoucherPrintServiceImpl 实现类 - 添加 VoucherPrintReq 请求对象和 VoucherPrintResp 响应对象 - 创建 VoucherPrintRecord 实体和对应的 Mapper - 更新 PriceVoucherCodeMapper 接口,添加随机获取未打印券码的方法 - 实现分布式锁机制防止重复打印- 生成流水号并记录打印状态
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.ycwl.basic.controller.mobile;
|
||||
|
||||
import com.ycwl.basic.pricing.dto.req.VoucherPrintReq;
|
||||
import com.ycwl.basic.pricing.dto.resp.VoucherPrintResp;
|
||||
import com.ycwl.basic.pricing.service.VoucherPrintService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/mobile/voucher/v1")
|
||||
public class AppVoucherController {
|
||||
|
||||
@Autowired
|
||||
private VoucherPrintService voucherPrintService;
|
||||
|
||||
/**
|
||||
* 打印小票
|
||||
* @param request 打印请求
|
||||
* @return 打印结果
|
||||
*/
|
||||
@PostMapping("/print")
|
||||
public ApiResponse<VoucherPrintResp> printVoucherTicket(@RequestBody VoucherPrintReq request) {
|
||||
log.info("收到打印小票请求: faceId={}, brokerId={}, scenicId={}",
|
||||
request.getFaceId(), request.getBrokerId(), request.getScenicId());
|
||||
|
||||
VoucherPrintResp response = voucherPrintService.printVoucherTicket(request);
|
||||
|
||||
log.info("打印小票完成: code={}, voucherCode={}, status={}",
|
||||
response.getCode(), response.getVoucherCode(), response.getPrintStatus());
|
||||
|
||||
return ApiResponse.success(response);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user