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
d53c643e
Commit
d53c643e
authored
Mar 24, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
控制台
parent
52d04593
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
326 additions
and
58 deletions
+326
-58
AccountController.java
.../browserbackend/account/controller/AccountController.java
+9
-15
IpChargeRequestDto.java
...gec/browserbackend/account/domain/IpChargeRequestDto.java
+2
-2
PaymentService.java
.../edgec/browserbackend/account/service/PaymentService.java
+2
-2
PaymentServiceImpl.java
...owserbackend/account/service/impl/PaymentServiceImpl.java
+20
-32
LoginHistory.java
...com/edgec/browserbackend/browser/domain/LoginHistory.java
+52
-0
OperationHistory.java
...edgec/browserbackend/browser/domain/OperationHistory.java
+61
-0
PayBack.java
...java/com/edgec/browserbackend/browser/domain/PayBack.java
+26
-0
HistoryPageResultDto.java
...dgec/browserbackend/browser/dto/HistoryPageResultDto.java
+24
-0
IpResourceRequestDto.java
...dgec/browserbackend/browser/dto/IpResourceRequestDto.java
+11
-0
LoginHistoryDto.java
...com/edgec/browserbackend/browser/dto/LoginHistoryDto.java
+52
-0
LoginHistoryRepository.java
...serbackend/browser/repository/LoginHistoryRepository.java
+11
-0
OperationHistoryRepository.java
...ackend/browser/repository/OperationHistoryRepository.java
+5
-0
PayBackRepository.java
.../browserbackend/browser/repository/PayBackRepository.java
+8
-0
HistoryService.java
.../edgec/browserbackend/browser/service/HistoryService.java
+17
-0
HistoryServiceImpl.java
...owserbackend/browser/service/Impl/HistoryServiceImpl.java
+19
-0
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+6
-6
ChargeType.java
...va/com/edgec/browserbackend/common/charge/ChargeType.java
+1
-1
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AccountController.java
View file @
d53c643e
...
...
@@ -249,14 +249,14 @@ public class AccountController {
return
paymentService
.
wechatPayCallback
(
tradno
);
}
@RequestMapping
(
path
=
"/0xwxcheckorderstatus/{tradno}/{
mor
e}"
,
method
=
RequestMethod
.
GET
)
public
UserPaymentDto
wechatCheckOrderStatus
(
Principal
principal
,
@PathVariable
String
tradno
,
@PathVariable
int
mor
e
)
{
return
paymentService
.
wxCheckOrderStatus
(
tradno
,
mor
e
);
@RequestMapping
(
path
=
"/0xwxcheckorderstatus/{tradno}/{
chargeTyp
e}"
,
method
=
RequestMethod
.
GET
)
public
UserPaymentDto
wechatCheckOrderStatus
(
Principal
principal
,
@PathVariable
String
tradno
,
@PathVariable
int
chargeTyp
e
)
{
return
paymentService
.
wxCheckOrderStatus
(
tradno
,
chargeTyp
e
);
}
@RequestMapping
(
path
=
"/wxpay/checkstatus/{tradno}/{
mor
e}"
,
method
=
RequestMethod
.
GET
)
public
UserPaymentDto
wechatPayCheckStatus
(
@PathVariable
String
tradno
,
@PathVariable
int
mor
e
)
{
return
paymentService
.
wxCheckOrderStatus
(
tradno
,
mor
e
);
@RequestMapping
(
path
=
"/wxpay/checkstatus/{tradno}/{
chargeTyp
e}"
,
method
=
RequestMethod
.
GET
)
public
UserPaymentDto
wechatPayCheckStatus
(
@PathVariable
String
tradno
,
@PathVariable
int
chargeTyp
e
)
{
return
paymentService
.
wxCheckOrderStatus
(
tradno
,
chargeTyp
e
);
}
@RequestMapping
(
path
=
"/0xalipaycallback/{tradno}"
,
method
=
RequestMethod
.
GET
)
...
...
@@ -264,15 +264,9 @@ public class AccountController {
paymentService
.
alipaCallback
(
tradno
);
}
@RequestMapping
(
path
=
"/0xalicheckorderstatus/{tradno}/{more}"
,
method
=
RequestMethod
.
GET
)
public
UserPaymentDto
alipayCheckOrderStatus
(
Principal
principal
,
@PathVariable
String
tradno
,
@PathVariable
int
more
)
{
return
paymentService
.
aliCheckOrderStatus
(
tradno
,
more
);
}
@RequestMapping
(
path
=
"/alipay/checkstatus/{tradno}/{more}"
,
method
=
RequestMethod
.
GET
)
@PreAuthorize
(
"#oauth2.hasScope('server')"
)
public
UserPaymentDto
alipayCheckStatus
(
@PathVariable
String
tradno
,
@PathVariable
int
more
)
{
return
paymentService
.
aliCheckOrderStatus
(
tradno
,
more
);
@RequestMapping
(
path
=
"/0xalicheckorderstatus/{tradno}/{chargeType}"
,
method
=
RequestMethod
.
GET
)
public
UserPaymentDto
alipayCheckOrderStatus
(
Principal
principal
,
@PathVariable
String
tradno
,
@PathVariable
int
chargeType
)
{
return
paymentService
.
aliCheckOrderStatus
(
tradno
,
chargeType
);
}
@RequestMapping
(
path
=
"/0xalipay/{amount}"
,
method
=
RequestMethod
.
GET
)
...
...
src/main/java/com/edgec/browserbackend/account/domain/IpChargeRequestDto.java
View file @
d53c643e
...
...
@@ -7,9 +7,9 @@ public class IpChargeRequestDto {
private
String
unit
=
"month"
;
private
String
target
;
//0 -- 充值, 1 -- newip, 2 --renew, 3 --
ipkeptfee, 4 --deleteip,
//0 -- 充值, 1 -- newip, 2 --renew, 3 --
退还
private
int
chargeType
=
0
;
//0 -- 余额,
2 -- 支付宝, 3
-- 微信
//0 -- 余额,
1 -- 支付宝, 2
-- 微信
private
int
payMethod
=
0
;
private
float
daysPerMonth
=
0
;
...
...
src/main/java/com/edgec/browserbackend/account/service/PaymentService.java
View file @
d53c643e
...
...
@@ -12,9 +12,9 @@ public interface PaymentService {
String
wechatPayCallback
(
String
tradno
);
UserPaymentDto
wxCheckOrderStatus
(
String
tradno
,
int
mor
e
);
UserPaymentDto
wxCheckOrderStatus
(
String
tradno
,
int
chargeTyp
e
);
UserPaymentDto
aliCheckOrderStatus
(
String
tradno
,
int
mor
e
);
UserPaymentDto
aliCheckOrderStatus
(
String
tradno
,
int
chargeTyp
e
);
void
alipaCallback
(
String
tradno
);
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/PaymentServiceImpl.java
View file @
d53c643e
...
...
@@ -20,6 +20,8 @@ import com.edgec.browserbackend.account.service.UserPrePaidBillingService;
import
com.edgec.browserbackend.alipay.AlipayConfig
;
import
com.edgec.browserbackend.alipay.CloudamAlipayConfig
;
import
com.edgec.browserbackend.alipay.VpsAlipayConfig
;
import
com.edgec.browserbackend.browser.domain.PayBack
;
import
com.edgec.browserbackend.browser.repository.PayBackRepository
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.wxpay.*
;
import
org.slf4j.Logger
;
...
...
@@ -44,6 +46,9 @@ public class PaymentServiceImpl implements PaymentService {
@Autowired
private
UserBalanceRepository
userBalanceRepository
;
@Autowired
private
PayBackRepository
payBackRepository
;
@Autowired
private
AccountService
accountService
;
...
...
@@ -75,7 +80,7 @@ public class PaymentServiceImpl implements PaymentService {
}
@Override
public
UserPaymentDto
wxCheckOrderStatus
(
String
tradeno
,
int
mor
e
)
{
public
UserPaymentDto
wxCheckOrderStatus
(
String
tradeno
,
int
chargeTyp
e
)
{
UserPaymentDto
result
=
new
UserPaymentDto
();
result
.
setPaid
(
false
);
...
...
@@ -84,7 +89,7 @@ public class PaymentServiceImpl implements PaymentService {
UserPayment
byTradeNo
=
userPaymentRepository
.
findByTradeNo
(
tradeno
);
if
(
PaymentMethod
.
ALIPAY
.
equals
(
byTradeNo
.
getPaymentMethod
()))
return
aliCheckOrderStatus
(
tradeno
,
mor
e
);
return
aliCheckOrderStatus
(
tradeno
,
chargeTyp
e
);
UserBalance
balance
=
userBalanceRepository
.
findById
(
byTradeNo
.
getUsername
()).
orElse
(
null
);
...
...
@@ -147,6 +152,7 @@ public class PaymentServiceImpl implements PaymentService {
balance
.
setUsername
(
byTradeNo
.
getUsername
());
}
if
(
chargeType
==
0
)
{
UserPrePaidBilling
bill
=
new
UserPrePaidBilling
();
bill
.
setChargeType
(
0
);
bill
.
setAmount
(
0
);
...
...
@@ -159,7 +165,6 @@ public class PaymentServiceImpl implements PaymentService {
bill
.
setPrepaid
(
true
);
bill
.
setTimestamp
(
Instant
.
now
().
toEpochMilli
());
final
YearMonth
lastmonth
=
YearMonth
.
now
();
int
monthValue
=
lastmonth
.
getMonthValue
();
...
...
@@ -168,21 +173,12 @@ public class PaymentServiceImpl implements PaymentService {
bill
.
setMonth
(
monthValue
);
userPrePaidBillingRepository
.
save
(
bill
);
if
(
more
!=
20
&&
more
!=
45
&&
more
!=
125
&&
more
!=
300
)
{
more
=
0
;
}
if
((
more
==
20
&&
byTradeNo
.
getAmount
()
!=
100
)
||
(
more
!=
20
&&
byTradeNo
.
getAmount
()
==
100
))
more
=
0
;
if
((
more
==
45
&&
byTradeNo
.
getAmount
()
!=
200
)
||
(
more
!=
45
&&
byTradeNo
.
getAmount
()
==
200
))
more
=
0
;
if
((
more
==
125
&&
byTradeNo
.
getAmount
()
!=
500
)
||
(
more
!=
125
&&
byTradeNo
.
getAmount
()
==
500
))
more
=
0
;
if
((
more
==
300
&&
byTradeNo
.
getAmount
()
!=
1000
)
||
(
more
!=
300
&&
byTradeNo
.
getAmount
()
==
1000
))
more
=
0
;
balance
.
setBalanced
(
balance
.
getBalanced
()
+
byTradeNo
.
getAmount
()
+
more
);
PayBack
payBack
=
payBackRepository
.
findByPay
(
byTradeNo
.
getAmount
());
if
(
payBack
==
null
)
payBack
=
new
PayBack
();
balance
.
setBalanced
(
balance
.
getBalanced
()
+
byTradeNo
.
getAmount
()
+
payBack
.
getBack
());
userBalanceRepository
.
save
(
balance
);
}
...
...
@@ -214,7 +210,7 @@ public class PaymentServiceImpl implements PaymentService {
}
@Override
public
UserPaymentDto
aliCheckOrderStatus
(
String
tradno
,
int
mor
e
)
{
public
UserPaymentDto
aliCheckOrderStatus
(
String
tradno
,
int
chargeTyp
e
)
{
UserPaymentDto
result
=
new
UserPaymentDto
();
result
.
setPaid
(
false
);
try
{
...
...
@@ -264,6 +260,7 @@ public class PaymentServiceImpl implements PaymentService {
balance
.
setUsername
(
byTradeNo
.
getUsername
());
}
if
(
chargeType
==
0
)
{
UserPrePaidBilling
bill
=
new
UserPrePaidBilling
();
bill
.
setChargeType
(
0
);
bill
.
setAmount
(
0
);
...
...
@@ -276,27 +273,18 @@ public class PaymentServiceImpl implements PaymentService {
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
);
}
if
(
more
!=
20
&&
more
!=
45
&&
more
!=
125
&&
more
!=
300
)
more
=
0
;
if
((
more
==
20
&&
byTradeNo
.
getAmount
()
!=
100
)
||
(
more
!=
20
&&
byTradeNo
.
getAmount
()
==
100
))
more
=
0
;
if
((
more
==
45
&&
byTradeNo
.
getAmount
()
!=
200
)
||
(
more
!=
45
&&
byTradeNo
.
getAmount
()
==
200
))
more
=
0
;
if
((
more
==
125
&&
byTradeNo
.
getAmount
()
!=
500
)
||
(
more
!=
125
&&
byTradeNo
.
getAmount
()
==
500
))
more
=
0
;
if
((
more
==
300
&&
byTradeNo
.
getAmount
()
!=
1000
)
||
(
more
!=
300
&&
byTradeNo
.
getAmount
()
==
1000
))
more
=
0
;
balance
.
setBalanced
(
balance
.
getBalanced
()
+
byTradeNo
.
getAmount
()
+
more
);
PayBack
payBack
=
payBackRepository
.
findByPay
(
byTradeNo
.
getAmount
());
if
(
payBack
==
null
)
payBack
=
new
PayBack
();
balance
.
setBalanced
(
balance
.
getBalanced
()
+
byTradeNo
.
getAmount
()
+
payBack
.
getBack
());
userBalanceRepository
.
save
(
balance
);
}
...
...
src/main/java/com/edgec/browserbackend/browser/domain/LoginHistory.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
domain
;
import
org.springframework.data.mongodb.core.mapping.Document
;
@Document
(
collection
=
"loginhistory"
)
public
class
LoginHistory
{
private
String
account
;
private
String
nickname
;
private
String
loginIp
;
private
String
loginPlace
;
private
long
loginTime
;
public
String
getNickname
()
{
return
nickname
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
String
getLoginPlace
()
{
return
loginPlace
;
}
public
void
setLoginPlace
(
String
loginPlace
)
{
this
.
loginPlace
=
loginPlace
;
}
public
String
getLoginIp
()
{
return
loginIp
;
}
public
void
setLoginIp
(
String
loginIp
)
{
this
.
loginIp
=
loginIp
;
}
public
String
getAccount
()
{
return
account
;
}
public
void
setAccount
(
String
account
)
{
this
.
account
=
account
;
}
public
long
getLoginTime
()
{
return
loginTime
;
}
public
void
setLoginTime
(
long
loginTime
)
{
this
.
loginTime
=
loginTime
;
}
}
src/main/java/com/edgec/browserbackend/browser/domain/OperationHistory.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
domain
;
import
org.springframework.data.mongodb.core.mapping.Document
;
@Document
(
collection
=
"operationhistory"
)
public
class
OperationHistory
{
private
String
account
;
private
String
nickname
;
private
String
loginIp
;
private
String
loginPlace
;
private
String
operation
;
private
long
operationTime
;
public
String
getAccount
()
{
return
account
;
}
public
void
setAccount
(
String
account
)
{
this
.
account
=
account
;
}
public
long
getOperationTime
()
{
return
operationTime
;
}
public
void
setOperationTime
(
long
operationTime
)
{
this
.
operationTime
=
operationTime
;
}
public
String
getLoginIp
()
{
return
loginIp
;
}
public
void
setLoginIp
(
String
loginIp
)
{
this
.
loginIp
=
loginIp
;
}
public
String
getLoginPlace
()
{
return
loginPlace
;
}
public
void
setLoginPlace
(
String
loginPlace
)
{
this
.
loginPlace
=
loginPlace
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
String
getOperation
()
{
return
operation
;
}
public
void
setOperation
(
String
operation
)
{
this
.
operation
=
operation
;
}
}
src/main/java/com/edgec/browserbackend/browser/domain/PayBack.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
domain
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
org.springframework.data.mongodb.core.mapping.Document
;
@Document
(
collection
=
"paybackprice"
)
public
class
PayBack
{
private
int
pay
;
private
int
back
=
0
;
public
int
getBack
()
{
return
back
;
}
public
void
setBack
(
int
back
)
{
this
.
back
=
back
;
}
public
int
getPay
()
{
return
pay
;
}
public
void
setPay
(
int
pay
)
{
this
.
pay
=
pay
;
}
}
src/main/java/com/edgec/browserbackend/browser/dto/HistoryPageResultDto.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
dto
;
import
java.util.List
;
public
class
HistoryPageResultDto
<
T
>
{
List
<
T
>
history
;
PageInfo
historyPage
;
public
List
<
T
>
getHistory
()
{
return
history
;
}
public
void
setHistory
(
List
<
T
>
history
)
{
this
.
history
=
history
;
}
public
PageInfo
getHistoryPage
()
{
return
historyPage
;
}
public
void
setHistoryPage
(
PageInfo
historyPage
)
{
this
.
historyPage
=
historyPage
;
}
}
src/main/java/com/edgec/browserbackend/browser/dto/IpResourceRequestDto.java
View file @
d53c643e
...
...
@@ -15,6 +15,9 @@ public class IpResourceRequestDto {
private
String
vendor
=
"aliyun"
;
private
String
logintype
=
"password"
;
//0 -- 余额, 1 -- 支付宝, 2 -- 微信
private
int
payMethod
=
0
;
@Max
(
12
)
@Min
(
1
)
private
int
period
=
1
;
...
...
@@ -175,4 +178,12 @@ public class IpResourceRequestDto {
public
void
setIpId
(
List
<
String
>
ipId
)
{
this
.
ipId
=
ipId
;
}
public
int
getPayMethod
()
{
return
payMethod
;
}
public
void
setPayMethod
(
int
payMethod
)
{
this
.
payMethod
=
payMethod
;
}
}
src/main/java/com/edgec/browserbackend/browser/dto/LoginHistoryDto.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
dto
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
LoginHistoryDto
{
private
String
account
;
private
String
nickname
;
private
String
loginIp
;
private
String
loginPlace
;
private
String
loginTime
;
public
String
getNickname
()
{
return
nickname
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
String
getLoginPlace
()
{
return
loginPlace
;
}
public
void
setLoginPlace
(
String
loginPlace
)
{
this
.
loginPlace
=
loginPlace
;
}
public
String
getLoginIp
()
{
return
loginIp
;
}
public
void
setLoginIp
(
String
loginIp
)
{
this
.
loginIp
=
loginIp
;
}
public
String
getAccount
()
{
return
account
;
}
public
void
setAccount
(
String
account
)
{
this
.
account
=
account
;
}
public
String
getLoginTime
()
{
return
loginTime
;
}
public
void
setLoginTime
(
String
loginTime
)
{
this
.
loginTime
=
loginTime
;
}
}
src/main/java/com/edgec/browserbackend/browser/repository/LoginHistoryRepository.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
repository
;
import
com.edgec.browserbackend.browser.domain.LoginHistory
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
public
interface
LoginHistoryRepository
extends
MongoRepository
<
LoginHistory
,
String
>
{
Page
<
LoginHistory
>
findByAccountOrderByLoginTimeDesc
(
String
account
,
Pageable
pageable
);
}
src/main/java/com/edgec/browserbackend/browser/repository/OperationHistoryRepository.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
repository
;
public
interface
OperationHistoryRepository
{
}
src/main/java/com/edgec/browserbackend/browser/repository/PayBackRepository.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
repository
;
import
com.edgec.browserbackend.browser.domain.PayBack
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
public
interface
PayBackRepository
extends
MongoRepository
<
PayBack
,
String
>
{
PayBack
findByPay
(
int
pay
);
}
src/main/java/com/edgec/browserbackend/browser/service/HistoryService.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
service
;
import
com.edgec.browserbackend.browser.domain.LoginHistory
;
import
com.edgec.browserbackend.browser.domain.OperationHistory
;
import
com.edgec.browserbackend.browser.dto.HistoryPageResultDto
;
import
com.edgec.browserbackend.browser.dto.LoginHistoryDto
;
import
org.springframework.data.domain.Page
;
import
java.util.List
;
public
interface
HistoryService
{
HistoryPageResultDto
getLoginHistories
(
String
username
,
int
day
);
HistoryPageResultDto
getOperationHistories
(
String
username
,
int
day
);
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/HistoryServiceImpl.java
0 → 100644
View file @
d53c643e
package
com
.
edgec
.
browserbackend
.
browser
.
service
.
Impl
;
import
com.edgec.browserbackend.browser.dto.HistoryPageResultDto
;
import
com.edgec.browserbackend.browser.service.HistoryService
;
public
class
HistoryServiceImpl
implements
HistoryService
{
@Override
public
HistoryPageResultDto
getLoginHistories
(
String
username
,
int
day
)
{
HistoryPageResultDto
historyPageResultDto
=
new
HistoryPageResultDto
();
return
null
;
}
@Override
public
HistoryPageResultDto
getOperationHistories
(
String
username
,
int
day
)
{
return
null
;
}
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
d53c643e
...
...
@@ -144,7 +144,7 @@ public class IpResourceServiceImpl implements IpResourceService {
return
retStr
;
}
private
IpChargeRequestDto
buildIpChargeRequestDto
(
IpResourceRequestDto
request
,
int
chargeType
)
{
private
IpChargeRequestDto
buildIpChargeRequestDto
(
IpResourceRequestDto
request
,
int
chargeType
,
int
payMethod
)
{
IpChargeRequestDto
ipChargeRequestDto
=
new
IpChargeRequestDto
();
ipChargeRequestDto
.
setAmount
(
request
.
getAmount
());
ipChargeRequestDto
.
setChargeType
(
chargeType
);
...
...
@@ -254,7 +254,7 @@ public class IpResourceServiceImpl implements IpResourceService {
try
{
ipBuyResultDto
=
restTemplate
.
postForObject
(
URL
+
"/intelligroup/ipresources?accountId=browser"
,
httpEntity
,
IpBuyResultDto
.
class
);
if
(
StringUtils
.
isNotBlank
(
ipBuyResultDto
.
getErrorCode
()))
{
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
1
);
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
3
,
0
);
accountService
.
chargeByMoney
(
username
,
-
newprice
*
ipChargeRequestDto
.
getAmount
(),
ipChargeRequestDto
);
for
(
IpResourceDto
ipResourceDto:
ipResourceDtos
)
{
ipResourceRepository
.
deleteById
(
ipResourceDto
.
getId
());
...
...
@@ -278,7 +278,7 @@ public class IpResourceServiceImpl implements IpResourceService {
index
.
getAndIncrement
();
});
if
(
ipBuyResultDto
.
getIplist
().
size
()
<
ipResourceDtos
.
size
())
{
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
1
);
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
3
,
0
);
accountService
.
chargeByMoney
(
username
,
-
newprice
*(
ipResourceDtos
.
size
()
-
ipBuyResultDto
.
getIplist
().
size
()),
ipChargeRequestDto
);
for
(
IpResourceDto
ipResourceDto
:
ipResourceDtos
)
{
IpResource
ipResource
=
ipResourceRepository
.
findById
(
ipResourceDto
.
getId
()).
orElse
(
null
);
...
...
@@ -299,7 +299,7 @@ public class IpResourceServiceImpl implements IpResourceService {
ipTransactionRepository
.
save
(
ipTransaction
);
}
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
1
);
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
1
,
ipResourceRequestDto
.
getPayMethod
()
);
accountService
.
chargeByMoney
(
username
,
newprice
*
ipChargeRequestDto
.
getAmount
(),
ipChargeRequestDto
);
return
ipTransactionDto
;
}
...
...
@@ -360,7 +360,7 @@ public class IpResourceServiceImpl implements IpResourceService {
.
map
(
vendorprice
->
vendorprice
.
substring
(
vendorprice
.
lastIndexOf
(
"-"
)
+
1
)).
collect
(
Collectors
.
joining
());
double
newprice1
=
ipResourceRequestDto
.
getUnit
().
equals
(
"week"
)
?
(
Integer
.
valueOf
(
price
)/
3
)
:
Integer
.
valueOf
(
price
);
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
2
);
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
2
,
ipResourceRequestDto
.
getPayMethod
()
);
accountService
.
chargeByMoney
(
username
,
newprice1
,
ipChargeRequestDto
);
ipResource
.
setValidTime
(
Instant
.
parse
(
x
.
getValidTill
()).
toEpochMilli
());
...
...
@@ -381,7 +381,7 @@ public class IpResourceServiceImpl implements IpResourceService {
.
map
(
vendorprice
->
vendorprice
.
substring
(
vendorprice
.
lastIndexOf
(
"-"
)
+
1
)).
collect
(
Collectors
.
joining
());
double
newprice1
=
ipResourceRequestDto
.
getUnit
().
equals
(
"week"
)
?
(
Integer
.
valueOf
(
price
)
/
3
)
:
Integer
.
valueOf
(
price
);
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
2
);
IpChargeRequestDto
ipChargeRequestDto
=
buildIpChargeRequestDto
(
ipResourceRequestDto
,
2
,
ipResourceRequestDto
.
getPayMethod
()
);
accountService
.
chargeByMoney
(
username
,
newprice1
,
ipChargeRequestDto
);
ipResource
.
setValidTime
(
Instant
.
ofEpochMilli
(
ipResource
.
getValidTime
()).
atZone
(
ZoneOffset
.
UTC
)
...
...
src/main/java/com/edgec/browserbackend/common/charge/ChargeType.java
View file @
d53c643e
...
...
@@ -9,5 +9,5 @@ public interface ChargeType {
int
payment
=
0
;
// 充值
int
newip
=
1
;
// 购买vps, ip
int
renew
=
2
;
// 续费ip
int
returnunused
=
3
;
// 退还
}
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