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
88973940
Commit
88973940
authored
Sep 25, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'staging' into 'master'
Staging See merge request
!179
parents
6c09e200
b5409c9a
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
176 additions
and
96 deletions
+176
-96
AdministratorController.java
...erbackend/account/controller/AdministratorController.java
+1
-1
AccountDto.java
...a/com/edgec/browserbackend/account/domain/AccountDto.java
+11
-0
UserPrePaidBilling.java
...gec/browserbackend/account/domain/UserPrePaidBilling.java
+1
-1
PaymentService.java
.../edgec/browserbackend/account/service/PaymentService.java
+5
-5
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+1
-1
PaymentServiceImpl.java
...owserbackend/account/service/impl/PaymentServiceImpl.java
+2
-2
ShopController.java
...gec/browserbackend/browser/controller/ShopController.java
+4
-47
IpResource.java
...a/com/edgec/browserbackend/browser/domain/IpResource.java
+5
-0
ShopUA.java
.../java/com/edgec/browserbackend/browser/domain/ShopUA.java
+45
-0
IpResourceDto.java
...a/com/edgec/browserbackend/browser/dto/IpResourceDto.java
+12
-1
BrowserWinLogRepositoryCustom.java
...end/browser/repository/BrowserWinLogRepositoryCustom.java
+2
-0
BrowserWinLogRepositoryCustomImpl.java
...browser/repository/BrowserWinLogRepositoryCustomImpl.java
+17
-2
ShopUARepository.java
...c/browserbackend/browser/repository/ShopUARepository.java
+12
-0
HistoryServiceImpl.java
...owserbackend/browser/service/Impl/HistoryServiceImpl.java
+1
-0
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+42
-35
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+14
-0
VpsServiceImpl.java
...c/browserbackend/browser/service/Impl/VpsServiceImpl.java
+1
-1
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AdministratorController.java
View file @
88973940
...
...
@@ -101,7 +101,7 @@ public class AdministratorController {
public
HashMap
bankTransferInsert
(
@RequestBody
UserBalance
userBalance
)
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
try
{
map
.
put
(
"userbalance"
,
paymentService
.
bankTransferInsertion
(
userBalance
.
getUsername
(),
(
int
)
userBalance
.
getBalanced
()));
map
.
put
(
"userbalance"
,
paymentService
.
bankTransferInsertion
(
userBalance
.
getUsername
(),
(
int
)
userBalance
.
getBalanced
()
,
3
));
map
.
put
(
"status"
,
"success"
);
}
catch
(
Exception
e
)
{
map
.
put
(
"status"
,
"failed"
);
...
...
src/main/java/com/edgec/browserbackend/account/domain/AccountDto.java
View file @
88973940
...
...
@@ -42,6 +42,8 @@ public class AccountDto {
private
List
<
String
>
whiteList
=
new
ArrayList
<>();
private
List
<
String
>
userWhiteList
=
new
ArrayList
<>();
private
ShopSummary
shopSummary
;
private
IpSummary
ipSummary
;
...
...
@@ -69,6 +71,7 @@ public class AccountDto {
this
.
setToken
(
account
.
getToken
());
this
.
setPermission
(
account
.
getPermission
());
this
.
setWhiteList
(
account
.
getWhiteList
());
this
.
setUserWhiteList
(
account
.
getWhiteList
());
this
.
setQueryIpUrlList
(
account
.
getQueryIpUrlList
());
if
(
account
.
getPromotion
()
!=
null
)
{
this
.
setPromotion
(
account
.
getPromotion
());
...
...
@@ -256,4 +259,12 @@ public class AccountDto {
public
void
setPromotionCode
(
String
promotionCode
)
{
this
.
promotionCode
=
promotionCode
;
}
public
List
<
String
>
getUserWhiteList
()
{
return
userWhiteList
;
}
public
void
setUserWhiteList
(
List
<
String
>
userWhiteList
)
{
this
.
userWhiteList
=
userWhiteList
;
}
}
src/main/java/com/edgec/browserbackend/account/domain/UserPrePaidBilling.java
View file @
88973940
...
...
@@ -41,7 +41,7 @@ public class UserPrePaidBilling {
private
BillStatus
status
;
/**
* 0 -- 余额, 1 -- 支付宝, 2 -- 微信, 3 -- 银行转账
* 0 -- 余额, 1 -- 支付宝, 2 -- 微信, 3 -- 银行转账
, 4--注册时赠送
*/
private
int
payMethod
;
...
...
src/main/java/com/edgec/browserbackend/account/service/PaymentService.java
View file @
88973940
...
...
@@ -6,19 +6,19 @@ import com.edgec.browserbackend.account.domain.UserPaymentDto;
public
interface
PaymentService
{
UserPaymentDto
wxPutPayOrder
(
String
username
,
int
amount
);
UserPaymentDto
wxPutPayOrder
(
String
username
,
int
amount
);
String
alipayPutPayOrder
(
String
username
,
int
amount
,
String
by
);
String
alipayPutPayOrder
(
String
username
,
int
amount
,
String
by
);
String
wechatPayCallback
(
String
tradno
);
String
wechatPayCallback
(
String
tradno
);
UserPaymentDto
wxCheckOrderStatus
(
String
tradno
,
int
chargeType
);
UserPaymentDto
wxCheckOrderStatus
(
String
tradno
,
int
chargeType
);
UserPaymentDto
aliCheckOrderStatus
(
String
tradno
,
int
chargeType
);
void
alipaCallback
(
String
tradno
);
UserBalance
bankTransferInsertion
(
String
username
,
int
amount
);
UserBalance
bankTransferInsertion
(
String
username
,
int
amount
,
int
payMethod
);
UserPaymentDto
h5wxPayOrder
(
String
ip
,
String
username
,
int
amount
);
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
88973940
...
...
@@ -477,7 +477,7 @@ public class AccountServiceImpl implements AccountService {
list
.
add
(
"184"
);
list
.
add
(
"170"
);
if
(!
StringUtils
.
isEmpty
(
account
.
getPhoneNumber
())
&&
!
list
.
contains
(
account
.
getPhoneNumber
().
substring
(
0
,
3
))
&&
inviter
!=
null
)
{
paymentService
.
bankTransferInsertion
(
account
.
getName
(),
globalFieldRepository
.
findAll
().
get
(
0
).
getRegisterGift
());
paymentService
.
bankTransferInsertion
(
account
.
getName
(),
globalFieldRepository
.
findAll
().
get
(
0
).
getRegisterGift
()
,
4
);
}
log
.
info
(
"new account has been created: "
+
account
.
getName
());
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/PaymentServiceImpl.java
View file @
88973940
...
...
@@ -310,7 +310,7 @@ public class PaymentServiceImpl implements PaymentService {
}
@Override
public
UserBalance
bankTransferInsertion
(
String
username
,
int
amount
)
{
public
UserBalance
bankTransferInsertion
(
String
username
,
int
amount
,
int
payMethod
)
{
UserPayment
bankOrder
=
new
UserPayment
();
bankOrder
.
setUsername
(
username
);
...
...
@@ -332,7 +332,7 @@ public class PaymentServiceImpl implements PaymentService {
bill
.
setAmount
(
0
);
bill
.
setUnit
(
null
);
bill
.
setPeriod
(
0
);
bill
.
setPayMethod
(
3
);
bill
.
setPayMethod
(
payMethod
);
bill
.
setUsername
(
username
);
bill
.
setTotal
((
float
)
amount
);
bill
.
setStatus
(
BillStatus
.
PAID
);
...
...
src/main/java/com/edgec/browserbackend/browser/controller/ShopController.java
View file @
88973940
...
...
@@ -3,7 +3,10 @@ package com.edgec.browserbackend.browser.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.edgec.browserbackend.account.dto.ResultDto
;
import
com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode
;
import
com.edgec.browserbackend.browser.dto.*
;
import
com.edgec.browserbackend.browser.dto.ShopPageResultDto
;
import
com.edgec.browserbackend.browser.dto.ShopRequestDto
;
import
com.edgec.browserbackend.browser.dto.ShopResultDto
;
import
com.edgec.browserbackend.browser.dto.ShopStringResultDto
;
import
com.edgec.browserbackend.browser.service.IpAndShopService
;
import
com.edgec.browserbackend.browser.service.ShopService
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
...
...
@@ -275,52 +278,6 @@ public class ShopController {
}
/**
* 店铺收藏夹
*//*
@GetMapping("/favorites/{shopId}")
public ResultDto getFavoritesByShopId(Principal principal, @PathVariable("shopId") String shopId) {
ResultDto resultDto = new ResultDto();
try {
List<FavoriteUrl> list = shopService.getFavoritesByShopId(principal.getName(), shopId);
resultDto.setData(list);
resultDto.setStatus(0);
} catch (ClientRequestException e) {
dealClientRequestException(resultDto, e);
}
return resultDto;
}
*//**
* 店铺收藏夹 删除收藏
*//*
@DeleteMapping("/favorites/{shopId}")
public ResultDto deleteFavoritesByShopId(Principal principal, @PathVariable("shopId") String shopId, @RequestBody FavoriteUrl favoriteUrl) {
ResultDto resultDto = new ResultDto();
try {
resultDto.setData(shopService.deleteFavoritesByShopId(principal.getName(), shopId, favoriteUrl));
resultDto.setStatus(0);
} catch (ClientRequestException e) {
dealClientRequestException(resultDto, e);
}
return resultDto;
}
*//**
* 店铺收藏夹 新增收藏
*//*
@PostMapping("/favorites/{shopId}")
public ResultDto saveFavoritesByShopId(Principal principal, @PathVariable("shopId") String shopId, @RequestBody FavoriteUrl favoriteUrl) {
ResultDto resultDto = new ResultDto();
try {
resultDto.setData(shopService.saveFavoritesByShopId(principal.getName(), shopId, favoriteUrl));
resultDto.setStatus(0);
} catch (ClientRequestException e) {
dealClientRequestException(resultDto, e);
}
return resultDto;
}*/
private
void
dealClientRequestException
(
ResultDto
resultDto
,
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
...
...
src/main/java/com/edgec/browserbackend/browser/domain/IpResource.java
View file @
88973940
...
...
@@ -146,6 +146,11 @@ public class IpResource implements Serializable {
*/
private
int
period
;
/**
* KCP端口号
*/
private
int
secondaryProxyPort
=
-
1
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
...
...
src/main/java/com/edgec/browserbackend/browser/domain/ShopUA.java
0 → 100644
View file @
88973940
package
com
.
edgec
.
browserbackend
.
browser
.
domain
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.util.List
;
/**
* @author xuxin
* @date 2020/9/25 14:54
* @description
*/
@Document
(
collection
=
"shopua"
)
public
class
ShopUA
{
@Id
private
String
id
;
private
String
platform
;
private
List
<
String
>
uaList
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getPlatform
()
{
return
platform
;
}
public
void
setPlatform
(
String
platform
)
{
this
.
platform
=
platform
;
}
public
List
<
String
>
getUaList
()
{
return
uaList
;
}
public
void
setUaList
(
List
<
String
>
uaList
)
{
this
.
uaList
=
uaList
;
}
}
src/main/java/com/edgec/browserbackend/browser/dto/IpResourceDto.java
View file @
88973940
...
...
@@ -35,6 +35,8 @@ public class IpResourceDto {
private
String
specialLineIp
;
private
int
secondaryProxyPort
=
-
1
;
public
IpResourceDto
()
{
}
...
...
@@ -52,6 +54,7 @@ public class IpResourceDto {
this
.
password
=
ipResource
.
getPassword
();
this
.
protocol
=
ipResource
.
getProtocol
();
this
.
specialLine
=
ipResource
.
isSpecialLine
();
this
.
secondaryProxyPort
=
ipResource
.
getSecondaryProxyPort
();
if
(
CollectionUtils
.
isNotEmpty
(
shopDtos
))
{
this
.
bindShops
=
shopDtos
;
this
.
bindShop
=
shopDtos
.
get
(
0
);
...
...
@@ -63,7 +66,6 @@ public class IpResourceDto {
this
.
bindHistories
=
ipResource
.
getBindHistory
();
else
this
.
bindHistories
=
new
ArrayList
<>();
}
public
IpResourceDto
(
IpResource
ipResource
,
List
<
ShopDto
>
shopDtos
,
boolean
useHistory
,
SpecialLine
specialLine1
)
{
...
...
@@ -84,6 +86,7 @@ public class IpResourceDto {
this
.
proxyPort
=
specialLine1
.
getProxyPort
();
this
.
proxyProtocol
=
specialLine1
.
getProxyProtocol
();
this
.
specialLine
=
ipResource
.
isSpecialLine
();
this
.
secondaryProxyPort
=
ipResource
.
getSecondaryProxyPort
();
if
(
CollectionUtils
.
isNotEmpty
(
shopDtos
))
{
this
.
bindShops
=
shopDtos
;
this
.
bindShop
=
shopDtos
.
get
(
0
);
...
...
@@ -265,4 +268,12 @@ public class IpResourceDto {
public
void
setBindShop
(
ShopDto
bindShop
)
{
this
.
bindShop
=
bindShop
;
}
public
int
getSecondaryProxyPort
()
{
return
secondaryProxyPort
;
}
public
void
setSecondaryProxyPort
(
int
secondaryProxyPort
)
{
this
.
secondaryProxyPort
=
secondaryProxyPort
;
}
}
src/main/java/com/edgec/browserbackend/browser/repository/BrowserWinLogRepositoryCustom.java
View file @
88973940
...
...
@@ -9,4 +9,6 @@ import com.edgec.browserbackend.browser.domain.WinHistory;
*/
public
interface
BrowserWinLogRepositoryCustom
{
void
addWinLog
(
String
username
,
WinHistory
winHistory
);
void
deleteBeforeWinLog
(
String
username
,
int
daysBefore
);
}
src/main/java/com/edgec/browserbackend/browser/repository/BrowserWinLogRepositoryCustomImpl.java
View file @
88973940
...
...
@@ -6,8 +6,13 @@ import org.bson.Document;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.BasicQuery
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
import
java.time.Instant
;
import
java.time.temporal.ChronoUnit
;
import
static
org
.
springframework
.
data
.
mongodb
.
core
.
query
.
Criteria
.
where
;
/**
...
...
@@ -26,8 +31,18 @@ public class BrowserWinLogRepositoryCustomImpl implements BrowserWinLogRepositor
basicQuery
.
addCriteria
(
where
(
"_id"
).
is
(
username
));
Update
update
=
new
Update
();
update
.
set
(
"_id"
,
username
);
update
.
push
(
"list"
,
winHistory
);
update
.
addToSet
(
"list"
,
winHistory
);
mongoTemplate
.
upsert
(
basicQuery
,
update
,
BrowserWinLog
.
class
);
}
@Override
public
void
deleteBeforeWinLog
(
String
username
,
int
daysBefore
)
{
Document
doc
=
new
Document
();
BasicQuery
basicQuery
=
new
BasicQuery
(
doc
);
basicQuery
.
addCriteria
(
where
(
"_id"
).
is
(
username
));
Update
update
=
new
Update
();
update
.
pull
(
"list"
,
Query
.
query
(
Criteria
.
where
(
"time"
).
lte
(
Instant
.
now
().
minus
(
daysBefore
,
ChronoUnit
.
DAYS
).
toEpochMilli
())));
mongoTemplate
.
upsert
(
basicQuery
,
update
,
BrowserWinLog
.
class
);
}
}
src/main/java/com/edgec/browserbackend/browser/repository/ShopUARepository.java
0 → 100644
View file @
88973940
package
com
.
edgec
.
browserbackend
.
browser
.
repository
;
import
com.edgec.browserbackend.browser.domain.ShopUA
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
/**
* @author xuxin
* @date 2020/9/25 14:56
* @description
*/
public
interface
ShopUARepository
extends
MongoRepository
<
ShopUA
,
String
>
{
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/HistoryServiceImpl.java
View file @
88973940
...
...
@@ -148,6 +148,7 @@ public class HistoryServiceImpl implements HistoryService {
@Override
public
void
addBrowserWinLog
(
String
username
,
WinHistory
winHistory
)
{
browserWinLogRepository
.
deleteBeforeWinLog
(
username
,
1
);
browserWinLogRepository
.
addWinLog
(
username
,
winHistory
);
}
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
88973940
...
...
@@ -175,9 +175,9 @@ public class IpResourceServiceImpl implements IpResourceService {
Map
<
String
,
List
<
String
>>
priceList
=
ipOptionsRepository
.
findAll
().
get
(
0
).
getIpPlatForm
();
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
());
.
filter
(
x
->
Vendor
.
valueOf
(
ipResourceRequestDto
.
getVendor
()).
getValue
().
equals
(
x
.
substring
(
0
,
x
.
indexOf
(
"-"
))))
.
map
(
x
->
x
.
substring
(
x
.
lastIndexOf
(
"-"
)
+
1
))
.
collect
(
Collectors
.
joining
());
newprice
=
"week"
.
equals
(
ipResourceRequestDto
.
getUnit
())
?
(
Integer
.
valueOf
(
price
)
/
3
)
:
Integer
.
valueOf
(
price
);
}
...
...
@@ -357,9 +357,9 @@ public class IpResourceServiceImpl implements IpResourceService {
List
<
String
>
vendorPrices
=
ipPlatForm
.
get
(
ipResource
.
getRegionCn
());
// 计算 ip 价格
String
price
=
vendorPrices
.
stream
()
.
filter
(
vendorprice
->
ipResource
.
getVendor
().
getValue
().
equals
(
vendorprice
.
substring
(
0
,
vendorprice
.
indexOf
(
"-"
))))
.
map
(
vendorprice
->
vendorprice
.
substring
(
vendorprice
.
lastIndexOf
(
"-"
)
+
1
))
.
collect
(
Collectors
.
joining
());
.
filter
(
vendorprice
->
ipResource
.
getVendor
().
getValue
().
equals
(
vendorprice
.
substring
(
0
,
vendorprice
.
indexOf
(
"-"
))))
.
map
(
vendorprice
->
vendorprice
.
substring
(
vendorprice
.
lastIndexOf
(
"-"
)
+
1
))
.
collect
(
Collectors
.
joining
());
double
newprice1
=
ipResourceRequestDto
.
getUnit
().
equals
(
"week"
)
?
(
Integer
.
valueOf
(
price
)
/
3
)
:
Integer
.
valueOf
(
price
);
// 封装 ip 的续费 信息
...
...
@@ -398,9 +398,9 @@ public class IpResourceServiceImpl implements IpResourceService {
}
String
price
=
vendorPrices
.
stream
()
.
filter
(
vendorprice
->
ipResource
.
getVendor
().
getValue
().
equals
(
vendorprice
.
substring
(
0
,
vendorprice
.
indexOf
(
"-"
))))
.
map
(
vendorprice
->
vendorprice
.
substring
(
vendorprice
.
lastIndexOf
(
"-"
)
+
1
))
.
collect
(
Collectors
.
joining
());
.
filter
(
vendorprice
->
ipResource
.
getVendor
().
getValue
().
equals
(
vendorprice
.
substring
(
0
,
vendorprice
.
indexOf
(
"-"
))))
.
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
,
ipResourceRequestDto
.
getPayMethod
());
...
...
@@ -409,10 +409,10 @@ public class IpResourceServiceImpl implements IpResourceService {
if
(
ipResourceRequestDto
.
getUnit
().
equals
(
"week"
))
{
ipResource
.
setValidTime
(
Instant
.
ofEpochMilli
(
ipResource
.
getValidTime
()).
atZone
(
ZoneOffset
.
UTC
)
.
plusWeeks
(
finalPeriod
).
toInstant
().
toEpochMilli
());
.
plusWeeks
(
finalPeriod
).
toInstant
().
toEpochMilli
());
}
else
{
ipResource
.
setValidTime
(
Instant
.
ofEpochMilli
(
ipResource
.
getValidTime
()).
atZone
(
ZoneOffset
.
UTC
)
.
plusMonths
(
finalPeriod
).
toInstant
().
toEpochMilli
());
.
plusMonths
(
finalPeriod
).
toInstant
().
toEpochMilli
());
}
ipResourceRepository
.
save
(
ipResource
);
ipOperationResultDto
.
getSuccessList
().
add
(
x
);
...
...
@@ -639,6 +639,9 @@ public class IpResourceServiceImpl implements IpResourceService {
return
ipOperationResultDto
;
}
/**********************************************************************************
* todo - D E V E L O P M E N T *
**********************************************************************************/
@Override
public
IpPageResultDto
getIpList
(
String
username
,
int
groupType
,
int
page
,
int
amount
,
IpFilterDto
ipFilterDto
)
{
// 获取当前用户的账户
...
...
@@ -823,15 +826,19 @@ public class IpResourceServiceImpl implements IpResourceService {
return
false
;
}
/**********************************************************************************
* todo - D E V E L O P M E N T *
**********************************************************************************/
@Override
public
IpResourceDto
queryIp
(
String
username
,
IpResourceRequestDto
ipResourceRequestDto
)
{
Account
account
=
accountRepository
.
findByName
(
username
).
orElseThrow
(()
->
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
));
IpResource
ipResource
=
null
;
if
(
ipResourceRequestDto
.
getAddr
()
!=
null
&&
ipResourceRequestDto
.
getAddr
().
size
()
>
0
)
ipResource
=
ipResourceRepository
.
findByAddrAndIsDeleted
(
ipResourceRequestDto
.
getAddr
().
get
(
0
),
false
);
else
if
(
ipResourceRequestDto
.
getIpId
()
!=
null
&&
ipResourceRequestDto
.
getIpId
().
size
()
>
0
)
ipResource
=
ipResourceRepository
.
findByIdAndIsDeleted
(
ipResourceRequestDto
.
getIpId
().
get
(
0
),
false
);
else
{
else
if
(
ipResourceRequestDto
.
getIpId
()
!=
null
&&
ipResourceRequestDto
.
getIpId
().
size
()
>
0
)
{
String
s
=
ipResourceRequestDto
.
getIpId
().
get
(
0
);
ipResource
=
ipResourceRepository
.
findByIdAndIsDeleted
(
s
,
false
);
}
else
{
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
}
...
...
@@ -977,9 +984,9 @@ public class IpResourceServiceImpl implements IpResourceService {
case
5
:
// 已分配且未过期
ipResources
=
ipResourceRepository
.
findShopIdInList
(
shopIds
,
false
)
.
stream
()
.
filter
(
x
->
x
.
getValidTime
()
>
Instant
.
now
().
toEpochMilli
())
.
collect
(
Collectors
.
toList
());
.
stream
()
.
filter
(
x
->
x
.
getValidTime
()
>
Instant
.
now
().
toEpochMilli
())
.
collect
(
Collectors
.
toList
());
if
(!
isParent
)
notUsed
=
ipResourceRepository
.
findByOwnerAndStatusInAndIsDeletedAndBind
(
username
,
Arrays
.
asList
(
0
,
2
,
4
,
8
),
false
,
false
);
else
...
...
@@ -1043,24 +1050,24 @@ public class IpResourceServiceImpl implements IpResourceService {
private
AtomicReference
<
Double
>
getDoubleAtomicReference
(
IpResourceRequestDto
ipResourceRequestDto
,
Map
<
String
,
List
<
String
>>
ipPlatForm
)
{
AtomicReference
<
Double
>
totalprice
=
new
AtomicReference
<>((
double
)
0
);
ipResourceRequestDto
.
getAddr
().
stream
()
.
map
(
x
->
ipResourceRepository
.
findByAddrAndIsDeleted
(
x
,
false
))
.
forEach
(
ipResource
->
{
List
<
String
>
regionAndPriceInfos
;
if
(!
ipResourceRequestDto
.
getVendor
().
equals
(
"own"
))
{
regionAndPriceInfos
=
ipPlatForm
.
get
(
ipResource
.
getRegionCn
());
}
else
{
regionAndPriceInfos
=
ipResource
.
isSpecialLine
()
?
ipPlatForm
.
get
(
"自有专线"
)
:
ipPlatForm
.
get
(
"自有"
);
}
for
(
String
vendorprice
:
regionAndPriceInfos
)
{
if
(
ipResource
.
getVendor
().
getValue
().
equals
(
vendorprice
.
substring
(
0
,
vendorprice
.
indexOf
(
"-"
))))
totalprice
.
updateAndGet
(
v
->
new
Double
(
v
+
Double
.
valueOf
(
vendorprice
.
substring
(
vendorprice
.
lastIndexOf
(
"-"
)
+
1
)))
);
}
}
);
.
map
(
x
->
ipResourceRepository
.
findByAddrAndIsDeleted
(
x
,
false
))
.
forEach
(
ipResource
->
{
List
<
String
>
regionAndPriceInfos
;
if
(!
ipResourceRequestDto
.
getVendor
().
equals
(
"own"
))
{
regionAndPriceInfos
=
ipPlatForm
.
get
(
ipResource
.
getRegionCn
());
}
else
{
regionAndPriceInfos
=
ipResource
.
isSpecialLine
()
?
ipPlatForm
.
get
(
"自有专线"
)
:
ipPlatForm
.
get
(
"自有"
);
}
for
(
String
vendorprice
:
regionAndPriceInfos
)
{
if
(
ipResource
.
getVendor
().
getValue
().
equals
(
vendorprice
.
substring
(
0
,
vendorprice
.
indexOf
(
"-"
))))
totalprice
.
updateAndGet
(
v
->
new
Double
(
v
+
Double
.
valueOf
(
vendorprice
.
substring
(
vendorprice
.
lastIndexOf
(
"-"
)
+
1
)))
);
}
}
);
return
totalprice
;
}
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
88973940
...
...
@@ -59,6 +59,9 @@ public class ShopServiceImpl implements ShopService {
@Autowired
SpecialLineRepository
specialLineRepository
;
@Autowired
ShopUARepository
shopUARepository
;
@Override
public
String
addShop
(
String
username
,
ShopResultDto
shopResultDto
)
{
// 1. 对商铺的分组信息校验
...
...
@@ -705,6 +708,17 @@ public class ShopServiceImpl implements ShopService {
shopResultDto
.
setOwner
(
username
);
shop
.
of
(
shopResultDto
);
shop
.
setCreateTime
(
Instant
.
now
().
toEpochMilli
());
List
<
ShopUA
>
all
=
shopUARepository
.
findAll
();
List
<
String
>
uaList
=
new
ArrayList
<>();
for
(
ShopUA
shopUA
:
all
)
{
uaList
.
addAll
(
shopUA
.
getUaList
());
}
if
(!
uaList
.
contains
(
shop
.
getShopUA
()))
{
Random
random
=
new
Random
();
shop
.
setShopUA
(
uaList
.
get
(
random
.
nextInt
(
uaList
.
size
())));
}
String
id
=
shopRepository
.
save
(
shop
).
getShopId
();
return
id
;
}
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/VpsServiceImpl.java
View file @
88973940
...
...
@@ -88,7 +88,7 @@ public class VpsServiceImpl implements VpsService {
"use redirection server name:i:0\n"
+
"rdgiskdcproxy:i:0\n"
+
"kdcproxyname:s:\n"
+
"drivestoredirect:s:C:\\
:s:
D:\\\n"
+
"drivestoredirect:s:C:\\
;
D:\\\n"
+
"username:s:#VPS_USER#\n"
+
"password 51:b:#VPS_PASSWORD#\n"
;
...
...
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