Ver código fonte

提交比价接口添加前台颜色区分的标志

hxl13994548489 2 anos atrás
pai
commit
e71d6a24d5

+ 2 - 2
src/main/java/com/ydtech/modules/order/entity/vo/InquiryDetalsVo.java

@@ -30,7 +30,7 @@ public class InquiryDetalsVo implements Serializable {
      * 比价信息
      */
     @ApiModelProperty("比价列表信息")
-    private List<List<String>>  parityPriceVo=new ArrayList<List<String>>();
+    private List<List<PriceParityVo>>  parityPriceVo=new ArrayList<List<PriceParityVo>>();
 
     /***
      * 最优惠公司
@@ -41,7 +41,7 @@ public class InquiryDetalsVo implements Serializable {
     public InquiryDetalsVo() {
     }
 
-    public InquiryDetalsVo(InsOrderVo insOrderVo, List<SubOrderVo> subOrderVos, List<List<String>> parityPriceVo, String companyName) {
+    public InquiryDetalsVo(InsOrderVo insOrderVo, List<SubOrderVo> subOrderVos, List<List<PriceParityVo>> parityPriceVo, String companyName) {
         this.insOrderVo = insOrderVo;
         this.subOrderVos = subOrderVos;
         this.parityPriceVo = parityPriceVo;

+ 31 - 0
src/main/java/com/ydtech/modules/order/entity/vo/PriceParityVo.java

@@ -0,0 +1,31 @@
+package com.ydtech.modules.order.entity.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/25 16:12
+ *  @Description: 前台添加比价最低的颜色区分
+ */
+@Data
+public class PriceParityVo {
+
+    @ApiModelProperty("内容")
+    private String value;
+    @ApiModelProperty("颜色标志 true false")
+    private boolean flag;
+
+    @ApiModelProperty("优惠后金额颜色标志 true false")
+    private boolean yzhFlag;
+
+    public PriceParityVo() {
+    }
+
+    public PriceParityVo(String value, boolean flag,boolean yzhFlag) {
+        this.value = value;
+        this.flag = flag;
+        this.yzhFlag = yzhFlag;
+    }
+}

+ 64 - 37
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -1272,26 +1272,27 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         //主订单信息
         InsOrders orders = this.getById(insAreaCompany.getOrderno());
         InsOrderVo  insOrderVo = getInsOrderVoDetals(orders);
-        List<List<String>>  priceList=new ArrayList<>();
-        List<String> companyList=new ArrayList<>();
-        companyList.add("公司");
-        List<String> jqList=new ArrayList<>();
-        jqList.add("交强险");
-        List<String> syList=new ArrayList<>();
-        syList.add("商业险");
-        List<String> ccList=new ArrayList<>();
-        ccList.add("车船税");
-        List<String> jyList=new ArrayList<>();
-        jyList.add("驾意险");
-        List<String> zbfList=new ArrayList<>();
-        zbfList.add("总保费");
-        List<String> yhjList=new ArrayList<>();
-        yhjList.add("优惠金额");
-        List<String> yhhList=new ArrayList<>();
-        yhhList.add("优惠后");
+        List<List<PriceParityVo>>  priceList=new ArrayList<>();
+        List<PriceParityVo> companyList=new ArrayList<>();
+        List<String> companyAllList=new ArrayList<>();
+        companyList.add(new PriceParityVo("公司",false,false));
+        List<PriceParityVo> jqList=new ArrayList<>();
+        jqList.add(new PriceParityVo("交强险",false,false));
+        List<PriceParityVo> syList=new ArrayList<>();
+        syList.add(new PriceParityVo("商业险",false,false));
+        List<PriceParityVo> ccList=new ArrayList<>();
+        ccList.add(new PriceParityVo("车船税",false,false));
+        List<PriceParityVo> jyList=new ArrayList<>();
+        jyList.add(new PriceParityVo("驾意险",false,false));
+        List<PriceParityVo> zbfList=new ArrayList<>();
+        zbfList.add(new PriceParityVo("总保费",false,false));
+        List<PriceParityVo> yhjList=new ArrayList<>();
+        yhjList.add(new PriceParityVo("优惠金额",false,false));
+        List<PriceParityVo> yhhList=new ArrayList<>();
+        yhhList.add(new PriceParityVo("优惠后",false,false));
         List<String> yhhbjList=new ArrayList<>();
         List<SubOrderVo> subOrderVos=new ArrayList<>();
-
+        String companyName="";
         if(inquiryDetalsDto.getSubOrderNos()!=null && inquiryDetalsDto.getSubOrderNos().size()>0){
             for(String subOrderId :inquiryDetalsDto.getSubOrderNos()){
                 BigDecimal sumyh =BigDecimal.ZERO;
@@ -1315,39 +1316,65 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                         insAreaCompanySingle.getSypremium(), insAreaCompanySingle.getKindinfo()==null?new JSONArray():insAreaCompanySingle.getKindinfo(),
                         insAreaCompanySingle.getTaxamount(), insAreaCompanySingle.getJypremium(), getJYRiskList(insAreaCompanySingle), insAreaCompanySingle.getSumpremium());
                 //保险公司名称
-                companyList.add(insAreaCompanySingle.getInscompany());
-                jqList.add(insAreaCompanySingle.getJqpremium().toString());
-                syList.add(insAreaCompanySingle.getSypremium().toString());
-                ccList.add(insAreaCompanySingle.getTaxamount().toString());
-                jyList.add(insAreaCompanySingle.getJypremium().toString());
-                zbfList.add(insAreaCompanySingle.getSumpremium().toString());
-                yhjList.add(sumyh.toString());
+                companyAllList.add(insAreaCompanySingle.getInscompany());
+                companyList.add(new PriceParityVo(insAreaCompanySingle.getInscompany(),false,false));
+                jqList.add(new PriceParityVo(insAreaCompanySingle.getJqpremium().toString(),false,false));
+                syList.add(new PriceParityVo(insAreaCompanySingle.getSypremium().toString(),false,false));
+                ccList.add(new PriceParityVo(insAreaCompanySingle.getTaxamount().toString(),false,false));
+                jyList.add(new PriceParityVo(insAreaCompanySingle.getJypremium().toString(),false,false));
+                zbfList.add(new PriceParityVo(insAreaCompanySingle.getSumpremium().toString(),false,false));
+                yhjList.add(new PriceParityVo(sumyh.toString(),false,false));
                 //优惠后金额
                 BigDecimal sumyhh = insAreaCompanySingle.getSumpremium().subtract(sumyh);
-                yhhList.add(sumyhh.toString());
+                yhhList.add(new PriceParityVo(sumyhh.toString(),false,false));
                 yhhbjList.add(sumyhh.toString());
                 subOrderVos.add(subOrderVo);
             }
+            //最优惠公司
+            int index = getCompanyNameByMinAmount(yhhbjList)+1;
+            companyName = companyAllList.get(index);
+           // priceList.add(getZYList(companyList,index,false));
             priceList.add(companyList);
-            priceList.add(jqList);
-            priceList.add(syList);
-            priceList.add(ccList);
-            priceList.add(jyList);
-            priceList.add(zbfList);
-            priceList.add(yhjList);
-            priceList.add(yhhList);
+            priceList.add(getZYList(jqList,index,false));
+            priceList.add(getZYList(syList,index,false));
+            priceList.add(getZYList(ccList,index,false));
+            priceList.add(getZYList(jyList,index,false));
+            priceList.add(getZYList(zbfList,index,false));
+            priceList.add(getZYList(yhjList,index,false));
+            priceList.add(getZYList(yhhList,index,true));
         }
