Commit 20a8e468 by 兰国旗

laolan

parent 04966bb4
...@@ -87,8 +87,12 @@ class BaseQcService { ...@@ -87,8 +87,12 @@ class BaseQcService {
attributes: ["id", "status", "statusName", "needNo", "uapp_id"],//2020-10-29 laolan xinzeng uapp_id attributes: ["id", "status", "statusName", "needNo", "uapp_id"],//2020-10-29 laolan xinzeng uapp_id
where: { channelNeedNo: ab.intentionBizId }, raw: true where: { channelNeedNo: ab.intentionBizId }, raw: true
}); });
var uappId = {};
if (!needinfo || !needinfo.id) { if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息"); return system.getResultFail(-201, "未知需求信息");
}else{
//2020-12-11 laolan xiugai
uappId['uapp_id'] = needinfo.uapp_id;
} }
if (needinfo.status == "ygb") { if (needinfo.status == "ygb") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
...@@ -97,6 +101,7 @@ class BaseQcService { ...@@ -97,6 +101,7 @@ class BaseQcService {
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { needNo: needinfo.needNo, isInvalid: 0 }, raw: true where: { needNo: needinfo.needNo, isInvalid: 0 }, raw: true
}); });
if (ns && ns.id) { if (ns && ns.id) {
if (ns.status == "ywc") { if (ns.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案"); return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案");
...@@ -105,9 +110,9 @@ class BaseQcService { ...@@ -105,9 +110,9 @@ class BaseQcService {
if (flowStatus && ["GXB_REFUSE", "CLOSE"].indexOf(flowStatus) < 0) { if (flowStatus && ["GXB_REFUSE", "CLOSE"].indexOf(flowStatus) < 0) {
return system.getResultFail(-104, "⽅案状态为关闭或不予受理才可关闭需求"); return system.getResultFail(-104, "⽅案状态为关闭或不予受理才可关闭需求");
} }
} var self = this;
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) { return await this.needsolutionDao.db.transaction(async function (t) {
var needObj = { var needObj = {
id: needinfo.id, status: "ygb", notes: ab.note id: needinfo.id, status: "ygb", notes: ab.note
}; };
...@@ -115,17 +120,16 @@ class BaseQcService { ...@@ -115,17 +120,16 @@ class BaseQcService {
if (ns && ns.id) { if (ns && ns.id) {
await self.needsolutionDao.model.update({ status: "yzf", isInvalid: 1 }, { where: { id: ns.id }, transaction: t });//方案废弃 await self.needsolutionDao.model.update({ status: "yzf", isInvalid: 1 }, { where: { id: ns.id }, transaction: t });//方案废弃
// return system.getResultSuccess(ns.orderNo); // return system.getResultSuccess(ns.orderNo);
//2020-12-11 laolan xiugai ns = ns ? ns : {};
var uappId = {}; ns = Object.assign(ns,uappId)
uappId['uapp_id'] = needinfo.uapp_id; console.log('guanbi ns +++',ns)
ns = ns ? ns : {}; return system.getResultSuccess(ns);
ns = Object.assign(ns,uappId) }
console.log('guanbi ns +++',ns) })
return system.getResultSuccess(ns); }else{
} return system.getResultSuccess(uappId);
return system.getResultSuccess(); }
}) }
}
//根据需求查看方案列表 //根据需求查看方案列表
async getProgrammeInfoByChannelNeedNo(pobj) { async getProgrammeInfoByChannelNeedNo(pobj) {
......
...@@ -252,16 +252,16 @@ class RegCenterOrderService{ ...@@ -252,16 +252,16 @@ class RegCenterOrderService{
return system.getResultFail(-102, "方案状态不能为空"); return system.getResultFail(-102, "方案状态不能为空");
} }
if (ab.isDirectBuy && ab.isDirectBuy == 1 && ab.status == 1) {//直接下单,无方案 直接返回 if (ab.isDirectBuy && ab.isDirectBuy == 1 && ab.status == 1) {//直接下单,无方案 直接返回
return system.getResultSuccess(); return system.getResultSuccess(pobj);
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.findOne({
where: { channelSolutionNo: ab.channelSolutionId, isInvalid: 0 }, raw: true where: { channelSolutionNo: ab.channelSolutionId, isInvalid: 0 }, raw: true
}); });
if (!ns) { if (!ns) {
return system.getResultFail(-102, "未知方案"); return system.getResultFail(-102, "未知方案");
} }
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.findOne({
where: { needNo: ns.needNo }, raw: true where: { needNo: ns.needNo }, raw: true
}); });
if (!needinfo) { if (!needinfo) {
...@@ -363,7 +363,7 @@ class RegCenterOrderService{ ...@@ -363,7 +363,7 @@ class RegCenterOrderService{
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.findOne({
where: { id: ns.id }, raw: true where: { id: ns.id }, raw: true
}); });
return system.getResultSuccess(new_ns); return system.getResultSuccess(new_ns);
...@@ -391,10 +391,11 @@ class RegCenterOrderService{ ...@@ -391,10 +391,11 @@ class RegCenterOrderService{
"status": "PAID", "status": "PAID",
"bizType": ab.product_info && ab.product_info.item_code?ab.product_info.item_code:"", "bizType": ab.product_info && ab.product_info.item_code?ab.product_info.item_code:"",
"solution": { "solution": {
"Area": ab.area || "", area:ab.area || "",
"IcpType": ab.consultType, price:ab.orderPrice || "",
"CompanyName": ab.companyName || "", regType:ab.consultType || "",
"CompanyAddress": ab.area || "" taxpayerType:ab.taxpayerType || "",
companyProperties:ab.companyProperties || ""
}, },
"totalSum": ab.totalSum || "", "totalSum": ab.totalSum || "",
"typeCode": ab.product_info && ab.product_info.item_code?ab.product_info.item_code:"", "typeCode": ab.product_info && ab.product_info.item_code?ab.product_info.item_code:"",
...@@ -405,7 +406,7 @@ class RegCenterOrderService{ ...@@ -405,7 +406,7 @@ class RegCenterOrderService{
"publishName": pobj.userInfo.channel_nickname || "", "publishName": pobj.userInfo.channel_nickname || "",
"publishMobile": pobj.userInfo.mobile || "" "publishMobile": pobj.userInfo.mobile || ""
}, },
"customerRemark": "", "customerRemark":ab.description || "",
"needStatusName": "处理中", "needStatusName": "处理中",
"customerMaterial": {}, "customerMaterial": {},
"solutionFlowList": [ "solutionFlowList": [
...@@ -823,63 +824,39 @@ class RegCenterOrderService{ ...@@ -823,63 +824,39 @@ class RegCenterOrderService{
console.log('actionBody------',pobj) console.log('actionBody------',pobj)
// 查询需求沟通记录 // 查询需求沟通记录
pobj.actionBody.Note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", pobj.actionBody.note]; pobj.actionBody.Note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", pobj.actionBody.note];
let needRes = await this.findOne({ channelNeedNo: pobj.actionBody.intentionBizId }); let needRes = await this.needinfoDao.findOne({ channelNeedNo: pobj.actionBody.intentionBizId });
console.log('needRes------',needRes)
var uappIds
// 没有需求单直接返回 // 没有需求单直接返回
if (!needRes) { if (!needRes) {
return system.getResult("没有这个需求单"); return system.getResult("没有这个需求单");
} }
// 如果未推送/以推送 修改为已跟进 // 如果未推送/以推送 修改为已跟进
if (needRes.status == "wts" || needRes.status == "yts") { if (needRes.status == "wts" || needRes.status == "yts") {
var sql = "update n_need_info set status=:status, statusName=:statusName where channelNeedNo=:BizId"
var paramWhere = { var paramWhere = {
statusName: '已跟进', statusName: '已跟进',
status: 'ygj', status: 'ygj',
BizId: pobj.actionBody.intentionBizId channelNeedNo: pobj.actionBody.intentionBizId
}; };
var updateRes = await this.customUpdate(sql, paramWhere); var updateRes = await this.needinfoDao.update(paramWhere);
} }
// 有需求单但没有沟通记录 直接set // 有需求单但没有沟通记录 直接set
if (!needRes.followContent) { if (!needRes.followContent) {
var sql = "update n_need_info set followContent=JSON_OBJECT(:followContent) where channelNeedNo=:BizId"
var paramWhere = { var paramWhere = {
followContent: pobj.actionBody.Note, followContent: pobj.actionBody.Note,
BizId: pobj.actionBody.intentionBizId channelNeedNo: pobj.actionBody.intentionBizId
}; };
var updateRes = await this.customUpdate(sql, paramWhere); var updateRes = await this.needinfoDao.update( paramWhere);
if (updateRes[1]) { return system.getResultSuccess(uappIds);
var sql = "select uapp_id from n_need_info where channelNeedNo = :channelNeedNo ";
var where = {
channelNeedNo: pobj.actionBody.intentionBizId
}
var uappIdInfo = await this.customQuery(sql, where);
console.log('uappIdInfo+++', uappIdInfo)
if (uappIdInfo) {
var uappIds = uappIdInfo[0].uapp_id
}
return system.getResultSuccess(uappIds);
}
return system.getResult("添加记录失败");
// 有需求单有沟通记录 json_array_append // 有需求单有沟通记录 json_array_append
} else { } 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(actionBody.Note) + "\""+") where channelNeedNo="+ "\"" +actionBody.BizId +"\"" +" "
var paramWhere = { var paramWhere = {
Note: pobj.actionBody.Note, Note: pobj.actionBody.Note,
BizId: pobj.actionBody.intentionBizId channelNeedNo: pobj.actionBody.intentionBizId
}; };
var updateRes = await this.customUpdate(sql, paramWhere); var updateRes = await this.needinfoDao.update(paramWhere);
if (updateRes[1]) { console.log('updateRes------',updateRes)
var sql = "select uapp_id from n_need_info where channelNeedNo = :channelNeedNo "; return system.getResultSuccess(uappIds);
var where = {
channelNeedNo: pobj.actionBody.intentionBizId
}
var uappIdInfo = await this.customQuery(sql, where);
if (uappIdInfo) {
var uappIds = uappIdInfo[0].uapp_id
}
return system.getResultSuccess(uappIds);
}
return system.getResult("添加记录失败");
} }
} }
//新增查询需求沟通记录 //新增查询需求沟通记录
...@@ -888,17 +865,11 @@ class RegCenterOrderService{ ...@@ -888,17 +865,11 @@ class RegCenterOrderService{
if (!pobj.actionBody.intentionBizId) { if (!pobj.actionBody.intentionBizId) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100493"); return system.getResult(null, "actionBody.intentionBizId can not be empty,100493");
} }
// if (!pobj.actionBody.userFeedBack) { var needinfo = await this.needinfoDao.model.findOne({
// return system.getResult(null, "actionBody.userFeedBack can not be empty,100494"); where: { channelNeedNo: pobj.actionBody.intentionBizId }, raw: true
// } });
var sql = "select uapp_id from n_need_info where channelNeedNo = :channelNeedNo "; if (needinfo) {
var where = { return system.getResultSuccess(needinfo);
channelNeedNo: pobj.actionBody.intentionBizId
}
var uappIdInfo = await this.customQuery(sql, where);
if (uappIdInfo) {
uappIdInfo = uappIdInfo[0];
return system.getResultSuccess(uappIdInfo);
} }
} }
......
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