From d34425f94ae7e832360add218755259c70b7c4a3 Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Tue, 29 Aug 2023 11:14:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=80=E6=9C=AF=E7=9B=91=E7=9D=A3=E5=9B=BD?= =?UTF-8?q?=E7=BD=91=E4=B8=8A=E9=80=81=EF=BC=8C=E7=BD=91=E5=9D=80=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SupvPushGwServiceImpl.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPushGwServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPushGwServiceImpl.java index 6896e5785..a0987d1ca 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPushGwServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPushGwServiceImpl.java @@ -33,6 +33,7 @@ import com.njcn.web.utils.RestTemplateUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.compress.utils.IOUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.FileSystemResource; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; @@ -76,6 +77,10 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { private final UserFeignClient userFeignClient; + @Value("${gw.url}") + private String gwUrl; + + @Override public String pushPlan(List planIds) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); @@ -445,7 +450,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { } } - public static Map send(SendParam param, String url, String serviceName) { + public Map send(SendParam param, String url, String serviceName) { Map map = new LinkedHashMap<>(); ContentBody cb; if (ObjectUtil.isNull(param)) { @@ -484,12 +489,12 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { return map; } - public static String LoginToken() { + public String LoginToken() { String token = null; String clientId = "942a9278671711eda2e10ae0b5517f6c"; String clientSecret = "3Psd2VEhsA3dVsSPHW0ll5r/03kAqlA2P4w2IiWPA8UWSadcX0we2wffjyTUYGsK"; - String userUrl = "http://25.36.214.86:32234/psr-auth/oauth/accessToken?grant_type={grant_type}&client_id={client_id}&client_secret={client_secret}"; + String userUrl = "http://"+gwUrl+"/psr-auth/oauth/accessToken?grant_type={grant_type}&client_id={client_id}&client_secret={client_secret}"; Map map = new HashMap<>(); map.put("grant_type", "credentials"); map.put("client_id", clientId); @@ -533,7 +538,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { //如果需要传递请求参数 可以拼接到请求URL中,或者设置paramsMap参数由SDK内部进行拼接 HttpParameters.Builder builder = HttpParameters.newBuilder(); - builder.requestURL("http://25.36.214.86:32234/CSB/WMCenter/powerQuality/file/create") // 设置请求的URL,可以拼接URL请求参数 + builder.requestURL(url) // 设置请求的URL,可以拼接URL请求参数 .api("zongbuSync") // 设置服务名 .version("1.0.0") // 设置版本号 .method("post") // 设置调用方式, 必须为 post @@ -638,8 +643,8 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { * @param type * @return */ - public static String getUrl(Integer type) { - String url = "http://25.36.214.86:32234/CSB"; + public String getUrl(Integer type) { + String url = "http://"+gwUrl+"/CSB"; switch (type) { case 1: