Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
4fccccd7
Commit
4fccccd7
authored
May 19, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pushorder2fq
parent
317a85bb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
219 additions
and
2 deletions
+219
-2
igirl-web/app/base/api/impl/task.js
+24
-0
igirl-web/app/base/db/models/order.js
+4
-0
igirl-web/app/base/service/impl/orderSve.js
+114
-2
igirl-web/app/base/utils/aliyunClient.js
+77
-0
No files found.
igirl-web/app/base/api/impl/task.js
0 → 100644
View file @
4fccccd7
var
System
=
require
(
"../../system"
);
const
logCtl
=
System
.
getObject
(
"web.oplogCtl"
);
class
Task
{
constructor
()
{
this
.
orderSve
=
System
.
getObject
(
"service.orderSve"
);
}
//订单信息推送至蜂擎
async
pushOrderInfo2Fq
(
pobj
){
try
{
var
result
=
await
this
.
orderSve
.
pushOrderInfo2Fq
(
pobj
);
return
result
;
}
catch
(
e
)
{
logCtl
.
error
({
optitle
:
"订单信息推送异常"
,
op
:
"app/base/api/impl/task.js/pushOrderInfo2Fq"
,
content
:
e
.
stack
,
clientIp
:
""
});
return
{
code
:
-
1
,
message
:
"订单信息推送异常"
,
data
:
[]
};
}
}
}
module
.
exports
=
Task
;
igirl-web/app/base/db/models/order.js
View file @
4fccccd7
...
@@ -174,6 +174,10 @@ module.exports = (db, DataTypes) => {
...
@@ -174,6 +174,10 @@ module.exports = (db, DataTypes) => {
values
:
Object
.
keys
(
uiconfig
.
config
.
pdict
.
sub_type
),
values
:
Object
.
keys
(
uiconfig
.
config
.
pdict
.
sub_type
),
defaultValue
:
"platform"
,
defaultValue
:
"platform"
,
},
},
pushStatus
:{
//提报类型:"platform": "平台", "self": "自己"
type
:
DataTypes
.
INTEGER
,
defaultValue
:
0
,
},
//支付状态:待支付,已支付---(用于提供交付数据、待材料审核的数据)
//支付状态:待支付,已支付---(用于提供交付数据、待材料审核的数据)
//新增商标交付状态------// "2": "待上传材料", "3": "待审核", "4": "审核不通过", "5": "待递交" , "6": "部分递交异常", "7": "已完成"
//新增商标交付状态------// "2": "待上传材料", "3": "待审核", "4": "审核不通过", "5": "待递交" , "6": "部分递交异常", "7": "已完成"
...
...
igirl-web/app/base/service/impl/orderSve.js
View file @
4fccccd7
...
@@ -29,6 +29,8 @@ class OrderService extends ServiceBase {
...
@@ -29,6 +29,8 @@ class OrderService extends ServiceBase {
this
.
pushmsgWxop
=
system
.
getObject
(
"wxop.pushmsgWxop"
);
this
.
pushmsgWxop
=
system
.
getObject
(
"wxop.pushmsgWxop"
);
this
.
mailClient
=
system
.
getObject
(
"util.mailClient"
);
this
.
mailClient
=
system
.
getObject
(
"util.mailClient"
);
this
.
userDao
=
system
.
getObject
(
"db.userDao"
);
this
.
userDao
=
system
.
getObject
(
"db.userDao"
);
// this.fqReqUrl = "https://yunfuapi.gongsibao.com";//线上域名
this
.
fqReqUrl
=
"https://yunfuapi-dev.gongsibao.com"
;
//dev域名
}
}
//付款提醒(商标订单)
//付款提醒(商标订单)
async
orderPaymentReminder
()
{
async
orderPaymentReminder
()
{
...
@@ -2485,11 +2487,121 @@ class OrderService extends ServiceBase {
...
@@ -2485,11 +2487,121 @@ class OrderService extends ServiceBase {
}
}
}
}
//---------------------------------icp业务----end-----------------------------------------------------------------------
//---------------------------------icp业务----end-----------------------------------------------------------------------
//订单信息推送任务======================================================================================
async
pushOrderInfo2Fq
(
pobj
){
var
limit
=
5
;
if
(
pobj
&&
pobj
.
limit
){
limit
=
pobj
.
limit
;
}
var
sql
=
"select ci.name as applyName,ci.applyAddr,rv.id as rv_id,rv.payOrderNo,rv.receiptType,"
+
"o.id,o.orderPayStatus,o.code,o.mobile,o.totalSum,o.salesNum,o.sveItemCode,"
+
"rv.certifyFileUrl,rv.payDate,rv.accountType as payType,u.nickName as createUserName,u.mobile as createUserMobile,"
+
"u.userName as createUserId from (SELECT * FROM `biz_order` where (orderPayStatus='yfk') "
+
" and pushStatus=0 ) as o "
+
"LEFT JOIN biz_customerinfo as ci on o.customerinfo_id=ci.id "
+
"LEFT JOIN p_user AS u ON o.createuser_id = u.id "
+
"LEFT JOIN biz_receiptvoucher as rv on rv.sourceOrderNo = o.code where 1=1 "
+
"ORDER BY id,rv_id ASC LIMIT "
+
limit
;
var
orderList
=
await
this
.
dao
.
customQuery
(
sql
);
var
pushOrderList
=
[];
var
pushResList
=
[];
for
(
var
i
=
0
;
i
<
orderList
.
length
;
i
++
){
var
orderInfo
=
orderList
[
i
];
if
(
pushOrderList
.
indexOf
(
orderInfo
.
code
)
<
0
){
var
pushRes
=
await
this
.
pushFqBusiness
(
orderInfo
);
pushOrderList
.
push
(
orderInfo
.
code
);
pushResList
.
push
(
pushRes
);
}
if
(
pushRes
&&
pushRes
.
code
&&
pushRes
.
code
==
200
){
await
this
.
dao
.
update
({
id
:
orderInfo
.
id
,
pushStatus
:
"1"
});
}
}
return
{
code
:
200
,
data
:
pushResList
};
}
async
pushFqBusiness
(
order
)
{
//推送商机
// "5ec3996d34b232000924d6c7": "知圈圈(商标撤三)",
// "5ec39934b57efc000bc30eb0": "知圈圈(商标撤三)",
// "5ec398f1712701000b02ad4e": "知圈圈(商标异议答辩)",
// "5ec398a7b57efc000bc30ead": "知圈圈(商标变更)",
// "5ec39835c62d5c000a7be3ff": "知圈圈(商标转让)",
// "5ec37f816141c9000ba9619e": "知圈圈(商标驳回复审)",
// "5ec37f3e0dc2c8000bb0f45b": "知圈圈(软件著作权注册)",
// "5ec37ebce22a25000a30ebcd": "知圈圈(商标注册)",
var
itemCodeContrast
=
{
"zzsbzc"
:
"5ec37ebce22a25000a30ebcd"
,
"dlrfzzc"
:
"5ec37ebce22a25000a30ebcd"
,
"dbsbzc"
:
"5ec37ebce22a25000a30ebcd"
,
//商标注册
"rjzzqdj"
:
"5ec37f3e0dc2c8000bb0f45b"
,
//软件著作权注册
"sbbhfs"
:
"5ec37f816141c9000ba9619e"
,
//商标驳回复审
"sbzr"
:
"5ec39835c62d5c000a7be3ff"
,
//商标转让
"sbbg"
:
"5ec398a7b57efc000bc30ead"
,
//商标变更
"sbyydb"
:
"5ec398f1712701000b02ad4e"
,
//商标异议答辩
"sbxz"
:
"5ec39934b57efc000bc30eb0"
,
//商标续展
"sbcssq"
:
"5ec3996d34b232000924d6c7"
,
//商标撤三
};
//产品码对照
if
(
!
order
||
!
order
.
sveItemCode
||
!
itemCodeContrast
[
order
.
sveItemCode
]){
return
{
code
:
-
100
,
message
:
"产品错误"
};
}
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
{};
var
reqUrl
=
this
.
fqReqUrl
+
"/crm/order/submit"
;
try
{
var
body
=
{
"idempotentId"
:
order
.
id
,
// 业务编号(订单id)
"idempotentSource"
:
"zqq"
,
// 来源编号,写死:zqq
"idempotentSourceName"
:
"知圈圈"
,
// 来源编号,写死:知圈圈
"thirdPartyCustomerId"
:
order
.
mobile
,
// 你们客户id
"productId"
:
itemCodeContrast
[
order
.
sveItemCode
],
// 云服产品id
"orderPrice"
:
order
.
totalSum
,
// 订单金额
"productQuantity"
:
order
.
salesNum
,
// 产品数量
"companyName"
:
order
.
applyName
,
// 公司名称
"phone"
:
order
.
mobile
,
//客户手机号
"operator_phone"
:
"13301398963"
,
//业务员手机号
"pay_flow_no"
:
order
.
payOrderNo
||
""
,
//支付流水号
"pay_channel"
:
""
,
"pay_payer_name"
:
""
,
//付款人姓名
"pay_payer_bank_no"
:
""
,
//付款人账号
"pay_time"
:
order
.
payDate
//支付时间
};
if
(
order
.
payType
==
"wx"
){
body
[
"pay_channel"
]
=
"微信"
;
//支付渠道(微信、支付宝、网银)
}
if
(
order
.
payType
==
"alipay"
){
body
[
"pay_channel"
]
=
"支付宝"
;
//支付渠道(微信、支付宝、网银)
}
if
(
order
.
payType
==
"bank"
){
body
[
"pay_channel"
]
=
"网银"
;
//支付渠道(微信、支付宝、网银)
}
if
(
order
.
certifyFileUrl
){
body
[
"pay_vouchers"
]
=
[{
"url"
:
order
.
certifyFileUrl
,
"name"
:
"支付凭证"
}];
//凭证url
}
rtn
=
await
rc
.
post
(
reqUrl
,
body
);
if
(
rtn
.
code
!=
200
&&
rtn
.
success
!=
true
)
{
return
{
code
:
-
1
,
message
:
"推送失败,失败原因:"
+
rtn
.
errorMsg
+
",selfrequestId="
+
req
.
requestId
+
",requestId="
+
rtn
.
requestId
};
}
logCtl
.
info
({
optitle
:
"知圈圈订单信息推送-----------蜂擎"
,
op
:
"app/base/service/impl/orderSve.js/pushFqBusiness"
,
content
:
"参数:"
+
JSON
.
stringify
(
body
)
+
",返回结果:"
+
JSON
.
stringify
(
rtn
),
clientIp
:
""
});
return
rtn
;
}
catch
(
e
)
{
logCtl
.
error
({
optitle
:
"知圈圈订单信息推送-----------蜂擎异常"
,
op
:
"app/base/service/impl/orderSve.js/pushFqBusiness"
,
content
:
"error:"
+
e
.
stack
+
",参数="
+
JSON
.
stringify
(
order
),
clientIp
:
""
});
return
{
code
:
-
200
,
message
:
"推送异常"
,
err
:
e
};
}
}
//订单信息推送任务==================end====================================================================
}
}
module
.
exports
=
OrderService
;
module
.
exports
=
OrderService
;
// var task = new OrderService();
// var task = new OrderService();
// task.
orderPaymentReminder
().then(d=>{
// task.
pushOrderInfo2Fq
().then(d=>{
// console.log("dddddddddddddddddd");
// console.log("dddddddddddddddddd");
// console.log(
d
);
// console.log(
JSON.stringify(d)
);
// })
// })
igirl-web/app/base/utils/aliyunClient.js
0 → 100644
View file @
4fccccd7
const
Client
=
require
(
'aliyun-api-gateway'
).
Client
;
var
RPCClient
=
require
(
'@alicloud/pop-core'
).
RPCClient
;
const
client
=
new
Client
(
'203756805'
,
'crkyej0xlmqa6bmvqijun6ltxparllyn'
);
//开发
// const client = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上
class
aliyunClient
{
constructor
()
{
// this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
this
.
aliclient
=
new
RPCClient
({
accessKeyId
:
'LTAI4FmyipY1wuLHjLhMWiPa'
,
accessKeySecret
:
'hp4FF18IDCSym1prqzxrAjnnhNH3ju'
,
endpoint
:
'https://trademark.aliyuncs.com'
,
apiVersion
:
'2018-07-24'
});
}
async
post
(
aliReqUrl
,
actionBody
)
{
// var reqParam = {};
// reqParam["ActionProcess"] = "AliTm";
// reqParam["ActionType"] = actionType;
// reqParam["ActionBody"] = actionBody;
// if (!actionBody.reqOnlyCode) {
// actionBody["reqOnlyCode"] = await this.getCreateOrderNum();
// }
var
param
=
{
data
:
actionBody
,
timeout
:
20000
,
headers
:
{
accept
:
'application/json'
}
};
console
.
log
(
JSON
.
stringify
(
param
),
"______________峰擎---阿里云参数_______"
);
var
result
=
await
client
.
post
(
aliReqUrl
,
param
);
console
.
log
(
JSON
.
stringify
(
result
),
"______________峰擎---阿里云返回结果_______"
);
return
result
;
}
//阿里接口
async
reqbyget
(
obj
,
cbk
)
{
var
self
=
this
;
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
return
self
.
aliclient
.
request
(
action
,
reqbody
,
{
timeout
:
3000
,
// default 3000 ms
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
headers
:
{},
// set the http request headers
});
}
// async getCreateOrderNum() {
// var createOrderNum = await this.getUidStr(5, 36);//====================订单号生成
// return createOrderNum + "" + Date.now();
// }
// async getUidStr(len, radix) {
// var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
// var uuid = [], i;
// radix = radix || chars.length;
// if (len) {
// for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
// } else {
// var r;
// uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
// uuid[14] = '4';
// for (i = 0; i < 36; i++) {
// if (!uuid[i]) {
// r = 0 | Math.random() * 16;
// uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
// }
// }
// }
// return uuid.join('');
// }
}
module
.
exports
=
aliyunClient
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment