From 70a39b9dcd01b8f50ee75e5078285e2ae7dba4f1 Mon Sep 17 00:00:00 2001 From: wangrangrang Date: Fri, 28 Jul 2023 14:09:12 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E7=9A=84=E8=AE=B0=E5=BD=95=E6=B6=88=E6=81=AF=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PushInvoiceServiceImpl.java | 25 ++++++++++--------- .../service/impl/InvoicePushServiceImpl.java | 6 ++--- 2 files changed, 16 insertions(+), 15 deletions(-) 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 9b5fa69f..25d06e17 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 @@ -382,7 +382,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { pushInfoRecord.setResult(result); pushInfoRecord.setCreateTime(new Date()); if(pushInfoRecordId!=null){ - pushInfoRecordMapper.updateByPrimaryKeySelective(pushInfoRecord); + pushInfoRecordMapper.updateByPrimaryKey(pushInfoRecord); }else { pushInfoRecordMapper.insert(pushInfoRecord); } @@ -407,7 +407,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { pushInfoRecord.setFailReason(failReason); pushInfoRecord.setCreateTime(new Date()); if(pushInfoRecordId!=null){ - pushInfoRecordMapper.updateByPrimaryKeySelective(pushInfoRecord); + pushInfoRecordMapper.updateByPrimaryKey(pushInfoRecord); }else { pushInfoRecordMapper.insert(pushInfoRecord); } @@ -459,7 +459,6 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { } pushUrl = pushInfo.getPushUrl(); //按照接口类型获取对应的报文数据 - //推送影像系统 String content = getPushContent(fpTsMqData, pushInfo, shList); if (StrUtil.isBlank(content)) { String error=String.format("税号:%s,组装请求报文为空,不进行推送数据",fpTsMqData.getNsrsbh()); @@ -471,12 +470,12 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { //推送影像系统 sendImageSys(content,fpTsMqData.getPushType(),pushInfo); } catch (Exception e) { - String error=String.format("影像推送出现异常%s,推送类型%s",e.getMessage(),fpTsMqData.getPushType()); + 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,JsonUtils.getInstance().toJsonString(fpTsMqData),error,error,pushInfo,fpTsMqData.getPushType()); + pushInfo1.setByzd1("YXXT"); + failPush(null,JsonUtils.getInstance().toJsonString(fpTsMqData),error,e.getMessage(),pushInfo1,fpTsMqData.getPushType()); e.printStackTrace(); } OrderProcessInfo orderProcessInfo = null; @@ -649,20 +648,22 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { } } catch (Exception e) { //多路径推送,返回数据异常后继续推送 - log.error("{}推送企业异常,异常信息:{}", LOGGER_MSG, e); + String error=String.format("%s推送企业异常,异常信息:%s",LOGGER_MSG,e); + log.error(error); errorMsg = e.getMessage(); r = processPushFail(fpTsMqData, pushUrl, errorMsg, shList); sendPushDelay = true; - failPush(null,JsonUtils.getInstance().toJsonString(fpTsMqData),errorMsg,errorMsg,pushInfo,fpTsMqData.getPushType()); + failPush(null,JsonUtils.getInstance().toJsonString(fpTsMqData),error,errorMsg,pushInfo,fpTsMqData.getPushType()); } } } catch (Exception e) { - log.error("{}推送异常,异常信息:{}", LOGGER_MSG, e); + String error=String.format("%s推送异常,异常信息:%s",LOGGER_MSG,e); + log.error(error); errorMsg = e.getMessage(); r = processPushFail(fpTsMqData, pushUrl, errorMsg, shList); sendPushDelay = true; - failPush(null,JsonUtils.getInstance().toJsonString(fpTsMqData),errorMsg,errorMsg,null,fpTsMqData.getPushType()); + failPush(null,JsonUtils.getInstance().toJsonString(fpTsMqData),error,errorMsg,null,fpTsMqData.getPushType()); } //如果需要放入延时队列需要存入队列中 if (sendPushDelay) { @@ -674,7 +675,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { public void sendImageSys(String content, String pushType, PushInfo pushInfo){ PushInfo pushInfo1 = new PushInfo(); pushInfo1.setId(pushInfo.getId()); - pushInfo1.setByzd1("yxxt"); + pushInfo1.setByzd1("YXXT"); DdfpzxxV5 ddfpzxxV5 = JsonUtils.getInstance().parseObject(content.substring(1,content.length()-1), DdfpzxxV5.class); DdfpxxV5 ddfpxx = ddfpzxxV5.getDDFPXX(); OutputInvoiceRequest outputInvoiceRequest = buildInvoiceRequest(ddfpxx); @@ -719,7 +720,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { String error=String.format("影像系统推送数据异常,%s ,推送类型为%s",e.getMessage(),pushType); log.error(error); e.printStackTrace(); - failPush(null,content,error,error,pushInfo1,pushType); + failPush(null,content,error,e.getMessage(),pushInfo1,pushType); } } diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java index e5bbd0f1..9217a0e7 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java @@ -130,7 +130,7 @@ public class InvoicePushServiceImpl implements InvoicePushService { return r; } //判断是不是影像的推送 - if ("yxxt".equals(pushInfoRecord.getQyType())) { + if ("YXXT".equals(pushInfoRecord.getQyType())) { try { //推送影像系统 pushInvoiceService.sendImageSys(content, fpTsMqData.getPushType(), pushInfo); @@ -138,8 +138,8 @@ public class InvoicePushServiceImpl implements InvoicePushService { } catch (Exception e) { String error = String.format("影像推送出现异常%s,推送类型%s", e.getMessage(), fpTsMqData.getPushType()); log.error(error); - pushInfo.setByzd1("yxxt"); - pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), error, error, pushInfo, fpTsMqData.getPushType()); + pushInfo.setByzd1("YXXT"); + pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), error, e.getMessage(), pushInfo, fpTsMqData.getPushType()); e.printStackTrace(); r.put(OrderManagementConstant.CODE, "9999"); r.put(OrderManagementConstant.ALL_MESSAGE, error); From a4aa182861fb9aaa110ba5949c9c254e9daee277 Mon Sep 17 00:00:00 2001 From: wangrangrang Date: Fri, 28 Jul 2023 15:35:37 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=BD=B1=E5=83=8F?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PushInvoiceServiceImpl.java | 2 +- .../service/impl/InvoicePushServiceImpl.java | 48 ++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) 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 25d06e17..c87fb7c6 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 @@ -475,7 +475,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { PushInfo pushInfo1 = new PushInfo(); pushInfo1.setId(pushInfo.getId()); pushInfo1.setByzd1("YXXT"); - failPush(null,JsonUtils.getInstance().toJsonString(fpTsMqData),error,e.getMessage(),pushInfo1,fpTsMqData.getPushType()); + failPush(null,content,error,e.getMessage(),pushInfo1,fpTsMqData.getPushType()); e.printStackTrace(); } OrderProcessInfo orderProcessInfo = null; diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java index 9217a0e7..e41e4768 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java @@ -87,6 +87,31 @@ public class InvoicePushServiceImpl implements InvoicePushService { r.put(OrderManagementConstant.ALL_MESSAGE, "推送内容为空"); return r; } + + PushInfo pushInfo = new PushInfo(); + //查询推送地址 + pushInfo.setId(pushInfoRecord.getPushInfoId()); + pushInfo = pushInfoMapper.selectByPushInfo(pushInfo); + log.info("查询到的推送地址信息:{}", JsonUtils.getInstance().toJsonString(pushInfo)); + //判断是不是影像的推送 + if ("YXXT".equals(pushInfoRecord.getQyType())) { + String pushType = pushInfoRecord.getInterfacePushType(); + try { + //推送影像系统 + pushInvoiceService.sendImageSys(pushInfoRecord.getPushContent(), pushType, pushInfo); + return r; + } catch (Exception e) { + String error = String.format("影像推送出现异常%s,推送类型%s", e.getMessage(), pushType); + log.error(error); + pushInfo.setByzd1("YXXT"); + pushInvoiceService.failPush(pushInfoRecordId, pushInfoRecord.getPushContent(), error, e.getMessage(), pushInfo, pushType); + e.printStackTrace(); + r.put(OrderManagementConstant.CODE, "9999"); + r.put(OrderManagementConstant.ALL_MESSAGE, error); + return r; + } + } + CommonTsMqData fpTsMqData = JSONObject.parseObject(pushInfoRecord.getPushContent(), CommonTsMqData.class); List shList = new ArrayList<>(); shList.add(fpTsMqData.getNsrsbh()); @@ -94,13 +119,7 @@ public class InvoicePushServiceImpl implements InvoicePushService { String pushUrl = ""; String errorMsg = ""; String xtly = "SAP"; - PushInfo pushInfo = new PushInfo(); try { - //查询推送地址 - pushInfo.setId(pushInfoRecord.getPushInfoId()); - pushInfo = pushInfoMapper.selectByPushInfo(pushInfo); - log.info("查询到的推送地址信息:{}", JsonUtils.getInstance().toJsonString(pushInfo)); - if (pushInfo == null) { log.warn("{}税号:{},推送地址没有配置", LOGGER_MSG, fpTsMqData.getNsrsbh()); String error = "税号:" + fpTsMqData.getNsrsbh() + ",推送地址没有配置"; @@ -129,23 +148,6 @@ public class InvoicePushServiceImpl implements InvoicePushService { r.put(OrderManagementConstant.ALL_MESSAGE, error); return r; } - //判断是不是影像的推送 - if ("YXXT".equals(pushInfoRecord.getQyType())) { - try { - //推送影像系统 - pushInvoiceService.sendImageSys(content, fpTsMqData.getPushType(), pushInfo); - return r; - } catch (Exception e) { - String error = String.format("影像推送出现异常%s,推送类型%s", e.getMessage(), fpTsMqData.getPushType()); - log.error(error); - pushInfo.setByzd1("YXXT"); - pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), error, e.getMessage(), pushInfo, fpTsMqData.getPushType()); - e.printStackTrace(); - r.put(OrderManagementConstant.CODE, "9999"); - r.put(OrderManagementConstant.ALL_MESSAGE, error); - return r; - } - } OrderProcessInfo orderProcessInfo = null; Map requestMap = commonDisposeService.getRequestParameter(pushInfo.getNsrsbh(), pushInfo.getZipCode(), pushInfo.getEncryptCode(), content, pushInfo.getPushUrl(), pushInfo.getInterfaceType(), pushInfo.getVersionIdent()); From b5b8789d8f621e81fd085a020f5c58568eadae71 Mon Sep 17 00:00:00 2001 From: wangrangrang Date: Fri, 28 Jul 2023 15:49:56 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=AE=B0=E5=BD=95id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/manager/service/PushInvoiceService.java | 2 +- .../manager/service/impl/PushInvoiceServiceImpl.java | 12 ++++++------ .../order/service/impl/InvoicePushServiceImpl.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/PushInvoiceService.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/PushInvoiceService.java index afcf99dd..98acdd3c 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/PushInvoiceService.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/PushInvoiceService.java @@ -71,7 +71,7 @@ public interface PushInvoiceService { public R processPushFail(CommonTsMqData commonTsMqData, String pushUrl, String msg, List shList); - public void sendImageSys(String content, String pushType, PushInfo pushInfo); + public void sendImageSys(String content, String pushType, PushInfo pushInfo, Long id); public void successPush(Long pushInfoRecordId,String content,String result,PushInfo pushInfo,String pushtype); 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 c87fb7c6..58d804c4 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,7 +468,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { } try { //推送影像系统 - sendImageSys(content,fpTsMqData.getPushType(),pushInfo); + sendImageSys(content,fpTsMqData.getPushType(),pushInfo, null); } catch (Exception e) { String error=String.format("影像推送出现异常%s,推送类型%s",e,fpTsMqData.getPushType()); log.error(error); @@ -672,7 +672,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { return r; } - public void sendImageSys(String content, String pushType, PushInfo pushInfo){ + public void sendImageSys(String content, String pushType, PushInfo pushInfo, Long id){ PushInfo pushInfo1 = new PushInfo(); pushInfo1.setId(pushInfo.getId()); pushInfo1.setByzd1("YXXT"); @@ -688,7 +688,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { if(!b){ String error=String.format("invoiceNo:%s not eleInvoice do not push",outputInvoiceRequest.getInvoiceList().get(0).getInvoiceNumber()); log.info(error); - failPush(null,content,error,error,pushInfo1,pushType); + failPush(id,content,error,error,pushInfo1,pushType); return; } } @@ -710,17 +710,17 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { String data = jsonObject.getString("data"); if("200".equals(status)){ //成功 - successPush(null,content,data,pushInfo,pushType); + successPush(id,content,data,pushInfo,pushType); }else { //失败 - failPush(null,content,message,data,pushInfo,pushType); + failPush(id,content,message,data,pushInfo,pushType); } //暂时不保存状态 } catch (Exception e) { String error=String.format("影像系统推送数据异常,%s ,推送类型为%s",e.getMessage(),pushType); log.error(error); e.printStackTrace(); - failPush(null,content,error,e.getMessage(),pushInfo1,pushType); + failPush(id,content,error,e.getMessage(),pushInfo1,pushType); } } diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java index e41e4768..936eccbc 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java @@ -98,7 +98,7 @@ public class InvoicePushServiceImpl implements InvoicePushService { String pushType = pushInfoRecord.getInterfacePushType(); try { //推送影像系统 - pushInvoiceService.sendImageSys(pushInfoRecord.getPushContent(), pushType, pushInfo); + pushInvoiceService.sendImageSys(pushInfoRecord.getPushContent(), pushType, pushInfo,pushInfoRecord.getId()); return r; } catch (Exception e) { String error = String.format("影像推送出现异常%s,推送类型%s", e.getMessage(), pushType); From 056c08e83b50177280d6f33581f3bcccd80e58ab Mon Sep 17 00:00:00 2001 From: wangrangrang Date: Fri, 28 Jul 2023 16:03:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/manager/service/PushInvoiceService.java | 2 +- .../manager/service/impl/PushInvoiceServiceImpl.java | 11 +++++++++-- .../order/service/impl/InvoicePushServiceImpl.java | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/PushInvoiceService.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/PushInvoiceService.java index 98acdd3c..9f493fb8 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/PushInvoiceService.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/PushInvoiceService.java @@ -71,7 +71,7 @@ public interface PushInvoiceService { public R processPushFail(CommonTsMqData commonTsMqData, String pushUrl, String msg, List shList); - public void sendImageSys(String content, String pushType, PushInfo pushInfo, Long id); + public R sendImageSys(String content, String pushType, PushInfo pushInfo, Long id); public void successPush(Long pushInfoRecordId,String content,String result,PushInfo pushInfo,String pushtype); 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 58d804c4..8127eda4 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 @@ -672,7 +672,8 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { return r; } - public void sendImageSys(String content, String pushType, PushInfo pushInfo, Long id){ + 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"); @@ -689,7 +690,9 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { 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); - return; + r.put(OrderManagementConstant.CODE, "9999"); + r.put(OrderManagementConstant.ALL_MESSAGE, error); + return r; } } @@ -721,7 +724,11 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { 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; } public static void main(String[] args) { diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java index 936eccbc..f08de92c 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/InvoicePushServiceImpl.java @@ -98,7 +98,7 @@ public class InvoicePushServiceImpl implements InvoicePushService { String pushType = pushInfoRecord.getInterfacePushType(); try { //推送影像系统 - pushInvoiceService.sendImageSys(pushInfoRecord.getPushContent(), pushType, pushInfo,pushInfoRecord.getId()); + r=pushInvoiceService.sendImageSys(pushInfoRecord.getPushContent(), pushType, pushInfo,pushInfoRecord.getId()); return r; } catch (Exception e) { String error = String.format("影像推送出现异常%s,推送类型%s", e.getMessage(), pushType);