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
f8e35a4b
Commit
f8e35a4b
authored
Dec 12, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
c38afe9c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
183 additions
and
7 deletions
+183
-7
EmailService.java
src/main/java/com/egolm/film/api/service/EmailService.java
+1
-1
EmailServiceImpl.java
...ava/com/egolm/film/api/service/impl/EmailServiceImpl.java
+27
-3
OpenMemberApiController.java
.../java/com/egolm/film/api/web/OpenMemberApiController.java
+1
-1
AdminFirstController.java
...va/com/egolm/film/api/web/admin/AdminFirstController.java
+7
-2
Fc_email_record.java
src/main/java/com/egolm/film/bean/Fc_email_record.java
+147
-0
No files found.
src/main/java/com/egolm/film/api/service/EmailService.java
View file @
f8e35a4b
...
...
@@ -2,6 +2,6 @@ package com.egolm.film.api.service;
public
interface
EmailService
{
void
send
(
String
subject
,
String
content
,
String
...
emailAddress
);
void
send
(
Integer
sender_type_id
,
Integer
sender_id
,
String
subject
,
String
content
,
String
email
);
}
src/main/java/com/egolm/film/api/service/impl/EmailServiceImpl.java
View file @
f8e35a4b
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
java.util.Date
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.MailUtil
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.film.api.service.EmailService
;
import
com.egolm.film.bean.Fc_email_record
;
@Service
public
class
EmailServiceImpl
implements
EmailService
{
...
...
@@ -16,16 +21,34 @@ public class EmailServiceImpl implements EmailService {
@Value
(
"${com.egolm.film.email.smtp.username}"
)
private
String
username
;
@Value
(
"${com.egolm.film.email.smtp.password}"
)
private
String
password
;
@Autowired
JdbcTemplate
jdbcTemplate
;
@Override
public
void
send
(
String
subject
,
String
content
,
String
...
emailAddress
)
{
public
void
send
(
Integer
sender_type_id
,
Integer
sender_id
,
String
subject
,
String
content
,
String
email
)
{
Fc_email_record
record
=
new
Fc_email_record
();
record
.
setSender_id
(
sender_id
);
record
.
setSender_type_id
(
sender_type_id
);
record
.
setEmail
(
email
);
record
.
setCreate_time
(
new
Date
());
record
.
setSubject
(
subject
);
record
.
setContent
(
content
);
record
.
setSend_state
(
0
);
jdbcTemplate
.
save
(
record
);
new
Thread
()
{
public
void
run
()
{
MailUtil
.
sendBySmtp
(
host
,
port
,
is_auth
,
username
,
password
,
from
,
subject
,
content
,
null
,
emailAddress
);
try
{
MailUtil
.
sendBySmtp
(
host
,
port
,
is_auth
,
username
,
password
,
from
,
subject
,
content
,
null
,
email
);
record
.
setSend_state
(
1
);
}
catch
(
Exception
e
)
{
record
.
setSend_state
(
2
);
}
finally
{
jdbcTemplate
.
update
(
record
);
}
}
}.
start
();
}
public
static
void
main
(
String
[]
args
)
{
String
host
=
"smtp.siff.com"
;
Integer
port
=
25
;
...
...
@@ -39,4 +62,5 @@ public class EmailServiceImpl implements EmailService {
MailUtil
.
sendBySmtp
(
host
,
port
,
is_auth
,
username
,
password
,
from
,
subject
,
content
,
null
,
emailAddress
);
}
}
src/main/java/com/egolm/film/api/web/OpenMemberApiController.java
View file @
f8e35a4b
...
...
@@ -102,7 +102,7 @@ public class OpenMemberApiController {
String
name
=
member
.
getUsername
();
String
subject
=
messages
.
get
(
"email.getPassword.subject"
);
String
content
=
messages
.
get
(
"email.getPassword.content"
,
name
==
null
?
""
:
name
,
password
);
emailService
.
send
(
subject
,
content
,
email
);
emailService
.
send
(
0
,
null
,
subject
,
content
,
email
);
return
Rjx
.
jsonOk
();
}
...
...
src/main/java/com/egolm/film/api/web/admin/AdminFirstController.java
View file @
f8e35a4b
...
...
@@ -26,6 +26,7 @@ import com.egolm.film.api.service.VoteService;
import
com.egolm.film.bean.Fc_member
;
import
com.egolm.film.bean.Fc_member_film
;
import
com.egolm.film.bean.Fc_member_film_enroll
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.util.Common
;
import
io.swagger.annotations.Api
;
...
...
@@ -113,6 +114,8 @@ public class AdminFirstController {
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"film_type_name_short"
,
value
=
"影片分类扩展分类"
),
})
public
Object
pass
(
Long
member_film_id
,
String
film_type_name_short
)
{
LoginToken
token
=
tokenService
.
getToken
();
Integer
adminid
=
(
Integer
)
token
.
getId
();
memberFilmService
.
verifyFilmDuplicate
(
member_film_id
);
Fc_member_film
film
=
new
Fc_member_film
();
film
.
setId
(
member_film_id
);
...
...
@@ -148,7 +151,7 @@ public class AdminFirstController {
}
String
film_no
=
StringUtil
.
formatLength
(
memberFilm
.
getFilm_no
(),
"0000"
);
content
=
MessageFormat
.
format
(
content
,
member
.
getUsername
(),
film_no
,
filmName
==
null
?
""
:
filmName
);
emailService
.
send
(
subject
,
content
,
member
.
getEmail
());
emailService
.
send
(
2
,
adminid
,
subject
,
content
,
member
.
getEmail
());
return
Rjx
.
jsonOk
().
set
(
"email"
,
member
.
getEmail
()).
set
(
"film_no"
,
memberFilm
.
getFilm_no
());
}
...
...
@@ -177,7 +180,9 @@ public class AdminFirstController {
String
[]
strs
=
i18n_language
.
split
(
"_"
,
2
);
String
content
=
Common
.
getStringAsStream
(
"doc/first_pass_"
+
strs
[
0
].
toLowerCase
()
+
"_"
+
strs
[
1
].
toUpperCase
()
+
".txt"
);
content
=
MessageFormat
.
format
(
content
,
"曲欣亮"
,
"00001"
,
"蜘蛛侠"
);
emailService
.
send
(
"测试邮件"
,
content
,
email
);
LoginToken
token
=
tokenService
.
getToken
();
Integer
adminid
=
(
Integer
)
token
.
getId
();
emailService
.
send
(
2
,
adminid
,
"测试邮件"
,
content
,
email
);
return
Rjx
.
jsonOk
();
}
...
...
src/main/java/com/egolm/film/bean/Fc_email_record.java
0 → 100644
View file @
f8e35a4b
package
com
.
egolm
.
film
.
bean
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
java.util.Date
;
/**
* @author 曲欣亮
*/
@Entity
(
name
=
"fc_email_record"
)
public
class
Fc_email_record
implements
java
.
io
.
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@Id
private
Integer
id
;
/**
* 发件人ID
*/
private
Integer
sender_id
;
/**
* 0会员,1评委,2管理员
*/
private
Integer
sender_type_id
;
/**
* 发送状态 0未发送 1成功 2失败
*/
private
Integer
send_state
;
/**
* 主题
*/
private
String
subject
;
/**
* 收件邮箱
*/
private
String
email
;
/**
* 邮件内容
*/
private
String
content
;
private
Date
create_time
;
/**
* 无参数构造方法
*/
public
Fc_email_record
()
{
super
();
}
/**
* 全参数构造方法
* @param id
* @param sender_id 发件人ID
* @param sender_type_id 0会员,1评委,2管理员
* @param send_state 发送状态 0未发送 1成功 2失败
* @param subject 主题
* @param email 收件邮箱
* @param content 邮件内容
* @param create_time
*/
public
Fc_email_record
(
Integer
id
,
Integer
sender_id
,
Integer
sender_type_id
,
Integer
send_state
,
String
subject
,
String
email
,
String
content
,
Date
create_time
)
{
this
.
id
=
id
;
this
.
sender_id
=
sender_id
;
this
.
sender_type_id
=
sender_type_id
;
this
.
send_state
=
send_state
;
this
.
subject
=
subject
;
this
.
email
=
email
;
this
.
content
=
content
;
this
.
create_time
=
create_time
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getId
()
{
return
id
;
}
public
void
setSender_id
(
Integer
sender_id
)
{
this
.
sender_id
=
sender_id
;
}
public
Integer
getSender_id
()
{
return
sender_id
;
}
public
void
setSender_type_id
(
Integer
sender_type_id
)
{
this
.
sender_type_id
=
sender_type_id
;
}
public
Integer
getSender_type_id
()
{
return
sender_type_id
;
}
public
void
setSend_state
(
Integer
send_state
)
{
this
.
send_state
=
send_state
;
}
public
Integer
getSend_state
()
{
return
send_state
;
}
public
void
setSubject
(
String
subject
)
{
this
.
subject
=
subject
;
}
public
String
getSubject
()
{
return
subject
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
public
String
getEmail
()
{
return
email
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setCreate_time
(
Date
create_time
)
{
this
.
create_time
=
create_time
;
}
public
Date
getCreate_time
()
{
return
create_time
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment