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
f50cf729
Commit
f50cf729
authored
Apr 13, 2020
by
王昆
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xgg-admin' into xgg-admin-ali
parents
7b525973
a76f7a1d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
35 deletions
+79
-35
xgg-admin/app/base/controller/impl/invoice/invoiceCtl.js
+71
-28
xgg-admin/app/base/service/impl/invoice/invoiceSve.js
+5
-5
xgg-admin/app/base/system.js
+2
-2
xgg-admin/app/config/routes/web.js
+1
-0
No files found.
xgg-admin/app/base/controller/impl/invoice/invoiceCtl.js
View file @
f50cf729
var
system
=
require
(
"../../../system"
)
var
system
=
require
(
"../../../system"
)
const
CtlBase
=
require
(
"../../ctlms.base"
);
const
CtlBase
=
require
(
"../../ctlms.base"
);
var
moment
=
require
(
'moment'
);
class
InvoiceCtl
extends
CtlBase
{
class
InvoiceCtl
extends
CtlBase
{
constructor
()
{
constructor
()
{
super
();
super
();
this
.
invoiceSve
=
system
.
getObject
(
"service.invoice.invoiceSve"
);
this
.
invoiceSve
=
system
.
getObject
(
"service.invoice.invoiceSve"
);
this
.
userSve
=
system
.
getObject
(
"service.uc.userSve"
);
this
.
userSve
=
system
.
getObject
(
"service.uc.userSve"
);
this
.
INVOICE_TYPE
=
[
"10"
,
"20"
,
"30"
];
}
}
/**
/**
...
@@ -13,7 +15,7 @@ class InvoiceCtl extends CtlBase {
...
@@ -13,7 +15,7 @@ class InvoiceCtl extends CtlBase {
*/
*/
async
processDics
(
pobj
,
pobj2
,
req
)
{
async
processDics
(
pobj
,
pobj2
,
req
)
{
try
{
try
{
return
await
this
.
invoiceSve
.
processDics
(
pobj
);
return
await
this
.
invoiceSve
.
processDics
(
pobj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
...
@@ -27,7 +29,7 @@ class InvoiceCtl extends CtlBase {
...
@@ -27,7 +29,7 @@ class InvoiceCtl extends CtlBase {
async
invoicePage
(
pobj
,
pobj2
,
req
)
{
async
invoicePage
(
pobj
,
pobj2
,
req
)
{
try
{
try
{
this
.
doTimeCondition
(
pobj
,
[
"createTimeBegin"
,
"createTimeEnd"
]);
this
.
doTimeCondition
(
pobj
,
[
"createTimeBegin"
,
"createTimeEnd"
]);
return
await
this
.
invoiceSve
.
invoicePage
(
pobj
);
return
await
this
.
invoiceSve
.
invoicePage
(
pobj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
...
@@ -42,7 +44,7 @@ class InvoiceCtl extends CtlBase {
...
@@ -42,7 +44,7 @@ class InvoiceCtl extends CtlBase {
try
{
try
{
pobj
.
bd_path
=
req
.
loginUser
.
orgpath
;
pobj
.
bd_path
=
req
.
loginUser
.
orgpath
;
this
.
doTimeCondition
(
pobj
,
[
"createTimeBegin"
,
"createTimeEnd"
]);
this
.
doTimeCondition
(
pobj
,
[
"createTimeBegin"
,
"createTimeEnd"
]);
return
await
this
.
invoiceSve
.
invoicePage
(
pobj
);
return
await
this
.
invoiceSve
.
invoicePage
(
pobj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
...
@@ -55,13 +57,13 @@ class InvoiceCtl extends CtlBase {
...
@@ -55,13 +57,13 @@ class InvoiceCtl extends CtlBase {
*/
*/
async
invoiceApply
(
pobj
,
pobj2
,
req
)
{
async
invoiceApply
(
pobj
,
pobj2
,
req
)
{
try
{
try
{
pobj
.
invoice_amount
=
system
.
y2f
(
pobj
.
invoice_amount
);
pobj
.
invoice_amount
=
system
.
y2f
(
pobj
.
invoice_amount
);
pobj
.
additional_tax
=
system
.
y2f
(
pobj
.
additional_tax
);
pobj
.
additional_tax
=
system
.
y2f
(
pobj
.
additional_tax
);
pobj
.
value_added_tax
=
system
.
y2f
(
pobj
.
value_added_tax
);
pobj
.
value_added_tax
=
system
.
y2f
(
pobj
.
value_added_tax
);
pobj
.
personal_invoice_tax
=
system
.
y2f
(
pobj
.
personal_invoice_tax
);
pobj
.
personal_invoice_tax
=
system
.
y2f
(
pobj
.
personal_invoice_tax
);
pobj
.
invoice_content
=
system
.
y2f
(
pobj
.
invoice_content
);
pobj
.
invoice_content
=
system
.
y2f
(
pobj
.
invoice_content
);
return
await
this
.
invoiceSve
.
invoiceApply
(
pobj
);
return
await
this
.
invoiceSve
.
invoiceApply
(
pobj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
...
@@ -75,37 +77,37 @@ class InvoiceCtl extends CtlBase {
...
@@ -75,37 +77,37 @@ class InvoiceCtl extends CtlBase {
async
handleStatus
(
pobj
,
pobj2
,
req
)
{
async
handleStatus
(
pobj
,
pobj2
,
req
)
{
try
{
try
{
if
(
pobj
.
status
==
"1010"
){
//平台分配业务员
if
(
pobj
.
status
==
"1010"
)
{
//平台分配业务员
//1.获取业务员的基本id和bd_path
//1.获取业务员的基本id和bd_path
let
_user
=
await
this
.
userSve
.
queryById
({
let
_user
=
await
this
.
userSve
.
queryById
({
id
:
pobj
.
bd_id
id
:
pobj
.
bd_id
});
});
if
(
!
_user
||
_user
.
status
!=
0
)
{
if
(
!
_user
||
_user
.
status
!=
0
)
{
return
system
.
getResult
(
null
,
`业务员不存在`
);
return
system
.
getResult
(
null
,
`业务员不存在`
);
}
}
if
(
!
_user
.
data
||
!
_user
.
data
.
orgpath
)
{
if
(
!
_user
.
data
||
!
_user
.
data
.
orgpath
)
{
return
system
.
getResult
(
null
,
`业务员信息错误 请联系管理员`
);
return
system
.
getResult
(
null
,
`业务员信息错误 请联系管理员`
);
}
}
pobj
.
bd_path
=
_user
.
data
.
orgpath
;
pobj
.
bd_path
=
_user
.
data
.
orgpath
;
}
else
if
(
pobj
.
status
==
"1030"
){
//交付商分配
}
else
if
(
pobj
.
status
==
"1030"
)
{
//交付商分配
pobj
.
deliver_delive
=
system
.
y2f
(
pobj
.
deliver_delive
);
pobj
.
deliver_delive
=
system
.
y2f
(
pobj
.
deliver_delive
);
}
}
let
res
=
await
this
.
invoiceSve
.
handleStatus
(
pobj
);
let
res
=
await
this
.
invoiceSve
.
handleStatus
(
pobj
);
return
res
;
return
res
;
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
}
}
}
}
/**
/**
* 根据ID查详细信息
* 根据ID查详细信息
* @param {*} pobj
* @param {*} pobj
*/
*/
async
invoice
(
pobj
,
pobj2
,
req
)
{
async
invoice
(
pobj
,
pobj2
,
req
)
{
try
{
try
{
return
await
this
.
invoiceSve
.
invoice
(
pobj
);
return
await
this
.
invoiceSve
.
invoice
(
pobj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
...
@@ -118,9 +120,9 @@ class InvoiceCtl extends CtlBase {
...
@@ -118,9 +120,9 @@ class InvoiceCtl extends CtlBase {
* @param {*} pobj2
* @param {*} pobj2
* @param {*} req
* @param {*} req
*/
*/
async
uploadDetail
(
pobj
,
pobj2
,
req
){
async
uploadDetail
(
pobj
,
pobj2
,
req
)
{
if
(
!
pobj
.
invoice_id
)
{
if
(
!
pobj
.
invoice_id
)
{
return
system
.
getResult
(
null
,
`参数错误 发票ID 不能为空`
);
return
system
.
getResult
(
null
,
`参数错误 发票ID 不能为空`
);
}
}
let
res
=
await
this
.
invoiceSve
.
uploadDetail
(
pobj
.
invoice_id
);
let
res
=
await
this
.
invoiceSve
.
uploadDetail
(
pobj
.
invoice_id
);
return
res
;
return
res
;
...
@@ -132,13 +134,54 @@ class InvoiceCtl extends CtlBase {
...
@@ -132,13 +134,54 @@ class InvoiceCtl extends CtlBase {
*/
*/
async
calcInvoice
(
pobj
)
{
async
calcInvoice
(
pobj
)
{
try
{
try
{
return
await
this
.
invoiceSve
.
calcInvoice
(
pobj
);
return
await
this
.
invoiceSve
.
calcInvoice
(
pobj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
return
system
.
getResultFail
(
500
,
`接口错误 错误信息
${
error
}
`
);
}
}
}
}
/**
* 发票试算接口
* @param {*} pobj
* @param {*} query
* @param {*} req
*/
async
calcInvoice
(
pobj
,
query
,
req
)
{
let
res
=
[],
params
=
{};
for
(
let
item
of
pobj
)
{
if
(
!
item
.
credit_code
)
{
return
system
.
getResult
(
null
,
`参数错误 统一社会信用代码不能为空`
);
}
if
(
!
item
.
invoiced_time
)
{
return
system
.
getResult
(
null
,
`参数错误 发票申请时间不能为空`
);
}
if
(
this
.
INVOICE_TYPE
.
indexOf
(
item
.
invoice_type
)
==
-
1
)
{
return
system
.
getResult
(
null
,
`参数错误 发票类型错误`
);
}
let
params
=
{
"credit_code"
:
item
.
credit_code
,
"invoiced_time"
:
moment
(
item
.
invoiced_time
).
format
(
"YYYY-MM-DD hh:mm:ss"
),
"invoice_type"
:
item
.
invoice_type
,
"invoice_amount"
:
item
.
invoice_amount
}
try
{
let
rs
=
await
this
.
invoiceSve
.
calcInvoice
(
params
);
if
(
!
rs
)
{
rs
=
{
credit_code
:
item
.
credit_code
,
msg
:
"试算失败"
};
}
res
.
push
(
rs
);
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
return
system
.
getResult
(
res
);
}
// /**
// /**
// * 申请发票校验
// * 申请发票校验
// * @param {*} pobj
// * @param {*} pobj
...
@@ -355,7 +398,7 @@ class InvoiceCtl extends CtlBase {
...
@@ -355,7 +398,7 @@ class InvoiceCtl extends CtlBase {
// return system.getResultFail(500, `接口错误 错误信息 ${error}`);
// return system.getResultFail(500, `接口错误 错误信息 ${error}`);
// }
// }
// }
// }
// /**
// /**
// * 发票申请列表(平台)
// * 发票申请列表(平台)
// * @param {*} pobj
// * @param {*} pobj
...
...
xgg-admin/app/base/service/impl/invoice/invoiceSve.js
View file @
f50cf729
...
@@ -183,7 +183,7 @@ class InvoiceService extends ServiceBase {
...
@@ -183,7 +183,7 @@ class InvoiceService extends ServiceBase {
amount
:
item
.
amount
,
amount
:
item
.
amount
,
tax
:
item
.
taxAmount
,
tax
:
item
.
taxAmount
,
totalPrice
:
Number
(
item
.
amount
)
+
Number
(
item
.
taxAmount
),
totalPrice
:
Number
(
item
.
amount
)
+
Number
(
item
.
taxAmount
),
tax
R
ate
:
item
.
taxRate
,
tax
r
ate
:
item
.
taxRate
,
abstractType
:
item
.
summaryType
abstractType
:
item
.
summaryType
};
};
_res
.
push
(
temp
);
_res
.
push
(
temp
);
...
@@ -320,7 +320,7 @@ class InvoiceService extends ServiceBase {
...
@@ -320,7 +320,7 @@ class InvoiceService extends ServiceBase {
if
(
!
businessmenBean
.
sign_time
)
{
if
(
!
businessmenBean
.
sign_time
)
{
return
system
.
getResult
(
null
,
`个体户未签约`
);
return
system
.
getResult
(
null
,
`个体户未签约`
);
}
}
params
.
invoice_amount
=
system
.
y2f
(
this
.
trim
(
params
.
invoice_amount
));
//
params.invoice_amount = system.y2f(this.trim(params.invoice_amount));
//增值税累计类型 1按月 2按季度 add_value_up_type
//增值税累计类型 1按月 2按季度 add_value_up_type
//个税累计类型 1按月累计 2按季度累计 tax_up_type
//个税累计类型 1按月累计 2按季度累计 tax_up_type
let
accumulatedAmountParams
=
{
let
accumulatedAmountParams
=
{
...
@@ -377,10 +377,10 @@ class InvoiceService extends ServiceBase {
...
@@ -377,10 +377,10 @@ class InvoiceService extends ServiceBase {
value_added_tax
=
system
.
f2y
(
value_added_tax
);
value_added_tax
=
system
.
f2y
(
value_added_tax
);
additional_tax
=
system
.
f2y
(
additional_tax
);
additional_tax
=
system
.
f2y
(
additional_tax
);
service_amount
=
system
.
f2y
(
service_amount
);
service_amount
=
system
.
f2y
(
service_amount
);
return
system
.
getResult
({
personal_invoice_tax
,
value_added_tax
,
additional_tax
,
service_amount
})
;
return
{
personal_invoice_tax
:
personal_invoice_tax
,
value_added_tax
:
value_added_tax
,
additional_tax
:
additional_tax
,
service_amount
:
service_amount
,
credit_code
:
params
.
credit_code
}
;
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误`
)
;
return
null
;
}
}
}
}
...
@@ -396,7 +396,7 @@ class InvoiceService extends ServiceBase {
...
@@ -396,7 +396,7 @@ class InvoiceService extends ServiceBase {
let
tax_ladder
=
null
,
other_ladder
=
null
;
let
tax_ladder
=
null
,
other_ladder
=
null
;
if
(
invoice_type
==
"10"
){
//专业发票
if
(
invoice_type
==
"10"
){
//专业发票
tax_ladder
=
JSON
.
parse
(
businessmenBean
.
common_tax_ladder
);
tax_ladder
=
JSON
.
parse
(
businessmenBean
.
common_tax_ladder
);
other_ladder
=
JSON
.
parse
(
businessmenBean
.
common_o
ht
er_ladder
);
other_ladder
=
JSON
.
parse
(
businessmenBean
.
common_o
th
er_ladder
);
}
else
{
//普通发票
}
else
{
//普通发票
tax_ladder
=
JSON
.
parse
(
businessmenBean
.
special_tax_ladder
);
tax_ladder
=
JSON
.
parse
(
businessmenBean
.
special_tax_ladder
);
other_ladder
=
JSON
.
parse
(
businessmenBean
.
special_other_ladder
);
other_ladder
=
JSON
.
parse
(
businessmenBean
.
special_other_ladder
);
...
...
xgg-admin/app/base/system.js
View file @
f50cf729
...
@@ -182,11 +182,11 @@ class System {
...
@@ -182,11 +182,11 @@ class System {
// merchant: "http://127.0.0.1:3101" + path,
// merchant: "http://127.0.0.1:3101" + path,
// 订单服务
// 订单服务
order
:
domain
2
+
":3103"
+
path
,
order
:
domain
+
":3103"
+
path
,
// order: domain + ":3103" + path,
// order: domain + ":3103" + path,
// 发票服务
// 发票服务
invoice
:
domain
2
+
":3105"
+
path
,
invoice
:
domain
+
":3105"
+
path
,
// invoice: domain + ":3105" + path,
// invoice: domain + ":3105" + path,
// 用户中心
// 用户中心
...
...
xgg-admin/app/config/routes/web.js
View file @
f50cf729
...
@@ -26,6 +26,7 @@ module.exports = function (app) {
...
@@ -26,6 +26,7 @@ module.exports = function (app) {
req
.
url
.
indexOf
(
"common/captchaCtl/captcha"
)
>
0
||
req
.
url
.
indexOf
(
"common/captchaCtl/captcha"
)
>
0
||
req
.
url
.
indexOf
(
"order/orderCtl/addSourceOrder"
)
>
0
||
req
.
url
.
indexOf
(
"order/orderCtl/addSourceOrder"
)
>
0
||
req
.
url
.
indexOf
(
"business/businessmenCtl/info"
)
>
0
||
req
.
url
.
indexOf
(
"business/businessmenCtl/info"
)
>
0
||
req
.
url
.
indexOf
(
"invoice/invoiceCtl/calcInvoice"
)
>
0
||
req
.
url
.
indexOf
(
"getRsConfig"
)
>
0
)
{
req
.
url
.
indexOf
(
"getRsConfig"
)
>
0
)
{
if
(
jsonUser
)
{
if
(
jsonUser
)
{
req
.
loginUser
=
jsonUser
;
req
.
loginUser
=
jsonUser
;
...
...
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