解决搜索问题
This commit is contained in:
parent
add805da09
commit
269b98a9cf
@ -9,9 +9,8 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
|
|||||||
@Data
|
@Data
|
||||||
@Document(indexName = "filesearch", shards = 1, replicas = 0)
|
@Document(indexName = "filesearch", shards = 1, replicas = 0)
|
||||||
public class FileSearch {
|
public class FileSearch {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private long fileSearchId;
|
private Long userFileId;
|
||||||
@Field(type = FieldType.Long)
|
@Field(type = FieldType.Long)
|
||||||
private Long fileId;
|
private Long fileId;
|
||||||
@Field(type = FieldType.Text, analyzer = "ik_max_word")
|
@Field(type = FieldType.Text, analyzer = "ik_max_word")
|
||||||
@ -32,8 +31,6 @@ public class FileSearch {
|
|||||||
@Field(type = FieldType.Keyword)
|
@Field(type = FieldType.Keyword)
|
||||||
private String identifier;
|
private String identifier;
|
||||||
@Field(type = FieldType.Long)
|
@Field(type = FieldType.Long)
|
||||||
private Long userFileId;
|
|
||||||
@Field(type = FieldType.Long)
|
|
||||||
private Long userId;
|
private Long userId;
|
||||||
@Field(type = FieldType.Keyword)
|
@Field(type = FieldType.Keyword)
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
@ -594,5 +594,4 @@ public class FileController {
|
|||||||
return isExistPath;
|
return isExistPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.crypto.hash.SimpleHash;
|
import org.apache.shiro.crypto.hash.SimpleHash;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -74,6 +75,9 @@ public class UserController {
|
|||||||
RestResult<UserLoginVo> restResult = new RestResult<UserLoginVo>();
|
RestResult<UserLoginVo> restResult = new RestResult<UserLoginVo>();
|
||||||
UserBean saveUserBean = userService.findUserInfoByTelephone(username);
|
UserBean saveUserBean = userService.findUserInfoByTelephone(username);
|
||||||
|
|
||||||
|
if (saveUserBean == null) {
|
||||||
|
return RestResult.fail().message("用户名或手机号不存在!");
|
||||||
|
}
|
||||||
String jwt = "";
|
String jwt = "";
|
||||||
try {
|
try {
|
||||||
jwt = JjwtUtil.createJWT("qiwenshare", "qiwen", JSON.toJSONString(saveUserBean));
|
jwt = JjwtUtil.createJWT("qiwenshare", "qiwen", JSON.toJSONString(saveUserBean));
|
||||||
@ -104,25 +108,22 @@ public class UserController {
|
|||||||
@GetMapping("/checkuserlogininfo")
|
@GetMapping("/checkuserlogininfo")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public RestResult<UserBean> checkUserLoginInfo(@RequestHeader("token") String token) {
|
public RestResult<UserBean> checkUserLoginInfo(@RequestHeader("token") String token) {
|
||||||
RestResult<UserBean> restResult = new RestResult<UserBean>();
|
|
||||||
|
|
||||||
|
if ("undefined".equals(token) || StringUtils.isEmpty(token)) {
|
||||||
|
return RestResult.fail().message("用户暂未登录");
|
||||||
|
}
|
||||||
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
||||||
if (sessionUserBean != null) {
|
if (sessionUserBean != null) {
|
||||||
|
|
||||||
restResult.setData(sessionUserBean);
|
|
||||||
restResult.setSuccess(true);
|
|
||||||
AliyunOSS oss = qiwenFileConfig.getAliyun().getOss();
|
AliyunOSS oss = qiwenFileConfig.getAliyun().getOss();
|
||||||
String domain = oss.getDomain();
|
String domain = oss.getDomain();
|
||||||
restResult.getData().setViewDomain(domain);
|
sessionUserBean.setViewDomain(domain);
|
||||||
String bucketName = oss.getBucketName();
|
return RestResult.success().data(sessionUserBean);
|
||||||
String endPoint = oss.getEndpoint();
|
|
||||||
restResult.getData().setDownloadDomain(bucketName + "." + endPoint);
|
|
||||||
} else {
|
} else {
|
||||||
restResult.setSuccess(false);
|
return RestResult.fail().message("用户暂未登录");
|
||||||
restResult.setMessage("用户暂未登录");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return restResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -105,9 +105,7 @@ public class UserBean {
|
|||||||
@Transient
|
@Transient
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String token;
|
private String token;
|
||||||
@Transient
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String downloadDomain;
|
|
||||||
@Transient
|
@Transient
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String viewDomain;
|
private String viewDomain;
|
||||||
|
@ -36,7 +36,6 @@ public class UserService extends ServiceImpl<UserMapper, UserBean> implements IU
|
|||||||
c = JjwtUtil.parseJWT(token);
|
c = JjwtUtil.parseJWT(token);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("解码异常");
|
log.error("解码异常");
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
@ -52,10 +51,16 @@ public class UserService extends ServiceImpl<UserMapper, UserBean> implements IU
|
|||||||
String savePassword = "";
|
String savePassword = "";
|
||||||
if (StringUtils.isNotEmpty(tokenUserBean.getPassword())) {
|
if (StringUtils.isNotEmpty(tokenUserBean.getPassword())) {
|
||||||
saveUserBean = findUserInfoByTelephone(tokenUserBean.getTelephone());
|
saveUserBean = findUserInfoByTelephone(tokenUserBean.getTelephone());
|
||||||
|
if (saveUserBean == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
tokenPassword = tokenUserBean.getPassword();
|
tokenPassword = tokenUserBean.getPassword();
|
||||||
savePassword = saveUserBean.getPassword();
|
savePassword = saveUserBean.getPassword();
|
||||||
} else if (StringUtils.isNotEmpty(tokenUserBean.getQqPassword())) {
|
} else if (StringUtils.isNotEmpty(tokenUserBean.getQqPassword())) {
|
||||||
saveUserBean = selectUserByopenid(tokenUserBean.getOpenId());
|
saveUserBean = selectUserByopenid(tokenUserBean.getOpenId());
|
||||||
|
if (saveUserBean == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
tokenPassword = tokenUserBean.getQqPassword();
|
tokenPassword = tokenUserBean.getQqPassword();
|
||||||
savePassword = saveUserBean.getQqPassword();
|
savePassword = saveUserBean.getQqPassword();
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,7 @@ mybatis.type-aliases-package=com.qiwenshare.file.domain
|
|||||||
mybatis.config-locations=classpath:mybatis/mybatis-config.xml
|
mybatis.config-locations=classpath:mybatis/mybatis-config.xml
|
||||||
mybatis.mapper-locations=classpath:mybatis/mapper/*.xml
|
mybatis.mapper-locations=classpath:mybatis/mapper/*.xml
|
||||||
#mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
#mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
#jdbc连接
|
|
||||||
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
|
||||||
spring.datasource.url = jdbc:mysql://localhost:3306/file?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
|
|
||||||
spring.datasource.username=root
|
|
||||||
spring.datasource.password=ma123456
|
|
||||||
|
|
||||||
#数据库初始化
|
#数据库初始化
|
||||||
spring.datasource.data=classpath:database/data.sql
|
spring.datasource.data=classpath:database/data.sql
|
||||||
@ -68,18 +64,18 @@ qiwen-file.aliyun.oss.bucket-name=
|
|||||||
#阿里云oss绑定域名
|
#阿里云oss绑定域名
|
||||||
qiwen-file.aliyun.oss.domain=
|
qiwen-file.aliyun.oss.domain=
|
||||||
|
|
||||||
|
#FastDFS配置
|
||||||
fdfs.so-timeout=1501
|
fdfs.so-timeout=1501
|
||||||
fdfs.connect-timeout=601
|
fdfs.connect-timeout=601
|
||||||
fdfs.thumb-image.width=150
|
fdfs.thumb-image.width=150
|
||||||
fdfs.thumb-image.height=150
|
fdfs.thumb-image.height=150
|
||||||
fdfs.tracker-list=121.89.222.103:22122
|
fdfs.tracker-list=127.0.0.1:22122
|
||||||
|
|
||||||
|
|
||||||
# Redis数据库索引(默认为0)
|
# Redis数据库索引(默认为0)
|
||||||
spring.redis.database=0
|
spring.redis.database=0
|
||||||
# Redis服务器地址
|
# Redis服务器地址
|
||||||
spring.redis.host=123.56.9.174
|
spring.redis.host=127.0.0.1
|
||||||
# Redis服务器连接端口
|
# Redis服务器连接端口
|
||||||
spring.redis.port=6379
|
spring.redis.port=6379
|
||||||
# Redis服务器连接密码(默认为空)
|
# Redis服务器连接密码(默认为空)
|
||||||
|
Loading…
Reference in New Issue
Block a user