Compare commits
17 Commits
feat/jntyz
...
4f07b22919
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f07b22919 | ||
|
|
1634565e92 | ||
|
|
65114aca14 | ||
|
|
9d14b3b7dc | ||
|
|
eb441b03e5 | ||
|
|
d40a15cbb5 | ||
|
|
7bf6b5d5ed | ||
|
|
1ad4012070 | ||
|
|
9e599ad5ae | ||
|
|
59ebe2b349 | ||
|
|
7f35a9960d | ||
|
|
963e03c5c9 | ||
|
|
211cca9a4b | ||
|
|
94b46737da | ||
|
|
0d2ae54678 | ||
|
|
8514eac031 | ||
|
|
1a7569d1a1 |
20
api/pom.xml
Normal file
20
api/pom.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.xiang.app</groupId>
|
||||||
|
<artifactId>xservice-cornucopia</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.xiang.app.module.jntyzx.pojo.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserAddReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "用户名称不能为空")
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "token不能为空")
|
||||||
|
private String token;
|
||||||
|
/**
|
||||||
|
* wx openId
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "openId不能为空")
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "会员卡号不能为空")
|
||||||
|
private String memberCardNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0:禁用 1:启用
|
||||||
|
*/
|
||||||
|
@NotNull(message = "用户状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.xiang.app.module.jntyzx.pojo.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,22 @@
|
|||||||
|
package com.xiang.app.module.jntyzx.pojo.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserStatusUpdateReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "用户名称不能为空")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* status
|
||||||
|
*/
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.xiang.app.module.jntyzx.pojo.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserTokenUpdateReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "用户名称不能为空")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "token不能为空")
|
||||||
|
private String token;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.xiang.app.module.jntyzx.pojo.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UsernameReq {
|
||||||
|
@NotBlank(message = "用户名称不能为空")
|
||||||
|
private String username;
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.xiang.app.module.jntyzx.pojo.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;
|
||||||
|
|
||||||
|
}
|
||||||
9
pom.xml
9
pom.xml
@@ -17,6 +17,7 @@
|
|||||||
<modules>
|
<modules>
|
||||||
<module>xservice-server</module>
|
<module>xservice-server</module>
|
||||||
<module>xservice-core</module>
|
<module>xservice-core</module>
|
||||||
|
<module>api</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -29,7 +30,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xiang.starter</groupId>
|
<groupId>com.xiang.starter</groupId>
|
||||||
<artifactId>xmc-common</artifactId>
|
<artifactId>xmc-common</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xiang.starter</groupId>
|
<groupId>com.xiang.starter</groupId>
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xiang.starter</groupId>
|
<groupId>com.xiang.starter</groupId>
|
||||||
<artifactId>xmc-http-starter</artifactId>
|
<artifactId>xmc-http-starter</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xiang.starter</groupId>
|
<groupId>com.xiang.starter</groupId>
|
||||||
@@ -54,12 +55,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xiang.starter</groupId>
|
<groupId>com.xiang.starter</groupId>
|
||||||
<artifactId>xservice-quartz-core</artifactId>
|
<artifactId>xservice-quartz-core</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xiang.starter</groupId>
|
<groupId>com.xiang.starter</groupId>
|
||||||
<artifactId>xmc-logger-starter</artifactId>
|
<artifactId>xmc-logger-starter</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -17,4 +17,11 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xiang.app</groupId>
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
package com.xiang.app.modules.jntyzx.constants;
|
package com.xiang.app.modules.jntyzx.constants;
|
||||||
|
|
||||||
|
import com.xiang.xservice.basic.utils.DateUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: xiang
|
* @Author: xiang
|
||||||
* @Date: 2025-12-16 10:43
|
* @Date: 2025-12-16 10:43
|
||||||
@@ -9,4 +13,23 @@ public class RedisKeyConstant {
|
|||||||
public static final String JNTYZX_ORDER_CREATE_KEY = "jntyzx:order:create:orderId:";
|
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 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ public class UrlConstant {
|
|||||||
* 查询当天的场地信息
|
* 查询当天的场地信息
|
||||||
*/
|
*/
|
||||||
public final static String QUERY_TODAY_SUBSCRIBE_URL = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/getSubscribeByToday";
|
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 QUERY_TOMORROW_SUBSCRIBE_URL = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/getSubscribeByTomorrow";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,4 +35,13 @@ public class UrlConstant {
|
|||||||
*/
|
*/
|
||||||
public final static String HEALTH_DECLARATION = GNTYZX_BASE_URL + "/GYM-JN//busi/healthDeclaration/addUserPrivacy";
|
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.app.modules.jntyzx.converts;
|
||||||
|
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.resp.JtUserVo;
|
||||||
|
import com.xiang.app.modules.jntyzx.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,29 @@
|
|||||||
|
package com.xiang.app.modules.jntyzx.entity.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;
|
||||||
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.xiang.app.modules.jntyzx.entity.pojo;
|
package com.xiang.app.modules.jntyzx.entity.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: xiang
|
* @Author: xiang
|
||||||
* @Date: 2025-12-16 09:18
|
* @Date: 2025-12-16 09:18
|
||||||
@@ -34,4 +37,23 @@ public class UserTokenInfoDO {
|
|||||||
* 状态(0:禁用 1:启用)
|
* 状态(0:禁用 1:启用)
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
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,109 @@
|
|||||||
|
package com.xiang.app.modules.jntyzx.entity.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,13 @@
|
|||||||
|
package com.xiang.app.modules.jntyzx.manage;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserRestrictionInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IUserRestrictionManage extends IService<UserRestrictionInfo> {
|
||||||
|
|
||||||
|
UserRestrictionInfo queryByUserId(Long userId);
|
||||||
|
|
||||||
|
List<UserRestrictionInfo> queryByIdList(List<Long> idList);
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.xiang.app.modules.jntyzx.manage;
|
package com.xiang.app.modules.jntyzx.manage;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserQueryReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.resp.JtUserVo;
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -12,4 +14,8 @@ import java.util.List;
|
|||||||
public interface IUserTokenInfoManage extends IService<UserTokenInfoDO> {
|
public interface IUserTokenInfoManage extends IService<UserTokenInfoDO> {
|
||||||
List<UserTokenInfoDO> listUser();
|
List<UserTokenInfoDO> listUser();
|
||||||
UserTokenInfoDO getByName(String name);
|
UserTokenInfoDO getByName(String name);
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> listCanOrder();
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> queryByList(UserQueryReq req);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.xiang.app.modules.jntyzx.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.app.modules.jntyzx.entity.pojo.UserRestrictionInfo;
|
||||||
|
import com.xiang.app.modules.jntyzx.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,16 @@
|
|||||||
package com.xiang.app.modules.jntyzx.manage;
|
package com.xiang.app.modules.jntyzx.manage;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserQueryReq;
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
||||||
import com.xiang.app.modules.jntyzx.mapper.JntyzxUserTokenInfoMapper;
|
import com.xiang.app.modules.jntyzx.mapper.JntyzxUserTokenInfoMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: xiang
|
* @Author: xiang
|
||||||
@@ -27,6 +30,40 @@ public class UserTokenInfoManageImpl extends ServiceImpl<JntyzxUserTokenInfoMapp
|
|||||||
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, 1);
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, 1);
|
||||||
lambdaQueryWrapper.eq(UserTokenInfoDO::getName, name);
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getName, name);
|
||||||
|
lambdaQueryWrapper.last("limit 1");
|
||||||
return baseMapper.selectOne(lambdaQueryWrapper);
|
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,11 @@
|
|||||||
|
package com.xiang.app.modules.jntyzx.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserRestrictionInfo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface JntyzxUserRestrictionInfoMapper extends BaseMapper<UserRestrictionInfo> {
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.xiang.app.modules.jntyzx.entity.pojo.VenueInfoDO;
|
|||||||
import com.xiang.app.modules.jntyzx.entity.resp.JntyzxResponse;
|
import com.xiang.app.modules.jntyzx.entity.resp.JntyzxResponse;
|
||||||
import com.xiang.app.modules.jntyzx.entity.resp.OrderCreateResp;
|
import com.xiang.app.modules.jntyzx.entity.resp.OrderCreateResp;
|
||||||
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.resp.query.UserInfoResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -40,4 +41,20 @@ public interface IJntyzxHttpService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
JntyzxResponse healthDeclaration(String token, String openId);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
package com.xiang.app.modules.jntyzx.service;
|
package com.xiang.app.modules.jntyzx.service;
|
||||||
|
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserAddReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserQueryReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UsernameReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.resp.JtUserVo;
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,8 +17,19 @@ import java.util.List;
|
|||||||
public interface IUserTokenInfoService {
|
public interface IUserTokenInfoService {
|
||||||
|
|
||||||
List<UserTokenInfoDO> getAvailableUser();
|
List<UserTokenInfoDO> getAvailableUser();
|
||||||
|
List<UserTokenInfoDO> getCanOrderUser();
|
||||||
String getToken(String name);
|
String getToken(String name);
|
||||||
boolean flushSingleToken(String name);
|
boolean flushSingleToken(String name);
|
||||||
boolean flushToken();
|
boolean flushToken();
|
||||||
boolean updateTokenByName(String name, String token);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,24 +5,20 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import com.alibaba.fastjson2.TypeReference;
|
import com.alibaba.fastjson2.TypeReference;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.xiang.app.modules.jntyzx.constants.RedisKeyConstant;
|
|
||||||
import com.xiang.app.modules.jntyzx.constants.UrlConstant;
|
import com.xiang.app.modules.jntyzx.constants.UrlConstant;
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.OrderInfoDO;
|
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.VenueInfoDO;
|
import com.xiang.app.modules.jntyzx.entity.pojo.VenueInfoDO;
|
||||||
import com.xiang.app.modules.jntyzx.entity.req.SubscribeRequest;
|
import com.xiang.app.modules.jntyzx.entity.req.SubscribeRequest;
|
||||||
import com.xiang.app.modules.jntyzx.entity.req.SubscribeVo;
|
import com.xiang.app.modules.jntyzx.entity.req.SubscribeVo;
|
||||||
import com.xiang.app.modules.jntyzx.entity.resp.JntyzxResponse;
|
import com.xiang.app.modules.jntyzx.entity.resp.JntyzxResponse;
|
||||||
import com.xiang.app.modules.jntyzx.entity.resp.OrderCreateResp;
|
import com.xiang.app.modules.jntyzx.entity.resp.OrderCreateResp;
|
||||||
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.resp.query.UserInfoResponse;
|
||||||
import com.xiang.app.modules.jntyzx.entity.resp.query.VenueList;
|
import com.xiang.app.modules.jntyzx.entity.resp.query.VenueList;
|
||||||
import com.xiang.app.modules.jntyzx.manage.IOrderCreateInfoManage;
|
import com.xiang.app.modules.jntyzx.manage.IOrderCreateInfoManage;
|
||||||
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
||||||
import com.xiang.app.modules.jntyzx.utils.JntyzxSaltEncodeUtils;
|
import com.xiang.app.modules.jntyzx.utils.JntyzxSaltEncodeUtils;
|
||||||
import com.xiang.xmc.service.cache.service.IRedisService;
|
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||||
import com.xiang.xmc.service.http.helper.BaseHttpHelp;
|
|
||||||
import com.xiang.xmc.service.http.helper.HttpHelper;
|
import com.xiang.xmc.service.http.helper.HttpHelper;
|
||||||
import com.xiang.xmc.service.http.helper.HttpHelperFactory;
|
|
||||||
import com.xiang.xservice.basic.utils.Base64;
|
|
||||||
import com.xiang.xservice.basic.utils.JsonUtils;
|
import com.xiang.xservice.basic.utils.JsonUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -31,9 +27,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -153,14 +146,15 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
|||||||
Map<String, String> params = Maps.newHashMap();
|
Map<String, String> params = Maps.newHashMap();
|
||||||
params.put("X-Access-Token", token);
|
params.put("X-Access-Token", token);
|
||||||
String resp = HttpHelper.doPost(UrlConstant.ADD_SUBSCRIBE, params, JsonUtils.toJsonString(subscribeRequest));
|
String resp = HttpHelper.doPost(UrlConstant.ADD_SUBSCRIBE, params, JsonUtils.toJsonString(subscribeRequest));
|
||||||
|
log.info("[江体小程序] 羽毛球场地下单响应结果:{}", resp);
|
||||||
if (StringUtils.isBlank(resp)) {
|
if (StringUtils.isBlank(resp)) {
|
||||||
log.info("请求结果为空");
|
log.info("[resp] 请求结果为空");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
JntyzxResponse<OrderCreateResp> response = JSON.parseObject(resp, new TypeReference<JntyzxResponse<OrderCreateResp>>() {
|
JntyzxResponse<OrderCreateResp> response = JSON.parseObject(resp, new TypeReference<JntyzxResponse<OrderCreateResp>>() {
|
||||||
});
|
});
|
||||||
if (Objects.isNull(response)) {
|
if (Objects.isNull(response)) {
|
||||||
log.info("请求结果为空");
|
log.info("[res ==> response] 请求结果为空");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
@@ -179,6 +173,37 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
|||||||
return JSON.parseObject(respStr, JntyzxResponse.class);
|
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) {
|
private static JSONObject buildParamJsonObj(String openId) {
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("id", "1702581215097257986");
|
jsonObject.put("id", "1702581215097257986");
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.xiang.app.modules.jntyzx.manage.IOrderCreateInfoManage;
|
|||||||
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
||||||
import com.xiang.app.modules.jntyzx.service.IJtOrderService;
|
import com.xiang.app.modules.jntyzx.service.IJtOrderService;
|
||||||
import com.xiang.xmc.service.cache.service.IRedisService;
|
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||||
|
import com.xiang.xservice.basic.exception.BusinessException;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -49,6 +50,12 @@ public class OrderInfoServiceImpl implements IJtOrderService {
|
|||||||
return true;
|
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());
|
JntyzxResponse<OrderCreateResp> orderResp = jntyzxHttpService.createOrder(venueInfoDOS, userTokenInfoDO.getToken(), userTokenInfoDO.getOpenId());
|
||||||
if (Objects.isNull(orderResp)) {
|
if (Objects.isNull(orderResp)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -74,10 +81,17 @@ public class OrderInfoServiceImpl implements IJtOrderService {
|
|||||||
} else {
|
} else {
|
||||||
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
||||||
if (orderResp.getMessage().contains("锁卡")) {
|
if (orderResp.getMessage().contains("锁卡")) {
|
||||||
return true;
|
log.info("有锁卡风险,不在请求,用户:{}", userTokenInfoDO.getName());
|
||||||
|
throw new BusinessException("即将锁卡,不再请求");
|
||||||
}
|
}
|
||||||
if (orderResp.getMessage().contains("限制")) {
|
if (orderResp.getMessage().contains("限制")) {
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,34 @@
|
|||||||
package com.xiang.app.modules.jntyzx.service.impl;
|
package com.xiang.app.modules.jntyzx.service.impl;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.xiang.app.common.service.dingtalk.JtDingTalkFactory;
|
import com.xiang.app.common.service.dingtalk.JtDingTalkFactory;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserAddReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserQueryReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.resp.JtUserVo;
|
||||||
|
import com.xiang.app.modules.jntyzx.converts.UserConverter;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserRestrictionInfo;
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
||||||
import com.xiang.app.modules.jntyzx.entity.resp.JntyzxResponse;
|
import com.xiang.app.modules.jntyzx.entity.resp.JntyzxResponse;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.resp.query.UserInfoResponse;
|
||||||
|
import com.xiang.app.modules.jntyzx.manage.IUserRestrictionManage;
|
||||||
import com.xiang.app.modules.jntyzx.manage.IUserTokenInfoManage;
|
import com.xiang.app.modules.jntyzx.manage.IUserTokenInfoManage;
|
||||||
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
||||||
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
||||||
|
import com.xiang.xservice.basic.exception.BusinessException;
|
||||||
|
import com.xiang.xservice.basic.utils.DateUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: xiang
|
* @Author: xiang
|
||||||
@@ -27,6 +42,8 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
|||||||
private final IUserTokenInfoManage userTokenInfoManage;
|
private final IUserTokenInfoManage userTokenInfoManage;
|
||||||
private final IJntyzxHttpService jntyzxHttpService;
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
private final JtDingTalkFactory jtDingTalkFactory;
|
private final JtDingTalkFactory jtDingTalkFactory;
|
||||||
|
private final IUserRestrictionManage userRestrictionManage;
|
||||||
|
private final UserConverter userConverter;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -43,6 +60,11 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
|||||||
return userTokenInfoDO.getToken();
|
return userTokenInfoDO.getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> getCanOrderUser() {
|
||||||
|
return userTokenInfoManage.listCanOrder();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean flushSingleToken(String name) {
|
public boolean flushSingleToken(String name) {
|
||||||
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
||||||
@@ -61,7 +83,10 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
|||||||
log.info("【心跳监测】查询用户信息为空,无需操作");
|
log.info("【心跳监测】查询用户信息为空,无需操作");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
userTokenInfoDOS.parallelStream().forEach(this::healthDeclaration);
|
userTokenInfoDOS.forEach(this::healthDeclaration);
|
||||||
|
// 信息更新
|
||||||
|
userTokenInfoDOS = userTokenInfoManage.list();
|
||||||
|
userTokenInfoDOS.forEach(this::queryMemberCardInfo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,4 +119,133 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
|||||||
}
|
}
|
||||||
return flag;
|
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,42 @@
|
|||||||
|
package com.xiang.app.modules.jntyzx.utils;
|
||||||
|
|
||||||
|
import com.xiang.app.common.service.dingtalk.JtDingTalkFactory;
|
||||||
|
import com.xiang.app.modules.jntyzx.constants.RedisKeyConstant;
|
||||||
|
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||||
|
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 IRedisService redisService;
|
||||||
|
private final JtDingTalkFactory 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,4 +25,17 @@ public class VenueInfoUtils {
|
|||||||
public static boolean get8210VenueInfo(SitePositionList sitePositionList) {
|
public static boolean get8210VenueInfo(SitePositionList sitePositionList) {
|
||||||
return StringUtils.equals(sitePositionList.getSjName(), "20:00-21:00") || StringUtils.equals(sitePositionList.getSjName(), "21:00-22:00");
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.springframework.context.annotation.ComponentScan;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@ConfigurationPropertiesScan(basePackages = {
|
@ConfigurationPropertiesScan(basePackages = {
|
||||||
"com.xiang.xservice.logger",
|
"com.xiang.xservice.logger",
|
||||||
|
"com.xiang.xmc.service.http"
|
||||||
})
|
})
|
||||||
@MapperScan(basePackages = {
|
@MapperScan(basePackages = {
|
||||||
"com.xiang.app.modules.*.mapper"
|
"com.xiang.app.modules.*.mapper"
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.xiang.app.debugger;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-02-25 10:23
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class OrderTest {
|
||||||
|
private static final UserTest userA = new UserTest(1L, "123");
|
||||||
|
private static final UserTest userB = new UserTest(2L, "234");
|
||||||
|
private static final UserTest userC = new UserTest(3L, "345");
|
||||||
|
private static final List<UserTest> users = Lists.newArrayList(userA, userB, userC);
|
||||||
|
|
||||||
|
private static final VenueInfoTest v1 = new VenueInfoTest(1L, "一号场地");
|
||||||
|
private static final VenueInfoTest v2 = new VenueInfoTest(2L, "二号场地");
|
||||||
|
private static final VenueInfoTest v3 = new VenueInfoTest(3L, "三号场地");
|
||||||
|
private static final Map<String, VenueInfoTest> venueInfoMap = Maps.newHashMap();
|
||||||
|
static {
|
||||||
|
venueInfoMap.put(v1.getPlaceName(), v1);
|
||||||
|
venueInfoMap.put(v2.getPlaceName(), v2);
|
||||||
|
venueInfoMap.put(v3.getPlaceName(), v3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
OrderTest orderTest = new OrderTest();
|
||||||
|
orderTest.test();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test() {
|
||||||
|
users.parallelStream().forEach(user -> {
|
||||||
|
try {
|
||||||
|
for (String placeName : venueInfoMap.keySet()) {
|
||||||
|
VenueInfoTest venueInfoTest = venueInfoMap.get(placeName);
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
boolean order = createOrder(venueInfoTest, user);
|
||||||
|
if (order) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
log.info("睡眠中 1.25s");
|
||||||
|
Thread.sleep(1250);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error("睡眠失败~~~");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 关键点:异常只影响当前 user
|
||||||
|
log.error("createOrder 异常,user={}", user.getId(), e);
|
||||||
|
return; // 结束这个 user,不影响其他 user
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean createOrder(VenueInfoTest venueInfoTest, UserTest userTest) {
|
||||||
|
log.info("用户:{}======>请求三方接口中", userTest.getUsername());
|
||||||
|
String order = order(venueInfoTest, userTest);
|
||||||
|
log.info("用户:{}======>请求结果::{}", userTest.getUsername(), order);
|
||||||
|
if (order.contains("成功")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (order.contains("锁卡")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String order(VenueInfoTest venueInfoTest, UserTest userTest) {
|
||||||
|
String msg = "~~~";
|
||||||
|
if (venueInfoTest.getId() == 1L && userTest.getId() == 2L) {
|
||||||
|
msg = "用户" + userTest.getUsername() + "预定成功!";
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
if (userTest.getId() == 1L) {
|
||||||
|
msg = "用户" + userTest.getUsername() + "频繁请求接口,将锁卡";
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
if (venueInfoTest.getId() == 2L) {
|
||||||
|
msg = "场地" + venueInfoTest.getPlaceName() + "已被预订";
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.xiang.app.debugger;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-02-25 10:24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class UserTest {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String username;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xiang.app.debugger;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-02-25 10:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VenueInfoTest {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.xiang.app.schedule.jntyzx;
|
||||||
|
|
||||||
|
import com.xiang.app.modules.jntyzx.constants.RedisKeyConstant;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
||||||
|
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
||||||
|
import com.xiang.app.modules.jntyzx.service.IJtOrderService;
|
||||||
|
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
||||||
|
import com.xiang.app.modules.jntyzx.utils.VenueInfoUtils;
|
||||||
|
import com.xiang.app.modules.jntyzx.utils.WeekendUtils;
|
||||||
|
import com.xiang.core.quartz.annotation.XxzJob;
|
||||||
|
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 江体小程序场地捡漏任务 周日和周二 启动捡漏周一和周三的场地
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-03-23 09:23
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class JtVenuePickTask {
|
||||||
|
|
||||||
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
|
private final IUserTokenInfoService userTokenInfoService;
|
||||||
|
private final IRedisService redisService;
|
||||||
|
private final IJtOrderService jtOrderService;
|
||||||
|
|
||||||
|
|
||||||
|
@XxzJob(name = "jtVenuePickTask")
|
||||||
|
@GetMapping("jtVenuePickTask")
|
||||||
|
public void handler() {
|
||||||
|
log.info("江体小程序场地捡漏,time:{}", System.currentTimeMillis());
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> availableUser = userTokenInfoService.getAvailableUser();
|
||||||
|
if (CollectionUtils.isEmpty(availableUser)) {
|
||||||
|
log.info("当前无可用用户查询场地信息!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UserTokenInfoDO userTokenInfoDO = availableUser.get(0);
|
||||||
|
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String subscribeKey = RedisKeyConstant.JNTYZX_ORDER_CREATE_KEY + userTokenInfoDO.getName() + LocalDate.now();
|
||||||
|
String subscribeValue = (String) redisService.get(subscribeKey);
|
||||||
|
if (StringUtils.isNotBlank(subscribeValue)) {
|
||||||
|
log.info("用户:{}今日已进行场地预定,不进行捡漏处理!", userTokenInfoDO.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String token = userTokenInfoDO.getToken();
|
||||||
|
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow(WeekendUtils.isWeekend(), token);
|
||||||
|
sitePositionLists = sitePositionLists.stream()
|
||||||
|
.filter(item -> !item.getPlaceName().contains("小馆"))
|
||||||
|
.filter(VenueInfoUtils::get8210VenueInfo)
|
||||||
|
.filter(item -> StringUtils.equals(item.getContacts(), "0")).toList();
|
||||||
|
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||||
|
log.info("目前没有可以捡漏的场地");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, List<VenueInfoDO>> map = sitePositionLists.stream().map(item -> {
|
||||||
|
VenueInfoDO venueInfoDO = new VenueInfoDO();
|
||||||
|
venueInfoDO.setPlaceName(item.getPlaceName());
|
||||||
|
venueInfoDO.setPlaceId(item.getPlaceId());
|
||||||
|
venueInfoDO.setScheduleId(Integer.valueOf(item.getScheduleId()));
|
||||||
|
venueInfoDO.setSjName(item.getSjName());
|
||||||
|
venueInfoDO.setMoney(item.getMoney());
|
||||||
|
venueInfoDO.setClassName(item.getClassName());
|
||||||
|
venueInfoDO.setClassCode(item.getClassCode());
|
||||||
|
venueInfoDO.setAppointments(item.getAppointments());
|
||||||
|
venueInfoDO.setCTypeCode(item.getCtypeCode());
|
||||||
|
return venueInfoDO;
|
||||||
|
}).collect(Collectors.groupingByConcurrent(VenueInfoDO::getPlaceName));
|
||||||
|
|
||||||
|
if (MapUtils.isEmpty(map)) {
|
||||||
|
log.info("暂无可下单场地,time:{}", System.currentTimeMillis());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> users = userTokenInfoService.getCanOrderUser();
|
||||||
|
if (CollectionUtils.isEmpty(users)) {
|
||||||
|
log.info("暂无可下单用户, time:{}", System.currentTimeMillis());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
users.parallelStream().forEach(user -> {
|
||||||
|
try {
|
||||||
|
List<String> placeNameList = map.keySet().stream().sorted(Comparator.comparing(VenueInfoUtils::sortVenueInfo)).toList();
|
||||||
|
for (String placeName : placeNameList) {
|
||||||
|
List<VenueInfoDO> venueInfoDOList = map.get(placeName);
|
||||||
|
String valid = (String) redisService.get(RedisKeyConstant.getVenueSubscribeKey(placeName));
|
||||||
|
if (StringUtils.isNotBlank(valid)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
boolean order = jtOrderService.createOrder(venueInfoDOList, user);
|
||||||
|
if (order) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(1250);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error("睡眠失败~~~");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 关键点:异常只影响当前 user
|
||||||
|
log.error("createOrder 异常,user={}", user.getId(), e);
|
||||||
|
return; // 结束这个 user,不影响其他 user
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.xiang.app.schedule.jntyzx;
|
package com.xiang.app.schedule.jntyzx;
|
||||||
|
|
||||||
import com.xiang.app.common.service.dingtalk.JtDingTalkFactory;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.xiang.app.modules.jntyzx.constants.RedisKeyConstant;
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
||||||
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
||||||
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
||||||
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
||||||
import com.xiang.app.modules.jntyzx.service.IVenueService;
|
import com.xiang.app.modules.jntyzx.service.IVenueService;
|
||||||
|
import com.xiang.app.modules.jntyzx.utils.MsgSendUtils;
|
||||||
import com.xiang.app.modules.jntyzx.utils.VenueInfoUtils;
|
import com.xiang.app.modules.jntyzx.utils.VenueInfoUtils;
|
||||||
import com.xiang.app.modules.jntyzx.utils.WeekendUtils;
|
import com.xiang.app.modules.jntyzx.utils.WeekendUtils;
|
||||||
import com.xiang.core.quartz.annotation.XxzJob;
|
import com.xiang.core.quartz.annotation.XxzJob;
|
||||||
@@ -21,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,8 +37,8 @@ public class JtVenuePullTask {
|
|||||||
|
|
||||||
private final IUserTokenInfoService userTokenInfoService;
|
private final IUserTokenInfoService userTokenInfoService;
|
||||||
private final IJntyzxHttpService jntyzxHttpService;
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
private final JtDingTalkFactory jtDingTalkFactory;
|
|
||||||
private final IVenueService venueService;
|
private final IVenueService venueService;
|
||||||
|
private final MsgSendUtils msgSendUtils;
|
||||||
|
|
||||||
@XxzJob(name = "jtVenueInfoPullTask")
|
@XxzJob(name = "jtVenueInfoPullTask")
|
||||||
@GetMapping("/jtVenueInfoPullTask")
|
@GetMapping("/jtVenueInfoPullTask")
|
||||||
@@ -69,11 +72,15 @@ public class JtVenuePullTask {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuffer msg = new StringBuffer("查询到20:00-22:00空闲场地信息===>\n时间:" + DateUtils.getDateFromDate(LocalDate.now()));
|
StringBuffer msg = new StringBuffer(
|
||||||
|
"查询到20:00-22:00空闲场地信息=====>\n时间:" + DateUtils.getDateFromDate(LocalDate.now()) + "\n");
|
||||||
sitePositionLists.forEach(item -> {
|
sitePositionLists.forEach(item -> {
|
||||||
msg.append(item.getPlaceName()).append("\n");
|
msg.append(item.getPlaceName()).append("\n");
|
||||||
});
|
});
|
||||||
jtDingTalkFactory.sendMsg(msg.toString());
|
|
||||||
|
String key = RedisKeyConstant.JNTYZX_VENUE_MSG_SEND_KEY + RedisKeyConstant.getDate();
|
||||||
|
msgSendUtils.sendMsgRestrict1Hours(key, msg.toString());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +95,12 @@ public class JtVenuePullTask {
|
|||||||
.filter(item -> !item.getPlaceName().contains("小馆"))
|
.filter(item -> !item.getPlaceName().contains("小馆"))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
return sitePositionLists;
|
Map<String, SitePositionList> mapByName = Maps.newLinkedHashMap();
|
||||||
|
for (SitePositionList sitePositionList : sitePositionLists) {
|
||||||
|
if (!mapByName.containsKey(sitePositionList.getPlaceName())) {
|
||||||
|
mapByName.put(sitePositionList.getPlaceName(), sitePositionList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mapByName.values().stream().toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.xiang.app.schedule.jntyzx;
|
package com.xiang.app.schedule.jntyzx;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.xiang.app.common.service.dingtalk.JtDingTalkFactory;
|
||||||
|
import com.xiang.app.modules.jntyzx.constants.RedisKeyConstant;
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.VenueInfoDO;
|
import com.xiang.app.modules.jntyzx.entity.pojo.VenueInfoDO;
|
||||||
import com.xiang.app.modules.jntyzx.service.IJtOrderService;
|
import com.xiang.app.modules.jntyzx.service.IJtOrderService;
|
||||||
@@ -7,12 +10,17 @@ import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
|||||||
import com.xiang.app.modules.jntyzx.service.IVenueService;
|
import com.xiang.app.modules.jntyzx.service.IVenueService;
|
||||||
import com.xiang.app.modules.jntyzx.utils.VenueInfoUtils;
|
import com.xiang.app.modules.jntyzx.utils.VenueInfoUtils;
|
||||||
import com.xiang.core.quartz.annotation.XxzJob;
|
import com.xiang.core.quartz.annotation.XxzJob;
|
||||||
|
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -26,30 +34,54 @@ public class JtVenueSubscribeTask {
|
|||||||
private final IUserTokenInfoService userTokenInfoService;
|
private final IUserTokenInfoService userTokenInfoService;
|
||||||
private final IJtOrderService jtOrderService;
|
private final IJtOrderService jtOrderService;
|
||||||
private final IVenueService venueService;
|
private final IVenueService venueService;
|
||||||
|
private final JtDingTalkFactory jtDingTalkFactory;
|
||||||
|
private final IRedisService redisService;
|
||||||
|
|
||||||
@XxzJob(name = "jtVenueSubscribeTask")
|
@XxzJob(name = "jtVenueSubscribeTask")
|
||||||
@GetMapping("/jtVenueSubscribeTask")
|
@GetMapping("/jtVenueSubscribeTask")
|
||||||
public void handle() {
|
public void handle() {
|
||||||
log.info("【Subscribe】 江体场地预定定时任务启动!!! time:{}", System.currentTimeMillis());
|
log.info("【Subscribe】 江体场地预定定时任务启动!!! time:{}", System.currentTimeMillis());
|
||||||
|
|
||||||
List<UserTokenInfoDO> users = userTokenInfoService.getAvailableUser();
|
List<UserTokenInfoDO> users = userTokenInfoService.getCanOrderUser();
|
||||||
|
if (CollectionUtils.isEmpty(users)) {
|
||||||
|
log.info("暂无可下单用户, time:{}", System.currentTimeMillis());
|
||||||
|
jtDingTalkFactory.sendMsg("暂无可下单用户, time:" + System.currentTimeMillis());
|
||||||
|
return;
|
||||||
|
}
|
||||||
List<VenueInfoDO> venueInfoDOS = venueService.queryTomorrowCanBuyVenue();
|
List<VenueInfoDO> venueInfoDOS = venueService.queryTomorrowCanBuyVenue();
|
||||||
|
|
||||||
Map<String, List<VenueInfoDO>> venueInfoMap = venueInfoDOS.stream().filter(VenueInfoUtils::get8210VenueInfo).collect(Collectors.groupingByConcurrent(VenueInfoDO::getPlaceName));
|
Map<String, List<VenueInfoDO>> venueInfoMap = venueInfoDOS.stream().filter(VenueInfoUtils::get8210VenueInfo).collect(Collectors.groupingByConcurrent(VenueInfoDO::getPlaceName));
|
||||||
|
if (MapUtils.isEmpty(venueInfoMap)) {
|
||||||
|
log.info("暂无可下单场地,time:{}", System.currentTimeMillis());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
venueInfoMap.keySet().parallelStream().forEach(placeName -> {
|
users.parallelStream().forEach(user -> {
|
||||||
List<VenueInfoDO> venueInfoDOList = venueInfoMap.get(placeName);
|
try {
|
||||||
users.forEach(user -> {
|
List<String> placeNameList = venueInfoMap.keySet().stream().sorted(Comparator.comparing(VenueInfoUtils::sortVenueInfo)).toList();
|
||||||
for (int i = 0; i < 10; i++) {
|
log.info("场地排序后的集合:{}", JSON.toJSONString(placeNameList));
|
||||||
boolean order = jtOrderService.createOrder(venueInfoDOList, user);
|
for (String placeName : placeNameList) {
|
||||||
if (order) {
|
List<VenueInfoDO> venueInfoDOList = venueInfoMap.get(placeName);
|
||||||
return;
|
for (int i = 0; i < 10; i++) {
|
||||||
|
String valid = (String) redisService.get(RedisKeyConstant.getVenueSubscribeKey(placeName));
|
||||||
|
if (StringUtils.isNotBlank(valid)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
boolean order = jtOrderService.createOrder(venueInfoDOList, user);
|
||||||
|
if (order) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(1250);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error("睡眠失败~~~");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
} catch (Exception e) {
|
||||||
|
// 关键点:异常只影响当前 user
|
||||||
|
log.error("createOrder 异常,user={}", user.getId(), e);
|
||||||
|
return; // 结束这个 user,不影响其他 user
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package com.xiang.app.schedule.jntyzx;
|
|||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.xiang.app.common.service.dingtalk.JtDingTalkFactory;
|
import com.xiang.app.common.service.dingtalk.JtDingTalkFactory;
|
||||||
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.app.modules.jntyzx.entity.resp.JntyzxResponse;
|
||||||
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
||||||
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
||||||
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
||||||
@@ -15,7 +16,6 @@ import com.xiang.xservice.basic.utils.DateUtils;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -44,37 +44,44 @@ public class JtVenueTomorrowPullTask {
|
|||||||
log.info("当前无可用用户查询场地信息!");
|
log.info("当前无可用用户查询场地信息!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String token;
|
// 用户信息
|
||||||
for (UserTokenInfoDO userTokenInfoDO : availableUser) {
|
StringBuffer userMsg = new StringBuffer();
|
||||||
if (Objects.isNull(userTokenInfoDO)) {
|
availableUser.forEach(item -> {
|
||||||
continue;
|
JntyzxResponse jntyzxResponse = jntyzxHttpService.checkDefaultNums(item.getToken(), item.getMemberCardNo());
|
||||||
}
|
if (Objects.nonNull(jntyzxResponse)) {
|
||||||
token = userTokenInfoDO.getToken();
|
if (jntyzxResponse.getSuccess()) {
|
||||||
if (StringUtils.isBlank(token)) {
|
userMsg.append("订购人:").append(item.getName()).append("正常下单\n");
|
||||||
continue;
|
} else {
|
||||||
}
|
userMsg.append("订购人:").append(item.getName()).append(jntyzxResponse.getMessage()).append("\n");
|
||||||
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow(WeekendUtils.isWeekend(), token);
|
|
||||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
venueService.saveTomorrowVenueInfo(sitePositionLists);
|
|
||||||
|
|
||||||
sitePositionLists = sitePositionLists.stream().filter(VenueInfoUtils::get8210VenueInfo).toList();
|
|
||||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Map<String, SitePositionList> map = Maps.newLinkedHashMap();
|
|
||||||
for (SitePositionList sitePositionList : sitePositionLists) {
|
|
||||||
if (map.containsKey(sitePositionList.getPlaceName())) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
map.put(sitePositionList.getPlaceName(), sitePositionList);
|
|
||||||
}
|
}
|
||||||
StringBuffer msg = new StringBuffer("查询江体场地信息===>时间:\n" + DateUtils.getDateFromDate(LocalDate.now().plusDays(1)) + " 20:00-22:00\n");
|
});
|
||||||
map.forEach((placeName, sitePositionList) -> {
|
jtDingTalkFactory.sendMsg(userMsg.toString());
|
||||||
msg.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
|
|
||||||
});
|
// 场地信息
|
||||||
jtDingTalkFactory.sendMsg(msg.toString());
|
UserTokenInfoDO userTokenInfoDO = availableUser.get(0);
|
||||||
|
String token = userTokenInfoDO.getToken();
|
||||||
|
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow(WeekendUtils.isWeekend(), token);
|
||||||
|
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
venueService.saveTomorrowVenueInfo(sitePositionLists);
|
||||||
|
sitePositionLists = sitePositionLists.stream().filter(VenueInfoUtils::get8210VenueInfo).toList();
|
||||||
|
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, SitePositionList> map = Maps.newLinkedHashMap();
|
||||||
|
for (SitePositionList sitePositionList : sitePositionLists) {
|
||||||
|
if (map.containsKey(sitePositionList.getPlaceName())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
map.put(sitePositionList.getPlaceName(), sitePositionList);
|
||||||
|
}
|
||||||
|
StringBuffer msg = new StringBuffer("查询江体场地信息=====>\n时间:" + DateUtils.getDateFromDate(LocalDate.now().plusDays(1)) + " 20:00-22:00\n");
|
||||||
|
map.forEach((placeName, sitePositionList) -> {
|
||||||
|
msg.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
|
||||||
|
});
|
||||||
|
jtDingTalkFactory.sendMsg(msg.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.xiang.app.server.jntyzx;
|
||||||
|
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserAddReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserQueryReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserStatusUpdateReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UserTokenUpdateReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.req.UsernameReq;
|
||||||
|
import com.xiang.app.module.jntyzx.pojo.resp.JtUserVo;
|
||||||
|
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
||||||
|
import com.xiang.xservice.basic.common.resp.Result;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 江南体育中心用户管理控制器
|
||||||
|
*
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-03-24 16:38
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/private/apps/jntyzx/user")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class UserTokenServer {
|
||||||
|
|
||||||
|
private final IUserTokenInfoService userTokenInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
public Result<List<JtUserVo>> list(@RequestBody @NotNull(message = "请求参数不能为空") @Valid UserQueryReq req) {
|
||||||
|
return Result.data(userTokenInfoService.list(req));
|
||||||
|
}
|
||||||
|
@GetMapping("/info/{id}")
|
||||||
|
public Result<JtUserVo> info(@PathVariable("id") Long userId) {
|
||||||
|
return Result.data(userTokenInfoService.info(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateToken")
|
||||||
|
public Result<Boolean> updateToken(@RequestBody @NotNull(message = "请求参数不能为空") @Valid UserTokenUpdateReq req) {
|
||||||
|
return Result.data(userTokenInfoService.updateTokenByName(req.getUsername(), req.getToken()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateStatus")
|
||||||
|
public Result<Boolean> updateStatus(@RequestBody @NotNull(message = "请求参数不能为空") @Valid UserStatusUpdateReq req) {
|
||||||
|
return Result.data(userTokenInfoService.updateStatusByUserName(req.getUsername(), req.getStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/refreshToken")
|
||||||
|
public Result<Boolean> refreshToken(@RequestBody @NotNull(message = "请求参数不能为空") @Valid UsernameReq req) {
|
||||||
|
return Result.data(userTokenInfoService.refreshToken(req.getUsername()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<Boolean> addUser(@RequestBody @NotNull(message = "请求参数不能为空") @Valid UserAddReq req) {
|
||||||
|
return Result.data(userTokenInfoService.save(req));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user