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; }