Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
recv_data_longhua
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d54a7a66
authored
Sep 23, 2020
by
zhangxk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改字符编码为GBK
1 parent
e3b9e586
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
src/main/java/com/viontech/process/BehaviorProcess.java
src/main/java/com/viontech/process/TrafficProcess.java
src/main/java/com/viontech/process/BehaviorProcess.java
View file @
d54a7a6
...
...
@@ -9,6 +9,7 @@ import com.viontech.utils.IntUtils;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.text.ParseException
;
import
java.util.Base64
;
...
...
@@ -97,11 +98,11 @@ public class BehaviorProcess implements Process {
}
String
locationName
=
location
.
getString
(
"name"
);
if
(
locationName
!=
null
)
{
byte
[]
locationNameBytes
=
locationName
.
getBytes
(
StandardCharsets
.
UTF_8
);
byte
[]
locationNameBytes
=
locationName
.
getBytes
(
Charset
.
forName
(
"GBK"
)
);
System
.
arraycopy
(
locationNameBytes
,
0
,
model
.
getEventLocation
(),
0
,
Math
.
min
(
locationNameBytes
.
length
,
32
));
}
// todo 录像路径
byte
[]
videoPathBytes
=
"testVideoPath"
.
getBytes
(
StandardCharsets
.
UTF_8
);
byte
[]
videoPathBytes
=
"testVideoPath"
.
getBytes
(
Charset
.
forName
(
"GBK"
)
);
System
.
arraycopy
(
videoPathBytes
,
0
,
model
.
getEventSnapshotPath
(),
0
,
videoPathBytes
.
length
);
}
...
...
@@ -119,7 +120,7 @@ public class BehaviorProcess implements Process {
if
(
plate
!=
null
)
{
String
text
=
plate
.
getString
(
"text"
);
if
(
text
!=
null
&&
!
""
.
equals
(
text
))
{
byte
[]
bytes
=
text
.
getBytes
(
StandardCharsets
.
UTF_8
);
byte
[]
bytes
=
text
.
getBytes
(
Charset
.
forName
(
"GBK"
)
);
System
.
arraycopy
(
bytes
,
0
,
model
.
getLicensePlateText
(),
0
,
Math
.
min
(
bytes
.
length
,
model
.
getLicensePlateText
().
length
));
}
}
...
...
src/main/java/com/viontech/process/TrafficProcess.java
View file @
d54a7a6
...
...
@@ -10,6 +10,7 @@ import com.viontech.utils.IntUtils;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.text.ParseException
;
import
java.util.Base64
;
...
...
@@ -95,7 +96,7 @@ public class TrafficProcess implements Process {
}
catch
(
Exception
ignore
)
{
}
// ftpClientHelper.storeFile(filePath, bytes);
byte
[]
videoPathBytes
=
filePath
.
getBytes
(
StandardCharsets
.
UTF_8
);
byte
[]
videoPathBytes
=
filePath
.
getBytes
(
Charset
.
forName
(
"GBK"
)
);
System
.
arraycopy
(
videoPathBytes
,
0
,
model
.
getVideoPath
(),
0
,
videoPathBytes
.
length
);
}
}
...
...
@@ -145,7 +146,7 @@ public class TrafficProcess implements Process {
JSONObject
plate
=
vehicle
.
getJSONObject
(
"plate"
);
// ----------------- 车牌 ------------------
if
(
plate
!=
null
)
{
byte
[]
text
=
plate
.
getString
(
"text"
).
getBytes
(
StandardCharsets
.
UTF_8
);
byte
[]
text
=
plate
.
getString
(
"text"
).
getBytes
(
Charset
.
forName
(
"GBK"
)
);
System
.
arraycopy
(
text
,
0
,
model
.
getPlateText
(),
0
,
Math
.
min
(
text
.
length
,
16
));
// todo 车牌类型待实现
model
.
setPlateType
(
1
);
...
...
@@ -204,7 +205,7 @@ public class TrafficProcess implements Process {
model
.
setDirection
(
directionCode
);
}
String
locationName
=
location
.
getString
(
"name"
);
byte
[]
locationNameBytes
=
locationName
.
getBytes
(
StandardCharsets
.
UTF_8
);
byte
[]
locationNameBytes
=
locationName
.
getBytes
(
Charset
.
forName
(
"GBK"
)
);
System
.
arraycopy
(
locationNameBytes
,
0
,
model
.
getRouteLocation
(),
0
,
Math
.
min
(
locationNameBytes
.
length
,
32
));
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment