Commit 983babc4 by 王勇飞

pp

parents 418b3029 0b0b8162
...@@ -9,9 +9,9 @@ class BizOptCtl extends CtlBase { ...@@ -9,9 +9,9 @@ class BizOptCtl extends CtlBase {
constructor() { constructor() {
super("bizchance", CtlBase.getServiceName(BizOptCtl)); super("bizchance", CtlBase.getServiceName(BizOptCtl));
this.schemeService = system.getObject("service.bizchance.schemeSve"); this.schemeService = system.getObject("service.bizchance.schemeSve");
this.schemeSve = system.getObject("service.bizchance.fitaxschemeSve");//财税-方案信息 this.schemeSve = system.getObject("service.bizchance.fitaxschemeSve"); //财税-方案信息
this.fitaxcompanySve = system.getObject("service.bizchance.fitaxcompanySve");//财税-企业信息 this.fitaxcompanySve = system.getObject("service.bizchance.fitaxcompanySve"); //财税-企业信息
this.operationrecordSve = system.getObject("service.bizchance.operationrecordSve");//财税-需求分配记录 this.operationrecordSve = system.getObject("service.bizchance.operationrecordSve"); //财税-需求分配记录
this.logService = system.getObject("service.bizchance.statuslogSve"); this.logService = system.getObject("service.bizchance.statuslogSve");
this.shisService = system.getObject("service.bizchance.salesmanhisSve"); this.shisService = system.getObject("service.bizchance.salesmanhisSve");
this.receiveUrl = settings.receiveUrl(); this.receiveUrl = settings.receiveUrl();
...@@ -40,22 +40,21 @@ class BizOptCtl extends CtlBase { ...@@ -40,22 +40,21 @@ class BizOptCtl extends CtlBase {
let results = rs.results.rows; let results = rs.results.rows;
results.forEach(element => { results.forEach(element => {
let robj = {}; let robj = {};
robj.id = element.id;//数据的id robj.id = element.id; //数据的id
robj.demand_code = element.demand_code;//商机编号 robj.demand_code = element.demand_code; //商机编号
robj.v_cophone = system.decryptStr(element.v_cophone);//联系电话-shousuo robj.v_cophone = system.decryptStr(element.v_cophone); //联系电话-shousuo
robj.business_status = element.business_status;//商机当前状态 robj.business_status = element.business_status; //商机当前状态
if (element.business_info.serviceName && element.business_info.serviceName != 'undefined') { if (element.business_info.serviceName && element.business_info.serviceName != 'undefined') {
robj.address = element.business_info.serviceName;//服务地区 robj.address = element.business_info.serviceName; //服务地区
} } else {
else {
robj.address = ""; robj.address = "";
} }
// robj.updated_at = this.timeFormat(element.updated_at);//商机当前状态日期 // robj.updated_at = this.timeFormat(element.updated_at);//商机当前状态日期
robj.updated_at = element.updated_at;//商机当前状态日期 robj.updated_at = element.updated_at; //商机当前状态日期
robj.business_type = element.business_type;//商机类型 robj.business_type = element.business_type; //商机类型
robj.v_coname = element.v_coname;//联系人-shousuo robj.v_coname = element.v_coname; //联系人-shousuo
robj.source_name = element.source_name;//渠道来源--前端服务 robj.source_name = element.source_name; //渠道来源--前端服务
robj.servicerName = element.facilitator_name;//服务商名称 robj.servicerName = element.facilitator_name; //服务商名称
// robj.facilitator_name = element.facilitator_name;//服务商名称 // robj.facilitator_name = element.facilitator_name;//服务商名称
// robj.sourceName = element.source_name;//渠道来源 // robj.sourceName = element.source_name;//渠道来源
...@@ -154,10 +153,10 @@ class BizOptCtl extends CtlBase { ...@@ -154,10 +153,10 @@ class BizOptCtl extends CtlBase {
var pobj = mobj.d; var pobj = mobj.d;
if (pobj.demand_code && pobj.demand_code != 'undefined') { if (pobj.demand_code && pobj.demand_code != 'undefined') {
try { try {
var bizoptInfo = await this.service.findInfoByDemandCode(pobj);//需求信息 var bizoptInfo = await this.service.findInfoByDemandCode(pobj); //需求信息
var companyInfo = await this.fitaxcompanySve.findInfo(pobj);//企业信息 var companyInfo = await this.fitaxcompanySve.findInfo(pobj); //企业信息
var schemeInfo = await this.schemeSve.findInfo(pobj);//方案详情 var schemeInfo = await this.schemeSve.findInfo(pobj); //方案详情
var followUpinfos = await this.operationrecordSve.findAllInfo(pobj);//线索记录 var followUpinfos = await this.operationrecordSve.findAllInfo(pobj); //线索记录
return system.getResult({ bizoptInfo: bizoptInfo, companyInfo: companyInfo, schemeInfo: schemeInfo, followUpinfos: followUpinfos }); return system.getResult({ bizoptInfo: bizoptInfo, companyInfo: companyInfo, schemeInfo: schemeInfo, followUpinfos: followUpinfos });
} catch (error) { } catch (error) {
...@@ -178,27 +177,26 @@ class BizOptCtl extends CtlBase { ...@@ -178,27 +177,26 @@ class BizOptCtl extends CtlBase {
var ms = await this.schemeService.findInfoByDemandCode(pobj); var ms = await this.schemeService.findInfoByDemandCode(pobj);
var rarr = {} var rarr = {}
if (rs) { if (rs) {
var statusInfo = { "currentStatus": rs.business_status };//商机状态 var statusInfo = { "currentStatus": rs.business_status }; //商机状态
var businessInfo = {}; var businessInfo = {};
businessInfo.demand_code = rs.demand_code;//商机编号 businessInfo.demand_code = rs.demand_code; //商机编号
businessInfo.channelSource = appconfig.pdict.source[rs.source_name];///渠道来源 businessInfo.channelSource = appconfig.pdict.source[rs.source_name]; ///渠道来源
// businessInfo.businessType = rs.business_type;//商机类型代码 // businessInfo.businessType = rs.business_type;//商机类型代码
businessInfo.businessType = appconfig.pdict.businessType[rs.business_type];//商机类型名称 businessInfo.businessType = appconfig.pdict.businessType[rs.business_type]; //商机类型名称
// businessInfo.serviceArea = rs.service_address;//服务地区 // businessInfo.serviceArea = rs.service_address;//服务地区
if (businessInfo.businessName == "云上园区注册") { if (businessInfo.businessName == "云上园区注册") {
businessInfo.serviceArea = appconfig.pdict.registeredParkDict[rs.service_address];//服务地区名称 businessInfo.serviceArea = appconfig.pdict.registeredParkDict[rs.service_address]; //服务地区名称
} } else {
else { businessInfo.serviceArea = appconfig.pdict.registeredAreaDict[rs.service_address]; //服务地区名称
businessInfo.serviceArea = appconfig.pdict.registeredAreaDict[rs.service_address];//服务地区名称
} }
if (businessInfo.businessName == "注册地址") { if (businessInfo.businessName == "注册地址") {
businessInfo.registeredAddress = appconfig.pdict.registeredAreaDict[rs.service_address];//注册地址名称 businessInfo.registeredAddress = appconfig.pdict.registeredAreaDict[rs.service_address]; //注册地址名称
} }
businessInfo.statusReason = rs.close_reason;//商机关闭原因 businessInfo.statusReason = rs.close_reason; //商机关闭原因
businessInfo.memoInfo = rs.business_info.memoInfo;//备注信息 businessInfo.memoInfo = rs.business_info.memoInfo; //备注信息
businessInfo.contactsName = rs.business_info.contactsName;//联系人名称 businessInfo.contactsName = rs.business_info.contactsName; //联系人名称
businessInfo.contactsPhone = system.decryptStr(rs.business_info.contactsPhone);//联系人联系方式 businessInfo.contactsPhone = system.decryptStr(rs.business_info.contactsPhone); //联系人联系方式
businessInfo.createdTime = this.timeFormat(rs.created_at);//商机创建时间 businessInfo.createdTime = this.timeFormat(rs.created_at); //商机创建时间
rarr.statusInfo = statusInfo; rarr.statusInfo = statusInfo;
rarr.businessInfo = businessInfo; rarr.businessInfo = businessInfo;
} }
...@@ -208,22 +206,19 @@ class BizOptCtl extends CtlBase { ...@@ -208,22 +206,19 @@ class BizOptCtl extends CtlBase {
planInfo.currentStatus = ms.scheme_status; planInfo.currentStatus = ms.scheme_status;
if (ms.scheme_status && ms.scheme_status == "isReject") { if (ms.scheme_status && ms.scheme_status == "isReject") {
planInfo.currentStatus = "已退回"; planInfo.currentStatus = "已退回";
} } else {
else {
planInfo.currentStatus = ms.scheme_status; planInfo.currentStatus = ms.scheme_status;
} }
planInfo.statusReason = ms.reject_reason; planInfo.statusReason = ms.reject_reason;
rarr.planInfo = planInfo; rarr.planInfo = planInfo;
} }
return system.getResult(rarr); return system.getResult(rarr);
} } catch (error) {
catch (error) {
console.log("eeeeeeeeeeeeeeeeeeeeee"); console.log("eeeeeeeeeeeeeeeeeeeeee");
console.log(error); console.log(error);
return system.getResultError(error); return system.getResultError(error);
} }
} } else {
else {
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
...@@ -254,20 +249,17 @@ class BizOptCtl extends CtlBase { ...@@ -254,20 +249,17 @@ class BizOptCtl extends CtlBase {
"newFacilitatorName": pobj.facilitatorName "newFacilitatorName": pobj.facilitatorName
} }
} }
await this.shisService.insertInfo(sInfo);//之前业务员转历史 await this.shisService.insertInfo(sInfo); //之前业务员转历史
await this.service.updateSalesmanInfoByDemandCode(pobj);//更新业务员信息 await this.service.updateSalesmanInfoByDemandCode(pobj); //更新业务员信息
return system.getResult("操作成功!"); return system.getResult("操作成功!");
} } else {
else {
return system.getResultError("未找到相关数据"); return system.getResultError("未找到相关数据");
} }
} } catch (error) {
catch (error) {
return system.getResultError(error); return system.getResultError(error);
} }
} } else {
else {
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
...@@ -277,7 +269,7 @@ class BizOptCtl extends CtlBase { ...@@ -277,7 +269,7 @@ class BizOptCtl extends CtlBase {
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined') { if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined') {
try { try {
await this.service.updateStatusByDemandCode(pobj); await this.service.updateStatusByDemandCode(pobj);
await this.schemeService.updateStatusByDemandCode(pobj);//同时更新方案的状态 await this.schemeService.updateStatusByDemandCode(pobj); //同时更新方案的状态
var res = await this.service.findInfoByDemandCode(pobj); var res = await this.service.findInfoByDemandCode(pobj);
if (res && res != 'undefined') { if (res && res != 'undefined') {
var logInfo = { var logInfo = {
...@@ -288,7 +280,7 @@ class BizOptCtl extends CtlBase { ...@@ -288,7 +280,7 @@ class BizOptCtl extends CtlBase {
"clerkName": res.salesman_name, "clerkName": res.salesman_name,
"clerkId": res.salesman_id "clerkId": res.salesman_id
} }
await this.logService.insertInfo(logInfo);//插入状态日志表 await this.logService.insertInfo(logInfo); //插入状态日志表
} }
if (pobj.currentStatus == "isClosed") { //关闭需求时调用 if (pobj.currentStatus == "isClosed") { //关闭需求时调用
...@@ -310,20 +302,16 @@ class BizOptCtl extends CtlBase { ...@@ -310,20 +302,16 @@ class BizOptCtl extends CtlBase {
var j = JSON.parse(rtn.stdout); var j = JSON.parse(rtn.stdout);
if (j.status == 1) { if (j.status == 1) {
return system.getResult("操作成功!"); return system.getResult("操作成功!");
} } else {
else {
return system.getResultError("更新方案状态出错!"); return system.getResultError("更新方案状态出错!");
} }
} } else {
else {
return system.getResult("操作成功!"); return system.getResult("操作成功!");
} }
} } catch (error) {
catch (error) {
return system.getResultError(error); return system.getResultError(error);
} }
} } else {
else {
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
...@@ -336,30 +324,31 @@ class BizOptCtl extends CtlBase { ...@@ -336,30 +324,31 @@ class BizOptCtl extends CtlBase {
//pobj.currentStatus = "beforeSubmission";//加上当前状态为待提交方案 //pobj.currentStatus = "beforeSubmission";//加上当前状态为待提交方案
// pobj.channelSource = "tencentCloud";//目前渠道只有腾讯 // pobj.channelSource = "tencentCloud";//目前渠道只有腾讯
// pobj.sourceNumber = "1111111"; // pobj.sourceNumber = "1111111";
pobj.businessType = appconfig.pdict.dyDict[pobj.businessType]; // pobj.businessType = appconfig.pdict.dyDict[pobj.businessType];
var buInfo = await this.service.insertInfo(pobj); var buInfo = await this.service.insertInfo(pobj);
var logInfo = { var logInfo = {
"flowType": "BIZ", "flowType": "BIZ",
"flowId": buInfo.id, "flowId": buInfo.id,
"statusCode": pobj.currentStatus, "statusCode": pobj.bussinessStatus,
"clerkName": pobj.clerkName, "clerkName": pobj.salesmanName,
"clerkId": pobj.salesmanId "clerkId": pobj.salesmanId
} }
await this.logService.insertInfo(logInfo);//插入状态日至表 await this.logService.insertInfo(logInfo); //插入状态日至表
return { return {
"status": 1, //1代表成功,否则失败 "status": 1, //1代表成功,否则失败
"message": "操作成功", "message": "操作成功",
"data": "", "data": "",
"requestId": "" "requestId": ""
}; };
} } catch (error) {
catch (error) {
console.log("TTTTTTTTTTTTTTTTTTTTTTT"); console.log("TTTTTTTTTTTTTTTTTTTTTTT");
console.log(error); console.log(error);
return system.getResultError(error); return system.getResultError(error);
} }
} } else {
else {
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
......
...@@ -19,8 +19,7 @@ class BizoptDao extends Dao { ...@@ -19,8 +19,7 @@ class BizoptDao extends Dao {
*/ */
if (!qobj.opath) { // 管理员 不做处理 if (!qobj.opath) { // 管理员 不做处理
} else if (qobj.isPrincipal) { // 销售主管 查询为空和自己组织结构下的 } else if (qobj.isPrincipal) { // 销售主管 查询为空和自己组织结构下的
filters.push({ qw["$or"] = [
$or: [
{ {
salesman_opcode: { salesman_opcode: {
$eq: null $eq: null
...@@ -29,11 +28,8 @@ class BizoptDao extends Dao { ...@@ -29,11 +28,8 @@ class BizoptDao extends Dao {
salesman_opcode: { $like: `%${qobj.opath}%` } salesman_opcode: { $like: `%${qobj.opath}%` }
} }
] ]
});
} else { // 销售 查询自己的 } else { // 销售 查询自己的
filters.push({ qw["salesman_opcode"] = { $like: `%${qobj.opath}%` }
salesman_opcode: { $like: `%${qobj.opath}%` }
});
} }
//不是来自平台前端查询 //不是来自平台前端查询
if (qobj.bizpath && qobj.bizpath.indexOf("pmx") < 0) { if (qobj.bizpath && qobj.bizpath.indexOf("pmx") < 0) {
...@@ -75,8 +71,7 @@ class BizoptDao extends Dao { ...@@ -75,8 +71,7 @@ class BizoptDao extends Dao {
var setobj = { "business_status": qobj.business_status }; var setobj = { "business_status": qobj.business_status };
if (qobj.close_reason && qobj.close_reason != 'undefined') { if (qobj.close_reason && qobj.close_reason != 'undefined') {
setobj["close_reason"] = qobj.close_reason; setobj["close_reason"] = qobj.close_reason;
} } else {
else {
setobj["close_reason"] = ""; setobj["close_reason"] = "";
} }
var whereobj = { "demand_code": qobj.demand_code }; var whereobj = { "demand_code": qobj.demand_code };
...@@ -113,47 +108,35 @@ class BizoptDao extends Dao { ...@@ -113,47 +108,35 @@ class BizoptDao extends Dao {
var obj = { var obj = {
"demand_code": qobj.businessMode, "demand_code": qobj.businessMode,
"business_type": qobj.businessType, "business_type": qobj.businessType,
"business_status": qobj.currentStatus, "business_status": qobj.bussinessStatus,
"business_info": {} "business_info": {},
"source_number": qobj.sourceNumber,
"service_address": qobj.serviceAddress,
"facilitator_id": qobj.favilitatorID,
"facilitator_name": qobj.favilitatorName,
"source_name": qobj.sourceName,
}; };
if (qobj.channelSource && qobj.channelSource != 'undefined') { //business_info START
obj.source_name = qobj.channelSource; if (qobj.topOrgCode && qobj.topOrgCode != 'undefined') {
} obj.business_info.topOrgCode = qobj.topOrgCode
if (qobj.sourceNumber && qobj.sourceNumber != 'undefined') {
obj.source_number = qobj.sourceNumber;
} }
if (qobj.serviceCode && qobj.serviceCode != 'undefined') { if (qobj.intentionBizId && qobj.intentionBizId != 'undefined') {
obj.service_address = qobj.serviceCode; obj.business_info.intentionBizId = qobj.intentionBizId;
} }
if (qobj.memoInfo && qobj.memoInfo != 'undefined') { if (qobj.contactsPhone && qobj.contactsPhone != 'undefined') {
obj.business_info.memoInfo = qobj.memoInfo; obj.business_info.contactsPhone = qobj.contactsPhone; //已经加密
}
if (qobj.statusReason && qobj.statusReason != 'undefined') {
obj.close_reason = qobj.statusReason;
} }
if (qobj.contactsName && qobj.contactsName != 'undefined') { if (qobj.contactsName && qobj.contactsName != 'undefined') {
obj.business_info.contactsName = qobj.contactsName; obj.business_info.contactsName = qobj.contactsName;
} }
if (qobj.contactsPhone && qobj.contactsPhone != 'undefined') {
obj.business_info.contactsPhone = qobj.contactsPhone;//已经加密
}
if (qobj.serviceName && qobj.serviceName != 'undefined') { if (qobj.serviceName && qobj.serviceName != 'undefined') {
obj.business_info.serviceName = qobj.serviceName; obj.business_info.serviceName = qobj.serviceName;
} }
if (qobj.businessName && qobj.businessName != 'undefined') {
obj.business_info.businessName = qobj.businessName; //bussiness_info END
} //other
if (qobj.UserName && qobj.UserName != 'undefined') { if (qobj.closeReason && qobj.closeReason != 'undefined') {
obj.business_info.userName = qobj.UserNames; obj.close_reason = qobj.closeReason;
}
if (qobj.companyName && qobj.companyName != 'undefined') {
obj.business_info.companyName = qobj.companyName;
}
if (qobj.servicerCode && qobj.servicerCode != 'undefined') {
obj.facilitator_id = qobj.servicerCode;
}
if (qobj.servicerName && qobj.servicerName != 'undefined') {
obj.facilitator_name = qobj.servicerName;
} }
if (qobj.salesmanOpcode && qobj.salesmanOpcode != 'undefined') { if (qobj.salesmanOpcode && qobj.salesmanOpcode != 'undefined') {
obj.salesman_opcode = qobj.salesmanOpcode; obj.salesman_opcode = qobj.salesmanOpcode;
...@@ -161,12 +144,13 @@ class BizoptDao extends Dao { ...@@ -161,12 +144,13 @@ class BizoptDao extends Dao {
if (qobj.salesmanId && qobj.salesmanId != 'undefined') { if (qobj.salesmanId && qobj.salesmanId != 'undefined') {
obj.salesman_id = qobj.salesmanId; obj.salesman_id = qobj.salesmanId;
} }
if (qobj.clerkName && qobj.clerkName != 'undefined') { if (qobj.salesmanName && qobj.salesmanName != 'undefined') {
obj.salesman_name = qobj.clerkName; obj.salesman_name = qobj.salesmanName;
} }
if (qobj.clerkPhone && qobj.clerkPhone != 'undefined') { if (qobj.salesmanPhone && qobj.salesmanPhone != 'undefined') {
obj.salesman_phone = qobj.clerkPhone; obj.salesman_phone = qobj.salesmanPhone;
} }
return await this.create(obj, t); return await this.create(obj, t);
} }
......
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