Commit 52c4d8c8 by 宋毅

增加返回值

parent 95d2f395
......@@ -69,9 +69,6 @@ class QcAPI extends APIBase {
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.aliyunqcSve.getProgrammeInfoByChannelNeedNo(pobj);
break;
case "getServiceProviderSubmitMaterial"://获取交付商提交材料信息
opResult = await this.baseqcSve.getServiceProviderSubmitMaterial(pobj);
break;
case "serviceProviderSubmitMaterial"://交付商提交材料信息
opResult = await this.baseqcSve.serviceProviderSubmitMaterial(pobj);
break;
......
const system = require("../../../system");
const moment = require('moment');
/**
* 阿里云增值电信相关接口(ICP、EDI)
* created by zhuangbing
......@@ -66,7 +67,7 @@ class BaseQcService {
//获取需求信息
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.intentionBizId}, raw: true
});
var uappId = {};
if (!needinfo || !needinfo.id) {
......@@ -80,7 +81,7 @@ class BaseQcService {
}
//获取方案信息
var ns = await this.needsolutionDao.model.findOne({
where: { needNo: needinfo.needNo, isInvalid: 0 }, raw: true
where: {needNo: needinfo.needNo, isInvalid: 0}, raw: true
});
if (ns && ns.id) {
......@@ -101,7 +102,10 @@ class BaseQcService {
};
await self.needinfoDao.update(needObj, t);//关闭需求
if (ns && ns.id) {
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);
ns = ns ? ns : {};
ns = Object.assign(ns, uappId)
......@@ -120,7 +124,6 @@ class BaseQcService {
}
//提交方案
async submitIcpProgramme(pobj) {
console.log("pobj++++", pobj)
......@@ -138,7 +141,7 @@ class BaseQcService {
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where: { channelNeedNo: ab.needNo }, raw: true
where: {channelNeedNo: ab.needNo}, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
......@@ -160,7 +163,7 @@ class BaseQcService {
ab.solutionContent.typeCode = needinfo.typeCode;
ab.solutionContent.typeName = needinfo.typeName;
var ns = await this.needsolutionDao.model.findAll({
where: { channelNeedNo: ab.needNo }, raw: true, order: [["id", 'asc']]
where: {channelNeedNo: ab.needNo}, raw: true, order: [["id", 'asc']]
});
for (var i = 0; i < ns.length; i++) {
var fa = ns[i];
......@@ -179,7 +182,7 @@ class BaseQcService {
return system.getResultFail(-103, "方案交付信息有误");
}
//判断属于渠道 18阿里,44百度,52易名
if(needinfo.uapp_id == 44 || needinfo.uapp_id == 18){
if (needinfo.uapp_id == 44 || needinfo.uapp_id == 18) {
if (needinfo.channelTypeCode == "7") {//edi
ab.solutionContent.solution.IcpType = 2;
} else if (needinfo.channelTypeCode == "5") {//icp
......@@ -188,7 +191,7 @@ class BaseQcService {
return system.getResultFail(-207, "需求业务类型有误");
}
}
if(needinfo.uapp_id == 52){
if (needinfo.uapp_id == 52) {
if (needinfo.channelTypeCode == "7") {//edisq
ab.solutionContent.solution.IcpType = 2;
} else if (needinfo.channelTypeCode == "5") {//icpsq
......@@ -197,7 +200,7 @@ class BaseQcService {
ab.solutionContent.solution.IcpType = 3;
} else if (needinfo.channelTypeCode == "EIDNB") {//EIDNB
ab.solutionContent.solution.IcpType = 4;
}else if (needinfo.channelTypeCode == "ICPXQ") {//ICPXQ
} else if (needinfo.channelTypeCode == "ICPXQ") {//ICPXQ
ab.solutionContent.solution.IcpType = 5;
} else if (needinfo.channelTypeCode == "EIDXQ") {//EIDXQ
ab.solutionContent.solution.IcpType = 6;
......@@ -223,7 +226,9 @@ class BaseQcService {
}
var solutionFlowList = ab.solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "SOLUTION_SUBMIT", statusName: this.icpSolutionStatusReference.SOLUTION_SUBMIT, updated_at: new Date()
status: "SOLUTION_SUBMIT",
statusName: this.icpSolutionStatusReference.SOLUTION_SUBMIT,
updated_at: new Date()
});
ab.solutionContent.status = "SOLUTION_SUBMIT";
ab.solutionContent.statusName = this.icpSolutionStatusReference.SOLUTION_SUBMIT;
......@@ -272,9 +277,9 @@ class BaseQcService {
}
await self.needinfoDao.update(needObj, t);
needinfo = await self.needinfoDao.model.findOne({
where: { id: needinfo.id }, raw: true
where: {id: needinfo.id}, raw: true
});
return system.getResultSuccess({ needinfo: needinfo, needsolution: od });
return system.getResultSuccess({needinfo: needinfo, needsolution: od});
} else {
return system.getResultFail(-302, "提交方案失败");
}
......@@ -290,7 +295,7 @@ class BaseQcService {
return system.getResultFail(-101, "订单号不能为空");
}
var ns = await this.needsolutionDao.model.findOne({
where: { orderNo: ab.orderNo }, raw: true
where: {orderNo: ab.orderNo}, raw: true
});
if (!ns || !ns.id) {
return system.getResultFail(-301, "未知方案");
......@@ -299,6 +304,7 @@ class BaseQcService {
pobj.actionBody = ab;
return this.submitIcpMaterial(pobj);
}
//提交icp材料信息
async submitIcpMaterial(pobj) {
var ab = pobj.actionBody;
......@@ -317,7 +323,7 @@ class BaseQcService {
//获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({
attributes: ["id", "needNo", "orderNo", "solutionContent"],
where: { channelSolutionNo: ab.BizId, isInvalid: 0 }, raw: true
where: {channelSolutionNo: ab.BizId, isInvalid: 0}, raw: true
});
console.log('needsolutioninfo+++', needsolutioninfo)
if (!needsolutioninfo || !needsolutioninfo.id) {
......@@ -387,7 +393,9 @@ class BaseQcService {
solutionContent.material = ab.material;
var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "MATERIAL_UNCONFIRM", statusName: this.icpSolutionStatusReference.MATERIAL_UNCONFIRM, updated_at: new Date()
status: "MATERIAL_UNCONFIRM",
statusName: this.icpSolutionStatusReference.MATERIAL_UNCONFIRM,
updated_at: new Date()
});
solutionContent.status = "MATERIAL_UNCONFIRM";
solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_UNCONFIRM;
......@@ -396,11 +404,11 @@ class BaseQcService {
return await this.needsolutionDao.db.transaction(async function (t) {
await self.needsolutionDao.update(needsolutioninfo, t);
var new_needsolutioninfo = await self.needsolutionDao.model.findOne({
where: { id: needsolutioninfo.id }, raw: true
where: {id: needsolutioninfo.id}, raw: true
});
//2020-10-27 laolan start
var orderInfo = await self.orderinfoDao.model.findOne({
where: { orderNo: ab.orderNo }, raw: true
where: {orderNo: ab.orderNo}, raw: true
})
if (orderInfo) {
var uappIds = orderInfo.uapp_id;
......@@ -414,9 +422,16 @@ class BaseQcService {
})
}
//交付商通知状态变更
async serviceProviderNotification(pobj) {
var ab = pobj.actionBody;
let ab = pobj.actionBody;
if (!pobj.userInfo || !pobj.userInfo.id) {
return system.getResultFail(-100, "未知用户");
}
if (!ab.ApplicationStatus) {
return system.getResultFail(-102, "通知状态不能为空");
}
if (!ab.orderNo) {
return system.getResultFail(-101, "订单号不能为空");
}
......@@ -438,49 +453,29 @@ class BaseQcService {
if (ab.certificateEndTime) {
ab["CertificateEndTime"] = ab.certificateEndTime;
}
var ns = await this.needsolutionDao.model.findOne({
where: { orderNo: ab.orderNo }, raw: true
});
if (!ns || !ns.id) {
return system.getResultFail(-301, "未知方案");
}
ab["BizId"] = ns.channelSolutionNo;
ab["solutionNo"] = ns.solutionNo;
pobj.actionBody = ab;
return this.acceptIcpPartnerNotification(pobj);
}
//服务商通知状态变更
async acceptIcpPartnerNotification(pobj) {
console.log('服务商通知状态变更pobj++++', pobj)
var ab = pobj.actionBody;
var user = pobj.userInfo;
if (!user || !user.id) {
return system.getResultFail(-100, "未知用户");
}
// ab["createUserId"] = user.id;
// if (!ab.BizId) {
// return system.getResultFail(-101, "渠道方案编号不能为空");
// }
if (!ab.solutionNo) {
return system.getResultFail(-101, "方案编号不能为空");
}
if (!ab.ApplicationStatus) {
return system.getResultFail(-102, "通知状态不能为空");
let self = this;
let ab = pobj.actionBody;
let needSolutionWhere = {};
if (ab.solutionNo) {
needSolutionWhere = {solutionNo: ab.solutionNo};
} else if (ab.orderNo) {
needSolutionWhere = {orderNo: ab.orderNo};
}
//获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({
attributes: ["id", "status", "solutionContent", "needNo","channelNeedNo"],
where: { solutionNo: ab.solutionNo }, raw: true
let needsolutioninfo = await this.needsolutionDao.model.findOne({
attributes: ["id", "status", "solutionContent", "needNo", "channelNeedNo"],
where: needSolutionWhere, raw: true
});
if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案");
}
// if (!needsolutioninfo.needNo) {
// return system.getResultFail(-401, "方案需求信息有误");
// }
var solutionContent = needsolutioninfo.solutionContent;
let solutionContent = needsolutioninfo.solutionContent;
if (!solutionContent) {
return system.getResultFail(-402, "方案交付信息有误");
}
......@@ -490,43 +485,19 @@ class BaseQcService {
if (solutionContent.ApplicationStatus && solutionContent.ApplicationStatus == ab.ApplicationStatus) {
return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交");
}
//获取需求信息
// var needinfo = await this.needinfoDao.model.findOne({
// where: { needNo: needsolutioninfo.needNo }, raw: true
// });
// if (!needinfo || !needinfo.id) {
// return system.getResultFail(-201, "未知需求信息");
// }
// // if (needinfo.status == "ycd" || needinfo.status == "ygb") {
// if (needinfo.status == "ygb") {
// return system.getResultFail(-202, "serviceProviderSubmitMateria" + needinfo.statusName + ",不能执行此操作");
// }
var solutionFlowList = solutionContent.solutionFlowList || [];
var orderuappId = await this.orderinfoDao.model.findOne({
attributes: ["uapp_id"],
where: { orderNo: ab.orderNo }, raw: true
let solutionFlowList = solutionContent.solutionFlowList || [];
let orderInfo = await this.orderinfoDao.model.findOne({
attributes: ["uapp_id", "channelOrderNo"],
where: {orderNo: ab.orderNo}, raw: true
})
console.log("orderuappId+++", orderuappId)
if (orderuappId) {
var uappId = orderuappId.uapp_id;
}
if (uappId != '50') {
// if (!needsolutioninfo.channelNeedNo) {
// return system.getResultFail(-401, "方案需求信息有误");
// }
// //获取需求信息
// var needinfo = await this.needinfoDao.model.findOne({
// where: { channelNeedNo: needsolutioninfo.channelNeedNo }, raw: true
// });
// if (!needinfo || !needinfo.id) {
// return system.getResultFail(-201, "未知需求信息");
// }
// if (needinfo.status == "ygb") {
// return system.getResultFail(-202, "serviceProviderSubmitMateria" + needinfo.statusName + ",不能执行此操作");
// }
if (!orderInfo || !orderInfo.channelOrderNo) {
return system.getResultFail(-406, "未知订单");
}
let uapp_id = orderInfo.uapp_id;
let channelOrderNo = orderInfo.channelOrderNo
if (ab.ApplicationStatus == 507) {//完成账户注册
if (uappId == '18') {
if (uapp_id == '18') {
if (solutionContent.status != "USER_CONFIRMED") {
return system.getResultFail(-508, "交付流程错误,用户确认递交⽂件后才能执行此操作");
}
......@@ -534,7 +505,9 @@ class BaseQcService {
solutionContent.ApplicationStatus = 507;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "ACCOUNT_REGISTERED", statusName: this.icpSolutionStatusReference.ACCOUNT_REGISTERED, updated_at: new Date()
status: "ACCOUNT_REGISTERED",
statusName: this.icpSolutionStatusReference.ACCOUNT_REGISTERED,
updated_at: new Date()
});
solutionContent.status = "ACCOUNT_REGISTERED";
solutionContent.statusName = this.icpSolutionStatusReference.ACCOUNT_REGISTERED;
......@@ -545,7 +518,9 @@ class BaseQcService {
}
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "MATERIAL_SUBMITTED", statusName: this.icpSolutionStatusReference.MATERIAL_SUBMITTED, updated_at: new Date()
status: "MATERIAL_SUBMITTED",
statusName: this.icpSolutionStatusReference.MATERIAL_SUBMITTED,
updated_at: new Date()
});
solutionContent.status = "MATERIAL_SUBMITTED";
solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_SUBMITTED;
......@@ -577,18 +552,20 @@ class BaseQcService {
if (solutionContent.status != "GXB_ACCEPT") {
return system.getResultFail(-511, "交付流程错误,⼯信部已受理后才能执行此操作");
}
if(uappId == "18"){
if (uapp_id == "18") {
solutionFlowList.push({
file: ab.OfficialFileURL || "", status: "GXB_SUCCESS",
statusName: this.icpSolutionStatusReference.GXB_SUCCESS, updated_at: new Date(),
CertificateNumber:ab.CertificateNumber,
CertificateStartTime:ab.CertificateStartTime,
CertificateEndTime:ab.CertificateEndTime
CertificateNumber: ab.CertificateNumber,
CertificateStartTime: ab.CertificateStartTime,
CertificateEndTime: ab.CertificateEndTime
});
}else{
} else {
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "GXB_SUCCESS", statusName: this.icpSolutionStatusReference.GXB_SUCCESS, updated_at: new Date()
status: "GXB_SUCCESS",
statusName: this.icpSolutionStatusReference.GXB_SUCCESS,
updated_at: new Date()
});
}
needsolutioninfo.status = "ywc";
......@@ -607,21 +584,25 @@ class BaseQcService {
needsolutioninfo.status = "ywc";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_FAIL;
}
solutionContent.solutionFlowList = solutionFlowList;
var applicationStatusList = solutionContent.applicationStatusList || [];
if(uappId == "18"){
var statusObj = {
//返回状态
let statusObj = {};
let applicationStatusList = solutionContent.applicationStatusList || [];
if (uapp_id == "18") {
statusObj = {
"OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.icpApplicationStatusReference[ab.ApplicationStatus],
"created_at": new Date(),
//2021-3-18 addNew
"CertificateNumber":ab.CertificateNumber || "",//证书编号
"CertificateStartTime":ab.CertificateStartTime || "",//证书有效期 开始时间
"CertificateEndTime":ab.CertificateEndTime || ""//证书有效期 结束时间
"CertificateNumber": ab.CertificateNumber || "",//证书编号
"CertificateStartTime": ab.CertificateStartTime || "",//证书有效期 开始时间
"CertificateEndTime": ab.CertificateEndTime || ""//证书有效期 结束时间
};
}else{
var statusObj = {
} else {
statusObj = {
"OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.icpApplicationStatusReference[ab.ApplicationStatus],
......@@ -633,24 +614,13 @@ class BaseQcService {
solutionContent.applicationStatus = ab.ApplicationStatus;
needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
console.log("ab.orderNo+++", ab.orderNo)
var self = this;
var orderInfo = await self.orderinfoDao.model.findOne({
attributes: ["channelOrderNo"],
where: { orderNo: ab.orderNo }, raw: true
})
console.log("orderInfo+++", orderInfo)
if (orderInfo) {
var channelOrderNo = orderInfo.channelOrderNo
}
return await this.needsolutionDao.db.transaction(async function (t) {
await self.needsolutionDao.update(needsolutioninfo, t);
statusObj["BizId"] = ab.BizId;
//2020-10-27 laolan start
statusObj['uapp_id'] = uappId;
statusObj["BizId"] = needsolutioninfo.channelSolutionNo;
statusObj["solutionNo"] = needsolutioninfo.solutionNo;
statusObj["material"] = solutionContent;
statusObj["uapp_id"] = uapp_id;
statusObj['channelOrderNo'] = channelOrderNo;
console.log('statusObj++', statusObj)
//2020-10-27 laolan start
return system.getResultSuccess(statusObj);
})
}
......@@ -673,6 +643,7 @@ class BaseQcService {
var timStr = moment().format("YYYYMMDDHHmm");
return prefix + timStr + uidStr;
}
/*
len:返回长度
radix:参与计算的长度,最大为62
......@@ -699,4 +670,5 @@ class BaseQcService {
}
module.exports = BaseQcService;
\ No newline at end of file
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