Commit 51d0a365 by 宋毅

tj

parent 0c92c857
...@@ -452,8 +452,8 @@ class OrderInfoService extends ServiceBase { ...@@ -452,8 +452,8 @@ class OrderInfoService extends ServiceBase {
if (produceinfo) { if (produceinfo) {
pobj.actionBody.payCode = produceinfo[0].payCode; pobj.actionBody.payCode = produceinfo[0].payCode;
} }
pobj.actionBody.totalSum = pobj.actionBody.orderPrice; pobj.actionBody.totalSum = Number(pobj.actionBody.orderPrice || "0");
pobj.actionBody.payTotalSum = pobj.actionBody.orderPrice; pobj.actionBody.payTotalSum = = Number(pobj.actionBody.orderPrice || "0");
var self = this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("ic" + pobj.appInfo.uapp_id); var orderNo = await self.getBusUid("ic" + pobj.appInfo.uapp_id);
...@@ -486,7 +486,7 @@ class OrderInfoService extends ServiceBase { ...@@ -486,7 +486,7 @@ class OrderInfoService extends ServiceBase {
} }
var solutionContent = needsolutioninfo.solutionContent; var solutionContent = needsolutioninfo.solutionContent;
solutionContent = JSON.parse(solutionContent); solutionContent = JSON.parse(solutionContent);
solutionContent["totalSum"] = orderPrice; solutionContent["totalSum"] = Number(orderPrice || "0");
needsolutioninfo.solutionContent = JSON.stringify(solutionContent); needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
needsolutioninfo.status = status; needsolutioninfo.status = status;
await self.needsolutionDao.update(needsolutioninfo, t); await self.needsolutionDao.update(needsolutioninfo, t);
......
...@@ -6,183 +6,183 @@ class NeedsolutionService extends ServiceBase { ...@@ -6,183 +6,183 @@ class NeedsolutionService extends ServiceBase {
constructor() { constructor() {
super("dbneed", ServiceBase.getDaoName(NeedsolutionService)); super("dbneed", ServiceBase.getDaoName(NeedsolutionService));
this.execlient = system.getObject("util.execClient"); this.execlient = system.getObject("util.execClient");
this.needinfoDao = system.getObject("db.dbneed.needinfoDao"); this.needinfoDao = system.getObject("db.dbneed.needinfoDao");
// 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:"提交服务单", 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: "工信部通过"
,CLOSE:"方案关闭" , CLOSE: "方案关闭"
}; };
} }
//---------------------公司注册-start----------------------------------------------------------------- //---------------------公司注册-start-----------------------------------------------------------------
//提交方案 //提交方案
async submitProgramme(pobj){ async submitProgramme(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
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.needNo){ if (!ab.needNo) {
return system.getResultFail(-101,"需求号不能为空"); return system.getResultFail(-101, "需求号不能为空");
} }
if(!ab.solutionContent){ if (!ab.solutionContent) {
return system.getResultFail(-102,"方案信息有误"); return system.getResultFail(-102, "方案信息有误");
} }
//获取需求信息 //获取需求信息
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{channelNeedNo:ab.needNo},raw:true where: { channelNeedNo: ab.needNo }, raw: true
}); });
if(!needinfo || !needinfo.id){ if (!needinfo || !needinfo.id) {
return system.getResultFail(-201,"未知需求信息"); return system.getResultFail(-201, "未知需求信息");
} }
if(needinfo.status=="ycd" || needinfo.status=="ygb"){ if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-202,"该方案需求状态为"+needinfo.statusName+",不能创建方案"); return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能创建方案");
} }
var bizType = ab.solutionContent.bizType;//业务类型 var bizType = ab.solutionContent.bizType;//业务类型
if(!bizType || !needinfo.typeCode || bizType!=needinfo.typeCode){ if (!bizType || !needinfo.typeCode || bizType != needinfo.typeCode) {
return system.getResultFail(-205,"方案类型错误"); return system.getResultFail(-205, "方案类型错误");
} }
if(!needinfo.channelTypeCode){ if (!needinfo.channelTypeCode) {
return system.getResultFail(-206,"渠道方案类型错误"); return system.getResultFail(-206, "渠道方案类型错误");
} }
ab.solutionContent.bizType=needinfo.channelTypeCode; ab.solutionContent.bizType = needinfo.channelTypeCode;
bizType =needinfo.channelTypeCode; bizType = needinfo.channelTypeCode;
// bizType取值如下: // bizType取值如下:
// 商标交易:esp.trademark_trade // 商标交易:esp.trademark_trade
// 财税代账:esp.bookkeeping // 财税代账:esp.bookkeeping
// 普通公司注册:esp.companyreg // 普通公司注册:esp.companyreg
// 云上公司注册:esp.companyreg_cloud // 云上公司注册:esp.companyreg_cloud
if(!ab.solutionContent.solution){ if (!ab.solutionContent.solution) {
return system.getResultFail(-104,"业务方案信息不能为空"); return system.getResultFail(-104, "业务方案信息不能为空");
} }
var solution = ab.solutionContent.solution; var solution = ab.solutionContent.solution;
if(bizType=="esp.companyreg"){//普通公司注册 if (bizType == "esp.companyreg") {//普通公司注册
if(!solution.companyName){ if (!solution.companyName) {
return system.getResultFail(-105,"公司名称不能为空"); return system.getResultFail(-105, "公司名称不能为空");
} }
if(!solution.city){ if (!solution.city) {
return system.getResultFail(-106,"注册城市不能为空"); return system.getResultFail(-106, "注册城市不能为空");
} }
if(!solution.area){ if (!solution.area) {
return system.getResultFail(-107,"注册区域不能为空"); return system.getResultFail(-107, "注册区域不能为空");
} }
if(!solution.companyCategory){ if (!solution.companyCategory) {
return system.getResultFail(-108,"纳税人类型不能为空"); return system.getResultFail(-108, "纳税人类型不能为空");
} }
// if(!solution.companyType){ // if(!solution.companyType){
// return system.getResultFail(-109,"公司性质不能为空"); // return system.getResultFail(-109,"公司性质不能为空");
// } // }
if(!solution.orgType){ if (!solution.orgType) {
return system.getResultFail(-110,"组织类型不能为空"); return system.getResultFail(-110, "组织类型不能为空");
} }
if(!solution.industryType){ if (!solution.industryType) {
return system.getResultFail(-111,"从事行业不能为空"); return system.getResultFail(-111, "从事行业不能为空");
} }
if(!solution.scope){ if (!solution.scope) {
return system.getResultFail(-112,"经营范围不能为空"); return system.getResultFail(-112, "经营范围不能为空");
} }
} }
if(bizType=="esp.companyreg_cloud"){//云上公司注册 if (bizType == "esp.companyreg_cloud") {//云上公司注册
if(!solution.park){ if (!solution.park) {
return system.getResultFail(-113,"注册园区不能为空"); return system.getResultFail(-113, "注册园区不能为空");
} }
if(!solution.registerType){ if (!solution.registerType) {
return system.getResultFail(-114,"注册类型不能为空"); return system.getResultFail(-114, "注册类型不能为空");
} }
if(!solution.productType){ if (!solution.productType) {
return system.getResultFail(-115,"产品类型不能为空"); return system.getResultFail(-115, "产品类型不能为空");
} }
} }
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;
ab["status"] = "dqr"; ab["status"] = "dqr";
ab.solutionContent["notes"]=""; ab.solutionContent["notes"] = "";
ab.solutionContent["totalSum"]=""; ab.solutionContent["totalSum"] = "";
ab.solutionContent = JSON.stringify(ab.solutionContent); ab.solutionContent = JSON.stringify(ab.solutionContent);
var self = this; var self = this;
return await this.db.transaction(async function (t) { return await this.db.transaction(async function (t) {
ab["needNo"] = needinfo.needNo; ab["needNo"] = needinfo.needNo;
var od = await self.dao.create(ab,t); var od = await self.dao.create(ab, t);
if(od && od.id){ if (od && od.id) {
var pushflag = 0;//推送标志 值为1推送小记 var pushflag = 0;//推送标志 值为1推送小记
var needObj={ var needObj = {
id:needinfo.id id: needinfo.id
}; };
if(!needinfo.followManUserId){ if (!needinfo.followManUserId) {
needObj={ needObj = {
id:needinfo.id, id: needinfo.id,
followManUserId: user.id,//跟进人id followManUserId: user.id,//跟进人id
followManName: user.channel_username,//跟进人姓名 followManName: user.channel_username,//跟进人姓名
followManMobile: user.mobile,//跟进人手机号(合伙人) followManMobile: user.mobile,//跟进人手机号(合伙人)
followManOnlyCode: user.channel_userid followManOnlyCode: user.channel_userid
}; };
} }
if(!needinfo.followContent){ if (!needinfo.followContent) {
var followContent = { var followContent = {
followDate:new Date(), followDate: new Date(),
content:"提交到方案" content: "提交到方案"
}; };
followContent = JSON.stringify(followContent); followContent = JSON.stringify(followContent);
needObj["followContent"] = followContent; needObj["followContent"] = followContent;
pushflag = 1; pushflag = 1;
} }
await self.needinfoDao.update(needObj,t); await self.needinfoDao.update(needObj, t);
needinfo = await self.needinfoDao.model.findOne({ needinfo = await self.needinfoDao.model.findOne({
where:{id:needinfo.id},raw:true where: { id: needinfo.id }, raw: true
}); });
needinfo["pushflag"]=pushflag; needinfo["pushflag"] = pushflag;
return system.getResultSuccess({needinfo:needinfo,needsolution:od}); return system.getResultSuccess({ needinfo: needinfo, needsolution: od });
}else{ } else {
return system.getResultFail(-202, "提交方案失败"); return system.getResultFail(-202, "提交方案失败");
} }
}) })
} }
//接收方案编号(方案推送至阿里后,接收保存方案信息) //接收方案编号(方案推送至阿里后,接收保存方案信息)
async receiveProgrammeNo(pobj){ async receiveProgrammeNo(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if(!ab.solutionBizId){ if (!ab.solutionBizId) {
return system.getResultFail(-101,"渠道方案业务编号不能为空"); return system.getResultFail(-101, "渠道方案业务编号不能为空");
} }
if(!ab.solutionNo){ if (!ab.solutionNo) {
return system.getResultFail(-102,"方案业务编号不能为空"); return system.getResultFail(-102, "方案业务编号不能为空");
} }
var ns = await this.dao.model.findOne({ var ns = await this.dao.model.findOne({
where:{solutionNo:ab.solutionNo},raw:true where: { solutionNo: ab.solutionNo }, raw: true
}); });
if(!ns || !ns.id){ if (!ns || !ns.id) {
return system.getResultFail(-103,"未知方案"); return system.getResultFail(-103, "未知方案");
} }
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ns.needNo},raw:true where: { needNo: ns.needNo }, raw: true
}); });
if(!needinfo){ if (!needinfo) {
return system.getResultFail(-104,"未知方案需求"); return system.getResultFail(-104, "未知方案需求");
} }
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 + ",不能执行此操作");
} }
await this.dao.model.update({channelSolutionNo:ab.solutionBizId}, { where: { id: ns.id }});//修改方案信息 await this.dao.model.update({ channelSolutionNo: ab.solutionBizId }, { where: { id: ns.id } });//修改方案信息
return system.getResultSuccess(); return system.getResultSuccess();
} }
//根据需求查看方案列表 //根据需求查看方案列表
async getProgrammeInfoByNeedNo(pobj){ async getProgrammeInfoByNeedNo(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
if(!user || !user.id){ if (!user || !user.id) {
return system.getResultFail(-100,"未知用户"); return system.getResultFail(-100, "未知用户");
} }
ab["createUserId"]=user.id; ab["createUserId"] = user.id;
// followManMobile: DataTypes.STRING,//跟进人手机号(合伙人) // followManMobile: DataTypes.STRING,//跟进人手机号(合伙人)
// followManOnlyCode: DataTypes.STRING(50),//跟进者唯一码 // followManOnlyCode: DataTypes.STRING(50),//跟进者唯一码
if(!ab.needNo){ if (!ab.needNo) {
return system.getResultFail(-101,"需求号不能为空"); return system.getResultFail(-101, "需求号不能为空");
} }
// if(!ab.followManMobile){ // if(!ab.followManMobile){
// return system.getResultFail(-102,"跟进人手机号不能为空"); // return system.getResultFail(-102,"跟进人手机号不能为空");
...@@ -192,23 +192,23 @@ class NeedsolutionService extends ServiceBase { ...@@ -192,23 +192,23 @@ class NeedsolutionService extends ServiceBase {
// } // }
//获取需求信息 //获取需求信息
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ab.needNo},raw:true where: { needNo: ab.needNo }, raw: true
}); });
if(!needinfo || !needinfo.id){ if (!needinfo || !needinfo.id) {
return system.getResultFail(-102,"未知需求信息"); return system.getResultFail(-102, "未知需求信息");
} }
var ns = await this.dao.model.findAll({ var ns = await this.dao.model.findAll({
where:{needNo:needinfo.needNo,createUserId:user.id},raw:true, where: { needNo: needinfo.needNo, createUserId: user.id }, raw: true,
attributes:["needNo","solutionNo","channelSolutionNo","orderNo","solutionContent","status","statusName"] attributes: ["needNo", "solutionNo", "channelSolutionNo", "orderNo", "solutionContent", "status", "statusName"]
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//获取方案列表(获取用户所有方案) //获取方案列表(获取用户所有方案)
async getProgrammeListByUser(pobj){ async getProgrammeListByUser(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
if(!user || !user.id){ if (!user || !user.id) {
return system.getResultFail(-100,"未知用户"); return system.getResultFail(-100, "未知用户");
} }
var pageSize = Number(ab.pageSize || 20); var pageSize = Number(ab.pageSize || 20);
if (pageSize > 500) { if (pageSize > 500) {
...@@ -220,11 +220,11 @@ class NeedsolutionService extends ServiceBase { ...@@ -220,11 +220,11 @@ class NeedsolutionService extends ServiceBase {
//select * from log where data->'$.id' = 142; //select * from log where data->'$.id' = 142;
var sql = "select id,needNo,channelNeedNo,solutionNo,channelSolutionNo,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){ 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) {//方案号
...@@ -242,47 +242,47 @@ class NeedsolutionService extends ServiceBase { ...@@ -242,47 +242,47 @@ class NeedsolutionService extends ServiceBase {
sqlCount += " and status = :status"; sqlCount += " and status = :status";
paramWhere.status = ab.status; paramWhere.status = ab.status;
} }
if(bizType=="esp.companyreg"){//普通公司注册 if (bizType == "esp.companyreg") {//普通公司注册
if (ab.companyName) {//企业名称 if (ab.companyName) {//企业名称
sql = sql+" and solutionContent->'$.solution.companyName' = :companyName"; sql = sql + " and solutionContent->'$.solution.companyName' = :companyName";
sqlCount = sqlCount+" and solutionContent->'$.solution.companyName' = :companyName"; sqlCount = sqlCount + " and solutionContent->'$.solution.companyName' = :companyName";
paramWhere.companyName = ab.companyName; paramWhere.companyName = ab.companyName;
}// }//
if (ab.orgType) {//组织类型 if (ab.orgType) {//组织类型
sql = sql+" and solutionContent->'$.solution.orgType' = :orgType"; sql = sql + " and solutionContent->'$.solution.orgType' = :orgType";
sqlCount = sqlCount+" and solutionContent->'$.solution.orgType' = :orgType"; sqlCount = sqlCount + " and solutionContent->'$.solution.orgType' = :orgType";
paramWhere.orgType = ab.orgType; paramWhere.orgType = ab.orgType;
} }
if (ab.companyType) {//公司性质 if (ab.companyType) {//公司性质
sql = sql+" and solutionContent->'$.solution.companyType' = :companyType"; sql = sql + " and solutionContent->'$.solution.companyType' = :companyType";
sqlCount = sqlCount+" and solutionContent->'$.solution.companyType' = :companyType"; sqlCount = sqlCount + " and solutionContent->'$.solution.companyType' = :companyType";
paramWhere.companyType = ab.companyType; paramWhere.companyType = ab.companyType;
} }
if (ab.city) {//城市 if (ab.city) {//城市
sql = sql+" and solutionContent->'$.solution.city' = :city"; sql = sql + " and solutionContent->'$.solution.city' = :city";
sqlCount = sqlCount+" and solutionContent->'$.solution.city' = :city"; sqlCount = sqlCount + " and solutionContent->'$.solution.city' = :city";
paramWhere.city = ab.city; paramWhere.city = ab.city;
} }
if (ab.area) {//区域 if (ab.area) {//区域
sql = sql+" and solutionContent->'$.solution.area' = :area"; sql = sql + " and solutionContent->'$.solution.area' = :area";
sqlCount = sqlCount+" and solutionContent->'$.solution.area' = :area"; sqlCount = sqlCount + " and solutionContent->'$.solution.area' = :area";
paramWhere.area = ab.area; paramWhere.area = ab.area;
} }
if (ab.companyCategory) {//纳税人类型 if (ab.companyCategory) {//纳税人类型
sql = sql+" and solutionContent->'$.solution.companyCategory' = :companyCategory"; sql = sql + " and solutionContent->'$.solution.companyCategory' = :companyCategory";
sqlCount = sqlCount+" and solutionContent->'$.solution.companyCategory' = :companyCategory"; sqlCount = sqlCount + " and solutionContent->'$.solution.companyCategory' = :companyCategory";
paramWhere.companyCategory = ab.companyCategory; paramWhere.companyCategory = ab.companyCategory;
} }
} }
if(bizType=="esp.companyreg_cloud"){//云上公司注册 if (bizType == "esp.companyreg_cloud") {//云上公司注册
if (ab.park) {//注册园区 if (ab.park) {//注册园区
sql = sql+" and solutionContent->'$.solution.park' = :park"; sql = sql + " and solutionContent->'$.solution.park' = :park";
sqlCount = sqlCount+" and solutionContent->'$.solution.park' = :park"; sqlCount = sqlCount + " and solutionContent->'$.solution.park' = :park";
paramWhere.park = ab.park; paramWhere.park = ab.park;
} }
if (ab.productType) {//产品类型 if (ab.productType) {//产品类型
sql = sql+" and solutionContent->'$.solution.productType' = :productType"; sql = sql + " and solutionContent->'$.solution.productType' = :productType";
sqlCount = sqlCount+" and solutionContent->'$.solution.productType' = :productType"; sqlCount = sqlCount + " and solutionContent->'$.solution.productType' = :productType";
paramWhere.productType = ab.productType; paramWhere.productType = ab.productType;
} }
} }
...@@ -299,255 +299,255 @@ class NeedsolutionService extends ServiceBase { ...@@ -299,255 +299,255 @@ class NeedsolutionService extends ServiceBase {
} }
//接收方案反馈信息(即方案作废) //接收方案反馈信息(即方案作废)
async receiveFeedback(pobj){ async receiveFeedback(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if(!ab.solutionBizId){ if (!ab.solutionBizId) {
return system.getResultFail(-101,"方案业务编号不能为空"); return system.getResultFail(-101, "方案业务编号不能为空");
} }
if(!ab.operateType){ if (!ab.operateType) {
return system.getResultFail(-102,"操作类型不能为空"); return system.getResultFail(-102, "操作类型不能为空");
} }
var ns = await this.dao.model.findOne({ var ns = await this.dao.model.findOne({
where:{channelSolutionNo:ab.solutionBizId},raw:true where: { channelSolutionNo: ab.solutionBizId }, raw: true
}); });
if(!ns || !ns.id){ if (!ns || !ns.id) {
return system.getResultFail(-103,"未知方案"); return system.getResultFail(-103, "未知方案");
} }
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ns.needNo},raw:true where: { needNo: ns.needNo }, raw: true
}); });
if(!needinfo){ if (!needinfo) {
return system.getResultFail(-104,"未知方案需求"); return system.getResultFail(-104, "未知方案需求");
} }
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 + ",不能执行此操作");
} }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
var status = ""; var status = "";
if(ab.operateType=="INVALID"){// INVALID:作废 if (ab.operateType == "INVALID") {// INVALID:作废
status="yzf"; status = "yzf";
}else if(ab.operateType=="REFUND"){// REFUND:退款 } else if (ab.operateType == "REFUND") {// REFUND:退款
status="yzf"; status = "yzf";
}else if(ab.operateType=="PAID"){// PAID:支付 } else if (ab.operateType == "PAID") {// PAID:支付
status="ywc"; status = "ywc";
}else{ } else {
return system.getResultFail(-104,"操作类型有误"); return system.getResultFail(-104, "操作类型有误");
} }
// var solution_status={"dqr":"待确认","ywc":"已完成","yzf":"已作废"}; // var solution_status={"dqr":"待确认","ywc":"已完成","yzf":"已作废"};
// solutionContent["deliveryStatus"] = status; // solutionContent["deliveryStatus"] = status;
// solutionContent["deliveryStatusName"] = solution_status[status]; // solutionContent["deliveryStatusName"] = solution_status[status];
// solutionContent["updated"] = new Date(); // solutionContent["updated"] = new Date();
if(ab.note){ if (ab.note) {
solutionContent["notes"] = ab.note; solutionContent["notes"] = ab.note;
} }
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
var reqObj={ var reqObj = {
status:status,solutionContent:solutionContent status: status, solutionContent: solutionContent
}; };
await this.dao.model.update(reqObj, { where: { id: ns.id }});//修改方案信息 await this.dao.model.update(reqObj, { where: { id: ns.id } });//修改方案信息
return system.getResultSuccess(); return system.getResultSuccess();
} }
//服务商方案作废 //服务商方案作废
async abolishProgramme(pobj){ async abolishProgramme(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
if(!user || !user.id){ if (!user || !user.id) {
return system.getResultFail(-100,"未知用户"); return system.getResultFail(-100, "未知用户");
} }
if(!ab.solutionNo){ if (!ab.solutionNo) {
return system.getResultFail(-101,"方案号不能为空"); return system.getResultFail(-101, "方案号不能为空");
} }
//获取方案信息 //获取方案信息
var ns = await this.dao.model.findOne({ 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.id){ if (!ns || !ns.id) {
return system.getResultFail(-102,"未知方案"); return system.getResultFail(-102, "未知方案");
} }
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ns.needNo},raw:true where: { needNo: ns.needNo }, raw: true
}); });
if(!needinfo){ if (!needinfo) {
return system.getResultFail(-104,"未知方案需求"); return system.getResultFail(-104, "未知方案需求");
} }
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") {
return system.getResultFail(-103,"方案状态错误,只能废弃待确认方案"); return system.getResultFail(-103, "方案状态错误,只能废弃待确认方案");
} }
await this.dao.update({id:ns.id,status:"yzf"});//方案废弃 await this.dao.update({ id: ns.id, status: "yzf" });//方案废弃
//获取方案信息 //获取方案信息
ns = await this.dao.model.findOne({ ns = await this.dao.model.findOne({
where:{solutionNo:ab.solutionNo,createUserId:user.id},raw:true where: { solutionNo: ab.solutionNo, createUserId: user.id }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//根据需求关闭方案(关闭需求后调用) //根据需求关闭方案(关闭需求后调用)
async abolishProgrammeByNeed(pobj){ async abolishProgrammeByNeed(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var app = pobj.appInfo; var app = pobj.appInfo;
if(!app || !app.uapp_id){ if (!app || !app.uapp_id) {
return system.getResultFail(-100,"未知渠道"); return system.getResultFail(-100, "未知渠道");
} }
if(!ab.intentionBizId){ if (!ab.intentionBizId) {
return system.getResultFail(-101,"需求编号不能为空"); return system.getResultFail(-101, "需求编号不能为空");
} }
//获取需求信息 //获取需求信息
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{channelNeedNo:ab.intentionBizId},raw:true where: { channelNeedNo: ab.intentionBizId }, raw: true
}); });
if(!needinfo || !needinfo.id){ if (!needinfo || !needinfo.id) {
return system.getResultFail(-201,"未知需求信息"); return system.getResultFail(-201, "未知需求信息");
} }
if(needinfo.status=="ycd" || needinfo.status=="ygb"){ if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-202,"该方案需求状态为"+needinfo.statusName+",不能执行此操作"); return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
//获取方案信息 //获取方案信息
var ns = await this.dao.model.findAll({ var ns = await this.dao.model.findAll({
where:{needNo:needinfo.needNo},raw:true where: { needNo: needinfo.needNo }, raw: true
}); });
for(var i=0;i<ns.length;i++){ for (var i = 0; i < ns.length; i++) {
var fa = ns[i]; var fa = ns[i];
if(fa.status=="ywc"){ if (fa.status == "ywc") {
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" }, { where: { needNo: needinfo.needNo } });//方案废弃
return system.getResultSuccess(); return system.getResultSuccess();
} }
//立即支付下单保存方案 //立即支付下单保存方案
async createSolutionByOrder(pobj){ async createSolutionByOrder(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var app = pobj.appInfo; var app = pobj.appInfo;
if(!app || !app.uapp_id){ if (!app || !app.uapp_id) {
return system.getResultFail(-100,"未知渠道"); return system.getResultFail(-100, "未知渠道");
} }
var solution = ""; var solution = "";
var bizType = "esp.companyreg"; var bizType = "esp.companyreg";
if(ab.companyName){ if (ab.companyName) {
solution = { solution = {
"companyName":ab.companyName, "companyName": ab.companyName,
"area":ab.area, "area": ab.area,
"city": ab.city, "city": ab.city,
"companyCategory": ab.companyCategory, "companyCategory": ab.companyCategory,
"companyType": ab.companyType, "companyType": ab.companyType,
"orgType" :ab.orgType, "orgType": ab.orgType,
"industryType": ab.industryType, "industryType": ab.industryType,
"scope": ab.scope, "scope": ab.scope,
"remark":ab.remark "remark": ab.remark
}; };
}else if(ab.park){ } else if (ab.park) {
solution = { solution = {
"park":ab.park, "park": ab.park,
"productType":ab.productType, "productType": ab.productType,
"remark":ab.remark "remark": ab.remark
}; };
bizType = "esp.companyreg_cloud"; bizType = "esp.companyreg_cloud";
} }
var solutionContent = { var solutionContent = {
"bizType":bizType, "bizType": bizType,
"solution":solution "solution": solution
}; };
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
// ab["channelNeedNo"] = needinfo.channelNeedNo; // ab["channelNeedNo"] = needinfo.channelNeedNo;
// ab["solutionNo"] = solutionNo; // ab["solutionNo"] = solutionNo;
var solutionNo = await this.getBusUid("ns"); var solutionNo = await this.getBusUid("ns");
var reqObj = { var reqObj = {
solutionContent:solutionContent,solutionNo:solutionNo,status:"ywc",orderNo:ab.orderNo solutionContent: solutionContent, solutionNo: solutionNo, status: "ywc", orderNo: ab.orderNo
}; };
var ns = await this.dao.create(reqObj); var ns = await this.dao.create(reqObj);
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//接收方案状态及支付信息 //接收方案状态及支付信息
async receiveSolutionPayInfo(pobj){ async receiveSolutionPayInfo(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var app = pobj.appInfo; var app = pobj.appInfo;
if(!app || !app.uapp_id){ if (!app || !app.uapp_id) {
return system.getResultFail(-100,"未知渠道"); return system.getResultFail(-100, "未知渠道");
} }
if(!ab.channelSolutionNo){ if (!ab.channelSolutionNo) {
return system.getResultFail(-101,"渠道方案编号不能为空"); return system.getResultFail(-101, "渠道方案编号不能为空");
} }
// if(!ab.status){ // if(!ab.status){
// return system.getResultFail(-102,"状态不能为空"); // return system.getResultFail(-102,"状态不能为空");
// } // }
var needsolutioninfo = await this.dao.model.findOne({ var needsolutioninfo = await this.dao.model.findOne({
where:{channelSolutionNo: ab.channelSolutionNo},raw:true where: { channelSolutionNo: ab.channelSolutionNo }, raw: true
}); });
if(!needsolutioninfo || !needsolutioninfo.id){ if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400,"未知方案"); return system.getResultFail(-400, "未知方案");
} }
var solutionContent = needsolutioninfo.solutionContent; var solutionContent = needsolutioninfo.solutionContent;
if(ab.orderPrice){ if (ab.orderPrice) {
// solutionContent = JSON.parse(solutionContent); // solutionContent = JSON.parse(solutionContent);
solutionContent["totalSum"] = ab.orderPrice; solutionContent["totalSum"] = Number(ab.orderPrice || "0");
needsolutioninfo.solutionContent = JSON.stringify(solutionContent); needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
} }
if(ab.status){ if (ab.status) {
needsolutioninfo.status = "ywc"; needsolutioninfo.status = "ywc";
} }
if(ab.orderNo){ if (ab.orderNo) {
needsolutioninfo.orderNo = ab.orderNo; needsolutioninfo.orderNo = ab.orderNo;
} }
await this.dao.update(needsolutioninfo); await this.dao.update(needsolutioninfo);
var ns = await this.dao.model.findOne({ var ns = await this.dao.model.findOne({
where:{channelSolutionNo: ab.channelSolutionNo},raw:true where: { channelSolutionNo: ab.channelSolutionNo }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//修改退款方案状态 //修改退款方案状态
async updateStausByRefundOrder(pobj){ async updateStausByRefundOrder(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var app = pobj.appInfo; var app = pobj.appInfo;
if(!ab.orderNo){ if (!ab.orderNo) {
return system.getResultFail(-101,"订单号不能为空"); return system.getResultFail(-101, "订单号不能为空");
} }
var orderns = await this.orderinfoDao.model.findOne({ var orderns = await this.orderinfoDao.model.findOne({
where:{channelOrderNo:ab.orderNo},raw:true where: { channelOrderNo: ab.orderNo }, raw: true
}); });
if(!orderns){ if (!orderns) {
return system.getResultFail(-102,"订单不存在"); return system.getResultFail(-102, "订单不存在");
} }
var ns = await this.dao.model.findOne({ var ns = await this.dao.model.findOne({
where:{orderNo:orderns.orderNo},raw:true where: { orderNo: orderns.orderNo }, raw: true
}); });
if(!ns || !ns.id){ if (!ns || !ns.id) {
return system.getResultFail(-103,"未知方案"); return system.getResultFail(-103, "未知方案");
} }
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ns.needNo},raw:true where: { needNo: ns.needNo }, raw: true
}); });
if(!needinfo){ if (!needinfo) {
return system.getResultFail(-104,"未知方案需求"); return system.getResultFail(-104, "未知方案需求");
} }
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 + ",不能执行此操作");
} }
var status = "yzf"; var status = "yzf";
var reqObj={ var reqObj = {
status:status,id:ns.id status: status, id: ns.id
}; };
await this.dao.model.update(reqObj, { where: { id: ns.id }});//修改方案信息 await this.dao.model.update(reqObj, { where: { id: ns.id } });//修改方案信息
return system.getResultSuccess(); return system.getResultSuccess();
} }
//---------------------公司注册-end----------------------------------------------------------------- //---------------------公司注册-end-----------------------------------------------------------------
//---------------------icp注册-start----------------------------------------------------------------- //---------------------icp注册-start-----------------------------------------------------------------
//根据需求查看方案列表 //根据需求查看方案列表
async getProgrammeInfoByChannelNeedNo(pobj){ async getProgrammeInfoByChannelNeedNo(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
if(!user || !user.id){ if (!user || !user.id) {
return system.getResultFail(-100,"未知用户"); return system.getResultFail(-100, "未知用户");
} }
ab["createUserId"]=user.id; ab["createUserId"] = user.id;
// followManMobile: DataTypes.STRING,//跟进人手机号(合伙人) // followManMobile: DataTypes.STRING,//跟进人手机号(合伙人)
// followManOnlyCode: DataTypes.STRING(50),//跟进者唯一码 // followManOnlyCode: DataTypes.STRING(50),//跟进者唯一码
if(!ab.needNo){ if (!ab.needNo) {
return system.getResultFail(-101,"需求号不能为空"); return system.getResultFail(-101, "需求号不能为空");
} }
// if(!ab.followManMobile){ // if(!ab.followManMobile){
// return system.getResultFail(-102,"跟进人手机号不能为空"); // return system.getResultFail(-102,"跟进人手机号不能为空");
...@@ -557,92 +557,92 @@ class NeedsolutionService extends ServiceBase { ...@@ -557,92 +557,92 @@ class NeedsolutionService extends ServiceBase {
// } // }
//获取需求信息 //获取需求信息
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{channelNeedNo:ab.needNo},raw:true where: { channelNeedNo: ab.needNo }, raw: true
}); });
if(!needinfo || !needinfo.id){ if (!needinfo || !needinfo.id) {
return system.getResultFail(-102,"未知需求信息"); return system.getResultFail(-102, "未知需求信息");
} }
var ns = await this.dao.model.findAll({ var ns = await this.dao.model.findAll({
where:{needNo:needinfo.needNo,createUserId:user.id},raw:true, where: { needNo: needinfo.needNo, createUserId: user.id }, raw: true,
attributes:["needNo","solutionNo","channelSolutionNo","orderNo","solutionContent","status","statusName"] attributes: ["needNo", "solutionNo", "channelSolutionNo", "orderNo", "solutionContent", "status", "statusName"]
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//提交方案 //提交方案
async submitIcpProgramme(pobj){ async submitIcpProgramme(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
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.needNo){ if (!ab.needNo) {
return system.getResultFail(-101,"渠道需求号不能为空"); return system.getResultFail(-101, "渠道需求号不能为空");
} }
if(!ab.solutionContent){ if (!ab.solutionContent) {
return system.getResultFail(-102,"方案信息有误"); return system.getResultFail(-102, "方案信息有误");
} }
//获取需求信息 //获取需求信息
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{channelNeedNo:ab.needNo},raw:true where: { channelNeedNo: ab.needNo }, raw: true
}); });
if(!needinfo || !needinfo.id){ if (!needinfo || !needinfo.id) {
return system.getResultFail(-201,"未知需求信息"); return system.getResultFail(-201, "未知需求信息");
} }
if(needinfo.status=="ycd" || needinfo.status=="ygb"){ if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-202,"该方案需求状态为"+needinfo.statusName+",不能创建方案"); return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能创建方案");
} }
var bizType = ab.solutionContent.bizType;//icp业务类型 var bizType = ab.solutionContent.bizType;//icp业务类型
if(!bizType || !needinfo.typeCode || bizType!=needinfo.typeCode){ if (!bizType || !needinfo.typeCode || bizType != needinfo.typeCode) {
return system.getResultFail(-205,"方案类型错误"); return system.getResultFail(-205, "方案类型错误");
} }
if(!needinfo.channelTypeCode){ if (!needinfo.channelTypeCode) {
return system.getResultFail(-206,"渠道方案类型错误"); return system.getResultFail(-206, "渠道方案类型错误");
} }
ab.solutionContent.typeCode=needinfo.typeCode; ab.solutionContent.typeCode = needinfo.typeCode;
ab.solutionContent.typeName=needinfo.typeName; ab.solutionContent.typeName = needinfo.typeName;
var ns = await this.dao.model.findAll({ var ns = await this.dao.model.findAll({
where:{channelNeedNo:ab.needNo},raw:true where: { channelNeedNo: ab.needNo }, raw: true
}); });
for(var i=0;i<ns.length;i++){ for (var i = 0; i < ns.length; i++) {
var fa = ns[i]; var fa = ns[i];
if(fa.status!="yzf"){ if (fa.status != "yzf") {
return system.getResultFail(-207,"需求方案已存在,不能重复提交"); return system.getResultFail(-207, "需求方案已存在,不能重复提交");
} }
} }
// ab.solutionContent.bizType=needinfo.channelTypeCode; // ab.solutionContent.bizType=needinfo.channelTypeCode;
// bizType =needinfo.channelTypeCode; // bizType =needinfo.channelTypeCode;
if(!ab.solutionContent.solution){ if (!ab.solutionContent.solution) {
return system.getResultFail(-104,"业务方案信息不能为空"); 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, "方案交付信息有误");
} }
if(needinfo.channelTypeCode=="7"){//edi if (needinfo.channelTypeCode == "7") {//edi
ab.solutionContent.solution.IcpType=2; ab.solutionContent.solution.IcpType = 2;
} }
if(needinfo.channelTypeCode=="5"){//icp if (needinfo.channelTypeCode == "5") {//icp
ab.solutionContent.solution.IcpType=1; ab.solutionContent.solution.IcpType = 1;
} }
ab.solutionContent.applicationStatusList = [{ ab.solutionContent.applicationStatusList = [{
"OfficialFileURL":"", "OfficialFileURL": "",
"ApplicationStatus":"submitIcpProgramme", "ApplicationStatus": "submitIcpProgramme",
"ApplicationStatusName":"提交方案", "ApplicationStatusName": "提交方案",
"created_at":new Date() "created_at": new Date()
}]; }];
if(!solution.CompanyName){ if (!solution.CompanyName) {
return system.getResultFail(-105,"公司名不能为空"); return system.getResultFail(-105, "公司名不能为空");
} }
if(!solution.CompanyAddress){ if (!solution.CompanyAddress) {
return system.getResultFail(-106,"公司地址不能为空"); return system.getResultFail(-106, "公司地址不能为空");
} }
if(!solution.Area){ if (!solution.Area) {
return system.getResultFail(-107,"区域不能为空"); return system.getResultFail(-107, "区域不能为空");
} }
var solutionFlowList = ab.solutionContent.solutionFlowList || []; var solutionFlowList = ab.solutionContent.solutionFlowList || [];
solutionFlowList.push({ 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.status = "SOLUTION_SUBMIT";
ab.solutionContent.statusName = this.icpSolutionStatusReference.SOLUTION_SUBMIT; ab.solutionContent.statusName = this.icpSolutionStatusReference.SOLUTION_SUBMIT;
...@@ -651,108 +651,108 @@ class NeedsolutionService extends ServiceBase { ...@@ -651,108 +651,108 @@ class NeedsolutionService extends ServiceBase {
var solutionNo = await this.getBusUid("ns"); var solutionNo = await this.getBusUid("ns");
ab["solutionNo"] = solutionNo; ab["solutionNo"] = solutionNo;
ab["status"] = "dqr"; ab["status"] = "dqr";
ab.solutionContent["notes"]=""; ab.solutionContent["notes"] = "";
ab.solutionContent["totalSum"]=""; ab.solutionContent["totalSum"] = "";
ab.solutionContent = JSON.stringify(ab.solutionContent); ab.solutionContent = JSON.stringify(ab.solutionContent);
var self = this; var self = this;
return await this.db.transaction(async function (t) { return await this.db.transaction(async function (t) {
ab["needNo"] = needinfo.needNo; ab["needNo"] = needinfo.needNo;
var od = await self.dao.create(ab,t); var od = await self.dao.create(ab, t);
if(od && od.id){ if (od && od.id) {
var pushflag = 0;//推送标志 值为1推送小记 var pushflag = 0;//推送标志 值为1推送小记
var needObj={ var needObj = {
id:needinfo.id id: needinfo.id
}; };
if(!needinfo.followManUserId){ if (!needinfo.followManUserId) {
needObj={ needObj = {
id:needinfo.id, id: needinfo.id,
followManUserId: user.id,//跟进人id followManUserId: user.id,//跟进人id
followManName: user.channel_username,//跟进人姓名 followManName: user.channel_username,//跟进人姓名
followManMobile: user.mobile,//跟进人手机号(合伙人) followManMobile: user.mobile,//跟进人手机号(合伙人)
followManOnlyCode: user.channel_userid followManOnlyCode: user.channel_userid
}; };
} }
if(!needinfo.followContent){ if (!needinfo.followContent) {
var followContent = { var followContent = {
followDate:new Date(), followDate: new Date(),
content:"icp提交到方案" content: "icp提交到方案"
}; };
followContent = JSON.stringify(followContent); followContent = JSON.stringify(followContent);
needObj["followContent"] = followContent; needObj["followContent"] = followContent;
pushflag = 1; pushflag = 1;
} }
await self.needinfoDao.update(needObj,t); await self.needinfoDao.update(needObj, t);
needinfo = await self.needinfoDao.model.findOne({ needinfo = await self.needinfoDao.model.findOne({
where:{id:needinfo.id},raw:true where: { id: needinfo.id }, raw: true
}); });
needinfo["pushflag"]=pushflag; needinfo["pushflag"] = pushflag;
return system.getResultSuccess({needinfo:needinfo,needsolution:od}); return system.getResultSuccess({ needinfo: needinfo, needsolution: od });
}else{ } else {
return system.getResultFail(-202, "提交方案失败"); return system.getResultFail(-202, "提交方案失败");
} }
}) })
} }
//修改icp方案-- 无效 //修改icp方案-- 无效
async updateIcpProgramme(pobj){ async updateIcpProgramme(pobj) {
} }
//提交icp材料信息 //提交icp材料信息
async submitIcpMaterial(pobj){ async submitIcpMaterial(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
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.material){ if (!ab.material) {
return system.getResultFail(-102,"材料信息有误"); return system.getResultFail(-102, "材料信息有误");
} }
//获取方案信息 //获取方案信息
var needsolutioninfo = await this.dao.model.findOne({ var needsolutioninfo = await this.dao.model.findOne({
where:{channelSolutionNo: ab.BizId},raw:true where: { channelSolutionNo: ab.BizId }, raw: true
}); });
if(!needsolutioninfo || !needsolutioninfo.id){ if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400,"未知方案"); return system.getResultFail(-400, "未知方案");
} }
if(!needsolutioninfo.needNo){ if (!needsolutioninfo.needNo) {
return system.getResultFail(-401,"方案需求信息有误"); return system.getResultFail(-401, "方案需求信息有误");
} }
var solutionContent = needsolutioninfo.solutionContent; var solutionContent = needsolutioninfo.solutionContent;
if(!solutionContent){ if (!solutionContent) {
return system.getResultFail(-402,"方案交付信息有误"); return system.getResultFail(-402, "方案交付信息有误");
} }
if(solutionContent.status!="USER_UPLOADED"){ if (solutionContent.status != "USER_UPLOADED") {
return system.getResultFail(-403,"用户未上传材料,不能执行此操作"); 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
}); });
if(!needinfo || !needinfo.id){ if (!needinfo || !needinfo.id) {
return system.getResultFail(-201,"未知需求信息"); return system.getResultFail(-201, "未知需求信息");
} }
if(needinfo.status=="ycd" || needinfo.status=="ygb"){ if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-202,"该方案需求状态为"+needinfo.statusName+",不能执行此操作"); return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
var material = ab.material; var material = ab.material;
if(!material.Domain){ if (!material.Domain) {
return system.getResultFail(-101,"备案域名不能为空"); return system.getResultFail(-101, "备案域名不能为空");
} }
if(!material.hasOwnProperty("IncludeForeignInvestment")){ if (!material.hasOwnProperty("IncludeForeignInvestment")) {
return system.getResultFail(-102,"包含外贸参数不能为空"); return system.getResultFail(-102, "包含外贸参数不能为空");
} }
if(!material.PartnerBusinessLicense){ if (!material.PartnerBusinessLicense) {
return system.getResultFail(-103,"营业执照不能为空"); return system.getResultFail(-103, "营业执照不能为空");
} }
if(!material.PartnerIdCardList || material.PartnerIdCardList.length<1){ if (!material.PartnerIdCardList || material.PartnerIdCardList.length < 1) {
return system.getResultFail(-105,"相关人员身份证不能为空"); return system.getResultFail(-105, "相关人员身份证不能为空");
} }
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,"合作方递交其他供预览文件不能为空");
...@@ -760,72 +760,72 @@ class NeedsolutionService extends ServiceBase { ...@@ -760,72 +760,72 @@ class NeedsolutionService extends ServiceBase {
solutionContent.material = ab.material; solutionContent.material = ab.material;
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({ 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.status = "MATERIAL_UNCONFIRM";
solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_UNCONFIRM; solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_UNCONFIRM;
needsolutioninfo.solutionContent = JSON.stringify(solutionContent); needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
var self = this; var self = this;
return await this.db.transaction(async function (t) { return await this.db.transaction(async function (t) {
await self.dao.update(needsolutioninfo,t); await self.dao.update(needsolutioninfo, t);
needsolutioninfo = await self.dao.model.findOne({ needsolutioninfo = await self.dao.model.findOne({
where:{channelSolutionNo: ab.BizId},raw:true where: { channelSolutionNo: ab.BizId }, raw: true
}); });
return system.getResultSuccess(needsolutioninfo); return system.getResultSuccess(needsolutioninfo);
}) })
} }
//服务商通知状态变更 //服务商通知状态变更
async acceptIcpPartnerNotification(pobj){ async acceptIcpPartnerNotification(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
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.ApplicationStatus){ if (!ab.ApplicationStatus) {
return system.getResultFail(-102,"通知状态不能为空"); return system.getResultFail(-102, "通知状态不能为空");
} }
//获取方案信息 //获取方案信息
var needsolutioninfo = await this.dao.model.findOne({ var needsolutioninfo = await this.dao.model.findOne({
where:{channelSolutionNo: ab.BizId},raw:true where: { channelSolutionNo: ab.BizId }, raw: true
}); });
if(!needsolutioninfo || !needsolutioninfo.id){ if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400,"未知方案"); return system.getResultFail(-400, "未知方案");
} }
if(!needsolutioninfo.needNo){ if (!needsolutioninfo.needNo) {
return system.getResultFail(-401,"方案需求信息有误"); return system.getResultFail(-401, "方案需求信息有误");
} }
var solutionContent = needsolutioninfo.solutionContent; var solutionContent = needsolutioninfo.solutionContent;
if(!solutionContent){ if (!solutionContent) {
return system.getResultFail(-402,"方案交付信息有误"); return system.getResultFail(-402, "方案交付信息有误");
} }
//获取需求信息 //获取需求信息
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
}); });
if(!needinfo || !needinfo.id){ if (!needinfo || !needinfo.id) {
return system.getResultFail(-201,"未知需求信息"); return system.getResultFail(-201, "未知需求信息");
} }
if(needinfo.status=="ycd" || needinfo.status=="ygb"){ if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-202,"该方案需求状态为"+needinfo.statusName+",不能执行此操作"); return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
var applicationStatusList = solutionContent.applicationStatusList || []; var applicationStatusList = solutionContent.applicationStatusList || [];
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
var statusObj={ var statusObj = {
"OfficialFileURL":ab.OfficialFileURL || "", "OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus":ab.ApplicationStatus, "ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName":ab.ApplicationStatus, "ApplicationStatusName": ab.ApplicationStatus,
"created_at":new Date() "created_at": new Date()
}; };
applicationStatusList.push(statusObj); applicationStatusList.push(statusObj);
solutionContent.applicationStatusList = applicationStatusList; solutionContent.applicationStatusList = applicationStatusList;
if(ab.ApplicationStatus==507){//完成账户注册 if (ab.ApplicationStatus == 507) {//完成账户注册
solutionFlowList.push({ solutionFlowList.push({
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.status = "ACCOUNT_REGISTERED";
solutionContent.statusName = this.icpSolutionStatusReference.ACCOUNT_REGISTERED; solutionContent.statusName = this.icpSolutionStatusReference.ACCOUNT_REGISTERED;
...@@ -836,154 +836,154 @@ class NeedsolutionService extends ServiceBase { ...@@ -836,154 +836,154 @@ class NeedsolutionService extends ServiceBase {
// ,CLOSE:"方案关闭" // ,CLOSE:"方案关闭"
// }; // };
} }
if(ab.ApplicationStatus==508){//"服务商完成提交资料到⼯信部 if (ab.ApplicationStatus == 508) {//"服务商完成提交资料到⼯信部
solutionFlowList.push({ solutionFlowList.push({
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.status = "MATERIAL_SUBMITTED";
solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_SUBMITTED; solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_SUBMITTED;
} }
if(ab.ApplicationStatus==509){//⼯商部已受理 if (ab.ApplicationStatus == 509) {//⼯商部已受理
solutionFlowList.push({ solutionFlowList.push({
status:"GXB_ACCEPT",statusName:this.icpSolutionStatusReference.GXB_ACCEPT,updated_at:new Date() status: "GXB_ACCEPT", statusName: this.icpSolutionStatusReference.GXB_ACCEPT, updated_at: new Date()
}); });
solutionContent.status = "GXB_ACCEPT"; solutionContent.status = "GXB_ACCEPT";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_ACCEPT; solutionContent.statusName = this.icpSolutionStatusReference.GXB_ACCEPT;
} }
if(ab.ApplicationStatus==510){//⼯商部不予受理 if (ab.ApplicationStatus == 510) {//⼯商部不予受理
solutionFlowList.push({ solutionFlowList.push({
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 = "yzf";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE; solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE;
} }
if(ab.ApplicationStatus==511){//⼯商部通过 if (ab.ApplicationStatus == 511) {//⼯商部通过
solutionFlowList.push({ solutionFlowList.push({
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"; needsolutioninfo.status = "ywc";
solutionContent.status = "GXB_SUCCESS"; solutionContent.status = "GXB_SUCCESS";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_SUCCESS; solutionContent.statusName = this.icpSolutionStatusReference.GXB_SUCCESS;
} }
if(ab.ApplicationStatus==512){//⼯信部未通过 if (ab.ApplicationStatus == 512) {//⼯信部未通过
solutionFlowList.push({ solutionFlowList.push({
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 = "yzf";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_FAIL; solutionContent.statusName = this.icpSolutionStatusReference.GXB_FAIL;
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
needsolutioninfo.solutionContent = JSON.stringify(solutionContent); needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
var self = this; var self = this;
return await this.db.transaction(async function (t) { return await this.db.transaction(async function (t) {
await self.dao.update(needsolutioninfo,t); await self.dao.update(needsolutioninfo, t);
needsolutioninfo = await self.dao.model.findOne({ needsolutioninfo = await self.dao.model.findOne({
where:{channelSolutionNo: ab.BizId},raw:true where: { channelSolutionNo: ab.BizId }, raw: true
}); });
statusObj["BizId"] = ab.BizId; statusObj["BizId"] = ab.BizId;
return system.getResultSuccess(statusObj); return system.getResultSuccess(statusObj);
}) })
} }
//服务商方案作废 -- abolishIcpProgramme //服务商方案作废 -- abolishIcpProgramme
async abolishIcpProgramme(pobj){ async abolishIcpProgramme(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
if(!user || !user.id){ if (!user || !user.id) {
return system.getResultFail(-100,"未知用户"); return system.getResultFail(-100, "未知用户");
} }
if(!ab.BizId){ if (!ab.BizId) {
return system.getResultFail(-101,"渠道方案号不能为空"); return system.getResultFail(-101, "渠道方案号不能为空");
} }
if(!ab.Note){ if (!ab.Note) {
return system.getResultFail(-106,"关闭理由不能为空"); return system.getResultFail(-106, "关闭理由不能为空");
} }
//获取方案信息 //获取方案信息
var ns = await this.dao.model.findOne({ var ns = await this.dao.model.findOne({
where:{channelSolutionNo: ab.BizId,createUserId:user.id},raw:true where: { channelSolutionNo: ab.BizId, createUserId: user.id }, raw: true
}); });
if(!ns || !ns.id){ if (!ns || !ns.id) {
return system.getResultFail(-102,"未知方案"); return system.getResultFail(-102, "未知方案");
} }
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ns.needNo},raw:true where: { needNo: ns.needNo }, raw: true
}); });
if(!needinfo){ if (!needinfo) {
return system.getResultFail(-104,"未知方案需求"); return system.getResultFail(-104, "未知方案需求");
} }
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") {
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 ){ if (!solutionContent.status || ["USER_UPLOADED", "MATERIAL_UNCONFIRM", "USER_CONFIRMED", "ACCOUNT_REGISTERED", "MATERIAL_SUBMITTED"].indexOf(solutionContent.status) < 0) {
return system.getResultFail(-108,"方案流程状态错误,不能执行此操作"); 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 });//方案废弃
//获取方案信息 //获取方案信息
ns = await this.dao.model.findOne({ ns = await this.dao.model.findOne({
where:{channelSolutionNo: ab.BizId,createUserId:user.id},raw:true where: { channelSolutionNo: ab.BizId, createUserId: user.id }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//确认方案 //确认方案
async confirmIcpIntention(pobj){ async confirmIcpIntention(pobj) {
return system.getResultFail(); return system.getResultFail();
} }
//接收渠道方案状态变更通知 //接收渠道方案状态变更通知
async receiveIcpStatusNotify(pobj){ async receiveIcpStatusNotify(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if(!ab.BizId){ if (!ab.BizId) {
return system.getResultFail(-101,"渠道方案号不能为空"); return system.getResultFail(-101, "渠道方案号不能为空");
} }
if(!ab.status){ if (!ab.status) {
return system.getResultFail(-102,"方案状态不能为空"); return system.getResultFail(-102, "方案状态不能为空");
} }
//获取方案信息 //获取方案信息
var ns = await this.dao.model.findOne({ var ns = await this.dao.model.findOne({
where:{channelSolutionNo: ab.BizId},raw:true where: { channelSolutionNo: ab.BizId }, raw: true
}); });
if(!ns || !ns.id){ if (!ns || !ns.id) {
return system.getResultFail(-102,"未知方案"); return system.getResultFail(-102, "未知方案");
} }
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ns.needNo},raw:true where: { needNo: ns.needNo }, raw: true
}); });
if(!needinfo){ if (!needinfo) {
return system.getResultFail(-104,"未知方案需求"); return system.getResultFail(-104, "未知方案需求");
} }
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" && ns.status!="yzf" ){ if (ns.status != "dqr" && ns.status != "yzf") {
return system.getResultFail(-103,"方案状态错误,不能作废已完成方案"); return system.getResultFail(-103, "方案状态错误,不能作废已完成方案");
} }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
//方案流程列表 //方案流程列表
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
if(ab.status=="2"){//⽤户已上传 if (ab.status == "2") {//⽤户已上传
solutionFlowList.push({ solutionFlowList.push({
status:"USER_UPLOADED",statusName:this.icpSolutionStatusReference.USER_UPLOADED,updated_at:new Date() status: "USER_UPLOADED", statusName: this.icpSolutionStatusReference.USER_UPLOADED, updated_at: new Date()
}); });
solutionContent.status = "USER_UPLOADED"; solutionContent.status = "USER_UPLOADED";
solutionContent.statusName = this.icpSolutionStatusReference.USER_UPLOADED; solutionContent.statusName = this.icpSolutionStatusReference.USER_UPLOADED;
} }
if(ab.status=="4"){//⽤户已确认 if (ab.status == "4") {//⽤户已确认
solutionFlowList.push({ solutionFlowList.push({
status:"USER_CONFIRMED",statusName:this.icpSolutionStatusReference.USER_CONFIRMED,updated_at:new Date() status: "USER_CONFIRMED", statusName: this.icpSolutionStatusReference.USER_CONFIRMED, updated_at: new Date()
}); });
solutionContent.status = "USER_CONFIRMED"; solutionContent.status = "USER_CONFIRMED";
solutionContent.statusName = this.icpSolutionStatusReference.USER_CONFIRMED; solutionContent.statusName = this.icpSolutionStatusReference.USER_CONFIRMED;
} }
if(ab.status=="11"){//⽅案已关闭 if (ab.status == "11") {//⽅案已关闭
solutionFlowList.push({ solutionFlowList.push({
status:"CLOSE",statusName:this.icpSolutionStatusReference.CLOSE,updated_at:new Date() status: "CLOSE", statusName: this.icpSolutionStatusReference.CLOSE, updated_at: new Date()
}); });
solutionContent.status = "CLOSE"; solutionContent.status = "CLOSE";
solutionContent.statusName = this.icpSolutionStatusReference.CLOSE; solutionContent.statusName = this.icpSolutionStatusReference.CLOSE;
...@@ -991,140 +991,140 @@ class NeedsolutionService extends ServiceBase { ...@@ -991,140 +991,140 @@ class NeedsolutionService extends ServiceBase {
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
var material = solutionContent.material || {}; var material = solutionContent.material || {};
if(ab.remark){ if (ab.remark) {
solutionContent.notes = ab.remark; solutionContent.notes = ab.remark;
} }
if(ab.newbusinessLicense){ if (ab.newbusinessLicense) {
material.PartnerBusinessLicense = ab.newbusinessLicense; material.PartnerBusinessLicense = ab.newbusinessLicense;
material.aliPartnerBusinessLicense = ab.businessLicense; material.aliPartnerBusinessLicense = ab.businessLicense;
} }
if(ab.newidCardUrlList && ab.newidCardUrlList.length>0){ if (ab.newidCardUrlList && ab.newidCardUrlList.length > 0) {
material.PartnerIdCardList = ab.newidCardUrlList; material.PartnerIdCardList = ab.newidCardUrlList;
material.aliPartnerIdCardList = ab.idCardUrlList; material.aliPartnerIdCardList = ab.idCardUrlList;
} }
if(ab.newuserPlan){ if (ab.newuserPlan) {
material.PartnerPlan = ab.newuserPlan; material.PartnerPlan = ab.newuserPlan;
material.aliPartnerPlan = ab.userPlan; material.aliPartnerPlan = ab.userPlan;
} }
if(ab.newuserForeig){ if (ab.newuserForeig) {
material.PartnerForeignInvestment = ab.newuserForeig; material.PartnerForeignInvestment = ab.newuserForeig;
material.aliPartnerForeignInvestment = ab.userForeig; material.aliPartnerForeignInvestment = ab.userForeig;
} }
if(ab.newuserLaw){ if (ab.newuserLaw) {
material.PartnerLaw = ab.newuserLaw; material.PartnerLaw = ab.newuserLaw;
material.aliPartnerLaw = ab.userLaw; material.aliPartnerLaw = ab.userLaw;
} }
if(ab.newuserOtherList && ab.newuserOtherList.length>0){ if (ab.newuserOtherList && ab.newuserOtherList.length > 0) {
material.PartnerSignAndStampOtherList = ab.newuserOtherList; material.PartnerSignAndStampOtherList = ab.newuserOtherList;
material.aliPartnerSignAndStampOtherList = ab.userOtherList; material.aliPartnerSignAndStampOtherList = ab.userOtherList;
} }
solutionContent.material = material; solutionContent.material = material;
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
var updateObj = { var updateObj = {
id:ns.id,solutionContent:solutionContent id: ns.id, solutionContent: solutionContent
}; };
if(ab.status == "11"){//⽅案已关闭 if (ab.status == "11") {//⽅案已关闭
updateObj["status"]="yzf"; updateObj["status"] = "yzf";
} }
// else if(ab.status == "2" || ab.status == "4"){ //2, "⽤户已上传" 4, "⽤户已确认" // else if(ab.status == "2" || ab.status == "4"){ //2, "⽤户已上传" 4, "⽤户已确认"
// updateObj["status"]="dqr"; // updateObj["status"]="dqr";
// } // }
await this.dao.update(updateObj);//方案状态修改 await this.dao.update(updateObj);//方案状态修改
ns = await this.dao.model.findOne({ ns = await this.dao.model.findOne({
where:{channelSolutionNo: ab.BizId},raw:true where: { channelSolutionNo: ab.BizId }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//接收icp用户方案反馈 //接收icp用户方案反馈
async receiveIcpFeedback(pobj){ async receiveIcpFeedback(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if(!ab.intentionBizId){ if (!ab.intentionBizId) {
return system.getResultFail(-101,"渠道需求编号错误"); return system.getResultFail(-101, "渠道需求编号错误");
} }
if(!ab.description){ if (!ab.description) {
return system.getResultFail(-102,"问题描述不能为空"); return system.getResultFail(-102, "问题描述不能为空");
} }
if(!ab.hasOwnProperty("intentionStatus")){ if (!ab.hasOwnProperty("intentionStatus")) {
return system.getResultFail(-103,"需求当前状态不能为空"); return system.getResultFail(-103, "需求当前状态不能为空");
} }
//获取需求信息 //获取需求信息
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{channelNeedNo: ab.intentionBizId},raw:true where: { channelNeedNo: ab.intentionBizId }, raw: true
}); });
if(!needinfo){ if (!needinfo) {
return system.getResultFail(-104,"未知方案需求"); return system.getResultFail(-104, "未知方案需求");
} }
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 + ",不能执行此操作");
} }
//获取方案信息 //获取方案信息
var ns = await this.dao.model.findOne({ var ns = await this.dao.model.findOne({
where:{channelNeedNo:ab.intentionBizId,status:"dqr"},raw:true where: { channelNeedNo: ab.intentionBizId, status: "dqr" }, raw: true
}); });
if(!ns){ if (!ns) {
return system.getResultFail(-106,"未知方案"); return system.getResultFail(-106, "未知方案");
} }
var intentionStatusList=["未知","⽅案待服务商确认","⽅案待⽤户确认","处理中","已完成","已关闭"]; var intentionStatusList = ["未知", "⽅案待服务商确认", "⽅案待⽤户确认", "处理中", "已完成", "已关闭"];
var updateObj={ var updateObj = {
id:ns.id id: ns.id
}; };
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
solutionContent.notes = ab.description; solutionContent.notes = ab.description;
solutionContent.needStatus = ab.intentionStatus; solutionContent.needStatus = ab.intentionStatus;
if(ab.intentionStatus==1 || ab.intentionStatus==2 || ab.intentionStatus==3){ if (ab.intentionStatus == 1 || ab.intentionStatus == 2 || ab.intentionStatus == 3) {
updateObj["status"]="dqr"; updateObj["status"] = "dqr";
}else if(ab.intentionStatus==4){ } else if (ab.intentionStatus == 4) {
updateObj["status"]="ywc"; updateObj["status"] = "ywc";
}else if(ab.intentionStatus==5){ } else if (ab.intentionStatus == 5) {
updateObj["status"]="yzf"; updateObj["status"] = "yzf";
}else{ } else {
return system.getResultFail(-107,"需求当前状态错误--"+ab.intentionStatus); return system.getResultFail(-107, "需求当前状态错误--" + ab.intentionStatus);
} }
solutionContent.needStatusName = intentionStatusList[ab.intentionStatus]; solutionContent.needStatusName = intentionStatusList[ab.intentionStatus];
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
updateObj["solutionContent"] =solutionContent; updateObj["solutionContent"] = solutionContent;
await this.dao.update(updateObj);//方案状态修改 await this.dao.update(updateObj);//方案状态修改
return system.getResultSuccess(); return system.getResultSuccess();
} }
//获取方案详情(内部调用) //获取方案详情(内部调用)
async getIcpProgrammeDetail(pobj){ async getIcpProgrammeDetail(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if(!ab.BizId){ if (!ab.BizId) {
return system.getResultFail(-101,"方案编号不能为空"); return system.getResultFail(-101, "方案编号不能为空");
} }
//获取方案信息 //获取方案信息
var ns = await this.dao.model.findAll({ var ns = await this.dao.model.findAll({
where:{channelSolutionNo:ab.BizId},raw:true where: { channelSolutionNo: ab.BizId }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//获取方案详情(前端调用) //获取方案详情(前端调用)
async getNeedSolutionDetailByUser(pobj){ async getNeedSolutionDetailByUser(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
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.solutionNo){ if (!ab.solutionNo) {
return system.getResultFail(-101,"方案编号不能为空"); return system.getResultFail(-101, "方案编号不能为空");
} }
//获取方案信息 //获取方案信息
var ns = await this.dao.model.findOne({ 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){ if (ns && ns.needNo) {
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ns.needNo},raw:true, where: { needNo: ns.needNo }, raw: true,
attributes:["publishName","publishMobile","channelUserId"] attributes: ["publishName", "publishMobile", "channelUserId"]
}); });
ns.needinfo = needinfo; ns.needinfo = needinfo;
} }
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
//---------------------icp注册-end----------------------------------------------------------------- //---------------------icp注册-end-----------------------------------------------------------------
} }
module.exports = NeedsolutionService; module.exports = NeedsolutionService;
// var task = new NeedsolutionService(); // var task = new NeedsolutionService();
......
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