From 0426a6e77ad62134685d7541b2410198de3e716f Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 08 五月 2026 16:51:17 +0800
Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile into 2.0
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TExchangeCodePackageController.java | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 111 insertions(+), 0 deletions(-)
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TExchangeCodePackageController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TExchangeCodePackageController.java
index 7c7984c..396e922 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TExchangeCodePackageController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TExchangeCodePackageController.java
@@ -52,6 +52,12 @@
@Resource
private TExchangeCodePackageService exchangeCodePackageService;
+ /**
+ * 分页查询兑换码卡包列表。
+ *
+ * @param query 查询条件
+ * @return 卡包分页结果
+ */
@RequiresPermissions(value = {"/exchangeCode"}, logical = Logical.OR)
@PostMapping("/pageList")
@ApiOperation(value = "兑换码卡包分页", tags = {"管理后台-兑换码管理"})
@@ -59,6 +65,12 @@
return AjaxResult.ok(exchangeCodePackageService.pageList(query));
}
+ /**
+ * 新增兑换码卡包。
+ *
+ * @param dto 卡包保存参数
+ * @return 操作结果
+ */
@RequiresPermissions(value = {"/exchangeCode/add"}, logical = Logical.OR)
@PostMapping("/save")
@ApiOperation(value = "新增兑换码卡包", tags = {"管理后台-兑换码管理"})
@@ -68,6 +80,12 @@
return AjaxResult.success();
}
+ /**
+ * 编辑兑换码卡包。
+ *
+ * @param dto 卡包保存参数
+ * @return 操作结果
+ */
@RequiresPermissions(value = {"/exchangeCode/update"}, logical = Logical.OR)
@PostMapping("/update")
@ApiOperation(value = "编辑兑换码卡包", tags = {"管理后台-兑换码管理"})
@@ -77,6 +95,12 @@
return AjaxResult.success();
}
+ /**
+ * 更新兑换码卡包启用状态。
+ *
+ * @param dto 卡包ID及状态参数
+ * @return 操作结果
+ */
@RequiresPermissions(value = {"/exchangeCode/update"}, logical = Logical.OR)
@PostMapping("/updateStatus")
@ApiOperation(value = "更新兑换码卡包启用状态", tags = {"管理后台-兑换码管理"})
@@ -86,6 +110,12 @@
return AjaxResult.success();
}
+ /**
+ * 删除兑换码卡包。
+ *
+ * @param ids 卡包ID,多个ID用英文逗号分隔
+ * @return 操作结果
+ */
@RequiresPermissions(value = {"/exchangeCode/del"}, logical = Logical.OR)
@GetMapping("/delete")
@ApiOperation(value = "删除兑换码卡包", tags = {"管理后台-兑换码管理"})
@@ -95,6 +125,12 @@
return AjaxResult.success();
}
+ /**
+ * 查询兑换码卡包详情。
+ *
+ * @param id 卡包ID
+ * @return 卡包详情
+ */
@RequiresPermissions(value = {"/exchangeCode/select"}, logical = Logical.OR)
@GetMapping("/detail")
@ApiOperation(value = "兑换码卡包详情", tags = {"管理后台-兑换码管理"})
@@ -102,6 +138,12 @@
return AjaxResult.ok(exchangeCodePackageService.getDetail(id));
}
+ /**
+ * 分页查询兑换码明细。
+ *
+ * @param query 查询条件
+ * @return 兑换码明细分页结果
+ */
@RequiresPermissions(value = {"/exchangeCode/select"}, logical = Logical.OR)
@PostMapping("/codePage")
@ApiOperation(value = "兑换码明细分页", tags = {"管理后台-兑换码管理"})
@@ -109,6 +151,12 @@
return AjaxResult.ok(exchangeCodePackageService.codePage(query));
}
+ /**
+ * 批量失效兑换码。
+ *
+ * @param dto 失效参数
+ * @return 失效结果
+ */
@RequiresPermissions(value = {"/exchangeCode/del"}, logical = Logical.OR)
@PostMapping("/batchInvalidate")
@ApiOperation(value = "批量失效兑换码", tags = {"管理后台-兑换码管理"})
@@ -118,6 +166,12 @@
return AjaxResult.ok(result).put("msg", "已失效" + result.getSuccessCount() + "条,跳过" + result.getSkipCount() + "条");
}
+ /**
+ * 导出兑换码明细。
+ *
+ * @param query 查询条件
+ * @throws IOException 输出流写出异常
+ */
@RequiresPermissions(value = {"/exchangeCode/select"}, logical = Logical.OR)
@PutMapping("/export")
@ApiOperation(value = "导出兑换码明细", tags = {"管理后台-兑换码管理"})
@@ -142,6 +196,12 @@
outputStream.close();
}
+ /**
+ * 下载单个兑换码二维码。
+ *
+ * @param id 兑换码明细ID
+ * @throws Exception 二维码生成或输出异常
+ */
@RequiresPermissions(value = {"/exchangeCode/select"}, logical = Logical.OR)
@GetMapping("/downloadQRCode/{id}")
@ApiOperation(value = "下载单个兑换码二维码", tags = {"管理后台-兑换码管理"})
@@ -154,6 +214,12 @@
QRCodeUtils.encode(buildQrPayload(detail), response.getOutputStream());
}
+ /**
+ * 批量下载未绑定兑换码二维码。
+ *
+ * @param query 查询条件
+ * @throws Exception 二维码生成或压缩输出异常
+ */
@RequiresPermissions(value = {"/exchangeCode/select"}, logical = Logical.OR)
@PutMapping("/downloadUnboundQRCodes")
@ApiOperation(value = "批量下载未绑定二维码", tags = {"管理后台-兑换码管理"})
@@ -176,6 +242,14 @@
zipOutputStream.close();
}
+ /**
+ * 小程序兑换码绑定。
+ *
+ * @param dto 绑定参数
+ * @param userId 用户ID
+ * @param phone 手机号
+ * @return 绑定结果
+ */
@PostMapping("/bind")
@ApiOperation(value = "小程序兑换码绑定", tags = {"小程序-兑换码"})
public R<ExchangeCodeBindResultVO> bind(@RequestBody ExchangeCodeBindDTO dto,
@@ -184,30 +258,61 @@
return R.ok(exchangeCodePackageService.bindExchangeCode(dto, userId, phone));
}
+ /**
+ * 查询用户兑换码余额映射。
+ *
+ * @param userIds 用户ID集合
+ * @return 用户余额映射
+ */
@PostMapping("/balanceMap")
@ApiOperation(value = "查询用户兑换码余额Map", tags = {"内部-兑换码"})
public R<Map<Long, BigDecimal>> balanceMap(@RequestBody List<Long> userIds) {
return R.ok(exchangeCodePackageService.getUserExchangeCodeBalanceMap(userIds));
}
+ /**
+ * 扣减用户兑换码余额。
+ *
+ * @param dto 扣减参数
+ * @return 扣减结果
+ */
@PostMapping("/consumeBalance")
@ApiOperation(value = "扣减用户兑换码余额", tags = {"内部-兑换码"})
public R<ExchangeCodeConsumeResultVO> consumeBalance(@RequestBody ExchangeCodeConsumeDTO dto) {
return R.ok(exchangeCodePackageService.consumeBalance(dto));
}
+ /**
+ * 退款返还用户兑换码余额。
+ *
+ * @param dto 退款参数
+ * @return 退款结果
+ */
@PostMapping("/refundBalance")
@ApiOperation(value = "退还兑换码余额", tags = {"小程序-兑换码"})
public R<ExchangeCodeConsumeResultVO> refundBalance(@RequestBody ExchangeCodeConsumeDTO dto) {
return R.ok(exchangeCodePackageService.refundBalance(dto));
}
+ /**
+ * 分页查询兑换码余额流水。
+ *
+ * @param query 查询条件
+ * @return 流水分页结果
+ */
@PostMapping("/useRecord/page")
@ApiOperation(value = "兑换码余额流水分页", tags = {"小程序-兑换码"})
public R<Page<TExchangeCodeUseRecord>> useRecordPage(@RequestBody ExchangeCodeUseRecordQuery query) {
return R.ok(exchangeCodePackageService.useRecordPage(query));
}
+ /**
+ * 查询兑换码余额流水详情。
+ *
+ * @param id 流水ID
+ * @param userId 用户ID
+ * @return 流水详情
+ */
@GetMapping("/useRecord/detail")
@ApiOperation(value = "兑换码余额流水详情", tags = {"小程序-兑换码"})
public R<TExchangeCodeUseRecord> useRecordDetail(@RequestParam("id") Long id,
@@ -215,6 +320,12 @@
return R.ok(exchangeCodePackageService.useRecordDetail(id, userId));
}
+ /**
+ * 构建二维码内容。
+ *
+ * @param detail 兑换码明细
+ * @return 二维码载荷内容
+ */
private String buildQrPayload(ExchangeCodeDetailVO detail) {
return "code=" + detail.getCode() + "&password=" + detail.getPassword();
}
--
Gitblit v1.7.1