Commit 07770a33 by linboxuan

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

parents 18646194 66665bd0
...@@ -1761,6 +1761,12 @@ class OrderInfoService extends ServiceBase { ...@@ -1761,6 +1761,12 @@ class OrderInfoService extends ServiceBase {
}//增加流程状态列表数据 }//增加流程状态列表数据
try { try {
//商标状态推送 360
if (orderItem.uapp_id == 50) {
actionBody.deliveryInfo = deliveryInfo;
this.push360Sve.pushTmStatus(actionBody);
this.push360Sve.sendMessage(actionBody)
}
await self.db.transaction(async function (t) { await self.db.transaction(async function (t) {
if (Object.keys(updateOrderFields).length > 0) { if (Object.keys(updateOrderFields).length > 0) {
self.updateByWhere(updateOrderFields, {where: {orderNo: actionBody.orderNo}}, t); self.updateByWhere(updateOrderFields, {where: {orderNo: actionBody.orderNo}}, t);
...@@ -1778,13 +1784,6 @@ class OrderInfoService extends ServiceBase { ...@@ -1778,13 +1784,6 @@ class OrderInfoService extends ServiceBase {
}//更新商标官文 }//更新商标官文
deliveryInfo.opNotes = actionBody.opNotes || ""; deliveryInfo.opNotes = actionBody.opNotes || "";
this.putOrderDelivery(deliveryInfo, actionBody.orderNo); this.putOrderDelivery(deliveryInfo, actionBody.orderNo);
//商标状态推送 360
if (orderItem.uapp_id == 50) {
actionBody.deliveryInfo = deliveryInfo;
this.push360Sve.pushTmStatus(actionBody);
this.push360Sve.sendMessage(actionBody)
}
} catch (error) { } catch (error) {
console.log("error------------------------", e.stack); console.log("error------------------------", e.stack);
} }
......
//工商注册 //工商注册
const system = require("../../../system"); const system = require("../../../system");
const moment = require('moment'); const moment = require('moment');
class RegCenterOrderService{ class RegCenterOrderService {
constructor() { constructor() {
this.needsolutionDao = system.getObject("db.dbneed.needsolutionDao"); this.needsolutionDao = system.getObject("db.dbneed.needsolutionDao");
this.needinfoDao = system.getObject("db.dbneed.needinfoDao"); this.needinfoDao = system.getObject("db.dbneed.needinfoDao");
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao"); this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
this.orderdeliveryDao = system.getObject("db.dbcorder.orderdeliveryDao"); this.orderdeliveryDao = system.getObject("db.dbcorder.orderdeliveryDao");
this.db = system.getObject("db.common.connection").getCon() this.db = system.getObject("db.common.connection").getCon()
//工商注册状态 //工商注册状态
this.regSolutionStatus = { this.regSolutionStatus = {
'RECEIVED': '已接单', 'RECEIVED': '已接单',
'COLLECTING': '材料收集环节', 'COLLECTING': '材料收集环节',
'AUDITING': '工商审核环节', 'AUDITING': '工商审核环节',
'ENGRAVING': '刻章环节', 'ENGRAVING': '刻章环节',
'SUCCESS': '已完成', 'SUCCESS': '已完成',
'PAID':'已支付', 'PAID': '已支付',
"CLOSE" : "已关闭", "CLOSE": "已关闭",
'ACTIVE': '服务中' 'ACTIVE': '服务中'
}; };
//工商注册状态 //工商注册状态
...@@ -30,14 +30,32 @@ class RegCenterOrderService{ ...@@ -30,14 +30,32 @@ class RegCenterOrderService{
'SUCCESS': 705, //已完成 'SUCCESS': 705, //已完成
'ACTIVE': 706 //服务中 'ACTIVE': 706 //服务中
} }
this.regDeliveryStatus = {
701: 'RECEIVED', //已接单
702: 'COLLECTING', //材料收集环节
703: 'AUDITING', //工商审核环节
704: 'ENGRAVING', //刻章环节
705: 'SUCCESS', //已完成
706: 'ACTIVE' //服务中
}
this.regDeliveryStatusName = {
701: '已接单',
702: '材料收集环节',
703: '工商审核环节',
704: '刻章环节',
705: '已完成',
706: '服务中'
}
} }
// 获取需求详情 // 获取需求详情
async selectNeedInfo(pobj){ async selectNeedInfo(pobj) {
pobj.actionType = "selectNeedInfo" pobj.actionType = "selectNeedInfo"
var needinfo = {} var needinfo = {}
if(pobj.actionBody.orderNo){ if (pobj.actionBody.orderNo) {
var orderinfo = await this.orderinfoDao.findOne({ channelOrderNo: pobj.actionBody.orderNo, deleted_at:null }); var orderinfo = await this.orderinfoDao.findOne({ channelOrderNo: pobj.actionBody.orderNo, deleted_at: null });
if (!orderinfo || !orderinfo.orderNo) { if (!orderinfo || !orderinfo.orderNo) {
return system.getResult(null, "订单数据为空,30210"); return system.getResult(null, "订单数据为空,30210");
} }
...@@ -53,12 +71,12 @@ class RegCenterOrderService{ ...@@ -53,12 +71,12 @@ class RegCenterOrderService{
needinfo['solutionContent'] = needsolution.solutionContent needinfo['solutionContent'] = needsolution.solutionContent
} }
} }
if(pobj.actionBody.channelNeedNo){ if (pobj.actionBody.channelNeedNo) {
needinfo = await this.needinfoDao.findOne({ channelNeedNo: pobj.actionBody.channelNeedNo }); needinfo = await this.needinfoDao.findOne({ channelNeedNo: pobj.actionBody.channelNeedNo });
if (!needinfo || !needinfo.channelNeedNo) { if (!needinfo || !needinfo.channelNeedNo) {
return system.getResult(null, "需求数据为空,30213"); return system.getResult(null, "需求数据为空,30213");
}
} }
}
return system.getResultSuccess(needinfo); return system.getResultSuccess(needinfo);
} }
...@@ -75,7 +93,7 @@ class RegCenterOrderService{ ...@@ -75,7 +93,7 @@ class RegCenterOrderService{
return system.getResultFail(-5003, "type不能为空"); return system.getResultFail(-5003, "type不能为空");
} }
var needInfo = await this.needinfoDao.findOne({ channelNeedNo: actionBody.intentionBizId }); var needInfo = await this.needinfoDao.findOne({ channelNeedNo: actionBody.intentionBizId });
console.log('needInfo---',needInfo) console.log('needInfo---', needInfo)
if (needInfo) { if (needInfo) {
return system.getResultSuccess(needInfo); return system.getResultSuccess(needInfo);
} }
...@@ -108,21 +126,21 @@ class RegCenterOrderService{ ...@@ -108,21 +126,21 @@ class RegCenterOrderService{
} }
//根据渠道订单获取方案信息 //根据渠道订单获取方案信息
async getSolutionByChannelOrderNo(pobj){ async getSolutionByChannelOrderNo(pobj) {
var orderinfo = await this.orderinfoDao.findOne({ channelOrderNo: pobj.actionBody.orderNo }); var orderinfo = await this.orderinfoDao.findOne({ channelOrderNo: pobj.actionBody.orderNo });
if (!orderinfo || !orderinfo.orderNo) { if (!orderinfo || !orderinfo.orderNo) {
return system.getResult(null, "订单数据为空,30210"); return system.getResult(null, "订单数据为空,30210");
} }
var item = await this.needsolutionDao.model.findOne({ var item = await this.needsolutionDao.model.findOne({
where:{orderNo:orderinfo.orderNo} where: { orderNo: orderinfo.orderNo }
}); });
if (!item) { if (!item) {
return system.getResult(null, "方案数据为空,30210"); return system.getResult(null, "方案数据为空,30210");
} }
return system.getResultSuccess(item); return system.getResultSuccess(item);
} }
//接收reg用户方案反馈 //接收reg用户方案反馈
async regFeedbackSubmit(pobj) { async regFeedbackSubmit(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if (!ab.intentionBizId) { if (!ab.intentionBizId) {
return system.getResultFail(-101, "渠道需求编号错误"); return system.getResultFail(-101, "渠道需求编号错误");
...@@ -137,7 +155,7 @@ class RegCenterOrderService{ ...@@ -137,7 +155,7 @@ class RegCenterOrderService{
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
}); });
console.log('needinfo-----reg---',needinfo) console.log('needinfo-----reg---', needinfo)
if (!needinfo) { if (!needinfo) {
return system.getResultFail(-104, "未知方案需求"); return system.getResultFail(-104, "未知方案需求");
} }
...@@ -154,49 +172,50 @@ class RegCenterOrderService{ ...@@ -154,49 +172,50 @@ class RegCenterOrderService{
var solutionContent; var solutionContent;
var i; var i;
var nsLength var nsLength
var needData = {id: needinfo.id}; var needData = { id: needinfo.id };
if(ab.intentionStatus){ if (ab.intentionStatus) {
if(ab.intentionStatus == 5){ if (ab.intentionStatus == 5) {
needData['status'] = 'ygb' needData['status'] = 'ygb'
needData['statusName'] = '已关闭' needData['statusName'] = '已关闭'
} }
if(ab.intentionStatus == 1){ if (ab.intentionStatus == 1) {
needData["status"] = "ygb"; needData["status"] = "ygb";
needData['statusName'] = '已关闭' needData['statusName'] = '已关闭'
} }
if (ns.length < 1) { if (ns.length < 1) {
//如果没有方案直接关闭需求,更新需求状态 //如果没有方案直接关闭需求,更新需求状态
await this.needinfoDao.update(needData);//更新状态修改 await this.needinfoDao.update(needData);//更新状态修改
} }
}else{ else {
nsLength = ns.length nsLength = ns.length
for(i=0;i<nsLength;i++){ for (i = 0; i < nsLength; i++) {
updateObj = { updateObj = {
id: ns[i].id id: ns[i].id
}; };
solutionContent = ns[i].solutionContent; solutionContent = ns[i].solutionContent;
solutionContent.customerRemark = ab.description; solutionContent.customerRemark = ab.description;
solutionContent.needStatus = ab.intentionStatus; solutionContent.needStatus = ab.intentionStatus;
if (ab.intentionStatus == 1) { if (ab.intentionStatus == 1) {
updateObj["status"] = "ybh"; updateObj["status"] = "ybh";
updateObj["isInvalid"] = 1; updateObj["isInvalid"] = 1;
} else if (ab.intentionStatus == 2) { } else if (ab.intentionStatus == 2) {
updateObj["status"] = "dqr"; updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 3) { } else if (ab.intentionStatus == 3) {
updateObj["status"] = "dqr"; updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 4) { } else if (ab.intentionStatus == 4) {
updateObj["status"] = "dqr"; updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 5) { } else if (ab.intentionStatus == 5) {
updateObj["status"] = "yzf"; updateObj["status"] = "yzf";
updateObj["isInvalid"] = 1; updateObj["isInvalid"] = 1;
} else { } else {
return system.getResultFail(-107, "需求当前状态错误--" + ab.intentionStatus); return system.getResultFail(-107, "需求当前状态错误--" + ab.intentionStatus);
}
solutionContent.needStatusName = intentionStatusList[ab.intentionStatus];
solutionContent = JSON.stringify(solutionContent);
updateObj["solutionContent"] = solutionContent;
await this.needsolutionDao.update(updateObj);//方案状态修改
await this.needinfoDao.update(needData);//更新状态修改
} }
solutionContent.needStatusName = intentionStatusList[ab.intentionStatus];
solutionContent = JSON.stringify(solutionContent);
updateObj["solutionContent"] = solutionContent;
await this.needsolutionDao.update(updateObj);//方案状态修改
await this.needinfoDao.update(needData);//更新状态修改
} }
} }
return system.getResultSuccess(); return system.getResultSuccess();
...@@ -224,20 +243,20 @@ class RegCenterOrderService{ ...@@ -224,20 +243,20 @@ class RegCenterOrderService{
//渠道方案号获取需求详情 //渠道方案号获取需求详情
async getItemByChannelSolutionNo(pobj) { async getItemByChannelSolutionNo(pobj) {
console.log('getItemByChannelSolutionNo---',pobj) console.log('getItemByChannelSolutionNo---', pobj)
var solutionitem = {} var solutionitem = {}
var orderinfo = {} var orderinfo = {}
var item = {} var item = {}
if(pobj.actionBody.channelSolutionId ){ if (pobj.actionBody.channelSolutionId) {
solutionitem = await this.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.channelSolutionId }); solutionitem = await this.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.channelSolutionId });
console.log('solutionitem---',solutionitem) console.log('solutionitem---', solutionitem)
if (!solutionitem) { if (!solutionitem) {
return system.getResult(null, "方案数据为空,30210"); return system.getResult(null, "方案数据为空,30210");
} }
} }
if(pobj.actionBody.orderNo ){ if (pobj.actionBody.orderNo) {
orderinfo = await this.orderinfoDao.findOne({ channelOrderNo: pobj.actionBody.orderNo }); orderinfo = await this.orderinfoDao.findOne({ channelOrderNo: pobj.actionBody.orderNo });
if(orderinfo){ if (orderinfo) {
solutionitem = await this.needsolutionDao.findOne({ orderNo: orderinfo.orderNo }); solutionitem = await this.needsolutionDao.findOne({ orderNo: orderinfo.orderNo });
} }
} }
...@@ -245,19 +264,19 @@ class RegCenterOrderService{ ...@@ -245,19 +264,19 @@ class RegCenterOrderService{
if (!item && !solutionitem) { if (!item && !solutionitem) {
return system.getResult(null, "需求或者方案不存在,30211"); return system.getResult(null, "需求或者方案不存在,30211");
} }
if(!item){ if (!item) {
item = {} item = {}
item['publishMobile']=solutionitem.solutionContent.customerInfo.publishMobile item['publishMobile'] = solutionitem.solutionContent.customerInfo.publishMobile
item['solutionProvince'] = solutionitem.solutionContent.solution.area; item['solutionProvince'] = solutionitem.solutionContent.solution.area;
item['solutionContent'] = solutionitem.solutionContent item['solutionContent'] = solutionitem.solutionContent
item['channelSolutionNo'] = solutionitem.channelSolutionNo item['channelSolutionNo'] = solutionitem.channelSolutionNo
}else{ } else {
item.solutionProvince = solutionitem.solutionContent.solution.area; item.solutionProvince = solutionitem.solutionContent.solution.area;
item.solutionContent = solutionitem.solutionContent item.solutionContent = solutionitem.solutionContent
item.channelSolutionNo = solutionitem.channelSolutionNo item.channelSolutionNo = solutionitem.channelSolutionNo
} }
return system.getResultSuccess(item); return system.getResultSuccess(item);
} }
...@@ -291,8 +310,8 @@ class RegCenterOrderService{ ...@@ -291,8 +310,8 @@ class RegCenterOrderService{
} }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
var checkStatus = { var checkStatus = {
COLLECTING: "材料收集环节",AUDITING: "工商审核环节",ACTIVE:"服务中", COLLECTING: "材料收集环节", AUDITING: "工商审核环节", ACTIVE: "服务中",
ENGRAVING:"刻章环节",SUCCESS:"已完成", CLOSE: "方案关闭" ENGRAVING: "刻章环节", SUCCESS: "已完成", CLOSE: "方案关闭"
}; };
if (solutionContent.status && checkStatus[solutionContent.status]) { if (solutionContent.status && checkStatus[solutionContent.status]) {
return system.getResultFail(-111, "方案已进入" + solutionContent.statusName + "流程,不能执行此操作"); return system.getResultFail(-111, "方案已进入" + solutionContent.statusName + "流程,不能执行此操作");
...@@ -301,7 +320,7 @@ class RegCenterOrderService{ ...@@ -301,7 +320,7 @@ class RegCenterOrderService{
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
if (ab.status == "1") {//⽤户已支付 if (ab.status == "1") {//⽤户已支付
var afterStatusList = [//用户支付后的流程状态 var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING" ,"SUCCESS" "COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
]; ];
if (!solutionContent.status || afterStatusList.indexOf(solutionContent.status) < 0) { if (!solutionContent.status || afterStatusList.indexOf(solutionContent.status) < 0) {
solutionFlowList.push({ solutionFlowList.push({
...@@ -339,7 +358,7 @@ class RegCenterOrderService{ ...@@ -339,7 +358,7 @@ class RegCenterOrderService{
}); });
solutionContent.status = "CLOSE"; solutionContent.status = "CLOSE";
solutionContent.statusName = this.regSolutionStatus.CLOSE; solutionContent.statusName = this.regSolutionStatus.CLOSE;
}else { } else {
return system.getResultFail(-110, "状态错误-5"); return system.getResultFail(-110, "状态错误-5");
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
...@@ -387,9 +406,9 @@ class RegCenterOrderService{ ...@@ -387,9 +406,9 @@ class RegCenterOrderService{
}); });
return system.getResultSuccess(new_ns); return system.getResultSuccess(new_ns);
} }
//接收方案状态及支付信息 //接收方案状态及支付信息
async regReceiveSolutionPayInfo(pobj) { async regReceiveSolutionPayInfo(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) {
...@@ -398,55 +417,55 @@ class RegCenterOrderService{ ...@@ -398,55 +417,55 @@ class RegCenterOrderService{
if (!ab.channelSolutionNo) { if (!ab.channelSolutionNo) {
return system.getResultFail(-101, "渠道方案编号不能为空"); return system.getResultFail(-101, "渠道方案编号不能为空");
} }
if(ab.isDirectBuy && ab.isDirectBuy==1){//直接下单 if (ab.isDirectBuy && ab.isDirectBuy == 1) {//直接下单
var oldNs = await this.orderinfoDao.model.findOne({ var oldNs = await this.orderinfoDao.model.findOne({
where: { orderNo: ab.orderNo }, raw: true where: { orderNo: ab.orderNo }, raw: true
}); });
var newNsObj={ var newNsObj = {
orderNo:ab.orderNo,channelSolutionNo:ab.channelSolutionNo,solutionNo:ab.channelSolutionNo, orderNo: ab.orderNo, channelSolutionNo: ab.channelSolutionNo, solutionNo: ab.channelSolutionNo,
needNo:ab.bizId,channelNeedNo:ab.bizId,status:"ywc" needNo: ab.bizId, channelNeedNo: ab.bizId, status: "ywc"
}; };
var newSolutionCount = { var newSolutionCount = {
"status": "PAID", "status": "PAID",
"bizType": ab.product_info && ab.product_info.item_code?ab.product_info.item_code:"", "bizType": ab.product_info && ab.product_info.item_code ? ab.product_info.item_code : "",
"companyName":ab.companyName || "", "companyName": ab.companyName || "",
"engagedIndustry":ab.engagedIndustry || "", "engagedIndustry": ab.engagedIndustry || "",
"bizScope":ab.bizScope || "", "bizScope": ab.bizScope || "",
"hasAddress":ab.hasAddress || "", "hasAddress": ab.hasAddress || "",
"solution": { "solution": {
// companyName:公司名称 // companyName:公司名称
// engagedIndustry:从事行业 // engagedIndustry:从事行业
// bizScope:经营范围 // bizScope:经营范围
// hasAddress:是否自有地址,布尔值 // hasAddress:是否自有地址,布尔值
companyName:ab.companyName || "", companyName: ab.companyName || "",
engagedIndustry:ab.engagedIndustry || "", engagedIndustry: ab.engagedIndustry || "",
bizScope:ab.bizScope || "", bizScope: ab.bizScope || "",
hasAddress:ab.hasAddress || "", hasAddress: ab.hasAddress || "",
area:ab.area || "", area: ab.area || "",
price:ab.orderPrice || "", price: ab.orderPrice || "",
regType:ab.consultType || "", regType: ab.consultType || "",
taxpayerType:ab.taxpayerType || "", taxpayerType: ab.taxpayerType || "",
companyProperties:ab.companyProperties || "" companyProperties: ab.companyProperties || ""
}, },
"totalSum": ab.totalSum || "", "totalSum": ab.totalSum || "",
"typeCode": ab.product_info && ab.product_info.item_code?ab.product_info.item_code:"", "typeCode": ab.product_info && ab.product_info.item_code ? ab.product_info.item_code : "",
"typeName": ab.product_info && ab.product_info.item_name?ab.product_info.item_name:"", "typeName": ab.product_info && ab.product_info.item_name ? ab.product_info.item_name : "",
"needStatus": "3", "needStatus": "3",
"statusName": "用户支付", "statusName": "用户支付",
"customerInfo": { "customerInfo": {
"publishName": pobj.userInfo.channel_nickname || "", "publishName": pobj.userInfo.channel_nickname || "",
"publishMobile": pobj.userInfo.mobile || "" "publishMobile": pobj.userInfo.mobile || ""
}, },
"customerRemark":ab.description || "", "customerRemark": ab.description || "",
"needStatusName": "处理中", "needStatusName": "处理中",
"customerMaterial": {}, "customerMaterial": {},
"solutionFlowList": [ "solutionFlowList": [
{ {
"status": "PAID", "status": "PAID",
"statusName": "用户支付", "statusName": "用户支付",
"updated_at": new Date() "updated_at": new Date()
} }
] ]
}; };
newNsObj.solutionContent = JSON.stringify(newSolutionCount); newNsObj.solutionContent = JSON.stringify(newSolutionCount);
var ns = null; var ns = null;
...@@ -454,16 +473,16 @@ class RegCenterOrderService{ ...@@ -454,16 +473,16 @@ class RegCenterOrderService{
// ns = oldNs; // ns = oldNs;
// console.log('ddddddd---ns=====',ns) // console.log('ddddddd---ns=====',ns)
// }else{ // }else{
ns = await this.needsolutionDao.create(newNsObj); ns = await this.needsolutionDao.create(newNsObj);
// } // }
var ns2 = await this.needsolutionDao.model.findOne({ var ns2 = await this.needsolutionDao.model.findOne({
where: { id: ns.id }, raw: true where: { id: ns.id }, raw: true
}); });
return system.getResultSuccess(ns2); return system.getResultSuccess(ns2);
}else{ } else {
var needsolutioninfo = await this.needsolutionDao.model.findOne({ var needsolutioninfo = await this.needsolutionDao.model.findOne({
attributes:["id","solutionContent","status","orderNo"], attributes: ["id", "solutionContent", "status", "orderNo"],
where: { channelSolutionNo: ab.channelSolutionId,isInvalid:0 }, raw: true where: { channelSolutionNo: ab.channelSolutionId, isInvalid: 0 }, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-400, "未知方案");
...@@ -484,7 +503,7 @@ class RegCenterOrderService{ ...@@ -484,7 +503,7 @@ class RegCenterOrderService{
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
} }
/* /*
...@@ -531,13 +550,13 @@ class RegCenterOrderService{ ...@@ -531,13 +550,13 @@ class RegCenterOrderService{
//关闭订单 //关闭订单
async regOrderClose(pobj) { async regOrderClose(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if (!ab.orderNo) { if (!ab.orderNo) {
return system.getResultFail(-101, "渠道订单号不能为空"); return system.getResultFail(-101, "渠道订单号不能为空");
} }
var orderInfo = await this.orderinfoDao.model.findOne({ var orderInfo = await this.orderinfoDao.model.findOne({
where:{channelOrderNo:ab.orderNo},raw:true where: { channelOrderNo: ab.orderNo }, raw: true
}); });
if (!orderInfo || !orderInfo.id) { if (!orderInfo || !orderInfo.id) {
return system.getResultFail(-103, "未知订单"); return system.getResultFail(-103, "未知订单");
...@@ -573,24 +592,24 @@ class RegCenterOrderService{ ...@@ -573,24 +592,24 @@ class RegCenterOrderService{
} }
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
var updateObj = { var updateObj = {
id: ns.id, solutionContent: solutionContent,status:"yzf",isInvalid:1 id: ns.id, solutionContent: solutionContent, status: "yzf", isInvalid: 1
}; };
var self = this; var self = this;
return await this.needsolutionDao.db.transaction(async function (t) { return await this.needsolutionDao.db.transaction(async function (t) {
await self.needsolutionDao.update(updateObj);//方案状态修改 await self.needsolutionDao.update(updateObj);//方案状态修改
await self.orderinfoDao.update({id:orderInfo.id,orderStatus:16});//订单状态修改 await self.orderinfoDao.update({ id: orderInfo.id, orderStatus: 16 });//订单状态修改
var new_ns = await self.needsolutionDao.model.findOne({ var new_ns = await self.needsolutionDao.model.findOne({
where: { id: ns.id }, raw: true where: { id: ns.id }, raw: true
}); });
return system.getResultSuccess(new_ns); return system.getResultSuccess(new_ns);
}) })
} }
//------------3. //------------3.
//提交方案 yiwancheng //提交方案 yiwancheng
async regSubmitSolution(pobj) { async regSubmitSolution(pobj) {
console.log("pobj++submitRegSolution++",pobj) console.log("pobj++submitRegSolution++", 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) {
...@@ -607,6 +626,7 @@ class RegCenterOrderService{ ...@@ -607,6 +626,7 @@ class RegCenterOrderService{
var solutionType = []; var solutionType = [];
var solutionContent; var solutionContent;
var needsolutions = [];//最后返回结果用 var needsolutions = [];//最后返回结果用
var bizType = [];//业务类型 百度公司注册兼容公司注册套餐
if (ab.solutionList) { if (ab.solutionList) {
var solutionListLength = ab.solutionList.length; var solutionListLength = ab.solutionList.length;
} }
...@@ -618,7 +638,9 @@ class RegCenterOrderService{ ...@@ -618,7 +638,9 @@ class RegCenterOrderService{
solutionContent = ab.solutionList[i].solutionContent solutionContent = ab.solutionList[i].solutionContent
solutionType.push(solutionContent.solution.regType) solutionType.push(solutionContent.solution.regType)
console.log('solutionType------', solutionType) console.log('solutionType------', solutionType)
bizType.push(solutionContent.solution.regType)
} }
bizType = bizType.toString()
//获取需求信息 //获取需求信息
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
...@@ -629,7 +651,8 @@ class RegCenterOrderService{ ...@@ -629,7 +651,8 @@ class RegCenterOrderService{
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 = needinfo.typeCode;//业务类型 // var bizType = needinfo.typeCode;//业务类型 原百度公司注册
if (!bizType) { if (!bizType) {
return system.getResultFail(-205, "方案类型错误"); return system.getResultFail(-205, "方案类型错误");
} }
...@@ -646,14 +669,14 @@ class RegCenterOrderService{ ...@@ -646,14 +669,14 @@ class RegCenterOrderService{
if (ns) { if (ns) {
var nsLength = ns.rows.length; var nsLength = ns.rows.length;
for (l = 0; l < nsLength; l++) { for (l = 0; l < nsLength; l++) {
if(ns.rows[l].isInvalid == 0){ if (ns.rows[l].isInvalid == 0) {
nsRegType.push(ns.rows[l].solutionContent.solution.regType) nsRegType.push(ns.rows[l].solutionContent.solution.regType)
} }
if(ns.rows[l].isInvalid == 1 && !ns.rows[l].solutionContent.solution.channelSolutionNo && ns.rows[l].status == "ybh"){ if (ns.rows[l].isInvalid == 1 && !ns.rows[l].solutionContent.solution.channelSolutionNo && ns.rows[l].status == "ybh") {
return system.getResultFail(-207, "该方案中包含已驳回方案,不能新建方案,只能修改方案"); return system.getResultFail(-207, "该方案中包含已驳回方案,不能新建方案,只能修改方案");
} }
} }
var diff; var diff;
diff = nsRegType.find(item => solutionType.includes(item)) diff = nsRegType.find(item => solutionType.includes(item))
console.log('diff---', diff) console.log('diff---', diff)
...@@ -664,8 +687,19 @@ class RegCenterOrderService{ ...@@ -664,8 +687,19 @@ class RegCenterOrderService{
for (j = 0; j < solutionListLength; j++) { for (j = 0; j < solutionListLength; j++) {
if (ab.solutionList[j].solutionContent) { if (ab.solutionList[j].solutionContent) {
ab.solutionList[j].solutionContent.bizType = bizType; ab.solutionList[j].solutionContent.bizType = bizType;
ab.solutionList[j].solutionContent.typeCode = needinfo.typeCode; ab.solutionList[j].solutionContent.typeCode = bizType;
ab.solutionList[j].solutionContent.typeName = needinfo.typeName; // ab.solutionList[j].solutionContent.typeName = needinfo.typeName;//需求类型中文 原百度公司注册
switch (bizType) {
case "GSREG":
ab.solutionList[j].solutionContent.typeName = needinfo.typeName
break;
case "QYJYTC1":
ab.solutionList[j].solutionContent.typeName = "企业经营套餐一"
break;
case "QYJYTC2":
ab.solutionList[j].solutionContent.typeName = "企业经营套餐二"
break;
}
for (k = 0; k < ns.rows.length; k++) { for (k = 0; k < ns.rows.length; k++) {
var fa = ns.rows[k]; var fa = ns.rows[k];
// if (fa.status == "dqr" || fa.status == "ywc") { // if (fa.status == "dqr" || fa.status == "ywc") {
...@@ -746,8 +780,8 @@ class RegCenterOrderService{ ...@@ -746,8 +780,8 @@ class RegCenterOrderService{
} }
//方案更新 //方案更新
async updateSolution(pobj){ async updateSolution(pobj) {
console.log("pobj++updateSolution++",pobj) console.log("pobj++updateSolution++", 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) {
...@@ -757,9 +791,9 @@ class RegCenterOrderService{ ...@@ -757,9 +791,9 @@ class RegCenterOrderService{
if (!ab.needNo) { if (!ab.needNo) {
return system.getResultFail(-101, "渠道需求号不能为空"); return system.getResultFail(-101, "渠道需求号不能为空");
} }
var needsolutions = [];//最后返回结果用 var needsolutions = [];//最后返回结果用
console.log('ab.solutionList------', ab.solutionList) console.log('ab.solutionList------', ab.solutionList)
if (!ab.solutionList[0].solutionContent) { if (!ab.solutionList[0].solutionContent) {
return system.getResultFail(-102, "方案信息有误"); return system.getResultFail(-102, "方案信息有误");
...@@ -767,7 +801,7 @@ class RegCenterOrderService{ ...@@ -767,7 +801,7 @@ class RegCenterOrderService{
if (!ab.solutionList[0].solutionContent.solution.channelSolutionNo) { if (!ab.solutionList[0].solutionContent.solution.channelSolutionNo) {
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.needNo }, raw: true where: { channelNeedNo: ab.needNo }, raw: true
...@@ -788,12 +822,12 @@ class RegCenterOrderService{ ...@@ -788,12 +822,12 @@ class RegCenterOrderService{
//查询对应类型方案是否有驳回,驳回后直接更新 //查询对应类型方案是否有驳回,驳回后直接更新
var bhns = await this.needsolutionDao.model.findOne({ var bhns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.solutionList[0].solutionContent.solution.channelSolutionNo ,isInvalid : 1 ,status : "ybh"}, raw: true, order: [["id", 'asc']] where: { channelSolutionNo: ab.solutionList[0].solutionContent.solution.channelSolutionNo, isInvalid: 1, status: "ybh" }, raw: true, order: [["id", 'asc']]
}); });
console.log('bhns----', bhns) console.log('bhns----', bhns)
if (!bhns) { if (!bhns) {
return system.getResultFail(-108, "修改方案,不存在的驳回方案"); return system.getResultFail(-108, "修改方案,不存在的驳回方案");
}else{ } else {
var self = this var self = this
ab.solutionList[0].solutionContent = JSON.stringify(ab.solutionList[0].solutionContent); ab.solutionList[0].solutionContent = JSON.stringify(ab.solutionList[0].solutionContent);
await this.needsolutionDao.db.transaction(async function (t) { await this.needsolutionDao.db.transaction(async function (t) {
...@@ -802,16 +836,16 @@ class RegCenterOrderService{ ...@@ -802,16 +836,16 @@ class RegCenterOrderService{
ab.solutionList[0]["isInvalid"] = 0; ab.solutionList[0]["isInvalid"] = 0;
var jsonDatas = ab.solutionList[0].solutionContent var jsonDatas = ab.solutionList[0].solutionContent
var jsonData = JSON.parse(jsonDatas) var jsonData = JSON.parse(jsonDatas)
var od = await self.needsolutionDao.updateByWhere(ab.solutionList[0],{where:{channelSolutionNo : jsonData.solution.channelSolutionNo}}, t); var od = await self.needsolutionDao.updateByWhere(ab.solutionList[0], { where: { channelSolutionNo: jsonData.solution.channelSolutionNo } }, t);
console.log("od-----",od) console.log("od-----", od)
if (od && od.length >0) { if (od && od.length > 0) {
var needObj = { var 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
}; };
var followContent = [{ var followContent = [{
followDate: new Date(), followDate: new Date(),
content: "驳回后更新方案" content: "驳回后更新方案"
...@@ -831,9 +865,9 @@ class RegCenterOrderService{ ...@@ -831,9 +865,9 @@ class RegCenterOrderService{
} }
//方案推送baidu后,接收保存方案编号/链接 //方案推送baidu后,接收保存方案编号/链接
async saveReginfo(pobj) { async saveReginfo(pobj) {
console.log('----pobj--',pobj) console.log('----pobj--', pobj)
var ab = pobj.actionBody; var ab = pobj.actionBody;
console.log('---ab---',ab) console.log('---ab---', ab)
if (!ab.infos) { if (!ab.infos) {
return system.getResultFail(-101, "渠道信息不能为空"); return system.getResultFail(-101, "渠道信息不能为空");
} }
...@@ -845,11 +879,11 @@ class RegCenterOrderService{ ...@@ -845,11 +879,11 @@ class RegCenterOrderService{
for (i = 0; i < infosLength; i++) { for (i = 0; i < infosLength; i++) {
solutionNos.push(ab.infos[i].gsbBizId) solutionNos.push(ab.infos[i].gsbBizId)
} }
console.log('----solutionNos----',solutionNos) console.log('----solutionNos----', solutionNos)
var ns = await this.needsolutionDao.model.findAll({ var ns = await this.needsolutionDao.model.findAll({
where: { solutionNo: { [this.db.Op.in]: solutionNos }, isInvalid: 0 }, raw: true where: { solutionNo: { [this.db.Op.in]: solutionNos }, isInvalid: 0 }, raw: true
}); });
console.log("----ns----",ns) console.log("----ns----", ns)
var nsLength = ns.length var nsLength = ns.length
if (!ns) { if (!ns) {
return system.getResultFail(-103, "未知方案"); return system.getResultFail(-103, "未知方案");
...@@ -864,29 +898,29 @@ class RegCenterOrderService{ ...@@ -864,29 +898,29 @@ class RegCenterOrderService{
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
var confirmUrl = [] var confirmUrl = []
var str ; var str;
for (j = 0; j < nsLength; j++) { for (j = 0; j < nsLength; j++) {
confirmUrl.push(ab.infos[j].confirmUrl) confirmUrl.push(ab.infos[j].confirmUrl)
ns[j].solutionContent['confirmUrl'] = ab.infos[j].confirmUrl ns[j].solutionContent['confirmUrl'] = ab.infos[j].confirmUrl
str = ns[j].solutionContent str = ns[j].solutionContent
str = JSON.stringify(str) str = JSON.stringify(str)
await this.needsolutionDao.model.update({ channelSolutionNo: ab.infos[j].bizId, solutionContent:str}, { where: { id: ns[j].id } });//修改方案信息 await this.needsolutionDao.model.update({ channelSolutionNo: ab.infos[j].bizId, solutionContent: str }, { where: { id: ns[j].id } });//修改方案信息
} }
return system.getResultSuccess(); return system.getResultSuccess();
} }
//回写沟通记录 //回写沟通记录
async regWriteCommunicationLog(pobj) { async regWriteCommunicationLog(pobj) {
console.log('回写沟通记录----pobj------',pobj) console.log('回写沟通记录----pobj------', pobj)
// 查询需求沟通记录 // 查询需求沟通记录
pobj.actionBody.Note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", pobj.actionBody.note]; pobj.actionBody.Note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", pobj.actionBody.note];
let needRes = await this.needinfoDao.findOne({ channelNeedNo: pobj.actionBody.intentionBizId }); let needRes = await this.needinfoDao.findOne({ channelNeedNo: pobj.actionBody.intentionBizId });
console.log('回写沟通记录----needRes------',needRes) console.log('回写沟通记录----needRes------', needRes)
var uappIds var uappIds
// 没有需求单直接返回 // 没有需求单直接返回
if (!needRes) { if (!needRes) {
return system.getResult("没有这个需求单"); return system.getResult("没有这个需求单");
}else{ } else {
uappIds = needRes.uapp_id uappIds = needRes.uapp_id
} }
// 如果未推送/以推送 修改为已跟进 // 如果未推送/以推送 修改为已跟进
...@@ -895,29 +929,29 @@ class RegCenterOrderService{ ...@@ -895,29 +929,29 @@ class RegCenterOrderService{
statusName: '已跟进', statusName: '已跟进',
status: 'ygj' status: 'ygj'
}; };
var updateRes = await this.needinfoDao.updateByWhere(paramWhere,{ where: { channelNeedNo: pobj.actionBody.intentionBizId } }); var updateRes = await this.needinfoDao.updateByWhere(paramWhere, { where: { channelNeedNo: pobj.actionBody.intentionBizId } });
console.log('回写沟通记录----updateRes---',updateRes) console.log('回写沟通记录----updateRes---', updateRes)
} }
// 有需求单但没有沟通记录 直接set // 有需求单但没有沟通记录 直接set
if (!needRes.followContent) { if (!needRes.followContent) {
var paramWhere = { var paramWhere = {
followContent: pobj.actionBody.Note followContent: pobj.actionBody.Note
}; };
var updateRes = await this.needinfoDao.updateByWhere(paramWhere,{ where: { channelNeedNo: pobj.actionBody.intentionBizId } }); var updateRes = await this.needinfoDao.updateByWhere(paramWhere, { where: { channelNeedNo: pobj.actionBody.intentionBizId } });
console.log('回写沟通记录----updateRes---updateRes---',updateRes) console.log('回写沟通记录----updateRes---updateRes---', updateRes)
// 有需求单有沟通记录 json_array_append // 有需求单有沟通记录 json_array_append
} else { } else {
var paramWhere = { var paramWhere = {
Note: pobj.actionBody.Note Note: pobj.actionBody.Note
}; };
var updateRes = await this.needinfoDao.updateByWhere(paramWhere,{ where: { channelNeedNo: pobj.actionBody.intentionBizId } }); var updateRes = await this.needinfoDao.updateByWhere(paramWhere, { where: { channelNeedNo: pobj.actionBody.intentionBizId } });
console.log('updateRes------',updateRes) console.log('updateRes------', updateRes)
} }
return system.getResultSuccess(uappIds); return system.getResultSuccess(uappIds);
} }
//新增查询需求沟通记录 //新增查询需求沟通记录
async regQueryExpertCommunicationLogs(pobj){ async regQueryExpertCommunicationLogs(pobj) {
console.log('query++pobj',pobj) console.log('query++pobj', pobj)
if (!pobj.actionBody.intentionBizId) { if (!pobj.actionBody.intentionBizId) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100493"); return system.getResult(null, "actionBody.intentionBizId can not be empty,100493");
} }
...@@ -931,7 +965,7 @@ class RegCenterOrderService{ ...@@ -931,7 +965,7 @@ class RegCenterOrderService{
//根据需求关闭reg需求/方案 //根据需求关闭reg需求/方案
async regNeedClose(pobj) { async regNeedClose(pobj) {
console.log("regNeedClose+++",pobj) console.log("regNeedClose+++", pobj)
var ab = pobj.actionBody; var ab = pobj.actionBody;
var app = pobj.appInfo; var app = pobj.appInfo;
var uappId; var uappId;
...@@ -948,7 +982,7 @@ class RegCenterOrderService{ ...@@ -948,7 +982,7 @@ class RegCenterOrderService{
}); });
if (!needinfo || !needinfo.id) { if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息"); return system.getResultFail(-201, "未知需求信息");
}else{ } else {
uappId = needinfo.uapp_id uappId = needinfo.uapp_id
} }
if (needinfo.status == "ygb" || needinfo.status == "ycd") { if (needinfo.status == "ygb" || needinfo.status == "ycd") {
...@@ -971,7 +1005,7 @@ class RegCenterOrderService{ ...@@ -971,7 +1005,7 @@ class RegCenterOrderService{
if (ns.rows[i].id) { if (ns.rows[i].id) {
ns.rows[i]['uapp_id'] = uappId; ns.rows[i]['uapp_id'] = uappId;
if (ns.rows[i].status == "ywc") { if (ns.rows[i].status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃"+ ns.rows[i].statusName +"方案"); return system.getResultFail(-103, "方案状态错误,不能废弃" + ns.rows[i].statusName + "方案");
} }
var flowStatus = ns.rows[i].solutionContent && ns.rows[i].solutionContent.status ? ns.rows[i].solutionContent.status : ""; var flowStatus = ns.rows[i].solutionContent && ns.rows[i].solutionContent.status ? ns.rows[i].solutionContent.status : "";
...@@ -980,25 +1014,25 @@ class RegCenterOrderService{ ...@@ -980,25 +1014,25 @@ class RegCenterOrderService{
} }
var self = this var self = this
updateSolution = { updateSolution = {
status: "yzf", status: "yzf",
isInvalid: 1 isInvalid: 1
} }
await this.needsolutionDao.db.transaction(async function (t) { await this.needsolutionDao.db.transaction(async function (t) {
needObj = { needObj = {
status: "ygb", notes: ab.note status: "ygb", notes: ab.note
}; };
await self.needinfoDao.updateByWhere(needObj, { where :{id: needinfo.id }, t });//关闭需求 await self.needinfoDao.updateByWhere(needObj, { where: { id: needinfo.id }, t });//关闭需求
var a= await self.needsolutionDao.updateByWhere(updateSolution, { where: { id: ns.rows[i].id }, t });//方案废弃 var a = await self.needsolutionDao.updateByWhere(updateSolution, { where: { id: ns.rows[i].id }, t });//方案废弃
console.log("aaaa---",a) console.log("aaaa---", a)
}) })
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
} }
}else{ } else {
needObj = { needObj = {
id: needinfo.id, status: "ygb", notes: ab.note id: needinfo.id, status: "ygb", notes: ab.note
}; };
await this.needinfoDao.updateByWhere(needObj,{where :{id: needinfo.id}}) await this.needinfoDao.updateByWhere(needObj, { where: { id: needinfo.id } })
return system.getResultSuccess(needinfo); return system.getResultSuccess(needinfo);
} }
} }
...@@ -1006,6 +1040,14 @@ class RegCenterOrderService{ ...@@ -1006,6 +1040,14 @@ class RegCenterOrderService{
//交付商通知状态变更 //交付商通知状态变更
async regUpdateOrderStatus(pobj) { async regUpdateOrderStatus(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if (!ab.consultType) {
return system.getResultFail(-101, "业务大类不能为空");
}
if (ab.consultType == "QYJYTC1" || ab.consultType == "QYJYTC2") {
if (!ab.productType) {
return system.getResultFail(-101, "业务小类不能为空");
}
}
if (!ab.orderNo) { if (!ab.orderNo) {
return system.getResultFail(-101, "订单号不能为空"); return system.getResultFail(-101, "订单号不能为空");
} }
...@@ -1017,8 +1059,8 @@ class RegCenterOrderService{ ...@@ -1017,8 +1059,8 @@ class RegCenterOrderService{
if (ab.officialFileURL) { if (ab.officialFileURL) {
ab["OfficialFileURL"] = ab.officialFileURL; ab["OfficialFileURL"] = ab.officialFileURL;
} }
if(pobj.deliverContent){ if (pobj.deliverContent) {
ab['deliverContent']= ab.deliverContent ab['deliverContent'] = ab.deliverContent
} }
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { orderNo: ab.orderNo }, raw: true where: { orderNo: ab.orderNo }, raw: true
...@@ -1037,7 +1079,7 @@ class RegCenterOrderService{ ...@@ -1037,7 +1079,7 @@ class RegCenterOrderService{
} }
//服务商通知状态变更 //服务商通知状态变更
async regAcceptPartnerNotification(pobj) { async regAcceptPartnerNotification(pobj) {
console.log('服务商通知状态变更pobj++++',pobj) console.log('服务商通知状态变更pobj++++', 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) {
...@@ -1050,7 +1092,7 @@ class RegCenterOrderService{ ...@@ -1050,7 +1092,7 @@ class RegCenterOrderService{
return system.getResultFail(-102, "通知状态不能为空"); return system.getResultFail(-102, "通知状态不能为空");
} }
var deliveryContents; var deliveryContents;
if(ab.deliverContent){ if (ab.deliverContent) {
deliveryContents = ab.deliverContent deliveryContents = ab.deliverContent
} }
//获取方案信息 //获取方案信息
...@@ -1064,194 +1106,315 @@ class RegCenterOrderService{ ...@@ -1064,194 +1106,315 @@ class RegCenterOrderService{
if (!needsolutioninfo.needNo) { if (!needsolutioninfo.needNo) {
return system.getResultFail(-401, "方案需求信息有误"); return system.getResultFail(-401, "方案需求信息有误");
} }
//获取jiaofu信息 //获取交付信息 原始公司注册 start
let bizTypeName
let productType = ab.productType
let orderdeliverySqlData = { let orderdeliverySqlData = {
sourceOrderNo:ab.orderNo sourceOrderNo: ab.orderNo
} }
let orderdeliverySql = "SELECT * FROM `c_order_delivery` WHERE sourceOrderNo = :sourceOrderNo ORDER BY id DESC limit 1"; let orderdeliverySql = "SELECT * FROM `c_order_delivery` WHERE sourceOrderNo = :sourceOrderNo ORDER BY id DESC limit 1";
let orderdeliveryInfo = await this.orderdeliveryDao.customQuery(orderdeliverySql,orderdeliverySqlData) let orderdeliveryInfo = await this.orderdeliveryDao.customQuery(orderdeliverySql, orderdeliverySqlData)
var solutionFlowList = []; let solutionFlowList = [];
var deliveryContent; var deliveryFlowList = [];
if(orderdeliveryInfo[0] && orderdeliveryInfo[0].deliveryContent){ let deliveryContent = {};
deliveryContent = orderdeliveryInfo[0].deliveryContent; var applicationStatusList
if(deliveryContent && deliveryContent.status && deliveryContent.ApplicationStatus && deliveryContent.solutionFlowList){
// if (this.regStatus[deliveryContent.status] && this.regStatus[deliveryContent.status] > ab.ApplicationStatus) {
// return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
// }
if (this.regStatus[deliveryContent.ApplicationStatus] && this.regStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus && ab.ApplicationStatus == 705) {
return system.getResultFail(-405, "操作失败,该方案已完成,不能更改");
}
solutionFlowList = deliveryContent.solutionFlowList || [];
}
}else{
var deliveryContent = needsolutioninfo.solutionContent;
solutionFlowList = needsolutioninfo.solutionContent.solutionFlowList
}
// console.log('reg +++ deliveryContent+++',deliveryContent)
// if (!deliveryContent) {
// return system.getResultFail(-402, "方案交付信息有误");
// }
// if(needsolutioninfo){
// if (this.regStatus[needsolutioninfo.solutionContent.status] && this.regStatus[needsolutioninfo.solutionContent.status] > ab.ApplicationStatus) {
// return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
// }
// if (this.regStatus[needsolutioninfo.solutionContent.ApplicationStatus] && this.regStatus[needsolutioninfo.solutionContent.ApplicationStatus] == ab.ApplicationStatus) {
// return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交");
// }
// var solutionFlowList = needsolutioninfo.solutionContent.solutionFlowList || [];
// }
var orderInfo = await this.orderinfoDao.model.findOne({ var orderInfo = await this.orderinfoDao.model.findOne({
attributes:["uapp_id","channelOrderNo"], attributes: ["uapp_id", "channelOrderNo"],
where: {orderNo: ab.orderNo}, raw: true where: { orderNo: ab.orderNo }, raw: true
}) })
console.log("orderInfo+++",orderInfo) console.log("orderInfo+++", orderInfo)
if(orderInfo){ if (orderInfo) {
var uappId = orderInfo.uapp_id; var uappId = orderInfo.uapp_id;
var channelOrderNo = orderInfo.channelOrderNo var channelOrderNo = orderInfo.channelOrderNo
} }
//2021-5-18区分套餐与非套餐改版之前非套餐的原有数据 start let startTime
let endTime
// if (ab.ApplicationStatus == 702) {//材料收集环节 if (ab.startTime) {
// if (needsolutioninfo.solutionContent.status != "PAID") { startTime = (new Date(ab.startTime * 1000)).Format("yyyy-MM-dd hh:mm:ss")
// return system.getResultFail(-702, "交付流程错误,请先完成支付"); }
// } if (ab.startTime) {
// deliveryContent['ApplicationStatus'] = 702; endTime = (new Date(ab.endTime * 1000)).Format("yyyy-MM-dd hh:mm:ss")
// solutionFlowList.push({ }
// file: ab.OfficialFileURL || "", if (ab.consultType == "QYJYTC1") {
// status: "COLLECTING", statusName: this.regSolutionStatus.COLLECTING, updated_at: new Date() bizTypeName = "企业经营套餐一"
// }); }
// deliveryContent.status = "COLLECTING"; if (ab.consultType == "QYJYTC2") {
// deliveryContent.statusName = this.regSolutionStatus.COLLECTING; bizTypeName = "企业经营套餐二"
// } }
// if (ab.ApplicationStatus == 703) {//工商审核环节 //判断是否有交付信息
// var afterStatusList = [//用户支付后的流程状态 if (orderdeliveryInfo[0] && orderdeliveryInfo[0].deliveryContent) {
// "COLLECTING", "AUDITING", "ENGRAVING" ,"SUCCESS" deliveryContent = orderdeliveryInfo[0].deliveryContent;
// ]; //判断大类是否是套餐
// if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0){ if (ab.consultType && ab.consultType == "GSREG") {//非套餐
// return system.getResultFail(-703, "交付流程错误,请先完成材料收集"); if (deliveryContent && deliveryContent.status && deliveryContent.ApplicationStatus && deliveryContent.solutionFlowList) {
// } // if (this.regStatus[deliveryContent.status] && this.regStatus[deliveryContent.status] > ab.ApplicationStatus) {
// if (deliveryContent.status == "SUCCESS") { // return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
// return system.getResultFail(-706, "该方案已完成,不可更改"); // }
// } if (this.regStatus[deliveryContent.ApplicationStatus] && this.regStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus && ab.ApplicationStatus == 705) {
// deliveryContent['ApplicationStatus'] = 703; return system.getResultFail(-405, "操作失败,该方案已完成,不能更改");
// solutionFlowList.push({ }
// file: ab.OfficialFileURL || "", if (ab.ApplicationStatus == 702) {//材料收集环节
// status: "AUDITING", statusName: this.regSolutionStatus.AUDITING, updated_at: new Date() if (needsolutioninfo.solutionContent.status != "PAID") {
// }); return system.getResultFail(-702, "交付流程错误,请先完成支付");
// deliveryContent.status = "AUDITING"; }
// deliveryContent.statusName = this.regSolutionStatus.AUDITING; deliveryContent['ApplicationStatus'] = 702;
// console.log('deliveryContent-----sss---',deliveryContent) solutionFlowList.push({
// console.log('deliveryContent-----ss+++',typeof(deliveryContent)) file: ab.OfficialFileURL || "",
// deliveryContent['deliveryContent'] = deliveryContents status: "COLLECTING", statusName: this.regSolutionStatus.COLLECTING, updated_at: new Date()
// } });
// if (ab.ApplicationStatus == 704) {//刻章环节 deliveryContent.status = "COLLECTING";
// var afterStatusList = [//用户支付后的流程状态 deliveryContent.statusName = this.regSolutionStatus.COLLECTING;
// "COLLECTING", "AUDITING", "ENGRAVING" ,"SUCCESS" }
// ]; if (ab.ApplicationStatus == 703) {//工商审核环节
// if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0){ var afterStatusList = [//用户支付后的流程状态
// return system.getResultFail(-704, "交付流程错误,请先工商审核"); "COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
// } ];
// if (deliveryContent.status == "SUCCESS") { if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0) {
// return system.getResultFail(-707, "该方案已完成,不可更改"); return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
// } }
// deliveryContent['ApplicationStatus'] = 704; if (deliveryContent.status == "SUCCESS") {
// solutionFlowList.push({ return system.getResultFail(-706, "该方案已完成,不可更改");
// file: ab.OfficialFileURL || "", }
// status: "ENGRAVING", statusName: this.regSolutionStatus.ENGRAVING, updated_at: new Date() deliveryContent['ApplicationStatus'] = 703;
// }); solutionFlowList.push({
// deliveryContent.status = "ENGRAVING"; file: ab.OfficialFileURL || "",
// deliveryContent.statusName = this.regSolutionStatus.ENGRAVING; status: "AUDITING", statusName: this.regSolutionStatus.AUDITING, updated_at: new Date()
// } });
// if (ab.ApplicationStatus == 705) {//已完成 deliveryContent.status = "AUDITING";
// if (deliveryContent.status != "ENGRAVING") { deliveryContent.statusName = this.regSolutionStatus.AUDITING;
// return system.getResultFail(-705, "交付流程错误,请先刻章"); console.log('deliveryContent-----sss---', deliveryContent)
// } console.log('deliveryContent-----ss+++', typeof (deliveryContent))
// if (deliveryContent.status == "SUCCESS") { deliveryContent['deliveryContent'] = deliveryContents
// return system.getResultFail(-708, "该方案已完成,不可更改"); }
// } if (ab.ApplicationStatus == 704) {//刻章环节
// deliveryContent['ApplicationStatus'] = 705; var afterStatusList = [//用户支付后的流程状态
// solutionFlowList.push({ "COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
// file: ab.OfficialFileURL || "", ];
// status: "SUCCESS", statusName: this.regSolutionStatus.SUCCESS, updated_at: new Date() if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0) {
// }); return system.getResultFail(-704, "交付流程错误,请先工商审核");
// deliveryContent.status = "SUCCESS"; }
// needsolutioninfo.status = "ywc"; if (deliveryContent.status == "SUCCESS") {
// deliveryContent.statusName = this.regSolutionStatus.SUCCESS; return system.getResultFail(-707, "该方案已完成,不可更改");
// } }
//2021-5-18区分套餐与非套餐改版之前非套餐的原有数据 end deliveryContent['ApplicationStatus'] = 704;
solutionFlowList.push({
//2021-5-18 新增百度公司注册与公司注册套餐区分 start file: ab.OfficialFileURL || "",
if(ab.consultType && ab.consultType == "GSREG"){//公司注册 status: "ENGRAVING", statusName: this.regSolutionStatus.ENGRAVING, updated_at: new Date()
if (ab.ApplicationStatus == 702) {//材料收集环节 });
if (needsolutioninfo.solutionContent.status != "PAID") { deliveryContent.status = "ENGRAVING";
return system.getResultFail(-702, "交付流程错误,请先完成支付"); deliveryContent.statusName = this.regSolutionStatus.ENGRAVING;
}
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent.status != "ENGRAVING") {
return system.getResultFail(-705, "交付流程错误,请先刻章");
}
if (deliveryContent.status == "SUCCESS") {
return system.getResultFail(-708, "该方案已完成,不可更改");
}
deliveryContent['ApplicationStatus'] = 705;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "SUCCESS", statusName: this.regSolutionStatus.SUCCESS, updated_at: new Date()
});
deliveryContent.status = "SUCCESS";
needsolutioninfo.status = "ywc";
deliveryContent.statusName = this.regSolutionStatus.SUCCESS;
}
solutionFlowList = deliveryContent.solutionFlowList || [];
applicationStatusList = deliveryContent.applicationStatusList || [];
} }
deliveryContent['ApplicationStatus'] = 702;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "COLLECTING", statusName: this.regSolutionStatus.COLLECTING, updated_at: new Date()
});
deliveryContent.status = "COLLECTING";
deliveryContent.statusName = this.regSolutionStatus.COLLECTING;
} }
if (ab.ApplicationStatus == 703) {//工商审核环节 if (ab.consultType && ab.consultType == "QYJYTC1" || ab.consultType && ab.consultType == "QYJYTC2") {//公司注册套餐1和公司注册套餐2
var afterStatusList = [//用户支付后的流程状态 if (ab.productType && ab.productType == "GSZZ") {//工商执照
"COLLECTING", "AUDITING", "ENGRAVING" ,"SUCCESS" if (ab.ApplicationStatus == 702) {//材料收集环节
]; if (needsolutioninfo.solutionContent.status != "PAID") {
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0){ return system.getResultFail(-702, "交付流程错误,请先完成支付");
return system.getResultFail(-703, "交付流程错误,请先完成材料收集"); }
}
if (ab.ApplicationStatus == 703) {//工商审核环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent[ab.productType] || (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0)) {
return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-706, "该方案已完成,不可更改");
}
}
if (ab.ApplicationStatus == 704) {//刻章环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent[ab.productType].channelStatus || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
return system.getResultFail(-704, "交付流程错误,请先工商审核");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该方案已完成,不可更改");
}
}
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus != "ENGRAVING") {
return system.getResultFail(-705, "交付流程错误,请先刻章");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-708, "该方案已完成,不可更改");
}
}
deliveryContent['GSZZ'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "工商执照",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
customerInfo: needsolutioninfo.solutionContent.customerInfo,
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
} }
if (deliveryContent.status == "SUCCESS") { if (ab.productType && ab.productType == "DZFW") {//地址服务
return system.getResultFail(-706, "该方案已完成,不可更改"); if (ab.ApplicationStatus == 702) {//材料收集环节
if (needsolutioninfo.solutionContent.status != "PAID") {
return system.getResultFail(-702, "交付流程错误,请先完成支付");
}
}
if (ab.ApplicationStatus == 703) {//工商审核环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent[ab.productType] || (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0)) {
return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-706, "该方案已完成,不可更改");
}
}
if (ab.ApplicationStatus == 706) {//服务中
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "SUCCESS"
];
if (!deliveryContent[ab.productType] || (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0)) {
return system.getResultFail(-704, "交付流程错误,请先工商审核");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该方案已完成,不可更改");
}
}
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus != "ACTIVE") {
return system.getResultFail(-705, "交付流程错误,请先变更状态为服务中");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-708, "该方案已完成,不可更改");
}
}
deliveryContent['DZFW'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "地址服务",
startTime: startTime || "",
endTime: endTime || "",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
} }
deliveryContent['ApplicationStatus'] = 703; if (ab.productType && ab.productType == "SWBD") {//税务报道:有已接单,已完成状态
solutionFlowList.push({ if (ab.ApplicationStatus == 705) {//已完成
file: ab.OfficialFileURL || "", if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
status: "AUDITING", statusName: this.regSolutionStatus.AUDITING, updated_at: new Date() return system.getResultFail(-707, "该方案已完成,不可更改");
}); }
deliveryContent.status = "AUDITING"; }
deliveryContent.statusName = this.regSolutionStatus.AUDITING; deliveryContent['SWBD'] = {
console.log('deliveryContent-----sss---',deliveryContent) bizType: ab.consultType,
console.log('deliveryContent-----ss+++',typeof(deliveryContent)) bizTypeName: bizTypeName,
deliveryContent['deliveryContent'] = deliveryContents productType: productType,
} productTypeName: "税务报道",
if (ab.ApplicationStatus == 704) {//刻章环节 status: ab.ApplicationStatus,
var afterStatusList = [//用户支付后的流程状态 statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
"COLLECTING", "AUDITING", "ENGRAVING" ,"SUCCESS" channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
]; update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0){ officialFile: ab.officialFile || "",
return system.getResultFail(-704, "交付流程错误,请先工商审核"); deliveryFlowList: []
}
} }
if (deliveryContent.status == "SUCCESS") { if (ab.productType && ab.productType == "YHKH") {//银行开户、:有已接单,已完成状态
return system.getResultFail(-707, "该方案已完成,不可更改"); if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该方案已完成,不可更改");
}
}
deliveryContent['YHKH'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "银行开户",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
} }
deliveryContent['ApplicationStatus'] = 704; if (ab.productType && ab.productType == "DLJZ") {//代理记账:有已接单,服务中,已完成状态
solutionFlowList.push({ if (ab.ApplicationStatus == 706) {//服务中
file: ab.OfficialFileURL || "", if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "ACTIVE") {
status: "ENGRAVING", statusName: this.regSolutionStatus.ENGRAVING, updated_at: new Date() return system.getResultFail(-707, "该交付单已在服务中,不能重复提交");
}); }
deliveryContent.status = "ENGRAVING"; }
deliveryContent.statusName = this.regSolutionStatus.ENGRAVING; if (ab.ApplicationStatus == 705) {//已完成
} if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
if (ab.ApplicationStatus == 705) {//已完成 return system.getResultFail(-707, "该交付单已在服务中,不能重复提交");
if (deliveryContent.status != "ENGRAVING") { }
return system.getResultFail(-705, "交付流程错误,请先刻章"); }
deliveryContent['DLJZ'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "代理记账",
startTime: startTime || "",
endTime: endTime || "",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
} }
if (deliveryContent.status == "SUCCESS") { //如果存在交付信息的话就去进行逻辑判断
return system.getResultFail(-708, "该方案已完成,不可更改"); if (deliveryContent && deliveryContent[ab.productType] && deliveryContent[ab.productType].status && deliveryContent[ab.productType].deliveryFlowList) {
if (this.regStatus[deliveryContent.ApplicationStatus] && this.regStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus && ab.ApplicationStatus == 705) {
return system.getResultFail(-406, "操作失败,该交付已完成,不能更改");
}
deliveryFlowList = deliveryContent[ab.productType].solutionFlowList || [];
} }
deliveryContent['ApplicationStatus'] = 705; deliveryContent[ab.productType].deliveryFlowList.push({
solutionFlowList.push({ status: ab.ApplicationStatus,
file: ab.OfficialFileURL || "", statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
status: "SUCCESS", statusName: this.regSolutionStatus.SUCCESS, updated_at: new Date() file: ab.officialFile || "",
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss")
}); });
deliveryContent.status = "SUCCESS"; deliveryContent[ab.productType].status = ab.ApplicationStatus
needsolutioninfo.status = "ywc"; deliveryContent[ab.productType].statusName = this.regDeliveryStatusName[ab.ApplicationStatus]
deliveryContent.statusName = this.regSolutionStatus.SUCCESS; deliveryContent[ab.productType].channelStatus = this.regDeliveryStatus[ab.ApplicationStatus]
} }
}else{//公司注册套餐 } else {//如果交付信息不存在
if(ab.productType && ab.productType == "GSZZ"){//工商执照 if (ab.consultType && ab.consultType == "GSREG") {//非套餐
solutionFlowList = needsolutioninfo.solutionContent.solutionFlowList
deliveryContent.solutionFlowList = solutionFlowList;
deliveryContent = needsolutioninfo.solutionContent;
deliveryContent['ApplicationStatus'] = ab.ApplicationStatus
applicationStatusList = deliveryContent.applicationStatusList || [];
if (ab.ApplicationStatus == 702) {//材料收集环节 if (ab.ApplicationStatus == 702) {//材料收集环节
if (needsolutioninfo.solutionContent.status != "PAID") { if (needsolutioninfo.solutionContent.status != "PAID") {
return system.getResultFail(-702, "交付流程错误,请先完成支付"); return system.getResultFail(-702, "交付流程错误,请先完成支付");
...@@ -1266,9 +1429,9 @@ class RegCenterOrderService{ ...@@ -1266,9 +1429,9 @@ class RegCenterOrderService{
} }
if (ab.ApplicationStatus == 703) {//工商审核环节 if (ab.ApplicationStatus == 703) {//工商审核环节
var afterStatusList = [//用户支付后的流程状态 var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING" ,"SUCCESS" "COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
]; ];
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0){ if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0) {
return system.getResultFail(-703, "交付流程错误,请先完成材料收集"); return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
} }
if (deliveryContent.status == "SUCCESS") { if (deliveryContent.status == "SUCCESS") {
...@@ -1281,15 +1444,15 @@ class RegCenterOrderService{ ...@@ -1281,15 +1444,15 @@ class RegCenterOrderService{
}); });
deliveryContent.status = "AUDITING"; deliveryContent.status = "AUDITING";
deliveryContent.statusName = this.regSolutionStatus.AUDITING; deliveryContent.statusName = this.regSolutionStatus.AUDITING;
console.log('deliveryContent-----sss---',deliveryContent) console.log('deliveryContent-----sss---', deliveryContent)
console.log('deliveryContent-----ss+++',typeof(deliveryContent)) console.log('deliveryContent-----ss+++', typeof (deliveryContent))
deliveryContent['deliveryContent'] = deliveryContents deliveryContent['deliveryContent'] = deliveryContents
} }
if (ab.ApplicationStatus == 704) {//刻章环节 if (ab.ApplicationStatus == 704) {//刻章环节
var afterStatusList = [//用户支付后的流程状态 var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING" ,"SUCCESS" "COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
]; ];
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0){ if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0) {
return system.getResultFail(-704, "交付流程错误,请先工商审核"); return system.getResultFail(-704, "交付流程错误,请先工商审核");
} }
if (deliveryContent.status == "SUCCESS") { if (deliveryContent.status == "SUCCESS") {
...@@ -1320,152 +1483,197 @@ class RegCenterOrderService{ ...@@ -1320,152 +1483,197 @@ class RegCenterOrderService{
deliveryContent.statusName = this.regSolutionStatus.SUCCESS; deliveryContent.statusName = this.regSolutionStatus.SUCCESS;
} }
} }
if(ab.productType && (ab.productType == "YHKH" || ab.productType == "SWBD")){//YHKH:银行开户; SWBD:税务报道;只有已接单和已完成状态 if (ab.consultType && ab.consultType == "QYJYTC1" || ab.consultType && ab.consultType == "QYJYTC2") {//公司注册套餐1和公司注册套餐2
if (ab.ApplicationStatus == 705) {//已完成 if (ab.consultType == "QYJYTC1") {
deliveryContent['ApplicationStatus'] = 705; bizTypeName = "企业经营套餐一"
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "SUCCESS", statusName: this.regSolutionStatus.SUCCESS, updated_at: new Date()
});
deliveryContent.status = "SUCCESS";
needsolutioninfo.status = "ywc";
deliveryContent.statusName = this.regSolutionStatus.SUCCESS;
}
}
if(ab.productType && ab.productType == "DZFW"){//地址服务
if (ab.ApplicationStatus == 702) {//材料收集环节
if (needsolutioninfo.solutionContent.status != "PAID") {
return system.getResultFail(-702, "交付流程错误,请先完成支付");
}
deliveryContent['ApplicationStatus'] = 702;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "COLLECTING", statusName: this.regSolutionStatus.COLLECTING, updated_at: new Date()
});
deliveryContent.status = "COLLECTING";
deliveryContent.statusName = this.regSolutionStatus.COLLECTING;
} }
if (ab.ApplicationStatus == 703) {//工商审核环节 if (ab.consultType == "QYJYTC2") {
var afterStatusList = [//用户支付后的流程状态 bizTypeName = "企业经营套餐二"
"COLLECTING", "AUDITING", "ENGRAVING" ,"SUCCESS"
];
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0){
return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
}
if (deliveryContent.status == "SUCCESS") {
return system.getResultFail(-706, "该方案已完成,不可更改");
}
deliveryContent['ApplicationStatus'] = 703;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "AUDITING", statusName: this.regSolutionStatus.AUDITING, updated_at: new Date()
});
deliveryContent.status = "AUDITING";
deliveryContent.statusName = this.regSolutionStatus.AUDITING;
console.log('deliveryContent-----sss---',deliveryContent)
console.log('deliveryContent-----ss+++',typeof(deliveryContent))
deliveryContent['deliveryContent'] = deliveryContents
} }
if (ab.ApplicationStatus == 706) {//服务中 switch (productType) {
var afterStatusList = [//用户支付后的流程状态 case "GSZZ":
"COLLECTING", "AUDITING","SUCCESS" deliveryContent['GSZZ'] = {
]; bizType: ab.consultType,
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0){ bizTypeName: bizTypeName,
return system.getResultFail(-704, "交付流程错误,请先工商审核"); productType: productType,
} productTypeName: "工商执照",
if (deliveryContent.status == "SUCCESS") { status: ab.ApplicationStatus,
return system.getResultFail(-707, "该方案已完成,不可更改"); statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
} channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
deliveryContent['ApplicationStatus'] = 706; customerInfo: needsolutioninfo.solutionContent.customerInfo,
solutionFlowList.push({ update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
file: ab.OfficialFileURL || "", officialFile: ab.officialFile || "",
status: "ACTIVE", statusName: this.regSolutionStatus.ACTIVE, updated_at: new Date() deliveryFlowList: []
}); }
deliveryContent.status = "ACTIVE"; break;
deliveryContent.statusName = this.regSolutionStatus.ACTIVE;
} case "YHKH":
if (ab.ApplicationStatus == 705) {//已完成 deliveryContent['YHKH'] = {
if (deliveryContent.status != "ACTIVE") { bizType: ab.consultType,
return system.getResultFail(-705, "交付流程错误,请先变更状态为服务中"); bizTypeName: bizTypeName,
} productType: productType,
if (deliveryContent.status == "SUCCESS") { productTypeName: "银行开户",
return system.getResultFail(-708, "该方案已完成,不可更改"); status: ab.ApplicationStatus,
} statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
deliveryContent['ApplicationStatus'] = 705; channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
solutionFlowList.push({ update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
file: ab.OfficialFileURL || "", officialFile: ab.officialFile || "",
status: "SUCCESS", statusName: this.regSolutionStatus.SUCCESS, updated_at: new Date() deliveryFlowList: []
}); }
deliveryContent.status = "SUCCESS"; break;
needsolutioninfo.status = "ywc";
deliveryContent.statusName = this.regSolutionStatus.SUCCESS; case "SWBD":
} deliveryContent['SWBD'] = {
} bizType: ab.consultType,
if(ab.productType && ab.productType == "DLJZ"){//代理记账:有已接单,服务中,已完成状态 bizTypeName: bizTypeName,
if (ab.ApplicationStatus == 706) {//服务中 productType: productType,
if (deliveryContent.status == "SUCCESS") { productTypeName: "税务报道",
return system.getResultFail(-707, "该方案已完成,不可更改"); status: ab.ApplicationStatus,
} statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
deliveryContent['ApplicationStatus'] = 706; channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
solutionFlowList.push({ update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
file: ab.OfficialFileURL || "", officialFile: ab.officialFile || "",
status: "ACTIVE", statusName: this.regSolutionStatus.ACTIVE, updated_at: new Date() deliveryFlowList: []
}); }
deliveryContent.status = "ACTIVE"; break;
deliveryContent.statusName = this.regSolutionStatus.ACTIVE;
} case "DLJZ":
if (ab.ApplicationStatus == 705) {//已完成 deliveryContent['DLJZ'] = {
deliveryContent['ApplicationStatus'] = 705; bizType: ab.consultType,
solutionFlowList.push({ bizTypeName: bizTypeName,
file: ab.OfficialFileURL || "", productType: productType,
status: "SUCCESS", statusName: this.regSolutionStatus.SUCCESS, updated_at: new Date() productTypeName: "代理记账",
}); status: ab.ApplicationStatus,
deliveryContent.status = "SUCCESS"; statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
needsolutioninfo.status = "ywc"; channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
deliveryContent.statusName = this.regSolutionStatus.SUCCESS; update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
break;
case "DZFW":
deliveryContent['DZFW'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "地址服务",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
break;
} }
} }
} }
//2021-5-18 新增百度公司注册与公司注册套餐区分 end
deliveryContent.solutionFlowList = solutionFlowList;
var applicationStatusList = deliveryContent.applicationStatusList || [];
var statusObj = {
"OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.regSolutionStatus[ab.ApplicationStatus],
"created_at": new Date()
};
applicationStatusList.push(statusObj);
deliveryContent.applicationStatusList = applicationStatusList;
deliveryContent["applicationStatus"] = ab.applicationStatus;
deliveryContent = JSON.stringify(deliveryContent); deliveryContent = JSON.stringify(deliveryContent);
let orderdeliveryData = { let orderdeliveryData = {
sourceOrderNo : ab.orderNo, sourceOrderNo: ab.orderNo,
deliveryContent : deliveryContent, deliveryContent: deliveryContent,
} }
if(!orderdeliveryInfo[0]){ if (!orderdeliveryInfo[0]) {
let sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUES (:sourceOrderNo,:deliveryContent)"; let sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUES (:sourceOrderNo,:deliveryContent)";
var orderdelivery = await this.orderdeliveryDao.customInsert(sql, orderdeliveryData); var orderdelivery = await this.orderdeliveryDao.customInsert(sql, orderdeliveryData);
}else{ } else {
let sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + deliveryContent + "' where sourceOrderNo='" + ab.orderNo + "'"; let sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + deliveryContent + "' where sourceOrderNo='" + ab.orderNo + "'";
var orderdelivery = await this.orderdeliveryDao.customInsert(sql); var orderdelivery = await this.orderdeliveryDao.customInsert(sql);
} }
let orderdeliveryQuery = "SELECT * from `c_order_delivery` where sourceOrderNo='" + ab.orderNo + "'"; let orderdeliveryQuery = "SELECT * from `c_order_delivery` where sourceOrderNo='" + ab.orderNo + "'";
let QueryDatas = { let QueryDatas = {
sourceOrderNo:ab.orderNo sourceOrderNo: ab.orderNo
} }
orderdelivery = await this.orderdeliveryDao.customQuery(orderdeliveryQuery,QueryDatas) orderdelivery = await this.orderdeliveryDao.customQuery(orderdeliveryQuery, QueryDatas)
console.log('orderdelivery++orderdelivery++++++',orderdelivery) console.log('orderdelivery++orderdelivery++++++', orderdelivery)
if(orderdelivery){ //todo 推送云服订单所有交付单状态为完成时订单状态为完成的判断 以下所有注释都是相关代码
// let gszzDeliveryStatus
// let yhkhDeliveryStatus
// let swbdDeliveryStatus
// let gszzDeliveryStatus2
// let yhkhDeliveryStatus2
// let swbdDeliveryStatus2
// let dljzDeliveryStatus2
// let dzfwDeliveryStatus2
// let update_at = new Date().Format("yyyy-MM-dd hh:mm:ss")
// var deliveryFlag
// var deliveryFlag2
if (orderdelivery) {
orderdelivery = orderdelivery[0] orderdelivery = orderdelivery[0]
orderdelivery["bizId"] = ab.bizId; orderdelivery["bizId"] = ab.bizId;
orderdelivery['uapp_id'] = uappId; orderdelivery['uapp_id'] = uappId;
orderdelivery['channelOrderNo'] = channelOrderNo; orderdelivery['channelOrderNo'] = channelOrderNo;
// if (ab.consultType && ab.consultType == "QYJYTC1") {
// switch (ab.productType) {
// case "GSZZ":
// if (deliveryContent["GSZZ"] && deliveryContent["GSZZ"].status == 705) {
// gszzDeliveryStatus = 705
// }
// break;
// case "YHKH":
// if (deliveryContent["YHKH"] && deliveryContent["YHKH"].status == 705) {
// yhkhDeliveryStatus = 705
// }
// break;
// case "SWBD":
// if (deliveryContent["SWBD"] && deliveryContent["SWBD"].status == 705) {
// swbdDeliveryStatus = 705
// }
// break;
// }
// if (gszzDeliveryStatus && yhkhDeliveryStatus && swbdDeliveryStatus && 705 == swbdDeliveryStatus == yhkhDeliveryStatus == gszzDeliveryStatus) {
// let sql = "UPDATE `c_order_info` SET orderStatusName ='已完成',orderStatus= 8,updated_at='" + update_at + "' where orderNo ='" + ab.orderNo + "'";
// let updateOrderInfo = await this.orderdeliveryDao.customInsert(sql);
// if (updateOrderInfo) {
// deliveryFlag = 200
// orderdelivery['deliveryFlag'] = deliveryFlag;
// }
// }
// }
// if (ab.consultType && ab.consultType == "QYJYTC2") {
// switch (ab.productType) {
// case "GSZZ":
// if (deliveryContent["GSZZ"] && deliveryContent["GSZZ"].status == 705) {
// gszzDeliveryStatus2 = 705
// }
// break;
// case "YHKH":
// if (deliveryContent["YHKH"] && deliveryContent["YHKH"].status == 705) {
// yhkhDeliveryStatus2 = 705
// }
// break;
// case "SWBD":
// if (deliveryContent["SWBD"] && deliveryContent["SWBD"].status == 705) {
// swbdDeliveryStatus2 = 705
// }
// break;
// case "DLJZ":
// if (deliveryContent["DLJZ"] && deliveryContent["DLJZ"].status == 705) {
// dljzDeliveryStatus2 = 705
// }
// break;
// case "DZFW":
// if (deliveryContent["DZFW"] && deliveryContent["DZFW"].status == 705) {
// dzfwDeliveryStatus2 = 705
// }
// break;
// }
// if (gszzDeliveryStatus2 && yhkhDeliveryStatus2 && swbdDeliveryStatus2 && dljzDeliveryStatus2 && dzfwDeliveryStatus2 && 705 == swbdDeliveryStatus2 == yhkhDeliveryStatus2 == gszzDeliveryStatus2 == dljzDeliveryStatus2 == dzfwDeliveryStatus2) {
// let sql2 = "UPDATE `c_order_info` SET orderStatusName ='已完成',orderStatus= 8,updated_at='" + update_at + "' where orderNo ='" + ab.orderNo + "'";
// let updateOrderInfo2 = await this.orderdeliveryDao.customInsert(sql2);
// if (updateOrderInfo2) {
// deliveryFlag2 = 200
// orderdelivery['deliveryFlag2'] = deliveryFlag2;
// }
// }
// }
} }
console.log('orderdelivery++',orderdelivery) console.log('orderdelivery++', orderdelivery)
return system.getResultSuccess(orderdelivery); return system.getResultSuccess(orderdelivery);
} }
} }
module.exports = RegCenterOrderService; module.exports = RegCenterOrderService;
\ No newline at end of file
...@@ -41,13 +41,26 @@ class ExecClient { ...@@ -41,13 +41,26 @@ class ExecClient {
console.log(cmd); console.log(cmd);
return cmd; return cmd;
} }
Fetch360TokenCmd(subData,url){ Fetch360TokenCmd(subData, url) {
let cmd = this.cmd360Token.replace( let cmd = this.cmd360Token.replace(
/\{data\}/g, subData).replace(/\{url\}/g, url); /\{data\}/g, subData).replace(/\{url\}/g, url);
console.log(cmd); console.log(cmd);
return cmd; return cmd;
} }
async execPost(subData, url) { async execPost(subData, url) {
//本机windows curl json格式
// if (settings.env == 'dev') {
// const rs = await axios.post(url, subData, {
// auth: {
// username: "admines",
// password: "adminGSBes"
// }
// });
// const ret = {
// stdout: JSON.stringify(rs.data)
// }
// return ret;
// }
let cmd = this.FetchPostCmd(subData, url); let cmd = this.FetchPostCmd(subData, url);
var result = await this.exec(cmd); var result = await this.exec(cmd);
return result; return result;
...@@ -62,9 +75,9 @@ class ExecClient { ...@@ -62,9 +75,9 @@ class ExecClient {
var result = await this.exec2(cmd); var result = await this.exec2(cmd);
return result; return result;
} }
async exec360GetToken(url){ async exec360GetToken(url) {
const qs = require('qs') const qs = require('qs')
let obj = {"scope":"smart_business","grant_type":"client_credentials"} let obj = { "scope": "smart_business", "grant_type": "client_credentials" }
// if(settings.env == 'dev'){ // if(settings.env == 'dev'){
// const rs = await axios({ // const rs = await axios({
// method: 'post', // method: 'post',
...@@ -80,7 +93,7 @@ class ExecClient { ...@@ -80,7 +93,7 @@ class ExecClient {
// } // }
// return ret; // return ret;
// } // }
let cmd = this.Fetch360TokenCmd(qs.stringify(obj),url); let cmd = this.Fetch360TokenCmd(qs.stringify(obj), url);
console.log(cmd); console.log(cmd);
var result = await this.exec(cmd); var result = await this.exec(cmd);
return result; return result;
......
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