|
|
@@ -7,13 +7,13 @@ import com.uas.eis.config.DonlimConfig;
|
|
|
import com.uas.eis.core.config.SpObserver;
|
|
|
import com.uas.eis.core.support.TokenProperties;
|
|
|
import com.uas.eis.dao.*;
|
|
|
-import com.uas.eis.dto.FindOrderRelationInvoiceDTO;
|
|
|
-import com.uas.eis.dto.FindOrderRelationInvoiceReq;
|
|
|
-import com.uas.eis.dto.FindOrderRelationInvoiceResp;
|
|
|
+import com.uas.eis.dto.*;
|
|
|
import com.uas.eis.service.CommonService;
|
|
|
import com.uas.eis.service.ERPService;
|
|
|
+import com.uas.eis.service.NuoNuoSDKService;
|
|
|
import com.uas.eis.utils.*;
|
|
|
import nuonuo.open.sdk.NNOpenSDK;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* @author koul
|
|
|
@@ -39,6 +41,8 @@ public class ERPServiceImpl implements ERPService {
|
|
|
private DonlimConfig donlimConfig;
|
|
|
@Autowired
|
|
|
private CommonService commonService;
|
|
|
+ @Autowired
|
|
|
+ private NuoNuoSDKService nuoNuoSDKService;
|
|
|
@Override
|
|
|
public Map<String, Object> pushInvoiceOrder(String master, int id) {
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
@@ -293,18 +297,27 @@ public class ERPServiceImpl implements ERPService {
|
|
|
token = obs[2].toString();// 访问令牌
|
|
|
taxnum = obs[3].toString();// 授权企业税号
|
|
|
}
|
|
|
+ Map<String,Object> m = new HashMap<>();
|
|
|
+ m.put("appKey",appKey);
|
|
|
+ m.put("appSecret",appSecret);
|
|
|
+ m.put("token",token);
|
|
|
+ m.put("taxnum",taxnum);
|
|
|
SpObserver.putSp(master);
|
|
|
SqlRowList ioList = baseDao.queryForRowSet("select io_id,io_code from "+master+".invoiceOrder left join "+master+".customer on io_cucode=cu_code " +
|
|
|
" where io_id = "+id);
|
|
|
while(ioList.next()) {
|
|
|
- map = getElecInvoices(appKey,appSecret,token,taxnum,ioList.getGeneralInt("io_id"),ioList.getGeneralString("io_code"));
|
|
|
+ m.put("io_id",ioList.getGeneralInt("io_id"));
|
|
|
+ m.put("io_code",ioList.getGeneralString("io_code"));
|
|
|
+ map = getElecInvoices(m);
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
@Override
|
|
|
- public Map<String, Object> getElecInvoices(String appKey,String appSecret,String token,String taxnum,int ioid,String ioCode){
|
|
|
+ public Map<String, Object> getElecInvoices(Map<String,Object> m){
|
|
|
+ String taxnum = m.get("taxnum").toString();
|
|
|
+ int ioid = Integer.valueOf(m.get("io_id").toString());
|
|
|
+ String ioCode = m.get("io_code").toString();
|
|
|
Map<String, Object> res = new HashMap<String, Object>();
|
|
|
- String url=donlimConfig.getRoute();
|
|
|
String errCode = "-999";
|
|
|
String errMsg = "";
|
|
|
try {
|
|
|
@@ -312,38 +325,41 @@ public class ERPServiceImpl implements ERPService {
|
|
|
FindOrderRelationInvoiceReq foriReq = new FindOrderRelationInvoiceReq();
|
|
|
foriReq.setOriginalOrderNo(ioCode);//订单编号
|
|
|
foriReq.setSaleTaxNum(taxnum);//销方税号
|
|
|
- foriReq.setNeedInvoiceSourceDetail("0");//是否需要发票所来源的订单明细,1-是, 0-否(不填默认 0) 当为0时,将不回传orderDetailCallBackVOS。先默认不需要明细
|
|
|
-
|
|
|
- NNOpenSDK sdk = NNOpenSDK.getIntance();
|
|
|
- String method = "nuonuo.OpeMplatform.findOrderRelationInvoice"; // API方法名
|
|
|
- String content =sdk.convertToUtf8(JSONArray.toJSONString(foriReq));
|
|
|
- String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
|
|
|
- String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
|
|
|
-
|
|
|
- FindOrderRelationInvoiceResp resp = JSON.parseObject(result , new TypeReference<FindOrderRelationInvoiceResp>() {});
|
|
|
+ foriReq.setNeedInvoiceSourceDetail("1");//是否需要发票所来源的订单明细,1-是, 0-否(不填默认 0) 当为0时,将不回传orderDetailCallBackVOS。先默认不需要明细
|
|
|
+ FindOrderRelationInvoiceResp resp = nuoNuoSDKService.findOrderRelationInvoice(foriReq,m);
|
|
|
errCode = resp.getStatus();
|
|
|
errMsg = resp.getMessage();
|
|
|
- logger.info("ElecInvoice-DownLoad-master: {} ,id {} status {} message {}",SpObserver.getSp(),ioid,errCode,errMsg);
|
|
|
+ logger.info("ElecI-DownLoad-master: {} ,id {} status {} message {}",SpObserver.getSp(),ioid,errCode,errMsg);
|
|
|
if("0000".equals(errCode)){//调用成功
|
|
|
//记录发票明细
|
|
|
baseDao.execute(getElecInvoicesSqls(ioid,resp.getData()));
|
|
|
+ //红字
|
|
|
commonService.logSRecord("订单关联发票对接",ioid);
|
|
|
}else if(!"8958".equals(errCode)){// {"status":"8958","message":"该订单对应的开票单不存在","data":null} 没有开票单的不记录对接失败日志
|
|
|
- if(errMsg.length() > 3990){
|
|
|
- errMsg = errMsg.substring(0,3990);
|
|
|
+ if(errMsg.length() > 3980){
|
|
|
+ errMsg = errMsg.substring(0,3980);
|
|
|
}
|
|
|
- baseDao.execute("update invoiceOrder set io_errorMsg='"+errMsg+"' where io_id="+ioid);
|
|
|
+ baseDao.execute("update invoiceOrder set io_errorMsg='订单关联发票查询失败: "+errMsg+"' where io_id="+ioid);
|
|
|
commonService.logFRecord("订单关联发票对接","("+errCode+")"+errMsg,ioid);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
errMsg = "发票获取异常";
|
|
|
if(StringUtil.hasText(e.getMessage())){
|
|
|
errMsg = e.getMessage();
|
|
|
}else if(e.getCause()!=null&&StringUtil.hasText(e.getCause().getMessage())){
|
|
|
errMsg = e.getCause().getMessage();
|
|
|
}
|
|
|
+ logger.info("ElecI-DownLoad-master: {} ,id {} message {}",SpObserver.getSp(),ioid,errMsg);
|
|
|
commonService.logFRecord("订单关联发票对接",errMsg.replaceAll("'","''"),ioid);
|
|
|
}
|
|
|
+ //获取红字发票PDF地址
|
|
|
+ List<String> serialNosAll = baseDao.queryForList("select ei_redsid from ElecInvoice " +
|
|
|
+ "where ei_ioid = "+ioid+" and EI_RELATIVEREFNO is not null and ei_redpdfurl is null and nvl(EI_BILLSTATUS,' ') in (' ','01','04')",String.class);
|
|
|
+ if (!CollectionUtil.isEmpty(serialNosAll)){
|
|
|
+ queryRedPdfUrl(serialNosAll,m);
|
|
|
+ }
|
|
|
+// queryRedPdfUrl()
|
|
|
if(StringUtil.hasText(errMsg)&&!"调用成功".equals(errMsg)){
|
|
|
res.put("success", false);
|
|
|
res.put("errCode", errCode);
|
|
|
@@ -353,6 +369,23 @@ public class ERPServiceImpl implements ERPService {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
+ private List<String> getElecInvoicesSqls(int ioid,List<FindOrderRelationInvoiceDTO> data){
|
|
|
+ List<String> sqls = new ArrayList<String>();
|
|
|
+ boolean syncToBillOut = baseDao.isDBSetting("BillOut","syncToBillOut");
|
|
|
+ for (int i = 0; i < data.size(); i++) {
|
|
|
+ FindOrderRelationInvoiceDTO friDto = data.get(i);
|
|
|
+ sqls.addAll(friDto.toMergeSql(ioid,(i+1)));
|
|
|
+ }
|
|
|
+ sqls.add("update invoiceOrder set io_refno = (select (min(ei_refno)||(case when max(ei_refno) <> min(ei_refno) then '-'||max(ei_refno) else '' end)) from ELECINVOICE where ei_ioid = io_id and EI_INVOICETYPE= 1 and nvl(ei_rushredstate,0) <> 1)" +
|
|
|
+ "where io_id = "+ioid);
|
|
|
+ //更新开票记录
|
|
|
+ if(syncToBillOut){
|
|
|
+ sqls.add("update BillOut set bi_refno = (select max(io_refno) from invoiceOrder where io_id = "+ioid+" and io_biid = bi_id) where bi_id in (select io_biid from invoiceOrder where io_id = "+ioid+" and io_refno is not null)");
|
|
|
+ }
|
|
|
+// System.out.println("sqls:");
|
|
|
+// System.out.println(sqls.toString());
|
|
|
+ return sqls;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> rushRed(String master, int id) {
|
|
|
@@ -369,10 +402,18 @@ public class ERPServiceImpl implements ERPService {
|
|
|
token = obs[2].toString();// 访问令牌
|
|
|
taxnum = obs[3].toString();// 授权企业税号
|
|
|
}
|
|
|
+ Map<String,Object> m = new HashMap<>();
|
|
|
+ m.put("appKey",appKey);
|
|
|
+ m.put("appSecret",appSecret);
|
|
|
+ m.put("token",token);
|
|
|
+ m.put("taxnum",taxnum);
|
|
|
logger.info("rushRed begin: master {} ,id {} ",master,id);
|
|
|
SpObserver.putSp(master);
|
|
|
+ StringBuffer errmsg = new StringBuffer();
|
|
|
+ StringBuffer remindmsg = new StringBuffer();
|
|
|
SqlRowList rs_main = baseDao.queryForRowSet("select * from invoiceOrder left join customer on io_cucode=cu_code left join elecinvoice on io_id=ei_ioid where io_id="+id);
|
|
|
if (rs_main.hasNext()){
|
|
|
+ int scount = 0;
|
|
|
while(rs_main.next()){
|
|
|
RedInvoiceReq redInvoiceReq=new RedInvoiceReq();
|
|
|
redInvoiceReq.setBlueInvoiceLine(rs_main.getGeneralString("io_invoiceline"));//蓝票发票种类
|
|
|
@@ -392,55 +433,185 @@ public class ERPServiceImpl implements ERPService {
|
|
|
Object code=res.get("code");
|
|
|
Object describe=res.get("describe");
|
|
|
Object result=res.get("result");
|
|
|
+ logger.info("rushRed master {} ,id {} code {} describe {} applycode {}",master,id,code,describe,result);
|
|
|
if(code !=null && "E0000".equals(code.toString())){//调用成功
|
|
|
baseDao.execute("update elecinvoice set ei_redapplyid='"+result.toString()+"' where ei_id="+rs_main.getGeneralInt("ei_id"));
|
|
|
- queryInvoiceRedConfirm( taxnum, appKey, appSecret, token, url, result.toString());
|
|
|
+ scount++;
|
|
|
commonService.logSRecord("红字确认单申请("+rs_main.getGeneralString("ei_refno")+")",id);
|
|
|
}else{
|
|
|
+ //E9755 describe 该发票存在进行中的红字确认单,暂时不能冲红
|
|
|
commonService.logFRecord("红字确认单申请("+rs_main.getGeneralInt("ei_id")+")","("+code+")"+describe,id);
|
|
|
- map.put("success", false);
|
|
|
- map.put("message", "("+code+")"+describe);
|
|
|
- return map;
|
|
|
+ errmsg.append("("+code+")"+describe).append("</br>");
|
|
|
}
|
|
|
- logger.info("rushRed master {} ,id {} code {} describe {} applycode{}",master,id,code,describe,result);
|
|
|
}
|
|
|
- }else{//数据无效
|
|
|
+ //没有自动开红票 但是可以拿状态
|
|
|
+ if(scount > 0){
|
|
|
+ m.put("io_id",id);
|
|
|
+ m.put("ei_id",0);
|
|
|
+ //获取红字确认状态等信息,若自动开票成功,则同时获取红票信息
|
|
|
+ Map<String, Object> mm = queryInvoiceRedConfirm(m);
|
|
|
+ if("false".equals(mm.get("success"))&&StringUtil.hasText(mm.get("errMsg"))){
|
|
|
+ remindmsg.append(mm.get("errMsg"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {//数据无效
|
|
|
logger.info("rushRed err {对接源信息无效} ,master {} , id {} status {} message {}",master,id);
|
|
|
- map.put("success", false);
|
|
|
- map.put("message", "对接源信息无效");
|
|
|
+ errmsg.append("对接源信息无效");
|
|
|
return map;
|
|
|
}
|
|
|
- map.put("success", true);
|
|
|
+ if(errmsg.length()>0){
|
|
|
+ map.put("success", false);
|
|
|
+ if(remindmsg.length()>0){
|
|
|
+ errmsg.append(remindmsg.toString());
|
|
|
+ }
|
|
|
+ map.put("message", errmsg.toString());
|
|
|
+ }else {
|
|
|
+ map.put("success", true);
|
|
|
+ if(remindmsg.length()>0){
|
|
|
+ map.put("message", remindmsg.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
return map;
|
|
|
}
|
|
|
-
|
|
|
+ /*
|
|
|
+ 条件:蓝票、有确认单号、待确认或者无需确认的情况下 持续获取红票相关信息
|
|
|
+ 按照红冲确认单查询对应状态
|
|
|
+ 可以查到信息: 确认单状态、开票状态、冲红原因、
|
|
|
+ 若已开票,则自动获取红票 发票号:
|
|
|
+ 冲红原因: 1销货退回 2开票有误 3服务中止 4销售折让
|
|
|
+ */
|
|
|
@Override
|
|
|
- public void queryInvoiceRedConfirm(String taxnum, String appKey, String appSecret, String token,String url,String redApplyId) {
|
|
|
- NNOpenSDK sdk = NNOpenSDK.getIntance();
|
|
|
- String method = "nuonuo.OpeMplatform.queryInvoiceRedConfirm"; // API方法名
|
|
|
- Map<String,String> reqParam=new HashMap<>();
|
|
|
- reqParam.put("identity","0");
|
|
|
- reqParam.put("billId",redApplyId);
|
|
|
- String content=JSONArray.toJSONString(reqParam);
|
|
|
- String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
|
|
|
- String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
|
|
|
- System.out.println(result);
|
|
|
- }
|
|
|
-
|
|
|
- private List<String> getElecInvoicesSqls(int ioid,List<FindOrderRelationInvoiceDTO> data){
|
|
|
- List<String> sqls = new ArrayList<String>();
|
|
|
- boolean syncToBillOut = baseDao.isDBSetting("BillOut","syncToBillOut");
|
|
|
- for (int i = 0; i < data.size(); i++) {
|
|
|
- sqls.add(data.get(i).toMergeSql(ioid,(i+1)));
|
|
|
+ public Map<String, Object> queryInvoiceRedConfirm(Map<String,Object> m) {
|
|
|
+ int ioid = Integer.valueOf(m.get("io_id").toString());
|
|
|
+ int eiid = Integer.valueOf(m.get("ei_id").toString());
|
|
|
+ Map<String, Object> res = new HashMap<String, Object>();
|
|
|
+ StringBuffer errmsg = new StringBuffer();
|
|
|
+ SqlRowList bluePiao = baseDao.queryForRowSet("select ei_id,ei_redapplyid,ei_billStatus,ei_billNo,ei_billUuid,ei_taxExcludedAmount,ei_taxAmount,ei_redReason " +
|
|
|
+ "from elecinvoice " +
|
|
|
+ "where ei_ioid = '"+ioid+"' "+(eiid>0?"and ei_id = "+eiid:"")
|
|
|
+ +" and EI_INVOICETYPE = '1' and ei_redapplyid is not null and EI_RELATIVEREFNO is null and nvl(ei_billStatus,' ') in (' ','01','02','03') " +
|
|
|
+ "order by ei_Detno");
|
|
|
+ if(bluePiao.hasNext()){
|
|
|
+ boolean isRushRedBill = false;
|
|
|
+ while (bluePiao.next()){
|
|
|
+ String redApplyId =bluePiao.getGeneralString("ei_redapplyid");
|
|
|
+ eiid = bluePiao.getGeneralInt("ei_id");
|
|
|
+ m.put("ei_id",eiid);
|
|
|
+ QueryInvoiceRedConfirmReq qircReq = new QueryInvoiceRedConfirmReq();
|
|
|
+ qircReq.setIdentity("0");
|
|
|
+ qircReq.setBillId(redApplyId);
|
|
|
+ String rCode = "-999";
|
|
|
+ String describe = "";
|
|
|
+ String logCode = "发票红字确认状态查询";
|
|
|
+ try {
|
|
|
+ QueryInvoiceRedConfirmResp qircResp = nuoNuoSDKService.queryInvoiceRedConfirm(qircReq,m);
|
|
|
+ rCode = qircResp.getCode();
|
|
|
+ describe = qircResp.getDescribe();
|
|
|
+ logger.info("ElecI-queryInvoiceRedConfirmByCode:master {} ,redApplyid {} rCode {} describe {} total {}",SpObserver.getSp(),redApplyId,rCode,describe,qircResp.getResult().getTotal());
|
|
|
+ if("E0000".equals(rCode)){//调用成功 记录发票明细 1135624457459470336
|
|
|
+ List<String> sqls = new ArrayList<>();
|
|
|
+ List<QueryInvoiceRedConfirmDTO> qircList = qircResp.getResult().getList();
|
|
|
+ for (int i = 0; i < qircList.size(); i++) {
|
|
|
+ QueryInvoiceRedConfirmDTO qircfDTO = qircList.get(i);
|
|
|
+ //先获取红票状态 不一致才更新
|
|
|
+ sqls.add("update elecinvoice set " +
|
|
|
+ "ei_billStatus='"+qircfDTO.getBillStatus()+"' " +
|
|
|
+ ",ei_billNo='"+StringUtil.nvl(qircfDTO.getBillNo(),"")+"' " + //990000008655037292
|
|
|
+ ",ei_billUuid='"+StringUtil.nvl(qircfDTO.getBillUuid(),"")+"' " +
|
|
|
+ ",ei_redsid='"+StringUtil.nvl(qircfDTO.getInvoiceSerialNum(),"")+"' " +
|
|
|
+ ",ei_redorderno='"+StringUtil.nvl(qircfDTO.getOrderNo(),"")+"' " +
|
|
|
+ ",ei_taxExcludedAmount='"+StringUtil.nvl(qircfDTO.getTaxExcludedAmount(),"0")+"' " +
|
|
|
+ ",ei_taxAmount='"+StringUtil.nvl(qircfDTO.getTaxAmount(),"0")+"' " +
|
|
|
+ ",ei_redReason='"+StringUtil.nvl(qircfDTO.getRedReason(),"")+"' " +
|
|
|
+ ",ei_openStatus='"+StringUtil.nvl(qircfDTO.getOpenStatus(),"0")+"' " +
|
|
|
+ " where ei_id = "+eiid);
|
|
|
+ //针对自动开票场景:若开票,则记录红票数据,调用查询接口批量更新
|
|
|
+ if("1".equals(qircfDTO.getOpenStatus())){ //已开具红字发票标记: 1:已开具 0:未开具 //orderNo 20230731182154174492
|
|
|
+ isRushRedBill = true;
|
|
|
+ // serialNos 流水号 -- EI_SID -- invoiceSerialNum ; orderNos 开票单号 --- EI_ORDERNO -- ORDERNO
|
|
|
+ }
|
|
|
+ }
|
|
|
+ baseDao.execute(sqls);
|
|
|
+ describe = "";
|
|
|
+ }else{
|
|
|
+ if(describe.length() > 3980){
|
|
|
+ describe = describe.substring(0,3980);
|
|
|
+ }
|
|
|
+ errmsg.append(describe).append("</br>");
|
|
|
+ baseDao.execute("update elecinvoice set io_errorMsg='"+logCode+": "+describe+"' where ei_id = "+eiid+" ");
|
|
|
+ commonService.logFRecord(logCode,describe,eiid);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ describe = "未知异常";
|
|
|
+ if(StringUtil.hasText(e.getMessage())){
|
|
|
+ describe = e.getMessage();
|
|
|
+ }else if(e.getCause()!=null&&StringUtil.hasText(e.getCause().getMessage())){
|
|
|
+ describe = e.getCause().getMessage();
|
|
|
+ }
|
|
|
+ commonService.logFRecord(logCode,"发票红冲状态查询:"+describe.replaceAll("'","''"),eiid);
|
|
|
+ }
|
|
|
+ if(StringUtil.hasText(describe)){
|
|
|
+ errmsg.append(describe);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(isRushRedBill){
|
|
|
+ Map<String,Object> elM = new HashMap<>();
|
|
|
+ elM.put("appKey",m.get("appKey"));
|
|
|
+ elM.put("appSecret",m.get("appSecret"));
|
|
|
+ elM.put("token",m.get("token"));
|
|
|
+ elM.put("taxnum",m.get("taxnum"));
|
|
|
+ elM.put("io_id",ioid);
|
|
|
+ getElecInvoices(elM);
|
|
|
+ }
|
|
|
}
|
|
|
- sqls.add("update ELECINVOICE set ei_refno = (case when ei_invoiceLine in ('bs','pc','es','ec') then ei_allElectronicInvoiceNumber else ei_invoiceNumber end) " +
|
|
|
- "where ei_ioid = "+ioid+" and EI_INVOICESTATE = 1 and EI_EXCEPTIONMESSAGE is null and (ei_allElectronicInvoiceNumber is not null or ei_invoiceNumber is not null )");
|
|
|
- sqls.add("update invoiceOrder set io_refno = (select (min(ei_refno)||(case when max(ei_refno) <> min(ei_refno) then '-'||max(ei_refno) else '' end)) from ELECINVOICE where ei_ioid = io_id)" +
|
|
|
- "where io_id = "+ioid);
|
|
|
- //更新开票记录
|
|
|
- if(syncToBillOut){
|
|
|
- sqls.add("update BillOut set bi_refno = (select max(io_refno) from invoiceOrder where io_id = "+ioid+" and io_biid = bi_id) where bi_id in (select io_biid from invoiceOrder where io_id = "+ioid+" and io_refno is not null)");
|
|
|
+ if(errmsg.length()>0){
|
|
|
+ res.put("success", false);
|
|
|
+ res.put("errMsg",errmsg.toString());
|
|
|
+ }else {
|
|
|
+ res.put("success", true);
|
|
|
}
|
|
|
- return sqls;
|
|
|
+ return res;
|
|
|
}
|
|
|
+ //根据红票流水号 获取红票号及其他信息
|
|
|
+ public Map<String,Object> queryRedPdfUrl(List<String> serialNosAll,Map<String,Object> m){
|
|
|
+ Map<String,Object> res = new HashMap<>();
|
|
|
+ String describe = "";
|
|
|
+ try {
|
|
|
+ logger.info("ElecI-queryRedPdfUrl:master {} ,serialNosAll {}",SpObserver.getSp(),serialNosAll.toString());
|
|
|
+ List<String> rSql = new ArrayList<String>();
|
|
|
+ if(serialNosAll.size()>0){
|
|
|
+ Stream.iterate(0, n -> n + 1)
|
|
|
+ .limit((int) Math.ceil((double) serialNosAll.size() / 50)).forEach(page -> {
|
|
|
+ List<String> serialNos = serialNosAll.stream().skip(page * 50).limit(50).collect(Collectors.toList());
|
|
|
+ QueryInvoiceResultReq qirReq = new QueryInvoiceResultReq();
|
|
|
+ qirReq.setIsOfferInvoiceDetail("0");
|
|
|
+ qirReq.setSerialNos(serialNos);
|
|
|
+ QueryInvoiceResultResp qirResp = nuoNuoSDKService.queryInvoiceResult(qirReq,m);
|
|
|
+ List<QueryInvoiceResultDTO> list = qirResp.getResult();
|
|
|
+ if(!CollectionUtil.isEmpty(list)){
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ String sql = list.get(i).updatePdfUrlSql();
|
|
|
+ if(!"".equals(sql)){
|
|
|
+ rSql.add(sql);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+// System.out.println("rSql:"+rSql.toString());
|
|
|
+ baseDao.execute(rSql);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ describe = "未知异常";
|
|
|
+ if(StringUtil.hasText(e.getMessage())){
|
|
|
+ describe = e.getMessage();
|
|
|
+ }else if(e.getCause()!=null&&StringUtil.hasText(e.getCause().getMessage())){
|
|
|
+ describe = e.getCause().getMessage();
|
|
|
+ }
|
|
|
+ commonService.logFRecord("查询红票详情",describe.replaceAll("'","''"),0);
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
}
|