Commit 20a8e468 by 兰国旗

laolan

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