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
3dbb5ad4
Commit
3dbb5ad4
authored
Jun 28, 2020
by
xuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
费用明细增加 chargeIp 字段
parent
e06f4648
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
233 additions
and
374 deletions
+233
-374
IpChargeRequestDto.java
...gec/browserbackend/account/domain/IpChargeRequestDto.java
+8
-78
IpChargeResultDto.java
...dgec/browserbackend/account/domain/IpChargeResultDto.java
+11
-23
UserBalance.java
.../com/edgec/browserbackend/account/domain/UserBalance.java
+10
-24
UserPrePaidBilling.java
...gec/browserbackend/account/domain/UserPrePaidBilling.java
+9
-156
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+93
-65
IpResource.java
...a/com/edgec/browserbackend/browser/domain/IpResource.java
+93
-6
IpType.java
.../java/com/edgec/browserbackend/browser/domain/IpType.java
+1
-1
IpOperationResultDto.java
...dgec/browserbackend/browser/dto/IpOperationResultDto.java
+5
-19
IpResourceRequestDto.java
...dgec/browserbackend/browser/dto/IpResourceRequestDto.java
+3
-2
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+0
-0
No files found.
src/main/java/com/edgec/browserbackend/account/domain/IpChargeRequestDto.java
View file @
3dbb5ad4
package
com
.
edgec
.
browserbackend
.
account
.
domain
;
package
com
.
edgec
.
browserbackend
.
account
.
domain
;
import
lombok.Data
;
@Data
public
class
IpChargeRequestDto
{
public
class
IpChargeRequestDto
{
private
int
period
;
private
int
period
;
private
int
amount
;
private
int
amount
;
private
String
region
;
private
String
region
;
private
String
unit
=
"month"
;
private
String
unit
=
"month"
;
private
String
target
;
private
String
target
;
//0 -- 充值, 1 -- newip, 2 --renew, 3 -- 退还
//0 -- 充值, 1 -- newip, 2 --renew, 3 -- 退还
...
@@ -18,83 +21,10 @@ public class IpChargeRequestDto {
...
@@ -18,83 +21,10 @@ public class IpChargeRequestDto {
private
String
services
;
private
String
services
;
public
String
getServices
()
{
/**
return
services
;
* 续费ip
}
*/
private
String
chargeIp
;
public
void
setServices
(
String
services
)
{
this
.
services
=
services
;
}
public
String
getTradeNo
()
{
return
tradeNo
;
}
public
void
setTradeNo
(
String
tradeNo
)
{
this
.
tradeNo
=
tradeNo
;
}
public
float
getDaysPerMonth
()
{
return
daysPerMonth
;
}
public
void
setDaysPerMonth
(
float
daysPerMonth
)
{
this
.
daysPerMonth
=
daysPerMonth
;
}
public
String
getTarget
()
{
return
target
;
}
public
void
setTarget
(
String
target
)
{
this
.
target
=
target
;
}
public
int
getChargeType
()
{
return
chargeType
;
}
public
void
setChargeType
(
int
chargeType
)
{
this
.
chargeType
=
chargeType
;
}
public
String
getUnit
()
{
return
unit
;
}
public
void
setUnit
(
String
unit
)
{
this
.
unit
=
unit
;
}
public
String
getRegion
()
{
return
region
;
}
public
void
setRegion
(
String
region
)
{
this
.
region
=
region
;
}
public
int
getPeriod
()
{
return
period
;
}
public
void
setPeriod
(
int
period
)
{
this
.
period
=
period
;
}
public
int
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
int
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/IpChargeResultDto.java
View file @
3dbb5ad4
package
com
.
edgec
.
browserbackend
.
account
.
domain
;
package
com
.
edgec
.
browserbackend
.
account
.
domain
;
import
lombok.Data
;
@Data
public
class
IpChargeResultDto
{
public
class
IpChargeResultDto
{
/**
* 充值状态
*/
private
boolean
success
;
private
boolean
success
;
private
int
balance
;
private
int
approvedAmount
;
public
boolean
isSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
private
int
balance
;
this
.
success
=
success
;
}
public
int
getBalance
()
{
return
balance
;
}
public
void
setBalance
(
int
balance
)
{
this
.
balance
=
balance
;
}
public
int
getApprovedAmount
()
{
/**
return
approvedAmount
;
* 到账金额
}
*/
private
int
approvedAmount
;
public
void
setApprovedAmount
(
int
approvedAmount
)
{
this
.
approvedAmount
=
approvedAmount
;
}
}
}
src/main/java/com/edgec/browserbackend/account/domain/UserBalance.java
View file @
3dbb5ad4
...
@@ -2,41 +2,27 @@ package com.edgec.browserbackend.account.domain;
...
@@ -2,41 +2,27 @@ package com.edgec.browserbackend.account.domain;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.data.mongodb.core.mapping.Document
;
@Getter
@Setter
@Document
(
collection
=
"userbalance"
)
@Document
(
collection
=
"userbalance"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
UserBalance
{
public
class
UserBalance
{
/**
* 用户手机号
*/
@Id
@Id
private
String
username
;
private
String
username
;
/**
* 账户余额
*/
private
float
balanced
;
private
float
balanced
;
private
float
used
;
private
float
used
;
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
float
getBalanced
()
{
return
balanced
;
}
public
void
setBalanced
(
float
balanced
)
{
this
.
balanced
=
balanced
;
}
public
float
getUsed
()
{
return
used
;
}
public
void
setUsed
(
float
used
)
{
this
.
used
=
used
;
}
}
}
src/main/java/com/edgec/browserbackend/account/domain/UserPrePaidBilling.java
View file @
3dbb5ad4
package
com
.
edgec
.
browserbackend
.
account
.
domain
;
package
com
.
edgec
.
browserbackend
.
account
.
domain
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
org.apache.commons.lang3.StringUtils
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.index.CompoundIndex
;
import
org.springframework.data.mongodb.core.index.CompoundIndex
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.data.mongodb.core.mapping.Document
;
...
@@ -9,6 +10,8 @@ import org.springframework.data.mongodb.core.mapping.Document;
...
@@ -9,6 +10,8 @@ import org.springframework.data.mongodb.core.mapping.Document;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
@Getter
@Setter
@Document
(
collection
=
"userprepaidbilling"
)
@Document
(
collection
=
"userprepaidbilling"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@CompoundIndex
(
name
=
"idx_username_timestamp"
,
def
=
"{'username': 1, 'timestamp': 1}"
)
@CompoundIndex
(
name
=
"idx_username_timestamp"
,
def
=
"{'username': 1, 'timestamp': 1}"
)
...
@@ -52,161 +55,11 @@ public class UserPrePaidBilling {
...
@@ -52,161 +55,11 @@ public class UserPrePaidBilling {
private
float
balanced
;
private
float
balanced
;
private
List
<
DeductionRecord
>
deductionRecords
=
new
ArrayList
<>();
/**
* 购买或者续费的ip 号
public
float
getRate
()
{
*/
return
rate
;
private
String
chargeIp
;
}
public
float
getTotal
()
{
return
total
;
}
public
void
setRate
(
float
rate
)
{
this
.
rate
=
rate
;
}
public
void
setTotal
(
float
total
)
{
this
.
total
=
total
;
}
public
int
getChargeType
()
{
return
chargeType
;
}
public
void
setChargeType
(
int
chargeType
)
{
this
.
chargeType
=
chargeType
;
}
public
String
getUnit
()
{
return
unit
;
}
public
void
setUnit
(
String
unit
)
{
this
.
unit
=
unit
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
int
getYear
()
{
return
year
;
}
public
void
setYear
(
int
year
)
{
this
.
year
=
year
;
}
public
int
getMonth
()
{
return
month
;
}
public
void
setMonth
(
int
month
)
{
this
.
month
=
month
;
}
public
long
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
long
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
public
Services
getServices
()
{
return
services
;
}
public
void
setServices
(
Services
services
)
{
private
List
<
DeductionRecord
>
deductionRecords
=
new
ArrayList
<>();
this
.
services
=
services
;
}
public
BillStatus
getStatus
()
{
return
status
;
}
public
void
setStatus
(
BillStatus
status
)
{
this
.
status
=
status
;
}
public
boolean
isPrepaid
()
{
return
isPrepaid
;
}
public
void
setPrepaid
(
boolean
prepaid
)
{
this
.
isPrepaid
=
prepaid
;
}
public
List
<
DeductionRecord
>
getDeductionRecords
()
{
return
deductionRecords
;
}
public
void
setDeductionRecords
(
List
<
DeductionRecord
>
deductionRecords
)
{
this
.
deductionRecords
=
deductionRecords
;
}
public
void
addDeductionRecord
(
DeductionRecord
record
)
{
this
.
deductionRecords
.
add
(
record
);
}
public
int
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
int
amount
)
{
this
.
amount
=
amount
;
}
public
int
getPeriod
()
{
return
period
;
}
public
void
setPeriod
(
int
period
)
{
this
.
period
=
period
;
}
public
int
getPayMethod
()
{
return
payMethod
;
}
public
void
setPayMethod
(
int
payMethod
)
{
this
.
payMethod
=
payMethod
;
}
public
String
getTradeNo
()
{
return
tradeNo
;
}
public
void
setTradeNo
(
String
tradeNo
)
{
this
.
tradeNo
=
tradeNo
;
}
public
String
getAdministrator
()
{
return
administrator
;
}
public
void
setAdministrator
(
String
administrator
)
{
this
.
administrator
=
administrator
;
}
public
float
getBalanced
()
{
return
balanced
;
}
public
void
setBalanced
(
float
balanced
)
{
this
.
balanced
=
balanced
;
}
}
}
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
3dbb5ad4
...
@@ -21,6 +21,7 @@ import com.edgec.browserbackend.browser.service.ShopService;
...
@@ -21,6 +21,7 @@ import com.edgec.browserbackend.browser.service.ShopService;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.utils.Aes
;
import
com.edgec.browserbackend.common.utils.Aes
;
import
com.edgec.browserbackend.common.utils.FileUtil
;
import
com.edgec.browserbackend.common.utils.FileUtil
;
import
org.jetbrains.annotations.NotNull
;
import
org.slf4j.Logger
;
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
;
...
@@ -186,60 +187,77 @@ public class AccountServiceImpl implements AccountService {
...
@@ -186,60 +187,77 @@ public class AccountServiceImpl implements AccountService {
@Override
@Override
public
IpChargeResultDto
chargeByMoney
(
String
name
,
double
money
,
IpChargeRequestDto
requestDto
)
{
public
IpChargeResultDto
chargeByMoney
(
String
name
,
double
money
,
IpChargeRequestDto
requestDto
)
{
IpChargeResultDto
charge
=
new
IpChargeResultDto
();
IpChargeResultDto
charge
=
new
IpChargeResultDto
();
CompletableFuture
.
runAsync
(()
->
{
CompletableFuture
.
runAsync
(
charge
.
setApprovedAmount
(
0
);
()
->
{
charge
.
setSuccess
(
true
);
charge
.
setApprovedAmount
(
0
);
charge
.
setSuccess
(
true
);
Account
account
=
accountRepository
.
findByName
(
name
).
orElseThrow
(()
->
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
));
Account
account
=
accountRepository
.
findByName
(
name
).
orElseThrow
(()
->
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
));
if
(
account
!=
null
)
{
UserBalance
userBalance
=
userBalanceRepository
.
findById
(
name
).
orElse
(
null
);
UserBalance
userBalance
=
userBalanceRepository
.
findById
(
name
).
orElse
(
null
);
if
(
userBalance
==
null
)
{
userBalance
=
new
UserBalance
();
userBalance
.
setBalanced
(
0
);
userBalance
.
setUsed
(
0
);
userBalance
.
setUsername
(
name
);
userBalanceRepository
.
save
(
userBalance
);
}
userBalanceRepository
.
incrementBalance
(
userBalance
,
-(
float
)
money
,
(
float
)
money
);
// 如果 userBalance 不存在,则创建
userBalance
=
userBalanceRepository
.
findById
(
name
).
orElse
(
null
);
if
(
userBalance
==
null
)
{
userBalance
=
new
UserBalance
();
charge
.
setBalance
(
Math
.
round
(
userBalance
.
getBalanced
()));
userBalance
.
setBalanced
(
0
);
charge
.
setSuccess
(
true
);
userBalance
.
setUsed
(
0
);
userBalance
.
setUsername
(
name
);
UserPrePaidBilling
bill
=
new
UserPrePaidBilling
();
userBalanceRepository
.
save
(
userBalance
);
if
(
account
.
getParent
()
!=
null
)
}
bill
.
setAdministrator
(
account
.
getParent
());
else
bill
.
setAdministrator
(
account
.
getName
());
bill
.
setTradeNo
(
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
).
format
(
new
Date
())
+
SmsUtils
.
createRandom
(
true
,
4
));
bill
.
setChargeType
(
requestDto
.
getChargeType
());
bill
.
setAmount
(
requestDto
.
getAmount
());
bill
.
setUnit
(
requestDto
.
getUnit
());
bill
.
setPeriod
(
requestDto
.
getPeriod
());
bill
.
setPayMethod
(
requestDto
.
getPayMethod
());
bill
.
setUsername
(
name
);
bill
.
setTotal
((
float
)
money
);
bill
.
setStatus
(
BillStatus
.
PAID
);
bill
.
setPrepaid
(
true
);
bill
.
setTimestamp
(
Instant
.
now
().
toEpochMilli
());
final
YearMonth
lastmonth
=
YearMonth
.
now
();
int
monthValue
=
lastmonth
.
getMonthValue
();
int
year
=
lastmonth
.
getYear
();
bill
.
setYear
(
year
);
bill
.
setMonth
(
monthValue
);
bill
.
setBalanced
(
userBalance
.
getBalanced
());
prePaidBillingRepository
.
save
(
bill
);
}
},
AccountServicePool
.
taskPool
).
join
();
// 更新 userbalance
userBalanceRepository
.
incrementBalance
(
userBalance
,
-(
float
)
money
,
(
float
)
money
);
// 获取更新后的 userbalance
userBalance
=
userBalanceRepository
.
findById
(
name
).
orElse
(
null
);
charge
.
setBalance
(
Math
.
round
(
userBalance
.
getBalanced
()));
charge
.
setSuccess
(
true
);
// 封装 userprepaidbilling 信息 并保存
UserPrePaidBilling
bill
=
getUserPrePaidBilling
(
name
,
(
float
)
money
,
requestDto
,
account
,
userBalance
);
prePaidBillingRepository
.
save
(
bill
);
},
AccountServicePool
.
taskPool
).
join
();
return
charge
;
return
charge
;
}
}
@NotNull
private
UserPrePaidBilling
getUserPrePaidBilling
(
String
name
,
float
money
,
IpChargeRequestDto
requestDto
,
Account
account
,
UserBalance
userBalance
)
{
UserPrePaidBilling
bill
=
new
UserPrePaidBilling
();
if
(
account
.
getParent
()
!=
null
)
{
bill
.
setAdministrator
(
account
.
getParent
());
}
else
{
bill
.
setAdministrator
(
account
.
getName
());
}
bill
.
setTradeNo
(
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
).
format
(
new
Date
())
+
SmsUtils
.
createRandom
(
true
,
4
));
bill
.
setChargeType
(
requestDto
.
getChargeType
());
if
(
requestDto
.
getChargeIp
()
!=
null
)
{
bill
.
setChargeIp
(
requestDto
.
getChargeIp
());
}
bill
.
setAmount
(
requestDto
.
getAmount
());
bill
.
setUnit
(
requestDto
.
getUnit
());
bill
.
setPeriod
(
requestDto
.
getPeriod
());
bill
.
setPayMethod
(
requestDto
.
getPayMethod
());
bill
.
setUsername
(
name
);
bill
.
setTotal
(
money
);
bill
.
setStatus
(
BillStatus
.
PAID
);
bill
.
setPrepaid
(
true
);
bill
.
setTimestamp
(
Instant
.
now
().
toEpochMilli
());
final
YearMonth
lastmonth
=
YearMonth
.
now
();
int
monthValue
=
lastmonth
.
getMonthValue
();
int
year
=
lastmonth
.
getYear
();
bill
.
setYear
(
year
);
bill
.
setMonth
(
monthValue
);
bill
.
setBalanced
(
userBalance
.
getBalanced
());
return
bill
;
}
private
static
final
String
DEFAULT_REGION_KEY
=
"--default"
;
private
static
final
String
DEFAULT_REGION_KEY
=
"--default"
;
@Override
@Override
...
@@ -253,27 +271,37 @@ public class AccountServiceImpl implements AccountService {
...
@@ -253,27 +271,37 @@ public class AccountServiceImpl implements AccountService {
return
"success"
;
return
"success"
;
}
}
/**
* 封装 预充值扣费 信息
*/
@Override
@Override
public
IpChargeResultDto
preChargeByMoney
(
String
name
,
double
money
)
{
public
IpChargeResultDto
preChargeByMoney
(
String
name
,
double
money
)
{
IpChargeResultDto
precharge
=
new
IpChargeResultDto
();
IpChargeResultDto
precharge
=
new
IpChargeResultDto
();
CompletableFuture
.
runAsync
(()
->
{
CompletableFuture
.
runAsync
(
precharge
.
setApprovedAmount
(
0
);
()
->
{
precharge
.
setSuccess
(
false
);
precharge
.
setApprovedAmount
(
0
);
Account
account
=
accountRepository
.
findByName
(
name
).
orElseThrow
(()
->
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
));
precharge
.
setSuccess
(
false
);
if
(
account
!=
null
)
{
UserBalance
userBalance
=
userBalanceRepository
.
findById
(
name
).
orElse
(
null
);
Account
account
=
accountRepository
.
findByName
(
name
).
orElseThrow
(()
->
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
));
float
balance
=
0
;
if
(
account
!=
null
)
{
if
(
userBalance
!=
null
)
UserBalance
userBalance
=
userBalanceRepository
.
findById
(
name
).
orElse
(
null
);
balance
=
userBalance
.
getBalanced
();
float
balance
=
0
;
if
(
userBalance
!=
null
)
{
if
(
balance
>=
money
)
{
balance
=
userBalance
.
getBalanced
();
precharge
.
setBalance
((
int
)
Math
.
round
(
balance
-
money
));
}
precharge
.
setSuccess
(
true
);
}
else
{
// 如果账户余额 比 扣费的 多,则设置为成功,并重新设置账户余额
precharge
.
setBalance
(
Math
.
round
(
balance
));
if
(
balance
>=
money
)
{
}
precharge
.
setBalance
((
int
)
Math
.
round
(
balance
-
money
));
}
precharge
.
setSuccess
(
true
);
},
AccountServicePool
.
taskPool
).
join
();
}
else
{
// todo 钱不够了,不是应该提示该充值么
precharge
.
setBalance
(
Math
.
round
(
balance
));
}
}
},
AccountServicePool
.
taskPool
).
join
();
return
precharge
;
return
precharge
;
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/domain/IpResource.java
View file @
3dbb5ad4
...
@@ -21,42 +21,129 @@ public class IpResource implements Serializable {
...
@@ -21,42 +21,129 @@ public class IpResource implements Serializable {
@Id
@Id
private
String
id
;
private
String
id
;
/**
* ip 地址
*/
private
String
addr
;
private
String
addr
;
/**
* ip 类型,默认是 ip代理 模式
*/
private
IpType
ipType
=
IpType
.
VENDOR
;
private
IpType
ipType
=
IpType
.
VENDOR
;
/**
* ip 的具体代理使用
*/
private
Vendor
vendor
;
private
Vendor
vendor
;
private
String
vendorCn
;
private
String
vendorCn
;
/**
* ip 地域
*/
private
String
region
;
private
String
region
;
private
String
regionCn
;
private
String
regionCn
;
//0:正常, 1:已过期, 2:即将过期, 3:正在分配, 4:未使用, 5:已失效, 6:未分配, 7:未缴费, 8:分配成功
/**
* ip 的状态
* 0:正常, 1:已过期, 2:即将过期, 3:正在分配, 4:未使用, 5:已失效, 6:未分配, 7:未缴费, 8:分配成功
*/
private
int
status
;
private
int
status
;
/**
* ip 端口号
*/
private
List
<
String
>
port
;
private
List
<
String
>
port
;
/**
* ip的购买时间点
*/
private
long
purchasedTime
;
private
long
purchasedTime
;
/**
* ip的过期的时间点
*/
private
long
validTime
;
private
long
validTime
;
private
String
details
;
private
String
details
;
/**
* ip的绑定历史
*/
private
List
<
BindHistory
>
bindHistory
=
new
ArrayList
<>();
private
List
<
BindHistory
>
bindHistory
=
new
ArrayList
<>();
/**
* ip的状态
* 当 ip 资源过期的时候,系统不会直接删除 ip 资源,而是将 isDeleted 设置为 true
* 过期7天后再删除这个ip资源
*/
private
boolean
isDeleted
;
private
boolean
isDeleted
;
/**
* 如果 使用的 ip 资源 是在我们系统申请的,则默认为 fangguanlianbrowser
*/
private
String
username
;
private
String
username
;
/**
* ip 资源的购买者(拥有者)
*/
private
String
owner
;
private
String
owner
;
private
String
userParent
;
private
String
userParent
;
/**
* ip访问协议
*/
private
List
<
String
>
protocol
;
private
List
<
String
>
protocol
;
private
String
password
;
private
String
password
;
private
double
price
;
private
double
price
;
private
boolean
specialLine
;
//是否使用专线
/**
private
boolean
usingSpecialLine
;
//是否正在使用专线
* 是否使用专线
//专线数据
*/
private
String
proxyUsername
;
//专线的代理用户名
private
boolean
specialLine
;
private
String
proxyPassword
;
//专线的代理密码
/**
* 是否正在使用专线
*/
private
boolean
usingSpecialLine
;
/**
* 专线的代理用户名
*/
private
String
proxyUsername
;
/**
* 专线的代理密码
*/
private
String
proxyPassword
;
/**
* ip 资源绑定的 商铺号
*/
private
String
shopId
;
private
String
shopId
;
private
List
<
String
>
shopIds
=
new
ArrayList
<>();
private
List
<
String
>
shopIds
=
new
ArrayList
<>();
/**
* 绑定状态
*/
private
boolean
bind
;
private
boolean
bind
;
private
boolean
isLocked
;
private
boolean
isLocked
;
private
long
lockTimestamp
;
private
long
lockTimestamp
;
private
long
healthLockTimestamp
;
private
long
healthLockTimestamp
;
/**
* 购买方式(按月、按周)
*/
private
String
unit
;
private
String
unit
;
/**
* 购买数量
* 例如 购买了 2 个月 的 ip资源,则
* period:2
* unit:month
*/
private
int
period
;
private
int
period
;
@Override
@Override
...
...
src/main/java/com/edgec/browserbackend/browser/domain/IpType.java
View file @
3dbb5ad4
...
@@ -14,5 +14,5 @@ public enum IpType {
...
@@ -14,5 +14,5 @@ public enum IpType {
/**
/**
* 自有ip,即该ip不是从我们系统购买的
* 自有ip,即该ip不是从我们系统购买的
*/
*/
OWN
;
OWN
}
}
src/main/java/com/edgec/browserbackend/browser/dto/IpOperationResultDto.java
View file @
3dbb5ad4
package
com
.
edgec
.
browserbackend
.
browser
.
dto
;
package
com
.
edgec
.
browserbackend
.
browser
.
dto
;
import
java.util.ArrayList
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.List
;
@Data
public
class
IpOperationResultDto
{
public
class
IpOperationResultDto
{
List
<
String
>
successList
=
new
ArrayList
<>();
List
<
String
>
successList
;
List
<
String
>
failList
=
new
ArrayList
<>();
List
<
String
>
failList
;
public
List
<
String
>
getSuccessList
()
{
return
successList
;
}
public
void
setSuccessList
(
List
<
String
>
successList
)
{
this
.
successList
=
successList
;
}
public
List
<
String
>
getFailList
()
{
return
failList
;
}
public
void
setFailList
(
List
<
String
>
failList
)
{
this
.
failList
=
failList
;
}
}
}
src/main/java/com/edgec/browserbackend/browser/dto/IpResourceRequestDto.java
View file @
3dbb5ad4
...
@@ -12,7 +12,7 @@ public class IpResourceRequestDto {
...
@@ -12,7 +12,7 @@ public class IpResourceRequestDto {
private
String
name
;
private
String
name
;
private
String
region
;
private
String
region
;
private
String
regionCn
;
private
String
regionCn
;
private
String
vendor
=
"aliyun"
;
private
String
vendor
=
"aliyun"
;
private
String
logintype
=
"password"
;
private
String
logintype
=
"password"
;
private
String
shopId
;
private
String
shopId
;
...
@@ -23,7 +23,7 @@ public class IpResourceRequestDto {
...
@@ -23,7 +23,7 @@ public class IpResourceRequestDto {
@Max
(
12
)
@Max
(
12
)
@Min
(
1
)
@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
;
private
boolean
autorenew
=
false
;
private
boolean
autorenew
=
false
;
private
int
ipkeptperiod
=
7
;
private
int
ipkeptperiod
=
7
;
...
@@ -44,6 +44,7 @@ public class IpResourceRequestDto {
...
@@ -44,6 +44,7 @@ public class IpResourceRequestDto {
private
List
<
String
>
ipId
=
new
ArrayList
<>();
private
List
<
String
>
ipId
=
new
ArrayList
<>();
public
String
getName
()
{
public
String
getName
()
{
return
name
;
return
name
;
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
3dbb5ad4
This diff is collapsed.
Click to expand it.
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