|
|
@@ -247,7 +247,7 @@ public class ElecInvoiceTask {
|
|
|
m.put("taxnum",taxnum);
|
|
|
logger.info("ElecI-redPdfUrlUpdate: master: {} Begin ",master);
|
|
|
SpObserver.putSp(master);
|
|
|
- List<String> serialNosAll = baseDao.queryForList("select ei_redsid from ElecInvoice left join InvoiceOrder on ei_ioid = io_id where io_ordertype=1 and EI_RELATIVEREFNO is not null and ei_redpdfurl is null and nvl(EI_BILLSTATUS,' ') in (' ','01','04')",String.class);
|
|
|
+ List<String> serialNosAll = baseDao.queryForList("select ei_redsid from ElecInvoice left join InvoiceOrder on ei_ioid = io_id where io_ordertype=1 and EI_RELATIVEREFNO is not null and ei_redpdfurl is null and nvl(EI_BILLSTATUS,' ') in (' ','01','04')",String.class);
|
|
|
if (serialNosAll == null){
|
|
|
logger.info("ElecI-redPdfUrlUpdate: master: {} size: {} ",master,0);
|
|
|
}else {
|
|
|
@@ -281,11 +281,15 @@ public class ElecInvoiceTask {
|
|
|
while (ioList.next()){
|
|
|
//下载地址
|
|
|
String fileUrl = ioList.getGeneralString("ei_redpdfurl"); // "https://inv.jss.com.cn/fp2/2zpnwyKkdvu9dWzE8BhmSnER0Iux3xQRMLidDJhiIE2PziVXY4lL3k83OsK0K06YctW5cf1FFHxraffj-bf16A.pdf";
|
|
|
+ String ei_relativerefno = ioList.getGeneralString("ei_relativerefno");
|
|
|
String[] fileUrls = fileUrl.split(",");
|
|
|
+ String[] refnos = ei_relativerefno.split(",");
|
|
|
StringBuffer fIds = new StringBuffer();
|
|
|
- for (String downFileurl:fileUrls) {
|
|
|
+ for (int i = 0; i <fileUrls.length ; i++) {
|
|
|
+ String downFileurl=fileUrls[i];
|
|
|
+ String refno = refnos[i];
|
|
|
// 定义要保存的文件的路径
|
|
|
- String fileName = ioList.getGeneralString("cu_name")+ioList.getGeneralString("ei_relativerefno")+".pdf";//发票号码
|
|
|
+ String fileName = ioList.getGeneralString("cu_name")+refno+".pdf";//发票号码
|
|
|
String fileBasePath = "C:\\invoice\\"+fileName;//发票号码
|
|
|
fileBasePath = String.valueOf(obs[5])+fileName;//发票储存路径
|
|
|
try {
|
|
|
@@ -312,6 +316,8 @@ public class ElecInvoiceTask {
|
|
|
//存文件 filepath
|
|
|
int id = commonService.saveFilePath(fileBasePath, (int) size, fileName, "管理员");
|
|
|
fIds.append(id).append(";");
|
|
|
+ //关联退货单 开票订单信息更新
|
|
|
+ baseDao.execute("update Invoiceorder set io_attach = '"+id+";' where io_ordertype=2 and io_yfphm='"+ioList.getGeneralString("ei_allelectronicinvoicenumber")+"' and io_refno = '"+refno+"'");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
String errMsg = "文件转存异常";
|
|
|
@@ -323,10 +329,8 @@ public class ElecInvoiceTask {
|
|
|
commonService.logFRecord("订单关联发票对接",errMsg.replaceAll("'","''"),ioList.getGeneralInt("ei_id"));
|
|
|
}
|
|
|
}
|
|
|
- baseDao.execute("update ELECINVOICE set ei_redpdfattach = '"+fIds+"' where ei_relativerefno='"+ioList.getGeneralString("ei_relativerefno")+"' and ei_allelectronicinvoicenumber = "+ioList.getGeneralString("ei_allelectronicinvoicenumber"));
|
|
|
- //关联退货单 开票订单信息更新
|
|
|
- baseDao.execute("update Invoiceorder set io_attach = '"+fIds+"' where io_ordertype=2 and io_yfphm='"+ioList.getGeneralString("ei_allelectronicinvoicenumber")+"' and io_refno = '"+ioList.getGeneralString("ei_relativerefno")+"'");
|
|
|
- System.out.println("下载成功");
|
|
|
+ baseDao.execute("update ELECINVOICE set ei_redpdfattach = '"+fIds+"' where ei_relativerefno='"+ei_relativerefno+"' and ei_allelectronicinvoicenumber = "+ioList.getGeneralString("ei_allelectronicinvoicenumber"));
|
|
|
+ System.out.println("下载成功");
|
|
|
}
|
|
|
logger.info("ElecI-AttachSave: master: {} End ",master);
|
|
|
}
|