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
e8e019fd
Commit
e8e019fd
authored
Aug 27, 2020
by
Sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:交付商信息
parent
d7ea23a4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
27 deletions
+60
-27
tx-fi-tax/app/base/controller/impl/bizchance/deliverybillCtl.js
+26
-2
tx-fi-tax/app/base/utils/toFtClient.js
+34
-25
No files found.
tx-fi-tax/app/base/controller/impl/bizchance/deliverybillCtl.js
View file @
e8e019fd
...
...
@@ -6,6 +6,7 @@ var settings = require("../../../../config/settings");
const
CtlBase
=
require
(
"../../ctl.base"
);
const
moment
=
require
(
'moment'
);
const
System
=
require
(
"../../../system"
);
const
toFtClient
=
require
(
"../../../utils/toFtClient"
);
const
appconfig
=
system
.
getSysConfig
();
class
DeliverybillCtl
extends
CtlBase
{
constructor
()
{
...
...
@@ -119,6 +120,9 @@ class DeliverybillCtl extends CtlBase {
/**
* 分配人
* @param {*} pobj
* @param {*} qobj
* @param {*} req
*/
async
distributionPerson
(
pobj
,
qobj
,
req
)
{
try
{
...
...
@@ -144,9 +148,29 @@ class DeliverybillCtl extends CtlBase {
}
}
/**
* 获取交付商信息
* @param {*} pobj
* @param {*} qobj
* @param {*} req
*/
async
getChannelCompany
(
pobj
,
qobj
,
req
)
{
try
{
const
rs
=
await
toFtClient
.
getChannelCompany
();
return
system
.
getResult
(
rs
.
map
(
item
=>
{
return
{
id
:
item
.
id
,
name
:
item
.
name
}
}));
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
// 创建融易算服务实例
async
insertInfo
(
mobj
,
qobj
,
req
)
{
console
.
log
(
'mobj--------------------------------'
,
mobj
);
console
.
log
(
'mobj--------------------------------'
,
mobj
);
try
{
var
pobj
=
mobj
.
actionBody
;
var
cachestr
=
sha235
(
JSON
.
stringify
(
pobj
));
...
...
@@ -281,7 +305,7 @@ class DeliverybillCtl extends CtlBase {
}
}
async
portog
(){
async
portog
()
{
console
.
log
(
settings
.
port
);
}
}
...
...
tx-fi-tax/app/base/utils/toFtClient.js
View file @
e8e019fd
const
axios
=
require
(
"axios"
);
const
settings
=
require
(
"../../config/settings"
);
const
system
=
require
(
"../system"
);
const
moment
=
require
(
'moment'
);
const
ftConfig
=
settings
.
ftConfig
();
let
ftTenantInfo
;
// 财税中心 缓存
const
_
=
require
(
"lodash"
)
/**
* 发送 post 请求
...
...
@@ -12,7 +13,7 @@ let ftTenantInfo; // 财税中心 缓存
*/
const
postRequest
=
async
(
url
,
data
,
headers
=
{})
=>
{
try
{
console
.
log
(
`
${
url
}
:
推送财税中心
数据 ------- `
);
console
.
log
(
`
${
url
}
:
请求
数据 ------- `
);
console
.
log
(
JSON
.
stringify
(
data
))
let
result
=
await
axios
.
post
(
url
,
data
,
{
headers
:
{
...
...
@@ -22,7 +23,7 @@ const postRequest = async (url, data, headers = {}) => {
timeout
:
5000
,
});
result
=
result
.
data
;
console
.
log
(
"
推送财税中心
返回数据 ------- "
);
console
.
log
(
"
${url} :
返回数据 ------- "
);
console
.
log
(
JSON
.
stringify
(
result
));
if
(
result
.
code
==
1
)
{
return
result
.
data
...
...
@@ -62,47 +63,55 @@ const postToFtBySign = async (url, data, headers = {}) => {
/**
* 财税 获取 租户信息
*/
const
getChannelCompany
=
async
()
=>
{
// 内存 缓存
if
(
ftTenantInfo
)
{
return
ftTenantInfo
}
const
getChannelCompany
=
async
(
id
)
=>
{
let
reqData
=
{
channelCode
:
ftConfig
.
channelCode
,
}
let
sign
=
system
.
signValid
(
reqData
,
ftConfig
.
secret
);
cons
t
companyData
=
await
postToFt
(
"/company/getChannelCompany"
,
{
le
t
companyData
=
await
postToFt
(
"/company/getChannelCompany"
,
{
...
reqData
,
sign
});
if
(
companyData
.
datas
&&
companyData
.
datas
.
length
>
0
)
{
ftTenantInfo
=
companyData
.
datas
[
0
]
return
ftTenantInfo
;
}
else
{
throw
(
"渠道码信息获取错误"
);
companyData
=
companyData
.
datas
;
if
(
id
)
{
// TODO: 获取单个信息
}
return
companyData
;
}
/**
* 建账
* @param {*} deliverData
* @param {*} pobj
*/
const
addCusAccApplyInfo
=
async
()
=>
{
const
addCusAccApplyInfo
=
async
(
deliverData
,
pobj
)
=>
{
const
accountStandard
=
{
"小企业会计准则"
:
1
,
"企业会计准则"
:
2
}
const
valueAddedTax
=
{
"小规模纳税人"
:
0
,
"一般纳税人"
:
1
,
"个体工商户"
:
2
}
let
reqData
=
{
accountStandard
:
1
,
applyDate
:
"2020-09-10"
,
contact
:
"JAMES7"
,
creditCode
:
"911101053516460817K"
,
customerName
:
"北京融易算"
,
phoneNumber
:
"18510669367"
,
valueAddedTax
:
1
,
serviceTime
:
"5"
,
initPeriod
:
202009
,
accountStandard
:
accountStandard
[
pobj
.
accountingType
]
,
applyDate
:
pobj
.
time
,
contact
:
deliverData
.
delivery_info
.
contactsName
,
creditCode
:
deliverData
.
delivery_info
.
creditCode
,
customerName
:
deliverData
.
delivery_info
.
companyName
,
phoneNumber
:
deliverData
.
delivery_info
.
contactsPhone
,
valueAddedTax
:
valueAddedTax
[
pobj
.
taxpayerType
]
,
serviceTime
:
moment
(
deliverData
.
delivery_info
.
serviceEndTime
).
diff
(
moment
(
deliverData
.
delivery_info
.
serviceStartTime
),
'months'
).
toString
()
,
initPeriod
:
parseInt
(
moment
(
deliverData
.
delivery_info
.
serviceStartTime
).
format
(
'YYYYMMDD'
))
,
}
const
data
=
await
postToFtBySign
(
'/cusAccApplyInfo/addCusAccApplyInfo'
,
reqData
);
console
.
log
(
data
);
}
// console.log(moment("2021-05-31").diff(moment("2020-06-01"), 'months', true).toString())
module
.
exports
=
{
postToFtBySign
,
addCusAccApplyInfo
addCusAccApplyInfo
,
getChannelCompany
}
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