Commit 14a74b1d by 兰国旗

laolan

parent ac1f05db
...@@ -34,6 +34,13 @@ class RegAPI extends APIBase { ...@@ -34,6 +34,13 @@ class RegAPI extends APIBase {
case "regReceiveSolutionPayInfo"://接收reg方案状态及支付信息(方案支付后创建订单时调用) case "regReceiveSolutionPayInfo"://接收reg方案状态及支付信息(方案支付后创建订单时调用)
opResult = await this.regCenterOrderSve.regReceiveSolutionPayInfo(pobj); opResult = await this.regCenterOrderSve.regReceiveSolutionPayInfo(pobj);
break; break;
case "selectNeedInfo"://查询需求信息
opResult = await this.regCenterOrderSve.selectNeedInfo(pobj);
break;
case "regOrderClose"://关闭订单
opResult = await this.regCenterOrderSve.regOrderClose(pobj);
break;
case "regFeedbackSubmit"://接收需求反馈 百度reg 2.2 case "regFeedbackSubmit"://接收需求反馈 百度reg 2.2
opResult = await this.regCenterOrderSve.regFeedbackSubmit(pobj); opResult = await this.regCenterOrderSve.regFeedbackSubmit(pobj);
break; break;
......
...@@ -8,7 +8,7 @@ class RegCenterOrderService{ ...@@ -8,7 +8,7 @@ class RegCenterOrderService{
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': '已接单',
...@@ -16,7 +16,8 @@ class RegCenterOrderService{ ...@@ -16,7 +16,8 @@ class RegCenterOrderService{
'AUDITING': '工商审核环节', 'AUDITING': '工商审核环节',
'ENGRAVING': '刻章环节', 'ENGRAVING': '刻章环节',
'SUCCESS': '已完成', 'SUCCESS': '已完成',
'PAID':'已支付' 'PAID':'已支付',
"CLOSE" : "已关闭"
}; };
//工商注册状态 //工商注册状态
...@@ -29,6 +30,32 @@ class RegCenterOrderService{ ...@@ -29,6 +30,32 @@ class RegCenterOrderService{
'SUCCESS': 705 //已完成 'SUCCESS': 705 //已完成
} }
} }
// 获取需求详情
async selectNeedInfo(pobj){
pobj.actionType = "selectNeedInfo"
if(pobj.actionBody.orderNo){
var orderinfo = await this.orderinfoDao.findOne({ channelOrderNo: pobj.actionBody.orderNo });
if (!orderinfo || !orderinfo.orderNo) {
return system.getResult(null, "订单数据为空,30210");
}
var needsolution = await this.needsolutionDao.findOne({ orderNo: orderinfo.orderNo });
if (!needsolution || !needsolution.channelSolutionNo) {
return system.getResult(null, "方案数据为空,30211");
}
var needinfo = await this.needinfoDao.findOne({ channelNeedNo: needsolution.channelNeedNo });
if (!needinfo || !needinfo.channelNeedNo) {
return system.getResult(null, "需求数据为空,30212");
}
}
if(pobj.actionBody.channelNeedNo){
var needinfo = await this.needinfoDao.findOne({ channelNeedNo: pobj.actionBody.channelNeedNo });
if (!needinfo || !needinfo.channelNeedNo) {
return system.getResult(null, "需求数据为空,30213");
}
}
return system.getResultSuccess(needinfo);
}
//提交需求 //提交需求
async submitRegNeed(pobj, actionBody, req) { async submitRegNeed(pobj, actionBody, req) {
var needNo = await this.getBusUid("n"); var needNo = await this.getBusUid("n");
...@@ -110,13 +137,14 @@ class RegCenterOrderService{ ...@@ -110,13 +137,14 @@ class RegCenterOrderService{
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findAll({
where: { channelNeedNo: ab.intentionBizId, isInvalid: 0 }, raw: true where: { channelNeedNo: ab.intentionBizId, isInvalid: 0 }, raw: true
}); });
var intentionStatusList = ["未知", "⽅案待服务商确认", "⽅案待⽤户确认", "处理中", "已完成", "已关闭"]; var intentionStatusList = ["未知", "⽅案待服务商确认", "⽅案待⽤户确认", "处理中", "已完成", "已关闭"];
var updateObj = {}; var updateObj = {};
var solutionContent; var solutionContent;
var i; var i;
var nsLength
var needData = {id: needinfo.id}; var needData = {id: needinfo.id};
if (!ns) { if (!ns) {
//如果没有方案直接关闭需求,更新需求状态 //如果没有方案直接关闭需求,更新需求状态
...@@ -125,11 +153,12 @@ class RegCenterOrderService{ ...@@ -125,11 +153,12 @@ class RegCenterOrderService{
needData['status'] = 'ygb' needData['status'] = 'ygb'
} }
if(ab.intentionStatus == 1){ if(ab.intentionStatus == 1){
needData["status"] = "ybh"; needData["status"] = "ygb";
} }
await this.needinfoDao.update(needData);//更新状态修改 await this.needinfoDao.update(needData);//更新状态修改
} }
}else{ }else{
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
...@@ -141,6 +170,7 @@ class RegCenterOrderService{ ...@@ -141,6 +170,7 @@ class RegCenterOrderService{
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) {
...@@ -185,10 +215,21 @@ class RegCenterOrderService{ ...@@ -185,10 +215,21 @@ class RegCenterOrderService{
//渠道方案号获取需求详情 //渠道方案号获取需求详情
async getItemByChannelSolutionNo(pobj) { async getItemByChannelSolutionNo(pobj) {
console.log('getItemByChannelSolutionNo---',pobj) console.log('getItemByChannelSolutionNo---',pobj)
var solutionitem = await this.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.channelSolutionNo }); if(pobj.actionBody.channelSolutionId ){
console.log('solutionitem---',pobj) var solutionitem = await this.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.channelSolutionId });
if (!solutionitem) { console.log('solutionitem---',solutionitem)
return system.getResult(null, "方案数据为空,30210"); if (!solutionitem) {
return system.getResult(null, "方案数据为空,30210");
}
}
if(pobj.actionBody.orderNo ){
var orderinfo = await this.orderinfoDao.findOne({ channelOrderNo: pobj.actionBody.orderNo });
if(orderinfo){
var solutionitem = await this.needsolutionDao.findOne({ orderNo: orderinfo.orderNo });
}
if (!solutionitem) {
return system.getResult(null, "方案数据为空,30210");
}
} }
var item = await this.needinfoDao.getItemByNeedNo(solutionitem.needNo); var item = await this.needinfoDao.getItemByNeedNo(solutionitem.needNo);
if (!item) { if (!item) {
...@@ -214,14 +255,14 @@ class RegCenterOrderService{ ...@@ -214,14 +255,14 @@ class RegCenterOrderService{
return system.getResultSuccess(); return system.getResultSuccess();
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findAll({ var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId, isInvalid: 0 }, raw: true where: { channelSolutionNo: ab.channelSolutionId, isInvalid: 0 }, raw: true
}); });
if (!ns) { if (!ns) {
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[0].needNo }, raw: true where: { needNo: ns.needNo }, raw: true
}); });
if (!needinfo) { if (!needinfo) {
return system.getResultFail(-104, "未知方案需求"); return system.getResultFail(-104, "未知方案需求");
...@@ -390,7 +431,7 @@ class RegCenterOrderService{ ...@@ -390,7 +431,7 @@ class RegCenterOrderService{
}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.channelSolutionNo,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, "未知方案");
...@@ -516,78 +557,61 @@ class RegCenterOrderService{ ...@@ -516,78 +557,61 @@ class RegCenterOrderService{
} }
//交付商关闭交付 //关闭订
async ncCloseOrderDelivery(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, "渠道订单号不能为空");
} }
if (!ab.note) { var orderInfo = await this.orderinfoDao.model.findOne({
return system.getResultFail(-106, "关闭理由不能为空"); where:{channelOrderNo:ab.orderNo},raw:true
} else {
ab.note = ab.note;
}
var ns = await this.needsolutionDao.model.findOne({
where: { orderNo: ab.orderNo }, raw: true
}); });
if (!orderInfo || !orderInfo.id) {
if (!ns || !ns.id) { return system.getResultFail(-103, "未知订单");
return system.getResultFail(-301, "未知方案");
}
ab["bizId"] = ns.channelSolutionNo;
pobj.actionBody = ab;
return this.ncAbolishProgramme(pobj);
}
//服务商作废方案-- ncAbolishProgramme
async ncAbolishProgramme(pobj) {
var ab = pobj.actionBody;
var user = pobj.userInfo;
if (!user || !user.id) {
return system.getResultFail(-100, "未知用户");
}
if (!ab.bizId) {
return system.getResultFail(-101, "渠道方案号不能为空");
}
if (!ab.note) {
return system.getResultFail(-106, "关闭理由不能为空");
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.bizId, isInvalid: 0 }, raw: true where: { orderNo: orderInfo.orderNo, isInvalid: 0 }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-300, "未知方案"); 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) {
return system.getResultFail(-400, "未知方案需求");
}
if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-401, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
// if (ns.status != "dqr") {
// return system.getResultFail(-301, "方案状态错误,只能废弃待确认方案");
// }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
if (!solutionContent.status || ["MATERIAL_UNCONFIRM", "AUDITING", "SUBMITTED"].indexOf(solutionContent.status) < 0) { var checkStatus = {
return system.getResultFail(-302, "方案流程状态错误,不能执行此操作"); COLLECTING: "材料收集环节", AUDITING: "工商审核环节",
ENGRAVING: "刻章环节", SUCCESS: "已完成"
};
if (solutionContent.status && checkStatus[solutionContent.status]) {
return system.getResultFail(-111, "方案已进入" + solutionContent.statusName + "流程,不能执行此操作");
} }
solutionContent.serviceProviderNote = ab.note; //方案流程列表
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({ solutionFlowList.push({
status: "CLOSE", statusName: this.regSolutionStatus.CLOSE, updated_at: new Date() status: "CLOSE", statusName: this.regSolutionStatus.CLOSE, updated_at: new Date()
}); });
solutionContent.status = "CLOSE"; solutionContent.status = "CLOSE";
solutionContent.statusName = this.regSolutionStatus.CLOSE; solutionContent.statusName = this.regSolutionStatus.CLOSE;
solutionContent.solutionFlowList = solutionFlowList;
if (ab.remark) {
solutionContent.customerRemark = ab.remark;
}
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
await this.needsolutionDao.update({ id: ns.id, status: "yzf", isInvalid: 1, solutionContent: solutionContent });//方案废弃 var updateObj = {
//获取方案信息 id: ns.id, solutionContent: solutionContent,status:"yzf",isInvalid:1
var new_ns = await this.needsolutionDao.model.findOne({ };
where: { id: ns.id }, raw: true var self = this;
}); return await this.needsolutionDao.db.transaction(async function (t) {
return system.getResultSuccess(new_ns); await self.needsolutionDao.update(updateObj);//方案状态修改
// await this.orderinfoDao.update({id:orderInfo.id,orderStatus:16});//订单状态修改
var new_ns = await self.needsolutionDao.model.findOne({
where: { id: ns.id }, raw: true
});
return system.getResultSuccess(new_ns);
})
} }
//------------3. //------------3.
...@@ -642,7 +666,7 @@ class RegCenterOrderService{ ...@@ -642,7 +666,7 @@ class RegCenterOrderService{
//查询对应类型方案是否有提交,提交过的不能重复提交 //查询对应类型方案是否有提交,提交过的不能重复提交
var ns = await this.needsolutionDao.model.findAll({ var ns = await this.needsolutionDao.model.findAll({
where: { channelNeedNo: ab.needNo }, raw: true, order: [["id", 'asc']] where: { channelNeedNo: ab.needNo ,isInvalid: 0 }, raw: true, order: [["id", 'asc']]
}); });
console.log('ns----', ns) console.log('ns----', ns)
var nsRegType = []; var nsRegType = [];
...@@ -651,11 +675,7 @@ class RegCenterOrderService{ ...@@ -651,11 +675,7 @@ class RegCenterOrderService{
for (l = 0; l < nsLength; l++) { for (l = 0; l < nsLength; l++) {
nsRegType.push(ns[l].solutionContent.solution.regType) nsRegType.push(ns[l].solutionContent.solution.regType)
} }
// var flag = nsRegType.indexOf(solutionType);
// console.log('flag---',flag)
// if(flag > 0){
// return "该方案已创建";
// }
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)
...@@ -882,31 +902,6 @@ class RegCenterOrderService{ ...@@ -882,31 +902,6 @@ class RegCenterOrderService{
} }
} }
//根据需求查看方案列表
async regGetInfoByChannelNeedNo(pobj) {
var ab = pobj.actionBody;
var user = pobj.userInfo;
if (!user || !user.id) {
return system.getResultFail(-100, "未知用户");
}
ab["createUserId"] = user.id;
if (!ab.needNo) {
return system.getResultFail(-101, "需求号不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where: { channelNeedNo: ab.needNo }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-102, "未知需求信息");
}
var ns = await this.needsolutionDao.model.findAll({
where: { needNo: needinfo.needNo }, raw: true,
attributes: ["needNo", "solutionNo", "channelSolutionNo", "orderNo", "solutionContent", "status", "statusName"]
});
return system.getResultSuccess(ns);
}
//根据需求关闭reg需求/方案 //根据需求关闭reg需求/方案
async regNeedClose(pobj) { async regNeedClose(pobj) {
console.log("regNeedClose+++",pobj) console.log("regNeedClose+++",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