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
8e4adb6c
Commit
8e4adb6c
authored
Apr 23, 2018
by
manxiaoqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2
parent
cea61169
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
0 deletions
+104
-0
workspace.xml
.idea/workspace.xml
+0
-0
AccountRepository.java
src/main/java/tkio/repository/AccountRepository.java
+3
-0
AccountCheck.java
src/main/java/tkio/task/AccountCheck.java
+43
-0
IOAccountRepository.java
src/main/java/userio/repository/IOAccountRepository.java
+3
-0
IOAccountCheck.java
src/main/java/userio/task/IOAccountCheck.java
+43
-0
applicationContext-schedule.xml
src/main/resources/spring/applicationContext-schedule.xml
+12
-0
No files found.
.idea/workspace.xml
View file @
8e4adb6c
This diff is collapsed.
Click to expand it.
src/main/java/tkio/repository/AccountRepository.java
View file @
8e4adb6c
...
@@ -16,6 +16,9 @@ public interface AccountRepository extends JpaRepository<Account, Long> {
...
@@ -16,6 +16,9 @@ public interface AccountRepository extends JpaRepository<Account, Long> {
@Query
(
value
=
"select root_parent from account where id=?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"select root_parent from account where id=?1"
,
nativeQuery
=
true
)
BigInteger
findRootParentByAccountId
(
Long
accountId
);
BigInteger
findRootParentByAccountId
(
Long
accountId
);
@Query
(
value
=
"SELECT * from account where is_super_user is true and `status` = 1 and DATE_FORMAT(pub_date,'%Y-%m-%d') = ?1"
,
nativeQuery
=
true
)
List
<
Account
>
findRootParentsByPubDate
(
String
date
);
@Query
(
value
=
"SELECT * from account where is_super_user is true and `status` = 1 and past_date > ?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"SELECT * from account where is_super_user is true and `status` = 1 and past_date > ?1"
,
nativeQuery
=
true
)
List
<
Account
>
findRootParentsUnPast
(
String
today
);
List
<
Account
>
findRootParentsUnPast
(
String
today
);
...
...
src/main/java/tkio/task/AccountCheck.java
0 → 100644
View file @
8e4adb6c
package
tkio
.
task
;
import
common.model.Contract
;
import
common.repository.ContractRepository
;
import
dic.ContractTypeEnum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
tkio.model.Account
;
import
tkio.repository.AccountRepository
;
import
util.DateUtil
;
import
util.ValidateUtil
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by mxq on 2018/4/23.
*/
public
class
AccountCheck
{
@Autowired
AccountRepository
accountRepository
;
@Autowired
ContractRepository
contractRepository
;
public
void
task
(){
List
<
Account
>
accountList
=
accountRepository
.
findRootParentsByPubDate
(
DateUtil
.
getBeforeDays
(
30
));
if
(
ValidateUtil
.
isValid
(
accountList
)){
List
<
Account
>
list
=
new
ArrayList
<>();
for
(
Account
a:
accountList
){
List
<
Contract
>
contractList
=
contractRepository
.
findByPlatformAndEmail
(
"tkio"
,
a
.
getEmail
(),
ContractTypeEnum
.
MAIN
.
getKey
());
if
(
null
==
contractList
){
a
.
setStatus
(
0
);
list
.
add
(
a
);
}
if
(
ValidateUtil
.
isValid
(
list
)){
accountRepository
.
save
(
list
);
}
}
}
}
}
src/main/java/userio/repository/IOAccountRepository.java
View file @
8e4adb6c
...
@@ -22,6 +22,9 @@ public interface IOAccountRepository extends JpaRepository<Account, Long> {
...
@@ -22,6 +22,9 @@ public interface IOAccountRepository extends JpaRepository<Account, Long> {
@Query
(
value
=
"SELECT * from account where is_super_user is true and `status` = 1 and past_date < ?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"SELECT * from account where is_super_user is true and `status` = 1 and past_date < ?1"
,
nativeQuery
=
true
)
List
<
Account
>
findRootParentsPast
(
String
today
);
List
<
Account
>
findRootParentsPast
(
String
today
);
@Query
(
value
=
"SELECT * from account where is_super_user is true and `status` = 1 and DATE_FORMAT(pub_date,'%Y-%m-%d') = ?1"
,
nativeQuery
=
true
)
List
<
Account
>
findRootParentsByPubDate
(
String
date
);
@Query
(
value
=
"SELECT * from account where is_super_user is true and `status` = 0"
,
nativeQuery
=
true
)
@Query
(
value
=
"SELECT * from account where is_super_user is true and `status` = 0"
,
nativeQuery
=
true
)
List
<
Account
>
findRootParentsForidin
();
List
<
Account
>
findRootParentsForidin
();
...
...
src/main/java/userio/task/IOAccountCheck.java
0 → 100644
View file @
8e4adb6c
package
userio
.
task
;
import
common.model.Contract
;
import
common.repository.ContractRepository
;
import
dic.ContractTypeEnum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
userio.model.Account
;
import
userio.repository.IOAccountRepository
;
import
util.DateUtil
;
import
util.ValidateUtil
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by mxq on 2018/4/23.
*/
public
class
IOAccountCheck
{
@Autowired
IOAccountRepository
accountRepository
;
@Autowired
ContractRepository
contractRepository
;
public
void
task
(){
List
<
Account
>
accountList
=
accountRepository
.
findRootParentsByPubDate
(
DateUtil
.
getBeforeDays
(
30
));
if
(
ValidateUtil
.
isValid
(
accountList
)){
List
<
Account
>
list
=
new
ArrayList
<>();
for
(
Account
a:
accountList
){
List
<
Contract
>
contractList
=
contractRepository
.
findByPlatformAndEmail
(
"io"
,
a
.
getEmail
(),
ContractTypeEnum
.
MAIN
.
getKey
());
if
(
null
==
contractList
){
a
.
setStatus
(
0
);
list
.
add
(
a
);
}
if
(
ValidateUtil
.
isValid
(
list
)){
accountRepository
.
save
(
list
);
}
}
}
}
}
src/main/resources/spring/applicationContext-schedule.xml
View file @
8e4adb6c
...
@@ -51,4 +51,16 @@
...
@@ -51,4 +51,16 @@
<task:scheduled
ref=
"ioAccountTask"
method=
"task"
cron=
"0 10 10 * * ?"
/>
<task:scheduled
ref=
"ioAccountTask"
method=
"task"
cron=
"0 10 10 * * ?"
/>
</task:scheduled-tasks>
</task:scheduled-tasks>
<bean
id=
"ioAccountTaskCheck"
class=
"userio.task.IOAccountCheck"
></bean>
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled
ref=
"ioAccountTaskCheck"
method=
"task"
cron=
"0 10 10 * * ?"
/>
</task:scheduled-tasks>
<bean
id=
"accountTaskCheck"
class=
"tkio.task.AccountCheck"
></bean>
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled
ref=
"accountTaskCheck"
method=
"task"
cron=
"0 10 10 * * ?"
/>
</task:scheduled-tasks>
</beans>
</beans>
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