-        //最优惠公司
-        String companyName = getCompanyNameByMinAmount(yhhbjList, companyList);
         return new InquiryDetalsVo(insOrderVo,subOrderVos,priceList,companyName);
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/25 16:31
+     *  @Description:  设置优惠公司数据颜色区分
+     */
+    private List<PriceParityVo> getZYList(List<PriceParityVo> companyList, int index, boolean flag) {
+           List<PriceParityVo>  newList=new ArrayList<>();
+           if(companyList !=null && companyList.size()>0){
+                for (int i = 1; i < companyList.size(); i++) {
+                    if (i==index) {
+                        PriceParityVo priceParityVo = companyList.get(i);
+                        priceParityVo.setFlag(true);
+                        priceParityVo.setYzhFlag(flag);
+                        newList.add(priceParityVo);
+                    }else{
+                        newList.add(companyList.get(i));
+                    }
+                }
+            }
+      return newList;
+    }
+
     /**
      *  @version
      *  @author: hxl
      *  @Date: 2024/6/25 9:47
      *  @Description: 获取优惠后最低的公司
      */
-    private static String getCompanyNameByMinAmount(List<String> yhhbjList, List<String> companyList) {
+    private static int getCompanyNameByMinAmount(List<String> yhhbjList) {
         int minIndex=0;
         if(yhhbjList !=null && yhhbjList.size()>0){
             String minValue = yhhbjList.get(0);
@@ -1357,7 +1384,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 }
             }
         }
-        return  companyList.get(minIndex+1);
+        return minIndex;
     }
 
     /**