|
@@ -1,13 +1,19 @@
|
|
|
package com.ydtech.modules.order.service.impl;
|
|
package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
+import com.ydtech.components.ZhongmeiRequestApiComponents;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.modules.esm.model.InsTaskImage;
|
|
import com.ydtech.modules.esm.model.InsTaskImage;
|
|
|
import com.ydtech.modules.esm.service.InsTaskImageService;
|
|
import com.ydtech.modules.esm.service.InsTaskImageService;
|
|
|
-import com.ydtech.modules.ins.model.InsOrder;
|
|
|
|
|
|
|
+import com.ydtech.modules.ins.model.ya.CarModelDTO;
|
|
|
|
|
+import com.ydtech.modules.order.convert.SimpleStadarCarDTOConvert;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.zm.request.ModelsQueryRequest;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.zm.response.ModelsQueryResponse;
|
|
|
|
|
+import com.ydtech.modules.order.entity.vo.AccidentalDrivingVo;
|
|
|
|
|
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
|
|
+import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
import com.ydtech.modules.order.service.ZhongMeiOrderApiService;
|
|
import com.ydtech.modules.order.service.ZhongMeiOrderApiService;
|
|
@@ -16,13 +22,9 @@ import com.ydtech.utils.HttpsPostUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
import org.springframework.security.core.userdetails.UserDetails;
|
|
import org.springframework.security.core.userdetails.UserDetails;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
|
|
-
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -38,46 +40,35 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
|
|
|
@Value("${ZMIMGUrl}")
|
|
@Value("${ZMIMGUrl}")
|
|
|
private String ZMIMGUrl;
|
|
private String ZMIMGUrl;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private InsOrdersService insOrdersService;
|
|
|
|
|
|
|
+ private final InsOrdersService insOrdersService;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private InsAreaCompanyService insAreaCompanyService;
|
|
|
|
|
|
|
+ private final InsAreaCompanyService insAreaCompanyService;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private InsTaskImageService insTaskImageService;
|
|
|
|
|
|
|
+ private final InsTaskImageService insTaskImageService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private StringRedisTemplate redisTemplate;
|
|
|
|
|
|
|
+ private ZhongmeiRequestApiComponents zhongmeiRequestApiComponents;
|
|
|
|
|
|
|
|
|
|
+ public ZhongMeiOrderApiServiceImpl(InsOrdersService insOrdersService, InsAreaCompanyService insAreaCompanyService, InsTaskImageService insTaskImageService) {
|
|
|
|
|
+ this.insOrdersService = insOrdersService;
|
|
|
|
|
+ this.insAreaCompanyService = insAreaCompanyService;
|
|
|
|
|
+ this.insTaskImageService = insTaskImageService;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public HttpResult modelsQuery(String modelName, HttpServletRequest request) {
|
|
|
|
|
- List<SimpleStadarCarVO> list = null;
|
|
|
|
|
- //获取请求方法名称
|
|
|
|
|
- String file = request.getRequestURI();
|
|
|
|
|
- String method = file.substring(file.lastIndexOf("/") + 1);
|
|
|
|
|
- //获取请求地址
|
|
|
|
|
- String zmUrl = ZMUrl;
|
|
|
|
|
- String url = zmUrl + "ModelsQuery.do";
|
|
|
|
|
- log.info("请求地址为:" + url);
|
|
|
|
|
- ModelsQueryHeadVO record = new ModelsQueryHeadVO();
|
|
|
|
|
- record.setModelName(modelName);
|
|
|
|
|
- HeadVO head = head(method, ZMToken);
|
|
|
|
|
- head.setToken(ZMToken);
|
|
|
|
|
- record.setHead(head);
|
|
|
|
|
- String json = JSON.toJSONString(record);
|
|
|
|
|
- log.info("请求参数为:" + json);
|
|
|
|
|
- String post = HttpsPostUtil.sendPost(url, json);
|
|
|
|
|
- if (!StringUtils.isEmpty(post)) {
|
|
|
|
|
- JSONObject jsonObject = null;
|
|
|
|
|
- jsonObject = JSONObject.parseObject(post);
|
|
|
|
|
- Map<String, Object> map = jsonObject;
|
|
|
|
|
- String simpleStadarCar = map.get("simpleStadarCar").toString();
|
|
|
|
|
- list = JSONObject.parseArray(simpleStadarCar, SimpleStadarCarVO.class);
|
|
|
|
|
- log.info("======车型查询接口返回为===============" + list);
|
|
|
|
|
- }
|
|
|
|
|
- return HttpResult.ok(list);
|
|
|
|
|
|
|
+ public HttpResult modelsQuery(String modelName) {
|
|
|
|
|
+ ModelsQueryRequest modelsQueryResponse = new ModelsQueryRequest();
|
|
|
|
|
+ modelsQueryResponse.setModelName(modelName);
|
|
|
|
|
+ ModelsQueryResponse response = zhongmeiRequestApiComponents.modelQuery(modelsQueryResponse, ModelsQueryResponse.class);
|
|
|
|
|
+ List<ModelsQueryResponse.SimpleStadarCarDTO> simpleStadarCar = response.getSimpleStadarCar();
|
|
|
|
|
+ List<CarModelDTO> map = SimpleStadarCarDTOConvert.INSTANCE.map(simpleStadarCar);
|
|
|
|
|
+ return HttpResult.ok(map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult quote(BaseQuoteInfoVo quoteInfo, BaseQuoteVo<AccidentalDrivingVo> zmQuoteVo) {
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|