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
649e6cd3
Commit
649e6cd3
authored
Mar 03, 2022
by
吴琼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
交易凭证添加批次号
parent
c4934057
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
15 deletions
+31
-15
TransactionReceiptRecord.java
.../quantgroup/customer/entity/TransactionReceiptRecord.java
+3
-3
TransactionReceiptRecordRepo.java
...uantgroup/customer/repo/TransactionReceiptRecordRepo.java
+4
-1
TransactionReceiptRecordServiceImpl.java
...mer/service/impl/TransactionReceiptRecordServiceImpl.java
+24
-11
No files found.
src/main/java/cn/quantgroup/customer/entity/TransactionReceiptRecord.java
View file @
649e6cd3
...
...
@@ -39,10 +39,10 @@ public class TransactionReceiptRecord {
private
Integer
batchNo
;
@Column
(
name
=
"sign_status"
)
private
Long
signStatus
;
private
Integer
signStatus
;
@Column
(
name
=
"
pdf_status
"
)
private
Long
pdfStatus
;
@Column
(
name
=
"
export_batch_no
"
)
private
Integer
exportBatchNo
;
public
TransactionReceiptRecord
()
{
...
...
src/main/java/cn/quantgroup/customer/repo/TransactionReceiptRecordRepo.java
View file @
649e6cd3
...
...
@@ -11,7 +11,10 @@ import java.util.List;
public
interface
TransactionReceiptRecordRepo
extends
JpaRepository
<
TransactionReceiptRecord
,
Long
>,
JpaSpecificationExecutor
<
TransactionReceiptRecord
>
{
@Query
(
value
=
"select max(batch_no) from transaction_receipt_record where export_status =?1 "
,
nativeQuery
=
true
)
Integer
findMaxbatchNo
(
Integer
status
);
Integer
findMaxBatchNo
(
Integer
status
);
@Query
(
value
=
"select max(export_batch_no) from transaction_receipt_record where import_status = ?1 "
,
nativeQuery
=
true
)
Integer
findExportMaxBatchNo
(
Integer
status
);
@Query
(
value
=
"select count(1) from transaction_receipt_record where user_id =?1 and user_name =?2 and order_no =?3 "
,
nativeQuery
=
true
)
Integer
selectCountByUserIdAndOrderNo
(
Integer
userId
,
String
userName
,
String
orderNo
);
...
...
src/main/java/cn/quantgroup/customer/service/impl/TransactionReceiptRecordServiceImpl.java
View file @
649e6cd3
...
...
@@ -144,7 +144,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
public
JsonResult
importTransactionReceiptRecord
(
MultipartFile
file
)
throws
RuntimeException
{
log
.
info
(
"[TransactionReceiptRecordServiceImpl importTransactionReceiptRecord] end,query={} "
,
file
);
//查询未导出数据最大批次号
Integer
maxBatchNo
=
transactionReceiptRecordRepo
.
findMax
b
atchNo
(
0
);
Integer
maxBatchNo
=
transactionReceiptRecordRepo
.
findMax
B
atchNo
(
0
);
if
(
maxBatchNo
==
null
||
maxBatchNo
==
0
){
maxBatchNo
=
1
;
}
...
...
@@ -269,7 +269,8 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
}
//导出zip压缩包文件
public
JsonResult
exportZipFile
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
@Transactional
public
JsonResult
exportZipFile
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
RuntimeException
{
//调用电商接口获取对应数据
log
.
info
(
"[TransactionReceiptRecordServiceImpl.exportZipFile begin]"
);
//查询需要导出的数据-导入成功的数据,但未导出成功的数据
...
...
@@ -277,6 +278,11 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
if
(
CollectionUtils
.
isEmpty
(
transactionReceiptRecordList
)){
return
JsonResult
.
buildErrorStateResult
(
"没有可以导出得数据"
);
}
//查询导入成功数据的导出的最大批次号
Integer
maxExportBatchNo
=
transactionReceiptRecordRepo
.
findExportMaxBatchNo
(
1
);
if
(
maxExportBatchNo
==
null
||
maxExportBatchNo
==
0
){
maxExportBatchNo
=
1
;
}
List
<
Map
<
String
,
Object
>>
filePathList
=
new
ArrayList
<>();
log
.
info
(
"[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口begin]"
,
System
.
currentTimeMillis
());
SFTPUtil
sftpUtil
=
new
SFTPUtil
(
username
,
password
,
host
,
port
);
...
...
@@ -329,6 +335,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
transactionReceiptRecordRepo
.
save
(
record
);
continue
;
}
record
.
setExportBatchNo
(
maxExportBatchNo
.
intValue
()+
1
);
//生成pdf
String
directory
=
record
.
getBatchNo
()+
record
.
getUserName
();
String
pdfFileName
=
record
.
getOrderNo
()+
".pdf"
;
...
...
@@ -336,11 +343,11 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
generatePDF
(
transactionReceiptVOList
.
get
(
0
),
uploadLocalPath
+
"/"
+
directory
+
"/"
+
pdfFileName
);
File
file1
=
new
File
(
uploadLocalPath
+
"/"
+
directory
+
"/"
+
pdfFileName
);
InputStream
inputStream
=
new
FileInputStream
(
file1
);
sftpUtil
.
upload
(
basePath
,
directory
,
pdfFileName
,
inputStream
);
sftpUtil
.
upload
(
basePath
+
maxExportBatchNo
+
"/交易凭证/"
,
directory
,
pdfFileName
,
inputStream
);
//将文件路径和useId放入list,进行签章
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"userId"
,
record
.
getUserId
());
map
.
put
(
"fileAddress"
,
basePath
+
directory
+
"/"
+
pdfFileName
);
map
.
put
(
"fileAddress"
,
basePath
+
maxExportBatchNo
+
"/交易凭证/"
+
directory
+
"/"
+
pdfFileName
);
filePathList
.
add
(
map
);
}
}
catch
(
Exception
e
)
{
...
...
@@ -392,13 +399,19 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
//File file = ZipUtil.zip("D:/0301/交易凭证", "D:/0301/交易凭证"+".zip");//zip 包保存路径
//FileToZip.mkdir(downloadLocalPath);
File
file
=
ZipUtil
.
zip
(
downloadLocalPath
,
downloadLocalPath
+
".zip"
);
//zip 包保存路径
FileInputStream
is
=
new
FileInputStream
(
file
);
byte
[]
fileData
=
IOUtils
.
readNBytes
(
is
,
is
.
available
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"base64"
,
Base64
.
getEncoder
().
encodeToString
(
fileData
));
map
.
put
(
"successCount"
,
100
);
map
.
put
(
"failCount"
,
20
);
return
JsonResult
.
buildSuccessResult
(
"ok"
,
map
);
FileInputStream
is
=
null
;
try
{
is
=
new
FileInputStream
(
file
);
byte
[]
fileData
=
IOUtils
.
readNBytes
(
is
,
is
.
available
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"base64"
,
Base64
.
getEncoder
().
encodeToString
(
fileData
));
map
.
put
(
"successCount"
,
100
);
map
.
put
(
"failCount"
,
20
);
return
JsonResult
.
buildSuccessResult
(
"ok"
,
map
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"文件转换失败"
);
}
//返回给前端
//sreturn this.outputFile(response,"交易凭证.zip",fileData ,100,20);
}
...
...
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