Commit a9871047 by 任晓松

update

parent 3167856f
...@@ -48,6 +48,9 @@ class IcAPI extends APIBase { ...@@ -48,6 +48,9 @@ class IcAPI extends APIBase {
case "getStatisticsByProduct": case "getStatisticsByProduct":
opResult = await this.opNeedInfoSve.getStatisticsByProduct(pobj); opResult = await this.opNeedInfoSve.getStatisticsByProduct(pobj);
break; break;
case "getNeedProductType":
opResult = await this.opNeedInfoSve.getNeedProductType(pobj);
break;
case "getStatisticsByArea": case "getStatisticsByArea":
opResult = await this.opNeedInfoSve.getStatisticsByCity(pobj); opResult = await this.opNeedInfoSve.getStatisticsByCity(pobj);
break; break;
......
...@@ -156,9 +156,9 @@ class NeedinfoService extends ServiceBase { ...@@ -156,9 +156,9 @@ class NeedinfoService extends ServiceBase {
whereParam.start = ac.start; whereParam.start = ac.start;
whereParam.end = ac.end; whereParam.end = ac.end;
} }
if(ac.type_code){ if(ac.type_name){
sql += ` AND typeCode = :type_code`; sql += ` AND typeCode = :type_name`;
whereParam.type_code = ac.type_code; whereParam.type_name = ac.type_name;
} }
if(ac.status){ if(ac.status){
sql += ` AND status = :status`; sql += ` AND status = :status`;
...@@ -177,7 +177,7 @@ class NeedinfoService extends ServiceBase { ...@@ -177,7 +177,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 `; let sql = `select count(*) count from n_need_info where deleted_at is null `;
let sql2 = `select count(DISTINCT(a.needNo)) count from n_need_solution a left join n_need_info b on a.needNo = b.needNo where a.deleted_at is null`; let sql2 = sql + ` and status = ygj`
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`;
...@@ -190,14 +190,14 @@ class NeedinfoService extends ServiceBase { ...@@ -190,14 +190,14 @@ class NeedinfoService extends ServiceBase {
sql2 += ` and b.uapp_id = :uapp_id`; sql2 += ` and b.uapp_id = :uapp_id`;
whereParams.uapp_id = ac.uapp_id; whereParams.uapp_id = ac.uapp_id;
} }
if(ac.type_code){ if(ac.type_name){
sql += ` and typeCode = :type_code`; sql += ` and typeCode = :type_name`;
sql2 += ` and b.typeCode = :type_code`; sql2 += ` and b.typeCode = :type_name`;
whereParams.type_code = ac.type_code; whereParams.type_name = ac.type_name;
} }
let total = await this.customQuery(sql,whereParams); let total = await this.customQuery(sql,whereParams);
let middle = await this.customQuery(sql2,whereParams); let middle = await this.customQuery(sql2,whereParams);
let sql3 = sql2 + ` and b.status = 'ycd'` let sql3 = sql + ` and b.status = 'ycd'`
let finish = await this.customQuery(sql3,whereParams); let finish = await this.customQuery(sql3,whereParams);
let result = { let result = {
total:total[0].count, total:total[0].count,
...@@ -208,13 +208,13 @@ class NeedinfoService extends ServiceBase { ...@@ -208,13 +208,13 @@ class NeedinfoService extends ServiceBase {
} }
/** /**
* 需求统计(产品维度 * 需求统计(产品类型
* @param pobj * @param pobj
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
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 typeCode is not null `; let sql = `select typeName typeCode,uapp_id,count(*) count from n_need_info where typeName 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 `;
...@@ -227,6 +227,20 @@ class NeedinfoService extends ServiceBase { ...@@ -227,6 +227,20 @@ class NeedinfoService extends ServiceBase {
} }
/** /**
* 需求统计(获取产品类型)
* @param pobj
* @returns {Promise<void>}
*/
async getNeedProductType(pobj){
let sql = `select typeName,count(*) count from n_need_info where typeName is not null GROUP BY typeName`;
let result = await this.customQuery(sql);
let typeNames = result.map(item =>{
return item.typeName;
})
return system.getResultSuccess(typeNames);
}
/**
* 需求统计(区域维度) * 需求统计(区域维度)
* @param pobj * @param pobj
* @returns {Promise<void>} * @returns {Promise<void>}
...@@ -240,9 +254,9 @@ class NeedinfoService extends ServiceBase { ...@@ -240,9 +254,9 @@ class NeedinfoService extends ServiceBase {
whereParams.start = ac.start; whereParams.start = ac.start;
whereParams.end = ac.end; whereParams.end = ac.end;
} }
if(ac.type_code){ if(ac.type_name){
sql += ` and typeCode = :typeCode`; sql += ` and typeCode = :typeCode`;
whereParams.typeCode = ac.type_code; whereParams.typeCode = ac.type_name;
} }
if(ac.uapp_id){ if(ac.uapp_id){
sql += ` and uapp_id = :uapp_id`; sql += ` and uapp_id = :uapp_id`;
...@@ -274,10 +288,10 @@ class NeedinfoService extends ServiceBase { ...@@ -274,10 +288,10 @@ class NeedinfoService extends ServiceBase {
sql2 += ` and b.uapp_id = :uapp_id`; sql2 += ` and b.uapp_id = :uapp_id`;
whereParams.uapp_id = ab.uapp_id; whereParams.uapp_id = ab.uapp_id;
} }
if(ab.type_code){ if(ab.type_name){
sql1 += ` and typeCode = :type_code`; sql1 += ` and typeName = :type_name`;
sql2 += ` and b.typeCode = :type_code`; sql2 += ` and b.typename = :type_name`;
whereParams.type_code = ab.type_code; whereParams.type_name = ab.type_name;
} }
let totalRet1 = await this.customQuery(sql1,whereParams); let totalRet1 = await this.customQuery(sql1,whereParams);
let orderRet1 = await this.customQuery(sql2,whereParams); let orderRet1 = await this.customQuery(sql2,whereParams);
...@@ -339,12 +353,12 @@ class NeedinfoService extends ServiceBase { ...@@ -339,12 +353,12 @@ class NeedinfoService extends ServiceBase {
needToOrderTotalSql += ` and b.uapp_id = :uapp_id`; needToOrderTotalSql += ` and b.uapp_id = :uapp_id`;
whereParams.uapp_id = actionBody.uapp_id; whereParams.uapp_id = actionBody.uapp_id;
} }
if(actionBody.type_code){ if(actionBody.type_name){
needSql += ` and a.typeCode = :type_code`; needSql += ` and a.typeName = :type_name`;
needTotalSql += ` and a.typeCode = :type_code`; needTotalSql += ` and a.typeName = :type_name`;
needToOrderSql += ` and b.typeCode = :type_code`; needToOrderSql += ` and b.typeName = :type_name`;
needToOrderTotalSql += ` and b.typeCode = :type_code`; needToOrderTotalSql += ` and b.typeName = :type_name`;
whereParams.type_code = actionBody.type_code; whereParams.typeName = actionBody.type_name;
} }
if(actionBody.fuzzy_code){ if(actionBody.fuzzy_code){
needSql += ` and ( a.needNo like :fuzzy_code or a.channelNeedNo like :fuzzy_code or a.publishMobile like :fuzzy_code)`; needSql += ` and ( a.needNo like :fuzzy_code or a.channelNeedNo like :fuzzy_code or a.publishMobile like :fuzzy_code)`;
...@@ -374,12 +388,13 @@ class NeedinfoService extends ServiceBase { ...@@ -374,12 +388,13 @@ class NeedinfoService extends ServiceBase {
} }
return system.getResult(data); return system.getResult(data);
} }
/**
* 修改需求商机推送状态 /**
* @param actionBody * 修改需求商机推送状态
* @returns {Promise<void>} * @param actionBody
*/ * @returns {Promise<void>}
async updateNeedPushStatus(actionBody) { */
async updateNeedPushStatus(actionBody) {
let channelNeedNo = actionBody.intentionBizId; let channelNeedNo = actionBody.intentionBizId;
let setObj = { let setObj = {
status: 'yts', status: 'yts',
......
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