|
@@ -48,39 +48,7 @@ public class HuanongServiceImpl implements HuanongService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private RestTemplate restTemplate;
|
|
private RestTemplate restTemplate;
|
|
|
|
|
|
|
|
- @Value("${hn.vin.search.url}")
|
|
|
|
|
- private String hnVinSearchUrl;
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public HttpResult vinQuery(String frameNo) {
|
|
|
|
|
- HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
|
|
- httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
|
- map.put("vin", frameNo);
|
|
|
|
|
- org.springframework.http.HttpEntity<Map<String, Object>> mapHttpEntity = new HttpEntity<>(map, httpHeaders);
|
|
|
|
|
- ResponseEntity<HuanongVinSearchBody> entity = restTemplate.postForEntity(hnVinSearchUrl, mapHttpEntity, HuanongVinSearchBody.class);
|
|
|
|
|
- HuanongVinSearchBody body = entity.getBody();
|
|
|
|
|
- if (body == null) {
|
|
|
|
|
- throw new SystemException("人保请求失败");
|
|
|
|
|
- }
|
|
|
|
|
- List<CarModelDTO> list;
|
|
|
|
|
-
|
|
|
|
|
- if (body.getState() == 1) {
|
|
|
|
|
- HuanongBodyData huanongBodyData = JSONObject.parseObject(body.getData(), HuanongBodyData.class);
|
|
|
|
|
- HuanongCarInfo car = huanongBodyData.getCar();
|
|
|
|
|
- CarModelDTO carModelDTO = HuanongCarInfoConvert.INSTANCE.huanongCar2YonganCar(car);
|
|
|
|
|
- list = new ArrayList<>();
|
|
|
|
|
- list.add(carModelDTO);
|
|
|
|
|
- } else if (body.getState() == 2) {
|
|
|
|
|
- List<HuanongCarInfos> huanongCarInfos = JSONObject.parseArray(body.getData(), HuanongCarInfos.class);
|
|
|
|
|
- list = HuanongCarInfosConvert.INSTANCE.map(huanongCarInfos);
|
|
|
|
|
- } else {
|
|
|
|
|
- logger.info(body.getError());
|
|
|
|
|
- throw new SystemException("没有查询到车型");
|
|
|
|
|
- }
|
|
|
|
|
- return HttpResult.ok(list);
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
//1、登录
|
|
//1、登录
|
|
|
public String login() {
|
|
public String login() {
|