Commit 52724d3c by 王栋源

wdy

parent 843fcb5d
......@@ -31,13 +31,13 @@ class IcAPI extends APIBase {
var opResult = null;
switch (action_type) {
case "submitNeed"://提交需求
opResult = await this.needinfoSve.submitNeed(pobj);
opResult = await this.needinfoSve.submitNeed(pobj,pobj.actionBody,req);
break;
case "getItemByNeedNo"://获取需求详情
opResult = await this.needinfoSve.getItemByNeedNo(pobj);
break;
case "needClose"://需求关闭
opResult = await this.needinfoSve.needClose(pobj);
opResult = await this.needinfoSve.needClose(pobj,pobj.actionBody,req);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
......
......@@ -20,13 +20,14 @@ module.exports = (db, DataTypes) => {
productType_id: DataTypes.STRING,//产品类型Id
notes: DataTypes.STRING,//备注
disposeNotes: DataTypes.STRING,//处理的备注
statusName: DataTypes.STRING,
status: {
//wts未推送,yts已推送,ygj已跟进,ycd已成单
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.push_chance_type),
set: function (val) {
this.setDataValue("chanceType", val);
this.setDataValue("chanceTypeName", uiconfig.config.pdict.push_chance_type[val]);
this.setDataValue("status", val);
this.setDataValue("statusName", uiconfig.config.pdict.push_chance_type[val]);
}
},
city: DataTypes.STRING(50), // 城市
......
......@@ -6,6 +6,7 @@ class NeedinfoService extends ServiceBase {
constructor() {
super("dbneed", ServiceBase.getDaoName(NeedinfoService));
this.execlient = system.getObject("util.execClient");
this.needsolutionSve = system.getObject("service.dbneed.needsolutionSve");
}
async getItemByNeedNo(pobj) {
var item = await this.dao.getItemByNeedNo(pobj.actionBody.needNo);
......@@ -45,46 +46,80 @@ class NeedinfoService extends ServiceBase {
// area
// type
// ext
async submitNeed(pobj, actionBody) {
async submitNeed(pobj, actionBody, req) {
var needNo = await this.getBusUid("n");
if (actionBody.intentionBizId) {
if (!actionBody.intentionBizId) {
return system.getResult(null, "intentionBizId不能为空");
}
if (actionBody.mobile) {
if (!actionBody.mobile) {
return system.getResult(null, "mobile不能为空");
}
if (actionBody.type) {
if (!actionBody.type) {
return system.getResult(null, "type不能为空");
}
var ninfo = await this.findOne({ channelNeedNo: actionBody.intentionBizId });
if (ninfo) {
return {
"requestId": req.requestId,
"success": true,
"errorMsg": "已存在",
"errorCode": "ok"
};
}
var nobj = {
uapp_id: pobj.appInfo.uapp_id,
channelNeedNo: actionBody.intentionBizId,
needNo: needNo,
channelUserId: pobj.userInfo.channel_userid,
channelUserId: actionBody.mobile,
publishName: actionBody.userName,
publishContent: actionBody.description,
publishMobile: actionBody.mobile,
city: actionBody.area,
disposeNotes: actionBody.ext,
channelTypeCode: actionBody.type
// disposeNotes: actionBody.ext,
channelTypeCode: actionBody.type,
status: "wts"
}
return await this.dao.create(nobj);
await this.dao.create(nobj);
return {
"requestId": req.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
}
async needClose(pobj) {
if (actionBody.intentionBizId) {
async needClose(pobj, actionBody, req) {
if (!actionBody.intentionBizId) {
return system.getResult(null, "intentionBizId不能为空");
}
var needinfo = await this.findOne({ channelNeedNo: actionBody.intentionBizId });
if (!needinfo) {
return {
"requestId": req.requestId,
"success": false,
"errorMsg": "需求不存在",
"errorCode": "ok"
};
}
if (needinfo.status == "ygb" || needinfo.status == "ycd") {
return {
"requestId": req.requestId,
"success": true,
"errorMsg": "需求已关闭",
"errorCode": "ok"
};
} else {
needinfo.status = "ygb";
var self = this;
return await self.db.transaction(async function (t) {
await self.update(needinfo, t);
var needsolutioninfo = await self.needsolutionDao.findOne({ channelNeedNo: pobj.actionBody.intentionBizId }, t)
needsolutioninfo.status = "yzf";
await self.needsolutionDao.update(needsolutioninfo, t);
// await
})
await self.update(needinfo.dataValues);
await self.needsolutionSve.abolishProgrammeByNeed(pobj);
return {
"requestId": req.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
}
}
async flowinfo(obj) {
......
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