Ver código fonte

提交比价接口的bug

hxl13994548489 2 anos atrás
pai
commit
3d749a0300

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

@@ -1290,7 +1290,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         yhjList.add(new PriceParityVo("优惠金额",false,false));
         List<PriceParityVo> yhhList=new ArrayList<>();
         yhhList.add(new PriceParityVo("优惠后",false,false));
-        List<String> yhhbjList=new ArrayList<>();
+        List<BigDecimal> yhhbjList=new ArrayList<>();
         List<SubOrderVo> subOrderVos=new ArrayList<>();
         String companyName="";
         if(inquiryDetalsDto.getSubOrderNos()!=null && inquiryDetalsDto.getSubOrderNos().size()>0){
@@ -1327,14 +1327,14 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 //优惠后金额
                 BigDecimal sumyhh = insAreaCompanySingle.getSumpremium().subtract(sumyh);
                 yhhList.add(new PriceParityVo(sumyhh.toString(),false,false));
-                yhhbjList.add(sumyhh.toString());
+                yhhbjList.add(sumyhh);
                 subOrderVos.add(subOrderVo);
             }
-            Set<String> set = new HashSet<String>(yhhbjList);
+            Set<BigDecimal> set = new HashSet<BigDecimal>(yhhbjList);
             //判断是否相等
             if(set.size()>1){
                 //最优惠公司
-                int index = getCompanyNameByMinAmount(yhhbjList);
+                int index = getCompanyNameByMinAmount(yhhbjList)+1;
                 companyName = companyAllList.get(index);
                 // priceList.add(getZYList(companyList,index,false));
                 priceList.add(companyList);
@@ -1387,11 +1387,11 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
      *  @Date: 2024/6/25 9:47
      *  @Description: 获取优惠后最低的公司
      */
-    private static int getCompanyNameByMinAmount(List<String> yhhbjList) {
+    private static int getCompanyNameByMinAmount(List<BigDecimal> yhhbjList) {
         int minIndex=0;
         if(yhhbjList !=null && yhhbjList.size()>0){
-            String max = Collections.max(yhhbjList);
-            minIndex = yhhbjList.indexOf(max);
+            BigDecimal min = yhhbjList.stream().filter(Objects::nonNull).min(BigDecimal::compareTo).orElse(new BigDecimal(0));
+            minIndex = yhhbjList.indexOf(min);
         }
         return minIndex;
     }