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
d3e5d284
Commit
d3e5d284
authored
Jul 10, 2020
by
xuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
手动专线回落
parent
12206673
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
8 deletions
+40
-8
TempController.java
...gec/browserbackend/browser/controller/TempController.java
+12
-4
IpResourceRepositoryCustomImpl.java
...nd/browser/repository/IpResourceRepositoryCustomImpl.java
+6
-4
TempServiceImpl.java
.../browserbackend/browser/service/Impl/TempServiceImpl.java
+20
-0
TempService.java
...com/edgec/browserbackend/browser/service/TempService.java
+2
-0
No files found.
src/main/java/com/edgec/browserbackend/browser/controller/TempController.java
View file @
d3e5d284
...
@@ -3,10 +3,7 @@ package com.edgec.browserbackend.browser.controller;
...
@@ -3,10 +3,7 @@ package com.edgec.browserbackend.browser.controller;
import
com.edgec.browserbackend.browser.domain.UserCode
;
import
com.edgec.browserbackend.browser.domain.UserCode
;
import
com.edgec.browserbackend.browser.service.TempService
;
import
com.edgec.browserbackend.browser.service.TempService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
* 一些临时执行的代码可以放在这里,方便删除
* 一些临时执行的代码可以放在这里,方便删除
...
@@ -18,8 +15,19 @@ public class TempController {
...
@@ -18,8 +15,19 @@ public class TempController {
@Autowired
@Autowired
private
TempService
tempService
;
private
TempService
tempService
;
/**
* 记住用户明文密码
*/
@PostMapping
(
value
=
"/usercode"
)
@PostMapping
(
value
=
"/usercode"
)
public
void
addUserCode
(
@RequestBody
UserCode
userCode
)
{
public
void
addUserCode
(
@RequestBody
UserCode
userCode
)
{
tempService
.
save
(
userCode
);
tempService
.
save
(
userCode
);
}
}
/**
* 专线回落
*/
@PutMapping
(
value
=
"/updateip/{addr}/{flag}"
)
public
void
updateIp
(
@PathVariable
String
addr
,
@PathVariable
String
flag
)
{
tempService
.
saveIpResource
(
addr
,
flag
);
}
}
}
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepositoryCustomImpl.java
View file @
d3e5d284
...
@@ -66,8 +66,10 @@ public class IpResourceRepositoryCustomImpl implements IpResourceRepositoryCusto
...
@@ -66,8 +66,10 @@ public class IpResourceRepositoryCustomImpl implements IpResourceRepositoryCusto
@Override
@Override
public
List
<
IpResource
>
sampleTasks
(
int
status
,
long
timestamp
)
{
public
List
<
IpResource
>
sampleTasks
(
int
status
,
long
timestamp
)
{
Criteria
matchCriteria
=
new
Criteria
();
Criteria
matchCriteria
=
new
Criteria
();
matchCriteria
.
orOperator
(
where
(
"status"
).
is
(
status
).
and
(
"isLocked"
).
is
(
false
).
and
(
"isDeleted"
).
is
(
false
),
matchCriteria
.
orOperator
(
where
(
"status"
).
is
(
status
).
and
(
"isLocked"
).
is
(
true
).
and
(
"lockTimestamp"
).
lte
(
timestamp
).
and
(
"isDeleted"
).
is
(
false
));
where
(
"status"
).
is
(
status
).
and
(
"isLocked"
).
is
(
false
).
and
(
"isDeleted"
).
is
(
false
),
where
(
"status"
).
is
(
status
).
and
(
"isLocked"
).
is
(
true
).
and
(
"lockTimestamp"
).
lte
(
timestamp
).
and
(
"isDeleted"
).
is
(
false
)
);
MatchOperation
match
=
Aggregation
.
match
(
matchCriteria
);
MatchOperation
match
=
Aggregation
.
match
(
matchCriteria
);
...
@@ -82,8 +84,8 @@ public class IpResourceRepositoryCustomImpl implements IpResourceRepositoryCusto
...
@@ -82,8 +84,8 @@ public class IpResourceRepositoryCustomImpl implements IpResourceRepositoryCusto
public
List
<
IpResource
>
sampleTasks
(
List
<
Integer
>
status
)
{
public
List
<
IpResource
>
sampleTasks
(
List
<
Integer
>
status
)
{
Criteria
matchCriteria
=
new
Criteria
();
Criteria
matchCriteria
=
new
Criteria
();
matchCriteria
.
orOperator
(
matchCriteria
.
orOperator
(
where
(
"status"
).
in
(
status
).
and
(
"isLocked"
).
is
(
false
).
and
(
"
validTime"
).
gt
(
Instant
.
now
().
toEpochMilli
()).
and
(
"isDeleted"
).
is
(
false
).
and
(
"healthLockTimestamp"
).
lte
(
Instant
.
now
().
minusSeconds
(
60
*
30
).
toEpochMilli
()),
where
(
"status"
).
in
(
status
).
and
(
"isLocked"
).
is
(
false
).
and
(
"
isDeleted"
).
is
(
false
).
and
(
"healthLockTimestamp"
).
lte
(
Instant
.
now
().
minusSeconds
(
60
*
30
).
toEpochMilli
()).
and
(
"validTime"
).
gt
(
Instant
.
now
(
).
toEpochMilli
()),
where
(
"status"
).
in
(
status
).
and
(
"isLocked"
).
is
(
true
).
and
(
"
healthLockTimestamp"
).
lte
(
Instant
.
now
().
minusSeconds
(
600
).
toEpochMilli
()).
and
(
"isDeleted"
).
is
(
false
)
where
(
"status"
).
in
(
status
).
and
(
"isLocked"
).
is
(
true
).
and
(
"
isDeleted"
).
is
(
false
).
and
(
"healthLockTimestamp"
).
lte
(
Instant
.
now
().
minusSeconds
(
60
*
10
).
toEpochMilli
()
)
);
);
MatchOperation
match
=
Aggregation
.
match
(
matchCriteria
);
MatchOperation
match
=
Aggregation
.
match
(
matchCriteria
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/TempServiceImpl.java
View file @
d3e5d284
package
com
.
edgec
.
browserbackend
.
browser
.
service
.
Impl
;
package
com
.
edgec
.
browserbackend
.
browser
.
service
.
Impl
;
import
com.edgec.browserbackend.browser.domain.IpResource
;
import
com.edgec.browserbackend.browser.domain.UserCode
;
import
com.edgec.browserbackend.browser.domain.UserCode
;
import
com.edgec.browserbackend.browser.repository.IpResourceRepository
;
import
com.edgec.browserbackend.browser.repository.UserCodeRepository
;
import
com.edgec.browserbackend.browser.repository.UserCodeRepository
;
import
com.edgec.browserbackend.browser.service.TempService
;
import
com.edgec.browserbackend.browser.service.TempService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -14,8 +16,26 @@ public class TempServiceImpl implements TempService {
...
@@ -14,8 +16,26 @@ public class TempServiceImpl implements TempService {
@Autowired
@Autowired
private
UserCodeRepository
userCodeRepository
;
private
UserCodeRepository
userCodeRepository
;
@Autowired
private
IpResourceRepository
ipResourceRepository
;
@Override
@Override
public
void
save
(
UserCode
userCode
)
{
public
void
save
(
UserCode
userCode
)
{
userCodeRepository
.
save
(
userCode
);
userCodeRepository
.
save
(
userCode
);
}
}
@Override
public
void
saveIpResource
(
String
addr
,
String
flag
)
{
IpResource
ipResource
=
ipResourceRepository
.
findByAddr
(
addr
);
if
(
"true"
.
equals
(
flag
))
{
ipResource
.
setSpecialLine
(
true
);
}
if
(
"false"
.
equals
(
flag
))
{
ipResource
.
setSpecialLine
(
false
);
}
ipResourceRepository
.
save
(
ipResource
);
}
}
}
src/main/java/com/edgec/browserbackend/browser/service/TempService.java
View file @
d3e5d284
...
@@ -7,4 +7,6 @@ import com.edgec.browserbackend.browser.domain.UserCode;
...
@@ -7,4 +7,6 @@ import com.edgec.browserbackend.browser.domain.UserCode;
*/
*/
public
interface
TempService
{
public
interface
TempService
{
void
save
(
UserCode
userCode
);
void
save
(
UserCode
userCode
);
void
saveIpResource
(
String
addr
,
String
flag
);
}
}
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