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