Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
cdd5389e
Commit
cdd5389e
authored
May 25, 2020
by
dengshichuan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dsc' into 'develop'
新添加了邮箱业务,目前还没有企业邮箱 See merge request 8timerv2/8timerapiv200!116
parents
0b309ac0
068dabd9
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
196 additions
and
83 deletions
+196
-83
pom.xml
+4
-0
src/main/java/cn/timer/api/bean/clazz/CityClazz.java
+0
-50
src/main/java/cn/timer/api/bean/qyzx/QyzxEmpLogin.java
+3
-0
src/main/java/cn/timer/api/config/interceptor/WebSecurityConfig.java
+1
-5
src/main/java/cn/timer/api/controller/LoginController.java
+18
-7
src/main/java/cn/timer/api/controller/email/EmailController.java
+162
-0
src/main/java/cn/timer/api/dao/clazz/CityClazzMapper.java
+0
-21
src/main/resources/application-dev.yml
+8
-0
No files found.
pom.xml
View file @
cdd5389e
...
@@ -94,6 +94,10 @@
...
@@ -94,6 +94,10 @@
<artifactId>spring-boot-starter-security</artifactId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency> -->
</dependency> -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-mail
</artifactId>
</dependency>
<!-- 添加MySQL依赖 -->
<!-- 添加MySQL依赖 -->
<dependency>
<dependency>
...
...
src/main/java/cn/timer/api/bean/clazz/CityClazz.java
deleted
100644 → 0
View file @
0b309ac0
/**
* @date 2019年12月7日
* @author 翁东州
* @方法中文名称:
*/
package
cn
.
timer
.
api
.
bean
.
clazz
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @date 2019年12月7日
* @author 翁东州
* @方法中文名称:
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"city_clazz"
)
@ApiModel
(
"城市类"
)
public
class
CityClazz
extends
Model
<
CityClazz
>{
private
static
final
long
serialVersionUID
=
3208566213833439168L
;
@Id
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"id"
,
example
=
""
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"data"
,
example
=
""
)
private
byte
[]
data
;
}
src/main/java/cn/timer/api/bean/qyzx/QyzxEmpLogin.java
View file @
cdd5389e
...
@@ -52,6 +52,9 @@ public class QyzxEmpLogin extends Model<QyzxEmpLogin> {
...
@@ -52,6 +52,9 @@ public class QyzxEmpLogin extends Model<QyzxEmpLogin> {
@ApiModelProperty
(
value
=
"邮箱地址 "
,
example
=
"邮箱地址"
)
@ApiModelProperty
(
value
=
"邮箱地址 "
,
example
=
"邮箱地址"
)
private
String
email
;
private
String
email
;
@ApiModelProperty
(
value
=
"邮箱状态 "
,
example
=
"0-未激活 1-已绑定"
)
private
Integer
emailStatus
;
@ApiModelProperty
(
value
=
"微信openid "
,
example
=
"微信openid"
)
@ApiModelProperty
(
value
=
"微信openid "
,
example
=
"微信openid"
)
private
String
openid
;
private
String
openid
;
...
...
src/main/java/cn/timer/api/config/interceptor/WebSecurityConfig.java
View file @
cdd5389e
package
cn
.
timer
.
api
.
config
.
interceptor
;
package
cn
.
timer
.
api
.
config
.
interceptor
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -11,13 +9,11 @@ import org.springframework.context.annotation.Bean;
...
@@ -11,13 +9,11 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.alibaba.fastjson.serializer.ValueFilter
;
import
com.alibaba.fastjson.support.config.FastJsonConfig
;
import
com.alibaba.fastjson.support.config.FastJsonConfig
;
import
com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter
;
import
com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter
;
...
@@ -47,7 +43,7 @@ public class WebSecurityConfig implements WebMvcConfigurer {
...
@@ -47,7 +43,7 @@ public class WebSecurityConfig implements WebMvcConfigurer {
.
excludePathPatterns
(
"/8timer/**"
)
.
excludePathPatterns
(
"/8timer/**"
)
.
excludePathPatterns
(
"/kqdk/punchclock/**"
)
.
excludePathPatterns
(
"/kqdk/punchclock/**"
)
.
excludePathPatterns
(
"/kqz/sauserregdata/**"
)
.
excludePathPatterns
(
"/kqz/sauserregdata/**"
)
.
excludePathPatterns
(
"/login/*"
)
.
excludePathPatterns
(
"/login/*
*
"
)
.
excludePathPatterns
(
"/swagger*/**"
)
.
excludePathPatterns
(
"/swagger*/**"
)
.
excludePathPatterns
(
"/v2/api-docs"
)
.
excludePathPatterns
(
"/v2/api-docs"
)
.
excludePathPatterns
(
"/druid/login*"
)
.
excludePathPatterns
(
"/druid/login*"
)
...
...
src/main/java/cn/timer/api/controller/LoginController.java
View file @
cdd5389e
...
@@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -438,7 +440,7 @@ public class LoginController {
...
@@ -438,7 +440,7 @@ public class LoginController {
@ApiOperation
(
value
=
"6.注册企业"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"6.注册企业"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
6
)
@ApiOperationSupport
(
order
=
6
)
@Log
(
title
=
"企业注册"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"企业注册"
,
businessType
=
BusinessType
.
INSERT
)
public
Result
<
String
>
register
(
@RequestBody
EntRegisterDto
entRegisterDto
)
throws
Exception
{
public
Result
<
String
>
register
(
@RequestBody
EntRegisterDto
entRegisterDto
)
throws
Exception
{
try
{
try
{
String
phone
=
entRegisterDto
.
getPhone
();
String
phone
=
entRegisterDto
.
getPhone
();
...
@@ -486,8 +488,9 @@ public class LoginController {
...
@@ -486,8 +488,9 @@ public class LoginController {
}
}
boolean
b4
=
YgglMainEmp
.
builder
().
orgCode
(
qyzxEntInfoM
.
getId
()).
empNum
(
login
.
getId
()).
rzTime
(
new
Date
())
boolean
b4
=
YgglMainEmp
.
builder
().
orgCode
(
qyzxEntInfoM
.
getId
()).
empNum
(
login
.
getId
()).
rzTime
(
new
Date
())
.
isManager
(
CommonEnum
.
U_TYPE_ADMIN
.
getType
()).
name
(
username
).
phone
(
phone
).
jobType
(
YgJobType
.
QUANZHI
.
getType
()).
jobStatus
(
YgEnumInterface
.
jobStatus
.
ZHENSHI
.
getType
())
.
isManager
(
CommonEnum
.
U_TYPE_ADMIN
.
getType
()).
name
(
username
).
phone
(
phone
)
.
build
().
insert
();
.
jobType
(
YgJobType
.
QUANZHI
.
getType
()).
jobStatus
(
YgEnumInterface
.
jobStatus
.
ZHENSHI
.
getType
()).
build
()
.
insert
();
if
(!
b4
)
{
if
(!
b4
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
ResultUtil
.
error
(
"注册企业失败3"
);
return
ResultUtil
.
error
(
"注册企业失败3"
);
...
@@ -504,10 +507,9 @@ public class LoginController {
...
@@ -504,10 +507,9 @@ public class LoginController {
SpmkService
.
createCustomApproval
(
qyzxEntInfoM
.
getId
());
SpmkService
.
createCustomApproval
(
qyzxEntInfoM
.
getId
());
QyzxAuthAccount
.
builder
().
createdTime
(
new
Date
()).
maxChildAccount
(
maxChildAccount
).
name
(
username
)
QyzxAuthAccount
.
builder
().
createdTime
(
new
Date
()).
maxChildAccount
(
maxChildAccount
).
name
(
username
).
accountPhone
(
phone
).
empNum
(
login
.
getId
())
.
accountPhone
(
phone
).
empNum
(
login
.
getId
()).
orgCode
(
qyzxEntInfoM
.
getId
()).
build
().
insert
();
// TODO
.
orgCode
(
qyzxEntInfoM
.
getId
()).
build
().
insert
();
// TODO 主账号权限表
// 主账号权限表
return
ResultUtil
.
success
(
"注册企业成功"
);
return
ResultUtil
.
success
(
"注册企业成功"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -640,4 +642,13 @@ public class LoginController {
...
@@ -640,4 +642,13 @@ public class LoginController {
}
}
@GetMapping
(
value
=
"/band/{empNum}"
)
public
Result
<
Object
>
bandEmail
(
@PathVariable
Integer
empNum
)
{
boolean
result
=
QyzxEmpLogin
.
builder
().
id
(
empNum
).
emailStatus
(
1
).
build
().
updateById
();
if
(
result
)
{
return
ResultUtil
.
success
(
"绑定成功"
);
}
return
ResultUtil
.
error
(
"绑定失败"
);
}
}
}
src/main/java/cn/timer/api/controller/email/EmailController.java
0 → 100644
View file @
cdd5389e
/**
* <p>Title: EmailController.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年5月25日
* @version 1.0
*/
package
cn
.
timer
.
api
.
controller
.
email
;
import
java.io.File
;
import
javax.mail.MessagingException
;
import
javax.mail.internet.MimeMessage
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.mail.SimpleMailMessage
;
import
org.springframework.mail.javamail.JavaMailSender
;
import
org.springframework.mail.javamail.MimeMessageHelper
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
cn.timer.api.bean.qyzx.QyzxEmpLogin
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* <p>
* Title: EmailController.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年5月25日
* @version 1.0
*/
@RestController
@Api
(
tags
=
"1.1 邮件发送"
)
@Transactional
@RequestMapping
(
value
=
"/email"
,
produces
=
{
"application/json"
})
public
class
EmailController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Value
(
"${spring.mail.username}"
)
private
String
from
;
@Autowired
JavaMailSender
mailSender
;
@PostMapping
(
"/sendSimpleMail"
)
@ApiOperation
(
value
=
"发送简单邮件"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Void
>
sendSimpleMail
(
String
to
,
String
subject
,
String
content
)
{
SimpleMailMessage
message
=
new
SimpleMailMessage
();
message
.
setTo
(
to
);
message
.
setSubject
(
subject
);
message
.
setText
(
content
);
message
.
setFrom
(
from
);
mailSender
.
send
(
message
);
return
ResultUtil
.
success
();
}
@PostMapping
(
"/sendHtmlMail"
)
@ApiOperation
(
value
=
"发送html邮件"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Void
>
sendHtmlMail
(
String
to
,
String
subject
,
String
content
)
{
MimeMessage
message
=
mailSender
.
createMimeMessage
();
try
{
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
message
,
true
);
helper
.
setFrom
(
from
);
helper
.
setTo
(
to
);
helper
.
setSubject
(
subject
);
helper
.
setText
(
content
,
true
);
mailSender
.
send
(
message
);
}
catch
(
MessagingException
e
)
{
e
.
printStackTrace
();
}
return
ResultUtil
.
success
();
}
@PostMapping
(
"/sendAttchmentMail"
)
@ApiOperation
(
value
=
"发送附件邮件"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Void
>
sendAttchmentMail
(
String
to
,
String
subject
,
String
content
,
String
filePath
)
{
MimeMessage
message
=
mailSender
.
createMimeMessage
();
try
{
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
message
,
true
);
helper
.
setFrom
(
from
);
helper
.
setTo
(
to
);
helper
.
setSubject
(
subject
);
helper
.
setText
(
content
,
true
);
FileSystemResource
file
=
new
FileSystemResource
(
new
File
(
filePath
));
String
fileName
=
file
.
getFilename
();
helper
.
addAttachment
(
fileName
,
file
);
// 可将参数换成数组遍历传送多个附件
mailSender
.
send
(
message
);
}
catch
(
MessagingException
e
)
{
e
.
printStackTrace
();
}
return
ResultUtil
.
success
();
}
@PostMapping
(
"/sendInlinResourceMail"
)
@ApiOperation
(
value
=
"发送静态图片邮件"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Void
>
sendInlinResourceMail
(
String
to
,
String
subject
,
String
content
,
String
rscPath
,
String
rscId
)
{
logger
.
info
(
"发送静态邮件开始:{},{},{},{},{}"
,
to
,
subject
,
content
,
rscPath
,
rscId
);
MimeMessage
message
=
mailSender
.
createMimeMessage
();
try
{
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
message
,
true
);
helper
.
setFrom
(
from
);
helper
.
setTo
(
to
);
helper
.
setSubject
(
subject
);
helper
.
setText
(
content
,
true
);
FileSystemResource
res
=
new
FileSystemResource
(
new
File
(
rscPath
));
helper
.
addInline
(
rscId
,
res
);
mailSender
.
send
(
message
);
logger
.
info
(
"发送成功"
);
}
catch
(
MessagingException
e
)
{
logger
.
error
(
"发送失败"
,
e
);
}
return
ResultUtil
.
success
();
}
@PostMapping
(
"/bindEmailAddress"
)
@ApiOperation
(
value
=
"绑定邮箱"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Void
>
bindEmailAddress
(
@CurrentUser
UserBean
userBean
,
String
to
)
{
QyzxEmpLogin
.
builder
().
id
(
userBean
.
getEmpNum
()).
email
(
to
).
emailStatus
(
0
).
build
().
updateById
();
return
sendHtmlMail
(
to
,
"8小时账号邮箱验证"
,
"<html>\r\n"
+
"<head>\r\n"
+
"<meta charset=\"UTF-8\">\r\n"
+
"</head>\r\n"
+
"<body>\r\n"
+
" <h1>您好,感谢绑定<a href=\"http://8timer.cn\">8小时人事管家</a>,点击下面链接完成验证,感谢支持!<h1>\r\n"
+
" <br />\r\n"
+
" <a href=\"http://test-8timer-api.youlingrc.com/login/band/"
+
userBean
.
getEmpNum
()+
"\">激活账户</a>\r\n"
+
"</body>\r\n"
+
"</html>"
);
}
@PostMapping
(
"/sendVerifyMail"
)
@ApiOperation
(
value
=
"发送注册验证邮件"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Void
>
sendVerifyMail
(
@CurrentUser
UserBean
userBean
,
String
to
)
{
return
sendHtmlMail
(
to
,
"8小时账号邮箱验证"
,
"<html>\r\n"
+
"<head>\r\n"
+
"<meta charset=\"UTF-8\">\r\n"
+
"</head>\r\n"
+
"<body>\r\n"
+
" <h1>您好,感谢注册<a href=\"http://8timer.cn\">8小时人事管家</a>,点击下面链接完成验证,感谢支持!<h1>\r\n"
+
" <br />\r\n"
+
" <a href=\"https://www.4399.com\">激活账户</a>\r\n"
+
"</body>\r\n"
+
"</html>"
);
}
}
src/main/java/cn/timer/api/dao/clazz/CityClazzMapper.java
deleted
100644 → 0
View file @
0b309ac0
/**
* @date 2019年12月7日
* @author 翁东州
* @方法中文名称:
*/
package
cn
.
timer
.
api
.
dao
.
clazz
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.clazz.CityClazz
;
/**
* 图标库
* @author Tang 2019-11-26
*/
@Repository
public
interface
CityClazzMapper
extends
BaseMapper
<
CityClazz
>{
}
src/main/resources/application-dev.yml
View file @
cdd5389e
...
@@ -86,6 +86,14 @@ spring:
...
@@ -86,6 +86,14 @@ spring:
margin
:
2
# Left hand image margin in chars.
margin
:
2
# Left hand image margin in chars.
invert
:
false
# Whether images should be inverted for dark terminal themes.
invert
:
false
# Whether images should be inverted for dark terminal themes.
mail
:
host
:
smtp.qq.com
username
:
544939826@qq.com
#dsc
password
:
cxvkrjyjzfpbbbce
default-encoding
:
utf-8
######### Spring boot应用健康监控
######### Spring boot应用健康监控
management
:
management
:
server
:
server
:
...
...
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