Commit 0584e4a2 by 王栋源

wdy

parent 1eae4ae6
......@@ -88,9 +88,9 @@ class NeedinfoService extends ServiceBase {
channelTypeName: actionBody.channel_type_name,
status: "wts"
}
if(nobj.channelTypeCode==7||nobj.channelTypeCode==5){
nobj.province=nobj.city,
nobj.city="";
if (nobj.channelTypeCode == 7 || nobj.channelTypeCode == 5) {
nobj.province = nobj.city,
nobj.city = "";
}
await this.dao.create(nobj);
return system.getResultSuccess();
......@@ -131,9 +131,9 @@ class NeedinfoService extends ServiceBase {
channelTypeName: actionBody.channel_type_name,
status: "wts"
}
if(nobj.channelTypeCode==7||nobj.channelTypeCode==5){
nobj.province=nobj.city,
nobj.city="";
if (nobj.channelTypeCode == 7 || nobj.channelTypeCode == 5) {
nobj.province = nobj.city,
nobj.city = "";
}
await this.dao.create(nobj);
return system.getResultSuccess();
......@@ -162,48 +162,49 @@ class NeedinfoService extends ServiceBase {
}
async getItemByChannelSolutionNo(pobj){
var solutionitem = await this.needsolutionDao.findOne({channelSolutionNo: pobj.actionBody.bizId});
async getItemByChannelSolutionNo(pobj) {
var solutionitem = await this.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.bizId });
if (!solutionitem) {
return system.getResult(null, "需求数据为空,30210");
}
var item = await this.dao.getItemByNeedNo(solutionitem.needNo);
item.solutionProvince = solutionitem.solutionContent.solution.Area;
if (!item) {
return system.getResult(null, "需求数据为空,30210");
}
return system.getResultSuccess(item);
}
async writeCommunicationLog(pobj,actionBody){
async writeCommunicationLog(pobj, actionBody) {
// 查询需求沟通记录
actionBody.Note = ["noteTime",moment().format("YYYY-MM-DD HH:mm:ss"),"note",actionBody.Note];
let needRes = await this.findOne({channelNeedNo:actionBody.BizId});
actionBody.Note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", actionBody.Note];
let needRes = await this.findOne({ channelNeedNo: actionBody.BizId });
// 没有需求单直接返回
if(!needRes) {
if (!needRes) {
return system.getResult("没有这个需求单");
}
}
// 有需求单但没有沟通记录 直接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: actionBody.Note,
BizId: actionBody.BizId
};
var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) {
var updateRes = await this.customUpdate(sql, paramWhere);
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
// 有需求单有沟通记录 json_array_append
// 有需求单有沟通记录 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 = {
var paramWhere = {
Note: actionBody.Note,
BizId: actionBody.BizId
};
var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) {
var updateRes = await this.customUpdate(sql, paramWhere);
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
......
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