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
144ed83a
Commit
144ed83a
authored
Jul 17, 2020
by
xuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将专线回落的代码移动到 administratorController 下
parent
e694e3cb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
81 deletions
+86
-81
AdminController.java
...ec/browserbackend/account/controller/AdminController.java
+0
-14
AdministratorController.java
...erbackend/account/controller/AdministratorController.java
+86
-67
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AdminController.java
View file @
144ed83a
...
@@ -6,7 +6,6 @@ import com.edgec.browserbackend.account.dto.ResultDto;
...
@@ -6,7 +6,6 @@ import com.edgec.browserbackend.account.dto.ResultDto;
import
com.edgec.browserbackend.account.dto.SubUsersRequestDto
;
import
com.edgec.browserbackend.account.dto.SubUsersRequestDto
;
import
com.edgec.browserbackend.account.service.AccountService
;
import
com.edgec.browserbackend.account.service.AccountService
;
import
com.edgec.browserbackend.browser.dto.ShopRequestDto
;
import
com.edgec.browserbackend.browser.dto.ShopRequestDto
;
import
com.edgec.browserbackend.browser.service.TempService
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
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.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -23,8 +22,6 @@ public class AdminController {
...
@@ -23,8 +22,6 @@ public class AdminController {
@Autowired
@Autowired
AccountService
accountService
;
AccountService
accountService
;
@Autowired
private
TempService
tempService
;
@RequestMapping
(
path
=
"/subuser/addone"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/subuser/addone"
,
method
=
RequestMethod
.
POST
)
public
ResultDto
createSubAccount
(
Principal
principal
,
@Valid
@RequestBody
AccountDto
user
)
{
public
ResultDto
createSubAccount
(
Principal
principal
,
@Valid
@RequestBody
AccountDto
user
)
{
...
@@ -132,15 +129,4 @@ public class AdminController {
...
@@ -132,15 +129,4 @@ public class AdminController {
return
resultDto
;
return
resultDto
;
}
}
/**
* 专线回落
*/
@PutMapping
(
value
=
"/updateip/{addr}/{flag}"
)
public
ResultDto
updateIp
(
@PathVariable
String
addr
,
@PathVariable
String
flag
)
{
tempService
.
saveIpResource
(
addr
,
flag
);
ResultDto
resultDto
=
new
ResultDto
();
resultDto
.
setStatus
(
0
);
return
resultDto
;
}
}
}
src/main/java/com/edgec/browserbackend/account/controller/AdministratorController.java
View file @
144ed83a
package
com
.
edgec
.
browserbackend
.
account
.
controller
;
package
com
.
edgec
.
browserbackend
.
account
.
controller
;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.account.dto.BillQueryResultDto
;
import
com.edgec.browserbackend.account.dto.BillQueryResultDto
;
import
com.edgec.browserbackend.account.dto.ResultDto
;
import
com.edgec.browserbackend.account.dto.ResultDto
;
import
com.edgec.browserbackend.account.dto.UserUsedDto
;
import
com.edgec.browserbackend.account.dto.UserUsedDto
;
import
com.edgec.browserbackend.account.service.*
;
import
com.edgec.browserbackend.account.service.*
;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode
;
import
com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode
;
import
com.edgec.browserbackend.browser.service.TempService
;
import
com.edgec.browserbackend.common.auth.Securitys
;
import
com.edgec.browserbackend.common.auth.Securitys
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -61,26 +61,29 @@ public class AdministratorController {
...
@@ -61,26 +61,29 @@ public class AdministratorController {
@Autowired
@Autowired
private
AccountService
accountService
;
private
AccountService
accountService
;
@Autowired
private
TempService
tempService
;
//--------------------------------ROOT用户操作--------------------------------------//
//--------------------------------ROOT用户操作--------------------------------------//
//管理员注册tested
//管理员注册tested
@PreAuthorize
(
Securitys
.
ROOT_EL
)
@PreAuthorize
(
Securitys
.
ROOT_EL
)
@RequestMapping
(
path
=
"/0xadministrator"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/0xadministrator"
,
method
=
RequestMethod
.
POST
)
public
Administrator
createNewAdministrator
(
@Valid
@RequestBody
Administrator
administrator
){
public
Administrator
createNewAdministrator
(
@Valid
@RequestBody
Administrator
administrator
)
{
return
administratorService
.
createAdministrator
(
administrator
);
return
administratorService
.
createAdministrator
(
administrator
);
}
}
//删除管理员testing
//删除管理员testing
@PreAuthorize
(
Securitys
.
ROOT_EL
)
@PreAuthorize
(
Securitys
.
ROOT_EL
)
@RequestMapping
(
path
=
"/0xadministrator/{name}"
,
method
=
RequestMethod
.
DELETE
)
@RequestMapping
(
path
=
"/0xadministrator/{name}"
,
method
=
RequestMethod
.
DELETE
)
public
void
deleteAdmin
(
@PathVariable
String
name
)
{
public
void
deleteAdmin
(
@PathVariable
String
name
)
{
administratorService
.
deleteAdministrator
(
name
);
administratorService
.
deleteAdministrator
(
name
);
}
}
// 查询所有的管理员
// 查询所有的管理员
@PreAuthorize
(
Securitys
.
ROOT_EL
)
@PreAuthorize
(
Securitys
.
ROOT_EL
)
@RequestMapping
(
path
=
"/0xadministrator"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator"
,
method
=
RequestMethod
.
GET
)
public
List
<
Administrator
>
getALLAdministrator
(){
public
List
<
Administrator
>
getALLAdministrator
()
{
return
administratorService
.
getAllAdministrator
();
return
administratorService
.
getAllAdministrator
();
}
}
...
@@ -88,8 +91,8 @@ public class AdministratorController {
...
@@ -88,8 +91,8 @@ public class AdministratorController {
//修改管理员权限tested
//修改管理员权限tested
@PreAuthorize
(
Securitys
.
ROOT_EL
)
@PreAuthorize
(
Securitys
.
ROOT_EL
)
@RequestMapping
(
path
=
"/0xadministrator/{name}"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
path
=
"/0xadministrator/{name}"
,
method
=
RequestMethod
.
PUT
)
public
Administrator
updateAgencyInfo
(
@PathVariable
String
name
,
@Valid
@RequestBody
String
string
){
public
Administrator
updateAgencyInfo
(
@PathVariable
String
name
,
@Valid
@RequestBody
String
string
)
{
return
administratorService
.
updateAdministrator
(
name
,
string
);
return
administratorService
.
updateAdministrator
(
name
,
string
);
}
}
//用户通过银行转账,手动插入余额记录
//用户通过银行转账,手动插入余额记录
...
@@ -109,17 +112,15 @@ public class AdministratorController {
...
@@ -109,17 +112,15 @@ public class AdministratorController {
//--------------------------------用户--------------------------------------//
//--------------------------------用户--------------------------------------//
//根据用户的性名,或者电话,或者邮件,查询用户的信息tested
//根据用户的性名,或者电话,或者邮件,查询用户的信息tested
@PreAuthorize
(
"hasRole('ADMIN')"
)
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/searchuser/{target}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/searchuser/{target}"
,
method
=
RequestMethod
.
GET
)
public
Account
getAccountByTarget
(
@RequestParam
(
"by"
)
String
by
,
@PathVariable
String
target
)
{
public
Account
getAccountByTarget
(
@RequestParam
(
"by"
)
String
by
,
@PathVariable
String
target
)
{
Account
searchAccount
=
new
Account
();
Account
searchAccount
=
new
Account
();
if
(
"name"
.
equals
(
by
))
{
if
(
"name"
.
equals
(
by
))
{
searchAccount
=
administratorService
.
getAccountByName
(
target
);
searchAccount
=
administratorService
.
getAccountByName
(
target
);
}
}
else
if
(
"phoneNumber"
.
equals
(
by
))
{
else
if
(
"phoneNumber"
.
equals
(
by
)){
searchAccount
=
administratorService
.
getAccountByPhoneNumber
(
target
);
searchAccount
=
administratorService
.
getAccountByPhoneNumber
(
target
);
}
}
else
if
(
"email"
.
equals
(
by
))
{
else
if
(
"email"
.
equals
(
by
)){
searchAccount
=
administratorService
.
getAccountByEmail
(
target
);
searchAccount
=
administratorService
.
getAccountByEmail
(
target
);
}
}
...
@@ -129,26 +130,25 @@ public class AdministratorController {
...
@@ -129,26 +130,25 @@ public class AdministratorController {
//根据用户名查询用户账单tested
//根据用户名查询用户账单tested
@PreAuthorize
(
"hasRole('ADMIN')"
)
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/searchuserbill/{name}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/searchuserbill/{name}"
,
method
=
RequestMethod
.
GET
)
public
BillQueryResultDto
getUserBillByName
(
@PathVariable
String
name
,
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"size"
)
int
size
){
public
BillQueryResultDto
getUserBillByName
(
@PathVariable
String
name
,
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"size"
)
int
size
)
{
return
administratorService
.
getUserBillingByName
(
name
);
return
administratorService
.
getUserBillingByName
(
name
);
}
}
//给用户激活未激活或者被锁住的账户tested
//给用户激活未激活或者被锁住的账户tested
@PreAuthorize
(
"hasRole('ADMIN')"
)
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/unlockaccount/{name}"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
path
=
"/0xadministrator/unlockaccount/{name}"
,
method
=
RequestMethod
.
PUT
)
public
Account
unLockAccount
(
@PathVariable
String
name
,
@Valid
@RequestBody
Account
account
)
{
public
Account
unLockAccount
(
@PathVariable
String
name
,
@Valid
@RequestBody
Account
account
)
{
return
administratorService
.
unLockLockedAccount
(
name
,
account
);
return
administratorService
.
unLockLockedAccount
(
name
,
account
);
}
}
//锁住异常用户tested
//锁住异常用户tested
@PreAuthorize
(
"hasRole('ADMIN')"
)
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/lockaccount/{name}"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
path
=
"/0xadministrator/lockaccount/{name}"
,
method
=
RequestMethod
.
PUT
)
public
Account
lockAccount
(
@PathVariable
String
name
,
@Valid
@RequestBody
Account
account
)
{
public
Account
lockAccount
(
@PathVariable
String
name
,
@Valid
@RequestBody
Account
account
)
{
return
administratorService
.
lockAbnormalAccount
(
name
,
account
);
return
administratorService
.
lockAbnormalAccount
(
name
,
account
);
}
}
//查询用户余额
//查询用户余额
...
@@ -190,32 +190,32 @@ public class AdministratorController {
...
@@ -190,32 +190,32 @@ public class AdministratorController {
//查看所有的用户<分页查询> tested
//查看所有的用户<分页查询> tested
@PreAuthorize
(
"hasRole('ADMIN')"
)
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/searchalluser"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/searchalluser"
,
method
=
RequestMethod
.
GET
)
public
Page
<
Account
>
searchAllUser
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
//(@PathVariable int page){
public
Page
<
Account
>
searchAllUser
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
//(@PathVariable int page){
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
return
administratorService
.
searchAllUserPage
(
pageable
);
return
administratorService
.
searchAllUserPage
(
pageable
);
}
}
//查询某时段内增加的用户
//查询某时段内增加的用户
@PreAuthorize
(
"hasRole('ADMIN')"
)
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/searchperioduser"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/searchperioduser"
,
method
=
RequestMethod
.
GET
)
public
Page
<
Account
>
searchCreateAccount
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"strDate1"
)
String
strDate1
,
@RequestParam
(
value
=
"strDate2"
)
String
strDate2
,
@RequestParam
(
value
=
"isAuthorized"
,
defaultValue
=
"5"
)
int
isAuthorized
)
{
public
Page
<
Account
>
searchCreateAccount
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"strDate1"
)
String
strDate1
,
@RequestParam
(
value
=
"strDate2"
)
String
strDate2
,
@RequestParam
(
value
=
"isAuthorized"
,
defaultValue
=
"5"
)
int
isAuthorized
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
return
administratorService
.
searchCreateAccountBetween
(
pageable
,
strDate1
,
strDate2
,
isAuthorized
);
return
administratorService
.
searchCreateAccountBetween
(
pageable
,
strDate1
,
strDate2
,
isAuthorized
);
}
}
// 查询所有用户消费
// 查询所有用户消费
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/allused"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/allused"
,
method
=
RequestMethod
.
GET
)
public
Page
<
UserUsedDto
>
findAllused
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
public
Page
<
UserUsedDto
>
findAllused
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
return
administratorService
.
getAllUserUsed
(
pageable
);
return
administratorService
.
getAllUserUsed
(
pageable
);
}
}
//search company earnings detail by month tested
//search company earnings detail by month tested
@PreAuthorize
(
"hasRole('ADMIN')"
)
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/companyearning/{stringdate}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/companyearning/{stringdate}"
,
method
=
RequestMethod
.
GET
)
public
List
<
CompanyEarningsDto
>
getCompanyEarning
(
@PathVariable
String
stringdate
)
{
public
List
<
CompanyEarningsDto
>
getCompanyEarning
(
@PathVariable
String
stringdate
)
{
return
administratorService
.
getCompanyEarningDetail
(
stringdate
);
return
administratorService
.
getCompanyEarningDetail
(
stringdate
);
}
}
...
@@ -230,17 +230,18 @@ public class AdministratorController {
...
@@ -230,17 +230,18 @@ public class AdministratorController {
//查找某个用户或者代理有没有被锁住
//查找某个用户或者代理有没有被锁住
@PreAuthorize
(
"hasRole('ADMIN')"
)
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/lockstate/{name}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/lockstate/{name}"
,
method
=
RequestMethod
.
GET
)
public
boolean
getLockState
(
@PathVariable
String
name
){
public
boolean
getLockState
(
@PathVariable
String
name
)
{
return
administratorService
.
getUserLockState
(
name
);
return
administratorService
.
getUserLockState
(
name
);
}
}
//对欠费用户强制停机
//对欠费用户强制停机
/** 用户费率 */
/**
* 用户费率
*/
// 设置费率
// 设置费率
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
...
@@ -252,7 +253,7 @@ public class AdministratorController {
...
@@ -252,7 +253,7 @@ public class AdministratorController {
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/adduserrate"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/0xadministrator/adduserrate"
,
method
=
RequestMethod
.
POST
)
public
void
insertUserRate
(
@RequestBody
UserRate
userRate
){
public
void
insertUserRate
(
@RequestBody
UserRate
userRate
)
{
userRateService
.
addUserRate
(
userRate
);
userRateService
.
addUserRate
(
userRate
);
}
}
...
@@ -290,10 +291,10 @@ public class AdministratorController {
...
@@ -290,10 +291,10 @@ public class AdministratorController {
//每月预付费统计分页展示
//每月预付费统计分页展示
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/listReport"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/listReport"
,
method
=
RequestMethod
.
GET
)
public
Page
<
CompanyMonthReport
>
listMonthReport
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"0"
)
int
page
,
public
Page
<
CompanyMonthReport
>
listMonthReport
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"0"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
)
{
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
return
monthReportService
.
listMonthReport
(
pageable
);
return
monthReportService
.
listMonthReport
(
pageable
);
}
}
...
@@ -308,29 +309,29 @@ public class AdministratorController {
...
@@ -308,29 +309,29 @@ public class AdministratorController {
//获取用户企业认证的图片
//获取用户企业认证的图片
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/authorize/files"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/authorize/files"
,
method
=
RequestMethod
.
GET
)
public
ResultDto
getAuthorizeFiles
(
Principal
principal
,
@RequestParam
(
"username"
)
String
username
,
HttpServletResponse
response
)
{
public
ResultDto
getAuthorizeFiles
(
Principal
principal
,
@RequestParam
(
"username"
)
String
username
,
HttpServletResponse
response
)
{
ResultDto
resultDto
=
new
ResultDto
();
ResultDto
resultDto
=
new
ResultDto
();
try
{
try
{
File
tempFile
=
accountService
.
getAuthorizeFiles
(
username
);
File
tempFile
=
accountService
.
getAuthorizeFiles
(
username
);
try
(
OutputStream
os
=
response
.
getOutputStream
();
try
(
OutputStream
os
=
response
.
getOutputStream
();
FileInputStream
fis
=
new
FileInputStream
(
tempFile
))
{
FileInputStream
fis
=
new
FileInputStream
(
tempFile
))
{
response
.
setHeader
(
"content-type"
,
"application/octet-stream"
);
response
.
setHeader
(
"content-type"
,
"application/octet-stream"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"Licenses.zip"
,
"UTF-8"
));
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"Licenses.zip"
,
"UTF-8"
));
int
len
=
0
;
int
len
=
0
;
byte
[]
bt
=
new
byte
[
5
*
1024
];
byte
[]
bt
=
new
byte
[
5
*
1024
];
while
((
len
=
fis
.
read
(
bt
))
!=
-
1
)
{
while
((
len
=
fis
.
read
(
bt
))
!=
-
1
)
{
os
.
write
(
bt
,
0
,
len
);
os
.
write
(
bt
,
0
,
len
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
}
finally
{
}
finally
{
tempFile
.
delete
();
tempFile
.
delete
();
}
}
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
...
@@ -348,7 +349,7 @@ public class AdministratorController {
...
@@ -348,7 +349,7 @@ public class AdministratorController {
try
{
try
{
resultDto
.
setData
(
accountService
.
getAuthorizeDetails
(
username
));
resultDto
.
setData
(
accountService
.
getAuthorizeDetails
(
username
));
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
...
@@ -366,7 +367,7 @@ public class AdministratorController {
...
@@ -366,7 +367,7 @@ public class AdministratorController {
try
{
try
{
resultDto
.
setData
(
accountService
.
setAuthorize
(
username
,
isAgree
));
resultDto
.
setData
(
accountService
.
setAuthorize
(
username
,
isAgree
));
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
...
@@ -385,7 +386,7 @@ public class AdministratorController {
...
@@ -385,7 +386,7 @@ public class AdministratorController {
try
{
try
{
administratorService
.
addPromotionCode
(
username
,
promotionCode
);
administratorService
.
addPromotionCode
(
username
,
promotionCode
);
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
...
@@ -403,7 +404,7 @@ public class AdministratorController {
...
@@ -403,7 +404,7 @@ public class AdministratorController {
try
{
try
{
administratorService
.
addWhiteList
(
website
);
administratorService
.
addWhiteList
(
website
);
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
...
@@ -421,7 +422,7 @@ public class AdministratorController {
...
@@ -421,7 +422,7 @@ public class AdministratorController {
try
{
try
{
administratorService
.
addUserWhiteList
(
username
,
website
);
administratorService
.
addUserWhiteList
(
username
,
website
);
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
...
@@ -439,7 +440,7 @@ public class AdministratorController {
...
@@ -439,7 +440,7 @@ public class AdministratorController {
try
{
try
{
resultDto
.
setData
(
administratorService
.
queyrIpCount
(
username
));
resultDto
.
setData
(
administratorService
.
queyrIpCount
(
username
));
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
...
@@ -452,15 +453,15 @@ public class AdministratorController {
...
@@ -452,15 +453,15 @@ public class AdministratorController {
//统计推广码下消费
//统计推广码下消费
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/promotioncode/query"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/promotioncode/query"
,
method
=
RequestMethod
.
GET
)
public
ResultDto
queryPromotion
(
Principal
principal
,
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
,
public
ResultDto
queryPromotion
(
Principal
principal
,
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"strDate1"
)
String
strDate1
,
@RequestParam
(
value
=
"strDate2"
)
String
strDate2
,
@RequestParam
(
value
=
"strDate1"
)
String
strDate1
,
@RequestParam
(
value
=
"strDate2"
)
String
strDate2
,
@RequestParam
(
value
=
"username"
,
required
=
false
)
String
username
,
@RequestParam
(
value
=
"promotionCode"
,
required
=
false
)
String
promotionCode
)
{
@RequestParam
(
value
=
"username"
,
required
=
false
)
String
username
,
@RequestParam
(
value
=
"promotionCode"
,
required
=
false
)
String
promotionCode
)
{
ResultDto
resultDto
=
new
ResultDto
();
ResultDto
resultDto
=
new
ResultDto
();
try
{
try
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
resultDto
.
setData
(
administratorService
.
queryPromotion
(
pageable
,
username
,
promotionCode
,
strDate1
,
strDate2
));
resultDto
.
setData
(
administratorService
.
queryPromotion
(
pageable
,
username
,
promotionCode
,
strDate1
,
strDate2
));
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
statusInfo
.
put
(
"code"
,
e
.
getErrorCode
());
...
@@ -477,18 +478,18 @@ public class AdministratorController {
...
@@ -477,18 +478,18 @@ public class AdministratorController {
if
(
StringUtils
.
isNotBlank
(
key
)
&&
key
.
equals
(
mykey
))
if
(
StringUtils
.
isNotBlank
(
key
)
&&
key
.
equals
(
mykey
))
file
=
administratorService
.
getProxyConfig
();
file
=
administratorService
.
getProxyConfig
();
if
(
file
!=
null
)
{
if
(
file
!=
null
)
{
try
(
OutputStream
os
=
response
.
getOutputStream
();
try
(
OutputStream
os
=
response
.
getOutputStream
();
FileInputStream
fis
=
new
FileInputStream
(
file
))
{
FileInputStream
fis
=
new
FileInputStream
(
file
))
{
response
.
setHeader
(
"content-type"
,
"application/octet-stream"
);
response
.
setHeader
(
"content-type"
,
"application/octet-stream"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"3proxy.cfg"
,
"UTF-8"
));
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"3proxy.cfg"
,
"UTF-8"
));
int
len
=
0
;
int
len
=
0
;
byte
[]
bt
=
new
byte
[
50
*
1024
];
byte
[]
bt
=
new
byte
[
50
*
1024
];
while
((
len
=
fis
.
read
(
bt
))
!=
-
1
)
{
while
((
len
=
fis
.
read
(
bt
))
!=
-
1
)
{
os
.
write
(
bt
,
0
,
len
);
os
.
write
(
bt
,
0
,
len
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
}
finally
{
}
finally
{
...
@@ -499,6 +500,24 @@ public class AdministratorController {
...
@@ -499,6 +500,24 @@ public class AdministratorController {
}
}
}
}
/**
* 专线回落
*/
@PutMapping
(
value
=
"/updateip/{addr}/{flag}"
)
public
ResultDto
updateIp
(
@PathVariable
String
addr
,
@PathVariable
String
flag
)
{
ResultDto
resultDto
=
new
ResultDto
();
try
{
tempService
.
saveIpResource
(
addr
,
flag
);
resultDto
.
setStatus
(
0
);
}
catch
(
Exception
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setData
(
e
.
getMessage
());
}
return
resultDto
;
}
}
}
...
...
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