Commit b8e2698f604ae25ff388267e96ca553875e52516
1 parent
84cea4d5
报备登记-服务投诉系统URL放到配置文件;
Showing
4 changed files
with
12 additions
and
4 deletions
src/main/java/com/bsth/controller/realcontrol/ReportRegisterController.java
| ... | ... | @@ -10,6 +10,7 @@ import com.bsth.util.HttpClientUtils; |
| 10 | 10 | import org.slf4j.Logger; |
| 11 | 11 | import org.slf4j.LoggerFactory; |
| 12 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | +import org.springframework.beans.factory.annotation.Value; | |
| 13 | 14 | import org.springframework.beans.propertyeditors.CustomDateEditor; |
| 14 | 15 | import org.springframework.web.bind.WebDataBinder; |
| 15 | 16 | import org.springframework.web.bind.annotation.InitBinder; |
| ... | ... | @@ -36,9 +37,11 @@ public class ReportRegisterController extends BaseController<ReportRegister, Lon |
| 36 | 37 | |
| 37 | 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 | 41 | // final static String url = "http://114.80.178.13/complaint/TsReport/input.do"; |
| 41 | 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 | 46 | @Autowired |
| 44 | 47 | ReportRegisterService reportRegisterService; |
| ... | ... | @@ -69,7 +72,7 @@ public class ReportRegisterController extends BaseController<ReportRegister, Lon |
| 69 | 72 | // map = baseService.delete(id); |
| 70 | 73 | reportRegisterService.deleteInfo(t); |
| 71 | 74 | String data = "{ID:'"+t.getID()+"', STATUS:'2'}"; |
| 72 | - StringBuilder sb = HttpClientUtils.post(url,data); | |
| 75 | + StringBuilder sb = HttpClientUtils.post(url, data); | |
| 73 | 76 | JSONObject obj = JSON.parseObject(sb.toString()); |
| 74 | 77 | map.put("status2", obj); |
| 75 | 78 | } catch (Exception e) { |
| ... | ... | @@ -86,7 +89,7 @@ public class ReportRegisterController extends BaseController<ReportRegister, Lon |
| 86 | 89 | reportRegisterService.save(t); |
| 87 | 90 | map.put("status", ResponseCode.SUCCESS); |
| 88 | 91 | map.put("t", t); |
| 89 | - StringBuilder sb = HttpClientUtils.post(url,t.toString()); | |
| 92 | + StringBuilder sb = HttpClientUtils.post(url, t.toString()); | |
| 90 | 93 | JSONObject obj = JSON.parseObject(sb.toString()); |
| 91 | 94 | map.put("status2", obj); |
| 92 | 95 | } catch (Exception e) { | ... | ... |
src/main/java/com/bsth/util/ReportRegisterHTTPUtil.java
| ... | ... | @@ -24,7 +24,8 @@ public class ReportRegisterHTTPUtil extends HttpServlet { |
| 24 | 24 | //创建默认连接 |
| 25 | 25 | CloseableHttpClient httpClient = HttpClients.createDefault(); |
| 26 | 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 | 30 | CloseableHttpResponse response = httpClient.execute(httpPost); |
| 30 | 31 | int code = response.getStatusLine().getStatusCode(); | ... | ... |
src/main/resources/application-prod.properties
| ... | ... | @@ -44,3 +44,5 @@ baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP |
| 44 | 44 | passengerFlow.url = http://192.168.168.32:9999/images/ |
| 45 | 45 | |
| 46 | 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