Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
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
reyun
manager
Commits
3119ff4e
Commit
3119ff4e
authored
7 years ago
by
manxiaoqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时任务
parent
1695457b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
35 deletions
+46
-35
workspace.xml
.idea/workspace.xml
+0
-0
AccountTask.java
src/main/java/tkio/task/AccountTask.java
+45
-34
applicationContext-schedule.xml
src/main/resources/spring/applicationContext-schedule.xml
+1
-1
No files found.
.idea/workspace.xml
View file @
3119ff4e
This diff is collapsed.
Click to expand it.
src/main/java/tkio/task/AccountTask.java
View file @
3119ff4e
...
@@ -2,6 +2,9 @@ package tkio.task;
...
@@ -2,6 +2,9 @@ package tkio.task;
import
common.model.Account4Web
;
import
common.model.Account4Web
;
import
common.repository.Account4WebRepository
;
import
common.repository.Account4WebRepository
;
import
common.task.SyncAppDataTask
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
tkio.model.Account
;
import
tkio.model.Account
;
import
tkio.model.AccountRestrict4Web
;
import
tkio.model.AccountRestrict4Web
;
...
@@ -23,6 +26,7 @@ import java.util.Map;
...
@@ -23,6 +26,7 @@ import java.util.Map;
* Created by mxq on 2017/12/25.
* Created by mxq on 2017/12/25.
*/
*/
public
class
AccountTask
{
public
class
AccountTask
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
AccountTask
.
class
);
@Autowired
@Autowired
AccountRepository
accountRepository
;
AccountRepository
accountRepository
;
...
@@ -40,6 +44,7 @@ public class AccountTask {
...
@@ -40,6 +44,7 @@ public class AccountTask {
SalesManLeaderRepository
salesManLeaderRepository
;
SalesManLeaderRepository
salesManLeaderRepository
;
public
void
task
(){
public
void
task
(){
logger
.
info
(
"tkio task start :"
+
System
.
currentTimeMillis
());
//清空前一天数据
//清空前一天数据
account4WebRepository
.
deleteAll
();
account4WebRepository
.
deleteAll
();
List
<
Account4Web
>
list
=
new
ArrayList
<>();
List
<
Account4Web
>
list
=
new
ArrayList
<>();
...
@@ -47,44 +52,49 @@ public class AccountTask {
...
@@ -47,44 +52,49 @@ public class AccountTask {
List
<
Account
>
accountValidList
=
accountRepository
.
findRootParentsUnPast
(
DateUtil
.
getBeforeDays
(
1
));
List
<
Account
>
accountValidList
=
accountRepository
.
findRootParentsUnPast
(
DateUtil
.
getBeforeDays
(
1
));
if
(
ValidateUtil
.
isValid
(
accountValidList
)){
if
(
ValidateUtil
.
isValid
(
accountValidList
)){
for
(
Account
ac
:
accountValidList
){
for
(
Account
ac
:
accountValidList
){
AccountRestrict4Web
restrict4Web
=
accountFlowRestrictService
.
findRestrictByAccount
(
ac
.
getId
());
try
{
Account4Web
account4Web
=
new
Account4Web
();
AccountRestrict4Web
restrict4Web
=
accountFlowRestrictService
.
findRestrictByAccount
(
ac
.
getId
());
account4Web
.
setAccountId
(
ac
.
getId
());
Account4Web
account4Web
=
new
Account4Web
();
account4Web
.
setEmail
(
ac
.
getEmail
());
account4Web
.
setAccountId
(
ac
.
getId
());
account4Web
.
setCompany
(
ac
.
getCompany
());
account4Web
.
setEmail
(
ac
.
getEmail
());
account4Web
.
setCreateDate
(
ac
.
getPubDate
());
account4Web
.
setCompany
(
ac
.
getCompany
());
account4Web
.
setCreateDs
(
DateUtil
.
getFormatDate
(
ac
.
getPubDate
()));
account4Web
.
setCreateDate
(
ac
.
getPubDate
());
account4Web
.
setStatus
(
null
==
restrict4Web
.
getIOFlowNotified
()
?
"已激活"
:
(
restrict4Web
.
getIOFlowNotified
()
?
"已激活"
:
"流量用尽"
));
account4Web
.
setCreateDs
(
DateUtil
.
getFormatDate
(
ac
.
getPubDate
()));
account4Web
.
setPackageType
(
restrict4Web
.
getPackageName
());
account4Web
.
setStatus
(
null
==
restrict4Web
.
getIOFlowNotified
()
?
"已激活"
:
(
restrict4Web
.
getIOFlowNotified
()
?
"已激活"
:
"流量用尽"
));
account4Web
.
setPastDate
(
ac
.
getPastDate
());
account4Web
.
setPackageType
(
restrict4Web
.
getPackageName
());
if
(
ac
.
getPricelevel
().
equals
(
7L
)
||
ac
.
getPricelevel
().
equals
(
8L
)
||
ac
.
getPricelevel
().
equals
(
5L
)
||
ac
.
getPricelevel
().
equals
(
6L
)){
account4Web
.
setPastDate
(
ac
.
getPastDate
());
account4Web
.
setIo
(
restrict4Web
.
getThisMonthIOFlow
());
if
(
ac
.
getPricelevel
().
equals
(
7L
)
||
ac
.
getPricelevel
().
equals
(
8L
)
||
ac
.
getPricelevel
().
equals
(
5L
)
||
ac
.
getPricelevel
().
equals
(
6L
)){
account4Web
.
setTrack
(
restrict4Web
.
getTrackTotalFlow
());
account4Web
.
setIo
(
restrict4Web
.
getThisMonthIOFlow
());
}
else
{
account4Web
.
setTrack
(
restrict4Web
.
getTrackTotalFlow
());
account4Web
.
setIo
(
restrict4Web
.
getThisMonthIOFlow
());
}
else
{
account4Web
.
setTrack
(
restrict4Web
.
getTrackTotalFlow
());
account4Web
.
setIo
(
restrict4Web
.
getThisMonthIOFlow
());
account4Web
.
setIoLimit
(
restrict4Web
.
getIOLimit
());
account4Web
.
setTrack
(
restrict4Web
.
getTrackTotalFlow
());
account4Web
.
setTrackLimit
(
restrict4Web
.
getTrackLimit
());
account4Web
.
setIoLimit
(
restrict4Web
.
getIOLimit
());
account4Web
.
setIoStatus
(
restrict4Web
.
getAllowBehavior
());
account4Web
.
setTrackLimit
(
restrict4Web
.
getTrackLimit
());
account4Web
.
setTrackStatus
(
restrict4Web
.
getTrackFlowNotified
());
account4Web
.
setIoStatus
(
restrict4Web
.
getAllowBehavior
());
double
f
=
1.0
;
account4Web
.
setTrackStatus
(
restrict4Web
.
getTrackFlowNotified
());
if
((
account4Web
.
getIo
().
doubleValue
()
!=
0
)
&&
(
null
!=
account4Web
.
getIoLimit
())){
double
f
=
1.0
;
if
((
account4Web
.
getIo
().
doubleValue
()
/
account4Web
.
getIoLimit
().
doubleValue
())
>
f
){
if
((
account4Web
.
getIo
().
doubleValue
()
!=
0
)
&&
(
null
!=
account4Web
.
getIoLimit
())){
account4Web
.
setIoStatus
(
false
);
if
((
account4Web
.
getIo
().
doubleValue
()
/
account4Web
.
getIoLimit
().
doubleValue
())
>
f
){
account4Web
.
setStatus
(
"流量用尽"
);
account4Web
.
setIoStatus
(
false
);
account4Web
.
setStatus
(
"流量用尽"
);
}
}
}
}
if
((
account4Web
.
getTrack
().
doubleValue
()
!=
0
)
&&
(
null
!=
account4Web
.
getTrackLimit
())){
if
((
account4Web
.
getTrack
().
doubleValue
()
!=
0
)
&&
(
null
!=
account4Web
.
getTrackLimit
())
){
if
((
account4Web
.
getTrack
().
doubleValue
()
/
account4Web
.
getTrackLimit
().
doubleValue
())
>
f
){
if
((
account4Web
.
getTrack
().
doubleValue
()
/
account4Web
.
getTrackLimit
().
doubleValue
())
>
f
){
account4Web
.
setTrackStatus
(
false
);
account4Web
.
setTrackStatus
(
false
);
account4Web
.
setStatus
(
"流量用尽"
);
account4Web
.
setStatus
(
"流量用尽"
);
}
}
}
}
}
account4Web
.
setUser
(
ac
.
getName
());
account4Web
.
setTell
(
ac
.
getPhone
());
account4Web
.
setBussinessMan
(
ac
.
getBussinessman
());
list
.
add
(
account4Web
);
}
catch
(
Exception
e
){
logger
.
error
(
"tkio task error :"
+
ac
.
getEmail
());
}
}
account4Web
.
setUser
(
ac
.
getName
());
account4Web
.
setTell
(
ac
.
getPhone
());
account4Web
.
setBussinessMan
(
ac
.
getBussinessman
());
list
.
add
(
account4Web
);
}
}
}
}
//已过期的直接设置成过期
//已过期的直接设置成过期
...
@@ -113,5 +123,6 @@ public class AccountTask {
...
@@ -113,5 +123,6 @@ public class AccountTask {
}
}
}
}
account4WebRepository
.
save
(
list
);
account4WebRepository
.
save
(
list
);
logger
.
info
(
"tkio task end :"
+
System
.
currentTimeMillis
());
}
}
}
}
This diff is collapsed.
Click to expand it.
src/main/resources/spring/applicationContext-schedule.xml
View file @
3119ff4e
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<bean
id=
"tkioAccountTask"
class=
"tkio.task.AccountTask"
></bean>
<bean
id=
"tkioAccountTask"
class=
"tkio.task.AccountTask"
></bean>
<task:scheduled-tasks>
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled
ref=
"tkioAccountTask"
method=
"task"
cron=
"0
22
2 * * ?"
/>
<task:scheduled
ref=
"tkioAccountTask"
method=
"task"
cron=
"0
38
2 * * ?"
/>
</task:scheduled-tasks>
</task:scheduled-tasks>
<bean
id=
"tkioNoticeTask"
class=
"tkio.task.NoticeTask"
></bean>
<bean
id=
"tkioNoticeTask"
class=
"tkio.task.NoticeTask"
></bean>
...
...
This diff is collapsed.
Click to expand it.
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