Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
Project
Project
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
Administrator
browser-backend
Commits
ea975173
Commit
ea975173
authored
Aug 26, 2020
by
xuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将已经过期的ip 的 isDeleted 状态设置为 true
parent
db62d2f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
4 deletions
+13
-4
IpResourceRepositoryCustom.java
...ackend/browser/repository/IpResourceRepositoryCustom.java
+1
-1
IpResourceRepositoryCustomImpl.java
...nd/browser/repository/IpResourceRepositoryCustomImpl.java
+8
-2
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+2
-1
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+1
-0
PromotionTask.java
.../com/edgec/browserbackend/browser/task/PromotionTask.java
+1
-0
No files found.
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepositoryCustom.java
View file @
ea975173
...
@@ -25,7 +25,7 @@ public interface IpResourceRepositoryCustom {
...
@@ -25,7 +25,7 @@ public interface IpResourceRepositoryCustom {
boolean
deleteShopId
(
String
ipId
,
String
shopId
,
BindHistory
bindHistory
);
boolean
deleteShopId
(
String
ipId
,
String
shopId
,
BindHistory
bindHistory
);
boolean
updateStatus
(
String
id
,
int
status
);
boolean
updateStatus
(
String
id
,
int
status
,
Object
...
args
);
boolean
updateBind
(
String
id
,
boolean
isbind
);
boolean
updateBind
(
String
id
,
boolean
isbind
);
...
...
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepositoryCustomImpl.java
View file @
ea975173
...
@@ -131,10 +131,16 @@ public class IpResourceRepositoryCustomImpl implements IpResourceRepositoryCusto
...
@@ -131,10 +131,16 @@ public class IpResourceRepositoryCustomImpl implements IpResourceRepositoryCusto
}
}
@Override
@Override
public
boolean
updateStatus
(
String
id
,
int
status
)
{
public
boolean
updateStatus
(
String
id
,
int
status
,
Object
...
args
)
{
Document
doc
=
new
Document
();
Document
doc
=
new
Document
();
BasicQuery
basicQuery
=
new
BasicQuery
(
doc
);
BasicQuery
basicQuery
=
new
BasicQuery
(
doc
);
basicQuery
.
addCriteria
(
where
(
"id"
).
is
(
id
).
and
(
"isDeleted"
).
is
(
false
));
if
(
args
.
length
==
0
)
{
basicQuery
.
addCriteria
(
where
(
"id"
).
is
(
id
).
and
(
"isDeleted"
).
is
(
false
));
}
if
(
args
.
length
==
1
)
{
basicQuery
.
addCriteria
(
where
(
"id"
).
is
(
id
).
and
(
"isDeleted"
).
is
(
true
));
}
Update
update
=
new
Update
();
Update
update
=
new
Update
();
update
.
set
(
"status"
,
status
);
update
.
set
(
"status"
,
status
);
UpdateResult
result
=
mongoTemplate
.
updateFirst
(
basicQuery
,
update
,
IpResource
.
class
);
UpdateResult
result
=
mongoTemplate
.
updateFirst
(
basicQuery
,
update
,
IpResource
.
class
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
ea975173
...
@@ -693,7 +693,8 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -693,7 +693,8 @@ public class IpResourceServiceImpl implements IpResourceService {
// 1.4 ip资源到期,且 ip 资源的状态不是 3(正在分配)、6(未分配),则设置 ip 资源的状态为 1(已过期)
// 1.4 ip资源到期,且 ip 资源的状态不是 3(正在分配)、6(未分配),则设置 ip 资源的状态为 1(已过期)
}
else
if
(
x
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
x
.
getStatus
()
!=
3
&&
x
.
getStatus
()
!=
6
)
{
}
else
if
(
x
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
x
.
getStatus
()
!=
3
&&
x
.
getStatus
()
!=
6
)
{
ipResourceRepository
.
updateStatus
(
x
.
getId
(),
1
);
// 这个地方可变参数随便传啥都行
ipResourceRepository
.
updateStatus
(
x
.
getId
(),
1
,
true
);
// 1.5 其他
// 1.5 其他
}
else
{
}
else
{
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
ea975173
...
@@ -489,6 +489,7 @@ public class ShopServiceImpl implements ShopService {
...
@@ -489,6 +489,7 @@ public class ShopServiceImpl implements ShopService {
// 3. ip资源到期,且 ip 资源的状态不是 3(正在分配)、6(未分配),则设置 ip 资源的状态为 1(已过期)
// 3. ip资源到期,且 ip 资源的状态不是 3(正在分配)、6(未分配),则设置 ip 资源的状态为 1(已过期)
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
1
);
ipResource
.
setStatus
(
1
);
ipResource
.
setDeleted
(
true
);
ipResourceRepository
.
save
(
ipResource
);
ipResourceRepository
.
save
(
ipResource
);
// 4. 其他,将ip资源状态设置为 未使用
// 4. 其他,将ip资源状态设置为 未使用
...
...
src/main/java/com/edgec/browserbackend/browser/task/PromotionTask.java
View file @
ea975173
...
@@ -87,6 +87,7 @@ public class PromotionTask {
...
@@ -87,6 +87,7 @@ public class PromotionTask {
log
.
info
(
"End scheduled task:Scheduled.countGift..."
);
log
.
info
(
"End scheduled task:Scheduled.countGift..."
);
}
}
// @SchedulerLock:标识使用分布式锁。name:用来标注一个定时服务的名字,被用于写入数据库作为区分不同服务的标识
@SchedulerLock
(
name
=
"countCommission"
,
lockAtLeastForString
=
"PT1H"
,
lockAtMostForString
=
"PT2H"
)
@SchedulerLock
(
name
=
"countCommission"
,
lockAtLeastForString
=
"PT1H"
,
lockAtMostForString
=
"PT2H"
)
@Scheduled
(
cron
=
"0 0 3 * * ?"
)
@Scheduled
(
cron
=
"0 0 3 * * ?"
)
public
void
countCommission
()
{
public
void
countCommission
()
{
...
...
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