Compare commits
2 Commits
4f07b22919
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
714bd3ce06 | ||
|
|
a20cdc46fd |
20
api/pom.xml
20
api/pom.xml
@@ -1,20 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
1
pom.xml
1
pom.xml
@@ -17,7 +17,6 @@
|
|||||||
<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>
|
||||||
|
|||||||
@@ -17,11 +17,4 @@
|
|||||||
<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,32 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -54,6 +54,4 @@ public class UserTokenInfoDO {
|
|||||||
*/
|
*/
|
||||||
@TableField("is_restriction")
|
@TableField("is_restriction")
|
||||||
private Integer isRestriction;
|
private Integer isRestriction;
|
||||||
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,7 @@ 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.modules.jntyzx.entity.pojo.UserRestrictionInfo;
|
import com.xiang.app.modules.jntyzx.entity.pojo.UserRestrictionInfo;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface IUserRestrictionManage extends IService<UserRestrictionInfo> {
|
public interface IUserRestrictionManage extends IService<UserRestrictionInfo> {
|
||||||
|
|
||||||
UserRestrictionInfo queryByUserId(Long userId);
|
UserRestrictionInfo queryByUserId(Long userId);
|
||||||
|
|
||||||
List<UserRestrictionInfo> queryByIdList(List<Long> idList);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
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;
|
||||||
@@ -17,5 +15,4 @@ public interface IUserTokenInfoManage extends IService<UserTokenInfoDO> {
|
|||||||
|
|
||||||
List<UserTokenInfoDO> listCanOrder();
|
List<UserTokenInfoDO> listCanOrder();
|
||||||
|
|
||||||
List<UserTokenInfoDO> queryByList(UserQueryReq req);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import com.xiang.app.modules.jntyzx.entity.pojo.UserRestrictionInfo;
|
|||||||
import com.xiang.app.modules.jntyzx.mapper.JntyzxUserRestrictionInfoMapper;
|
import com.xiang.app.modules.jntyzx.mapper.JntyzxUserRestrictionInfoMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserRestrictionManageImpl extends ServiceImpl<JntyzxUserRestrictionInfoMapper, UserRestrictionInfo> implements IUserRestrictionManage {
|
public class UserRestrictionManageImpl extends ServiceImpl<JntyzxUserRestrictionInfoMapper, UserRestrictionInfo> implements IUserRestrictionManage {
|
||||||
@Override
|
@Override
|
||||||
@@ -17,11 +15,4 @@ public class UserRestrictionManageImpl extends ServiceImpl<JntyzxUserRestriction
|
|||||||
lambdaQueryWrapper.eq(UserRestrictionInfo::getUserId, userId);
|
lambdaQueryWrapper.eq(UserRestrictionInfo::getUserId, userId);
|
||||||
return baseMapper.selectOne(lambdaQueryWrapper);
|
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,16 +1,13 @@
|
|||||||
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
|
||||||
@@ -30,7 +27,6 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,28 +38,4 @@ public class UserTokenInfoManageImpl extends ServiceImpl<JntyzxUserTokenInfoMapp
|
|||||||
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsRestriction, 0);
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsRestriction, 0);
|
||||||
return baseMapper.selectList(lambdaQueryWrapper);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,14 +16,4 @@ public interface IUserTokenInfoService {
|
|||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
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.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;
|
||||||
@@ -15,7 +9,6 @@ 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 com.xiang.xservice.basic.utils.DateUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -23,12 +16,8 @@ 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
|
||||||
@@ -43,7 +32,6 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
|||||||
private final IJntyzxHttpService jntyzxHttpService;
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
private final JtDingTalkFactory jtDingTalkFactory;
|
private final JtDingTalkFactory jtDingTalkFactory;
|
||||||
private final IUserRestrictionManage userRestrictionManage;
|
private final IUserRestrictionManage userRestrictionManage;
|
||||||
private final UserConverter userConverter;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -120,97 +108,6 @@ 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户信息
|
* 查询用户信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.xiang.app;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
public class HealthController {
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String env;
|
||||||
|
|
||||||
|
@GetMapping("/actuator/health")
|
||||||
|
public Map<String, String> checkHealth() {
|
||||||
|
Map<String, String> map = Maps.newHashMap();
|
||||||
|
map.put("env", env);
|
||||||
|
map.put("status", "UP");
|
||||||
|
log.info("cornucopia application health check success! listening in env:{}, now:{}", env, System.currentTimeMillis());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
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.common.service.dingtalk.JtDingTalkFactory;
|
||||||
import com.xiang.app.modules.jntyzx.constants.RedisKeyConstant;
|
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;
|
||||||
@@ -49,7 +48,10 @@ public class JtVenueSubscribeTask {
|
|||||||
return;
|
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)
|
||||||
|
.filter(item -> !StringUtils.contains(item.getPlaceName(), "小馆"))
|
||||||
|
.collect(Collectors.groupingByConcurrent(VenueInfoDO::getPlaceName));
|
||||||
if (MapUtils.isEmpty(venueInfoMap)) {
|
if (MapUtils.isEmpty(venueInfoMap)) {
|
||||||
log.info("暂无可下单场地,time:{}", System.currentTimeMillis());
|
log.info("暂无可下单场地,time:{}", System.currentTimeMillis());
|
||||||
return;
|
return;
|
||||||
@@ -58,7 +60,6 @@ public class JtVenueSubscribeTask {
|
|||||||
users.parallelStream().forEach(user -> {
|
users.parallelStream().forEach(user -> {
|
||||||
try {
|
try {
|
||||||
List<String> placeNameList = venueInfoMap.keySet().stream().sorted(Comparator.comparing(VenueInfoUtils::sortVenueInfo)).toList();
|
List<String> placeNameList = venueInfoMap.keySet().stream().sorted(Comparator.comparing(VenueInfoUtils::sortVenueInfo)).toList();
|
||||||
log.info("场地排序后的集合:{}", JSON.toJSONString(placeNameList));
|
|
||||||
for (String placeName : placeNameList) {
|
for (String placeName : placeNameList) {
|
||||||
List<VenueInfoDO> venueInfoDOList = venueInfoMap.get(placeName);
|
List<VenueInfoDO> venueInfoDOList = venueInfoMap.get(placeName);
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,10 @@ spring:
|
|||||||
discovery:
|
discovery:
|
||||||
group: DEFAULT_GROUP
|
group: DEFAULT_GROUP
|
||||||
namespace: 00131110-3ecb-4a35-8bbb-624edde1d937
|
namespace: 00131110-3ecb-4a35-8bbb-624edde1d937
|
||||||
server-addr: general.xiangtech.xyz:8848
|
server-addr: http://192.168.1.10:8848
|
||||||
|
|
||||||
|
# 是否启用健康检查
|
||||||
|
register-enabled: true
|
||||||
username: nacos
|
username: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
datasource:
|
datasource:
|
||||||
47
xservice-server/src/main/resources/application-outside.yml
Normal file
47
xservice-server/src/main/resources/application-outside.yml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
namespace: 00131110-3ecb-4a35-8bbb-624edde1d937
|
||||||
|
server-addr: http://general.xiangtech.xyz:8848
|
||||||
|
# 是否启用健康检查
|
||||||
|
register-enabled: false
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
datasource:
|
||||||
|
dynamic:
|
||||||
|
primary: master
|
||||||
|
datasource:
|
||||||
|
master:
|
||||||
|
url: jdbc:mysql://120.27.153.87:3306/xservice_cornucopia?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||||
|
username: cornucopia
|
||||||
|
password: cornucopia@123
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
sshConnect: false
|
||||||
|
redis:
|
||||||
|
host: r-bp1wt59a6nfyt4e3ltpd.redis.rds.aliyuncs.com
|
||||||
|
port: 6379
|
||||||
|
password: Xiang0000 # 如果无密码可以省略
|
||||||
|
database: 10
|
||||||
|
timeout: 5000
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8
|
||||||
|
max-idle: 8
|
||||||
|
min-idle: 0
|
||||||
|
max-wait: 1000
|
||||||
|
xxz-job:
|
||||||
|
app-name: xservice-cornucopia
|
||||||
|
admin-address: http://192.168.1.10:10001
|
||||||
|
namespace: 1
|
||||||
|
|
||||||
|
dingtalk:
|
||||||
|
robot:
|
||||||
|
properties:
|
||||||
|
venue:
|
||||||
|
name: 江南体育中心通知群
|
||||||
|
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
|
||||||
|
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
|
||||||
|
users:
|
||||||
|
- 450841600726084717
|
||||||
@@ -4,7 +4,9 @@ spring:
|
|||||||
discovery:
|
discovery:
|
||||||
group: DEFAULT_GROUP
|
group: DEFAULT_GROUP
|
||||||
namespace: 6f603892-e9f7-4ca4-acbc-538fa09ebec0
|
namespace: 6f603892-e9f7-4ca4-acbc-538fa09ebec0
|
||||||
server-addr: general.xiangtech.xyz:8848
|
server-addr: http://192.168.32.3:8848
|
||||||
|
# 是否启用健康检查
|
||||||
|
register-enabled: true
|
||||||
username: nacos
|
username: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
datasource:
|
datasource:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: test
|
active: local
|
||||||
application:
|
application:
|
||||||
name: xservice-cornucopia
|
name: xservice-cornucopia
|
||||||
main:
|
main:
|
||||||
|
|||||||
Reference in New Issue
Block a user