Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yuyiAdminServer
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
yuyiAdminServer
Commits
3fd93875
Commit
3fd93875
authored
May 28, 2025
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
70b7d73d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
73 deletions
+67
-73
qccInit.ts
src/biz/qccInit.ts
+62
-47
dataInterfaceWithCache.ts
src/data/dataInterfaceWithCache.ts
+4
-25
main.ts
src/main.ts
+1
-1
No files found.
src/biz/qccInit.ts
View file @
3fd93875
...
...
@@ -28,7 +28,7 @@ export async function updateQCCDataTask() {
async
function
数据是否存在
(
tableName
,
param
,
idKey
)
{
let
info
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
tableName
,
param
,
[]);
let
info
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
tableName
,
param
,
[
idKey
]);
if
(
info
&&
info
[
idKey
])
{
return
true
;
}
...
...
@@ -67,7 +67,7 @@ function getReqParam(uscc, isKeyNo?) {
Token
:
md5
(
`
${
systemConfig
.
qccKey
}${
TimeSpan
}${
systemConfig
.
qccSecretKey
}
`
).
toUpperCase
(),
TimeSpan
};
let
query
=
{};
let
query
:
any
=
{};
if
(
isKeyNo
==
"isKeyNo"
)
{
query
=
{
key
:
systemConfig
.
qccKey
,
...
...
@@ -95,6 +95,7 @@ function getReqParam(uscc, isKeyNo?) {
// keyNo:"云合智网(上海)技术有限公司"
};
}
return
{
header
,
query
};
}
...
...
@@ -117,7 +118,29 @@ async function 工商信息(uscc, eId) {
let
TermEnd
=
"无固定期限"
;
if
(
工商信息
.
TermEnd
)
TermEnd
=
moment
(
工商信息
.
TermEnd
).
format
(
"YYYY-MM-DD"
);
if
(
工商信息
.
OperName
)
{
let
farenInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
法人信息表
,
{
eId
,
name
:
工商信息
.
OperName
},
[
"legalId"
]
);
if
(
!
farenInfo
||
!
farenInfo
.
legalId
)
{
await
operationalData
(
OPERATIONALDATATYPE
.
删除
,
TABLENAME
.
法人信息表
,
{},
{
eId
});
let
addfr
=
{
legalId
:
randomId
(
TABLEID
.
法人信息表
),
eId
,
name
:
工商信息
.
OperName
};
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
法人信息表
,
addfr
,
{});
}
}
//企业基础信息
let
guanWang
=
""
;
if
(
工商信息
.
ContactInfo
.
WebSite
&&
工商信息
.
ContactInfo
.
WebSite
[
0
])
{
guanWang
=
工商信息
.
ContactInfo
.
WebSite
[
0
].
Url
||
""
;
}
let
qiYeGuiMo
=
""
;
if
(
工商信息
.
TagList
&&
工商信息
.
TagList
[
0
])
{
guanWang
=
工商信息
.
TagList
[
0
].
Name
||
""
;
}
let
baseInfo
=
{
enterpriseName
:
工商信息
.
Name
,
pinyinName
,
...
...
@@ -136,9 +159,9 @@ async function 工商信息(uscc, eId) {
// liaison: 工商信息., //联系人
liaisonPhone
:
工商信息
.
ContactInfo
.
PhoneNumber
,
//联系电话
dengJiJiGuan
:
工商信息
.
BelongOrg
,
//登机机关
qiYeGuiMo
:
工商信息
.
TagList
[
0
].
Name
,
//企业规模 TagList
qiYeGuiMo
,
//企业规模 TagList
RAS
:
工商信息
.
Status
,
//登记状态
guanWang
:
工商信息
.
ContactInfo
.
WebSite
[
0
].
Url
,
//官网地址
guanWang
,
//官网地址
yingYeQiXian
:
`
${
TermStart
}
至
${
TermEnd
}
`
,
//营业期限 TermStart至TermEnd
logOffMS
:
工商信息
.
EndDate
||
null
,
//注销时间
shijiaoziben
:
工商信息
.
RecCap
,
//实缴资本
...
...
@@ -162,7 +185,7 @@ async function 工商信息(uscc, eId) {
let
出现不存在数据
=
false
;
for
(
let
i
=
0
;
i
<
工商信息
.
Partners
.
length
;
i
++
)
{
let
info
=
工商信息
.
Partner
[
i
];
let
info
=
工商信息
.
Partner
s
[
i
];
let
findItemParam
=
{
name
:
info
.
StockName
,
finalBenefitPercent
:
info
.
FinalBenefitPercent
,
...
...
@@ -219,7 +242,7 @@ async function 工商信息(uscc, eId) {
let
{
Type
,
Name
}
=
info
;
let
dbLabelItem
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
企业标签表
,
{
labelName
:
info
.
Name
},
[
"elId"
]);
if
(
!
dbLabelItem
&&
!
dbLabelItem
.
elId
)
{
if
(
!
dbLabelItem
||
!
dbLabelItem
.
elId
)
{
//添加新的
let
addItemInfo
=
{
elId
:
randomId
(
TABLEID
.
企业标签表
),
...
...
@@ -232,7 +255,7 @@ async function 工商信息(uscc, eId) {
//处理资质
let
isAdd
=
false
;
//库里是否不存在这个企业的数据
let
zzInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
企业资质
,
{
eId
},
[]);
let
zzInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
企业资质
,
{
eId
},
[
"qId"
]);
if
(
!
zzInfo
||
!
zzInfo
.
qId
)
{
//不存在 直接添加
zzInfo
=
{
...
...
@@ -292,19 +315,7 @@ async function 工商信息(uscc, eId) {
}
}
//删除历史记录数据
await
operationalData
(
OPERATIONALDATATYPE
.
删除
,
TABLENAME
.
企业标签表
,
null
,
{
eId
});
//同步最新记录
let
enterpriseLabelList
=
[];
工商信息
.
TagList
.
forEach
(
info
=>
{
enterpriseLabelList
.
push
({
elId
:
randomId
(
TABLEID
.
企业标签表
),
eId
,
type
:
info
.
Type
,
labelName
:
info
.
Name
,
});
});
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
企业标签表
,
enterpriseLabelList
,
null
);
}
/**
...
...
@@ -335,7 +346,7 @@ async function 工商信息(uscc, eId) {
* 变更记录目前小程序没有涉及到这部分数据,所以直接与企查查全量更新
* 逻辑:先删除现有的,再重新添加
*/
if
(
工商信息
.
ChangeRecords
)
{
if
(
工商信息
.
ChangeRecords
&&
工商信息
.
ChangeRecords
.
length
)
{
//删除历史记录数据
await
operationalData
(
OPERATIONALDATATYPE
.
删除
,
TABLENAME
.
变更信息表
,
null
,
{
eId
});
//同步最新记录
...
...
@@ -352,7 +363,7 @@ async function 工商信息(uscc, eId) {
});
});
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
变更信息表
,
infoupdateList
,
null
);
if
(
infoupdateList
.
length
)
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
变更信息表
,
infoupdateList
,
null
);
}
}
...
...
@@ -397,7 +408,7 @@ async function 知识产权(uscc, eId) {
if
(
!
item
||
!
item
.
qccId
)
{
let
qcc
商标详情
=
await
商标详情查询
(
uscc
,
info
.
ID
);
//添加新的
let
addItemInfo
=
{
let
addItemInfo
:
any
=
{
tmId
:
randomId
(
TABLEID
.
商标
),
eId
,
qccId
:
info
.
ID
,
...
...
@@ -408,8 +419,8 @@ async function 知识产权(uscc, eId) {
person
:
info
.
Person
,
imageUrl
:
info
.
ImageUrl
,
flowStatusDesc
:
info
.
FlowStatusDesc
,
RegDate
:
moment
(
qcc
商标详情
.
RegDate
).
format
(
"YYYY-MM-DD"
),
};
if
(
qcc
商标详情
.
RegDate
)
addItemInfo
.
RegDate
=
getMySqlMs
(
qcc
商标详情
.
RegDate
)
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
商标
,
addItemInfo
,
{});
}
}
...
...
@@ -427,17 +438,17 @@ async function 知识产权(uscc, eId) {
let
item
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
作品著作权
,
{
registerNo
:
info
.
RegisterNo
},
[
"registerNo"
]);
if
(
!
item
||
!
item
.
registerNo
)
{
// 库里不存在就会添加新的
let
addItemInfo
=
{
let
addItemInfo
:
any
=
{
crId
:
randomId
(
TABLEID
.
作品著作权
),
eId
,
owner
:
info
.
Owner
,
category
:
info
.
Category
,
name
:
info
.
Name
,
registerNo
:
info
.
RegisterNo
,
registerDate
:
moment
(
info
.
RegisterDate
).
format
(
"YYYY-MM-DD"
),
publishDate
:
moment
(
info
.
PublishDate
).
format
(
"YYYY-MM-DD"
),
finishDate
:
moment
(
info
.
FinishDate
).
format
(
"YYYY-MM-DD"
),
};
if
(
info
.
RegisterDate
)
addItemInfo
.
registerDate
=
getMySqlMs
(
info
.
RegisterDate
);
if
(
info
.
PublishDate
)
addItemInfo
.
publishDate
=
getMySqlMs
(
info
.
PublishDate
);
if
(
info
.
FinishDate
)
addItemInfo
.
finishDate
=
getMySqlMs
(
info
.
FinishDate
);
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
作品著作权
,
addItemInfo
,
{});
}
...
...
@@ -447,7 +458,8 @@ async function 知识产权(uscc, eId) {
}
/**同步 软件著作权 */
let
rjzzqReqInfo
=
getReqParam
(
uscc
);
let
rjzzqReqInfo
:
any
=
getReqParam
(
uscc
);
rjzzqReqInfo
.
query
.
pageSize
=
50
;
let
软件著作查询
:
any
=
await
getQcc
(
'https://api.qichacha.com/CopyRight/SearchSoftwareCr'
,
rjzzqReqInfo
.
query
,
rjzzqReqInfo
.
header
);
if
(
Array
.
isArray
(
软件著作查询
))
{
for
(
let
i
=
0
;
i
<
软件著作查询
.
length
;
i
++
)
{
...
...
@@ -455,19 +467,19 @@ async function 知识产权(uscc, eId) {
let
item
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
软件著作权
,
{
registerNo
:
info
.
RegisterNo
},
[
"registerNo"
]);
if
(
!
item
||
!
item
.
registerNo
)
{
// 库里不存在就会添加新的
let
addItemInfo
=
{
let
addItemInfo
:
any
=
{
scId
:
randomId
(
TABLEID
.
软件著作权
),
eId
,
category
:
info
.
Category
,
publishDate
:
info
.
PublishDate
,
versionNo
:
info
.
VersionNo
,
registerNo
:
info
.
RegisterNo
,
registerAperDate
:
moment
(
info
.
RegisterAperDate
).
format
(
"YYYY-MM-DD"
),
name
:
info
.
Name
,
shortName
:
info
.
ShortName
,
owner
:
info
.
Owner
,
finishDevelopDate
:
moment
(
info
.
FinishDevelopDate
).
format
(
"YYYY-MM-DD"
),
};
if
(
info
.
RegisterAperDate
)
addItemInfo
.
registerAperDate
=
getMySqlMs
(
info
.
RegisterAperDate
);
if
(
info
.
FinishDevelopDate
)
addItemInfo
.
finishDevelopDate
=
getMySqlMs
(
info
.
FinishDevelopDate
);
if
(
info
.
PublishDate
)
addItemInfo
.
publishDate
=
getMySqlMs
(
info
.
PublishDate
);
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
软件著作权
,
addItemInfo
,
{});
}
...
...
@@ -477,7 +489,8 @@ async function 知识产权(uscc, eId) {
}
/** IPRALLTYPE.外观设计专利, IPRALLTYPE.实用新型专利 IPRALLTYPE.发明专利 */
let
zlcxReqInfo
=
getReqParam
(
uscc
);
let
zlcxReqInfo
:
any
=
getReqParam
(
uscc
);
zlcxReqInfo
.
query
.
pageSize
=
50
;
let
专利查询
:
any
=
await
getQcc
(
'https://api.qichacha.com/PatentV4/SearchMultiPatents'
,
zlcxReqInfo
.
query
,
zlcxReqInfo
.
header
);
if
(
Array
.
isArray
(
专利查询
))
{
for
(
let
i
=
0
;
i
<
专利查询
.
length
;
i
++
)
{
...
...
@@ -485,23 +498,25 @@ async function 知识产权(uscc, eId) {
let
item
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
专利
,
{
applicationNumber
:
info
.
ApplicationNumber
},
[
"applicationNumber"
]);
if
(
!
item
||
!
item
.
applicationNumber
)
{
// 库里不存在就会添加新的
let
addItemInfo
=
{
let
addItemInfo
:
any
=
{
patentId
:
randomId
(
TABLEID
.
专利
),
eId
,
category
:
info
.
Category
,
kindcode
:
info
.
Kind
c
ode
,
kindcode
:
info
.
Kind
C
ode
,
applicationNumber
:
info
.
ApplicationNumber
,
applicationDate
:
moment
(
info
.
ApplicationDate
).
format
(
"YYYY-MM-DD"
),
publicationNumber
:
info
.
PublicationNumber
,
publicationDate
:
moment
(
info
.
PublicationDate
).
format
(
"YYYY-MM-DD"
),
legalStatusDesc
:
info
.
LegalStatusDesc
,
title
:
info
.
Title
,
agency
:
JSON
.
stringify
(
info
.
Agency
||
[]),
kindCodeDesc
:
info
.
KindCodeDesc
,
IPCDesc
:
JSON
.
stringify
(
info
.
IPCDesc
||
[]),
inventorStringList
:
JSON
.
stringify
(
info
.
info
.
InventorStringList
||
[]),
inventorStringList
:
JSON
.
stringify
(
info
.
InventorStringList
||
[]),
assigneestringList
:
JSON
.
stringify
(
info
.
AssigneestringList
||
[]),
};
if
(
info
.
ApplicationDate
)
addItemInfo
.
applicationDate
=
getMySqlMs
(
info
.
ApplicationDate
);
if
(
info
.
PublicationDate
)
addItemInfo
.
publicationDate
=
getMySqlMs
(
info
.
PublicationDate
);
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
专利
,
addItemInfo
,
{});
}
...
...
@@ -527,7 +542,7 @@ async function 主要人员(uscc, eId) {
if
(
Array
.
isArray
(
主要人员数据
))
{
let
employeesList
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
主要人员
,
{
eId
},
[])
let
employeesList
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
主要人员
,
{
eId
},
[
"job"
,
"name"
])
let
checkMap
=
{};
employeesList
.
forEach
(
info
=>
{
checkMap
[
info
.
name
]
=
info
.
job
;
...
...
@@ -603,7 +618,7 @@ async function 准入尽职调查(uscc, eId) {
for
(
let
i
=
0
;
i
<
qccselectdata
.
Data
.
length
;
i
++
)
{
let
info
=
qccselectdata
.
Data
[
i
];
let
item
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
空壳扫描
,
{
eId
,
title
:
info
.
Title
},
[
"riskId"
]
);
let
item
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
风险
,
{
eId
,
title
:
info
.
Title
},
[
"riskId"
]
);
if
(
!
item
||
!
item
.
riskId
)
{
addList
.
push
({
riskId
:
randomId
(
TABLEID
.
风险
),
...
...
@@ -729,12 +744,12 @@ async function 科创分(uscc, eId) {
function
getFinancingRounds
(
str
)
{
if
(
str
.
indexOf
(
"天使"
))
return
FINANCINGROUNDS
.
天使投资
;
if
(
str
.
indexOf
(
"种子"
))
return
FINANCINGROUNDS
.
种子轮
;
if
(
str
.
indexOf
(
"A"
))
return
FINANCINGROUNDS
.
A
轮
;
if
(
str
.
indexOf
(
"B"
))
return
FINANCINGROUNDS
.
B
轮
;
if
(
str
.
indexOf
(
"C"
))
return
FINANCINGROUNDS
.
C
轮
;
if
(
str
.
indexOf
(
"以上"
))
return
FINANCINGROUNDS
.
C
轮以上
;
if
(
str
.
indexOf
(
"天使"
)
>
-
1
)
return
FINANCINGROUNDS
.
天使投资
;
if
(
str
.
indexOf
(
"种子"
)
>
-
1
)
return
FINANCINGROUNDS
.
种子轮
;
if
(
str
.
indexOf
(
"A"
)
>
-
1
)
return
FINANCINGROUNDS
.
A
轮
;
if
(
str
.
indexOf
(
"B"
)
>
-
1
)
return
FINANCINGROUNDS
.
B
轮
;
if
(
str
.
indexOf
(
"C"
)
>
-
1
)
return
FINANCINGROUNDS
.
C
轮
;
if
(
str
.
indexOf
(
"以上"
)
>
-
1
)
return
FINANCINGROUNDS
.
C
轮以上
;
return
FINANCINGROUNDS
.
天使投资
;
}
...
...
src/data/dataInterfaceWithCache.ts
View file @
3fd93875
import
{
awaitData
}
from
"../biz/dataInit"
;
import
{
OPERATIONALDATATYPE
,
TABLENAME
}
from
"../config/enum/dbEnum"
;
import
{
selectData
}
from
"./operationalData"
;
// 初始化数据文件结构
async
function
initDataFile
()
{
let
enterpriseList
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
企业基础信息表
,
{},
[
"eId"
,
"uscc"
,
"enterpriseName"
]);
let
currentData
=
{};
let
usccData
=
await
awaitData
(
"91310115MADM8EA654"
);
currentData
[
"91310115MADM8EA654"
]
=
usccData
;
for
(
let
i
=
0
;
i
<
enterpriseList
.
length
;
i
++
)
{
let
info
=
enterpriseList
[
i
];
console
.
log
(
"开始同步企查查数据"
);
let
usccData
=
await
awaitData
(
info
.
uscc
);
currentData
[
info
.
uscc
]
=
usccData
;
console
.
log
(
`
${
info
.
enterpriseName
}
同步成功, eId:
${
info
.
eId
}
,下标
${
i
}
`
);
}
console
.
log
(
"刷新缓存数据结束"
)
}
import
{
updateQCCDataTask
}
from
"../biz/qccInit"
;
/**
...
...
@@ -28,9 +7,9 @@ async function initDataFile() {
* 设置定时器,每天刷新一次数据
*/
export
async
function
initApiDataStorage
()
{
await
initDataFile
();
await
updateQCCDataTask
();
setInterval
(
async
function
()
{
await
initDataFile
();
await
updateQCCDataTask
();
},
3600
*
1000
*
24
);
}
...
...
src/main.ts
View file @
3fd93875
...
...
@@ -9,7 +9,7 @@ async function lanuch() {
httpServer
.
createServer
(
systemConfig
.
port
);
console
.
log
(
'This indicates that the server is started successfully.'
);
//
await initApiDataStorage();
await
initApiDataStorage
();
}
...
...
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