Commit b8e2698f604ae25ff388267e96ca553875e52516

Authored by 娄高锋
1 parent 84cea4d5

报备登记-服务投诉系统URL放到配置文件;

src/main/java/com/bsth/controller/realcontrol/ReportRegisterController.java
@@ -10,6 +10,7 @@ import com.bsth.util.HttpClientUtils; @@ -10,6 +10,7 @@ import com.bsth.util.HttpClientUtils;
10 import org.slf4j.Logger; 10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.beans.factory.annotation.Value;
13 import org.springframework.beans.propertyeditors.CustomDateEditor; 14 import org.springframework.beans.propertyeditors.CustomDateEditor;
14 import org.springframework.web.bind.WebDataBinder; 15 import org.springframework.web.bind.WebDataBinder;
15 import org.springframework.web.bind.annotation.InitBinder; 16 import org.springframework.web.bind.annotation.InitBinder;
@@ -36,9 +37,11 @@ public class ReportRegisterController extends BaseController<ReportRegister, Lon @@ -36,9 +37,11 @@ public class ReportRegisterController extends BaseController<ReportRegister, Lon
36 37
37 Logger log = LoggerFactory.getLogger(this.getClass()); 38 Logger log = LoggerFactory.getLogger(this.getClass());
38 39
39 - final static String url = "http://61.171.28.220:8018/complaint/TsReport/input.do"; 40 +// final static String url = "http://61.171.28.220:8018/complaint/TsReport/input.do";
40 // final static String url = "http://114.80.178.13/complaint/TsReport/input.do"; 41 // final static String url = "http://114.80.178.13/complaint/TsReport/input.do";
41 // final static String url = "http://192.168.168.228:8080/complaint/TsReport/input.do"; 42 // final static String url = "http://192.168.168.228:8080/complaint/TsReport/input.do";
  43 + @Value("${report_register.complaint.url}")
  44 + private String url;
42 45
43 @Autowired 46 @Autowired
44 ReportRegisterService reportRegisterService; 47 ReportRegisterService reportRegisterService;
@@ -69,7 +72,7 @@ public class ReportRegisterController extends BaseController<ReportRegister, Lon @@ -69,7 +72,7 @@ public class ReportRegisterController extends BaseController<ReportRegister, Lon
69 // map = baseService.delete(id); 72 // map = baseService.delete(id);
70 reportRegisterService.deleteInfo(t); 73 reportRegisterService.deleteInfo(t);
71 String data = "{ID:'"+t.getID()+"', STATUS:'2'}"; 74 String data = "{ID:'"+t.getID()+"', STATUS:'2'}";
72 - StringBuilder sb = HttpClientUtils.post(url,data); 75 + StringBuilder sb = HttpClientUtils.post(url, data);
73 JSONObject obj = JSON.parseObject(sb.toString()); 76 JSONObject obj = JSON.parseObject(sb.toString());
74 map.put("status2", obj); 77 map.put("status2", obj);
75 } catch (Exception e) { 78 } catch (Exception e) {
@@ -86,7 +89,7 @@ public class ReportRegisterController extends BaseController<ReportRegister, Lon @@ -86,7 +89,7 @@ public class ReportRegisterController extends BaseController<ReportRegister, Lon
86 reportRegisterService.save(t); 89 reportRegisterService.save(t);
87 map.put("status", ResponseCode.SUCCESS); 90 map.put("status", ResponseCode.SUCCESS);
88 map.put("t", t); 91 map.put("t", t);
89 - StringBuilder sb = HttpClientUtils.post(url,t.toString()); 92 + StringBuilder sb = HttpClientUtils.post(url, t.toString());
90 JSONObject obj = JSON.parseObject(sb.toString()); 93 JSONObject obj = JSON.parseObject(sb.toString());
91 map.put("status2", obj); 94 map.put("status2", obj);
92 } catch (Exception e) { 95 } catch (Exception e) {
src/main/java/com/bsth/util/ReportRegisterHTTPUtil.java
@@ -24,7 +24,8 @@ public class ReportRegisterHTTPUtil extends HttpServlet { @@ -24,7 +24,8 @@ public class ReportRegisterHTTPUtil extends HttpServlet {
24 //创建默认连接 24 //创建默认连接
25 CloseableHttpClient httpClient = HttpClients.createDefault(); 25 CloseableHttpClient httpClient = HttpClients.createDefault();
26 //创建HttpGet对象,处理get请求,转发到A站点 26 //创建HttpGet对象,处理get请求,转发到A站点
27 - HttpPost httpPost = new HttpPost("http://114.80.178.13/complaint/TsReport/input.do"); 27 +// HttpPost httpPost = new HttpPost("http://114.80.178.13/complaint/TsReport/input.do");
  28 + HttpPost httpPost = new HttpPost("http://10.10.200.113:8060/complaint/TsReport/input.do");
28 //执行 29 //执行
29 CloseableHttpResponse response = httpClient.execute(httpPost); 30 CloseableHttpResponse response = httpClient.execute(httpPost);
30 int code = response.getStatusLine().getStatusCode(); 31 int code = response.getStatusLine().getStatusCode();
src/main/resources/application-prod.properties
@@ -44,3 +44,5 @@ baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP @@ -44,3 +44,5 @@ baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP
44 passengerFlow.url = http://192.168.168.32:9999/images/ 44 passengerFlow.url = http://192.168.168.32:9999/images/
45 45
46 electricity.importFile.path= /home/control/elecImportFile 46 electricity.importFile.path= /home/control/elecImportFile
  47 +
  48 +report_register.complaint.url= http://10.10.200.113:8060/complaint/TsReport/input.do
src/main/resources/application-test.properties
@@ -44,3 +44,5 @@ baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP @@ -44,3 +44,5 @@ baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP
44 passengerFlow.url = http://127.0.0.1:9999/images/ 44 passengerFlow.url = http://127.0.0.1:9999/images/
45 45
46 electricity.importFile.path= E:/elecImportFile 46 electricity.importFile.path= E:/elecImportFile
  47 +
  48 +report_register.complaint.url= http://192.168.168.172:8080/complaint/TsReport/input.do