Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
0a7decf4
Commit
0a7decf4
authored
Jan 02, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
43db0279
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
fi-taxctl/app/base/service/impl/rpt/rpttypeSve.js
+7
-0
fi-taxctl/app/base/utils/redisClient.js
+4
-0
No files found.
fi-taxctl/app/base/service/impl/rpt/rpttypeSve.js
View file @
0a7decf4
...
@@ -33,10 +33,15 @@ class RptTypeService extends ServiceBase{
...
@@ -33,10 +33,15 @@ class RptTypeService extends ServiceBase{
hisarray
.
push
(
h
);
hisarray
.
push
(
h
);
});
});
await
self
.
db
.
models
.
rpthistory
.
bulkCreate
(
hisarray
,{
transaction
:
t
});
await
self
.
db
.
models
.
rpthistory
.
bulkCreate
(
hisarray
,{
transaction
:
t
});
//每保存一次历史数据,就是处理完成一个任务中的一个报表
var
currentval
=
await
self
.
redisClient
.
decr
(
"batch"
+
batchid
);
if
(
currentval
==
0
){
await
self
.
redisClient
.
rpush
(
"riskmq"
,
JSON
.
stringify
({
await
self
.
redisClient
.
rpush
(
"riskmq"
,
JSON
.
stringify
({
key
:
new
Date
().
toLocaleString
(),
key
:
new
Date
().
toLocaleString
(),
content
:
batchid
+
""
content
:
batchid
+
""
}));
}));
self
.
redisClient
.
delete
(
"batch"
+
batchid
);
}
return
{};
return
{};
});
});
}
}
...
@@ -89,6 +94,8 @@ class RptTypeService extends ServiceBase{
...
@@ -89,6 +94,8 @@ class RptTypeService extends ServiceBase{
//保存报表
//保存报表
await
this
.
db
.
models
.
uploadrpt
.
bulkCreate
(
rptresult
,{
transaction
:
t
});
await
this
.
db
.
models
.
uploadrpt
.
bulkCreate
(
rptresult
,{
transaction
:
t
});
var
lstspts
=
await
this
.
db
.
models
.
uploadrpt
.
findAll
({
where
:{
uploadbatch_id
:
batchtemp
.
id
},
transaction
:
t
});
var
lstspts
=
await
this
.
db
.
models
.
uploadrpt
.
findAll
({
where
:{
uploadbatch_id
:
batchtemp
.
id
},
transaction
:
t
});
//保存当前批的报表数量到缓存,每保存一次历史,计数减1,当计数变为0时,改变批状态,给康发送消息,
await
this
.
redisClient
.
set
(
"batch"
+
batchtemp
.
id
,
lstspts
.
length
);
try
{
try
{
lstspts
.
forEach
(
async
(
rpt
)
=>
{
lstspts
.
forEach
(
async
(
rpt
)
=>
{
await
this
.
redisClient
.
notifyConsume
(
"k8stask"
,
"docurls"
,
rpt
.
id
+
"~"
+
batchtemp
.
id
+
"~"
+
rpt
.
rptdate
+
"~"
+
rpt
.
rpttypecode
+
"~"
+
rpt
.
urlpath
);
await
this
.
redisClient
.
notifyConsume
(
"k8stask"
,
"docurls"
,
rpt
.
id
+
"~"
+
batchtemp
.
id
+
"~"
+
rpt
.
rptdate
+
"~"
+
rpt
.
rpttypecode
+
"~"
+
rpt
.
urlpath
);
...
...
fi-taxctl/app/base/utils/redisClient.js
View file @
0a7decf4
...
@@ -222,6 +222,10 @@ class RedisClient {
...
@@ -222,6 +222,10 @@ class RedisClient {
async
incr
(
key
)
{
async
incr
(
key
)
{
return
this
.
client
.
incrAsync
(
key
);
return
this
.
client
.
incrAsync
(
key
);
}
}
async
decr
(
key
)
{
return
this
.
client
.
decrAsync
(
key
);
}
}
}
module
.
exports
=
RedisClient
;
module
.
exports
=
RedisClient
;
var
client
=
new
RedisClient
();
var
client
=
new
RedisClient
();
...
...
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