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
61268149
Commit
61268149
authored
Feb 24, 2022
by
吴琼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xiugai
parent
9f3d5a6d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
8 deletions
+21
-8
TransactionReceiptRecordRest.java
...uantgroup/customer/rest/TransactionReceiptRecordRest.java
+2
-2
TransactionReceiptRecordServiceImpl.java
...mer/service/impl/TransactionReceiptRecordServiceImpl.java
+19
-6
No files found.
src/main/java/cn/quantgroup/customer/rest/TransactionReceiptRecordRest.java
View file @
61268149
...
...
@@ -64,9 +64,9 @@ public class TransactionReceiptRecordRest {
@ResponseBody
public
JsonResult
importTransactionReceiptRecord
(
MultipartFile
multipartFile
)
{
try
{
/*
File excelFile =new File("D://交易凭证.xlsx");
/*
File excelFile =new File("D://交易凭证.xlsx");
FileInputStream inputStream =new FileInputStream(excelFile);
MultipartFile
multipartFile = new MockMultipartFile(excelFile.getName(), excelFile.getName(),
multipartFile = new MockMultipartFile(excelFile.getName(), excelFile.getName(),
ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);*/
return
transactionReceiptRecordService
.
importTransactionReceiptRecord
(
multipartFile
);
}
catch
(
IOException
e
){
...
...
src/main/java/cn/quantgroup/customer/service/impl/TransactionReceiptRecordServiceImpl.java
View file @
61268149
...
...
@@ -128,12 +128,22 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
}
//读取所有数据
log
.
info
(
"importTransactionReceiptRecord read begin"
);
List
<
TransactionReceiptRecord
>
readList
=
read
(
file
.
getOriginalFilename
(),
file
.
getInputStream
());
log
.
info
(
"importTransactionReceiptRecord read end"
);
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
())){
if
((
record
.
getUserId
()
==
null
||
record
.
getUserId
()
==
0
)
&&
StringUtils
.
isEmpty
(
record
.
getUserName
())
&&
StringUtils
.
isEmpty
(
record
.
getOrderNo
())
&&
StringUtils
.
isEmpty
(
record
.
getSerialNo
())
){
continue
;
}
if
(
record
.
getUserId
()
==
null
||
record
.
getUserId
()
==
0
||
StringUtils
.
isEmpty
(
record
.
getUserName
())
||
StringUtils
.
isEmpty
(
record
.
getOrderNo
())){
record
.
setImportStatus
(
2
);
//默认导出失败
record
.
setExportStatus
(
2
);
...
...
@@ -152,6 +162,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
}
public
List
<
TransactionReceiptRecord
>
read
(
String
filename
,
InputStream
is
)
throws
IOException
{
log
.
info
(
" read excel file"
);
/**
* 总行数
*/
...
...
@@ -183,7 +194,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
}
/** 循环Excel的行 */
for
(
int
r
=
0
;
r
<
totalRows
;
r
++)
{
log
.
info
(
" read excel file"
);
if
(
r
==
0
){
continue
;
}
...
...
@@ -195,6 +206,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
TransactionReceiptRecord
record
=
new
TransactionReceiptRecord
();
for
(
int
c
=
0
;
c
<
totalCols
;
c
++)
{
Cell
cell
=
row
.
getCell
(
c
);
log
.
info
(
"cell "
+
cell
);
if
(
cell
==
null
){
continue
;
}
...
...
@@ -267,20 +279,21 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
return
JsonResult
.
buildErrorStateResult
(
"未查询到对应的订单信息"
);
}
//生成pdf
String
basicPath
=
"D:\\交易凭证0222"
;
String
filePath
=
basicPath
+
"\\"
+
record
.
getBatchNo
()+
record
.
getUserName
();
FileToZip
.
mkdir
(
filePath
);
filePath
=
filePath
+
"\\"
+
record
.
getOrderNo
()+
".pdf"
;
generatePDF
(
transactionReceiptVOList
.
get
(
0
),
filePath
);
//调用电子签章接口
//todo
//保存到文件服务器上
SFTPUtil
sftpUtil
=
new
SFTPUtil
(
username
,
password
,
host
,
port
);
/*
SFTPUtil sftpUtil = new SFTPUtil(username,password,host,port);
sftpUtil.login();
log.info("uploadFile | 成功连接ftp");
//sftpUtil.upload(basePath,directory,okFileName,new ByteArrayInputStream(okFileData));
sftpUtil
.
logout
();
sftpUtil.logout();*/
//todo
}
}
catch
(
Exception
e
)
{
log
.
error
(
"[TransactionReceiptRecordServiceImpl][exportZipFile] 网络通讯异常,userId:{},ex:{}"
,
ExceptionUtils
.
getStackTrace
(
e
));
...
...
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