Commit 052d61b2 by linboxuan

update OpSubmitNeed

parent 80e8813e
...@@ -4,7 +4,7 @@ var settings = require("../../../../config/settings"); ...@@ -4,7 +4,7 @@ var settings = require("../../../../config/settings");
class OpNeed extends APIBase { class OpNeed extends APIBase {
constructor() { constructor() {
super(); super();
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve"); this.utilsOpNeedSve = system.getObject("service.utilsSve.utilsOpNeedSve");
this.centerorderSve = system.getObject("service.common.centerorderSve"); this.centerorderSve = system.getObject("service.common.centerorderSve");
} }
...@@ -26,23 +26,22 @@ class OpNeed extends APIBase { ...@@ -26,23 +26,22 @@ class OpNeed extends APIBase {
} }
async opActionProcess(pobj, action_process, action_type, action_body, req) { async opActionProcess(pobj, action_process, action_type, action_body, req) {
pobj.requestId = req.requestId; pobj.requestId = req.requestId;
var self = this;
var opResult = null; var opResult = null;
switch (action_type) { switch (action_type) {
case "submitNeed"://提交需求 case "submitNeed"://提交需求 2020 0807 lin 新增
opResult = await this.utilsNeedSve.submitNeed(pobj, pobj.actionBody); opResult = await this.utilsOpNeedSve.submitNeed(pobj, pobj.actionBody);
break;
case "needList"://需求列表
opResult = await this.utilsOpNeedSve.needList(pobj, pobj.actionBody);
break; break;
// case "submitNeed"://需求列表
// opResult = await this.utilsNeedSve.submitNeed(pobj, pobj.actionBody);
// break;
case "needClose"://关闭需求 case "needClose"://关闭需求
opResult = await this.utilsNeedSve.needClose(pobj, pobj.actionBody); opResult = await this.utilsOpNeedSve.needClose(pobj, pobj.actionBody);
break; break;
case "needDetailByChannelNo"://需求详情--包含方案 case "needDetailByChannelNo"://需求详情--包含方案
opResult = await this.utilsNeedSve.needDetailByChannelNo(pobj, pobj.actionBody); opResult = await this.utilsOpNeedSve.needDetailByChannelNo(pobj, pobj.actionBody);
break; break;
// case "getItemByChannelNeedNo"://方案反馈 // case "getItemByChannelNeedNo"://方案反馈
// opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj, pobj.actionBody); // opResult = await this.utilsOpNeedSve.getItemByChannelNeedNo(pobj, pobj.actionBody);
// break; // break;
// case "receiveFeedback"://关闭方案 // case "receiveFeedback"://关闭方案
// opResult = await this.centerorderSve.reqCenterOrderApi(pobj); // opResult = await this.centerorderSve.reqCenterOrderApi(pobj);
......
...@@ -3,7 +3,8 @@ var settings = require("../../../../config/settings"); ...@@ -3,7 +3,8 @@ var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base"); const AppServiceBase = require("../../app.base");
const fs = require("fs"); const fs = require("fs");
const { json } = require("sequelize"); const { json } = require("sequelize");
//需求操作类----ali对接的需求 // 2020 0807 lin 新增 需求相关
// 接口文档地址:
class UtilsOpNeedService extends AppServiceBase { class UtilsOpNeedService extends AppServiceBase {
constructor() { constructor() {
super(); super();
...@@ -17,111 +18,31 @@ class UtilsOpNeedService extends AppServiceBase { ...@@ -17,111 +18,31 @@ class UtilsOpNeedService extends AppServiceBase {
} }
/** /**
* 提交需求 * 提交需求 h5/pc 通用
* @param {*} pobj * @param {*} pobj
* @param {*} actionBody * @param {*} actionBody
*/ */
async submitNeed(pobj, actionBody) { async submitNeed(pobj, actionBody) {
if (!actionBody.intentionBizId) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100380");
}
var sobj = pobj;
sobj.actionType = "getProductTypeInfo";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var rtn = await this.execClient.execPost(sobj, url);
if (!rtn || !rtn.stdout) {
return system.getResultFail(-5015, "需求類型查询失败");
}
var data = JSON.parse(rtn.stdout);
if (data.status != 0) {
return system.getResultFail(-5015, "需求類型查询失败");
}
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
pobj.actionBody.channel_type_name = data.data.channel_type_name;
pobj.actionType = "submitNeed";
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
if (pobj.actionBody.channel_type_code == "esp.companyreg") {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedBusiness");
} else {
if (pobj.actionBody.channel_type_code == 5) {
pobj.actionBody.type = "ali.icp";
} else {
pobj.actionBody.type = "ali.edi";
}
var reqParams = {
actionBody: pobj.actionBody,
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "addChance");
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedICPBusiness");
}
}
return result;
}
//调用center-order icp需求反馈
async reqCenterOrderQcApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/qcapi/springBoard";
if (reqUrl) {
var url = this.centerOrderUrl + reqUrl;
}
var self = this;
pobj.actionType = "receiveIcpFeedback";
// 2020 0803 lin 修改;
if (pobj.intentionStatus) {
// 如果需求当前字段为5(已关闭)则通知fq
if (pobj.intentionStatus == 5) {
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
}
}
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
return data;
}
/**
* 提交需求-----del
* @param {*} pobj
* @param {*} actionBody
*/
async submitNeedH5(pobj, actionBody) {
var sobj = pobj; var sobj = pobj;
// 获取商品类型
sobj.actionType = "getProductTypeInfo"; sobj.actionType = "getProductTypeInfo";
var url = settings.centerAppUrl() + "action/opProduct/springBoard"; var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var rtn = await this.execClient.execPost(sobj, url); var opResult =await this.restPostUrl(sobj,url);
if (!rtn || !rtn.stdout) { if (opResult.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
}
var data = JSON.parse(rtn.stdout);
if (data.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败"); return system.getResultFail(-5015, "需求类型查询失败");
} }
pobj.actionBody.type_code = data.data.type_code; pobj.actionBody.type_code = opResult.data.type_code;
pobj.actionBody.type_name = data.data.type_name; pobj.actionBody.type_name = opResult.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code; pobj.actionBody.channel_type_code = opResult.data.channel_type_code;
pobj.actionBody.channel_type_name = data.data.channel_type_name; pobj.actionBody.channel_type_name = opResult.data.channel_type_name;
pobj.actionType = "submitNeedH5"; // 提交需求 暂未做推送
var reqUrl = this.centerOrderUrl + "action/need/springBoard"; pobj.actionType = "submitNeed";
var reqUrl = this.centerOrderUrl + "action/opNeed/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) { if (result.status == 0) {
if (pobj.actionBody.channel_type_code == "esp.companyreg") { if (pobj.actionBody.channel_type_code == "esp.companyreg") {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedBusiness"); this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedBusiness");
} }
// else{
// if(pobj.actionBody.channel_type_code==5){
// pobj.actionBody.regType="ali.icp";
// }else{
// pobj.actionBody.regType="ali.edi";
// }
// this.utilsPushSve.aliBusiness2Fq(pobj, "intention");
// }
} }
return result; return result;
} }
...@@ -139,85 +60,25 @@ class UtilsOpNeedService extends AppServiceBase { ...@@ -139,85 +60,25 @@ class UtilsOpNeedService extends AppServiceBase {
var itemResult = await this.restPostUrl(pobj, reqUrl); var itemResult = await this.restPostUrl(pobj, reqUrl);
return itemResult; return itemResult;
} }
/**
* 获取需求详情
* @param {*} pobj
* @param {*} actionBody needNo 需求号
*/
async getItemByChannelNeedNo(pobj, actionBody) {
if (!actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100390");
}
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var itemResult = await this.restPostUrl(pobj, reqUrl);
return itemResult;
}
/**
* 获取需求详情
* @param {*} pobj
* @param {*} actionBody bizId 渠道方案号
*/
async getItemByChannelSolutionNo(pobj, actionBody) {
if (!actionBody.bizId) {
return system.getResult(null, "actionBody.bizId can not be empty,100390");
}
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var itemResult = await this.restPostUrl(pobj, reqUrl);
return itemResult;
}
/** /**
* 关闭需求 * 关闭需求
* @param {*} pobj * @param {*} pobj
* @param {*} actionBody * @param {*} actionBody
*/ */
async needClose(pobj, actionBody) { async needClose(pobj, actionBody) {
if (!actionBody.intentionBizId) { if (!actionBody.needNo) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100395");
}
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseNeed");
return system.getResultSuccess();
} else {
return system.getResult(null, "推送失敗 100388");
}
}
/**
* icp关闭需求
* @param {*} pobj
* @param {*} actionBody
*/
async needCloseIcp(pobj, actionBody) {
if (!actionBody.channelNeedNo) {
return system.getResult(null, "actionBody.channelNeedNo can not be empty,100395"); return system.getResult(null, "actionBody.channelNeedNo can not be empty,100395");
} }
if (!actionBody.note) { if (!actionBody.note) {
return system.getResult(null, "actionBody.note can not be empty,100395"); return system.getResult(null, "actionBody.note can not be empty,100395");
} }
var self = this; var reqUrl = this.centerOrderUrl + "action/opNeed/springBoard";
pobj.actionBody.intentionBizId = pobj.actionBody.channelNeedNo;
pobj.actionType = "abolishIcpProgrammeByNeed"
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) { if (result.status != 0) {
if (result.data) { return system.getResult(null, "推送失敗 100388");
pobj.actionBody.orderNo = result.data;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
} }
// 推送ali
var a = await self.aliclient.reqbyget({ action: "CloseIntention", reqbody: { BizId: actionBody.channelNeedNo, Note: actionBody.note }, apiVersion: "2019-05-08" });
console.log(a);
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
return system.getResultSuccess(); return system.getResultSuccess();
} else {
return system.getResult(null, "close fail 100389 ");
}
} }
//查询需求详情 //查询需求详情
......
...@@ -243,7 +243,7 @@ module.exports = function (app) { ...@@ -243,7 +243,7 @@ module.exports = function (app) {
"getOrderDeliveryFlowInfo", "getOrderDeliveryFlowList", "getOrderLogInfo", "updateContacts", "updateTmOrder", "delOrder", "getOrderDeliveryFlowInfo", "getOrderDeliveryFlowList", "getOrderLogInfo", "updateContacts", "updateTmOrder", "delOrder",
"submitProgramme", "getProgrammeListByUser", "getProgrammeInfoByNeedNo", "abolishProgramme", "getAliPayInfo", "submitProgramme", "getProgrammeListByUser", "getProgrammeInfoByNeedNo", "abolishProgramme", "getAliPayInfo",
"getPaidLogoListByUser","getCollectibleLogoListByUser","collectLogo","getLogoMaterial","cancelCollectLogo","icpNotify","createName","getNameDetail","orderConfirm", "getPaidLogoListByUser","getCollectibleLogoListByUser","collectLogo","getLogoMaterial","cancelCollectLogo","icpNotify","createName","getNameDetail","orderConfirm",
"orderTotalSum", "collect", "reg", "orderCheck","getReOrderList","getOfficalList","addReviewList" "orderTotalSum", "collect", "reg", "orderCheck","getReOrderList","getOfficalList","addReviewList","submitNeedWeb","needCloseWeb","needListWeb","needDetailByChannelNoWeb"
]; ];
if (lst.indexOf(req.body.actionType) >= 0) { if (lst.indexOf(req.body.actionType) >= 0) {
var userpin = req.headers["userpin"] || ""; var userpin = req.headers["userpin"] || "";
......
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