|
|
|
@ -371,6 +371,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void successPush(Long pushInfoRecordId,String content,String result,PushInfo pushInfo,String pushType){ |
|
|
|
|
try { |
|
|
|
|
PushInfoRecord pushInfoRecord = new PushInfoRecord(); |
|
|
|
@ -400,6 +401,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void failPush(Long pushInfoRecordId,String content,String result,String failReason,PushInfo pushInfo,String pushType){ |
|
|
|
|
try { |
|
|
|
|
PushInfoRecord pushInfoRecord = new PushInfoRecord(); |
|
|
|
@ -698,62 +700,66 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public R sendImageSys(String content, String pushType, PushInfo pushInfo, Long id){ |
|
|
|
|
@Override |
|
|
|
|
public R sendImageSys(String content, String pushType, PushInfo pushInfo, Long id) { |
|
|
|
|
R r = new R(); |
|
|
|
|
PushInfo pushInfo1 = new PushInfo(); |
|
|
|
|
pushInfo1.setId(pushInfo.getId()); |
|
|
|
|
pushInfo1.setByzd1("YXXT"); |
|
|
|
|
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){ |
|
|
|
|
String error=String.format("invoiceNo:%s not eleInvoice do not push",outputInvoiceRequest.getInvoiceList().get(0).getInvoiceNumber()); |
|
|
|
|
log.info(error); |
|
|
|
|
failPush(id,content,error,error,pushInfo1,pushType); |
|
|
|
|
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) { |
|
|
|
|
String error = String.format("invoiceNo:%s not eleInvoice do not push", outputInvoiceRequest.getInvoiceList().get(0).getInvoiceNumber()); |
|
|
|
|
log.info(error); |
|
|
|
|
failPush(id, content, error, error, pushInfo1, pushType); |
|
|
|
|
r.put(OrderManagementConstant.CODE, "9999"); |
|
|
|
|
r.put(OrderManagementConstant.ALL_MESSAGE, error); |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
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"); |
|
|
|
|
if ("200".equals(status)) { |
|
|
|
|
//成功
|
|
|
|
|
successPush(id, content, data, pushInfo1, pushType); |
|
|
|
|
} else { |
|
|
|
|
//失败
|
|
|
|
|
failPush(id, content, message, data, pushInfo1, pushType); |
|
|
|
|
} |
|
|
|
|
//暂时不保存状态
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
String error = String.format("影像系统推送数据异常,%s ,推送类型为%s", e.getMessage(), pushType); |
|
|
|
|
log.error(error); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
failPush(id, content, error, e.getMessage(), pushInfo1, pushType); |
|
|
|
|
r.put(OrderManagementConstant.CODE, "9999"); |
|
|
|
|
r.put(OrderManagementConstant.ALL_MESSAGE, error); |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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"); |
|
|
|
|
if("200".equals(status)){ |
|
|
|
|
//成功
|
|
|
|
|
successPush(id,content,data,pushInfo1,pushType); |
|
|
|
|
}else { |
|
|
|
|
//失败
|
|
|
|
|
failPush(id,content,message,data,pushInfo1,pushType); |
|
|
|
|
} |
|
|
|
|
//暂时不保存状态
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
String error=String.format("影像系统推送数据异常,%s ,推送类型为%s",e.getMessage(),pushType); |
|
|
|
|
log.error(error); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
failPush(id,content,error,e.getMessage(),pushInfo1,pushType); |
|
|
|
|
r.put(OrderManagementConstant.CODE, "9999"); |
|
|
|
|
r.put(OrderManagementConstant.ALL_MESSAGE, error); |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1092,6 +1098,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R processPushFail(CommonTsMqData commonTsMqData, String pushUrl, String msg, List<String> shList) { |
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(pushUrl)) { |
|
|
|
@ -1183,6 +1190,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void processPushSuccess(CommonTsMqData commonTsMqData, String s, String version) { |
|
|
|
|
//按照接口类型进行执行不同的业务
|
|
|
|
|
if (OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_1.getKey().equals(commonTsMqData.getPushType())) { |
|
|
|
@ -1407,6 +1415,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
* @return |
|
|
|
|
* @throws OrderReceiveException |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public String getPushContent(CommonTsMqData commonTsMqData, PushInfo pushInfo, List<String> shList) throws OrderReceiveException { |
|
|
|
|
String content = ""; |
|
|
|
|
|
|
|
|
@ -1431,6 +1440,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
return content; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String convertToYwxtParam(CommonTsMqData fpTsMqData,String content){ |
|
|
|
|
String ywxtParam = ""; |
|
|
|
|
|
|
|
|
|