From 8a89ba02db5c19db669a5cf9bb7d443223bdfb71 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期二, 29 九月 2026 10:48:21 +0800
Subject: [PATCH] 会员管理及取消场地预约问题
---
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java | 39 +++++++++++++++++++++++++++++++--------
1 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java
index 716e013..cd70dfc 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java
@@ -61,7 +61,13 @@
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Vip vip = vipService.getById(id);
+ if (vip == null) {
+ throw new IllegalArgumentException("会员卡不存在: " + id);
+ }
model.addAttribute("vip",vip);
+ // 编辑页的两个权益列表都会被模板遍历,即使会员卡尚未配置权益也必须提供空集合。
+ model.addAttribute("couponList", new ArrayList<Coupon>());
+ model.addAttribute("ticketList", new ArrayList<TicketDetailVO>());
if (vip.getCouponJson() != null && !vip.getCouponJson().isEmpty()){
String couponJson = vip.getCouponJson();
// 转化为jsonArray
@@ -106,6 +112,9 @@
break;
case 3:
coupon.setTypeValue("体验券");
+ break;
+ case 4:
+ coupon.setTypeValue("抵扣券");
break;
}
switch (coupon.getUserPopulation()){
@@ -125,6 +134,7 @@
model.addAttribute("couponList", new ArrayList<Coupon>());
}
}
+
if (vip.getTicketJson() != null && !vip.getTicketJson().isEmpty()){
String ticketJson = vip.getTicketJson();
// 转化为jsonArray
@@ -141,24 +151,34 @@
ticketDetailVOS.add(ticketDetailVO);
}
model.addAttribute("ticketList", ticketDetailVOS);
+
+ }else{
+ model.addAttribute("ticketList", new ArrayList<TicketDetailVO>());
+
}
+
return PREFIX + "vip_edit.html";
}
- public static void main(String[] args) {
- String temp = "[{\"id\":\"36\",\"value\":\"1\"}]";
- JSONArray couponJsonArray = JSONArray.parseArray(temp);
- for (Object o : couponJsonArray) {
- JSONObject couponJsonObject = (JSONObject) o;
- Integer couponId = couponJsonObject.getInteger("id");
- }
- }
+// public static void main(String[] args) {
+// String temp = "[{\"id\":\"36\",\"value\":\"1\"}]";
+// JSONArray couponJsonArray = JSONArray.parseArray(temp);
+// for (Object o : couponJsonArray) {
+// JSONObject couponJsonObject = (JSONObject) o;
+// Integer couponId = couponJsonObject.getInteger("id");
+// }
+// }
@RequestMapping("/detail/{id}")
public String detail(@PathVariable("id")Integer id, Model model) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Vip vip = vipService.getById(id);
+ if (vip == null) {
+ throw new IllegalArgumentException("会员卡不存在: " + id);
+ }
model.addAttribute("vip",vip);
+ model.addAttribute("couponList", new ArrayList<Coupon>());
+ model.addAttribute("ticketList", new ArrayList<TicketDetailVO>());
if (vip.getCouponJson() != null && !vip.getCouponJson().isEmpty()){
String couponJson = vip.getCouponJson();
// 转化为jsonArray
@@ -204,6 +224,9 @@
case 3:
coupon.setTypeValue("体验券");
break;
+ case 4:
+ coupon.setTypeValue("抵扣券");
+ break;
}
switch (coupon.getUserPopulation()){
case 1:
--
Gitblit v1.7.1