Commit 9e272c8c by 任晓松

add 看板渠道产品统计维度

parent 5eb45076
var APIBase = require("../../api.base"); var APIBase = require("../../api.base");
var system = require("../../../system"); var system = require("../../../system");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
class IcAPI extends APIBase { class IcAPI extends APIBase {
constructor() { constructor() {
super(); super();
this.opNeedInfoSve = system.getObject("service.dbneed.opneedinfoSve"); this.opNeedInfoSve = system.getObject("service.dbneed.opneedinfoSve");
} }
/** /**
* 接口跳转-POST请求 * 接口跳转-POST请求
* action_process 执行的流程 * action_process 执行的流程
* action_type 执行的类型 * action_type 执行的类型
* action_body 执行的参数 * action_body 执行的参数
*/ */
async springBoard(pobj, qobj, req) { async springBoard(pobj, qobj, req) {
if (!pobj.actionType) { if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空"); return system.getResult(null, "actionType参数不能为空");
...@@ -27,6 +29,7 @@ class IcAPI extends APIBase { ...@@ -27,6 +29,7 @@ class IcAPI extends APIBase {
var result = await this.opActionProcess(pobj, pobj.actionType, req); var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result; return result;
} }
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
var opResult = null; var opResult = null;
switch (action_type) { switch (action_type) {
...@@ -48,6 +51,9 @@ class IcAPI extends APIBase { ...@@ -48,6 +51,9 @@ class IcAPI extends APIBase {
case "getStatisticsByProduct": case "getStatisticsByProduct":
opResult = await this.opNeedInfoSve.getStatisticsByProduct(pobj); opResult = await this.opNeedInfoSve.getStatisticsByProduct(pobj);
break; break;
case "getStatisticsByChannel":
opResult = await this.opNeedInfoSve.getStatisticsByChannel(pobj);
break;
case "getNeedProductType": case "getNeedProductType":
opResult = await this.opNeedInfoSve.getNeedProductType(pobj); opResult = await this.opNeedInfoSve.getNeedProductType(pobj);
break; break;
...@@ -61,7 +67,7 @@ class IcAPI extends APIBase { ...@@ -61,7 +67,7 @@ class IcAPI extends APIBase {
opResult = await this.opNeedInfoSve.getNeedComparison(pobj); opResult = await this.opNeedInfoSve.getNeedComparison(pobj);
break; break;
case "getNeedComparisonList": case "getNeedComparisonList":
opResult = await this.opNeedInfoSve.getNeedComparisonList(pobj,pobj.actionBody); opResult = await this.opNeedInfoSve.getNeedComparisonList(pobj, pobj.actionBody);
break; break;
case "updateNeedPushStatus": case "updateNeedPushStatus":
opResult = await this.opNeedInfoSve.updateNeedPushStatus(pobj.actionBody); opResult = await this.opNeedInfoSve.updateNeedPushStatus(pobj.actionBody);
...@@ -74,4 +80,5 @@ class IcAPI extends APIBase { ...@@ -74,4 +80,5 @@ class IcAPI extends APIBase {
} }
} }
module.exports = IcAPI; module.exports = IcAPI;
\ No newline at end of file
...@@ -47,6 +47,9 @@ class OrderAPI extends APIBase { ...@@ -47,6 +47,9 @@ class OrderAPI extends APIBase {
case "getOrderStatisticsByProduct": case "getOrderStatisticsByProduct":
opResult = await this.orderinfoSve.getOrdersStatisticsByProduct(pobj); opResult = await this.orderinfoSve.getOrdersStatisticsByProduct(pobj);
break; break;
case "getOrderStatisticsByChannel":
opResult = await this.orderinfoSve.getOrdersStatisticsByChannel(pobj);
break;
case "getOrdersComparison": case "getOrdersComparison":
opResult = await this.orderinfoSve.getOrdersComparison(pobj); opResult = await this.orderinfoSve.getOrdersComparison(pobj);
break; break;
......
...@@ -1338,6 +1338,25 @@ class OrderInfoService extends ServiceBase { ...@@ -1338,6 +1338,25 @@ class OrderInfoService extends ServiceBase {
} }
/** /**
* 订单统计(产品维度)
* @param pobj
* @returns {Promise<void>}
*/
async getOrdersStatisticsByChannel(pobj) {
let ac = pobj.actionBody;
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 a.uapp_id,b.pathName`;
let result = await this.customQuery(sql, whereParams);
return system.getResultSuccess(result);
}
/**
* 订单对比 * 订单对比
* @param pobj * @param pobj
* @returns {Promise<void>} * @returns {Promise<void>}
......
...@@ -232,6 +232,25 @@ class NeedinfoService extends ServiceBase { ...@@ -232,6 +232,25 @@ class NeedinfoService extends ServiceBase {
} }
/** /**
* 需求统计(产品类型) 总数
* @param pobj
* @returns {Promise<void>}
*/
async getStatisticsByChannel(pobj){
let ac = pobj.actionBody;
let sql = `select typeName typeCode,uapp_id,count(*) count from n_need_info where typeName is not null AND (channelTypeName <> "商标交易" or channelTypeName is not null) `;
let whereParams = {};
if(ac.start&&ac.end){
sql += ` and created_at >= :start and created_at <= :end `;
whereParams.start = ac.start;
whereParams.end = ac.end;
}
sql += ` GROUP BY uapp_id,typeName`;
let result = await this.customQuery(sql,whereParams);
return system.getResultSuccess(result);
}
/**
* 需求统计(获取产品类型) * 需求统计(获取产品类型)
* @param pobj * @param pobj
* @returns {Promise<void>} * @returns {Promise<void>}
......
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