Commit aa8bfd4f by 宋毅

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

parents a79ae5c0 cab499a8
......@@ -46,6 +46,7 @@ class PatentQueryAPI extends WEBBase {
case "CommomSearchbyInventor"://根据发明人查询聚合
case "CommomSearchbyFilingno"://根据申请号查询聚合
case "CommomSearchbyPubno"://根据公开号查询聚合
case "AffairsearchbyFilingno"://根据申请号查询并根据法律状态日期排序
opResult = await this.patentSve.opReqResult(pobj, req);
break;
default:
......
......@@ -8,6 +8,7 @@ class NameAPI extends WEBBase{
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.centerOrderUrl = settings.centerOrderUrl();
this.centerCacheUrl = settings.centerCacheUrl();
this.aliGetNamesjavaUrl = settings.aliGetNamesjavaUrl();
}
/**
* 接口跳转-POST请求
......@@ -36,6 +37,9 @@ class NameAPI extends WEBBase{
case "getNameDetail"://详情
opResult = await this.getNameDetail(pobj);
break;
case "getNames"://详情
opResult = await this.getNames(pobj,pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......@@ -131,6 +135,18 @@ class NameAPI extends WEBBase{
}
return system.getResult(null,'try again');
}
async getNames(pobj,actionBody){
let rtn = await this.restClient.execPost(actionBody,this.aliGetNamesjavaUrl);
if (!rtn.stdout) {
return system.getResultFail();
}
var result = JSON.parse(rtn.stdout);
if(result) {
return system.getResultSuccess(result);
}
return system.getResultFail(result);
}
}
const cacheJson = {
......
......@@ -39,9 +39,9 @@ class PaymentAPI extends WEBBase {
case "queryOrderStatus"://通联支付查询
opResult = await this.utilsOrderSve.queryOrderStatus(pobj, pobj.actionBody);
break;
case "getQrCode"://获取pc端支付二维码--不跟订单关联
opResult = await this.utilsOrderSve.getQrCode(pobj, pobj.actionBody);
break;
// case "getQrCode"://获取pc端支付二维码--不跟订单关联
// opResult = await this.utilsOrderSve.getQrCode(pobj, pobj.actionBody);
// break;
case "queryOrder"://通联支付查询
opResult = await this.utilsOrderSve.queryOrder(pobj, pobj.actionBody);
break;
......
......@@ -50,6 +50,7 @@ class UtilsNeedService extends AppServiceBase {
} else if (pobj.actionBody.channel_type_code == "tmjy") {
pobj.actionBody.type = "ali.tmd";
}
if (pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A";
......@@ -64,6 +65,10 @@ class UtilsNeedService extends AppServiceBase {
}
}
if(pobj.actionBody.phone=="17319425791"){
pobj.actionBody.level = "F";
}
pobj.actionType = "submitNeed";
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
......@@ -617,6 +622,10 @@ class UtilsNeedService extends AppServiceBase {
async needBatchUpload(pobj,actionBody) {
var BizIds="";
var demands = [];
// 声明两个数组 用来走后四步用
var npobj = [];
var spobj = [];
// 遍历生成阿里需求 并把bizId 填充进数组
for(var i = 0;i < actionBody.demands.length;i++) {
// 第一步
// 地区转换
......@@ -633,29 +642,18 @@ class UtilsNeedService extends AppServiceBase {
Channel:"gsb",
Token:"gsb",
}
// 4.1 提交阿里需求
var aliResult = await this.aliclient.reqbyget({ action: "SubmitIcpIntention", reqbody: obj, apiVersion: "2019-05-08" });
console.log("needBatchUpload-aliResult",aliResult)
if(aliResult.status != 0) {
// 统计失败次数
}
// 第二步
// 创建企服通需求单
var objString = JSON.stringify(pobj);
var npobj = JSON.parse(objString);
npobj.actionBody = {
intentionBizId: aliResult.data.BizId,
type: this.bizTypeChange(actionBody.demands[i].type),
description:actionBody.demands[i].description,
mobile:actionBody.demands[i].contactMobile
}
var opResult = await this.submitNeed(npobj,npobj.actionBody);
console.log("needBatchUpload-opResult",opResult)
// 第三步
// 提交Icp注册方案
var sobjString = JSON.stringify(pobj);
var spobj = JSON.parse(sobjString);
spobj.actionType = "submitIcpProgramme";
spobj.actionBody = {
// 整合前端需要的数据1
BizIds += aliResult.data.BizId + ",";
npobj.push({
"intentionBizId": aliResult.data.BizId,
"type": this.bizTypeChange(actionBody.demands[i].type),
"description":actionBody.demands[i].description,
"mobile":actionBody.demands[i].contactMobile
})
spobj.push({
"needNo": aliResult.data.BizId,//渠道需求号
"solutionContent":{
// submitIcpProgramme需要的类型转换 ICP许可证 = icpsq/EDI许可证 = edisq
......@@ -668,44 +666,63 @@ class UtilsNeedService extends AppServiceBase {
"Note":actionBody.demands[i].description
}
}
})
if(aliResult.status != 0) {
// 统计失败次数
}
var subRes = await this.qcCenterOrderSve.submitIcpProgramme(spobj);
}
// 判断数据是否符合 执行后四步 的条件
if(npobj.length != actionBody.demands.length || spobj.length != actionBody.demands.length) {
return system.getResultFail(-5018,"提交阿里需求失败");
}
// 睡3秒 意义:等待阿里异步分配成功。如果不等待则提交方案会失败 无法生成支付链接,需求状态错误
await this.sleep(3000)
// 遍历 执行后面步骤 创建企服需求单(提交方案需要)。提交方案。需求沟通提交
for(var i = 0;i < actionBody.demands.length;i++) {
// 第二步
// 创建企服通需求单
var objString1 = JSON.stringify(pobj);
var obj1 = JSON.parse(objString1);
obj1.actionBody = npobj[i];
var opResult = await this.submitNeed(obj1, obj1.actionBody);
console.log("needBatchUpload-opResult",opResult)
// 第三步
// 提交Icp注册方案
// 程序执行比异步分配需求快,所以写成两个循环
var objString2 = JSON.stringify(pobj);
var obj2 = JSON.parse(objString2);
obj2.actionType = "submitIcpProgramme";
obj2.actionBody = spobj[i];
var subRes = await this.qcCenterOrderSve.submitIcpProgramme(obj2);
console.log("----------------------------------start");
console.log("needBatchUpload-res",subRes)
console.log("----------------------------------end");
// 第四步
// 需求沟通记录接口
var writeRes = await this.writeCommunicationLog({actionBody:{intentionBizId:"20200804200124000001",note:"测试反馈"}});
var writeRes = await this.writeCommunicationLog({actionBody:{intentionBizId:npobj[i].intentionBizId,note:"测试反馈"}});
console.log("needBatchUpload-writeRes",writeRes)
// 整合前端需要的数据
// BizIds.push(aliResult.data.BizId)
BizIds += aliResult.data.BizId + ",";
// 整合前端需要的数据2
demands.push({
uniqueCode:actionBody.demands[i].uniqueCode,
demandCode: opResult.data.needNo
demandCode: npobj[i].intentionBizId
})
}
BizIds = BizIds.substr(0, BizIds.length - 1);
// 第五步 用户需求确认
// 首先切割掉BizId最后一位 是,
BizIds = BizIds.substr(0, BizIds.length - 1);
var aliConfirmResult = await this.aliclient.reqbyget({ action: "ConfirmIcpIntention", reqbody: {BizIds:BizIds}, apiVersion: "2019-05-08" });
console.log("needBatchUpload-aliConfirmResult",aliConfirmResult)
// 获取链接失败
if(aliConfirmResult.status != 0) {
var res = {
paymentLink:"www.baidu.com",
batchNumber:actionBody.batchNumber,
demands:demands
}
return system.getResultFail(-5018,"confirmIcpIntention fail");
// return system.getResultRedisSuccess(res);
}
var res = {
paymentLink:aliConfirmResult.data.ConfirmUrl,
batchNumber:actionBody.batchNumber,
demands:demands
}
// 2020 0916 lin 新增返回格式 成功status为1
return system.getResultRedisSuccess(res);
// 2020 0916 lin 新增返回格式 成功status为1 因为queue判断成功请求的条件为status1
return system.getResultRedisQueueSuccess(res);
}
async testsymq(pobj) {
var a = null;
......@@ -808,6 +825,11 @@ class UtilsNeedService extends AppServiceBase {
return "edisq"
}
}
sleep(t) {
return new Promise(res => setTimeout(res, t))
}
urlSplit(url) {
var arr = url.split("?")[1]; //根据?跟个url
var arr2 = arr[1].split("&"); //根据&重新分割参数
......@@ -817,6 +839,11 @@ class UtilsNeedService extends AppServiceBase {
}
return jsonarr;
}
// async test() {
// var aliConfirmResult = await this.aliclient.reqbyget({ action: "ConfirmIcpIntention", reqbody: {BizIds:"20200916170117000001,20200916170117000002,20200916170117000003,20200916170118000001,20200916170118000002,20200916170118000003,20200916170119000001,20200916170119000002,20200916170120000001,20200916170120000002,20200916170120000003,20200916170121000001,20200916170121000002,20200916170121000003,20200916170122000001,20200916170122000002,20200916170122000003,20200916170123000001,20200916170123000002"}, apiVersion: "2019-05-08" });
// console.log("needBatchUpload-aliConfirmResult",aliConfirmResult)
// }
// async test1() {
// var a = await this.aliclient.reqbyget({ action: "CloseIntention", reqbody: { BizId: "20200416125415000001", Note: "测试需求关闭" }, apiVersion: "2019-05-08" });
......@@ -838,4 +865,7 @@ module.exports = UtilsNeedService;
// var a = new UtilsNeedService();
// a.queryTradeIntentionUserList({ actionBody: { intentionBizId: "20200803095203000001", userFeedBack: true } });
// var a = new UtilsNeedService();
// a.test();
......@@ -291,27 +291,83 @@ class UtilsOrderService extends AppServiceBase {
if (payStatus.data && payStatus.data.trxstatus == "0000") {
//TODO:处理支付成功的业务逻辑
// payStatus.data.client_ip = obj.client_ip || "";
// let attachList = [];
// if (payStatus.data.reqsn.indexOf("_") >= 0) {
// attachList = payStatus.data.reqsn.split("_");
// }
// else {
// attachList.push(payStatus.data.reqsn);
// }
// if (attachList.length != 2) {
// return { -120, msg: "reqsn参数错误,没有_标识" };
// }
// payStatus.data.out_trade_no = attachList[0];
// payStatus.data.company_id = attachList[1];
// return await this.utilstlbankSve.opBackNotify(payStatus.data, "页面回调");
return system.getResultFail(-100130,'订单已支付,请勿重复付款,100130')
// this.opPayStatusSuccess
// return system.getResultFail(-100130,'订单已支付,请勿重复付款,100130')
return system.getResultSuccess(payStatus.data,'订单已支付,请勿重复付款,100130');
}
else if (payStatus.data && payStatus.data.trxstatus == "3045") {
return system.getResultFail(-100170, "超时未支付,请刷新页面,100170");
}
return system.getResultFail(-100180, "请及时支付,100180");
}
async opPayStatusSuccess(parmas, client_ip) { //操作回调业务逻辑---查询支付状态为已支付时进行调用
try {
//日志记录
this.logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "回调处理订单参数:,method=opPayStatusSuccess",
op: "service/impl/utilsSve/utilsOrderSve.js/opPayStatusSuccess",
content: JSON.stringify(parmas),
clientIp: client_ip || ""
});
//获取充值业务锁
// await this.cacheManager["TlPayLocker"].init(receiptVoucher.sourceOrderNo);//---测试时放开
var locker = await this.cacheManager["TlPayLocker"].enter(receiptVoucher.sourceOrderNo);
if (!locker || locker != "1") {
this.logCtl.info({
appid: appInfo.uapp_id,
appkey: appInfo.uapp_key,
op: "service/impl/utilsSve/utilsOrderSve.js/opPayStatusSuccess",
content: "参数=" + JSON.stringify(parmas),
clientIp: parmas.client_ip || "",
optitle: "通联回调操作频繁---太频繁了,太频繁了"
});
return system.getResultFail(-200, "回调操作频繁---太频繁了,太频繁了");
}
if (parmas.trxcode == "VSP501") {
parmas.pay_type = "wx";
} else {
parmas.pay_type = "alipay";
}
parmas.appInfo = appInfo;
parmas.orderNo = parmas.out_trade_no;
//修改并返回订单支付状态,创建收款单
var url = this.centerOrderUrl + "opaction/opPayOrder/receivePayCallBackNotify";
var opResult = await this.restPostUrl(parmas, url);
if (opResult.status == 0) {
opResult.data.appInfo = {
uapp_id: appInfo.uapp_id,
uapp_key: appInfo.uapp_key,
app_code: appInfo.app_code,
app_name: appInfo.app_name
};
opResult.data.userInfo = {
channel_userid: opResult.data.order_info.channelUserId,
channel_username: opResult.data.order_info.channelUserId,
channel_nickname: opResult.data.order_info.channelUserId
};
var pobj = {
appInfo: opResult.data.appInfo,
actionBody: opResult.data
}
// this.utilsPushSve.pushBusInfo(opResult.data, "pushOrderBusiness",0);
this.utilsPushSve.pushBusInfo(pobj, "pushOrder", 0);
}
opResult.data = null;
return opResult;
} catch (e) {
await this.cacheManager["TlPayLocker"].release(parmas.out_trade_no);
this.logCtl.error({
optitle: "回调处理订单---error异常",
op: "center-app/app/base/service/impl/utilsSve/utilstlbankSve.js/opBackNotify",
content: "参数=" + JSON.stringify(parmas) + ",error:" + e.stack,
clientIp: client_ip || ""
});
return system.getResultFail(-200, e.stack);
}
}
/**
* 获取pc端支付二维码--不跟订单关联
* @param {*} pobj
......
......@@ -8,9 +8,28 @@ class UtilsTmOrderCallService extends AppServiceBase {
constructor() {
super();
this.aliclient = system.getObject("util.aliyunClient");
this.centerOrderUrl = settings.centerOrderUrl();
this.aliUappId = settings.aliUappId();
}
async queryTradeProduceList(pobj, actionBody) {//2020 0907 lin 新增 ali查询 用户确认资料支付尾款,并更新订单状态
// 1查询渠道/商品为icp/edi的订单已经支付部分款的订单。
// 这里写死 itemCode 和 订单状态
pobj.actionBody.itemCode = "tmjy"
pobj.actionBody.orderStatus = 64
pobj.actionType = "queryVOrderByOrderStatusAndItemCode";
pobj.appInfo = {
uapp_id: this.aliUappId
}
// 随便填的。因为center-order会校验if (!pobj.userInfo) {
pobj.userInfo = {
uapp_id: this.aliUappId
}
var url = this.centerOrderUrl + "action/order/springBoard";
var res = await this.restPostUrl(pobj, url);
console.log(res);
// 2查询渠道/商品为icp/edi的订单已经支付尾款的订单。
// 3
var obj = {
BuyerStatus: 11,
PageNum: 1,
......
......@@ -53,7 +53,7 @@ class aliyunClient {
reqAliclient.apiVersion = obj.apiVersion;
}
var res = await reqAliclient.request(action, reqbody, {
timeout: 3000, // default 3000 ms
timeout: 10000, // default 3000 ms 2020 0916 lin修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'GET', // set the http method, default is GET
......
......@@ -51,6 +51,14 @@ var settings = {
return "http://aliossjava-service/uploadfile";
}
},
aliGetNamesjavaUrl: function () {
if (this.env == "dev") {
return "192.168.210.240:80/getNames";
} else {
return "http://aliossjava-service/getNames";
}
},
tmtransactionUrl: function () {
if (this.env == "dev") {
return "http://192.168.2.109:8080/uploadfile";
......@@ -220,6 +228,13 @@ var settings = {
return "https://m.ucommune.com/"// 6.29lin修改为测试环境。原因优客 目前还没有正式环境
}
},
aliUappId: function () {
if (this.env == "dev") {
return 18// uapp_id
} else {
return 18// uapp_id
}
},
apiconfig: {
opLogUrl: function () {
return settings.reqEsAddr() + "center_channel_log/_doc?pretty";
......
......@@ -14,6 +14,7 @@
1. [根据申请号查询聚合](#CommomSearchbyFilingno)
1. [根据公开号查询聚合](#CommomSearchbyPubno)
1. [根据发明人查询聚合](#CommomSearchbyInventor)
1. [根据申请号查询并根据法律状态日期排序](#AffairsearchbyFilingno)
## **<a name="CommomSearchbyApplicant"> 根据申请人查询聚合接口</a>**
......@@ -1073,3 +1074,73 @@
}
```
## **<a name="AffairsearchbyFilingno"> 根据申请号查询并根据法律状态日期排序</a>**
[返回到目录](#menu)
##### URL
[/action/patentQuery/AffairsearchbyFilingno]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:AffairsearchbyFilingno
```javascript
{
"filingno":"201410451887"//申请号
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "操作成功",
"data": {
"total": 3,
"max_score": null,
"hits": [{
"_index": "bigdata_patent_affair",
"_type": "_doc",
"_id": "24696710",
"_score": null,
"_source": {
"filing_no": "201410451887",
"aff_info": "公开",
"aff_date": "2015-01-21",
"aff_timestamp": 1421816400,
"aff_status": "公开",
"aff_code": "024000"
},
"sort": [1421798400000]
}, {
"_index": "bigdata_patent_affair",
"_type": "_doc",
"_id": "5523865",
"_score": null,
"_source": {
"filing_no": "201410451887",
"aff_info": "实质审查的生效",
"aff_date": "2015-02-18",
"aff_timestamp": 1424235600,
"aff_status": "实质审查的生效",
"aff_code": "001000"
},
"sort": [1424217600000]
}, {
"_index": "bigdata_patent_affair",
"_type": "_doc",
"_id": "41352716",
"_score": null,
"_source": {
"filing_no": "201410451887",
"aff_info": "授权",
"aff_date": "2017-10-10",
"aff_timestamp": 1507608000,
"aff_status": "授权",
"aff_code": "026000"
},
"sort": [1507593600000]
}]
},
"bizmsg": "empty"
}
```
\ No newline at end of file
<a name="menu" href="/doc">返回主目录</a>
1. [获取pc端支付二维码--不跟订单关联](#getQrCode)
1. [pc端订单支付二维码生成](#getOrderQrCode)
1. [pc端查询订单是否支付成功](#getOrderQrCode)
1. [获取H5支付链接](#getH5PayUrl)
## **<a name="getQrCode"> 获取pc端支付二维码--不跟订单关联</a>**
[返回到目录](#menu)
##### URL
[/web/payment/paymentApi/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:getQrCode
``` javascript
{
"uapp_id": "1", //平台渠道ID
"order_num": "1", //支付单号
"total_fee": "1",   //支付金额  分
"body_desc": "1",    //产品名称
"opType": "1", // 支付方式  alipay阿里  wx微信
}
```
#### 返回结果
```javascript
{
"status": 0,  //0 成功 小于0  失败
"msg": "SUCCESS",
"data": {
"payinfo": "https://syb.allinpay.com/apiweb/h5unionpay/native?key=l6lfPuHDErJrTW%2FN7WxSlg4n", //二维码url
"reqsn": "dfghrtjjn_1",  ////商户订单号_appid
"chnltrxid": "112094120001042656", // 支付渠道交易单号,如支付宝,微信平台的交易单号
"trxid": "112094120001042656",  // 交易单号,平台的交易流水号
"trxstatus": "0000"   // 交易状态,0000:交易成功、1001:交易不存在、
},
"requestId": "058244807fff4ab388bbda79afc04b28"
  }
```
## **<a name="getOrderQrCode"> pc端订单支付二维码生成</a>**
[返回到目录](#menu)
##### URL
......@@ -71,6 +37,29 @@
}
```
## **<a name="queryOrderStatus"> pc端查询订单是否支付成功</a>**
[返回到目录](#menu)
##### URL
[/web/payment/paymentApi/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:queryOrderStatus
``` javascript
{
"orderNo": "TM22202008042050Pmex",//订单号
"opType": "wx"// 支付方式  alipay阿里  wx微信
}
```
#### 返回结果
``` javascript
{
"status": 0,// 0为成功,否则失败
"msg": "success",
"data": null,
"requestId": "07dedd4ffd4441dcac54c6d8a0f91653"
}
```
## **<a name="getH5PayUrl"> 获取H5支付链接</a>**
[返回到目录](#menu)
......
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