首页统计数据调整
当年销售统计时,不包含预售提货,需要包含当年的预售额合计
当月销售统计时,不包含预售提货,需要包含当月的预售额合计
当日销售统计时,不包含预售提货,需要包含当日的预售额合计
dev
parent
72aaf684a8
commit
e23125c6dd
|
|
@ -126,7 +126,6 @@ group by date
|
|||
|
||||
*/
|
||||
public Record stat(Integer supermarket_id) {
|
||||
long st = System.currentTimeMillis();
|
||||
Record out = new Record();
|
||||
Date now = new Date();
|
||||
Calendar c = Calendar.getInstance();
|
||||
|
|
@ -145,55 +144,57 @@ group by date
|
|||
c.set(Calendar.MONTH, 0);
|
||||
Date year = c.getTime(); // 当年
|
||||
|
||||
String sql_ordercluster = "select\n" +
|
||||
" ifnull(sum(t.weight), 0) total_weight,\n" +
|
||||
" 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) 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" +
|
||||
" \n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = ?";
|
||||
|
||||
String sql_ordercluster_presell = "select \n" +
|
||||
String sql_ordercluster = "select \n" +
|
||||
" ifnull(sum(g.total_weight), 0) total_weight,\n" +
|
||||
" ifnull(sum(g.total_price), 0) total_price,\n" +
|
||||
" ifnull(sum(g.truck_cnt), 0) truck_cnt,\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" +
|
||||
" ifnull(sum(g.month_truck_cnt), 0) month_truck_cnt,\n" +
|
||||
" ifnull(sum(g.day_total_weight), 0) day_total_weight,\n" +
|
||||
" ifnull(sum(g.day_total_price), 0) day_total_price,\n" +
|
||||
" ifnull(sum(g.day_truck_cnt), 0) day_truck_cnt\n" +
|
||||
" from \n" +
|
||||
" (\n" +
|
||||
" select \n" +
|
||||
" ifnull(sum(t.weight), 0) total_weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price,\n" +
|
||||
" ifnull(count(t.sn), 0) truck_cnt,\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" +
|
||||
" ifnull(sum(case when t.create_time >= ? then 1 else 0 end ), 0) month_truck_cnt,\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" +
|
||||
" from order_temp t\n" +
|
||||
" where t.sale_type = 0\n" +
|
||||
" and t.state = 5\n" +
|
||||
" union\n" +
|
||||
" select \n" +
|
||||
" 0 total_weight,\n" +
|
||||
" ifnull(sum(p.presell_amount), 0) total_price,\n" +
|
||||
" 0 truck_cnt,\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" +
|
||||
" 0 month_truck_cnt,\n" +
|
||||
" 0 day_total_weight,\n" +
|
||||
" ifnull(sum(case when p.presell_date >= ? then p.presell_amount end ), 0) day_total_price,\n" +
|
||||
" 0 day_truck_cnt\n" +
|
||||
" from presell_order p\n" +
|
||||
" where p.del = 0\n" +
|
||||
" ) g";
|
||||
|
||||
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", ret);
|
||||
Record ocout = Db.findFirst(sql_ordercluster, year, year, year, month, month, month, day, day, day, year, month, day);
|
||||
out.set("ordercluster", ocout);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue