|
@@ -20,7 +20,6 @@ import com.jzg.commons.entity.agreement.dispatch.vo.PtlAgreementDispatchVo;
|
|
|
import com.jzg.commons.entity.agreement.dispatch.vo.ValidateDispatchRuleVo;
|
|
import com.jzg.commons.entity.agreement.dispatch.vo.ValidateDispatchRuleVo;
|
|
|
import com.jzg.commons.entity.costs.vo.ValidateSchemeRuleVo;
|
|
import com.jzg.commons.entity.costs.vo.ValidateSchemeRuleVo;
|
|
|
import com.jzg.commons.entity.po.*;
|
|
import com.jzg.commons.entity.po.*;
|
|
|
-import com.jzg.commons.entity.po.jyxSetting;
|
|
|
|
|
import com.jzg.commons.entity.quote.vo.CustomerInfoVo;
|
|
import com.jzg.commons.entity.quote.vo.CustomerInfoVo;
|
|
|
import com.jzg.commons.entity.quote.vo.SalespersonInfoVo;
|
|
import com.jzg.commons.entity.quote.vo.SalespersonInfoVo;
|
|
|
import com.jzg.commons.entity.scheme.po.*;
|
|
import com.jzg.commons.entity.scheme.po.*;
|
|
@@ -29,6 +28,7 @@ import com.jzg.commons.entity.vo.CompanyClauseVo;
|
|
|
import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
|
|
import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
|
|
|
import com.jzg.commons.entity.vo.InsCompanyClauseVo;
|
|
import com.jzg.commons.entity.vo.InsCompanyClauseVo;
|
|
|
import com.jzg.commons.exception.NoneException;
|
|
import com.jzg.commons.exception.NoneException;
|
|
|
|
|
+import com.jzg.commons.exception.ValidateException;
|
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
|
import com.jzg.commons.util.MinioUtils;
|
|
import com.jzg.commons.util.MinioUtils;
|
|
|
import com.jzg.commons.util.idgen.IdGenerate;
|
|
import com.jzg.commons.util.idgen.IdGenerate;
|
|
@@ -149,6 +149,8 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
|
|
|
|
|
|
|
|
//驾意险信息
|
|
//驾意险信息
|
|
|
List<PtlSchemeInsuranceDrivingIntention> ptlSchemeInsuranceDrivingIntentionList = ptlSchemeSaveVo.getPtlSchemeInsuranceDrivingIntentionList();
|
|
List<PtlSchemeInsuranceDrivingIntention> ptlSchemeInsuranceDrivingIntentionList = ptlSchemeSaveVo.getPtlSchemeInsuranceDrivingIntentionList();
|
|
|
|
|
+ //校验驾意险座位数范围不可重复
|
|
|
|
|
+ validateDrivingIntentionSeatRange(ptlSchemeInsuranceDrivingIntentionList);
|
|
|
//清空驾意险信息
|
|
//清空驾意险信息
|
|
|
cleanDrivingIntention(ptlSchemeInfoList);
|
|
cleanDrivingIntention(ptlSchemeInfoList);
|
|
|
ptlSchemeInsuranceDrivingIntentionMapper.insertOrUpdate(ptlSchemeInsuranceDrivingIntentionList);
|
|
ptlSchemeInsuranceDrivingIntentionMapper.insertOrUpdate(ptlSchemeInsuranceDrivingIntentionList);
|
|
@@ -175,6 +177,46 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
|
|
|
ptlSchemeInsuranceDrivingIntentionMapper.delete(new LambdaQueryWrapper<PtlSchemeInsuranceDrivingIntention>().in(PtlSchemeInsuranceDrivingIntention::getSchemeInfoId, ids));
|
|
ptlSchemeInsuranceDrivingIntentionMapper.delete(new LambdaQueryWrapper<PtlSchemeInsuranceDrivingIntention>().in(PtlSchemeInsuranceDrivingIntention::getSchemeInfoId, ids));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 校验驾意险座位数范围不可重复
|
|
|
|
|
+ * 两组座位数范围 [a_min, a_max] 和 [b_min, b_max] 存在重叠即判定为重复
|
|
|
|
|
+ * @param drivingIntentionList 驾意险列表
|
|
|
|
|
+ */
|
|
|
|
|
+ private void validateDrivingIntentionSeatRange(List<PtlSchemeInsuranceDrivingIntention> drivingIntentionList) {
|
|
|
|
|
+ if (CollUtil.isEmpty(drivingIntentionList)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ for (int i = 0; i < drivingIntentionList.size(); i++) {
|
|
|
|
|
+ PtlSchemeInsuranceDrivingIntention a = drivingIntentionList.get(i);
|
|
|
|
|
+ Integer aMin = a.getMinSeatCount();
|
|
|
|
|
+ Integer aMax = a.getMaxSeatCount();
|
|
|
|
|
+ for (int j = i + 1; j < drivingIntentionList.size(); j++) {
|
|
|
|
|
+ PtlSchemeInsuranceDrivingIntention b = drivingIntentionList.get(j);
|
|
|
|
|
+ Integer bMin = b.getMinSeatCount();
|
|
|
|
|
+ Integer bMax = b.getMaxSeatCount();
|
|
|
|
|
+
|
|
|
|
|
+ // null 视为无限制:min=null 视为0, max=null 视为∞
|
|
|
|
|
+ boolean overlap = isSeatRangeOverlap(aMin, aMax, bMin, bMax);
|
|
|
|
|
+ if (overlap) {
|
|
|
|
|
+ throw new ValidateException("驾意险座位数范围存在重叠,请检查!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 判断两个座位数范围是否重叠
|
|
|
|
|
+ */
|
|
|
|
|
+ private boolean isSeatRangeOverlap(Integer min1, Integer max1, Integer min2, Integer max2) {
|
|
|
|
|
+ // 有效下界:null 视为 -∞(即不限制下限)
|
|
|
|
|
+ // 有效上界:null 视为 +∞(即不限制上限)
|
|
|
|
|
+ // 不重叠条件:max1 < min2 或 max2 < min1
|
|
|
|
|
+ // 因此重叠条件:!(max1 < min2) && !(max2 < min1)
|
|
|
|
|
+ boolean leftDisjoint = max1 != null && min2 != null && max1 < min2;
|
|
|
|
|
+ boolean rightDisjoint = max2 != null && min1 != null && max2 < min1;
|
|
|
|
|
+ return !leftDisjoint && !rightDisjoint;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 清空险种数据
|
|
* 清空险种数据
|
|
|
*
|
|
*
|
|
@@ -521,6 +563,16 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
|
|
|
driving.setCoverage(setting.getCoverage() != null ? setting.getCoverage().toString() : null);
|
|
driving.setCoverage(setting.getCoverage() != null ? setting.getCoverage().toString() : null);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ // 根据座位数范围过滤驾意险:只保留座位数在 minSeatCount~maxSeatCount 范围内的
|
|
|
|
|
+ drivings.removeIf(driving -> {
|
|
|
|
|
+ if (driving.getMinSeatCount() != null && seats < driving.getMinSeatCount()) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (driving.getMaxSeatCount() != null && seats > driving.getMaxSeatCount()) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|