dev
parent
4a95e2e442
commit
51f5fccae3
|
|
@ -130,10 +130,8 @@ group by date
|
||||||
Record out = new Record();
|
Record out = new Record();
|
||||||
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
List<Object> params1 = new ArrayList<>();
|
|
||||||
List<Object> params2 = new ArrayList<>();
|
List<Object> params2 = new ArrayList<>();
|
||||||
|
|
||||||
params1.add(OrderStateEnum.INVALID.getStateid());
|
|
||||||
params2.add(OrderStateEnum.RECEIVED.getStateid());
|
params2.add(OrderStateEnum.RECEIVED.getStateid());
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -161,20 +159,16 @@ group by date
|
||||||
" ifnull(sum(case when t.create_time like '" + nowmonttm + "%' then t.total_price end ), 0) month_total_price, \n" +
|
" ifnull(sum(case when t.create_time like '" + nowmonttm + "%' then t.total_price end ), 0) month_total_price, \n" +
|
||||||
" ifnull(sum(case when t.create_time like '" + nowdaytm + "%' then t.total_price end ), 0) day_total_price, \n" +
|
" ifnull(sum(case when t.create_time like '" + nowdaytm + "%' then t.total_price end ), 0) day_total_price, \n" +
|
||||||
" ifnull(sum(case when t.create_time like '" + premonthtm + "%' then t.total_price end ), 0) before_month_total_price, \n" +
|
" ifnull(sum(case when t.create_time like '" + premonthtm + "%' then t.total_price end ), 0) before_month_total_price, \n" +
|
||||||
" ifnull(sum(case when t.create_time like '" + predaytm + "%' then t.total_price end) , 0) before_day_total_price \n" +
|
" ifnull(sum(case when t.create_time like '" + predaytm + "%' then t.total_price end) , 0) before_day_total_price, \n" +
|
||||||
|
" \n" +
|
||||||
|
" ifnull(count(t.sn), 0) truck_cnt, \n" +
|
||||||
|
" ifnull(sum(case when t.create_time like '" + nowmonttm + "%' then 1 else 0 end ), 0) month_truck_cnt, \n" +
|
||||||
|
" ifnull(sum(case when t.create_time like '" + nowdaytm + "%' then 1 else 0 end ), 0) day_truck_cnt, \n" +
|
||||||
|
" ifnull(sum(case when t.create_time like '" + premonthtm + "%' then 1 else 0 end ), 0) before_month_truck_cnt, \n" +
|
||||||
|
" ifnull(sum(case when t.create_time like '" + predaytm + "%' then 1 else 0 end) , 0) before_day_truck_cnt \n" +
|
||||||
" from order_temp t\n" +
|
" from order_temp t\n" +
|
||||||
" where t.state = ?";
|
" where t.state = ?";
|
||||||
|
|
||||||
String sql_ordercluster_truck = "select\n" +
|
|
||||||
" count(t.id) truck_cnt,\n" +
|
|
||||||
" sum(case when t.change_time like '" + nowmonttm + "%' then 1 else 0 end) month_truck_cnt,\n" +
|
|
||||||
" sum(case when t.change_time like '" + nowdaytm + "%' then 1 else 0 end) day_truck_cnt,\n" +
|
|
||||||
" sum(case when t.change_time like '" + premonthtm + "%' then 1 else 0 end) before_month_truck_cnt,\n" +
|
|
||||||
" sum(case when t.change_time like '" + predaytm + "%' then 1 else 0 end) before_day_truck_cnt\n" +
|
|
||||||
" from ordercluster_truck t\n" +
|
|
||||||
" left join ordercluster c on c.id = t.ordercluster_id\n" +
|
|
||||||
" where c.state < ?";
|
|
||||||
|
|
||||||
String sql_by_customer = "\n" +
|
String sql_by_customer = "\n" +
|
||||||
" select\n" +
|
" select\n" +
|
||||||
" t.customer_id,\n" +
|
" t.customer_id,\n" +
|
||||||
|
|
@ -256,10 +250,8 @@ group by date
|
||||||
|
|
||||||
if (supermarket_id != null) {
|
if (supermarket_id != null) {
|
||||||
sql_ordercluster += " and t.supermarket_id = ? ";
|
sql_ordercluster += " and t.supermarket_id = ? ";
|
||||||
sql_ordercluster_truck += " and c.supermarket_id = ? ";
|
|
||||||
sql_by_customer += " and t.supermarket_id = ? ";
|
sql_by_customer += " and t.supermarket_id = ? ";
|
||||||
|
|
||||||
params1.add(supermarket_id);
|
|
||||||
params2.add(supermarket_id);
|
params2.add(supermarket_id);
|
||||||
|
|
||||||
by_supermarket_list = Db.find(sql_by_supermarket +
|
by_supermarket_list = Db.find(sql_by_supermarket +
|
||||||
|
|
@ -287,9 +279,6 @@ group by date
|
||||||
}
|
}
|
||||||
|
|
||||||
Record ocout = Db.findFirst(sql_ordercluster, params2.toArray());
|
Record ocout = Db.findFirst(sql_ordercluster, params2.toArray());
|
||||||
Record oct = Db.findFirst(sql_ordercluster_truck, params1.toArray());
|
|
||||||
|
|
||||||
ocout.setColumns(oct);
|
|
||||||
|
|
||||||
out.set("ordercluster", ocout);
|
out.set("ordercluster", ocout);
|
||||||
out.set("by_customer", Db.find(sql_by_customer + " group by t.customer_id", params2.toArray()));
|
out.set("by_customer", Db.find(sql_by_customer + " group by t.customer_id", params2.toArray()));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue