From 6a3d9113f6d0d3386509b8f39f2f989f977cd1f6 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Thu, 3 Aug 2023 16:43:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8F=91=E7=A5=A8=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E5=AE=9E=E6=97=B6=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/glxp/api/constant/SocketMsgType.java | 6 ++---- .../glxp/api/http/sync/SpGetHttpClient.java | 11 ++++++++++ .../api/service/sync/SocketMsgService.java | 20 ++++++++++++++++++- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/glxp/api/constant/SocketMsgType.java b/src/main/java/com/glxp/api/constant/SocketMsgType.java index d259b0b47..3ed283034 100644 --- a/src/main/java/com/glxp/api/constant/SocketMsgType.java +++ b/src/main/java/com/glxp/api/constant/SocketMsgType.java @@ -2,15 +2,13 @@ package com.glxp.api.constant; public interface SocketMsgType { - - String DL_ALL_DATA = "DL_ALL_DATA"; //生产入库 + String DL_ALL_DATA = "DL_ALL_DATA"; //基础数据同步 String DL_NOTICE = "DL_NOTICE"; //通知类消息 - /** * 任务类型 */ - String TASK_INVOICE_CONFIRM = "TASK_INVOICE_CONFIRM"; //发票确认 + } diff --git a/src/main/java/com/glxp/api/http/sync/SpGetHttpClient.java b/src/main/java/com/glxp/api/http/sync/SpGetHttpClient.java index 1494dcf37..ae7fa2c89 100644 --- a/src/main/java/com/glxp/api/http/sync/SpGetHttpClient.java +++ b/src/main/java/com/glxp/api/http/sync/SpGetHttpClient.java @@ -182,6 +182,17 @@ public class SpGetHttpClient { return response; } + public BaseResponse getOrderByBillNo(String billNo) { + + + List header = (List) Convert.toList(buildHeader()); + String result = okHttpCli.doGet(getIpUrl() + "/directToSpms" + "/udiwms/inout/order/findByBillNo/" + "?billNo=" + billNo, Convert.toStrArray(header)); + BaseResponse response = + JSONObject.parseObject(result, new TypeReference>() { + }); + return response; + } + // 最小销售标识获取国家库信息 public BaseResponse> getSyncDi(ProductInfoFilterRequest productInfoFilterRequest) { diff --git a/src/main/java/com/glxp/api/service/sync/SocketMsgService.java b/src/main/java/com/glxp/api/service/sync/SocketMsgService.java index 9c9b5f6c0..a6b818701 100644 --- a/src/main/java/com/glxp/api/service/sync/SocketMsgService.java +++ b/src/main/java/com/glxp/api/service/sync/SocketMsgService.java @@ -3,9 +3,14 @@ package com.glxp.api.service.sync; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.constant.SocketMsgType; +import com.glxp.api.dao.inout.IoOrderDao; +import com.glxp.api.entity.inout.IoOrderEntity; import com.glxp.api.entity.sync.SocketMsgEntity; +import com.glxp.api.http.sync.SpGetHttpClient; +import com.glxp.api.service.inout.IoOrderService; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -17,6 +22,8 @@ public class SocketMsgService { @Value("${SPMS_WEBSOCKET_TOKEN}") String token; + @Resource + SpGetHttpClient spGetHttpClient; @Async public void dealNoticeMsg(SocketMsgEntity socketMsgEntity) { @@ -33,8 +40,19 @@ public class SocketMsgService { } + @Resource + IoOrderService orderService; + //发票确认 public void invoiceConfirm(SocketMsgEntity socketMsgEntity) { - + String billNo = socketMsgEntity.getContent(); + BaseResponse baseResponse = spGetHttpClient.getOrderByBillNo(billNo); + if (baseResponse != null && baseResponse.getCode() == 20000) { + IoOrderEntity orderEntity = baseResponse.getData(); + IoOrderEntity updateEntity = new IoOrderEntity(); + updateEntity.setBillNo(orderEntity.getBillNo()); + updateEntity.setCheckStatus(orderEntity.getCheckStatus()); + orderService.updateByBillNo(updateEntity); + } } }