Commit fab0d54a by 王勇飞

pp

parent 3958de66
...@@ -19,7 +19,7 @@ class BizOptCtl extends CtlBase { ...@@ -19,7 +19,7 @@ class BizOptCtl extends CtlBase {
/** /**
* 根据用户id获取商机信息,分页获取 * 根据用户id获取商机信息,分页获取
* @param pobj * @param {*} pobj
*/ */
async findAndCountAll(pobj, qobj, req) { async findAndCountAll(pobj, qobj, req) {
try { try {
...@@ -72,22 +72,50 @@ class BizOptCtl extends CtlBase { ...@@ -72,22 +72,50 @@ class BizOptCtl extends CtlBase {
/** /**
* 需求分配 TODO * 需求分配 TODO
* @param mobj * @param {*} mobj
* @param qobj * @param {*} qobj
* @param req * @param {*} req
*/ */
async distribution(mobj, qobj, req) { async distribution(mobj, qobj, req) {
let pobj = mobj.d; let pobj = mobj.d;
let params = { let params = {
demandCodeList: ["1", "2", "3"],//至少一个需求编号 demand_code_list: ["1", "2", "3"],//至少一个需求编号
salesman_id: "jdlfaj"//唯一标识 salesman_opcode: "",//唯一标识
salesman_id: "jdlfaj",//销售员id
salesman_name: "",//销售员姓名
salesman_phone: "",//销售员手机号
} }
} }
/*根据商机编号获取商机详情*/ /**
* 关闭需求
* @param {*} mobj
*/
async closeBizopt(mobj, qobj, req) {
let pobj = mobj.d;
pobj.business_status = "isClosed";
let params = {
demand_code: "",//需求编号
close_reason: "",//关闭原因
}
//根据需求编号去更新该条需求的状态为已关闭
try {
let res = await this.service.updateStatusByDemandCode(pobj);
//TODO 同步该需求关闭信息到其他系统
return system.getResult("关闭需求成功!");
} catch (error) {
return system.getResultError("bizoptCtl/closeBizopt 关闭需求出错!");
}
}
/**
* 根据需求编号获取需求详情
* @param {*} mobj
*/
async findInfoByDemandCode(mobj, qobj, req) { async findInfoByDemandCode(mobj, qobj, req) {
var pobj = mobj.d; var pobj = mobj.d;
if (pobj.businessMode && pobj.businessMode != 'undefined') { if (pobj.demand_code && pobj.demand_code != 'undefined') {
try { try {
var rs = await this.service.findInfoByDemandCode(pobj); var rs = await this.service.findInfoByDemandCode(pobj);
var ms = await this.schemeService.findInfoByDemandCode(pobj); var ms = await this.schemeService.findInfoByDemandCode(pobj);
...@@ -95,7 +123,7 @@ class BizOptCtl extends CtlBase { ...@@ -95,7 +123,7 @@ class BizOptCtl extends CtlBase {
if (rs) { if (rs) {
var statusInfo = { "currentStatus": rs.business_status };//商机状态 var statusInfo = { "currentStatus": rs.business_status };//商机状态
var businessInfo = {}; var businessInfo = {};
businessInfo.businessMode = 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];//商机类型名称
...@@ -142,7 +170,6 @@ class BizOptCtl extends CtlBase { ...@@ -142,7 +170,6 @@ class BizOptCtl extends CtlBase {
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
/*更新业务员信息*/ /*更新业务员信息*/
async updateSalesmanInfoByDemandCode(mobj, qobj, req) { async updateSalesmanInfoByDemandCode(mobj, qobj, req) {
var pobj = mobj.d; var pobj = mobj.d;
...@@ -203,7 +230,7 @@ class BizOptCtl extends CtlBase { ...@@ -203,7 +230,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") { //关闭需求时调用
......
var system = require("../../../system");
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
const appconfig = system.getSysConfig();
class FitaxcompanyCtl extends CtlBase {
constructor() {
super("bizchance", CtlBase.getServiceName(FitaxcompanyCtl));
}
/**
* 新建企业信息
* @param {*} mobj
*/
async insertInfo(mobj, qobj, req) {
let pobj = mobj.d;
try {
if (!pobj.demand_code) {
return system.getResultError("fitaxschemeCtl/insertInfo 缺少需求编号!");
}
let res = await this.service.insertInfo(pobj);
return system.getResult("新建方案成功!");
} catch (error) {
return system.getResultError("fitaxschemeCtl/insertInfo 新建方案出错!");
}
}
}
module.exports = FitaxcompanyCtl;
var system = require("../../../system");
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
const appconfig = system.getSysConfig();
class FitaxschemeCtl extends CtlBase {
constructor() {
super("bizchance", CtlBase.getServiceName(FitaxschemeCtl));
}
/**
* 新建方案信息
* @param {*} mobj
*/
async insertInfo(mobj, qobj, req) {
let pobj = mobj.d;
try {
if (!pobj.demand_code) {
return system.getResultError("fitaxschemeCtl/insertInfo 缺少需求编号!");
}
let res = await this.service.insertInfo(pobj);
return system.getResult("新建方案成功!");
} catch (error) {
return system.getResultError("fitaxschemeCtl/insertInfo 新建方案出错!");
}
}
}
module.exports = FitaxschemeCtl;
...@@ -20,7 +20,7 @@ class BizoptDao extends Dao { ...@@ -20,7 +20,7 @@ class BizoptDao extends Dao {
//不是来自平台前端查询 //不是来自平台前端查询
if (qobj.bizpath && qobj.bizpath.indexOf("pmx") < 0) { if (qobj.bizpath && qobj.bizpath.indexOf("pmx") < 0) {
qc.where.business_type = qc.where.business_type || { qc.where.business_type = qc.where.business_type || {
[this.db.Op.In]: ["ft"] [this.db.Op.In]: ["bookkeeping"]
} }
// if (qobj.bizpath && qobj.bizpath != "") { // if (qobj.bizpath && qobj.bizpath != "") {
// if (qobj.bizpath.indexOf("myChance") > 0) {//说明是从商机列表过来的 // if (qobj.bizpath.indexOf("myChance") > 0) {//说明是从商机列表过来的
...@@ -41,14 +41,14 @@ class BizoptDao extends Dao { ...@@ -41,14 +41,14 @@ class BizoptDao extends Dao {
/*更新商机状态*/ /*更新商机状态*/
async updateStatusByDemandCode(qobj, t) { async updateStatusByDemandCode(qobj, t) {
var setobj = { "business_status": qobj.currentStatus }; var setobj = { "business_status": qobj.business_status };
if (qobj.statusReason && qobj.statusReason != 'undefined') { if (qobj.close_reason && qobj.close_reason != 'undefined') {
setobj["close_reason"] = qobj.statusReason; setobj["close_reason"] = qobj.close_reason;
} }
else { else {
setobj["close_reason"] = ""; setobj["close_reason"] = "";
} }
var whereobj = { "demand_code": qobj.businessMode }; var whereobj = { "demand_code": qobj.demand_code };
return await this.updateByWhere(setobj, whereobj, t); return await this.updateByWhere(setobj, whereobj, t);
} }
......
...@@ -6,16 +6,42 @@ class FitaxcompanyDao extends Dao { ...@@ -6,16 +6,42 @@ class FitaxcompanyDao extends Dao {
} }
/** /**
*增删改查
*/
/**
* 插入状态信息 * 插入状态信息
* @param {*} qobj * @param {*} qobj
* @param {*} t * @param {*} t
*/ */
async insertInfo(qobj,t){ async insertInfo(qobj, t) {
let obj = {
"demand_code": qobj.demand_code,// 需求编码
}
if (qobj.company_name) {// 企业名称
obj.company_name = qobj.company_name;
}
if (qobj.legal_person) {// 法人姓名
obj.legal_person = qobj.legal_person;
}
if (qobj.tax_number) {// 税号
obj.tax_number = qobj.tax_number;
}
if (qobj.taxpayer_type) {// 纳税人类型
obj.taxpayer_type = qobj.taxpayer_type;
}
if (qobj.engaged_industry) {// 所属行业
obj.engaged_industry = qobj.engaged_industry;
}
if (qobj.region) {// 地区
obj.region = qobj.region;
}
if (qobj.address) {// 企业地址
obj.address = qobj.address;
}
return await this.create(obj, t);
} }
/**
*增删改查
*/
} }
module.exports = FitaxcompanyDao; module.exports = FitaxcompanyDao;
...@@ -14,8 +14,35 @@ class FitaxschemeDao extends Dao { ...@@ -14,8 +14,35 @@ class FitaxschemeDao extends Dao {
* @param {*} qobj * @param {*} qobj
* @param {*} t * @param {*} t
*/ */
async insertInfo(qobj,t){ async insertInfo(qobj, t) {
let obj = {
"demand_code": qobj.demand_code,// 需求编码
}
if (qobj.solution_bizid) {// 方案编号
obj.solution_bizid = qobj.solution_bizid;
}
if (qobj.company_type) {// 公司类型
obj.company_type = qobj.company_type;
}
if (qobj.taxpayer_type) {// 纳税人类型
obj.taxpayer_type = qobj.taxpayer_type;
}
if (qobj.service_name) {// 服务地区
obj.service_name = qobj.service_name;
}
if (qobj.buy_duration) {// 购买时长
obj.buy_duration = qobj.buy_duration;
}
if (qobj.number) {// 数量
obj.number = qobj.number;
}
if (qobj.total_cost) {// 总计费用
obj.total_cost = qobj.total_cost;
}
if (qobj.remarks) {// 备注
obj.remarks = qobj.remarks;
}
return await this.create(obj, t);
} }
} }
module.exports = FitaxschemeDao; module.exports = FitaxschemeDao;
...@@ -16,6 +16,15 @@ module.exports = { ...@@ -16,6 +16,15 @@ module.exports = {
"tencentCloud": "腾讯云" "tencentCloud": "腾讯云"
}, },
"bizoptStatus": {
"pending": "待处理",
"beforeFollowUp": "待跟进",
"followingUp": "跟进中",
"beforeSubmission": "待确认方案",
"isFinished": "已完成",
"isClosed": "已关闭"
},
"businessType": {//商机类型 "businessType": {//商机类型
"companyCase": "公司注册", "companyCase": "公司注册",
"psCase": "云上园区注册", "psCase": "云上园区注册",
......
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
class FitaxcompanyService extends ServiceBase {
constructor() {
super("bizchance", ServiceBase.getDaoName(FitaxcompanyService));
}
async findById(qobj){//根据id获取方案信息
var oid = qobj.id;
return await this.dao.findById(oid);
}
async findInfoByDemandCode(qobj){//根据方案编号获取方案详情
return await this.dao.findInfoByDemandCode(qobj);
}
async updateStatusByDemandCode(qobj){//根据商机编号号更新方案状态及原因
var self=this;
return self.db.transaction(async function (t) {
return await self.dao.updateStatusByDemandCode(qobj,t);
});
}
async updateInfoByDemandCode(qobj){//根据商机编号更新方案详情
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateInfoByDemandCode(qobj,t);
});
}
async updateSchemeNumberByDemandCode(qobj){//根据商机编号更新方案编号
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateSchemeNumberByDemandCode(qobj,t);
});
}
async insertInfo(qobj){//插入方案信息
var self = this;
return await self.db.transaction(async function (t) {
return await self.dao.insertInfo(qobj,t);
});
}
}
module.exports = FitaxcompanyService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
class FitaxschemeService extends ServiceBase {
constructor() {
super("bizchance", ServiceBase.getDaoName(FitaxschemeService));
}
async findById(qobj){//根据id获取方案信息
var oid = qobj.id;
return await this.dao.findById(oid);
}
async findInfoByDemandCode(qobj){//根据方案编号获取方案详情
return await this.dao.findInfoByDemandCode(qobj);
}
async updateStatusByDemandCode(qobj){//根据商机编号号更新方案状态及原因
var self=this;
return self.db.transaction(async function (t) {
return await self.dao.updateStatusByDemandCode(qobj,t);
});
}
async updateInfoByDemandCode(qobj){//根据商机编号更新方案详情
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateInfoByDemandCode(qobj,t);
});
}
async updateSchemeNumberByDemandCode(qobj){//根据商机编号更新方案编号
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateSchemeNumberByDemandCode(qobj,t);
});
}
async insertInfo(qobj){//插入方案信息
var self = this;
return await self.db.transaction(async function (t) {
return await self.dao.insertInfo(qobj,t);
});
}
}
module.exports = FitaxschemeService;
\ 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