Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
Z
zion
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
zion
Commits
55a871b4
提交
55a871b4
authored
1月 03, 2020
作者:
luojie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增定时发送邮件,修改首页商品接口
上级
9463f368
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
129 行增加
和
15 行删除
+129
-15
ZionApplication.java
src/main/java/com/diaoyun/zion/ZionApplication.java
+2
-0
EmailTemplateConstant.java
...aoyun/zion/chinafrica/constant/EmailTemplateConstant.java
+2
-0
TbCfUserInfoDao.java
...java/com/diaoyun/zion/chinafrica/dao/TbCfUserInfoDao.java
+3
-1
TbCfOrderEntity.java
...a/com/diaoyun/zion/chinafrica/entity/TbCfOrderEntity.java
+0
-1
TbCfStationItemEntity.java
...diaoyun/zion/chinafrica/entity/TbCfStationItemEntity.java
+17
-0
TbCfUserInfoEntity.java
...om/diaoyun/zion/chinafrica/entity/TbCfUserInfoEntity.java
+13
-0
TbCfUserInfoService.java
.../diaoyun/zion/chinafrica/service/TbCfUserInfoService.java
+4
-1
TbCfUserInfoServiceImpl.java
...zion/chinafrica/service/impl/TbCfUserInfoServiceImpl.java
+10
-4
QuartzMethod.java
...ain/java/com/diaoyun/zion/master/quartz/QuartzMethod.java
+30
-0
EmailHelper.java
src/main/java/com/diaoyun/zion/master/util/EmailHelper.java
+8
-3
TbCfStationItemDao.xml
src/main/resources/mapper/TbCfStationItemDao.xml
+10
-0
TbCfUserInfoDao.xml
src/main/resources/mapper/TbCfUserInfoDao.xml
+18
-5
email-template2019-12-27.ftl
src/main/resources/templates/email-template2019-12-27.ftl
+12
-0
没有找到文件。
src/main/java/com/diaoyun/zion/ZionApplication.java
浏览文件 @
55a871b4
...
...
@@ -4,9 +4,11 @@ import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@SpringBootApplication
@EnableCaching
@EnableScheduling
public
class
ZionApplication
extends
SpringBootServletInitializer
{
//tomcat 设置
/*@Override
...
...
src/main/java/com/diaoyun/zion/chinafrica/constant/EmailTemplateConstant.java
浏览文件 @
55a871b4
...
...
@@ -8,4 +8,6 @@ public class EmailTemplateConstant {
public
static
String
REGISTER
=
"email-template.ftl"
;
//注册
public
static
String
REGISTERS
=
"email-templates.ftl"
;
//20191227
public
static
String
REGISTER20191227
=
"email-template2019-12-27.ftl"
;
}
src/main/java/com/diaoyun/zion/chinafrica/dao/TbCfUserInfoDao.java
浏览文件 @
55a871b4
...
...
@@ -67,5 +67,7 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> {
List
<
TbCfUserInfoEntity
>
selectUserByPhone
();
List
<
String
>
findEmails
();
String
findEmails
();
int
updateIsSend
(
String
email
);
}
src/main/java/com/diaoyun/zion/chinafrica/entity/TbCfOrderEntity.java
浏览文件 @
55a871b4
...
...
@@ -130,7 +130,6 @@ public class TbCfOrderEntity implements Serializable {
*/
private
Integer
enableFlag
;
/**
* 商品品名
*/
...
...
src/main/java/com/diaoyun/zion/chinafrica/entity/TbCfStationItemEntity.java
浏览文件 @
55a871b4
...
...
@@ -38,6 +38,11 @@ public class TbCfStationItemEntity implements Serializable {
* 商品价格
*/
private
BigDecimal
itemPrice
;
/**
* 商品折扣价格
*/
private
BigDecimal
discountPrice
;
/**
* 商品链接
*/
...
...
@@ -282,4 +287,16 @@ public class TbCfStationItemEntity implements Serializable {
public
String
getItemDescritionId
()
{
return
itemDescritionId
;
}
/**
* 设置:商品折扣价格
*/
public
BigDecimal
getDiscountPrice
()
{
return
discountPrice
;
}
/**
* 获取:商品折扣价格
*/
public
void
setDiscountPrice
(
BigDecimal
discountPrice
)
{
this
.
discountPrice
=
discountPrice
;
}
}
src/main/java/com/diaoyun/zion/chinafrica/entity/TbCfUserInfoEntity.java
浏览文件 @
55a871b4
...
...
@@ -98,6 +98,11 @@ public class TbCfUserInfoEntity implements Serializable {
*/
private
Integer
emailFlag
;
/**
* 是否已发送邮件 0 未发送,1已发送
*/
private
Integer
isSend
;
/**
* 设置:用户id
*/
...
...
@@ -366,4 +371,12 @@ public class TbCfUserInfoEntity implements Serializable {
public
void
setEmailFlag
(
Integer
emailFlag
)
{
this
.
emailFlag
=
emailFlag
;
}
public
Integer
getIsSend
()
{
return
isSend
;
}
public
void
setIsSend
(
Integer
isSend
)
{
this
.
isSend
=
isSend
;
}
}
src/main/java/com/diaoyun/zion/chinafrica/service/TbCfUserInfoService.java
浏览文件 @
55a871b4
...
...
@@ -180,7 +180,10 @@ public interface TbCfUserInfoService {
Result
queryUserByUserId
(
String
userId
);
List
<
TbCfUserInfoEntity
>
selectUserByPhone
();
List
<
String
>
findEmails
();
String
sendRegister
(
String
email
)
throws
EmailException
,
TemplateException
,
IOException
;
String
findEmails
();
int
updateIsSend
(
String
email
);
}
src/main/java/com/diaoyun/zion/chinafrica/service/impl/TbCfUserInfoServiceImpl.java
浏览文件 @
55a871b4
...
...
@@ -559,15 +559,21 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
return
tbCfUserInfoDao
.
selectUserByPhone
();
}
@Override
public
String
sendRegister
(
String
email
)
throws
EmailException
,
TemplateException
,
IOException
{
emailHelper
.
sendEmail
(
email
,
EmailTemplateConstant
.
REGISTER20191227
);
return
"s"
;
}
@Override
public
List
<
String
>
findEmails
()
{
public
String
findEmails
()
{
return
tbCfUserInfoDao
.
findEmails
();
}
@Override
public
String
sendRegister
(
String
email
)
throws
EmailException
,
TemplateException
,
IOException
{
emailHelper
.
sendEmail
(
email
,
EmailTemplateConstant
.
REGISTERS
);
return
"s"
;
public
int
updateIsSend
(
String
email
)
{
return
tbCfUserInfoDao
.
updateIsSend
(
email
);
}
...
...
src/main/java/com/diaoyun/zion/master/quartz/QuartzMethod.java
0 → 100644
浏览文件 @
55a871b4
package
com
.
diaoyun
.
zion
.
master
.
quartz
;
import
com.diaoyun.zion.chinafrica.service.TbCfUserInfoService
;
import
freemarker.template.TemplateException
;
import
org.apache.commons.mail.EmailException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.util.List
;
@Component
public
class
QuartzMethod
{
@Autowired
private
TbCfUserInfoService
tbCfUserInfoService
;
//@Scheduled(cron = "0 0/1 * * * ? ")
public
void
sendEmail
()
throws
EmailException
,
TemplateException
,
IOException
{
System
.
out
.
println
(
"////////////////////////////////////////////////////"
);
String
email
=
tbCfUserInfoService
.
findEmails
();
// String email= "1203063316@qq.com";
if
(
email
!=
null
){
String
s
=
tbCfUserInfoService
.
sendRegister
(
email
);
if
(
s
!=
null
){
System
.
out
.
println
(
"已发送邮件:"
+
email
);
}
}
}
}
src/main/java/com/diaoyun/zion/master/util/EmailHelper.java
浏览文件 @
55a871b4
package
com
.
diaoyun
.
zion
.
master
.
util
;
import
com.diaoyun.zion.chinafrica.service.TbCfUserInfoService
;
import
com.diaoyun.zion.master.bo.EmailTemplateBo
;
import
com.diaoyun.zion.master.config.DomainProperties
;
import
freemarker.template.Configuration
;
...
...
@@ -24,6 +25,8 @@ public class EmailHelper {
private
Configuration
configuration
;
@Autowired
private
DomainProperties
domainProperties
;
@Autowired
private
TbCfUserInfoService
tbCfUserInfoService
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
EmailHelper
.
class
);
...
...
@@ -53,10 +56,9 @@ public class EmailHelper {
//logger.info("邮件发送结果:"+res);
return
emailTemplateBo
.
getIdentifyCode
();
}
public
void
sendEmail
(
String
email
,
String
templateName
)
throws
IOException
,
TemplateException
,
EmailException
{
Template
t
=
configuration
.
getTemplate
(
templateName
);
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
Map
<
String
[]
,
Object
>
model
=
new
HashMap
<>();
String
html
=
FreeMarkerTemplateUtils
.
processTemplateIntoString
(
t
,
model
);
HtmlEmail
emails
=
new
HtmlEmail
();
//创建一个HtmlEmail实例对象
emails
.
setHostName
(
domainProperties
.
getProperty
(
"email.hostName"
));
//邮箱的SMTP服务器,一般123邮箱的是smtp.123.com,qq邮箱为smtp.qq.com
...
...
@@ -65,9 +67,12 @@ public class EmailHelper {
emails
.
addTo
(
email
);
//设置收件人
emails
.
setFrom
(
domainProperties
.
getProperty
(
"email.from.email"
),
domainProperties
.
getProperty
(
"email.from.name"
));
//发送人的邮箱为自己的,用户名可以随便填
emails
.
setAuthentication
(
domainProperties
.
getProperty
(
"email.authentication.userName"
),
domainProperties
.
getProperty
(
"email.authentication.password"
));
//设置发送人的邮箱和用户名和授权码(授权码是自己设置的)
emails
.
setSubject
(
domainProperties
.
getProperty
(
"email.
sub
ject"
));
//设置发送主题
emails
.
setSubject
(
domainProperties
.
getProperty
(
"email.
pro
ject"
));
//设置发送主题
emails
.
setMsg
(
html
);
//设置发送内容
String
res
=
emails
.
send
();
if
(
res
!=
null
){
tbCfUserInfoService
.
updateIsSend
(
email
);
}
logger
.
info
(
"邮件发送结果:"
+
res
);
}
}
src/main/resources/mapper/TbCfStationItemDao.xml
浏览文件 @
55a871b4
...
...
@@ -10,6 +10,7 @@
<result
property=
"itemBrief"
column=
"item_brief"
/>
<result
property=
"itemCategory"
column=
"item_category"
/>
<result
property=
"itemPrice"
column=
"item_price"
/>
<result
property=
"discountPrice"
column=
"discount_price"
/>
<result
property=
"itemUrl"
column=
"item_url"
/>
<result
property=
"itemImg"
column=
"item_img"
/>
<result
property=
"itemNum"
column=
"item_num"
/>
...
...
@@ -29,6 +30,7 @@
`item_brief`,
`item_category`,
`item_price`,
`discount_price`,
`item_url`,
`item_img`,
`item_num`,
...
...
@@ -50,6 +52,7 @@
`item_brief`,
`item_category`,
`item_price`,
`discount_price`,
`item_url`,
`item_img`,
`item_num`,
...
...
@@ -93,6 +96,7 @@
`item_brief`,
`item_category`,
`item_price`,
`discount_price`,
`item_url`,
`item_img`,
`item_num`,
...
...
@@ -109,6 +113,7 @@
#{itemBrief},
#{itemCategory},
#{itemPrice},
#{discountPrice},
#{itemUrl},
#{itemImg},
#{itemNum},
...
...
@@ -128,6 +133,7 @@
<if
test=
"itemBrief != null"
>
`item_brief` = #{itemBrief},
</if>
<if
test=
"itemCategory != null"
>
`item_category` = #{itemCategory},
</if>
<if
test=
"itemPrice != null"
>
`item_price` = #{itemPrice},
</if>
<if
test=
"discountPrice != null"
>
`discount_price` = #{discountPrice},
</if>
<if
test=
"itemUrl != null"
>
`item_url` = #{itemUrl},
</if>
<if
test=
"itemImg != null"
>
`item_img` = #{itemImg},
</if>
<if
test=
"itemNum != null"
>
`item_num` = #{itemNum},
</if>
...
...
@@ -160,6 +166,7 @@
`item_brief`,
`item_category`,
`item_price`,
`discount_price`,
`item_url`,
`item_img`,
`item_num`,
...
...
@@ -182,6 +189,7 @@
`item_brief`,
`item_category`,
`item_price`,
`discount_price`,
`item_url`,
`item_img`,
`item_num`,
...
...
@@ -201,6 +209,7 @@
`item_brief`,
`item_category`,
`item_price`,
`discount_price`,
`item_url`,
`item_img`,
`item_num`,
...
...
@@ -221,6 +230,7 @@
`item_brief`,
`item_category`,
`item_price`,
`discount_price`,
`item_url`,
`item_img`,
`item_num`,
...
...
src/main/resources/mapper/TbCfUserInfoDao.xml
浏览文件 @
55a871b4
...
...
@@ -25,6 +25,7 @@
<result
property=
"invitedCount"
column=
"invited_count"
/>
<result
property=
"enableFlag"
column=
"enable_flag"
/>
<result
property=
"emailFlag"
column=
"email_flag"
/>
<result
property=
"isSend"
column=
"is_send"
/>
</resultMap>
<select
id=
"queryObject"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity"
>
...
...
@@ -49,7 +50,8 @@
`invited_user_id`,
`invited_count`,
`enable_flag`,
`email_flag`
`email_flag`,
`is_send`
from tb_cf_user_info
where user_id = #{id}
</select>
...
...
@@ -76,7 +78,8 @@
`invited_user_id`,
`invited_count`,
`enable_flag`,
`email_flag`
`email_flag`,
`is_send`
from tb_cf_user_info
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
...
...
@@ -134,7 +137,9 @@
`invited_user_id`,
`invited_count`,
`enable_flag`,
`email_flag`)
`email_flag`,
`is_send`
)
values(
#{userId},
#{userNo},
...
...
@@ -156,7 +161,8 @@
#{invitedUserId},
#{invitedCount},
#{enableFlag},
#{emailFlag}
#{emailFlag},
#{isSend}
)
</insert>
...
...
@@ -180,6 +186,7 @@
<if
test=
"invitedCount != null"
>
`invited_count` = #{invitedCount},
</if>
<if
test=
"enableFlag != null"
>
`enable_flag` = #{enableFlag},
</if>
<if
test=
"emailFlag != null"
>
`email_flag` = #{emailFlag}
</if>
<if
test=
"isSend != null"
>
`is_send` = #{isSend}
</if>
</set>
where user_id = #{userId}
</update>
...
...
@@ -195,8 +202,14 @@
</foreach>
</delete>
<select
id=
"findEmails"
resultType=
"String"
>
select account from tb_cf_user_info where account LIKE concat('%@%')
select account from tb_cf_user_info where is_send=0 and account like '%@%' order by rand() limit 1
</select>
<!-- 修改用户是否发送邮件-->
<update
id=
"updateIsSend"
>
update tb_cf_user_info set is_send=1 where account=#{email}
</update>
<!--根据nickname获取用户信息-->
<select
id=
"getByNickname"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity"
>
select * from tb_cf_user_info where nickname=#{nickname}
...
...
src/main/resources/templates/email-template2019-12-27.ftl
0 → 100644
浏览文件 @
55a871b4
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>
Afrishop Verification
</title>
</head>
<body>
<section
style=
"width: 600px;height :720px;margin:0 auto;box-sizing: border-box;position: relative;"
>
<img
style=
"position:absolute;width: 600px;height :720px;top:0;left:0;"
src=
"http://q2bspr5ox.bkt.clouddn.com/afrishop20191227.jpg"
alt=
"背景图"
>
</section>
</body>
</html>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论