刘帅
2026-09-29 b55cd9aad0835a96a790e61f9f89edc2fae1be9f
cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -14,6 +14,7 @@
import com.dsh.other.enums.SiteBookingStatusEnum;
import com.dsh.other.mapper.QrLinkMapper;
import com.dsh.other.feignclient.CourseRecordClient;
import com.dsh.other.feignclient.account.AppUserClient;
import com.dsh.other.feignclient.account.CityManagerClient;
import com.dsh.other.feignclient.activity.UserCouponClient;
import com.dsh.other.feignclient.activity.model.QueryUserCouponByIdAndUserId;
@@ -53,6 +54,7 @@
import java.util.*;
import java.security.SecureRandom;
import java.util.stream.Collectors;
import java.util.regex.Pattern;
/**
 * @author zhibing.pu
@@ -64,6 +66,7 @@
public class SiteController {
    private static final char[] ENTRY_CODE_CHARS = "23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
    private static final Pattern MAINLAND_MOBILE = Pattern.compile("^1[3-9]\\d{9}$");
    private final SecureRandom entryCodeRandom = new SecureRandom();
    @Autowired
@@ -89,6 +92,8 @@
    @Resource
    private CityManagerClient cityManagerClient;
    @Resource
    private AppUserClient appUserClient;
    @Autowired
    private IOperatorUserService operatorUserService;
@@ -390,6 +395,19 @@
            if (null == uid) {
                return ResultUtil.tokenErr();
            }
            String phone = reservationSite.getPhone();
            if (phone != null && phone.contains("*")) {
                Map<String, Object> userPhone = appUserClient.siteBookingPhone(uid, "true");
                Object originalPhone = userPhone == null ? null : userPhone.get("phone");
                if (!(originalPhone instanceof String) || ((String) originalPhone).trim().isEmpty()) {
                    return ResultUtil.error("未获取到用户原始手机号");
                }
                reservationSite.setPhone((String) originalPhone);
            } else if (phone == null || !MAINLAND_MOBILE.matcher(phone.trim()).matches()) {
                return ResultUtil.error("请输入正确的手机号");
            } else {
                reservationSite.setPhone(phone.trim());
            }
//            Integer uid = 201;
            return siteService.reservationSite(uid, reservationSite);
        } catch (Exception e) {
@@ -659,9 +677,18 @@
    })
    public ResultUtil<Map<String, Object>> queryMySiteById(Integer id) {
        try {
            Integer uid = tokenUtil.getUserIdFormRedis();
            if (uid == null) {
                return ResultUtil.tokenErr();
            }
            HashMap<String, Object> map = new HashMap<>();
            System.err.println("预约id"+id);
            SiteBooking siteBooking = siteBookingService.getById(id);
            // This endpoint now returns the original contact data to the APP,
            // so an authenticated user may only read their own booking.
            if (siteBooking == null || !uid.equals(siteBooking.getAppUserId())) {
                return ResultUtil.error("预约记录不存在");
            }
            Integer targetAudience = siteBooking.getTargetAudience();
            System.err.println("预约"+siteBooking);
            Integer storeId = siteBooking.getStoreId();
@@ -720,7 +747,7 @@
    @ResponseBody
    @GetMapping("/api/site/entryQr")
    @ApiOperation(value = "获取订场进场二维码", tags = {"用户—预约场地"})
    @ApiOperation(value = "获取订场进场二维码(废弃没用)", tags = {"用户—预约场地"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "预约数据 id", name = "bookingId", dataType = "int", required = true),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header")
@@ -745,7 +772,7 @@
            }
            Map<String, Object> data = new HashMap<>();
            data.put("shortCode", link.getShortCode());
            data.put("url", "https://www.weparklife.com/other/q/" + link.getShortCode());
            data.put("url", "http://8.137.22.229:56666/other/q/" + link.getShortCode());
            data.put("expiresAt", link.getExpiresAt());
            return ResultUtil.success(data);
        } catch (Exception e) {