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
36456682
Commit
36456682
authored
May 15, 2025
by
Zllgogo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
6778ed4e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
177 additions
and
41 deletions
+177
-41
fuhua.ts
src/biz/fuhua.ts
+95
-39
zaiFu.ts
src/biz/zaiFu.ts
+79
-1
admin.ts
src/routers/admin.ts
+3
-1
No files found.
src/biz/fuhua.ts
View file @
36456682
...
...
@@ -462,60 +462,116 @@ export async function getOperateData(year) {
export
async
function
getRiskData
()
{
let
riskData
=
[
{
key
:
"迁出异常"
,
value
:
0
key
:
"迁出异常"
,
value
:
0
},
{
key
:
"办公地址冲突"
,
value
:
0
key
:
"办公地址冲突"
,
value
:
0
},
{
key
:
"连续未填报"
,
value
:
0
key
:
"连续未填报"
,
value
:
0
},
]
]
;
// 1. 迁出异常
let
qianchuList
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
企业孵化信息
,
{
state
:
FUHUASTATE
.
迁出
},
{});
let
qianchuAbnormal
=
qianchuList
.
filter
(
info
=>
{
// 示例条件:迁出时间在当前时间之后(不合理)
return
new
Date
(
info
.
endTime
)
>
new
Date
();
});
riskData
[
0
].
value
=
qianchuAbnormal
.
length
;
// 2. 办公地址冲突
let
leaseList
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
租赁信息
,
{},
[
"address"
,
"startTime"
,
"endTime"
,
"eId"
]);
let
addressConflict
=
new
Map
<
string
,
number
[]
>
();
leaseList
.
forEach
(
lease
=>
{
let
key
=
`
${
lease
.
address
}
-
${
lease
.
startTime
}
-
${
lease
.
endTime
}
`
;
if
(
addressConflict
.
has
(
key
))
{
addressConflict
.
get
(
key
)?.
push
(
lease
.
eId
);
}
else
{
addressConflict
.
set
(
key
,
[
lease
.
eId
]);
// 1. 获取所有迁出记录(state 为迁出)
let
zaifuList
=
await
selectManyTableData
(
OPERATIONALDATATYPE
.
多表联查
,
TABLENAME
.
企业基础信息表
,{},[
"eId"
,
"enterpriseName"
],
{
[
TABLENAME
.
企业孵化信息
]:
{
column
:
[
"state"
,
"moveOutTime"
,
"moveOutType"
,
"endTime"
],
where
:
{
state
:
FUHUASTATE
.
迁出
}
}
}
}
);
);
riskData
[
1
].
value
=
Array
.
from
(
addressConflict
.
values
()).
filter
(
ids
=>
ids
.
length
>
1
).
length
;
let
abnormalCount
=
0
;
// 3. 连续未填报
let
reportList
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
企业经营信息
,
{},
[
"eId"
,
"annual"
]);
let
continuousUnreported
=
new
Set
<
number
>
();
for
(
const
info
of
zaifuList
)
{
const
incubationInfo
=
info
.
enterprise_fuhuas
[
0
];
// 关联的孵化信息
if
(
!
incubationInfo
||
!
incubationInfo
.
moveOutTime
)
continue
;
let
moveOutTime
=
new
Date
(
incubationInfo
.
moveOutTime
);
let
endTime
=
info
.
enterprise_fuhuas
[
0
].
endTime
?
new
Date
(
info
.
enterprise_fuhuas
[
0
].
endTime
)
:
null
;
// 1. 违约迁出
let
isBreachExit
=
incubationInfo
.
moveOutType
===
EMIGRATIONTYPE
.
违约退租
;
// 2. 未到期迁出(迁出早于孵化结束)
let
isEarlyExit
=
endTime
&&
moveOutTime
<
endTime
;
// 如果满足任一异常条件,计为异常
if
(
isBreachExit
||
isEarlyExit
)
{
abnormalCount
++
;
}
}
riskData
[
0
].
value
=
abnormalCount
;
// 2. 办公地址冲突(楼号 + 室号 + 时间段冲突)
let
leaseList
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
租赁信息
,{},[
"eId"
,
"building"
,
"roomNumber"
,
"startTime"
,
"endTime"
]);
// 构建一个 map,key 是 building_roomNumber,值是租赁时间段列表
let
addressMap
=
new
Map
<
string
,
Array
<
{
eId
:
number
;
start
:
Date
;
end
:
Date
}
>>
();
for
(
const
lease
of
leaseList
)
{
const
key
=
`
${
lease
.
building
}
_
${
lease
.
roomNumber
}
`
;
const
timeRange
=
{
eId
:
lease
.
eId
,
start
:
new
Date
(
lease
.
startTime
),
end
:
new
Date
(
lease
.
endTime
)
};
if
(
!
addressMap
.
has
(
key
))
{
addressMap
.
set
(
key
,
[]);
}
addressMap
.
get
(
key
)?.
push
(
timeRange
);
}
// 假设每年需要填报,检查最近三年的填报情况
let
currentYear
=
new
Date
().
getFullYear
();
for
(
let
i
=
0
;
i
<
reportList
.
length
;
i
++
)
{
let
eId
=
reportList
[
i
].
eId
;
let
reportedYears
=
new
Set
(
reportList
.
filter
(
item
=>
item
.
eId
===
eId
).
map
(
item
=>
item
.
annual
));
let
conflictCount
=
0
;
for
(
let
year
=
currentYear
-
2
;
year
<=
currentYear
;
year
++
)
{
if
(
!
reportedYears
.
has
(
year
.
toString
()))
{
continuousUnreported
.
add
(
eId
);
break
;
// 遍历每个地址组合,检查时间段是否有重叠
for
(
const
[
key
,
ranges
]
of
addressMap
.
entries
())
{
for
(
let
i
=
0
;
i
<
ranges
.
length
;
i
++
)
{
for
(
let
j
=
i
+
1
;
j
<
ranges
.
length
;
j
++
)
{
const
a
=
ranges
[
i
];
const
b
=
ranges
[
j
];
// 判断时间段是否重叠
if
(
a
.
start
<
b
.
end
&&
b
.
start
<
a
.
end
)
{
conflictCount
++
;
break
;
// 当前地址组合已冲突,跳出循环
}
}
}
}
riskData
[
1
].
value
=
conflictCount
;
// 3. 连续未填报(改进:在孵企业中没有任何经营数据)
let
selectParam
=
{
state
:
STATE
.
是
};
/**在孵企业 当前时间小于孵化结束时间 */
let
araeParam
=
{
column
:[
"area"
,
"unitPrice"
,
"roomNumber"
,
"rent"
,
"startTime"
,
"endTime"
],
where
:{}
};
let
zaifuTableInfo
:
any
=
{};
zaifuTableInfo
[
TABLENAME
.
租赁信息
]
=
araeParam
;
zaifuTableInfo
[
TABLENAME
.
企业孵化信息
]
=
{
column
:[
"state"
,
"startTime"
,
"endTime"
],
where
:{
state
:{
"%ne%"
:
FUHUASTATE
.
迁出
}}
};
let
allIncubatingEnterprises
=
await
selectManyTableData
(
OPERATIONALDATATYPE
.
多表联查
,
TABLENAME
.
企业基础信息表
,
selectParam
,
[
"eId"
],
zaifuTableInfo
);
// 收集所有有填报记录的企业
let
reportedEnterprises
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
企业经营信息
,{},[
"eId"
]);
let
reportedEIds
=
new
Set
(
reportedEnterprises
.
map
(
e
=>
e
.
eId
));
// 找出没有填报的在孵企业
let
continuousUnreported
=
new
Set
<
number
>
();
allIncubatingEnterprises
.
forEach
(
ent
=>
{
if
(
!
reportedEIds
.
has
(
ent
.
eId
))
{
continuousUnreported
.
add
(
ent
.
eId
);
}
});
riskData
[
2
].
value
=
continuousUnreported
.
size
;
return
riskData
;
...
...
src/biz/zaiFu.ts
View file @
36456682
...
...
@@ -77,7 +77,6 @@ import { BUILDING } from "../config/enum/enum";
// return {dataList, dataCount:dataCount.length};
// }
export
async
function
enterpriseList
(
enterpriseName
:
string
,
page
:
number
,
logonStartTime
:
string
,
logonEndTime
:
string
,
startTime
:
number
,
endTime
:
number
,
building
:
number
)
{
let
selectParam
:
any
=
{
state
:
1
};
...
...
@@ -714,6 +713,7 @@ export async function dwEnterpriseTable(enterpriseName:string, type:number, file
if
(
enterpriseName
)
{
selectParam
.
enterpriseName
=
{
"%like%"
:
enterpriseName
}
}
}
let
filesList
=
[
"eId"
,
"enterpriseName"
,
"uscc"
,
"logonTime"
,
"logonAddress"
,
"qiYeGuiMo"
];
...
...
@@ -765,7 +765,85 @@ export async function dwEnterpriseTable(enterpriseName:string, type:number, file
return
{
dataList
};
}
/**
* 加了注册时间,租赁时间,园区楼号筛选的
*/
// export async function dwEnterpriseTable(enterpriseName:string, type:number,files, logonStartTime:string, logonEndTime:string, startTime: number,endTime: number, building: number ) {
// let selectParam:any = {state:1};
// if (type ==1) {
// if (enterpriseName) {
// selectParam.enterpriseName = {"%like%":enterpriseName}
// }
// // 注册时间筛选
// if (logonStartTime && logonEndTime) {
// selectParam.logonTime = {"%between%":[getMySqlMs(logonStartTime), getMySqlMs(logonEndTime)]}
// }
// }
// let filesList = ["eId", "enterpriseName", "uscc", "logonTime", "logonAddress", "qiYeGuiMo"];
// let manyTableInfo:any = {};
// // manyTableInfo[TABLENAME.租赁信息] = {column:["area", "startTime", "endTime","building", "roomNumber" ], where:{} };
// // 租赁信息表配置
// let leaseWhere:any = {};
// if (startTime && endTime) {
// if (!leaseWhere["%literal%"]) {
// leaseWhere["%literal%"] = `(startTime between '${getMySqlMs(startTime)}' and '${getMySqlMs(endTime)}'
// or endTime between '${getMySqlMs(startTime)}' and '${getMySqlMs(endTime)}') `;
// }
// }
// if (building) {
// leaseWhere.building = building;
// }
// // 关联企业孵化信息表,获取 moveOutTime 字段
// manyTableInfo[TABLENAME.企业孵化信息] = { column: ["moveOutTime","moveOutType", "startTime", "endTime",], where: { state:{"%ne%": enumConfig.FUHUASTATE.迁出} } };
// let resInfo = await selectManyTableData(OPERATIONALDATATYPE.多表联查, TABLENAME.企业基础信息表, selectParam, filesList, manyTableInfo);
// let dataList = [];
// let titleList = []
// let valueList = [];
// files.forEach(item => {
// titleList.push(item.key);
// valueList.push(item.value);
// });
// dataList.push(titleList);
// resInfo.forEach(info => {
// let {enterpriseName, uscc, logonTime, logonAddress, qiYeGuiMo, enterprise_leases, enterprise_fuhuas} = info;
// let leasesTime = '-'
// if (enterprise_leases[0].startTime){
// leasesTime = `${moment(enterprise_leases[0].startTime).format("YYYY-MM-DD")}至${moment(enterprise_leases[0].endTime).format("YYYY-MM-DD")}`;
// }
// let fuhuaTime = '-';
// if (enterprise_fuhuas[0].startTime){
// fuhuaTime = `${moment(enterprise_fuhuas[0].startTime).format("YYYY-MM-DD")}至${moment(enterprise_fuhuas[0].endTime).format("YYYY-MM-DD")}`;
// }
// let subList = [];
// valueList.forEach(subInfo => {
// if (subInfo == "enterpriseName") subList.push(enterpriseName);//企业名称
// if (subInfo == "uscc") subList.push(uscc); //统一信用代码
// if (subInfo == "logonTime") subList.push(moment(logonTime).format("YYYY-MM-DD"));//注册日期
// if (subInfo == "logonAddress") subList.push(changeAdd(JSON.parse(logonAddress)));//注册地址
// if (subInfo == "qiYeGuiMo") subList.push(qiYeGuiMo);//企业规模
// if (subInfo == "startTime") subList.push(fuhuaTime);//孵化时间
// if (subInfo == "startTime") subList.push(leasesTime);//租赁时间
// if (subInfo == "area") subList.push(enterprise_leases[0].area+"㎡");//租赁面积
// if (subInfo == "building") subList.push(enterprise_leases[0].building);//楼号
// if (subInfo == "roomNumber") subList.push(enterprise_leases[0].roomNumber);//室号
// });
// dataList.push(subList);
// })
// return {dataList};
// }
export
async
function
getAllDwOutPut
(
eId
:
string
)
{
let
details
=
{
...
...
src/routers/admin.ts
View file @
36456682
...
...
@@ -429,7 +429,9 @@ async function enterpriseDetails(req, res) {
* @param res
*/
async
function
dwEnterpriseList
(
req
,
res
)
{
let
{
enterpriseName
,
type
,
files
}
=
req
.
body
// let {enterpriseName, type, files,logonStartTime, logonEndTime, startTime,endTime, building } = req.body
// let result = await zaiFuBiz.dwEnterpriseTable(enterpriseName, type, files,logonStartTime, logonEndTime, startTime,endTime, building );
let
{
enterpriseName
,
type
,
files
}
=
req
.
body
let
result
=
await
zaiFuBiz
.
dwEnterpriseTable
(
enterpriseName
,
type
,
files
);
res
.
success
(
result
);
...
...
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