Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
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
曲欣亮
sentinel
Commits
561a66c1
Commit
561a66c1
authored
Jan 18, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
b309f0a1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
5 deletions
+105
-5
NewsService.java
src/main/java/com/egolm/film/api/service/NewsService.java
+4
-0
NewsServiceImpl.java
...java/com/egolm/film/api/service/impl/NewsServiceImpl.java
+12
-1
AdminNewsController.java
...ava/com/egolm/film/api/web/admin/AdminNewsController.java
+4
-4
UserNewsController.java
.../java/com/egolm/film/api/web/user/UserNewsController.java
+72
-0
Fc_news_read.java
src/main/java/com/egolm/film/bean/Fc_news_read.java
+13
-0
No files found.
src/main/java/com/egolm/film/api/service/NewsService.java
View file @
561a66c1
...
...
@@ -11,8 +11,12 @@ public interface NewsService {
void
merge
(
Object
obj
);
void
save
(
Object
obj
);
void
batchSave
(
List
<?>
objs
);
Map
<
String
,
Object
>
queryById
(
Integer
id
);
List
<
Map
<
String
,
Object
>>
queryListForUser
(
Integer
uid
,
Page
page
);
}
src/main/java/com/egolm/film/api/service/impl/NewsServiceImpl.java
View file @
561a66c1
...
...
@@ -36,4 +36,15 @@ public class NewsServiceImpl implements NewsService {
return
jdbcTemplate
.
queryForMap
(
"select * from fc_news where id = ?"
,
id
);
}
@Override
public
void
save
(
Object
obj
)
{
jdbcTemplate
.
save
(
obj
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryListForUser
(
Integer
uid
,
Page
page
)
{
// TODO Auto-generated method stub
return
null
;
}
}
src/main/java/com/egolm/film/api/web/admin/AdminNewsController.java
View file @
561a66c1
...
...
@@ -58,8 +58,8 @@ public class AdminNewsController {
})
public
Object
save
(
Integer
id
,
String
type
,
String
title
,
String
content
,
Integer
level
)
{
Date
now
=
new
Date
();
LoginToken
loginT
oken
=
tokenService
.
getToken
();
Integer
adminid
=
(
Integer
)
loginToken
.
getId
();
LoginToken
t
oken
=
tokenService
.
getToken
();
Integer
adminid
=
(
(
Number
)
token
.
getId
()).
intValue
();
Fc_news
news
=
new
Fc_news
();
news
.
setId
(
id
);
news
.
setType
(
type
);
...
...
@@ -89,8 +89,8 @@ public class AdminNewsController {
})
public
Object
send
(
Integer
id
,
Integer
[]
user_id
,
Integer
[]
user_group_id
)
{
Date
now
=
new
Date
();
LoginToken
loginT
oken
=
tokenService
.
getToken
();
Integer
adminid
=
(
Integer
)
loginToken
.
getId
();
LoginToken
t
oken
=
tokenService
.
getToken
();
Integer
adminid
=
(
(
Number
)
token
.
getId
()).
intValue
();
List
<
Fc_news_sender
>
senders
=
new
ArrayList
<
Fc_news_sender
>();
for
(
Integer
uid
:
user_id
)
{
Fc_news_sender
sender
=
new
Fc_news_sender
();
...
...
src/main/java/com/egolm/film/api/web/user/UserNewsController.java
0 → 100644
View file @
561a66c1
package
com
.
egolm
.
film
.
api
.
web
.
user
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.service.NewsService
;
import
com.egolm.film.api.service.UserTokenService
;
import
com.egolm.film.bean.Fc_news_read
;
import
com.egolm.film.model.LoginToken
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
@Api
@Controller
@RequestMapping
(
"user/news"
)
public
class
UserNewsController
{
@Autowired
UserTokenService
tokenService
;
@Autowired
NewsService
service
;
@ResponseBody
@PostMapping
(
"list"
)
@ApiOperation
(
"公告列表查询"
)
public
Object
list
(
Long
index
,
Long
limit
)
{
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
20
:
limit
;
Page
page
=
new
Page
(
index
,
limit
);
LoginToken
token
=
tokenService
.
getToken
();
Integer
uid
=
((
Number
)
token
.
getId
()).
intValue
();
List
<
Map
<
String
,
Object
>>
list
=
service
.
queryListForUser
(
uid
,
page
);
return
Rjx
.
jsonOk
().
setData
(
list
).
setPage
(
page
);
}
@ResponseBody
@PostMapping
(
"saveReadLog"
)
@ApiOperation
(
"保存阅读记录"
)
public
Object
saveReadLog
(
Integer
news_id
,
Integer
user_id
)
{
Fc_news_read
read
=
new
Fc_news_read
();
read
.
setNews_id
(
news_id
);
read
.
setUser_id
(
user_id
);
read
.
setRead_time
(
new
Date
());
service
.
save
(
read
);
return
Rjx
.
jsonOk
();
}
@ResponseBody
@PostMapping
(
"getById"
)
@ApiOperation
(
"消息详情查询"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"id"
,
value
=
"消息ID"
),
})
public
Object
getById
(
Integer
id
)
{
Map
<
String
,
Object
>
map
=
service
.
queryById
(
id
);
return
Rjx
.
jsonOk
().
setData
(
map
);
}
}
src/main/java/com/egolm/film/bean/Fc_news_read.java
View file @
561a66c1
...
...
@@ -6,6 +6,8 @@ import javax.persistence.Column;
import
javax.persistence.Id
;
import
java.util.Date
;
@Entity
(
name
=
"fc_news_read"
)
public
class
Fc_news_read
implements
java
.
io
.
Serializable
{
...
...
@@ -19,6 +21,9 @@ public class Fc_news_read implements java.io.Serializable {
@Column
(
columnDefinition
=
"int(11)"
)
private
Integer
user_id
;
@Column
(
columnDefinition
=
"datetime"
)
private
Date
read_time
;
public
void
setNews_id
(
Integer
news_id
)
{
this
.
news_id
=
news_id
;
...
...
@@ -36,5 +41,13 @@ public class Fc_news_read implements java.io.Serializable {
return
user_id
;
}
public
void
setRead_time
(
Date
read_time
)
{
this
.
read_time
=
read_time
;
}
public
Date
getRead_time
()
{
return
read_time
;
}
}
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