|
|
@@ -112,66 +112,54 @@ public class InsDrivingIntentionInsuranceServiceImpl extends ServiceImpl<InsDriv
|
|
|
*/
|
|
|
@Override
|
|
|
public List<InsDrivingIntentionInsuranceVo> getInsDrivingIntentionInsuranceRule(NoCarInsuranceQueryVo insuranceVo) {
|
|
|
- // 添加平安的驾意险的险种信息 2024-07-18
|
|
|
- PtlAgreement ptlAgreement = ptlAgreementService.getById(insuranceVo.getAgreementId());
|
|
|
//判断是否是平安
|
|
|
- if("PAIC1000000".equals(ptlAgreement.getInsuranceCompanyId())){
|
|
|
- //调用接口返回数据
|
|
|
- // ProductDetailsRequest productDetailsRequest =new ProductDetailsRequest(insuranceVo.getAgreementId(), insuranceVo.getRuleUseNature() ,
|
|
|
- // insuranceVo.getOwnAttribute(), insuranceVo.getRuleSeatNum(), insuranceVo.getTonNumber(),
|
|
|
- // insuranceVo.getIsUseCombine(), insuranceVo.getCimodelclass(),ptlAgreement.getInsuranceCompanyId());
|
|
|
- // List<InsDrivingIntentionInsuranceVo> insDrivingIntentionInsuranceVos = pingAnOrderApiService.productQueryList(productDetailsRequest);
|
|
|
- // return insDrivingIntentionInsuranceVos;
|
|
|
- return null;
|
|
|
- }else{
|
|
|
- LambdaQueryWrapper<PtlAgreementNonCarProductRule> query = new LambdaQueryWrapper<PtlAgreementNonCarProductRule>();
|
|
|
- ProductsType productType = InsuranceRisk.determineInsuranceInformation(insuranceVo.getKind(), insuranceVo.getRisk());
|
|
|
- if(insuranceVo.getCompanyCode() != null){
|
|
|
- List<PtlAgreement> byCompanyCode = ptlAgreementService.getByCompanyCode(insuranceVo.getCompanyCode());
|
|
|
- List<String> collect = byCompanyCode.stream().map(x -> x.getId()).collect(Collectors.toList());
|
|
|
- query.in(PtlAgreementNonCarProductRule::getAgreementId, collect);
|
|
|
- }else {
|
|
|
- PtlAgreement byAgreementIdNew = ptlAgreementService.getByAgreementIdNew(insuranceVo.getAgreementId());
|
|
|
- List<PtlAgreement> byCompanyCode = ptlAgreementService.getByCompanyCode(byAgreementIdNew.getInsuranceCompanyId());
|
|
|
- List<String> collect = byCompanyCode.stream().map(x -> x.getId()).collect(Collectors.toList());
|
|
|
- query.in(PtlAgreementNonCarProductRule::getAgreementId, collect);
|
|
|
- }
|
|
|
- query.le(PtlAgreementNonCarProductRule::getSeatNumMin, insuranceVo.getRuleSeatNum());
|
|
|
- query.ge(PtlAgreementNonCarProductRule::getSeatNumMax, insuranceVo.getRuleSeatNum());
|
|
|
- query.eq(PtlAgreementNonCarProductRule::getUseNature, insuranceVo.getRuleUseNature());
|
|
|
- query.eq(PtlAgreementNonCarProductRule::getProductCode, productType.getCode());
|
|
|
- if(insuranceVo.getRuleThirdPartyInsurance() != null) {
|
|
|
- query.ge(PtlAgreementNonCarProductRule::getThirdPartyLnsuranceMin, insuranceVo.getRuleThirdPartyInsurance());
|
|
|
- query.le(PtlAgreementNonCarProductRule::getThirdPartyLnsuranceMax, insuranceVo.getRuleThirdPartyInsurance());
|
|
|
- }
|
|
|
- query.orderBy(true, true, PtlAgreementNonCarProductRule::getSort);
|
|
|
- List<PtlAgreementNonCarProductRule> list = ptlAgreementNonCarProductRuleService.list(query);
|
|
|
-
|
|
|
- PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insuranceVo.getAgreementId());
|
|
|
- Integer apiType = ptlAgreementAttribution.getApiType();
|
|
|
-
|
|
|
- List<InsDrivingIntentionInsuranceVo> insDrivingIntentionInsuranceVo = getInsDrivingIntentionInsuranceVo(insuranceVo, apiType);
|
|
|
- if(!list.isEmpty()){
|
|
|
- //遍历顶级
|
|
|
- insDrivingIntentionInsuranceVo.stream()
|
|
|
- .filter(item -> item.getProjectCode().toString().equals(list.get(0).getParentId()))
|
|
|
- .findFirst()
|
|
|
- .ifPresent(item -> {
|
|
|
- item.setIsDefault(true);
|
|
|
- item.setQuantity(1);
|
|
|
- });
|
|
|
- //遍历下级
|
|
|
- insDrivingIntentionInsuranceVo.stream()
|
|
|
- .flatMap(item -> item.getChildren().stream())
|
|
|
- .filter(child -> child.getProjectCode().toString().equals(list.get(0).getProductId()))
|
|
|
- .findFirst()
|
|
|
- .ifPresent(child -> {
|
|
|
- child.setIsDefault(true);
|
|
|
- child.setQuantity(1);
|
|
|
- });
|
|
|
- }
|
|
|
- return insDrivingIntentionInsuranceVo;
|
|
|
+ LambdaQueryWrapper<PtlAgreementNonCarProductRule> query = new LambdaQueryWrapper<PtlAgreementNonCarProductRule>();
|
|
|
+ ProductsType productType = InsuranceRisk.determineInsuranceInformation(insuranceVo.getKind(), insuranceVo.getRisk());
|
|
|
+ if(insuranceVo.getCompanyCode() != null){
|
|
|
+ List<PtlAgreement> byCompanyCode = ptlAgreementService.getByCompanyCode(insuranceVo.getCompanyCode());
|
|
|
+ List<String> collect = byCompanyCode.stream().map(PtlAgreement::getId).collect(Collectors.toList());
|
|
|
+ query.in(!collect.isEmpty(), PtlAgreementNonCarProductRule::getAgreementId, collect);
|
|
|
+ }else {
|
|
|
+ PtlAgreement byAgreementIdNew = ptlAgreementService.getByAgreementIdNew(insuranceVo.getAgreementId());
|
|
|
+ List<PtlAgreement> byCompanyCode = ptlAgreementService.getByCompanyCode(byAgreementIdNew.getInsuranceCompanyId());
|
|
|
+ List<String> collect = byCompanyCode.stream().map(PtlAgreement::getId).collect(Collectors.toList());
|
|
|
+ query.in(!collect.isEmpty(), PtlAgreementNonCarProductRule::getAgreementId, collect);
|
|
|
}
|
|
|
+ query.le(PtlAgreementNonCarProductRule::getSeatNumMin, insuranceVo.getRuleSeatNum());
|
|
|
+ query.ge(PtlAgreementNonCarProductRule::getSeatNumMax, insuranceVo.getRuleSeatNum());
|
|
|
+ query.eq(PtlAgreementNonCarProductRule::getUseNature, insuranceVo.getRuleUseNature());
|
|
|
+ query.eq(PtlAgreementNonCarProductRule::getProductCode, productType.getCode());
|
|
|
+ if(insuranceVo.getRuleThirdPartyInsurance() != null) {
|
|
|
+ query.ge(PtlAgreementNonCarProductRule::getThirdPartyLnsuranceMin, insuranceVo.getRuleThirdPartyInsurance());
|
|
|
+ query.le(PtlAgreementNonCarProductRule::getThirdPartyLnsuranceMax, insuranceVo.getRuleThirdPartyInsurance());
|
|
|
+ }
|
|
|
+ query.orderBy(true, true, PtlAgreementNonCarProductRule::getSort);
|
|
|
+ List<PtlAgreementNonCarProductRule> list = ptlAgreementNonCarProductRuleService.list(query);
|
|
|
+
|
|
|
+ PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insuranceVo.getAgreementId());
|
|
|
+ Integer apiType = ptlAgreementAttribution.getApiType();
|
|
|
+
|
|
|
+ List<InsDrivingIntentionInsuranceVo> insDrivingIntentionInsuranceVo = getInsDrivingIntentionInsuranceVo(insuranceVo, apiType);
|
|
|
+ if(!list.isEmpty()){
|
|
|
+ //遍历顶级
|
|
|
+ insDrivingIntentionInsuranceVo.stream()
|
|
|
+ .filter(item -> item.getProjectCode().toString().equals(list.get(0).getParentId()))
|
|
|
+ .findFirst()
|
|
|
+ .ifPresent(item -> {
|
|
|
+ item.setIsDefault(true);
|
|
|
+ item.setQuantity(1);
|
|
|
+ });
|
|
|
+ //遍历下级
|
|
|
+ insDrivingIntentionInsuranceVo.stream()
|
|
|
+ .flatMap(item -> item.getChildren().stream())
|
|
|
+ .filter(child -> child.getProjectCode().toString().equals(list.get(0).getProductId()))
|
|
|
+ .findFirst()
|
|
|
+ .ifPresent(child -> {
|
|
|
+ child.setIsDefault(true);
|
|
|
+ child.setQuantity(1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return insDrivingIntentionInsuranceVo;
|
|
|
}
|
|
|
|
|
|
@Override
|