|
|
@@ -10,10 +10,15 @@ import com.ydtech.modules.order.entity.InsOrders;
|
|
|
import com.ydtech.modules.order.entity.api.dajia.constants.TypeVehicleMapping;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlNewCarJudgeRules;
|
|
|
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
import lombok.Data;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.Period;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
@@ -37,11 +42,11 @@ public class RuleAttrMappingVo {
|
|
|
this.value = value;
|
|
|
}
|
|
|
|
|
|
- public static List<RuleAttrMappingVo> getRuleAttrMappingVoList(InsAreaCompany insAreaCompany, InsOrders insOrders) {
|
|
|
+ public static List<RuleAttrMappingVo> getRuleAttrMappingVoList(InsAreaCompany insAreaCompany, InsOrders insOrders,
|
|
|
+ List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList, PtlNewCarJudgeRules carJudgeRule) {
|
|
|
List<RuleAttrMappingVo> ruleAttrMappingVoList = new ArrayList<>();
|
|
|
CarInfoVo carInfo = insOrders.getCarinfo().toJavaObject(CarInfoVo.class);
|
|
|
//车牌号
|
|
|
-
|
|
|
ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseNo", carInfo.getLicenseNo()));
|
|
|
//品牌型号
|
|
|
ruleAttrMappingVoList.add(new RuleAttrMappingVo("BrandandModel", carInfo.getModelcname()));
|
|
|
@@ -64,7 +69,31 @@ public class RuleAttrMappingVo {
|
|
|
//是否过户
|
|
|
ruleAttrMappingVoList.add(new RuleAttrMappingVo("TransferVehicle", carInfo.isTransferFlag() ? "1" : "0"));
|
|
|
//是否新车
|
|
|
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NewAndOldCars", carInfo.isNoLicenseFlag() ? "1" : "0"));
|
|
|
+ //使用注册日期算出自然月 然后判断是否是新旧车
|
|
|
+ LocalDate registrationDate = LocalDate.parse(carInfo.getIssueDate());
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+ PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream().filter(x -> x.getAttrCode().equals("NewAndOldCars")).findFirst().get();
|
|
|
+ boolean isNoLicenseFlag = false;
|
|
|
+ if(carJudgeRule != null)
|
|
|
+ {
|
|
|
+ if(carJudgeRule.getUnitTypeCode().equals("天")){
|
|
|
+ long days = ChronoUnit.DAYS.between(registrationDate, currentDate);
|
|
|
+ if(days < Integer.parseInt(carJudgeRule.getUnitTypeValue()))
|
|
|
+ {
|
|
|
+ isNoLicenseFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(carJudgeRule.getUnitTypeCode().equals("月")){
|
|
|
+ long months = ChronoUnit.MONTHS.between(registrationDate, currentDate);
|
|
|
+ if(months < Integer.parseInt(carJudgeRule.getUnitTypeValue()))
|
|
|
+ {
|
|
|
+ isNoLicenseFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ruleAttrMappingVoList.add(new RuleAttrMappingVo("NewAndOldCars", isNoLicenseFlag ? "1" : "0"));
|
|
|
+
|
|
|
//发证日期
|
|
|
ruleAttrMappingVoList.add(new RuleAttrMappingVo("DateofIssuance", carInfo.getIssueDate()));
|
|
|
//车长
|
|
|
@@ -175,11 +204,11 @@ public class RuleAttrMappingVo {
|
|
|
//非车险
|
|
|
ruleAttrMappingVoList.add(new RuleAttrMappingVo("NonMotorInsurance", String.valueOf(insAreaCompany.getJypremium())));
|
|
|
//总折扣率
|
|
|
-// ruleAttrMappingVoList.add(new RuleAttrMappingVo("TotalDiscountRate", String.valueOf(insAreaCompany.())));
|
|
|
+ ruleAttrMappingVoList.add(new RuleAttrMappingVo("TotalDiscountRate", String.valueOf(insAreaCompany.getTotalAdjustRate())));
|
|
|
//交强折扣
|
|
|
-// ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsuranceDiscount", String.valueOf(quoteRespVo.getJqAdjustRate())));
|
|
|
+ ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsuranceDiscount", String.valueOf(insAreaCompany.getJqAdjustRate())));
|
|
|
//商业折扣
|
|
|
-// ruleAttrMappingVoList.add(new RuleAttrMappingVo("CommercialDiscount", String.valueOf(quoteRespVo.getSyAdjustRate())));
|
|
|
+ ruleAttrMappingVoList.add(new RuleAttrMappingVo("CommercialDiscount", String.valueOf(insAreaCompany.getSyAdjustRate())));
|
|
|
//数值型总评分
|
|
|
Pattern pattern = Pattern.compile("[0-9]*");
|
|
|
if (insAreaCompany.getScore() != null) {
|