local-tool设置动态uri
This commit is contained in:
+4
-2
@@ -7,14 +7,16 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description
|
* @description
|
||||||
* @date 2021/12/8 14:53
|
* @date 2021/12/8 14:53
|
||||||
* @auth zhn
|
* @auth zhn
|
||||||
*/
|
*/
|
||||||
@FeignClient(name = "local-tool", url = "http://139.9.235.66:9022")
|
@FeignClient(name = "local-tool", url = "EMPTY")
|
||||||
public interface LocalToolFeignClient {
|
public interface LocalToolFeignClient {
|
||||||
|
|
||||||
@RequestMapping(value = "/local-tool/ocr/handleFile",method = RequestMethod.POST,headers = {"content-type=application/json"})
|
@RequestMapping(value = "/local-tool/ocr/handleFile",method = RequestMethod.POST,headers = {"content-type=application/json"})
|
||||||
ResponseEntity<String> getFile(@RequestBody OcrVO ocrVO);
|
ResponseEntity<String> getFile(URI uri, @RequestBody OcrVO ocrVO);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -33,6 +33,7 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.net.URI;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -62,6 +63,9 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WebSocketServer webSocketServer;
|
private WebSocketServer webSocketServer;
|
||||||
|
|
||||||
|
//请求处理文件url
|
||||||
|
@Value("${local-tool.uri}")
|
||||||
|
private URI uri;
|
||||||
|
|
||||||
//请求处理文件url
|
//请求处理文件url
|
||||||
@Value("${OCR.handleFileUrl}")
|
@Value("${OCR.handleFileUrl}")
|
||||||
@@ -136,7 +140,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
|
|||||||
ocrVO.setTaskId(taskId);
|
ocrVO.setTaskId(taskId);
|
||||||
ocrVO.setRestCallBackUrl(RestCallBackUrl);
|
ocrVO.setRestCallBackUrl(RestCallBackUrl);
|
||||||
ocrVO.setIsThird(true);
|
ocrVO.setIsThird(true);
|
||||||
ResponseEntity<String> responseEntity = localToolFeignClient.getFile(ocrVO);
|
ResponseEntity<String> responseEntity = localToolFeignClient.getFile(uri, ocrVO);
|
||||||
|
|
||||||
log.info("请求OCR接口完毕,返回响应状态:【"+sdf.format(new Date())+"】");
|
log.info("请求OCR接口完毕,返回响应状态:【"+sdf.format(new Date())+"】");
|
||||||
HttpStatus statusCode = responseEntity.getStatusCode();
|
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 返回客户端的消息
|
* @param message 返回客户端的消息
|
||||||
*/
|
*/
|
||||||
public void onMessage(Session session, String message);
|
public void onMessage(String message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发生异常时触发的方法
|
* 发生异常时触发的方法
|
||||||
* @param session session 对象
|
|
||||||
* @param throwable 抛出的异常
|
* @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
|
@OnClose
|
||||||
@Override
|
@Override
|
||||||
public void onClose(Session session) {
|
public void onClose() {
|
||||||
// 客户端断开连接移除websocket对象
|
// 客户端断开连接移除websocket对象
|
||||||
webSocketSet.remove(session.getId());
|
webSocketSet.remove(this);
|
||||||
log.info("客户端断开连接,当前连接数:" + webSocketSet.size());
|
log.info("客户端 session id: "+session.getId() +"断开连接,当前连接数:" + webSocketSet.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnMessage
|
@OnMessage
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Session session, String message) {
|
public void onMessage(String message) {
|
||||||
log.info("客户端 session id: "+session.getId()+",消息:" + message);
|
log.info("客户端 session id: "+session.getId()+",消息:" + message);
|
||||||
|
|
||||||
// 此方法为客户端给服务器发送消息后进行的处理,可以根据业务自己处理,这里返回页面
|
// 此方法为客户端给服务器发送消息后进行的处理,可以根据业务自己处理,这里返回页面
|
||||||
@@ -51,7 +51,7 @@ public class WebsocketServerImpl implements WebSocketServer {
|
|||||||
|
|
||||||
@OnError
|
@OnError
|
||||||
@Override
|
@Override
|
||||||
public void onError(Session session, Throwable throwable) {
|
public void onError(Throwable throwable) {
|
||||||
log.error("发生错误"+ throwable.getMessage(),throwable);
|
log.error("发生错误"+ throwable.getMessage(),throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +64,9 @@ public class WebsocketServerImpl implements WebSocketServer {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
continue;
|
continue;
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,7 +365,14 @@ people:
|
|||||||
# secret: 7C3F03170E3ea489df04Ce8DEC7Df4f7
|
# secret: 7C3F03170E3ea489df04Ce8DEC7Df4f7
|
||||||
## Feishu
|
## Feishu
|
||||||
Feishu:
|
Feishu:
|
||||||
|
# 测试
|
||||||
appId: cli_a16d47ca9f381013
|
appId: cli_a16d47ca9f381013
|
||||||
appSecret: DSfCrj70xku2VUjqwHBIuuY6HZnz7ppe
|
appSecret: DSfCrj70xku2VUjqwHBIuuY6HZnz7ppe
|
||||||
|
|
||||||
|
# 正式
|
||||||
|
# appId: cli_a2a1a6014679500d
|
||||||
|
# appSecret: AeHwisC82S0fhiREJg6bkdxhIZMevnZZ
|
||||||
getTenantAccessTokenUrl: https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal
|
getTenantAccessTokenUrl: https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal
|
||||||
batchSendMessageUrl: https://open.feishu.cn/open-apis/message/v4/batch_send/
|
batchSendMessageUrl: https://open.feishu.cn/open-apis/message/v4/batch_send/
|
||||||
|
local-tool:
|
||||||
|
uri: http://139.9.235.66:9022
|
||||||
|
|||||||
Reference in New Issue
Block a user