Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
member-api
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
曲欣亮
member-api
Commits
ca92f81e
Commit
ca92f81e
authored
Nov 02, 2018
by
zhangyong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.egolm.com/hanxu/siff-film-api
parents
aec1ad3d
6d170d1f
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
273 additions
and
35 deletions
+273
-35
MemberOpenApiController.java
...va/com/egolm/film/api/member/MemberOpenApiController.java
+8
-2
MemberServiceImpl.java
...egolm/film/api/member/service/impl/MemberServiceImpl.java
+1
-1
MemberTokenServiceImpl.java
.../film/api/member/service/impl/MemberTokenServiceImpl.java
+1
-1
UserReviewController.java
...in/java/com/egolm/film/api/user/UserReviewController.java
+43
-18
UserReviewService.java
...va/com/egolm/film/api/user/service/UserReviewService.java
+11
-2
UserReviewServiceImpl.java
...olm/film/api/user/service/impl/UserReviewServiceImpl.java
+175
-6
UserTokenServiceImpl.java
...golm/film/api/user/service/impl/UserTokenServiceImpl.java
+1
-1
WebMvcConfig.java
src/main/java/com/egolm/film/config/WebMvcConfig.java
+24
-3
Common.java
src/main/java/com/egolm/film/util/Common.java
+7
-1
messages_en_US.properties
src/main/resources/i18n/messages_en_US.properties
+1
-0
messages_zh_CN.properties
src/main/resources/i18n/messages_zh_CN.properties
+1
-0
No files found.
src/main/java/com/egolm/film/api/member/MemberOpenApiController.java
View file @
ca92f81e
...
...
@@ -9,6 +9,7 @@ import javax.servlet.http.HttpSession;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.i18n.LocaleContextHolder
;
import
org.springframework.dao.EmptyResultDataAccessException
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -21,9 +22,9 @@ import com.egolm.film.api.common.service.EmailService;
import
com.egolm.film.api.common.service.Messages
;
import
com.egolm.film.api.member.service.MemberService
;
import
com.egolm.film.bean.Fc_member
;
import
com.egolm.film.config.Common
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.interceptor.LocaleSessionInterceptor
;
import
com.egolm.film.util.Common
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -83,7 +84,12 @@ public class MemberOpenApiController {
XException
.
assertNotBlank
(
messages
.
get
(
"err.email_null"
),
email
);
int
code
=
(
int
)
((
Math
.
random
()
*
9
+
1
)
*
10000000
);
String
password
=
String
.
valueOf
(
code
);
Fc_member
member
=
memberService
.
getMemberByEmail
(
email
);
Fc_member
member
=
null
;
try
{
member
=
memberService
.
getMemberByEmail
(
email
);
}
catch
(
EmptyResultDataAccessException
e
)
{
throw
new
XException
(
messages
.
get
(
"err.user_not_exists"
));
}
String
encodePwd
=
Common
.
encodePassword
(
password
,
member
.
getSalt
());
memberService
.
resetPassword
(
member
.
getId
(),
encodePwd
);
String
name
=
member
.
getUsername
();
...
...
src/main/java/com/egolm/film/api/member/service/impl/MemberServiceImpl.java
View file @
ca92f81e
...
...
@@ -27,9 +27,9 @@ 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.config.Common
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.util.Common
;
@Service
...
...
src/main/java/com/egolm/film/api/member/service/impl/MemberTokenServiceImpl.java
View file @
ca92f81e
...
...
@@ -10,10 +10,10 @@ import com.egolm.film.api.common.service.Messages;
import
com.egolm.film.api.member.service.MemberService
;
import
com.egolm.film.api.member.service.MemberTokenService
;
import
com.egolm.film.bean.Fc_member
;
import
com.egolm.film.config.Common
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.util.Common
;
@Service
public
class
MemberTokenServiceImpl
implements
MemberTokenService
{
...
...
src/main/java/com/egolm/film/api/user/UserReviewController.java
View file @
ca92f81e
package
com
.
egolm
.
film
.
api
.
user
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -49,14 +50,18 @@ public class UserReviewController {
@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
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"date"
,
required
=
false
,
name
=
"start_time"
,
value
=
"开始时间"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"date"
,
required
=
false
,
name
=
"end_time"
,
value
=
"结束时间"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"film_type_name"
,
value
=
"影片类型"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"keyword"
,
value
=
"模糊匹配关键词"
),
})
public
Object
getReviewList
(
Long
index
,
Long
limit
,
String
[]
limitKey
)
{
public
Object
getReviewList
(
Long
index
,
Long
limit
,
String
[]
limitKey
,
Date
start_time
,
Date
end_time
,
String
film_type_name
,
String
keyword
)
{
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
);
List
<
Map
<
String
,
Object
>>
list
=
reviewService
.
limitReviewList
(
user_id
,
page
,
start_time
,
end_time
,
film_type_name
,
keyword
);
return
Rjx
.
jsonOk
().
setData
(
list
).
setPage
(
page
);
}
...
...
@@ -68,12 +73,16 @@ public class UserReviewController {
@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
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"date"
,
required
=
false
,
name
=
"start_time"
,
value
=
"开始时间"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"date"
,
required
=
false
,
name
=
"end_time"
,
value
=
"结束时间"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"film_type_name"
,
value
=
"影片类型"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"keyword"
,
value
=
"模糊匹配关键词"
),
})
public
Object
getUnviewList
(
Long
index
,
Long
limit
,
String
[]
limitKey
)
{
public
Object
getUnviewList
(
Long
index
,
Long
limit
,
String
[]
limitKey
,
Date
start_time
,
Date
end_time
,
String
film_type_name
,
String
keyword
)
{
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
);
List
<
Map
<
String
,
Object
>>
list
=
reviewService
.
limitUnviewList
(
user_id
,
page
,
start_time
,
end_time
,
film_type_name
,
keyword
);
return
Rjx
.
jsonOk
().
setData
(
list
).
setPage
(
page
);
}
...
...
@@ -136,9 +145,29 @@ public class UserReviewController {
@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
=
"次数"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"
long"
,
required
=
true
,
name
=
"times"
,
value
=
"次数"
),
})
public
Object
doubtfulAppend
(
Long
film_id
,
Integer
type
,
String
type_content
,
Long
play_time
,
Integer
times
)
{
public
Object
doubtfulAppend
(
Long
film_id
,
Integer
type
,
String
type_content
,
Long
play_time
,
Long
times
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Long
user_id
=
(
Long
)
loginToken
.
getId
();
Integer
round
=
reviewService
.
queryRound
(
user_id
,
film_id
);
reviewService
.
doubtfulAppend
(
user_id
,
film_id
,
round
,
type
,
type_content
,
play_time
,
times
);
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
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Long
user_id
=
(
Long
)
loginToken
.
getId
();
Integer
round
=
reviewService
.
queryRound
(
user_id
,
film_id
);
reviewService
.
playAppend
(
user_id
,
film_id
,
round
,
playtime
,
watchtime
);
return
Rjx
.
jsonOk
();
}
...
...
@@ -150,6 +179,10 @@ public class UserReviewController {
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"veto"
,
value
=
"否决理由"
),
})
public
Object
doReject
(
Long
film_id
,
String
veto
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Long
user_id
=
(
Long
)
loginToken
.
getId
();
Integer
round
=
reviewService
.
queryRound
(
user_id
,
film_id
);
reviewService
.
doReject
(
user_id
,
film_id
,
round
,
veto
);
return
Rjx
.
jsonOk
();
}
...
...
@@ -162,18 +195,10 @@ public class UserReviewController {
@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
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Long
user_id
=
(
Long
)
loginToken
.
getId
();
Integer
round
=
reviewService
.
queryRound
(
user_id
,
film_id
);
reviewService
.
doPass
(
user_id
,
film_id
,
round
,
score
,
content
);
return
Rjx
.
jsonOk
();
}
...
...
src/main/java/com/egolm/film/api/user/service/UserReviewService.java
View file @
ca92f81e
package
com
.
egolm
.
film
.
api
.
user
.
service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -11,9 +12,9 @@ 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
>>
limitReviewList
(
Long
user_id
,
Page
page
,
Date
start_time
,
Date
end_time
,
String
film_type_name
,
String
keyword
);
List
<
Map
<
String
,
Object
>>
limitUnviewList
(
Long
user_id
,
Page
page
);
List
<
Map
<
String
,
Object
>>
limitUnviewList
(
Long
user_id
,
Page
page
,
Date
start_time
,
Date
end_time
,
String
film_type_name
,
String
keyword
);
Long
queryMemberFilmIdByFilmId
(
Long
film_id
);
...
...
@@ -27,4 +28,12 @@ public interface UserReviewService {
Rjx
queryStatistics
(
Long
user_id
);
void
doubtfulAppend
(
Long
user_id
,
Long
film_id
,
Integer
round
,
Integer
type
,
String
type_content
,
Long
play_time
,
Long
times
);
void
playAppend
(
Long
user_id
,
Long
film_id
,
Integer
round
,
Long
playtime
,
Long
watchtime
);
void
doReject
(
Long
user_id
,
Long
film_id
,
Integer
round
,
String
veto
);
void
doPass
(
Long
user_id
,
Long
film_id
,
Integer
round
,
Double
score
,
String
content
);
}
src/main/java/com/egolm/film/api/user/service/impl/UserReviewServiceImpl.java
View file @
ca92f81e
package
com
.
egolm
.
film
.
api
.
user
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.Page
;
...
...
@@ -14,6 +18,8 @@ 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
;
import
com.egolm.film.bean.Fc_film_user_play
;
import
com.egolm.film.config.WebMvcConfig
;
@Service
public
class
UserReviewServiceImpl
implements
UserReviewService
{
...
...
@@ -22,7 +28,35 @@ public class UserReviewServiceImpl implements UserReviewService {
private
JdbcTemplate
jdbcTemplate
;
@Override
public
List
<
Map
<
String
,
Object
>>
limitReviewList
(
Long
user_id
,
Page
page
)
{
public
List
<
Map
<
String
,
Object
>>
limitReviewList
(
Long
user_id
,
Page
page
,
Date
start_time
,
Date
end_time
,
String
film_type_name
,
String
keyword
)
{
List
<
Object
>
args
=
new
ArrayList
<
Object
>();
List
<
String
>
strs
=
new
ArrayList
<
String
>();
args
.
add
(
user_id
);
if
(
start_time
!=
null
)
{
strs
.
add
(
"allot.push_time >= ?"
);
args
.
add
(
start_time
);
}
if
(
end_time
!=
null
)
{
strs
.
add
(
"allot.push_time < ?"
);
args
.
add
(
DateUtil
.
day
(
end_time
,
1
));
}
if
(
film_type_name
!=
null
&&
film_type_name
.
trim
().
length
()
>
0
)
{
strs
.
add
(
"film.film_type_name = ?"
);
args
.
add
(
film_type_name
);
}
if
(
keyword
!=
null
&&
keyword
.
trim
().
length
()
>
0
)
{
strs
.
add
(
"(film.en_name like ? or film.cn_name like ?)"
);
args
.
add
(
"%"
+
keyword
+
"%"
);
args
.
add
(
"%"
+
keyword
+
"%"
);
}
String
sql
=
""
+
" select "
+
"film.*, "
...
...
@@ -38,12 +72,41 @@ public class UserReviewServiceImpl implements UserReviewService {
+
"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
);
+
"and review.state > 0"
+
StringUtil
.
join
(
" and "
,
" "
,
""
,
""
,
strs
);
return
jdbcTemplate
.
limit
(
sql
,
page
,
args
.
toArray
());
}
@Override
public
List
<
Map
<
String
,
Object
>>
limitUnviewList
(
Long
user_id
,
Page
page
)
{
public
List
<
Map
<
String
,
Object
>>
limitUnviewList
(
Long
user_id
,
Page
page
,
Date
start_time
,
Date
end_time
,
String
film_type_name
,
String
keyword
)
{
List
<
Object
>
args
=
new
ArrayList
<
Object
>();
List
<
String
>
strs
=
new
ArrayList
<
String
>();
args
.
add
(
user_id
);
if
(
start_time
!=
null
)
{
strs
.
add
(
"allot.push_time >= ?"
);
args
.
add
(
start_time
);
}
if
(
end_time
!=
null
)
{
strs
.
add
(
"allot.push_time < ?"
);
args
.
add
(
DateUtil
.
day
(
end_time
,
1
));
}
if
(
film_type_name
!=
null
&&
film_type_name
.
trim
().
length
()
>
0
)
{
strs
.
add
(
"film.film_type_name = ?"
);
args
.
add
(
film_type_name
);
}
if
(
keyword
!=
null
&&
keyword
.
trim
().
length
()
>
0
)
{
strs
.
add
(
"(film.en_name like ? or film.cn_name like ?)"
);
args
.
add
(
"%"
+
keyword
+
"%"
);
args
.
add
(
"%"
+
keyword
+
"%"
);
}
String
sql
=
""
+
" select "
+
"film.*, "
...
...
@@ -59,8 +122,9 @@ public class UserReviewServiceImpl implements UserReviewService {
+
"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
);
+
"and review.state is null"
+
StringUtil
.
join
(
" and "
,
" "
,
""
,
""
,
strs
);
return
jdbcTemplate
.
limit
(
sql
,
page
,
args
.
toArray
());
}
@Override
...
...
@@ -133,4 +197,109 @@ public class UserReviewServiceImpl implements UserReviewService {
return
new
BigDecimal
(
dou
*
100
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
)
+
"%"
;
}
@Override
public
void
doubtfulAppend
(
Long
user_id
,
Long
film_id
,
Integer
round
,
Integer
type
,
String
type_content
,
Long
play_time
,
Long
times
)
{
Fc_film_doubtful_point
doubtful
=
new
Fc_film_doubtful_point
();
String
ip
=
WebMvcConfig
.
getRemoteIp
();
doubtful
.
setCreate_ip
(
ip
);
doubtful
.
setCreate_time
(
System
.
currentTimeMillis
());
doubtful
.
setFilm_id
(
film_id
);
doubtful
.
setPlay_time
(
play_time
+
""
);
doubtful
.
setRound
(
round
);
doubtful
.
setTimes
(
times
);
doubtful
.
setType
(
type
);
doubtful
.
setType_content
(
type_content
);
doubtful
.
setUid
(
user_id
);
jdbcTemplate
.
save
(
doubtful
);
}
@Override
public
void
playAppend
(
Long
user_id
,
Long
film_id
,
Integer
round
,
Long
playtime
,
Long
watchtime
)
{
Fc_film_user_play
play
=
new
Fc_film_user_play
();
play
.
setAddtime
(
System
.
currentTimeMillis
());
play
.
setFilm_id
(
film_id
);
play
.
setPlaytime
(
playtime
+
""
);
play
.
setRound
(
round
);
play
.
setWatchtime
(
watchtime
);
play
.
setUid
(
user_id
);
jdbcTemplate
.
save
(
play
);
}
@Override
public
void
doReject
(
Long
user_id
,
Long
film_id
,
Integer
round
,
String
veto
)
{
boolean
isSave
=
false
;
Fc_film_review
review
=
null
;
try
{
String
sql
=
"select * from fc_film_review where uid = ? and film_id = ? and round = ?"
;
review
=
this
.
jdbcTemplate
.
queryForBean
(
sql
,
Fc_film_review
.
class
,
user_id
,
film_id
,
round
);
}
catch
(
Exception
e
)
{
isSave
=
true
;
review
=
new
Fc_film_review
();
review
.
setUid
(
user_id
);
review
.
setFilm_id
(
film_id
);
}
String
ip
=
WebMvcConfig
.
getRemoteIp
();
review
.
setRound
(
round
);
review
.
setVeto
(
veto
);
review
.
setReview_ip
(
ip
);
review
.
setReview_time
(
System
.
currentTimeMillis
());
review
.
setState
(
2
);
if
(
isSave
)
{
this
.
jdbcTemplate
.
save
(
review
);
}
else
{
this
.
jdbcTemplate
.
update
(
review
);
}
}
@Override
public
void
doPass
(
Long
user_id
,
Long
film_id
,
Integer
round
,
Double
score
,
String
content
)
{
boolean
isSave
=
false
;
Fc_film_review
review
=
null
;
try
{
String
sql
=
"select * from fc_film_review where uid = ? and film_id = ? and round = ?"
;
review
=
this
.
jdbcTemplate
.
queryForBean
(
sql
,
Fc_film_review
.
class
,
user_id
,
film_id
,
round
);
}
catch
(
Exception
e
)
{
isSave
=
true
;
review
=
new
Fc_film_review
();
review
.
setUid
(
user_id
);
review
.
setFilm_id
(
film_id
);
}
String
ip
=
WebMvcConfig
.
getRemoteIp
();
review
.
setRound
(
round
);
review
.
setSelect_result
(
content
);
review
.
setReview_ip
(
ip
);
review
.
setAward_1_score
(
new
BigDecimal
(
score
));
review
.
setReview_time
(
System
.
currentTimeMillis
());
review
.
setState
(
1
);
if
(
isSave
)
{
this
.
jdbcTemplate
.
save
(
review
);
}
else
{
this
.
jdbcTemplate
.
update
(
review
);
}
}
}
src/main/java/com/egolm/film/api/user/service/impl/UserTokenServiceImpl.java
View file @
ca92f81e
...
...
@@ -10,10 +10,10 @@ 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
;
import
com.egolm.film.util.Common
;
@Service
public
class
UserTokenServiceImpl
implements
UserTokenService
{
...
...
src/main/java/com/egolm/film/config/WebMvcConfig.java
View file @
ca92f81e
...
...
@@ -87,12 +87,33 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
HttpServletRequest
request
=
WebMvcConfig
.
getRequest
();
if
(
request
!=
null
)
{
Cookie
[]
cookies
=
request
.
getCookies
();
if
(
cookies
!=
null
)
{
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
name
))
{
return
cookie
;
}
}
}
}
return
null
;
}
public
static
String
getRemoteIp
()
{
HttpServletRequest
request
=
WebMvcConfig
.
getRequest
();
String
ip
=
request
.
getHeader
(
"X-Real_IP"
);
if
(
ip
==
null
||
ip
.
length
()
==
0
||
ip
.
equalsIgnoreCase
(
"unknown"
))
{
ip
=
request
.
getHeader
(
"X-Forwarded-For"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
ip
.
equalsIgnoreCase
(
"unknown"
))
{
ip
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
ip
.
equalsIgnoreCase
(
"unknown"
))
{
ip
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
ip
.
equalsIgnoreCase
(
"unknown"
))
{
ip
=
request
.
getRemoteAddr
();
}
String
[]
ips
=
ip
.
trim
().
split
(
", "
);
return
ips
[
ips
.
length
-
1
].
trim
();
}
}
src/main/java/com/egolm/film/
config
/Common.java
→
src/main/java/com/egolm/film/
util
/Common.java
View file @
ca92f81e
package
com
.
egolm
.
film
.
config
;
package
com
.
egolm
.
film
.
util
;
import
java.util.Random
;
...
...
@@ -20,4 +20,10 @@ public class Common {
public
static
String
encodePassword
(
String
password
,
String
salt
)
{
return
StringUtil
.
toMD5HexString
(
StringUtil
.
toMD5HexString
(
password
+
salt
).
toLowerCase
().
substring
(
4
,
24
)).
toLowerCase
();
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
encodePassword
(
"123456"
,
"5e0vt0"
));
System
.
out
.
println
(
getGenerateString
(
6
));
}
}
src/main/resources/i18n/messages_en_US.properties
View file @
ca92f81e
...
...
@@ -7,6 +7,7 @@ err.user_disabled=User disabled
err.user_pwd_err
=
User or password error
err.user_pwd_null
=
User and passowrd can not be null
err.user_exists
=
User already exists
err.user_not_exists
=
User does not exists
err.email_null
=
The mailbox can not be empty
err.name_null
=
The username can not be empty
err.pwd_null
=
The password can not be empty
...
...
src/main/resources/i18n/messages_zh_CN.properties
View file @
ca92f81e
...
...
@@ -7,6 +7,7 @@ err.user_disabled=\u7528\u6237\u5DF2\u7ECF\u7981\u7528
err.user_pwd_err=
\u7528\u6237\u6216\u
5BC6
\u7801\u9519\u
8BEF
err.user_pwd_null
=
\u7528\u6237\u
540D
\u
548C
\u
5BC6
\u7801\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
err.user_exists
=
\u7528\u6237\u
5DF2
\u
5B58
\u5728
err.user_not_exists=
\u7528\u6237\u
4E0D
\u
5B58
\u5728
err.email_null=
\u
90AE
\u
7BB1
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
err.name_null
=
\u
59D3
\u
540D
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
err.pwd_null
=
\u
5BC6
\u7801\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
...
...
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