Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mid-service
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
mid-service
Commits
8599ded5
Commit
8599ded5
authored
Jan 17, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改读取配置文件
parent
657260a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
src/main/java/com/mortals/xhx/daemon/applicationservice/CaptureThread.java
.../mortals/xhx/daemon/applicationservice/CaptureThread.java
+20
-11
No files found.
src/main/java/com/mortals/xhx/daemon/applicationservice/CaptureThread.java
View file @
8599ded5
...
...
@@ -9,6 +9,7 @@ import cn.hutool.http.HttpUtil;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.setting.dialect.Props
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONValidator
;
import
com.alibaba.fastjson.TypeReference
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.common.code.YesNoEnum
;
...
...
@@ -28,6 +29,7 @@ import org.pcap4j.packet.TcpPacket;
import
java.io.EOFException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.nio.charset.Charset
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -239,21 +241,20 @@ public class CaptureThread implements Runnable {
log
.
info
(
"配置文件不存在,返回!"
);
return
;
}
Props
props
=
new
Props
(
confPath
);
//获取窗口id 默认值为0
windowId
=
props
.
getInt
(
"windowId"
,
0
);
//读取当前设置的窗口id
/* HcpReq hcpReq = new HcpReq();
hcpReq.setWindowid(windowId);//todo 读取窗口 共享文件
String hcpUrl = hcpGovUrl + "?affairCode=" + affairCode;
hcpReq.setUrl(hcpUrl);
String body = JSON.toJSONString(hcpReq);
// log.info("req url:{},body:{}", url, body);*/
String
json
=
FileUtil
.
readString
(
confPath
,
Charset
.
forName
(
"UTF-8"
));
boolean
jsonBoolean
=
JSONValidator
.
from
(
json
).
validate
();
if
(!
jsonBoolean
)
{
log
.
info
(
"配置文件格式错误,返回!:{}"
,
json
);
return
;
}
HcpReq
hcpReq
=
JSON
.
parseObject
(
json
,
HcpReq
.
class
);
String
hcpUrl
=
hcpGovUrl
+
"?affairCode="
+
affairCode
;
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"url"
,
hcpUrl
);
paramMap
.
put
(
"windowid"
,
windowId
);
paramMap
.
put
(
"windowid"
,
hcpReq
.
getWindowid
()
);
log
.
info
(
"req url:{},body:{}"
,
url
,
JSON
.
toJSONString
(
paramMap
));
String
response
=
HttpUtil
.
post
(
url
,
paramMap
);
...
...
@@ -283,4 +284,12 @@ public class CaptureThread implements Runnable {
return
buffer
;
}
public
static
void
main
(
String
[]
args
)
{
String
json
=
"{ } 12"
;
boolean
jsonBoolean
=
JSONValidator
.
from
(
json
).
validate
();
System
.
out
.
println
(
jsonBoolean
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment