RenbaoRequestComponents.java 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //package com.ydtech.components;
  2. //
  3. //import com.alibaba.fastjson.JSON;
  4. //import com.ydtech.exception.SystemException;
  5. //import lombok.extern.slf4j.Slf4j;
  6. //import org.springframework.beans.factory.annotation.Autowired;
  7. //import org.springframework.beans.factory.annotation.Value;
  8. //import org.springframework.http.*;
  9. //import org.springframework.lang.Nullable;
  10. //import org.springframework.stereotype.Component;
  11. //import org.springframework.web.client.RestTemplate;
  12. //
  13. //@Slf4j
  14. //@Component
  15. //public class RenbaoRequestComponents {
  16. //
  17. // @Autowired
  18. // private RestTemplate restTemplate;
  19. //
  20. // @Value("${rb.quote.url}")
  21. // private String rbQuoteUrl;
  22. //
  23. // @Value("${rb.audit.url}")
  24. // private String rbAuditUrl;
  25. //
  26. // @Value("${rb.car.search.url}")
  27. // private String rbCarSearchUrl;
  28. //
  29. // @Value("${rb.brand.search.url}")
  30. // private String rbBrandSearchUrl;
  31. //
  32. // // @MethodLogAnnotation(title = "报价-请求python")
  33. // public <T, B> B post(String url, String message, @Nullable T requestBody, Class<B> responseType) {
  34. // HttpHeaders httpHeaders = new HttpHeaders();
  35. // httpHeaders.setContentType(MediaType.APPLICATION_JSON);
  36. // HttpEntity<T> yaQuoteInfoVoHttpEntity = new HttpEntity<>(requestBody, httpHeaders);
  37. //
  38. // String request = JSON.toJSONString(requestBody);
  39. // log.info("---------> 请求参数: url {} {}", url, request);
  40. //
  41. // ResponseEntity<B> stringResponseEntity = restTemplate.postForEntity(url, yaQuoteInfoVoHttpEntity, responseType);
  42. // B body = stringResponseEntity.getBody();
  43. // if (body == null) {
  44. // throw new SystemException(message + "接口请求失败");
  45. // }
  46. //
  47. // String response = JSON.toJSONString(body);
  48. // log.info("---------> 响应参数:{}", response);
  49. // return body;
  50. // }
  51. //
  52. // public <T, B> B quote(T t, Class<B> responseType) {
  53. // return post(rbQuoteUrl, "人保报价", t, responseType);
  54. // }
  55. //
  56. // public <T, B> B audit(T t, Class<B> responseType) {
  57. // return post(rbAuditUrl, "人保核保", t, responseType);
  58. // }
  59. //
  60. // public <T, B> B licensePlateQuery(T t, Class<B> responseType) {
  61. // return post(rbCarSearchUrl, "人保车牌号查询车辆信息", t, responseType);
  62. // }
  63. //
  64. // public <T, B> B modelsQuery(T t, Class<B> responseType) {
  65. // return post(rbBrandSearchUrl, "人保车辆查询", t, responseType);
  66. // }
  67. //
  68. //}