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
aec1ad3d
Commit
aec1ad3d
authored
Oct 30, 2018
by
zhangyong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.egolm.com/hanxu/siff-film-api
parents
c532f860
d4f2021a
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
523 additions
and
49 deletions
+523
-49
pom.xml
pom.xml
+3
-9
TokenService.java
src/main/java/com/egolm/film/api/TokenService.java
+5
-2
AdminTokenServiceImpl.java
...lm/film/api/admin/service/impl/AdminTokenServiceImpl.java
+20
-0
AliyunApiController.java
...n/java/com/egolm/film/api/common/AliyunApiController.java
+1
-1
LanguageServiceImpl.java
...olm/film/api/common/service/impl/LanguageServiceImpl.java
+2
-2
MemberApplyController.java
...java/com/egolm/film/api/member/MemberApplyController.java
+0
-3
MemberService.java
...java/com/egolm/film/api/member/service/MemberService.java
+4
-1
MemberTokenService.java
...com/egolm/film/api/member/service/MemberTokenService.java
+1
-1
MemberServiceImpl.java
...egolm/film/api/member/service/impl/MemberServiceImpl.java
+12
-3
MemberTokenServiceImpl.java
.../film/api/member/service/impl/MemberTokenServiceImpl.java
+25
-1
UserReviewController.java
...in/java/com/egolm/film/api/user/UserReviewController.java
+189
-0
UserReviewService.java
...va/com/egolm/film/api/user/service/UserReviewService.java
+30
-0
UserReviewServiceImpl.java
...olm/film/api/user/service/impl/UserReviewServiceImpl.java
+136
-0
UserTokenServiceImpl.java
...golm/film/api/user/service/impl/UserTokenServiceImpl.java
+44
-24
WebMvcConfig.java
src/main/java/com/egolm/film/config/WebMvcConfig.java
+13
-0
AdminLoginInterceptor.java
.../egolm/film/config/interceptor/AdminLoginInterceptor.java
+12
-0
MemberLoginInterceptor.java
...egolm/film/config/interceptor/MemberLoginInterceptor.java
+12
-0
UserLoginInterceptor.java
...m/egolm/film/config/interceptor/UserLoginInterceptor.java
+12
-0
AliyunUtil.java
src/main/java/com/egolm/film/util/AliyunUtil.java
+1
-1
DBUtil.java
src/main/java/com/egolm/film/util/DBUtil.java
+1
-1
No files found.
pom.xml
View file @
aec1ad3d
...
...
@@ -18,15 +18,9 @@
<repositories>
<repository>
<id>
sonatype-nexus-staging
</id>
<name>
Sonatype Nexus Staging
</name>
<url>
https://oss.sonatype.org/service/local/staging/deploy/maven2/
</url>
<releases>
<enabled>
true
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
<id>
alimaven
</id>
<name>
aliyun maven
</name>
<url>
http://maven.aliyun.com/nexus/content/groups/public/
</url>
</repository>
</repositories>
...
...
src/main/java/com/egolm/film/api/TokenService.java
View file @
aec1ad3d
...
...
@@ -3,13 +3,16 @@ package com.egolm.film.api;
import
com.egolm.film.model.LoginToken
;
public
interface
TokenService
{
final
String
JSESSIONID
=
"JSESSIONID"
;
LoginToken
getToken
();
LoginToken
doLogin
(
String
username
,
String
password
);
void
doLogout
();
boolean
isLogin
();
boolean
isLoginByToken
(
String
token
);
}
src/main/java/com/egolm/film/api/admin/service/impl/AdminTokenServiceImpl.java
View file @
aec1ad3d
...
...
@@ -3,6 +3,7 @@ package com.egolm.film.api.admin.service.impl;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -35,6 +36,11 @@ public class AdminTokenServiceImpl implements AdminTokenService {
Integer
adminid
=
(
Integer
)
map
.
get
(
"adminid"
);
LoginToken
token
=
new
LoginToken
(
adminid
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
Cookie
cookie
=
WebMvcConfig
.
getCookie
(
JSESSIONID
);
if
(
cookie
!=
null
)
{
String
sql
=
"update fc_admin set token = ? where id = ?"
;
jdbcTemplate
.
executeUpdate
(
sql
,
cookie
.
getValue
(),
adminid
);
}
return
token
;
}
else
if
(
state
==
2
)
{
throw
new
XException
(
"用户已禁用"
);
...
...
@@ -69,4 +75,18 @@ public class AdminTokenServiceImpl implements AdminTokenService {
public
boolean
isLogin
()
{
return
this
.
getToken
()
!=
null
;
}
@Override
public
boolean
isLoginByToken
(
String
token_string
)
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
try
{
String
sql
=
"select adminid from fc_admin where token = ?"
;
Integer
adminid
=
jdbcTemplate
.
queryForInt
(
sql
,
token_string
);
LoginToken
token
=
new
LoginToken
(
adminid
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
return
true
;
}
catch
(
Exception
e
)
{
return
false
;
}
}
}
src/main/java/com/egolm/film/api/common/AliyunApiController.java
View file @
aec1ad3d
...
...
@@ -18,7 +18,7 @@ import com.aliyuncs.vod.model.v20170321.RefreshUploadVideoResponse;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.film.api.common.service.Messages
;
import
com.egolm.film.
api.
util.AliyunUtil
;
import
com.egolm.film.util.AliyunUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
src/main/java/com/egolm/film/api/common/service/impl/LanguageServiceImpl.java
View file @
aec1ad3d
...
...
@@ -12,8 +12,8 @@ import com.egolm.film.api.common.service.LanguageService;
@Service
public
class
LanguageServiceImpl
implements
LanguageService
{
static
String
en
=
"Chinese,French,Russian,Japanese,Portugal,Farsi,Italian,English,German,Spanish,Arabic,Hindi,Korean,Other"
;
static
String
zh
=
"
中文
,法语,俄罗斯语,日文,葡萄牙语,波斯语,意大利语,英语,德语,西班牙语,阿拉伯语,印第语,韩语,其他"
;
static
String
en
=
"Chinese,
Dialect,
French,Russian,Japanese,Portugal,Farsi,Italian,English,German,Spanish,Arabic,Hindi,Korean,Other"
;
static
String
zh
=
"
普通话,方言
,法语,俄罗斯语,日文,葡萄牙语,波斯语,意大利语,英语,德语,西班牙语,阿拉伯语,印第语,韩语,其他"
;
public
List
<
Map
<
String
,
String
>>
queryLanguageList
()
{
List
<
Map
<
String
,
String
>>
list
=
new
ArrayList
<
Map
<
String
,
String
>>();
...
...
src/main/java/com/egolm/film/api/member/MemberApplyController.java
View file @
aec1ad3d
...
...
@@ -110,7 +110,6 @@ public class MemberApplyController {
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"film_medium"
,
value
=
"影片色彩"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"film_format"
,
value
=
"样片规格"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"film_express_no"
,
value
=
"快递单号"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"film_format_url"
,
value
=
"样片URL地址"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"film_format_passw"
,
value
=
"样片URL访问密码"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"film_format_other"
,
value
=
"其他样品信息"
),
...
...
@@ -130,7 +129,6 @@ public class MemberApplyController {
String
other_filmfest_name
,
String
film_medium
,
String
film_format
,
String
film_express_no
,
String
film_format_url
,
String
film_format_passw
,
String
film_format_other
)
{
...
...
@@ -153,7 +151,6 @@ public class MemberApplyController {
other_filmfest_name
,
film_medium
,
film_format
,
film_express_no
,
film_format_url
,
film_format_passw
,
film_format_other
);
...
...
src/main/java/com/egolm/film/api/member/service/MemberService.java
View file @
aec1ad3d
...
...
@@ -82,7 +82,6 @@ public interface MemberService {
String
other_filmfest_name
,
String
film_medium
,
String
film_format
,
String
film_express_no
,
String
film_format_url
,
String
film_format_passw
,
String
film_format_other
);
...
...
@@ -126,4 +125,8 @@ public interface MemberService {
boolean
changePasswordByMemberId
(
Integer
member_id
,
String
password
,
String
newPassword
);
Fc_member
getMemberByToken
(
String
token
);
void
updateToken
(
Integer
member_id
,
String
token_string
);
}
src/main/java/com/egolm/film/api/member/service/MemberTokenService.java
View file @
aec1ad3d
...
...
@@ -5,5 +5,5 @@ import com.egolm.film.api.TokenService;
public
interface
MemberTokenService
extends
TokenService
{
final
String
TOKEN_NAME
=
"FILM_MEMBER_LOGIN_TOKEN_NAME"
;
}
src/main/java/com/egolm/film/api/member/service/impl/MemberServiceImpl.java
View file @
aec1ad3d
...
...
@@ -223,7 +223,6 @@ public class MemberServiceImpl implements MemberService {
String
other_filmfest_name
,
String
film_medium
,
String
film_format
,
String
film_express_no
,
String
film_format_url
,
String
film_format_passw
,
String
film_format_other
)
{
...
...
@@ -246,7 +245,6 @@ public class MemberServiceImpl implements MemberService {
+
"other_filmfest_name = ?, "
+
"film_medium = ?, "
+
"film_format = ?, "
+
"film_express_no = ?, "
+
"film_format_url = ?, "
+
"film_format_passw = ?, "
+
"film_format_other = ?, "
...
...
@@ -269,7 +267,6 @@ public class MemberServiceImpl implements MemberService {
other_filmfest_name
,
film_medium
,
film_format
,
film_express_no
,
film_format_url
,
film_format_passw
,
film_format_other
,
...
...
@@ -469,4 +466,16 @@ public class MemberServiceImpl implements MemberService {
return
false
;
}
@Override
public
Fc_member
getMemberByToken
(
String
token
)
{
String
sql
=
"select * from fc_member where token = ?"
;
return
jdbcTemplate
.
queryForBean
(
sql
,
Fc_member
.
class
,
token
);
}
@Override
public
void
updateToken
(
Integer
member_id
,
String
token_string
)
{
String
sql
=
"update fc_member set token = ? where id = ?"
;
jdbcTemplate
.
executeUpdate
(
sql
,
token_string
,
member_id
);
}
}
src/main/java/com/egolm/film/api/member/service/impl/MemberTokenServiceImpl.java
View file @
aec1ad3d
package
com
.
egolm
.
film
.
api
.
member
.
service
.
impl
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -41,6 +42,10 @@ public class MemberTokenServiceImpl implements MemberTokenService {
Integer
id
=
member
.
getId
();
LoginToken
token
=
new
LoginToken
(
id
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
Cookie
cookie
=
WebMvcConfig
.
getCookie
(
JSESSIONID
);
if
(
cookie
!=
null
)
{
memberService
.
updateToken
(
id
,
cookie
.
getValue
());
}
return
token
;
}
else
{
throw
new
XException
(
messages
.
get
(
"err.user_pwd_err"
));
...
...
@@ -51,7 +56,7 @@ public class MemberTokenServiceImpl implements MemberTokenService {
throw
new
XException
(
messages
.
get
(
"err"
));
}
}
@Override
public
LoginToken
getToken
()
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
...
...
@@ -71,4 +76,23 @@ public class MemberTokenServiceImpl implements MemberTokenService {
return
this
.
getToken
()
!=
null
;
}
@Override
public
boolean
isLoginByToken
(
String
token_string
)
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
try
{
Fc_member
member
=
memberService
.
getMemberByToken
(
token_string
);
Integer
state
=
member
.
getState
();
if
(
state
==
1
)
{
Integer
id
=
member
.
getId
();
LoginToken
token
=
new
LoginToken
(
id
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
return
true
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
return
false
;
}
}
}
src/main/java/com/egolm/film/api/user/UserReviewController.java
0 → 100644
View file @
aec1ad3d
package
com
.
egolm
.
film
.
api
.
user
;
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.member.service.MemberService
;
import
com.egolm.film.api.user.service.UserReviewService
;
import
com.egolm.film.api.user.service.UserTokenService
;
import
com.egolm.film.bean.Fc_film_doubtful_point
;
import
com.egolm.film.bean.Fc_film_review
;
import
com.egolm.film.bean.Fc_member_film
;
import
com.egolm.film.bean.Fc_member_film_director
;
import
com.egolm.film.bean.Fc_member_film_issuer
;
import
com.egolm.film.bean.Fc_member_film_playactor
;
import
com.egolm.film.bean.Fc_member_film_show
;
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/review"
)
public
class
UserReviewController
{
@Autowired
private
UserTokenService
tokenService
;
@Autowired
private
UserReviewService
reviewService
;
@Autowired
private
MemberService
memberService
;
@ResponseBody
@PostMapping
(
"review_list"
)
@ApiOperation
(
"已审核列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
false
,
name
=
"index"
,
value
=
"分页页码"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
false
,
name
=
"limit"
,
value
=
"分页大小"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"limitKey"
,
value
=
"分页排序"
,
allowMultiple
=
true
),
})
public
Object
getReviewList
(
Long
index
,
Long
limit
,
String
[]
limitKey
)
{
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
20
:
limit
;
LoginToken
loginToken
=
tokenService
.
getToken
();
Long
user_id
=
(
Long
)
loginToken
.
getId
();
Page
page
=
new
Page
(
index
,
limit
,
limitKey
);
List
<
Map
<
String
,
Object
>>
list
=
reviewService
.
limitReviewList
(
user_id
,
page
);
return
Rjx
.
jsonOk
().
setData
(
list
).
setPage
(
page
);
}
@ResponseBody
@PostMapping
(
"unview_list"
)
@ApiOperation
(
"未审核列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
false
,
name
=
"index"
,
value
=
"分页页码"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
false
,
name
=
"limit"
,
value
=
"分页大小"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"limitKey"
,
value
=
"分页排序"
,
allowMultiple
=
true
),
})
public
Object
getUnviewList
(
Long
index
,
Long
limit
,
String
[]
limitKey
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Long
user_id
=
(
Long
)
loginToken
.
getId
();
Page
page
=
new
Page
(
index
,
limit
,
limitKey
);
List
<
Map
<
String
,
Object
>>
list
=
reviewService
.
limitUnviewList
(
user_id
,
page
);
return
Rjx
.
jsonOk
().
setData
(
list
).
setPage
(
page
);
}
@ResponseBody
@PostMapping
(
"member_apply_detail"
)
@ApiOperation
(
"查询申报影片详细信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"film_id"
,
value
=
"影片ID"
),
})
public
Object
getMemberApplyDetail
(
Long
film_id
)
{
Long
member_film_id
=
reviewService
.
queryMemberFilmIdByFilmId
(
film_id
);
Fc_member_film
memberFilm
=
memberService
.
queryMemberFilmById
(
member_film_id
);
List
<
Fc_member_film_director
>
directorList
=
memberService
.
queryMemberFilmDirectorList
(
member_film_id
);
List
<
Fc_member_film_issuer
>
issuerList
=
memberService
.
queryMemberFilmIssuerList
(
member_film_id
);
List
<
Fc_member_film_playactor
>
playactorList
=
memberService
.
queryMemberFilmPlayactorList
(
member_film_id
);
List
<
Fc_member_film_show
>
showList
=
memberService
.
queryMemberFilmShowList
(
member_film_id
);
return
Rjx
.
jsonOk
()
.
setData
(
memberFilm
)
.
set
(
"member_film_id"
,
member_film_id
)
.
set
(
"directorList"
,
directorList
)
.
set
(
"issuerList"
,
issuerList
)
.
set
(
"playactorList"
,
playactorList
)
.
set
(
"showList"
,
showList
)
;
}
@ResponseBody
@PostMapping
(
"review_record_list"
)
@ApiOperation
(
"查询评审记录列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
false
,
name
=
"film_id"
,
value
=
"影片ID"
),
})
public
Object
getReviewRecordList
(
Long
film_id
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Long
user_id
=
(
Long
)
loginToken
.
getId
();
Integer
round
=
reviewService
.
queryRound
(
user_id
,
film_id
);
List
<
Fc_film_review
>
reviewList
=
reviewService
.
queryRoundReviewList
(
user_id
,
round
,
film_id
);
return
Rjx
.
jsonOk
().
setData
(
reviewList
);
}
@ResponseBody
@PostMapping
(
"doubtful_list"
)
@ApiOperation
(
"查询疑点列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
false
,
name
=
"film_id"
,
value
=
"影片ID"
),
})
public
Object
getDoubtfulList
(
Long
film_id
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Long
user_id
=
(
Long
)
loginToken
.
getId
();
List
<
Fc_film_doubtful_point
>
doubtfulList
=
reviewService
.
queryDoubtfulList
(
user_id
,
film_id
);
return
Rjx
.
jsonOk
().
setData
(
doubtfulList
);
}
@ResponseBody
@PostMapping
(
"doubtful_append"
)
@ApiOperation
(
"增加疑点"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"film_id"
,
value
=
"影片ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"type"
,
value
=
"疑点类型"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"type_content"
,
value
=
"疑点说明"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"play_time"
,
value
=
"播放时间"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"int"
,
required
=
true
,
name
=
"times"
,
value
=
"次数"
),
})
public
Object
doubtfulAppend
(
Long
film_id
,
Integer
type
,
String
type_content
,
Long
play_time
,
Integer
times
)
{
return
Rjx
.
jsonOk
();
}
@ResponseBody
@PostMapping
(
"do_reject"
)
@ApiOperation
(
"审片否决"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
false
,
name
=
"film_id"
,
value
=
"影片ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"veto"
,
value
=
"否决理由"
),
})
public
Object
doReject
(
Long
film_id
,
String
veto
)
{
return
Rjx
.
jsonOk
();
}
@ResponseBody
@PostMapping
(
"do_pass"
)
@ApiOperation
(
"审片通过"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"film_id"
,
value
=
"影片ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"float"
,
required
=
true
,
name
=
"score"
,
value
=
"评分"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"content"
,
value
=
"选片结论"
),
})
public
Object
doPass
(
Long
film_id
,
Double
score
,
String
content
)
{
return
Rjx
.
jsonOk
();
}
@ResponseBody
@PostMapping
(
"play_append"
)
@ApiOperation
(
"增加播放记录"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"film_id"
,
value
=
"影片ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"playtime"
,
value
=
"播放时间"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"watchtime"
,
value
=
"观看时间"
),
})
public
Object
playAppend
(
Long
film_id
,
Long
playtime
,
Long
watchtime
)
{
return
Rjx
.
jsonOk
();
}
@ResponseBody
@PostMapping
(
"statistics"
)
@ApiOperation
(
"查询统计数据"
)
public
Object
statistics
()
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Long
user_id
=
(
Long
)
loginToken
.
getId
();
return
reviewService
.
queryStatistics
(
user_id
);
}
}
src/main/java/com/egolm/film/api/user/service/UserReviewService.java
0 → 100644
View file @
aec1ad3d
package
com
.
egolm
.
film
.
api
.
user
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.bean.Fc_film
;
import
com.egolm.film.bean.Fc_film_doubtful_point
;
import
com.egolm.film.bean.Fc_film_review
;
public
interface
UserReviewService
{
List
<
Map
<
String
,
Object
>>
limitReviewList
(
Long
user_id
,
Page
page
);
List
<
Map
<
String
,
Object
>>
limitUnviewList
(
Long
user_id
,
Page
page
);
Long
queryMemberFilmIdByFilmId
(
Long
film_id
);
List
<
Fc_film_review
>
queryRoundReviewList
(
Long
user_id
,
Integer
round
,
Long
film_id
);
List
<
Fc_film_doubtful_point
>
queryDoubtfulList
(
Long
user_id
,
Long
film_id
);
Fc_film
queryFilmById
(
Long
film_id
);
Integer
queryRound
(
Long
user_id
,
Long
film_id
);
Rjx
queryStatistics
(
Long
user_id
);
}
src/main/java/com/egolm/film/api/user/service/impl/UserReviewServiceImpl.java
0 → 100644
View file @
aec1ad3d
package
com
.
egolm
.
film
.
api
.
user
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.user.service.UserReviewService
;
import
com.egolm.film.bean.Fc_film
;
import
com.egolm.film.bean.Fc_film_doubtful_point
;
import
com.egolm.film.bean.Fc_film_review
;
@Service
public
class
UserReviewServiceImpl
implements
UserReviewService
{
@Autowired
private
JdbcTemplate
jdbcTemplate
;
@Override
public
List
<
Map
<
String
,
Object
>>
limitReviewList
(
Long
user_id
,
Page
page
)
{
String
sql
=
""
+
" select "
+
"film.*, "
+
"allot.uid, "
+
"allot.review_round, "
+
"allot.film_id, "
+
"review.is_save, "
+
"review.state review_state, "
+
"review.save_state "
+
"from "
+
"fc_film_allot allot "
+
"left join fc_film film on film.id = allot.film_id "
+
"left join fc_film_review review on review.film_id = allot.film_id and review.uid = allot.uid and review.round = allot.review_round "
+
"where "
+
"allot.uid = ? "
+
"and review.state > 0"
;
return
jdbcTemplate
.
limit
(
sql
,
page
,
user_id
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
limitUnviewList
(
Long
user_id
,
Page
page
)
{
String
sql
=
""
+
" select "
+
"film.*, "
+
"allot.uid, "
+
"allot.review_round, "
+
"allot.film_id, "
+
"review.is_save, "
+
"review.state review_state, "
+
"review.save_state "
+
"from "
+
"fc_film_allot allot "
+
"left join fc_film film on film.id = allot.film_id "
+
"left join fc_film_review review on review.film_id = allot.film_id and review.uid = allot.uid and review.round = allot.review_round "
+
"where "
+
"allot.uid = ? "
+
"and review.state is null"
;
return
jdbcTemplate
.
limit
(
sql
,
page
,
user_id
);
}
@Override
public
Long
queryMemberFilmIdByFilmId
(
Long
film_id
)
{
String
sql
=
"select mf.id from fc_member_film mf, fc_film f where mf.film_no = f.film_no and f.id = ?"
;
return
jdbcTemplate
.
queryForLong
(
sql
,
film_id
);
}
@Override
public
List
<
Fc_film_review
>
queryRoundReviewList
(
Long
user_id
,
Integer
round
,
Long
film_id
)
{
String
sql
=
"SELECT fc_film_review.* FROM fc_film_review WHERE film_id = ? AND uid = ? AND round = ?"
;
return
jdbcTemplate
.
queryForBeans
(
sql
,
Fc_film_review
.
class
,
film_id
,
user_id
,
round
);
}
@Override
public
List
<
Fc_film_doubtful_point
>
queryDoubtfulList
(
Long
user_id
,
Long
film_id
)
{
String
sql
=
"SELECT * FROM fc_film_doubtful_point WHERE uid = ? AND film_id = ?"
;
return
jdbcTemplate
.
queryForBeans
(
sql
,
Fc_film_doubtful_point
.
class
,
user_id
,
film_id
);
}
@Override
public
Fc_film
queryFilmById
(
Long
film_id
)
{
return
jdbcTemplate
.
queryForBean
(
"select * from fc_film where id = ?"
,
Fc_film
.
class
,
film_id
);
}
@Override
public
Integer
queryRound
(
Long
user_id
,
Long
film_id
)
{
return
jdbcTemplate
.
queryForInt
(
"select round from fc_film_allot where film_id = ? and uid = ?"
,
film_id
,
user_id
);
}
@Override
public
Rjx
queryStatistics
(
Long
user_id
)
{
String
sql0
=
"SELECT count(*) as total FROM fc_view_allot WHERE uid = ?"
;
String
sql1
=
"SELECT count(*) as total FROM fc_view_allot WHERE uid = ? AND review_state = 4"
;
String
sql2
=
"SELECT count(*) as total FROM fc_view_allot WHERE uid = ? AND review_state = 2"
;
String
sql3
=
"SELECT count(*) as total FROM fc_view_allot WHERE uid = ? AND (review_state = 3 or review_state = 5)"
;
String
sql4
=
"SELECT count(*) as total FROM fc_view_allot WHERE uid = ? AND review_state = 6"
;
Integer
count0
=
jdbcTemplate
.
queryForInt
(
sql0
,
user_id
);
Integer
count1
=
jdbcTemplate
.
queryForInt
(
sql1
,
user_id
);
Integer
count2
=
jdbcTemplate
.
queryForInt
(
sql2
,
user_id
);
Integer
count3
=
jdbcTemplate
.
queryForInt
(
sql3
,
user_id
);
Integer
count4
=
jdbcTemplate
.
queryForInt
(
sql4
,
user_id
);
Double
rate_1
=
0
D
;
Double
rate_2
=
0
D
;
Double
rate_3
=
0
D
;
Double
rate_4
=
0
D
;
if
(
count0
>
0
)
{
rate_1
=
(
double
)
count1
/(
double
)
count0
;
rate_2
=
(
double
)
count2
/(
double
)
count0
;
rate_3
=
(
double
)
count3
/(
double
)
count0
;
rate_4
=
(
double
)
count4
/(
double
)
count0
;
}
return
Rjx
.
jsonOk
()
.
set
(
"total"
,
count0
)
.
set
(
"count_state_4"
,
count1
)
.
set
(
"count_state_2"
,
count2
)
.
set
(
"count_state_3_5"
,
count3
)
.
set
(
"count_state_6"
,
count4
)
.
set
(
"rate_1"
,
toRate
(
rate_1
))
.
set
(
"rate_2"
,
toRate
(
rate_2
))
.
set
(
"rate_3"
,
toRate
(
rate_3
))
.
set
(
"rate_4"
,
toRate
(
rate_4
))
;
}
private
String
toRate
(
Double
dou
)
{
return
new
BigDecimal
(
dou
*
100
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
)
+
"%"
;
}
}
src/main/java/com/egolm/film/api/user/service/impl/UserTokenServiceImpl.java
View file @
aec1ad3d
package
com
.
egolm
.
film
.
api
.
user
.
service
.
impl
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.film.api.common.service.Messages
;
import
com.egolm.film.api.user.service.UserTokenService
;
import
com.egolm.film.bean.Fc_user
;
import
com.egolm.film.config.Common
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.model.LoginToken
;
...
...
@@ -21,33 +21,39 @@ public class UserTokenServiceImpl implements UserTokenService {
@Autowired
private
JdbcTemplate
jdbcTemplate
;
@Autowired
private
Messages
messages
;
@Override
public
LoginToken
doLogin
(
String
username
,
String
password
)
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
String
md5String
=
StringUtil
.
toMD5HexString
(
password
).
toLowerCase
();
String
loginSql
=
"select * from fc_user where username = ? and password = ?"
;
List
<
Map
<
String
,
Object
>>
list
=
this
.
jdbcTemplate
.
queryForList
(
loginSql
,
username
,
md5String
);
if
(
list
!=
null
)
{
if
(
list
.
size
()
==
1
)
{
Map
<
String
,
Object
>
map
=
list
.
get
(
0
);
Integer
state
=
(
Integer
)
map
.
get
(
"state"
);
if
(
state
==
1
)
{
Integer
adminid
=
(
Integer
)
map
.
get
(
"adminid"
);
LoginToken
token
=
new
LoginToken
(
adminid
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
return
token
;
}
else
if
(
state
==
2
)
{
throw
new
XException
(
"用户已禁用"
);
}
else
{
throw
new
XException
(
"用户状态未知"
);
Fc_user
user
=
null
;
try
{
user
=
this
.
jdbcTemplate
.
queryForBean
(
"select * from fc_user where username = ?"
,
Fc_user
.
class
,
username
);
}
catch
(
Exception
e
)
{
throw
new
XException
(
messages
.
get
(
"err.user_pwd_err"
));
}
Integer
state
=
user
.
getState
();
if
(
state
==
1
)
{
String
salt
=
user
.
getSalt
();
String
dbPwd
=
user
.
getPassword
();
String
encodePassword
=
Common
.
encodePassword
(
password
,
salt
);
if
(
encodePassword
.
equals
(
dbPwd
))
{
Long
uid
=
user
.
getUid
();
LoginToken
token
=
new
LoginToken
(
uid
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
Cookie
cookie
=
WebMvcConfig
.
getCookie
(
JSESSIONID
);
if
(
cookie
!=
null
)
{
jdbcTemplate
.
executeUpdate
(
"update fc_user set token = ? where uid = ?"
,
cookie
.
getValue
(),
uid
);
}
}
else
if
(
list
.
size
()
==
0
)
{
throw
new
XException
(
"用户名或密码错误"
);
return
token
;
}
else
{
throw
new
XException
(
"用户登陆信息重复,请联系管理员"
);
throw
new
XException
(
messages
.
get
(
"err.user_pwd_err"
)
);
}
}
else
if
(
state
==
2
)
{
throw
new
XException
(
messages
.
get
(
"err.user_disabled"
));
}
else
{
throw
new
XException
(
"用户名或密码错误"
);
throw
new
XException
(
messages
.
get
(
"err"
)
);
}
}
...
...
@@ -69,4 +75,18 @@ public class UserTokenServiceImpl implements UserTokenService {
public
boolean
isLogin
()
{
return
this
.
getToken
()
!=
null
;
}
@Override
public
boolean
isLoginByToken
(
String
token_string
)
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
try
{
String
sql
=
"select uid from fc_user where token = ?"
;
Long
uid
=
jdbcTemplate
.
queryForLong
(
sql
,
token_string
);
LoginToken
token
=
new
LoginToken
(
uid
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
return
true
;
}
catch
(
Exception
e
)
{
return
false
;
}
}
}
src/main/java/com/egolm/film/config/WebMvcConfig.java
View file @
aec1ad3d
...
...
@@ -2,6 +2,7 @@ package com.egolm.film.config;
import
java.util.EventListener
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
...
...
@@ -82,4 +83,16 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
return
null
;
}
public
static
Cookie
getCookie
(
String
name
)
{
HttpServletRequest
request
=
WebMvcConfig
.
getRequest
();
if
(
request
!=
null
)
{
Cookie
[]
cookies
=
request
.
getCookies
();
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
name
))
{
return
cookie
;
}
}
}
return
null
;
}
}
src/main/java/com/egolm/film/config/interceptor/AdminLoginInterceptor.java
View file @
aec1ad3d
package
com
.
egolm
.
film
.
config
.
interceptor
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -7,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
com.egolm.film.api.TokenService
;
import
com.egolm.film.api.admin.service.AdminTokenService
;
import
com.egolm.film.config.XException
;
...
...
@@ -21,6 +23,16 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
if
(
tokenService
.
isLogin
())
{
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
else
{
String
sessionid
=
null
;
Cookie
[]
cookies
=
req
.
getCookies
();
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
TokenService
.
JSESSIONID
))
{
sessionid
=
cookie
.
getValue
();
}
}
if
(
sessionid
!=
null
&&
tokenService
.
isLoginByToken
(
sessionid
))
{
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
throw
new
XException
(
"用户未登陆"
,
300
);
}
}
...
...
src/main/java/com/egolm/film/config/interceptor/MemberLoginInterceptor.java
View file @
aec1ad3d
package
com
.
egolm
.
film
.
config
.
interceptor
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -7,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
com.egolm.film.api.TokenService
;
import
com.egolm.film.api.member.service.MemberTokenService
;
import
com.egolm.film.config.XException
;
...
...
@@ -21,6 +23,16 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
if
(
tokenService
.
isLogin
())
{
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
else
{
String
sessionid
=
null
;
Cookie
[]
cookies
=
req
.
getCookies
();
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
TokenService
.
JSESSIONID
))
{
sessionid
=
cookie
.
getValue
();
}
}
if
(
sessionid
!=
null
&&
tokenService
.
isLoginByToken
(
sessionid
))
{
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
throw
new
XException
(
"用户未登陆"
,
300
);
}
}
...
...
src/main/java/com/egolm/film/config/interceptor/UserLoginInterceptor.java
View file @
aec1ad3d
package
com
.
egolm
.
film
.
config
.
interceptor
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -7,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
com.egolm.film.api.TokenService
;
import
com.egolm.film.api.user.service.UserTokenService
;
import
com.egolm.film.config.XException
;
...
...
@@ -21,6 +23,16 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
if
(
tokenService
.
isLogin
())
{
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
else
{
String
sessionid
=
null
;
Cookie
[]
cookies
=
req
.
getCookies
();
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
TokenService
.
JSESSIONID
))
{
sessionid
=
cookie
.
getValue
();
}
}
if
(
sessionid
!=
null
&&
tokenService
.
isLoginByToken
(
sessionid
))
{
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
throw
new
XException
(
"用户未登陆"
,
300
);
}
}
...
...
src/main/java/com/egolm/film/
api/
util/AliyunUtil.java
→
src/main/java/com/egolm/film/util/AliyunUtil.java
View file @
aec1ad3d
package
com
.
egolm
.
film
.
api
.
util
;
package
com
.
egolm
.
film
.
util
;
import
java.util.Map
;
...
...
src/main/java/com/egolm/film/
config
/DBUtil.java
→
src/main/java/com/egolm/film/
util
/DBUtil.java
View file @
aec1ad3d
package
com
.
egolm
.
film
.
config
;
package
com
.
egolm
.
film
.
util
;
import
java.sql.SQLException
;
...
...
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