gaodd 1 год назад
Родитель
Сommit
21a94820a2

+ 7 - 0
src/main/java/com/chinaitop/depot/DepotKeeperAccountApplication.java

@@ -5,6 +5,8 @@ import org.springframework.boot.SpringApplication;
5 5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
6 6
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 7
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
8
+import org.springframework.context.annotation.Bean;
9
+import org.springframework.web.client.RestTemplate;
8 10
 
9 11
 import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
10 12
 
@@ -17,4 +19,9 @@ public class DepotKeeperAccountApplication {
17 19
 	public static void main(String[] args) {
18 20
 		SpringApplication.run(DepotKeeperAccountApplication.class, args);
19 21
 	}
22
+	
23
+	@Bean
24
+    public RestTemplate restTemplate() {
25
+        return new RestTemplate();
26
+    }
20 27
 }

+ 5 - 6
src/main/java/com/chinaitop/depot/customer/service/impl/BusinessCustomerServiceImpl.java

@@ -7,6 +7,7 @@ import java.util.Map;
7 7
 import javax.annotation.Resource;
8 8
 
9 9
 import org.apache.commons.lang3.StringUtils;
10
+import org.springframework.beans.factory.annotation.Value;
10 11
 import org.springframework.context.annotation.Bean;
11 12
 import org.springframework.stereotype.Service;
12 13
 import org.springframework.util.LinkedMultiValueMap;
@@ -32,10 +33,8 @@ public class BusinessCustomerServiceImpl implements BusinessCustomerService {
32 33
 	@Resource
33 34
     private RestTemplate restTemplate;
34 35
 
35
-    @Bean
36
-    public RestTemplate restTemplate() {
37
-        return new RestTemplate();
38
-    }
36
+	@Value("${jsgjjsjUrl}")
37
+    private String jsgjjsjUrl;
39 38
 	
40 39
 	@Override
41 40
 	public List<BusinessCustomer> queryByExample(BusinessCustomerExample example) {
@@ -208,7 +207,7 @@ public class BusinessCustomerServiceImpl implements BusinessCustomerService {
208 207
    		/**
209 208
             * restTemplate调用
210 209
             */
211
-           String url = "http://localhost:9022/recPublish/sendMessage";//
210
+           //String url = "http://localhost:9022/recPublish/sendMessage";//
212 211
            // 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
213 212
            MultiValueMap<String, Object> sendMap = new LinkedMultiValueMap<>();
214 213
    		//Map<String, Object>  sendMap = new HashMap<String, Object>();
@@ -224,7 +223,7 @@ public class BusinessCustomerServiceImpl implements BusinessCustomerService {
224 223
    		sendMap.add("tableName", tableName);
225 224
    		sendMap.add("orgId",orgId);
226 225
 
227
-          String result = (String) restTemplate.postForObject(url, sendMap, String.class);
226
+          String result = (String) restTemplate.postForObject(jsgjjsjUrl, sendMap, String.class);
228 227
        }
229 228
 
230 229
 }

+ 3 - 1
src/main/resources/bootstrap-dev.yml

@@ -46,4 +46,6 @@ spring:
46 46
 web:
47 47
   upload-path: /home/depot/depot-web/apache-tomcat-8.0.53/webapps/ROOT/WEB-INF/classes/static
48 48
 cxf:
49
-  path: /profitloss
49
+  path: /profitloss
50
+  
51
+jsgjjsjUrl: http://localhost:9022/recPublish/sendMessage

+ 3 - 1
src/main/resources/bootstrap-prod.yml

@@ -46,4 +46,6 @@ spring:
46 46
 web:
47 47
   upload-path: /home/qh/depot/depotImg
48 48
 cxf:
49
-  path: /profitloss
49
+  path: /profitloss
50
+  
51
+jsgjjsjUrl: http://localhost:9022/recPublish/sendMessage