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
873f0c8d
Commit
873f0c8d
authored
May 19, 2020
by
renjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-zrj' into 'staging'
Dev zrj See merge request
!128
parents
b365f7b6
3d35f69e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
AdministratorServiceImpl.java
...ackend/account/service/impl/AdministratorServiceImpl.java
+4
-4
IpResourceRepository.java
...owserbackend/browser/repository/IpResourceRepository.java
+2
-2
BrowserTask.java
...va/com/edgec/browserbackend/browser/task/BrowserTask.java
+8
-3
No files found.
src/main/java/com/edgec/browserbackend/account/service/impl/AdministratorServiceImpl.java
View file @
873f0c8d
...
@@ -382,7 +382,7 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -382,7 +382,7 @@ public class AdministratorServiceImpl implements AdministratorService {
public
IpCountQueryResultDto
queyrIpCount
(
String
username
)
{
public
IpCountQueryResultDto
queyrIpCount
(
String
username
)
{
IpCountQueryResultDto
ipCountQueryResultDto
=
new
IpCountQueryResultDto
();
IpCountQueryResultDto
ipCountQueryResultDto
=
new
IpCountQueryResultDto
();
if
(
StringUtils
.
isBlank
(
username
))
{
if
(
StringUtils
.
isBlank
(
username
))
{
long
ipcount_using
=
ipResourceRepository
.
countAllByIsDeleted
(
false
);
long
ipcount_using
=
ipResourceRepository
.
countAllByIsDeleted
AndValidTimeGreaterThan
(
false
,
Instant
.
now
().
toEpochMilli
()
);
long
ipcount_all
=
ipResourceRepository
.
count
();
long
ipcount_all
=
ipResourceRepository
.
count
();
ipCountQueryResultDto
.
setIpCount_using
(
ipcount_using
);
ipCountQueryResultDto
.
setIpCount_using
(
ipcount_using
);
ipCountQueryResultDto
.
setIpCount_all
(
ipcount_all
);
ipCountQueryResultDto
.
setIpCount_all
(
ipcount_all
);
...
@@ -394,7 +394,7 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -394,7 +394,7 @@ public class AdministratorServiceImpl implements AdministratorService {
ipCountQueryResultDto
.
setIpCount_using
(
ipCountRecord
.
getIp_using
());
ipCountQueryResultDto
.
setIpCount_using
(
ipCountRecord
.
getIp_using
());
}
}
}
else
{
}
else
{
long
ipcount_using
=
ipResourceRepository
.
countAllByOwnerAndIsDeleted
(
username
,
false
);
long
ipcount_using
=
ipResourceRepository
.
countAllByOwnerAndIsDeleted
AndValidTimeGreaterThan
(
username
,
false
,
Instant
.
now
().
toEpochMilli
()
);
long
ipcount_all
=
ipResourceRepository
.
countAllByOwner
(
username
);
long
ipcount_all
=
ipResourceRepository
.
countAllByOwner
(
username
);
ipCountQueryResultDto
.
setIpCount_using
(
ipcount_using
);
ipCountQueryResultDto
.
setIpCount_using
(
ipcount_using
);
ipCountQueryResultDto
.
setIpCount_all
(
ipcount_all
);
ipCountQueryResultDto
.
setIpCount_all
(
ipcount_all
);
...
@@ -453,12 +453,12 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -453,12 +453,12 @@ public class AdministratorServiceImpl implements AdministratorService {
promotion
.
setTotalCommission
(
promotion
.
getTotalCommission
()
+
(
int
)
totalCommission
);
promotion
.
setTotalCommission
(
promotion
.
getTotalCommission
()
+
(
int
)
totalCommission
);
promotion
.
setCommission
(
promotion
.
getCommission
()
+
x
.
getPromotion
().
getCommission
());
promotion
.
setCommission
(
promotion
.
getCommission
()
+
x
.
getPromotion
().
getCommission
());
double
secondCommission
=
0
;
double
secondCommission
=
0
;
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerAndIsDeleted
(
x
.
getName
(),
false
));
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerAndIsDeleted
AndValidTimeGreaterThan
(
x
.
getName
(),
false
,
Instant
.
now
().
toEpochMilli
()
));
if
(
finalAccount
.
getPromotion
().
isSale
()
&&
x
.
getParent
()
==
null
)
{
if
(
finalAccount
.
getPromotion
().
isSale
()
&&
x
.
getParent
()
==
null
)
{
List
<
Account
>
secondPromotes
=
accountRepository
.
findByPromotionCodeAndParentIsNull
(
x
.
getPromotion
().
getCode
());
List
<
Account
>
secondPromotes
=
accountRepository
.
findByPromotionCodeAndParentIsNull
(
x
.
getPromotion
().
getCode
());
if
(
secondPromotes
!=
null
&&
secondPromotes
.
size
()
>
0
)
{
if
(
secondPromotes
!=
null
&&
secondPromotes
.
size
()
>
0
)
{
for
(
Account
secondPromote
:
secondPromotes
)
{
for
(
Account
secondPromote
:
secondPromotes
)
{
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerAndIsDeleted
(
secondPromote
.
getName
(),
false
));
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerAndIsDeleted
AndValidTimeGreaterThan
(
secondPromote
.
getName
(),
false
,
Instant
.
now
().
toEpochMilli
()
));
List
<
UserPrePaidBilling
>
userPrePaidBillings1
=
userPrePaidBillingRepository
.
findByAdministratorAndPayMethodInAndTimestampBetween
(
secondPromote
.
getName
(),
Arrays
.
asList
(
1
,
2
,
3
),
dateTime1
.
getTime
(),
dateTime2
.
getTime
());
List
<
UserPrePaidBilling
>
userPrePaidBillings1
=
userPrePaidBillingRepository
.
findByAdministratorAndPayMethodInAndTimestampBetween
(
secondPromote
.
getName
(),
Arrays
.
asList
(
1
,
2
,
3
),
dateTime1
.
getTime
(),
dateTime2
.
getTime
());
if
(
userPrePaidBillings1
!=
null
&&
userPrePaidBillings1
.
size
()
>
0
)
if
(
userPrePaidBillings1
!=
null
&&
userPrePaidBillings1
.
size
()
>
0
)
secondCommission
+=
userPrePaidBillings1
.
stream
().
mapToDouble
(
UserPrePaidBilling:
:
getTotal
).
sum
();
secondCommission
+=
userPrePaidBillings1
.
stream
().
mapToDouble
(
UserPrePaidBilling:
:
getTotal
).
sum
();
...
...
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepository.java
View file @
873f0c8d
...
@@ -44,8 +44,8 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
...
@@ -44,8 +44,8 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
int
countByStatusAndIdInAndIsDeleted
(
int
status
,
List
<
String
>
ipIds
,
boolean
isDeleted
);
int
countByStatusAndIdInAndIsDeleted
(
int
status
,
List
<
String
>
ipIds
,
boolean
isDeleted
);
long
countAllByIsDeleted
(
boolean
isDeleted
);
long
countAllByIsDeleted
AndValidTimeGreaterThan
(
boolean
isDeleted
,
long
time
);
long
countAllByOwnerAndIsDeleted
(
String
username
,
boolean
isDeleted
);
long
countAllByOwnerAndIsDeleted
AndValidTimeGreaterThan
(
String
username
,
boolean
isDeleted
,
long
time
);
long
countAllByOwner
(
String
username
);
long
countAllByOwner
(
String
username
);
}
}
src/main/java/com/edgec/browserbackend/browser/task/BrowserTask.java
View file @
873f0c8d
...
@@ -25,6 +25,7 @@ import org.slf4j.Logger;
...
@@ -25,6 +25,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.mongodb.core.aggregation.ArrayOperators
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
...
@@ -238,7 +239,11 @@ public class BrowserTask {
...
@@ -238,7 +239,11 @@ public class BrowserTask {
if
(
ipResourceRepository
.
healthLock
(
ipResource
))
{
if
(
ipResourceRepository
.
healthLock
(
ipResource
))
{
try
{
try
{
QueryIpUrlList
queryIpUrlList
=
queryIpUrlListRepository
.
findAll
().
get
(
0
);
QueryIpUrlList
queryIpUrlList
=
queryIpUrlListRepository
.
findAll
().
get
(
0
);
if
(
ipResource
.
isSpecialLine
())
{
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
1
);
ipResourceRepository
.
save
(
ipResource
);
}
else
if
(
ipResource
.
isSpecialLine
())
{
Trans
trans
=
new
Trans
(
ipResource
.
getProxyUsername
(),
ipResource
.
getProxyPassword
());
Trans
trans
=
new
Trans
(
ipResource
.
getProxyUsername
(),
ipResource
.
getProxyPassword
());
String
sp_result
=
trans
.
get
(
queryIpUrlList
.
getUrl
());
String
sp_result
=
trans
.
get
(
queryIpUrlList
.
getUrl
());
int
failTime
=
0
;
int
failTime
=
0
;
...
@@ -296,7 +301,7 @@ public class BrowserTask {
...
@@ -296,7 +301,7 @@ public class BrowserTask {
IpCountRecord
ipCountRecord
=
new
IpCountRecord
();
IpCountRecord
ipCountRecord
=
new
IpCountRecord
();
ipCountRecord
.
setUsername
(
x
.
getName
());
ipCountRecord
.
setUsername
(
x
.
getName
());
ipCountRecord
.
setTimestamp
(
Instant
.
now
().
toEpochMilli
());
ipCountRecord
.
setTimestamp
(
Instant
.
now
().
toEpochMilli
());
long
ipcount_using
=
ipResourceRepository
.
countAllByOwnerAndIsDeleted
(
x
.
getName
(),
false
);
long
ipcount_using
=
ipResourceRepository
.
countAllByOwnerAndIsDeleted
AndValidTimeGreaterThan
(
x
.
getName
(),
false
,
Instant
.
now
().
toEpochMilli
()
);
long
ipcount_all
=
ipResourceRepository
.
countAllByOwner
(
x
.
getName
());
long
ipcount_all
=
ipResourceRepository
.
countAllByOwner
(
x
.
getName
());
ipCountRecord
.
setIp_all
(
ipcount_all
);
ipCountRecord
.
setIp_all
(
ipcount_all
);
ipCountRecord
.
setIp_using
(
ipcount_using
);
ipCountRecord
.
setIp_using
(
ipcount_using
);
...
@@ -305,7 +310,7 @@ public class BrowserTask {
...
@@ -305,7 +310,7 @@ public class BrowserTask {
IpCountRecord
ipCountRecord
=
new
IpCountRecord
();
IpCountRecord
ipCountRecord
=
new
IpCountRecord
();
ipCountRecord
.
setUsername
(
"all"
);
ipCountRecord
.
setUsername
(
"all"
);
ipCountRecord
.
setTimestamp
(
Instant
.
now
().
toEpochMilli
());
ipCountRecord
.
setTimestamp
(
Instant
.
now
().
toEpochMilli
());
long
ipcount_using
=
ipResourceRepository
.
countAllByIsDeleted
(
false
);
long
ipcount_using
=
ipResourceRepository
.
countAllByIsDeleted
AndValidTimeGreaterThan
(
false
,
Instant
.
now
().
toEpochMilli
()
);
long
ipcount_all
=
ipResourceRepository
.
count
();
long
ipcount_all
=
ipResourceRepository
.
count
();
ipCountRecord
.
setIp_using
(
ipcount_using
);
ipCountRecord
.
setIp_using
(
ipcount_using
);
ipCountRecord
.
setIp_all
(
ipcount_all
);
ipCountRecord
.
setIp_all
(
ipcount_all
);
...
...
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