Commit 907ef412 by 庄冰

icp

parent 18bfd9dc
......@@ -45,6 +45,9 @@ class IcpAPI extends APIBase {
case "abolishIcpProgramme"://服务商icp方案关闭
opResult = await this.needsolutionSve.abolishIcpProgramme(pobj);
break;
case "getIcpProgrammeDetail"://获取icp方案
opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj);
break;
// case "updateStausByRefundOrder"://修改退款方案状态
// opResult = await this.needsolutionSve.updateStausByRefundOrder(pobj);
// break;
......
......@@ -558,10 +558,17 @@ class NeedsolutionService extends ServiceBase {
if(!needinfo.channelTypeCode){
return system.getResultFail(-206,"渠道方案类型错误");
}
var ns = await this.dao.model.findAll({
where:{needNo:ab.needNo},raw:true
});
for(var i=0;i<ns.length;i++){
var fa = ns[i];
if(fa.status!="yzf"){
return system.getResultFail(-207,"需求方案已存在,不能重复提交");
}
}
ab.solutionContent.bizType=needinfo.channelTypeCode;
bizType =needinfo.channelTypeCode;
if(!ab.solutionContent.solution){
return system.getResultFail(-104,"业务方案信息不能为空");
}
......@@ -844,7 +851,7 @@ class NeedsolutionService extends ServiceBase {
};
applicationStatusList.push(statusObj);
solutionContent.applicationStatusList = applicationStatusList;
solutionContent.status = ab.ApplicationStatus;
// solutionContent.status = ab.ApplicationStatus;
needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
var self = this;
return await this.db.transaction(async function (t) {
......@@ -902,6 +909,137 @@ class NeedsolutionService extends ServiceBase {
async confirmIcpIntention(pobj){
return system.getResultFail();
}
//接收方案状态变更通知
async receiveIcpStatusNotify(pobj){
var ab = pobj.actionBody;
if(!ab.BizId){
return system.getResultFail(-101,"渠道方案号不能为空");
}
if(!ab.status){
return system.getResultFail(-102,"方案状态不能为空");
}
//获取方案信息
var ns = await this.dao.model.findOne({
where:{channelSolutionNo: ab.BizId},raw:true
});
if(!ns || !ns.id){
return system.getResultFail(-102,"未知方案");
}
var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ns.needNo},raw:true
});
if(!needinfo){
return system.getResultFail(-104,"未知方案需求");
}
if(needinfo.status=="ycd" || needinfo.status=="ygb"){
return system.getResultFail(-105,"该方案需求状态为"+needinfo.statusName+",不能执行此操作");
}
if(ns.status!="dqr"){
return system.getResultFail(-103,"方案状态错误,只能废弃待确认方案");
}
var solutionContent = ns.solutionContent;
solutionContent.status = ab.status;
var material = solutionContent.material || {};
if(ab.remark){
solutionContent.notes = ab.remark;
}
if(ab.businessLicense){
material.PartnerBusinessLicense = ab.businessLicense;
}
if(ab.idCardUrlList && ab.idCardUrlList.length>0){
material.PartnerIdCardList = ab.idCardUrlList;
}
if(ab.userPlan){
material.PartnerPlan = ab.userPlan;
}
if(ab.userForeig){
material.PartnerForeignInvestment = ab.userForeig;
}
if(ab.userLaw){
material.PartnerLaw = ab.userLaw;
}
if(ab.userOtherList && ab.userOtherList.length>0){
material.PartnerSignAndStampOtherList = ab.userOtherList;
}
solutionContent.material = material;
solutionContent = JSON.stringify(solutionContent);
var updateObj = {
id:ns.id,solutionContent:solutionContent
};
if(ab.status == "11"){//⽅案已关闭
updateObj["status"]="yzf";
}else if(ab.status == "2" || ab.status == "4"){ //2, "⽤户已上传" 4, "⽤户已确认"
updateObj["status"]="dqr";
}
await this.dao.update(updateObj);//方案状态修改
ns = await this.dao.model.findOne({
where:{channelSolutionNo: ab.BizId},raw:true
});
return system.getResultSuccess(ns);
}
//接收icp用户方案反馈
async receiveIcpFeedback(pobj){
var ab = pobj.actionBody;
if(!ab.intentionBizId){
return system.getResultFail(-101,"渠道需求编号错误");
}
if(!ab.description){
return system.getResultFail(-102,"问题描述不能为空");
}
if(!ab.hasOwnProperty("intentionStatus")){
return system.getResultFail(-103,"需求当前状态不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where:{channelNeedNo: ab.intentionBizId},raw:true
});
if(!needinfo){
return system.getResultFail(-104,"未知方案需求");
}
if(needinfo.status=="ycd" || needinfo.status=="ygb"){
return system.getResultFail(-105,"该方案需求状态为"+needinfo.statusName+",不能执行此操作");
}
//获取方案信息
var ns = await this.dao.model.findOne({
where:{channelNeedNo:ab.intentionBizId,status:"dqr"},raw:true
});
if(!ns){
return system.getResultFail(-106,"未知方案");
}
var intentionStatusList=["未知","⽅案待服务商确认","⽅案待⽤户确认","处理中","已完成","已关闭"];
var updateObj={
id:ns.id
};
var solutionContent = ns.solutionContent;
solutionContent.notes = ab.description;
solutionContent.needStatus = ab.intentionStatus;
if(ab.intentionStatus==1 || ab.intentionStatus==2 || ab.intentionStatus==3){
updateObj["status"]="dqr";
}else if(ab.intentionStatus==4){
updateObj["status"]="ywc";
}else if(ab.intentionStatus==5){
updateObj["status"]="yzf";
}else{
return system.getResultFail(-107,"需求当前状态错误--"+ab.intentionStatus);
}
solutionContent.needStatusName = intentionStatusList[ab.intentionStatus];
solutionContent = JSON.stringify(solutionContent);
updateObj["solutionContent"] =solutionContent;
await this.dao.update(updateObj);//方案状态修改
return system.getResultSuccess();
}
//
async getIcpProgrammeDetail(pobj){
var ab = pobj.actionBody;
if(!ab.intentionBizId){
return system.getResultFail(-101,"渠道需求编号错误");
}
//获取方案信息
var ns = await this.dao.model.findAll({
where:{channelNeedNo:ab.intentionBizId},raw:true
});
return system.getResultSuccess(ns);
}
//---------------------icp注册-end-----------------------------------------------------------------
......
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