|
@@ -286,20 +286,24 @@ public class PtlSchemeSaveVo {
|
|
|
public List<PtlSchemeInsuranceDrivingIntention> getPtlSchemeInsuranceDrivingIntentionList(){
|
|
public List<PtlSchemeInsuranceDrivingIntention> getPtlSchemeInsuranceDrivingIntentionList(){
|
|
|
List<PtlSchemeInsuranceDrivingIntention> ptlSchemeInsuranceDrivingIntentionList = new ArrayList<>();
|
|
List<PtlSchemeInsuranceDrivingIntention> ptlSchemeInsuranceDrivingIntentionList = new ArrayList<>();
|
|
|
for (Scheme scheme : schemeList) {
|
|
for (Scheme scheme : schemeList) {
|
|
|
- // 校验同一方案内驾意险的选中类型:默认选中(1)/强制选中(2)只能出现一种且各最多一条(可选=3)
|
|
|
|
|
- long defaultSelectedCount = scheme.getDrivingList().stream()
|
|
|
|
|
- .filter(drivingIntention -> "1".equals(drivingIntention.getSelectedStatus())).count();
|
|
|
|
|
- long forceSelectedCount = scheme.getDrivingList().stream()
|
|
|
|
|
- .filter(drivingIntention -> "2".equals(drivingIntention.getSelectedStatus())).count();
|
|
|
|
|
- if (defaultSelectedCount > 1) {
|
|
|
|
|
- throw new ValidateException("方案[" + scheme.getSchemeName() + "]中默认选中的驾意险只能有一条");
|
|
|
|
|
- }
|
|
|
|
|
- if (forceSelectedCount > 1) {
|
|
|
|
|
- throw new ValidateException("方案[" + scheme.getSchemeName() + "]中强制选中的驾意险只能有一条");
|
|
|
|
|
- }
|
|
|
|
|
- if (defaultSelectedCount > 0 && forceSelectedCount > 0) {
|
|
|
|
|
- throw new ValidateException("方案[" + scheme.getSchemeName() + "]中默认选中与强制选中的驾意险不能同时存在");
|
|
|
|
|
|
|
+ // 仅自选方案(schemeType 1基础 2自选)才校验驾意险默认/强制选中,基础方案不校验
|
|
|
|
|
+ if ("2".equals(this.schemeType)) {
|
|
|
|
|
+ // 校验同一方案内驾意险的选中类型:默认选中(1)/强制选中(2)只能出现一种且各最多一条(可选=3)
|
|
|
|
|
+ long defaultSelectedCount = scheme.getDrivingList().stream()
|
|
|
|
|
+ .filter(drivingIntention -> "1".equals(drivingIntention.getSelectedStatus())).count();
|
|
|
|
|
+ long forceSelectedCount = scheme.getDrivingList().stream()
|
|
|
|
|
+ .filter(drivingIntention -> "2".equals(drivingIntention.getSelectedStatus())).count();
|
|
|
|
|
+ if (defaultSelectedCount > 1) {
|
|
|
|
|
+ throw new ValidateException("方案[" + scheme.getSchemeName() + "]中默认选中的驾意险只能有一条");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (forceSelectedCount > 1) {
|
|
|
|
|
+ throw new ValidateException("方案[" + scheme.getSchemeName() + "]中强制选中的驾意险只能有一条");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (defaultSelectedCount > 0 && forceSelectedCount > 0) {
|
|
|
|
|
+ throw new ValidateException("方案[" + scheme.getSchemeName() + "]中默认选中与强制选中的驾意险不能同时存在");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
scheme.getDrivingList().forEach(drivingIntention -> {
|
|
scheme.getDrivingList().forEach(drivingIntention -> {
|
|
|
PtlSchemeInsuranceDrivingIntention ptlSchemeInsuranceDrivingIntention = new PtlSchemeInsuranceDrivingIntention();
|
|
PtlSchemeInsuranceDrivingIntention ptlSchemeInsuranceDrivingIntention = new PtlSchemeInsuranceDrivingIntention();
|
|
|
ptlSchemeInsuranceDrivingIntention.setId(IdGenerate.nextId());
|
|
ptlSchemeInsuranceDrivingIntention.setId(IdGenerate.nextId());
|