Commit bc94ff0b authored by 吴琼's avatar 吴琼

修改

parent 9d2570fe
...@@ -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.getUserId()+"-"+record.getUserName()+"-"+record.getOrderNo()+".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");
......
...@@ -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);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment