Commit 8ccd9019 by 兰国旗

laolan

parent fe5719ca
//工商注册
var APIBase = require("../../api.base");
var system = require("../../../system");
class BaiduReg extends APIBase {
class RegAPI extends APIBase {
constructor() {
super();
this.regCenterOrder = system.getObject("service.qcutils.regCenterOrder");
this.regCenterOrderSve = system.getObject("service.qcutils.regCenterOrderSve");
}
/**
* 接口跳转-POST请求
......@@ -32,34 +32,35 @@ class BaiduReg extends APIBase {
var opResult = null;
switch (action_type) {
case "receiveSolutionPayInfoNew"://接收reg方案状态及支付信息(方案支付后创建订单时调用)
opResult = await this.regCenterOrder.receiveSolutionPayInfoNew(pobj);
opResult = await this.regCenterOrderSve.receiveSolutionPayInfoNew(pobj);
break;
case "getItemByChannelSolutionNo"://渠道方案号获取需求详情
opResult = await this.regCenterOrder.getItemByChannelSolutionNo(pobj, pobj.actionBody, req);
opResult = await this.regCenterOrderSve.getItemByChannelSolutionNo(pobj, pobj.actionBody, req);
break;
case "getRegOrderStatus"://接收订单状态推送 百度reg 2.3
opResult = await this.regCenterOrder.getRegOrderStatus(pobj);
opResult = await this.regCenterOrderSve.getRegOrderStatus(pobj);
break;
case "addRegSalesmanInfo"://添加业务员信息,用于直接下单的reg订单
opResult = await this.regCenterOrder.addRegSalesmanInfo(pobj);
opResult = await this.regCenterOrderSve.addRegSalesmanInfo(pobj);
break;
case "submitRegNeed"://提交需求
opResult = await this.regCenterOrder.submitRegNeed(pobj, pobj.actionBody, req);
opResult = await this.regCenterOrderSve.submitRegNeed(pobj, pobj.actionBody, req);
break;
case "submitBdRegSolution"://方案提交
opResult = await this.regCenterOrder.submitBdRegSolution(pobj);
case "submitRegSolution"://方案提交
opResult = await this.regCenterOrderSve.submitRegSolution(pobj);
break;
case "writeRegCommunicationLog"://新增沟通记录
opResult = await this.regCenterOrder.writeRegCommunicationLog(pobj);
opResult = await this.regCenterOrderSve.writeRegCommunicationLog(pobj);
break;
case "queryExpertRegCommunicationLogs"://获取沟通记录
opResult = await this.regCenterOrder.queryExpertRegCommunicationLogs(pobj);
opResult = await this.regCenterOrderSve.queryExpertRegCommunicationLogs(pobj);
break;
case "updateOrdertatus"://提交交付信息/修改订单状态
opResult = await this.regCenterOrder.updateOrdertatus(pobj);
case "updateRegOrdertatus"://提交交付信息/修改订单状态
opResult = await this.regCenterOrderSve.updateRegOrdertatus(pobj);
break;
case "closeBdRegNeed"://需求关闭
opResult = await this.regCenterOrder.closeBdRegNeed(pobj);
case "closeRegNeed"://需求关闭
opResult = await this.regCenterOrderSve.closeRegNeed(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
......@@ -68,4 +69,4 @@ class BaiduReg extends APIBase {
return opResult;
}
}
module.exports = BaiduReg;
\ No newline at end of file
module.exports = RegAPI;
\ No newline at end of file
......@@ -312,8 +312,8 @@ class regCenterOrderService {
}
//提交方案
async submitBdRegSolution(pobj) {
console.log("pobj++submitBdRegSolution++",pobj)
async submitRegSolution(pobj) {
console.log("pobj++submitRegSolution++",pobj)
var ab = pobj.actionBody;
var user = pobj.userInfo;
if (!user || !user.id) {
......@@ -323,9 +323,15 @@ class regCenterOrderService {
if (!ab.needNo) {
return system.getResultFail(-101, "渠道需求号不能为空");
}
if (!ab.solutionContent) {
var i=0;
if(ab.solutionList){
var solutionListLength = ab.solutionList.length;
}
for(i=0;i<solutionListLength;i++){
if (!ab.solutionList[i].solutionContent) {
return system.getResultFail(-102, "方案信息有误");
}
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where: { channelNeedNo: ab.needNo }, raw: true
......@@ -337,61 +343,52 @@ class regCenterOrderService {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能创建方案");
}
var bizType = needinfo.typeCode;//ab.solutionContent.bizType;//业务类型
ab.solutionContent.bizType = bizType;
if (!bizType) {
return system.getResultFail(-205, "方案类型错误");
}
if (!needinfo.channelTypeCode) {
return system.getResultFail(-206, "渠道方案类型错误");
}
ab.solutionContent.typeCode = needinfo.typeCode;
ab.solutionContent.typeName = needinfo.typeName;
var needsolutions = [];//最后返回结果用
var j=0;
for(j=0;j<solutionListLength;j++){
if (ab.solutionList[j].solutionContent) {
ab.solutionList[j].solutionContent.bizType = bizType;
ab.solutionList[j].solutionContent.typeCode = needinfo.typeCode;
ab.solutionList[j].solutionContent.typeName = needinfo.typeName;
var ns = await this.needsolutionDao.model.findAll({
where: { channelNeedNo: ab.needNo }, raw: true, order: [["id", 'asc']]
});
for (var i = 0; i < ns.length; i++) {
var fa = ns[i];
if (fa.status == "dqr" || fa.status == "ywc") {
return system.getResultFail(-207, "需求方案已存在,不能重复提交");
}
var k = 0;
for (k = 0; k < ns.length; k++) {
var fa = ns[k];
// if (fa.status == "dqr" || fa.status == "ywc") {
// return system.getResultFail(-207, "需求方案已存在,不能重复提交");
// }
if (fa.status == "ybh") {
ab.channelSolutionNo = fa.channelSolutionNo;
ab.solutionList[j].channelSolutionNo = fa.channelSolutionNo;
}
if (fa.status == "yzf") {
ab.channelSolutionNo = "";
}
}
var solution = ab.solutionContent.solution;
if (!solution) {
return system.getResultFail(-103, "方案交付信息有误");
}
if (!needinfo.channelTypeCode) {
return system.getResultFail(-104, "需求业务类型有误");
ab.solutionList[j].channelSolutionNo = "";
}
if (!solution.CompanyName) {
return system.getResultFail(-105, "公司名不能为空");
}
if (!solution.LicenseType) {
return system.getResultFail(-106, "业务类型不能为空");
}
if (!solution.Area) {
return system.getResultFail(-107, "区域不能为空");
}
if (!solution.ActionType) {
return system.getResultFail(-108, "办理类型不能为空");
}
var solutionFlowList = ab.solutionContent.solutionFlowList || [];
// var solution = ab.solutionList[j].solutionContent.solution;
var solutionFlowList = ab.solutionList[j].solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "SOLUTION_SUBMIT", statusName: this.regSolutionStatus.SOLUTION_SUBMIT, updated_at: new Date()
});
ab.solutionContent.status = "SOLUTION_SUBMIT";
ab.solutionContent.statusName = this.regSolutionStatus.SOLUTION_SUBMIT;
ab.solutionContent.solutionFlowList = solutionFlowList;
ab["channelNeedNo"] = needinfo.channelNeedNo;
var solutionNo = await this.getBusUid("ns");
ab["solutionNo"] = solutionNo;
ab["status"] = "dqr";
ab.solutionList[j].solutionContent.status = "SOLUTION_SUBMIT";
ab.solutionList[j].solutionContent.statusName = this.regSolutionStatus.SOLUTION_SUBMIT;
ab.solutionList[j].solutionContent.solutionFlowList = solutionFlowList;
ab.solutionList[j]["channelNeedNo"] = needinfo.channelNeedNo;
// var solutionNo = await this.getBusUid("ns");//chuangjian
var solutionNo = [];//chuangjian
solutionNo[j] = await this.getBusUid("ns")
console.log('solutionNo[j]----',solutionNo[j])
ab.solutionList[j]["solutionNo"] = solutionNo[j];
ab.solutionList[j]["status"] = "dqr";
var customerInfo = {//客户信息
"publishName": needinfo.publishName,
"publishMobile": needinfo.publishMobile
......@@ -402,14 +399,15 @@ class regCenterOrderService {
"salesmanId": user.id,
"salesmanChannelId": user.channel_userid
};
ab.solutionContent["customerInfo"] = customerInfo;
ab.solutionContent["salesmanInfo"] = salesmanInfo;
ab.solutionContent.solution.SolutionPrice = (ab.solutionContent.solution.SolutionPrice) / 100 || "";//分转元
ab.solutionContent = JSON.stringify(ab.solutionContent);
ab.solutionList[j].solutionContent["customerInfo"] = customerInfo;
ab.solutionList[j].solutionContent["salesmanInfo"] = salesmanInfo;
ab.solutionList[j].solutionContent.solution.solutionPrice = (ab.solutionList[j].solutionContent.solution.solutionPrice) / 100 || "";//分转元
ab.solutionList[j].solutionContent = JSON.stringify(ab.solutionList[j].solutionContent);
console.log('abababab---+++---++',ab)
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) {
ab["needNo"] = needinfo.needNo;
var od = await self.needsolutionDao.create(ab, t);
var res = await this.needsolutionDao.db.transaction(async function (t) {
ab.solutionList[j]["needNo"] = needinfo.needNo;
var od = await self.needsolutionDao.create(ab.solutionList[j], t);
if (od && od.id) {
var needObj = {
id: needinfo.id
......@@ -426,7 +424,7 @@ class regCenterOrderService {
if (!needinfo.followContent) {
var followContent = [{
followDate: new Date(),
content: "nc提交方案"
content: "reg提交方案"
}];
followContent = JSON.stringify(followContent);
needObj["followContent"] = followContent;
......@@ -435,12 +433,20 @@ class regCenterOrderService {
needinfo = await self.needinfoDao.model.findOne({
where: { id: needinfo.id }, raw: true
});
return system.getResultSuccess({ needinfo: needinfo, needsolution: od });
} else {
return system.getResultFail(-302, "提交方案失败");
// return system.getResultSuccess({ needinfo: needinfo, needsolution: od });
needsolutions.push(od.dataValues)
console.log('needsolutions-------',needsolutions)
}
// else {
// return system.getResultFail(-302, "提交方案失败");
// }
})
}
}
return system.getResultSuccess({ needinfo: needinfo,needsolutions: needsolutions });
}
//交付商通知状态变更
async ncNotification(pobj) {
......
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