diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java index 360cd100f..ef75efbee 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java @@ -35,6 +35,7 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -52,12 +53,16 @@ import java.util.*; @Slf4j public class BusinessDocumentOrderApplicationService { - private static final String PUSH_API_URL = "http://10.33.0.100/nagu-erp-api/transfer/pushData"; private static final String API_NAME_I = "saveBill_i"; private static final String API_NAME_E = "saveBill_e"; - private static final String VERIFY = "FuDjK3iuftzwf8kWJ44DDZJ9icZmL9Ee4Valv8Qz6VfsdW60fNEzNSEtrKlUr6OI"; private static final String API_NAME = "billAppModify"; + @Value("${gw.push.url}") + private String pushUrl; + + @Value("${gw.push.verify-key1}") + private String verifyKey; + @@ -279,12 +284,12 @@ public class BusinessDocumentOrderApplicationService { // 7. 调用推送接口 try { CloseableHttpClient httpClient = HttpClients.createDefault(); - HttpPost httpPost = new HttpPost(PUSH_API_URL); + HttpPost httpPost = new HttpPost(pushUrl); StringEntity postingString = new StringEntity(JSONObject.toJSONString(bodyList), "UTF-8"); httpPost.setEntity(postingString); httpPost.setHeader("Content-type", "application/json"); - httpPost.setHeader("verify", VERIFY); + httpPost.setHeader("verify", verifyKey); if ("I".equals(order.getIeType())) { httpPost.setHeader("apiName", API_NAME_I); } else if ("E".equals(order.getIeType())) { @@ -406,12 +411,12 @@ public class BusinessDocumentOrderApplicationService { // 3. 调用推送接口 try { CloseableHttpClient httpClient = HttpClients.createDefault(); - HttpPost httpPost = new HttpPost(PUSH_API_URL); + HttpPost httpPost = new HttpPost(pushUrl); StringEntity postingString = new StringEntity(JSONObject.toJSONString(bodyList), "UTF-8"); httpPost.setEntity(postingString); httpPost.setHeader("Content-type", "application/json"); - httpPost.setHeader("verify", VERIFY); + httpPost.setHeader("verify", verifyKey); httpPost.setHeader("apiName", API_NAME); CloseableHttpResponse response = httpClient.execute(httpPost); diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessPartner/BusinessPartnerApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessPartner/BusinessPartnerApplicationService.java index 5a1433c71..5a7339591 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessPartner/BusinessPartnerApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessPartner/BusinessPartnerApplicationService.java @@ -20,6 +20,7 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -30,10 +31,13 @@ import java.util.*; @Slf4j public class BusinessPartnerApplicationService { - private static final String PUSH_API_URL = "http://10.33.0.100/nagu-erp-api/transfer/pushData"; private static final String API_NAME = "saveCorporation"; - private static final String VERIFY = "ESLuxAmB6VXCgbqP1eFzxTPVRagkQ62BUkfhElrgQ6XmE/g2reHVflY/SiCSU7JD"; + @Value("${gw.push.url}") + private String pushUrl; + + @Value("${gw.push.verify-key2}") + private String verifyKey; @Resource private UserServiceFeign userServiceFeign; @@ -115,12 +119,12 @@ public class BusinessPartnerApplicationService { updatePushStatus(Long.valueOf(businessPartnerDTO.getShipperId()),2,new Date(),pushBy,pushByName); CloseableHttpClient httpClient = HttpClients.createDefault(); - HttpPost httpPost = new HttpPost(PUSH_API_URL); + HttpPost httpPost = new HttpPost(pushUrl); StringEntity postingString = new StringEntity(JSONObject.toJSONString(bodyList),"UTF-8"); httpPost.setEntity(postingString); httpPost.setHeader("Content-type", "application/json"); httpPost.setHeader("apiName", API_NAME); - httpPost.setHeader("verify", VERIFY); + httpPost.setHeader("verify", verifyKey); try{ CloseableHttpResponse response = httpClient.execute(httpPost); String responseString = EntityUtils.toString(response.getEntity()); diff --git a/mhd_oms/src/main/resources/bootstrap.yml b/mhd_oms/src/main/resources/bootstrap.yml index 4fb339508..9185cc5b7 100644 --- a/mhd_oms/src/main/resources/bootstrap.yml +++ b/mhd_oms/src/main/resources/bootstrap.yml @@ -34,4 +34,11 @@ spring: # 锁定server端的配置文件(读取它的配置项) namespace: # 命名空间id group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 - file-extension: yml #默认properties \ No newline at end of file + file-extension: yml #默认properties + +# GW推送配置 +gw: + push: + url: http://10.33.0.100/nagu-erp-api/transfer/pushData + verify-key1: FuDjK3iuftzwf8kWJ44DDZJ9icZmL9Ee4Valv8Qz6VfsdW60fNEzNSEtrKlUr6OI + verify-key2: ESLuxAmB6VXCgbqP1eFzxTPVRagkQ62BUkfhElrgQ6XmE/g2reHVflY/SiCSU7JD \ No newline at end of file