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
e3ea297e
Commit
e3ea297e
authored
Apr 10, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
ea3daeae
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
162 additions
and
53 deletions
+162
-53
xgg-saas-merchant/app/base/controller/impl/saas/invoiceCtl.js
+67
-7
xgg-saas-merchant/app/base/service/impl/trade/tradeSve.js
+5
-0
xgg-saas-merchant/app/base/system.js
+1
-1
xgg-saas-merchant/app/base/utils/validation.js
+73
-0
xgg-saas-merchant/app/front/entry/public/apidoc/saas/invoice.md
+15
-44
xgg-saas-merchant/app/front/entry/public/apidoc/saas/merchant.md
+1
-1
No files found.
xgg-saas-merchant/app/base/controller/impl/saas/invoiceCtl.js
View file @
e3ea297e
var
system
=
require
(
"../../../system"
)
var
system
=
require
(
"../../../system"
)
const
CtlBase
=
require
(
"../../ctlms.base"
);
const
CtlBase
=
require
(
"../../ctlms.base"
);
const
validation
=
system
.
getObject
(
"util.validation"
);
class
InvoiceCtl
extends
CtlBase
{
class
InvoiceCtl
extends
CtlBase
{
constructor
()
{
constructor
()
{
super
();
super
();
this
.
orderSve
=
system
.
getObject
(
"service.saas.orderSve"
);
this
.
orderSve
=
system
.
getObject
(
"service.saas.orderSve"
);
this
.
tradeSve
=
system
.
getObject
(
"service.trade.tradeSve"
);
this
.
tradeSve
=
system
.
getObject
(
"service.trade.tradeSve"
);
this
.
invoiceSve
=
system
.
getObject
(
"service.saas.invoiceSve"
);
this
.
invoiceSve
=
system
.
getObject
(
"service.saas.invoiceSve"
);
this
.
merchantSve
=
system
.
getObject
(
"service.saas.merchantSve"
);
}
}
// 注册订单列表
// 注册订单列表
...
@@ -45,24 +48,81 @@ class InvoiceCtl extends CtlBase {
...
@@ -45,24 +48,81 @@ class InvoiceCtl extends CtlBase {
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
}
}
//发票列表
async
merchantinvoicePage
(
params
,
pobj2
,
req
)
{
try
{
let
rs
=
await
this
.
invoiceSve
.
merchantinvoicePage
(
params
);
return
rs
;
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
// 发票申请
// 发票申请
async
apply
(
params
,
pobj2
,
req
)
{
async
apply
(
params
,
pobj2
,
req
)
{
try
{
try
{
let
fee_type
=
this
.
trim
(
params
.
fee_type
);
if
(
fee_type
==
"00"
)
{
}
else
if
(
fee_type
==
"10"
)
{
return
await
this
.
apply10
(
params
,
pobj2
,
req
);
}
else
if
(
fee_type
==
"20"
)
{
}
else
{
return
system
.
getResult
(
null
,
"费用类型错误"
);
}
return
await
this
.
orderSve
.
page
(
params
);
return
await
this
.
orderSve
.
page
(
params
);
}
catch
(
error
)
{
}
catch
(
error
)
{
let
msg
=
error
.
message
;
if
(
msg
.
startsWith
(
"bpo-validation-error:"
))
{
return
system
.
getResult
(
null
,
msg
.
replace
(
"bpo-validation-error:"
,
""
));
}
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
}
}
//发票列表
// 功能2开票
async
merchantinvoicePage
(
params
,
pobj2
,
req
)
{
async
apply10
(
params
,
pobj2
,
req
)
{
try
{
validation
.
check
(
params
,
'data_ids'
,
{
name
:
"交易信息"
,
arr_require
:
true
});
let
rs
=
await
this
.
invoiceSve
.
merchantinvoicePage
(
params
);
return
rs
;
let
title
=
await
this
.
merchantSve
.
title
(
params
)
||
{};
}
catch
(
error
)
{
title
=
title
.
data
||
{};
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
if
(
!
title
.
merchant_name
||
!
title
.
merchant_credit_code
||
!
title
.
merchant_addr
||
!
title
.
merchant_mobile
||
!
title
.
merchant_bank
||
!
title
.
merchant_account
)
{
return
system
.
getResult
(
null
,
"开票抬头不完整,请联系平台"
);
}
let
addr
=
await
this
.
merchantSve
.
addr
(
params
)
||
{};
addr
=
addr
.
data
||
{};
if
(
!
addr
||
!
addr
.
mail_to
||
!
addr
.
mail_addr
||
!
addr
.
mail_mobile
)
{
return
system
.
getResult
(
null
,
"开票邮寄不完整"
);
}
}
let
data
=
{
saas_id
:
params
.
saas_id
,
saas_merchant_id
:
params
.
saas_merchant_id
,
data_ids
:
params
.
data_ids
,
fee_type
:
this
.
trim
(
params
.
fee_type
),
invoice_type
:
this
.
trim
(
params
.
invoice_type
),
to_name
:
this
.
trim
(
title
.
merchant_name
),
to_credit_code
:
this
.
trim
(
title
.
merchant_credit_code
),
to_addr
:
this
.
trim
(
title
.
merchant_addr
),
to_mobile
:
this
.
trim
(
title
.
merchant_mobile
),
to_bank
:
this
.
trim
(
title
.
merchant_bank
),
to_account
:
this
.
trim
(
title
.
merchant_account
),
mail_addr
:
this
.
trim
(
addr
.
mail_addr
),
mail_mobile
:
this
.
trim
(
addr
.
mail_mobile
),
mail_to
:
this
.
trim
(
addr
.
mail_to
),
};
console
.
log
(
data
);
return
system
.
getResultSuccess
(
data
);
}
}
}
}
module
.
exports
=
InvoiceCtl
;
module
.
exports
=
InvoiceCtl
;
xgg-saas-merchant/app/base/service/impl/trade/tradeSve.js
View file @
e3ea297e
...
@@ -246,6 +246,11 @@ class TradeService extends ServiceBase {
...
@@ -246,6 +246,11 @@ class TradeService extends ServiceBase {
return
error
;
return
error
;
}
}
async
byIds
(
params
)
{
let
rs
=
await
this
.
callms
(
"trade"
,
"orderPay"
,
params
);
return
rs
;
}
checkField
(
data
,
field
,
rule
)
{
checkField
(
data
,
field
,
rule
)
{
if
(
!
data
||
!
field
)
{
if
(
!
data
||
!
field
)
{
return
;
return
;
...
...
xgg-saas-merchant/app/base/system.js
View file @
e3ea297e
...
@@ -178,7 +178,7 @@ class System {
...
@@ -178,7 +178,7 @@ class System {
common
:
dev
+
":3102"
+
path
,
common
:
dev
+
":3102"
+
path
,
// 商户服务
// 商户服务
merchant
:
local
+
":3101"
+
path
,
merchant
:
dev
+
":3101"
+
path
,
// 订单服务
// 订单服务
order
:
local
+
":3103"
+
path
,
order
:
local
+
":3103"
+
path
,
...
...
xgg-saas-merchant/app/base/utils/validation.js
0 → 100644
View file @
e3ea297e
const
system
=
require
(
"../system"
);
class
Validation
{
constructor
()
{
// this.restClient = system.getObject("util.restClient");
this
.
PATTERN
=
{
EMAIL_PATTERN
:
/^
\w
+
((
-
\w
+
)
|
(\.\w
+
))
*
\@[
A-Za-z0-9
]
+
((\.
|-
)[
A-Za-z0-9
]
+
)
*
\.[
A-Za-z0-9
]
+$/
,
PHONE_PATTERN
:
/^
(
1
[
0-9
])\d{9}
$/
,
CHINESE_PATTERN
:
/^
[\u
4E00-
\u
9FA5
]
+$/
,
ENGLISH_PATTERN
:
/^
[
A-Za-z
]
+$/
,
QQ_PATTERN
:
/^
[
1-9
][
0-9
]{4,}
$/
,
NUMBER_PATTERN
:
/^
\d
+$/
,
CONTAINS_CHINESE_PATTERN
:
/
[\u
4e00-
\u
9fa5
]
/
,
CONTAINS_ENGLISH_PATTERN
:
/.*
[
a-zA-Z
]
+.*/
,
CONTAINS_NUM_PATTERN
:
/
[
0-9
]
+
?
/
,
DATE_PATTERN
:
/
((
^
((
1
[
8-9
]\d{2})
|
([
2-9
]\d{3}))[
-
](
10|12|0
?[
13578
])[
-
](
3
[
01
]
|
[
12
][
0-9
]
|0
?[
1-9
])(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
((
1
[
8-9
]\d{2})
|
([
2-9
]\d{3}))[
-
](
11|0
?[
469
])[
-
](
30|
[
12
][
0-9
]
|0
?[
1-9
])(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
((
1
[
8-9
]\d{2})
|
([
2-9
]\d{3}))[
-
](
0
?
2
)[
-
](
2
[
0-8
]
|1
[
0-9
]
|0
?[
1-9
])(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
([
2468
][
048
]
00
)[
-
](
0
?
2
)[
-
](
29
)(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
([
3579
][
26
]
00
)[
-
](
0
?
2
)[
-
](
29
)(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
([
1
][
89
][
0
][
48
])[
-
](
0
?
2
)[
-
](
29
)(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
([
2-9
][
0-9
][
0
][
48
])[
-
](
0
?
2
)[
-
](
29
)(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
([
1
][
89
][
2468
][
048
])[
-
](
0
?
2
)[
-
](
29
)(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
([
2-9
][
0-9
][
2468
][
048
])[
-
](
0
?
2
)[
-
](
29
)(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
([
1
][
89
][
13579
][
26
])[
-
](
0
?
2
)[
-
](
29
)(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
([
2-9
][
0-9
][
13579
][
26
])[
-
](
0
?
2
)[
-
](
29
)(\s{1}([
01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
])?
$
)
|
(
^
([
2-9
][
0-9
][
13579
][
26
])[
-
](
0
?
2
)[
-
](
29
)(\s{1}([
this.01
][
0-9
]
|2
[
0-3
])
:
[
0-5
][
0-9
]
:
[
0-5
][
0-9
](\.[
0-9
]
*
))?
$
))
/
,
PASSWORD_PATTERN
:
/^
(?![
0-9
]
+$
)(?![
a-zA-Z
]
+$
)[
0-9A-Za-z
]{6,20}
$/
,
};
}
/**
* 验证字段合法
* @param data 验证的对象
* data.errors 数组,不为空时,会将验证数据放到数组中
* @param field 验证的key
* @param rule 验证规则
* @param vall 是否全部验证完成
* @returns
*/
check
(
data
,
field
,
rule
)
{
if
(
!
rule
)
{
return
true
;
}
if
(
!
data
)
{
throw
new
Error
(
msg
+
"对象不存在"
);
}
let
v
=
data
[
field
];
if
(
rule
.
is_require
&&
!
v
)
{
this
.
error
(
data
,
"对象不存在"
);
}
if
(
rule
.
maxLen
&&
v
.
length
>
rule
.
maxLen
)
{
this
.
error
(
data
,
`
${
rule
.
name
}
:长度不允许超过
${
rule
.
maxLen
}
`
);
}
if
(
rule
.
minLen
&&
v
.
length
<
rule
.
minLen
)
{
this
.
error
(
data
,
`
${
rule
.
name
}
:长度不允许少于
${
rule
.
minLen
}
`
);
}
if
(
rule
.
eqLen
&&
v
.
length
!=
rule
.
eqLen
)
{
this
.
error
(
data
,
`
${
rule
.
name
}
:长度为
${
rule
.
eqLen
}
`
);
}
if
(
rule
.
is_number
&&
isNaN
(
v
))
{
this
.
error
(
data
,
`
${
rule
.
name
}
:需要填写数字类型`
);
}
if
(
rule
.
is_mobile
&&
this
.
PATTERN
.
PHONE_PATTERN
.
test
(
v
))
{
this
.
error
(
data
,
`
${
rule
.
name
}
:需要填写数字类型`
);
}
if
(
rule
.
dics
&&
rule
.
dics
.
indexOf
(
v
)
==
-
1
)
{
this
.
error
(
data
,
`
${
rule
.
name
}
:
${
v
}
错误`
);
}
if
(
rule
.
arr_require
&&
(
!
v
||
v
.
length
==
0
))
{
this
.
error
(
data
,
`
${
rule
.
name
}
:数据为空`
);
}
}
error
(
data
,
msg
)
{
if
(
data
.
errors
)
{
data
.
errors
.
push
(
msg
);
}
else
{
throw
new
Error
(
`bpo-validation-error:
${
msg
}
`
);
}
}
}
module
.
exports
=
Validation
;
xgg-saas-merchant/app/front/entry/public/apidoc/saas/invoice.md
View file @
e3ea297e
<a
name=
"menu"
>
目录
</a>
<a
name=
"menu"
>
目录
</a>
1.
[
发票申请-功能1-交易列表
](
#merchantPage
)
1.
[
发票申请-功能1-交易列表
](
#merchantPage
)
1.
[
发票申请-功能2-交易列表
](
#platformPage
)
1.
[
发票申请-功能2-交易列表
](
#platformPage
)
1.
[
发票申请-功能2
](
#apply2
)
1.
[
发票申请-功能3-订单列表
](
#orderPage
)
1.
[
发票申请-功能3-订单列表
](
#orderPage
)
1.
[
商户抬头
](
#merchantTitle
)
1.
[
商户抬头
](
#merchantTitle
)
1.
[
商户地址
](
#merchantAddr
)
1.
[
商户地址
](
#merchantAddr
)
1.
[
发票申请
](
#apply
)
1.
[
商户地址编辑
](
#merchantAddrSave
)
1.
[
发票列表
](
#invoicePage
)
1.
[
发票列表
](
#invoicePage
)
## **<a name="orderPage"> 发票申请-功能1-交易列表</a>**
## **<a name="orderPage"> 发票申请-功能1-交易列表</a>**
...
@@ -193,11 +194,15 @@
...
@@ -193,11 +194,15 @@
## **<a name="merchantAddr"> 商户地址</a>**
## **<a name="merchantAddr"> 商户地址</a>**
[
返回到目录
](
#menu
)
[
返回到目录
](
#menu
)
##### URL
##### URL
[
/web/saas/merchantCtl/addr
]
<a
href=
"/doc/saas/merchant.md#
title
"
>
【 去接口详情 】
</a>
[
/web/saas/merchantCtl/addr
]
<a
href=
"/doc/saas/merchant.md#
addr
"
>
【 去接口详情 】
</a>
## **<a name="merchantAddrSave"> 商户地址编辑</a>**
[
返回到目录
](
#menu
)
##### URL
[
/web/saas/merchantCtl/addr
]
<a
href=
"/doc/saas/merchant.md#saveAddr"
>
【 去接口详情 】
</a>
## **<a name="apply
"> 发票申请
</a>**
## **<a name="apply
2"> 发票申请-功能2
</a>**
[
返回到目录
](
#menu
)
[
返回到目录
](
#menu
)
##### URL
##### URL
[
/web/saas/invoiceCtl/apply
]
[
/web/saas/invoiceCtl/apply
]
...
@@ -207,10 +212,12 @@
...
@@ -207,10 +212,12 @@
```
javascript
```
javascript
{
{
"currentPage"
:
"1"
,
"fee_type"
:
"10"
,
// 费用类型 00注册订单费用 10平台转账费用 20商户转账费用
"pageSize"
:
"10"
,
"invoice_type"
:
"10"
,
// 发票类型 10 增值税专用发票 20 增值税普通发票 30 普通发票
"createBegin"
:
""
,
// 创建时间 开始
"data_ids"
:
[
// 所选交易列表
"createEnd"
:
""
// 创建时间 结束
"1"
,
"2"
],
}
}
```
```
...
@@ -220,43 +227,7 @@
...
@@ -220,43 +227,7 @@
{
{
"status"
:
0
,
"status"
:
0
,
"msg"
:
"success"
,
"msg"
:
"success"
,
"data"
:
{
"data"
:
null
,
"count"
:
0
,
"rows"
:
[
{
"id"
:
"1726724188001516"
,
// 订单编号
"price"
:
1500
,
// 订单价格
"pay_voucher_img"
:
"0"
,
// 付款凭证
"audit_remark"
:
""
,
// 审核凭证
"deliver_man"
:
""
,
// 交付联系人
"deliver_mobile"
:
""
,
// 交付联系电话
"deliver_addr"
:
""
,
// 邮寄地址
"created_at"
:
"2020-03-21 07:45:18"
,
// 创建时间
"status"
:
"3030"
,
// 订单状态
"status_name"
:
"已交付"
// 订单状态名称
// 订单信息
"bminfo"
:
{
"idcard_front"
:
"11111"
,
// 身份证正面
"idcard_back"
:
"11111"
,
// 身份证反面
"legal_name"
:
"11111"
,
// 法人名称
"legal_mobile"
:
"11111"
,
// 手机号
"legal_idno"
:
"11111"
,
// 身份证号码
"company_names"
:
"11111"
,
// 个体户名称
"bank_front"
:
"11111"
,
// 银行卡正面图
"bank_back"
:
"11111"
,
// 银行卡反面图
"bank_name"
:
"11111"
,
// 开户行
"bank_no"
:
"11111"
,
// 银行卡号
"bank_mobile"
:
"11111"
,
// 预留手机号
"domicile_id"
:
""
,
// 注册地id
"domicile_name"
:
""
,
// 注册地
"business_scope_id"
:
""
,
// 经营范围id
"business_type"
:
""
,
// 经营范围类型
"business_scope"
:
""
,
// 经营范围详情
}
}
],
"total"
:
1
},
"requestid"
:
"00521a0a0f094c8d982bf4375fbe91b1"
"requestid"
:
"00521a0a0f094c8d982bf4375fbe91b1"
}
}
```
```
...
...
xgg-saas-merchant/app/front/entry/public/apidoc/saas/merchant.md
View file @
e3ea297e
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
```
```
## **<a name="
a
ddr"> 邮寄地址编辑</a>**
## **<a name="
saveA
ddr"> 邮寄地址编辑</a>**
[
返回到目录
](
#menu
)
[
返回到目录
](
#menu
)
##### URL
##### URL
[
/web/saas/merchantCtl/saveAddr
]
[
/web/saas/merchantCtl/saveAddr
]
...
...
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