From 9cedc28427b18309387e0fad5b6b1f81c8e4855f Mon Sep 17 00:00:00 2001 From: wuwenxiong <646448316@qq.com> Date: Tue, 15 Feb 2022 23:06:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E3=80=81=E6=9C=88=E6=8C=89=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=BB=9F=E8=AE=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ssjygl/stat/sale/OrderStatService.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java index 368345d..2b68596 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java @@ -646,8 +646,7 @@ public class OrderStatService { " from order_temp t\n" + " left join customer c on c.id = t.customer_id \n" + " where t.state = ? \n" + - saleParams + - " and t.create_time like ? \n"; + " and t.create_time like ? \n" + saleParams + ""; if (customer_id != null) { sql += " and c.id = ? \n"; paraList.add(customer_id); @@ -669,8 +668,7 @@ public class OrderStatService { " from order_temp t\n" + " left join customer c on c.id = t.customer_id \n" + " where t.state = ? \n" + - saleParams + - " and t.create_time like ? \n"; + " and t.create_time like ? \n" + saleParams + ""; if (customer_id != null) { sql += " and c.id = ? \n"; paraList.add(customer_id); @@ -689,23 +687,25 @@ public class OrderStatService { } List dblist = Db.find(sql, paraList.toArray()); - Record total = new Record(); - total.set("id", 0); - total.set("name", "合计"); - total.set("orderCount", 0); - total.set("totalPrice", 0); - total.set("weight", 0); + if (dblist.size() > 0) { + Record total = new Record(); + total.set("id", 0); + total.set("name", "合计"); + total.set("orderCount", 0); + total.set("totalPrice", 0); + total.set("weight", 0); - for (Record record : dblist) { - total.set("orderCount", total.getDouble("orderCount") + record.getDouble("orderCount")); - total.set("totalPrice", total.getDouble("totalPrice") + record.getDouble("totalPrice")); - total.set("weight", total.getDouble("weight") + record.getDouble("weight")); + for (Record record : dblist) { + total.set("orderCount", total.getDouble("orderCount") + record.getDouble("orderCount")); + total.set("totalPrice", total.getDouble("totalPrice") + record.getDouble("totalPrice")); + total.set("weight", total.getDouble("weight") + record.getDouble("weight")); + } + + total.set("weight", Double.parseDouble(String.format("%.2f", total.getDouble("weight")))); + total.set("product_name", ""); + dblist.add(total); } - total.set("weight", Double.parseDouble(String.format("%.2f", total.getDouble("weight")))); - total.set("product_name", ""); - dblist.add(total); - for (Record record : dblist) { String uuid = StrKit.getRandomUUID(); record.set("uuid", uuid);