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
bc94ff0b
Commit
bc94ff0b
authored
Mar 15, 2022
by
吴琼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
9d2570fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
10 deletions
+37
-10
TransactionReceiptRecordServiceImpl.java
...mer/service/impl/TransactionReceiptRecordServiceImpl.java
+36
-10
MailUtil.java
src/main/java/cn/quantgroup/customer/util/MailUtil.java
+1
-0
No files found.
src/main/java/cn/quantgroup/customer/service/impl/TransactionReceiptRecordServiceImpl.java
View file @
bc94ff0b
...
@@ -343,7 +343,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
...
@@ -343,7 +343,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
if
(
maxExportBatchNo
==
null
||
maxExportBatchNo
==
0
){
if
(
maxExportBatchNo
==
null
||
maxExportBatchNo
==
0
){
maxExportBatchNo
=
1
;
maxExportBatchNo
=
1
;
}
}
maxExportBatchNo
=
maxExportBatchNo
.
intValue
()+
1
;
List
<
Map
<
String
,
Object
>>
emailList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
emailList
=
new
ArrayList
<>();
log
.
info
(
"[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口begin]"
,
System
.
currentTimeMillis
());
log
.
info
(
"[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口begin]"
,
System
.
currentTimeMillis
());
SFTPUtil
sftpUtil
=
new
SFTPUtil
(
username
,
password
,
host
,
port
);
SFTPUtil
sftpUtil
=
new
SFTPUtil
(
username
,
password
,
host
,
port
);
...
@@ -402,10 +402,10 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
...
@@ -402,10 +402,10 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
transactionReceiptRecordRepo
.
save
(
record
);
transactionReceiptRecordRepo
.
save
(
record
);
continue
;
continue
;
}
}
record
.
setExportBatchNo
(
maxExportBatchNo
.
intValue
()+
1
);
record
.
setExportBatchNo
(
maxExportBatchNo
);
//生成pdf
//生成pdf
String
directory
=
record
.
getSerialNo
()+
record
.
getUserName
();
String
directory
=
record
.
getSerialNo
()+
record
.
getUserName
();
String
pdfFileName
=
record
.
getOrderNo
()+
".pdf"
;
String
pdfFileName
=
record
.
get
UserId
()+
"-"
+
record
.
getUserName
()+
"-"
+
record
.
get
OrderNo
()+
".pdf"
;
FileToZip
.
mkdir
(
uploadLocalPath
+
directory
);
FileToZip
.
mkdir
(
uploadLocalPath
+
directory
);
log
.
info
(
"导出文件生成pdf begin:"
+
pdfFileName
);
log
.
info
(
"导出文件生成pdf begin:"
+
pdfFileName
);
generatePDF
(
transactionReceiptVOList
.
get
(
0
),
uploadLocalPath
+
"/"
+
directory
+
"/"
+
pdfFileName
);
generatePDF
(
transactionReceiptVOList
.
get
(
0
),
uploadLocalPath
+
"/"
+
directory
+
"/"
+
pdfFileName
);
...
@@ -435,9 +435,13 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
...
@@ -435,9 +435,13 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
sftpUtil
.
logout
();
sftpUtil
.
logout
();
log
.
info
(
"uploadFile | 断开ftp"
);
log
.
info
(
"uploadFile | 断开ftp"
);
log
.
info
(
"[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口end]"
);
log
.
info
(
"[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口end]"
);
//发送邮件通知已经处理完成
log
.
info
(
"[TransactionReceiptRecordServiceImpl.sendCustomerTransactionHtmlMail 发送邮件begin]"
);
sendCustomerTransactionHtmlMail
(
transactionReceiptRecordList
.
size
(),
emailList
.
size
(),
transactionReceiptRecordList
.
size
()-
emailList
.
size
());
log
.
info
(
"[TransactionReceiptRecordServiceImpl.sendCustomerTransactionHtmlMail 发送邮件end]"
);
deleteRedis
(
"exportZipFile"
);
//将文件分批放入本地
//将文件分批放入本地
log
.
info
(
"下载签章完成的文件 begin"
);
/*
log.info("下载签章完成的文件 begin");
if(CollectionUtils.isEmpty(emailList)){
if(CollectionUtils.isEmpty(emailList)){
log.info("没有签章成功的文件可以发送");
log.info("没有签章成功的文件可以发送");
deleteRedis("exportZipFile");
deleteRedis("exportZipFile");
...
@@ -490,9 +494,9 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
...
@@ -490,9 +494,9 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
//log.info("删除暂存的文件 end");
//log.info("删除暂存的文件 end");
deleteRedis("exportZipFile");
deleteRedis("exportZipFile");
log.info("分批发送邮件end");
log.info("分批发送邮件end");
}
}
*/
deleteRedis
(
"exportZipFile"
);
//
deleteRedis("exportZipFile");
log
.
info
(
"分批发送邮件成功end"
);
//
log.info("分批发送邮件成功end");
}
}
/**
/**
...
@@ -528,6 +532,8 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
...
@@ -528,6 +532,8 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
int
totalLength
=
filepath
.
length
();
int
totalLength
=
filepath
.
length
();
int
length
=
filepath
.
lastIndexOf
(
"/"
);
int
length
=
filepath
.
lastIndexOf
(
"/"
);
String
fileName
=
filepath
.
substring
(
length
+
1
,
totalLength
);
String
fileName
=
filepath
.
substring
(
length
+
1
,
totalLength
);
int
length2
=
fileName
.
lastIndexOf
(
"-"
);
fileName
=
fileName
.
substring
(
length2
+
1
,
fileName
.
length
());
updateSuccessList
.
add
(
fileName
.
substring
(
0
,
fileName
.
indexOf
(
"."
)));
updateSuccessList
.
add
(
fileName
.
substring
(
0
,
fileName
.
indexOf
(
"."
)));
filepath
=
filepath
.
substring
(
0
,
length
+
1
);
filepath
=
filepath
.
substring
(
0
,
length
+
1
);
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
...
@@ -544,11 +550,15 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
...
@@ -544,11 +550,15 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
log
.
info
(
"contractUrl /contract/batch/sign failList,"
+
failList
);
log
.
info
(
"contractUrl /contract/batch/sign failList,"
+
failList
);
List
<
String
>
updateFailList
=
new
ArrayList
<>();
List
<
String
>
updateFailList
=
new
ArrayList
<>();
if
(
failList
!=
null
&&
failList
.
size
()>
0
){
if
(
failList
!=
null
&&
failList
.
size
()>
0
){
//String path = "/result/47/交易凭证/1张三/70454371-张三-1499341519604432896.pdf";
String
path
=
(
String
)
failList
.
get
(
0
);
String
path
=
(
String
)
failList
.
get
(
0
);
int
begin
=
path
.
lastIndexOf
(
"/"
)+
1
;
int
begin
=
path
.
lastIndexOf
(
"/"
)+
1
;
int
end
=
path
.
indexOf
(
"."
);
int
end
=
path
.
indexOf
(
"."
);
path
=
path
.
substring
(
begin
,
end
);
String
fileName
=
path
.
substring
(
begin
,
end
);
updateFailList
.
add
(
path
);
int
totalLength
=
fileName
.
length
();
int
length
=
fileName
.
lastIndexOf
(
"-"
);
fileName
=
fileName
.
substring
(
length
+
1
,
totalLength
);
updateFailList
.
add
(
fileName
);
}
}
//更新导出状态
//更新导出状态
log
.
info
(
"交易凭证导出接口更新导出状态 begin"
);
log
.
info
(
"交易凭证导出接口更新导出状态 begin"
);
...
@@ -1012,6 +1022,22 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
...
@@ -1012,6 +1022,22 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
return
table
;
return
table
;
}
}
/**
*发送一个支持html
*/
public
void
sendCustomerTransactionHtmlMail
(
Integer
total
,
Integer
success
,
Integer
fail
){
SendMailParam
sendMailParam
=
new
SendMailParam
();
sendMailParam
.
setSender
(
sender
);
sendMailParam
.
setReceiver
(
receiver
.
split
(
","
));
sendMailParam
.
setSubject
(
"客服系统交易凭证"
);
sendMailParam
.
setContentText
(
String
.
format
(
"客服系统交易凭证本次总共导出"
)+
total
+
"条数据,导出成功"
+
success
+
"条,导出失败"
+
fail
+
"条"
);
MailUtil
.
sendHtmlMail
(
sendMailParam
);
}
/**
* 发送一个支持html 和 附件 的邮件
* @param inputStreamResource
* @throws RuntimeException
*/
public
void
sendCustomerTransactionMail
(
InputStreamResource
inputStreamResource
)
throws
RuntimeException
{
public
void
sendCustomerTransactionMail
(
InputStreamResource
inputStreamResource
)
throws
RuntimeException
{
try
{
try
{
//FileInputStream is = new FileInputStream("D:\\tmp1\\交易凭证.zip");
//FileInputStream is = new FileInputStream("D:\\tmp1\\交易凭证.zip");
...
...
src/main/java/cn/quantgroup/customer/util/MailUtil.java
View file @
bc94ff0b
...
@@ -77,6 +77,7 @@ public class MailUtil implements Serializable {
...
@@ -77,6 +77,7 @@ public class MailUtil implements Serializable {
mailSender
.
send
(
mimeMessage
);
mailSender
.
send
(
mimeMessage
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"[MailUtilSendMail] 邮件发送失败。"
,
e
);
logger
.
error
(
"[MailUtilSendMail] 邮件发送失败。"
,
e
);
throw
new
RuntimeException
(
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