local-tool设置动态uri
This commit is contained in:
+5
-1
@@ -33,6 +33,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
@@ -62,6 +63,9 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
|
||||
@Autowired
|
||||
private WebSocketServer webSocketServer;
|
||||
|
||||
//请求处理文件url
|
||||
@Value("${local-tool.uri}")
|
||||
private URI uri;
|
||||
|
||||
//请求处理文件url
|
||||
@Value("${OCR.handleFileUrl}")
|
||||
@@ -136,7 +140,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
|
||||
ocrVO.setTaskId(taskId);
|
||||
ocrVO.setRestCallBackUrl(RestCallBackUrl);
|
||||
ocrVO.setIsThird(true);
|
||||
ResponseEntity<String> responseEntity = localToolFeignClient.getFile(ocrVO);
|
||||
ResponseEntity<String> responseEntity = localToolFeignClient.getFile(uri, ocrVO);
|
||||
|
||||
log.info("请求OCR接口完毕,返回响应状态:【"+sdf.format(new Date())+"】");
|
||||
HttpStatus statusCode = responseEntity.getStatusCode();
|
||||
|
||||
+3
-5
@@ -14,21 +14,19 @@ public interface WebSocketServer {
|
||||
/**
|
||||
* 断开连接方法
|
||||
*/
|
||||
public void onClose(Session session);
|
||||
public void onClose();
|
||||
|
||||
/**
|
||||
* 收到客户端消息后调用的方法
|
||||
* @param session session 对象
|
||||
* @param message 返回客户端的消息
|
||||
*/
|
||||
public void onMessage(Session session, String message);
|
||||
public void onMessage(String message);
|
||||
|
||||
/**
|
||||
* 发生异常时触发的方法
|
||||
* @param session session 对象
|
||||
* @param throwable 抛出的异常
|
||||
*/
|
||||
public void onError(Session session,Throwable throwable);
|
||||
public void onError(Throwable throwable);
|
||||
|
||||
/**
|
||||
* 向单个客户端发送消息
|
||||
|
||||
+8
-5
@@ -34,15 +34,15 @@ public class WebsocketServerImpl implements WebSocketServer {
|
||||
|
||||
@OnClose
|
||||
@Override
|
||||
public void onClose(Session session) {
|
||||
public void onClose() {
|
||||
// 客户端断开连接移除websocket对象
|
||||
webSocketSet.remove(session.getId());
|
||||
log.info("客户端断开连接,当前连接数:" + webSocketSet.size());
|
||||
webSocketSet.remove(this);
|
||||
log.info("客户端 session id: "+session.getId() +"断开连接,当前连接数:" + webSocketSet.size());
|
||||
}
|
||||
|
||||
@OnMessage
|
||||
@Override
|
||||
public void onMessage(Session session, String message) {
|
||||
public void onMessage(String message) {
|
||||
log.info("客户端 session id: "+session.getId()+",消息:" + message);
|
||||
|
||||
// 此方法为客户端给服务器发送消息后进行的处理,可以根据业务自己处理,这里返回页面
|
||||
@@ -51,7 +51,7 @@ public class WebsocketServerImpl implements WebSocketServer {
|
||||
|
||||
@OnError
|
||||
@Override
|
||||
public void onError(Session session, Throwable throwable) {
|
||||
public void onError(Throwable throwable) {
|
||||
log.error("发生错误"+ throwable.getMessage(),throwable);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ public class WebsocketServerImpl implements WebSocketServer {
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
continue;
|
||||
} catch (IllegalStateException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user