Commit 0ccaddcd by linboxuan

update writeCommunicationLog

parent e3b31c2e
...@@ -175,19 +175,38 @@ class NeedinfoService extends ServiceBase { ...@@ -175,19 +175,38 @@ class NeedinfoService extends ServiceBase {
} }
async writeCommunicationLog(pobj,actionBody){ async writeCommunicationLog(pobj,actionBody){
// 查询需求沟通记录
actionBody.Note = ["noteTime",moment().format("YYYY-MM-DD HH:mm:ss"),"note",actionBody.Note]; actionBody.Note = ["noteTime",moment().format("YYYY-MM-DD HH:mm:ss"),"note",actionBody.Note];
let needRes = await this.findOne({channelNeedNo:actionBody.BizId});
// 没有需求单直接返回
if(!needRes) {
return system.getResult("没有这个需求单");
}
if(!needRes.followContent) {
var sql = "update n_need_info set followContent=JSON_OBJECT(:followContent) where channelNeedNo=:BizId"
var paramWhere = {
followContent: actionBody.Note,
BizId: actionBody.BizId
};
var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
} 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_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 sql = "update n_need_info set followContent=json_array_append(followContent, '$', "+ "\"" + JSON.stringify(actionBody.Note) + "\""+") where channelNeedNo="+ "\"" +actionBody.BizId +"\"" +" "
var paramWhere = { var paramWhere = {
Note: actionBody.Note, Note: actionBody.Note,
BizId: actionBody.BizId BizId: actionBody.BizId
}; };
let updateRes = await this.customUpdate(sql,paramWhere); var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) { if(updateRes[1]) {
return system.getResultSuccess(); return system.getResultSuccess();
} }
return system.getResult("添加记录失败"); return system.getResult("添加记录失败");
} }
}
} }
module.exports = NeedinfoService; module.exports = NeedinfoService;
......
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