修改消费明细列表查询接口
parent
f824b3f4c9
commit
1e6ff6923e
|
|
@ -210,6 +210,7 @@ public class PrepayService {
|
|||
" ,p.order_sn \n" +
|
||||
" ,p.arrive_time \n" +
|
||||
" ,p.type \n" +
|
||||
" ,p.second_weight - p.first_weight net_weight\n" +
|
||||
" ,a.supermarket_id \n" +
|
||||
" ,s.`name` supermarket_name \n" +
|
||||
" ,a.truck_license \n" +
|
||||
|
|
|
|||
|
|
@ -1195,7 +1195,8 @@ public class OrderStatService {
|
|||
// paraTemp.add(tm + "%");
|
||||
|
||||
temp_sql += " and t.create_time between ? and ? \n";
|
||||
addTm(tm, paraTemp); }
|
||||
addTm(tm, paraTemp);
|
||||
}
|
||||
|
||||
if (isprepaid != null) {
|
||||
temp_sql += " and t.isprepaid = ? \n";
|
||||
|
|
@ -2276,24 +2277,86 @@ public class OrderStatService {
|
|||
saleParam += " and t.sale_type = ? \n";
|
||||
}
|
||||
|
||||
String union_4 = "union select\n" +
|
||||
String union_4 = "";
|
||||
String union_99 = "";
|
||||
String today = "";
|
||||
String endDay = etm.split(" ")[0];
|
||||
if (LocalDate.now().toString().equals(endDay)) {
|
||||
|
||||
union_4 = "union select\n" +
|
||||
" ifnull(t.customer_id, 0) customer_id,\n" +
|
||||
" t.supermarket_id,\n" +
|
||||
" ifnull(sum(t.weight), 0) weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" where t.state = 5\n";
|
||||
// " and t.product_id != 4\n" +
|
||||
saleParam +
|
||||
" and t.supermarket_id = 4\n" +
|
||||
|
||||
if (invoice_type != null) {
|
||||
union_4 += "and t.invoice_type = " + invoice_type + " \n";
|
||||
}
|
||||
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
union_4 += " and t.sale_type = " + sale_type + " \n";
|
||||
}
|
||||
|
||||
union_4 += " and t.supermarket_id = 4\n" +
|
||||
" and (t.create_time < '2021-09-08 00:00:00'\n" +
|
||||
" or t.create_time > '2021-10-15 23:59:59')\n" +
|
||||
" AND t.create_time >= CONCAT( CURDATE(), ' 00:00:00' )" +
|
||||
// " and t.create_time >= ? \n" +
|
||||
// " and t.create_time <= ?\n" +
|
||||
" and (t.create_time < '2021-10-20 00:00:00' or t.create_time > '2021-10-20 23:59:59')\n" +
|
||||
paramsSql +
|
||||
" group by t.customer_id\n";
|
||||
|
||||
union_99 = " union select\n" +
|
||||
" ifnull(t.customer_id, 0) customer_id,\n" +
|
||||
" 99 supermarket_id,\n" +
|
||||
" ifnull(sum(t.weight), 0) weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = 5\n" ;
|
||||
// " and t.product_id != 4\n" +
|
||||
if (invoice_type != null) {
|
||||
union_99 += "and t.invoice_type = " + invoice_type + " \n";
|
||||
}
|
||||
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
union_99 += " and t.sale_type = " + sale_type + " \n";
|
||||
}
|
||||
union_99 += " and t.supermarket_id = 4\n" +
|
||||
" and ((t.create_time >= '2021-09-08 00:00:00' and t.create_time <= '2021-10-15 23:59:59') \n" +
|
||||
" or (t.create_time >= '2021-10-20 00:00:00' and t.create_time <= '2021-10-20 23:59:59'))\n" +
|
||||
" AND t.create_time >= CONCAT( CURDATE(), ' 00:00:00' ) \n" +
|
||||
// " and t.create_time >= ? \n" +
|
||||
// " and t.create_time <= ?\n" +
|
||||
" group by t.customer_id\n";
|
||||
|
||||
today = " select\n" +
|
||||
" ifnull(t.customer_id, 0) customer_id,\n" +
|
||||
" t.supermarket_id,\n" +
|
||||
" ifnull(sum(t.weight), 0) weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = 5\n" ;
|
||||
// " and t.product_id != 4\n" +
|
||||
if (invoice_type != null) {
|
||||
today += "and t.invoice_type = " + invoice_type + " \n";
|
||||
}
|
||||
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
today += " and t.sale_type = " + sale_type + " \n";
|
||||
}
|
||||
today += " and t.supermarket_id != 4\n" +
|
||||
" AND t.create_time >= CONCAT( CURDATE(), ' 00:00:00' ) \n" +
|
||||
// " and t.create_time>= ? \n" +
|
||||
// " and t.create_time<= ?\n" +
|
||||
// paramsSql +
|
||||
" group by t.customer_id, t.supermarket_id \n " +
|
||||
" union \n ";
|
||||
}
|
||||
|
||||
|
||||
union_4 += " UNION\n" +
|
||||
" SELECT\n" +
|
||||
" ifnull( t.customer_id, 0 ) customer_id,\n" +
|
||||
|
|
@ -2306,28 +2369,14 @@ public class OrderStatService {
|
|||
" t.supermarket_id != 4 \n" +
|
||||
" AND t.date >= ? \n" +
|
||||
" AND t.date <= ? \n" +
|
||||
" and (t.date < '2021-09-08'\n" +
|
||||
" or t.date > '2021-10-15')\n" +
|
||||
" and (t.date < '2021-10-20' or t.date > '2021-10-20')\n" +
|
||||
saleParam +
|
||||
" GROUP BY\n" +
|
||||
" t.customer_id,\n" +
|
||||
" t.supermarket_id";
|
||||
|
||||
String union_99 = " union select\n" +
|
||||
" ifnull(t.customer_id, 0) customer_id,\n" +
|
||||
" 99 supermarket_id,\n" +
|
||||
" ifnull(sum(t.weight), 0) weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
// " and t.product_id != 4\n" +
|
||||
saleParam +
|
||||
" and t.supermarket_id = 4\n" +
|
||||
" and ((t.create_time >= '2021-09-08 00:00:00' and t.create_time <= '2021-10-15 23:59:59') \n" +
|
||||
" or (t.create_time >= '2021-10-20 00:00:00' and t.create_time <= '2021-10-20 23:59:59'))\n" +
|
||||
" AND t.create_time >= CONCAT( CURDATE(), ' 00:00:00' ) \n" +
|
||||
// " and t.create_time >= ? \n" +
|
||||
// " and t.create_time <= ?\n" +
|
||||
paramsSql +
|
||||
" group by t.customer_id\n";
|
||||
|
||||
union_99 += " union SELECT\n" +
|
||||
" ifnull( t.customer_id, 0 ) customer_id,\n" +
|
||||
|
|
@ -2371,26 +2420,12 @@ public class OrderStatService {
|
|||
" ifnull(sum(case when g.supermarket_id = 12 then g.total_price end), 0) xse_12,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 99 then g.total_price end), 0) xse_99\n" +
|
||||
" from (\n" +
|
||||
today +
|
||||
" select\n" +
|
||||
" ifnull(t.customer_id, 0) customer_id,\n" +
|
||||
" t.supermarket_id,\n" +
|
||||
" ifnull(sum(t.weight), 0) weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
// " and t.product_id != 4\n" +
|
||||
saleParam +
|
||||
" and t.supermarket_id != 4\n" +
|
||||
" AND t.create_time >= CONCAT( CURDATE(), ' 00:00:00' ) \n" +
|
||||
// " and t.create_time>= ? \n" +
|
||||
// " and t.create_time<= ?\n" +
|
||||
paramsSql +
|
||||
" group by t.customer_id, t.supermarket_id\n" +
|
||||
" union select\n" +
|
||||
" ifnull(t.customer_id, 0) customer_id,\n" +
|
||||
" t.supermarket_id,\n" +
|
||||
" ifnull(sum(t.weight), 0) weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price\n" +
|
||||
" from order_end t\n" +
|
||||
" where t.supermarket_id != 4\n" +
|
||||
// " and t.product_id != 4\n" +
|
||||
|
|
@ -2406,13 +2441,14 @@ public class OrderStatService {
|
|||
|
||||
if (invoice_type != null) {
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
customer_sale_list = Db.find(sql, sale_type, invoice_type,stm, etm,sale_type, sale_type,invoice_type, stm, etm, sale_type, sale_type,invoice_type, stm, etm, sale_type);
|
||||
customer_sale_list = Db.find(sql, stm, etm, sale_type, stm, etm, sale_type, stm, etm, sale_type);
|
||||
} else {
|
||||
customer_sale_list = Db.find(sql, stm, etm, invoice_type, stm, etm, invoice_type, stm, etm, invoice_type);
|
||||
// customer_sale_list = Db.find(sql, stm, etm, invoice_type, stm, etm, invoice_type, stm, etm, invoice_type);
|
||||
customer_sale_list = Db.find(sql, stm, etm, stm, etm, stm, etm);
|
||||
}
|
||||
} else {
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
customer_sale_list = Db.find(sql, sale_type, stm, etm, sale_type, sale_type, stm, etm, sale_type,sale_type, stm, etm, sale_type);
|
||||
customer_sale_list = Db.find(sql,stm, etm, sale_type, stm, etm, sale_type, stm, etm, sale_type);
|
||||
} else {
|
||||
customer_sale_list = Db.find(sql, stm, etm, stm, etm, stm, etm);
|
||||
}
|
||||
|
|
@ -2990,6 +3026,7 @@ public class OrderStatService {
|
|||
|
||||
/**
|
||||
* 各砂站预售金额、提货额统计
|
||||
*
|
||||
* @param stm
|
||||
* @param etm
|
||||
* @return
|
||||
|
|
@ -3304,6 +3341,7 @@ public class OrderStatService {
|
|||
* }
|
||||
* ]
|
||||
* 砂站年统计
|
||||
*
|
||||
* @param tm
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -3758,7 +3796,8 @@ public class OrderStatService {
|
|||
list.add(tm + "-12-31 23:59:59");
|
||||
|
||||
break;
|
||||
}case 7:{ // 月
|
||||
}
|
||||
case 7: { // 月
|
||||
|
||||
list.add(tm + "-01 00:00:00");
|
||||
list.add(tm + "-31 23:59:59");
|
||||
|
|
|
|||
Loading…
Reference in New Issue