|
|
@@ -25,10 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -55,6 +52,9 @@ public class PtlOptionalSchemeServiceImpl extends ServiceImpl<PtlOptionalSchemeM
|
|
|
@Autowired
|
|
|
InsDrivingIntentionInsuranceTypeService insDrivingIntentionInsuranceTypeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ InsDrivingIntentionInsuranceService insDrivingIntentionInsuranceService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public boolean addOptionScheme(OptionalSchemeSaveVo optionalSchemeSaveVo) {
|
|
|
@@ -166,8 +166,34 @@ public class PtlOptionalSchemeServiceImpl extends ServiceImpl<PtlOptionalSchemeM
|
|
|
//驾意险
|
|
|
List<PtlOptionalSchemeInsuranceDrivingIntention> drivingIntentions = ptlOptionalSchemeInsuranceDrivingIntentionService.list(new LambdaQueryWrapper<PtlOptionalSchemeInsuranceDrivingIntention>()
|
|
|
.eq(PtlOptionalSchemeInsuranceDrivingIntention::getSchemeId,optionalScheme.getId()));
|
|
|
- List<String> collect = drivingIntentions.stream().map(x -> x.getDrivingIntentionId()).collect(Collectors.toList());
|
|
|
- optionalSchemeSaveVo.setDrvingIntentions(collect);
|
|
|
+ List<OptionalSchemeSaveVo.OptionsSchemeInsurance> collect = new ArrayList<>();
|
|
|
+ Map<String, List<PtlOptionalSchemeInsuranceDrivingIntention>> maps = new HashMap<>();
|
|
|
+ if(drivingIntentions.size() > 0){
|
|
|
+ maps = drivingIntentions.stream().collect(Collectors.groupingBy(PtlOptionalSchemeInsuranceDrivingIntention::getSeatNum));
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Map.Entry<String, List<PtlOptionalSchemeInsuranceDrivingIntention>> entry : maps.entrySet()) {
|
|
|
+ String seatNum = entry.getKey(); // 获取 SeatNum
|
|
|
+ List<PtlOptionalSchemeInsuranceDrivingIntention> intentions = entry.getValue(); // 获取对应的列表
|
|
|
+ OptionalSchemeSaveVo.OptionsSchemeInsurance insruance = new OptionalSchemeSaveVo.OptionsSchemeInsurance();
|
|
|
+ List<OptionalSchemeSaveVo.OptionsSchemeInsurance.IsOptions> isOptions = new ArrayList<>();
|
|
|
+ for (PtlOptionalSchemeInsuranceDrivingIntention x : intentions) {
|
|
|
+ OptionalSchemeSaveVo.OptionsSchemeInsurance.IsOptions isOption = new OptionalSchemeSaveVo.OptionsSchemeInsurance.IsOptions();
|
|
|
+ isOption.setAlias(x.getAlias());
|
|
|
+ isOption.setProjectName(x.getAlias());
|
|
|
+ isOption.setTitle(x.getTitle());
|
|
|
+ isOption.setId(x.getDrivingIntentionId());
|
|
|
+ isOptions.add(isOption);
|
|
|
+ }
|
|
|
+ insruance.setSeatNum(seatNum);
|
|
|
+ insruance.setIsOptions(isOptions);
|
|
|
+ DrivingIntentionQueryVo drivingIntentionQueryVo = new DrivingIntentionQueryVo();
|
|
|
+ drivingIntentionQueryVo.setCompanyId(companyId);
|
|
|
+ insruance.setUndrvingList(insDrivingIntentionInsuranceService.getSchemeDrivingIntentionInsurance(drivingIntentionQueryVo));
|
|
|
+ collect.add(insruance);
|
|
|
+ }
|
|
|
+
|
|
|
+ optionalSchemeSaveVo.setDrvingList(collect);
|
|
|
|
|
|
return optionalSchemeSaveVo;
|
|
|
}
|