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
466c0b6e
Commit
466c0b6e
authored
Feb 10, 2023
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
32409487
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
254 additions
and
196 deletions
+254
-196
enterprise.ts
src/biz/enterprise/enterprise.ts
+25
-17
financing.ts
src/biz/enterprise/financing.ts
+42
-26
base.ts
src/biz/fuHuqQi/base.ts
+42
-44
month.ts
src/biz/fuHuqQi/month.ts
+39
-32
task.ts
src/biz/fuHuqQi/task.ts
+26
-26
user.ts
src/biz/fuHuqQi/user.ts
+18
-3
enum.ts
src/config/enum.ts
+8
-0
errorEnum.ts
src/config/errorEnum.ts
+1
-1
ojbectResultKeyConfig.ts
src/config/ojbectResultKeyConfig.ts
+39
-3
enterprise.ts
src/data/enterprise/enterprise.ts
+2
-2
financing.ts
src/data/enterprise/financing.ts
+6
-24
monthTable.ts
src/data/fuHuaQi/monthTable.ts
+5
-17
fuhuaqi.ts
src/routers/fuhuaqi.ts
+1
-1
No files found.
src/biz/enterprise/enterprise.ts
View file @
466c0b6e
...
...
@@ -4,7 +4,6 @@
* 包括新注册企业,迁入企业
*
*/
import
{
MoveInEnterpriseParamConfig
,
RegisterEnterpriseParamConfig
}
from
"../../config/checkParamConfig"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
EnterpriseInfoConfig
}
from
"../../config/ojbectResultKeyConfig"
;
...
...
@@ -17,18 +16,20 @@ import { FUHUAQILV } from "../../config/enum";
/**
* 新注册企业
* 小程序端
* @param uscc 孵化器统一信用代码
* @param param 表单参数
* @returns {isSuccess:true/false}
*/
export
async
function
registerEnterprise
(
uscc
:
string
,
param
)
{
const
TaskId
=
getTaskId
(
uscc
);
checkParamater
(
"新注册企业"
,
RegisterEnterpriseParamConfig
,
param
);
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
param
.
uscc
);
checkParamater
(
"新注册企业"
,
RegisterEnterpriseParamConfig
,
param
);
//校验表单参数
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
param
.
uscc
);
if
(
dataBaseInfo
&&
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
该企业已存在
,
`
${
param
.
uscc
}
已经在库中存在`
);
param
.
isCreate
=
true
;
param
.
isCreate
=
true
;
//标识此次操作是否是新注册企业并不是迁入企业
await
createEnterprise
(
uscc
,
TaskId
,
param
);
return
{
isSuccess
:
true
};
...
...
@@ -36,18 +37,20 @@ export async function registerEnterprise(uscc:string, param) {
/**
* 新注册企业表单修改
* 修改新注册企业的表单
* 小程序端
* @param uscc 孵化器统一信用代码
* @param param 表单参数
* @returns {isSuccess:true/false}
*/
export
async
function
updateRegisterEnterprise
(
uscc
:
string
,
param
)
{
checkParamater
(
"新注册企业表单修改"
,
RegisterEnterpriseParamConfig
,
param
);
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
param
.
uscc
);
checkParamater
(
"新注册企业表单修改"
,
RegisterEnterpriseParamConfig
,
param
);
//校验表单参数
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
param
.
uscc
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
param
.
uscc
}
这个企业`
);
let
changeList
=
checkChange
(
param
,
dataBaseInfo
);
let
changeList
=
checkChange
(
param
,
dataBaseInfo
);
//比对修改字段
if
(
!
changeList
.
length
)
throw
new
BizError
(
ERRORENUM
.
数据无更新
,
`
${
param
.
uscc
}
数据无更新`
);
changeList
.
forEach
(
key
=>
{
...
...
@@ -62,15 +65,17 @@ export async function updateRegisterEnterprise(uscc:string, param) {
/**
* 迁入企业登记
* 小程序端
* @param uscc 孵化器统一信用代码
* @param param 表单参数
* @returns {isSuccess:true/false}
*/
export
async
function
moveInEnterprise
(
uscc
:
string
,
param
)
{
const
TaskId
=
getTaskId
(
uscc
);
checkParamater
(
"迁入企业登记"
,
MoveInEnterpriseParamConfig
,
param
);
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
param
.
uscc
);
checkParamater
(
"迁入企业登记"
,
MoveInEnterpriseParamConfig
,
param
);
//校验表单参数
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
param
.
uscc
);
if
(
dataBaseInfo
&&
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
该企业已存在
,
`
${
param
.
uscc
}
已经在库中存在`
);
await
createEnterprise
(
uscc
,
TaskId
,
param
);
...
...
@@ -81,16 +86,17 @@ export async function moveInEnterprise(uscc:string, param) {
/**
* 修改迁入企业登记信息
* 小程序端
* @param uscc 孵化器统一信用代码
* @param param 表单参数
* @returns {isSuccess:true/false}
*/
export
async
function
updateMoveInEnterprise
(
uscc
:
string
,
param
)
{
checkParamater
(
"修改迁入企业登记信息"
,
MoveInEnterpriseParamConfig
,
param
);
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
param
.
uscc
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
param
.
uscc
}
这个企业`
);
checkParamater
(
"修改迁入企业登记信息"
,
MoveInEnterpriseParamConfig
,
param
);
//校验表单参数
let
dataBaseInfo
=
await
findEnterpriseByUscc
(
param
.
uscc
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
param
.
uscc
}
这个企业`
);
let
changeList
=
checkChange
(
param
,
dataBaseInfo
);
if
(
!
changeList
.
length
)
throw
new
BizError
(
ERRORENUM
.
数据无更新
,
`
${
param
.
uscc
}
数据无更新`
);
...
...
@@ -102,12 +108,12 @@ export async function updateMoveInEnterprise(uscc:string, param) {
await
dataBaseInfo
.
save
();
return
{
isSuccess
:
true
};
}
/**
* 根据企业id查询企业
* 根据企业id查询企业信息
* 小程序端 回显
* @param uscc 企业统一信用代码
*/
export
async
function
getEnterpriseByUscc
(
uscc
:
string
)
{
...
...
@@ -122,13 +128,14 @@ export async function getEnterpriseByUscc(uscc:string) {
/**
* 根据企业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
);
if
(
dataBaseInfo
.
draftLock
)
throw
new
BizError
(
ERRORENUM
.
已入库的
数据
不能删除
,
uscc
);
await
deleteEnterprise
(
uscc
);
...
...
@@ -138,12 +145,13 @@ export async function deleteEnterpriseByUscc(uscc:string) {
/**
* 获取在孵企业信息列表
* 管理后台端
* @param time 新注册时间/迁入时间
* @param fuHuaQiUscc 所属孵化器
* @param industry 行业领域
* @param isNaturalPersonHolding 自然人控股
* @param page 页数
* @returns
* @returns
{dataList:[], count:0} dataList=数据列表 count:条件筛选下的数据总数
*/
export
async
function
enterpriseList
(
time
:
number
,
fuHuaQiUscc
:
string
,
industry
:
number
,
isNaturalPersonHolding
:
boolean
,
page
:
number
)
{
let
selectParam
:
any
=
{};
...
...
src/biz/enterprise/financing.ts
View file @
466c0b6e
...
...
@@ -4,11 +4,10 @@
* 包括新融资信息的增删改查
*
*/
import
{
FinancingParamConfig
}
from
"../../config/checkParamConfig"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
EnterpriseFinancingInfoConfig
}
from
"../../config/ojbectResultKeyConfig"
;
import
{
createFinancing
,
deleteEnterpriseFinancing
,
find
AddByName
,
findEnterpriseFinancingByUscc
,
find
FinancingCount
,
findFinancingInfoByTaskIdAndSucc
,
findFinancingList
,
groupFindFinancing
}
from
"../../data/enterprise/financing"
;
import
{
createFinancing
,
deleteEnterpriseFinancing
,
findFinancingCount
,
findFinancingInfoByTaskIdAndSucc
,
findFinancingList
,
groupFindFinancing
}
from
"../../data/enterprise/financing"
;
import
{
FinancingListConfig
}
from
"../../config/ojbectResultKeyConfig"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
checkChange
,
checkParamater
,
extractData
,
getTaskId
}
from
"../../util/tools"
;
...
...
@@ -17,23 +16,25 @@ import { findFuHuaQiByName } from "../../data/fuHuaQi/fuhuaqi";
/**
* 创建企业融资信息
* 添加企业融资信息
* 小程序端
* @param uscc 孵化器统一信用代码
* @param param 表单配置
* @returns {isSuccess:true/false}
*/
export
async
function
createFinancingInfo
(
uscc
,
param
)
{
const
TaskId
=
getTaskId
(
uscc
);
export
async
function
createFinancingInfo
(
uscc
:
string
,
param
)
{
checkParamater
(
"录入企业融资信息"
,
FinancingParamConfig
,
param
);
/**校验企业是否存在 */
let
enterpriseInfo
=
await
findEnterpriseInfoByName
(
param
.
name
);
if
(
!
enterpriseInfo
)
throw
new
BizError
(
ERRORENUM
.
该企业不存在
,
uscc
,
param
.
name
);
param
.
uscc
=
enterpriseInfo
.
uscc
;
let
dataBaseInfo
=
await
findFinancingInfoByTaskIdAndSucc
(
TaskId
,
param
.
uscc
);
param
.
uscc
=
enterpriseInfo
.
uscc
;
//前端无需传入企业的uscc 库中需要企业的uscc
const
TaskId
=
getTaskId
(
uscc
);
/**一个企业一个月只能填报一次融资信息 */
let
dataBaseInfo
=
await
findFinancingInfoByTaskIdAndSucc
(
TaskId
,
param
.
uscc
);
if
(
dataBaseInfo
&&
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
该企业当月数据已存在
,
`
${
param
.
uscc
}
的融资信息已经存在`
);
await
createFinancing
(
uscc
,
TaskId
,
param
);
...
...
@@ -41,22 +42,24 @@ export async function createFinancingInfo(uscc, param) {
return
{
isSuccess
:
true
};
}
/**
* 更新融资企业信息
* 更新企业融资信息
* 小程序端
* 只能更新本月未提交的并且已经创建的企业融资信息
* @param uscc 孵化器统一信用代码
* @param param 表单配置
* @returns {isSuccess:true/false}
*/
export
async
function
updateFinancingInfo
(
uscc
,
param
)
{
const
TaskId
=
getTaskId
(
uscc
);
export
async
function
updateFinancingInfo
(
uscc
:
string
,
param
)
{
checkParamater
(
"更新融资企业信息"
,
FinancingParamConfig
,
param
);
let
dataBaseInfo
=
await
findFinancingInfoByTaskIdAndSucc
(
TaskId
,
param
.
uscc
);
let
changeList
=
checkChange
(
param
,
dataBaseInfo
);
const
TaskId
=
getTaskId
(
uscc
);
let
dataBaseInfo
=
await
findFinancingInfoByTaskIdAndSucc
(
TaskId
,
param
.
uscc
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
TaskId
}
的任务`
);
if
(
!
changeList
.
length
)
throw
new
BizError
(
ERRORENUM
.
数据无更新
,
`
${
param
.
uscc
}
数据无更新`
);
let
changeList
=
checkChange
(
param
,
dataBaseInfo
);
if
(
!
changeList
.
length
)
throw
new
BizError
(
ERRORENUM
.
数据无更新
,
`
${
param
.
uscc
}
数据无更新`
);
changeList
.
forEach
(
key
=>
{
dataBaseInfo
[
key
]
=
param
[
key
];
});
...
...
@@ -68,13 +71,17 @@ export async function updateFinancingInfo(uscc, param) {
/**
* 根据企业id查询企业
* 查询本月提交的企业融资信息
* 小程序端
* @param fuHuaQiUscc 孵化器统一信用代码
* @param uscc 企业统一信用代码
* @returns {data:{}} 表单
*/
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
dataBaseInfo
=
await
findFinancingInfoByTaskIdAndSucc
(
TaskId
,
uscc
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
uscc
}
这个企业的本次融资数据`
);
let
data
=
extractData
(
EnterpriseFinancingInfoConfig
,
dataBaseInfo
);
...
...
@@ -84,14 +91,18 @@ export async function getEnterpriseFinancingByUscc(fuHuaQiUscc:string, uscc:stri
/**
* 根据企业id删除草稿企业
* 小程序端
* @param fuHuaQiUscc 孵化器统一信用代码
* @param uscc 企业统一信用代码
* @returns {isSuccess:true/false}
*/
export
async
function
deleteEnterpriseFinancingByUscc
(
fuHuaQiUscc
:
string
,
uscc
:
string
)
{
const
TaskId
=
getTaskId
(
fuHuaQiUscc
);
let
dataBaseInfo
=
await
findEnterpriseFinancingByUscc
(
uscc
,
TaskId
);
let
dataBaseInfo
=
await
findFinancingInfoByTaskIdAndSucc
(
TaskId
,
uscc
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`库中不存在
${
uscc
}
这个企业`
);
if
(
dataBaseInfo
.
draftLock
)
throw
new
BizError
(
ERRORENUM
.
已入库的
企业
不能删除
,
uscc
);
if
(
dataBaseInfo
.
draftLock
)
throw
new
BizError
(
ERRORENUM
.
已入库的
数据
不能删除
,
uscc
);
await
deleteEnterpriseFinancing
(
uscc
,
TaskId
);
...
...
@@ -100,25 +111,30 @@ export async function deleteEnterpriseFinancingByUscc(fuHuaQiUscc:string, uscc:s
/**
* 融资企业名称模糊查询
*
* 获取本孵化器下的所有企业信息
* 小程序端 用于下拉框使用
* @param uscc 孵化器统一信用代码
* @returns [] name:企业名称, logonAdd:注册地址, operatingAdd:经营地址
*/
export
async
function
getFinancingByName
(
uscc
:
string
)
{
let
financingInfo
=
await
findEnterpriseListByFuHuaQiUsccName
(
uscc
);
export
async
function
getFuHuaQiEnterpriseForSelect
(
uscc
:
string
)
{
let
enterpriseList
=
await
findEnterpriseListByFuHuaQiUsccName
(
uscc
);
let
dataList
=
[];
financingInfo
.
forEach
(
info
=>
{
enterpriseList
.
forEach
(
info
=>
{
dataList
.
push
({
name
:
info
.
name
,
logonAdd
:
info
.
logonAdd
,
operatingAdd
:
info
.
operatingAdd
});
});
return
dataList
;
}
/**
* 融资企业信息列表
* 管理后台端
* @param monthData 数据月份 目前数据库没有该字段
* @param fuHuaQiName 所属孵化器
* @param industry 行业领域
...
...
src/biz/fuHuqQi/base.ts
View file @
466c0b6e
...
...
@@ -4,85 +4,83 @@
* 孵化器相关逻辑 包括孵化器的增删改查
*
*/
import
moment
=
require
(
"moment"
);
import
{
BaseParamUpdateConfig
}
from
"../../config/checkParamConfig"
;
import
{
findEnterpriseCount
,
findEnterpriseCountByFuHuaQiUscc
,
groupFindEnterprise
}
from
"../../data/enterprise/enterprise"
;
import
{
findFuHuaQiByUSCC
,
findFuHuaQiCount
,
findFuHuaQiList
,
groupFindFuHuaQi
}
from
"../../data/fuHuaQi/fuhuaqi"
;
import
{
findFuHuaQiByUSCC
,
findFuHuaQiCount
,
findFuHuaQiList
}
from
"../../data/fuHuaQi/fuhuaqi"
;
import
*
as
tools
from
"../../util/tools"
;
import
{
FuHuaQiBaseListConfig
}
from
"../../config/ojbectResultKeyConfig"
;
import
{
FUHUAQILV
}
from
"../../config/enum"
;
import
{
FuHuaQiHomeDataConfig
,
FuHuaQiBaseListConfig
,
FuHuaQiBaseDataConfig
}
from
"../../config/ojbectResultKeyConfig"
;
import
{
FUHUAQILV
,
INSTITUTIONALNATURE
}
from
"../../config/enum"
;
import
{
extractData
}
from
"../../util/tools"
;
/**
* 更新孵化器基础数据
* 主界面基础数据
* 小程序端 首页的基础数据
* 评分数据还没有
* @param uscc 孵化器统一信用代码
* @param param 表单内容
* @returns {isSuccess:true/false};
* @returns {} "incubatedAcreage", "acreageTotal", "acreagePersonalUse", "name", "lv", "institutionalNature"
*/
export
async
function
updateFuHuaQiBaseData
(
uscc
:
string
,
param
)
{
let
baseData
Info
=
await
findFuHuaQiByUSCC
(
uscc
);
export
async
function
homeData
(
uscc
:
string
)
{
let
dataBase
Info
=
await
findFuHuaQiByUSCC
(
uscc
);
tools
.
checkParamater
(
"更新孵化器基础数据"
,
BaseParamUpdateConfig
,
param
);
let
data
:
any
=
extractData
(
FuHuaQiHomeDataConfig
,
dataBaseInfo
);
let
changeList
=
tools
.
checkChange
(
param
,
baseDataInfo
);
for
(
let
i
=
0
;
i
<
changeList
.
length
;
i
++
)
{
let
key
=
changeList
[
i
];
baseDataInfo
[
key
]
=
param
[
key
];
}
await
baseDataInfo
.
save
();
data
.
enterpriseCount
=
await
findEnterpriseCountByFuHuaQiUscc
(
uscc
);
data
.
lv
=
tools
.
changeEnumValue
(
FUHUAQILV
,
dataBaseInfo
.
lv
);
data
.
institutionalNature
=
tools
.
changeEnumValue
(
INSTITUTIONALNATURE
,
dataBaseInfo
.
institutionalNature
);
return
{
isSuccess
:
true
}
;
return
data
;
}
/**
* 查询孵化器基础数据
* 孵化器详细数据
* 小程序端 点击我的数据之后拉取的详细数据
* @param uscc 孵化器统一信用代码
* @returns data 基础数据字段
*/
export
async
function
selectFuHuaQiBaseData
(
uscc
:
string
)
{
let
dataBaseInfo
=
await
findFuHuaQiByUSCC
(
uscc
);
let
enterpriseTotal
=
await
findEnterpriseCount
({
fuHuaQiUscc
:
uscc
});
//企业总数
let
numOfEntities
=
enterpriseTotal
-
dataBaseInfo
.
virtualEnterpriseNum
;
//企业总数 - 虚拟企业数量
let
keyList
=
[
"name"
,
"operationName"
,
"uscc"
,
"virtualEnterpriseNum"
,
"logonTime"
,
"incubatedAcreage"
,
"acreageTotal"
,
"acreagePersonalUse"
,
"lv"
,
"identificationTime"
,
"industry"
,
"institutionalNature"
,
"liaison"
,
"liaisonPhone"
,
"personInCharge"
,
"personInChargePhone"
,
"hatchingGround"
];
let
data
=
{};
keyList
.
forEach
(
key
=>
{
data
[
key
]
=
dataBaseInfo
[
key
];
data
[
"enterpriseTotal"
]
=
enterpriseTotal
;
data
[
"numOfEntities"
]
=
numOfEntities
;
});
let
data
:
any
=
extractData
(
FuHuaQiBaseDataConfig
,
dataBaseInfo
);
data
.
enterpriseTotal
=
enterpriseTotal
;
data
.
numOfEntities
=
enterpriseTotal
-
dataBaseInfo
.
virtualEnterpriseNum
;
//企业总数 - 虚拟企业数量
return
data
;
}
/**
* 主界面基础数据
* 更新孵化器基础数据
* 小程序端
* @param uscc 孵化器统一信用代码
* @returns data "incubatedAcreage", "acreageTotal", "acreagePersonalUse", "enterpriseCount"
* @param param 表单内容
* @returns {isSuccess:true/false};
*/
export
async
function
homeData
(
uscc
:
string
)
{
let
dataBaseInfo
=
await
findFuHuaQiByUSCC
(
uscc
);
let
keyList
=
[
"incubatedAcreage"
,
"acreageTotal"
,
"acreagePersonalUse"
,
"name"
,
"lv"
,
"institutionalNature"
];
let
data
:
any
=
{
enterpriseCount
:
0
};
export
async
function
updateFuHuaQiBaseData
(
uscc
:
string
,
param
)
{
tools
.
checkParamater
(
"更新孵化器基础数据"
,
BaseParamUpdateConfig
,
param
);
keyList
.
forEach
(
key
=>
{
data
[
key
]
=
dataBaseInfo
[
key
];
});
let
baseDataInfo
=
await
findFuHuaQiByUSCC
(
uscc
);
data
.
enterpriseCount
=
await
findEnterpriseCountByFuHuaQiUscc
(
uscc
);
data
.
lv
=
FUHUAQILV
[
dataBaseInfo
.
lv
];
data
.
institutionalNature
=
FUHUAQILV
[
dataBaseInfo
.
institutionalNature
];
return
data
;
//todo 这里有个bug
let
changeList
=
tools
.
checkChange
(
param
,
baseDataInfo
);
for
(
let
i
=
0
;
i
<
changeList
.
length
;
i
++
)
{
let
key
=
changeList
[
i
];
baseDataInfo
[
key
]
=
param
[
key
];
}
await
baseDataInfo
.
save
();
return
{
isSuccess
:
true
};
}
/**
* 获取孵化器基本信息列表
* 管理后台端
* @param lv 孵化器等级
* @param institutionalNature 机构性质
* @param industry 领域
...
...
src/biz/fuHuqQi/month.ts
View file @
466c0b6e
...
...
@@ -2,49 +2,50 @@
* 月度表单逻辑层
* 作者: 陈金晶
* 月度表单相关逻辑 包括孵化器月度填报的增删改查
* 月度表单在孵化器任务生成时 就会在库里存在数据
*/
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
*
as
monthData
from
"../../data/fuHuaQi/monthTable"
;
import
{
extractData
,
getTaskId
}
from
"../../util/tools"
;
import
moment
=
require
(
"moment"
);
import
{
findAllFuHuaQiOperationNameMap
}
from
"../../data/fuHuaQi/fuhuaqi"
;
import
{
MonthListConfig
}
from
"../../config/ojbectResultKeyConfig"
;
import
{
TASKTYPEENUM
}
from
"../../config/enum"
;
import
{
findTaskListByType
}
from
"../../data/fuHuaQi/task"
;
import
{
MonthConfig
}
from
"../../config/ojbectResultKeyConfig"
;
/**
* 新添加孵化器月度填报
* 小程序端
* 逻辑是 将填报编辑状态修改
* @param uscc 孵化器的统一信用代码
* @param occupancyRate 本月出租率
* @returns {isSuccess:true/false}
*/
export
async
function
createReport
(
uscc
:
string
,
occupancyRate
:
number
)
{
const
TaskId
=
getTaskId
(
uscc
);
let
dataBaseInfo
=
await
monthData
.
find
m
onthTableByTaskId
(
TaskId
);
let
dataBaseInfo
=
await
monthData
.
find
M
onthTableByTaskId
(
TaskId
);
if
(
dataBaseInfo
.
state
==
2
)
throw
new
BizError
(
ERRORENUM
.
该孵化器月度填报已存在
,
`
${
uscc
}
重复提交了月度填报值为
${
occupancyRate
}
`
);
if
(
dataBaseInfo
.
isUpdate
)
throw
new
BizError
(
ERRORENUM
.
该孵化器月度填报已存在
,
`
${
uscc
}
重复提交了月度填报值为
${
occupancyRate
}
`
);
dataBaseInfo
.
state
=
2
;
dataBaseInfo
.
createTime
=
new
Date
().
valueOf
();
dataBaseInfo
.
isUpdate
=
true
;
dataBaseInfo
.
occupancyRate
=
occupancyRate
;
await
dataBaseInfo
.
save
();
// const MonthNumber = moment().subtract(1, 'months').month() + 1;
// const MonthTableName = `${MonthNumber}月孵化器月度填报`;
// await monthData.addOnceReport(TaskId, MonthTableName, uscc, occupancyRate);
return
{
isSuccess
:
true
};
}
/**
* 修改孵化器月度报表
* 小程序端
* @param uscc 孵化器的统一信用代码
* @param occupancyRate 本月出租率
* @returns {isSuccess:true/false}
*/
export
async
function
updateReport
(
uscc
:
string
,
occupancyRate
:
number
)
{
const
TaskId
=
getTaskId
(
uscc
);
let
dataBaseInfo
=
await
monthData
.
findmonthTableByTaskId
(
TaskId
);
let
dataBaseInfo
=
await
monthData
.
findMonthTableByTaskId
(
TaskId
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
taskId
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`未找到
${
uscc
}
的月度报表`
);
dataBaseInfo
.
occupancyRate
=
occupancyRate
;
...
...
@@ -55,23 +56,44 @@ export async function updateReport(uscc:string, occupancyRate:number) {
/**
* 删除孵化器月度报表
* 小程序端
* @param uscc 孵化器的统一信用代码
* @returns {isSuccess:true/false}
*/
export
async
function
deleteReport
(
uscc
:
string
)
{
const
TaskId
=
getTaskId
(
uscc
);
let
dataBaseInfo
=
await
monthData
.
findmonthTableByTaskId
(
TaskId
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
taskId
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
);
await
monthData
.
deleteReport
(
uscc
,
dataBaseInfo
.
name
);
let
dataBaseInfo
=
await
monthData
.
findMonthTableByTaskId
(
TaskId
);
if
(
!
dataBaseInfo
.
isUpdate
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
);
dataBaseInfo
.
isUpdate
=
false
;
//修改编辑状态
await
dataBaseInfo
.
save
();
return
{
isSuccess
:
true
};
}
/**
* 根据uscc查询月度报表
* 小程序端 回显
* @param uscc 企业统一信用代码
* @returns {occupancyRate:0} occupancyRate 本月出租率
*/
export
async
function
getMonthByUscc
(
uscc
:
string
)
{
const
TaskId
=
getTaskId
(
uscc
);
let
dataBaseInfo
=
await
monthData
.
findMonthTableByTaskId
(
TaskId
);
if
(
!
dataBaseInfo
.
isUpdate
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`未找到
${
uscc
}
的月度报表`
);
let
data
=
extractData
(
MonthConfig
,
dataBaseInfo
);
return
{
data
};
}
/**
* 月度出租率数据列表
* 管理后台
使用
* 管理后台
端
* @param state 填报状态
* @param year 数据年份
* @param month 数据月份
...
...
@@ -102,18 +124,3 @@ export async function monthTableList(state:number, year:number, month:number, pa
return
{
count
,
dataList
}
}
\ No newline at end of file
/**
* 根据uscc查询月度报表
* @param uscc 企业统一信用代码
*/
export
async
function
getMonthByUscc
(
uscc
:
string
)
{
const
TaskId
=
getTaskId
(
uscc
);
let
dataBaseInfo
=
await
monthData
.
findmonthTableByTaskId
(
TaskId
);
if
(
!
dataBaseInfo
||
!
dataBaseInfo
.
taskId
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
,
`未找到
${
uscc
}
的月度报表`
);
let
data
=
extractData
(
MonthListConfig
,
dataBaseInfo
);
return
{
data
};
}
\ No newline at end of file
src/biz/fuHuqQi/task.ts
View file @
466c0b6e
...
...
@@ -11,42 +11,40 @@ import { ERRORENUM } from "../../config/errorEnum";
import
{
findEnterpriseListByTaskId
,
updateEnterpriseDraftLock
}
from
"../../data/enterprise/enterprise"
;
import
{
findFinancingListByTaskId
,
updateFinancingDraftLock
}
from
"../../data/enterprise/financing"
;
import
{
findAllFuHuaQi
}
from
"../../data/fuHuaQi/fuhuaqi"
;
import
{
createMonthTableToList
,
find
m
onthTableByTaskId
,
findmonthTableListByTaskId
}
from
"../../data/fuHuaQi/monthTable"
;
import
{
createMonthTableToList
,
find
M
onthTableByTaskId
,
findmonthTableListByTaskId
}
from
"../../data/fuHuaQi/monthTable"
;
import
{
findEnterpriseByTaskIdAndType
,
createTaskToList
,
findFuHuaQiTaskByTaskId
,
findTaskCountByKey
}
from
"../../data/fuHuaQi/task"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
log
Console
,
log
Handle
}
from
"../../util/log"
;
import
{
extractData
,
getTaskId
,
getTimeKey
}
from
"../../util/tools"
;
import
{
logHandle
}
from
"../../util/log"
;
import
{
getTaskId
,
getTimeKey
}
from
"../../util/tools"
;
/**
* 获取孵化器的任务列表
* @param uscc 孵化器的信用标识
* 小程序端
* @param uscc 孵化器统一信用
* @returns [{type:1, title:'', enterpriseList:[] }]
*/
export
async
function
fuHuaQiTaskList
(
uscc
:
string
)
{
let
result
=
[];
const
TimeKey
=
getTimeKey
();
const
TaskId
=
getTaskId
(
uscc
);
let
taskMap
=
await
findFuHuaQiTaskByTaskId
(
TaskId
);
let
taskTypeMapConf
=
{};
//
let taskTypeMapConf = {};
for
(
let
key
in
TASKTYPEENUM
)
{
let
k
:
any
=
key
;
if
(
isNaN
(
k
))
taskTypeMapConf
[
TASKTYPEENUM
[
key
]]
=
key
;
}
if
(
isNaN
(
k
))
{
const
Value
=
k
;
const
KeyStr
=
TASKTYPEENUM
[
key
]
let
keyNumber
=
parseInt
(
KeyStr
);
let
onceObj
=
{
key
:
keyNumber
,
title
:
Value
,
enterpriseList
:[]};
for
(
let
typeStr
in
taskTypeMapConf
)
{
let
typeKey
=
parseInt
(
typeStr
);
let
onceObj
=
{
key
:
typeKey
,
title
:
taskTypeMapConf
[
typeStr
],
enterpriseList
:[]};
let
onceTaskInfo
=
taskMap
[
typeStr
];
let
onceTaskInfo
=
taskMap
[
KeyStr
];
if
(
!
onceTaskInfo
.
isSubmit
)
{
//没有提交任务
let
dataList
=
[];
switch
(
typeKey
)
{
switch
(
keyNumber
)
{
case
TASKTYPEENUM
.
孵化器月度填报
:
dataList
=
await
findmonthTableListByTaskId
(
TaskId
);
break
;
case
TASKTYPEENUM
.
新注册或迁入企业登记
:
dataList
=
await
findEnterpriseListByTaskId
(
TaskId
);
break
;
case
TASKTYPEENUM
.
融资企业填报
:
dataList
=
await
findFinancingListByTaskId
(
TaskId
);
break
;
...
...
@@ -58,7 +56,7 @@ export async function fuHuaQiTaskList(uscc:string) {
});
result
.
push
(
onceObj
);
}
}
}
return
{
taskList
:
result
};
...
...
@@ -67,12 +65,12 @@ export async function fuHuaQiTaskList(uscc:string) {
/**
* 提交任务
* @param uscc 孵化器的信用标识
* 小程序端
* @param uscc 孵化器统一信用代码
* @param taskType 任务类型
* @returns {isSuccess:true/false}
*/
export
async
function
checkTask
(
uscc
:
string
,
taskType
:
number
)
{
const
TimeKey
=
getTimeKey
();
const
TaskId
=
getTaskId
(
uscc
);
let
taskInfo
=
await
findEnterpriseByTaskIdAndType
(
TaskId
,
taskType
);
...
...
@@ -81,17 +79,18 @@ export async function checkTask(uscc:string, taskType:number) {
switch
(
taskType
)
{
case
TASKTYPEENUM
.
孵化器月度填报
:
let
tableInfo
=
await
findmonthTableByTaskId
(
TaskId
);
if
(
!
tableInfo
)
throw
new
BizError
(
ERRORENUM
.
该报表需要填写本月内容后提交
,
uscc
,
taskType
);
if
(
tableInfo
.
draftLock
)
throw
new
BizError
(
ERRORENUM
.
不能重复提交任务
,
uscc
,
taskType
,
'月度表lock = true'
);
tableInfo
.
draftLock
=
true
;
await
tableInfo
.
save
();
let
monthTableInfo
=
await
findMonthTableByTaskId
(
TaskId
);
if
(
!
monthTableInfo
.
isUpdate
)
throw
new
BizError
(
ERRORENUM
.
该报表需要填写本月内容后提交
,
uscc
,
taskType
);
if
(
monthTableInfo
.
draftLock
)
throw
new
BizError
(
ERRORENUM
.
不能重复提交任务
,
uscc
,
taskType
,
'月度表lock = true'
);
monthTableInfo
.
draftLock
=
true
;
await
monthTableInfo
.
save
();
break
;
case
TASKTYPEENUM
.
新注册或迁入企业登记
:
await
update
Financing
DraftLock
(
TaskId
);
await
update
Enterprise
DraftLock
(
TaskId
);
break
;
case
TASKTYPEENUM
.
融资企业填报
:
await
update
Enterprise
DraftLock
(
TaskId
);
await
update
Financing
DraftLock
(
TaskId
);
break
;
}
...
...
@@ -107,6 +106,7 @@ export async function checkTask(uscc:string, taskType:number) {
/**
* 发放任务
* 系统自发
* 需求说明:
* 每月1日0时0分,将任务下发至孵化器表中未被禁用的孵化器中
*
...
...
@@ -155,7 +155,7 @@ export async function provideTask() {
fuHuaQiUscc
:
uscc
,
month
:
MonthNumber
,
year
:
YearNumber
,
state
:
1
draftLock
:
false
});
});
...
...
src/biz/fuHuqQi/user.ts
View file @
466c0b6e
...
...
@@ -10,8 +10,10 @@ import * as fuhuaqiData from "../../data/fuHuaQi/fuhuaqi"
import
{
BizError
}
from
"../../util/bizError"
;
import
{
extractData
,
getPwdMd5
,
getToken
}
from
"../../util/tools"
;
/**
* 登录
* 小程序的孵化器登录
* 小程序端
* @param uscc 信用代码
* @param pwd 密码
* @returns fuhuaqiUserInfo:{uscc, name} 登录后的信息
...
...
@@ -43,6 +45,7 @@ export async function login(uscc:string, pwd:string) {
/**
* 首次登录修改密码
* 小程序端
* @param uscc 孵化器统一信用代码
* @param pwd 新密码
* @param confirmPwd 确认密码
...
...
@@ -62,6 +65,7 @@ export async function firstLoginChangePwd(uscc:string, pwd:string, confirmPwd:st
/**
* 重置密码
* 小程序端
* @param uscc 信用代码
* @param pwd 原密码
* @param newPwd 修改后的密码
...
...
@@ -85,8 +89,10 @@ export async function changePassword(uscc:string, pwd:string, newPwd:string) {
return
{
isSuccess
:
true
};
}
/**
* 退出登录
* 小程序端
* @param uscc 信用代码
* @returns {isSuccess:true/false}
*/
...
...
@@ -97,8 +103,10 @@ export async function logout(uscc:string):Promise<object> {
return
{
isSuccess
:
true
};
}
/**
* 孵化器账号信息列表
* 管理后台使用
* @param operationName 运营机构名称
* @param page 页数
* @returns
...
...
@@ -120,14 +128,20 @@ export async function logout(uscc:string):Promise<object> {
return
{
count
,
dataList
};
}
/**
* 修改账号状态
* 管理后台端 禁用/启用
* @param uscc 孵化器统一信用代码
* @param userStatem 是否禁用 true=启用 false=禁用
* @returns
*/
export
async
function
updateState
(
us
erStatem
:
boolean
,
uscc
:
string
)
{
export
async
function
updateState
(
us
cc
:
string
,
userStatem
:
boolean
)
{
let
fuhuaqiInfo
=
await
fuhuaqiData
.
findFuHuaQiByUSCC
(
uscc
);
if
(
!
fuhuaqiInfo
)
throw
new
BizError
(
ERRORENUM
.
账号不存在
);
fuhuaqiInfo
.
userStatem
=
userStatem
;
await
fuhuaqiInfo
.
save
();
console
.
log
(
await
fuhuaqiInfo
.
save
());
return
{
isSuccess
:
true
};
}
\ No newline at end of file
src/config/enum.ts
View file @
466c0b6e
...
...
@@ -60,3 +60,10 @@ export enum INDUSTRY{
文化创意
,
其他
}
/**更新状态 */
export
enum
UPDATESTATE
{
未填报
=
1
,
已填报
=
2
}
\ No newline at end of file
src/config/errorEnum.ts
View file @
466c0b6e
...
...
@@ -17,7 +17,7 @@ export enum ERRORENUM {
身份验证过期
,
密码长度不能超过
24
个字符
,
账号不存在
,
已入库的
企业
不能删除
,
已入库的
数据
不能删除
,
任务不存在
,
该企业不存在
}
...
...
src/config/ojbectResultKeyConfig.ts
View file @
466c0b6e
...
...
@@ -110,9 +110,44 @@ export const FuHuaQiListConfig = {
/**
* 孵化器月度报表 参数转换配置
*/
export
const
Month
List
Config
=
{
export
const
MonthConfig
=
{
name
:{
key
:
"任务名称"
},
fuHuaQiUscc
:{
key
:
"任务所属孵化器id"
},
occupancyRate
:{
key
:
"出租率"
},
createTime
:{
key
:
"创建时间"
},
}
/**
* 小程序首页的孵化器基础数据配置
*/
export
const
FuHuaQiHomeDataConfig
=
{
incubatedAcreage
:{
key
:
"在孵面积"
},
acreageTotal
:{
key
:
"孵化器总面积"
},
acreagePersonalUse
:{
key
:
"孵化器自用面积"
},
name
:{
key
:
"名称"
},
lv
:{
key
:
"孵化器级别"
},
institutionalNature
:{
key
:
"机构性质"
}
}
/**
* 小程序孵化器详细数据
*/
export
const
FuHuaQiBaseDataConfig
=
{
name
:{
key
:
"名称"
},
operationName
:{
key
:
"运营机构名称"
},
uscc
:{
key
:
"统一信用代码"
},
virtualEnterpriseNum
:{
key
:
"虚拟企业数量"
},
logonTime
:{
key
:
"注册时间"
},
incubatedAcreage
:{
key
:
"在孵面积"
},
acreageTotal
:{
key
:
"孵化器总面积"
},
acreagePersonalUse
:{
key
:
"/孵化器自用面积"
},
lv
:{
key
:
"孵化器级别"
},
identificationTime
:{
key
:
"认定时间"
},
industry
:{
key
:
"孵化领域"
},
institutionalNature
:{
key
:
"机构性质"
},
liaison
:{
key
:
"联系人"
},
liaisonPhone
:{
key
:
"联系电话"
},
personInCharge
:{
key
:
"负责人"
},
personInChargePhone
:{
key
:
"负责人联系电话"
},
hatchingGround
:{
key
:
"经备案孵化场地"
}
}
\ No newline at end of file
src/data/enterprise/enterprise.ts
View file @
466c0b6e
...
...
@@ -156,9 +156,9 @@ export async function findEnterpriseInfoByName(name:string) {
/**
*
todo 注释后加
*
获取孵化器下的所有企业信息
* @param selectParam 查询参数
* @returns
number 数据数量
* @returns
[]
*/
export
async
function
findEnterpriseListByFuHuaQiUsccName
(
fuHuaQiUscc
:
string
)
{
return
await
enterpriseModel
.
find
({
fuHuaQiUscc
});
...
...
src/data/enterprise/financing.ts
View file @
466c0b6e
...
...
@@ -59,9 +59,10 @@ export async function findFinancingListByTaskId(taskId:string) {
}
/**
* 通过taskId和uscc获取融资信息
* 通过taskId和
企业
uscc获取融资信息
* 支持.save方法保存对象修改
* @param taskId 任务id 格式遵循tool中getTaskId
* @param uscc 企业统一信用代码
* @returns {}
*/
export
async
function
findFinancingInfoByTaskIdAndSucc
(
taskId
:
string
,
uscc
:
string
)
{
...
...
@@ -95,20 +96,11 @@ export async function createFinancing(fuHuaQiUscc:string, taskId:string, param)
* @param taskId 任务id
*/
export
async
function
deleteEnterpriseFinancing
(
uscc
:
string
,
taskId
:
string
)
{
return
await
financingModel
.
deleteOne
({
uscc
:
uscc
}).
exec
();
return
await
financingModel
.
deleteOne
({
uscc
:
uscc
,
taskId
}).
exec
();
}
/**
* 根据融资企业名称获取融资数据
* @param name
* @returns
*/
export
async
function
findAddByName
(
name
:
string
)
{
return
await
financingModel
.
selectOnceData
({
name
});
}
/**
* 聚合查询 孵化器所拥有的企业数量
* @returns {} key=孵化器统一信用 value=企业数量
*/
...
...
@@ -125,23 +117,12 @@ export async function groupFindFinancing() {
/**
* 通过企业统一信用代码获取企业信息
* 支持.save方法保存对象修改
* @param uscc 企业统一信用代码
* @param taskId 任务id
* @returns {}
*/
export
async
function
findEnterpriseFinancingByUscc
(
uscc
:
string
,
taskId
:
string
)
{
return
await
financingModel
.
selectOnceData
({
uscc
});
}
/**
* 获取所有融资企业
* @param selectParam 查询参数
* @param skipCount 跳过数量
* @returns [] 孵化器列表
*/
export
async
function
findFinancingList
(
selectParam
,
skipCount
)
{
export
async
function
findFinancingList
(
selectParam
:
object
,
skipCount
:
number
)
{
return
await
financingModel
.
find
(
selectParam
).
skip
(
skipCount
).
limit
(
10
);
}
...
...
@@ -150,6 +131,6 @@ export async function findEnterpriseFinancingByUscc(uscc:string, taskId:string)
* @param selectParam 查询参数
* @returns number 数据数量
*/
export
async
function
findFinancingCount
(
selectParam
)
{
export
async
function
findFinancingCount
(
selectParam
:
object
)
{
return
await
financingModel
.
find
(
selectParam
).
count
();
}
\ No newline at end of file
src/data/fuHuaQi/monthTable.ts
View file @
466c0b6e
...
...
@@ -14,12 +14,12 @@ const monthTableSchema = new Schema({
name
:
String
,
//任务名称
fuHuaQiUscc
:
String
,
//任务所属孵化器id
occupancyRate
:
Number
,
//出租率 单位为%
createTime
:
Number
,
//创建时间
state
:{
type
:
Number
,
default
:
1
},
//状态 初始状态=1 1表示未填报
/**不下发字段 */
draftLock
:{
type
:
Boolean
,
default
:
false
},
//草稿锁,true为提交之后,false为草稿
month
:{
type
:
Number
,
index
:
true
},
year
:{
type
:
Number
,
index
:
true
}
year
:{
type
:
Number
,
index
:
true
},
isUpdate
:{
type
:
Boolean
,
default
:
false
},
submitTime
:
Number
,
//提交时间
});
var
monthTableModel
;
...
...
@@ -52,30 +52,18 @@ export async function findmonthTableListByTaskId(taskId:string) {
return
await
monthTableModel
.
find
({
taskId
});
}
/**
* 通过taskId 获取此次月度任务
* 支持.save方法保存对象修改
* @param taskId 任务id 格式遵循tool中getTaskId
* @returns {}
*/
export
async
function
find
m
onthTableByTaskId
(
taskId
:
string
)
{
export
async
function
find
M
onthTableByTaskId
(
taskId
:
string
)
{
let
monthTableInfo
=
await
monthTableModel
.
selectOnceData
({
taskId
});
return
monthTableInfo
;
}
/**
* 孵化器月度填报 新增报表
* @param taskId 任务Id
* @param name 任务名称 系统生成
* @param uscc 孵化器统一信用代码
* @param occupancyRate 出租率
* @param createTime 创建时间
*
*/
export
async
function
addOnceReport
(
taskId
:
string
,
name
:
string
,
uscc
:
string
,
occupancyRate
:
number
)
{
let
monthInfo
=
{
taskId
,
name
,
fuHuaQiUscc
:
uscc
,
occupancyRate
,
createTime
:
new
Date
().
valueOf
()}
await
monthTableModel
.
create
(
monthInfo
);
}
/**
* 孵化器月度填报 删除报表
...
...
src/routers/fuhuaqi.ts
View file @
466c0b6e
...
...
@@ -171,7 +171,7 @@ async function delEnterpriseInfo(req, res) {
async
function
getFinancingInfoByName
(
req
,
res
)
{
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
financingBiz
.
getF
inancingByName
(
Uscc
);
let
result
=
await
financingBiz
.
getF
uHuaQiEnterpriseForSelect
(
Uscc
);
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