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
2436758d
Commit
2436758d
authored
May 15, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
店铺ip续费不更新bug
parent
7ff109d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
74 deletions
+45
-74
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+0
-74
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+45
-0
No files found.
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
2436758d
...
...
@@ -398,44 +398,7 @@ public class IpResourceServiceImpl implements IpResourceService {
accountService
.
chargeByMoney
(
username
,
newprice1
*
ipResourceRequestDto
.
getPeriod
()
*
ipResourceRequestDto
.
getAmount
(),
ipChargeRequestDto
);
ipResource
.
setValidTime
(
Instant
.
parse
(
x
.
getValidTill
()).
toEpochMilli
());
if
(
StringUtils
.
isNotBlank
(
ipResource
.
getAddr
()))
{
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
plusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getValidTime
()
>
Instant
.
now
().
toEpochMilli
())
{
if
(
ipResource
.
getStatus
()
!=
5
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
2
);
ipResourceRepository
.
save
(
ipResource
);
}
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
minusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
if
(
ipResource
.
getIpType
()
==
IpType
.
VENDOR
)
{
IpResourceRequestDto
ipResourceRequestDto1
=
new
IpResourceRequestDto
();
ipResourceRequestDto1
.
setAddr
(
Arrays
.
asList
(
ipResource
.
getAddr
()));
try
{
deleteIp
(
username
,
ipResourceRequestDto1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
else
{
IpResourceRequestDto
ipResourceRequestDto1
=
new
IpResourceRequestDto
();
ipResourceRequestDto1
.
setIpId
(
Arrays
.
asList
(
ipResource
.
getId
()));
try
{
deleteIp
(
username
,
ipResourceRequestDto1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
return
;
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
1
);
ipResourceRepository
.
save
(
ipResource
);
}
else
{
if
((
ipResource
.
getStatus
()
==
0
||
ipResource
.
getStatus
()
==
1
||
ipResource
.
getStatus
()
==
2
)
&&
ipResource
.
getVendor
()
!=
Vendor
.
local
)
{
ipResource
.
setStatus
(
0
);
ipResourceRepository
.
save
(
ipResource
);
}
else
if
(
ipResource
.
getIpType
().
equals
(
IpType
.
LOCAL
)
&&
(
ipResource
.
getStatus
()
==
1
||
ipResource
.
getStatus
()
==
2
)
&&
ipResource
.
getAddr
().
equals
(
"本地Ip未使用"
))
{
ipResource
.
setStatus
(
4
);
ipResourceRepository
.
save
(
ipResource
);
}
}
}
ipOperationResultDto
.
getSuccessList
().
add
(
x
.
getIp
());
failedList
.
remove
(
x
.
getIp
());
...
...
@@ -472,44 +435,7 @@ public class IpResourceServiceImpl implements IpResourceService {
ipResource
.
setValidTime
(
Instant
.
ofEpochMilli
(
ipResource
.
getValidTime
()).
atZone
(
ZoneOffset
.
UTC
)
.
plusMonths
(
finalPeriod
).
toInstant
().
toEpochMilli
());
}
if
(
StringUtils
.
isNotBlank
(
ipResource
.
getAddr
()))
{
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
plusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getValidTime
()
>
Instant
.
now
().
toEpochMilli
())
{
if
(
ipResource
.
getStatus
()
!=
5
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
2
);
ipResourceRepository
.
save
(
ipResource
);
}
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
minusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
if
(
ipResource
.
getIpType
()
==
IpType
.
VENDOR
)
{
IpResourceRequestDto
ipResourceRequestDto1
=
new
IpResourceRequestDto
();
ipResourceRequestDto1
.
setAddr
(
Arrays
.
asList
(
ipResource
.
getAddr
()));
try
{
deleteIp
(
username
,
ipResourceRequestDto1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
else
{
IpResourceRequestDto
ipResourceRequestDto1
=
new
IpResourceRequestDto
();
ipResourceRequestDto1
.
setIpId
(
Arrays
.
asList
(
ipResource
.
getId
()));
try
{
deleteIp
(
username
,
ipResourceRequestDto1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
return
;
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
1
);
ipResourceRepository
.
save
(
ipResource
);
}
else
{
if
((
ipResource
.
getStatus
()
==
0
||
ipResource
.
getStatus
()
==
1
||
ipResource
.
getStatus
()
==
2
)
&&
ipResource
.
getVendor
()
!=
Vendor
.
local
)
{
ipResource
.
setStatus
(
0
);
ipResourceRepository
.
save
(
ipResource
);
}
else
if
(
ipResource
.
getIpType
().
equals
(
IpType
.
LOCAL
)
&&
(
ipResource
.
getStatus
()
==
1
||
ipResource
.
getStatus
()
==
2
)
&&
ipResource
.
getAddr
().
equals
(
"本地Ip未使用"
))
{
ipResource
.
setStatus
(
4
);
ipResourceRepository
.
save
(
ipResource
);
}
}
}
ipOperationResultDto
.
getSuccessList
().
add
(
x
);
failedList
.
remove
(
x
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
2436758d
...
...
@@ -9,6 +9,7 @@ import com.edgec.browserbackend.browser.domain.*;
import
com.edgec.browserbackend.browser.dto.*
;
import
com.edgec.browserbackend.browser.repository.*
;
import
com.edgec.browserbackend.browser.service.IpAndShopService
;
import
com.edgec.browserbackend.browser.service.IpResourceService
;
import
com.edgec.browserbackend.browser.service.ShopService
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.utils.FileUtil
;
...
...
@@ -34,6 +35,7 @@ import java.time.ZoneId;
import
java.time.ZonedDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -61,6 +63,9 @@ public class ShopServiceImpl implements ShopService {
@Autowired
IpAndShopService
ipAndShopService
;
@Autowired
IpResourceService
ipResourceService
;
@Autowired
SpecialLineRepository
specialLineRepository
;
...
...
@@ -418,6 +423,46 @@ public class ShopServiceImpl implements ShopService {
List
<
ShopResultDto
>
shopResultDtos
=
new
ArrayList
<>();
shops
.
getContent
().
stream
().
forEach
(
x
->
{
IpResource
ipResource
=
ipResourceRepository
.
findFirstByShopIdAndIsDeleted
(
x
.
getShopId
(),
false
);
if
(
ipResource
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
ipResource
.
getAddr
()))
{
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
plusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getValidTime
()
>
Instant
.
now
().
toEpochMilli
())
{
if
(
ipResource
.
getStatus
()
!=
5
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
2
);
ipResourceRepository
.
save
(
ipResource
);
}
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
minusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
if
(
ipResource
.
getIpType
()
==
IpType
.
VENDOR
)
{
IpResourceRequestDto
ipResourceRequestDto1
=
new
IpResourceRequestDto
();
ipResourceRequestDto1
.
setAddr
(
Arrays
.
asList
(
ipResource
.
getAddr
()));
try
{
ipResourceService
.
deleteIp
(
username
,
ipResourceRequestDto1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
else
{
IpResourceRequestDto
ipResourceRequestDto1
=
new
IpResourceRequestDto
();
ipResourceRequestDto1
.
setIpId
(
Arrays
.
asList
(
ipResource
.
getId
()));
try
{
ipResourceService
.
deleteIp
(
username
,
ipResourceRequestDto1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
return
;
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
1
);
ipResourceRepository
.
save
(
ipResource
);
}
else
{
if
((
ipResource
.
getStatus
()
==
0
||
ipResource
.
getStatus
()
==
1
||
ipResource
.
getStatus
()
==
2
)
&&
ipResource
.
getVendor
()
!=
Vendor
.
local
)
{
ipResource
.
setStatus
(
0
);
ipResourceRepository
.
save
(
ipResource
);
}
else
if
(
ipResource
.
getIpType
().
equals
(
IpType
.
LOCAL
)
&&
(
ipResource
.
getStatus
()
==
1
||
ipResource
.
getStatus
()
==
2
)
&&
ipResource
.
getAddr
().
equals
(
"本地Ip未使用"
))
{
ipResource
.
setStatus
(
4
);
ipResourceRepository
.
save
(
ipResource
);
}
}
}
}
if
(
ipResource
==
null
)
ipResource
=
new
IpResource
();
String
group1
=
userShopRepository
.
findByUsernameAndShopId
(
username
,
x
.
getShopId
()).
getGroupId
();
...
...
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