Commit 98fe24a5 by 兰国旗

laolan

parents 3a5d86af 6341c45c
......@@ -4,7 +4,7 @@ var settings = require("../../../../config/settings");
class QcAPI extends APIBase {
constructor() {
super();
this.centerorderSve = system.getObject("service.common.qcCenterOrderSve");
this.qcCenterOrderSve = system.getObject("service.common.qcCenterOrderSve");
}
/**
* 接口跳转-POST请求
......@@ -23,70 +23,70 @@ class QcAPI extends APIBase {
var opResult = null;
switch (action_type) {
case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.centerorderSve.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
opResult = await this.qcCenterOrderSve.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
break;
case "submitIcpProgramme"://icp方案提交
opResult = await this.centerorderSve.submitIcpProgramme(pobj);
opResult = await this.qcCenterOrderSve.submitIcpProgramme(pobj);
break;
case "receiveProgrammeNo"://接收渠道方案号(测试)
opResult = await this.centerorderSve.reqCenterOrderApi(pobj);
opResult = await this.qcCenterOrderSve.reqCenterOrderApi(pobj);
break;
// case "submitIcpMaterial"://icp材料提交
// opResult = await this.centerorderSve.submitIcpMaterial(pobj);
// opResult = await this.qcCenterOrderSve.submitIcpMaterial(pobj);
// break;
// case "acceptIcpPartnerNotification"://icp通知状态变更
// opResult = await this.centerorderSve.acceptIcpPartnerNotification(pobj);
// opResult = await this.qcCenterOrderSve.acceptIcpPartnerNotification(pobj);
// break;
case "abolishIcpProgramme"://服务商icp方案关闭
opResult = await this.centerorderSve.abolishIcpProgramme(pobj);
opResult = await this.qcCenterOrderSve.abolishIcpProgramme(pobj);
break;
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.centerorderSve.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
opResult = await this.qcCenterOrderSve.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
break;
case "serviceProviderSubmitMaterial"://交付商提交材料信息
opResult = await this.centerorderSve.serviceProviderSubmitMaterial(pobj);
opResult = await this.qcCenterOrderSve.serviceProviderSubmitMaterial(pobj);
break;
case "serviceProviderNotification"://交付商通知状态变更
opResult = await this.centerorderSve.serviceProviderNotification(pobj);
opResult = await this.qcCenterOrderSve.serviceProviderNotification(pobj);
break;
case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.centerorderSve.closeOrderDelivery(pobj);
opResult = await this.qcCenterOrderSve.closeOrderDelivery(pobj);
break;
// --------- 文网文 ---------
case "serviceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.centerorderSve.serviceSubmitOption(pobj);
opResult = await this.qcCenterOrderSve.serviceSubmitOption(pobj);
break;
case "submitWangwenSolution"://提交方案(文网文)2020-9-26
opResult = await this.centerorderSve.submitWangwenSolution(pobj);
opResult = await this.qcCenterOrderSve.submitWangwenSolution(pobj);
break;
case "closeNeed"://关闭需求(文网文)2020-9-28
opResult = await this.centerorderSve.closeNeed(pobj);
opResult = await this.qcCenterOrderSve.closeNeed(pobj);
break;
case "recordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.centerorderSve.recordLog(pobj);
opResult = await this.qcCenterOrderSve.recordLog(pobj);
break;
case "recordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.centerorderSve.recordLogList(pobj);
opResult = await this.qcCenterOrderSve.recordLogList(pobj);
break;
// --------- 食品 ---------
case "foodServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.centerorderSve.foodServiceSubmitOption(pobj);
opResult = await this.qcCenterOrderSve.foodServiceSubmitOption(pobj);
break;
case "submitFoodSolution"://提交方案(文网文)2020-9-26
opResult = await this.centerorderSve.submitFoodSolution(pobj);
opResult = await this.qcCenterOrderSve.submitFoodSolution(pobj);
break;
case "foodCloseNeed"://关闭需求(文网文)2020-9-28
opResult = await this.centerorderSve.foodCloseNeed(pobj);
opResult = await this.qcCenterOrderSve.foodCloseNeed(pobj);
break;
case "foodRecordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.centerorderSve.foodRecordLog(pobj);
opResult = await this.qcCenterOrderSve.foodRecordLog(pobj);
break;
case "foodRecordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.centerorderSve.foodRecordLogList(pobj);
opResult = await this.qcCenterOrderSve.foodRecordLogList(pobj);
break;
default:
......
var WEBBase = require("../../web.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class ProductAPI extends WEBBase {
constructor() {
super();
this.signSve = system.getObject("service.common.signSve");
}
/**
* 优客工厂
* 接口跳转-POST请求
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "getAppInfoByAppKey":// 根据优客token获取用户信息,生成userPin返回前端 actionBody
opResult = await this.signSve.getAppInfoByAppKey(pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = ProductAPI;
\ No newline at end of file
......@@ -30,6 +30,9 @@ class TmQueryAPI extends WEBBase {
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "tmTest":
opResult = await this.tmquerySve.test(pobj);
break;
case "findTrademarkNameAccurate"://商标精确检索(相同商标检索)
opResult = await this.tmquerySve.findTrademarkNameAccurate(action_body, req);
break;
......
......@@ -51,12 +51,13 @@ class Feedback extends APIBase {
if (!pobj.intentionStatus) {
return self.getResultFail("intentionStatus不能为空");
}
pobj.action_type = "icpFeedbackSubmitNew";
var param = {
requestId: req.requestId || self.getUUID(),
requestUrl: "/icp/feedback/submit",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "icpFeedbackSubmit",//调用参数
pushActionType: "icpFeedbackSubmitNew",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
......
......@@ -67,6 +67,118 @@ class Order extends APIBase {
}
}
pobj.action_type = "icpOrderStatus";
if (pobj.area) {
switch (pobj.area) {
case "BEIJING":
pobj.area = "1";
break;
case "SHANGHAI":
pobj.area = "2";
break;
case "FUJIAN":
pobj.area = "3";
break;
case "GUANGXI":
pobj.area = "4";
break;
case "GUANGDONG":
pobj.area = "5";
break;
case "ANHUI":
pobj.area = "6";
break;
case "HENAN":
pobj.area = "7";
break;
case "HUBEI":
pobj.area = "8";
break;
case "ZHEJIANG":
pobj.area = "9";
break;
case "JIANGSU":
pobj.area = "10";
break;
case "SHANDONG":
pobj.area = "11";
break;
case "SHANGXI_SHAN":
pobj.area = "12";
break;
case "NINGXIA":
pobj.area = "13";
break;
case "GANSU":
pobj.area = "14";
break;
case "XINJIANG":
pobj.area = "15";
break;
case "QINGHAI":
pobj.area = "16";
break;
case "TIANJIN":
pobj.area = "17";
break;
case "CHONGQING":
pobj.area = "18";
break;
case "HEBEI":
pobj.area = "19";
break;
case "SHANXI_JIN":
pobj.area = "20";
break;
case "LIAONING":
pobj.area = "21";
break;
case "JINLIN":
pobj.area = "22";
break;
case "HEILONGJIANG":
pobj.area = "23";
break;
case "JIANGXI":
pobj.area = "24";
break;
case "HUNAN":
pobj.area = "25";
break;
case "SICHUAN":
pobj.area = "26";
break;
case "GUIZHOU":
pobj.area = "27";
break;
case "YUNNAN":
pobj.area = "28";
break;
case "NEIMENGGU":
pobj.area = "29";
break;
case "XIZANG":
pobj.area = "30";
break;
case "HANWAIZI":
pobj.area = "31";
break;
case "QUANWAIZI":
pobj.area = "31";
break;
case "WAIZI":
pobj.area = "31";
break;
case "HAINAN":
pobj.area = "34";
break;
default:
pobj.area = "";
break;
}
}
if (!pobj.area) {
return self.getResultFail("area参数错误");
}
var param = {
requestId: req.requestId || self.getUUID(),
requestUrl: "/icp/order/notify",
......@@ -80,5 +192,28 @@ class Order extends APIBase {
return self.getResultSuccess(param.requestId);
}
async close(pobj,obj,req){
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return self.getResultFail("未知应用或应用未启用");
}
if (!pobj.orderNo) {
return self.getResultFail("orderNo不能为空");
}
pobj.channelOrderNo = pobj.orderNo;
pobj.action_type = "icpOrderClose";
var param = {
requestId: req.requestId || self.getUUID(),
requestUrl: "/icp/order/close",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "icpOrderClose",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await self.gatewaypushlogSve.create(param);
return self.getResultSuccess(param.requestId);
}
}
module.exports = Order;
\ No newline at end of file
......@@ -105,6 +105,9 @@ class Need extends APIBase {
opResult = await self.centerorderSve.icppaysuccessNew(pobj, pobj.actionBody);
}
break;
case "icpOrderClose"://关闭ICP订单
opResult = await this.utilsNeedSve.icpOrderClose(pobj, pobj.actionBody);
break;
//-----------接入百度ICP------end----------------------------------
default:
opResult = system.getResult(null, "action_type参数错误");
......
......@@ -7,34 +7,110 @@ class edi extends APIBase {
this.centerorderSve = system.getObject("service.common.centerorderSve");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
this.utilsServicedSve = system.getObject("service.utilsSve.utilsServiceSve");
this.utilsServiceSve = system.getObject("service.utilsSve.utilsServiceSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj, pobj.actionType, pobj.actionBody, req);
return result;
async create(pobj,query,req) {
console.log(pobj);
// 校验必填 pannong 2.1
var checkResult = await this.serviceCreateCheck(pobj,req.headers);
if(checkResult.status != 0) {
return checkResult;
}
var qobj = {appInfo:pobj.appInfo};
qobj.actionBody = pobj;
var result = await this.utilsServiceSve.submitService(qobj,qobj.actionBody,req);
return result
}
async notify(pobj,query,req) {
console.log(pobj);
// 校验必填 pannong 2.1
var checkResult = await this.serviceNotifyCheck(pobj,req.headers);
if(checkResult.status != 0) {
return checkResult;
}
var qobj = {appInfo:pobj.appInfo};
qobj.actionBody = pobj;
var result = await this.utilsServiceSve.notifyService(qobj,qobj.actionBody,req);
return result
}
async opActionProcess(pobj, action_type, action_body, req) {
var opResult = null;
switch (action_type) {
case "submitService":
opResult = await this.utilsServicedSve.submitService(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
async notice(pobj,query,req) {
console.log("/api/opreceive/service/notice",pobj)
if(!pobj.actionType) {
return system.getResult(null, "pobj.actionType cannot be empty");
}
var result = await this.utilsServiceSve.noticeService(pobj,pobj.actionBody,req);
return result
}
async serviceCreateCheck(pobj,headers) {
if(!headers.appkey) {
return system.getResult(null, "headers.appkey cannot be empty");
}
if(!headers.sign) {
return system.getResult(null, "headers.sign cannot be empty");
}
if(!pobj.bizId) {
return system.getResult(null, "bizId cannot be empty");
}
if(!pobj.contactName) {
return system.getResult(null, "contactName cannot be empty");
}
if(!pobj.contactMobile) {
return system.getResult(null, "contactName cannot be empty");
}
if(!pobj.timeUnit) {
return system.getResult(null, "contactName cannot be empty");
}
if(!pobj.quantity) {
return system.getResult(null, "contactName cannot be empty");
}
if(!pobj.companyInfo) {
return system.getResult(null, "contactName cannot be empty");
}
if(!pobj.companyInfo.companyName) {
return system.getResult(null, "companyName cannot be empty");
}
if(!pobj.companyInfo.taxpayerType) {
return system.getResult(null, "taxpayerType cannot be empty");
}
if(!pobj.companyInfo.acctgSystemId) {
return system.getResult(null, "acctgSystemId cannot be empty");
}
if(!pobj.companyInfo.companyForm) {
return system.getResult(null, "companyForm cannot be empty");
}
if(!pobj.companyInfo.industry) {
return system.getResult(null, "industry cannot be empty");
}
if(!pobj.companyInfo.taxpayerNumber) {
return system.getResult(null, "taxpayerNumber cannot be empty");
}
if(!pobj.companyInfo.companyArea) {
return system.getResult(null, "companyArea cannot be empty");
}
return system.getResultSuccess()
}
async serviceNotifyCheck(pobj,headers) {
if(!headers.appkey) {
return system.getResult(null, "headers.appkey cannot be empty");
}
if(!headers.sign) {
return system.getResult(null, "headers.sign cannot be empty");
}
if(!pobj.bizId) {
return system.getResult(null, "bizId cannot be empty");
}
if(!pobj.status) {
return system.getResult(null, "status cannot be empty");
}
if(pobj.status != 4 && pobj.status != 8 && pobj.status != 16) {
return system.getResult(null, "status error");
}
return system.getResultSuccess()
}
}
module.exports = edi;
\ No newline at end of file
......@@ -614,6 +614,7 @@ class CenterorderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
var baiduPushRes = await this.utilsPushSve.baiduBusiness2Fq(fqobj, "pushOrderICPBusinessNew");
var deliveryObj = {
actionBody: {
orderNo: orderrtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
......@@ -627,9 +628,35 @@ class CenterorderService extends AppServiceBase {
}
},
appInfo: pobj.appInfo
};
if(pobj.actionBody.isDirectBuy && pobj.actionBody.isDirectBuy==1){//直接下单需执行添加订单业务员操作
if(baiduPushRes && baiduPushRes.status==0){
if(baiduPushRes.data && baiduPushRes.data.data){
var resData = baiduPushRes.data.data;
var salesmanInfo = {
salesmanName:resData.orderList && resData.orderList.length>0?resData.orderList[0].operatorName:"",
salesmanChannelId:resData.orderList && resData.orderList.length>0?resData.orderList[0].operator:"",
};
var salesmanObj={
appInfo:pobj.appInfo,
actionType:"addIcpSalesmanInfo",//添加业务员信息
actionBody:{salesmanInfo:salesmanInfo,orderNo:orderrtn.data.orderNo}
};
var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
var addRes = await this.execClient.execPost(salesmanObj, url);
if (addRes && addRes.stdout) {
var salesmanRes = JSON.parse(addRes.stdout);
if (salesmanRes.status == 0) {
deliveryObj.actionBody.needsolution = salesmanRes.data;
await this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
}
}
}
}
}else{
this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
}
this.utilsPushSve.baiduBusiness2Fq(fqobj, "pushOrderICPBusinessNew");
this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
return system.getResultSuccess();
}
}
......
......@@ -660,8 +660,8 @@ async foodRecordLogList(pobj) {
return system.getResult(null, "interface_params can not be empty,100400");
}
let interface_params_info = JSON.parse(pobj.interface_params);
if (!interface_params_info || !interface_params_info.pushUrl || !interface_params_info.action || interface_params_info.apiVersion) {
return system.getResult(null, "interface_params(pushUrl、action、apiVersion) can not be empty,100430");
if (!interface_params_info || !interface_params_info.action || interface_params_info.apiVersion) {
return system.getResult(null, "interface_params(action、apiVersion) can not be empty,100430");
}
let pushObj = {
BizId: pobj.pushObj.BizId,
......
......@@ -87,8 +87,12 @@ class SignService{
}
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey] && !(params[tKey] instanceof Array)) {
signArr.push(tKey + "=" + params[tKey]);
if (tKey != "sign" && params[tKey]) {
let tmpKeyValue = params[tKey];
if (tmpKeyValue instanceof Array || tmpKeyValue instanceof Object) {
tmpKeyValue = JSON.stringify(tmpKeyValue);
}
signArr.push(tKey + "=" + tmpKeyValue);
}
}
if (signArr.length == 0) {
......@@ -98,10 +102,10 @@ class SignService{
var resultTmpSign = md5(resultSignStr).toUpperCase();
return system.getResultSuccess(resultTmpSign);
}
}
module.exports = SignService;
// var task = new SignService();
// var obj = {
// "intentionBizId": "TRE-nmnHtEoTjeEtest",
// "phone": "13126673246",
......@@ -113,3 +117,16 @@ module.exports = SignService;
// task.createSign(obj,"7cbb892450174167b5c7e01we4716t51").then(d=>{
// console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!");
// });
// var obj = {
// "orderNo":"c76a7c1a0cf747db92e9fc6beab770f0",
// "remark":"lin"
// }
// var obj = {
// "bizId":"202011031421",
// "status":"16"
// }
// task.createSign(obj,"7cbb892450174167b5c7e01we4717z51").then(d=>{
// console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!");
// });
\ No newline at end of file
......@@ -150,5 +150,12 @@ class TmqueryService {
return data;
}
async test(pobj){
let url = settings.centerOrderUrl() + 'notifyaction/internalCallsNotify/updateTmStatus';
let result = await this.execClient.execPost(pobj.actionBody,url);
return result;
}
}
module.exports = TmqueryService;
......@@ -36,8 +36,7 @@ class UtilsDeliverSystemService extends AppServiceBase {
},
requestId: pobj.requestId || "" // N 请求id
}
this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
......
......@@ -87,7 +87,7 @@ class UtilsFqAliyunService extends AppServiceBase {
if (rtn.code != 200 && rtn.success != true) {
return system.getResult(null, "推送失败,失败原因:" + rtn.errorMsg + ",selfrequestId=" + pobj.requestId + ",requestId=" + rtn.requestId);
}
return system.getResultSuccess(null, "推送成功");
return system.getResultSuccess(rtn.data, "推送成功");
} catch (e) {
//日志记录
this.logCtl.error({
......
......@@ -1011,31 +1011,6 @@ class UtilsNeedService extends AppServiceBase {
* @param {*} actionBody
*/
async produceNoticeAliEsp(req, pobj, actionBody) {
// 如果状态为USER_UPLOAD_PRODUCE需要转换url
// if(actionBody.operationType == "USER_UPLOAD_PRODUCE" ) {
// if(actionBody.extInfo) {
// // businessLicense:['business_license/12195411 61213057/1599115976393/p08xo9frgzj.png']
// // idCardList:[' ["card/1219541161213057/1599115980036/s1nn3sozulo.png"] ']
// // 注意idCardList 是二维数组 需要再转换一下 不知道为什么
// var extJson = JSON.parse(actionBody.extInfo);
// var businessLicenseArr = [];
// if(extJson.idCardList) {
// // 抽出数组
// var idCardListA = JSON.parse(extJson.idCardList);
// var idCardListArr = [];
// for(var i = 0; i < idCardListA.lenght; i++) {
// idCardListArr.push(await this.opDownFileInfo(idCardListA[i]));
// }
// }
// for(var i = 0; i < extJson.businessLicense.lenght; i++) {
// businessLicenseArr.push(await this.opDownFileInfo(extJson.businessLicense[i]));
// }
// actionBody.extInfo = {
// businessLicenseArr,
// idCardListArr
// }
// }
// }
switch (actionBody.operationType) {
case "USER_PAY_PRODUCE":
// 修改需求,方案 订单状态
......@@ -1223,6 +1198,7 @@ class UtilsNeedService extends AppServiceBase {
// 2020 0927 lin 新增 edi状态更新
async ediNotify(pobj, actionBody) {
// 如果状态为USER_UPLOAD_PRODUCE需要转换url
if (actionBody.operationType == "USER_UPLOAD_PRODUCE") {
if (actionBody.extInfo) {
// businessLicense:['business_license/12195411 61213057/1599115976393/p08xo9frgzj.png']
......@@ -1455,6 +1431,32 @@ class UtilsNeedService extends AppServiceBase {
}//通知更新状态
return rtn;
}
//关闭icp订单
async icpOrderClose(pobj) {
var actionBody = pobj.actionBody;
var self = this;
var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
var rtn = await this.restPostUrl(pobj, url);
if (rtn.status == 0 && rtn.data) {
pobj.actionBody.orderNo = rtn.data.orderNo;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
var tmpObj = {
actionBody: {
orderNo: rtn.data.orderNo,
channelNeedNo: rtn.data.channelNeedNo,
needsolution: rtn.data.solutionContent
},
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.baiduBusiness2Fq(tmpObj, "pushOrderICPClose");
}//通知更新状态
return rtn;
}
//-----------接入百度ICP------end----------------------------------
}
......
......@@ -48,9 +48,9 @@ class UtilsOrderService extends AppServiceBase {
}
console.log("buyTotalSum", buyTotalSum)
console.log("totalSum", totalSum)
// if (buyTotalSum < totalSum) {
// return system.getResult(null, "订单金额有误,100060");
// }
if (buyTotalSum < totalSum) {
return system.getResult(null, "订单金额有误,100060");
}
let tmpPriceList = [];
pobj.actionBody.product_info.price_item = price_list[productIndex];
tmpPriceList.push(pobj.actionBody.product_info.price_item);
......@@ -303,7 +303,7 @@ class UtilsOrderService extends AppServiceBase {
var payStatus = await this.restPostUrl(pobj, this.centerAppPayUrl);
if (payStatus.data && payStatus.data.trxstatus == "0000") {
//TODO:处理支付成功的业务逻辑
//TODO:处理支付成功的业务逻辑
payStatus.data.out_trade_no = receiptVoucher.sourceOrderNo;
this.opPayStatusSuccess(payStatus.data, pobj.appInfo, null);
// return system.getResultFail(-100130,'订单已支付,请勿重复付款,100130')
......@@ -688,7 +688,7 @@ class UtilsOrderService extends AppServiceBase {
// 模拟验签结果
var outTradeInfo = parmas.out_trade_no.split('-');
console.log("模拟验签结果--------------", outTradeInfo)
//
//
var opResult = {}
opResult.data = {
orderNo: outTradeInfo[0],
......@@ -740,7 +740,7 @@ class UtilsOrderService extends AppServiceBase {
channel_nickname: opOrderResult.data.order_info.channelUserId
};
opOrderResult.data.orderNo = opResult.data.orderNo;
opOrderResult.data.order_info.pay_flow_no = parmas.trade_no;// 2020 0704 lin 新增 推送fq必填字段
opOrderResult.data.order_info.pay_flow_no = parmas.trade_no;// 2020 0704 lin 新增 推送fq必填字段
opOrderResult.data.order_info.pay_channel = "支付宝";//付款方式
opOrderResult.data.order_info.pay_time = parmas.gmt_payment;//付款时间
opOrderResult.data.order_info.pay_payer_bank_no = parmas.buyer_email;//付款账号
......@@ -805,7 +805,7 @@ class UtilsOrderService extends AppServiceBase {
// }
// 模拟验签结果
var outTradeInfo = parmas.out_trade_no.split('-');
//
//
var opResult = {}
opResult.data = {
orderNo: outTradeInfo[0],
......@@ -936,7 +936,8 @@ class UtilsOrderService extends AppServiceBase {
uapp_id: appInfo.uapp_id,
uapp_key: appInfo.uapp_key,
app_code: appInfo.app_code,
app_name: appInfo.app_name
app_name: appInfo.app_name,
contact_mobile:appInfo.contact_mobile
};
opOrderResult.data.userInfo = {
channel_userid: opOrderResult.data.order_info.channelUserId,
......@@ -954,9 +955,18 @@ class UtilsOrderService extends AppServiceBase {
actionBody: opOrderResult.data
}
// 推送
this.utilsPushSve.pushBusInfo(pobj, "pushOrder", 0);
let yfRet = await this.utilsPushSve.pushBusInfo(pobj, "pushOrder", 0);
if(yfRet.status !=0){
return yfRet;
}
if (['icpsq', 'edisq'].includes(opOrderResult.data.product_info.channel_item_code)) {
//创建方案
pobj.salesmanInfo ={
"salesmanId":yfRet.data.orderList[0].operator || "",
"salesmanName":yfRet.data.orderList[0].operatorName || "",
"salesmanMobile":yfRet.data.orderList[0].phone ||"",
"salesmanChannelId":yfRet.data.orderList[0].channelUserId || ""
}
let pushRet = await this.packagingPushData(pobj);
if (pushRet.status != 0) {
throw new Error('推送失败')
......@@ -997,7 +1007,7 @@ class UtilsOrderService extends AppServiceBase {
"CompanyName": "",
"licenseType": "",
"solutionCity": ab.product_info.price_item.price_desc,
"solutionPrice": ab.order_info.totalSum,
"solutionPrice": Number(ab.order_info.totalSum)*100,
"channelTypeCode": ab.product_info.service_business_code,
"companyLocation": ab.product_info.price_item.price_desc
}
......@@ -1005,14 +1015,15 @@ class UtilsOrderService extends AppServiceBase {
"status": "USER_PAY_PRODUCE",
"bizType": ab.product_info.channel_item_code,
"solution": solution,
"totalSum": ab.order_info.totalSum,
"totalSum": Number(ab.order_info.totalSum)*100,
"typeCode": ab.product_info.channel_item_code,
"typeName": ab.product_info.channel_item_name,
"statusName": "⽤户⽀付",
"customerInfo": {
"publishName": "",
"publishMobile": ""
}
"publishName": ab.order_contact.contactName || "",
"publishMobile": ab.order_contact.mobile || ""
},
"salesmanInfo":pobj.salesmanInfo
}
//推送数据
let pushObj = {
......
......@@ -53,7 +53,7 @@ class UtilsPushService extends AppServiceBase {
}
async pushBusInfo(pobj, opType, isDelProductInfo) {//推送业务总入口,不在db中做配置进行调用
console.log(JSON.stringify(pobj),".......pushBusInfo.........................");
console.log(JSON.stringify(pobj), ".......pushBusInfo.........................");
var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
if (!interface_list) {
return system.getResult(null, "暂无推送配置");
......@@ -63,10 +63,21 @@ class UtilsPushService extends AppServiceBase {
return system.getResult(null, "暂无【" + opType + "】的推送配置");
}
var self = this;
for (let index = 0; index < interface_list_temp.length; index++) {
const element = interface_list_temp[index];
await self.reflexAction(element, opType, pobj, isDelProductInfo);
let result;
if (interface_list_temp && interface_list_temp.length == 1) {
const element = interface_list_temp[0];
let reflexActionRes = await self.reflexAction(element, opType, pobj, isDelProductInfo);
self.execClientNew.execLogs("pushBusInfo-reflexAction-result:", pobj, "center-channel-reflexAction", reflexActionRes, null);
return reflexActionRes;
} else {
for (let index = 0; index < interface_list_temp.length; index++) {
const element = interface_list_temp[index];
result = await self.reflexAction(element, opType, pobj, isDelProductInfo);
self.execClientNew.execLogs("pushBusInfo-for---reflexAction-result:", pobj, "center-channel-reflexAction", result, null);
}
return result;
}
}
async againPushBusInfo(pobj) {//再次推送业务总入口-重试
......@@ -75,6 +86,7 @@ class UtilsPushService extends AppServiceBase {
return system.getResult(null, "暂无推送配置");
}
var result = await this.reflexAction(interface_info, pobj.opType, pobj, pobj.isDelProductInfo || 1);
this.execClientNew.execLogs("againPushBusInfo-reflexAction-result:", pobj, "center-channel-reflexAction", result, null);
if (result.status != 0) {
return result;
}
......@@ -97,7 +109,8 @@ class UtilsPushService extends AppServiceBase {
}
pobj.interface_params = interface_info.params;
var params = [pobj];
invokeObj[interface_info.method_name].apply(invokeObj, params);
var doRes = await invokeObj[interface_info.method_name].apply(invokeObj, params);
return doRes;
}
else if (interface_info.interface_type == "yc") {
var actionBody = pobj.actionBody;
......@@ -114,8 +127,8 @@ class UtilsPushService extends AppServiceBase {
delete actionBody["product_info"];
}//是否删除产品信息进行推送
refResult = await this.restPostUrl(pobj.actionBody, interface_info.interface_url);
if(refResult.code == 1) {
refResult.status = 0
if (refResult.code == 1) {
refResult.status = 0
}
this.disposePushResult(pobj, refResult, "ycUrlPush->reflexAction->refResult", this.pushlogFailType.NEWRPC);
}
......@@ -142,8 +155,8 @@ class UtilsPushService extends AppServiceBase {
optitle: pobj.opType + "推送蜂擎获取的接口信息->baiduBusiness2Fq",
});
if (pobj.interface_info) {
await this.pushBusInfo(pobj, opType, 1);
return system.getResultSuccess();
var pushBusInfo = await this.pushBusInfo(pobj, opType, 1);
return system.getResultSuccess(pushBusInfo);
}
return system.getResult(null, "push Fail,interface_info data is empty");
}
......
var system = require("../../../system");
var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base");
const md5 = require('md5')
const md5 = require('md5');
const { sign } = require("crypto");
//阿里支付类
class utils360Sve extends AppServiceBase {
constructor() {
super();
this.centerAppUrl = settings.centerAppUrl();
this.pannongServiceConfig = settings.pannongServiceConfig();
this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve")
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.signSve = system.getObject("service.common.signSve");
}
/**
......@@ -17,11 +22,197 @@ class utils360Sve extends AppServiceBase {
* @param {*} pobj
* @param {*} actionBody
*/
async submitService(pobj, actionBody) {
// 明天开始写逻辑
async submitService(pobj, actionBody,req) {
// 获取userpin 为什么在这里获取?原因:getWay获取不到手机号 再去调用其他接口浪费资源
pobj.actionType = "getLoginByUserName";
pobj.actionBody.channelUserId = actionBody.contactMobile; // 即:86_18512345678
pobj.actionBody.userName = actionBody.contactMobile;
pobj.actionBody.mobile = actionBody.contactMobile;
// pobj.actionBody.userpin = pobj.actionBody.userpin || this.getUUID();//采用jwt方式封装userpin
var tmpOpResult = await this.utilsAuthSve.getLoginByUserName(req, pobj, pobj.actionBody);
if (tmpOpResult.status != 0) {
return system.getResult(null, "创建用户信息失败");
}
pobj.userInfo = {
channel_userid: actionBody.contactMobile,
channel_username: actionBody.contactMobile,
mobile: actionBody.contactMobile
}
// 询价
pobj.actionBody.channelItemCode = "kjxg";
pobj.actionBody.pathCode = "/kjfw/kjxg/";// 写死
pobj.actionType = "getProductPrice";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var productPriceResult = await this.restPostUrl(pobj, url);
if (productPriceResult.status != 0) {
return system.getResult(null, "productPrice is empty");
}
// addOrder
pobj.actionBody.bizId = actionBody.bizId;
pobj.actionBody.userName = actionBody.contactName;
pobj.actionBody.mobile = actionBody.contactMobile;
pobj.actionBody.orderNo = actionBody.bizId;
pobj.actionBody.totalSum = productPriceResult.data.price;
pobj.actionBody.orderPrice = productPriceResult.data.price;
pobj.actionBody.payTotalSum = productPriceResult.data.price;
pobj.actionBody.price = productPriceResult.data.price;
pobj.actionBody.payCode = productPriceResult.data.payCode;
pobj.actionBody.channelItemCode = productPriceResult.data.channelItemCode;
pobj.actionBody.quantity = 1;
pobj.actionBody.channelOrder = {
channelServiceNo: actionBody.bizId,
channelOrderNo: actionBody.bizId,
orderStatus: 2
}
var orderrtn = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
this.logCtl.info({
op: "service/impl/utilsSve/utilsServiceSve.js/submitService",
content: "参数=" + JSON.stringify(pobj) + " 返回值=" + JSON.stringify(orderrtn),
clientIp: req.client_ip || "",
optitle: "服务单创建接口"
});
if (orderrtn.status != 0 && orderrtn.status != -1) {
return system.getResultFail(-5012, "订单创建失败");
}
if (orderrtn.data) {
pobj.actionBody.orderNo = orderrtn.data.orderNo;
}
var deliveryObj = {
actionBody: {
"bizId":pobj.actionBody.bizId,
"orderNo":pobj.actionBody.orderNo,
"contactName":pobj.actionBody.contactName,
"contactMobile":pobj.actionBody.contactMobile,
"timeUnit":pobj.actionBody.timeUnit,
"quantity":pobj.actionBody.quantity,
"companyInfo":{
"companyName":pobj.actionBody.companyInfo.companyName,
"taxpayerType":pobj.actionBody.companyInfo.taxpayerType,
"acctgSystemId":pobj.actionBody.companyInfo.acctgSystemId,
"companyForm":pobj.actionBody.companyInfo.companyForm,
"industry":pobj.actionBody.companyInfo.industry,
"taxpayerNumber":pobj.actionBody.companyInfo.taxpayerNumber,
"companyArea":pobj.actionBody.companyInfo.companyArea
}
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "submitService");
return system.getResultSuccess();
}
async notifyService(pobj, actionBody,req) {
// 根据渠道订单号查出订单 判断订单状态是否可以变更
pobj.actionBody.channelOrderNo = pobj.bizId;
var sobj = {
actionType: "getOrderByChannelOrderNo",
actionBody: pobj.actionBody,
appInfo: pobj.appInfo,
userInfo: {
channelUerId: ""// 获取不到userpin 模拟
}
}
var url = settings.centerOrderUrl() + "action/order/springBoard";
var orderInfoResult = await this.restPostUrl(sobj, url);
if(orderInfoResult.status != 0) {
return system.getResult(null, "order data is empty");
}
var orderInfo = orderInfoResult.data;
// 2020 1106 lin 这里为什么要查出订单 再去修改 不直接修改?
// 因为先暂时不做状态判断是否可以修改 后面优化
pobj.actionBody.orderId = orderInfo.id;
if(actionBody.status == 16) {// 2020 1106 lin 这里转换一下已关闭为16不合适 换为已作废
var orderStatus = 32
} else {
var orderStatus = actionBody.status;
}
var sobj = {
actionType: "updateOrderStatusById",
actionBody: {
orderStatus: orderStatus,
orderId: orderInfo.id
},
appInfo: pobj.appInfo,
userInfo: {
channelUerId: ""// 获取不到userpin 模拟
}
}
var url = settings.centerOrderUrl() + "action/order/springBoard";
var orderInfoResult = await this.restPostUrl(sobj, url);
if(orderInfoResult.status != 0) {
return system.getResult(null, "order data is empty");
}
var deliveryObj = {
actionBody: {
"bizId": actionBody.bizId,
"status": actionBody.status
},
appInfo: pobj.appInfo
}
if(actionBody.serviceStartTime && actionBody.serviceEndTime ) {
deliveryObj.actionBody.serviceStartTime = actionBody.serviceStartTime,
deliveryObj.actionBody.serviceEndTime = actionBody.serviceEndTime
}
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "notifyService");
return system.getResultSuccess();
}
async noticeService(pobj, actionBody,req) {
delete actionBody.appHosts
var obj = {
appid: this.pannongServiceConfig.appid,
noncestr: this.getUUID(),
timestamp: new Date().getTime(),
body: actionBody
}
var signResult = await this.signSve.createSign(obj, this.pannongServiceConfig.appkey);
if(signResult.status != 0) {
return system.getResult(null, "create sign fail");
}
obj.sign = signResult.data;
switch(pobj.actionType) {
case "feedback":
var url = settings.pannongUrl() + "pas-api/gsb/service/feedback";
var result = await this.restPostUrl(obj, url);
this.logCtl.info({
op: "service/impl/utilsSve/utilsServiceSve.js/feedback",
content: "参数=" + JSON.stringify(obj) + " 返回值=" + JSON.stringify(result),
clientIp: req.client_ip || "",
optitle: "服务单处理反馈接收接口"
});
return result;
case "accountingInfo":
var url = settings.pannongUrl() + "pas-api/gsb/service/accountingInfo";
var result = await this.restPostUrl(obj, url);
this.logCtl.info({
op: "service/impl/utilsSve/utilsServiceSve.js/feedback",
content: "参数=" + JSON.stringify(obj) + " 返回值=" + JSON.stringify(result),
clientIp: req.client_ip || "",
optitle: "回传会计信息"
});
return result;
case "booksInfo":
var url = settings.pannongUrl() + "pas-api/gsb/service/booksInfo";
var result = await this.restPostUrl(obj, url);
this.logCtl.info({
op: "service/impl/utilsSve/utilsServiceSve.js/feedback",
content: "参数=" + JSON.stringify(obj) + " 返回值=" + JSON.stringify(result),
clientIp: req.client_ip || "",
optitle: "帐套信息接受接口"
});
return result;
default:
return system.getResult(null, "actionType参数错误");
}
}
}
module.exports = utils360Sve;
......@@ -18,7 +18,12 @@ module.exports = {
"foodCloseNeed", "foodRecordLog", "foodRecordLogList", "getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode",
"putUserPwdByMobile", "icpNotifyNew"
],
<<<<<<< HEAD
apiMustUserpinList: ["submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme","serviceProviderNotification"],
apiSecretPathList: ["/api/icp/consultation/submit","/api/icp/feedback/submit","/api/icp/order/notify"]
=======
apiMustUserpinList: ["submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme","submitService"],
apiSecretPathList: ["/api/icp/consultation/submit","/api/icp/feedback/submit","/api/icp/order/notify","/api/opreceive/service/create","/api/icp/order/close","/api/opreceive/service/notify"]
>>>>>>> 6341c45c21c448304176aa0b36216c1b9bd5f379
}
}
......@@ -442,7 +442,7 @@ module.exports = function (app) {
}
}
if (["getAppTokenByHosts", "getAppTokenByAppKey", "getTmNclFilterSearch"].indexOf(req.body.actionType) >= 0) {
if (["getAppTokenByHosts", "getAppTokenByAppKey", "getTmNclFilterSearch","feedback"].indexOf(req.body.actionType) >= 0) {
req.body.actionBody.appHosts = req.host;
next();
return;
......
......@@ -246,7 +246,7 @@ var settings = {
if (this.env == "dev") {
return "http://180.163.239.98:38085/"// 360测试环境
} else {
return "http://180.163.239.98:38085/"//
return "https://console.e.360.cn/"//
}
},
aliUappId: function () {
......@@ -354,6 +354,23 @@ var settings = {
} else {
return "15754717260";// 7.7修改正式环境优客 辅助/担保订单推送业务员手机号 刘文悦
}
},
pannongServiceConfig: function() {
if (this.env == "dev") {
return {
appid: "10015683988",
appkey: "b74b73acf78cc2851aa559e93c84f7888adq23we"
}
} else {
// 2020 1106 lin 正式环境还未给出
}
},
pannongUrl: function() {
if (this.env == "dev") {
return "http://39.101.172.142:8980/"
} else {
// 2020 1106 lin 正式环境还未给出
}
}
};
module.exports = settings;
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