Commit a855b85a by 宋毅

tj

parent 97af5cb9
......@@ -6,6 +6,7 @@ class ProductAPI extends WEBBase {
super();
this.utilsOpOrderSve = system.getObject("service.utilsSve.utilsOpOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.utilsTmAliyunSve = system.getObject("service.utilsSve.utilsTmAliyunSve");
}
/**
* 接口跳转-POST请求
......@@ -27,20 +28,25 @@ class ProductAPI extends WEBBase {
pobj.requestId = req.requestId;
var opResult = null;
switch (action_type) {
case "closeAliTrademarkApplication"://关闭阿里自主申请actionBody:{product_id:产品id,parentCode:商标申请实例id}
var pushInterfaceResult = await this.utilsOpOrderSve.getProductInterface(pobj, pobj.actionBody.product_id);
case "opAliDingInterfaceManage"://操作阿里钉钉接口管理---actionBody:{为阿里需要的参数}
var pushInterfaceResult = await this.utilsOpOrderSve.getProductInterface(pobj.appInfo, pobj.product_id);
if (pushInterfaceResult.status != 0) {
pobj.actionBody.product_info.interface_info = pushInterfaceResult.data;
this.utilsPushSve.pushBusInfo(pobj, "closeAliTmApply", 1);
return pushInterfaceResult;
}
break;
case "checkTmNameByAli"://检测商标名称是否合规
var pushInterfaceResult = await this.utilsOpOrderSve.getProductInterface(pobj, pobj.actionBody.product_id);
if (pushInterfaceResult.status != 0) {
pobj.actionBody.product_info.interface_info = pushInterfaceResult.data;
this.utilsPushSve.pushBusInfo(pobj, "closeAliTmApply", 1);
var interface_list_temp = pushInterfaceResult.data.filter(f => f.op_type == "createAliTmApply")
if (!interface_list_temp || interface_list_temp.length == 0) {
return system.getResult(null, "暂无【createAliTmApply】的推送配置,100520");
}
pobj.interface_params = interface_list_temp[0].params;
opResult = await this.utilsTmAliyunSve.opAliDingInterfaceManage(pobj);
break;
// case "checkTmNameByAli"://检测商标名称是否合规
// var pushInterfaceResult = await this.utilsOpOrderSve.getProductInterface(pobj, pobj.actionBody.product_id);
// if (pushInterfaceResult.status != 0) {
// pobj.actionBody.product_info.interface_info = pushInterfaceResult.data;
// this.utilsPushSve.pushBusInfo(pobj, "closeAliTmApply", 1);
// }
// break;
case "updateContacts"://修改订单联系人
opResult = await this.utilsOpOrderSve.updateContacts(pobj, pobj.actionBody);
break;
......
......@@ -81,10 +81,10 @@ class AppServiceBase {
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/app.base.js/restPostUrl",
op: "service/app.base.js/execPostUrl",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->restPostUrl",
optitle: pobj.opType + "基类操作异常->execPostUrl",
});
return system.getResult(null, errorMsg);
}
......@@ -161,8 +161,8 @@ class AppServiceBase {
var opType = pobj.opType || "";
if (result.status != 0) {
this.pushlogSve.createFailLogDb({
appid: pobj.appInfo.uapp_id,
appkey: pobj.appInfo.uapp_key,
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
content: JSON.stringify(pobj),//推送的参数信息
resultInfo: JSON.stringify(result),
......@@ -175,8 +175,8 @@ class AppServiceBase {
return result;
}
this.pushlogSve.createDb({
appid: pobj.appInfo.uapp_id,
appkey: pobj.appInfo.uapp_key,
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "推送业务类型:" + opType,
content: JSON.stringify(pobj),//推送的参数信息
......@@ -192,13 +192,13 @@ class AppServiceBase {
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType 错误类型,1为old-rpc推送失败日志,2为new-rpc推送失败日志,业务处理失败日志
* @param {*} failType 错误类型,1为old-rpc推送失败日志,2为new-rpc推送失败日志,业务处理失败日志,3为失败日志记录
*/
async disposePushResultFail(pobj, result, opTitleDesc, failType) {//处理失败的结果信息--内部使用
var opType = pobj.opType || "";
this.pushlogSve.createFailLogDb({
appid: pobj.appInfo.uapp_id,
appkey: pobj.appInfo.uapp_key,
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
content: JSON.stringify(pobj),//推送的参数信息
resultInfo: JSON.stringify(result),
......@@ -211,12 +211,24 @@ class AppServiceBase {
return result;
}
async getAliossjavaFileUrl(pobj, params) {//上传ali oss 文件调用
var opType = pobj.opType || "";
try {
var aliOssFileInfo = await this.execPostUrl(params, settings.aliossjavaUrl());
if (aliOssFileInfo) {
if (aliOssFileInfo == true) {
var fileUrl = params.filedir + "/" + params.objectName;
return system.getResultSuccess(fileUrl);
}
this.pushlogSve.createFailLogDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
content: JSON.stringify(params),//推送的参数信息
resultInfo: JSON.stringify(aliOssFileInfo),
clientIp: pobj.clientIp || "",
failType: 3,
opTitle: opType + "aliossjava-upload阿里上传文件操作失败->getAliossjavaFileUrl",
pushNumber: 1
});
return system.getResult(null, "java ali oss upload fail");
} catch (e) {
this.logCtl.error({
......
......@@ -488,13 +488,13 @@ class UtilsOrderService extends AppServiceBase {
// uappId: outTradeInfo[1],
// productId: outTradeInfo.length == 3 ? outTradeInfo[2] : 0
// }
opResult.data = {
orderNo: "TM36202004111014WcFs",
uappId: 36,
productId: 42
};
// opResult.data = {
// orderNo: "TM36202004142002tEl6",
// uappId: 36,
// productId: 42
// };
//获取充值业务锁
await this.cacheManager["TlPayLocker"].init(opResult.data.orderNo);//---测试时放开
// await this.cacheManager["TlPayLocker"].init(opResult.data.orderNo);//---测试时放开
var locker = await this.cacheManager["TlPayLocker"].enter(opResult.data.orderNo);
if (!locker || locker != "1") {
this.logCtl.info({
......
......@@ -31,6 +31,9 @@ class UtilsTmAliyunService extends AppServiceBase {
var idCardOssKey = "";
var businessLicenceOssKey = "";
var legalNoticeOssKey = "";
var picUrl = "";
var authorizationOssKey = "";
if (apply.customerType != "ent" && apply.identityCardPic) {
idCardOssKey = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.CARD, apply.identityCardPic, rpcParam);
if (!idCardOssKey) {
......@@ -43,24 +46,24 @@ class UtilsTmAliyunService extends AppServiceBase {
verifyResult = system.getResult(null, "businessLicensePic ali oss upload is error,100464");
}
}
if (apply.smwjUrl) {
legalNoticeOssKey = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.LEGAL_NOTICE, apply.smwjUrl, rpcParam);
if (!legalNoticeOssKey) {
verifyResult = system.getResult(null, "smwjUrl ali oss upload is error,100466");
if (verifyResult.status == 0) {
if (apply.smwjUrl) {
legalNoticeOssKey = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.LEGAL_NOTICE, apply.smwjUrl, rpcParam);
if (!legalNoticeOssKey) {
verifyResult = system.getResult(null, "smwjUrl ali oss upload is error,100466");
}
}
}
var picUrl = "";
var authorizationOssKey = "";
if (tmInfo.picUrl) {
picUrl = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.ICON, tmInfo.picUrl, rpcParam);
if (!picUrl) {
verifyResult = system.getResult(null, "picUrl ali oss upload is error,100467");
if (tmInfo.picUrl) {
picUrl = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.ICON, tmInfo.picUrl, rpcParam);
if (!picUrl) {
verifyResult = system.getResult(null, "picUrl ali oss upload is error,100467");
}
}
}
if (apply.gzwtsUrl) {
authorizationOssKey = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.ATTORNEY, apply.gzwtsUrl, rpcParam);
if (!authorizationOssKey) {
verifyResult = system.getResult(null, "gzwtsUrl ali oss upload is error,100468");
if (apply.gzwtsUrl) {
authorizationOssKey = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.ATTORNEY, apply.gzwtsUrl, rpcParam);
if (!authorizationOssKey) {
verifyResult = system.getResult(null, "gzwtsUrl ali oss upload is error,100468");
}
}
}
if (verifyResult.status != 0) {
......@@ -94,21 +97,38 @@ class UtilsTmAliyunService extends AppServiceBase {
reqbody: actionBody,
rpcParam: rpcParam
}
// var applicantResult = await this.opAliyunRpcReq(pobj, params);
// if (applicantResult.status != 0) {
// return await this.disposePushResultFail(pobj, applicantResult, "ali->tmCreateApplicant->applicantResult");
// }//++++++++++++++++++++++323661
var classificationsResult = await this.getClassifications(pobj, pobj.actionBody.delivery_content.nclones, rpcParam);
if (Object.keys(classificationsResult).length == 0) {
classificationsResult = system.getResult(null, "获取阿里尼斯数据为空,100469");
return await this.disposePushResultFail(pobj, classificationsResult, "ali->tmCreateApplicant->classificationsResult");
var applicantResult = await this.opAliyunRpcReq(pobj, params);
if (applicantResult.status != 0) {
return await this.disposePushResultFail(pobj, applicantResult, "ali->tmCreateApplicant->applicantResult");
}
var tmCreateResult = await this.tmCreate(pobj, tmInfo, rpcParam, picUrl, authorizationOssKey, classificationsResult, 323661);//applicantResult.data.ApplicantId);
if (tmCreateResult.status == 0) {
var classificationsResult = system.getResultSuccess();
var tmCreateResult = system.getResultSuccess();
var self = this;
for (let i = 0; i < pobj.actionBody.delivery_content.nclones.length; i++) {
const nclonesItem = pobj.actionBody.delivery_content.nclones[i];
classificationsResult = await self.getClassifications(pobj, nclonesItem, rpcParam);
if (classificationsResult.status != 0) {
classificationsResult = await self.getClassifications(pobj, nclonesItem, rpcParam);
if (classificationsResult.status != 0) {
classificationsResult = system.getResult(null, "获取阿里尼斯数据为空,100469");
break;
}//第二次调用失败则尼斯调用失败
}
tmCreateResult = await self.tmCreate(pobj, tmInfo, rpcParam, picUrl, authorizationOssKey, classificationsResult.data, applicantResult.data.ApplicantId);
if (tmCreateResult.status != 0) {
tmCreateResult = await self.tmCreate(pobj, tmInfo, rpcParam, picUrl, authorizationOssKey, classificationsResult.data, applicantResult.data.ApplicantId);
if (tmCreateResult.status != 0) {
break;
}//第二次调用失败则创建商标失败
}
//保存渠道申请人数据
actionBody.ApplicantId = 323661;//applicantResult.data.ApplicantId;
actionBody.ApplicantId = applicantResult.data.ApplicantId;
actionBody.AuthorizationOssKey = authorizationOssKey;
this.addAliChannelTmApplicant(pobj, actionBody, tmCreateResult.data.orderId);
tmCreateResult.data.tmInfo.Classifications = classificationsResult.data;
self.addAliChannelTmApplicant(pobj, actionBody, tmCreateResult.data.OrderId, tmCreateResult.data.tmInfo);
}
if (classificationsResult.status != 0) {
return await this.disposePushResultFail(pobj, classificationsResult, "ali->tmCreateApplicant->classificationsResult");
}
return await this.disposePushResult(pobj, tmCreateResult, "ali->tmCreateApplicant->tmCreateResult");
}
......@@ -189,23 +209,7 @@ class UtilsTmAliyunService extends AppServiceBase {
var result = await this.opAliyunRpcReq(pobj, params);
return await this.disposePushResult(pobj, result, "ali->updateAliTmApplicant->result");
}
async closeAliTrademarkApplication(pobj) {//主动关闭商标申请
var verifyResult = await this.opAliyunRpcVerifyParam(pobj);
if (!pobj.actionBody.parentCode) {
verifyResult = system.getResult(null, "parentCode param is empty,100490");
}
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "ali->closeAliTrademarkApplication->verifyResult");
}
var rpcParam = verifyResult.data;
var params = {
action: rpcParam.action,
reqbody: { ParentCode: pobj.actionBody.parentCode },
rpcParam: rpcParam
}
var result = await this.opAliyunRpcReq(pobj, params);
return await this.disposePushResult(pobj, result, "ali->closeAliTrademarkApplication->result");
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
......@@ -238,10 +242,12 @@ class UtilsTmAliyunService extends AppServiceBase {
reqbody: actionBody,
rpcParam: rpcParam
}
// var tmCreateReslut = await this.opAliyunRpcReq(pobj, params);
// return tmCreateReslut;
return system.getResultSuccess({ "orderId": "204426185080629" });
var tmCreateReslut = await this.opAliyunRpcReq(pobj, params);
if (tmCreateReslut.status == 0) {
tmCreateReslut.data.tmInfo = actionBody;
}
return tmCreateReslut;
// return system.getResultSuccess({ "orderId": "204426185080629" });
}
async bindAliTmApplicantGzwtsUrl(pobj, rpcParam, applicantId, authorizationOssKey) {//绑定商标申请人信息-(绑定授权书Oss文件)---内部使用
if (!authorizationOssKey) {
......@@ -293,42 +299,46 @@ class UtilsTmAliyunService extends AppServiceBase {
var self = this;
var aliNclThreesList = {};
var aliNclTwosList = [];
for (let i = 0; i < nclones.length; i++) {
const nclOneItem = nclones[i];
var nclThreeList = nclOneItem.nclThree;
var getAliThreeList = [];
for (let j = 0; j < nclThreeList.length; j++) {
const nclThreeItem = nclThreeList[j];
var aliThreeList = null;
var aliNclTwosListIndex = aliNclTwosList.findIndex(f => f.pcode === nclThreeItem.pcode);
if (aliNclTwosListIndex < 0) {
var aliNclDataResult = await self.getAliNclInfo(pobj, nclThreeItem.pcode, rpcParam);
if (aliNclDataResult.status == 0) {
aliThreeList = aliNclDataResult.data;
aliNclTwosList.push({
pcode: nclThreeItem.pcode,
nclThree: aliThreeList
});
}
}//获取ali 的信息
else {
aliThreeList = aliNclTwosList[aliNclTwosListIndex].nclThree;
}
if (!aliThreeList) {
continue;
// for (let i = 0; i < nclones.length; i++) {
const nclOneItem = nclones;
var nclThreeList = nclOneItem.nclThree;
var getAliThreeList = [];
for (let j = 0; j < nclThreeList.length; j++) {
const nclThreeItem = nclThreeList[j];
var aliThreeList = null;
var aliNclTwosListIndex = aliNclTwosList.findIndex(f => f.pcode === nclThreeItem.pcode);
if (aliNclTwosListIndex < 0) {
var aliNclDataResult = await self.getAliNclInfo(pobj, nclThreeItem.pcode, rpcParam);
if (aliNclDataResult.status == 0) {
aliThreeList = aliNclDataResult.data;
aliNclTwosList.push({
pcode: nclThreeItem.pcode,
nclThree: aliThreeList
});
}
for (let k = 0; k < aliThreeList.length; k++) {
const aliNclThree = aliThreeList[k];
if (aliNclThree.ClassificationName == nclThreeItem.name) {
getAliThreeList.push(aliNclThree.ClassificationCode);
break;
}
}//获取ali 的信息
else {
aliThreeList = aliNclTwosList[aliNclTwosListIndex].nclThree;
}
if (!aliThreeList) {
continue;
}
for (let k = 0; k < aliThreeList.length; k++) {
const aliNclThree = aliThreeList[k];
if (aliNclThree.ClassificationName == nclThreeItem.name) {
getAliThreeList.push(aliNclThree.ClassificationCode);
break;
}
}//一个大类下小项组装完毕
aliNclThreesList[nclOneItem.code] = getAliThreeList.join(',');
// aliNclThreesList["\"" + nclOneItem.code + "\""] = "\"" + getAliThreeList.join(',') + "\"";
}
return aliNclThreesList;
}
}//一个大类下小项组装完毕
if (getAliThreeList.length == 0) {
return system.getResult(null, "获取阿里尼斯数据失败,100530");
}
aliNclThreesList[nclOneItem.code] = getAliThreeList.join(',');
// aliNclThreesList["\"" + nclOneItem.code + "\""] = "\"" + getAliThreeList.join(',') + "\"";
// }
return system.getResultSuccess(aliNclThreesList)
// return aliNclThreesList;
}
async getAliNclInfo(pobj, parentCode, rpcParam) {
var params = {
......@@ -345,11 +355,11 @@ class UtilsTmAliyunService extends AppServiceBase {
//-------------------------操作渠道商标信息
async addAliChannelTmApplicant(pobj, applyInfo, channelOrderNo) {//新增ali渠道商标交付信息
async addAliChannelTmApplicant(pobj, applyInfo, channelOrderNo, tmInfo) {//新增ali渠道商标交付信息
var tmpPobj = {
actionType: "addAliChannelTmApplicant",
appInfo: pobj.appInfo,
actionBody: { deliveryData: { apply: applyInfo }, orderNo: pobj.actionBody.orderNo, channelOrderNo: channelOrderNo }
actionBody: { deliveryData: { apply: applyInfo, tm: tmInfo }, orderNo: pobj.actionBody.orderNo, channelOrderNo: channelOrderNo }
}
var reqUrl = settings.centerOrderUrl() + "opaction/opOrder/springBoard";
var result = await this.restPostUrl(tmpPobj, reqUrl);
......@@ -377,5 +387,27 @@ class UtilsTmAliyunService extends AppServiceBase {
//--------------------------------------------------内部辅助方法-------------------end-----------------
//--------------------------------------------------供外部调用方法-----------------start---------------
async opAliDingInterfaceManage(pobj, rpcParam) {//操作阿里钉钉接口管理---外部调用
var verifyResult = await this.opAliyunRpcVerifyParam(pobj);
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "ali->opAliDingInterfaceManage->verifyResult", 3);
}
var rpcParam = verifyResult.data;
var params = {
action: pobj.action,
reqbody: pobj.actionBody,
rpcParam: rpcParam
}
var result = await this.opAliyunRpcReq(pobj, params);
return result;
}
//--------------------------------------------------供外部调用方法-----------------end---------------
}
module.exports = UtilsTmAliyunService;
......@@ -88,6 +88,8 @@ class aliyunClient {
method: 'GET', // set the http method, default is GET
headers: {}, // set the http request headers
});
console.log(action,"action...........");
console.log(reqbody,"reqbody...........");
return system.getResultSuccess(res);
}
async reqCustomByPost(obj, cbk) {
......
......@@ -109,8 +109,8 @@ module.exports = function (app) {
}
req.body.appInfo = result.data;
req.body.actionProcess = result.data.app_code;
var lst = ["tmConfirm","getNeedSolutionDetailByUser",
"submitIcpProgramme","submitIcpMaterial","acceptIcpPartnerNotification","abolishIcpProgramme",
var lst = ["tmConfirm", "getNeedSolutionDetailByUser",
"submitIcpProgramme", "submitIcpMaterial", "acceptIcpPartnerNotification", "abolishIcpProgramme",
"addOrder", "getH5PayUrl", "getOrderQrCode", "queryOrderStatus", "getOrderInfo", "getOrderDeliveryInfo", "getOrderDetails",
"getOrderDeliveryFlowInfo", "getOrderDeliveryFlowList", "getOrderLogInfo", "updateContacts", "updateTmOrder", "delOrder",
"submitProgramme", "getProgrammeListByUser", "getProgrammeInfoByNeedNo", "abolishProgramme", "getAliPayInfo"
......
已经使用的编码汇总:
已经使用的编码汇总:
......@@ -49,4 +49,6 @@
100480
100490
100500
100510
\ No newline at end of file
100510
100520
100530
\ No newline at end of file
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