Commit 4d46a261 by 王勇飞

Merge branch 'ic-deliver' of gitlab.gongsibao.com:jiangyong/zhichan into ic-deliver

parents 186ce0e4 a16251a1
......@@ -7,6 +7,28 @@ class BizChanceAPI extends APIBase {
this.bizChanceS=system.getObject("service.bizchance.bizoptSve")
}
/**
* 按照服务商进行分组统计
* @param {*} p
* @param {*} q
* @param {*} req
*/
async statBizChanceCountBySp(p,q,req){
let params={}
params.group={
byFields:['facilitator_name'],
actionType:'count',
aggField:'id',
aliasField:' as chanceCount',
tblName:'bussiness_opportunity',
where:'',
having:'',
}
let rtn=await this.bizChanceS.statBizChanceCountBySp(params)
return system.getResult(rtn)
}
/**
* 待处理商机beforeSubmission
* 处理中商机 beforeConfirmation
*累计处理商机 包括成单和关闭
......
......@@ -35,6 +35,7 @@ class BizOptCtl extends CtlBase {
robj.updated_at = this.timeFormat(element.updated_at);//商机当前状态日期
robj.servicerName = element.facilitator_name;
robj.facilitator_name = element.facilitator_name;
robj.sourceName = element.source_name;//渠道来源
rarr.push(robj);
......
......@@ -218,6 +218,24 @@ class Dao {
async customExecAddOrPutSql(sql, paras = null) {
return this.db.query(sql, paras);
}
/**
* p.group.fields=['','']
* p.group.sumField=''
* p.group.aliasField=' as xxx'
* @param {*} p
*/
async statGroupBy(p,paras,t){
let groupFields=p.group.byFields.join(",")
let aggField=p.group.aggField?p.group.aggField:''
let tblName=p.group.tblName?p.group.tblName:''
let where=p.group.where?p.group.where:''
let having=p.group.having?p.group.having:''
let aliasField=p.group.aliasField?p.group.aliasField:''
let actionType=p.group.actionType?p.group.actionType:'count'
let sql=`select ${groupFields},${actionType}(${aggField}) ${aliasField} from ${tblName} ${where} group by ${groupFields} ${having} WITH ROLLUP`
return this.customQuery(sql,paras,t)
}
async customQuery(sql, paras, t) {
var tmpParas = null;//||paras=='undefined'?{type: this.db.QueryTypes.SELECT }:{ replacements: paras, type: this.db.QueryTypes.SELECT };
if (t && t != 'undefined') {
......
......@@ -6,6 +6,10 @@ class BizOptService extends ServiceBase {
constructor() {
super("bizchance", ServiceBase.getDaoName(BizOptService));
}
async statBizChanceCountBySp(params){
let s=await this.dao.statGroupBy(params,null)
return s
}
/**
* 公司id,平台公司ID为1
* @param {*} companyId
......
let s=['d','dx']
let str=`${s.join(",")}`
console.log(str)
\ No newline at end of file
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