Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
emport-api
Overview
Overview
Details
Activity
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
刘泽志
emport-api
Commits
1f00cb80
Commit
1f00cb80
authored
Dec 04, 2023
by
liuzz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
针对处理'-'等未输入的值,插入数据库时直接显示为null值,便于统计
parent
727d3f9b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
DataImportUtils.java
...ain/java/com/tbyf/his/web/dataImport/DataImportUtils.java
+5
-1
ExcelDataServiceImpl.java
...his/web/dataImport/service/impl/ExcelDataServiceImpl.java
+6
-0
application.yml
admin-api/src/main/resources/application.yml
+1
-1
No files found.
admin-api/src/main/java/com/tbyf/his/web/dataImport/DataImportUtils.java
View file @
1f00cb80
...
...
@@ -105,6 +105,10 @@ public class DataImportUtils {
* @return
*/
public
static
String
getInsertContent
(
VerifyVO
vo
,
int
index
)
{
// 没有值就插入null
if
(
vo
.
getValues
().
get
(
index
)
==
null
){
return
"null"
;
}
if
(
StringUtils
.
containsIgnoreCase
(
vo
.
getFieldType
(),
"VARCHAR"
))
{
return
"'"
+
vo
.
getValues
().
get
(
index
)
+
"'"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
vo
.
getFieldType
(),
"NUMBER"
))
{
...
...
@@ -120,8 +124,8 @@ public class DataImportUtils {
return
StrFormatter
.
format
(
"to_date('{}','YYYY-MM-DD HH24:MI:SS')"
,
DateUtils
.
parseDateToStr
(
"yyyy-MM-dd HH:mm:ss"
,
date
));
}
}
catch
(
Exception
ignore
)
{
return
"null"
;
}
return
"null"
;
}
return
"'"
+
vo
.
getValues
().
get
(
index
)
+
"'"
;
}
...
...
admin-api/src/main/java/com/tbyf/his/web/dataImport/service/impl/ExcelDataServiceImpl.java
View file @
1f00cb80
...
...
@@ -560,6 +560,12 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
for
(
Integer
column
:
columnList
)
{
final
Cell
cell
=
row
.
getCell
(
column
,
Row
.
MissingCellPolicy
.
RETURN_BLANK_AS_NULL
);
String
cellValue
=
DiConfig
.
getValue
(
cell
);
// 如果没有值一律转换为空值
if
(
StrUtil
.
isBlank
(
cellValue
)
||
StrUtil
.
equalsAnyIgnoreCase
(
cellValue
,
"-"
,
"null"
)){
cellValue
=
null
;
vo
.
addValue
(
cellValue
);
continue
;
}
if
(
StrUtil
.
containsIgnoreCase
(
vo
.
getFieldType
(),
"number"
)){
// 如果是数字
// 计算整数长度in 小数长度de
...
...
admin-api/src/main/resources/application.yml
View file @
1f00cb80
...
...
@@ -47,7 +47,7 @@ spring:
# 国际化资源文件路径
basename
:
i18n/messages
profiles
:
active
:
druid
active
:
zyy
# 文件上传
servlet
:
multipart
:
...
...
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