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
f3a3b953
Commit
f3a3b953
authored
Feb 09, 2023
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
4bc34a76
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
411 additions
and
31 deletions
+411
-31
enterprise.ts
src/biz/enterprise/enterprise.ts
+33
-2
financing.ts
src/biz/enterprise/financing.ts
+36
-2
month.ts
src/biz/fuHuqQi/month.ts
+64
-0
task.ts
src/biz/fuHuqQi/task.ts
+6
-5
checkParamConfig.ts
src/config/checkParamConfig.ts
+0
-1
errorEnum.ts
src/config/errorEnum.ts
+2
-1
ojbectResultKeyConfig.ts
src/config/ojbectResultKeyConfig.ts
+38
-2
enterprise.ts
src/data/enterprise/enterprise.ts
+11
-3
financing.ts
src/data/enterprise/financing.ts
+24
-3
fuhuaqi.ts
src/data/fuHuaQi/fuhuaqi.ts
+32
-1
monthTable.ts
src/data/fuHuaQi/monthTable.ts
+27
-2
task.ts
src/data/fuHuaQi/task.ts
+3
-3
user.ts
src/middleware/user.ts
+31
-1
admin.ts
src/routers/admin.ts
+1
-1
fuhuaqi.ts
src/routers/fuhuaqi.ts
+64
-2
tools.ts
src/util/tools.ts
+39
-2
No files found.
src/biz/enterprise/enterprise.ts
View file @
f3a3b953
...
@@ -7,9 +7,10 @@
...
@@ -7,9 +7,10 @@
import
{
MoveInEnterpriseParamConfig
,
RegisterEnterpriseParamConfig
}
from
"../../config/checkParamConfig"
;
import
{
MoveInEnterpriseParamConfig
,
RegisterEnterpriseParamConfig
}
from
"../../config/checkParamConfig"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
createEnterprise
,
findEnterpriseByUscc
}
from
"../../data/enterprise/enterprise"
;
import
{
EnterpriseInfoConfig
}
from
"../../config/ojbectResultKeyConfig"
;
import
{
createEnterprise
,
deleteEnterprise
,
findEnterpriseByUscc
}
from
"../../data/enterprise/enterprise"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
checkChange
,
checkParamater
,
getTaskId
}
from
"../../util/tools"
import
{
checkChange
,
checkParamater
,
extractData
,
getTaskId
}
from
"../../util/tools"
/**
/**
...
@@ -101,3 +102,32 @@ export async function updateMoveInEnterprise(uscc:string, param) {
...
@@ -101,3 +102,32 @@ export async function updateMoveInEnterprise(uscc:string, param) {
}
}
/**
* 根据企业id查询企业
* @param uscc 企业统一信用代码
*/
export
async
function
getEnterpriseByUscc
(
uscc
:
string
)
{
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
uscc
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
uscc
}
这个企业`
);
let
data
=
extractData
(
EnterpriseInfoConfig
,
dataBaseInfo
);
return
{
data
};
}
/**
* 根据企业id删除草稿企业
* @param uscc 企业统一信用代码
*/
export
async
function
deleteEnterpriseByUscc
(
uscc
:
string
)
{
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
uscc
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
uscc
}
这个企业`
);
if
(
dataBaseInfo
.
draftLock
)
throw
new
BizError
(
ERRORENUM
.
已入库的企业不能删除
,
uscc
);
await
deleteEnterprise
(
uscc
);
return
{
isSuccess
:
true
};
}
\ No newline at end of file
src/biz/enterprise/financing.ts
View file @
f3a3b953
...
@@ -7,9 +7,10 @@
...
@@ -7,9 +7,10 @@
import
{
FinancingParamConfig
}
from
"../../config/checkParamConfig"
;
import
{
FinancingParamConfig
}
from
"../../config/checkParamConfig"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
createFinancing
,
findFinancingInfoByTaskIdAndSucc
}
from
"../../data/enterprise/financing"
;
import
{
EnterpriseFinancingInfoConfig
,
EnterpriseInfoConfig
}
from
"../../config/ojbectResultKeyConfig"
;
import
{
createFinancing
,
deleteEnterpriseFinancing
,
findEnterpriseFinancingByUscc
,
findFinancingInfoByTaskIdAndSucc
}
from
"../../data/enterprise/financing"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
checkChange
,
checkParamater
,
getTaskId
}
from
"../../util/tools"
;
import
{
checkChange
,
checkParamater
,
extractData
,
getTaskId
}
from
"../../util/tools"
;
/**
/**
...
@@ -56,3 +57,35 @@ export async function updateFinancingInfo(uscc, param) {
...
@@ -56,3 +57,35 @@ export async function updateFinancingInfo(uscc, param) {
return
{
isSuccess
:
true
};
return
{
isSuccess
:
true
};
}
}
/**
* 根据企业id查询企业
* @param uscc 企业统一信用代码
*/
export
async
function
getEnterpriseFinancingByUscc
(
fuHuaQiUscc
:
string
,
uscc
:
string
)
{
const
TaskId
=
getTaskId
(
fuHuaQiUscc
);
let
dataBaseInfo
=
await
findEnterpriseFinancingByUscc
(
uscc
,
TaskId
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
uscc
}
这个企业`
);
let
data
=
extractData
(
EnterpriseFinancingInfoConfig
,
dataBaseInfo
);
return
{
data
};
}
/**
* 根据企业id删除草稿企业
* @param uscc 企业统一信用代码
*/
export
async
function
deleteEnterpriseFinancingByUscc
(
fuHuaQiUscc
:
string
,
uscc
:
string
)
{
const
TaskId
=
getTaskId
(
fuHuaQiUscc
);
let
dataBaseInfo
=
await
findEnterpriseFinancingByUscc
(
uscc
,
TaskId
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
uscc
}
这个企业`
);
if
(
dataBaseInfo
.
draftLock
)
throw
new
BizError
(
ERRORENUM
.
已入库的企业不能删除
,
uscc
);
await
deleteEnterpriseFinancing
(
uscc
,
TaskId
);
return
{
isSuccess
:
true
};
}
\ No newline at end of file
src/biz/fuHuqQi/month.ts
View file @
f3a3b953
...
@@ -8,6 +8,7 @@ import { BizError } from "../../util/bizError";
...
@@ -8,6 +8,7 @@ import { BizError } from "../../util/bizError";
import
*
as
monthData
from
"../../data/fuHuaQi/monthTable"
;
import
*
as
monthData
from
"../../data/fuHuaQi/monthTable"
;
import
{
getTaskId
}
from
"../../util/tools"
;
import
{
getTaskId
}
from
"../../util/tools"
;
import
moment
=
require
(
"moment"
);
import
moment
=
require
(
"moment"
);
import
{
findAllFuHuaQiOperationNameMap
,
getFuHuaQiCreateDataTimeMap
}
from
"../../data/fuHuaQi/fuhuaqi"
;
/**
/**
* 新添加孵化器月度填报
* 新添加孵化器月度填报
...
@@ -58,4 +59,66 @@ export async function deleteReport(uscc:string) {
...
@@ -58,4 +59,66 @@ export async function deleteReport(uscc:string) {
await
monthData
.
deleteReport
(
uscc
,
dataBaseInfo
.
name
);
await
monthData
.
deleteReport
(
uscc
,
dataBaseInfo
.
name
);
return
{
isSuccess
:
true
};
return
{
isSuccess
:
true
};
}
/**
* 月度出租率数据列表
* 管理后台使用
* @param state 填报状态
* @param year 数据年份
* @param month 数据月份
* @param page 页面
*/
export
async
function
monthTableList
(
state
:
number
,
year
:
number
,
month
:
number
,
page
:
number
)
{
let
selectParam
:
any
=
{};
if
(
year
)
selectParam
.
year
=
year
;
if
(
month
)
selectParam
.
month
=
month
;
if
(
state
==
1
)
{
let
{
dataList
,
count
}
=
await
getCompleted
(
selectParam
,
page
);
return
{
dataList
,
count
};
}
else
if
(
state
==
2
)
{
}
else
{
let
{
dataList
,
count
}
=
await
getCompleted
(
selectParam
,
page
);
/**组合未填报 */
}
// let 需要组合未填报数 = 10 - dataList.length;
// return {count, dataList};
}
async
function
getNotCompleted
(
year
,
month
)
{
/** */
getFuHuaQiCreateDataTimeMap
();
}
/**
* 获取已填报数据
* @param selectParam
* @param page
* @returns
*/
async
function
getCompleted
(
selectParam
,
page
)
{
let
dataBaseList
=
await
monthData
.
findMonthTableList
(
selectParam
,
(
page
-
1
)
*
10
);
let
count
=
await
monthData
.
findMonthTableListCount
(
selectParam
);
let
operationNameMap
=
findAllFuHuaQiOperationNameMap
();
let
dataList
=
[];
dataBaseList
.
forEach
(
info
=>
{
let
onceInfo
=
{
operationName
:
operationNameMap
[
info
.
fuHuaQiUscc
],
state
:
'已填报'
,
time
:
`
${
info
.
year
}
年
${
info
.
month
}
月`
,
occupancyRate
:
info
.
occupancyRate
};
dataList
.
push
(
onceInfo
);
});
return
{
count
,
dataList
}
}
}
\ No newline at end of file
src/biz/fuHuqQi/task.ts
View file @
f3a3b953
...
@@ -9,7 +9,7 @@ import { TASKTYPEENUM } from "../../config/enum";
...
@@ -9,7 +9,7 @@ import { TASKTYPEENUM } from "../../config/enum";
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
findEnterpriseListByTaskId
,
updateEnterpriseDraftLock
}
from
"../../data/enterprise/enterprise"
;
import
{
findEnterpriseListByTaskId
,
updateEnterpriseDraftLock
}
from
"../../data/enterprise/enterprise"
;
import
{
findFinancingListByTaskId
,
updateFinancingDraftLock
}
from
"../../data/enterprise/financing"
;
import
{
findFinancingListByTaskId
,
updateFinancingDraftLock
}
from
"../../data/enterprise/financing"
;
import
{
findmonthTableListByTaskId
}
from
"../../data/fuHuaQi/monthTable"
;
import
{
findmonthTable
ByTaskId
,
findmonthTable
ListByTaskId
}
from
"../../data/fuHuaQi/monthTable"
;
import
{
createTaskData
,
findFuHuaQiTaskByKeyAndUscc
}
from
"../../data/fuHuaQi/task"
;
import
{
createTaskData
,
findFuHuaQiTaskByKeyAndUscc
}
from
"../../data/fuHuaQi/task"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
getTaskId
,
getTimeKey
}
from
"../../util/tools"
;
import
{
getTaskId
,
getTimeKey
}
from
"../../util/tools"
;
...
@@ -35,7 +35,7 @@ export async function fuHuaQiTaskList(uscc:string) {
...
@@ -35,7 +35,7 @@ export async function fuHuaQiTaskList(uscc:string) {
for
(
let
typeStr
in
taskTypeMapConf
)
{
for
(
let
typeStr
in
taskTypeMapConf
)
{
let
typeKey
=
parseInt
(
typeStr
);
let
typeKey
=
parseInt
(
typeStr
);
let
onceObj
=
{
key
:
type
Str
,
title
:
taskTypeMapConf
[
typeStr
],
enterpriseList
:[]};
let
onceObj
=
{
key
:
type
Key
,
title
:
taskTypeMapConf
[
typeStr
],
enterpriseList
:[]};
if
(
!
taskMap
[
typeStr
])
{
//没有提交任务
if
(
!
taskMap
[
typeStr
])
{
//没有提交任务
let
dataList
=
[];
let
dataList
=
[];
...
@@ -47,10 +47,11 @@ export async function fuHuaQiTaskList(uscc:string) {
...
@@ -47,10 +47,11 @@ export async function fuHuaQiTaskList(uscc:string) {
}
}
dataList
.
forEach
(
info
=>
{
dataList
.
forEach
(
info
=>
{
onceObj
.
enterpriseList
.
push
(
info
.
name
);
onceObj
.
enterpriseList
.
push
(
{
name
:
info
.
name
,
id
:
info
.
uscc
}
);
});
});
result
.
push
(
onceObj
);
}
}
result
.
push
(
onceObj
);
}
}
return
{
taskList
:
result
};
return
{
taskList
:
result
};
...
@@ -72,7 +73,7 @@ export async function checkTask(uscc:string, taskType:number) {
...
@@ -72,7 +73,7 @@ export async function checkTask(uscc:string, taskType:number) {
switch
(
taskType
)
{
switch
(
taskType
)
{
case
TASKTYPEENUM
.
孵化器月度填报
:
case
TASKTYPEENUM
.
孵化器月度填报
:
let
tableInfo
=
await
findmonthTable
List
ByTaskId
(
TaskId
);
let
tableInfo
=
await
findmonthTableByTaskId
(
TaskId
);
if
(
!
tableInfo
)
throw
new
BizError
(
ERRORENUM
.
该报表需要填写本月内容后提交
,
uscc
,
taskType
);
if
(
!
tableInfo
)
throw
new
BizError
(
ERRORENUM
.
该报表需要填写本月内容后提交
,
uscc
,
taskType
);
if
(
tableInfo
.
draftLock
)
throw
new
BizError
(
ERRORENUM
.
不能重复提交任务
,
uscc
,
taskType
,
'lock = true'
);
if
(
tableInfo
.
draftLock
)
throw
new
BizError
(
ERRORENUM
.
不能重复提交任务
,
uscc
,
taskType
,
'lock = true'
);
tableInfo
.
draftLock
=
true
;
tableInfo
.
draftLock
=
true
;
...
...
src/config/checkParamConfig.ts
View file @
f3a3b953
...
@@ -75,5 +75,4 @@ export const FinancingParamConfig = {
...
@@ -75,5 +75,4 @@ export const FinancingParamConfig = {
fuHuaQiInvestment
:
"Boolean"
,
//孵化器是否投资
fuHuaQiInvestment
:
"Boolean"
,
//孵化器是否投资
fuHuaQiInvestmentAmount
:
"Number"
,
//孵化器投资金额(万元)
fuHuaQiInvestmentAmount
:
"Number"
,
//孵化器投资金额(万元)
fuHuaQiInvestmentStyle
:
"Number"
,
//孵化器投资方式
fuHuaQiInvestmentStyle
:
"Number"
,
//孵化器投资方式
};
};
src/config/errorEnum.ts
View file @
f3a3b953
...
@@ -16,7 +16,8 @@ export enum ERRORENUM {
...
@@ -16,7 +16,8 @@ export enum ERRORENUM {
非法登录
,
非法登录
,
身份验证过期
,
身份验证过期
,
密码长度不能超过
24
个字符
,
密码长度不能超过
24
个字符
,
账号不存在
账号不存在
,
已入库的企业不能删除
,
}
}
export
enum
ERRORCODEENUM
{
export
enum
ERRORCODEENUM
{
...
...
src/config/ojbectResultKeyConfig.ts
View file @
f3a3b953
...
@@ -22,4 +22,41 @@ export const FuHuaQiBaseListConfig = {
...
@@ -22,4 +22,41 @@ export const FuHuaQiBaseListConfig = {
personInChargeAdd
:{
key
:
"孵化场地地址"
},
personInChargeAdd
:{
key
:
"孵化场地地址"
},
siteAcreage
:{
key
:
"孵化场地面积(㎡)"
},
siteAcreage
:{
key
:
"孵化场地面积(㎡)"
},
leasePrice
:{
key
:
"孵化场地出租单价"
},
leasePrice
:{
key
:
"孵化场地出租单价"
},
};
};
\ No newline at end of file
/**
* 企业信息 参数转换配置
*/
export
const
EnterpriseInfoConfig
=
{
name
:{
key
:
"企业名称"
},
//
uscc
:{
key
:
"统一信用代码"
},
//
industry
:{
key
:
"领域"
},
//
logonTime
:{
key
:
"注册时间"
,
changeDate
:
true
},
//
firstIncubationTime
:{
key
:
"首次入孵时间"
,
changeDate
:
true
},
//
isNaturalPersonHolding
:{
key
:
"是否自然人控股企业"
},
//
logonAdd
:{
key
:
"注册地址"
},
//
operatingAdd
:{
key
:
"经营地址"
},
//
leasedArea
:{
key
:
"租赁面积(平方米)"
},
timeOfImmigration
:{
key
:
"迁入时间"
},
//
oldLogonAdd
:{
key
:
"迁入前注册地址"
},
//
};
/**
* 企业融资信息 参数转换配置
*/
export
const
EnterpriseFinancingInfoConfig
=
{
uscc
:{
key
:
"统一信用代码"
},
//
name
:{
key
:
"企业名称"
},
//
logonAdd
:{
key
:
"注册地址"
},
//
operatingAdd
:{
key
:
"经营地址"
},
//
financingAmount
:{
key
:
"融资金额(万元)"
},
//
investmentInstitutionsName
:{
key
:
"投资机构名称"
},
//
timeToObtainInvestment
:{
key
:
"获得投资时间"
,
changeDate
:
true
},
//
fuHuaQiInvestment
:{
key
:
" //孵化器是否投资"
},
fuHuaQiInvestmentAmount
:{
key
:
"孵化器投资金额(万元)"
},
//
fuHuaQiInvestmentStyle
:{
key
:
"孵化器投资方式"
},
//
};
src/data/enterprise/enterprise.ts
View file @
f3a3b953
...
@@ -52,7 +52,7 @@ export async function save(throwError=false) {
...
@@ -52,7 +52,7 @@ export async function save(throwError=false) {
* @returns [{}]
* @returns [{}]
*/
*/
export
async
function
findEnterpriseListByTaskId
(
taskId
:
string
)
{
export
async
function
findEnterpriseListByTaskId
(
taskId
:
string
)
{
return
await
enterpriseModel
.
find
({
taskId
})
.
exec
()
;
return
await
enterpriseModel
.
find
({
taskId
});
}
}
...
@@ -109,4 +109,13 @@ export async function groupFindEnterprise() {
...
@@ -109,4 +109,13 @@ export async function groupFindEnterprise() {
result
[
_id
]
=
count
;
result
[
_id
]
=
count
;
});
});
return
result
;
return
result
;
}
}
\ No newline at end of file
/**
* 删除创建企业的草稿报表
* @param uscc 企业统一信用代码
*/
export
async
function
deleteEnterprise
(
uscc
:
string
)
{
return
await
enterpriseModel
.
deleteOne
({
uscc
:
uscc
}).
exec
();
}
src/data/enterprise/financing.ts
View file @
f3a3b953
...
@@ -52,7 +52,7 @@ export async function save(throwError=false) {
...
@@ -52,7 +52,7 @@ export async function save(throwError=false) {
* @returns [{}]
* @returns [{}]
*/
*/
export
async
function
findFinancingListByTaskId
(
taskId
:
string
)
{
export
async
function
findFinancingListByTaskId
(
taskId
:
string
)
{
return
await
financingModel
.
find
({
taskId
})
.
exec
()
;
return
await
financingModel
.
find
({
taskId
});
}
}
/**
/**
...
@@ -83,4 +83,26 @@ export async function updateFinancingDraftLock(taskId:string) {
...
@@ -83,4 +83,26 @@ export async function updateFinancingDraftLock(taskId:string) {
export
async
function
createFinancing
(
fuHuaQiUscc
:
string
,
taskId
:
string
,
param
)
{
export
async
function
createFinancing
(
fuHuaQiUscc
:
string
,
taskId
:
string
,
param
)
{
let
addInfo
=
Object
.
assign
({
fuHuaQiUscc
,
taskId
,
createTime
:
new
Date
().
valueOf
()},
param
);
let
addInfo
=
Object
.
assign
({
fuHuaQiUscc
,
taskId
,
createTime
:
new
Date
().
valueOf
()},
param
);
await
financingModel
.
create
(
addInfo
);
await
financingModel
.
create
(
addInfo
);
}
}
\ No newline at end of file
/**
* 删除创建企业的草稿报表
* @param uscc 企业统一信用代码
* @param taskId 任务id
*/
export
async
function
deleteEnterpriseFinancing
(
uscc
:
string
,
taskId
:
string
)
{
return
await
financingModel
.
deleteOne
({
uscc
:
uscc
}).
exec
();
}
/**
* 通过企业统一信用代码获取企业信息
* 支持.save方法保存对象修改
* @param uscc 企业统一信用代码
* @param taskId 任务id
* @returns {}
*/
export
async
function
findEnterpriseFinancingByUscc
(
uscc
:
string
,
taskId
:
string
)
{
return
await
financingModel
.
selectOnceData
({
uscc
});
}
src/data/fuHuaQi/fuhuaqi.ts
View file @
f3a3b953
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
* uscc不可修改 2023-02-06 确定此需求
* uscc不可修改 2023-02-06 确定此需求
* 首次登录要求改密码 不改密码不能继续操作 2023-02-07 确定此需求
* 首次登录要求改密码 不改密码不能继续操作 2023-02-07 确定此需求
* 管理后台列表页面一页展示10条 2023-02-08 确定此需求
* 管理后台列表页面一页展示10条 2023-02-08 确定此需求
* 孵化器账号不能被删除 只能被禁用 2023-02-08 确定此需求
*/
*/
import
{
Schema
}
from
'mongoose'
;
import
{
Schema
}
from
'mongoose'
;
...
@@ -34,6 +35,7 @@ const fuHuaQiSchema = new Schema({
...
@@ -34,6 +35,7 @@ const fuHuaQiSchema = new Schema({
token
:{
type
:
String
,
index
:
true
},
token
:{
type
:
String
,
index
:
true
},
tokenMs
:
Number
,
tokenMs
:
Number
,
firstLoginIsChangePwd
:{
type
:
Boolean
,
default
:
false
},
//首次登录是否修改密码
firstLoginIsChangePwd
:{
type
:
Boolean
,
default
:
false
},
//首次登录是否修改密码
createTime
:
Number
});
});
var
fuHuaQiModel
;
var
fuHuaQiModel
;
...
@@ -108,10 +110,38 @@ export async function findFuHuaQiList(selectParam, skipCount) {
...
@@ -108,10 +110,38 @@ export async function findFuHuaQiList(selectParam, skipCount) {
}
}
/**
/**
* 获取所有孵化器
* 获取所有孵化器
数量
* @param selectParam 查询参数
* @param selectParam 查询参数
* @returns number 数据数量
* @returns number 数据数量
*/
*/
export
async
function
findFuHuaQiCount
(
selectParam
)
{
export
async
function
findFuHuaQiCount
(
selectParam
)
{
return
await
fuHuaQiModel
.
find
(
selectParam
).
count
();
return
await
fuHuaQiModel
.
find
(
selectParam
).
count
();
}
/**
* 获取所有运营机构名称的map
* @returns map key:统一信用代码 value:运营机构名称
*/
export
async
function
findAllFuHuaQiOperationNameMap
()
{
let
dataList
=
await
fuHuaQiModel
.
find
({});
let
map
=
{};
dataList
.
forEach
(
info
=>
{
map
[
info
.
uscc
]
=
info
.
operationName
;
});
return
map
;
}
/**
* 获取所有企业创建时间
* @returns {} key:企业统一信用代码
*/
export
async
function
getFuHuaQiCreateDataTimeMap
()
{
let
list
=
await
fuHuaQiModel
.
find
({});
let
result
=
{};
list
.
forEach
(
info
=>
{
result
[
info
.
uscc
]
=
info
.
createTime
;
});
return
result
;
}
}
\ No newline at end of file
src/data/fuHuaQi/monthTable.ts
View file @
f3a3b953
...
@@ -10,12 +10,15 @@ import {Schema} from 'mongoose';
...
@@ -10,12 +10,15 @@ import {Schema} from 'mongoose';
import
{
baseDB
}
from
'../../db/dbInit'
;
import
{
baseDB
}
from
'../../db/dbInit'
;
const
monthTableSchema
=
new
Schema
({
const
monthTableSchema
=
new
Schema
({
taskId
:
String
,
//任务id
taskId
:
{
type
:
String
,
index
:
true
}
,
//任务id
name
:
String
,
//任务名称
name
:
String
,
//任务名称
fuHuaQiUscc
:
String
,
//任务所属孵化器id
fuHuaQiUscc
:
String
,
//任务所属孵化器id
occupancyRate
:
Number
,
//出租率 单位为%
occupancyRate
:
Number
,
//出租率 单位为%
createTime
:
Number
,
//创建时间
createTime
:
Number
,
//创建时间
/**不下发字段 */
draftLock
:{
type
:
Boolean
,
default
:
false
},
//草稿锁,true为提交之后,false为草稿
draftLock
:{
type
:
Boolean
,
default
:
false
},
//草稿锁,true为提交之后,false为草稿
year
:{
type
:
Number
,
index
:
true
},
month
:{
type
:
Number
,
index
:
true
},
});
});
var
monthTableModel
;
var
monthTableModel
;
...
@@ -45,7 +48,7 @@ export async function save(throwError=false) {
...
@@ -45,7 +48,7 @@ export async function save(throwError=false) {
* @returns {}
* @returns {}
*/
*/
export
async
function
findmonthTableListByTaskId
(
taskId
:
string
)
{
export
async
function
findmonthTableListByTaskId
(
taskId
:
string
)
{
return
await
monthTableModel
.
find
({
taskId
})
.
exec
()
;
return
await
monthTableModel
.
find
({
taskId
});
}
}
/**
/**
...
@@ -80,4 +83,25 @@ export async function addOnceReport(taskId:string, name:string, uscc:string, occ
...
@@ -80,4 +83,25 @@ export async function addOnceReport(taskId:string, name:string, uscc:string, occ
*/
*/
export
async
function
deleteReport
(
uscc
:
string
,
name
:
string
)
{
export
async
function
deleteReport
(
uscc
:
string
,
name
:
string
)
{
return
await
monthTableModel
.
deleteOne
({
fuHuaQiUscc
:
uscc
,
name
}).
exec
();
return
await
monthTableModel
.
deleteOne
({
fuHuaQiUscc
:
uscc
,
name
}).
exec
();
}
/**
* 查询符合条件的月度任务列表
* @param selectParam 查询参数
* @param skipNum 跳过数量
* @returns []符合条件的月度列表
*/
export
async
function
findMonthTableList
(
selectParam
:
object
,
skipNum
:
number
)
{
return
await
monthTableModel
.
find
(
selectParam
).
skip
(
skipNum
).
limit
(
10
);
}
/**
* 获取符合条件的月度任务列表数据量
* @param selectParam 查询参数
* @returns count 数据量
*/
export
async
function
findMonthTableListCount
(
selectParam
:
object
)
{
return
await
monthTableModel
.
find
(
selectParam
).
count
();
}
}
\ No newline at end of file
src/data/fuHuaQi/task.ts
View file @
f3a3b953
...
@@ -11,7 +11,7 @@ import {Schema} from 'mongoose';
...
@@ -11,7 +11,7 @@ import {Schema} from 'mongoose';
import
{
baseDB
}
from
'../../db/dbInit'
;
import
{
baseDB
}
from
'../../db/dbInit'
;
const
fuHuaQiTaskSchema
=
new
Schema
({
const
fuHuaQiTaskSchema
=
new
Schema
({
key
:{
type
:
String
,
index
:
true
},
//任务标识 格式为:YYYYM
M
key
:{
type
:
String
,
index
:
true
},
//任务标识 格式为:YYYYM
type
:
{
type
:
Number
,
index
:
true
},
//任务类型
type
:
{
type
:
Number
,
index
:
true
},
//任务类型
taskId
:
String
,
//任务id
taskId
:
String
,
//任务id
fuHuaQiUscc
:
String
,
//任务所属孵化器id
fuHuaQiUscc
:
String
,
//任务所属孵化器id
...
@@ -31,10 +31,10 @@ export function initModel(){
...
@@ -31,10 +31,10 @@ export function initModel(){
* @returns {YYYYMM:{}, YYYYMM:{}}
* @returns {YYYYMM:{}, YYYYMM:{}}
*/
*/
export
async
function
findFuHuaQiTaskByKeyAndUscc
(
uscc
:
string
,
key
:
string
)
{
export
async
function
findFuHuaQiTaskByKeyAndUscc
(
uscc
:
string
,
key
:
string
)
{
let
findList
=
await
fuHuaQiTaskModel
.
find
({
uscc
,
key
}).
exec
()
||
[];
let
findList
=
await
fuHuaQiTaskModel
.
find
({
fuHuaQiUscc
:
uscc
,
key
}).
exec
()
||
[];
let
taskMap
=
{};
let
taskMap
=
{};
findList
.
forEach
(
item
=>
{
findList
.
forEach
(
item
=>
{
taskMap
[
item
.
key
]
=
item
;
taskMap
[
item
.
type
]
=
1
;
});
});
return
taskMap
;
return
taskMap
;
}
}
...
...
src/middleware/user.ts
View file @
f3a3b953
import
{
ERRORENUM
}
from
"../config/errorEnum"
;
import
{
ERRORENUM
}
from
"../config/errorEnum"
;
import
{
findFuHuaQiByUSCC
}
from
"../data/fuHuaQi/fuhuaqi"
;
import
{
findFuHuaQiByUSCC
}
from
"../data/fuHuaQi/fuhuaqi"
;
import
{
findGuanWeiHuiUserInfoByLoginId
}
from
"../data/guanWeiHui/guanweihui"
;
import
{
BizError
}
from
"../util/bizError"
;
import
{
BizError
}
from
"../util/bizError"
;
/**
/**
...
@@ -24,8 +25,36 @@ export async function checkFuHuaQiToken(req, res, next) {
...
@@ -24,8 +25,36 @@ export async function checkFuHuaQiToken(req, res, next) {
// if (userInfo.token != reqToken || (new Date().valueOf() - userInfo.tokenMs) > (3600*100*24*7) ) return next(new BizError(ERRORENUM.身份验证过期, `userId:${userId} token:${reqToken}`));
// if (userInfo.token != reqToken || (new Date().valueOf() - userInfo.tokenMs) > (3600*100*24*7) ) return next(new BizError(ERRORENUM.身份验证过期, `userId:${userId} token:${reqToken}`));
if
(
userInfo
.
token
!=
reqToken
)
return
next
(
new
BizError
(
ERRORENUM
.
身份验证过期
,
`userId:
${
userId
}
token:
${
reqToken
}
`
));
if
(
userInfo
.
token
!=
reqToken
)
return
next
(
new
BizError
(
ERRORENUM
.
身份验证过期
,
`userId:
${
userId
}
token:
${
reqToken
}
`
));
//todo
req
.
headers
.
uscc
=
userInfo
.
uscc
;
req
.
headers
.
uscc
=
userInfo
.
uscc
;
next
();
next
();
}
/**
* 中间件 校验管委会token
* @param req
* @param res
* @param next
* @returns
*/
export
async
function
checkGuanWeiHuiToken
(
req
,
res
,
next
)
{
if
(
!
req
.
headers
)
req
.
headers
=
{};
const
reqToken
=
req
.
headers
.
token
;
const
userId
=
req
.
headers
.
userid
||
""
;
if
(
!
userId
)
return
next
(
new
BizError
(
ERRORENUM
.
身份验证失败
,
`userId:
${
userId
}
token:
${
reqToken
}
`
));
let
userInfo
=
await
findGuanWeiHuiUserInfoByLoginId
(
userId
);
if
(
!
userInfo
)
return
next
(
new
BizError
(
ERRORENUM
.
非法登录
,
`userId:
${
userId
}
token:
${
reqToken
}
`
));
/**2023-2-8日需求 登录一次一直有效 */
// if (userInfo.token != reqToken || (new Date().valueOf() - userInfo.tokenMs) > (3600*100*24*7) ) return next(new BizError(ERRORENUM.身份验证过期, `userId:${userId} token:${reqToken}`));
if
(
userInfo
.
token
!=
reqToken
)
return
next
(
new
BizError
(
ERRORENUM
.
身份验证过期
,
`userId:
${
userId
}
token:
${
reqToken
}
`
));
req
.
headers
.
userid
=
userInfo
.
userid
;
next
();
}
}
\ No newline at end of file
src/routers/admin.ts
View file @
f3a3b953
...
@@ -10,7 +10,7 @@ export function setRouter(httpServer) {
...
@@ -10,7 +10,7 @@ export function setRouter(httpServer) {
// /**登录 */
// /**登录 */
// httpServer.post('/admin/login', asyncHandler(login));
// httpServer.post('/admin/login', asyncHandler(login));
// /** 孵化器*/
// /** 孵化器*/
// httpServer.post('/admin/fuhuaqi/baselist', asyncHandler(
));
httpServer
.
post
(
'/admin/fuhuaqi/baselist'
,
asyncHandler
(
fuHuaQiBaseList
));
// httpServer.post('/admin/fuhuaqi/monthoccupancyrate', asyncHandler());
// httpServer.post('/admin/fuhuaqi/monthoccupancyrate', asyncHandler());
// httpServer.post('/admin/fuhuaqi/userlist', asyncHandler());
// httpServer.post('/admin/fuhuaqi/userlist', asyncHandler());
// httpServer.post('/admin/fuhuaqi/updatestate', asyncHandler());
// httpServer.post('/admin/fuhuaqi/updatestate', asyncHandler());
...
...
src/routers/fuhuaqi.ts
View file @
f3a3b953
...
@@ -29,12 +29,16 @@ export function setRouter(httpServer) {
...
@@ -29,12 +29,16 @@ export function setRouter(httpServer) {
/**融资企业填报 */
/**融资企业填报 */
httpServer
.
post
(
'/fuhuaqi/financing/create'
,
checkFuHuaQiToken
,
asyncHandler
(
createFinancingInfo
));
httpServer
.
post
(
'/fuhuaqi/financing/create'
,
checkFuHuaQiToken
,
asyncHandler
(
createFinancingInfo
));
httpServer
.
post
(
'/fuhuaqi/financing/update'
,
checkFuHuaQiToken
,
asyncHandler
(
updateFinancingInfo
));
httpServer
.
post
(
'/fuhuaqi/financing/update'
,
checkFuHuaQiToken
,
asyncHandler
(
updateFinancingInfo
));
httpServer
.
post
(
'/fuhuaqi/financing/select'
,
checkFuHuaQiToken
,
asyncHandler
(
selectFinancingInfo
));
httpServer
.
post
(
'/fuhuaqi/financing/delete'
,
checkFuHuaQiToken
,
asyncHandler
(
delFinancingInfo
));
/**新注册或迁入企业 */
/**新注册或迁入企业 */
httpServer
.
post
(
'/fuhuaqi/enterprise/register'
,
checkFuHuaQiToken
,
asyncHandler
(
registerEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/register'
,
checkFuHuaQiToken
,
asyncHandler
(
registerEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/updateregister'
,
checkFuHuaQiToken
,
asyncHandler
(
updateRegisterEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/updateregister'
,
checkFuHuaQiToken
,
asyncHandler
(
updateRegisterEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/move'
,
checkFuHuaQiToken
,
asyncHandler
(
moveInEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/move'
,
checkFuHuaQiToken
,
asyncHandler
(
moveInEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/updatemove'
,
checkFuHuaQiToken
,
asyncHandler
(
updateMoveInEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/updatemove'
,
checkFuHuaQiToken
,
asyncHandler
(
updateMoveInEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/select'
,
checkFuHuaQiToken
,
asyncHandler
(
selectEnterpriseFinancingInfo
));
httpServer
.
post
(
'/fuhuaqi/enterprise/delete'
,
checkFuHuaQiToken
,
asyncHandler
(
delEnterpriseFinancingInfo
));
}
}
/**
/**
...
@@ -108,11 +112,68 @@ async function updateRegisterEnterprise(req, res) {
...
@@ -108,11 +112,68 @@ async function updateRegisterEnterprise(req, res) {
}
}
/**
/**
* 查询迁入企业登记信息或新建企业登录信息
* @param req
* @param res
*/
async
function
selectFinancingInfo
(
req
,
res
)
{
let
reqConf
=
{
uscc
:
'String'
};
let
{
uscc
}
=
checkReqParam
(
reqConf
,
req
.
body
);
let
result
=
await
enterpriseBiz
.
getEnterpriseByUscc
(
uscc
);
res
.
success
(
result
);
}
/**
* 查询企业融资信息
* @param req
* @param res
*/
async
function
selectEnterpriseFinancingInfo
(
req
,
res
)
{
let
reqConf
=
{
uscc
:
'String'
};
let
{
uscc
}
=
checkReqParam
(
reqConf
,
req
.
body
);
const
FHQUscc
=
req
.
headers
.
uscc
;
let
result
=
await
financingBiz
.
getEnterpriseFinancingByUscc
(
FHQUscc
,
uscc
);
res
.
success
(
result
);
}
/**
* 删除迁入企业登记信息或新建企业登录信息
* @param req
* @param res
*/
async
function
delFinancingInfo
(
req
,
res
)
{
let
reqConf
=
{
uscc
:
'String'
};
let
{
uscc
}
=
checkReqParam
(
reqConf
,
req
.
body
);
let
result
=
await
enterpriseBiz
.
deleteEnterpriseByUscc
(
uscc
);
res
.
success
(
result
);
}
/**
* 查询企业融资信息
* @param req
* @param res
*/
async
function
delEnterpriseFinancingInfo
(
req
,
res
)
{
let
reqConf
=
{
uscc
:
'String'
};
let
{
uscc
}
=
checkReqParam
(
reqConf
,
req
.
body
);
const
FHQUscc
=
req
.
headers
.
uscc
;
let
result
=
await
financingBiz
.
deleteEnterpriseFinancingByUscc
(
FHQUscc
,
uscc
);
res
.
success
(
result
);
}
//=======================
/**
* 修改迁入企业登记信息
* 修改迁入企业登记信息
* @param req
* @param req
* @param res
* @param res
*/
*/
async
function
updateMoveInEnterprise
(
req
,
res
)
{
async
function
updateMoveInEnterprise
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
checkReqParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
checkReqParam
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
const
Uscc
=
req
.
headers
.
uscc
;
...
@@ -121,7 +182,8 @@ async function updateRegisterEnterprise(req, res) {
...
@@ -121,7 +182,8 @@ async function updateRegisterEnterprise(req, res) {
res
.
success
(
result
);
res
.
success
(
result
);
}
}
//=======================
//==============
/**
/**
* 孵化器登录
* 孵化器登录
...
...
src/util/tools.ts
View file @
f3a3b953
...
@@ -159,4 +159,42 @@ export function extractData(conf, data) {
...
@@ -159,4 +159,42 @@ export function extractData(conf, data) {
}
}
}
}
return
result
;
return
result
;
}
}
\ No newline at end of file
/**
* 校验value是否符合传入的枚举
* @param enumConf 目标枚举
* @param value 目标值
* @returns true/false 是否通过校验
*/
export
function
checkEnumValue
(
enumConf
,
value
:
any
)
{
if
(
typeof
value
==
'number'
)
{
return
enumConf
[
value
]
?
true
:
false
;
}
let
checkSuccess
=
true
;
value
.
forEach
(
item
=>
{
if
(
!
enumConf
[
item
]
)
checkSuccess
=
false
;
});
return
checkSuccess
;
}
/**
* 将枚举值转换成对应的枚举名(key)
* @param enumConf 目标枚举
* @param value 目标值
* @returns string 返回字符串 如果传入多个枚举值,就拼接字符串
*/
export
function
changeEnumValue
(
enumConf
,
value
:
any
)
{
if
(
typeof
value
==
'number'
)
{
return
enumConf
[
value
];
}
let
str
=
""
;
value
.
forEach
(
item
=>
{
str
+=
enumConf
[
item
];
});
return
str
;
}
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