Commit 9b13ef46 by 庄冰

icp

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