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
677dd280
Commit
677dd280
authored
Jan 19, 2021
by
huangjiamin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-maintain-notice' into 'master'
Feature maintain notice See merge request
!235
parents
6404622b
8ee9115a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
150 additions
and
5 deletions
+150
-5
AdministratorController.java
...erbackend/account/controller/AdministratorController.java
+32
-3
Notice.java
.../java/com/edgec/browserbackend/account/domain/Notice.java
+33
-0
NoticeDto.java
.../java/com/edgec/browserbackend/account/dto/NoticeDto.java
+40
-0
NoticeRepository.java
...c/browserbackend/account/repository/NoticeRepository.java
+12
-0
AdministratorService.java
.../browserbackend/account/service/AdministratorService.java
+6
-2
AdministratorServiceImpl.java
...ackend/account/service/impl/AdministratorServiceImpl.java
+27
-0
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AdministratorController.java
View file @
677dd280
...
@@ -3,6 +3,7 @@ package com.edgec.browserbackend.account.controller;
...
@@ -3,6 +3,7 @@ package com.edgec.browserbackend.account.controller;
import
com.edgec.browserbackend.account.domain.*
;
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.NoticeDto
;
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.*
;
...
@@ -20,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -20,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -621,9 +621,9 @@ public class AdministratorController {
...
@@ -621,9 +621,9 @@ public class AdministratorController {
/**
/**
* 迁移ip
* 迁移ip
*
*
* @param owner owner
* @param owner
owner
* @param newOwner newOwner
* @param newOwner newOwner
* @param ips ips
* @param ips
ips
* @return ResultDto
* @return ResultDto
*/
*/
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
...
@@ -659,6 +659,35 @@ public class AdministratorController {
...
@@ -659,6 +659,35 @@ public class AdministratorController {
public
List
<
PayBack
>
deleteBack
(
Integer
pay
)
{
public
List
<
PayBack
>
deleteBack
(
Integer
pay
)
{
return
payBackService
.
deletePayBack
(
pay
);
return
payBackService
.
deletePayBack
(
pay
);
}
}
/**
* 设置公告
*/
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/setNotice"
,
method
=
RequestMethod
.
POST
)
public
boolean
setNotice
(
@RequestBody
Notice
notice
)
{
administratorService
.
setNotice
(
notice
);
return
true
;
}
/**
* 查询公告
*/
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/getNotice"
,
method
=
RequestMethod
.
GET
)
public
NoticeDto
getNotice
()
{
return
administratorService
.
getNotice
();
}
/**
* 删除公告
*/
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/delNotice"
,
method
=
RequestMethod
.
DELETE
)
public
boolean
delNotice
()
{
administratorService
.
delNotice
();
return
true
;
}
}
}
...
...
src/main/java/com/edgec/browserbackend/account/domain/Notice.java
0 → 100644
View file @
677dd280
package
com
.
edgec
.
browserbackend
.
account
.
domain
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
org.hibernate.validator.constraints.Length
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
@NoArgsConstructor
@Getter
@Setter
@Document
(
collection
=
"notices"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
Notice
{
@Id
private
String
name
;
private
String
starDate
;
private
String
endDate
;
@Length
(
min
=
0
,
max
=
20000
)
private
String
content
;
public
Notice
(
String
starDate
,
String
endDate
,
@Length
(
min
=
0
,
max
=
20000
)
String
content
)
{
this
.
starDate
=
starDate
;
this
.
endDate
=
endDate
;
this
.
content
=
content
;
}
}
src/main/java/com/edgec/browserbackend/account/dto/NoticeDto.java
0 → 100644
View file @
677dd280
package
com
.
edgec
.
browserbackend
.
account
.
dto
;
public
class
NoticeDto
{
String
starDate
;
String
endDate
;
String
content
;
public
NoticeDto
(
String
starDate
,
String
endDate
,
String
content
)
{
this
.
starDate
=
starDate
;
this
.
endDate
=
endDate
;
this
.
content
=
content
;
}
public
String
getStarDate
()
{
return
starDate
;
}
public
void
setStarDate
(
String
starDate
)
{
this
.
starDate
=
starDate
;
}
public
String
getEndDate
()
{
return
endDate
;
}
public
void
setEndDate
(
String
endDate
)
{
this
.
endDate
=
endDate
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
}
src/main/java/com/edgec/browserbackend/account/repository/NoticeRepository.java
0 → 100644
View file @
677dd280
package
com
.
edgec
.
browserbackend
.
account
.
repository
;
import
com.edgec.browserbackend.account.domain.Notice
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
NoticeRepository
extends
MongoRepository
<
Notice
,
String
>
{
Notice
findOneByNameIsNotNull
();
}
src/main/java/com/edgec/browserbackend/account/service/AdministratorService.java
View file @
677dd280
...
@@ -2,7 +2,6 @@ package com.edgec.browserbackend.account.service;
...
@@ -2,7 +2,6 @@ package com.edgec.browserbackend.account.service;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.account.dto.*
;
import
com.edgec.browserbackend.account.dto.*
;
import
com.edgec.browserbackend.browser.domain.IpResource
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
...
@@ -70,8 +69,13 @@ public interface AdministratorService {
...
@@ -70,8 +69,13 @@ public interface AdministratorService {
Long
convertToDistributor
(
String
id
,
boolean
tag
);
Long
convertToDistributor
(
String
id
,
boolean
tag
);
List
<
String
>
getUsernameIpList
(
String
owner
);
List
<
String
>
getUsernameIpList
(
String
owner
);
List
<
String
>
ipMigration
(
String
owner
,
String
newOwner
,
String
ips
);
List
<
String
>
ipMigration
(
String
owner
,
String
newOwner
,
String
ips
);
void
setNotice
(
Notice
notice
);
NoticeDto
getNotice
();
void
delNotice
();
}
}
src/main/java/com/edgec/browserbackend/account/service/impl/AdministratorServiceImpl.java
View file @
677dd280
...
@@ -79,6 +79,8 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -79,6 +79,8 @@ public class AdministratorServiceImpl implements AdministratorService {
@Autowired
@Autowired
private
ShopRepository
shopRepository
;
private
ShopRepository
shopRepository
;
@Autowired
private
NoticeRepository
noticeRepository
;
@Override
@Override
public
Administrator
createAdministrator
(
Administrator
administrator
)
{
public
Administrator
createAdministrator
(
Administrator
administrator
)
{
...
@@ -769,7 +771,32 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -769,7 +771,32 @@ public class AdministratorServiceImpl implements AdministratorService {
}
}
}
}
@Override
public
void
setNotice
(
Notice
notice
)
{
Notice
only
=
noticeRepository
.
findOneByNameIsNotNull
();
if
(
only
!=
null
)
{
only
.
setStarDate
(
notice
.
getStarDate
());
only
.
setEndDate
(
notice
.
getEndDate
());
only
.
setContent
(
notice
.
getContent
());
noticeRepository
.
save
(
only
);
}
else
{
noticeRepository
.
save
(
notice
);
}
}
@Override
public
NoticeDto
getNotice
()
{
Notice
notice
=
noticeRepository
.
findOneByNameIsNotNull
();
if
(
notice
!=
null
)
{
return
new
NoticeDto
(
notice
.
getStarDate
(),
notice
.
getEndDate
(),
notice
.
getContent
());
}
return
null
;
}
@Override
public
void
delNotice
()
{
noticeRepository
.
deleteAll
();
}
}
}
...
...
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