wks %!s(int64=2) %!d(string=hai) anos
pai
achega
6a05f22757

+ 23 - 0
src/main/java/com/ydtech/modules/ins/model/yc/YcBuildData.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.ArrayUtil;
 import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.modules.ins.model.vo.*;
 import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
+import com.ydtech.modules.ins.model.yc.ruote.Vhl;
 import com.ydtech.modules.ins.model.yc.ruote.response.BaseResponse;
 import com.ydtech.modules.ins.model.yc.ruote.response.PrmCoefResponse;
 import com.ydtech.modules.ins.model.yc.ruote.response.RuoteResponse;
@@ -342,4 +343,26 @@ public class YcBuildData {
     }
 
 
+    /**
+     * 获取折旧价
+     *
+     * @param depreciationValue 折旧价
+     * @param vhl               车辆信息
+     * @return
+     */
+    public static String getNegotiateThePrice(String depreciationValue, Vhl vhl, String startTime) {
+        if (!"32773001".equals(vhl.getFuelType())) {
+            return depreciationValue;
+        }
+        int monthDiff = getMonthDiffSub(vhl.getCFstRegYm(), startTime);
+        if (monthDiff > 9 && monthDiff < 96) {
+            return new BigDecimal(depreciationValue).multiply(new BigDecimal("0.3")).toString();
+        } else if ("1".equals(vhl.getCChgOwnerFlag()) || monthDiff >= 96) {
+            return new BigDecimal(depreciationValue).multiply(new BigDecimal("0.5")).toString();
+        }
+
+        return depreciationValue;
+    }
+
+
 }

+ 3 - 1
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Ruote.java

@@ -196,7 +196,9 @@ public class Ruote {
         //折旧价
         String defValue = YcBuildData.getDefValue(new BigDecimal(vhl.getNNewPriceValue()), vhl.getCFstRegYm(), startTime);
         vhl.setNActualValue(defValue);
-        vhl.setNNewPurchaseValue(defValue);
+
+        String negotiateThePrice = YcBuildData.getNegotiateThePrice(defValue,  vhl, startTime);
+        vhl.setNNewPurchaseValue(negotiateThePrice);
         condition.setVhl(vhl);
         /**
          * 车主信息

+ 1 - 1
src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml

@@ -76,7 +76,7 @@
         from esm_ins_company as eic
                  left join ptl_agreement as pa on pa.insurance_company_id = eic.id
                  left join ptl_agreement_attribution as paa on paa.id = pa.id
-        where (#{localDate} between start_date and end_date)
+        where (#{localDate} between start_date and DATE_SUB(end_date, INTERVAL 1 DAY))
           and (paa.template_id is not null)
           and pa.valid_status = 1
           and pa.id in (select distinct agreement_id