feat:江体小程序
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 13:55
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VenueListDTO {
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String contacts;
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:57
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("jntyzx_order_create_info")
|
||||||
|
public class OrderInfoDO {
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数
|
||||||
|
*/
|
||||||
|
private String params;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建人
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地号
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属日期
|
||||||
|
*/
|
||||||
|
private LocalDate date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态 (0:待付款,1:已付款)
|
||||||
|
*/
|
||||||
|
private Integer orderStatus;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("jntyzx_user_restriction")
|
||||||
|
public class UserRestrictionInfo {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 封禁截止时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime restrictionDeadline;
|
||||||
|
/**
|
||||||
|
* 封禁原因
|
||||||
|
*/
|
||||||
|
private String restrictionDesc;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("jntyzx_user_token_info")
|
||||||
|
public class UserTokenInfoDO {
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wx openid
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0:禁用 1:启用)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可以下单 (0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer isOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
@TableField("member_card_no")
|
||||||
|
private String memberCardNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否封禁 0:否 1:是
|
||||||
|
*/
|
||||||
|
@TableField("is_restriction")
|
||||||
|
private Integer isRestriction;
|
||||||
|
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 15:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("jntyzx_venue_info")
|
||||||
|
public class VenueInfoDO {
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 场地名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属日期
|
||||||
|
*/
|
||||||
|
private LocalDate date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地信息三方主键
|
||||||
|
*/
|
||||||
|
private Long placeMainId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地id
|
||||||
|
*/
|
||||||
|
private Integer placeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer scheduleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间范围
|
||||||
|
*/
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private BigDecimal money;
|
||||||
|
private String className;
|
||||||
|
private String classCode;
|
||||||
|
private String appointments;
|
||||||
|
private String cTypeCode;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 16:34
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SubscribeRequest {
|
||||||
|
private JSONObject jsonObject;
|
||||||
|
private List<com.xiang.service.module.jntyzx.miniapp.entity.req.SubscribeVo> subscribeVos;
|
||||||
|
private String bookTime;
|
||||||
|
private Integer paymentMethod;
|
||||||
|
private String svCiphertext;
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 16:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SubscribeVo {
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private String ballCourtId;
|
||||||
|
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
private String scheduleId;
|
||||||
|
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
private int placeId;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String className;
|
||||||
|
|
||||||
|
private String classCode;
|
||||||
|
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
private String contactNumber;
|
||||||
|
|
||||||
|
private String memberNumber;
|
||||||
|
|
||||||
|
private String appointments;
|
||||||
|
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
private String beginTime;
|
||||||
|
|
||||||
|
private int specOneTimes;
|
||||||
|
|
||||||
|
private String ctypeCode;
|
||||||
|
|
||||||
|
private int isWhole;
|
||||||
|
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
private int votesnum;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserAddReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
/**
|
||||||
|
* wx openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
private String memberCardNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0:禁用 1:启用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-03-24 16:40
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserQueryReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wx openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
private String memberCardNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0:禁用 1:启用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可以下单 0:否 1:是
|
||||||
|
*/
|
||||||
|
private Integer isOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否封禁 0:否 1:是
|
||||||
|
*/
|
||||||
|
private Integer isRestriction;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserStatusUpdateReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* status
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserTokenUpdateReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UsernameReq {
|
||||||
|
private String username;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-04-09 09:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VenueInfoQueryRequest{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
private LocalDate date;
|
||||||
|
/**
|
||||||
|
* 时间段 例如 20:00-21:00
|
||||||
|
*/
|
||||||
|
private String sj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-04-09 10:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class VenueInfoSubscribeRequest {
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class JntyzxResponse<T> {
|
||||||
|
private Boolean success;
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
private T result;
|
||||||
|
|
||||||
|
private Long timestamp;
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-03-24 16:40
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class JtUserVo {
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
/**
|
||||||
|
* wx:openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
/**
|
||||||
|
* 账号状态:
|
||||||
|
* 状态(0:禁用 1:启用)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd Hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd Hh:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
/**
|
||||||
|
* 江南体育中心会员卡号
|
||||||
|
*/
|
||||||
|
private String memberCardNo;
|
||||||
|
/**
|
||||||
|
* 是否可以下单
|
||||||
|
*/
|
||||||
|
private Boolean isOrder;
|
||||||
|
/**
|
||||||
|
* 是否封禁
|
||||||
|
*/
|
||||||
|
private Boolean isRestriction;
|
||||||
|
/**
|
||||||
|
* 封禁结束时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd Hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd Hh:mm:ss")
|
||||||
|
private LocalDateTime restrictionDeadline;
|
||||||
|
/**
|
||||||
|
* 封禁缘由
|
||||||
|
*/
|
||||||
|
private String restrictionDesc;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class OrderCreateResp {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String countDownNum;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-04-09 09:42
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VenueInfoQueryResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
private LocalDate date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间范围
|
||||||
|
*/
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0:可订购 2:zlb 4:已订购
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
private Long placeMainId;
|
||||||
|
private Integer placeId;
|
||||||
|
private Integer scheduleId;
|
||||||
|
private String className;
|
||||||
|
private String classCode;
|
||||||
|
private String appointments;
|
||||||
|
private String cTypeCode;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class QueryVenueResponse {
|
||||||
|
private List<TimeList> timeList;
|
||||||
|
|
||||||
|
private List<VenueList> venue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:45
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SitePositionList {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String ballCourtId;
|
||||||
|
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
private String scheduleId;
|
||||||
|
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
private Integer placeId;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private String className;
|
||||||
|
|
||||||
|
private String classCode;
|
||||||
|
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
private String contactNumber;
|
||||||
|
|
||||||
|
private String memberNumber;
|
||||||
|
|
||||||
|
private String appointments;
|
||||||
|
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
private String beginTime;
|
||||||
|
|
||||||
|
private Integer specOneTimes;
|
||||||
|
|
||||||
|
private String ctypeCode;
|
||||||
|
|
||||||
|
private String isWhole;
|
||||||
|
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
private Integer votesnum;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TimeList {
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String beginTime;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String isenable;
|
||||||
|
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
private String createtime;
|
||||||
|
|
||||||
|
private String remarks;
|
||||||
|
|
||||||
|
private String default01;
|
||||||
|
private String default02;
|
||||||
|
private String default03;
|
||||||
|
private String votesnum;
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class UserInfoResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
private String consCard;
|
||||||
|
/**
|
||||||
|
* 姓名
|
||||||
|
*/
|
||||||
|
private String consName;
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
private String consSex;
|
||||||
|
/**
|
||||||
|
* 身份证号
|
||||||
|
*/
|
||||||
|
private String consIdCard;
|
||||||
|
/**
|
||||||
|
* 固定电话
|
||||||
|
*/
|
||||||
|
private String consTel;
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String consHandSet;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String consUnit;
|
||||||
|
/**
|
||||||
|
* 照片
|
||||||
|
*/
|
||||||
|
private String consPhoto;
|
||||||
|
private Integer consWaste;
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
private String consNumber;
|
||||||
|
private BigDecimal consMin;
|
||||||
|
private Integer consProp;
|
||||||
|
/**
|
||||||
|
* 注册年
|
||||||
|
*/
|
||||||
|
private String consYear;
|
||||||
|
/**
|
||||||
|
* 注册月
|
||||||
|
*/
|
||||||
|
private String consMonth;
|
||||||
|
/**
|
||||||
|
* 注册日
|
||||||
|
*/
|
||||||
|
private String consDay;
|
||||||
|
private boolean consIflag;
|
||||||
|
/**
|
||||||
|
* 注册时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime consTimes;
|
||||||
|
/**
|
||||||
|
* openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String photoUrl;
|
||||||
|
/**
|
||||||
|
* 会员
|
||||||
|
*/
|
||||||
|
private Integer consVip;
|
||||||
|
/**
|
||||||
|
* 会员等级号
|
||||||
|
*/
|
||||||
|
private String consVipCode;
|
||||||
|
|
||||||
|
private String eleCardNum;
|
||||||
|
private Integer appointmentEligibility;
|
||||||
|
/**
|
||||||
|
* 封禁截止日期
|
||||||
|
*/
|
||||||
|
@JSONField(name = "restrictionDeadline")
|
||||||
|
private String restrictionDeadline;
|
||||||
|
/**
|
||||||
|
* 封禁原因
|
||||||
|
*/
|
||||||
|
private String restrictionDescription;
|
||||||
|
/**
|
||||||
|
* 封禁截止日期
|
||||||
|
*/
|
||||||
|
@JSONField(name = "RestrictionDeadline")
|
||||||
|
private String RestrictionDeadline2;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class VenueList {
|
||||||
|
|
||||||
|
private Integer placeId;
|
||||||
|
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
private List<SitePositionList> sitePosition;
|
||||||
|
|
||||||
|
}
|
||||||
253
src/main/java/com/xiang/common/utils/Base64.java
Normal file
253
src/main/java/com/xiang/common/utils/Base64.java
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
package com.xiang.common.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base64工具类
|
||||||
|
*
|
||||||
|
* @author xiang
|
||||||
|
*/
|
||||||
|
public final class Base64 {
|
||||||
|
static private final int BASELENGTH = 128;
|
||||||
|
static private final int LOOKUPLENGTH = 64;
|
||||||
|
static private final int TWENTYFOURBITGROUP = 24;
|
||||||
|
static private final int EIGHTBIT = 8;
|
||||||
|
static private final int SIXTEENBIT = 16;
|
||||||
|
static private final int FOURBYTE = 4;
|
||||||
|
static private final int SIGN = -128;
|
||||||
|
static private final char PAD = '=';
|
||||||
|
static final private byte[] base64Alphabet = new byte[BASELENGTH];
|
||||||
|
static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH];
|
||||||
|
|
||||||
|
static {
|
||||||
|
for (int i = 0; i < BASELENGTH; ++i) {
|
||||||
|
base64Alphabet[i] = -1;
|
||||||
|
}
|
||||||
|
for (int i = 'Z'; i >= 'A'; i--) {
|
||||||
|
base64Alphabet[i] = (byte) (i - 'A');
|
||||||
|
}
|
||||||
|
for (int i = 'z'; i >= 'a'; i--) {
|
||||||
|
base64Alphabet[i] = (byte) (i - 'a' + 26);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = '9'; i >= '0'; i--) {
|
||||||
|
base64Alphabet[i] = (byte) (i - '0' + 52);
|
||||||
|
}
|
||||||
|
|
||||||
|
base64Alphabet['+'] = 62;
|
||||||
|
base64Alphabet['/'] = 63;
|
||||||
|
|
||||||
|
for (int i = 0; i <= 25; i++) {
|
||||||
|
lookUpBase64Alphabet[i] = (char) ('A' + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 26, j = 0; i <= 51; i++, j++) {
|
||||||
|
lookUpBase64Alphabet[i] = (char) ('a' + j);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 52, j = 0; i <= 61; i++, j++) {
|
||||||
|
lookUpBase64Alphabet[i] = (char) ('0' + j);
|
||||||
|
}
|
||||||
|
lookUpBase64Alphabet[62] = '+';
|
||||||
|
lookUpBase64Alphabet[63] = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isWhiteSpace(char octect) {
|
||||||
|
return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isPad(char octect) {
|
||||||
|
return (octect == PAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isData(char octect) {
|
||||||
|
return (octect < BASELENGTH && base64Alphabet[octect] != -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes hex octects into Base64
|
||||||
|
*
|
||||||
|
* @param binaryData Array containing binaryData
|
||||||
|
* @return Encoded Base64 array
|
||||||
|
*/
|
||||||
|
public static String encode(byte[] binaryData) {
|
||||||
|
if (binaryData == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lengthDataBits = binaryData.length * EIGHTBIT;
|
||||||
|
if (lengthDataBits == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
|
||||||
|
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
|
||||||
|
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
|
||||||
|
char[] encodedData = null;
|
||||||
|
|
||||||
|
encodedData = new char[numberQuartet * 4];
|
||||||
|
|
||||||
|
byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
|
||||||
|
|
||||||
|
int encodedIndex = 0;
|
||||||
|
int dataIndex = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < numberTriplets; i++) {
|
||||||
|
b1 = binaryData[dataIndex++];
|
||||||
|
b2 = binaryData[dataIndex++];
|
||||||
|
b3 = binaryData[dataIndex++];
|
||||||
|
|
||||||
|
l = (byte) (b2 & 0x0f);
|
||||||
|
k = (byte) (b1 & 0x03);
|
||||||
|
|
||||||
|
byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
|
||||||
|
byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
|
||||||
|
byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc);
|
||||||
|
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f];
|
||||||
|
}
|
||||||
|
|
||||||
|
// form integral number of 6-bit groups
|
||||||
|
if (fewerThan24bits == EIGHTBIT) {
|
||||||
|
b1 = binaryData[dataIndex];
|
||||||
|
k = (byte) (b1 & 0x03);
|
||||||
|
byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4];
|
||||||
|
encodedData[encodedIndex++] = PAD;
|
||||||
|
encodedData[encodedIndex++] = PAD;
|
||||||
|
} else if (fewerThan24bits == SIXTEENBIT) {
|
||||||
|
b1 = binaryData[dataIndex];
|
||||||
|
b2 = binaryData[dataIndex + 1];
|
||||||
|
l = (byte) (b2 & 0x0f);
|
||||||
|
k = (byte) (b1 & 0x03);
|
||||||
|
|
||||||
|
byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
|
||||||
|
byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
|
||||||
|
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2];
|
||||||
|
encodedData[encodedIndex++] = PAD;
|
||||||
|
}
|
||||||
|
return new String(encodedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decodes Base64 data into octects
|
||||||
|
*
|
||||||
|
* @param encoded string containing Base64 data
|
||||||
|
* @return Array containind decoded data.
|
||||||
|
*/
|
||||||
|
public static byte[] decode(String encoded) {
|
||||||
|
if (encoded == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
char[] base64Data = encoded.toCharArray();
|
||||||
|
// remove white spaces
|
||||||
|
int len = removeWhiteSpace(base64Data);
|
||||||
|
|
||||||
|
if (len % FOURBYTE != 0) {
|
||||||
|
return null;// should be divisible by four
|
||||||
|
}
|
||||||
|
|
||||||
|
int numberQuadruple = (len / FOURBYTE);
|
||||||
|
|
||||||
|
if (numberQuadruple == 0) {
|
||||||
|
return new byte[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] decodedData = null;
|
||||||
|
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
||||||
|
char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
int encodedIndex = 0;
|
||||||
|
int dataIndex = 0;
|
||||||
|
decodedData = new byte[(numberQuadruple) * 3];
|
||||||
|
|
||||||
|
for (; i < numberQuadruple - 1; i++) {
|
||||||
|
|
||||||
|
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))
|
||||||
|
|| !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) {
|
||||||
|
return null;
|
||||||
|
} // if found "no data" just return null
|
||||||
|
|
||||||
|
b1 = base64Alphabet[d1];
|
||||||
|
b2 = base64Alphabet[d2];
|
||||||
|
b3 = base64Alphabet[d3];
|
||||||
|
b4 = base64Alphabet[d4];
|
||||||
|
|
||||||
|
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||||
|
decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
|
||||||
|
decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
|
||||||
|
return null;// if found "no data" just return null
|
||||||
|
}
|
||||||
|
|
||||||
|
b1 = base64Alphabet[d1];
|
||||||
|
b2 = base64Alphabet[d2];
|
||||||
|
|
||||||
|
d3 = base64Data[dataIndex++];
|
||||||
|
d4 = base64Data[dataIndex++];
|
||||||
|
if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters
|
||||||
|
if (isPad(d3) && isPad(d4)) {
|
||||||
|
if ((b2 & 0xf) != 0)// last 4 bits should be zero
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
byte[] tmp = new byte[i * 3 + 1];
|
||||||
|
System.arraycopy(decodedData, 0, tmp, 0, i * 3);
|
||||||
|
tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
|
||||||
|
return tmp;
|
||||||
|
} else if (!isPad(d3) && isPad(d4)) {
|
||||||
|
b3 = base64Alphabet[d3];
|
||||||
|
if ((b3 & 0x3) != 0)// last 2 bits should be zero
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
byte[] tmp = new byte[i * 3 + 2];
|
||||||
|
System.arraycopy(decodedData, 0, tmp, 0, i * 3);
|
||||||
|
tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||||
|
tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
|
||||||
|
return tmp;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else { // No PAD e.g 3cQl
|
||||||
|
b3 = base64Alphabet[d3];
|
||||||
|
b4 = base64Alphabet[d4];
|
||||||
|
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||||
|
decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
|
||||||
|
decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
|
||||||
|
|
||||||
|
}
|
||||||
|
return decodedData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remove WhiteSpace from MIME containing encoded Base64 data.
|
||||||
|
*
|
||||||
|
* @param data the byte array of base64 data (with WS)
|
||||||
|
* @return the new length
|
||||||
|
*/
|
||||||
|
private static int removeWhiteSpace(char[] data) {
|
||||||
|
if (data == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// count characters that's not whitespace
|
||||||
|
int newSize = 0;
|
||||||
|
int len = data.length;
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
if (!isWhiteSpace(data[i])) {
|
||||||
|
data[newSize++] = data[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.xiang.common.utils;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.xiang.common.enums.DateFormatEnum;
|
import com.xiang.common.enums.DateFormatEnum;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.xml.datatype.DatatypeConfigurationException;
|
import javax.xml.datatype.DatatypeConfigurationException;
|
||||||
import javax.xml.datatype.DatatypeFactory;
|
import javax.xml.datatype.DatatypeFactory;
|
||||||
@@ -11,6 +13,8 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -22,6 +26,9 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*/
|
*/
|
||||||
public class DateUtils {
|
public class DateUtils {
|
||||||
|
|
||||||
|
private static final String defaultDateFormatter = "yyyy-MM-dd";
|
||||||
|
private static final String defaultDateTimeFormatter = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造函数.
|
* 构造函数.
|
||||||
@@ -603,4 +610,56 @@ public class DateUtils {
|
|||||||
public static Date setModifiedDate(String key, Date date) {
|
public static Date setModifiedDate(String key, Date date) {
|
||||||
return modifiedDate.put(key, date);
|
return modifiedDate.put(key, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime getDateTimeFromStr(String dateStr) {
|
||||||
|
return getDateTimeFromStr(dateStr, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime getDateTimeFromStr(String dateStr, String pattern) {
|
||||||
|
return LocalDateTime.parse(dateStr, DateTimeFormatter.ofPattern(pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDate getDateFromStr(String dataStr) {
|
||||||
|
return getDateFromStr(dataStr, "yyyy-MM-dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDate getDateFromStr(String dataStr, String pattern) {
|
||||||
|
return LocalDate.parse(dataStr, DateTimeFormatter.ofPattern(pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDateFromDate(LocalDate date) {
|
||||||
|
return getDateFromDate(date, "yyyy-MM-dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDateFromDate(LocalDate date, String pattern) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
return date.format(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDateTimeFromDateTime(LocalDateTime dateTime) {
|
||||||
|
return getDateTimeFromDateTime(dateTime, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDateTimeFromDateTime(LocalDateTime dateTime, String pattern) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
return dateTime.format(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime getTimeFromStr(String date, String time) {
|
||||||
|
String dateTimeStr = date + " " + time;
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
return LocalDateTime.parse(dateTimeStr, formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean validWeekTime() {
|
||||||
|
if (!Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) && !Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||||
|
LocalTime now = LocalTime.now();
|
||||||
|
boolean inMorning = now.isAfter(LocalTime.of(9, 29)) && now.isBefore(LocalTime.of(11, 31));
|
||||||
|
boolean inAfternoon = now.isAfter(LocalTime.of(12, 59)) && now.isBefore(LocalTime.of(15, 1));
|
||||||
|
return !inAfternoon && !inMorning ? true : false;
|
||||||
|
} else {
|
||||||
|
log.info("当前时间为:{}", LocalDateTime.now());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.constants;
|
||||||
|
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:43
|
||||||
|
*/
|
||||||
|
public class RedisKeyConstant {
|
||||||
|
|
||||||
|
public static final String JNTYZX_ORDER_CREATE_KEY = "jntyzx:order:create:orderId:";
|
||||||
|
|
||||||
|
public static final String JNTUZX_ORDER_PEEK_KEY = "jntyzx:order:peek:user:";
|
||||||
|
|
||||||
|
public static final String JNTYZX_VENUE_MSG_SEND_KEY = "jntyzx:order:venue:msg:send";
|
||||||
|
|
||||||
|
private static final String JNTYZX_VENUE_SUBSCRIBE_KEY = "jntyzx:venue:subscribe:";
|
||||||
|
|
||||||
|
private static final String JNTYZX_ORDER_CLOSE_CARD_KEY = "jntyzx:order:close:card:";
|
||||||
|
|
||||||
|
public static String getCloseCardKey(String username) {
|
||||||
|
return JNTYZX_ORDER_CLOSE_CARD_KEY + username + ":" +getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getVenueSubscribeKey(String placeName) {
|
||||||
|
return JNTYZX_VENUE_SUBSCRIBE_KEY + placeName + ":" + getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDate() {
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
return ":" + DateUtils.getDateFromDate(now);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.constants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 13:46
|
||||||
|
*/
|
||||||
|
public class UrlConstant {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 江南体育中心基础URL
|
||||||
|
*/
|
||||||
|
private final static String GNTYZX_BASE_URL = "https://jntyzx.cn:8443";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当天的场地信息
|
||||||
|
*/
|
||||||
|
public final static String QUERY_TODAY_SUBSCRIBE_URL = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/getSubscribeByToday";
|
||||||
|
/**
|
||||||
|
* 查询明天场地信息
|
||||||
|
*/
|
||||||
|
public final static String QUERY_TOMORROW_SUBSCRIBE_URL = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/getSubscribeByTomorrow";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅场地
|
||||||
|
*/
|
||||||
|
public final static String ADD_SUBSCRIBE = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/addSubscribe";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息
|
||||||
|
*/
|
||||||
|
public final static String ORDER_INFO = GNTYZX_BASE_URL + "/GYM-JN/multi/busiOrder/queryOrderInfo";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心跳监测接口
|
||||||
|
*/
|
||||||
|
public final static String HEALTH_DECLARATION = GNTYZX_BASE_URL + "/GYM-JN//busi/healthDeclaration/addUserPrivacy";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验会员卡状态
|
||||||
|
*/
|
||||||
|
public final static String CHECK_NUM = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/checkDefaultsNum";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openId查询会员卡信息
|
||||||
|
*/
|
||||||
|
public final static String QUERY_BY_OPEN_ID = GNTYZX_BASE_URL + "/GYM-JN/multi/xfConsumer/queryByOpenId";
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.converts;
|
||||||
|
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.JtUserVo;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.entity.pojo.UserTokenInfoDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.Named;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Mapper(componentModel = "spring")
|
||||||
|
public interface UserConverter {
|
||||||
|
|
||||||
|
UserConverter INSTANCE = Mappers.getMapper(UserConverter.class);
|
||||||
|
@Mapping(source = "id", target = "userId")
|
||||||
|
@Mapping(source = "isOrder", target = "isOrder", qualifiedByName = "isOrder")
|
||||||
|
@Mapping(source = "isRestriction", target = "isRestriction", qualifiedByName = "isRestrict")
|
||||||
|
JtUserVo convert(UserTokenInfoDO userTokenInfoDO);
|
||||||
|
List<JtUserVo> convert(List<UserTokenInfoDO> userTokenInfoDOs);
|
||||||
|
|
||||||
|
@Named("isOrder")
|
||||||
|
default Boolean isOrder(Integer value) {
|
||||||
|
return Objects.nonNull(value) && Objects.equals(value, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Named("isRestrict")
|
||||||
|
default Boolean isRestrict(Integer value) {
|
||||||
|
return Objects.nonNull(value) && Objects.equals(value, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.converts;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.VenueInfoQueryResp;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.entity.pojo.VenueInfoDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-04-09 09:54
|
||||||
|
*/
|
||||||
|
@Mapper(componentModel = "spring")
|
||||||
|
public interface VenueInfoConverter {
|
||||||
|
|
||||||
|
Page<VenueInfoQueryResp> toPage(Page<VenueInfoDO> page);
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.manage;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:59
|
||||||
|
*/
|
||||||
|
public interface IOrderCreateInfoManage extends IService<OrderInfoDO> {
|
||||||
|
|
||||||
|
|
||||||
|
List<OrderInfoDO> queryNoPayOrder();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.manage;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IUserRestrictionManage extends IService<UserRestrictionInfo> {
|
||||||
|
|
||||||
|
UserRestrictionInfo queryByUserId(Long userId);
|
||||||
|
|
||||||
|
List<UserRestrictionInfo> queryByIdList(List<Long> idList);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.manage;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:19
|
||||||
|
*/
|
||||||
|
public interface IUserTokenInfoManage extends IService<UserTokenInfoDO> {
|
||||||
|
List<UserTokenInfoDO> listUser();
|
||||||
|
UserTokenInfoDO getByName(String name);
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> listCanOrder();
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> queryByList(UserQueryReq req);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.manage;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.VenueInfoQueryRequest;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 15:50
|
||||||
|
*/
|
||||||
|
public interface IVenueInfoManage extends IService<VenueInfoDO> {
|
||||||
|
|
||||||
|
List<VenueInfoDO> queryByDate(LocalDate date);
|
||||||
|
|
||||||
|
List<VenueInfoDO> queryByType(LocalDate date, Integer type);
|
||||||
|
|
||||||
|
Page<VenueInfoDO> page(VenueInfoQueryRequest request);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.manage;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.mapper.JntyzxOrderCreateInfoMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:59
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OrderCreateInfoManageImpl extends ServiceImpl<JntyzxOrderCreateInfoMapper, OrderInfoDO> implements IOrderCreateInfoManage {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrderInfoDO> queryNoPayOrder() {
|
||||||
|
LambdaQueryWrapper<OrderInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(OrderInfoDO::getOrderStatus, 0);
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.manage;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.mapper.JntyzxUserRestrictionInfoMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserRestrictionManageImpl extends ServiceImpl<JntyzxUserRestrictionInfoMapper, UserRestrictionInfo> implements IUserRestrictionManage {
|
||||||
|
@Override
|
||||||
|
public UserRestrictionInfo queryByUserId(Long userId) {
|
||||||
|
LambdaQueryWrapper<UserRestrictionInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(UserRestrictionInfo::getUserId, userId);
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserRestrictionInfo> queryByIdList(List<Long> idList) {
|
||||||
|
LambdaQueryWrapper<UserRestrictionInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.in(UserRestrictionInfo::getUserId, idList);
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.manage;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.mapper.JntyzxUserTokenInfoMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserTokenInfoManageImpl extends ServiceImpl<JntyzxUserTokenInfoMapper, UserTokenInfoDO> implements IUserTokenInfoManage {
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> listUser() {
|
||||||
|
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, 1);
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserTokenInfoDO getByName(String name) {
|
||||||
|
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, 1);
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getName, name);
|
||||||
|
lambdaQueryWrapper.last("limit 1");
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> listCanOrder() {
|
||||||
|
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, 1);
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsOrder, 1);
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsRestriction, 0);
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> queryByList(UserQueryReq req) {
|
||||||
|
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
if (StringUtils.isNotBlank(req.getName())) {
|
||||||
|
lambdaQueryWrapper.like(UserTokenInfoDO::getName, req.getName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(req.getOpenId())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getOpenId, req.getOpenId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(req.getMemberCardNo())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getMemberCardNo, req.getMemberCardNo());
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(req.getStatus())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, req.getStatus());
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(req.getIsRestriction())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsRestriction, req.getIsRestriction());
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(req.getIsOrder())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsOrder, req.getIsOrder());
|
||||||
|
}
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.manage;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.VenueInfoQueryRequest;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.mapper.JntyzxVenueInfoMapper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 15:51
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class VenueInfoManageImpl extends ServiceImpl<JntyzxVenueInfoMapper, VenueInfoDO> implements IVenueInfoManage {
|
||||||
|
|
||||||
|
public List<VenueInfoDO> queryByDate(LocalDate date) {
|
||||||
|
LambdaQueryWrapper<VenueInfoDO> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(VenueInfoDO::getDate, date);
|
||||||
|
return baseMapper.selectList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VenueInfoDO> queryByType(LocalDate date, Integer type) {
|
||||||
|
LambdaQueryWrapper<VenueInfoDO> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(VenueInfoDO::getDate, date);
|
||||||
|
lqw.eq(VenueInfoDO::getType, type);
|
||||||
|
return baseMapper.selectList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<VenueInfoDO> page(VenueInfoQueryRequest request) {
|
||||||
|
Page<VenueInfoDO> page = new Page<>(request.getCurrent(), request.getPageSize());
|
||||||
|
LambdaQueryWrapper<VenueInfoDO> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(VenueInfoDO::getDate, request.getDate());
|
||||||
|
if (StringUtils.isNotBlank(request.getSj())) {
|
||||||
|
lqw.eq(VenueInfoDO::getSjName, request.getSj());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(request.getPlaceName())) {
|
||||||
|
lqw.like(VenueInfoDO::getPlaceName, request.getPlaceName());
|
||||||
|
}
|
||||||
|
return baseMapper.selectPage(page, lqw);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:58
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface JntyzxOrderCreateInfoMapper extends BaseMapper<OrderInfoDO> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface JntyzxUserRestrictionInfoMapper extends BaseMapper<UserRestrictionInfo> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:18
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface JntyzxUserTokenInfoMapper extends BaseMapper<UserTokenInfoDO> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 15:48
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface JntyzxVenueInfoMapper extends BaseMapper<VenueInfoDO> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.OrderCreateResp;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 14:47
|
||||||
|
*/
|
||||||
|
public interface IJntyzxHttpService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询今日可用场地
|
||||||
|
*/
|
||||||
|
List<SitePositionList> queryAvailable(String isWeekend, String token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询明日可用场地
|
||||||
|
* @param isWeekend
|
||||||
|
* @param token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SitePositionList> queryAvailableTomorrow(String isWeekend, String token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JntyzxResponse<OrderCreateResp> createOrder(List<VenueInfoDO> venueInfos, String token, String openId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心跳监测
|
||||||
|
* @param token token
|
||||||
|
* @param openId openid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JntyzxResponse healthDeclaration(String token, String openId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openid查询
|
||||||
|
* @param token token
|
||||||
|
* @param openId openId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JntyzxResponse<UserInfoResponse> queryByOpenId(String token, String openId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验会员卡状态
|
||||||
|
* @param token token
|
||||||
|
* @param cardNo 会员卡号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JntyzxResponse checkDefaultNums(String token, String cardNo);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 16:17
|
||||||
|
*/
|
||||||
|
public interface IJtOrderService {
|
||||||
|
|
||||||
|
boolean createOrder(List<VenueInfoDO> venueInfoDOS, UserTokenInfoDO userTokenInfoDO);
|
||||||
|
|
||||||
|
List<OrderInfoDO> queryNoPayOrder();
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.UserAddReq;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.JtUserVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:22
|
||||||
|
*/
|
||||||
|
public interface IUserTokenInfoService {
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> getAvailableUser();
|
||||||
|
List<UserTokenInfoDO> getCanOrderUser();
|
||||||
|
String getToken(String name);
|
||||||
|
boolean flushSingleToken(String name);
|
||||||
|
boolean flushToken();
|
||||||
|
boolean updateTokenByName(String name, String token);
|
||||||
|
|
||||||
|
List<JtUserVo> list(UserQueryReq req);
|
||||||
|
|
||||||
|
Boolean updateStatusByUserName(String username, Integer status);
|
||||||
|
|
||||||
|
Boolean refreshToken(String username);
|
||||||
|
|
||||||
|
Boolean save(UserAddReq req);
|
||||||
|
|
||||||
|
JtUserVo info(Long userId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.VenueInfoQueryRequest;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.VenueInfoQueryResp;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 16:07
|
||||||
|
*/
|
||||||
|
public interface IVenueService {
|
||||||
|
|
||||||
|
List<SitePositionList> queryVenueService();
|
||||||
|
List<SitePositionList> queryTomorrowVenue();
|
||||||
|
List<VenueInfoDO> queryCanBuyVenue();
|
||||||
|
List<VenueInfoDO> queryTomorrowCanBuyVenue();
|
||||||
|
List<VenueInfoDO> queryToday6210VenueInfo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新场地信息
|
||||||
|
* @param sitePositionLists
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean saveOrUpdateTodayVenueInfo(List<SitePositionList> sitePositionLists);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新第二天的场地信息
|
||||||
|
* @param sitePositionLists
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean saveTomorrowVenueInfo(List<SitePositionList> sitePositionLists);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询场地列表信息
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Page<VenueInfoQueryResp> list(VenueInfoQueryRequest request);
|
||||||
|
}
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.alibaba.fastjson2.TypeReference;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.SubscribeRequest;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.SubscribeVo;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.OrderCreateResp;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.VenueList;
|
||||||
|
import com.xiang.common.utils.RedisService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.constants.UrlConstant;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.manage.IOrderCreateInfoManage;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.utils.JntyzxSaltEncodeUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
||||||
|
|
||||||
|
private final RedisService redisService;
|
||||||
|
private final IOrderCreateInfoManage orderCreateInfoManage;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SitePositionList> queryAvailable(String isWeekend, String token) {
|
||||||
|
String url = UrlConstant.QUERY_TODAY_SUBSCRIBE_URL;
|
||||||
|
return querySitePositionInfo(isWeekend, token, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static List<SitePositionList> querySitePositionInfo(String isWeekend, String token, String url) {
|
||||||
|
Map<String, String> header = Maps.newHashMap();
|
||||||
|
header.put("X-Access-Token", token);
|
||||||
|
String resp = null;
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("gid", "03");
|
||||||
|
params.put("isWeekend", isWeekend);
|
||||||
|
try {
|
||||||
|
resp = HttpHelper.doGet(url, header, params);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("[doGet] 江南体育中心查询当天场地 请求失败, url:{}", url);
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(resp)) {
|
||||||
|
log.warn("[查询场地] 江南体育中心查询当天场地 请求结果为空, url:{}, resp:{}", url, resp);
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSON.parseObject(resp);
|
||||||
|
if (Objects.isNull(jsonObject)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
String resultStr = JSON.toJSONString(jsonObject.get("result"));
|
||||||
|
if (StringUtils.isBlank(resultStr)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
JSONObject result = JSON.parseObject(resultStr);
|
||||||
|
if (Objects.isNull(result)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
String venueStr = JSON.toJSONString(result.get("venue"));
|
||||||
|
if (StringUtils.isBlank(venueStr)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<VenueList> venueLists = JSON.parseArray(venueStr, VenueList.class);
|
||||||
|
if (CollectionUtils.isEmpty(venueLists)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<SitePositionList> res = Lists.newArrayList();
|
||||||
|
for (VenueList venueList : venueLists) {
|
||||||
|
List<SitePositionList> sitePositionList = venueList.getSitePosition();
|
||||||
|
if (CollectionUtils.isEmpty(sitePositionList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
res.addAll(sitePositionList);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SitePositionList> queryAvailableTomorrow(String isWeekend, String token) {
|
||||||
|
String url = UrlConstant.QUERY_TOMORROW_SUBSCRIBE_URL;
|
||||||
|
return querySitePositionInfo(isWeekend, token, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JntyzxResponse<OrderCreateResp> createOrder(List<VenueInfoDO> venueInfos, String token, String openId) {
|
||||||
|
List<SubscribeVo> vos = Lists.newArrayList();
|
||||||
|
for (VenueInfoDO venueInfo : venueInfos) {
|
||||||
|
SubscribeVo subscribeVo = new SubscribeVo();
|
||||||
|
subscribeVo.setId(0);
|
||||||
|
subscribeVo.setBallCourtId("03");
|
||||||
|
subscribeVo.setSjName(venueInfo.getSjName());
|
||||||
|
subscribeVo.setScheduleId(String.valueOf(venueInfo.getScheduleId()));
|
||||||
|
subscribeVo.setPlaceName(venueInfo.getPlaceName());
|
||||||
|
subscribeVo.setPlaceId(venueInfo.getPlaceId());
|
||||||
|
subscribeVo.setType("0");
|
||||||
|
subscribeVo.setClassName(venueInfo.getClassName());
|
||||||
|
subscribeVo.setClassCode(venueInfo.getClassCode());
|
||||||
|
subscribeVo.setMoney(venueInfo.getMoney().setScale(0));
|
||||||
|
subscribeVo.setContacts("0");
|
||||||
|
subscribeVo.setContactNumber(null);
|
||||||
|
subscribeVo.setMemberNumber(null);
|
||||||
|
subscribeVo.setAppointments(venueInfo.getAppointments());
|
||||||
|
subscribeVo.setOperator(null);
|
||||||
|
subscribeVo.setEndTime(null);
|
||||||
|
subscribeVo.setBeginTime(null);
|
||||||
|
subscribeVo.setSpecOneTimes(3);
|
||||||
|
subscribeVo.setCtypeCode(venueInfo.getCTypeCode());
|
||||||
|
subscribeVo.setIsWhole(0);
|
||||||
|
subscribeVo.setOrderId(null);
|
||||||
|
subscribeVo.setVotesnum(1);
|
||||||
|
vos.add(subscribeVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jsonObject = buildParamJsonObj(openId);
|
||||||
|
SubscribeRequest subscribeRequest = new SubscribeRequest();
|
||||||
|
|
||||||
|
subscribeRequest.setSubscribeVos(vos);
|
||||||
|
subscribeRequest.setBookTime(venueInfos.get(0).getAppointments());
|
||||||
|
subscribeRequest.setPaymentMethod(1);
|
||||||
|
subscribeRequest.setSvCiphertext(JntyzxSaltEncodeUtils.sonAddSalt(JsonUtils.toJsonString(vos)));
|
||||||
|
subscribeRequest.setJsonObject(jsonObject);
|
||||||
|
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("X-Access-Token", token);
|
||||||
|
String resp = HttpHelper.doPost(UrlConstant.ADD_SUBSCRIBE, params, JsonUtils.toJsonString(subscribeRequest));
|
||||||
|
log.info("[江体小程序] 羽毛球场地下单响应结果:{}", resp);
|
||||||
|
if (StringUtils.isBlank(resp)) {
|
||||||
|
log.info("[resp] 请求结果为空");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
JntyzxResponse<OrderCreateResp> response = JSON.parseObject(resp, new TypeReference<JntyzxResponse<OrderCreateResp>>() {
|
||||||
|
});
|
||||||
|
if (Objects.isNull(response)) {
|
||||||
|
log.info("[res ==> response] 请求结果为空");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public JntyzxResponse healthDeclaration(String token, String openId) {
|
||||||
|
Map<String, String> headers = Maps.newHashMap();
|
||||||
|
headers.put("X-Access-Token", token);
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("openId", openId);
|
||||||
|
|
||||||
|
String respStr = HttpHelper.doGet(UrlConstant.HEALTH_DECLARATION, headers, params);
|
||||||
|
if (StringUtils.isBlank(respStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSON.parseObject(respStr, JntyzxResponse.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JntyzxResponse<UserInfoResponse> queryByOpenId(String token, String openId) {
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("openId", openId);
|
||||||
|
Map<String, String> headers = Maps.newHashMap();
|
||||||
|
headers.put("X-Access-Token", token);
|
||||||
|
|
||||||
|
String resp = HttpHelper.doGet(UrlConstant.QUERY_BY_OPEN_ID, headers, params);
|
||||||
|
JntyzxResponse<UserInfoResponse> response = JSON.parseObject(resp, new TypeReference<JntyzxResponse<UserInfoResponse>>() {
|
||||||
|
});
|
||||||
|
if (Objects.isNull(response)) {
|
||||||
|
log.info("请求结果为空!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JntyzxResponse checkDefaultNums(String token, String cardNo) {
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("consNumber", cardNo);
|
||||||
|
Map<String, String> headers = Maps.newHashMap();
|
||||||
|
headers.put("X-Access-Token", token);
|
||||||
|
|
||||||
|
String resp = HttpHelper.doGet(UrlConstant.CHECK_NUM, headers, params);
|
||||||
|
if (StringUtils.isBlank(resp)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSON.parseObject(resp, JntyzxResponse.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JSONObject buildParamJsonObj(String openId) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("id", "1702581215097257986");
|
||||||
|
jsonObject.put("createBy", null);
|
||||||
|
jsonObject.put("createTime", "2023-09-15 15:12:48");
|
||||||
|
jsonObject.put("updateBy", null);
|
||||||
|
jsonObject.put("updateTime", null);
|
||||||
|
jsonObject.put("sysOrgCode", null);
|
||||||
|
jsonObject.put("openId", openId);
|
||||||
|
jsonObject.put("nickName", "1");
|
||||||
|
jsonObject.put("unionId", null);
|
||||||
|
jsonObject.put("avatarUrl", "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132");
|
||||||
|
jsonObject.put("remarks", null);
|
||||||
|
jsonObject.put("default01", null);
|
||||||
|
jsonObject.put("default02", null);
|
||||||
|
jsonObject.put("default03", null);
|
||||||
|
jsonObject.put("default04", null);
|
||||||
|
jsonObject.put("default05", null);
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.xiang.common.exception.BusinessException;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.OrderCreateResp;
|
||||||
|
import com.xiang.common.utils.RedisService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.constants.RedisKeyConstant;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.manage.IOrderCreateInfoManage;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.service.IJtOrderService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 16:17
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OrderInfoServiceImpl implements IJtOrderService {
|
||||||
|
|
||||||
|
private final IOrderCreateInfoManage orderCreateInfoManage;
|
||||||
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
|
private final RedisService redisService;
|
||||||
|
private final JntyzxHttpServiceImpl dingTalkFactory;
|
||||||
|
@Override
|
||||||
|
public List<OrderInfoDO> queryNoPayOrder() {
|
||||||
|
return orderCreateInfoManage.queryNoPayOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createOrder(List<VenueInfoDO> venueInfoDOS, UserTokenInfoDO userTokenInfoDO) {
|
||||||
|
|
||||||
|
String order = (String) redisService.get(RedisKeyConstant.JNTYZX_ORDER_CREATE_KEY + userTokenInfoDO.getName() + LocalDate.now());
|
||||||
|
if (StringUtils.isNotBlank(order)) {
|
||||||
|
log.info("用户:{}已经有成功预订了场地", userTokenInfoDO.getName());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String user = (String) redisService.get(RedisKeyConstant.getCloseCardKey(userTokenInfoDO.getName()));
|
||||||
|
if (StringUtils.isNotBlank(user)) {
|
||||||
|
log.info("用户:{}有锁卡风险,不在请求接口!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
JntyzxResponse<OrderCreateResp> orderResp = jntyzxHttpService.createOrder(venueInfoDOS, userTokenInfoDO.getToken(), userTokenInfoDO.getOpenId());
|
||||||
|
if (Objects.isNull(orderResp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (orderResp.getSuccess()) {
|
||||||
|
OrderCreateResp result = orderResp.getResult();
|
||||||
|
if (Objects.nonNull(result)) {
|
||||||
|
String orderId = result.getId();
|
||||||
|
if (StringUtils.isNotBlank(orderId)) {
|
||||||
|
redisService.set(RedisKeyConstant.JNTYZX_ORDER_CREATE_KEY + userTokenInfoDO.getName() + LocalDate.now(), orderId);
|
||||||
|
OrderInfoDO orderInfoDO = new OrderInfoDO();
|
||||||
|
orderInfoDO.setOrderId(orderId);
|
||||||
|
orderInfoDO.setCreateTime(LocalDateTime.now());
|
||||||
|
orderInfoDO.setUsername(userTokenInfoDO.getName());
|
||||||
|
orderInfoDO.setPlaceName(venueInfoDOS.get(0).getPlaceName());
|
||||||
|
orderInfoDO.setDate(LocalDate.now());
|
||||||
|
orderInfoDO.setOrderStatus(0);
|
||||||
|
orderCreateInfoManage.save(orderInfoDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
||||||
|
if (orderResp.getMessage().contains("锁卡")) {
|
||||||
|
log.info("有锁卡风险,不在请求,用户:{}", userTokenInfoDO.getName());
|
||||||
|
throw new BusinessException("即将锁卡,不再请求");
|
||||||
|
}
|
||||||
|
if (orderResp.getMessage().contains("限制")) {
|
||||||
|
log.info("改会员卡被限制,不在请求,用户:{}", userTokenInfoDO.getName());
|
||||||
|
redisService.set(RedisKeyConstant.getCloseCardKey(userTokenInfoDO.getName()), "true");
|
||||||
|
throw new BusinessException("会员卡被限制,不在请求");
|
||||||
|
}
|
||||||
|
if (orderResp.getMessage().contains("已有人预订")) {
|
||||||
|
log.info("该场地已被人预定,更换场地, 用户:{}", userTokenInfoDO.getName());
|
||||||
|
redisService.set(RedisKeyConstant.getVenueSubscribeKey(venueInfoDOS.get(0).getPlaceName()), "true");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service.impl;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.xiang.common.exception.BusinessException;
|
||||||
|
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.UserAddReq;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.JtUserVo;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse;
|
||||||
|
import com.xiang.common.utils.DateUtils;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.converts.UserConverter;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.manage.IUserRestrictionManage;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.manage.IUserTokenInfoManage;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
||||||
|
|
||||||
|
private final IUserTokenInfoManage userTokenInfoManage;
|
||||||
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
|
private final JntyzxDingTalkFactory jtDingTalkFactory;
|
||||||
|
private final IUserRestrictionManage userRestrictionManage;
|
||||||
|
private final UserConverter userConverter;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> getAvailableUser() {
|
||||||
|
return userTokenInfoManage.listUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToken(String name) {
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return userTokenInfoDO.getToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> getCanOrderUser() {
|
||||||
|
return userTokenInfoManage.listCanOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean flushSingleToken(String name) {
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
log.info("用户信息不存在,无需进行监测!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return healthDeclaration(userTokenInfoDO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean flushToken() {
|
||||||
|
List<UserTokenInfoDO> userTokenInfoDOS = userTokenInfoManage.list();
|
||||||
|
if (CollectionUtils.isEmpty(userTokenInfoDOS)) {
|
||||||
|
log.info("【心跳监测】查询用户信息为空,无需操作");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
userTokenInfoDOS.forEach(this::healthDeclaration);
|
||||||
|
// 信息更新
|
||||||
|
userTokenInfoDOS = userTokenInfoManage.list();
|
||||||
|
userTokenInfoDOS.forEach(this::queryMemberCardInfo);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateTokenByName(String name, String token) {
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
throw new BusinessException("用户信息不存在!");
|
||||||
|
}
|
||||||
|
userTokenInfoDO.setToken(token);
|
||||||
|
boolean flag = userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
|
jtDingTalkFactory.sendMsg("用户:" + name + ",token更新成功!");
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean healthDeclaration(UserTokenInfoDO userTokenInfoDO) {
|
||||||
|
JntyzxResponse jntyzxResponse = jntyzxHttpService.healthDeclaration(userTokenInfoDO.getToken(), userTokenInfoDO.getOpenId());
|
||||||
|
if (Objects.isNull(jntyzxResponse)) {
|
||||||
|
log.info("用户名:{}心跳监测失败!", userTokenInfoDO.getName());
|
||||||
|
}
|
||||||
|
boolean flag = StringUtils.contains(jntyzxResponse.getMessage(), "已存在");
|
||||||
|
if (flag) {
|
||||||
|
log.info("用户名:{}心跳成功✅✅✅✅✅✅", userTokenInfoDO.getName());
|
||||||
|
userTokenInfoDO.setStatus(1);
|
||||||
|
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
|
} else {
|
||||||
|
jtDingTalkFactory.sendMsg("用户名:" + userTokenInfoDO.getName() + "心跳失败,消息:" + jntyzxResponse.getMessage());
|
||||||
|
userTokenInfoDO.setStatus(0);
|
||||||
|
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<JtUserVo> list(UserQueryReq req) {
|
||||||
|
List<UserTokenInfoDO> userTokenInfoDOS = userTokenInfoManage.queryByList(req);
|
||||||
|
if (CollectionUtils.isEmpty(userTokenInfoDOS)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<Long> idList = userTokenInfoDOS.stream().map(UserTokenInfoDO::getId).toList();
|
||||||
|
List<UserRestrictionInfo> userRestrictionInfos = userRestrictionManage.queryByIdList(idList);
|
||||||
|
Map<Long, UserRestrictionInfo> userRestrictionInfoMap = Maps.newHashMap();
|
||||||
|
if (CollectionUtils.isNotEmpty(userRestrictionInfos)) {
|
||||||
|
userRestrictionInfoMap.putAll(
|
||||||
|
userRestrictionInfos.stream().collect(Collectors.toMap(
|
||||||
|
UserRestrictionInfo::getUserId, Function.identity(), (a, b) -> a)));
|
||||||
|
}
|
||||||
|
List<JtUserVo> jtUserVoList = userConverter.convert(userTokenInfoDOS);
|
||||||
|
jtUserVoList.forEach(item -> {
|
||||||
|
if (userRestrictionInfoMap.containsKey(item.getUserId())) {
|
||||||
|
UserRestrictionInfo userRestrictionInfo = userRestrictionInfoMap.get(item.getUserId());
|
||||||
|
if (Objects.nonNull(userRestrictionInfo)) {
|
||||||
|
if (userRestrictionInfo.getRestrictionDeadline().isAfter(LocalDateTime.now())) {
|
||||||
|
item.setRestrictionDeadline(userRestrictionInfo.getRestrictionDeadline());
|
||||||
|
item.setRestrictionDesc(userRestrictionInfo.getRestrictionDesc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return jtUserVoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updateStatusByUserName(String username, Integer status) {
|
||||||
|
if (StringUtils.isEmpty(username)) {
|
||||||
|
log.error("用户名为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(username);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
throw new BusinessException("用户不存在!");
|
||||||
|
}
|
||||||
|
userTokenInfoDO.setStatus(status);
|
||||||
|
return userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean refreshToken(String username) {
|
||||||
|
if (StringUtils.isEmpty(username)) {
|
||||||
|
log.error("用户名为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(username);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
throw new BusinessException("用户不存在!");
|
||||||
|
}
|
||||||
|
return healthDeclaration(userTokenInfoDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean save(UserAddReq req) {
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(req.getName());
|
||||||
|
if (Objects.nonNull(userTokenInfoDO)) {
|
||||||
|
throw new BusinessException("用户名已存在!");
|
||||||
|
}
|
||||||
|
userTokenInfoDO = new UserTokenInfoDO();
|
||||||
|
userTokenInfoDO.setName(req.getName());
|
||||||
|
userTokenInfoDO.setToken(req.getToken());
|
||||||
|
userTokenInfoDO.setOpenId(req.getOpenId());
|
||||||
|
userTokenInfoDO.setStatus(req.getStatus());
|
||||||
|
userTokenInfoDO.setIsOrder(1);
|
||||||
|
userTokenInfoDO.setMemberCardNo(req.getMemberCardNo());
|
||||||
|
userTokenInfoDO.setIsRestriction(0);
|
||||||
|
userTokenInfoDO.setUpdateTime(LocalDateTime.now());
|
||||||
|
return userTokenInfoManage.save(userTokenInfoDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JtUserVo info(Long userId) {
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getById(userId);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
throw new BusinessException("用户不存在!");
|
||||||
|
}
|
||||||
|
JtUserVo jtUserVo = userConverter.convert(userTokenInfoDO);
|
||||||
|
UserRestrictionInfo userRestrictionInfo = userRestrictionManage.queryByUserId(userId);
|
||||||
|
if (Objects.nonNull(userRestrictionInfo)) {
|
||||||
|
if (userRestrictionInfo.getRestrictionDeadline().isAfter(LocalDateTime.now())) {
|
||||||
|
jtUserVo.setRestrictionDeadline(userRestrictionInfo.getRestrictionDeadline());
|
||||||
|
jtUserVo.setRestrictionDesc(userRestrictionInfo.getRestrictionDesc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return jtUserVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户信息
|
||||||
|
*
|
||||||
|
* @param userTokenInfoDO 用户
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private void queryMemberCardInfo(UserTokenInfoDO userTokenInfoDO) {
|
||||||
|
JntyzxResponse<UserInfoResponse> response = jntyzxHttpService.queryByOpenId(userTokenInfoDO.getToken(), userTokenInfoDO.getOpenId());
|
||||||
|
if (Objects.isNull(response)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (response.getSuccess()) {
|
||||||
|
UserInfoResponse userInfoResponse = response.getResult();
|
||||||
|
userTokenInfoDO.setMemberCardNo(userInfoResponse.getConsCard());
|
||||||
|
if (StringUtils.isNotBlank(userInfoResponse.getRestrictionDeadline2())) {
|
||||||
|
userTokenInfoDO.setIsRestriction(1);
|
||||||
|
userTokenInfoDO.setIsOrder(0);
|
||||||
|
UserRestrictionInfo userRestrictionInfo = userRestrictionManage.queryByUserId(userTokenInfoDO.getId());
|
||||||
|
if (Objects.isNull(userRestrictionInfo)) {
|
||||||
|
userRestrictionInfo = new UserRestrictionInfo();
|
||||||
|
userRestrictionInfo.setUserId(userTokenInfoDO.getId());
|
||||||
|
userRestrictionInfo.setRestrictionDeadline(DateUtils.getDateTimeFromStr(userInfoResponse.getRestrictionDeadline2()));
|
||||||
|
userRestrictionInfo.setRestrictionDesc(userInfoResponse.getRestrictionDescription());
|
||||||
|
userRestrictionManage.save(userRestrictionInfo);
|
||||||
|
} else {
|
||||||
|
userRestrictionInfo.setRestrictionDeadline(DateUtils.getDateTimeFromStr(userInfoResponse.getRestrictionDeadline2()));
|
||||||
|
userRestrictionInfo.setRestrictionDesc(userInfoResponse.getRestrictionDescription());
|
||||||
|
userRestrictionManage.updateById(userRestrictionInfo);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
userTokenInfoDO.setIsRestriction(0);
|
||||||
|
userTokenInfoDO.setIsOrder(1);
|
||||||
|
}
|
||||||
|
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,227 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.VenueInfoQueryRequest;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.VenueInfoQueryResp;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
|
||||||
|
import com.xiang.common.utils.DateUtils;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.converts.VenueInfoConverter;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.manage.IVenueInfoManage;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 16:08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class VenueServiceImpl implements IVenueService {
|
||||||
|
|
||||||
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
|
private final IVenueInfoManage venueInfoManage;
|
||||||
|
private final IUserTokenInfoService userTokenInfoService;
|
||||||
|
private final VenueInfoConverter venueInfoConverter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SitePositionList> queryVenueService() {
|
||||||
|
String token = userTokenInfoService.getToken("Xiang");
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailable("1", token);
|
||||||
|
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
updateDatabase(sitePositionLists, true);
|
||||||
|
return sitePositionLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SitePositionList> queryTomorrowVenue() {
|
||||||
|
String token = userTokenInfoService.getToken("Xiang");
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow("1", token);
|
||||||
|
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
updateDatabase(sitePositionLists, false);
|
||||||
|
return sitePositionLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VenueInfoDO> queryCanBuyVenue() {
|
||||||
|
return venueInfoManage.queryByType(LocalDate.now(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VenueInfoDO> queryTomorrowCanBuyVenue() {
|
||||||
|
return venueInfoManage.queryByType(LocalDate.now().plusDays(1), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VenueInfoDO> queryToday6210VenueInfo() {
|
||||||
|
List<VenueInfoDO> venueInfoDOS = venueInfoManage.queryByDate(LocalDate.now());
|
||||||
|
return venueInfoDOS.stream().filter(item -> VenueInfoUtils.get628VenueInfo(item) || VenueInfoUtils.get8210VenueInfo(item)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveOrUpdateTodayVenueInfo(List<SitePositionList> sitePositionLists) {
|
||||||
|
List<VenueInfoDO> venueInfoDOS = venueInfoManage.queryByDate(LocalDate.now());
|
||||||
|
Map<String, Map<String, VenueInfoDO>> map = Maps.newHashMap();
|
||||||
|
if (CollectionUtils.isNotEmpty(sitePositionLists)) {
|
||||||
|
Map<String, List<VenueInfoDO>> map1 = venueInfoDOS.stream().collect(Collectors.groupingBy(VenueInfoDO::getPlaceName));
|
||||||
|
map1.forEach((placeName, venueInfos) -> {
|
||||||
|
Map<String, VenueInfoDO> venueInfoDOMap = venueInfoDOS.stream().collect(Collectors.toMap(VenueInfoDO::getSjName, Function.identity(), (a, b) -> a));
|
||||||
|
map.put(placeName, venueInfoDOMap);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SitePositionList sitePositionList : sitePositionLists) {
|
||||||
|
if (map.containsKey(sitePositionList.getPlaceName())) {
|
||||||
|
Map<String, VenueInfoDO> venueInfoDOMap = map.get(sitePositionList.getPlaceName());
|
||||||
|
if (venueInfoDOMap.containsKey(sitePositionList.getSjName())) {
|
||||||
|
VenueInfoDO venueInfoDO = venueInfoDOMap.get(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setPlaceName(sitePositionList.getPlaceName());
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoDO.setPlaceId(sitePositionList.getPlaceId());
|
||||||
|
venueInfoDO.setScheduleId(Integer.valueOf(sitePositionList.getScheduleId()));
|
||||||
|
venueInfoDO.setSjName(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setMoney(sitePositionList.getMoney());
|
||||||
|
venueInfoDO.setClassName(sitePositionList.getClassName());
|
||||||
|
venueInfoDO.setClassCode(sitePositionList.getClassCode());
|
||||||
|
venueInfoDO.setAppointments(sitePositionList.getAppointments());
|
||||||
|
venueInfoDO.setCTypeCode(sitePositionList.getCtypeCode());
|
||||||
|
venueInfoManage.updateById(venueInfoDO);
|
||||||
|
} else {
|
||||||
|
VenueInfoDO venueInfoDO = new VenueInfoDO();
|
||||||
|
venueInfoDO.setDate(LocalDate.now());
|
||||||
|
venueInfoDO.setCreateTime(LocalDateTime.now());
|
||||||
|
venueInfoDO.setPlaceName(sitePositionList.getPlaceName());
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoDO.setPlaceId(sitePositionList.getPlaceId());
|
||||||
|
venueInfoDO.setScheduleId(Integer.valueOf(sitePositionList.getScheduleId()));
|
||||||
|
venueInfoDO.setSjName(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setMoney(sitePositionList.getMoney());
|
||||||
|
venueInfoDO.setClassName(sitePositionList.getClassName());
|
||||||
|
venueInfoDO.setClassCode(sitePositionList.getClassCode());
|
||||||
|
venueInfoDO.setAppointments(sitePositionList.getAppointments());
|
||||||
|
venueInfoDO.setCTypeCode(sitePositionList.getCtypeCode());
|
||||||
|
venueInfoManage.save(venueInfoDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveTomorrowVenueInfo(List<SitePositionList> sitePositionLists) {
|
||||||
|
for (SitePositionList sitePositionList : sitePositionLists) {
|
||||||
|
VenueInfoDO venueInfoDO = new VenueInfoDO();
|
||||||
|
venueInfoDO.setDate(LocalDate.now().plusDays(1));
|
||||||
|
venueInfoDO.setCreateTime(LocalDateTime.now());
|
||||||
|
venueInfoDO.setPlaceName(sitePositionList.getPlaceName());
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoDO.setPlaceId(sitePositionList.getPlaceId());
|
||||||
|
venueInfoDO.setScheduleId(Integer.valueOf(sitePositionList.getScheduleId()));
|
||||||
|
venueInfoDO.setSjName(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setMoney(sitePositionList.getMoney());
|
||||||
|
venueInfoDO.setClassName(sitePositionList.getClassName());
|
||||||
|
venueInfoDO.setClassCode(sitePositionList.getClassCode());
|
||||||
|
venueInfoDO.setAppointments(sitePositionList.getAppointments());
|
||||||
|
venueInfoDO.setCTypeCode(sitePositionList.getCtypeCode());
|
||||||
|
venueInfoManage.save(venueInfoDO);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<VenueInfoQueryResp> list(VenueInfoQueryRequest request) {
|
||||||
|
Page<VenueInfoDO> page = venueInfoManage.page(request);
|
||||||
|
return venueInfoConverter.toPage(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDatabase(List<SitePositionList> list, boolean isToday) {
|
||||||
|
List<VenueInfoDO> venueInfoDOS = Lists.newArrayList();
|
||||||
|
if (isToday) {
|
||||||
|
venueInfoDOS.addAll(venueInfoManage.queryByDate(LocalDate.now()));
|
||||||
|
} else {
|
||||||
|
venueInfoDOS.addAll(venueInfoManage.queryByDate(LocalDate.now().plusDays(1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Integer, List<VenueInfoDO>> map = Maps.newHashMap();
|
||||||
|
if (CollectionUtils.isNotEmpty(venueInfoDOS)) {
|
||||||
|
map.putAll(venueInfoDOS.stream().filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.groupingBy(VenueInfoDO::getPlaceId)));
|
||||||
|
}
|
||||||
|
List<VenueInfoDO> insertList = Lists.newArrayList();
|
||||||
|
for (SitePositionList sitePositionList : list) {
|
||||||
|
if (map.containsKey(sitePositionList.getPlaceId())) {
|
||||||
|
List<VenueInfoDO> venueInfoDOList = map.get(sitePositionList.getPlaceId());
|
||||||
|
Map<String, VenueInfoDO> sjMap = venueInfoDOList.stream().collect(Collectors.toMap(VenueInfoDO::getSjName, Function.identity(), (a, b) -> a));
|
||||||
|
if (sjMap.containsKey(sitePositionList.getSjName())) {
|
||||||
|
VenueInfoDO venueInfoDO = sjMap.get(sitePositionList.getSjName());
|
||||||
|
if (!StringUtils.equals(venueInfoDO.getContacts(), sitePositionList.getContacts())
|
||||||
|
|| !Objects.equals(venueInfoDO.getType(), sitePositionList.getType())
|
||||||
|
|| !Objects.equals(venueInfoDO.getPlaceMainId(), sitePositionList.getId())) {
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoManage.updateById(venueInfoDO);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addIntoInsert(sitePositionList, insertList);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addIntoInsert(sitePositionList, insertList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(insertList)) {
|
||||||
|
venueInfoManage.saveBatch(insertList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addIntoInsert(SitePositionList sitePositionList, List<VenueInfoDO> insertList) {
|
||||||
|
VenueInfoDO venueInfoDO = new VenueInfoDO();
|
||||||
|
venueInfoDO.setPlaceName(sitePositionList.getPlaceName());
|
||||||
|
venueInfoDO.setDate(DateUtils.getDateFromStr(sitePositionList.getAppointments()));
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoDO.setPlaceId(sitePositionList.getPlaceId());
|
||||||
|
venueInfoDO.setScheduleId(Integer.valueOf(sitePositionList.getScheduleId()));
|
||||||
|
venueInfoDO.setSjName(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setCreateTime(LocalDateTime.now());
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setMoney(sitePositionList.getMoney());
|
||||||
|
venueInfoDO.setClassName(sitePositionList.getClassName());
|
||||||
|
venueInfoDO.setClassCode(sitePositionList.getClassCode());
|
||||||
|
venueInfoDO.setAppointments(sitePositionList.getAppointments());
|
||||||
|
venueInfoDO.setCTypeCode(sitePositionList.getCtypeCode());
|
||||||
|
insertList.add(venueInfoDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xiang.common.utils.Base64;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class JntyzxSaltEncodeUtils {
|
||||||
|
|
||||||
|
private static int[] getMonthAndDay() {
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
int month = currentDate.getMonthValue();
|
||||||
|
int day = currentDate.getDayOfMonth();
|
||||||
|
return new int[]{month, day};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String sonAddSalt(String json) {
|
||||||
|
String svCiphertext = "";
|
||||||
|
String suiji = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
String token1 = String.valueOf(suiji.charAt((int) (Math.random() * (double) suiji.length())));
|
||||||
|
String token2 = String.valueOf(suiji.charAt((int) (Math.random() * (double) suiji.length())));
|
||||||
|
svCiphertext = Base64.encode(json.getBytes(StandardCharsets.UTF_8));
|
||||||
|
int[] monthAndDay = getMonthAndDay();
|
||||||
|
int month = monthAndDay[0];
|
||||||
|
int day = monthAndDay[1];
|
||||||
|
if (month == 1) {
|
||||||
|
svCiphertext = (svCiphertext = token1 + svCiphertext).substring(0, day - 1) + token2 + svCiphertext.substring(day - 1);
|
||||||
|
} else if (day == 1) {
|
||||||
|
svCiphertext = token2 + svCiphertext.substring(0, month - 1) + token1 + svCiphertext.substring(month - 1);
|
||||||
|
} else {
|
||||||
|
svCiphertext = (svCiphertext = svCiphertext.substring(0, month - 1) + token1 + svCiphertext.substring(month - 1)).substring(0, day - 1) + token2 + svCiphertext.substring(day - 1);
|
||||||
|
}
|
||||||
|
return svCiphertext;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.utils;
|
||||||
|
|
||||||
|
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
||||||
|
import com.xiang.common.utils.RedisService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.constants.RedisKeyConstant;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-01-26 09:14
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MsgSendUtils {
|
||||||
|
|
||||||
|
private final RedisService redisService;
|
||||||
|
private final JntyzxDingTalkFactory jtDingTalkFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限制钉钉消息发送 1小时最多5次
|
||||||
|
* @param redisKey redis缓存的key
|
||||||
|
* @param msgContent 消息内容
|
||||||
|
*/
|
||||||
|
public void sendMsgRestrict1Hours(String redisKey, String msgContent) {
|
||||||
|
String key = RedisKeyConstant.JNTYZX_VENUE_MSG_SEND_KEY + RedisKeyConstant.getDate();
|
||||||
|
String cache = (String) redisService.get(redisKey);
|
||||||
|
if (StringUtils.isNotBlank(cache)) {
|
||||||
|
int sendNum = Integer.parseInt(cache);
|
||||||
|
if (sendNum >= 0 && sendNum <= 5) {
|
||||||
|
jtDingTalkFactory.sendMsg(msgContent);
|
||||||
|
redisService.set(key, String.valueOf(++sendNum), 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jtDingTalkFactory.sendMsg(msgContent);
|
||||||
|
redisService.set(key, "0", 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.utils;
|
||||||
|
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:55
|
||||||
|
*/
|
||||||
|
public class VenueInfoUtils {
|
||||||
|
|
||||||
|
public static boolean get123VenueInfo4Mor(VenueInfoDO venueInfoDO) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "13:00-14:00") || StringUtils.equals(venueInfoDO.getSjName(), "14:00-15:00");
|
||||||
|
}
|
||||||
|
public static boolean get1221VenueInfo4Mor(VenueInfoDO venueInfoDO) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "12:00-13:00") || StringUtils.equals(venueInfoDO.getSjName(), "13:00-14:00");
|
||||||
|
}
|
||||||
|
public static boolean get628VenueInfo(VenueInfoDO venueInfoDO) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "18:00-19:00") || StringUtils.equals(venueInfoDO.getSjName(), "19:00-20:00");
|
||||||
|
}
|
||||||
|
public static boolean get8210VenueInfo(VenueInfoDO venueInfoDO) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "20:00-21:00") || StringUtils.equals(venueInfoDO.getSjName(), "21:00-22:00");
|
||||||
|
}
|
||||||
|
public static boolean get8210VenueInfo(SitePositionList sitePositionList) {
|
||||||
|
return StringUtils.equals(sitePositionList.getSjName(), "20:00-21:00") || StringUtils.equals(sitePositionList.getSjName(), "21:00-22:00");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int sortVenueInfo(String placeName) {
|
||||||
|
if (placeName.contains("十号")) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (placeName.contains("二号")) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (placeName.contains("九号")) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.utils;
|
||||||
|
|
||||||
|
import java.time.DayOfWeek;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class WeekendUtils {
|
||||||
|
|
||||||
|
public static String isWeekend() {
|
||||||
|
LocalDate tomorrow = LocalDate.now().plusDays(1);
|
||||||
|
DayOfWeek dayOfWeek = tomorrow.getDayOfWeek();
|
||||||
|
String isWeekend = "0";
|
||||||
|
if (dayOfWeek.getValue() == 6 || dayOfWeek.getValue() == 7 ) {
|
||||||
|
isWeekend = "1";
|
||||||
|
}
|
||||||
|
return isWeekend;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user