first commit

This commit is contained in:
chuzhongzai 2023-12-08 12:56:42 +08:00
parent ef6d4ed5af
commit 60c700451c
14 changed files with 39 additions and 28 deletions

33
.gitignore vendored Normal file
View File

@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

View File

@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.3</version>
<version>3.2.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.lion</groupId>

View File

@ -6,7 +6,6 @@ import com.lion.sns.util.Response;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

View File

@ -2,7 +2,6 @@ package com.lion.sns.controller;
import com.lion.sns.pojo.Site;
import com.lion.sns.service.SiteService;
import com.lion.sns.util.Response;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

View File

@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Update;
@Mapper
public interface CustomConfigurationMapper {
static final String PATH = "path";
String PATH = "path";
@Select("select value from custom_configuration where key=#{key}")

View File

@ -12,8 +12,6 @@ import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Objects;
@Getter
@Component
@ -25,7 +23,7 @@ public class Interceptor implements HandlerInterceptor {
sessionId2user = new HashMap<>();
String path = customConfigurationMapper.selectValue(CustomConfigurationMapper.PATH);
if(path == null || path.isEmpty())
new Thread(() -> {CustomUtil.initSns(customConfigurationMapper, siteMapper, userMapper);}).start();
new Thread(() -> CustomUtil.initSns(customConfigurationMapper, siteMapper, userMapper)).start();
}
//需要鉴别管理员接口

View File

@ -5,7 +5,6 @@ import lombok.Data;
import java.util.Date;
import java.util.TreeMap;
@Data
public class FileNode {

View File

@ -354,9 +354,7 @@ public class CommunicateService {
}
case AbstractMessage.MOVE_FILE_REQUEST_MESSAGE -> {
MoveFileRequestMessage moveFileRequestMessage = (MoveFileRequestMessage) abstractMessage;
threadPool.submit(() -> {
receiveFile(ctx.channel(), moveFileRequestMessage);
});
threadPool.submit(() -> receiveFile(ctx.channel(), moveFileRequestMessage));
}
case AbstractMessage.MOVE_FILE_RESPONSE_MESSAGE -> {
MoveFileResponseMessage moveFileResponseMessage = (MoveFileResponseMessage) abstractMessage;
@ -382,9 +380,7 @@ public class CommunicateService {
}
}
}
case AbstractMessage.PAIR_MESSAGE -> {
proceedPair((PairMessage) abstractMessage, ctx.channel());
}
case AbstractMessage.PAIR_MESSAGE -> proceedPair((PairMessage) abstractMessage, ctx.channel());
case AbstractMessage.CONNECT_MESSAGE -> {
String ip = ctx.channel().remoteAddress().toString().replace("/", "").split(":")[0];
Site site = siteMapper.selectSiteByIp(ip);

View File

@ -1,8 +1,6 @@
package com.lion.sns.service;
import cn.hutool.core.util.RandomUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.lion.sns.dao.CustomConfigurationMapper;
import com.lion.sns.dao.ShareFileMapper;

View File

@ -1,6 +1,5 @@
package com.lion.sns.service;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.file.PathUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.lion.sns.ScalableNetworkStorageApplication;

View File

@ -9,7 +9,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
@Service
@ -18,13 +17,8 @@ public class TaskService {
ScheduledExecutorService thread;
@Resource
WebSocketService webSocketService;
ReentrantLock lock;
HashMap<Integer, Integer> taskId2Site;
public TaskService(){

View File

@ -123,7 +123,7 @@ public class WebSocketService implements WebSocketHandler {
}
@Override
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
public void handleTransportError(WebSocketSession session, Throwable exception){
}

View File

@ -8,7 +8,6 @@ import com.lion.sns.dao.UserMapper;
import com.lion.sns.message.PairMessage;
import com.lion.sns.pojo.Site;
import com.lion.sns.pojo.User;
import jakarta.servlet.http.HttpServletResponse;
import lombok.Data;
import org.springframework.util.DigestUtils;

View File

@ -2,13 +2,10 @@ package com.lion.sns.util;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.util.HashMap;
public class Response {
// HashMap<String, String> result;
ObjectNode result;
public Response(){