|
@@ -2,16 +2,19 @@ package com.jzg.quotation.summary.service.impl;
|
|
|
|
|
|
|
|
import com.jzg.commons.exception.SystemException;
|
|
import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.quotation.commons.constant.enums.base.ApiType;
|
|
import com.jzg.quotation.commons.constant.enums.base.ApiType;
|
|
|
|
|
+import com.jzg.quotation.commons.constant.enums.base.QuoteRuleCategory;
|
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.QuoteResultsVo;
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.QuoteResultsVo;
|
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
|
|
|
import com.jzg.quotation.commons.entity.vo.base.OrderBase;
|
|
import com.jzg.quotation.commons.entity.vo.base.OrderBase;
|
|
|
import com.jzg.quotation.commons.entity.vo.quote.CarInfoVo;
|
|
import com.jzg.quotation.commons.entity.vo.quote.CarInfoVo;
|
|
|
import com.jzg.quotation.commons.entity.vo.quote.KindInfoVo;
|
|
import com.jzg.quotation.commons.entity.vo.quote.KindInfoVo;
|
|
|
import com.jzg.quotation.commons.service.QuotationApiBaseService;
|
|
import com.jzg.quotation.commons.service.QuotationApiBaseService;
|
|
|
|
|
+import com.jzg.quotation.commons.service.QuotationBaseService;
|
|
|
import com.jzg.quotation.commons.service.QuotationCrawlerBaseService;
|
|
import com.jzg.quotation.commons.service.QuotationCrawlerBaseService;
|
|
|
-import com.jzg.quotation.summary.entity.po.QuoteKindMapping;
|
|
|
|
|
|
|
+import com.jzg.quotation.summary.converter.QuoteInfoConverter;
|
|
|
|
|
+import com.jzg.quotation.summary.entity.po.QuoteRuleMapping;
|
|
|
import com.jzg.quotation.summary.service.InsuranceCompanyRequestService;
|
|
import com.jzg.quotation.summary.service.InsuranceCompanyRequestService;
|
|
|
-import com.jzg.quotation.summary.service.QuoteKindMappingService;
|
|
|
|
|
|
|
+import com.jzg.quotation.summary.service.QuoteRuleMappingService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
@@ -27,7 +30,7 @@ import java.util.Map;
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
public class InsuranceCompanyRequestServiceImpl implements InsuranceCompanyRequestService {
|
|
public class InsuranceCompanyRequestServiceImpl implements InsuranceCompanyRequestService {
|
|
|
|
|
|
|
|
- private final QuoteKindMappingService quoteKindMappingService;
|
|
|
|
|
|
|
+ private final QuoteRuleMappingService quoteRuleMappingService;
|
|
|
|
|
|
|
|
private final Map<String, QuotationApiBaseService> quoteApiBaseServiceMap;
|
|
private final Map<String, QuotationApiBaseService> quoteApiBaseServiceMap;
|
|
|
|
|
|
|
@@ -39,45 +42,24 @@ public class InsuranceCompanyRequestServiceImpl implements InsuranceCompanyReque
|
|
|
return input.matches(regex) ? input : input.replaceAll("(?i).*?([A-Z]+).*", "$1");
|
|
return input.matches(regex) ? input : input.replaceAll("(?i).*?([A-Z]+).*", "$1");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
|
|
- String ssss1213SS = extractEnglishChars("SSSS1213SS");
|
|
|
|
|
- String ss120000 = extractEnglishChars("SS120000");
|
|
|
|
|
- String poi789456141 = extractEnglishChars("POI789456141");
|
|
|
|
|
- String poi789456123 = extractEnglishChars("POI789456123");
|
|
|
|
|
- System.out.println(ssss1213SS);
|
|
|
|
|
- System.out.println(ss120000);
|
|
|
|
|
- System.out.println(poi789456141);
|
|
|
|
|
- System.out.println(poi789456123);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ private QuotationBaseService getQuotationBase(int apiType, String insuranceCode) {
|
|
|
|
|
+ if(ApiType.API_1.getCode() == apiType){
|
|
|
|
|
+ return quoteApiBaseServiceMap.get(insuranceCode);
|
|
|
|
|
+ } else if (ApiType.API_2.getCode() == apiType) {
|
|
|
|
|
+ return quotationCrawlerBaseServiceMap.get(insuranceCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ throw new SystemException("");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QuoteResultsVo quote(QuoteVo quoteVo) {
|
|
public QuoteResultsVo quote(QuoteVo quoteVo) {
|
|
|
- CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
|
|
|
OrderBase order = quoteVo.getOrder();
|
|
OrderBase order = quoteVo.getOrder();
|
|
|
String insuranceCompanyCode = order.getInsuranceCompanyCode();
|
|
String insuranceCompanyCode = order.getInsuranceCompanyCode();
|
|
|
String insuranceCode = extractEnglishChars(insuranceCompanyCode);
|
|
String insuranceCode = extractEnglishChars(insuranceCompanyCode);
|
|
|
- Map<String, QuoteKindMapping> quoteKindMappingMap = quoteKindMappingService.getByGroupCode(insuranceCode, "");
|
|
|
|
|
- // 替换保险公司的险种代码
|
|
|
|
|
- List<KindInfoVo> kindInfoVo = quoteVo.getKindInfoVo();
|
|
|
|
|
- kindInfoVo.forEach(kind -> {
|
|
|
|
|
- QuoteKindMapping quoteKindMapping = quoteKindMappingMap.get(kind.getKindCode());
|
|
|
|
|
- kind.setKindCode(quoteKindMapping.getInsuranceCode());
|
|
|
|
|
- kind.setKindName(quoteKindMapping.getInsurance());
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- if(ApiType.API_1.getCode() == order.getApiType()){
|
|
|
|
|
- return quoteApiBaseServiceMap.get(insuranceCode).quote(quoteVo);
|
|
|
|
|
- } else if (ApiType.API_2.getCode() == order.getApiType()) {
|
|
|
|
|
- return quotationCrawlerBaseServiceMap.get(insuranceCode).quote(quoteVo);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- throw new SystemException("");
|
|
|
|
|
|
|
+ Map<String, List<QuoteRuleMapping>> quoteKindMappingMap = quoteRuleMappingService.getByInsuranceCompanyCode(insuranceCode);
|
|
|
|
|
+ QuoteInfoConverter.converterCarInfoVo(quoteVo.getCarInfoVo(), quoteKindMappingMap.get(QuoteRuleCategory.QUOTE_INFO.getCode()));
|
|
|
|
|
+ QuoteInfoConverter.converterKindInfoVo(quoteVo.getKindInfoVo(), quoteKindMappingMap.get(QuoteRuleCategory.KIND.getCode()));
|
|
|
|
|
+ return getQuotationBase(order.getApiType(), insuranceCode).quote(quoteVo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|