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
4c409c10
Commit
4c409c10
authored
Jul 08, 2020
by
zhaoxiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
cffe9c82
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
172 additions
and
50 deletions
+172
-50
bpo-admin/app/base/api/impl/channelApi.js
+133
-46
bpo-admin/app/base/db/impl/busistatDao.js
+20
-0
bpo-admin/app/base/service/impl/busistatSve.js
+6
-0
bpo-admin/app/base/service/impl/channelSve.js
+9
-1
bpo-admin/app/config/localsettings.js
+1
-1
bpo-admin/app/config/settings.js
+3
-2
No files found.
bpo-admin/app/base/api/impl/channelApi.js
View file @
4c409c10
...
@@ -11,9 +11,10 @@ class ChannelApi {
...
@@ -11,9 +11,10 @@ class ChannelApi {
this
.
esettleSve
=
system
.
getObject
(
"service.esettleSve"
);
this
.
esettleSve
=
system
.
getObject
(
"service.esettleSve"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
esettleofflineitemSve
=
system
.
getObject
(
"service.esettleofflineitemSve"
);
this
.
esettleofflineitemSve
=
system
.
getObject
(
"service.esettleofflineitemSve"
);
this
.
FQURL
=
settings
.
FQYF
().
pushOrderApi
;
this
.
FQURL
=
settings
.
FQYF
();
this
.
pushfqlogSve
=
system
.
getObject
(
"service.pushfqlogSve"
)
this
.
pushfqlogSve
=
system
.
getObject
(
"service.pushfqlogSve"
);
this
.
esettleofflineSve
=
system
.
getObject
(
"service.esettleofflineSve"
)
this
.
esettleofflineSve
=
system
.
getObject
(
"service.esettleofflineSve"
);
this
.
busistatSve
=
system
.
getObject
(
"service.busistatSve"
);
}
}
//渠道绑定
//渠道绑定
...
@@ -33,7 +34,7 @@ class ChannelApi {
...
@@ -33,7 +34,7 @@ class ChannelApi {
//绑定渠道推送(弃用)
//绑定渠道推送(弃用)
async
pushbindingchannel
(
queryobj
,
qobj
,
req
)
{
async
pushbindingchannel
(
queryobj
,
qobj
,
req
)
{
if
(
queryobj
.
day
)
{
if
(
queryobj
.
day
)
{
queryobj
.
begin
=
queryobj
.
day
+
' 00:00:00'
;
/* 自定义时间 */
queryobj
.
begin
=
queryobj
.
day
+
' 00:00:00'
;
/* 自定义时间 */
queryobj
.
end
=
queryobj
.
day
+
' 23:59:59'
;
/* 自定义时间 */
queryobj
.
end
=
queryobj
.
day
+
' 23:59:59'
;
/* 自定义时间 */
}
else
{
}
else
{
...
@@ -51,7 +52,7 @@ class ChannelApi {
...
@@ -51,7 +52,7 @@ class ChannelApi {
var
pushData
=
this
.
getBusiData
(
busiData
[
j
],
data
[
i
]);
var
pushData
=
this
.
getBusiData
(
busiData
[
j
],
data
[
i
]);
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
null
;
var
rtn
=
null
;
rtn
=
await
rc
.
post
(
this
.
FQURL
,
pushData
);
rtn
=
await
rc
.
post
(
this
.
FQURL
.
pushOrderApi
,
pushData
);
console
.
log
(
pushData
)
console
.
log
(
pushData
)
console
.
log
(
rtn
)
console
.
log
(
rtn
)
var
result
=
JSON
.
parse
(
system
.
decryption
(
decodeURIComponent
(
pushData
.
param
)));
var
result
=
JSON
.
parse
(
system
.
decryption
(
decodeURIComponent
(
pushData
.
param
)));
...
@@ -75,7 +76,7 @@ class ChannelApi {
...
@@ -75,7 +76,7 @@ class ChannelApi {
var
pushData
=
this
.
getBusiDatas
(
esettleoffline
.
dataValues
,
data
[
i
]);
var
pushData
=
this
.
getBusiDatas
(
esettleoffline
.
dataValues
,
data
[
i
]);
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
null
;
var
rtn
=
null
;
rtn
=
await
rc
.
post
(
this
.
FQURL
,
pushData
);
rtn
=
await
rc
.
post
(
this
.
FQURL
.
pushOrderApi
,
pushData
);
console
.
log
(
pushData
)
console
.
log
(
pushData
)
console
.
log
(
rtn
)
console
.
log
(
rtn
)
var
result
=
JSON
.
parse
(
system
.
decryption
(
decodeURIComponent
(
pushData
.
param
)));
var
result
=
JSON
.
parse
(
system
.
decryption
(
decodeURIComponent
(
pushData
.
param
)));
...
@@ -105,40 +106,40 @@ class ChannelApi {
...
@@ -105,40 +106,40 @@ class ChannelApi {
async
pushAddChannel
(
queryobj
,
qobj
,
req
)
{
async
pushAddChannel
(
queryobj
,
qobj
,
req
)
{
try
{
try
{
if
(
!
queryobj
.
platform_id
)
{
if
(
!
queryobj
.
platform_id
)
{
return
system
.
getResultFail
(
-
1
,
"platform_id不能为空"
);
return
system
.
getResultFail
(
-
1
,
"platform_id不能为空"
);
}
}
if
(
!
queryobj
.
ctype
)
{
if
(
!
queryobj
.
ctype
)
{
return
system
.
getResultFail
(
-
1
,
"ctype不能为空"
);
return
system
.
getResultFail
(
-
1
,
"ctype不能为空"
);
}
}
if
(
!
queryobj
.
name
)
{
if
(
!
queryobj
.
name
)
{
return
system
.
getResultFail
(
-
1
,
"name不能为空"
);
return
system
.
getResultFail
(
-
1
,
"name不能为空"
);
}
}
if
(
!
queryobj
.
idcode
)
{
if
(
!
queryobj
.
idcode
)
{
return
system
.
getResultFail
(
-
1
,
"idcode不能为空"
);
return
system
.
getResultFail
(
-
1
,
"idcode不能为空"
);
}
}
if
(
queryobj
.
ctype
==
1
)
{
if
(
queryobj
.
ctype
==
1
)
{
if
(
!
queryobj
.
business_license
)
{
if
(
!
queryobj
.
business_license
)
{
return
system
.
getResultFail
(
-
1
,
"business_license不能为空"
);
return
system
.
getResultFail
(
-
1
,
"business_license不能为空"
);
}
}
}
else
{
}
else
{
if
(
!
queryobj
.
idcard_front
)
{
if
(
!
queryobj
.
idcard_front
)
{
return
system
.
getResultFail
(
-
1
,
"idcard_front不能为空"
);
return
system
.
getResultFail
(
-
1
,
"idcard_front不能为空"
);
}
}
if
(
!
queryobj
.
idcard_back
)
{
if
(
!
queryobj
.
idcard_back
)
{
return
system
.
getResultFail
(
-
1
,
"idcard_back不能为空"
);
return
system
.
getResultFail
(
-
1
,
"idcard_back不能为空"
);
}
}
}
}
if
(
!
queryobj
.
contact_man
)
{
if
(
!
queryobj
.
contact_man
)
{
return
system
.
getResultFail
(
-
1
,
"contact_man不能为空"
);
return
system
.
getResultFail
(
-
1
,
"contact_man不能为空"
);
}
}
if
(
!
queryobj
.
contact_mobile
)
{
if
(
!
queryobj
.
contact_mobile
)
{
return
system
.
getResultFail
(
-
1
,
"contact_mobile不能为空"
);
return
system
.
getResultFail
(
-
1
,
"contact_mobile不能为空"
);
}
}
if
(
!
queryobj
.
contact_email
)
{
if
(
!
queryobj
.
contact_email
)
{
return
system
.
getResultFail
(
-
1
,
"contact_email不能为空"
);
return
system
.
getResultFail
(
-
1
,
"contact_email不能为空"
);
}
}
if
(
!
queryobj
.
contact_addr
)
{
if
(
!
queryobj
.
contact_addr
)
{
return
system
.
getResultFail
(
-
1
,
"contact_addr不能为空"
);
return
system
.
getResultFail
(
-
1
,
"contact_addr不能为空"
);
}
}
...
@@ -147,7 +148,7 @@ class ChannelApi {
...
@@ -147,7 +148,7 @@ class ChannelApi {
var
bind
=
{
var
bind
=
{
platform_id
:
queryobj
.
platform_id
,
platform_id
:
queryobj
.
platform_id
,
channel_id
:
da
.
data
.
id
,
channel_id
:
da
.
data
.
id
,
platform_channel_id
:
10000
platform_channel_id
:
10000
}
}
var
result
=
this
.
channelSve
.
bindPlatform
(
bind
);
var
result
=
this
.
channelSve
.
bindPlatform
(
bind
);
console
.
log
(
result
);
console
.
log
(
result
);
...
@@ -160,34 +161,37 @@ class ChannelApi {
...
@@ -160,34 +161,37 @@ class ChannelApi {
}
}
//商户添加
//商户添加
async
pushAddMerchant
(
queryobj
,
qobj
,
req
){
async
pushAddMerchant
(
queryobj
,
qobj
,
req
)
{
try
{
try
{
if
(
!
queryobj
.
channel_id
)
{
if
(
!
queryobj
.
channel_id
)
{
return
system
.
getResultFail
(
-
1
,
"channel_id不能为空"
);
return
system
.
getResultFail
(
-
1
,
"channel_id不能为空"
);
}
}
// if(!queryobj.origin_id){
// if(!queryobj.origin_id){
// return system.getResultFail(-1, "origin_id不能为空");
// return system.getResultFail(-1, "origin_id不能为空");
// }
// }
if
(
!
queryobj
.
merchant_name
)
{
if
(
!
queryobj
.
merchant_name
)
{
return
system
.
getResultFail
(
-
1
,
"merchant_name不能为空"
);
return
system
.
getResultFail
(
-
1
,
"merchant_name不能为空"
);
}
}
if
(
!
queryobj
.
contact_man
)
{
if
(
!
queryobj
.
contact_man
)
{
return
system
.
getResultFail
(
-
1
,
"contact_man不能为空"
);
return
system
.
getResultFail
(
-
1
,
"contact_man不能为空"
);
}
}
if
(
!
queryobj
.
contact_mobile
)
{
if
(
!
queryobj
.
contact_mobile
)
{
return
system
.
getResultFail
(
-
1
,
"contact_mobile不能为空"
);
return
system
.
getResultFail
(
-
1
,
"contact_mobile不能为空"
);
}
}
if
(
!
queryobj
.
contact_email
)
{
if
(
!
queryobj
.
contact_email
)
{
return
system
.
getResultFail
(
-
1
,
"contact_email不能为空"
);
return
system
.
getResultFail
(
-
1
,
"contact_email不能为空"
);
}
}
if
(
!
queryobj
.
contact_addr
)
{
if
(
!
queryobj
.
contact_addr
)
{
return
system
.
getResultFail
(
-
1
,
"contact_addr不能为空"
);
return
system
.
getResultFail
(
-
1
,
"contact_addr不能为空"
);
}
}
if
(
queryobj
.
id
){
if
(
!
queryobj
.
merchanmt_id
)
{
if
(
!
queryobj
.
origin_merchant_id
){
return
system
.
getResultFail
(
-
1
,
"merchanmt_id不能为空"
);
}
if
(
queryobj
.
id
)
{
if
(
!
queryobj
.
origin_merchant_id
)
{
return
system
.
getResultFail
(
-
1
,
"origin_merchant_id不能为空"
);
return
system
.
getResultFail
(
-
1
,
"origin_merchant_id不能为空"
);
}
}
if
(
!
queryobj
.
origin_merchant_name
)
{
if
(
!
queryobj
.
origin_merchant_name
)
{
return
system
.
getResultFail
(
-
1
,
"origin_merchant_name不能为空"
);
return
system
.
getResultFail
(
-
1
,
"origin_merchant_name不能为空"
);
}
}
}
}
...
@@ -255,7 +259,7 @@ class ChannelApi {
...
@@ -255,7 +259,7 @@ class ChannelApi {
"thirdPartyChannelId"
:
chnanel
.
channel_id
.
toString
(),
// 渠道id
"thirdPartyChannelId"
:
chnanel
.
channel_id
.
toString
(),
// 渠道id
"thirdPartyCustomerId"
:
chnanel
.
id
.
toString
(),
// 第三方客户id
"thirdPartyCustomerId"
:
chnanel
.
id
.
toString
(),
// 第三方客户id
"productId"
:
"5e6b02cc3290c3000a3a63dc"
,
// 云服产品id (测试环境)
"productId"
:
"5e6b02cc3290c3000a3a63dc"
,
// 云服产品id (测试环境)
// "productId": "5e6c89d54c52bf000a750bc5",// 云服产品id (生产环境)
// "productId": "5e6c89d54c52bf000a750bc5",// 云服产品id (生产环境)
// "allotRatio":"50",// 分润比例(百分比的数字部分(如:50代表50%))
// "allotRatio":"50",// 分润比例(百分比的数字部分(如:50代表50%))
"orderPrice"
:
da
.
amt
,
// 订单金额
"orderPrice"
:
da
.
amt
,
// 订单金额
"productQuantity"
:
"1"
,
// 产品数量
"productQuantity"
:
"1"
,
// 产品数量
...
@@ -287,7 +291,7 @@ class ChannelApi {
...
@@ -287,7 +291,7 @@ class ChannelApi {
async
pushChannels
(
queryobj
,
qobj
,
req
)
{
async
pushChannels
(
queryobj
,
qobj
,
req
)
{
let
begin
;
let
begin
;
let
end
;
let
end
;
if
(
queryobj
.
day
)
{
if
(
queryobj
.
day
)
{
begin
=
queryobj
.
day
+
' 00:00:00'
;
/* 自定义时间 */
begin
=
queryobj
.
day
+
' 00:00:00'
;
/* 自定义时间 */
end
=
queryobj
.
day
+
' 23:59:59'
;
/* 自定义时间 */
end
=
queryobj
.
day
+
' 23:59:59'
;
/* 自定义时间 */
}
else
{
}
else
{
...
@@ -296,11 +300,11 @@ class ChannelApi {
...
@@ -296,11 +300,11 @@ class ChannelApi {
}
}
var
merchantIds
=
await
this
.
channelSve
.
getPushMerchantIds
()
||
[];
var
merchantIds
=
await
this
.
channelSve
.
getPushMerchantIds
()
||
[];
if
(
merchantIds
.
length
==
0
)
{
if
(
merchantIds
.
length
==
0
)
{
return
system
.
getErrResult2
(
"暂无绑定渠道"
);
return
system
.
getErrResult2
(
"暂无绑定渠道"
);
}
}
for
(
let
merchantId
of
merchantIds
)
{
for
(
let
merchantId
of
merchantIds
)
{
console
.
log
(
merchantId
,
"----------------------------"
);
console
.
log
(
merchantId
,
"----------------------------"
);
// 查渠道商户id
// 查渠道商户id
let
merchant
=
(
await
this
.
channelSve
.
merchantInfo
({
id
:
merchantId
})
||
{}).
data
;
let
merchant
=
(
await
this
.
channelSve
.
merchantInfo
({
id
:
merchantId
})
||
{}).
data
;
...
@@ -315,10 +319,10 @@ class ChannelApi {
...
@@ -315,10 +319,10 @@ class ChannelApi {
async
pushOnlineOrder
(
merchant
,
begin
,
end
)
{
async
pushOnlineOrder
(
merchant
,
begin
,
end
)
{
let
orders
=
await
this
.
esettleSve
.
findPushInfos
(
merchant
.
origin_merchant_id
,
begin
,
end
)
||
[];
let
orders
=
await
this
.
esettleSve
.
findPushInfos
(
merchant
.
origin_merchant_id
,
begin
,
end
)
||
[];
if
(
orders
.
length
==
0
)
{
if
(
orders
.
length
==
0
)
{
return
;
return
;
}
}
for
(
let
order
of
orders
)
{
for
(
let
order
of
orders
)
{
// 获取推送数据
// 获取推送数据
let
pushData
=
this
.
getPushData
(
merchant
,
order
);
let
pushData
=
this
.
getPushData
(
merchant
,
order
);
...
@@ -327,7 +331,7 @@ class ChannelApi {
...
@@ -327,7 +331,7 @@ class ChannelApi {
// 推送数据
// 推送数据
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
let
rtn
=
await
rc
.
post
(
this
.
FQURL
,
pushData
.
data
);
let
rtn
=
await
rc
.
post
(
this
.
FQURL
.
pushOrderApi
,
pushData
.
data
);
// 返回结果都保存到toPush中吧
// 返回结果都保存到toPush中吧
log
.
topush
=
JSON
.
stringify
(
rtn
);
log
.
topush
=
JSON
.
stringify
(
rtn
);
...
@@ -337,10 +341,10 @@ class ChannelApi {
...
@@ -337,10 +341,10 @@ class ChannelApi {
async
pushOfflineOrder
(
merchant
,
begin
,
end
)
{
async
pushOfflineOrder
(
merchant
,
begin
,
end
)
{
let
orders
=
await
this
.
esettleofflineSve
.
findPushInfos
(
merchant
.
origin_merchant_id
,
begin
,
end
)
||
[];
let
orders
=
await
this
.
esettleofflineSve
.
findPushInfos
(
merchant
.
origin_merchant_id
,
begin
,
end
)
||
[];
if
(
orders
.
length
==
0
)
{
if
(
orders
.
length
==
0
)
{
return
;
return
;
}
}
for
(
let
order
of
orders
)
{
for
(
let
order
of
orders
)
{
// 获取推送数据
// 获取推送数据
let
pushData
=
this
.
getPushData
(
merchant
,
order
);
let
pushData
=
this
.
getPushData
(
merchant
,
order
);
...
@@ -349,7 +353,7 @@ class ChannelApi {
...
@@ -349,7 +353,7 @@ class ChannelApi {
// 推送数据
// 推送数据
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
let
rtn
=
await
rc
.
post
(
this
.
FQURL
,
pushData
.
data
);
let
rtn
=
await
rc
.
post
(
this
.
FQURL
.
pushOrderApi
,
pushData
.
data
);
// 返回结果都保存到toPush中吧
// 返回结果都保存到toPush中吧
log
.
topush
=
JSON
.
stringify
({
rtn
});
log
.
topush
=
JSON
.
stringify
({
rtn
});
...
@@ -407,7 +411,7 @@ class ChannelApi {
...
@@ -407,7 +411,7 @@ class ChannelApi {
if
(
!
param
.
data_id
)
{
if
(
!
param
.
data_id
)
{
return
system
.
getErrResult2
(
"参数错误, 订单不存在"
);
return
system
.
getErrResult2
(
"参数错误, 订单不存在"
);
}
}
let
merchant
=
await
this
.
channelSve
.
merchantInfo
({
id
:
param
.
channel_merchant_id
})
||
{};
let
merchant
=
await
this
.
channelSve
.
merchantInfo
({
id
:
param
.
channel_merchant_id
})
||
{};
merchant
=
merchant
.
data
;
merchant
=
merchant
.
data
;
if
(
!
merchant
)
{
if
(
!
merchant
)
{
return
system
.
getErrResult2
(
`渠道商户
${
param
.
channel_merchant_id
}
不存在`
);
return
system
.
getErrResult2
(
`渠道商户
${
param
.
channel_merchant_id
}
不存在`
);
...
@@ -457,7 +461,7 @@ class ChannelApi {
...
@@ -457,7 +461,7 @@ class ChannelApi {
if
(
!
param
.
data_id
)
{
if
(
!
param
.
data_id
)
{
return
system
.
getErrResult2
(
"参数错误, 订单不存在"
);
return
system
.
getErrResult2
(
"参数错误, 订单不存在"
);
}
}
let
merchant
=
await
this
.
channelSve
.
merchantInfo
({
id
:
param
.
channel_merchant_id
})
||
{};
let
merchant
=
await
this
.
channelSve
.
merchantInfo
({
id
:
param
.
channel_merchant_id
})
||
{};
merchant
=
merchant
.
data
;
merchant
=
merchant
.
data
;
if
(
!
merchant
)
{
if
(
!
merchant
)
{
return
system
.
getErrResult2
(
`渠道商户
${
param
.
channel_merchant_id
}
不存在`
);
return
system
.
getErrResult2
(
`渠道商户
${
param
.
channel_merchant_id
}
不存在`
);
...
@@ -468,15 +472,15 @@ class ChannelApi {
...
@@ -468,15 +472,15 @@ class ChannelApi {
page
=
await
this
.
esettleSve
.
pageByOrderId
(
param
.
data_id
,
currentPage
,
pageSize
);
page
=
await
this
.
esettleSve
.
pageByOrderId
(
param
.
data_id
,
currentPage
,
pageSize
);
}
else
{
}
else
{
page
=
await
this
.
esettleofflineitemSve
.
pageByByOrderId
(
param
.
data_id
,
currentPage
,
pageSize
);
page
=
await
this
.
esettleofflineitemSve
.
pageByByOrderId
(
param
.
data_id
,
currentPage
,
pageSize
);
if
(
page
.
rows
)
{
if
(
page
.
rows
)
{
for
(
let
row
of
page
.
rows
)
{
for
(
let
row
of
page
.
rows
)
{
row
.
deduct_amt
=
row
.
amt
;
row
.
deduct_amt
=
row
.
amt
;
row
.
trade_status
=
"02"
;
row
.
trade_status
=
"02"
;
}
}
}
}
}
}
if
(
page
&&
page
.
rows
)
{
if
(
page
&&
page
.
rows
)
{
for
(
let
row
of
page
.
rows
)
{
for
(
let
row
of
page
.
rows
)
{
row
.
actual_amt
=
system
.
f2y
(
row
.
actual_amt
);
row
.
actual_amt
=
system
.
f2y
(
row
.
actual_amt
);
row
.
income_tax
=
system
.
f2y
(
row
.
income_tax
);
row
.
income_tax
=
system
.
f2y
(
row
.
income_tax
);
row
.
service_tax
=
system
.
f2y
(
row
.
service_tax
);
row
.
service_tax
=
system
.
f2y
(
row
.
service_tax
);
...
@@ -486,6 +490,89 @@ class ChannelApi {
...
@@ -486,6 +490,89 @@ class ChannelApi {
return
system
.
getResult2
(
page
);
return
system
.
getResult2
(
page
);
}
}
//------------------------------------------------财务中心对账 begin------------------------------------------------------------\\
async
pushReconciliation
(
queryobj
,
qobj
,
req
)
{
let
begin
;
let
end
;
let
month
;
if
(
queryobj
.
num
)
{
//自定义时间
month
=
moment
().
add
().
month
(
moment
().
month
()
-
queryobj
.
num
).
startOf
(
'month'
).
format
(
"YYYYMM"
);
begin
=
moment
().
add
().
month
(
moment
().
month
()
-
queryobj
.
num
).
startOf
(
'month'
).
format
(
"YYYYMMDD"
);
end
=
moment
().
add
().
month
(
moment
().
month
()
-
queryobj
.
num
).
endOf
(
'month'
).
format
(
"YYYYMMDD"
);
}
else
{
month
=
moment
().
add
().
month
(
moment
().
month
()
-
queryobj
.
num
).
startOf
(
'month'
).
format
(
"YYYYMM"
);
begin
=
moment
().
add
().
month
(
moment
().
month
()
-
1
).
startOf
(
'month'
).
format
(
"YYYYMMDD"
);
end
=
moment
().
add
().
month
(
moment
().
month
()
-
1
).
endOf
(
'month'
).
format
(
"YYYYMMDD"
);
}
var
merchantIds
=
await
this
.
channelSve
.
getchannelIds
()
||
[];
if
(
merchantIds
.
length
==
0
)
{
return
system
.
getErrResult2
(
"暂无绑定渠道"
);
}
for
(
let
merchantId
of
merchantIds
)
{
console
.
log
(
merchantId
,
"----------------------------"
);
// 查渠道所有商户
let
merchant
=
await
this
.
channelSve
.
getchannelmerchantIds
({
channel_id
:
merchantId
.
channel_id
})
||
{};
if
(
merchant
.
length
>
0
)
{
let
busiId
=
[];
for
(
let
mer
of
merchant
)
{
busiId
.
push
(
mer
.
origin_merchant_id
);
}
if
(
busiId
)
{
var
list
=
await
this
.
busistatSve
.
gettomonthList
(
busiId
,
begin
,
end
);
if
(
list
)
{
let
pushData
=
this
.
gettopushdata
(
merchantId
,
list
,
month
,
merchant
);
var
rtn
=
null
;
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
rtn
=
await
rc
.
post
(
this
.
FQURL
.
pushOrderSum
,
pushData
);
// console.log(pushData);
console
.
log
(
rtn
);
}
}
}
}
}
gettopushdata
(
merchantId
,
list
,
month
,
merchant
)
{
var
data
=
{
channel_id
:
merchantId
.
platform_id
,
//蜂擎云服渠道id,
channel_name
:
merchantId
.
name
||
" "
,
//渠道上名称,
month
:
month
,
//月份(202006YYYYMM)channel_name: 渠道上名称,
trans_amt_total
:
0
,
//本月充值总额额,
deduct_amt
:
0
,
//扣除金额,
amt
:
0
,
//申请发薪金额,
actual_amt
:
0
,
//实发金额,
income_tax
:
0
,
//个税,
service_tax
:
0
,
//服务费金额,
added_value_tax
:
0
,
//增值税,
items
:
list
}
for
(
let
item
of
list
)
{
for
(
let
i
=
0
;
i
<
merchant
.
length
;
i
++
)
{
if
(
merchant
[
i
].
origin_merchant_id
==
item
.
busi_id
)
{
item
.
merchant_id
=
merchant
[
i
].
merchant_id
;
break
;
}
}
item
.
user_department_name
=
"渠道销售中心"
;
data
.
trans_amt_total
=
data
.
trans_amt_total
+
item
.
trans_amt
;
data
.
deduct_amt
=
data
.
deduct_amt
+
item
.
deduct_amt
;
data
.
amt
=
data
.
amt
+
item
.
amt
;
data
.
actual_amt
=
data
.
actual_amt
+
item
.
actual_amt
;
data
.
income_tax
=
data
.
income_tax
+
item
.
income_tax
;
data
.
service_tax
=
data
.
service_tax
+
item
.
service_tax
;
data
.
added_value_tax
=
data
.
added_value_tax
+
item
.
added_value_tax
;
}
return
data
;
}
//------------------------------------------------财务中心对账 end------------------------------------------------------------\\
trim
(
o
)
{
trim
(
o
)
{
if
(
!
o
)
{
if
(
!
o
)
{
return
""
;
return
""
;
...
...
bpo-admin/app/base/db/impl/busistatDao.js
View file @
4c409c10
...
@@ -63,6 +63,26 @@ class BusistatDao extends Dao {
...
@@ -63,6 +63,26 @@ class BusistatDao extends Dao {
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
}
async
gettomonthList
(
param
){
let
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"*"
);
sql
.
push
(
"FROM `c_busi_stat`"
);
sql
.
push
(
"WHERE 1 = 1"
);
if
(
param
.
busiId
){
sql
.
push
(
"AND busi_id IN (:busiId)"
);
}
if
(
param
.
begin
)
{
sql
.
push
(
"AND stat_day >= :begin"
);
}
if
(
param
.
end
)
{
sql
.
push
(
"AND stat_day <= :end"
);
}
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
param
);
}
async
setCondition
(
sql
,
params
)
{
async
setCondition
(
sql
,
params
)
{
if
(
!
sql
||
!
params
)
{
if
(
!
sql
||
!
params
)
{
return
;
return
;
...
...
bpo-admin/app/base/service/impl/busistatSve.js
View file @
4c409c10
...
@@ -50,6 +50,12 @@ class BusistatService extends ServiceBase {
...
@@ -50,6 +50,12 @@ class BusistatService extends ServiceBase {
item
.
added_value_tax
=
system
.
f2y
(
item
.
added_value_tax
);
item
.
added_value_tax
=
system
.
f2y
(
item
.
added_value_tax
);
}
}
}
}
async
gettomonthList
(
busiId
,
begin
,
end
)
{
return
await
this
.
dao
.
gettomonthList
({
busiId
:
busiId
,
begin
:
begin
,
end
:
end
});
}
}
}
module
.
exports
=
BusistatService
;
module
.
exports
=
BusistatService
;
bpo-admin/app/base/service/impl/channelSve.js
View file @
4c409c10
...
@@ -39,7 +39,10 @@ class ChannelService extends microService {
...
@@ -39,7 +39,10 @@ class ChannelService extends microService {
}
}
async
bindPlatform
(
params
){
async
bindPlatform
(
params
){
return
await
this
.
callms
(
"channel"
,
"bindPlatform"
,
params
);
}
async
getchannelIds
(
params
){
return
await
this
.
callms
(
"channel"
,
"channelIds"
,
params
);
}
}
async
pushbindingchannel
(
params
){
async
pushbindingchannel
(
params
){
...
@@ -50,6 +53,9 @@ class ChannelService extends microService {
...
@@ -50,6 +53,9 @@ class ChannelService extends microService {
async
merchantInfo
(
params
)
{
async
merchantInfo
(
params
)
{
return
await
this
.
callms
(
"channel"
,
"merchantInfo"
,
params
);
return
await
this
.
callms
(
"channel"
,
"merchantInfo"
,
params
);
}
}
async
getchannelmerchantIds
(
params
)
{
return
await
this
.
callms
(
"channel"
,
"getchannelmerchantIds"
,
params
);
}
async
merchantSave
(
params
)
{
async
merchantSave
(
params
)
{
return
await
this
.
callms
(
"channel"
,
"merchantSave"
,
params
);
return
await
this
.
callms
(
"channel"
,
"merchantSave"
,
params
);
}
}
...
@@ -63,5 +69,7 @@ class ChannelService extends microService {
...
@@ -63,5 +69,7 @@ class ChannelService extends microService {
async
getPushMerchantIds
(
params
){
async
getPushMerchantIds
(
params
){
return
await
this
.
callms
(
"channel"
,
"getPushMerchantIds"
,
params
);
return
await
this
.
callms
(
"channel"
,
"getPushMerchantIds"
,
params
);
}
}
}
}
module
.
exports
=
ChannelService
;
module
.
exports
=
ChannelService
;
bpo-admin/app/config/localsettings.js
View file @
4c409c10
...
@@ -9,7 +9,7 @@ var settings = {
...
@@ -9,7 +9,7 @@ var settings = {
// dbname : "bpo",
// dbname : "bpo",
// user : "write",
// user : "write",
// password : "write",
// password : "write",
dbname
:
"bpo
2
"
,
dbname
:
"bpo"
,
user
:
"write"
,
user
:
"write"
,
password
:
"write"
,
password
:
"write"
,
config
:
{
config
:
{
...
...
bpo-admin/app/config/settings.js
View file @
4c409c10
...
@@ -36,6 +36,7 @@ var settings = {
...
@@ -36,6 +36,7 @@ var settings = {
v
:
"crkyej0xlmqa6bmvqijun6ltxparllyn"
,
v
:
"crkyej0xlmqa6bmvqijun6ltxparllyn"
,
productId
:
"5e6b02cc3290c3000a3a63dc"
,
// 云服产品id
productId
:
"5e6b02cc3290c3000a3a63dc"
,
// 云服产品id
pushOrderApi
:
"http://yunfuapi-dev.gongsibao.com/crm/order/submit"
,
// 云服产品id
pushOrderApi
:
"http://yunfuapi-dev.gongsibao.com/crm/order/submit"
,
// 云服产品id
pushOrderSum
:
"http://yunfuapi-dev.gongsibao.com/cloudapi/bpo/pushBill"
,
};
};
}
else
{
}
else
{
return
{
return
{
...
@@ -43,6 +44,7 @@ var settings = {
...
@@ -43,6 +44,7 @@ var settings = {
v
:
"e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu"
,
v
:
"e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu"
,
productId
:
"5e6c89d54c52bf000a750bc5"
,
// 云服产品id (生产环境)
productId
:
"5e6c89d54c52bf000a750bc5"
,
// 云服产品id (生产环境)
pushOrderApi
:
"http://yunfuapi.gongsibao.com/crm/order/submit"
,
// 云服产品id (生产环境)
pushOrderApi
:
"http://yunfuapi.gongsibao.com/crm/order/submit"
,
// 云服产品id (生产环境)
pushOrderSum
:
"http://yunfuapi.gongsibao.com/cloudapi/bpo/pushBill"
,
};
};
}
}
},
},
...
@@ -187,4 +189,4 @@ var settings = {
...
@@ -187,4 +189,4 @@ var settings = {
}
}
};
};
settings
.
ENVINPUT
=
ENVINPUT
;
settings
.
ENVINPUT
=
ENVINPUT
;
module
.
exports
=
settings
;
module
.
exports
=
settings
;
\ No newline at end of file
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