Commit 400c6b63 by 兰国旗

laolan

parent 5f561eb5
......@@ -85,12 +85,8 @@ class QcAPI extends APIBase {
case "receiveIcpConfirmUrl"://前端关闭ICP需求及方案
opResult = await this.aliyunqcSve.receiveIcpConfirmUrl(pobj);
break;
// --------- 网文 ---------
case "ncGetNeedList"://查询需求列表(网文)2020-11-11
opResult = await this.ncSve.ncGetNeedList(pobj);
break;
case "ncSubmitMaterial"://交付材料提交(网文)2020-11-11
opResult = await this.ncSve.ncSubmitMaterial(pobj);
break;
......@@ -100,27 +96,16 @@ class QcAPI extends APIBase {
case "ncSubmitSolution"://提交方案(网文)2020-11-11
opResult = await this.ncSve.ncSubmitSolution(pobj);
break;
case "ncWriteCommunicationRecord"://提交沟通记录(网文)2020-11-11
opResult = await this.ncSve.ncWriteCommunicationRecord(pobj);
break;
case "ncGetCommunicationRecord"://查询沟通记录(网文)2020-11-11
opResult = await this.ncSve.ncGetCommunicationRecord(pobj);
break;
case "ncCloseNeed"://关闭需求(网文)2020-11-11
opResult = await this.ncSve.ncCloseNeed(pobj);
break;
case "ncClosePlan"://关闭方案(网文)2020-11-11
case "ncClosePlan"://关闭需求(网文)2020-11-11
opResult = await this.ncSve.ncClosePlan(pobj);
break;
case "ncCloseOrderDelivery"://关闭交付单(网文)2020-11-11
opResult = await this.ncSve.ncCloseOrderDelivery(pobj);
case "ncReceiveProgrammeNo":
opResult = await this.ncSve.ncReceiveProgrammeNo(pobj);
break;
// --------- 广电 ---------
case "rtGetNeedList"://查询需求列表(广电)2020-11-11
opResult = await this.rtSve.rtGetNeedList(pobj);
break;
case "rtSubmitMaterial"://交付材料提交(广电)2020-11-11
opResult = await this.rtSve.rtSubmitMaterial(pobj);
break;
......@@ -130,23 +115,13 @@ class QcAPI extends APIBase {
case "rtSubmitSolution"://提交方案(广电)2020-11-11
opResult = await this.rtSve.rtSubmitSolution(pobj);
break;
case "rtWriteCommunicationRecord"://提交沟通记录(广电)2020-11-11
opResult = await this.rtSve.rtWriteCommunicationRecord(pobj);
break;
case "rtGetCommunicationRecord"://查询沟通记录(广电)2020-11-11
opResult = await this.rtSve.rtGetCommunicationRecord(pobj);
break;
case "rtCloseNeed"://关闭需求(广电)2020-11-11
opResult = await this.rtSve.rtCloseNeed(pobj);
break;
case "rtClosePlan"://关闭方案(广电)2020-11-11
case "rtClosePlan"://关闭需求(广电)2020-11-11
opResult = await this.rtSve.rtClosePlan(pobj);
break;
case "rtCloseOrderDelivery"://关闭交付单(广电)2020-11-11
opResult = await this.rtSve.rtCloseOrderDelivery(pobj);
case "rtReceiveProgrammeNo":
opResult = await this.rtSve.rtReceiveProgrammeNo(pobj);
break;
// ----------------------------------------
case "receiveOrderStatusNotify"://接收订单状态推送 百度icp 2.3
opResult = await this.baiduqcSve.receiveOrderStatusNotify(pobj);
break;
......
......@@ -73,6 +73,7 @@ class BaseQcService {
//根据需求关闭ICP方案(关闭需求后调用)
async abolishIcpProgrammeByNeed(pobj) {
console.log("abolishIcpProgrammeByNeed+++",pobj)
var ab = pobj.actionBody;
var app = pobj.appInfo;
if (!app || !app.uapp_id) {
......@@ -126,6 +127,7 @@ class BaseQcService {
})
}
//根据需求查看方案列表
async getProgrammeInfoByChannelNeedNo(pobj) {
var ab = pobj.actionBody;
......@@ -444,6 +446,20 @@ class BaseQcService {
if (!solutionContent) {
return system.getResultFail(-402, "方案交付信息有误");
}
//----
var productType = solutionContent.solution;
if(productType && productType.IcpType){
productType = productType.IcpType
switch (productType) {
case "5":
productType = "ICP"
break;
case "7":
productType = "EDI"
break;
}
}
//----
var orderInfo = await this.orderinfoDao.model.findOne({
attributes: ["uapp_id"],
where: {orderNo: needsolutioninfo.orderNo}, raw: true
......@@ -506,6 +522,7 @@ class BaseQcService {
var uappIds = orderInfo.uapp_id;
new_needsolutioninfo['orderChannelNo'] = orderInfo.channelOrderNo;
new_needsolutioninfo['uapp_id'] = uappIds;
new_needsolutioninfo['productType'] = productType;
}
console.log('new_needsolutioninfo+++',new_needsolutioninfo)
//2020-10-27 laolan end
......
......@@ -32,22 +32,21 @@ class NcService {
"NOT_APPROVED": "⼯商部未通过",
"CLOSE": "方案关闭"
};
//网文状态2020-11-11 baidu
this.ncSNumberStatus = {
// "SOLUTION_SUBMIT": "提交服务单",
"MATERIAL_UNCONFIRM": 506,
"REGISTRATION": 507,
"SUBMITTED": 508,
"ACCEPTED": 509,
"NOT_ACCEPTED": 510,
"APPROVED": 511,
"NOT_APPROVED": 512
// "CLOSE": "方案关闭"
};
}
//获取需求列表
async ncGetNeedList (pobj) {
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.needinfoDao.model.findAndCountAll(query);
res = res.rows.map(n=>n.channelNeedNo);
res = pobj.actionBody.data.filter(r =>!res.includes(r.bizId));
return system.getResultSuccess(res)
} catch (error) {
return system.getResultFail(-1, error.message)
}
}
//交付商提交材料信息
async ncSubmitMaterial(pobj) {
......@@ -96,19 +95,25 @@ class NcService {
if (!solutionContent) {
return system.getResultFail(-402, "方案交付信息有误");
}
//----
var productType = solutionContent.solution;
if(productType && productType.IcpType){
productType = productType.IcpType
}
//----
var orderInfo = await this.orderinfoDao.model.findOne({
where: {orderNo: needsolutioninfo.orderNo}, raw: true
})
if(orderInfo){
var uappId = orderInfo.uapp_id
}
var material = ab.material;
if (!material.businessLicense.name) {
if (!ab.material.businessLicense.name) {
return system.getResultFail(-101, "公司名称不能为空");
}
if (!material.partnerBusinessLicense) {
if (!ab.material.partnerBusinessLicense) {
return system.getResultFail(-103, "营业执照不能为空");
}
console.log('solutionContent++++++---------------',solutionContent)
solutionContent.material = ab.material;
var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({
......@@ -134,10 +139,11 @@ class NcService {
let sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + deliveryContent + "' where sourceOrderNo='" + ab.orderNo + "'";
var orderdelivery = await this.orderdeliveryDao.customInsert(sql);
}
orderdelivery['orderChannelNo'] = orderInfo.channelOrderNo;
orderdelivery['uapp_id'] = uappId;
console.log('nc orderdelivery+++',orderdelivery)
return system.getResultSuccess(orderdelivery);
needsolutioninfo['orderChannelNo'] = orderInfo.channelOrderNo;
needsolutioninfo['uapp_id'] = uappId;
needsolutioninfo['productType'] = productType;
console.log('nc orderdelivery+++',needsolutioninfo)
return system.getResultSuccess(needsolutioninfo);
}
//提交方案
......@@ -195,21 +201,19 @@ class NcService {
if (!solution) {
return system.getResultFail(-103, "方案交付信息有误");
}
if (needinfo.channelTypeCode == "NC") {
ab.solutionContent.solution.icpType = "NC";
} else {
if (!needinfo.channelTypeCode) {
return system.getResultFail(-104, "需求业务类型有误");
}
if (!solution.companyName) {
if (!solution.CompanyName) {
return system.getResultFail(-105, "公司名不能为空");
}
if (!solution.licenseType) {
return system.getResultFail(-106, "网文类型不能为空");
if (!solution.LicenseType) {
return system.getResultFail(-106, "业务类型不能为空");
}
if (!solution.area) {
if (!solution.Area) {
return system.getResultFail(-107, "区域不能为空");
}
if (!solution.actionType) {
if (!solution.ActionType) {
return system.getResultFail(-108, "办理类型不能为空");
}
var solutionFlowList = ab.solutionContent.solutionFlowList || [];
......@@ -235,6 +239,7 @@ class NcService {
};
ab.solutionContent["customerInfo"] = customerInfo;
ab.solutionContent["salesmanInfo"] = salesmanInfo;
ab.solutionContent.solution.SolutionPrice = (ab.solutionContent.solution.SolutionPrice) / 100 || "";//分转元
ab.solutionContent = JSON.stringify(ab.solutionContent);
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) {
......@@ -281,10 +286,10 @@ class NcService {
if (!ab.status) {
return system.getResultFail(-102, "交付状态不能为空");
} else {
ab["applicationStatus"] = ab.status;
ab["ApplicationStatus"] = ab.status;
}
if (ab.officialFileURL) {
ab["officialFileURL"] = ab.officialFileURL;
ab["OfficialFileURL"] = ab.officialFileURL;
}
var ns = await this.needsolutionDao.model.findOne({
......@@ -310,7 +315,7 @@ class NcService {
if (!ab.solutionNo) {
return system.getResultFail(-101, "方案编号不能为空");
}
if (!ab.applicationStatus) {
if (!ab.ApplicationStatus) {
return system.getResultFail(-102, "通知状态不能为空");
}
//获取方案信息
......@@ -330,15 +335,17 @@ class NcService {
}
let orderdeliverySql = "SELECT * FROM `c_order_delivery` WHERE sourceOrderNo = :sourceOrderNo ORDER BY id DESC limit 1";
let orderdeliveryInfo = await this.orderdeliveryDao.customQuery(orderdeliverySql,orderdeliverySqlData)
let deliveryContent = orderdeliveryInfo[0].deliveryContent;
if(orderdeliveryInfo[0] && orderdeliveryInfo[0].deliveryContent){
var deliveryContent = orderdeliveryInfo[0].deliveryContent;
}
console.log('nc +++ deliveryContent+++',deliveryContent)
if (!deliveryContent) {
return system.getResultFail(-402, "方案交付信息有误");
}
if (deliveryContent.applicationStatus && deliveryContent.applicationStatus > ab.applicationStatus) {
if (this.ncSNumberStatus[deliveryContent.status] && this.ncSNumberStatus[deliveryContent.status] > ab.ApplicationStatus) {
return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
}
if (deliveryContent.applicationStatus && deliveryContent.applicationStatus == ab.applicationStatus) {
if (this.ncSNumberStatus[deliveryContent.ApplicationStatus] && this.ncSNumberStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus) {
return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交");
}
......@@ -352,72 +359,77 @@ class NcService {
var uappId = orderInfo.uapp_id;
var channelOrderNo = orderInfo.channelOrderNo
}
if (ab.applicationStatus == 507) {//完成账户注册
if (ab.ApplicationStatus == 507) {//完成账户注册
if(uappId == '18'){
if (deliveryContent.status != "USER_CONFIRMED") {
return system.getResultFail(-508, "交付流程错误,用户确认递交⽂件后才能执行此操作");
return system.getResultFail(-507, "交付流程错误,用户确认递交⽂件后才能执行此操作");
}
}
deliveryContent.applicationStatus = 507;
deliveryContent['ApplicationStatus'] = 507;
solutionFlowList.push({
file: ab.officialFileURL || "",
file: ab.OfficialFileURL || "",
status: "REGISTRATION", statusName: this.ncSolutionStatus.REGISTRATION, updated_at: new Date()
});
deliveryContent.status = "REGISTRATION";
deliveryContent.statusName = this.ncSolutionStatus.REGISTRATION;
}
if (ab.applicationStatus == 508) {//"服务商完成提交资料到⼯信部
if (ab.ApplicationStatus == 508) {//"服务商完成提交资料到⼯信部
if (deliveryContent.status != "REGISTRATION") {
return system.getResultFail(-508, "交付流程错误,请先完成账户注册");
}
deliveryContent['ApplicationStatus'] = 508;
solutionFlowList.push({
file: ab.officialFileURL || "",
file: ab.OfficialFileURL || "",
status: "SUBMITTED", statusName: this.ncSolutionStatus.SUBMITTED, updated_at: new Date()
});
deliveryContent.status = "SUBMITTED";
deliveryContent.statusName = this.ncSolutionStatus.SUBMITTED;
}
if (ab.applicationStatus == 509) {//⼯商部已受理
if (ab.ApplicationStatus == 509) {//⼯商部已受理
if (deliveryContent.status != "SUBMITTED") {
return system.getResultFail(-509, "交付流程错误,请先完成资料递交");
}
deliveryContent['ApplicationStatus'] = 509;
solutionFlowList.push({
file: ab.officialFileURL || "",
file: ab.OfficialFileURL || "",
status: "ACCEPTED", statusName: this.ncSolutionStatus.ACCEPTED, updated_at: new Date()
});
deliveryContent.status = "ACCEPTED";
deliveryContent.statusName = this.ncSolutionStatus.ACCEPTED;
}
if (ab.applicationStatus == 510) {//⼯商部不予受理
if (ab.ApplicationStatus == 510) {//⼯商部不予受理
if (deliveryContent.status != "SUBMITTED") {
return system.getResultFail(-510, "交付流程错误,请先完成资料递交");
}
deliveryContent['ApplicationStatus'] = 510;
solutionFlowList.push({
file: ab.officialFileURL || "",
file: ab.OfficialFileURL || "",
status: "NOT_ACCEPTED", statusName: this.ncSolutionStatus.NOT_ACCEPTED, updated_at: new Date()
});
deliveryContent.status = "NOT_ACCEPTED";
needsolutioninfo.status = "ywc";
deliveryContent.statusName = this.ncSolutionStatus.NOT_ACCEPTED;
}
if (ab.applicationStatus == 511) {//⼯商部通过
if (ab.ApplicationStatus == 511) {//⼯商部通过
if (deliveryContent.status != "ACCEPTED") {
return system.getResultFail(-511, "交付流程错误,⼯信部已受理后才能执行此操作");
}
deliveryContent['ApplicationStatus'] = 511;
solutionFlowList.push({
file: ab.officialFileURL || "",
file: ab.OfficialFileURL || "",
status: "APPROVED", statusName: this.ncSolutionStatus.APPROVED, updated_at: new Date()
});
needsolutioninfo.status = "ywc";
deliveryContent.status = "APPROVED";
deliveryContent.statusName = this.ncSolutionStatus.APPROVED;
}
if (ab.applicationStatus == 512) {//⼯信部未通过
if (ab.ApplicationStatus == 512) {//⼯信部未通过
if (deliveryContent.status != "ACCEPTED") {
return system.getResultFail(-512, "交付流程错误,⼯信部已受理后才能执行此操作");
}
deliveryContent['ApplicationStatus'] = 512;
solutionFlowList.push({
file: ab.officialFileURL || "",
file: ab.OfficialFileURL || "",
status: "NOT_APPROVED", statusName: this.ncSolutionStatus.NOT_APPROVED, updated_at: new Date()
});
deliveryContent.status = "NOT_APPROVED";
......@@ -427,14 +439,14 @@ class NcService {
deliveryContent.solutionFlowList = solutionFlowList;
var applicationStatusList = deliveryContent.applicationStatusList || [];
var statusObj = {
"officialFileURL": ab.officialFileURL || "",
"applicationStatus": ab.applicationStatus,
"applicationStatusName": this.ncSolutionStatus[ab.applicationStatus],
"OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.ncSolutionStatus[ab.ApplicationStatus],
"created_at": new Date()
};
applicationStatusList.push(statusObj);
deliveryContent.applicationStatusList = applicationStatusList;
deliveryContent.applicationStatus = ab.applicationStatus;
deliveryContent["applicationStatus"] = ab.applicationStatus;
deliveryContent = JSON.stringify(deliveryContent);
let orderdeliveryData = {
sourceOrderNo : ab.orderNo,
......@@ -447,9 +459,18 @@ class NcService {
let sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + deliveryContent + "' where sourceOrderNo='" + ab.orderNo + "'";
var orderdelivery = await this.orderdeliveryDao.customInsert(sql);
}
orderdelivery["bizId"] = ab.bizId;
orderdelivery['uapp_id'] = uappId;
orderdelivery['channelOrderNo'] = channelOrderNo;
let orderdeliveryQuery = "SELECT * from `c_order_delivery` where sourceOrderNo='" + ab.orderNo + "'";
let QueryDatas = {
sourceOrderNo:ab.orderNo
}
orderdelivery = await this.orderdeliveryDao.customQuery(orderdeliveryQuery,QueryDatas)
console.log('orderdelivery++orderdelivery++++++',orderdelivery)
if(orderdelivery){
orderdelivery = orderdelivery[0]
orderdelivery["bizId"] = ab.bizId;
orderdelivery['uapp_id'] = uappId;
orderdelivery['channelOrderNo'] = channelOrderNo;
}
console.log('orderdelivery++',orderdelivery)
return system.getResultSuccess(orderdelivery);
}
......@@ -524,124 +545,23 @@ class NcService {
return uuid.join('');
}
//提交沟通记录
async ncWriteCommunicationRecord(pobj) {
// 查询需求沟通记录
pobj.actionBody.note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", pobj.actionBody.note];
let needRes = await this.needsolutionDao.findOne({ channelNeedNo: pobj.actionBody.needNo });
console.log('needRes',needRes)
// 没有需求单直接返回
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.needNo
};
var updateRes = await this.orderinfoDao.customUpdate(sql, paramWhere);
console.log('updateRes',updateRes)
}
// 有需求单但没有沟通记录 直接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.needNo
};
var updateRes = await this.orderinfoDao.customUpdate(sql, paramWhere);
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
// 有需求单有沟通记录 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(pobj.actionBody.note) + "\""+") where channelNeedNo="+ "\"" +pobj.actionBody.bizId +"\"" +" "
var paramWhere = {
note: pobj.actionBody.note,
bizId: pobj.actionBody.needNo
};
var updateRes = await this.orderinfoDao.customUpdate(sql, paramWhere);
console.log('updateRes',updateRes)
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
}
}
//查询沟通记录
async ncGetCommunicationRecord(pobj){
console.log('query++pobj',pobj)
if (!pobj.actionBody.intentionBizId) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100493");
}
if(pobj.appInfo.uapp_id == 18){
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);
}
}
//关闭需求
async ncCloseNeed(pobj) {
var ab = pobj.actionBody;
var app = pobj.appInfo;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
if (!ab.needNo) {
return system.getResultFail(-101, "需求编号不能为空");
}
if (!ab.note) {
return system.getResultFail(-106, "关闭理由不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
attributes: ["id", "status", "statusName", "needNo"],
where: { channelNeedNo: ab.needNo }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
}
if (needinfo.status == "ygb") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
var updateNeed = await this.needinfoDao.update(needObj);//关闭需求
if (!updateNeed) {
return system.getResultFail(-203, "关闭需求失败");
} else {
return system.getResultSuccess();
}
}
//根据需求关闭方案(关闭需求后调用)
//根据需求关闭NC方案(关闭需求后调用)
async ncClosePlan(pobj) {
console.log("ncClosePlan+++",pobj)
var ab = pobj.actionBody;
var app = pobj.appInfo;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
if (!ab.intentionBizId) {
if (!ab.needNo) {
return system.getResultFail(-101, "需求编号不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
attributes: ["id", "status", "statusName", "needNo", "uapp_id"],//2020-10-29 laolan xinzeng uapp_id
where: { channelNeedNo: ab.intentionBizId }, raw: true
where: { channelNeedNo: ab.needNo }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
......@@ -653,17 +573,18 @@ class NcService {
var ns = await this.needsolutionDao.model.findOne({
where: { needNo: needinfo.needNo, isInvalid: 0 }, raw: true
});
// var newFlowStatus = [];
if (ns && ns.id) {
if (ns.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案");
}
var flowStatus = ns.solutionContent && ns.solutionContent.status ? ns.solutionContent.status : "";
if (flowStatus && ["NOT_APPROVED", "CLOSE"].indexOf(flowStatus) < 0) {
if (flowStatus && ["NOT_ACCEPTED","CLOSE"].indexOf(flowStatus) < 0) {
return system.getResultFail(-104, "⽅案状态为关闭或不予受理才可关闭需求");
}
}
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) {
return await self.needsolutionDao.db.transaction(async function (t) {
var needObj = {
id: needinfo.id, status: "ygb", notes: ab.note
};
......@@ -679,10 +600,11 @@ class NcService {
ns = Object.assign(ns,uappId)
console.log('guanbi ns +++',ns)
return system.getResultSuccess(ns);
// return system.getResultSuccess();
})
}
//交付商关闭交付单
async ncCloseOrderDelivery(pobj) {
var ab = pobj.actionBody;
......
const system = require("../../../system");
const moment = require('moment');
/**
* 广相关接口(RT)
* 广播电视相关接口(RT)
* laolan
* 2020.11.11
*/
......@@ -10,8 +10,9 @@ class RtService {
this.needsolutionDao = system.getObject("db.dbneed.needsolutionDao");
this.needinfoDao = system.getObject("db.dbneed.needinfoDao");
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
this.orderdeliveryDao = system.getObject("db.dbcorder.orderdeliveryDao");
this.db = system.getObject("db.common.connection").getCon()
this.rtStatusReference = {
this.ncStatusReference = {
507: "完成账户注册",
508: "服务商完成提交资料到⼯信部",
509: "⼯商部已受理",
......@@ -20,7 +21,7 @@ class RtService {
512: "⼯商部未通过"
};
//网文状态2020-11-11 baidu
this.rtSolutionStatus = {
this.ncSolutionStatus = {
"SOLUTION_SUBMIT": "提交服务单",
"MATERIAL_UNCONFIRM": "服务商递交⽂件",
"REGISTRATION": "完成账户注册",
......@@ -31,27 +32,26 @@ class RtService {
"NOT_APPROVED": "⼯商部未通过",
"CLOSE": "方案关闭"
};
//网文状态2020-11-11 baidu
this.ncSNumberStatus = {
// "SOLUTION_SUBMIT": "提交服务单",
"MATERIAL_UNCONFIRM": 506,
"REGISTRATION": 507,
"SUBMITTED": 508,
"ACCEPTED": 509,
"NOT_ACCEPTED": 510,
"APPROVED": 511,
"NOT_APPROVED": 512
// "CLOSE": "方案关闭"
};
}
//获取需求列表
async rtGetNeedList (pobj) {
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.needinfoDao.model.findAndCountAll(query);
res = res.rows.map(n=>n.channelNeedNo);
res = pobj.actionBody.data.filter(r =>!res.includes(r.bizId));
return system.getResultSuccess(res)
} catch (error) {
return system.getResultFail(-1, error.message)
}
}
//交付商提交材料信息
async rtSubmitMaterial(pobj) {
var ab = pobj.actionBody;
console.log('rt ab++',ab)
console.log('ab++',ab)
if (!ab.orderNo) {
return system.getResultFail(-101, "订单号不能为空");
}
......@@ -68,7 +68,7 @@ class RtService {
//提交材料信息
async submitRtMaterial(pobj) {
var ab = pobj.actionBody;
console.log('rt ababab++',ab)
console.log('ababab++',ab)
var user = pobj.userInfo;
if (!user || !user.id) {
return system.getResultFail(-100, "未知用户");
......@@ -95,43 +95,60 @@ class RtService {
if (!solutionContent) {
return system.getResultFail(-402, "方案交付信息有误");
}
//----
var productType = solutionContent.solution;
if(productType && productType.IcpType){
productType = productType.IcpType
}
//----
var orderInfo = await this.orderinfoDao.model.findOne({
where: {orderNo: needsolutioninfo.orderNo}, raw: true
})
if(orderInfo){
var uappId = orderInfo.uapp_id
}
var material = ab.material;
if (!material.name) {
if (!ab.material.businessLicense.name) {
return system.getResultFail(-101, "公司名称不能为空");
}
if (!material.partnerBusinessLicense) {
if (!ab.material.partnerBusinessLicense) {
return system.getResultFail(-103, "营业执照不能为空");
}
console.log('solutionContent++++++---------------',solutionContent)
solutionContent.material = ab.material;
var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "MATERIAL_UNCONFIRM", statusName: this.rtSolutionStatus.MATERIAL_UNCONFIRM, updated_at: new Date()
status: "MATERIAL_UNCONFIRM", statusName: this.ncSolutionStatus.MATERIAL_UNCONFIRM, updated_at: new Date()
});
solutionContent.status = "MATERIAL_UNCONFIRM";
solutionContent.statusName = this.rtSolutionStatus.MATERIAL_UNCONFIRM;
solutionContent.statusName = this.ncSolutionStatus.MATERIAL_UNCONFIRM;
needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
return await this.needsolutionDao.db.transaction(async function (t) {
await this.needsolutionDao.update(needsolutioninfo, t);
var new_needsolutioninfo = await this.needsolutionDao.model.findOne({
where: { id: needsolutioninfo.id }, raw: true
});
new_needsolutioninfo['orderChannelNo'] = orderInfo.channelOrderNo;
new_needsolutioninfo['uapp_id'] = uappId;
console.log('rt new_needsolutioninfo+++',new_needsolutioninfo)
return system.getResultSuccess(new_needsolutioninfo);
})
let deliveryContent = needsolutioninfo.solutionContent;
let orderdeliveryData = {
sourceOrderNo : ab.orderNo,
deliveryContent : deliveryContent,
}
let orderdeliverySqlData = {
sourceOrderNo:ab.orderNo
}
let orderdeliverySql = "SELECT * FROM `c_order_delivery` WHERE sourceOrderNo = :sourceOrderNo ORDER BY id DESC limit 1";
let orderdeliveryInfo = await this.orderdeliveryDao.customQuery(orderdeliverySql,orderdeliverySqlData)
if(!orderdeliveryInfo[0]){
let sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUES (:sourceOrderNo,:deliveryContent)";
var orderdelivery = await this.orderdeliveryDao.customInsert(sql, orderdeliveryData);
}else{
let sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + deliveryContent + "' where sourceOrderNo='" + ab.orderNo + "'";
var orderdelivery = await this.orderdeliveryDao.customInsert(sql);
}
needsolutioninfo['orderChannelNo'] = orderInfo.channelOrderNo;
needsolutioninfo['uapp_id'] = uappId;
needsolutioninfo['productType'] = productType;
console.log('rt orderdelivery+++',needsolutioninfo)
return system.getResultSuccess(needsolutioninfo);
}
//提交方案
async rtSubmitSolution(pobj) {
console.log("rt pobj++++",pobj)
console.log("pobj++++",pobj)
var ab = pobj.actionBody;
var user = pobj.userInfo;
if (!user || !user.id) {
......@@ -184,29 +201,27 @@ class RtService {
if (!solution) {
return system.getResultFail(-103, "方案交付信息有误");
}
if (needinfo.channelTypeCode == "RT") {
ab.solutionContent.solution.icpType = "RT";
} else {
if (!needinfo.channelTypeCode) {
return system.getResultFail(-104, "需求业务类型有误");
}
if (!solution.companyName) {
if (!solution.CompanyName) {
return system.getResultFail(-105, "公司名不能为空");
}
if (!solution.licenseType) {
return system.getResultFail(-106, "网文类型不能为空");
if (!solution.LicenseType) {
return system.getResultFail(-106, "业务类型不能为空");
}
if (!solution.area) {
if (!solution.Area) {
return system.getResultFail(-107, "区域不能为空");
}
if (!solution.actionType) {
if (!solution.ActionType) {
return system.getResultFail(-108, "办理类型不能为空");
}
var solutionFlowList = ab.solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "SOLUTION_SUBMIT", statusName: this.rtSolutionStatus.SOLUTION_SUBMIT, updated_at: new Date()
status: "SOLUTION_SUBMIT", statusName: this.ncSolutionStatus.SOLUTION_SUBMIT, updated_at: new Date()
});
ab.solutionContent.status = "SOLUTION_SUBMIT";
ab.solutionContent.statusName = this.rtSolutionStatus.SOLUTION_SUBMIT;
ab.solutionContent.statusName = this.ncSolutionStatus.SOLUTION_SUBMIT;
ab.solutionContent.solutionFlowList = solutionFlowList;
ab["channelNeedNo"] = needinfo.channelNeedNo;
var solutionNo = await this.getBusUid("ns");
......@@ -224,9 +239,10 @@ class RtService {
};
ab.solutionContent["customerInfo"] = customerInfo;
ab.solutionContent["salesmanInfo"] = salesmanInfo;
ab.solutionContent.solution.SolutionPrice = (ab.solutionContent.solution.SolutionPrice) / 100 || "";//分转元
ab.solutionContent = JSON.stringify(ab.solutionContent);
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) {
return await self.needsolutionDao.db.transaction(async function (t) {
ab["needNo"] = needinfo.needNo;
var od = await self.needsolutionDao.create(ab, t);
if (od && od.id) {
......@@ -270,10 +286,10 @@ class RtService {
if (!ab.status) {
return system.getResultFail(-102, "交付状态不能为空");
} else {
ab["applicationStatus"] = ab.status;
ab["ApplicationStatus"] = ab.status;
}
if (ab.officialFileURL) {
ab["officialFileURL"] = ab.officialFileURL;
ab["OfficialFileURL"] = ab.officialFileURL;
}
var ns = await this.needsolutionDao.model.findOne({
......@@ -289,7 +305,7 @@ class RtService {
}
//服务商通知状态变更
async rtAcceptPartnerNotification(pobj) {
console.log('rt 服务商通知状态变更pobj++++',pobj)
console.log('服务商通知状态变更pobj++++',pobj)
var ab = pobj.actionBody;
var user = pobj.userInfo;
......@@ -299,7 +315,7 @@ class RtService {
if (!ab.solutionNo) {
return system.getResultFail(-101, "方案编号不能为空");
}
if (!ab.applicationStatus) {
if (!ab.ApplicationStatus) {
return system.getResultFail(-102, "通知状态不能为空");
}
//获取方案信息
......@@ -313,115 +329,150 @@ class RtService {
if (!needsolutioninfo.needNo) {
return system.getResultFail(-401, "方案需求信息有误");
}
var solutionContent = needsolutioninfo.solutionContent;
if (!solutionContent) {
//获取jiaofu信息
let orderdeliverySqlData = {
sourceOrderNo:ab.orderNo
}
let orderdeliverySql = "SELECT * FROM `c_order_delivery` WHERE sourceOrderNo = :sourceOrderNo ORDER BY id DESC limit 1";
let orderdeliveryInfo = await this.orderdeliveryDao.customQuery(orderdeliverySql,orderdeliverySqlData)
if(orderdeliveryInfo[0] && orderdeliveryInfo[0].deliveryContent){
var deliveryContent = orderdeliveryInfo[0].deliveryContent;
}
console.log('nc +++ deliveryContent+++',deliveryContent)
if (!deliveryContent) {
return system.getResultFail(-402, "方案交付信息有误");
}
if (solutionContent.applicationStatus && solutionContent.applicationStatus > ab.applicationStatus) {
if (this.ncSNumberStatus[deliveryContent.status] && this.ncSNumberStatus[deliveryContent.status] > ab.ApplicationStatus) {
return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
}
if (solutionContent.applicationStatus && solutionContent.applicationStatus == ab.applicationStatus) {
if (this.ncSNumberStatus[deliveryContent.ApplicationStatus] && this.ncSNumberStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus) {
return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交");
}
var solutionFlowList = solutionContent.solutionFlowList || [];
var solutionFlowList = deliveryContent.solutionFlowList || [];
var orderInfo = await this.orderinfoDao.model.findOne({
attributes:["uapp_id","channelOrderNo"],
where: {orderNo: ab.orderNo}, raw: true
})
console.log("rt orderInfo+++",orderInfo)
console.log("orderInfo+++",orderInfo)
if(orderInfo){
var uappId = orderInfo.uapp_id;
var channelOrderNo = orderInfo.channelOrderNo
}
if (ab.applicationStatus == 507) {//完成账户注册
solutionContent.applicationStatus = 507;
if (ab.ApplicationStatus == 507) {//完成账户注册
if(uappId == '18'){
if (deliveryContent.status != "USER_CONFIRMED") {
return system.getResultFail(-507, "交付流程错误,用户确认递交⽂件后才能执行此操作");
}
}
deliveryContent['ApplicationStatus'] = 507;
solutionFlowList.push({
file: ab.officialFileURL || "",
status: "REGISTRATION", statusName: this.rtSolutionStatus.REGISTRATION, updated_at: new Date()
file: ab.OfficialFileURL || "",
status: "REGISTRATION", statusName: this.ncSolutionStatus.REGISTRATION, updated_at: new Date()
});
solutionContent.status = "REGISTRATION";
solutionContent.statusName = this.rtSolutionStatus.REGISTRATION;
deliveryContent.status = "REGISTRATION";
deliveryContent.statusName = this.ncSolutionStatus.REGISTRATION;
}
if (ab.applicationStatus == 508) {//"服务商完成提交资料到⼯信部
if (solutionContent.status != "REGISTRATION") {
if (ab.ApplicationStatus == 508) {//"服务商完成提交资料到⼯信部
if (deliveryContent.status != "REGISTRATION") {
return system.getResultFail(-508, "交付流程错误,请先完成账户注册");
}
deliveryContent['ApplicationStatus'] = 508;
solutionFlowList.push({
file: ab.officialFileURL || "",
status: "SUBMITTED", statusName: this.rtSolutionStatus.SUBMITTED, updated_at: new Date()
file: ab.OfficialFileURL || "",
status: "SUBMITTED", statusName: this.ncSolutionStatus.SUBMITTED, updated_at: new Date()
});
solutionContent.status = "SUBMITTED";
solutionContent.statusName = this.rtSolutionStatus.SUBMITTED;
deliveryContent.status = "SUBMITTED";
deliveryContent.statusName = this.ncSolutionStatus.SUBMITTED;
}
if (ab.applicationStatus == 509) {//⼯商部已受理
if (solutionContent.status != "SUBMITTED") {
if (ab.ApplicationStatus == 509) {//⼯商部已受理
if (deliveryContent.status != "SUBMITTED") {
return system.getResultFail(-509, "交付流程错误,请先完成资料递交");
}
deliveryContent['ApplicationStatus'] = 509;
solutionFlowList.push({
file: ab.officialFileURL || "",
status: "ACCEPTED", statusName: this.rtSolutionStatus.ACCEPTED, updated_at: new Date()
file: ab.OfficialFileURL || "",
status: "ACCEPTED", statusName: this.ncSolutionStatus.ACCEPTED, updated_at: new Date()
});
solutionContent.status = "ACCEPTED";
solutionContent.statusName = this.rtSolutionStatus.ACCEPTED;
deliveryContent.status = "ACCEPTED";
deliveryContent.statusName = this.ncSolutionStatus.ACCEPTED;
}
if (ab.applicationStatus == 510) {//⼯商部不予受理
if (solutionContent.status != "SUBMITTED") {
if (ab.ApplicationStatus == 510) {//⼯商部不予受理
if (deliveryContent.status != "SUBMITTED") {
return system.getResultFail(-510, "交付流程错误,请先完成资料递交");
}
deliveryContent['ApplicationStatus'] = 510;
solutionFlowList.push({
file: ab.officialFileURL || "",
status: "NOT_ACCEPTED", statusName: this.rtSolutionStatus.NOT_ACCEPTED, updated_at: new Date()
file: ab.OfficialFileURL || "",
status: "NOT_ACCEPTED", statusName: this.ncSolutionStatus.NOT_ACCEPTED, updated_at: new Date()
});
solutionContent.status = "NOT_ACCEPTED";
deliveryContent.status = "NOT_ACCEPTED";
needsolutioninfo.status = "ywc";
solutionContent.statusName = this.rtSolutionStatus.NOT_ACCEPTED;
deliveryContent.statusName = this.ncSolutionStatus.NOT_ACCEPTED;
}
if (ab.applicationStatus == 511) {//⼯商部通过
if (solutionContent.status != "ACCEPTED") {
if (ab.ApplicationStatus == 511) {//⼯商部通过
if (deliveryContent.status != "ACCEPTED") {
return system.getResultFail(-511, "交付流程错误,⼯信部已受理后才能执行此操作");
}
deliveryContent['ApplicationStatus'] = 511;
solutionFlowList.push({
file: ab.officialFileURL || "",
status: "APPROVED", statusName: this.rtSolutionStatus.APPROVED, updated_at: new Date()
file: ab.OfficialFileURL || "",
status: "APPROVED", statusName: this.ncSolutionStatus.APPROVED, updated_at: new Date()
});
needsolutioninfo.status = "ywc";
solutionContent.status = "APPROVED";
solutionContent.statusName = this.rtSolutionStatus.APPROVED;
deliveryContent.status = "APPROVED";
deliveryContent.statusName = this.ncSolutionStatus.APPROVED;
}
if (ab.applicationStatus == 512) {//⼯信部未通过
if (solutionContent.status != "ACCEPTED") {
if (ab.ApplicationStatus == 512) {//⼯信部未通过
if (deliveryContent.status != "ACCEPTED") {
return system.getResultFail(-512, "交付流程错误,⼯信部已受理后才能执行此操作");
}
deliveryContent['ApplicationStatus'] = 512;
solutionFlowList.push({
file: ab.officialFileURL || "",
status: "NOT_APPROVED", statusName: this.rtSolutionStatus.NOT_APPROVED, updated_at: new Date()
file: ab.OfficialFileURL || "",
status: "NOT_APPROVED", statusName: this.ncSolutionStatus.NOT_APPROVED, updated_at: new Date()
});
solutionContent.status = "NOT_APPROVED";
deliveryContent.status = "NOT_APPROVED";
needsolutioninfo.status = "ywc";
solutionContent.statusName = this.rtSolutionStatus.NOT_APPROVED;
deliveryContent.statusName = this.ncSolutionStatus.NOT_APPROVED;
}
solutionContent.solutionFlowList = solutionFlowList;
var applicationStatusList = solutionContent.applicationStatusList || [];
deliveryContent.solutionFlowList = solutionFlowList;
var applicationStatusList = deliveryContent.applicationStatusList || [];
var statusObj = {
"officialFileURL": ab.officialFileURL || "",
"applicationStatus": ab.applicationStatus,
"applicationStatusName": this.rtSolutionStatus[ab.applicationStatus],
"OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.ncSolutionStatus[ab.ApplicationStatus],
"created_at": new Date()
};
applicationStatusList.push(statusObj);
solutionContent.applicationStatusList = applicationStatusList;
solutionContent.applicationStatus = ab.applicationStatus;
needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
return await this.needsolutionDao.db.transaction(async function (t) {
await self.needsolutionDao.update(needsolutioninfo, t);
statusObj["bizId"] = ab.bizId;
statusObj['uapp_id'] = uappId;
statusObj['channelOrderNo'] = channelOrderNo;
console.log('rt statusObj++',statusObj)
return system.getResultSuccess(statusObj);
})
deliveryContent.applicationStatusList = applicationStatusList;
deliveryContent["applicationStatus"] = ab.applicationStatus;
deliveryContent = JSON.stringify(deliveryContent);
let orderdeliveryData = {
sourceOrderNo : ab.orderNo,
deliveryContent : deliveryContent,
}
if(!orderdeliveryInfo[0]){
let sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUES (:sourceOrderNo,:deliveryContent)";
var orderdelivery = await this.orderdeliveryDao.customInsert(sql, orderdeliveryData);
}else{
let sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + deliveryContent + "' where sourceOrderNo='" + ab.orderNo + "'";
var orderdelivery = await this.orderdeliveryDao.customInsert(sql);
}
let orderdeliveryQuery = "SELECT * from `c_order_delivery` where sourceOrderNo='" + ab.orderNo + "'";
let QueryDatas = {
sourceOrderNo:ab.orderNo
}
orderdelivery = await this.orderdeliveryDao.customQuery(orderdeliveryQuery,QueryDatas)
console.log('orderdelivery++orderdelivery++++++',orderdelivery)
if(orderdelivery){
orderdelivery = orderdelivery[0]
orderdelivery["bizId"] = ab.bizId;
orderdelivery['uapp_id'] = uappId;
orderdelivery['channelOrderNo'] = channelOrderNo;
}
console.log('orderdelivery++',orderdelivery)
return system.getResultSuccess(orderdelivery);
}
//接收方案编号(方案推送至yun后,接收保存方案信息)
......@@ -494,124 +545,23 @@ class RtService {
return uuid.join('');
}
//提交沟通记录
async rtWriteCommunicationRecord(pobj) {
// 查询需求沟通记录
pobj.actionBody.note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", pobj.actionBody.note];
let needRes = await this.needsolutionDao.findOne({ channelNeedNo: pobj.actionBody.needNo });
console.log('needRes',needRes)
// 没有需求单直接返回
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.needNo
};
var updateRes = await this.orderinfoDao.customUpdate(sql, paramWhere);
console.log('updateRes',updateRes)
}
// 有需求单但没有沟通记录 直接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.needNo
};
var updateRes = await this.orderinfoDao.customUpdate(sql, paramWhere);
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
// 有需求单有沟通记录 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(pobj.actionBody.note) + "\""+") where channelNeedNo="+ "\"" +pobj.actionBody.bizId +"\"" +" "
var paramWhere = {
note: pobj.actionBody.note,
bizId: pobj.actionBody.needNo
};
var updateRes = await this.orderinfoDao.customUpdate(sql, paramWhere);
console.log('updateRes',updateRes)
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
}
}
//查询沟通记录
async rtGetCommunicationRecord(pobj){
console.log('query++pobj',pobj)
if (!pobj.actionBody.intentionBizId) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100493");
}
if(pobj.appInfo.uapp_id == 18){
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);
}
}
//关闭需求
async rtCloseNeed(pobj) {
var ab = pobj.actionBody;
var app = pobj.appInfo;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
if (!ab.needNo) {
return system.getResultFail(-101, "需求编号不能为空");
}
if (!ab.note) {
return system.getResultFail(-106, "关闭理由不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
attributes: ["id", "status", "statusName", "needNo"],
where: { channelNeedNo: ab.needNo }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
}
if (needinfo.status == "ygb") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
var updateNeed = await this.needinfoDao.update(needObj);//关闭需求
if (!updateNeed) {
return system.getResultFail(-203, "关闭需求失败");
} else {
return system.getResultSuccess();
}
}
//根据需求关闭方案(关闭需求后调用)
//根据需求关闭NC方案(关闭需求后调用)
async rtClosePlan(pobj) {
console.log("rtClosePlan+++",pobj)
var ab = pobj.actionBody;
var app = pobj.appInfo;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
if (!ab.intentionBizId) {
if (!ab.needNo) {
return system.getResultFail(-101, "需求编号不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
attributes: ["id", "status", "statusName", "needNo", "uapp_id"],//2020-10-29 laolan xinzeng uapp_id
where: { channelNeedNo: ab.intentionBizId }, raw: true
where: { channelNeedNo: ab.needNo }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
......@@ -628,12 +578,12 @@ class RtService {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案");
}
var flowStatus = ns.solutionContent && ns.solutionContent.status ? ns.solutionContent.status : "";
if (flowStatus && ["NOT_APPROVED", "CLOSE"].indexOf(flowStatus) < 0) {
if (flowStatus && ["NOT_ACCEPTED","CLOSE"].indexOf(flowStatus) < 0) {
return system.getResultFail(-104, "⽅案状态为关闭或不予受理才可关闭需求");
}
}
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) {
return await self.needsolutionDao.db.transaction(async function (t) {
var needObj = {
id: needinfo.id, status: "ygb", notes: ab.note
};
......@@ -642,16 +592,18 @@ class RtService {
await self.needsolutionDao.model.update({ status: "yzf", isInvalid: 1 }, { where: { id: ns.id }, transaction: t });//方案废弃
return system.getResultSuccess(ns.orderNo);
}
//2020-10-29 laolan
var uappId = {};
uappId['uapp_id'] = needinfo.uapp_id;
ns = ns ? ns : {};
ns = Object.assign(ns,uappId)
console.log('rt guanbi ns +++',ns)
console.log('guanbi ns +++',ns)
return system.getResultSuccess(ns);
// return system.getResultSuccess();
})
}
//交付商关闭交付单
async rtCloseOrderDelivery(pobj) {
var ab = pobj.actionBody;
......@@ -674,7 +626,7 @@ class RtService {
pobj.actionBody = ab;
return this.rtAbolishProgramme(pobj);
}
//服务商作废方案-- rtAbolishProgramme
//服务商作废方案-- ncAbolishProgramme
async rtAbolishProgramme(pobj) {
var ab = pobj.actionBody;
var user = pobj.userInfo;
......@@ -713,10 +665,10 @@ class RtService {
solutionContent.serviceProviderNote = ab.note;
var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "CLOSE", statusName: this.rtSolutionStatus.CLOSE, updated_at: new Date()
status: "CLOSE", statusName: this.ncSolutionStatus.CLOSE, updated_at: new Date()
});
solutionContent.status = "CLOSE";
solutionContent.statusName = this.rtSolutionStatus.CLOSE;
solutionContent.statusName = this.ncSolutionStatus.CLOSE;
solutionContent = JSON.stringify(solutionContent);
await this.needsolutionDao.update({ id: ns.id, status: "yzf", isInvalid: 1, solutionContent: solutionContent });//方案废弃
//获取方案信息
......
var settings={
redis:{
host: "121.36.3.35",
port: 8967,
password: "Gongsibao2018",
host: "39.107.234.14",
port: 6379,
password: "123123",
db:9,
},
database:{
......
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