523096025 4 kuukautta sitten
vanhempi
commit
0aff425c84

+ 12 - 6
huimv-farm/src/main/java/vip/xiaonuo/purchase/service/impl/PurchaseOrderServiceImpl.java

@@ -420,9 +420,12 @@ public class PurchaseOrderServiceImpl extends ServiceImpl<PurchaseOrderMapper, P
             dsBusAllParam.setCaiGouMoneyOnYear(calculateYOYZiJinYvE(getDouble(dsBusAllParam.getCaiGouMoney()),getDouble(lastDsBus.getCaiGouMoney()) ));
             dsBusAllParam.setCaiGouMoneyIsOn(getDouble(lastDsBus.getCaiGouMoney()) <getDouble(dsBusAllParam.getCaiGouMoney()));
         }
-        PurchaseAllParam dsBusAllParam = busAllParams.get(0);
-        dsBusAllParam.setCaiGouMoneyIsOn(true);
-        dsBusAllParam.setCaiGouMoneyOnYear("0%");
+        if (ObjectUtil.isNotEmpty(busAllParams)){
+            PurchaseAllParam dsBusAllParam = busAllParams.get(0);
+            dsBusAllParam.setCaiGouMoneyIsOn(true);
+            dsBusAllParam.setCaiGouMoneyOnYear("0%");
+        }
+
         return busAllParams;
     }
 
@@ -443,10 +446,13 @@ public class PurchaseOrderServiceImpl extends ServiceImpl<PurchaseOrderMapper, P
         Page<GongYingShangParam> page = new Page<>(priceParam.getPageNum(), priceParam.getPageSize());
         wapper.eq( StringUtils.isNotBlank(orgId),"org_id", orgId).groupBy("supplier");
         Page<GongYingShangParam> gongYingShang = purchasePriceMapper.getGongYingShang(page, wapper);
-        for (int i = 0; i < priceParam.getPageSize(); i++) {
-            GongYingShangParam gongYingShangParam = gongYingShang.getRecords().get(i);
-            gongYingShangParam.setSort((priceParam.getPageNum()-1) *priceParam.getPageSize() + i+ 1 );
+        if (ObjectUtil.isNotEmpty(gongYingShang.getRecords())){
+            for (int i = 0; i < priceParam.getPageSize(); i++) {
+                GongYingShangParam gongYingShangParam = gongYingShang.getRecords().get(i);
+                gongYingShangParam.setSort((priceParam.getPageNum()-1) *priceParam.getPageSize() + i+ 1 );
+            }
         }
+
         return  gongYingShang;
     }