fix(bug): 修复摄像头传输流关闭和日志大小上限问题
- 修改 logback.xml 中的日志大小上限为 200MB - 修正 Operational 类中的摄像头传输流操作 - 在 R 类中添加 noMean 方法用于处理无对应方法的情况 - 更新 SocketServer 和 SocketUtils 类中的消息处理逻辑 - 优化 TwainContainer 类中的 intValue 方法
This commit is contained in:
parent
c620d07075
commit
84eac91bac
|
@ -79,7 +79,7 @@ public class Operational {
|
|||
WebCamUtils.setViewSizes(param.getInteger("width"), param.getInteger("height"));
|
||||
r = R.ok();
|
||||
}else if("002007".equals(function)){
|
||||
//打开摄像头传输流
|
||||
//关闭摄像头传输流
|
||||
WebCamUtils.closeWebcamTransfer();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ public class R<T> {
|
|||
return new R<>("500", msg, null, false);
|
||||
}
|
||||
|
||||
public static R noMean(){
|
||||
return new R<>("201", "没有找到对应的方法", null, true);
|
||||
}
|
||||
|
||||
public String toJsonStr() {
|
||||
return JSONUtil.toJsonStr(this);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,10 @@ public abstract class TwainContainer {
|
|||
}
|
||||
|
||||
private int intValue(Object obj) throws TwainException {
|
||||
if(obj == null){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (obj instanceof Number) {
|
||||
return ((Number) obj).intValue();
|
||||
} else if (obj instanceof Boolean) {
|
||||
|
|
|
@ -43,7 +43,7 @@ public class SocketServer extends WebSocketServer {
|
|||
public void onMessage(WebSocket conn, String message) {
|
||||
JSONObject json = SocketUtils.isNoPingMessage(message);
|
||||
if (json == null){
|
||||
conn.send(R.ok().toJsonStr());
|
||||
conn.send(R.noMean().toJsonStr());
|
||||
}else{
|
||||
conn.send(selectOperational(json));
|
||||
}
|
||||
|
|
|
@ -77,11 +77,16 @@ public class SocketUtils {
|
|||
* @return
|
||||
*/
|
||||
public static JSONObject isNoPingMessage(String message){
|
||||
try{
|
||||
JSONObject json = JSONObject.parse(message);
|
||||
String type = json.getString("type");
|
||||
if("ping".equals(type)){
|
||||
return json;
|
||||
}
|
||||
return null;
|
||||
}catch (Exception e){
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<fileNamePattern>${log.path}/ScanService.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
<totalSizeCap>200M</totalSizeCap>
|
||||
<totalSizeCap>200MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
|
|
Loading…
Reference in New Issue