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
ce9ed9a9
Commit
ce9ed9a9
authored
Feb 09, 2023
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
87c4b0da
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
3 deletions
+79
-3
task.ts
src/biz/fuHuqQi/task.ts
+36
-2
systemTask.ts
src/biz/systemTask.ts
+29
-0
fuhuaqi.ts
src/data/fuHuaQi/fuhuaqi.ts
+2
-1
task.ts
src/data/fuHuaQi/task.ts
+10
-0
main.ts
src/main.ts
+2
-0
No files found.
src/biz/fuHuqQi/task.ts
View file @
ce9ed9a9
...
...
@@ -11,8 +11,9 @@ import { findEnterpriseListByTaskId, updateEnterpriseDraftLock } from "../../dat
import
{
findFinancingListByTaskId
,
updateFinancingDraftLock
}
from
"../../data/enterprise/financing"
;
import
{
findAllFuHuaQi
}
from
"../../data/fuHuaQi/fuhuaqi"
;
import
{
findmonthTableByTaskId
,
findmonthTableListByTaskId
}
from
"../../data/fuHuaQi/monthTable"
;
import
{
createTaskData
,
findFuHuaQiTaskByKeyAndUscc
}
from
"../../data/fuHuaQi/task"
;
import
{
createTaskData
,
createTaskToList
,
findFuHuaQiTaskByKeyAndUscc
,
findTaskCountByKey
}
from
"../../data/fuHuaQi/task"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
logConsole
,
logHandle
}
from
"../../util/log"
;
import
{
getTaskId
,
getTimeKey
}
from
"../../util/tools"
;
...
...
@@ -102,9 +103,41 @@ export async function checkTask(uscc:string, taskType:number) {
*
*/
export
async
function
provideTask
()
{
const
TimeKey
=
getTimeKey
();
let
taskCount
=
await
findTaskCountByKey
(
TimeKey
);
if
(
taskCount
)
{}
//todo 重复创建了任务
let
fuHuaQiList
=
await
findAllFuHuaQi
();
let
addList
=
[];
fuHuaQiList
.
forEach
(
info
=>
{
let
{
uscc
}
=
info
;
addList
.
push
({
key
:
TimeKey
,
type
:
TASKTYPEENUM
.
孵化器月度填报
,
taskId
:
getTaskId
(
uscc
),
fuHuaQiUscc
:
uscc
,
isSubmit
:
false
},{
key
:
TimeKey
,
type
:
TASKTYPEENUM
.
新注册或迁入企业登记
,
taskId
:
getTaskId
(
uscc
),
fuHuaQiUscc
:
uscc
,
isSubmit
:
false
},{
key
:
TimeKey
,
type
:
TASKTYPEENUM
.
融资企业填报
,
taskId
:
getTaskId
(
uscc
),
fuHuaQiUscc
:
uscc
,
isSubmit
:
false
});
});
try
{
await
createTaskToList
(
addList
);
logHandle
(
`添加了
${
addList
.
length
}
`
)
}
catch
(
err
)
{
//todo添加异常了
}
}
\ No newline at end of file
src/biz/systemTask.ts
0 → 100644
View file @
ce9ed9a9
/**
* 系统任务逻辑
* 作者:李欣鸣
* 目前下发任务有
* 1: 每月1日0时0分,下发孵化器任务
*
*/
import
{
findTaskCountByKey
}
from
"../data/fuHuaQi/task"
;
import
{
getTimeKey
}
from
"../util/tools"
;
import
{
provideTask
}
from
"./fuHuqQi/task"
;
export
function
initSystemTask
()
{
fuHuaQiTask
();
setInterval
(
async
function
()
{
await
fuHuaQiTask
();
},
3600
*
1000
);
}
async
function
fuHuaQiTask
()
{
const
Key
=
getTimeKey
();
let
count
=
await
findTaskCountByKey
(
Key
);
if
(
count
!=
0
)
return
;
await
provideTask
();
}
src/data/fuHuaQi/fuhuaqi.ts
View file @
ce9ed9a9
...
...
@@ -184,5 +184,5 @@ export async function getFuHuaQiCreateDataTimeMap() {
export
async
function
findAllFuHuaQi
()
{
return
await
fuHuaQiModel
.
find
({});
return
await
fuHuaQiModel
.
find
({
userState
:
false
});
}
\ No newline at end of file
src/data/fuHuaQi/task.ts
View file @
ce9ed9a9
...
...
@@ -17,6 +17,7 @@ const fuHuaQiTaskSchema = new Schema({
fuHuaQiUscc
:
String
,
//任务所属孵化器id
createTime
:
Number
,
//提交时间
// relevanceId:String,//任务关联的表 financing 或 enterprise 的id 弃用
isSubmit
:
Boolean
,
//是否提交
});
var
fuHuaQiTaskModel
;
...
...
@@ -51,3 +52,11 @@ export async function createTaskData(uscc:string, key:string, taskId:string, typ
await
fuHuaQiTaskModel
.
create
(
addInfo
);
}
export
async
function
findTaskCountByKey
(
key
:
string
)
{
return
await
fuHuaQiTaskModel
.
find
({
key
}).
count
();
}
export
async
function
createTaskToList
(
taskList
:
object
)
{
await
fuHuaQiTaskModel
.
insertMany
(
taskList
);
}
\ No newline at end of file
src/main.ts
View file @
ce9ed9a9
import
{
fuHuaQiTaskList
}
from
"./biz/fuHuqQi/task"
;
import
{
initSystemTask
}
from
"./biz/systemTask"
;
import
{
initConfig
,
systemConfig
}
from
"./config/serverConfig"
;
import
{
initDB
}
from
"./db/dbInit"
;
import
{
httpServer
}
from
"./net/http_server"
;
...
...
@@ -6,6 +7,7 @@ import { httpServer } from "./net/http_server";
async
function
lanuch
()
{
await
initConfig
();
//初始化配置解析
await
initDB
();
await
initSystemTask
();
httpServer
.
createServer
(
systemConfig
.
port
);
console
.
log
(
'This indicates that the server is started successfully.'
);
}
...
...
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