Commit f30f40c4 by 宋毅

Merge branch 'center-order' of gitlab.gongsibao.com:jiangyong/zhichan into center-order

parents 66ffbad1 dd70dbc0
...@@ -149,7 +149,7 @@ class NeedinfoService extends ServiceBase { ...@@ -149,7 +149,7 @@ class NeedinfoService extends ServiceBase {
*/ */
async getStatisticsByUappId(pobj){ async getStatisticsByUappId(pobj){
let ac = pobj.actionBody; let ac = pobj.actionBody;
let sql = `SELECT uapp_id,count(*) count,DATE_FORMAT(created_at,'%Y-%m-%d') time FROM n_need_info WHERE deleted_at is null AND (channelTypeName <> "商标交易" or channelTypeName is null)`; let sql = `SELECT uapp_id,count(*) count,DATE_FORMAT(created_at,'%Y-%m-%d') time FROM n_need_info WHERE deleted_at is null AND (channelTypeName <> "商标交易" or channelTypeName is not null)`;
let whereParam = {}; let whereParam = {};
if(ac.start&&ac.end){ if(ac.start&&ac.end){
sql += ` AND created_at >= :start AND created_at <= :end`; sql += ` AND created_at >= :start AND created_at <= :end`;
...@@ -176,7 +176,7 @@ class NeedinfoService extends ServiceBase { ...@@ -176,7 +176,7 @@ class NeedinfoService extends ServiceBase {
*/ */
async getNeedFunnelStatistics(pobj){ async getNeedFunnelStatistics(pobj){
let ac = pobj.actionBody; let ac = pobj.actionBody;
let sql = `select count(*) count from n_need_info where deleted_at is null AND (channelTypeName <> "商标交易" or channelTypeName is null) `; let sql = `select count(*) count from n_need_info where deleted_at is null AND (channelTypeName <> "商标交易" or channelTypeName is not null) `;
let sql2 = sql + ` and status in('ygj','ygb','ycd')`; let sql2 = sql + ` and status in('ygj','ygb','ycd')`;
let sql3 = sql + ` and status = 'ycd'`; let sql3 = sql + ` and status = 'ycd'`;
let whereParams = {}; let whereParams = {};
...@@ -217,7 +217,7 @@ class NeedinfoService extends ServiceBase { ...@@ -217,7 +217,7 @@ class NeedinfoService extends ServiceBase {
*/ */
async getStatisticsByProduct(pobj){ async getStatisticsByProduct(pobj){
let ac = pobj.actionBody; 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 null) `; 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 = {}; let whereParams = {};
if(ac.start&&ac.end){ if(ac.start&&ac.end){
sql += ` and created_at >= :start and created_at <= :end `; sql += ` and created_at >= :start and created_at <= :end `;
...@@ -235,7 +235,7 @@ class NeedinfoService extends ServiceBase { ...@@ -235,7 +235,7 @@ class NeedinfoService extends ServiceBase {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async getNeedProductType(pobj){ async getNeedProductType(pobj){
let sql = `select typeName,count(*) count from n_need_info where typeName is not null AND (channelTypeName <> "商标交易" or channelTypeName is null) GROUP BY typeName`; let sql = `select typeName,count(*) count from n_need_info where typeName is not null AND (channelTypeName <> "商标交易" or channelTypeName is not null) GROUP BY typeName`;
let result = await this.customQuery(sql); let result = await this.customQuery(sql);
let typeNames = result.map(item =>{ let typeNames = result.map(item =>{
return item.typeName; return item.typeName;
...@@ -250,7 +250,7 @@ class NeedinfoService extends ServiceBase { ...@@ -250,7 +250,7 @@ class NeedinfoService extends ServiceBase {
*/ */
async getStatisticsByCity(pobj){ async getStatisticsByCity(pobj){
let ac = pobj.actionBody; let ac = pobj.actionBody;
let sql = `select typeName typeCode,province,count(*) count from n_need_info where province is not null and typeCode is not null AND (channelTypeName <> "商标交易" or channelTypeName is null) `; let sql = `select typeName typeCode,province,count(*) count from n_need_info where province is not null and typeCode is not null AND (channelTypeName <> "商标交易" or channelTypeName is not null) `;
let whereParams = {}; let whereParams = {};
if(ac.start&&ac.end){ if(ac.start&&ac.end){
sql += ` and created_at >= :start and created_at <= :end `; sql += ` and created_at >= :start and created_at <= :end `;
...@@ -277,8 +277,8 @@ class NeedinfoService extends ServiceBase { ...@@ -277,8 +277,8 @@ class NeedinfoService extends ServiceBase {
*/ */
async getNeedComparison(pobj){ async getNeedComparison(pobj){
let ab =pobj.actionBody; let ab =pobj.actionBody;
let sql1 = `select count(DISTINCT(channelNeedNo)) count from n_need_info where deleted_at is null AND (channelTypeName <> "商标交易" or channelTypeName is null) `; let sql1 = `select count(DISTINCT(channelNeedNo)) count from n_need_info where deleted_at is null AND (channelTypeName <> "商标交易" or channelTypeName is not null) `;
let sql2 = `select count(DISTINCT(b.channelNeedNo)) count from n_need_solution a left join n_need_info b on a.needNo = b.needNo where a.deleted_at is null and b.status = 'ycd' AND (b.channelTypeName <> "商标交易" or b.channelTypeName is null)`; let sql2 = `select count(DISTINCT(b.channelNeedNo)) count from n_need_info b where b.deleted_at is null and b.status = 'ycd' AND (b.channelTypeName <> "商标交易" or b.channelTypeName is not null)`;
let whereParams = {}; let whereParams = {};
if(ab.startNow&&ab.endNow){ if(ab.startNow&&ab.endNow){
sql1 += ` and created_at >= :start and created_at <= :end`; sql1 += ` and created_at >= :start and created_at <= :end`;
...@@ -332,13 +332,13 @@ class NeedinfoService extends ServiceBase { ...@@ -332,13 +332,13 @@ class NeedinfoService extends ServiceBase {
} }
let tag = actionBody.tag; let tag = actionBody.tag;
//需求列表 //需求列表
let needSql = `select DISTINCT(a.channelNeedNo),b.app_name,a.needNo,a.typeName,a.province,a.city,a.publishContent,a.publishName,a.publishMobile,a.statusName,a.created_at from center_order.n_need_info a left join center_app.p_app b on a.uapp_id = b.uapp_id where a.deleted_at is null AND (a.channelTypeName <> "商标交易" or a.channelTypeName is null) `; let needSql = `select DISTINCT(a.channelNeedNo),b.app_name,a.needNo,a.typeName,a.province,a.city,a.publishContent,a.publishName,a.publishMobile,a.statusName,a.created_at from center_order.n_need_info a left join center_app.p_app b on a.uapp_id = b.uapp_id where a.deleted_at is null AND (a.channelTypeName <> "商标交易" or a.channelTypeName is not null) `;
//需求总数 //需求总数
let needTotalSql = `select count(DISTINCT(a.channelNeedNo)) count from center_order.n_need_info a left join center_app.p_app b on a.uapp_id = b.uapp_id where a.deleted_at is null AND (a.channelTypeName <> "商标交易" or a.channelTypeName is null) `; let needTotalSql = `select count(DISTINCT(a.channelNeedNo)) count from center_order.n_need_info a left join center_app.p_app b on a.uapp_id = b.uapp_id where a.deleted_at is null AND (a.channelTypeName <> "商标交易" or a.channelTypeName is not null) `;
//需求成单 //需求成单
let needToOrderSql = `select DISTINCT(b.channelNeedNo),c.app_name,b.channelNeedNo,b.province,b.city,b.typeName,b.publishContent,b.publishName,b.publishMobile,b.statusName,b.created_at from center_order.n_need_solution a left join center_order.n_need_info b on a.needNo = b.needNo left join center_app.p_app c on b.uapp_id = c.uapp_id where a.deleted_at is null and b.status = 'ycd' AND (b.channelTypeName <> "商标交易" or b.channelTypeName is null) `; let needToOrderSql = `select DISTINCT(b.channelNeedNo),c.app_name,b.channelNeedNo,b.province,b.city,b.typeName,b.publishContent,b.publishName,b.publishMobile,b.statusName,b.created_at from center_order.n_need_info b inner join center_app.p_app c on b.uapp_id = c.uapp_id where b.deleted_at is null and b.status = 'ycd' AND (b.channelTypeName <> "商标交易" or b.channelTypeName is not null) `;
//需求成单总数 //需求成单总数
let needToOrderTotalSql = `select count(DISTINCT(a.channelNeedNo)) count from n_need_solution a left join n_need_info b on a.needNo = b.needNo where a.deleted_at is null and b.status = 'ycd' AND (b.channelTypeName <> "商标交易" or b.channelTypeName is null) `; let needToOrderTotalSql = `select count(DISTINCT(b.channelNeedNo)) count from n_need_info b where b.deleted_at is null and b.status = 'ycd' AND (b.channelTypeName <> "商标交易" or b.channelTypeName is not null) `;
let whereParams = {}; let whereParams = {};
if(actionBody.start&&actionBody.end){ if(actionBody.start&&actionBody.end){
needSql += ` and a.created_at >= :start and a.created_at <= :end`; needSql += ` and a.created_at >= :start and a.created_at <= :end`;
......
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