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
6ee498e4
Commit
6ee498e4
authored
Mar 08, 2023
by
chentianzhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提一个版本
parent
854c3519
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
641 additions
and
80 deletions
+641
-80
pom.xml
+6
-0
src/main/java/com/zq/email/config/Swagger.java
+2
-2
src/main/java/com/zq/email/controller/EmailContentController.java
+25
-0
src/main/java/com/zq/email/controller/EmailController.java
+106
-13
src/main/java/com/zq/email/controller/EmailFolderController.java
+11
-0
src/main/java/com/zq/email/controller/EmailPersonController.java
+44
-7
src/main/java/com/zq/email/dto/DeptSimpleDto.java
+16
-0
src/main/java/com/zq/email/entity/EmailAttach.java
+3
-0
src/main/java/com/zq/email/entity/EmailContent.java
+3
-0
src/main/java/com/zq/email/entity/EmailPerson.java
+5
-0
src/main/java/com/zq/email/enums/EmailFolderEnum.java
+4
-4
src/main/java/com/zq/email/enums/SearchRangeEnum.java
+17
-0
src/main/java/com/zq/email/feign/AdminFeignClient.java
+7
-0
src/main/java/com/zq/email/feign/fallback/AdminFeignFallbackFactory.java
+6
-0
src/main/java/com/zq/email/service/IEmailAttachService.java
+2
-1
src/main/java/com/zq/email/service/IEmailContentService.java
+3
-0
src/main/java/com/zq/email/service/IEmailPersonService.java
+24
-4
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
+31
-22
src/main/java/com/zq/email/service/impl/EmailContentServiceImpl.java
+13
-1
src/main/java/com/zq/email/service/impl/EmailFolderServiceImpl.java
+1
-1
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
+0
-0
src/main/java/com/zq/email/utils/DateUtils.java
+17
-10
src/main/java/com/zq/email/utils/EmailUtil.java
+88
-0
src/main/java/com/zq/email/vo/EmailEditVo.java
+1
-1
src/main/java/com/zq/email/vo/EmailLastAndAfterReqVo.java
+24
-0
src/main/java/com/zq/email/vo/EmailMoveFolderVo.java
+20
-0
src/main/java/com/zq/email/vo/EmailReadVo.java
+19
-0
src/main/java/com/zq/email/vo/EmailReplyVo.java
+53
-0
src/main/java/com/zq/email/vo/EmailReqVo.java
+53
-9
src/main/java/com/zq/email/vo/EmailTaskVo.java
+19
-0
src/main/java/com/zq/email/vo/EmlFileVo.java
+10
-0
src/main/resources/application-dev.yml
+1
-1
src/main/resources/application-local.yml
+1
-1
src/main/resources/application.yml
+3
-0
src/main/resources/bootstrap.yml
+1
-1
src/main/resources/logback-spring.xml
+2
-2
No files found.
pom.xml
View file @
6ee498e4
...
@@ -147,6 +147,12 @@
...
@@ -147,6 +147,12 @@
<version>
2.1.3
</version>
<version>
2.1.3
</version>
</dependency>
</dependency>
<dependency>
<groupId>
javax.mail
</groupId>
<artifactId>
mail
</artifactId>
<version>
1.4.7
</version>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencyManagement>
...
...
src/main/java/com/zq/email/config/Swagger.java
View file @
6ee498e4
...
@@ -32,10 +32,10 @@ public class Swagger implements WebMvcConfigurer {
...
@@ -32,10 +32,10 @@ public class Swagger implements WebMvcConfigurer {
@Bean
@Bean
public
Docket
api
()
{
public
Docket
api
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
groupName
(
"
sealPlatfrom
"
)
.
groupName
(
"
email
"
)
.
enable
(
enabled
)
//生产环境关闭
.
enable
(
enabled
)
//生产环境关闭
.
select
()
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.zq.
sealPlatform
.controller"
))
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.zq.
email
.controller"
))
.
paths
(
PathSelectors
.
any
())
.
paths
(
PathSelectors
.
any
())
.
build
()
.
build
()
.
apiInfo
(
apiInfo
());
.
apiInfo
(
apiInfo
());
...
...
src/main/java/com/zq/email/controller/EmailContentController.java
View file @
6ee498e4
package
com
.
zq
.
email
.
controller
;
package
com
.
zq
.
email
.
controller
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.email.service.IEmailContentService
;
import
com.zq.email.vo.EmailReqVo
;
import
com.zq.email.vo.EmailTaskVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -13,8 +24,22 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -13,8 +24,22 @@ import org.springframework.web.bind.annotation.RestController;
* @author chentianzhong
* @author chentianzhong
* @since 2023-03-06
* @since 2023-03-06
*/
*/
@Api
(
tags
=
"邮件内容接口"
)
@RestController
@RestController
@RequestMapping
(
"/email/emailContent"
)
@RequestMapping
(
"/email/emailContent"
)
@Slf4j
@RequiredArgsConstructor
public
class
EmailContentController
{
public
class
EmailContentController
{
private
final
IEmailContentService
emailContentService
;
@ApiOperation
(
"设置任务邮件"
)
@PostMapping
(
"setTaskEmail"
)
public
ResultVo
setTaskEmail
(
@RequestBody
EmailTaskVo
vo
)
{
AssertUtils
.
notEmpty
(
vo
.
getContentId
(),
"缺少参数: contentId"
);
AssertUtils
.
notNull
(
vo
.
getIsTask
(),
"缺少参数: isTask"
);
emailContentService
.
setTaskEmail
(
vo
);
return
ResultVo
.
success
();
}
}
}
src/main/java/com/zq/email/controller/EmailController.java
View file @
6ee498e4
...
@@ -4,24 +4,27 @@ package com.zq.email.controller;
...
@@ -4,24 +4,27 @@ package com.zq.email.controller;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.email.constants.EmailConstant
;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.entity.EmailPerson
;
import
com.zq.email.entity.EmailPerson
;
import
com.zq.email.enums.EmailFolderEnum
;
import
com.zq.email.enums.SearchRangeEnum
;
import
com.zq.email.enums.WhetherEnum
;
import
com.zq.email.service.IEmailContentService
;
import
com.zq.email.service.IEmailContentService
;
import
com.zq.email.service.IEmailPersonService
;
import
com.zq.email.service.IEmailPersonService
;
import
com.zq.email.vo.EmailDetailVo
;
import
com.zq.email.vo.*
;
import
com.zq.email.vo.EmailEditVo
;
import
com.zq.email.vo.EmailReqVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.core.io.InputStreamResource
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.mail.MessagingException
;
import
javax.mail.internet.MimeMessage
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
import
java.util.List
;
/**
/**
* <p>
* <p>
...
@@ -41,6 +44,13 @@ public class EmailController {
...
@@ -41,6 +44,13 @@ public class EmailController {
private
final
IEmailPersonService
emailPersonService
;
private
final
IEmailPersonService
emailPersonService
;
private
final
IEmailContentService
emailContentService
;
private
final
IEmailContentService
emailContentService
;
@ApiOperation
(
"查询范围"
)
@PostMapping
(
"searchRange"
)
public
ResultVo
searchRange
()
{
return
ResultVo
.
success
(
SearchRangeEnum
.
toList
());
}
@ApiOperation
(
"列表总数"
)
@ApiOperation
(
"列表总数"
)
@PostMapping
(
"total"
)
@PostMapping
(
"total"
)
public
ResultVo
total
(
@RequestBody
EmailReqVo
vo
)
{
public
ResultVo
total
(
@RequestBody
EmailReqVo
vo
)
{
...
@@ -56,10 +66,12 @@ public class EmailController {
...
@@ -56,10 +66,12 @@ public class EmailController {
@ApiOperation
(
"写邮件"
)
@ApiOperation
(
"写邮件"
)
@PostMapping
(
"edit"
)
@PostMapping
(
"edit"
)
public
ResultVo
edit
(
@RequestBody
EmailEditVo
vo
)
{
public
ResultVo
edit
(
EmailEditVo
vo
)
{
AssertUtils
.
hasText
(
vo
.
getTitle
(),
"缺少参数:title"
);
AssertUtils
.
hasText
(
vo
.
getTitle
(),
"缺少参数:title"
);
AssertUtils
.
notNull
(
vo
.
getIsSend
(),
"缺少参数: isSend"
);
AssertUtils
.
notNull
(
vo
.
getIsSend
(),
"缺少参数: isSend"
);
AssertUtils
.
isTrue
(
CollectionUtil
.
isNotEmpty
(
vo
.
getReceiver
())
||
CollectionUtil
.
isNotEmpty
(
vo
.
getReceiver
()),
"缺少参数:receiver和 receiveDeptList"
);
log
.
info
(
"vo.getReceiver()"
+
vo
.
getReceiver
());
log
.
info
(
"vo.getReceiveDeptList()"
+
vo
.
getReceiveDeptList
());
AssertUtils
.
isTrue
(
CollectionUtil
.
isNotEmpty
(
vo
.
getReceiver
())
||
CollectionUtil
.
isNotEmpty
(
vo
.
getReceiveDeptList
()),
"缺少参数:receiver和 receiveDeptList"
);
emailPersonService
.
emailEditVo
(
vo
);
emailPersonService
.
emailEditVo
(
vo
);
return
ResultVo
.
success
();
return
ResultVo
.
success
();
}
}
...
@@ -67,15 +79,96 @@ public class EmailController {
...
@@ -67,15 +79,96 @@ public class EmailController {
@ApiOperation
(
"邮件详情,这个接口如果前端从列表能获取到显示就不用调用"
)
@ApiOperation
(
"邮件详情,这个接口如果前端从列表能获取到显示就不用调用"
)
@PostMapping
(
"detail"
)
@PostMapping
(
"detail"
)
public
ResultVo
detail
(
@RequestBody
EmailDetailVo
vo
)
{
public
ResultVo
detail
(
@RequestBody
EmailDetailVo
vo
)
{
AssertUtils
.
notNull
(
vo
.
getPersonId
(),
"缺少参数:id"
);
AssertUtils
.
notNull
(
vo
.
getPersonId
(),
"缺少参数:personId"
);
AssertUtils
.
notNull
(
vo
.
getContentId
(),
"缺少参数:contentId"
);
EmailPerson
emailPerson
=
emailPersonService
.
getById
(
vo
.
getPersonId
());
EmailPerson
emailPerson
=
emailPersonService
.
getById
(
vo
.
getPersonId
());
AssertUtils
.
notNull
(
emailPerson
,
"获取邮件对应人员信息失败"
);
AssertUtils
.
notNull
(
emailPerson
,
"获取邮件对应人员信息失败"
);
AssertUtils
.
isTrue
(
emailPerson
.
getEmailContentId
()
==
vo
.
getContentId
()
,
"contentId对应不一致"
+
emailPerson
.
getEmailContentId
()
+
":"
+
vo
.
getContentId
());
EmailContent
content
=
emailContentService
.
getById
(
emailPerson
.
getEmailContentId
());
EmailContent
content
=
emailContentService
.
getById
(
emailPerson
.
getEmailContentId
());
AssertUtils
.
notNull
(
content
,
"获取邮件内容失败"
);
AssertUtils
.
notNull
(
content
,
"获取邮件内容失败"
);
emailPerson
.
setEmailContent
(
content
);
emailPerson
.
setEmailContent
(
content
);
return
ResultVo
.
success
(
emailPerson
);
return
ResultVo
.
success
(
emailPerson
);
}
}
// @ApiOperation("回复")
// @PostMapping("reply")
// public ResultVo reply(@RequestBody EmailEditVo vo) {
// AssertUtils.hasText(vo.getTitle(), "缺少参数:title");
// AssertUtils.notNull(vo.getIsSend(), "缺少参数: isSend");
// AssertUtils.isTrue(CollectionUtil.isNotEmpty(vo.getReceiver()) || CollectionUtil.isNotEmpty(vo.getReceiver()), "缺少参数:receiver和 receiveDeptList");
// emailPersonService.emailEditVo(vo);
// return ResultVo.success();
// }
//
// @ApiOperation("转发")
// @PostMapping("forward")
// public ResultVo forward(@RequestBody EmailEditVo vo) {
// AssertUtils.hasText(vo.getTitle(), "缺少参数:title");
// AssertUtils.notNull(vo.getIsSend(), "缺少参数: isSend");
// AssertUtils.isTrue(CollectionUtil.isNotEmpty(vo.getReceiver()) || CollectionUtil.isNotEmpty(vo.getReceiver()), "缺少参数:receiver和 receiveDeptList");
// emailPersonService.emailEditVo(vo);
// return ResultVo.success();
// }
@ApiOperation
(
"收件箱彻底删除"
)
@PostMapping
(
"delete"
)
public
ResultVo
delete
(
@RequestBody
List
<
Long
>
personIds
)
{
AssertUtils
.
notEmpty
(
personIds
,
"缺少参数:personIds"
);
emailPersonService
.
removeByIds
(
personIds
);
return
ResultVo
.
success
();
}
@ApiOperation
(
"删除所有收件人已删除邮件"
)
@PostMapping
(
"deleteAllReceiverDelete"
)
public
ResultVo
deleteAllReceiverDelete
()
{
emailPersonService
.
deleteAllReceiverDelete
();
return
ResultVo
.
success
();
}
@ApiOperation
(
"删除所有收件人未读邮件"
)
@PostMapping
(
"deleteAllReceiverUnread"
)
public
ResultVo
deleteAllReceiverUnread
()
{
emailPersonService
.
deleteAllReceiverUnread
();
return
ResultVo
.
success
();
}
@ApiOperation
(
"导出eml格式邮件"
)
@PostMapping
(
"/emlFile"
)
public
void
emlFile
(
HttpServletResponse
response
,
@RequestParam
(
value
=
"contentId"
,
required
=
true
)
Long
contentId
)
throws
Exception
{
MimeMessage
mimeMessage
=
emailPersonService
.
emlFile
(
contentId
);
response
.
setContentType
(
"application/x-download"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
mimeMessage
.
getSubject
()+
".eml"
);
//浏览器上提示下载时默认的文件名
ServletOutputStream
out
=
response
.
getOutputStream
();
mimeMessage
.
writeTo
(
out
);
out
.
close
();
out
.
flush
();
}
@ApiOperation
(
"上一封"
)
@PostMapping
(
"lastEmail"
)
public
ResultVo
lastEmail
(
@RequestBody
EmailLastAndAfterReqVo
vo
)
{
AssertUtils
.
notNull
(
vo
.
getFolderId
(),
"缺少参数:folderId"
);
EmailPerson
person
=
this
.
emailPersonService
.
lastAndAfterEmail
(
vo
,
0
);
AssertUtils
.
notNull
(
person
,
"没有上一封了"
);
return
ResultVo
.
success
(
person
);
}
@ApiOperation
(
"下一封"
)
@PostMapping
(
"afterEmail"
)
public
ResultVo
afterEmail
(
@RequestBody
EmailLastAndAfterReqVo
vo
)
{
AssertUtils
.
notNull
(
vo
.
getFolderId
(),
"缺少参数:folderId"
);
EmailPerson
person
=
this
.
emailPersonService
.
lastAndAfterEmail
(
vo
,
0
);
AssertUtils
.
notNull
(
person
,
"没有下一封了"
);
return
ResultVo
.
success
(
person
);
}
...
...
src/main/java/com/zq/email/controller/EmailFolderController.java
View file @
6ee498e4
...
@@ -40,6 +40,17 @@ public class EmailFolderController {
...
@@ -40,6 +40,17 @@ public class EmailFolderController {
return
ResultVo
.
success
(
emailFolderService
.
selfFolderList
(
adminContext
.
getUserId
()));
return
ResultVo
.
success
(
emailFolderService
.
selfFolderList
(
adminContext
.
getUserId
()));
}
}
@ApiOperation
(
"获取自定义文件夹"
)
@PostMapping
(
"otherFolderList"
)
public
ResultVo
otherFolderList
()
{
OnlineUserDto
adminContext
=
TokenUtils
.
getAdminContext
();
AssertUtils
.
notNull
(
adminContext
,
"登录已失效,请重新登录后再次尝试!"
);
return
ResultVo
.
success
(
this
.
emailFolderService
.
lambdaQuery
()
.
eq
(
EmailFolder:
:
getUserId
,
adminContext
.
getUserId
())
.
orderByAsc
(
EmailFolder:
:
getSort
).
list
());
}
@ApiOperation
(
"编辑个人文件夹"
)
@ApiOperation
(
"编辑个人文件夹"
)
@PostMapping
(
"edit"
)
@PostMapping
(
"edit"
)
public
ResultVo
edit
(
@RequestBody
EmailFolderVo
vo
)
{
public
ResultVo
edit
(
@RequestBody
EmailFolderVo
vo
)
{
...
...
src/main/java/com/zq/email/controller/EmailPersonController.java
View file @
6ee498e4
...
@@ -3,18 +3,19 @@ package com.zq.email.controller;
...
@@ -3,18 +3,19 @@ package com.zq.email.controller;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.email.entity.EmailPerson
;
import
com.zq.email.enums.WhetherEnum
;
import
com.zq.email.service.IEmailPersonService
;
import
com.zq.email.service.IEmailPersonService
;
import
com.zq.email.vo.EmailDetailVo
;
import
com.zq.email.vo.EmailDetailVo
;
import
com.zq.email.vo.EmailFolderMoveVo
;
import
com.zq.email.vo.EmailFolderMoveVo
;
import
com.zq.email.vo.EmailReadVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
/**
* <p>
* <p>
...
@@ -42,10 +43,46 @@ public class EmailPersonController {
...
@@ -42,10 +43,46 @@ public class EmailPersonController {
@ApiOperation
(
"邮件收件人详情"
)
@ApiOperation
(
"邮件收件人详情"
)
@PostMapping
(
"
b
yContentId"
)
@PostMapping
(
"
findReceiverB
yContentId"
)
public
ResultVo
b
yContentId
(
@RequestBody
EmailDetailVo
vo
)
{
public
ResultVo
findReceiverB
yContentId
(
@RequestBody
EmailDetailVo
vo
)
{
AssertUtils
.
notNull
(
vo
.
getContentId
(),
"缺少参数:contentId"
);
AssertUtils
.
notNull
(
vo
.
getContentId
(),
"缺少参数:contentId"
);
return
ResultVo
.
success
(
emailPersonService
.
findByContentId
(
vo
.
getContentId
()));
return
ResultVo
.
success
(
emailPersonService
.
find
Receiver
ByContentId
(
vo
.
getContentId
()));
}
}
@ApiOperation
(
"邮件收件部门"
)
@PostMapping
(
"findReceiveDeptByContentId"
)
public
ResultVo
findReceiveDeptByContentId
(
@RequestBody
EmailDetailVo
vo
)
{
AssertUtils
.
notNull
(
vo
.
getContentId
(),
"缺少参数:contentId"
);
return
ResultVo
.
success
(
emailPersonService
.
findReceiveDeptByContentId
(
vo
.
getContentId
()));
}
@ApiOperation
(
"设置为已读或未读"
)
@PostMapping
(
"readEmail"
)
public
ResultVo
readEmail
(
@RequestBody
EmailReadVo
vo
)
{
AssertUtils
.
notEmpty
(
vo
.
getPersonIdList
(),
"缺少参数:personIdList"
);
AssertUtils
.
notNull
(
vo
.
getIsRead
(),
"缺少参数:isSend"
);
this
.
emailPersonService
.
readEmail
(
vo
);
return
ResultVo
.
success
();
}
@ApiOperation
(
"全部设置已读"
)
@PostMapping
(
"readAllEmails"
)
public
ResultVo
readAllEmails
(
@RequestParam
(
value
=
"folderId"
,
required
=
true
)
Long
folderId
)
{
this
.
emailPersonService
.
readAllEmails
(
folderId
);
return
ResultVo
.
success
();
}
@ApiOperation
(
"删除已读(把已读放入回收站)"
)
@PostMapping
(
"readToBin"
)
public
ResultVo
readToBin
(
@RequestParam
(
value
=
"folderId"
,
required
=
true
)
Long
folderId
)
{
this
.
emailPersonService
.
readToBin
(
folderId
);
return
ResultVo
.
success
();
}
}
}
src/main/java/com/zq/email/dto/DeptSimpleDto.java
0 → 100644
View file @
6ee498e4
package
com
.
zq
.
email
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
DeptSimpleDto
{
@ApiModelProperty
(
"部门名"
)
private
String
name
;
@ApiModelProperty
(
"部门id"
)
private
Long
deptId
;
@ApiModelProperty
(
"部门全称(便于区分同名)"
)
private
String
deptWholeName
;
}
src/main/java/com/zq/email/entity/EmailAttach.java
View file @
6ee498e4
...
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
...
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.*
;
import
lombok.*
;
...
@@ -41,6 +43,7 @@ public class EmailAttach implements Serializable {
...
@@ -41,6 +43,7 @@ public class EmailAttach implements Serializable {
private
String
downloadPath
;
private
String
downloadPath
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
sendTime
;
private
LocalDateTime
sendTime
;
...
...
src/main/java/com/zq/email/entity/EmailContent.java
View file @
6ee498e4
...
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
...
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -42,6 +44,7 @@ public class EmailContent implements Serializable {
...
@@ -42,6 +44,7 @@ public class EmailContent implements Serializable {
private
String
sendUserName
;
private
String
sendUserName
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
sendTime
;
private
LocalDateTime
sendTime
;
private
Integer
smsRemind
;
private
Integer
smsRemind
;
...
...
src/main/java/com/zq/email/entity/EmailPerson.java
View file @
6ee498e4
...
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
...
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.*
;
import
lombok.*
;
...
@@ -38,6 +40,8 @@ public class EmailPerson implements Serializable {
...
@@ -38,6 +40,8 @@ public class EmailPerson implements Serializable {
private
String
userEmail
;
private
String
userEmail
;
private
String
userName
;
private
Long
deptId
;
private
Long
deptId
;
private
String
deptName
;
private
String
deptName
;
...
@@ -46,6 +50,7 @@ public class EmailPerson implements Serializable {
...
@@ -46,6 +50,7 @@ public class EmailPerson implements Serializable {
private
Integer
personType
;
private
Integer
personType
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
sendTime
;
private
LocalDateTime
sendTime
;
private
Long
folderId
;
private
Long
folderId
;
...
...
src/main/java/com/zq/email/enums/EmailFolderEnum.java
View file @
6ee498e4
...
@@ -13,11 +13,11 @@ public enum EmailFolderEnum {
...
@@ -13,11 +13,11 @@ public enum EmailFolderEnum {
FOLDER_INBOX
(
1
,
"收件箱"
),
FOLDER_INBOX
(
1
,
"收件箱"
),
FOLDER_DEPT_INBOX
(
2
,
"部门邮件"
),
FOLDER_DEPT_INBOX
(
2
,
"部门邮件"
),
FOLDER_OUTBOX
(
3
,
"
发件
箱"
),
FOLDER_OUTBOX
(
3
,
"
草稿
箱"
),
FOLDER_ALREADY_SEND
(
4
,
"已发送"
),
FOLDER_ALREADY_SEND
(
4
,
"已发送"
),
FOLDER_ALREADY_DELETE
(
5
,
"
已删除
"
),
FOLDER_ALREADY_DELETE
(
5
,
"
回收站
"
),
FOLDER_OTHER
(
6
,
"其他文件夹"
),
FOLDER_OTHER
(
6
,
"其他文件夹"
),
FOLDER_LABEL
(
7
,
"邮件标签"
),
//
FOLDER_LABEL(7, "邮件标签"),
;
;
private
Integer
key
;
private
Integer
key
;
...
@@ -56,7 +56,7 @@ public enum EmailFolderEnum {
...
@@ -56,7 +56,7 @@ public enum EmailFolderEnum {
List
<
EmailFolderDto
>
list
=
new
ArrayList
<>();
List
<
EmailFolderDto
>
list
=
new
ArrayList
<>();
for
(
EmailFolderEnum
emailFolderEnum
:
EmailFolderEnum
.
values
())
{
for
(
EmailFolderEnum
emailFolderEnum
:
EmailFolderEnum
.
values
())
{
EmailFolderDto
folder
=
EmailFolderDto
.
builder
()
EmailFolderDto
folder
=
EmailFolderDto
.
builder
()
.
folderId
(
emailFolderEnum
.
getKey
())
.
folderId
(
emailFolderEnum
.
getKey
()
.
longValue
()
)
.
folderName
(
emailFolderEnum
.
getValue
())
.
folderName
(
emailFolderEnum
.
getValue
())
.
sort
(
emailFolderEnum
.
getKey
())
.
sort
(
emailFolderEnum
.
getKey
())
.
build
();
.
build
();
...
...
src/main/java/com/zq/email/enums/SearchRangeEnum.java
View file @
6ee498e4
package
com
.
zq
.
email
.
enums
;
package
com
.
zq
.
email
.
enums
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.email.dto.EmailFolderDto
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 是否
* 是否
...
@@ -55,6 +61,17 @@ public enum SearchRangeEnum {
...
@@ -55,6 +61,17 @@ public enum SearchRangeEnum {
return
null
;
return
null
;
}
}
public
static
List
<
Map
<
Integer
,
String
>>
toList
(){
List
<
Map
<
Integer
,
String
>>
list
=
new
ArrayList
<>();
for
(
SearchRangeEnum
searchRangeEnum
:
SearchRangeEnum
.
values
())
{
Map
<
Integer
,
String
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
searchRangeEnum
.
getKey
(),
searchRangeEnum
.
getValue
());
list
.
add
(
map
);
}
return
list
;
}
public
Integer
getKey
()
{
public
Integer
getKey
()
{
return
key
;
return
key
;
}
}
...
...
src/main/java/com/zq/email/feign/AdminFeignClient.java
View file @
6ee498e4
...
@@ -5,6 +5,7 @@ import com.zq.common.annotation.Log;
...
@@ -5,6 +5,7 @@ import com.zq.common.annotation.Log;
import
com.zq.common.vo.CustomerUserVo
;
import
com.zq.common.vo.CustomerUserVo
;
import
com.zq.common.vo.OnlineUserDto
;
import
com.zq.common.vo.OnlineUserDto
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.email.dto.DeptSimpleDto
;
import
com.zq.email.feign.fallback.AdminFeignFallbackFactory
;
import
com.zq.email.feign.fallback.AdminFeignFallbackFactory
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
...
@@ -31,4 +32,10 @@ public interface AdminFeignClient {
...
@@ -31,4 +32,10 @@ public interface AdminFeignClient {
@GetMapping
(
value
=
"/users/getUserByDeptId/{deptId}"
)
@GetMapping
(
value
=
"/users/getUserByDeptId/{deptId}"
)
ResultVo
<
List
<
CustomerUserVo
>>
getUserByDeptId
(
@PathVariable
(
value
=
"deptId"
)
Long
deptId
);
ResultVo
<
List
<
CustomerUserVo
>>
getUserByDeptId
(
@PathVariable
(
value
=
"deptId"
)
Long
deptId
);
@Log
(
"根据部门id查询部门信息"
)
@ApiOperation
(
"根据部门id查询部门信息"
)
@AnonymousAccess
@GetMapping
(
"/dept/getByDeptId/{deptId}"
)
ResultVo
<
DeptSimpleDto
>
getByDeptId
(
@PathVariable
Long
deptId
);
}
}
src/main/java/com/zq/email/feign/fallback/AdminFeignFallbackFactory.java
View file @
6ee498e4
...
@@ -3,6 +3,7 @@ package com.zq.email.feign.fallback;
...
@@ -3,6 +3,7 @@ package com.zq.email.feign.fallback;
import
com.zq.common.vo.CustomerUserVo
;
import
com.zq.common.vo.CustomerUserVo
;
import
com.zq.common.vo.OnlineUserDto
;
import
com.zq.common.vo.OnlineUserDto
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.email.dto.DeptSimpleDto
;
import
com.zq.email.feign.AdminFeignClient
;
import
com.zq.email.feign.AdminFeignClient
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -43,6 +44,11 @@ public class AdminFeignFallbackFactory implements FallbackFactory<AdminFeignClie
...
@@ -43,6 +44,11 @@ public class AdminFeignFallbackFactory implements FallbackFactory<AdminFeignClie
return
null
;
return
null
;
}
}
@Override
public
ResultVo
<
DeptSimpleDto
>
getByDeptId
(
Long
deptId
)
{
return
null
;
}
};
};
}
}
...
...
src/main/java/com/zq/email/service/IEmailAttachService.java
View file @
6ee498e4
...
@@ -3,6 +3,7 @@ package com.zq.email.service;
...
@@ -3,6 +3,7 @@ package com.zq.email.service;
import
com.zq.email.entity.EmailAttach
;
import
com.zq.email.entity.EmailAttach
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.vo.EmailEditVo
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
import
java.util.List
;
...
@@ -17,7 +18,7 @@ import java.util.List;
...
@@ -17,7 +18,7 @@ import java.util.List;
*/
*/
public
interface
IEmailAttachService
extends
IService
<
EmailAttach
>
{
public
interface
IEmailAttachService
extends
IService
<
EmailAttach
>
{
void
saveAttach
(
List
<
MultipartFile
>
fileIdList
,
EmailContent
content
);
void
saveAttach
(
EmailEditVo
vo
,
EmailContent
content
);
List
<
EmailAttach
>
findByContentId
(
Long
contentId
);
List
<
EmailAttach
>
findByContentId
(
Long
contentId
);
...
...
src/main/java/com/zq/email/service/IEmailContentService.java
View file @
6ee498e4
...
@@ -4,6 +4,7 @@ import com.zq.common.vo.OnlineUserDto;
...
@@ -4,6 +4,7 @@ import com.zq.common.vo.OnlineUserDto;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.entity.EmailContent
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zq.email.vo.EmailEditVo
;
import
com.zq.email.vo.EmailEditVo
;
import
com.zq.email.vo.EmailTaskVo
;
/**
/**
* <p>
* <p>
...
@@ -16,4 +17,6 @@ import com.zq.email.vo.EmailEditVo;
...
@@ -16,4 +17,6 @@ import com.zq.email.vo.EmailEditVo;
public
interface
IEmailContentService
extends
IService
<
EmailContent
>
{
public
interface
IEmailContentService
extends
IService
<
EmailContent
>
{
EmailContent
saveContent
(
EmailEditVo
vo
,
OnlineUserDto
adminContext
);
EmailContent
saveContent
(
EmailEditVo
vo
,
OnlineUserDto
adminContext
);
void
setTaskEmail
(
EmailTaskVo
vo
);
}
}
src/main/java/com/zq/email/service/IEmailPersonService.java
View file @
6ee498e4
package
com
.
zq
.
email
.
service
;
package
com
.
zq
.
email
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.zq.email.dto.DeptDto
;
import
com.zq.email.dto.DeptSimpleDto
;
import
com.zq.email.entity.EmailPerson
;
import
com.zq.email.entity.EmailPerson
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zq.email.vo.
EmailEditVo
;
import
com.zq.email.vo.
*
;
import
com.zq.email.vo.EmailFolderMoveVo
;
import
org.springframework.core.io.InputStreamResource
;
import
com.zq.email.vo.EmailReqVo
;
import
org.springframework.http.ResponseEntity
;
import
javax.mail.internet.MimeMessage
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -27,5 +30,22 @@ public interface IEmailPersonService extends IService<EmailPerson> {
...
@@ -27,5 +30,22 @@ public interface IEmailPersonService extends IService<EmailPerson> {
void
moveEmailFolder
(
EmailFolderMoveVo
vo
);
void
moveEmailFolder
(
EmailFolderMoveVo
vo
);
List
<
EmailPerson
>
findByContentId
(
Long
contentId
);
List
<
EmailPerson
>
findReceiverByContentId
(
Long
contentId
);
List
<
DeptSimpleDto
>
findReceiveDeptByContentId
(
Long
contentId
);
void
readAllEmails
(
Long
folderId
);
void
readEmail
(
EmailReadVo
vo
);
void
readToBin
(
Long
folderId
);
MimeMessage
emlFile
(
Long
contentId
);
void
deleteAllReceiverDelete
();
void
deleteAllReceiverUnread
();
// 0上一封 1下一封
EmailPerson
lastAndAfterEmail
(
EmailLastAndAfterReqVo
vo
,
Integer
type
);
}
}
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
View file @
6ee498e4
...
@@ -12,11 +12,10 @@ import com.zq.email.feign.FileFeignClient;
...
@@ -12,11 +12,10 @@ import com.zq.email.feign.FileFeignClient;
import
com.zq.email.mapper.EmailAttachMapper
;
import
com.zq.email.mapper.EmailAttachMapper
;
import
com.zq.email.service.IEmailAttachService
;
import
com.zq.email.service.IEmailAttachService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zq.email.vo.EmailEditVo
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
sun.tools.jstat.Token
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -36,32 +35,42 @@ public class EmailAttachServiceImpl extends ServiceImpl<EmailAttachMapper, Email
...
@@ -36,32 +35,42 @@ public class EmailAttachServiceImpl extends ServiceImpl<EmailAttachMapper, Email
private
final
FileFeignClient
fileFeignClient
;
private
final
FileFeignClient
fileFeignClient
;
@Override
@Override
public
void
saveAttach
(
List
<
MultipartFile
>
fileIdList
,
EmailContent
content
)
{
public
void
saveAttach
(
EmailEditVo
vo
,
EmailContent
content
)
{
List
<
EmailAttach
>
list
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getFileIds
()))
{
//拿到旧附件
list
=
this
.
lambdaQuery
().
eq
(
EmailAttach:
:
getEmailContentId
,
content
.
getId
()).
in
(
EmailAttach:
:
getAttachId
,
vo
.
getFileIds
()).
list
();
for
(
EmailAttach
emailAttach
:
list
)
{
emailAttach
.
setId
(
null
);
}
}
//先检查旧附件
//先检查旧附件
this
.
lambdaUpdate
().
eq
(
EmailAttach:
:
getEmailContentId
,
content
.
getId
()).
remove
();
this
.
lambdaUpdate
().
eq
(
EmailAttach:
:
getEmailContentId
,
content
.
getId
()).
remove
();
ResultVo
<
UploadFileListRespVo
>
uploadFileListRespVoResultVo
=
fileFeignClient
.
uploadFileList
(
fileIdList
.
toArray
(
new
MultipartFile
[
fileIdList
.
size
()]),
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getFileList
()))
{
EmailConstant
.
SYSTEM_TAG
,
ResultVo
<
UploadFileListRespVo
>
uploadFileListRespVoResultVo
=
fileFeignClient
.
uploadFileList
(
vo
.
getFileList
().
toArray
(
new
MultipartFile
[
vo
.
getFileList
().
size
()]),
content
.
getSendUserId
(),
EmailConstant
.
SYSTEM_TAG
,
String
.
valueOf
(
content
.
getId
()));
content
.
getSendUserId
(),
String
.
valueOf
(
content
.
getId
()));
AssertUtils
.
isTrue
(
uploadFileListRespVoResultVo
.
isSuccess
(),
"上传文件失败"
);
AssertUtils
.
isTrue
(
uploadFileListRespVoResultVo
.
isSuccess
(),
"上传文件失败"
);
UploadFileListRespVo
data
=
uploadFileListRespVoResultVo
.
getData
();
UploadFileListRespVo
data
=
uploadFileListRespVoResultVo
.
getData
();
AssertUtils
.
isTrue
(
data
!=
null
&&
CollectionUtil
.
isNotEmpty
(
data
.
getUploadFileRespVos
()),
"上传文件失败,结果为空"
);
AssertUtils
.
isTrue
(
data
!=
null
&&
CollectionUtil
.
isNotEmpty
(
data
.
getUploadFileRespVos
()),
"上传文件失败,结果为空"
);
List
<
EmailAttach
>
attachList
=
new
ArrayList
<>();
for
(
UploadFileRespVo
uploadFileRespVo
:
data
.
getUploadFileRespVos
())
{
for
(
UploadFileRespVo
uploadFileRespVo
:
data
.
getUploadFileRespVos
())
{
EmailAttach
emailAttach
=
EmailAttach
.
builder
()
EmailAttach
emailAttach
=
EmailAttach
.
builder
(
)
.
emailContentId
(
content
.
getId
()
)
.
emailContentId
(
content
.
getId
())
.
attachId
(
uploadFileRespVo
.
getId
())
.
attachId
(
uploadFileRespVo
.
getId
())
.
attachName
(
uploadFileRespVo
.
getFileName
())
.
attachName
(
uploadFileRespVo
.
getFileNam
e
())
.
attachSize
(
uploadFileRespVo
.
getSiz
e
())
.
attachSize
(
uploadFileRespVo
.
getSize
())
.
downloadPath
(
uploadFileRespVo
.
getDownloadPath
())
.
downloadPath
(
uploadFileRespVo
.
getDownloadPath
())
.
sendTime
(
content
.
getSendTime
())
.
sendTime
(
content
.
getSendTime
())
.
build
();
.
build
(
);
list
.
add
(
emailAttach
);
attachList
.
add
(
emailAttach
);
}
}
}
this
.
saveBatch
(
attachL
ist
);
this
.
saveBatch
(
l
ist
);
}
}
@Override
@Override
...
...
src/main/java/com/zq/email/service/impl/EmailContentServiceImpl.java
View file @
6ee498e4
package
com
.
zq
.
email
.
service
.
impl
;
package
com
.
zq
.
email
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.vo.OnlineUserDto
;
import
com.zq.common.vo.OnlineUserDto
;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.entity.EmailContent
;
...
@@ -10,6 +11,8 @@ import com.zq.email.mapper.EmailContentMapper;
...
@@ -10,6 +11,8 @@ import com.zq.email.mapper.EmailContentMapper;
import
com.zq.email.service.IEmailContentService
;
import
com.zq.email.service.IEmailContentService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zq.email.vo.EmailEditVo
;
import
com.zq.email.vo.EmailEditVo
;
import
com.zq.email.vo.EmailTaskVo
;
import
net.bytebuddy.matcher.CollectionErasureMatcher
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -56,9 +59,18 @@ public class EmailContentServiceImpl extends ServiceImpl<EmailContentMapper, Ema
...
@@ -56,9 +59,18 @@ public class EmailContentServiceImpl extends ServiceImpl<EmailContentMapper, Ema
}
}
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getReceiveDeptList
())){
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getReceiveDeptList
())){
content
.
setDeptList
(
vo
.
getReceiveDeptList
().
toString
());
StringBuffer
sb
=
new
StringBuffer
();
for
(
Long
deptId
:
vo
.
getReceiveDeptList
())
{
sb
.
append
(
deptId
).
append
(
","
);
}
content
.
setDeptList
(
sb
.
toString
());
}
}
this
.
saveOrUpdate
(
content
);
this
.
saveOrUpdate
(
content
);
return
content
;
return
content
;
}
}
@Override
public
void
setTaskEmail
(
EmailTaskVo
vo
)
{
this
.
lambdaUpdate
().
in
(
EmailContent:
:
getId
,
vo
.
getContentId
()).
set
(
EmailContent:
:
getIsTask
,
vo
.
getIsTask
()).
update
();
}
}
}
src/main/java/com/zq/email/service/impl/EmailFolderServiceImpl.java
View file @
6ee498e4
...
@@ -43,7 +43,7 @@ public class EmailFolderServiceImpl extends ServiceImpl<EmailFolderMapper, Email
...
@@ -43,7 +43,7 @@ public class EmailFolderServiceImpl extends ServiceImpl<EmailFolderMapper, Email
List
<
EmailFolderDto
>
list
=
EmailFolderEnum
.
toList
();
List
<
EmailFolderDto
>
list
=
EmailFolderEnum
.
toList
();
if
(
CollectionUtil
.
isNotEmpty
(
folderDtoList
)){
if
(
CollectionUtil
.
isNotEmpty
(
folderDtoList
)){
for
(
EmailFolderDto
folderDto
:
list
)
{
for
(
EmailFolderDto
folderDto
:
list
)
{
if
(
folderDto
.
getFolderId
().
equals
(
EmailFolderEnum
.
FOLDER_OTHER
.
getKey
()
)){
if
(
folderDto
.
getFolderId
().
intValue
()
==
EmailFolderEnum
.
FOLDER_OTHER
.
getKey
().
intValue
(
)){
folderDto
.
setChildren
(
folderDtoList
);
folderDto
.
setChildren
(
folderDtoList
);
}
}
}
}
...
...
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
View file @
6ee498e4
This diff is collapsed.
Click to expand it.
src/main/java/com/zq/email/utils/DateUtils.java
View file @
6ee498e4
...
@@ -26,20 +26,27 @@ public class DateUtils {
...
@@ -26,20 +26,27 @@ public class DateUtils {
* @param monthNum
* @param monthNum
* @return
* @return
*/
*/
public
static
Consumer
<
LambdaQueryWrapper
<
EmailPerson
>>
getRangeStart
(
Integer
monthNum
)
{
public
static
LocalDateTime
getRangeStart
(
Integer
monthNum
)
{
LocalDateTime
localDateTime
=
null
;
LocalDateTime
localDateTime
=
null
;
if
(
monthNum
!=
null
)
{
if
(
monthNum
.
equals
(
SearchRangeEnum
.
LAST_THREE_MONTHS
.
getKey
())){
if
(
monthNum
.
equals
(
SearchRangeEnum
.
LAST_THREE_MONTHS
.
getKey
()))
{
localDateTime
=
DateUtil
.
offsetMonth
(
new
Date
(),
-
3
).
toLocalDateTime
();
localDateTime
=
DateUtil
.
offsetMonth
(
new
Date
(),
-
3
).
toLocalDateTime
();
}
else
if
(
monthNum
.
equals
(
SearchRangeEnum
.
LAST_SIX_MONTHS
.
getKey
())){
}
else
if
(
monthNum
.
equals
(
SearchRangeEnum
.
LAST_SIX_MONTHS
.
getKey
()))
{
localDateTime
=
DateUtil
.
offsetMonth
(
new
Date
(),
-
6
).
toLocalDateTime
();
localDateTime
=
DateUtil
.
offsetMonth
(
new
Date
(),
-
6
).
toLocalDateTime
();
}
else
if
(
monthNum
.
equals
(
SearchRangeEnum
.
LAST_ONE_YEAR
.
getKey
())){
}
else
if
(
monthNum
.
equals
(
SearchRangeEnum
.
LAST_ONE_YEAR
.
getKey
()))
{
localDateTime
=
DateUtil
.
offsetMonth
(
new
Date
(),
-
12
).
toLocalDateTime
();
localDateTime
=
DateUtil
.
offsetMonth
(
new
Date
(),
-
12
).
toLocalDateTime
();
}
else
{
}
else
{
localDateTime
=
null
;
localDateTime
=
null
;
}
}
}
return
localDateTime
;
return
localDateTime
;
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
DateUtil
.
format
(
LocalDateTime
.
now
(),
"yyyy-MM-dd HH:mm:ss"
));
LocalDateTime
rangeStart
=
getRangeStart
(
0
);
System
.
out
.
println
(
DateUtil
.
format
(
rangeStart
,
"yyyy-MM-dd HH:mm:ss"
));
}
}
}
src/main/java/com/zq/email/utils/EmailUtil.java
0 → 100644
View file @
6ee498e4
package
com
.
zq
.
email
.
utils
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.zq.email.entity.EmailAttach
;
import
io.swagger.models.auth.In
;
import
javax.activation.DataHandler
;
import
javax.activation.FileDataSource
;
import
javax.activation.URLDataSource
;
import
javax.mail.Message
;
import
javax.mail.MessagingException
;
import
javax.mail.Session
;
import
javax.mail.internet.*
;
import
java.io.FileOutputStream
;
import
java.net.URL
;
import
java.util.List
;
import
java.util.Properties
;
public
class
EmailUtil
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
InternetAddress
[]
parse
=
InternetAddress
.
parse
(
"111@sina.com,111@sina.com,"
);
for
(
InternetAddress
internetAddress
:
parse
)
{
System
.
out
.
println
(
internetAddress
.
toString
());
System
.
out
.
println
(
internetAddress
.
getAddress
());
}
// Session session = Session.getDefaultInstance(new Properties());
// MimeMessage message = createMessage(session);
//
// message.writeTo(new FileOutputStream("D:\\Eclipse\\ComplexMessage.eml"));
}
public
static
MimeMessage
createMessage
(
Session
session
,
String
sender
,
String
recipient
,
String
subject
,
String
content
,
List
<
EmailAttach
>
attachList
)
throws
Exception
{
MimeMessage
message
=
new
MimeMessage
(
session
);
message
.
setFrom
(
new
InternetAddress
(
sender
));
message
.
setRecipients
(
Message
.
RecipientType
.
TO
,
recipient
);
// message.setFrom(new InternetAddress("sender@sina.com"));
// message.setRecipients(Message.RecipientType.TO, "recipient1@sina.com,recipient2@sina.com,recipient3@sina.com,");
message
.
setSubject
(
subject
);
//创建代表邮件正文和附件的各个MimeBodyPart对象
MimeBodyPart
contentBodyPart
=
createContent
(
content
);
MimeMultipart
allMultipart
=
new
MimeMultipart
(
"mixed"
);
allMultipart
.
addBodyPart
(
contentBodyPart
);
if
(
CollectionUtil
.
isNotEmpty
(
attachList
))
{
for
(
EmailAttach
emailAttach
:
attachList
)
{
MimeBodyPart
attachPart
=
createAttachment
(
emailAttach
);
allMultipart
.
addBodyPart
(
attachPart
);
}
}
//设置整个邮件内容为最终组合出的MimeMultipart对象
message
.
setContent
(
allMultipart
);
message
.
saveChanges
();
return
message
;
}
private
static
MimeBodyPart
createAttachment
(
EmailAttach
attach
)
throws
Exception
{
//创建保存附件的MimeBodyPart对象,并加入附件内容和相应信息
MimeBodyPart
attachPart
=
new
MimeBodyPart
();
//FileDataSource fds = new FileDataSource(filename);
URLDataSource
fds
=
new
URLDataSource
(
new
URL
(
attach
.
getDownloadPath
()));
attachPart
.
setDataHandler
(
new
DataHandler
(
fds
));
attachPart
.
setFileName
(
MimeUtility
.
encodeText
(
attach
.
getAttachName
()));
return
attachPart
;
}
private
static
MimeBodyPart
createContent
(
String
body
)
throws
Exception
{
//创建代表组合MIME消息的MimeMultipart对象,和将该MimeMultipart对象保存到MimeBodyPart对象
MimeBodyPart
contentPart
=
new
MimeBodyPart
();
MimeMultipart
contentMultipart
=
new
MimeMultipart
(
"related"
);
//创建用于保存HTML正文的MimeBodyPart对象,并将它保存到MimeMultipart中
MimeBodyPart
htmlBodyPart
=
new
MimeBodyPart
();
htmlBodyPart
.
setContent
(
body
,
"text/html;charset=gb2312"
);
contentMultipart
.
addBodyPart
(
htmlBodyPart
);
//将MimeMultipart对象保存到MimeBodyPart对象中
contentPart
.
setContent
(
contentMultipart
);
return
contentPart
;
}
}
src/main/java/com/zq/email/vo/EmailEditVo.java
View file @
6ee498e4
...
@@ -33,7 +33,7 @@ public class EmailEditVo {
...
@@ -33,7 +33,7 @@ public class EmailEditVo {
private
List
<
Integer
>
remind
;
private
List
<
Integer
>
remind
;
@ApiModelProperty
(
"附件id"
)
@ApiModelProperty
(
"附件id"
)
private
List
<
String
>
fileId
;
private
List
<
String
>
fileId
s
;
@ApiModelProperty
(
"回复短信id"
)
@ApiModelProperty
(
"回复短信id"
)
private
Long
replyId
;
private
Long
replyId
;
...
...
src/main/java/com/zq/email/vo/EmailLastAndAfterReqVo.java
0 → 100644
View file @
6ee498e4
package
com
.
zq
.
email
.
vo
;
import
com.zq.common.vo.PageReqVo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
description
=
"上一封、下一封传参"
)
@Data
public
class
EmailLastAndAfterReqVo
{
@ApiModelProperty
(
value
=
"文件夹ID"
)
private
Integer
folderId
;
@ApiModelProperty
(
"人员类型"
)
private
Integer
personType
;
@ApiModelProperty
(
"是否个人邮件"
)
private
Integer
isPerson
;
@ApiModelProperty
(
"是否已发送"
)
private
Integer
isSend
;
@ApiModelProperty
(
"查询范围,默认最近三个月"
)
private
Long
currentPersonId
;
}
src/main/java/com/zq/email/vo/EmailMoveFolderVo.java
0 → 100644
View file @
6ee498e4
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
;
@Api
(
"移动邮件到其他文件夹Vo"
)
@Data
public
class
EmailMoveFolderVo
{
@ApiModelProperty
(
"personId集合"
)
private
List
<
Long
>
personIdList
;
@ApiModelProperty
(
"文件夹id"
)
private
Long
folderId
;
}
src/main/java/com/zq/email/vo/EmailReadVo.java
0 → 100644
View file @
6ee498e4
package
com
.
zq
.
email
.
vo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Api
(
"移动邮件到其他文件夹Vo"
)
@Data
public
class
EmailReadVo
{
@ApiModelProperty
(
"personId集合"
)
private
List
<
Long
>
personIdList
;
@ApiModelProperty
(
"0:未读 1:已读"
)
private
Integer
isRead
;
}
src/main/java/com/zq/email/vo/EmailReplyVo.java
0 → 100644
View file @
6ee498e4
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.Date
;
import
java.util.List
;
@Api
(
"回复邮件对应VO"
)
@Data
public
class
EmailReplyVo
{
@ApiModelProperty
(
"邮箱id"
)
private
Long
id
;
@ApiModelProperty
(
"标题"
)
private
String
title
;
@ApiModelProperty
(
"内容"
)
private
String
content
;
@ApiModelProperty
(
"重要程度"
)
private
Integer
degree
;
@ApiModelProperty
(
"收件人"
)
private
List
<
Long
>
receiver
;
@ApiModelProperty
(
"收件部门"
)
private
List
<
Long
>
receiveDeptList
;
@ApiModelProperty
(
"提醒方式"
)
private
List
<
Integer
>
remind
;
@ApiModelProperty
(
"附件id"
)
private
List
<
String
>
fileId
;
@ApiModelProperty
(
"回复短信id"
)
private
Long
replyId
;
@ApiModelProperty
(
"回复内容"
)
private
String
replyContent
;
@ApiModelProperty
(
"是否任务邮件 0否 1是"
)
private
Integer
isTask
=
0
;
@ApiModelProperty
(
"是否发送 0:发件箱 1:发送"
)
private
Integer
isSend
=
0
;
@ApiModelProperty
(
"附件"
)
private
List
<
MultipartFile
>
fileList
;
}
src/main/java/com/zq/email/vo/EmailReqVo.java
View file @
6ee498e4
...
@@ -17,15 +17,59 @@ import java.util.List;
...
@@ -17,15 +17,59 @@ import java.util.List;
@Data
@Data
public
class
EmailReqVo
extends
PageReqVo
{
public
class
EmailReqVo
extends
PageReqVo
{
@ApiModelProperty
(
value
=
"文件夹ID,默认收件箱"
)
private
Integer
folderId
=
EmailFolderEnum
.
FOLDER_INBOX
.
getKey
();
/**
@ApiModelProperty
(
"人员类型, 默认接收人"
)
*
private
Integer
personType
=
EmailConstant
.
TYPE_EMAIL_RECEIVE
;
* 收件箱
@ApiModelProperty
(
"是否个人邮件,默认是"
)
* folderId = 1
private
Integer
isPerson
=
WhetherEnum
.
YES
.
getKey
();
* personType = 2
@ApiModelProperty
(
"是否已发送, 默认是"
)
* isPerson =1
private
Integer
isSend
=
WhetherEnum
.
YES
.
getKey
();
* isSend = 1
* searchRange = 0
* 部门邮件
* folderId = 2
* personType = 2
* isPerson =0
* isSend = 1
* searchRange = 0
* 草稿箱
* folderId = 3
* personType = 1
* isPerson =1
* isSend = 0
* searchRange = 0
* 已发送
* folderId = 4
* personType = 1
* isPerson =1
* isSend = 1
* searchRange = 0
* 回收站
* folderId = 5
* personType = 2
* isSend = 1
* searchRange = 0
* 其他文件夹
* folderId = 前端根据点击传入
* searchRange = 0
*/
@ApiModelProperty
(
value
=
"文件夹ID"
)
private
Integer
folderId
;
@ApiModelProperty
(
"人员类型"
)
private
Integer
personType
;
@ApiModelProperty
(
"是否个人邮件"
)
private
Integer
isPerson
;
@ApiModelProperty
(
"是否已发送"
)
private
Integer
isSend
;
@ApiModelProperty
(
"查询范围,默认最近三个月"
)
@ApiModelProperty
(
"查询范围,默认最近三个月"
)
private
Integer
searchRange
=
SearchRangeEnum
.
LAST_THREE_MONTHS
.
getKey
()
;
private
Integer
searchRange
=
0
;
}
}
src/main/java/com/zq/email/vo/EmailTaskVo.java
0 → 100644
View file @
6ee498e4
package
com
.
zq
.
email
.
vo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Api
(
"设置任务邮件"
)
@Data
public
class
EmailTaskVo
{
@ApiModelProperty
(
"contentId集合"
)
private
List
<
Long
>
contentId
;
@ApiModelProperty
(
"0:否 1:是"
)
private
Integer
isTask
;
}
src/main/java/com/zq/email/vo/EmlFileVo.java
0 → 100644
View file @
6ee498e4
package
com
.
zq
.
email
.
vo
;
import
lombok.Data
;
@Data
public
class
EmlFileVo
{
private
String
downloadPath
;
private
String
emailTitle
;
}
src/main/resources/application-dev.yml
View file @
6ee498e4
...
@@ -11,7 +11,7 @@ spring:
...
@@ -11,7 +11,7 @@ spring:
datasource
:
datasource
:
druid
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
db-type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:kingbase8://172.18.4.84:54321/
SEAL_PLATFOMR
url
:
jdbc:kingbase8://172.18.4.84:54321/
EMAIL_NEW
username
:
oa_system
username
:
oa_system
password
:
123456
password
:
123456
driver-class-name
:
com.kingbase8.Driver
driver-class-name
:
com.kingbase8.Driver
...
...
src/main/resources/application-local.yml
View file @
6ee498e4
...
@@ -11,7 +11,7 @@ spring:
...
@@ -11,7 +11,7 @@ spring:
datasource
:
datasource
:
druid
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
db-type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:kingbase8://1
27.0.0.1:54321/SEAL_PLATFOMR
url
:
jdbc:kingbase8://1
72.18.4.84:54321/EMAIL_NEW
username
:
oa_system
username
:
oa_system
password
:
123456
password
:
123456
driver-class-name
:
com.kingbase8.Driver
driver-class-name
:
com.kingbase8.Driver
...
...
src/main/resources/application.yml
View file @
6ee498e4
...
@@ -22,6 +22,8 @@ mybatis-plus:
...
@@ -22,6 +22,8 @@ mybatis-plus:
db-config
:
db-config
:
select-strategy
:
not_empty
select-strategy
:
not_empty
update-strategy
:
not_empty
update-strategy
:
not_empty
configuration
:
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
#日志
#日志
logging
:
logging
:
config
:
classpath:logback-spring.xml
config
:
classpath:logback-spring.xml
...
@@ -29,3 +31,4 @@ logging:
...
@@ -29,3 +31,4 @@ logging:
src/main/resources/bootstrap.yml
View file @
6ee498e4
...
@@ -4,7 +4,7 @@ spring:
...
@@ -4,7 +4,7 @@ spring:
cloud
:
cloud
:
config
:
config
:
name
:
config
name
:
config
profile
:
${spring.profiles.active}
profile
:
dev
discovery
:
discovery
:
enabled
:
true
enabled
:
true
service-id
:
CONFIG-SERVER
service-id
:
CONFIG-SERVER
...
...
src/main/resources/logback-spring.xml
View file @
6ee498e4
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
<contextName>
logback
</contextName>
<contextName>
logback
</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property
name=
"log.path"
value=
"/data/services/email/logs/"
/>
<property
name=
"log.path"
value=
"/data/services/email
_mail
/logs/"
/>
<!-- <property name="log.path" value="D:/seallog/"/>-->
<!-- <property name="log.path" value="D:/seallog/"/>-->
<!--主要日志文件名-->
<!--主要日志文件名-->
<property
name=
"default_log_file"
value=
"email"
/>
<property
name=
"default_log_file"
value=
"email
_new
"
/>
<!-- 彩色日志 -->
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<!-- 彩色日志依赖的渲染类 -->
...
...
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