Commit d630c43c by linboxuan

Merge branch 'center-order' of http://gitlab.gongsibao.com/jiangyong/zhichan into center-order

parents 702af4f8 5ac3f093
...@@ -85,6 +85,12 @@ class QcAPI extends APIBase { ...@@ -85,6 +85,12 @@ class QcAPI extends APIBase {
case "submitWangwenSolution"://提交方案(文网文)2020-9-27 case "submitWangwenSolution"://提交方案(文网文)2020-9-27
opResult = await this.aliyunqcSve.submitWangwenSolution(pobj); opResult = await this.aliyunqcSve.submitWangwenSolution(pobj);
break; break;
case "closeNeed"://关闭需求(文网文)2020-9-28
opResult = await this.aliyunqcSve.closeNeed(pobj);
break;
case "recordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.aliyunqcSve.recordLog(pobj);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -933,7 +933,7 @@ class AliyunQcService { ...@@ -933,7 +933,7 @@ class AliyunQcService {
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId ,isInvalid:0}, raw: true where: { channelSolutionNo: ab.BizId, isInvalid: 0 }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-102, "未知方案"); return system.getResultFail(-102, "未知方案");
...@@ -948,9 +948,9 @@ class AliyunQcService { ...@@ -948,9 +948,9 @@ class AliyunQcService {
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
var checkStatus = {ABC_CLOSE_PRODUCE: "⼩⼆后台关闭服务单"}; var checkStatus = { ABC_CLOSE_PRODUCE: "⼩⼆后台关闭服务单" };
if(solutionContent.status && checkStatus[solutionContent.status]){ if (solutionContent.status && checkStatus[solutionContent.status]) {
return system.getResultFail(-111, "方案已进入"+solutionContent.statusName+"流程,不能执行此操作"); return system.getResultFail(-111, "方案已进入" + solutionContent.statusName + "流程,不能执行此操作");
} }
//方案流程列表 //方案流程列表
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
...@@ -965,31 +965,31 @@ class AliyunQcService { ...@@ -965,31 +965,31 @@ class AliyunQcService {
id: needinfo.id, status: "ycd" id: needinfo.id, status: "ycd"
} }
await this.needinfoDao.update(needObj);//关闭需求 await this.needinfoDao.update(needObj);//关闭需求
}else if (ab.operationType == "USER_CONFIRM_PRODUCE") {//⽤户确认资料 } else if (ab.operationType == "USER_CONFIRM_PRODUCE") {//⽤户确认资料
solutionFlowList.push({ solutionFlowList.push({
status: "USER_CONFIRM_PRODUCE", statusName: this.ediSolutionStatusReference.USER_CONFIRM_PRODUCE, updated_at: new Date() status: "USER_CONFIRM_PRODUCE", statusName: this.ediSolutionStatusReference.USER_CONFIRM_PRODUCE, updated_at: new Date()
}); });
solutionContent.status = "USER_CONFIRM_PRODUCE"; solutionContent.status = "USER_CONFIRM_PRODUCE";
solutionContent.statusName = this.ediSolutionStatusReference.USER_CONFIRM_PRODUCE; solutionContent.statusName = this.ediSolutionStatusReference.USER_CONFIRM_PRODUCE;
}else if (ab.operationType == "USER_REFUSE_PRODUCE") {//资料退回修改 } else if (ab.operationType == "USER_REFUSE_PRODUCE") {//资料退回修改
solutionFlowList.push({ solutionFlowList.push({
status: "USER_REFUSE_PRODUCE", statusName: this.ediSolutionStatusReference.USER_REFUSE_PRODUCE, updated_at: new Date() status: "USER_REFUSE_PRODUCE", statusName: this.ediSolutionStatusReference.USER_REFUSE_PRODUCE, updated_at: new Date()
}); });
solutionContent.status = "USER_REFUSE_PRODUCE"; solutionContent.status = "USER_REFUSE_PRODUCE";
solutionContent.statusName = this.ediSolutionStatusReference.USER_REFUSE_PRODUCE; solutionContent.statusName = this.ediSolutionStatusReference.USER_REFUSE_PRODUCE;
}else if (ab.operationType == "USER_UPLOAD_PRODUCE") {//⽤户补充基本资料 } else if (ab.operationType == "USER_UPLOAD_PRODUCE") {//⽤户补充基本资料
solutionFlowList.push({ solutionFlowList.push({
status: "USER_UPLOAD_PRODUCE", statusName: this.ediSolutionStatusReference.USER_UPLOAD_PRODUCE, updated_at: new Date() status: "USER_UPLOAD_PRODUCE", statusName: this.ediSolutionStatusReference.USER_UPLOAD_PRODUCE, updated_at: new Date()
}); });
solutionContent.status = "USER_UPLOAD_PRODUCE"; solutionContent.status = "USER_UPLOAD_PRODUCE";
solutionContent.statusName = this.ediSolutionStatusReference.USER_UPLOAD_PRODUCE; solutionContent.statusName = this.ediSolutionStatusReference.USER_UPLOAD_PRODUCE;
}else if (ab.operationType == "ABC_CLOSE_PRODUCE") {//⽅案已关闭 } else if (ab.operationType == "ABC_CLOSE_PRODUCE") {//⽅案已关闭
solutionFlowList.push({ solutionFlowList.push({
status: "ABC_CLOSE_PRODUCE", statusName: this.ediSolutionStatusReference.ABC_CLOSE_PRODUCE, updated_at: new Date() status: "ABC_CLOSE_PRODUCE", statusName: this.ediSolutionStatusReference.ABC_CLOSE_PRODUCE, updated_at: new Date()
}); });
solutionContent.status = "ABC_CLOSE_PRODUCE"; solutionContent.status = "ABC_CLOSE_PRODUCE";
solutionContent.statusName = this.ediSolutionStatusReference.ABC_CLOSE_PRODUCE; solutionContent.statusName = this.ediSolutionStatusReference.ABC_CLOSE_PRODUCE;
}else{ } else {
return system.getResultFail(-110, "状态错误"); return system.getResultFail(-110, "状态错误");
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
...@@ -1014,7 +1014,7 @@ class AliyunQcService { ...@@ -1014,7 +1014,7 @@ class AliyunQcService {
}; };
if (ab.operationType == "ABC_CLOSE_PRODUCE") {//⽅案已关闭 if (ab.operationType == "ABC_CLOSE_PRODUCE") {//⽅案已关闭
updateObj["status"] = "yzf"; updateObj["status"] = "yzf";
updateObj["isInvalid"]=1; updateObj["isInvalid"] = 1;
} }
await this.needsolutionDao.update(updateObj);//方案状态修改 await this.needsolutionDao.update(updateObj);//方案状态修改
var new_ns = await this.needsolutionDao.model.findOne({ var new_ns = await this.needsolutionDao.model.findOne({
...@@ -1227,7 +1227,7 @@ class AliyunQcService { ...@@ -1227,7 +1227,7 @@ class AliyunQcService {
if (!solution) { if (!solution) {
return system.getResultFail(-103, "方案交付信息有误"); return system.getResultFail(-103, "方案交付信息有误");
} }
if (needinfo.channelTypeCode == "官网") {//esp.wangwen if (needinfo.channelTypeCode == "esp.wangwen") {//esp.wangwen
ab.solutionContent.solution.IcpType = "wangwen"; ab.solutionContent.solution.IcpType = "wangwen";
} else { } else {
return system.getResultFail(-208, "需求业务类型有误"); return system.getResultFail(-208, "需求业务类型有误");
...@@ -1305,5 +1305,85 @@ class AliyunQcService { ...@@ -1305,5 +1305,85 @@ class AliyunQcService {
} }
//关闭需求(文网文) 2020-9-28
async closeNeed() {
var ab = pobj.actionBody;
var app = pobj.appInfo;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
if (!ab.needNo) {
return system.getResultFail(-101, "需求编号不能为空");
}
if (!ab.note) {
return system.getResultFail(-106, "关闭理由不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
attributes: ["id", "status", "statusName", "needNo"],
where: { channelNeedNo: ab.needNo }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
}
if (needinfo.status == "ygb") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
var updateNeed = await this.needinfoDao.update(needObj);//关闭需求
if (!updateNeed) {
return system.getResultFail(-203, "关闭需求失败");
} else {
return system.getResultSuccess();
}
}
//提交沟通记录
async recordLog(pobj) {
// 查询需求沟通记录
// 2020 0820 lin 修改channel传过来的参数 为 note/needNo
pobj.actionBody.Note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", pobj.actionBody.note];
let needRes = await this.findOne({ channelNeedNo: pobj.actionBody.needNo});
// 没有需求单直接返回
if (!needRes) {
return system.getResult("没有这个需求单");
}
// 如果未推送/以推送 修改为已跟进
if (needRes.status == "wts" || needRes.status == "yts") {
var sql = "update n_need_info set status=:status, statusName=:statusName where channelNeedNo=:BizId"
var paramWhere = {
statusName: '已跟进',
status: 'ygj',
BizId: pobj.actionBody.needNo
};
var updateRes = await this.customUpdate(sql, paramWhere);
}
// 有需求单但没有沟通记录 直接set
if (!needRes.followContent) {
var sql = "update n_need_info set followContent=JSON_OBJECT(:followContent) where channelNeedNo=:BizId"
var paramWhere = {
followContent: pobj.actionBody.Note,
BizId: pobj.actionBody.needNo
};
var updateRes = await this.customUpdate(sql, paramWhere);
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
// 有需求单有沟通记录 json_array_append
} else {
var sql = "update n_need_info set followContent=json_array_append(followContent, '$', JSON_OBJECT(:Note)) where channelNeedNo=:BizId"
// var sql = "update n_need_info set followContent=json_array_append(followContent, '$', "+ "\"" + JSON.stringify(pobj.actionBody.Note) + "\""+") where channelNeedNo="+ "\"" +pobj.actionBody.BizId +"\"" +" "
var paramWhere = {
Note: pobj.actionBody.Note,
BizId: pobj.actionBody.needNo
};
var updateRes = await this.customUpdate(sql, paramWhere);
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
}
}
} }
module.exports = AliyunQcService; module.exports = AliyunQcService;
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