Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
email
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
陈天仲
email
Commits
52a87d26
Commit
52a87d26
authored
Aug 30, 2023
by
chentianzhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码,邮件管理
parent
d6964839
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
430 additions
and
187 deletions
+430
-187
pom.xml
+6
-10
src/main/java/com/zq/email/config/SpringSecurityConfig.java
+3
-3
src/main/java/com/zq/email/config/Swagger.java
+1
-1
src/main/java/com/zq/email/config/TokenConfigurer.java
+4
-2
src/main/java/com/zq/email/config/TokenFilter.java
+8
-10
src/main/java/com/zq/email/controller/EmailManageController.java
+126
-0
src/main/java/com/zq/email/enums/EmailFolderEnum.java
+2
-2
src/main/java/com/zq/email/service/IEmailAttachService.java
+4
-0
src/main/java/com/zq/email/service/IEmailContentService.java
+1
-1
src/main/java/com/zq/email/service/IEmailPersonService.java
+8
-0
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
+36
-0
src/main/java/com/zq/email/service/impl/EmailContentServiceImpl.java
+16
-4
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
+103
-3
src/main/java/com/zq/email/utils/Test.java
+21
-0
src/main/java/com/zq/email/vo/EmailReqVo.java
+3
-0
src/main/java/com/zq/email/vo/UpdateBodyOrAttachVo.java
+41
-0
src/main/resources/application-dev.yml
+8
-16
src/main/resources/application-local.yml
+0
-65
src/main/resources/application-product.yml
+11
-19
src/main/resources/application-test.yml
+11
-18
src/main/resources/application-wanpro.yml
+4
-4
src/main/resources/application.yml
+7
-2
src/main/resources/bootstrap.yml
+6
-27
No files found.
pom.xml
View file @
52a87d26
...
...
@@ -153,7 +153,12 @@
<version>
1.4.7
</version>
</dependency>
<!-- 配置文件加解密 -->
<!-- <dependency>-->
<!-- <groupId>com.github.ulisesbocchio</groupId>-->
<!-- <artifactId>jasypt-spring-boot-starter</artifactId>-->
<!-- <version>3.0.4</version>-->
<!-- </dependency>-->
</dependencies>
<dependencyManagement>
...
...
@@ -229,15 +234,6 @@
<profiles>
<profile>
<!--本地环境-->
<id>
local
</id>
<properties>
<profiles.active>
local
</profiles.active>
<logging.level>
debug
</logging.level>
<eureka.server.url>
http://admin:GXfy2021@172.18.4.171:8800/eureka/
</eureka.server.url>
</properties>
</profile>
<profile>
<!--开发环境-->
<id>
dev
</id>
<properties>
...
...
src/main/java/com/zq/email/config/SpringSecurityConfig.java
View file @
52a87d26
...
...
@@ -116,7 +116,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
.
antMatchers
(
"/webjars/**"
).
permitAll
()
.
antMatchers
(
"/*/api-docs"
).
permitAll
()
//webservice
.
antMatchers
(
"/sealPlatform/ws/**"
).
permitAll
()
.
antMatchers
(
"/sealPlatform/ws/**"
).
permitAll
()
// 文件
.
antMatchers
(
"/avatar/**"
).
permitAll
()
.
antMatchers
(
"/file/**"
).
permitAll
()
...
...
@@ -143,8 +143,8 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
}
private
TokenConfigurer
securityConfigurerAdapter
()
{
//
return new TokenConfigurer(tokenProvider, properties, redisUtils);
return
new
TokenConfigurer
(
tokenProvider
,
properties
,
adminFeignClient
);
return
new
TokenConfigurer
(
tokenProvider
,
properties
,
redisUtils
);
//
return new TokenConfigurer(tokenProvider, properties, adminFeignClient);
}
private
Map
<
String
,
Set
<
String
>>
getAnonymousUrl
(
Map
<
RequestMappingInfo
,
HandlerMethod
>
handlerMethodMap
)
{
...
...
src/main/java/com/zq/email/config/Swagger.java
View file @
52a87d26
...
...
@@ -20,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
public
class
Swagger
implements
WebMvcConfigurer
{
@Value
(
"${swagger.enabled}"
)
@Value
(
"${swagger.enabled
: false
}"
)
private
Boolean
enabled
;
@Override
...
...
src/main/java/com/zq/email/config/TokenConfigurer.java
View file @
52a87d26
...
...
@@ -15,6 +15,7 @@
*/
package
com
.
zq
.
email
.
config
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.config.security.SecurityProperties
;
import
com.zq.email.feign.AdminFeignClient
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -31,11 +32,12 @@ public class TokenConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFi
private
final
TokenProvider
tokenProvider
;
private
final
SecurityProperties
properties
;
private
final
AdminFeignClient
adminFeignClient
;
//private final AdminFeignClient adminFeignClient;
private
final
RedisUtils
redisUtils
;
@Override
public
void
configure
(
HttpSecurity
http
)
{
TokenFilter
customFilter
=
new
TokenFilter
(
tokenProvider
,
properties
,
adminFeignClient
);
TokenFilter
customFilter
=
new
TokenFilter
(
tokenProvider
,
properties
,
redisUtils
);
http
.
addFilterBefore
(
customFilter
,
UsernamePasswordAuthenticationFilter
.
class
);
}
}
src/main/java/com/zq/email/config/TokenFilter.java
View file @
52a87d26
...
...
@@ -17,6 +17,7 @@ package com.zq.email.config;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.config.security.SecurityProperties
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.TokenUtils
;
...
...
@@ -44,17 +45,18 @@ public class TokenFilter extends GenericFilterBean {
private
final
TokenProvider
tokenProvider
;
private
final
SecurityProperties
properties
;
private
final
AdminFeignClient
adminFeignClient
;
//private final AdminFeignClient adminFeignClient;
private
final
RedisUtils
redisUtils
;
/**
* @param tokenProvider Token
* @param properties JWT
* @param
adminFeignClient
redis
* @param
redisUtils
redis
*/
public
TokenFilter
(
TokenProvider
tokenProvider
,
SecurityProperties
properties
,
AdminFeignClient
adminFeignClient
)
{
public
TokenFilter
(
TokenProvider
tokenProvider
,
SecurityProperties
properties
,
RedisUtils
redisUtils
)
{
this
.
properties
=
properties
;
this
.
tokenProvider
=
tokenProvider
;
this
.
adminFeignClient
=
adminFeignClient
;
this
.
redisUtils
=
redisUtils
;
}
@Override
...
...
@@ -66,13 +68,9 @@ public class TokenFilter extends GenericFilterBean {
if
(
StrUtil
.
isNotBlank
(
token
))
{
OnlineUserDto
onlineUserDto
=
null
;
try
{
ResultVo
<
OnlineUserDto
>
userInfoByToken
=
adminFeignClient
.
getUserInfoByToken
(
token
);
if
(
userInfoByToken
.
isSuccess
()
||
userInfoByToken
.
getData
()
!=
null
){
onlineUserDto
=
userInfoByToken
.
getData
();
}
onlineUserDto
=
redisUtils
.
getObj
(
properties
.
getOnlineKey
()
+
token
,
OnlineUserDto
.
class
);
}
catch
(
Exception
e
){
log
.
error
(
"执行AdminFeignClient.getUserInfoByToken()方法异常"
);
log
.
error
(
e
.
getLocalizedMessage
(),
e
);
log
.
error
(
">>>>> ^ ^ 过滤中获取当前用户信息失败----, 错误提示"
+
e
.
getLocalizedMessage
(),
e
);
onlineUserDto
=
null
;
}
...
...
src/main/java/com/zq/email/controller/EmailManageController.java
0 → 100644
View file @
52a87d26
package
com
.
zq
.
email
.
controller
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.TokenUtils
;
import
com.zq.common.vo.OnlineUserDto
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.email.constants.EmailConstant
;
import
com.zq.email.entity.EmailAttach
;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.entity.EmailPerson
;
import
com.zq.email.enums.EmailFolderEnum
;
import
com.zq.email.enums.WhetherEnum
;
import
com.zq.email.service.IEmailAttachService
;
import
com.zq.email.service.IEmailContentService
;
import
com.zq.email.service.IEmailPersonService
;
import
com.zq.email.vo.EmailDetailVo
;
import
com.zq.email.vo.EmailSearchReqVo
;
import
com.zq.email.vo.UpdateBodyOrAttachVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author chentianzhong
* @version 1.0
* @date 2023-08-28 15:40
*/
@Api
(
tags
=
"邮件管理功能"
)
@RestController
@RequestMapping
(
"/email/manage"
)
@Slf4j
@RequiredArgsConstructor
public
class
EmailManageController
{
private
final
IEmailPersonService
emailPersonService
;
private
final
IEmailContentService
emailContentService
;
private
final
IEmailAttachService
emailAttachService
;
@ApiOperation
(
"列表总数(文件夹未读总数也可以使用这个接口,注意参数)"
)
@PostMapping
(
"total"
)
public
ResultVo
total
(
@RequestBody
EmailSearchReqVo
vo
)
{
vo
.
setFolderId
(
EmailFolderEnum
.
FOLDER_ALREADY_SEND
.
getKey
());
AssertUtils
.
notNull
(
vo
.
getSendUserId
(),
"缺少参数:sendUserId"
);
return
ResultVo
.
success
(
emailPersonService
.
emailManageCount
(
vo
));
}
@ApiOperation
(
"列表分页"
)
@PostMapping
(
"page"
)
public
ResultVo
page
(
@RequestBody
EmailSearchReqVo
vo
)
{
vo
.
setFolderId
(
EmailFolderEnum
.
FOLDER_ALREADY_SEND
.
getKey
());
AssertUtils
.
notNull
(
vo
.
getSendUserId
(),
"缺少参数:sendUserId"
);
return
ResultVo
.
success
(
emailPersonService
.
emailManagePage
(
vo
));
}
@ApiOperation
(
"邮件详情,这个接口如果前端从列表能获取到显示就不用调用"
)
@PostMapping
(
"detail"
)
public
ResultVo
detail
(
@RequestBody
EmailDetailVo
vo
)
{
OnlineUserDto
adminContext
=
TokenUtils
.
getAdminContext
();
AssertUtils
.
notNull
(
adminContext
,
"登录已失效,请重新登录后再次尝试!"
);
AssertUtils
.
notNull
(
vo
.
getContentId
(),
"缺少参数:contentId"
);
EmailContent
content
=
emailContentService
.
getById
(
vo
.
getContentId
());
return
ResultVo
.
success
(
content
);
}
@ApiOperation
(
"撤回邮件并删除邮件记录"
)
@GetMapping
(
"delete/{contentId}"
)
public
ResultVo
delete
(
@PathVariable
(
"contentId"
)
String
contentId
)
{
OnlineUserDto
adminContext
=
TokenUtils
.
getAdminContext
();
AssertUtils
.
notNull
(
adminContext
,
"登录已失效,请重新登录后再次尝试!"
);
this
.
emailPersonService
.
lambdaUpdate
().
eq
(
EmailPerson:
:
getEmailContentId
,
contentId
).
remove
();
this
.
emailAttachService
.
lambdaUpdate
().
eq
(
EmailAttach:
:
getEmailContentId
,
contentId
).
remove
();
this
.
emailContentService
.
lambdaUpdate
().
eq
(
EmailContent:
:
getId
,
contentId
).
remove
();
return
ResultVo
.
success
();
}
@ApiOperation
(
"撤回邮件到收件箱"
)
@GetMapping
(
"revoke/{contentId}"
)
public
ResultVo
revoke
(
@PathVariable
(
"contentId"
)
String
contentId
)
{
OnlineUserDto
adminContext
=
TokenUtils
.
getAdminContext
();
AssertUtils
.
notNull
(
adminContext
,
"登录已失效,请重新登录后再次尝试!"
);
this
.
emailPersonService
.
lambdaUpdate
().
eq
(
EmailPerson:
:
getEmailContentId
,
contentId
).
set
(
EmailPerson:
:
getIsSend
,
WhetherEnum
.
NO
.
getKey
()).
update
();
this
.
emailPersonService
.
lambdaUpdate
()
.
eq
(
EmailPerson:
:
getEmailContentId
,
contentId
)
.
eq
(
EmailPerson:
:
getPersonType
,
EmailConstant
.
TYPE_EMAIL_SEND
)
.
set
(
EmailPerson:
:
getFolderId
,
EmailFolderEnum
.
FOLDER_OUTBOX
.
getKey
())
.
update
();
return
ResultVo
.
success
();
}
@ApiOperation
(
"修改正文"
)
@PostMapping
(
"updateBodyOrAttach"
)
public
ResultVo
updateBody
(
UpdateBodyOrAttachVo
vo
)
{
OnlineUserDto
adminContext
=
TokenUtils
.
getAdminContext
();
AssertUtils
.
notNull
(
adminContext
,
"登录已失效,请重新登录后再次尝试!"
);
EmailContent
emailContent
=
this
.
emailContentService
.
getById
(
vo
.
getId
());
AssertUtils
.
notNull
(
emailContent
,
"获取邮件对象异常"
);
this
.
emailContentService
.
updateBodyOrAttach
(
vo
);
//更新附件
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getFileIds
())){
this
.
emailAttachService
.
updateAttachByContentId
(
emailContent
,
vo
.
getFileIds
());
}
//添加附件
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getFileList
())){
this
.
emailAttachService
.
addAttachByContentId
(
emailContent
,
vo
.
getFileList
());
}
return
ResultVo
.
success
();
}
}
src/main/java/com/zq/email/enums/EmailFolderEnum.java
View file @
52a87d26
...
...
@@ -16,8 +16,8 @@ public enum EmailFolderEnum {
FOLDER_OUTBOX
(
3
,
"草稿箱"
),
FOLDER_ALREADY_SEND
(
4
,
"已发送"
),
FOLDER_ALREADY_DELETE
(
5
,
"回收站"
),
FOLDER_OTHER
(
6
,
"
其他文件夹
"
),
//FOLDER_LABEL(7, "邮件标签
"),
FOLDER_OTHER
(
6
,
"
邮箱(文件夹)
"
),
FOLDER_MANAGE
(
7
,
"邮件管理
"
),
;
private
Integer
key
;
...
...
src/main/java/com/zq/email/service/IEmailAttachService.java
View file @
52a87d26
...
...
@@ -28,4 +28,8 @@ public interface IEmailAttachService extends IService<EmailAttach> {
String
getDownloadPath
(
EmailAttach
emailAttach
);
String
getWpsPreviewUrl
(
Long
id
);
void
updateAttachByContentId
(
EmailContent
emailContent
,
List
<
Long
>
fileIds
);
void
addAttachByContentId
(
EmailContent
emailContent
,
List
<
MultipartFile
>
fileList
);
}
src/main/java/com/zq/email/service/IEmailContentService.java
View file @
52a87d26
...
...
@@ -40,5 +40,5 @@ public interface IEmailContentService extends IService<EmailContent> {
List
<
Long
>
findRecentlySendEmail
(
Integer
num
);
void
updateBodyOrAttach
(
UpdateBodyOrAttachVo
vo
);
}
src/main/java/com/zq/email/service/IEmailPersonService.java
View file @
52a87d26
...
...
@@ -33,6 +33,12 @@ public interface IEmailPersonService extends IService<EmailPerson> {
//邮件分页列表
Page
<
EmailPerson
>
emailPage
(
EmailReqVo
vo
);
//邮件分页总数
Integer
emailManageCount
(
EmailSearchReqVo
vo
);
//邮件分页列表
Page
<
EmailPerson
>
emailManagePage
(
EmailSearchReqVo
vo
);
//写邮件
EmailContent
emailEditVo
(
EmailEditVo
vo
);
...
...
@@ -113,5 +119,7 @@ public interface IEmailPersonService extends IService<EmailPerson> {
//根据content和文件夹获取person
EmailPerson
getByContentAndFolderId
(
Long
contentId
,
LocalDateTime
sendTime
,
Long
folderId
);
EmailPerson
getByContentAndFolderId2
(
Long
contentId
,
LocalDateTime
sendTime
,
Long
folderId
);
List
<
DeptSimpleDto
>
findDraftsDeptByContentId
(
Long
contentId
);
}
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
View file @
52a87d26
...
...
@@ -26,7 +26,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* <p>
...
...
@@ -192,5 +194,39 @@ public class EmailAttachServiceImpl extends ServiceImpl<EmailAttachMapper, Email
return
resultVo
.
getData
();
}
@Override
public
void
updateAttachByContentId
(
EmailContent
emailContent
,
List
<
Long
>
fileIds
)
{
List
<
EmailAttach
>
attaches
=
this
.
findByContentId
(
emailContent
.
getId
());
List
<
Long
>
attacheIds
=
attaches
.
stream
().
map
(
e
->
e
.
getId
()).
collect
(
Collectors
.
toList
());
Collection
<
Long
>
subtract
=
CollectionUtil
.
subtract
(
attacheIds
,
fileIds
);
this
.
removeByIds
(
subtract
);
}
@Override
public
void
addAttachByContentId
(
EmailContent
emailContent
,
List
<
MultipartFile
>
fileList
)
{
Long
adminId
=
TokenUtils
.
getAdminId
();
AssertUtils
.
notNull
(
adminId
,
"登录信息异常"
);
ResultVo
<
UploadFileListRespVo
>
uploadFileListRespVoResultVo
=
fileFeignClient
.
uploadFileList
(
fileList
.
toArray
(
new
MultipartFile
[
fileList
.
size
()]),
EmailConstant
.
SYSTEM_TAG
,
adminId
,
String
.
valueOf
(
emailContent
.
getId
()));
AssertUtils
.
isTrue
(
uploadFileListRespVoResultVo
.
isSuccess
(),
"上传文件失败"
);
UploadFileListRespVo
data
=
uploadFileListRespVoResultVo
.
getData
();
AssertUtils
.
isTrue
(
data
!=
null
&&
CollectionUtil
.
isNotEmpty
(
data
.
getUploadFileRespVos
()),
"上传文件失败,结果为空"
);
for
(
UploadFileRespVo
uploadFileRespVo
:
data
.
getUploadFileRespVos
())
{
EmailAttach
emailAttach
=
EmailAttach
.
builder
()
.
emailContentId
(
emailContent
.
getId
())
.
attachId
(
uploadFileRespVo
.
getId
())
.
attachName
(
uploadFileRespVo
.
getFileName
())
.
attachSize
(
uploadFileRespVo
.
getSize
())
.
downloadPath
(
uploadFileRespVo
.
getDownloadPath
())
.
sendTime
(
emailContent
.
getSendTime
())
.
build
();
this
.
save
(
emailAttach
);
}
}
}
src/main/java/com/zq/email/service/impl/EmailContentServiceImpl.java
View file @
52a87d26
package
com
.
zq
.
email
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -19,10 +20,7 @@ import com.zq.email.feign.AdminFeignClient;
import
com.zq.email.mapper.EmailContentMapper
;
import
com.zq.email.service.IEmailContentService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zq.email.vo.EmailDegreeVo
;
import
com.zq.email.vo.EmailEditVo
;
import
com.zq.email.vo.EmailReqVo
;
import
com.zq.email.vo.EmailTaskVo
;
import
com.zq.email.vo.*
;
import
com.zq.email.vo.api.ApiSendEmailVo
;
import
com.zq.email.vo.api.EmailEditApiVo
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -222,4 +220,18 @@ public class EmailContentServiceImpl extends ServiceImpl<EmailContentMapper, Ema
return
list
;
}
@Override
public
void
updateBodyOrAttach
(
UpdateBodyOrAttachVo
vo
)
{
EmailContent
emailContent
=
this
.
getById
(
vo
.
getId
());
AssertUtils
.
notNull
(
emailContent
,
"邮件对象获取失败"
);
boolean
update
=
this
.
lambdaUpdate
()
.
set
(
StrUtil
.
isNotBlank
(
vo
.
getTitle
()),
EmailContent:
:
getTitle
,
vo
.
getTitle
())
.
set
(
StrUtil
.
isNotBlank
(
vo
.
getContent
()),
EmailContent:
:
getContent
,
vo
.
getContent
())
.
set
(
vo
.
getDegree
()
!=
null
,
EmailContent:
:
getDegree
,
vo
.
getDegree
())
.
set
(
vo
.
getIsTask
()
!=
null
,
EmailContent:
:
getIsTask
,
vo
.
getIsTask
())
.
eq
(
EmailContent:
:
getId
,
vo
.
getId
()).
update
();
AssertUtils
.
isTrue
(
update
,
"更新邮件正文信息失败"
);
}
}
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
View file @
52a87d26
...
...
@@ -134,12 +134,9 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
UserDto
userDto
=
new
UserDto
();
if
(
profile
.
contains
(
"wan"
))
{
content
.
setSendUserPhoto
(
StrUtil
.
isNotBlank
(
data
.
getPhoto
())?
data
.
getPhoto
().
replace
(
"http://147.1.3.87"
,
"http://172.28.1.159:82"
):
data
.
getPhoto
());
//userDto.setPhoto();
}
else
{
content
.
setSendUserPhoto
(
data
.
getPhoto
());
//userDto.setPhoto(data.getPhoto());
}
//record.setSender(userDto);
}
}
record
.
setEmailContent
(
content
);
...
...
@@ -148,6 +145,50 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
return
page
;
}
@Override
public
Integer
emailManageCount
(
EmailSearchReqVo
vo
)
{
vo
.
setUserId
(
vo
.
getSendUserId
());
vo
.
setPersonType
(
EmailConstant
.
TYPE_EMAIL_SEND
);
vo
.
setIsSend
(
WhetherEnum
.
YES
.
getKey
());
Integer
total
=
this
.
baseMapper
.
selectSearchTotal
(
vo
);
return
total
!=
null
?
total:
0
;
}
@Override
public
Page
<
EmailPerson
>
emailManagePage
(
EmailSearchReqVo
vo
)
{
vo
.
setUserId
(
vo
.
getSendUserId
());
vo
.
setPersonType
(
EmailConstant
.
TYPE_EMAIL_SEND
);
vo
.
setIsSend
(
WhetherEnum
.
YES
.
getKey
());
Page
<
EmailPerson
>
page
=
new
Page
<>(
vo
.
getPage
(),
vo
.
getSize
());
page
=
this
.
baseMapper
.
selectSearchPage
(
page
,
vo
);
if
(
page
!=
null
&&
page
.
getRecords
()!=
null
){
for
(
EmailPerson
person
:
page
.
getRecords
())
{
EmailContent
content
=
this
.
emailContentService
.
getById
(
person
.
getEmailContentId
());
if
(
vo
.
getFolderId
().
equals
(
EmailFolderEnum
.
FOLDER_ALREADY_SEND
.
getKey
())){
person
.
setEmailAttachList
(
this
.
emailAttachService
.
findByContentId
(
content
.
getId
()));
person
.
setReceiverList
(
this
.
findReceiverByContentId
(
content
.
getId
(),
null
));
}
//发送人头像
if
(
vo
.
getIsSenderPhoto
()){
ResultVo
<
UserDto
>
senderVo
=
adminFeignClient
.
findById
(
content
.
getSendUserId
());
if
(
senderVo
.
isSuccess
()
&&
senderVo
.
getData
()
!=
null
){
UserDto
data
=
senderVo
.
getData
();
if
(
profile
.
contains
(
"wan"
))
{
content
.
setSendUserPhoto
(
StrUtil
.
isNotBlank
(
data
.
getPhoto
())?
data
.
getPhoto
().
replace
(
"http://147.1.3.87"
,
"http://172.28.1.159:82"
):
data
.
getPhoto
());
}
else
{
content
.
setSendUserPhoto
(
data
.
getPhoto
());
}
}
}
person
.
setEmailContent
(
content
);
}
}
return
page
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
EmailContent
emailEditVo
(
EmailEditVo
vo
)
{
...
...
@@ -965,6 +1006,65 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
}
@Override
public
EmailPerson
getByContentAndFolderId2
(
Long
contentId
,
LocalDateTime
sendTime
,
Long
folderId
)
{
OnlineUserDto
adminContext
=
TokenUtils
.
getAdminContext
();
AssertUtils
.
notNull
(
adminContext
,
"登录已失效,请重新登录后再次尝试!"
);
LambdaQueryWrapper
<
EmailPerson
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
contentId
!=
null
,
EmailPerson:
:
getEmailContentId
,
contentId
)
.
eq
(
sendTime
!=
null
,
EmailPerson:
:
getSendTime
,
sendTime
)
.
eq
(
EmailPerson:
:
getFolderId
,
folderId
);
switch
(
EmailFolderEnum
.
getEnumByKey
(
folderId
.
intValue
()))
{
case
FOLDER_INBOX:
//收件箱
queryWrapper
.
eq
(
EmailPerson:
:
getPersonType
,
EmailConstant
.
TYPE_EMAIL_RECEIVE
)
.
eq
(
EmailPerson:
:
getIsPerson
,
WhetherEnum
.
YES
.
getKey
())
.
eq
(
EmailPerson:
:
getIsSend
,
WhetherEnum
.
YES
.
getKey
())
.
eq
(
EmailPerson:
:
getUserId
,
adminContext
.
getUserId
());
break
;
case
FOLDER_DEPT_INBOX:
//部门邮件
queryWrapper
.
eq
(
EmailPerson:
:
getPersonType
,
EmailConstant
.
TYPE_EMAIL_RECEIVE
)
.
eq
(
EmailPerson:
:
getIsPerson
,
WhetherEnum
.
NO
.
getKey
())
.
eq
(
EmailPerson:
:
getIsSend
,
WhetherEnum
.
YES
.
getKey
())
.
eq
(
EmailPerson:
:
getUserId
,
adminContext
.
getUserId
());
break
;
case
FOLDER_OUTBOX:
//草稿箱
queryWrapper
.
eq
(
EmailPerson:
:
getPersonType
,
EmailConstant
.
TYPE_EMAIL_SEND
)
.
eq
(
EmailPerson:
:
getIsPerson
,
WhetherEnum
.
YES
.
getKey
())
.
eq
(
EmailPerson:
:
getIsSend
,
WhetherEnum
.
NO
.
getKey
())
.
eq
(
EmailPerson:
:
getUserId
,
adminContext
.
getUserId
());
break
;
case
FOLDER_ALREADY_SEND:
//已发送
queryWrapper
.
eq
(
EmailPerson:
:
getPersonType
,
EmailConstant
.
TYPE_EMAIL_SEND
)
.
eq
(
EmailPerson:
:
getIsPerson
,
WhetherEnum
.
YES
.
getKey
())
.
eq
(
EmailPerson:
:
getIsSend
,
WhetherEnum
.
YES
.
getKey
());
//.eq(EmailPerson::getUserId, adminContext.getUserId());
break
;
case
FOLDER_ALREADY_DELETE:
//回收站
queryWrapper
.
eq
(
EmailPerson:
:
getUserId
,
adminContext
.
getUserId
());
break
;
default
:
queryWrapper
.
eq
(
EmailPerson:
:
getUserId
,
adminContext
.
getUserId
());
break
;
}
EmailPerson
emailPerson
=
this
.
getOne
(
queryWrapper
,
false
);
AssertUtils
.
notNull
(
emailPerson
,
"获取收件人信息失败"
);
if
(
emailPerson
.
getIsRead
().
equals
(
WhetherEnum
.
NO
.
getKey
())){
msgUtil
.
doneMsgByBusinessIdAndReceiverId
(
contentId
,
emailPerson
.
getUserId
());
}
return
emailPerson
;
}
@Override
public
List
<
DeptSimpleDto
>
findDraftsDeptByContentId
(
Long
contentId
)
{
List
<
DeptSimpleDto
>
deptDtoList
=
new
ArrayList
<>();
List
<
EmailPerson
>
list
=
this
.
lambdaQuery
()
...
...
src/main/java/com/zq/email/utils/Test.java
0 → 100644
View file @
52a87d26
package
com
.
zq
.
email
.
utils
;
import
com.baomidou.mybatisplus.core.toolkit.AES
;
/**
* @author chentianzhong
* @version 1.0
* @date 2023-08-21 19:17
*/
public
class
Test
{
public
static
void
main
(
String
[]
args
)
{
String
randomKey
=
AES
.
generateRandomKey
();
System
.
out
.
println
(
"秘钥"
+
randomKey
);
//48ca763f0ea577cf
String
result
=
AES
.
encrypt
(
"123456"
,
randomKey
);
System
.
out
.
println
(
"result: "
+
result
);
}
}
src/main/java/com/zq/email/vo/EmailReqVo.java
View file @
52a87d26
...
...
@@ -78,4 +78,7 @@ public class EmailReqVo extends PageReqVo {
@ApiModelProperty
(
"是否获取人员头像"
)
private
Boolean
isSenderPhoto
=
false
;
@ApiModelProperty
(
"发送人Id,邮件管理查询用。"
)
private
Long
sendUserId
;
}
src/main/java/com/zq/email/vo/UpdateBodyOrAttachVo.java
0 → 100644
View file @
52a87d26
package
com
.
zq
.
email
.
vo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
/**
* @author chentianzhong
* @version 1.0
* @date 2023-08-29 9:31
*/
@Api
(
"邮件详情参数"
)
@Data
public
class
UpdateBodyOrAttachVo
{
@ApiModelProperty
(
"邮箱id"
)
private
Long
id
;
@ApiModelProperty
(
"标题"
)
private
String
title
;
@ApiModelProperty
(
"内容"
)
private
String
content
;
@ApiModelProperty
(
"重要程度"
)
private
Integer
degree
;
@ApiModelProperty
(
"是否任务邮件 0否 1是"
)
private
Integer
isTask
=
0
;
@ApiModelProperty
(
"附件id(已上传的附件)"
)
private
List
<
Long
>
fileIds
;
@ApiModelProperty
(
"附件"
)
private
List
<
MultipartFile
>
fileList
;
}
src/main/resources/application-dev.yml
View file @
52a87d26
#配置数据源
spring
:
redis
:
#数据库索引
database
:
0
host
:
172.18.4.171
port
:
6379
password
:
#连接超时时间
timeout
:
5000
datasource
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:kingbase8://172.18.4.171:54321/EMAIL
username
:
oa_system
password
:
123456
driver-class-name
:
com.kingbase8.Driver
driverClassName
:
${jdbc.driver-class-name}
username
:
${jdbc.db1.username}
password
:
${jdbc.db1.password}
url
:
${jdbc.db1.base-url}/EMAIL
# 初始连接数
initial-size
:
5
# 最小连接数
...
...
@@ -42,8 +34,8 @@ spring:
enabled
:
true
url-pattern
:
/druid/*
reset-enable
:
false
login-username
:
admin
login-password
:
GXfy2021
login-username
:
'
{cipher}de5d7ff75d4535cfc661426dd13202776c6af08f48bd46640e3d8de415bc8fad'
login-password
:
'
{cipher}365d86c1efeee8a078231d809bead42416df81d969c0f70d7815094b3e526e9c'
allow
:
127.0.0.1,147.1.*.*
filter
:
stat
:
...
...
@@ -59,8 +51,7 @@ spring:
swagger
:
enabled
:
true
sms
:
app-id
:
oa_new
app-key
:
OA@2022!
url
:
http://171.106.48.55:19891/ums/inside_new/sendBatch
url
:
http://171.106.48.55:19891/ums/inside_new/sendBatch
\ No newline at end of file
src/main/resources/application-local.yml
deleted
100644 → 0
View file @
d6964839
#配置数据源
spring
:
redis
:
#数据库索引
database
:
0
host
:
127.0.0.1
port
:
6379
password
:
#连接超时时间
timeout
:
5000
datasource
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:kingbase8://172.18.4.84:54321/EMAIL_NEW
username
:
oa_system
password
:
123456
driver-class-name
:
com.kingbase8.Driver
# 初始连接数
initial-size
:
5
# 最小连接数
min-idle
:
10
# 最大连接数
max-active
:
20
# 获取连接超时时间
max-wait
:
5000
# 连接有效性检测时间
time-between-eviction-runs-millis
:
60000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis
:
300000
# 连接在池中最大生存的时间
max-evictable-idle-time-millis
:
900000
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
# 检测连接是否有效
validation-query
:
select 1
# 配置监控统计
webStatFilter
:
enabled
:
true
#安全配置
stat-view-servlet
:
enabled
:
true
url-pattern
:
/druid/*
reset-enable
:
false
login-username
:
admin
login-password
:
GXfy2021
allow
:
127.0.0.1,147.1.*.*
filter
:
stat
:
enabled
:
true
# 记录慢SQL
log-slow-sql
:
true
slow-sql-millis
:
2000
merge-sql
:
true
wall
:
config
:
multi-statement-allow
:
true
#是否开启 swagger-ui
swagger
:
enabled
:
true
sms
:
app-id
:
oa_new
app-key
:
OA@2022!
url
:
http://171.106.48.55:19891/ums/inside_new/sendBatch
src/main/resources/application-product.yml
View file @
52a87d26
#配置数据源
spring
:
redis
:
#数据库索引
database
:
0
host
:
147.2.3.18
port
:
6379
password
:
zq4208!@#$
timeout
:
5000
datasource
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:kingbase8://147.2.3.4:54321/EMAIL_NEW?ConfigurePath=/opt/db-config/EMAIL/jdbc_new.conf
username
:
oa_system
password
:
GXfy/2014!@#$
driver-class-name
:
com.kingbase8.Driver
driverClassName
:
${jdbc.driver-class-name}
username
:
${jdbc.db1.username}
password
:
${jdbc.db1.password}
url
:
${jdbc.db1.base-url}/EMAIL_NEW?ConfigurePath=/opt/db-config/EMAIL/jdbc_new.conf
# 初始连接数
initial-size
:
20
initial-size
:
5
# 最小连接数
min-idle
:
2
0
min-idle
:
1
0
# 最大连接数
max-active
:
5
0
max-active
:
2
0
# 获取连接超时时间
max-wait
:
5000
# 连接有效性检测时间
...
...
@@ -41,23 +34,22 @@ spring:
enabled
:
true
url-pattern
:
/druid/*
reset-enable
:
false
login-username
:
admin
login-password
:
GXfy2021
login-username
:
'
{cipher}de5d7ff75d4535cfc661426dd13202776c6af08f48bd46640e3d8de415bc8fad'
login-password
:
'
{cipher}365d86c1efeee8a078231d809bead42416df81d969c0f70d7815094b3e526e9c'
allow
:
127.0.0.1,147.1.*.*
filter
:
stat
:
enabled
:
true
# 记录慢SQL
log-slow-sql
:
true
slow-sql-millis
:
1
000
slow-sql-millis
:
2
000
merge-sql
:
true
wall
:
config
:
multi-statement-allow
:
true
#是否开启 swagger-ui
swagger
:
enabled
:
false
enabled
:
true
sms
:
app-id
:
oa_new
...
...
src/main/resources/application-test.yml
View file @
52a87d26
#配置数据源
spring
:
redis
:
#数据库索引
database
:
0
host
:
147.2.3.2
port
:
63793
password
:
Zq4208!@#$
timeout
:
5000
datasource
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:kingbase8://147.2.3.4:54321/EMAIL_TEST?ConfigurePath=/opt/db-config/EMAIL/jdbc_new.conf
username
:
oa_system
password
:
GXfy/2014!@#$
driver-class-name
:
com.kingbase8.Driver
driverClassName
:
${jdbc.driver-class-name}
username
:
${jdbc.db1.username}
password
:
${jdbc.db1.password}
url
:
${jdbc.db1.base-url}/EMAIL_TEST?ConfigurePath=/opt/db-config/EMAIL/jdbc_new.conf
# 初始连接数
initial-size
:
20
initial-size
:
5
# 最小连接数
min-idle
:
2
0
min-idle
:
1
0
# 最大连接数
max-active
:
5
0
max-active
:
2
0
# 获取连接超时时间
max-wait
:
5000
# 连接有效性检测时间
...
...
@@ -41,22 +34,22 @@ spring:
enabled
:
true
url-pattern
:
/druid/*
reset-enable
:
false
login-username
:
admin
login-password
:
GXfy2021
login-username
:
'
{cipher}de5d7ff75d4535cfc661426dd13202776c6af08f48bd46640e3d8de415bc8fad'
login-password
:
'
{cipher}365d86c1efeee8a078231d809bead42416df81d969c0f70d7815094b3e526e9c'
allow
:
127.0.0.1,147.1.*.*
filter
:
stat
:
enabled
:
true
# 记录慢SQL
log-slow-sql
:
true
slow-sql-millis
:
1
000
slow-sql-millis
:
2
000
merge-sql
:
true
wall
:
config
:
multi-statement-allow
:
true
#是否开启 swagger-ui
swagger
:
enabled
:
fals
e
enabled
:
tru
e
sms
:
app-id
:
oa_new
...
...
src/main/resources/application-wanpro.yml
View file @
52a87d26
...
...
@@ -5,14 +5,14 @@ spring:
database
:
0
host
:
172.28.1.71
port
:
6379
password
:
zq4208!@#$
password
:
'
{cipher}c11d1213bc6bc1f524d4426ff563380d01b9d6d7153c5ba566fbc489f07b5142'
timeout
:
5000
datasource
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:kingbase8://172.28.1.68:54321/EMAIL_NEW
username
:
oa_system
password
:
GXfy/2014!@#$
password
:
'
{cipher}c11d1213bc6bc1f524d4426ff563380d01b9d6d7153c5ba566fbc489f07b5142'
driver-class-name
:
com.kingbase8.Driver
# 初始连接数
initial-size
:
20
...
...
@@ -41,8 +41,8 @@ spring:
enabled
:
true
url-pattern
:
/druid/*
reset-enable
:
false
login-username
:
admin
login-password
:
GXfy2021
login-username
:
'
{cipher}de5d7ff75d4535cfc661426dd13202776c6af08f48bd46640e3d8de415bc8fad'
login-password
:
'
{cipher}365d86c1efeee8a078231d809bead42416df81d969c0f70d7815094b3e526e9c'
allow
:
127.0.0.1,147.1.*.*
filter
:
stat
:
...
...
src/main/resources/application.yml
View file @
52a87d26
server
:
port
:
819
7
port
:
819
8
#配置数据源
spring
:
application
:
...
...
@@ -15,7 +15,12 @@ spring:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
default-property-inclusion
:
non_null
redis
:
host
:
${redis.url}
port
:
${redis.port}
password
:
${redis.password}
#连接超时时间
timeout
:
5000
# mybatis plus 配置
mybatis-plus
:
global-config
:
...
...
src/main/resources/bootstrap.yml
View file @
52a87d26
...
...
@@ -8,14 +8,14 @@ spring:
discovery
:
enabled
:
true
service-id
:
CONFIG-SERVER
username
:
admin
password
:
GXfy2021
username
:
'
{cipher}6d5973291f0ee0a10758022d3e8f89e4eb9d4e18cb8e3b991d3851de4315ad7e'
password
:
'
{cipher}5a13ab499d94e634ac4132bb050e8251a2053698cef2ca68240f3c8a1569fdd9'
eureka
:
instance
:
prefer-ip-address
:
true
lease-renewal-interval-in-seconds
:
2
#每间隔1s,向服务端发送一次心跳,证明自己依然"存活"
lease-expiration-duration-in-seconds
:
6
#告诉服务端,如果我2s之内没有给你发心跳,就代表我"死"了,将我踢出掉。
lease-renewal-interval-in-seconds
:
30
#服务续约(renew)的间隔,默认为30秒
lease-expiration-duration-in-seconds
:
90
#服务失效时间,默认值90秒
instance-id
:
${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
client
:
serviceUrl
:
...
...
@@ -23,8 +23,6 @@ eureka:
#Feign 超时配置
feign
:
hystrix
:
enabled
:
false
httpclient
:
enabled
:
false
okhttp
:
...
...
@@ -33,24 +31,4 @@ feign:
config
:
FILE-SERVER
:
connectTimeout
:
10000
readTimeout
:
30000
ribbon
:
okhttp
:
enabled
:
true
ConnectTimeout
:
10000
ReadTimeout
:
30000
OkToRetryOnAllOperations
:
false
hystrix
:
command
:
default
:
execution
:
isolation
:
thread
:
timeoutInMilliseconds
:
30000
threadpool
:
default
:
coreSize
:
200
#并发执行的最大线程数,默认10
maxQueueSize
:
1000
#BlockingQueue的最大队列数,默认值-1
queueSizeRejectionThreshold
:
800
#即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝,默认值5
readTimeout
:
30000
\ No newline at end of file
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