Commit eef3d660 by 蒋勇

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

parents f968a3a2 3506ce7d
......@@ -89,12 +89,12 @@ class BizOptCtl extends CtlBase {
}
/*根据商机编号更新商机状态*/
async updateStatusByDemandCode(pobj,qobj,req){
async updateStatusByDemandCode(pobj,qobj,req){//关闭需求时调用
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined'){
try{
var res = await this.service.updateStatusByDemandCode(pobj);
await this.schemeService.updateStatusByDemandCode(pobj);//同时更新方案的状态
//调商城接口,回传状态信息,后加
//如果商机状态为关闭,需要回传给商城
if (pobj.currentStatus == "isClosed"){
var rc = system.getObject("util.execClient");
var requrl = this.receiveUrl;
......
......@@ -193,12 +193,37 @@ class SchemeCtl extends CtlBase {
/*根据商机编号更新方案详情*/
async updateInfoByDemandCode(pobj, qobj, req){
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.planInfo && pobj.planInfo != 'undefined'){
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.schemeNumber && schemeNumber != 'undefined'
&& pobj.planInfo && pobj.planInfo != 'undefined'){
try{
var retn = await this.service.updateInfoByDemandCode(pobj);
var bobj = {"businessMode":pobj.businessMode,"currentStatus":"beforeSubmission"};//把商机状态更新回待提交方案
await this.bizoptService.updateStatusByDemandCode(bobj);
return system.getResult("更新成功!");
pobj.currentStatus = "beforeConfirmation";//同时把方案的状态也更新为待确认
//修改方案的时候,需要把修改的方案传给商城
var mobj = pobj;
mobj.businessType = appconfig.pdict.fdyDict[pobj.businessType];
var rc = system.getObject("util.execClient");
var requrl = this.receiveUrl;
var params = {
"actionType":"submitSolution",
"actionBody":{
"needNum": pobj.businessMode,
"solutionNum":pobj.schemeNumber,
"solutionContent": mobj
}
}
var rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
if (j.status == 1){
var retn = await this.service.updateInfoByDemandCode(pobj);//更新方案详情
var bobj = {"businessMode":pobj.businessMode,"currentStatus":"beforeConfirmation"};//同时把商机状态更新回待确认
await this.bizoptService.updateStatusByDemandCode(bobj);
return system.getResult("更新成功!");
}
else{
return system.getResultError("更新方案出错!");
}
}
catch(error){
return system.getResultError(error);
......@@ -227,11 +252,11 @@ class SchemeCtl extends CtlBase {
/*插入方案信息*/
async insertInfo(pobj, qobj, req){
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined'
&& pobj.baseInfo && pobj.baseInfo != 'undefined'){//商机编号必须存在
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.baseInfo && pobj.baseInfo != 'undefined'){//商机编号必须存在
try{
await this.bizoptService.updateStatusByDemandCode(pobj);//修改商机状态
var businessInfo = await this.bizoptService.findInfoByDemandCode(pobj);//得到商机的信息
pobj.currentStatus = "beforeConfirmation";//商机状态为待用户确认
await this.bizoptService.updateStatusByDemandCode(pobj);//先修改商机状态
var businessInfo = await this.bizoptService.findInfoByDemandCode(pobj);//得到商机的信息,插入方案表时要用到
if (businessInfo){
pobj.businessId = businessInfo.id;//商机id
pobj.businessType = businessInfo.business_type;//商机类型
......@@ -241,9 +266,10 @@ class SchemeCtl extends CtlBase {
pobj.clerkId = businessInfo.salesman_id;//业务员id
pobj.clerkName = businessInfo.salesman_name;//业务员名称
pobj.clerkPhone = businessInfo.salesman_phone;//业务员联系电话
pobj.currentStatus = appconfig.pdict.businessStatus[businessInfo.business_status];//商机状态即为方案状态
//pobj.currentStatus = appconfig.pdict.businessStatus[businessInfo.business_status];//商机状态即为方案状态
pobj.statusReason = businessInfo.close_reason;//状态原因
}
//调商城的接口,把商机详情返回给商城
var mobj = pobj;
mobj.businessType = appconfig.pdict.fdyDict[pobj.businessType];
var rc = system.getObject("util.execClient");
......
......@@ -21,14 +21,14 @@ class SchemeDao extends Dao {
return await this.updateByWhere(setobj,whereobj,t);
}
/*根据方案编号更新方案详情*/
/*根据商机编号更新方案详情*/
async updateInfoByDemandCode(qobj,t){
var whereobj = {"demand_code":qobj.businessMode};
var setobj = {"scheme_info":qobj.planInfo};
var setobj = {"scheme_info":qobj.planInfo,"scheme_status":qobj.currentStatus};
return await this.updateByWhere(setobj,whereobj,t);
}
/*根据商机编号更新方案编号*/
/*根据方案编号更新方案编号*/
async updateSchemeNumberByDemandCode(qobj,t){
var setobj = {"scheme_number":qobj.schemeNumber};
var whereobj = {"demand_code":qobj.businessMode};
......
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