diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java index 4fe6ee39..87e9523a 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java @@ -468,6 +468,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { // this.openTextUploadFile(fpTsMqData,shList); //多个地址循环推送 + boolean flag = true; for (PushInfo pushInfo : pushInfoList) { if (StringUtils.isBlank(pushInfo.getPushUrl())) { @@ -485,17 +486,21 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { failPush(null,JsonUtils.getInstance().toJsonString(fpTsMqData),error,error,pushInfo,fpTsMqData.getPushType()); break; } - try { - //推送影像系统 - sendImageSys(content,fpTsMqData.getPushType(),pushInfo, null); - } catch (Exception e) { - String error=String.format("影像推送出现异常%s,推送类型%s",e,fpTsMqData.getPushType()); - log.error(error); - PushInfo pushInfo1 = new PushInfo(); - pushInfo1.setId(pushInfo.getId()); - pushInfo1.setByzd1("YXXT"); - failPush(null,content,error,e.getMessage(),pushInfo1,fpTsMqData.getPushType()); - e.printStackTrace(); + if(flag){ + try { + //推送影像系统 + sendImageSys(content,fpTsMqData.getPushType(),pushInfo, null); + flag = false; + } catch (Exception e) { + flag = false; + String error=String.format("影像推送出现异常%s,推送类型%s",e,fpTsMqData.getPushType()); + log.error(error); + PushInfo pushInfo1 = new PushInfo(); + pushInfo1.setId(pushInfo.getId()); + pushInfo1.setByzd1("YXXT"); + failPush(null,content,error,e.getMessage(),pushInfo1,fpTsMqData.getPushType()); + e.printStackTrace(); + } } OrderProcessInfo orderProcessInfo = null; Map requestMap = commonDisposeService.getRequestParameter(pushInfo.getNsrsbh(), pushInfo.getZipCode(), pushInfo.getEncryptCode(), content, pushInfo.getPushUrl(), pushInfo.getInterfaceType(), pushInfo.getVersionIdent()); @@ -516,6 +521,12 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { // if (param.length() > 500) { // param = param.substring(0, 400); // } + + if (!"SAP".equalsIgnoreCase(pushInfo.getByzd1())){ + log.debug("备用字段1{}",pushInfo.getByzd1()); + log.debug("************非sap推送信息跳过************"); + continue; + } log.info("{}推送企业开始,推送企业url:{},用户:{},密码:{},推送参数:{}", LOGGER_MSG, pushInfo.getPushUrl(),baseServiceConfig.getPoUserName(),baseServiceConfig.getPoPassword(), fptsParam); long startTime = System.currentTimeMillis(); String result = ""; @@ -552,6 +563,9 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)||OrderInfoEnum.SYS_SOURCE_SNYXX.getKey().equals(xtly)) { PoCommonResponseParam poCommonResponseParam = JsonUtils.getInstance().parseObject(result, PoCommonResponseParam.class); EsOutput es_output = poCommonResponseParam.getES_OUTPUT(); + if (es_output == null) { + throw new InterfaceException("500","推送SAP返回报错"); + } String sapkey = es_output.getSAPKEY(); String ztype = es_output.getZTYPE(); String zmessage = es_output.getZMESSAGE(); @@ -617,6 +631,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { processPushSuccess(fpTsMqData, s, pushInfo.getVersionIdent()); successPush(null,JsonUtils.getInstance().toJsonString(fpTsMqData),s,pushInfo,fpTsMqData.getPushType()); + sendPushDelay = false; } else { String error=String.format("推送数据返回的状态结果为失败,信息为:%s",dxhyInterfaceResponse.getReturnMessage()); log.error(error); @@ -679,6 +694,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { //多路径推送,返回数据异常后继续推送 String error=String.format("%s推送企业异常,异常信息:%s",LOGGER_MSG,e); log.error(error); + log.error("堆栈信息打印{}",e); errorMsg = e.getMessage(); r = processPushFail(fpTsMqData, pushUrl, errorMsg, shList); sendPushDelay = true; @@ -689,6 +705,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { } catch (Exception e) { String error=String.format("%s推送异常,异常信息:%s",LOGGER_MSG,e); log.error(error); + log.error("堆栈信息打印{}",e); errorMsg = e.getMessage(); r = processPushFail(fpTsMqData, pushUrl, errorMsg, shList); sendPushDelay = true; @@ -730,11 +747,11 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { Map headerMap = Maps.newHashMap(); headerMap.put("Authorization",md5Encode); String param = JSONObject.toJSONString(outputInvoiceRequest); - if(StringUtils.isNotBlank(param) && param.length() > 400){ - param = param.substring(0,400); - } +// 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(); + String body = HttpRequest.post(invoiceConfig.getSnYxUrl()).contentType("application/json").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 失败 @@ -751,6 +768,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { } catch (Exception e) { String error=String.format("影像系统推送数据异常,%s ,推送类型为%s",e.getMessage(),pushType); log.error(error); + log.error("打印堆栈信息{}",e); e.printStackTrace(); failPush(id,content,error,e.getMessage(),pushInfo1,pushType); return;