Compare commits
No commits in common. "4c3952e6a4cf23812090bd9f3ec151971a6c5048" and "b29dde71505583b83ede581ada2e420885601852" have entirely different histories.
4c3952e6a4
...
b29dde7150
|
|
@ -140,7 +140,7 @@ public class OrderTempService extends BaseService {
|
|||
}
|
||||
|
||||
if (supermarket_id != null) {
|
||||
fromsql += " and s.supermarket_id = ? \n";
|
||||
fromsql += " and t.supermarket_id = ? \n";
|
||||
paraList.add(supermarket_id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -547,36 +547,13 @@ public class OrderStatService {
|
|||
params.add(type);
|
||||
}
|
||||
|
||||
params.addAll(params);
|
||||
//2025-03-06更改,解决砂站商品删除后月统计数据查询不到问题
|
||||
String selectSql = "select s.id, s.name, s.name2, p.id product_id, p.`name` product_name, ifnull(a.orderCount, 0) as orderCount, ifnull(a.totalPrice, 0) as totalPrice, ifnull(a.weight, 0) as weight\n" +
|
||||
" from supermarket_product t\n";
|
||||
String commonSql = "select t.id, t.product_id, count(*) as orderCount, sum(t.total_price) as totalPrice, sum(t.weight) as weight\n" +
|
||||
" from (\n" +
|
||||
" select t.supermarket_id as id, t.paid, t.total_price, t.weight, t.product_id\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = 5 \n" +
|
||||
" and t.create_time between ? and ? \n" +
|
||||
saleParams +
|
||||
" ) t\n" +
|
||||
" group by t.id, t.product_id\n";
|
||||
|
||||
String sql = "select m.* from (" + selectSql + "left join (\n" + commonSql + " ) a on a.id = t.supermarket_id and a.product_id = t.product_id\n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id\n" +
|
||||
" left join product p on p.id = t.product_id\n" +
|
||||
"union\n" +
|
||||
selectSql + "right join (\n" + commonSql + " ) a on a.id = t.supermarket_id and a.product_id = t.product_id\n" +
|
||||
" left join supermarket s on s.id = a.id\n" +
|
||||
" left join product p on p.id = a.product_id ) m order by m.id,m.product_id";
|
||||
|
||||
/**
|
||||
String sql = "select s.id, s.name, s.name2, p.id product_id, p.`name` product_name, ifnull(a.orderCount, 0) as orderCount, ifnull(a.totalPrice, 0) as totalPrice, ifnull(a.weight, 0) as weight\n" +
|
||||
" from supermarket_product t\n" +
|
||||
" left join (\n" +
|
||||
" select t.id, t.product_id, count(*) as orderCount, sum(t.total_price) as totalPrice, sum(t.weight) as weight\n" +
|
||||
" from (\n" +
|
||||
" select t.supermarket_id as id, t.paid, t.total_price, t.weight, t.product_id\n" +
|
||||
" from order_temp t LEFT JOIN supermarket s on t.supermarket_id = s.id \n" +
|
||||
" from order_temp t LEFT JOIN supermarket s on t.supermarket_id = s.id AND s.type = 0\n" +
|
||||
" where t.state = 5 \n" +
|
||||
// " and t.create_time like ? \n" +
|
||||
" and t.create_time between ? and ? \n" +
|
||||
|
|
@ -585,7 +562,8 @@ public class OrderStatService {
|
|||
" group by t.id, t.product_id\n" +
|
||||
" ) a on a.id = t.supermarket_id and a.product_id = t.product_id\n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id\n" +
|
||||
" left join product p on p.id = t.product_id AND p.del = 0";*/
|
||||
" left join product p on p.id = t.product_id AND p.del = 0" +
|
||||
" where s.type = 0";
|
||||
|
||||
List<Record> dblist = Db.find(sql, params.toArray());
|
||||
|
||||
|
|
@ -2051,7 +2029,7 @@ public class OrderStatService {
|
|||
" LEFT JOIN product p ON p.id = t.product_id " +
|
||||
" left join customer c on c.id = t.customer_id\n" +
|
||||
// " where t.state = 5\n" +
|
||||
" where 1 = 1 and t.sale_type != 3 \n" +
|
||||
" where 1 = 1\n" +
|
||||
saleParams +
|
||||
// " and t.create_time like ? \n";
|
||||
// " and t.create_time between ? and ? \n";
|
||||
|
|
@ -2088,7 +2066,7 @@ public class OrderStatService {
|
|||
" from order_end t\n" +
|
||||
" left join customer c on c.id = t.customer_id\n" +
|
||||
// " where t.state = 5\n" +
|
||||
" where 1 = 1 and t.sale_type != 3 \n" +
|
||||
" where 1 = 1\n" +
|
||||
saleParams +
|
||||
// " and t.create_time like ? \n";
|
||||
// " and t.create_time between ? and ? \n";
|
||||
|
|
@ -2129,7 +2107,7 @@ public class OrderStatService {
|
|||
" LEFT JOIN product p ON p.id = t.product_id " +
|
||||
" left join customer c on c.id = t.customer_id\n" +
|
||||
// " where t.state = 5\n" +
|
||||
" where 1 = 1 and t.sale_type != 3 \n" + saleParams;
|
||||
" where 1 = 1\n" + saleParams;
|
||||
|
||||
if (customer_id != null) {
|
||||
sql += " and c.id = ? \n";
|
||||
|
|
@ -2160,7 +2138,7 @@ public class OrderStatService {
|
|||
" from order_end t\n" +
|
||||
" left join customer c on c.id = t.customer_id\n" +
|
||||
// " where t.state = 5\n" +
|
||||
" where 1 = 1 and t.sale_type != 3 \n" + saleParams;
|
||||
" where 1 = 1\n" + saleParams;
|
||||
|
||||
if (customer_id != null) {
|
||||
sql += " and c.id = ? \n";
|
||||
|
|
|
|||
|
|
@ -493,7 +493,6 @@ public class OrderTempSyncService {
|
|||
order.setSettlementUserId(sysuser.getId());
|
||||
order.setSettlementUserName(sysuser.getName());
|
||||
|
||||
order.setSaleType(ordercluster.getSaleType());
|
||||
order.setState(OrderStateEnum.RECEIVED.getStateid()); // 直接完成,没有前面的过程
|
||||
order.setCreateTime(now);
|
||||
order.setMemo(memo); // 备注
|
||||
|
|
|
|||
Loading…
Reference in New Issue