From f7ef2230af6dc8a55c2b5bd6505eed8586c87f75 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 24 九月 2025 08:59:15 +0800
Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0

---
 cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java |   41 ++++++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java
index d1e0d3e..35c530b 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java
@@ -58,13 +58,19 @@
             List<TicketVipResp> ticketVipRespList = new ArrayList<>();
             String couponJson = vip.getCouponJson();
             JSONArray couponJsonArray = JSONArray.parseArray(couponJson);
+            if(couponJsonArray==null){
+                continue;
+            }
             for (Object o : couponJsonArray) {
                 JSONObject couponJsonObject = (JSONObject) o;
                 // 优惠券id
                 Integer id = Integer.valueOf(couponJsonObject.getString("id"));
                 // 优惠券数量
                 Integer value = Integer.valueOf(couponJsonObject.getString("value"));
-                Coupon coupon = coupons.stream().filter(e -> e.getId().equals(id)).findFirst().orElse(new Coupon());
+                Coupon coupon = coupons.stream().filter(e -> e.getId().equals(id)).findFirst().orElse(null);
+                if (coupon==null){
+                    continue;
+                }
                 CouponVipResp couponVipResp = new CouponVipResp();
                 couponVipResp.setId(coupon.getId());
                 couponVipResp.setName(coupon.getName());
@@ -153,22 +159,23 @@
             }
             vip.setCouponList(couponVipRespList);
             String ticketJson = vip.getTicketJson();
-            JSONArray ticketJsonArray = JSONArray.parseArray(ticketJson);
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-
-            for (Object o : ticketJsonArray) {
-                JSONObject ticketJsonObject = (JSONObject) o;
-                TicketVipResp ticketVipResp = new TicketVipResp();
-                Integer count = ticketJsonObject.getInteger("count");
-                ticketVipResp.setName(ticketJsonObject.getString("name"));
-                ticketVipResp.setTime(ticketJsonObject.getInteger("time"));
-                ticketVipResp.setCount(ticketJsonObject.getInteger("count"));
-                ticketVipResp.setStartTime(simpleDateFormat.format(new Date()));
-                Date date = new Date();
-                // 给这个date加X天
-                date.setTime(date.getTime() + ticketJsonObject.getInteger("time") * 24 * 60 * 60 * 1000);
-                ticketVipResp.setEffectiveTime(simpleDateFormat.format(date));
-                ticketVipRespList.add(ticketVipResp);
+            if(ticketJson!=null && !"".equals(ticketJson)){
+                JSONArray ticketJsonArray = JSONArray.parseArray(ticketJson);
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                for (Object o : ticketJsonArray) {
+                    JSONObject ticketJsonObject = (JSONObject) o;
+                    TicketVipResp ticketVipResp = new TicketVipResp();
+                    Integer count = ticketJsonObject.getInteger("count");
+                    ticketVipResp.setName(ticketJsonObject.getString("name"));
+                    ticketVipResp.setTime(ticketJsonObject.getInteger("time"));
+                    ticketVipResp.setCount(ticketJsonObject.getInteger("count"));
+                    ticketVipResp.setStartTime(simpleDateFormat.format(new Date()));
+                    Date date = new Date();
+                    // 给这个date加X天
+                    date.setTime(date.getTime() + ticketJsonObject.getInteger("time") * 24 * 60 * 60 * 1000);
+                    ticketVipResp.setEffectiveTime(simpleDateFormat.format(date));
+                    ticketVipRespList.add(ticketVipResp);
+                }
             }
             vip.setTicketList(ticketVipRespList);
         }

--
Gitblit v1.7.1