|
|
|
@ -613,39 +613,43 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void sendImageSys(String content){ |
|
|
|
|
DdfpzxxV5 ddfpzxxV5 = JsonUtils.getInstance().parseObject(content.substring(1,content.length()-1), DdfpzxxV5.class); |
|
|
|
|
DdfpxxV5 ddfpxx = ddfpzxxV5.getDDFPXX(); |
|
|
|
|
OutputInvoiceRequest outputInvoiceRequest = buildInvoiceRequest(ddfpxx); |
|
|
|
|
if(outputInvoiceRequest.getInvoiceList() != null && outputInvoiceRequest.getInvoiceList().size() > 0){ |
|
|
|
|
String fplxdm = ddfpxx.getFPLXDM(); |
|
|
|
|
boolean b = OrderInfoEnum.ORDER_INVOICE_TYPE_001.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_002.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_026.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_028.getKey().equals(fplxdm); |
|
|
|
|
if(!b){ |
|
|
|
|
log.info("invoiceNo:{} not eleInvoice do not push",outputInvoiceRequest.getInvoiceList().get(0).getInvoiceNumber()); |
|
|
|
|
return; |
|
|
|
|
List<DdfpzxxV5> ddfpzxxV5s = JsonUtils.getInstance().listBeanCopy(content, DdfpzxxV5.class); |
|
|
|
|
//DdfpzxxV5 ddfpzxxV5 = JsonUtils.getInstance().parseObject(content.substring(1,content.length()-1), DdfpzxxV5.class);
|
|
|
|
|
for (DdfpzxxV5 ddfpzxxV5 : ddfpzxxV5s) { |
|
|
|
|
|
|
|
|
|
DdfpxxV5 ddfpxx = ddfpzxxV5.getDDFPXX(); |
|
|
|
|
OutputInvoiceRequest outputInvoiceRequest = buildInvoiceRequest(ddfpxx); |
|
|
|
|
if(outputInvoiceRequest.getInvoiceList() != null && outputInvoiceRequest.getInvoiceList().size() > 0){ |
|
|
|
|
String fplxdm = ddfpxx.getFPLXDM(); |
|
|
|
|
boolean b = OrderInfoEnum.ORDER_INVOICE_TYPE_001.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_002.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_026.getKey().equals(fplxdm) |
|
|
|
|
|| OrderInfoEnum.ORDER_INVOICE_TYPE_028.getKey().equals(fplxdm); |
|
|
|
|
if(!b){ |
|
|
|
|
log.info("invoiceNo:{} not eleInvoice do not push",outputInvoiceRequest.getInvoiceList().get(0).getInvoiceNumber()); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
String md5Encode = MD5.getMd5Encode(outputInvoiceRequest.getBillNum() + invoiceConfig.getSapSalt() ); |
|
|
|
|
Map<String, String> headerMap = Maps.newHashMap(); |
|
|
|
|
headerMap.put("Authorization",md5Encode); |
|
|
|
|
String param = JSONObject.toJSONString(outputInvoiceRequest); |
|
|
|
|
if(StringUtils.isNotBlank(param) && param.length() > 400){ |
|
|
|
|
param = param.substring(0,400); |
|
|
|
|
try { |
|
|
|
|
String md5Encode = MD5.getMd5Encode(outputInvoiceRequest.getBillNum() + invoiceConfig.getSapSalt() ); |
|
|
|
|
Map<String, String> headerMap = Maps.newHashMap(); |
|
|
|
|
headerMap.put("Authorization",md5Encode); |
|
|
|
|
String param = JSONObject.toJSONString(outputInvoiceRequest); |
|
|
|
|
if(StringUtils.isNotBlank(param) && param.length() > 400){ |
|
|
|
|
param = param.substring(0,400); |
|
|
|
|
} |
|
|
|
|
log.info("call image check request url:{},header:{},parameter:{}",invoiceConfig.getSnYxUrl(),JSONObject.toJSONString(headerMap),param); |
|
|
|
|
String body = HttpRequest.post(invoiceConfig.getSnYxUrl()).addHeaders(headerMap).body(JSONObject.toJSONString(outputInvoiceRequest)).timeout(300000).execute().body(); |
|
|
|
|
log.info("call image check return parameter:{}",body); |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(body); |
|
|
|
|
String status = jsonObject.getString("status");//200 成功、 500 失败
|
|
|
|
|
String message = jsonObject.getString("message"); |
|
|
|
|
String data = jsonObject.getString("data"); |
|
|
|
|
//暂时不保存状态
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
log.info("call image check request url:{},header:{},parameter:{}",invoiceConfig.getSnYxUrl(),JSONObject.toJSONString(headerMap),param); |
|
|
|
|
String body = HttpRequest.post(invoiceConfig.getSnYxUrl()).addHeaders(headerMap).body(JSONObject.toJSONString(outputInvoiceRequest)).timeout(300000).execute().body(); |
|
|
|
|
log.info("call image check return parameter:{}",body); |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(body); |
|
|
|
|
String status = jsonObject.getString("status");//200 成功、 500 失败
|
|
|
|
|
String message = jsonObject.getString("message"); |
|
|
|
|
String data = jsonObject.getString("data"); |
|
|
|
|
//暂时不保存状态
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|