| | |
| | | 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; |
| | |
| | | import java.util.*; |
| | | import java.security.SecureRandom; |
| | | import java.util.stream.Collectors; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | 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 |
| | |
| | | |
| | | @Resource |
| | | private CityManagerClient cityManagerClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | |
| | | 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) { |
| | |
| | | }) |
| | | 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(); |
| | |
| | | |
| | | @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") |
| | |
| | | } |
| | | 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) { |