Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zjxcxServer
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
zjxcxServer
Commits
b2b8f876
Commit
b2b8f876
authored
Jun 08, 2023
by
孙香冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
abi接口
parent
25afc29c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
163 additions
and
1 deletions
+163
-1
.gitignore
.gitignore
+0
-1
testAbi.ts
src/biz/mobileFuHuaQi/fuHuaQi/testAbi.ts
+121
-0
testAbi.ts
src/routers/mobileClient/testAbi.ts
+42
-0
No files found.
.gitignore
View file @
b2b8f876
...
...
@@ -5,6 +5,5 @@
/public
/logs
/video
*test*
*.logs
*.zip
src/biz/mobileFuHuaQi/fuHuaQi/testAbi.ts
0 → 100644
View file @
b2b8f876
import
moment
=
require
(
"moment"
);
import
*
as
fuhuaqiData
from
"../../../data/fuHuaQi/fuhuaqi"
;
import
*
as
monthData
from
"../../../data/fuHuaQi/monthTable"
;
import
*
as
enterpriseData
from
"../../../data/enterprise/enterprise"
;
export
async
function
getTestABI
()
{
let
res
=
await
fuhuaqiData
.
findFuHuaQiList
({});
return
{
dataList
:
res
}
}
/**
* 孵化器平均月度出租率
* @returns occupancyRateAvg 该月的月度出租率
*/
export
async
function
getAvgOccupancyRate
()
{
let
year
=
moment
().
format
(
"YYYY"
);
let
month
=
moment
().
subtract
(
1
,
'M'
).
format
(
"M"
);
let
dataBaseList
=
await
monthData
.
findMonthTableList
({
year
,
month
:
1
});
let
occupancyRate
=
0
;
dataBaseList
.
forEach
(
info
=>
{
if
(
info
.
occupancyRate
)
occupancyRate
=
occupancyRate
+
info
.
occupancyRate
;
});
let
occupancyRateAvg
=
Math
.
round
(
occupancyRate
/
dataBaseList
.
length
);
return
{
"孵化器平均出租率"
:
occupancyRateAvg
};
}
/**
* 孵化器总面积
* @returns acreageTotal 所有孵化器的总面积
*/
export
async
function
getAcreageTotal
()
{
let
dataBaseList
=
await
fuhuaqiData
.
findFuHuaQiList
({});
let
acreageTotal
=
0
;
dataBaseList
.
forEach
(
info
=>
{
if
(
info
.
acreageTotal
)
acreageTotal
=
acreageTotal
+
Math
.
floor
(
info
.
acreageTotal
);
});
return
{
"孵化总面积"
:
acreageTotal
};
}
/**
* 机构性质
* @returns dataList
*/
export
async
function
getInstitutionalNature
()
{
let
国资为主
=
await
fuhuaqiData
.
findFuHuaQiCount
({
institutionalNature
:
1
});
let
民资为主
=
await
fuhuaqiData
.
findFuHuaQiCount
({
institutionalNature
:
2
});
let
外资为主
=
await
fuhuaqiData
.
findFuHuaQiCount
({
institutionalNature
:
3
});
let
dataList
=
[
{
key
:
"国资为主"
,
value
:
国资为主
},
{
key
:
"民资为主"
,
value
:
民资为主
},
{
key
:
"外资为主"
,
value
:
外资为主
}
]
return
dataList
;
}
/**
* 资质情况
* @returns
*/
export
async
function
getlv
()
{
let
国家级众创空间
=
await
fuhuaqiData
.
findFuHuaQiCount
({
lv
:
1
});
let
市级众创空间
=
await
fuhuaqiData
.
findFuHuaQiCount
({
lv
:
2
});
let
国家级孵化器
=
await
fuhuaqiData
.
findFuHuaQiCount
({
lv
:
3
});
let
市级孵化器
=
await
fuhuaqiData
.
findFuHuaQiCount
({
lv
:
4
});
let
区级
=
await
fuhuaqiData
.
findFuHuaQiCount
({
lv
:
5
});
let
dataList
=
[
{
key
:
"国家级众创空间"
,
value
:
国家级众创空间
},
{
key
:
"市级众创空间"
,
value
:
市级众创空间
},
{
key
:
"国家级孵化器"
,
value
:
国家级孵化器
},
{
key
:
"市级孵化器"
,
value
:
市级孵化器
},
{
key
:
"区级"
,
value
:
区级
}
]
return
dataList
;
}
/**
* 在孵企业数(家)
* @returns enterpriseTotal 在孵企业数(家)
*/
export
async
function
getEnterpriseTotal
()
{
let
enterpriseTotal
=
await
enterpriseData
.
findEnterpriseCount
({});
return
{
"在孵企业数"
:
enterpriseTotal
};
}
\ No newline at end of file
src/routers/mobileClient/testAbi.ts
0 → 100644
View file @
b2b8f876
import
*
as
asyncHandler
from
'express-async-handler'
;
import
*
as
testAbiBiz
from
'../../biz/mobileFuHuaQi/fuHuaQi/testAbi'
;
import
{
checkInterior
}
from
'../../middleware/user'
;
export
function
setRouter
(
httpServer
)
{
httpServer
.
post
(
'/testabi/avgoccupancyrate'
,
checkInterior
,
asyncHandler
(
avgOccupancyRate
));
httpServer
.
post
(
'/testabi/totalacreage'
,
checkInterior
,
asyncHandler
(
acreageTotal
));
httpServer
.
post
(
'/testabi/institutionalnature'
,
checkInterior
,
asyncHandler
(
institutionalNature
));
httpServer
.
post
(
'/testabi/lv'
,
checkInterior
,
asyncHandler
(
lv
));
httpServer
.
post
(
'/testabi/enterprisetotal'
,
checkInterior
,
asyncHandler
(
enterpriseTotal
));
}
async
function
avgOccupancyRate
(
req
,
res
)
{
let
avgOccupancyRate
=
await
testAbiBiz
.
getAvgOccupancyRate
();
res
.
success
(
avgOccupancyRate
);
}
async
function
acreageTotal
(
req
,
res
)
{
let
acreageTotal
=
await
testAbiBiz
.
getAcreageTotal
();
res
.
success
(
acreageTotal
);
}
async
function
institutionalNature
(
req
,
res
)
{
let
institutionalNature
=
await
testAbiBiz
.
getInstitutionalNature
();
res
.
success
(
institutionalNature
);
}
async
function
lv
(
req
,
res
)
{
let
lv
=
await
testAbiBiz
.
getlv
();
res
.
success
(
lv
);
}
async
function
enterpriseTotal
(
req
,
res
)
{
let
enterpriseTotal
=
await
testAbiBiz
.
getEnterpriseTotal
();
res
.
success
(
enterpriseTotal
);
}
\ No newline at end of file
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