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
44ee5a1a
Commit
44ee5a1a
authored
Oct 12, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://key@gitlab.egolm.com/hanxu/siff-film-api.git
parents
56b35611
6e69308f
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
359 additions
and
373 deletions
+359
-373
pom.xml
pom.xml
+8
-0
MemberOpenApiController.java
...main/java/com/egolm/film/api/MemberOpenApiController.java
+42
-8
MemberApplyController.java
...java/com/egolm/film/api/member/MemberApplyController.java
+34
-5
MemberInfoController.java
.../java/com/egolm/film/api/member/MemberInfoController.java
+18
-1
ApplyModel.java
...main/java/com/egolm/film/api/member/model/ApplyModel.java
+13
-0
MemberService.java
...java/com/egolm/film/api/member/service/MemberService.java
+43
-0
MemberServiceImpl.java
...egolm/film/api/member/service/impl/MemberServiceImpl.java
+100
-0
Test.java
src/main/java/com/egolm/film/bean/Test.java
+0
-252
MemberService.java
src/main/java/com/egolm/film/common/MemberService.java
+0
-15
DefaultMessages.java
...main/java/com/egolm/film/common/impl/DefaultMessages.java
+2
-1
EmailServiceImpl.java
...ain/java/com/egolm/film/common/impl/EmailServiceImpl.java
+1
-1
MemberServiceImpl.java
...in/java/com/egolm/film/common/impl/MemberServiceImpl.java
+0
-41
Common.java
src/main/java/com/egolm/film/config/Common.java
+23
-0
LocaleConfig.java
src/main/java/com/egolm/film/config/LocaleConfig.java
+20
-0
WebMvcConfig.java
src/main/java/com/egolm/film/config/WebMvcConfig.java
+3
-1
MemberLoginController.java
...main/java/com/egolm/film/login/MemberLoginController.java
+1
-1
MemberTokenServiceImpl.java
...egolm/film/login/service/impl/MemberTokenServiceImpl.java
+20
-28
UserTokenServiceImpl.java
...m/egolm/film/login/service/impl/UserTokenServiceImpl.java
+1
-1
application-dev.properties
src/main/resources/application-dev.properties
+1
-1
application-pro.properties
src/main/resources/application-pro.properties
+1
-1
application.properties
src/main/resources/application.properties
+2
-6
message.properties
src/main/resources/i18n/message.properties
+0
-10
message_zh_CN.properties
src/main/resources/i18n/message_zh_CN.properties
+0
-0
messages.properties
src/main/resources/i18n/messages.properties
+0
-0
messages_en_US.properties
src/main/resources/i18n/messages_en_US.properties
+13
-0
messages_zh_CN.properties
src/main/resources/i18n/messages_zh_CN.properties
+13
-0
No files found.
pom.xml
View file @
44ee5a1a
...
...
@@ -63,6 +63,14 @@
<artifactId>
activation
</artifactId>
<version>
1.1
</version>
</dependency>
<dependency>
<groupId>
javax.mail
</groupId>
<artifactId>
javax.mail-api
</artifactId>
</dependency>
<dependency>
<groupId>
com.sun.mail
</groupId>
<artifactId>
javax.mail
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
...
...
src/main/java/com/egolm/film/api/MemberOpenApiController.java
View file @
44ee5a1a
...
...
@@ -12,12 +12,15 @@ 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.MailUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.web.ServletUtil
;
import
com.egolm.film.api.member.service.MemberService
;
import
com.egolm.film.bean.Fc_member
;
import
com.egolm.film.common.EmailService
;
import
com.egolm.film.common.MemberService
;
import
com.egolm.film.common.Messages
;
import
com.egolm.film.config.Common
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.interceptor.LocaleSessionInterceptor
;
import
io.swagger.annotations.Api
;
...
...
@@ -48,34 +51,65 @@ public class MemberOpenApiController {
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"email"
),
})
public
Object
register
(
HttpServletRequest
request
,
String
username
,
String
password
,
String
email
)
{
XException
.
assertNotBlank
(
messages
.
get
(
"err.email_null"
),
email
);
XException
.
assertNotBlank
(
messages
.
get
(
"err.name_null"
),
username
);
XException
.
assertNotBlank
(
messages
.
get
(
"err.pwd_null"
),
password
);
Locale
locale
=
LocaleContextHolder
.
getLocale
();
String
salt
=
Common
.
getGenerateString
(
6
);
String
encodePwd
=
Common
.
encodePassword
(
password
,
salt
);
Fc_member
member
=
new
Fc_member
();
member
.
setSalt
(
salt
);
member
.
setUsername
(
username
);
member
.
setPassword
(
memberService
.
encodePassword
(
password
)
);
member
.
setPassword
(
encodePwd
);
member
.
setEmail
(
email
);
member
.
setCreate_ip
(
ServletUtil
.
remoteIp
(
request
));
member
.
setCreate_time
(
System
.
currentTimeMillis
());
member
.
setLang
(
locale
==
null
?
"zh"
:
locale
.
getLanguage
());
member
.
setState
(
1
);
if
(
memberService
.
exists
(
email
))
{
throw
new
XException
(
messages
.
get
(
"err.user_exists"
));
}
memberService
.
saveMember
(
member
);
return
Rjx
.
jsonOk
();
}
@ResponseBody
@PostMapping
(
"
g
etPassword"
)
@PostMapping
(
"
res
etPassword"
)
@ApiOperation
(
"找回密码"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"email"
)})
public
Object
getPassword
(
String
email
)
{
public
Object
resetPassword
(
String
email
)
{
XException
.
assertNotBlank
(
messages
.
get
(
"err.email_null"
),
email
);
int
code
=
(
int
)
((
Math
.
random
()
*
9
+
1
)
*
10000000
);
String
newP
assword
=
String
.
valueOf
(
code
);
String
p
assword
=
String
.
valueOf
(
code
);
Fc_member
member
=
memberService
.
getMemberByEmail
(
email
);
memberService
.
changePassword
(
member
.
getAddress
(),
newPassword
);
String
encodePwd
=
Common
.
encodePassword
(
password
,
member
.
getSalt
());
memberService
.
changePassword
(
member
.
getId
(),
encodePwd
);
String
name
=
member
.
getUsername
();
String
subject
=
messages
.
get
(
"email.getPassword.subject"
);
String
content
=
messages
.
get
(
"email.getPassword.
subject"
,
member
.
getRealname
(),
newP
assword
);
String
content
=
messages
.
get
(
"email.getPassword.
content"
,
name
==
null
?
""
:
name
,
p
assword
);
emailService
.
send
(
subject
,
content
,
email
);
return
Rjx
.
jsonOk
();
}
public
static
void
main
(
String
[]
args
)
{
/**
* com.egolm.film.email.smtp.host=mail.egolm.com
com.egolm.film.email.smtp.port=25
com.egolm.film.email.smtp.is_auth=true
com.egolm.film.email.smtp.from=qu.xinliang@egolm.com
com.egolm.film.email.smtp.password=Liang12345
*/
String
host
=
"mail.egolm.com"
;
Integer
port
=
25
;
Boolean
is_auth
=
true
;
String
content
=
"测试邮件"
;
String
from
=
"qu.xinliang@egolm.com"
;
String
password
=
"Liang12345"
;
String
to
=
"747539993@qq.com"
;
String
subject
=
"测试邮件"
;
MailUtil
.
sendBySmtp
(
host
,
port
,
is_auth
,
from
,
password
,
subject
,
content
,
null
,
to
);
}
@ResponseBody
@PostMapping
(
"setLocale"
)
@ApiOperation
(
"设置语言环境"
)
...
...
@@ -90,7 +124,7 @@ public class MemberOpenApiController {
@PostMapping
(
"getLocale"
)
@ApiOperation
(
"获取当前语言环境"
)
public
Object
getLocale
(
HttpServletRequest
request
)
{
return
Rjx
.
jsonOk
().
set
Message
(
LocaleContextHolder
.
getLocale
().
toString
(
));
return
Rjx
.
jsonOk
().
set
(
"locale"
,
LocaleContextHolder
.
getLocale
().
toString
()).
set
(
"msg.test"
,
messages
.
get
(
"msg.test"
));
}
}
src/main/java/com/egolm/film/api/member/MemberApplyController.java
View file @
44ee5a1a
package
com
.
egolm
.
film
.
api
.
member
;
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
;
...
...
@@ -7,6 +11,14 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.film.api.member.model.ApplyModel
;
import
com.egolm.film.api.member.service.MemberService
;
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.login.service.MemberTokenService
;
import
com.egolm.film.model.LoginToken
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -17,12 +29,21 @@ import io.swagger.annotations.ApiOperation;
@Controller
@RequestMapping
(
"member/apply"
)
public
class
MemberApplyController
{
@Autowired
private
MemberService
memberService
;
@Autowired
private
MemberTokenService
tokenService
;
@ResponseBody
@PostMapping
(
"list"
)
@ApiOperation
(
"申报项目查询"
)
public
Object
list
()
{
return
Rjx
.
jsonOk
();
LoginToken
loginToken
=
tokenService
.
getToken
();
Integer
member_id
=
(
Integer
)
loginToken
.
getId
();
List
<
Map
<
String
,
Object
>>
list
=
memberService
.
queryListByMemberID
(
member_id
);
return
Rjx
.
jsonOk
().
setData
(
list
);
}
@ResponseBody
...
...
@@ -35,16 +56,24 @@ public class MemberApplyController {
@ResponseBody
@PostMapping
(
"get"
)
@ApiOperation
(
"获取申报详情"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"id"
)})
public
Object
get
(
String
id
)
{
return
Rjx
.
jsonOk
();
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"id"
)})
public
Object
get
(
Long
id
)
{
Fc_member_film
memberFilm
=
memberService
.
queryMemberFilmById
(
id
);
List
<
Fc_member_film_director
>
directorList
=
memberService
.
queryMemberFilmDirectorList
(
memberFilm
.
getId
());
List
<
Fc_member_film_issuer
>
issuerList
=
memberService
.
queryMemberFilmIssuerList
(
memberFilm
.
getId
());
List
<
Fc_member_film_playactor
>
playactorList
=
memberService
.
queryMemberFilmPlayactorList
(
memberFilm
.
getId
());
List
<
Fc_member_film_show
>
showList
=
memberService
.
queryMemberFilmShowList
(
memberFilm
.
getId
());
return
Rjx
.
jsonOk
().
setData
(
memberFilm
).
set
(
"directorList"
,
directorList
).
set
(
"issuerList"
,
issuerList
).
set
(
"playactorList"
,
playactorList
).
set
(
"showList"
,
showList
);
}
@ResponseBody
@PostMapping
(
"doApply"
)
@ApiOperation
(
"提交申报"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"id"
)})
public
Object
doApply
(
String
id
)
{
public
Object
doApply
(
Long
id
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Integer
member_id
=
(
Integer
)
loginToken
.
getId
();
memberService
.
doApply
(
member_id
,
id
);
return
Rjx
.
jsonOk
();
}
...
...
src/main/java/com/egolm/film/api/member/MemberInfoController.java
View file @
44ee5a1a
package
com
.
egolm
.
film
.
api
.
member
;
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.film.api.member.service.MemberService
;
import
com.egolm.film.bean.Fc_member
;
import
com.egolm.film.login.service.MemberTokenService
;
import
com.egolm.film.model.LoginToken
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -17,11 +22,20 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping
(
"member/info"
)
public
class
MemberInfoController
{
@Autowired
private
MemberTokenService
tokenService
;
@Autowired
private
MemberService
memberService
;
@ResponseBody
@PostMapping
(
"query"
)
@ApiOperation
(
"查询会员基本信息"
)
public
Object
query
()
{
return
Rjx
.
jsonOk
();
LoginToken
loginToken
=
tokenService
.
getToken
();
Integer
id
=
(
Integer
)
loginToken
.
getId
();
Fc_member
member
=
memberService
.
getMemberById
(
id
);
return
Rjx
.
jsonOk
().
setData
(
member
);
}
@ResponseBody
...
...
@@ -35,6 +49,9 @@ public class MemberInfoController {
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"tel"
),
})
public
Object
save
(
String
email
,
String
realname
,
String
address
,
String
company
,
String
tel
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Integer
id
=
(
Integer
)
loginToken
.
getId
();
memberService
.
updateMember
(
id
,
email
,
realname
,
address
,
company
,
tel
);
return
Rjx
.
jsonOk
();
}
...
...
src/main/java/com/egolm/film/api/member/model/ApplyModel.java
View file @
44ee5a1a
...
...
@@ -5,6 +5,11 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel
public
class
ApplyModel
{
/**
* 会员影片表主键
*/
private
String
id
;
/**
* 基本信息
...
...
@@ -519,4 +524,12 @@ public class ApplyModel {
this
.
film_apply_country
=
film_apply_country
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
}
src/main/java/com/egolm/film/api/member/service/MemberService.java
0 → 100644
View file @
44ee5a1a
package
com
.
egolm
.
film
.
api
.
member
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.egolm.film.bean.Fc_member
;
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
;
public
interface
MemberService
{
Fc_member
getMemberByEmail
(
String
email
);
void
changePassword
(
Integer
id
,
String
newPassword
);
void
saveMember
(
Fc_member
member
);
Fc_member
getMemberById
(
Integer
id
);
void
mergeMember
(
Fc_member
member
);
void
updateMember
(
Integer
id
,
String
email
,
String
realname
,
String
address
,
String
company
,
String
tel
);
List
<
Map
<
String
,
Object
>>
queryListByMemberID
(
Integer
member_id
);
boolean
exists
(
String
email
);
Fc_member_film
queryMemberFilmById
(
Long
id
);
List
<
Fc_member_film_director
>
queryMemberFilmDirectorList
(
Long
member_film_id
);
List
<
Fc_member_film_issuer
>
queryMemberFilmIssuerList
(
Long
member_film_id
);
List
<
Fc_member_film_playactor
>
queryMemberFilmPlayactorList
(
Long
member_film_id
);
List
<
Fc_member_film_show
>
queryMemberFilmShowList
(
Long
member_film_id
);
void
doApply
(
Integer
member_id
,
Long
member_film_id
);
}
src/main/java/com/egolm/film/api/member/service/impl/MemberServiceImpl.java
0 → 100644
View file @
44ee5a1a
package
com
.
egolm
.
film
.
api
.
member
.
service
.
impl
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.film.api.member.service.MemberService
;
import
com.egolm.film.bean.Fc_member
;
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
;
@Service
public
class
MemberServiceImpl
implements
MemberService
{
@Autowired
private
JdbcTemplate
jdbcTemplate
;
@Override
public
void
changePassword
(
Integer
id
,
String
newPassword
)
{
String
sql
=
"update fc_member set password = ? where id = ?"
;
jdbcTemplate
.
executeUpdate
(
sql
,
newPassword
,
id
);
}
@Override
public
Fc_member
getMemberByEmail
(
String
email
)
{
String
sql
=
"select * from fc_member where email = ?"
;
return
jdbcTemplate
.
queryForBean
(
sql
,
Fc_member
.
class
,
email
);
}
@Override
public
void
saveMember
(
Fc_member
member
)
{
jdbcTemplate
.
save
(
member
);
}
@Override
public
Fc_member
getMemberById
(
Integer
id
)
{
String
sql
=
"select * from fc_member where id = ?"
;
return
jdbcTemplate
.
queryForBean
(
sql
,
Fc_member
.
class
,
id
);
}
@Override
public
void
mergeMember
(
Fc_member
member
)
{
jdbcTemplate
.
merge
(
member
);
}
@Override
public
void
updateMember
(
Integer
id
,
String
email
,
String
realname
,
String
address
,
String
company
,
String
tel
)
{
String
sql
=
"update fc_member set email = ?, realname = ?, address = ?, company = ?, tel = ? where id = ?"
;
jdbcTemplate
.
executeUpdate
(
sql
,
email
,
realname
,
address
,
company
,
tel
,
id
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryListByMemberID
(
Integer
member_id
)
{
String
sql
=
"select * from fc_member_film where member_id = ?"
;
return
jdbcTemplate
.
queryForList
(
sql
,
member_id
);
}
@Override
public
boolean
exists
(
String
email
)
{
return
jdbcTemplate
.
queryForInt
(
"select count(*) from fc_member where email = ?"
,
email
)
>
0
;
}
@Override
public
Fc_member_film
queryMemberFilmById
(
Long
id
)
{
return
jdbcTemplate
.
queryForBean
(
"select * from fc_member_film where id = ?"
,
Fc_member_film
.
class
,
id
);
}
@Override
public
List
<
Fc_member_film_director
>
queryMemberFilmDirectorList
(
Long
member_film_id
)
{
return
jdbcTemplate
.
queryForBeans
(
"select * from fc_member_film_director where film_id = ?"
,
Fc_member_film_director
.
class
,
member_film_id
);
}
@Override
public
List
<
Fc_member_film_issuer
>
queryMemberFilmIssuerList
(
Long
member_film_id
)
{
return
jdbcTemplate
.
queryForBeans
(
"select * from fc_member_film_issuer where film_id = ?"
,
Fc_member_film_issuer
.
class
,
member_film_id
);
}
@Override
public
List
<
Fc_member_film_playactor
>
queryMemberFilmPlayactorList
(
Long
member_film_id
)
{
return
jdbcTemplate
.
queryForBeans
(
"select * from fc_member_film_playactor where film_id = ?"
,
Fc_member_film_playactor
.
class
,
member_film_id
);
}
@Override
public
List
<
Fc_member_film_show
>
queryMemberFilmShowList
(
Long
member_film_id
)
{
return
jdbcTemplate
.
queryForBeans
(
"select * from fc_member_film_show where film_id = ?"
,
Fc_member_film_show
.
class
,
member_film_id
);
}
@Override
public
void
doApply
(
Integer
member_id
,
Long
member_film_id
)
{
jdbcTemplate
.
executeUpdate
(
"update fc_member_film set state = ?, apply_state = ? where id = ? and member_id = ?"
,
2
,
2
,
member_film_id
,
member_id
);
}
}
src/main/java/com/egolm/film/bean/Test.java
deleted
100644 → 0
View file @
56b35611
package
com
.
egolm
.
film
.
bean
;
import
javax.persistence.Entity
;
/**
* @author 曲欣亮
* @since 2018-10-10
* @version v-1.0
*/
@Entity
(
name
=
"test"
)
public
class
Test
implements
java
.
io
.
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 电影编号
*/
private
String
film_no
;
/**
* 导入时影片类型名称
*/
private
String
film_type_name
;
/**
* 报名性质
*/
private
String
enroll_type_name
;
/**
* 最佳男演员
*/
private
String
section_award_1
;
/**
* 最佳女演员
*/
private
String
section_award_2
;
/**
* 最佳影片
*/
private
String
section_award_3
;
/**
* 最佳导演
*/
private
String
section_award_4
;
/**
* 最佳编剧
*/
private
String
section_award_5
;
/**
* 最佳摄影
*/
private
String
section_award_6
;
/**
* 评选奖项7
*/
private
String
section_award_7
;
/**
* 评选奖项8
*/
private
String
section_award_8
;
private
Long
id
;
/**
* 英文名称
*/
private
String
en_name
;
/**
* 中文片名
*/
private
String
cn_name
;
/**
* 该片已参加过的电影节及所获奖项
*/
private
String
prize
;
/**
* 无参数构造方法
*/
public
Test
()
{
super
();
}
/**
* 全参数构造方法
* @param film_no 电影编号
* @param film_type_name 导入时影片类型名称
* @param enroll_type_name 报名性质
* @param section_award_1 最佳男演员
* @param section_award_2 最佳女演员
* @param section_award_3 最佳影片
* @param section_award_4 最佳导演
* @param section_award_5 最佳编剧
* @param section_award_6 最佳摄影
* @param section_award_7 评选奖项7
* @param section_award_8 评选奖项8
* @param id
* @param en_name 英文名称
* @param cn_name 中文片名
* @param prize 该片已参加过的电影节及所获奖项
*/
public
Test
(
String
film_no
,
String
film_type_name
,
String
enroll_type_name
,
String
section_award_1
,
String
section_award_2
,
String
section_award_3
,
String
section_award_4
,
String
section_award_5
,
String
section_award_6
,
String
section_award_7
,
String
section_award_8
,
Long
id
,
String
en_name
,
String
cn_name
,
String
prize
)
{
this
.
film_no
=
film_no
;
this
.
film_type_name
=
film_type_name
;
this
.
enroll_type_name
=
enroll_type_name
;
this
.
section_award_1
=
section_award_1
;
this
.
section_award_2
=
section_award_2
;
this
.
section_award_3
=
section_award_3
;
this
.
section_award_4
=
section_award_4
;
this
.
section_award_5
=
section_award_5
;
this
.
section_award_6
=
section_award_6
;
this
.
section_award_7
=
section_award_7
;
this
.
section_award_8
=
section_award_8
;
this
.
id
=
id
;
this
.
en_name
=
en_name
;
this
.
cn_name
=
cn_name
;
this
.
prize
=
prize
;
}
public
void
setFilm_no
(
String
film_no
)
{
this
.
film_no
=
film_no
;
}
public
String
getFilm_no
()
{
return
film_no
;
}
public
void
setFilm_type_name
(
String
film_type_name
)
{
this
.
film_type_name
=
film_type_name
;
}
public
String
getFilm_type_name
()
{
return
film_type_name
;
}
public
void
setEnroll_type_name
(
String
enroll_type_name
)
{
this
.
enroll_type_name
=
enroll_type_name
;
}
public
String
getEnroll_type_name
()
{
return
enroll_type_name
;
}
public
void
setSection_award_1
(
String
section_award_1
)
{
this
.
section_award_1
=
section_award_1
;
}
public
String
getSection_award_1
()
{
return
section_award_1
;
}
public
void
setSection_award_2
(
String
section_award_2
)
{
this
.
section_award_2
=
section_award_2
;
}
public
String
getSection_award_2
()
{
return
section_award_2
;
}
public
void
setSection_award_3
(
String
section_award_3
)
{
this
.
section_award_3
=
section_award_3
;
}
public
String
getSection_award_3
()
{
return
section_award_3
;
}
public
void
setSection_award_4
(
String
section_award_4
)
{
this
.
section_award_4
=
section_award_4
;
}
public
String
getSection_award_4
()
{
return
section_award_4
;
}
public
void
setSection_award_5
(
String
section_award_5
)
{
this
.
section_award_5
=
section_award_5
;
}
public
String
getSection_award_5
()
{
return
section_award_5
;
}
public
void
setSection_award_6
(
String
section_award_6
)
{
this
.
section_award_6
=
section_award_6
;
}
public
String
getSection_award_6
()
{
return
section_award_6
;
}
public
void
setSection_award_7
(
String
section_award_7
)
{
this
.
section_award_7
=
section_award_7
;
}
public
String
getSection_award_7
()
{
return
section_award_7
;
}
public
void
setSection_award_8
(
String
section_award_8
)
{
this
.
section_award_8
=
section_award_8
;
}
public
String
getSection_award_8
()
{
return
section_award_8
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setEn_name
(
String
en_name
)
{
this
.
en_name
=
en_name
;
}
public
String
getEn_name
()
{
return
en_name
;
}
public
void
setCn_name
(
String
cn_name
)
{
this
.
cn_name
=
cn_name
;
}
public
String
getCn_name
()
{
return
cn_name
;
}
public
void
setPrize
(
String
prize
)
{
this
.
prize
=
prize
;
}
public
String
getPrize
()
{
return
prize
;
}
}
src/main/java/com/egolm/film/common/MemberService.java
deleted
100644 → 0
View file @
56b35611
package
com
.
egolm
.
film
.
common
;
import
com.egolm.film.bean.Fc_member
;
public
interface
MemberService
{
String
encodePassword
(
String
password
);
Fc_member
getMemberByEmail
(
String
email
);
void
changePassword
(
String
id
,
String
newPassword
);
void
saveMember
(
Fc_member
member
);
}
src/main/java/com/egolm/film/common/impl/DefaultMessages.java
View file @
44ee5a1a
...
...
@@ -20,7 +20,8 @@ public class DefaultMessages implements Messages {
public
String
get
(
String
name
,
String
...
args
)
{
try
{
Locale
locale
=
LocaleContextHolder
.
getLocale
();
return
messageSource
.
getMessage
(
name
,
args
,
locale
==
null
?
Locale
.
CHINA
:
locale
);
locale
=
locale
==
null
?
Locale
.
CHINA
:
locale
;
return
messageSource
.
getMessage
(
name
,
args
,
locale
);
}
catch
(
NoSuchMessageException
e
)
{
return
name
;
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/egolm/film/common/impl/EmailServiceImpl.java
View file @
44ee5a1a
...
...
@@ -17,7 +17,7 @@ public class EmailServiceImpl implements EmailService {
@Override
public
void
send
(
String
subject
,
String
content
,
String
...
emailAddress
)
{
MailUtil
.
sendBySmtp
(
host
,
port
,
is_auth
,
content
,
password
,
subject
,
content
,
null
,
emailAddress
);
MailUtil
.
sendBySmtp
(
host
,
port
,
is_auth
,
from
,
password
,
subject
,
content
,
null
,
emailAddress
);
}
}
src/main/java/com/egolm/film/common/impl/MemberServiceImpl.java
deleted
100644 → 0
View file @
56b35611
package
com
.
egolm
.
film
.
common
.
impl
;
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.bean.Fc_member
;
import
com.egolm.film.common.MemberService
;
@Service
public
class
MemberServiceImpl
implements
MemberService
{
@Autowired
private
JdbcTemplate
jdbcTemplate
;
@Override
public
void
changePassword
(
String
id
,
String
newPassword
)
{
String
sql
=
"update fc_member set password = ? where id = ?"
;
jdbcTemplate
.
executeUpdate
(
sql
,
this
.
encodePassword
(
newPassword
),
id
);
}
@Override
public
Fc_member
getMemberByEmail
(
String
email
)
{
String
sql
=
"select * from fc_member where email = ?"
;
return
jdbcTemplate
.
queryForBean
(
sql
,
Fc_member
.
class
,
email
);
}
@Override
public
String
encodePassword
(
String
password
)
{
return
StringUtil
.
toMD5HexString
(
password
);
}
@Override
public
void
saveMember
(
Fc_member
member
)
{
jdbcTemplate
.
save
(
member
);
}
}
src/main/java/com/egolm/film/config/Common.java
0 → 100644
View file @
44ee5a1a
package
com
.
egolm
.
film
.
config
;
import
java.util.Random
;
import
com.egolm.common.StringUtil
;
public
class
Common
{
public
static
final
String
SOURCES
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
;
public
static
String
getGenerateString
(
int
length
)
{
Random
random
=
new
Random
();
char
[]
text
=
new
char
[
length
];
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
text
[
i
]
=
SOURCES
.
charAt
(
random
.
nextInt
(
SOURCES
.
length
()));
}
return
new
String
(
text
);
}
public
static
String
encodePassword
(
String
password
,
String
salt
)
{
return
StringUtil
.
toMD5HexString
(
StringUtil
.
toMD5HexString
(
password
+
salt
).
toLowerCase
().
substring
(
4
,
24
)).
toLowerCase
();
}
}
src/main/java/com/egolm/film/config/LocaleConfig.java
0 → 100644
View file @
44ee5a1a
package
com
.
egolm
.
film
.
config
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.support.ResourceBundleMessageSource
;
@Configuration
public
class
LocaleConfig
{
@Bean
public
MessageSource
messageSource
()
{
ResourceBundleMessageSource
messageSource
=
new
ResourceBundleMessageSource
();
messageSource
.
setBasename
(
"i18n/messages"
);
messageSource
.
setDefaultEncoding
(
"utf-8"
);
messageSource
.
setAlwaysUseMessageFormat
(
true
);
messageSource
.
setCacheSeconds
(-
1
);
return
messageSource
;
}
}
src/main/java/com/egolm/film/config/WebMvcConfig.java
View file @
44ee5a1a
...
...
@@ -19,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
import
com.egolm.film.config.interceptor.AdminLoginInterceptor
;
import
com.egolm.film.config.interceptor.LocaleSessionInterceptor
;
import
com.egolm.film.config.interceptor.MemberLoginInterceptor
;
import
com.egolm.film.config.interceptor.UserLoginInterceptor
;
@Configuration
...
...
@@ -31,7 +32,7 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
private
UserLoginInterceptor
userLoginInterceptor
;
@Autowired
private
Us
erLoginInterceptor
memberLoginInterceptor
;
private
Memb
erLoginInterceptor
memberLoginInterceptor
;
@Autowired
private
LocaleSessionInterceptor
localeSessionInterceptor
;
...
...
@@ -42,6 +43,7 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
registry
.
addInterceptor
(
adminLoginInterceptor
).
addPathPatterns
(
"/admin/**"
).
excludePathPatterns
(
"/admin/login"
);
registry
.
addInterceptor
(
userLoginInterceptor
).
addPathPatterns
(
"/user/**"
).
excludePathPatterns
(
"/user/login"
);
registry
.
addInterceptor
(
memberLoginInterceptor
).
addPathPatterns
(
"/member/**"
).
excludePathPatterns
(
"/member/login"
);
}
@Override
...
...
src/main/java/com/egolm/film/login/MemberLoginController.java
View file @
44ee5a1a
...
...
@@ -36,7 +36,7 @@ public class MemberLoginController {
}
else
{
LoginToken
token
=
tokenService
.
doLogin
(
username
,
password
);
if
(
token
!=
null
)
{
return
Rjx
.
jsonOk
()
.
setData
(
token
)
;
return
Rjx
.
jsonOk
();
}
else
{
throw
new
XException
(
messages
.
get
(
"sys.err.user_or_pwd"
));
}
...
...
src/main/java/com/egolm/film/login/service/impl/MemberTokenServiceImpl.java
View file @
44ee5a1a
package
com
.
egolm
.
film
.
login
.
service
.
impl
;
import
java.util.List
;
import
java.util.Map
;
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.member.service.MemberService
;
import
com.egolm.
film.bean.Fc_member
;
import
com.egolm.film.common.Messages
;
import
com.egolm.film.config.Common
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.login.service.MemberTokenService
;
...
...
@@ -23,35 +21,29 @@ public class MemberTokenServiceImpl implements MemberTokenService {
private
Messages
messages
;
@Autowired
private
JdbcTemplate
jdbcTemplat
e
;
private
MemberService
memberServic
e
;
@Override
public
LoginToken
doLogin
(
String
username
,
String
password
)
{
public
LoginToken
doLogin
(
String
email
,
String
password
)
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
String
md5String
=
StringUtil
.
toMD5HexString
(
password
);
String
loginSql
=
"select * from fc_member 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
(
messages
.
get
(
"sys.err.user_disabled"
));
}
else
{
throw
new
XException
(
messages
.
get
(
"sys.err"
));
}
}
else
if
(
list
.
size
()
==
0
)
{
throw
new
XException
(
messages
.
get
(
"sys.err.user_pwd_err"
));
Fc_member
member
=
memberService
.
getMemberByEmail
(
email
);
Integer
state
=
member
.
getState
();
if
(
state
==
1
)
{
String
salt
=
member
.
getSalt
();
String
dbPwd
=
member
.
getPassword
();
String
encodePassword
=
Common
.
encodePassword
(
password
,
salt
);
if
(
encodePassword
.
equals
(
dbPwd
))
{
Integer
id
=
member
.
getId
();
LoginToken
token
=
new
LoginToken
(
id
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
return
token
;
}
else
{
throw
new
XException
(
messages
.
get
(
"sys.err"
));
throw
new
XException
(
messages
.
get
(
"sys.err
.user_pwd_err
"
));
}
}
else
if
(
state
==
2
)
{
throw
new
XException
(
messages
.
get
(
"sys.err.user_disabled"
));
}
else
{
throw
new
XException
(
messages
.
get
(
"sys.err
.user_pwd_err
"
));
throw
new
XException
(
messages
.
get
(
"sys.err"
));
}
}
...
...
src/main/java/com/egolm/film/login/service/impl/UserTokenServiceImpl.java
View file @
44ee5a1a
...
...
@@ -24,7 +24,7 @@ public class UserTokenServiceImpl implements UserTokenService {
@Override
public
LoginToken
doLogin
(
String
username
,
String
password
)
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
String
md5String
=
StringUtil
.
toMD5HexString
(
password
);
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
)
{
...
...
src/main/resources/application-dev.properties
View file @
44ee5a1a
spring.datasource.url
=
jdbc:mysql://10.10.0.111:3306/film_
dev
?useSSL=false&useUnicode=true&characterEncoding=utf8
spring.datasource.url
=
jdbc:mysql://10.10.0.111:3306/film_
critic_2018
?useSSL=false&useUnicode=true&characterEncoding=utf8
spring.datasource.username
=
root
spring.datasource.password
=
egolm#2018
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
...
...
src/main/resources/application-pro.properties
View file @
44ee5a1a
spring.datasource.url
=
jdbc:mysql://10.10.0.111:3306/film_
dev
?useSSL=false&useUnicode=true&characterEncoding=utf8
spring.datasource.url
=
jdbc:mysql://10.10.0.111:3306/film_
critic_2018
?useSSL=false&useUnicode=true&characterEncoding=utf8
spring.datasource.username
=
root
spring.datasource.password
=
egolm#2018
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
...
...
src/main/resources/application.properties
View file @
44ee5a1a
...
...
@@ -13,12 +13,8 @@ spring.http.encoding.force=true
spring.http.encoding.enabled
=
true
spring.http.encoding.charset
=
utf-8
spring.messages.basename
=
classpath:i18n/messages
spring.messages.cache-seconds
=
3600
spring.messages.encoding
=
UTF-8
com.egolm.film.email.smtp.host
=
smtp.163.com
com.egolm.film.email.smtp.host
=
mail.egolm.com
com.egolm.film.email.smtp.port
=
25
com.egolm.film.email.smtp.is_auth
=
true
com.egolm.film.email.smtp.from
=
15601712556@163
.com
com.egolm.film.email.smtp.from
=
qu.xinliang@egolm
.com
com.egolm.film.email.smtp.password
=
Liang12345
src/main/resources/i18n/message.properties
deleted
100644 → 0
View file @
56b35611
email.getPassword.subject
=
\u
4E2D
\u
56FD
\u7535\u
5F71
\u8282
[
\u
627E
\u
56DE
\u
5BC6
\u7801
]
\u
90AE
\u
4EF6
email.getPassword.content
=
{0},
\u
60A8
\u
597D,
\u
60A8
\u7684\u
65B0
\u
5BC6
\u7801\u
662F: [{1}]
sys.err
=
\u
7CFB
\u
7EDF
\u9519\u
8BEF
sys.err.user_disabled
=
\u7528\u6237\u
5DF2
\u
7ECF
\u7981\u7528
sys.err.user_pwd_err=
\u7528\u6237\u6216\u
5BC6
\u7801\u9519\u
8BEF
sys.err.user_pwd_null
=
\u7528\u6237\u
540D
\u
548C
\u
5BC6
\u7801\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
msg.hello
=
\u
60A8
\u
597D
msg.your_pwd
=
\u
60A8
\u7684\u
5BC6
\u7801\u
662F
\ No newline at end of file
src/main/resources/i18n/message_zh_CN.properties
deleted
100644 → 0
View file @
56b35611
src/main/resources/i18n/message
_en_US
.properties
→
src/main/resources/i18n/message
s
.properties
View file @
44ee5a1a
File moved
src/main/resources/i18n/messages_en_US.properties
0 → 100644
View file @
44ee5a1a
msg.test
=
Test
email.getPassword.subject
=
China Film Festival [retrieve password] email
email.getPassword.content
=
Hello {0}, Your password is: [{1}]
err
=
System error
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.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
0 → 100644
View file @
44ee5a1a
msg.test
=
\u
6D4B
\u
8BD5
email.getPassword.subject
=
\u
4E2D
\u
56FD
\u7535\u
5F71
\u8282
[
\u
627E
\u
56DE
\u
5BC6
\u7801
]
\u
90AE
\u
4EF6
email.getPassword.content
=
{0}
\u
60A8
\u
597D,
\u
60A8
\u7684\u
65B0
\u
5BC6
\u7801\u
662F: [{1}]
err
=
\u
7CFB
\u
7EDF
\u9519\u
8BEF
err.user_disabled
=
\u7528\u6237\u
5DF2
\u
7ECF
\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.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