1.添加AI聊天工具登录接口
2.删除 xmlsql 无用判断 3.修改 dev配置文件开启 swagger
This commit is contained in:
@@ -45,7 +45,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
// 你的其他放行路径,例如登录接口
|
||||
"/user/doLogin",
|
||||
"/tenant/get-id-by-name",
|
||||
"/user/bigbrother-doLogin"
|
||||
"/user/bigbrother-doLogin",
|
||||
"/user/aiChat-doLogin"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,38 @@ public class UserController {
|
||||
BeanUtil.copyProperties(user, systemUsersVO);
|
||||
// 赋予用户 Id
|
||||
StpUtil.login(user.getId(),"bigbrother");
|
||||
// 设置 token 有效期为当前日期和套餐有效期的差值
|
||||
StpUtil.renewTimeout(second);
|
||||
systemUsersVO.setTokenName(StpUtil.getTokenName());
|
||||
systemUsersVO.setTokenValue(StpUtil.getTokenValue());
|
||||
return ResultUtils.success(systemUsersVO);
|
||||
}
|
||||
|
||||
// 用户登陆接口
|
||||
@PostMapping("aiChat-doLogin")
|
||||
public BaseResponse<SystemUsersVO> aiChatDoLogin(@RequestBody SystemUsersDTO usersDTO) {
|
||||
SystemUsers user = usersService.getUserByUserName(usersDTO.getUsername(),usersDTO.getTenantId());
|
||||
if (user == null) {
|
||||
throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR);
|
||||
}
|
||||
if (!usersService.isPasswordMatch(usersDTO.getPassword(), user.getPassword())) {
|
||||
throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR);
|
||||
}
|
||||
|
||||
if (CommonStatusEnum.isDisable(Integer.valueOf(user.getStatus()))) {
|
||||
throw new BusinessException(ErrorCode.USER_DISABLE);
|
||||
}
|
||||
if (usersService.isExpired(usersDTO.getTenantId())){
|
||||
throw new BusinessException(ErrorCode.PACKAGE_EXPIRED);
|
||||
}
|
||||
if (!usersService.checkAiCHatLoginRole(user.getId())){
|
||||
throw new BusinessException(ErrorCode.LOGIN_NOW_ALLOWED);
|
||||
}
|
||||
Long second = usersService.getTenantExpiredTime(usersDTO.getTenantId());
|
||||
SystemUsersVO systemUsersVO = new SystemUsersVO();
|
||||
BeanUtil.copyProperties(user, systemUsersVO);
|
||||
// 赋予用户 Id
|
||||
StpUtil.login(user.getId(),"aiChat");
|
||||
// 设置 token 有效期为当前日期和套餐有效期的差值
|
||||
StpUtil.renewTimeout(second);
|
||||
systemUsersVO.setTokenName(StpUtil.getTokenName());
|
||||
|
||||
@@ -174,4 +174,11 @@ public class SystemUsers {
|
||||
@TableField(value = "big_brother")
|
||||
@ApiModelProperty(value = "能否登录大哥爬虫客户端")
|
||||
private Byte bigBrother;
|
||||
|
||||
/**
|
||||
* 能否登录大哥爬虫客户端
|
||||
*/
|
||||
@TableField(value = "ai_chat")
|
||||
@ApiModelProperty(value = "能否登录大哥爬虫客户端")
|
||||
private Byte aiChat;
|
||||
}
|
||||
@@ -23,4 +23,5 @@ public interface SystemUsersService extends IService<SystemUsers> {
|
||||
|
||||
boolean checkbigBrotherlRole(Long userId);
|
||||
|
||||
boolean checkAiCHatLoginRole(Long userId);
|
||||
}
|
||||
|
||||
@@ -76,5 +76,11 @@ public class SystemUsersServiceImpl extends ServiceImpl<SystemUsersMapper,System
|
||||
return systemUsers.getBigBrother() == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAiCHatLoginRole(Long userId) {
|
||||
SystemUsers systemUsers = baseMapper.selectById(userId);
|
||||
return systemUsers.getAiChat() == 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,3 +37,13 @@ spring:
|
||||
simple:
|
||||
acknowledge-mode: manual
|
||||
|
||||
knife4j:
|
||||
enable: true
|
||||
openapi:
|
||||
title: "接口文档"
|
||||
version: 1.0
|
||||
group:
|
||||
default:
|
||||
api-rule: package
|
||||
api-rule-resources:
|
||||
- com.yupi.springbootinit.controller
|
||||
@@ -86,16 +86,7 @@ cos:
|
||||
region: xxx
|
||||
bucket: xxx
|
||||
# 接口文档配置
|
||||
knife4j:
|
||||
enable: false
|
||||
openapi:
|
||||
title: "接口文档"
|
||||
version: 1.0
|
||||
group:
|
||||
default:
|
||||
api-rule: package
|
||||
api-rule-resources:
|
||||
- com.yupi.springbootinit.controller
|
||||
|
||||
|
||||
############## Sa-Token 配置 (文档: https://sa-token.cc) ##############
|
||||
sa-token:
|
||||
|
||||
@@ -261,50 +261,50 @@
|
||||
and ns.hosts_id like concat(#{hostInfoDTO.hostsId,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
<!-- 今日主播金币筛选 -->
|
||||
<if test="hostInfoDTO.hostsCoinsMin != null and hostInfoDTO.hostsCoinsMax == null and hostInfoDTO.hostsCoinsMax != '' ">
|
||||
<if test="hostInfoDTO.hostsCoinsMin != null and hostInfoDTO.hostsCoinsMax == null ">
|
||||
and ns.hosts_coins >=#{hostInfoDTO.hostsCoinsMin,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.hostsCoinsMax != null and hostInfoDTO.hostsCoinsMin == null and hostInfoDTO.hostsCoinsMin !='' ">
|
||||
<if test="hostInfoDTO.hostsCoinsMax != null and hostInfoDTO.hostsCoinsMin == null ">
|
||||
and ns.hosts_coins <=#{hostInfoDTO.hostsCoinsMax,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.hostsCoinsMin != null and hostInfoDTO.hostsCoinsMax != null " >
|
||||
and ns.hosts_coins between #{hostInfoDTO.hostsCoinsMin,jdbcType=INTEGER} and #{hostInfoDTO.hostsCoinsMax,jdbcType=INTEGER}
|
||||
</if>
|
||||
<!-- 昨日主播金币筛选 -->
|
||||
<if test="hostInfoDTO.yesterdayCoinsMin != null and hostInfoDTO.yesterdayCoinsMax == null and hostInfoDTO.yesterdayCoinsMax != ''">
|
||||
<if test="hostInfoDTO.yesterdayCoinsMin != null and hostInfoDTO.yesterdayCoinsMax == null ">
|
||||
and ns.yesterday_coins >=#{hostInfoDTO.yesterdayCoinsMin,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.yesterdayCoinsMax != null and hostInfoDTO.yesterdayCoinsMin == null and hostInfoDTO.yesterdayCoinsMin != '' ">
|
||||
<if test="hostInfoDTO.yesterdayCoinsMax != null and hostInfoDTO.yesterdayCoinsMin == null ">
|
||||
and ns.yesterday_coins <=#{hostInfoDTO.yesterdayCoinsMax,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.yesterdayCoinsMin != null and hostInfoDTO.yesterdayCoinsMax != null " >
|
||||
and ns.yesterday_coins between #{hostInfoDTO.yesterdayCoinsMin,jdbcType=INTEGER} and #{hostInfoDTO.yesterdayCoinsMax,jdbcType=INTEGER}
|
||||
</if>
|
||||
<!-- 主播粉丝数筛选-->
|
||||
<if test="hostInfoDTO.fansMin != null and hostInfoDTO.fansMax == null and hostInfoDTO.fansMax != ''">
|
||||
<if test="hostInfoDTO.fansMin != null and hostInfoDTO.fansMax == null ">
|
||||
and ns.fans >=#{hostInfoDTO.fansMin,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.fansMax != null and hostInfoDTO.fansMin == null and hostInfoDTO.fansMin != '' ">
|
||||
<if test="hostInfoDTO.fansMax != null and hostInfoDTO.fansMin == null ">
|
||||
and ns.fans <=#{hostInfoDTO.fansMax,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.fansMin != null and hostInfoDTO.fansMax != null " >
|
||||
and ns.fans between #{hostInfoDTO.fansMin,jdbcType=INTEGER} and #{hostInfoDTO.fansMax,jdbcType=INTEGER}
|
||||
</if>
|
||||
<!-- 主播关注筛选-->
|
||||
<if test="hostInfoDTO.fllowernumMin != null and hostInfoDTO.fllowernumMax == null and hostInfoDTO.fllowernumMax != ''">
|
||||
<if test="hostInfoDTO.fllowernumMin != null and hostInfoDTO.fllowernumMax == null">
|
||||
and ns.fllowernum >=#{hostInfoDTO.fllowernumMin,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.fllowernumMax != null and hostInfoDTO.fllowernumMin == null and hostInfoDTO.fllowernumMin != ''">
|
||||
<if test="hostInfoDTO.fllowernumMax != null and hostInfoDTO.fllowernumMin == null">
|
||||
and ns.fllowernum <=#{hostInfoDTO.fllowernumMax,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.fllowernumMin != null and hostInfoDTO.fllowernumMax != null " >
|
||||
and ns.fllowernum between #{hostInfoDTO.fllowernumMin,jdbcType=INTEGER} and #{hostInfoDTO.fllowernumMax,jdbcType=INTEGER}
|
||||
</if>
|
||||
<!-- 主播在线人数筛选-->
|
||||
<if test="hostInfoDTO.onlineFansMin != null and hostInfoDTO.onlineFansMax == null and hostInfoDTO.onlineFansMax != '' ">
|
||||
<if test="hostInfoDTO.onlineFansMin != null and hostInfoDTO.onlineFansMax == null ">
|
||||
and ns.online_fans >=#{hostInfoDTO.onlineFansMin,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.onlineFansMax != null and hostInfoDTO.onlineFansMin == null and hostInfoDTO.onlineFansMin != ''">
|
||||
<if test="hostInfoDTO.onlineFansMax != null and hostInfoDTO.onlineFansMin == null ">
|
||||
and ns.online_fans <= #{hostInfoDTO.onlineFansMax,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="hostInfoDTO.onlineFansMin != null and hostInfoDTO.onlineFansMax != null " >
|
||||
|
||||
Reference in New Issue
Block a user