|
|
@@ -102,7 +102,6 @@ public class ElecInvoiceTask {
|
|
|
@Scheduled(cron = "0 0/5 * * * ?")
|
|
|
//PDF文件转存 一次转存
|
|
|
public void elecInvoiceAttachSave(){
|
|
|
- long t1 = System.currentTimeMillis();
|
|
|
List<Object[]> obsList=baseDao.getFieldsDatasByCondition("YITOA_DATACENTER.dock_invoice_config",new String[]{"appKey","appSecret","token","taxnum","username"},"1=1");
|
|
|
if(!CollectionUtil.isEmpty(obsList)){
|
|
|
logger.info("ElecInvoice-AttachSave Begin");
|
|
|
@@ -120,13 +119,12 @@ public class ElecInvoiceTask {
|
|
|
logger.info("ElecInvoice-AttachSave: master: {} size: {} ",master,ioList.getResultList().size());
|
|
|
List<Integer> ioids = new ArrayList<>();
|
|
|
while (ioList.next()){
|
|
|
- long tt1 = System.currentTimeMillis();
|
|
|
//下载地址
|
|
|
String fileUrl = ioList.getGeneralString("ei_pdfurl"); // "https://inv.jss.com.cn/fp2/2zpnwyKkdvu9dWzE8BhmSnER0Iux3xQRMLidDJhiIE2PziVXY4lL3k83OsK0K06YctW5cf1FFHxraffj-bf16A.pdf";
|
|
|
// 定义要保存的文件的路径
|
|
|
String fileName = ioList.getGeneralString("ei_refno")+".pdf";//发票号码
|
|
|
String fileBasePath = "C:\\invoice\\"+fileName;//发票号码
|
|
|
- fileBasePath = "\\usr\\local\\uas\\invoice\\"+fileName;//发票号码
|
|
|
+ fileBasePath = "/usr/local/uas/invoice/"+fileName;//发票号码
|
|
|
try {
|
|
|
// 创建URL对象
|
|
|
URL url = new URL(fileUrl);
|
|
|
@@ -157,9 +155,14 @@ public class ElecInvoiceTask {
|
|
|
System.out.println("下载成功");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ String errMsg = "文件转存异常";
|
|
|
+ if(StringUtil.hasText(e.getMessage())){
|
|
|
+ errMsg = e.getMessage();
|
|
|
+ }else if(e.getCause()!=null&&StringUtil.hasText(e.getCause().getMessage())){
|
|
|
+ errMsg = e.getCause().getMessage();
|
|
|
+ }
|
|
|
+ commonService.logFRecord("订单关联发票对接",errMsg.replaceAll("'","''"),ioList.getGeneralInt("ei_id"));
|
|
|
}
|
|
|
- long tt2 = System.currentTimeMillis();
|
|
|
- System.out.println("tt1->tt2: "+(tt2 - tt1));
|
|
|
}
|
|
|
if(ioids.size()>0){
|
|
|
baseDao.execute("update invoiceOrder set io_attach = REPLACE(to_char((select wm_concat(ei_pdfattach) from ELECINVOICE where io_id = ei_ioid)),',','') where io_id in ("+StringUtils.join(ioids.toArray(), ",")+")");
|
|
|
@@ -168,7 +171,5 @@ public class ElecInvoiceTask {
|
|
|
}
|
|
|
logger.info("ElecInvoice-AttachSave End");
|
|
|
}
|
|
|
- long t2 = System.currentTimeMillis();
|
|
|
- System.out.println("t1->t2: "+(t2-t1));
|
|
|
}
|
|
|
}
|