Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
customer-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QG
customer-service
Commits
9f3d5a6d
Commit
9f3d5a6d
authored
Feb 24, 2022
by
吴琼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
判断非空
parent
255e1fc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
+21
-15
TransactionReceiptRecordServiceImpl.java
...mer/service/impl/TransactionReceiptRecordServiceImpl.java
+21
-15
No files found.
src/main/java/cn/quantgroup/customer/service/impl/TransactionReceiptRecordServiceImpl.java
View file @
9f3d5a6d
...
...
@@ -129,23 +129,26 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
//读取所有数据
List
<
TransactionReceiptRecord
>
readList
=
read
(
file
.
getOriginalFilename
(),
file
.
getInputStream
());
//0代表初始状态,1代表导入成功,2代表导入失败
for
(
TransactionReceiptRecord
record
:
readList
){
//保存时如果有其中一项为空则默认为导入失败,其他则默认初始状态
if
(
record
.
getUserId
()
==
null
||
record
.
getUserId
()
==
0
||
StringUtils
.
isEmpty
(
record
.
getUserName
())
||
StringUtils
.
isEmpty
(
record
.
getOrderNo
())){
record
.
setImportStatus
(
2
);
//默认导出失败
record
.
setExportStatus
(
2
);
}
else
{
record
.
setImportStatus
(
0
);
//默认导出初始状态
record
.
setExportStatus
(
0
);
if
(
readList
.
size
()>
0
){
//0代表初始状态,1代表导入成功,2代表导入失败
for
(
TransactionReceiptRecord
record
:
readList
){
//保存时如果有其中一项为空则默认为导入失败,其他则默认初始状态
if
(
record
.
getUserId
()
==
null
||
record
.
getUserId
()
==
0
||
StringUtils
.
isEmpty
(
record
.
getUserName
())
||
StringUtils
.
isEmpty
(
record
.
getOrderNo
())){
record
.
setImportStatus
(
2
);
//默认导出失败
record
.
setExportStatus
(
2
);
}
else
{
record
.
setImportStatus
(
0
);
//默认导出初始状态
record
.
setExportStatus
(
0
);
}
//存储批次号
record
.
setBatchNo
(
maxBatchNo
);
transactionReceiptRecordRepo
.
save
(
record
);
}
//存储批次号
record
.
setBatchNo
(
maxBatchNo
);
transactionReceiptRecordRepo
.
save
(
record
);
return
JsonResult
.
buildSuccessResult
(
"success"
,
null
);
}
return
JsonResult
.
build
SuccessResult
(
"success"
,
null
);
return
JsonResult
.
build
ErrorStateResult
(
"未读取到数据或读取失败"
);
}
public
List
<
TransactionReceiptRecord
>
read
(
String
filename
,
InputStream
is
)
throws
IOException
{
...
...
@@ -192,6 +195,9 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
TransactionReceiptRecord
record
=
new
TransactionReceiptRecord
();
for
(
int
c
=
0
;
c
<
totalCols
;
c
++)
{
Cell
cell
=
row
.
getCell
(
c
);
if
(
cell
==
null
){
continue
;
}
cell
.
setCellType
(
cell
.
CELL_TYPE_STRING
);
String
cellValue
=
cell
.
getStringCellValue
();
if
(
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
cellValue
))
{
...
...
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