Commit 47a96597 by 宋毅

Merge branch 'center-order' of gitlab.gongsibao.com:jiangyong/zhichan into center-order

parents 44ad40e9 200f15d5
...@@ -60,6 +60,9 @@ class IcpAPI extends APIBase { ...@@ -60,6 +60,9 @@ class IcpAPI extends APIBase {
case "getIcpProgrammeDetail"://获取方案详情(内部调用) case "getIcpProgrammeDetail"://获取方案详情(内部调用)
opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj); opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj);
break; break;
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.needsolutionSve.getProgrammeInfoByChannelNeedNo(pobj);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -10,6 +10,7 @@ class NeedinfoService extends ServiceBase { ...@@ -10,6 +10,7 @@ class NeedinfoService extends ServiceBase {
} }
async getItemByNeedNo(pobj) { async getItemByNeedNo(pobj) {
var item = await this.dao.getItemByNeedNo(pobj.actionBody.needNo); var item = await this.dao.getItemByNeedNo(pobj.actionBody.needNo);
console.log(system.getResultSuccess(item));
if (!item) { if (!item) {
return system.getResult(null, "需求数据为空,30210"); return system.getResult(null, "需求数据为空,30210");
} }
...@@ -84,6 +85,10 @@ class NeedinfoService extends ServiceBase { ...@@ -84,6 +85,10 @@ class NeedinfoService extends ServiceBase {
channelTypeName: actionBody.channel_type_name, channelTypeName: actionBody.channel_type_name,
status: "wts" status: "wts"
} }
if(nobj.channelTypeCode==7||nobj.channelTypeCode==5){
nobj.province=nobj.city,
nobj.city="";
}
await this.dao.create(nobj); await this.dao.create(nobj);
return system.getResultSuccess(); return system.getResultSuccess();
} }
...@@ -114,5 +119,5 @@ class NeedinfoService extends ServiceBase { ...@@ -114,5 +119,5 @@ class NeedinfoService extends ServiceBase {
} }
module.exports = NeedinfoService; module.exports = NeedinfoService;
// var a=new NeedinfoService(); var a=new NeedinfoService();
// a.needinfo2fq(); var b=a.getItemByNeedNo({actionBody:{needNo:"N202004132334EjurnEr"}});
\ No newline at end of file \ No newline at end of file
...@@ -10,6 +10,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -10,6 +10,7 @@ class NeedsolutionService extends ServiceBase {
// this.push2aliSve = system.getObject("service.common.push2aliSve"); // this.push2aliSve = system.getObject("service.common.push2aliSve");
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao"); this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
this.icpSolutionStatusReference={ this.icpSolutionStatusReference={
SOLUTION_SUBMIT:"提交服务单",
UN_PAID:"未支付",PAID:"用户支付",USER_UPLOADED:"用户上传资料",MATERIAL_UNCONFIRM:"服务商递交⽂件" UN_PAID:"未支付",PAID:"用户支付",USER_UPLOADED:"用户上传资料",MATERIAL_UNCONFIRM:"服务商递交⽂件"
,USER_CONFIRMED:"⽤户已确认递交⽂件",ACCOUNT_REGISTERED:"完成账户注册",MATERIAL_SUBMITTED:"完成资料递交", ,USER_CONFIRMED:"⽤户已确认递交⽂件",ACCOUNT_REGISTERED:"完成账户注册",MATERIAL_SUBMITTED:"完成资料递交",
GXB_ACCEPT:"⼯信部已受理",GXB_REFUSE:"⼯信部不予受理",GXB_FAIL:"⼯信部未通过",GXB_SUCCESS:"工信部通过" GXB_ACCEPT:"⼯信部已受理",GXB_REFUSE:"⼯信部不予受理",GXB_FAIL:"⼯信部未通过",GXB_SUCCESS:"工信部通过"
...@@ -213,16 +214,18 @@ class NeedsolutionService extends ServiceBase { ...@@ -213,16 +214,18 @@ class NeedsolutionService extends ServiceBase {
if (pageSize > 500) { if (pageSize > 500) {
pageSize = 500; pageSize = 500;
} }
var bizType = ab.bizType || "esp.companyreg";// esp.companyreg_cloud var bizType = ab.bizType;// || "esp.companyreg";// esp.companyreg_cloud
var pageIndex = Number(ab.pageIndex || 1); var pageIndex = Number(ab.pageIndex || 1);
var from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize); var from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize);
//select * from log where data->'$.id' = 142; //select * from log where data->'$.id' = 142;
var sql = "select id,needNo,solutionNo,orderNo,solutionContent,status,statusName,created_at from n_need_solution where 1=1 "; var sql = "select id,needNo,channelNeedNo,solutionNo,channelSolutionNo,orderNo,solutionContent,status,statusName,created_at from n_need_solution where 1=1 ";
var sqlCount = "select count(1) as dataCount from n_need_solution where 1=1 "; var sqlCount = "select count(1) as dataCount from n_need_solution where 1=1 ";
sql = sql+" and createUserId="+user.id; sql = sql+" and createUserId="+user.id;
sqlCount = sqlCount+" and createUserId="+user.id; sqlCount = sqlCount+" and createUserId="+user.id;
if(bizType){
sql = sql+" and solutionContent->'$.bizType' = '"+bizType+"'"; sql = sql+" and solutionContent->'$.bizType' = '"+bizType+"'";
sqlCount = sqlCount+" and solutionContent->'$.bizType' = '"+bizType+"'"; sqlCount = sqlCount+" and solutionContent->'$.bizType' = '"+bizType+"'";
}
var paramWhere = {}; var paramWhere = {};
if (ab.solutionNo) {//方案号 if (ab.solutionNo) {//方案号
sql += " and solutionNo = :solutionNo"; sql += " and solutionNo = :solutionNo";
...@@ -533,6 +536,38 @@ class NeedsolutionService extends ServiceBase { ...@@ -533,6 +536,38 @@ class NeedsolutionService extends ServiceBase {
//---------------------公司注册-end----------------------------------------------------------------- //---------------------公司注册-end-----------------------------------------------------------------
//---------------------icp注册-start----------------------------------------------------------------- //---------------------icp注册-start-----------------------------------------------------------------
//根据需求查看方案列表
async getProgrammeInfoByChannelNeedNo(pobj){
var ab = pobj.actionBody;
var user = pobj.userInfo;
if(!user || !user.id){
return system.getResultFail(-100,"未知用户");
}
ab["createUserId"]=user.id;
// followManMobile: DataTypes.STRING,//跟进人手机号(合伙人)
// followManOnlyCode: DataTypes.STRING(50),//跟进者唯一码
if(!ab.needNo){
return system.getResultFail(-101,"需求号不能为空");
}
// if(!ab.followManMobile){
// return system.getResultFail(-102,"跟进人手机号不能为空");
// }
// if(!ab.followManOnlyCode){
// return system.getResultFail(-103,"跟进人唯一码不能为空");
// }
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where:{channelNeedNo:ab.needNo},raw:true
});
if(!needinfo || !needinfo.id){
return system.getResultFail(-102,"未知需求信息");
}
var ns = await this.dao.model.findAll({
where:{needNo:needinfo.needNo,createUserId:user.id},raw:true,
attributes:["needNo","solutionNo","channelSolutionNo","orderNo","solutionContent","status","statusName"]
});
return system.getResultSuccess(ns);
}
//提交方案 //提交方案
async submitIcpProgramme(pobj){ async submitIcpProgramme(pobj){
var ab = pobj.actionBody; var ab = pobj.actionBody;
...@@ -584,7 +619,12 @@ class NeedsolutionService extends ServiceBase { ...@@ -584,7 +619,12 @@ class NeedsolutionService extends ServiceBase {
if(!solution){ if(!solution){
return system.getResultFail(-103,"方案交付信息有误"); return system.getResultFail(-103,"方案交付信息有误");
} }
ab.solutionContent.solution.IcpType = needinfo.channelTypeCode; if(needinfo.channelTypeCode=="7"){//edi
ab.solutionContent.solution.IcpType=2;
}
if(needinfo.channelTypeCode=="5"){//icp
ab.solutionContent.solution.IcpType=1;
}
ab.solutionContent.applicationStatusList = [{ ab.solutionContent.applicationStatusList = [{
"OfficialFileURL":"", "OfficialFileURL":"",
"ApplicationStatus":"submitIcpProgramme", "ApplicationStatus":"submitIcpProgramme",
...@@ -600,6 +640,13 @@ class NeedsolutionService extends ServiceBase { ...@@ -600,6 +640,13 @@ class NeedsolutionService extends ServiceBase {
if(!solution.Area){ if(!solution.Area){
return system.getResultFail(-107,"区域不能为空"); return system.getResultFail(-107,"区域不能为空");
} }
var solutionFlowList = ab.solutionContent.solutionFlowList || [];
solutionFlowList.push({
status:"SOLUTION_SUBMIT",statusName:this.icpSolutionStatusReference.SOLUTION_SUBMIT,updated_at:new Date()
});
ab.solutionContent.status = "SOLUTION_SUBMIT";
ab.solutionContent.statusName = this.icpSolutionStatusReference.SOLUTION_SUBMIT;
ab.solutionContent.solutionFlowList = solutionFlowList;
ab["channelNeedNo"] = needinfo.channelNeedNo; ab["channelNeedNo"] = needinfo.channelNeedNo;
var solutionNo = await this.getBusUid("ns"); var solutionNo = await this.getBusUid("ns");
ab["solutionNo"] = solutionNo; ab["solutionNo"] = solutionNo;
...@@ -648,100 +695,6 @@ class NeedsolutionService extends ServiceBase { ...@@ -648,100 +695,6 @@ class NeedsolutionService extends ServiceBase {
} }
//修改icp方案-- 无效 //修改icp方案-- 无效
async updateIcpProgramme(pobj){ async updateIcpProgramme(pobj){
var ab = pobj.actionBody;
var user = pobj.userInfo;
if(!user || !user.id){
return system.getResultFail(-100,"未知用户");
}
ab["createUserId"]=user.id;
if(!ab.needNo){
return system.getResultFail(-101,"渠道需求号不能为空");
}
if(!ab.solutionContent){
return system.getResultFail(-102,"方案信息有误");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where:{channelNeedNo:ab.needNo},raw:true
});
if(!needinfo || !needinfo.id){
return system.getResultFail(-201,"未知需求信息");
}
if(needinfo.status=="ycd" || needinfo.status=="ygb"){
return system.getResultFail(-202,"该方案需求状态为"+needinfo.statusName+",不能创建方案");
}
var bizType = ab.solutionContent.bizType;//icp业务类型
if(!bizType || !needinfo.typeCode || bizType!=needinfo.typeCode){
return system.getResultFail(-205,"方案类型错误");
}
if(!needinfo.channelTypeCode){
return system.getResultFail(-206,"渠道方案类型错误");
}
ab.solutionContent.bizType=needinfo.channelTypeCode;
bizType =needinfo.channelTypeCode;
if(!ab.solutionContent.solution){
return system.getResultFail(-104,"业务方案信息不能为空");
}
var solution = ab.solutionContent.solution;
if(!solution){
return system.getResultFail(-103,"方案交付信息有误");
}
ab.solutionContent.solution.IcpType = needinfo.channelTypeCode;
if(!solution.CompanyName){
return system.getResultFail(-105,"公司名不能为空");
}
if(!solution.CompanyAddress){
return system.getResultFail(-106,"公司地址不能为空");
}
if(!solution.Area){
return system.getResultFail(-107,"区域不能为空");
}
ab["channelNeedNo"] = needinfo.channelNeedNo;
var solutionNo = await this.getBusUid("ns");
ab["solutionNo"] = solutionNo;
ab["status"] = "dqr";
ab.solutionContent["notes"]="";
ab.solutionContent["totalSum"]="";
ab.solutionContent = JSON.stringify(ab.solutionContent);
var self = this;
return await this.db.transaction(async function (t) {
ab["needNo"] = needinfo.needNo;
var od = await self.dao.create(ab,t);
if(od && od.id){
var pushflag = 0;//推送标志 值为1推送小记
var needObj={
id:needinfo.id
};
if(!needinfo.followManUserId){
needObj={
id:needinfo.id,
followManUserId: user.id,//跟进人id
followManName: user.channel_username,//跟进人姓名
followManMobile: user.mobile,//跟进人手机号(合伙人)
followManOnlyCode: user.channel_userid
};
}
if(!needinfo.followContent){
var followContent = {
followDate:new Date(),
content:"icp提交到方案"
};
followContent = JSON.stringify(followContent);
needObj["followContent"] = followContent;
pushflag = 1;
}
await self.needinfoDao.update(needObj,t);
needinfo = await self.needinfoDao.model.findOne({
where:{id:needinfo.id},raw:true
});
needinfo["pushflag"]=pushflag;
return system.getResultSuccess({needinfo:needinfo,needsolution:od});
}else{
return system.getResultFail(-202, "提交方案失败");
}
})
} }
//提交icp材料信息 //提交icp材料信息
...@@ -772,6 +725,9 @@ class NeedsolutionService extends ServiceBase { ...@@ -772,6 +725,9 @@ class NeedsolutionService extends ServiceBase {
if(!solutionContent){ if(!solutionContent){
return system.getResultFail(-402,"方案交付信息有误"); return system.getResultFail(-402,"方案交付信息有误");
} }
if(solutionContent.status!="USER_UPLOADED"){
return system.getResultFail(-403,"用户未上传材料,不能执行此操作");
}
//获取需求信息 //获取需求信息
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
...@@ -798,9 +754,9 @@ class NeedsolutionService extends ServiceBase { ...@@ -798,9 +754,9 @@ class NeedsolutionService extends ServiceBase {
if(!material.PartnerDomainCertificate){ if(!material.PartnerDomainCertificate){
return system.getResultFail(-106,"域名证书不能为空"); return system.getResultFail(-106,"域名证书不能为空");
} }
if(!material.PartnerPreviewOtherList || material.PartnerPreviewOtherList.length<1){ // if(!material.PartnerPreviewOtherList || material.PartnerPreviewOtherList.length<1){
return system.getResultFail(-107,"合作方递交其他供预览文件不能为空"); // return system.getResultFail(-107,"合作方递交其他供预览文件不能为空");
} // }
solutionContent.material = ab.material; solutionContent.material = ab.material;
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({ solutionFlowList.push({
...@@ -899,6 +855,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -899,6 +855,7 @@ class NeedsolutionService extends ServiceBase {
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";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE; solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE;
} }
if(ab.ApplicationStatus==511){//⼯商部通过 if(ab.ApplicationStatus==511){//⼯商部通过
...@@ -906,6 +863,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -906,6 +863,7 @@ class NeedsolutionService extends ServiceBase {
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"; needsolutioninfo.status="ywc";
needsolutioninfo.status="ywc";
solutionContent.status = "GXB_SUCCESS"; solutionContent.status = "GXB_SUCCESS";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_SUCCESS; solutionContent.statusName = this.icpSolutionStatusReference.GXB_SUCCESS;
} }
...@@ -914,6 +872,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -914,6 +872,7 @@ class NeedsolutionService extends ServiceBase {
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";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_FAIL; solutionContent.statusName = this.icpSolutionStatusReference.GXB_FAIL;
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
...@@ -939,7 +898,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -939,7 +898,7 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-101,"渠道方案号不能为空"); return system.getResultFail(-101,"渠道方案号不能为空");
} }
if(!ab.Note){ if(!ab.Note){
return system.getResultFail(-105,"关闭理由不能为空"); return system.getResultFail(-106,"关闭理由不能为空");
} }
//获取方案信息 //获取方案信息
var ns = await this.dao.model.findOne({ var ns = await this.dao.model.findOne({
...@@ -961,6 +920,9 @@ class NeedsolutionService extends ServiceBase { ...@@ -961,6 +920,9 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-103,"方案状态错误,只能废弃待确认方案"); return system.getResultFail(-103,"方案状态错误,只能废弃待确认方案");
} }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
if(!solutionContent.status || ["USER_UPLOADED","MATERIAL_UNCONFIRM","USER_CONFIRMED","ACCOUNT_REGISTERED","MATERIAL_SUBMITTED"].indexOf(solutionContent.status)<0 ){
return system.getResultFail(-108,"方案流程状态错误,不能执行此操作");
}
solutionContent.solution.Note = ab.Note; solutionContent.solution.Note = ab.Note;
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
await this.dao.update({id:ns.id,status:"yzf",solutionContent:solutionContent});//方案废弃 await this.dao.update({id:ns.id,status:"yzf",solutionContent:solutionContent});//方案废弃
...@@ -999,8 +961,8 @@ class NeedsolutionService extends ServiceBase { ...@@ -999,8 +961,8 @@ class NeedsolutionService extends ServiceBase {
if(needinfo.status=="ycd" || needinfo.status=="ygb"){ if(needinfo.status=="ycd" || needinfo.status=="ygb"){
return system.getResultFail(-105,"该方案需求状态为"+needinfo.statusName+",不能执行此操作"); return system.getResultFail(-105,"该方案需求状态为"+needinfo.statusName+",不能执行此操作");
} }
if(ns.status!="dqr"){ if(ns.status!="dqr" && ns.status!="yzf" ){
return system.getResultFail(-103,"方案状态错误,只能废弃待确认方案"); return system.getResultFail(-103,"方案状态错误,不能作废已完成方案");
} }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
//方案流程列表 //方案流程列表
...@@ -1032,23 +994,29 @@ class NeedsolutionService extends ServiceBase { ...@@ -1032,23 +994,29 @@ class NeedsolutionService extends ServiceBase {
if(ab.remark){ if(ab.remark){
solutionContent.notes = ab.remark; solutionContent.notes = ab.remark;
} }
if(ab.businessLicense){ if(ab.newbusinessLicense){
material.PartnerBusinessLicense = ab.businessLicense; material.PartnerBusinessLicense = ab.newbusinessLicense;
material.aliPartnerBusinessLicense = ab.businessLicense;
} }
if(ab.idCardUrlList && ab.idCardUrlList.length>0){ if(ab.newidCardUrlList && ab.newidCardUrlList.length>0){
material.PartnerIdCardList = ab.idCardUrlList; material.PartnerIdCardList = ab.newidCardUrlList;
material.aliPartnerIdCardList = ab.idCardUrlList;
} }
if(ab.userPlan){ if(ab.newuserPlan){
material.PartnerPlan = ab.userPlan; material.PartnerPlan = ab.newuserPlan;
material.aliPartnerPlan = ab.userPlan;
} }
if(ab.userForeig){ if(ab.newuserForeig){
material.PartnerForeignInvestment = ab.userForeig; material.PartnerForeignInvestment = ab.newuserForeig;
material.aliPartnerForeignInvestment = ab.userForeig;
} }
if(ab.userLaw){ if(ab.newuserLaw){
material.PartnerLaw = ab.userLaw; material.PartnerLaw = ab.newuserLaw;
material.aliPartnerLaw = ab.userLaw;
} }
if(ab.userOtherList && ab.userOtherList.length>0){ if(ab.newuserOtherList && ab.newuserOtherList.length>0){
material.PartnerSignAndStampOtherList = ab.userOtherList; material.PartnerSignAndStampOtherList = ab.newuserOtherList;
material.aliPartnerSignAndStampOtherList = ab.userOtherList;
} }
solutionContent.material = material; solutionContent.material = material;
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
...@@ -1142,9 +1110,16 @@ class NeedsolutionService extends ServiceBase { ...@@ -1142,9 +1110,16 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-101,"方案编号不能为空"); return system.getResultFail(-101,"方案编号不能为空");
} }
//获取方案信息 //获取方案信息
var ns = await this.dao.model.findAll({ var ns = await this.dao.model.findOne({
where:{solutionNo:ab.solutionNo,createUserId:user.id},raw:true where:{solutionNo:ab.solutionNo,createUserId:user.id},raw:true
}); });
if(ns && ns.needNo){
var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ns.needNo},raw:true,
attributes:["publishName","publishMobile","channelUserId"]
});
ns.needinfo = needinfo;
}
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//---------------------icp注册-end----------------------------------------------------------------- //---------------------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