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
54138c3c
Commit
54138c3c
authored
Mar 12, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
付费功能
删除ip修改
parent
ab204c18
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
199 additions
and
76 deletions
+199
-76
IpChargeRequestDto.java
...gec/browserbackend/account/domain/IpChargeRequestDto.java
+11
-1
UserPrePaidBilling.java
...gec/browserbackend/account/domain/UserPrePaidBilling.java
+12
-2
AccountErrorCode.java
...ec/browserbackend/account/exception/AccountErrorCode.java
+4
-2
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+1
-3
IpControlloer.java
...dgec/browserbackend/browser/controller/IpControlloer.java
+18
-5
IpResource.java
...a/com/edgec/browserbackend/browser/domain/IpResource.java
+12
-3
Vendor.java
.../java/com/edgec/browserbackend/browser/domain/Vendor.java
+20
-0
IpResourceDto.java
...a/com/edgec/browserbackend/browser/dto/IpResourceDto.java
+4
-7
IpResourceRequestDto.java
...dgec/browserbackend/browser/dto/IpResourceRequestDto.java
+14
-0
IpResourceRepository.java
...owserbackend/browser/repository/IpResourceRepository.java
+7
-7
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+96
-46
No files found.
src/main/java/com/edgec/browserbackend/account/domain/IpChargeRequestDto.java
View file @
54138c3c
...
@@ -7,8 +7,10 @@ public class IpChargeRequestDto {
...
@@ -7,8 +7,10 @@ public class IpChargeRequestDto {
private
String
unit
=
"month"
;
private
String
unit
=
"month"
;
private
String
target
;
private
String
target
;
//0 --
newip, 1 --renew, 2 --ipkeptfee, 3 --deleteip, 4 -- stopinstanceonly , 5 -- bindinstance, 6 -- refundipkeptfee
//0 --
充值, 1 -- newip, 2 --renew, 3 --ipkeptfee, 4 --deleteip,
private
int
chargeType
=
0
;
private
int
chargeType
=
0
;
//0 -- 余额, 2 -- 支付宝, 3 -- 微信
private
int
payMethod
=
0
;
private
float
daysPerMonth
=
0
;
private
float
daysPerMonth
=
0
;
...
@@ -87,4 +89,12 @@ public class IpChargeRequestDto {
...
@@ -87,4 +89,12 @@ public class IpChargeRequestDto {
public
void
setAmount
(
int
amount
)
{
public
void
setAmount
(
int
amount
)
{
this
.
amount
=
amount
;
this
.
amount
=
amount
;
}
}
public
int
getPayMethod
()
{
return
payMethod
;
}
public
void
setPayMethod
(
int
payMethod
)
{
this
.
payMethod
=
payMethod
;
}
}
}
src/main/java/com/edgec/browserbackend/account/domain/UserPrePaidBilling.java
View file @
54138c3c
...
@@ -35,6 +35,9 @@ public class UserPrePaidBilling {
...
@@ -35,6 +35,9 @@ public class UserPrePaidBilling {
private
BillStatus
status
;
private
BillStatus
status
;
//0 -- 余额, 2 -- 支付宝, 3 -- 微信
private
int
payMethod
;
private
boolean
isPrepaid
;
private
boolean
isPrepaid
;
private
String
user
;
private
String
user
;
...
@@ -46,8 +49,7 @@ public class UserPrePaidBilling {
...
@@ -46,8 +49,7 @@ public class UserPrePaidBilling {
private
float
ownBillingCost
=
0
;
private
float
ownBillingCost
=
0
;
private
float
total
;
private
float
total
;
//0 -- newip, 1 --renew, 2 --ipkeptfee, 3 --deleteip, 4 -- stopinstanceonly , 5 -- bindinstance, 6 -- refundipkeptfee
//0 -- 充值, 1 -- newip, 2 --renew, 3 --ipkeptfee, 4 --deleteip,
//7 -- newcvm , 8 -- renewcvm , 9 -- intelligroup
private
int
chargeType
;
private
int
chargeType
;
private
String
target
;
private
String
target
;
...
@@ -221,4 +223,12 @@ public class UserPrePaidBilling {
...
@@ -221,4 +223,12 @@ public class UserPrePaidBilling {
public
void
setUser
(
String
user
)
{
public
void
setUser
(
String
user
)
{
this
.
user
=
user
;
this
.
user
=
user
;
}
}
public
int
getPayMethod
()
{
return
payMethod
;
}
public
void
setPayMethod
(
int
payMethod
)
{
this
.
payMethod
=
payMethod
;
}
}
}
src/main/java/com/edgec/browserbackend/account/exception/AccountErrorCode.java
View file @
54138c3c
...
@@ -53,8 +53,10 @@ public enum AccountErrorCode implements ErrorCode {
...
@@ -53,8 +53,10 @@ public enum AccountErrorCode implements ErrorCode {
NOPERMISSION
(
ACCOUNT_BASE
+
140
,
"You have no right to do this operarion"
),
NOPERMISSION
(
ACCOUNT_BASE
+
140
,
"You have no right to do this operarion"
),
GROUPMAX
(
ACCOUNT_BASE
+
141
,
"You can not have more groups"
),
GROUPMAX
(
ACCOUNT_BASE
+
141
,
"You can not have more groups"
),
SHOPMAX
(
ACCOUNT_BASE
+
141
,
"You can not have more shops"
),
SHOPMAX
(
ACCOUNT_BASE
+
142
,
"You can not have more shops"
),
CHILDMAX
(
ACCOUNT_BASE
+
141
,
"You can not have more subUsers"
);
CHILDMAX
(
ACCOUNT_BASE
+
143
,
"You can not have more subUsers"
),
NOTENOUGHBALANCE
(
ErrorCode
.
ACCOUNT_BASE
+
150
,
"Your balance is not enough"
);
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
54138c3c
...
@@ -213,21 +213,19 @@ public class AccountServiceImpl implements AccountService {
...
@@ -213,21 +213,19 @@ public class AccountServiceImpl implements AccountService {
userBalanceRepository
.
incrementBalance
(
userBalance
,
-(
float
)
money
,
(
float
)
money
);
userBalanceRepository
.
incrementBalance
(
userBalance
,
-(
float
)
money
,
(
float
)
money
);
userBalance
=
userBalanceRepository
.
findById
(
name
).
orElse
(
null
);
userBalance
=
userBalanceRepository
.
findById
(
name
).
orElse
(
null
);
charge
.
setBalance
(
Math
.
round
(
userBalance
.
getBalanced
()));
charge
.
setBalance
(
Math
.
round
(
userBalance
.
getBalanced
()));
charge
.
setSuccess
(
true
);
charge
.
setSuccess
(
true
);
UserPrePaidBilling
bill
=
new
UserPrePaidBilling
();
UserPrePaidBilling
bill
=
new
UserPrePaidBilling
();
bill
.
setChargeType
(
requestDto
.
getChargeType
());
bill
.
setChargeType
(
requestDto
.
getChargeType
());
bill
.
setServices
(
Services
.
valueOf
(
requestDto
.
getServices
()));
bill
.
setAmount
(
requestDto
.
getAmount
());
bill
.
setAmount
(
requestDto
.
getAmount
());
bill
.
setUnit
(
requestDto
.
getUnit
());
bill
.
setUnit
(
requestDto
.
getUnit
());
bill
.
setPeriod
(
requestDto
.
getPeriod
());
bill
.
setPeriod
(
requestDto
.
getPeriod
());
bill
.
setPayMethod
(
requestDto
.
getPayMethod
());
bill
.
setUsername
(
name
);
bill
.
setUsername
(
name
);
bill
.
setTotal
((
float
)
money
);
bill
.
setTotal
((
float
)
money
);
bill
.
setStatus
(
BillStatus
.
PAID
);
bill
.
setStatus
(
BillStatus
.
PAID
);
bill
.
setPrepaid
(
true
);
bill
.
setPrepaid
(
true
);
bill
.
setUsername
(
name
);
bill
.
setTimestamp
(
Instant
.
now
().
toEpochMilli
());
bill
.
setTimestamp
(
Instant
.
now
().
toEpochMilli
());
...
...
src/main/java/com/edgec/browserbackend/browser/controller/IpControlloer.java
View file @
54138c3c
...
@@ -3,6 +3,7 @@ package com.edgec.browserbackend.browser.controller;
...
@@ -3,6 +3,7 @@ package com.edgec.browserbackend.browser.controller;
import
com.edgec.browserbackend.account.dto.ResultDto
;
import
com.edgec.browserbackend.account.dto.ResultDto
;
import
com.edgec.browserbackend.browser.dto.*
;
import
com.edgec.browserbackend.browser.dto.*
;
import
com.edgec.browserbackend.browser.service.IpResourceService
;
import
com.edgec.browserbackend.browser.service.IpResourceService
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -28,7 +29,13 @@ public class IpControlloer {
...
@@ -28,7 +29,13 @@ public class IpControlloer {
List
<
IpResourceDto
>
ipResourceDto
=
ipResourceService
.
buyIp
(
principal
.
getName
(),
ipResourceRequestDto
);
List
<
IpResourceDto
>
ipResourceDto
=
ipResourceService
.
buyIp
(
principal
.
getName
(),
ipResourceRequestDto
);
resultDto
.
setData
(
ipResourceDto
);
resultDto
.
setData
(
ipResourceDto
);
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
Exception
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"message"
,
e
.
getMessage
());
resultDto
.
setStatusInfo
(
statusInfo
);
}
catch
(
Exception
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
80001
);
statusInfo
.
put
(
"code"
,
80001
);
...
@@ -44,7 +51,13 @@ public class IpControlloer {
...
@@ -44,7 +51,13 @@ public class IpControlloer {
try
{
try
{
resultDto
.
setData
(
ipResourceService
.
renewIp
(
principal
.
getName
(),
ipResourceRequestDto
));
resultDto
.
setData
(
ipResourceService
.
renewIp
(
principal
.
getName
(),
ipResourceRequestDto
));
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
Exception
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"message"
,
e
.
getMessage
());
resultDto
.
setStatusInfo
(
statusInfo
);
}
catch
(
Exception
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
80001
);
statusInfo
.
put
(
"code"
,
80001
);
...
@@ -60,7 +73,7 @@ public class IpControlloer {
...
@@ -60,7 +73,7 @@ public class IpControlloer {
try
{
try
{
resultDto
.
setData
(
ipResourceService
.
deleteIp
(
principal
.
getName
(),
ipResourceRequestDto
.
getAddr
()));
resultDto
.
setData
(
ipResourceService
.
deleteIp
(
principal
.
getName
(),
ipResourceRequestDto
.
getAddr
()));
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
80001
);
statusInfo
.
put
(
"code"
,
80001
);
...
@@ -78,10 +91,10 @@ public class IpControlloer {
...
@@ -78,10 +91,10 @@ public class IpControlloer {
ipListRequestDto
.
getAmount
(),
ipListRequestDto
.
getIpFilterDto
());
ipListRequestDto
.
getAmount
(),
ipListRequestDto
.
getIpFilterDto
());
resultDto
.
setData
(
ipResourceDto
);
resultDto
.
setData
(
ipResourceDto
);
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
Exception
e
)
{
}
catch
(
ClientRequest
Exception
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
80001
);
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
()
);
statusInfo
.
put
(
"message"
,
e
.
getMessage
());
statusInfo
.
put
(
"message"
,
e
.
getMessage
());
resultDto
.
setStatusInfo
(
statusInfo
);
resultDto
.
setStatusInfo
(
statusInfo
);
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/domain/IpResource.java
View file @
54138c3c
...
@@ -15,8 +15,9 @@ public class IpResource {
...
@@ -15,8 +15,9 @@ public class IpResource {
private
String
id
;
private
String
id
;
private
String
addr
;
private
String
addr
;
private
IpType
ipType
=
IpType
.
VENDOR
;
private
IpType
ipType
=
IpType
.
VENDOR
;
private
String
vendor
;
private
Vendor
vendor
;
private
String
region
;
private
String
region
;
private
String
regionCn
;
//0:正常, 1:已过期, 2:即将过期
//0:正常, 1:已过期, 2:即将过期
private
int
status
;
private
int
status
;
private
List
<
String
>
port
;
private
List
<
String
>
port
;
...
@@ -57,6 +58,14 @@ public class IpResource {
...
@@ -57,6 +58,14 @@ public class IpResource {
this
.
region
=
region
;
this
.
region
=
region
;
}
}
public
String
getRegionCn
()
{
return
regionCn
;
}
public
void
setRegionCn
(
String
regionCn
)
{
this
.
regionCn
=
regionCn
;
}
public
int
getStatus
()
{
public
int
getStatus
()
{
return
status
;
return
status
;
}
}
...
@@ -105,11 +114,11 @@ public class IpResource {
...
@@ -105,11 +114,11 @@ public class IpResource {
this
.
addr
=
ipAddr
;
this
.
addr
=
ipAddr
;
}
}
public
String
getVendor
()
{
public
Vendor
getVendor
()
{
return
vendor
;
return
vendor
;
}
}
public
void
setVendor
(
String
vendor
)
{
public
void
setVendor
(
Vendor
vendor
)
{
this
.
vendor
=
vendor
;
this
.
vendor
=
vendor
;
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/domain/Vendor.java
0 → 100644
View file @
54138c3c
package
com
.
edgec
.
browserbackend
.
browser
.
domain
;
/**
* @Desc
* @Author jason
* @CreateTime 2020/3/12 4:01 下午
**/
public
enum
Vendor
{
aliyun
(
"阿里云"
),
JDCLOUD
(
"京东云"
),
aws
(
"亚马逊云"
),
awscn
(
"亚马逊中国"
),
tencent
(
"腾讯云"
);
private
String
value
;
private
Vendor
(
String
value
)
{
this
.
value
=
value
;
}
public
String
getValue
()
{
return
value
;
}
}
src/main/java/com/edgec/browserbackend/browser/dto/IpResourceDto.java
View file @
54138c3c
package
com
.
edgec
.
browserbackend
.
browser
.
dto
;
package
com
.
edgec
.
browserbackend
.
browser
.
dto
;
import
com.edgec.browserbackend.browser.domain.IpResource
;
import
com.edgec.browserbackend.browser.domain.*
;
import
com.edgec.browserbackend.browser.domain.IpStatus
;
import
com.edgec.browserbackend.browser.domain.IpType
;
import
com.edgec.browserbackend.browser.domain.Shop
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
java.util.List
;
import
java.util.List
;
...
@@ -12,7 +9,7 @@ import java.util.List;
...
@@ -12,7 +9,7 @@ import java.util.List;
public
class
IpResourceDto
{
public
class
IpResourceDto
{
private
String
id
;
private
String
id
;
private
String
addr
;
private
String
addr
;
private
String
vendor
;
private
Vendor
vendor
;
private
String
region
;
private
String
region
;
private
int
status
;
private
int
status
;
private
List
<
String
>
port
;
private
List
<
String
>
port
;
...
@@ -67,11 +64,11 @@ public class IpResourceDto {
...
@@ -67,11 +64,11 @@ public class IpResourceDto {
this
.
region
=
region
;
this
.
region
=
region
;
}
}
public
String
getVendor
()
{
public
Vendor
getVendor
()
{
return
vendor
;
return
vendor
;
}
}
public
void
setVendor
(
String
vendor
)
{
public
void
setVendor
(
Vendor
vendor
)
{
this
.
vendor
=
vendor
;
this
.
vendor
=
vendor
;
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/dto/IpResourceRequestDto.java
View file @
54138c3c
...
@@ -2,6 +2,8 @@ package com.edgec.browserbackend.browser.dto;
...
@@ -2,6 +2,8 @@ package com.edgec.browserbackend.browser.dto;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.Min
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -9,8 +11,12 @@ import java.util.List;
...
@@ -9,8 +11,12 @@ import java.util.List;
public
class
IpResourceRequestDto
{
public
class
IpResourceRequestDto
{
private
String
name
;
private
String
name
;
private
String
region
;
private
String
region
;
private
String
regionCn
;
private
String
vendor
=
"aliyun"
;
private
String
vendor
=
"aliyun"
;
private
String
logintype
=
"password"
;
private
String
logintype
=
"password"
;
@Max
(
12
)
@Min
(
1
)
private
int
period
=
1
;
private
int
period
=
1
;
private
String
unit
=
"month"
;
private
String
unit
=
"month"
;
private
int
amount
=
1
;
private
int
amount
=
1
;
...
@@ -83,6 +89,14 @@ public class IpResourceRequestDto {
...
@@ -83,6 +89,14 @@ public class IpResourceRequestDto {
this
.
region
=
region
;
this
.
region
=
region
;
}
}
public
String
getRegionCn
()
{
return
regionCn
;
}
public
void
setAutorenew
(
boolean
autorenew
)
{
this
.
autorenew
=
autorenew
;
}
public
int
getIpkeptperiod
()
{
public
int
getIpkeptperiod
()
{
return
ipkeptperiod
;
return
ipkeptperiod
;
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepository.java
View file @
54138c3c
...
@@ -10,11 +10,11 @@ import java.util.List;
...
@@ -10,11 +10,11 @@ import java.util.List;
public
interface
IpResourceRepository
extends
MongoRepository
<
IpResource
,
String
>
{
public
interface
IpResourceRepository
extends
MongoRepository
<
IpResource
,
String
>
{
IpResource
findByAddrAndIsDeleted
(
String
addr
,
boolean
isDeleted
);
IpResource
findByAddrAndIsDeleted
(
String
addr
,
boolean
isDeleted
);
List
<
IpResource
>
findByIdIn
(
List
<
String
>
ipIds
);
List
<
IpResource
>
findByIdIn
AndIsDeleted
(
List
<
String
>
ipIds
,
boolean
isDeleted
);
List
<
IpResource
>
findByOwnerAnd
ShopIdIsNull
(
String
owner
);
List
<
IpResource
>
findByOwnerAnd
IsDeletedAndShopIdIsNull
(
String
owner
,
boolean
isDeleted
);
List
<
IpResource
>
findByOwnerAndStatusAnd
ShopIdIsNull
(
String
owner
,
int
status
);
List
<
IpResource
>
findByOwnerAndStatusAnd
IsDeletedAndShopIdIsNull
(
String
owner
,
int
status
,
boolean
isDeleted
);
List
<
IpResource
>
findByStatusAndIdIn
(
int
status
,
List
<
String
>
ipIds
);
List
<
IpResource
>
findByStatusAndIdIn
AndIsDeleted
(
int
status
,
List
<
String
>
ipIds
,
boolean
isDeleted
);
Page
<
IpResource
>
findByAddrLikeAndIdIn
(
String
addr
,
List
<
String
>
ipIds
,
Pageable
pageable
);
Page
<
IpResource
>
findByAddrLikeAndIdIn
AndIsDeleted
(
String
addr
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findByVendorLikeAndIdIn
(
String
vendor
,
List
<
String
>
ipIds
,
Pageable
pageable
);
Page
<
IpResource
>
findByVendorLikeAndIdIn
AndIsDeleted
(
String
vendor
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findByRegionLikeAndIdIn
(
String
region
,
List
<
String
>
ipIds
,
Pageable
pageable
);
Page
<
IpResource
>
findByRegionLikeAndIdIn
AndIsDeleted
(
String
region
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
}
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
54138c3c
...
@@ -3,6 +3,10 @@ package com.edgec.browserbackend.browser.service.Impl;
...
@@ -3,6 +3,10 @@ package com.edgec.browserbackend.browser.service.Impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.edgec.browserbackend.account.domain.Account
;
import
com.edgec.browserbackend.account.domain.Account
;
import
com.edgec.browserbackend.account.domain.IpChargeRequestDto
;
import
com.edgec.browserbackend.account.domain.IpChargeResultDto
;
import
com.edgec.browserbackend.account.dto.CvmChargeRegion
;
import
com.edgec.browserbackend.account.dto.ResultDto
;
import
com.edgec.browserbackend.account.exception.AccountErrorCode
;
import
com.edgec.browserbackend.account.exception.AccountErrorCode
;
import
com.edgec.browserbackend.account.repository.AccountRepository
;
import
com.edgec.browserbackend.account.repository.AccountRepository
;
import
com.edgec.browserbackend.account.service.AccountService
;
import
com.edgec.browserbackend.account.service.AccountService
;
...
@@ -12,6 +16,8 @@ import com.edgec.browserbackend.browser.dto.*;
...
@@ -12,6 +16,8 @@ import com.edgec.browserbackend.browser.dto.*;
import
com.edgec.browserbackend.browser.repository.*
;
import
com.edgec.browserbackend.browser.repository.*
;
import
com.edgec.browserbackend.browser.service.IpResourceService
;
import
com.edgec.browserbackend.browser.service.IpResourceService
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.commons.error.ErrorCode
;
import
com.edgec.browserbackend.common.dto.Result
;
import
com.edgec.browserbackend.common.utils.FileUtil
;
import
com.edgec.browserbackend.common.utils.FileUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -25,9 +31,12 @@ import org.springframework.http.*;
...
@@ -25,9 +31,12 @@ import org.springframework.http.*;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
javax.swing.text.Document
;
import
java.io.File
;
import
java.io.File
;
import
java.text.MessageFormat
;
import
java.time.Instant
;
import
java.time.Instant
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -89,6 +98,17 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -89,6 +98,17 @@ public class IpResourceServiceImpl implements IpResourceService {
return
sb
.
toString
();
return
sb
.
toString
();
}
}
private
IpChargeRequestDto
buildIpChargeRequestDto
(
IpResourceRequestDto
request
,
int
chargeType
)
{
IpChargeRequestDto
ipChargeRequestDto
=
new
IpChargeRequestDto
();
ipChargeRequestDto
.
setAmount
(
request
.
getAmount
());
ipChargeRequestDto
.
setChargeType
(
chargeType
);
ipChargeRequestDto
.
setRegion
(
request
.
getRegion
());
ipChargeRequestDto
.
setPeriod
(
request
.
getPeriod
());
ipChargeRequestDto
.
setUnit
(
request
.
getUnit
());
ipChargeRequestDto
.
setPayMethod
(
0
);
return
ipChargeRequestDto
;
}
@Override
@Override
public
List
<
IpResourceDto
>
buyIp
(
String
username
,
IpResourceRequestDto
ipResourceRequestDto
)
throws
Exception
{
public
List
<
IpResourceDto
>
buyIp
(
String
username
,
IpResourceRequestDto
ipResourceRequestDto
)
throws
Exception
{
Account
account
=
accountRepository
.
findByName
(
username
);
Account
account
=
accountRepository
.
findByName
(
username
);
...
@@ -96,9 +116,21 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -96,9 +116,21 @@ public class IpResourceServiceImpl implements IpResourceService {
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
if
(
account
.
getPermission
()
<
8
)
if
(
account
.
getPermission
()
<
8
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
//todo 预扣费
Map
<
String
,
List
<
String
>>
priceList
=
ipOptionsRepository
.
findAll
().
get
(
0
).
getIpPlatForm
();
if
(
ipResourceRequestDto
.
getRegionCn
()
==
null
)
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
List
<
String
>
vendorPrices
=
priceList
.
get
(
ipResourceRequestDto
.
getRegionCn
());
String
price
=
vendorPrices
.
stream
()
.
filter
(
x
->
Vendor
.
valueOf
(
ipResourceRequestDto
.
getVendor
()).
getValue
().
equals
(
x
.
substring
(
0
,
x
.
indexOf
(
"-"
))))
.
map
(
x
->
x
.
substring
(
x
.
lastIndexOf
(
"-"
)
+
1
)).
collect
(
Collectors
.
joining
());
IpChargeResultDto
ipChargeResultDto
=
accountService
.
preChargeByMoney
(
username
,
Double
.
valueOf
(
price
));
if
(!
ipChargeResultDto
.
isSuccess
())
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NOTENOUGHBALANCE
);
}
List
<
IpResourceDto
>
ipResourceDtos
=
new
ArrayList
<>();
List
<
IpResourceDto
>
ipResourceDtos
=
new
ArrayList
<>();
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
header
=
buildPostHeader
();
HttpHeaders
header
=
buildPostHeader
();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
...
@@ -145,12 +177,13 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -145,12 +177,13 @@ public class IpResourceServiceImpl implements IpResourceService {
else
if
(
ipResourceRequestDto
.
getUnit
().
equals
(
"week"
))
else
if
(
ipResourceRequestDto
.
getUnit
().
equals
(
"week"
))
ipResource
.
setValidTime
(
Instant
.
now
().
plusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
());
ipResource
.
setValidTime
(
Instant
.
now
().
plusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
());
ipResource
.
setPort
(
port
);
ipResource
.
setPort
(
port
);
ipResource
.
setVendor
(
ipResourceRequestDto
.
getVendor
(
));
ipResource
.
setVendor
(
Vendor
.
valueOf
(
ipResourceRequestDto
.
getVendor
()
));
ipResource
.
setStatus
(
0
);
ipResource
.
setStatus
(
0
);
ipResource
.
setUsername
(
USERNAME
);
ipResource
.
setUsername
(
USERNAME
);
if
(
account
.
getParent
()
!=
null
)
if
(
account
.
getParent
()
!=
null
)
ipResource
.
setUserParent
(
account
.
getParent
());
ipResource
.
setUserParent
(
account
.
getParent
());
ipResource
.
setRegion
(
ipResourceRequestDto
.
getRegion
());
ipResource
.
setRegion
(
ipResourceRequestDto
.
getRegion
());
ipResource
.
setRegionCn
(
ipResourceRequestDto
.
getRegionCn
());
ipResource
.
setProtocol
(
protocol
);
ipResource
.
setProtocol
(
protocol
);
ipResource
.
setPassword
(
password
);
ipResource
.
setPassword
(
password
);
ipResource
.
setOwner
(
username
);
ipResource
.
setOwner
(
username
);
...
@@ -164,55 +197,70 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -164,55 +197,70 @@ public class IpResourceServiceImpl implements IpResourceService {
logger
.
error
(
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
());
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
}
}
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
0
);
accountService
.
chargeByMoney
(
username
,
Double
.
valueOf
(
price
),
ipChargeRequestDto
);
return
ipResourceDtos
;
return
ipResourceDtos
;
}
}
@Override
@Override
public
IpOperationResultDto
renewIp
(
String
username
,
IpResourceRequestDto
ipResourceRequestDto
)
throws
Exception
{
public
IpOperationResultDto
renewIp
(
String
username
,
IpResourceRequestDto
ipResourceRequestDto
)
{
Account
account
=
accountRepository
.
findByName
(
username
);
Account
account
=
accountRepository
.
findByName
(
username
);
if
(
account
==
null
)
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
ipResourceRequestDto
.
getAddr
().
forEach
(
x
->
{
IpResource
ipResource
=
ipResourceRepository
.
findByAddrAndIsDeleted
(
x
,
false
);
List
<
String
>
failedList
=
ipResourceRequestDto
.
getAddr
();
if
(
ipResource
==
null
)
throw
new
ClientRequestException
(
BrowserErrorCode
.
IPNOTEXIST
);
Map
<
String
,
List
<
String
>>
priceList
=
ipOptionsRepository
.
findAll
().
get
(
0
).
getIpPlatForm
();
if
(
ipResource
.
getShopId
()
!=
null
)
{
UserShop
userShop
=
userShopRepository
.
findByUsernameAndShopId
(
username
,
ipResource
.
getShopId
());
double
totalprice
=
ipResourceRequestDto
.
getAddr
().
stream
().
map
(
x
->
ipResourceRepository
.
findByAddrAndIsDeleted
(
x
,
false
)).
map
(
ipResource
->
priceList
.
get
(
ipResource
.
getRegionCn
())).
map
(
vendorPrices
->
vendorPrices
.
stream
()
if
(
userShop
==
null
)
.
filter
(
vendorprice
->
Vendor
.
valueOf
(
ipResourceRequestDto
.
getVendor
()).
getValue
().
equals
(
vendorprice
.
substring
(
0
,
vendorprice
.
indexOf
(
"-"
))))
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
.
map
(
vendorprice
->
vendorprice
.
substring
(
vendorprice
.
lastIndexOf
(
"-"
)
+
1
)).
collect
(
Collectors
.
joining
())).
mapToDouble
(
Double:
:
valueOf
).
sum
();
}
else
if
(!
ipResource
.
getOwner
().
equals
(
username
))
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
IpChargeResultDto
ipChargeResultDto
=
accountService
.
preChargeByMoney
(
username
,
Double
.
valueOf
(
totalprice
));
}
if
(!
ipChargeResultDto
.
isSuccess
())
{
});
throw
new
ClientRequestException
(
AccountErrorCode
.
NOTENOUGHBALANCE
);
//todo 预扣费
}
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"iplist"
,
ipResourceRequestDto
.
getAddr
());
map
.
put
(
"iplist"
,
ipResourceRequestDto
.
getAddr
());
map
.
put
(
"period"
,
ipResourceRequestDto
.
getPeriod
());
map
.
put
(
"period"
,
ipResourceRequestDto
.
getPeriod
());
HttpHeaders
headers
=
buildPostHeader
();
HttpHeaders
headers
=
buildPostHeader
();
HttpEntity
<
Map
<
String
,
Object
>>
entity
=
new
HttpEntity
<>(
map
,
headers
);
HttpEntity
<
Map
<
String
,
Object
>>
entity
=
new
HttpEntity
<>(
map
,
headers
);
try
{
ResponseEntity
<
String
>
result
=
restTemplate
.
exchange
(
TESTURL
+
"/intelligroup/renewip?accountId=browser"
,
HttpMethod
.
PUT
,
entity
,
String
.
class
);
ResponseEntity
<
String
>
result
=
restTemplate
.
exchange
(
TESTURL
+
"/intelligroup/renewip?accountId=browser"
,
HttpMethod
.
PUT
,
entity
,
String
.
class
);
RenewIpResultDto
renewIpResultDto
=
JSON
.
parseObject
(
result
.
getBody
(),
RenewIpResultDto
.
class
);
RenewIpResultDto
renewIpResultDto
=
JSON
.
parseObject
(
result
.
getBody
(),
RenewIpResultDto
.
class
);
if
(
StringUtils
.
isNotBlank
(
renewIpResultDto
.
getErrorCode
()))
{
if
(
StringUtils
.
isNotBlank
(
renewIpResultDto
.
getErrorCode
()))
logger
.
error
(
renewIpResultDto
.
getErrorCode
());
throw
new
Exception
(
renewIpResultDto
.
getErrorCode
());
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
IpOperationResultDto
ipOperationResultDto
=
new
IpOperationResultDto
();
renewIpResultDto
.
getIplist
().
forEach
(
x
->
{
IpResource
ipResource
=
ipResourceRepository
.
findByAddrAndIsDeleted
(
x
.
getIp
(),
false
);
ipResource
.
setValidTime
(
Instant
.
parse
(
x
.
getValidTill
()).
toEpochMilli
());
ipResourceRepository
.
save
(
ipResource
);
ipOperationResultDto
.
getSuccessList
().
add
(
x
.
getIp
());
});
return
ipOperationResultDto
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"fail to renew ip"
,
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
());
throw
new
Exception
(
e
.
getMessage
());
}
}
IpOperationResultDto
ipOperationResultDto
=
new
IpOperationResultDto
();
renewIpResultDto
.
getIplist
().
forEach
(
x
->
{
IpResource
ipResource
=
ipResourceRepository
.
findByAddrAndIsDeleted
(
x
.
getIp
(),
false
);
List
<
String
>
vendorPrices
=
priceList
.
get
(
ipResource
.
getRegionCn
());
String
price
=
vendorPrices
.
stream
()
.
filter
(
vendorprice
->
Vendor
.
valueOf
(
ipResourceRequestDto
.
getVendor
()).
getValue
().
equals
(
vendorprice
.
substring
(
0
,
vendorprice
.
indexOf
(
"-"
))))
.
map
(
vendorprice
->
vendorprice
.
substring
(
vendorprice
.
lastIndexOf
(
"-"
)
+
1
)).
collect
(
Collectors
.
joining
());
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
0
);
accountService
.
chargeByMoney
(
username
,
Double
.
valueOf
(
price
),
ipChargeRequestDto
);
ipResource
.
setValidTime
(
Instant
.
parse
(
x
.
getValidTill
()).
toEpochMilli
());
ipResourceRepository
.
save
(
ipResource
);
ipOperationResultDto
.
getSuccessList
().
add
(
x
.
getIp
());
failedList
.
remove
(
x
.
getIp
());
});
ipOperationResultDto
.
setFailList
(
failedList
);
return
ipOperationResultDto
;
}
}
@Override
@Override
public
IpOperationResultDto
deleteIp
(
String
username
,
List
<
String
>
ipAddrs
)
throws
Exception
{
public
IpOperationResultDto
deleteIp
(
String
username
,
List
<
String
>
ipAddrs
)
{
Account
account
=
accountRepository
.
findByName
(
username
);
Account
account
=
accountRepository
.
findByName
(
username
);
if
(
account
==
null
)
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
...
@@ -231,6 +279,7 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -231,6 +279,7 @@ public class IpResourceServiceImpl implements IpResourceService {
return
;
return
;
}
}
}
else
if
(!
ipResource
.
getOwner
().
equals
(
username
))
{
}
else
if
(!
ipResource
.
getOwner
().
equals
(
username
))
{
ipOperationResultDto
.
getFailList
().
add
(
ipAddr
);
return
;
return
;
}
}
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
...
@@ -242,7 +291,8 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -242,7 +291,8 @@ public class IpResourceServiceImpl implements IpResourceService {
DeleteIpResultDto
deleteIpResultDto
=
JSON
.
parseObject
(
result
.
getBody
(),
DeleteIpResultDto
.
class
);
DeleteIpResultDto
deleteIpResultDto
=
JSON
.
parseObject
(
result
.
getBody
(),
DeleteIpResultDto
.
class
);
if
(
StringUtils
.
isNotBlank
(
deleteIpResultDto
.
getErrorCode
()))
if
(
StringUtils
.
isNotBlank
(
deleteIpResultDto
.
getErrorCode
()))
throw
new
Exception
(
deleteIpResultDto
.
getErrorCode
());
throw
new
Exception
(
deleteIpResultDto
.
getErrorCode
());
ipResourceRepository
.
delete
(
ipResource
);
ipResource
.
setDeleted
(
true
);
ipResourceRepository
.
save
(
ipResource
);
if
(
userShop
!=
null
){
if
(
userShop
!=
null
){
Shop
shop
=
shopRepository
.
findById
(
ipResource
.
getShopId
()).
orElse
(
null
);
Shop
shop
=
shopRepository
.
findById
(
ipResource
.
getShopId
()).
orElse
(
null
);
if
(
shop
!=
null
)
{
if
(
shop
!=
null
)
{
...
@@ -258,7 +308,7 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -258,7 +308,7 @@ public class IpResourceServiceImpl implements IpResourceService {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"fail to renew ip"
,
e
.
getMessage
());
logger
.
error
(
"fail to renew ip"
,
e
.
getMessage
());
ipOperationResultDto
.
getFailList
().
add
(
ipAddr
);
ipOperationResultDto
.
getFailList
().
add
(
ipAddr
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
)
;
return
;
}
}
});
});
return
ipOperationResultDto
;
return
ipOperationResultDto
;
...
@@ -280,19 +330,19 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -280,19 +330,19 @@ public class IpResourceServiceImpl implements IpResourceService {
List
<
IpResource
>
notUsed
=
null
;
List
<
IpResource
>
notUsed
=
null
;
switch
(
groupType
)
{
switch
(
groupType
)
{
case
1
:
case
1
:
ipResources
=
ipResourceRepository
.
findByIdIn
(
ipIds
);;
ipResources
=
ipResourceRepository
.
findByIdIn
AndIsDeleted
(
ipIds
,
false
);;
notUsed
=
ipResourceRepository
.
findByOwnerAnd
ShopIdIsNull
(
usernam
e
);
notUsed
=
ipResourceRepository
.
findByOwnerAnd
IsDeletedAndShopIdIsNull
(
username
,
fals
e
);
break
;
break
;
case
2
:
case
2
:
ipResources
=
ipResourceRepository
.
findByStatusAndIdIn
(
2
,
ipIds
);
ipResources
=
ipResourceRepository
.
findByStatusAndIdIn
AndIsDeleted
(
2
,
ipIds
,
false
);
notUsed
=
ipResourceRepository
.
findByOwnerAndStatusAnd
ShopIdIsNull
(
username
,
2
);
notUsed
=
ipResourceRepository
.
findByOwnerAndStatusAnd
IsDeletedAndShopIdIsNull
(
username
,
2
,
false
);
break
;
break
;
case
3
:
case
3
:
ipResources
=
ipResourceRepository
.
findByStatusAndIdIn
(
1
,
ipIds
);
ipResources
=
ipResourceRepository
.
findByStatusAndIdIn
AndIsDeleted
(
1
,
ipIds
,
false
);
notUsed
=
ipResourceRepository
.
findByOwnerAndStatusAnd
ShopIdIsNull
(
username
,
1
);
notUsed
=
ipResourceRepository
.
findByOwnerAndStatusAnd
IsDeletedAndShopIdIsNull
(
username
,
1
,
false
);
break
;
break
;
case
4
:
case
4
:
notUsed
=
ipResourceRepository
.
findByOwnerAnd
ShopIdIsNull
(
usernam
e
);
notUsed
=
ipResourceRepository
.
findByOwnerAnd
IsDeletedAndShopIdIsNull
(
username
,
fals
e
);
break
;
break
;
}
}
if
(
notUsed
!=
null
)
if
(
notUsed
!=
null
)
...
@@ -300,7 +350,7 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -300,7 +350,7 @@ public class IpResourceServiceImpl implements IpResourceService {
List
<
IpResourceDto
>
ipResourceDtos
=
new
ArrayList
<>();
List
<
IpResourceDto
>
ipResourceDtos
=
new
ArrayList
<>();
List
<
String
>
allIpIds
=
ipResources
.
stream
().
map
(
x
->
x
.
getId
()).
collect
(
Collectors
.
toList
());
List
<
String
>
allIpIds
=
ipResources
.
stream
().
map
(
x
->
x
.
getId
()).
collect
(
Collectors
.
toList
());
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getRegion
()))
{
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getRegion
()))
{
Page
<
IpResource
>
ipResources1
=
ipResourceRepository
.
findByRegionLikeAndIdIn
(
ipFilterDto
.
getRegion
(),
allIpIds
,
pageable
);
Page
<
IpResource
>
ipResources1
=
ipResourceRepository
.
findByRegionLikeAndIdIn
AndIsDeleted
(
ipFilterDto
.
getRegion
(),
allIpIds
,
false
,
pageable
);
ipResources1
.
getContent
().
forEach
(
x
->
{
ipResources1
.
getContent
().
forEach
(
x
->
{
ShopDto
shopDto
;
ShopDto
shopDto
;
if
(
x
.
getShopId
()
==
null
)
{
if
(
x
.
getShopId
()
==
null
)
{
...
@@ -316,7 +366,7 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -316,7 +366,7 @@ public class IpResourceServiceImpl implements IpResourceService {
});
});
}
}
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getAddr
()))
{
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getAddr
()))
{
Page
<
IpResource
>
ipResources1
=
ipResourceRepository
.
findByAddrLikeAndIdIn
(
ipFilterDto
.
getAddr
(),
allIpIds
,
pageable
);
Page
<
IpResource
>
ipResources1
=
ipResourceRepository
.
findByAddrLikeAndIdIn
AndIsDeleted
(
ipFilterDto
.
getAddr
(),
allIpIds
,
false
,
pageable
);
ipResources1
.
getContent
().
forEach
(
x
->
{
ipResources1
.
getContent
().
forEach
(
x
->
{
ShopDto
shopDto
;
ShopDto
shopDto
;
if
(
x
.
getShopId
()
==
null
)
{
if
(
x
.
getShopId
()
==
null
)
{
...
@@ -332,7 +382,7 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -332,7 +382,7 @@ public class IpResourceServiceImpl implements IpResourceService {
});
});
}
}
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getVendor
()))
{
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getVendor
()))
{
Page
<
IpResource
>
ipResources1
=
ipResourceRepository
.
findByVendorLikeAndIdIn
(
ipFilterDto
.
getVendor
(),
allIpIds
,
pageable
);
Page
<
IpResource
>
ipResources1
=
ipResourceRepository
.
findByVendorLikeAndIdIn
AndIsDeleted
(
ipFilterDto
.
getVendor
(),
allIpIds
,
false
,
pageable
);
ipResources1
.
getContent
().
forEach
(
x
->
{
ipResources1
.
getContent
().
forEach
(
x
->
{
ShopDto
shopDto
;
ShopDto
shopDto
;
if
(
x
.
getShopId
()
==
null
)
{
if
(
x
.
getShopId
()
==
null
)
{
...
...
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