From 190009a33398dea53d9fe60ec1e098a8f47fd5e5 Mon Sep 17 00:00:00 2001 From: wuwenxiong <646448316@qq.com> Date: Mon, 24 Jan 2022 11:37:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=BB=9F=E8=AE=A1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cowr/ssjygl/overall/OverallService.java | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/overall/OverallService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/overall/OverallService.java index f23501b..d7b065d 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/overall/OverallService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/overall/OverallService.java @@ -150,15 +150,6 @@ group by date " ifnull(sum(t.total_price), 0) total_price,\n" + " ifnull(count(t.sn), 0) truck_cnt,\n" + " \n" + - " ifnull(sum(case when t.create_time >= ? then t.weight end ), 0) year_total_weight,\n" + - " ifnull(sum(case when t.create_time >= ? then t.total_price end ), 0) year_total_price,\n" + - " ifnull(sum(case when t.create_time >= ? then 1 else 0 end ), 0) year_truck_cnt,\n" + - " \n" + - " ifnull(sum(case when t.create_time >= ? then t.weight end ), 0) month_total_weight,\n" + - " ifnull(sum(case when t.create_time >= ? then t.total_price end ), 0) month_total_price,\n" + - " ifnull(sum(case when t.create_time >= ? then 1 else 0 end ), 0) month_truck_cnt,\n" + - " \n" + - " \n" + " ifnull(sum(case when t.create_time >= ? then t.weight end ), 0) day_total_weight,\n" + " ifnull(sum(case when t.create_time >= ? then t.total_price end ), 0) day_total_price,\n" + " ifnull(sum(case when t.create_time >= ? then 1 else 0 end ), 0) day_truck_cnt\n" + @@ -166,10 +157,43 @@ group by date " from order_temp t\n" + " where t.state = ?"; + String sql_ordercluster_presell = "select \n" + + " ifnull(sum(g.year_total_weight), 0) year_total_weight,\n" + + " ifnull(sum(g.year_total_price), 0) year_total_price,\n" + + " ifnull(sum(g.year_truck_cnt), 0) year_truck_cnt,\n" + + " ifnull(sum(g.month_total_weight), 0) month_total_weight,\n" + + " ifnull(sum(g.month_total_price), 0) month_total_price,\n" + + " ifnull(sum(g.month_truck_cnt), 0) month_truck_cnt\n" + + " from \n" + + " (\n" + + " select \n" + + " ifnull(sum(case when t.create_time >= ? then t.weight end ), 0) year_total_weight,\n" + + " ifnull(sum(case when t.create_time >= ? then t.total_price end ), 0) year_total_price,\n" + + " ifnull(sum(case when t.create_time >= ? then 1 else 0 end ), 0) year_truck_cnt,\n" + + " ifnull(sum(case when t.create_time >= ? then t.weight end ), 0) month_total_weight,\n" + + " ifnull(sum(case when t.create_time >= ? then t.total_price end ), 0) month_total_price,\n" + + " ifnull(sum(case when t.create_time >= ? then 1 else 0 end ), 0) month_truck_cnt\n" + + " from order_temp t\n" + + " where t.sale_type = 0\n" + + " and t.state = 5\n" + + " union\n" + + " select \n" + + " 0 year_total_weight,\n" + + " ifnull(sum(case when p.presell_date >= ? then p.presell_amount end ), 0) year_total_price,\n" + + " 0 year_truck_cnt,\n" + + " 0 month_total_weight,\n" + + " ifnull(sum(case when p.presell_date >= ? then p.presell_amount end ), 0) month_total_price,\n" + + " 0 month_truck_cnt\n" + + " from presell_order p\n" + + " where p.del = 0\n" + + " ) g"; - Record ocout = Db.findFirst(sql_ordercluster, year, year, year, month, month, month, day, day, day, OrderStateEnum.RECEIVED.getStateid()); + Record ret = new Record(); + Record ocout = Db.findFirst(sql_ordercluster, day, day, day, OrderStateEnum.RECEIVED.getStateid()); + Record presell = Db.findFirst(sql_ordercluster_presell, year, year, year, month, month, month, year, month); + ret.setColumns(ocout).setColumns(presell); - out.set("ordercluster", ocout); + out.set("ordercluster", ret); return out; }