From e07929e9dda548777a37d8117b3a4fbfacb0b253 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 10 二月 2026 15:38:23 +0800
Subject: [PATCH] bug修改,维护指定门店门票和散客二维码只可使用一次

---
 cloud-server-other/src/main/java/com/dsh/other/service/ISiteBookingUseService.java                                             |   21 +++++++
 cloud-server-other/src/main/java/com/dsh/other/controller/CodeCallBackController.java                                          |   43 +++++++++++++
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java         |    1 
 cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java                                               |   12 +++-
 cloud-server-other/src/main/java/com/dsh/other/entity/TSiteBookingUse.java                                                     |   43 ++++++++++++++
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java |    1 
 cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js                               |    1 
 cloud-server-other/src/main/java/com/dsh/other/mapper/SiteBookingUseMapper.java                                                |   20 ++++++
 cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js                                  |    2 
 cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteBookingUseServiceImpl.java                                     |   28 +++++++++
 10 files changed, 167 insertions(+), 5 deletions(-)

diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
index df83a2d..376a7f2 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
@@ -535,6 +535,7 @@
             map.put("lose", lose);
             AppUser appUser = appUserClient.getAppUser(appUserId);
             map.put("province", appUser.getProvince() + appUser.getCity());
+            map.put("registerPhone", appUser.getPhone());
             if (1 == participantType) {
                 TStudent tStudent = studentClient.queryById(participantId.intValue());
                 if (tStudent.getState() != 1) {
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java
index 55aab09..ee0d8ca 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java
@@ -322,6 +322,7 @@
             WorldCupPayment worldCupPayment = worldCupPaymentService.getById(on.getWorldCupPaymentId());
             Map<String, Object> map1 = new HashMap<>();
             AppUser appUser = appUserClient.getAppUser(on.getAppUserId());
+            map1.put("registerPhone", appUser.getPhone());
             if(on.getParticipantType() == 1){
                 TStudent tStudent = studentClient.queryById(on.getParticipantId().intValue());
                 if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){
diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js
index e2706b9..63f785f 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js
@@ -17,6 +17,8 @@
         {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',},
         {title: '性别', field: 'gender', visible: true, align: 'center', valign: 'middle',},
         {title: '年龄', field: 'age', visible: true, align: 'center', valign: 'middle'},
+        {title: '注册电话', field: 'registerPhone', visible: true, align: 'center', valign: 'middle'},
+
         {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle'},
         {title: '身份证号', field: 'idcard', visible: true, align: 'center', valign: 'middle'},
         {title: '二维码', field: '', visible: true, align: 'center', valign: 'middle',
diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js
index 2b7dca5..e1d812b 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js
@@ -141,6 +141,7 @@
         {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
         {title: '名次', field: 'row_num', visible: true, align: 'center', valign: 'middle',width:'20%',},
         {title: '用户姓名', field: 'name', visible: true, align: 'center', valign: 'middle',},
+        {title: '注册电话', field: 'registerPhone', visible: true, align: 'center', valign: 'middle',},
         {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle'},
         {title: '所在城市', field: 'province', visible: true, align: 'center', valign: 'middle'},
         {title: '已比赛场次', field: 'totalSession', visible: true, align: 'center', valign: 'middle'},
diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/CodeCallBackController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/CodeCallBackController.java
index fd18f40..34cc292 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/CodeCallBackController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/CodeCallBackController.java
@@ -1,9 +1,11 @@
 package com.dsh.other.controller;
 
 import com.dsh.other.entity.SiteBooking;
+import com.dsh.other.entity.TSiteBookingUse;
 import com.dsh.other.feignclient.activity.UserCouponClient;
 import com.dsh.other.model.QuerySiteTimes;
 import com.dsh.other.service.ISiteBookingService;
+import com.dsh.other.service.ISiteBookingUseService;
 import com.dsh.other.service.ISiteService;
 import com.dsh.other.util.ResultUtil;
 import io.swagger.annotations.Api;
@@ -38,6 +40,8 @@
     private ISiteService siteService;
     @Autowired
     private UserCouponClient userCouponClient;
+    @Autowired
+    private ISiteBookingUseService siteBookingUseService;
     // 进场二维码新增参数codeType 1=订场 2=散客,3=门票,玩湃惠民卡codeType=4
     /**
      * 硬件开门后回调 是否可进场检查接口 sid门店id rid场地id
@@ -67,7 +71,25 @@
                 siteBooking.setStatus(3);
                 siteBookingService.updateById(siteBooking);
             }
-            return ResultUtil.success();
+            if (siteBooking.getStoreId()==9939 && codeType==2){
+                TSiteBookingUse siteBookingUse = siteBookingUseService.lambdaQuery()
+                        .eq(TSiteBookingUse::getDataId, dataId)
+
+                        .eq(TSiteBookingUse::getType, 1)
+                        .last("limit 1")
+                        .one();
+                if (siteBookingUse!=null){
+                    // 已经使用过了 不开门
+                    return ResultUtil.error("已使用");
+                }
+                TSiteBookingUse siteBookingUse1 = new TSiteBookingUse();
+                siteBookingUse1.setDataId(dataId);
+                siteBookingUse1.setType(1);
+                siteBookingUse1.setInsertTime(date);
+                siteBookingUseService.save(siteBookingUse1);
+                return ResultUtil.success();
+            }
+
         }
         if (codeType==3){
             //  判断是否能入场 远程调用将门票设置为已使用
@@ -88,7 +110,24 @@
             }else{
                 // 远程调用 将门票设置为已使用
                 userCouponClient.changeTicketStatus(dataId,sid,rid);
-                return ResultUtil.success();
+                if (sid==9939){
+                    TSiteBookingUse siteBookingUse = siteBookingUseService.lambdaQuery()
+                            .eq(TSiteBookingUse::getDataId, dataId)
+                            .eq(TSiteBookingUse::getType, 2)
+                            .last("limit 1")
+                            .one();
+                    if (siteBookingUse!=null){
+                        // 已经使用过了 不开门
+                        return ResultUtil.error("已使用");
+                    }
+                    TSiteBookingUse siteBookingUse2 = new TSiteBookingUse();
+                    siteBookingUse2.setDataId(dataId);
+                    siteBookingUse2.setType(2);
+                    siteBookingUse2.setInsertTime(date);
+                    siteBookingUseService.save(siteBookingUse2);
+                    return ResultUtil.success();
+                }
+
             }
         }
         if (codeType==4){
diff --git a/cloud-server-other/src/main/java/com/dsh/other/entity/TSiteBookingUse.java b/cloud-server-other/src/main/java/com/dsh/other/entity/TSiteBookingUse.java
new file mode 100644
index 0000000..92e68aa
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/entity/TSiteBookingUse.java
@@ -0,0 +1,43 @@
+package com.dsh.other.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author zhibing.pu
+ * @Date 2023/8/1 17:43
+ */
+@Data
+@TableName("t_site_booking_use")
+public class TSiteBookingUse {
+    /**
+     * 主键id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 类型:1=订场,2=门票
+     */
+    @TableField("type")
+    private Integer type;
+
+    /**
+     * 数据id
+     */
+    @TableField("dataId")
+    private String dataId;
+
+    /**
+     * 插入时间
+     */
+    @TableField("insertTime")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date insertTime;
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/mapper/SiteBookingUseMapper.java b/cloud-server-other/src/main/java/com/dsh/other/mapper/SiteBookingUseMapper.java
new file mode 100644
index 0000000..48abbb6
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/mapper/SiteBookingUseMapper.java
@@ -0,0 +1,20 @@
+package com.dsh.other.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dsh.other.entity.Banner;
+import com.dsh.other.entity.CreateHistoryDto;
+import com.dsh.other.entity.GetHistoryDto;
+import com.dsh.other.entity.TSiteBookingUse;
+import com.dsh.other.feignclient.model.AdvertisementQuery;
+import com.dsh.other.model.BannerVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author zhibing.pu
+ * @date 2023/7/11 17:46
+ */
+public interface SiteBookingUseMapper extends BaseMapper<TSiteBookingUse> {
+
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/ISiteBookingUseService.java b/cloud-server-other/src/main/java/com/dsh/other/service/ISiteBookingUseService.java
new file mode 100644
index 0000000..029f177
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/ISiteBookingUseService.java
@@ -0,0 +1,21 @@
+package com.dsh.other.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dsh.other.entity.Banner;
+import com.dsh.other.entity.CreateHistoryDto;
+import com.dsh.other.entity.GetHistoryDto;
+import com.dsh.other.entity.TSiteBookingUse;
+import com.dsh.other.feignclient.model.AdvertisementChangeStateDTO;
+import com.dsh.other.feignclient.model.AdvertisementQuery;
+import com.dsh.other.mapper.SiteBookingUseMapper;
+import com.dsh.other.model.BannerVo;
+
+import java.util.List;
+
+/**
+ * @author zhibing.pu
+ * @date 2023/7/11 17:47
+ */
+public interface ISiteBookingUseService extends IService<TSiteBookingUse> {
+
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteBookingUseServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteBookingUseServiceImpl.java
new file mode 100644
index 0000000..1f8cda2
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteBookingUseServiceImpl.java
@@ -0,0 +1,28 @@
+package com.dsh.other.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dsh.other.entity.Banner;
+import com.dsh.other.entity.CreateHistoryDto;
+import com.dsh.other.entity.GetHistoryDto;
+import com.dsh.other.entity.TSiteBookingUse;
+import com.dsh.other.feignclient.model.AdvertisementChangeStateDTO;
+import com.dsh.other.feignclient.model.AdvertisementQuery;
+import com.dsh.other.mapper.BannerMapper;
+import com.dsh.other.mapper.SiteBookingUseMapper;
+import com.dsh.other.model.BannerVo;
+import com.dsh.other.service.IBannerService;
+import com.dsh.other.service.ISiteBookingUseService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author zhibing.pu
+ * @date 2023/7/11 17:47
+ */
+@Service
+public class SiteBookingUseServiceImpl extends ServiceImpl<SiteBookingUseMapper, TSiteBookingUse> implements ISiteBookingUseService {
+
+
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
index 84ffa90..3c8f120 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -891,8 +891,14 @@
         siteBooking.setHalfName(reservationSite.getHalfName());
         siteBookingService.save(siteBooking);
 
-
-        if (reservationSite.getPayType() == 1) {//微信支付
+        if (money.compareTo(BigDecimal.ZERO)==0){
+            siteBooking.setStatus(1);
+            siteBookingService.updateById(siteBooking);
+            HashMap<String, String> map = new HashMap<>();
+            map.put("siteBooking", siteBooking.getId().toString());
+            return ResultUtil.success(map);
+        }
+        if (reservationSite.getPayType() == 1 ) {//微信支付
             ResultUtil resultUtil = weChatPaymentSite(money.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), siteBooking);
             return resultUtil;
         }
@@ -901,8 +907,8 @@
         }
         if (reservationSite.getPayType() == 3) {//玩湃币支付
             return playPaiCoinPaymentSite(appUser, playCoin.doubleValue(), siteBooking);
-
         }
+
         return ResultUtil.success();
     }
 

--
Gitblit v1.7.1