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
830cc61f
Commit
830cc61f
authored
Apr 20, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xgg-saas-merchant' of gitlab.gongsibao.com:jiangyong/zhichan into xgg-saas-merchant
parents
a3c44d52
3d1a0c0d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
8 deletions
+33
-8
xgg-saas-merchant/app/base/service/impl/trade/tradeSve.js
+11
-8
xgg-saas-merchant/app/base/system.js
+6
-0
xgg-saas-merchant/app/config/routes/applet.js
+14
-0
xgg-saas-merchant/app/front/entry/public/apidoc/saas/trade.md
+2
-0
No files found.
xgg-saas-merchant/app/base/service/impl/trade/tradeSve.js
View file @
830cc61f
...
...
@@ -57,7 +57,7 @@ class TradeService extends ServiceBase {
return
system
.
getResultFail
(
-
1
,
`锁定批次无数据`
,
itemList
);
}
// 验证字段
let
error
=
await
this
.
checkItemList
(
itemList
,
params
.
saas_merchant_id
);
let
error
=
await
this
.
checkItemList
(
itemList
,
params
);
if
(
error
)
{
return
system
.
getResultFail
(
-
1
,
`批次内有错误数据,请检查后修改`
,
itemList
);
}
...
...
@@ -66,7 +66,7 @@ class TradeService extends ServiceBase {
info
=
info
.
data
||
{};
let
main
=
info
.
main_trade
||
{};
// 计算预计付款金额
let
result
=
await
this
.
countAmt
(
itemList
,
info
);
let
result
=
await
this
.
countAmt
(
itemList
,
info
,
params
);
for
(
let
item
of
itemList
)
{
item
.
amt
=
system
.
y2f
(
item
.
actual_amt
);
...
...
@@ -126,13 +126,13 @@ class TradeService extends ServiceBase {
}
// 读取excel
let
itemList
=
await
this
.
readItems
(
params
.
fileUrl
,
params
.
fileName
);
let
itemList
=
await
this
.
readItems
(
params
);
// 验证字段
let
error
=
await
this
.
checkItemList
(
itemList
,
params
.
saas_merchant_id
);
let
error
=
await
this
.
checkItemList
(
itemList
,
params
);
// 计算预计付款基恩
let
result
=
await
this
.
countAmt
(
itemList
,
info
);
let
result
=
await
this
.
countAmt
(
itemList
,
info
,
params
);
// 封装返回对象
result
.
error
=
error
;
...
...
@@ -150,7 +150,7 @@ class TradeService extends ServiceBase {
return
system
.
getResultSuccess
(
result
);
}
async
countAmt
(
itemList
,
info
)
{
async
countAmt
(
itemList
,
info
,
params
)
{
let
result
=
{
amt
:
0
,
actual_amt
:
0
,
deduct_amt
:
0
,
service_tax
:
0
};
if
(
!
itemList
)
{
return
result
;
...
...
@@ -178,7 +178,9 @@ class TradeService extends ServiceBase {
return
result
;
}
async
readItems
(
fileUrl
,
fileName
)
{
async
readItems
(
params
)
{
let
fileUrl
=
params
.
fileUrl
;
let
fileName
=
params
.
fileName
;
let
itemList
=
[];
let
filePath
=
settings
.
localpath
()
+
"saas_xgg_trade_order_"
+
this
.
trim
(
fileName
)
+
".xlsx"
;
try
{
...
...
@@ -228,7 +230,8 @@ class TradeService extends ServiceBase {
}
}
async
checkItemList
(
itemList
,
saas_merchant_id
)
{
async
checkItemList
(
itemList
,
params
)
{
let
saas_merchant_id
=
params
.
saas_merchant_id
;
let
error
=
false
;
if
(
!
itemList
||
itemList
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"打款文件无数据"
)
...
...
xgg-saas-merchant/app/base/system.js
View file @
830cc61f
...
...
@@ -166,6 +166,12 @@ class System {
return
uuid
.
join
(
''
);
}
static
endWith
(
source
,
str
){
if
(
!
str
||
!
source
||
source
.
length
==
0
||
str
.
length
>
source
.
length
)
{
return
false
;
}
return
source
.
substring
(
source
.
length
-
str
.
length
)
==
str
;
}
static
microsetting
()
{
console
.
log
(
settings
.
env
,
"-------------- microsetting env ------------------"
);
var
path
=
"/api/op/action/springboard"
;
...
...
xgg-saas-merchant/app/config/routes/applet.js
View file @
830cc61f
...
...
@@ -3,6 +3,20 @@ var System = require("../../base/system");
const
settings
=
require
(
"../settings"
);
module
.
exports
=
function
(
app
)
{
app
.
all
(
"/applet/*"
,
function
(
req
,
res
,
next
)
{
let
openid
=
req
.
body
.
openid
||
req
.
query
.
openid
;
if
(
System
.
endWith
(
req
.
url
,
"applet/merchantApplet/login"
)
||
System
.
endWith
(
req
.
url
,
"applet/merchantApplet/uploadConfig"
))
{
if
(
openid
)
{
req
.
openid
=
openid
;
}
else
{
req
.
openid
=
null
;
}
return
next
();
}
if
(
!
openid
)
{
res
.
end
(
JSON
.
stringify
({
code
:
403
,
msg
:
"no login"
}));
return
;
}
return
next
();
});
...
...
xgg-saas-merchant/app/front/entry/public/apidoc/saas/trade.md
View file @
830cc61f
...
...
@@ -82,6 +82,7 @@
```
javascript
{
"order_type"
:
"10"
,
// 10批量上传 20交易上传
// 上传文件地址
"fileUrl"
:
"https://gsb-zc.oss-cn-beijing.aliyuncs.com//zc_273315857206750512020113575551testbank2.xlsx"
}
...
...
@@ -136,6 +137,7 @@
{
"acc_type"
:
"00"
,
"order_type"
:
"10"
,
// 10批量上传 20交易上传
"fileUrl"
:
"https://gsb-zc.oss-cn-beijing.aliyuncs.com//zc_273315857206750512020113575551testbank2.xlsx"
,
"itemList"
:
[
{
...
...
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