Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lmp_server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lmp
lmp_server
Commits
42007ed0
Commit
42007ed0
authored
Apr 28, 2024
by
pengxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出CSV特殊符号处理。
parent
e99cdcfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
DatasetOutputServiceImpl.java
...e/webadmin/app/service/impl/DatasetOutputServiceImpl.java
+6
-5
No files found.
application-webadmin/src/main/java/com/yice/webadmin/app/service/impl/DatasetOutputServiceImpl.java
View file @
42007ed0
...
...
@@ -392,6 +392,12 @@ public class DatasetOutputServiceImpl extends BaseService<DatasetOutput, Long> i
JsonNode
rootNode
=
objectMapper
.
readTree
(
datasetData
.
getData
());
String
instruction
=
rootNode
.
get
(
DatasetConstant
.
INSTRUCTION
).
textValue
();
String
output
=
rootNode
.
get
(
DatasetConstant
.
OUTPUT
).
textValue
();
// 对包含换行符的字符串进行处理
instruction
=
instruction
.
replaceAll
(
"\n"
,
" "
);
output
=
output
.
replaceAll
(
"\n"
,
" "
);
// 将包含逗号的字符串用双引号包围,并转义其中的双引号
pw
.
println
(
escapeCsvValue
(
instruction
)
+
","
+
escapeCsvValue
(
output
));
}
pw
.
flush
();
...
...
@@ -413,11 +419,6 @@ public class DatasetOutputServiceImpl extends BaseService<DatasetOutput, Long> i
return
fileName
;
}
/**
* 特殊符号处理
* @param value 处理值
* @return 返回处理
*/
private
String
escapeCsvValue
(
String
value
)
{
// 使用Apache Commons CSV库来转义CSV值中的特殊字符
String
escaped
=
StringEscapeUtils
.
escapeCsv
(
value
);
...
...
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