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
7a487e21
Commit
7a487e21
authored
Aug 27, 2020
by
王勇飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tx-fi-tax' of gitlab.gongsibao.com:jiangyong/zhichan into tx-fi-tax
parents
ae30f77d
004c016a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
9 deletions
+128
-9
tx-fi-tax/app/base/controller/impl/bizchance/bizoptCtl.js
+1
-1
tx-fi-tax/app/base/db/impl/bizchance/fitaxschemeDao.js
+1
-0
tx-fi-tax/app/base/system.js
+3
-8
tx-fi-tax/app/base/utils/toFtClient.js
+108
-0
tx-fi-tax/app/config/settings.js
+15
-0
No files found.
tx-fi-tax/app/base/controller/impl/bizchance/bizoptCtl.js
View file @
7a487e21
...
@@ -123,7 +123,7 @@ class BizOptCtl extends CtlBase {
...
@@ -123,7 +123,7 @@ class BizOptCtl extends CtlBase {
//根据需求编号去更新该条需求的状态为已关闭
//根据需求编号去更新该条需求的状态为已关闭
try
{
try
{
let
res
=
await
this
.
service
.
updateStatusByDemandCode
(
pobj
);
let
res
=
await
this
.
service
.
updateStatusByDemandCode
(
pobj
);
//TODO 同步该需求关闭信息到其他系统
//TODO 同步该需求关闭信息到其他系统
(走队列,直接扔到队列里面)
//添加到记录表
//添加到记录表
pobj
.
operator
=
{
pobj
.
operator
=
{
...
...
tx-fi-tax/app/base/db/impl/bizchance/fitaxschemeDao.js
View file @
7a487e21
...
@@ -18,6 +18,7 @@ class FitaxschemeDao extends Dao {
...
@@ -18,6 +18,7 @@ class FitaxschemeDao extends Dao {
/**
/**
* 插入方案信息
* 插入方案信息
* TODO 同步方案信息,获取方案编号(走队列,再写一个接收队列方案编号的方法,将方案编号更新到数据库)
* @param {*} qobj
* @param {*} qobj
* @param {*} t
* @param {*} t
*/
*/
...
...
tx-fi-tax/app/base/system.js
View file @
7a487e21
...
@@ -354,23 +354,18 @@ class System {
...
@@ -354,23 +354,18 @@ class System {
for
(
var
i
in
arr
)
{
for
(
var
i
in
arr
)
{
if
(
arr
[
i
]
!=
"sign"
&&
arr
[
i
]
!=
"ip"
&&
if
(
arr
[
i
]
!=
"sign"
&&
arr
[
i
]
!=
"ip"
&&
(
!
(
Object
.
prototype
.
toString
.
call
(
obj
[
arr
[
i
]])
==
'[object Object]'
||
Object
.
prototype
.
toString
.
call
(
obj
[
arr
[
i
]])
==
'[object Array]'
)
(
!
(
Object
.
prototype
.
toString
.
call
(
obj
[
arr
[
i
]])
==
'[object Object]'
||
Object
.
prototype
.
toString
.
call
(
obj
[
arr
[
i
]])
==
'[object Array]'
)
&&
(
obj
[
arr
[
i
]]
&&
obj
[
arr
[
i
]]
!=
'undefined'
)))
{
&&
(
(
obj
[
arr
[
i
]]
||
obj
[
arr
[
i
]]
===
0
||
obj
[
arr
[
i
]]
===
false
)
&&
obj
[
arr
[
i
]]
!=
'undefined'
)))
{
str
+=
arr
[
i
]
+
"="
+
obj
[
arr
[
i
]]
+
"&"
;
str
+=
arr
[
i
]
+
"="
+
obj
[
arr
[
i
]]
+
"&"
;
}
}
}
}
var
toSignStr
=
str
.
substr
(
0
,
str
.
length
-
1
);
var
toSignStr
=
str
.
substr
(
0
,
str
.
length
-
1
);
var
sb
=
toSignStr
+
secret
;
var
sb
=
toSignStr
+
secret
;
console
.
log
(
"cmd=ApiSignUtils:toSign msg=original Sign:"
+
sb
.
toString
()
+
" req param:"
+
obj
);
console
.
log
(
"cmd=ApiSignUtils:toSign msg=original Sign:"
+
sb
.
toString
());
// 对sb进行md5加密后得到svrSign
// 对sb进行md5加密后得到svrSign
svrSign
=
md5
(
sb
);
svrSign
=
md5
(
sb
);
console
.
log
(
"svrSign===>"
+
svrSign
);
console
.
log
(
"svrSign===>"
+
svrSign
);
}
}
if
(
svrSign
.
toLowerCase
()
==
obj
[
"sign"
].
toLowerCase
())
{
return
svrSign
;
console
.
log
(
"cmd=ApiSignUtils:SignValid msg=original Sign:"
+
svrSign
)
return
true
;
}
console
.
error
(
"cmd=ApiSignUtils:SignValid msg=Sign validtate fail! svrSign:"
+
svrSign
+
" reqSign:"
+
obj
[
"sign"
]);
return
false
;
}
}
static
queueOper
(
obj
)
{
static
queueOper
(
obj
)
{
...
...
tx-fi-tax/app/base/utils/toFtClient.js
0 → 100644
View file @
7a487e21
const
axios
=
require
(
"axios"
);
const
settings
=
require
(
"../../config/settings"
);
const
system
=
require
(
"../system"
);
const
ftConfig
=
settings
.
ftConfig
();
let
ftTenantInfo
;
// 财税中心 缓存
/**
* 发送 post 请求
* @param {*} url
* @param {*} data
* @param {*} headers
*/
const
postRequest
=
async
(
url
,
data
,
headers
=
{})
=>
{
try
{
console
.
log
(
`
${
url
}
: 推送财税中心数据 ------- `
);
console
.
log
(
JSON
.
stringify
(
data
))
let
result
=
await
axios
.
post
(
url
,
data
,
{
headers
:
{
'Content-Type'
:
'application/json'
,
...
headers
},
timeout
:
5000
,
});
result
=
result
.
data
;
console
.
log
(
"推送财税中心返回数据 ------- "
);
console
.
log
(
JSON
.
stringify
(
result
));
if
(
result
.
code
==
1
)
{
return
result
.
data
}
else
{
throw
new
Error
(
result
.
errMsg
);
}
}
catch
(
err
)
{
console
.
log
(
"------ 财税中心err -----"
);
console
.
log
(
err
)
throw
(
err
)
}
}
/**
* 向财税 项目 发送消息 (不带签名)
* @param {*} url
* @param {*} data
* @param {*} headers
*/
const
postToFt
=
(
url
,
data
,
headers
=
{})
=>
{
return
postRequest
(
`
${
ftConfig
.
url
}${
url
}
`
,
data
,
headers
=
{})
}
/**
* 租户 向财税 项目 发送消息 带签名
* @param {*} url
* @param {*} data
* @param {*} headers
*/
const
postToFtBySign
=
async
(
url
,
data
,
headers
=
{})
=>
{
let
tenantInfo
=
await
getChannelCompany
();
data
.
companyId
=
tenantInfo
.
id
;
let
sign
=
system
.
signValid
(
data
,
tenantInfo
.
signSecret
);
return
postRequest
(
`
${
ftConfig
.
url
}${
url
}
`
,
{
...
data
,
sign
},
headers
=
{})
}
/**
* 财税 获取 租户信息
*/
const
getChannelCompany
=
async
()
=>
{
// 内存 缓存
if
(
ftTenantInfo
)
{
return
ftTenantInfo
}
let
reqData
=
{
channelCode
:
ftConfig
.
channelCode
,
}
let
sign
=
system
.
signValid
(
reqData
,
ftConfig
.
secret
);
const
companyData
=
await
postToFt
(
"/company/getChannelCompany"
,
{
...
reqData
,
sign
});
if
(
companyData
.
datas
&&
companyData
.
datas
.
length
>
0
)
{
ftTenantInfo
=
companyData
.
datas
[
0
]
return
ftTenantInfo
;
}
else
{
throw
(
"渠道码信息获取错误"
);
}
}
/**
* 建账
*/
const
addCusAccApplyInfo
=
async
()
=>
{
let
reqData
=
{
accountStandard
:
1
,
applyDate
:
"2020-09-10"
,
contact
:
"JAMES7"
,
creditCode
:
"911101053516460817K"
,
customerName
:
"北京融易算"
,
phoneNumber
:
"18510669367"
,
valueAddedTax
:
1
,
serviceTime
:
"5"
,
initPeriod
:
202009
,
}
const
data
=
await
postToFtBySign
(
'/cusAccApplyInfo/addCusAccApplyInfo'
,
reqData
);
console
.
log
(
data
);
}
module
.
exports
=
{
postToFtBySign
,
addCusAccApplyInfo
}
tx-fi-tax/app/config/settings.js
View file @
7a487e21
...
@@ -59,6 +59,21 @@ var settings = {
...
@@ -59,6 +59,21 @@ var settings = {
return
"http://logs-sytxpublic-msgq-service/api/queueAction/producer/springBoard"
;
return
"http://logs-sytxpublic-msgq-service/api/queueAction/producer/springBoard"
;
}
}
},
},
ftConfig
:
function
()
{
if
(
this
.
env
==
"localhost"
)
{
return
{
channelCode
:
"e0kj8ehs"
,
secret
:
"92a15b9b4c5a9ea708bb5583408e1441"
,
url
:
"https://nt-api.gongsibao.com/nga-api"
};
}
else
{
return
{
channelCode
:
"e0kj8ehs"
,
secret
:
"92a15b9b4c5a9ea708bb5583408e1441"
,
url
:
"https://nt-api.gongsibao.com/nga-api"
};
}
},
pmappid
:
1
,
pmappid
:
1
,
pmcompanyid
:
1
,
pmcompanyid
:
1
,
pmroleid
:
{
"ta"
:
1
,
"pr"
:
2
},
pmroleid
:
{
"ta"
:
1
,
"pr"
:
2
},
...
...
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