Commit ebc0361d by 任晓松

update 订单统计

parent 6211ce9a
......@@ -1298,22 +1298,22 @@ class OrderInfoService extends ServiceBase {
*/
async getOrdersStatisticsByUappId(pobj) {
let ac = pobj.actionBody;
let sql = `SELECT uapp_id,count(*) count,DATE_FORMAT(created_at,'%Y-%m-%d') time FROM c_order_info WHERE deleted_at is null `;
let sql = `SELECT a.uapp_id,count(*) count,DATE_FORMAT(a.created_at,'%Y-%m-%d') time FROM c_order_info a INNER JOIN c_order_product b ON a.orderNo = b.sourceOrderNo WHERE a.deleted_at is null `;
let whereParam = {};
if (ac.start && ac.end) {
sql += ` AND created_at >= :start AND created_at <= :end`;
sql += ` AND a.created_at >= :start AND a.created_at <= :end`;
whereParam.start = ac.start;
whereParam.end = ac.end;
}
if (ac.type_code) {
sql += ` AND typeCode = :type_code`;
whereParam.type_code = ac.type_code;
if(ac.pathName){
sql += ` AND b.pathName = :pathName`;
whereParam.pathName = ac.pathName;
}
if (ac.status) {
sql += ` AND orderStatus = :status`;
whereParam.status = ac.status;
}
sql += ` GROUP BY uapp_id,DATE_FORMAT(created_at,'%Y-%m-%d') ORDER BY created_at ASC`
sql += ` GROUP BY a.uapp_id,DATE_FORMAT(a.created_at,'%Y-%m-%d') ORDER BY a.created_at ASC`
let result = await this.customQuery(sql, whereParam);
return system.getResultSuccess(result);
}
......@@ -1325,14 +1325,14 @@ class OrderInfoService extends ServiceBase {
*/
async getOrdersStatisticsByProduct(pobj) {
let ac = pobj.actionBody;
let sql = `SELECT b.channelItemName typeCode,a.uapp_id,count( DISTINCT(a.orderNo)) count FROM c_order_info a left join c_order_product b on a.orderNo = b.sourceOrderNo WHERE a.deleted_at is null and b.itemCode is not null `;
let sql = `SELECT b.pathName,a.uapp_id,count( DISTINCT(a.orderNo)) count FROM c_order_info a left join c_order_product b on a.orderNo = b.sourceOrderNo WHERE a.deleted_at is null and b.pathName is not null `;
let whereParams = {};
if (ac.start && ac.end) {
sql += ` and a.created_at >= :start and a.created_at <= :end `;
whereParams.start = ac.start;
whereParams.end = ac.end;
}
sql += ` GROUP BY b.channelItemName,a.uapp_id`;
sql += ` GROUP BY b.pathName,a.uapp_id`;
let result = await this.customQuery(sql, whereParams);
return system.getResultSuccess(result);
}
......@@ -1397,6 +1397,7 @@ class OrderInfoService extends ServiceBase {
b.itemName,
a.totalSum,
a.orderStatusName,
a.notes,
c.contactName,
c.mobile,
a.isPushNum,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment