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: