Commit dda17e74 by linboxuan

Merge branch 'center-order' of http://gitlab.gongsibao.com/jiangyong/zhichan into center-order

parents b47b2c16 058975b2
...@@ -60,6 +60,9 @@ class IcAPI extends APIBase { ...@@ -60,6 +60,9 @@ class IcAPI extends APIBase {
case "confirmIcpIntention":// 2020 0827 lin 新增 4.3 用户需求确认 case "confirmIcpIntention":// 2020 0827 lin 新增 4.3 用户需求确认
opResult = await this.needinfoSve.confirmIcpIntention(pobj, pobj.actionBody, req); opResult = await this.needinfoSve.confirmIcpIntention(pobj, pobj.actionBody, req);
break; break;
case "getUnCreated":// 获取需求列表
opResult = await this.needinfoSve.getUnCreated(pobj, pobj.actionBody, req);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -36,6 +36,8 @@ module.exports = (db, DataTypes) => { ...@@ -36,6 +36,8 @@ module.exports = (db, DataTypes) => {
typeName: DataTypes.STRING(50), //类型产品名称', typeName: DataTypes.STRING(50), //类型产品名称',
channelTypeCode: DataTypes.STRING(50), //渠道产品类型编码', channelTypeCode: DataTypes.STRING(50), //渠道产品类型编码',
channelTypeName: DataTypes.STRING(255), //渠道产品类型名称', channelTypeName: DataTypes.STRING(255), //渠道产品类型名称',
level: DataTypes.STRING(20), //商机等级
probability: DataTypes.STRING(20), //商机概率
}, { }, {
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: true,
......
...@@ -281,7 +281,7 @@ class OrderInfoService extends ServiceBase { ...@@ -281,7 +281,7 @@ class OrderInfoService extends ServiceBase {
let pageIndex = Number(actionBody.pageIndex || 1); let pageIndex = Number(actionBody.pageIndex || 1);
let from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize); let from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize);
let sql = `SELECT orderNo,json_extract(d.deliveryContent,'$.apply.askforId') askforId,json_extract(d.deliveryContent,'$.apply.tradeType') tradeType,json_extract(d.deliveryContent,'$.apply.tradeImg') tradeImg,json_extract(d.deliveryContent,'$.applyUser.applicantName') applicantName,json_extract(d.deliveryContent,'$.deliveryStatusName') deliveryStatusName,json_extract(d.deliveryContent,'$.deliveryUpdated') deliveryUpdated from c_order_info i left join c_order_delivery d on i.orderNo = d.sourceOrderNo where i.uapp_id = ${pobj.appInfo.uapp_id}`; let sql = `SELECT orderNo,json_extract(d.deliveryContent,'$.apply.askforId') askforId,json_extract(d.deliveryContent,'$.apply.tradeType') tradeType,json_extract(d.deliveryContent,'$.apply.tradeImg') tradeImg,json_extract(d.deliveryContent,'$.applyUser.applicantName') applicantName,json_extract(d.deliveryContent,'$.deliveryStatusName') deliveryStatusName,json_extract(d.deliveryContent,'$.deliveryUpdated') deliveryUpdated,i.updated_at updated_at from c_order_info i left join c_order_delivery d on i.orderNo = d.sourceOrderNo where i.uapp_id = ${pobj.appInfo.uapp_id}`;
let sqlCount = `SELECT count(1) as dataCount from c_order_info i left join c_order_delivery d on i.orderNo = d.sourceOrderNo where i.uapp_id = ${pobj.appInfo.uapp_id}`; let sqlCount = `SELECT count(1) as dataCount from c_order_info i left join c_order_delivery d on i.orderNo = d.sourceOrderNo where i.uapp_id = ${pobj.appInfo.uapp_id}`;
if (pobj.userInfo.channel_userid) { if (pobj.userInfo.channel_userid) {
......
...@@ -86,7 +86,10 @@ class NeedinfoService extends ServiceBase { ...@@ -86,7 +86,10 @@ class NeedinfoService extends ServiceBase {
typeName: actionBody.type_name, typeName: actionBody.type_name,
channelTypeCode: actionBody.channel_type_code, channelTypeCode: actionBody.channel_type_code,
channelTypeName: actionBody.channel_type_name, channelTypeName: actionBody.channel_type_name,
status: "wts" status: "wts",
level: actionBody.level || "",
probability: actionBody.probability || "",
notes: actionBody.notes
} }
if (nobj.channelTypeCode == 7 || nobj.channelTypeCode == 5) { if (nobj.channelTypeCode == 7 || nobj.channelTypeCode == 5) {
nobj.province = nobj.city, nobj.province = nobj.city,
...@@ -188,14 +191,14 @@ class NeedinfoService extends ServiceBase { ...@@ -188,14 +191,14 @@ class NeedinfoService extends ServiceBase {
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 sql = "update n_need_info set status=:status, statusName=:statusName where channelNeedNo=:BizId"
var paramWhere = { var paramWhere = {
statusName: '已跟进', statusName: '已跟进',
status: 'ygj', status: 'ygj',
BizId: actionBody.intentionBizId BizId: actionBody.intentionBizId
}; };
var updateRes = await this.customUpdate(sql, paramWhere); var updateRes = await this.customUpdate(sql, paramWhere);
} }
// 有需求单但没有沟通记录 直接set // 有需求单但没有沟通记录 直接set
if (!needRes.followContent) { if (!needRes.followContent) {
...@@ -243,7 +246,7 @@ class NeedinfoService extends ServiceBase { ...@@ -243,7 +246,7 @@ class NeedinfoService extends ServiceBase {
} }
if (nobj.channelTypeCode == 7 || nobj.channelTypeCode == 5) { if (nobj.channelTypeCode == 7 || nobj.channelTypeCode == 5) {
nobj.province = nobj.city, nobj.province = nobj.city,
nobj.city = ""; nobj.city = "";
} }
await this.dao.create(nobj); await this.dao.create(nobj);
return system.getResultSuccess(); return system.getResultSuccess();
...@@ -292,6 +295,20 @@ class NeedinfoService extends ServiceBase { ...@@ -292,6 +295,20 @@ class NeedinfoService extends ServiceBase {
return system.getResultSuccess(); return system.getResultSuccess();
} }
} }
async getUnCreated (pobj, data, req) {
let stdate = new Date(pobj.actionBody.Begin);
let enddate = new Date(pobj.actionBody.End );
let query = {where:{}};
query.where["created_at"] = { [this.db.Op.between]: [stdate, enddate] };
try {
let res = await this.dao.model.findAndCountAll(query);
res = res.rows.map(n=>n.channelNeedNo);
res = pobj.actionBody.data.filter(ali=>!res.includes(ali.BizId));
return system.getResultSuccess(res)
} catch (error) {
return system.getResultFail(-1, error.message)
}
}
} }
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