Commit 400c6b63 by 兰国旗

laolan

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