日、月按客户统计问题
parent
9a37d32b88
commit
9cedc28427
|
|
@ -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<Record> 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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue