Commit 9b13ef46 by 庄冰

icp

parent c8619ab6
...@@ -21,6 +21,7 @@ module.exports = (db, DataTypes) => { ...@@ -21,6 +21,7 @@ module.exports = (db, DataTypes) => {
}, },
statusName: DataTypes.STRING(50), //状态名称 statusName: DataTypes.STRING(50), //状态名称
createUserId: DataTypes.INTEGER, //创建者id createUserId: DataTypes.INTEGER, //创建者id
isInvalid:DataTypes.INTEGER, //是否废弃的无效的方案
}, { }, {
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: true,
......
...@@ -413,7 +413,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -413,7 +413,7 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案"); return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案");
} }
} }
await this.dao.model.update({ status: "yzf" }, { where: { needNo: needinfo.needNo } });//方案废弃 await this.dao.model.update({ status: "yzf",isInvalid:1 }, { where: { needNo: needinfo.needNo } });//方案废弃
return system.getResultSuccess(); return system.getResultSuccess();
} }
......
...@@ -58,7 +58,7 @@ class AliyunQcService{ ...@@ -58,7 +58,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findAll({ var ns = await this.needsolutionDao.model.findAll({
where: { channelSolutionNo: ab.BizId }, raw: true where: { channelSolutionNo: ab.BizId,isInvalid:0 }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
...@@ -121,7 +121,7 @@ class AliyunQcService{ ...@@ -121,7 +121,7 @@ class AliyunQcService{
ab.solutionContent.typeCode = needinfo.typeCode; ab.solutionContent.typeCode = needinfo.typeCode;
ab.solutionContent.typeName = needinfo.typeName; ab.solutionContent.typeName = needinfo.typeName;
var ns = await this.needsolutionDao.model.findAll({ 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++) { for (var i = 0; i < ns.length; i++) {
var fa = ns[i]; var fa = ns[i];
...@@ -131,10 +131,10 @@ class AliyunQcService{ ...@@ -131,10 +131,10 @@ class AliyunQcService{
if (fa.status == "ybh") { if (fa.status == "ybh") {
ab.channelSolutionNo = fa.channelSolutionNo; ab.channelSolutionNo = fa.channelSolutionNo;
} }
if (fa.status == "yzf") {
ab.channelSolutionNo = "";
}
} }
// if (!ab.solutionContent.solution) {
// return system.getResultFail(-104, "业务方案信息不能为空");
// }
var solution = ab.solutionContent.solution; var solution = ab.solutionContent.solution;
if (!solution) { if (!solution) {
return system.getResultFail(-103, "方案交付信息有误"); return system.getResultFail(-103, "方案交付信息有误");
...@@ -146,12 +146,6 @@ class AliyunQcService{ ...@@ -146,12 +146,6 @@ class AliyunQcService{
}else{ }else{
return system.getResultFail(-208, "需求业务类型有误"); return system.getResultFail(-208, "需求业务类型有误");
} }
// ab.solutionContent.applicationStatusList = [{
// "OfficialFileURL": "",
// "ApplicationStatus": "submitIcpProgramme",
// "ApplicationStatusName": "提交方案",
// "created_at": new Date()
// }];
if (!solution.CompanyName) { if (!solution.CompanyName) {
return system.getResultFail(-105, "公司名不能为空"); return system.getResultFail(-105, "公司名不能为空");
} }
...@@ -255,7 +249,7 @@ class AliyunQcService{ ...@@ -255,7 +249,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId}, raw: true where: { channelSolutionNo: ab.BizId,isInvalid:0}, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-300, "未知方案"); return system.getResultFail(-300, "未知方案");
...@@ -277,13 +271,19 @@ class AliyunQcService{ ...@@ -277,13 +271,19 @@ class AliyunQcService{
return system.getResultFail(-302, "方案流程状态错误,不能执行此操作"); return system.getResultFail(-302, "方案流程状态错误,不能执行此操作");
} }
solutionContent.serviceProviderNote = ab.Note; solutionContent.serviceProviderNote = ab.Note;
var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "CLOSE", statusName: this.icpSolutionStatusReference.CLOSE, updated_at: new Date()
});
solutionContent.status = "CLOSE";
solutionContent.statusName = this.icpSolutionStatusReference.CLOSE;
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
await this.needsolutionDao.update({ id: ns.id, status: "yzf", solutionContent: solutionContent });//方案废弃 await this.needsolutionDao.update({ id: ns.id, status: "yzf",isInvalid:1, solutionContent: solutionContent });//方案废弃
//获取方案信息 //获取方案信息
ns = await this.needsolutionDao.model.findOne({ var new_ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId, createUserId: user.id }, raw: true where: { id:ns.id}, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(new_ns);
} }
//交付商提交材料信息 //交付商提交材料信息
async serviceProviderSubmitMaterial(pobj){ async serviceProviderSubmitMaterial(pobj){
...@@ -308,7 +308,7 @@ class AliyunQcService{ ...@@ -308,7 +308,7 @@ class AliyunQcService{
if (!user || !user.id) { if (!user || !user.id) {
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
ab["createUserId"] = user.id; // ab["createUserId"] = user.id;
if (!ab.BizId) { if (!ab.BizId) {
return system.getResultFail(-101, "渠道方案编号不能为空"); return system.getResultFail(-101, "渠道方案编号不能为空");
} }
...@@ -317,7 +317,8 @@ class AliyunQcService{ ...@@ -317,7 +317,8 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({ var needsolutioninfo = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true attributes:["id","needNo","solutionContent"],
where: { channelSolutionNo: ab.BizId ,isInvalid:0}, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-400, "未知方案");
...@@ -370,10 +371,10 @@ class AliyunQcService{ ...@@ -370,10 +371,10 @@ class AliyunQcService{
var self = this; var self = this;
return await this.needsolutionDao.db.transaction(async function (t) { return await this.needsolutionDao.db.transaction(async function (t) {
await self.needsolutionDao.update(needsolutioninfo, t); await self.needsolutionDao.update(needsolutioninfo, t);
needsolutioninfo = await self.needsolutionDao.model.findOne({ var new_needsolutioninfo = await self.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true where: { id: needsolutioninfo.id }, raw: true
}); });
return system.getResultSuccess(needsolutioninfo); return system.getResultSuccess(new_needsolutioninfo);
}) })
} }
...@@ -399,6 +400,7 @@ class AliyunQcService{ ...@@ -399,6 +400,7 @@ class AliyunQcService{
return system.getResultFail(-301, "未知方案"); return system.getResultFail(-301, "未知方案");
} }
ab["BizId"] = ns.channelSolutionNo; ab["BizId"] = ns.channelSolutionNo;
ab["solutionNo"] = ns.solutionNo;
pobj.actionBody = ab; pobj.actionBody = ab;
return this.acceptIcpPartnerNotification(pobj); return this.acceptIcpPartnerNotification(pobj);
} }
...@@ -409,16 +411,20 @@ class AliyunQcService{ ...@@ -409,16 +411,20 @@ class AliyunQcService{
if (!user || !user.id) { if (!user || !user.id) {
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
ab["createUserId"] = user.id; // ab["createUserId"] = user.id;
if (!ab.BizId) { // if (!ab.BizId) {
return system.getResultFail(-101, "渠道方案编号不能为空"); // return system.getResultFail(-101, "渠道方案编号不能为空");
// }
if (!ab.solutionNo) {
return system.getResultFail(-101, "方案编号不能为空");
} }
if (!ab.ApplicationStatus) { if (!ab.ApplicationStatus) {
return system.getResultFail(-102, "通知状态不能为空"); return system.getResultFail(-102, "通知状态不能为空");
} }
//获取方案信息 //获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({ var needsolutioninfo = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true attributes:["id","status","solutionContent","needNo",""],
where: { solutionNo: ab.solutionNo }, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-400, "未知方案");
...@@ -433,10 +439,9 @@ class AliyunQcService{ ...@@ -433,10 +439,9 @@ class AliyunQcService{
if (solutionContent.applicationStatus && solutionContent.applicationStatus>ab.ApplicationStatus) { if (solutionContent.applicationStatus && solutionContent.applicationStatus>ab.ApplicationStatus) {
return system.getResultFail(-403, "操作失败,交付流程未按顺序执行"); return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
} }
// if (solutionContent.ApplicationStatus && solutionContent.ApplicationStatus==ab.ApplicationStatus) { if (solutionContent.ApplicationStatus && solutionContent.ApplicationStatus==ab.ApplicationStatus) {
// return system.getResultFail(-403, "操作失败,该流程状态已提交,不能重复提交"); return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交");
// } }
// if(solutionContent.)
//获取需求信息 //获取需求信息
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where: { needNo: needsolutioninfo.needNo }, raw: true where: { needNo: needsolutioninfo.needNo }, raw: true
...@@ -491,7 +496,7 @@ class AliyunQcService{ ...@@ -491,7 +496,7 @@ class AliyunQcService{
status: "GXB_REFUSE", statusName: this.icpSolutionStatusReference.GXB_REFUSE, updated_at: new Date() status: "GXB_REFUSE", statusName: this.icpSolutionStatusReference.GXB_REFUSE, updated_at: new Date()
}); });
solutionContent.status = "GXB_REFUSE"; solutionContent.status = "GXB_REFUSE";
needsolutioninfo.status = "yzf"; needsolutioninfo.status = "ywc";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE; solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE;
} }
if (ab.ApplicationStatus == 511) {//⼯商部通过 if (ab.ApplicationStatus == 511) {//⼯商部通过
...@@ -515,7 +520,7 @@ class AliyunQcService{ ...@@ -515,7 +520,7 @@ class AliyunQcService{
status: "GXB_FAIL", statusName: this.icpSolutionStatusReference.GXB_FAIL, updated_at: new Date() status: "GXB_FAIL", statusName: this.icpSolutionStatusReference.GXB_FAIL, updated_at: new Date()
}); });
solutionContent.status = "GXB_FAIL"; solutionContent.status = "GXB_FAIL";
needsolutioninfo.status = "yzf"; needsolutioninfo.status = "ywc";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_FAIL; solutionContent.statusName = this.icpSolutionStatusReference.GXB_FAIL;
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
...@@ -532,11 +537,7 @@ class AliyunQcService{ ...@@ -532,11 +537,7 @@ class AliyunQcService{
needsolutioninfo.solutionContent = JSON.stringify(solutionContent); needsolutioninfo.solutionContent = JSON.stringify(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) {
delete needsolutioninfo["statusName"];
await self.needsolutionDao.update(needsolutioninfo, t); await self.needsolutionDao.update(needsolutioninfo, t);
needsolutioninfo = await self.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true
});
statusObj["BizId"] = ab.BizId; statusObj["BizId"] = ab.BizId;
return system.getResultSuccess(statusObj); return system.getResultSuccess(statusObj);
}) })
...@@ -553,7 +554,7 @@ class AliyunQcService{ ...@@ -553,7 +554,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true where: { channelSolutionNo: ab.BizId ,isInvalid:0}, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-102, "未知方案"); return system.getResultFail(-102, "未知方案");
...@@ -643,10 +644,11 @@ class AliyunQcService{ ...@@ -643,10 +644,11 @@ class AliyunQcService{
}; };
if (ab.status == "11") {//⽅案已关闭 if (ab.status == "11") {//⽅案已关闭
updateObj["status"] = "yzf"; updateObj["status"] = "yzf";
updateObj["isInvalid"]=1;
} }
await this.needsolutionDao.update(updateObj);//方案状态修改 await this.needsolutionDao.update(updateObj);//方案状态修改
ns = await this.needsolutionDao.model.findOne({ var new_ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true where: { id: ns.id }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
...@@ -674,7 +676,7 @@ class AliyunQcService{ ...@@ -674,7 +676,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelNeedNo: ab.intentionBizId, status: "dqr" }, raw: true where: { channelNeedNo: ab.intentionBizId, isInvalid:0 }, raw: true
}); });
if (!ns) { if (!ns) {
return system.getResultFail(-106, "未知方案"); return system.getResultFail(-106, "未知方案");
...@@ -688,14 +690,16 @@ class AliyunQcService{ ...@@ -688,14 +690,16 @@ class AliyunQcService{
solutionContent.needStatus = ab.intentionStatus; solutionContent.needStatus = ab.intentionStatus;
if(ab.intentionStatus == 1){ if(ab.intentionStatus == 1){
updateObj["status"] = "ybh"; updateObj["status"] = "ybh";
updateObj["isInvalid"]=1;
}else if (ab.intentionStatus == 2) { }else if (ab.intentionStatus == 2) {
updateObj["status"] = "dqr"; updateObj["status"] = "dqr";
}else if (ab.intentionStatus == 3) { }else if (ab.intentionStatus == 3) {
updateObj["status"] = "ywc"; updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 4) { } else if (ab.intentionStatus == 4) {
updateObj["status"] = "ywc"; updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 5) { } else if (ab.intentionStatus == 5) {
updateObj["status"] = "yzf"; updateObj["status"] = "yzf";
updateObj["isInvalid"]=1;
} else { } else {
return system.getResultFail(-107, "需求当前状态错误--" + ab.intentionStatus); return system.getResultFail(-107, "需求当前状态错误--" + ab.intentionStatus);
} }
...@@ -715,7 +719,7 @@ class AliyunQcService{ ...@@ -715,7 +719,7 @@ class AliyunQcService{
return system.getResultFail(-102, "方案业务编号不能为空"); return system.getResultFail(-102, "方案业务编号不能为空");
} }
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { solutionNo: ab.solutionNo }, raw: true where: { solutionNo: ab.solutionNo,isInvalid:0 }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-103, "未知方案"); return system.getResultFail(-103, "未知方案");
......
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