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
92e479af
Commit
92e479af
authored
Nov 10, 2022
by
李健华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改pdf模板内容
parent
b47aeb4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
38 deletions
+55
-38
TransactionReceiptRecordServiceImpl.java
...mer/service/impl/TransactionReceiptRecordServiceImpl.java
+55
-38
No files found.
src/main/java/cn/quantgroup/customer/service/impl/TransactionReceiptRecordServiceImpl.java
View file @
92e479af
...
...
@@ -337,7 +337,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
log
.
info
(
"[TransactionReceiptRecordServiceImpl.exportZipFile begin]"
);
//查询需要导出的数据-导入成功的数据,但未导出成功的数据
String
accessToken
=
request
.
getHeader
(
"Access-Token"
);
List
<
TransactionReceiptRecord
>
transactionReceiptRecordList
=
transactionReceiptRecordRepo
.
selectRecordsByImportStatusAndExportStatus
(
VoucherExportStatus
.
EXPORT_SUCCESS
.
getCode
(),
limit
);
List
<
TransactionReceiptRecord
>
transactionReceiptRecordList
=
transactionReceiptRecordRepo
.
selectRecordsByImportStatusAndExportStatus
(
VoucherExportStatus
.
EXPORT_SUCCESS
.
getCode
(),
limit
);
log
.
info
(
"[TransactionReceiptRecordServiceImpl.exportZipFile transactionReceiptRecordList] 可导出数据为:"
,
transactionReceiptRecordList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
transactionReceiptRecordList
)){
deleteRedis
(
"exportZipFile"
);
...
...
@@ -355,12 +355,13 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
SFTPUtil
sftpUtil
=
new
SFTPUtil
(
username
,
password
,
host
,
port
);
sftpUtil
.
login
();
log
.
info
(
"uploadFile | 成功连接ftp"
);
String
url
=
kdspOperationUrl
+
"/api/kdsp/op/fa-cui/transaction-proof/query"
;
for
(
TransactionReceiptRecord
record
:
transactionReceiptRecordList
){
Integer
userId
=
record
.
getUserId
();
String
orderNo
=
record
.
getOrderNo
();
String
orderId
=
record
.
getOrderId
();
//调用kdsp接口获取交易凭证订单信息
String
url
=
kdspOperationUrl
+
"/api/kdsp/op/fa-cui/transaction-proof/query"
;
//String url = "http://kdsp-operation-test7.liangkebang.net/api/kdsp/op/fa-cui/transaction-proof/query";
try
{
Map
<
String
,
String
>
header
=
Maps
.
newHashMap
();
header
.
put
(
"Content-type"
,
"application/json"
);
...
...
@@ -412,20 +413,19 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
continue
;
}
TransactionReceiptVO
vo
=
transactionReceiptVOList
.
get
(
0
);
// if(vo.getLogisticsList().size() <= 5) {
// // 物流信息异常
// record.setExportStatus(VoucherExportStatus.EXPORT_WARN.getCode());
// transactionReceiptRecordRepo.save(record);
// continue;
//
// }
if
(
vo
.
getLogisticsList
().
size
()
<=
5
)
{
// 物流信息异常
record
.
setExportStatus
(
VoucherExportStatus
.
EXPORT_WARN
.
getCode
());
transactionReceiptRecordRepo
.
save
(
record
);
continue
;
}
record
.
setExportBatchNo
(
maxExportBatchNo
);
//生成pdf
String
directory
=
record
.
getSerialNo
()+
record
.
getUserName
();
String
pdfFileName
=
record
.
getUserId
()+
"-"
+
record
.
getUserName
()+
"-"
+
record
.
getOrderNo
()+
".pdf"
;
FileToZip
.
mkdir
(
uploadLocalPath
+
directory
);
log
.
info
(
"导出文件生成pdf begin:"
+
pdfFileName
);
generatePDF
(
vo
,
uploadLocalPath
+
"/"
+
directory
+
"/"
+
pdfFileName
);
generatePDF
(
transactionReceiptVOList
.
get
(
0
)
,
uploadLocalPath
+
"/"
+
directory
+
"/"
+
pdfFileName
);
log
.
info
(
"导出文件生成pdf end:"
+
pdfFileName
);
File
file1
=
new
File
(
uploadLocalPath
+
"/"
+
directory
+
"/"
+
pdfFileName
);
InputStream
inputStream
=
new
FileInputStream
(
file1
);
...
...
@@ -449,19 +449,19 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
throw
new
RuntimeException
(
"导出文件出错了"
);
}
}
//
sftpUtil.logout();
sftpUtil
.
logout
();
log
.
info
(
"uploadFile | 断开ftp"
);
log
.
info
(
"[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口end]"
);
if
(!
CollectionUtils
.
isEmpty
(
emailList
)){
//发送邮件通知已经处理完成
log
.
info
(
"[TransactionReceiptRecordServiceImpl.sendCustomerTransactionHtmlMail 发送邮件begin]"
);
sendCustomerTransactionHtmlMail
(
transactionReceiptRecordList
.
size
(),
emailList
.
size
(),
transactionReceiptRecordList
.
size
()-
emailList
.
size
());
log
.
info
(
"[TransactionReceiptRecordServiceImpl.sendCustomerTransactionHtmlMail 发送邮件end]"
);
if
(
CollectionUtils
.
isEmpty
(
emailList
)){
log
.
info
(
"没有签章成功的文件可以发送"
);
deleteRedis
(
"exportZipFile"
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//
throw new RuntimeException("没有签章成功的文件可以发送");
throw
new
RuntimeException
(
"没有签章成功的文件可以发送"
);
}
log
.
info
(
"[TransactionReceiptRecordServiceImpl.sendCustomerTransactionHtmlMail 发送邮件begin]"
);
sendCustomerTransactionHtmlMail
(
transactionReceiptRecordList
.
size
(),
emailList
.
size
(),
transactionReceiptRecordList
.
size
()-
emailList
.
size
());
log
.
info
(
"[TransactionReceiptRecordServiceImpl.sendCustomerTransactionHtmlMail 发送邮件end]"
);
deleteRedis
(
"exportZipFile"
);
}
...
...
@@ -708,8 +708,8 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
if
(
StringUtils
.
isNotBlank
(
orderNo
)){
List
<
TransactionReceiptRecord
>
list
=
transactionReceiptRecordRepo
.
selectRecords
(
orderNo
);
if
(!
list
.
isEmpty
()){
list
.
get
(
0
).
setExportStatus
(
1
);
list
.
get
(
0
).
setSignStatus
(
1
);
list
.
get
(
0
).
setExportStatus
(
VoucherExportStatus
.
EXPORT_SUCCESS
.
getCode
()
);
list
.
get
(
0
).
setSignStatus
(
VoucherExportStatus
.
EXPORT_SUCCESS
.
getCode
()
);
transactionReceiptRecordRepo
.
save
(
list
.
get
(
0
));
}
}
...
...
@@ -722,8 +722,8 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
if
(
StringUtils
.
isNotBlank
(
orderNo
))
{
List
<
TransactionReceiptRecord
>
list
=
transactionReceiptRecordRepo
.
selectRecords
(
orderNo
);
if
(!
list
.
isEmpty
()){
list
.
get
(
0
).
setExportStatus
(
2
);
list
.
get
(
0
).
setSignStatus
(
2
);
list
.
get
(
0
).
setExportStatus
(
VoucherExportStatus
.
EXPORT_FAIL
.
getCode
()
);
list
.
get
(
0
).
setSignStatus
(
VoucherExportStatus
.
EXPORT_FAIL
.
getCode
()
);
transactionReceiptRecordRepo
.
save
(
list
.
get
(
0
));
}
}
...
...
@@ -782,17 +782,24 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
//订单信息
//第一行合并单元格
PdfPCell
cell
;
cell
=
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"订单信息"
),
font
));
// cell = new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("订单信息"), font));
cell
=
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"OrderInfo"
),
font
));
cell
.
setColspan
(
6
);
cell
.
setMinimumHeight
(
18
);
table
.
addCell
(
cell
);
//第二行标题
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"订单ID"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"供应商订单ID"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"供应链订单号"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"商品渠道"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"下单平台"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"平台账号id"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"orderId"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"busId"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"busNo"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"channel"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"saas"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"saasid"
),
font
))).
setMinimumHeight
(
18
);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("订单ID"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("供应商订单ID"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("供应链订单号"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("商品渠道"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("下单平台"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("平台账号id"), font))).setMinimumHeight(18);
//第三行数据iTextITextPDFUtil.
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
StringUtils
.
isEmpty
(
orderVO
.
getOrderNo
())?
"/"
:
orderVO
.
getOrderNo
()),
font
))).
setMinimumHeight
(
18
);
...
...
@@ -804,12 +811,18 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
//第4行标题iTextITextPDFUtil.
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"平台绑定手机号"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"订单创建时间"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"支付完成时间"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"订单金额"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"实付金额"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"支付方式"
),
font
))).
setMinimumHeight
(
18
);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("平台绑定手机号"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("订单创建时间"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("支付完成时间"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("订单金额"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("实付金额"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("支付方式"), font))).setMinimumHeight(18);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"phone"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"createdat"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"payTime"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"orderamount"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"payamount"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"payType"
),
font
))).
setMinimumHeight
(
18
);
//查询手机号
UserSysResult
<
XUser
>
user
=
userSdk
.
getService
().
findUserByUserId
(
orderVO
.
getUserId
());
//第5行数据
...
...
@@ -825,8 +838,10 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
StringUtils
.
isEmpty
(
orderVO
.
getPayAmount
())?
"/"
:
orderVO
.
getPayAmount
()),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
StringUtils
.
isEmpty
(
orderVO
.
getPayTypeName
())?
"/"
:
orderVO
.
getPayTypeName
()),
font
))).
setMinimumHeight
(
18
);
// 第六行数据
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"享花卡支付"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"其他方式支付"
),
font
))).
setMinimumHeight
(
18
);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("享花卡支付"), font))).setMinimumHeight(18);
// table.addCell(new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("其他方式支付"), font))).setMinimumHeight(18);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"xhkpay"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"otherpay"
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
""
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
""
),
font
))).
setMinimumHeight
(
18
);
table
.
addCell
(
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
""
),
font
))).
setMinimumHeight
(
18
);
...
...
@@ -850,12 +865,14 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
table
=
generateMultiParagraph
(
cell
,
font
,
table
,
logisticsVOList
,
skuVOList
,
receiverVO
,
0
);
}
//贷款信息
cell
=
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"贷款信息"
),
font
));
// cell = new PdfPCell(new Phrase(ITextPDFUtil.getUTF8String("贷款信息"), font));
cell
=
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"dkinfo"
),
font
));
cell
.
setColspan
(
6
);
cell
.
setMinimumHeight
(
18
);
table
.
addCell
(
cell
);
//贷款信息详情
table
.
addCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"合同编号/贷字"
),
font
));
// table.addCell(new Phrase(ITextPDFUtil.getUTF8String("合同编号/贷字"), font));
table
.
addCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
"contractNo"
),
font
));
//todo: 贷款信息只有一个,选择?
if
(
loanVo
!=
null
)
{
cell
=
new
PdfPCell
(
new
Phrase
(
ITextPDFUtil
.
getUTF8String
(
StringUtils
.
isEmpty
(
loanVo
.
getContractNo
())?
""
:
loanVo
.
getContractNo
()),
font
));
...
...
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