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
3e5c0442
Commit
3e5c0442
authored
Apr 16, 2024
by
陈天仲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
邮件外部接口
parent
11e11eb1
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
274 additions
and
93 deletions
+274
-93
pom.xml
+1
-1
src/main/java/com/zq/email/controller/EmailAttachController.java
+72
-0
src/main/java/com/zq/email/controller/EmailManageController.java
+2
-2
src/main/java/com/zq/email/controller/EmailPersonController.java
+14
-0
src/main/java/com/zq/email/feign/AdminFeignClient.java
+0
-2
src/main/java/com/zq/email/mapper/EmailPersonMapper.java
+2
-0
src/main/java/com/zq/email/service/IEmailAttachService.java
+2
-0
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
+79
-67
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
+9
-7
src/main/java/com/zq/email/utils/SmsUtil.java
+4
-4
src/main/java/com/zq/email/vo/EmailEditVo.java
+7
-3
src/main/resources/application-dev.yml
+4
-2
src/main/resources/application-test.yml
+5
-3
src/main/resources/bootstrap.yml
+4
-2
src/main/resources/logback-spring.xml
+8
-0
src/main/resources/mapper/EmailPersonMapper.xml
+61
-0
No files found.
pom.xml
View file @
3e5c0442
...
...
@@ -278,7 +278,7 @@
<properties>
<profiles.active>
wanpro
</profiles.active>
<logging.level>
info
</logging.level>
<eureka.server.url>
http://admin:GXfy2021@1
72.28.1
.71:8800/eureka/
</eureka.server.url>
<eureka.server.url>
http://admin:GXfy2021@1
92.168.143
.71:8800/eureka/
</eureka.server.url>
</properties>
</profile>
</profiles>
...
...
src/main/java/com/zq/email/controller/EmailAttachController.java
View file @
3e5c0442
package
com
.
zq
.
email
.
controller
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.IoUtil
;
...
...
@@ -17,6 +18,9 @@ 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.common.vo.UploadFileListRespVo
;
import
com.zq.common.vo.UploadFileRespVo
;
import
com.zq.email.constants.EmailConstant
;
import
com.zq.email.entity.EmailAttach
;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.entity.EmailPerson
;
...
...
@@ -25,6 +29,7 @@ import com.zq.email.service.IEmailAttachService;
import
com.zq.email.vo.EmailDetailVo
;
import
com.zq.email.vo.FileViewVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -33,6 +38,7 @@ import org.springframework.core.io.Resource;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.Assert
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -42,6 +48,7 @@ import java.io.OutputStream;
import
java.net.URLEncoder
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -189,5 +196,70 @@ public class EmailAttachController {
}
@ApiOperation
(
"上传附件"
)
@PostMapping
(
"upload"
)
public
ResultVo
upload
(
MultipartFile
[]
fileList
)
{
AssertUtils
.
notEmpty
(
fileList
,
"文件不能为空"
);
OnlineUserDto
adminContext
=
TokenUtils
.
getAdminContext
();
AssertUtils
.
notNull
(
adminContext
,
"登录已失效,请重新登录后再次尝试!"
);
ResultVo
<
UploadFileListRespVo
>
uploadFileListRespVoResultVo
=
fileFeignClient
.
uploadFileList
(
fileList
,
EmailConstant
.
SYSTEM_TAG
,
adminContext
.
getUserId
(),
null
);
AssertUtils
.
isTrue
(
uploadFileListRespVoResultVo
.
isSuccess
(),
"上传附件到文件服务失败"
);
AssertUtils
.
notNull
(
uploadFileListRespVoResultVo
.
getData
(),
"附件保存到文件服务失败"
);
List
<
EmailAttach
>
attaches
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
uploadFileListRespVoResultVo
.
getData
().
getUploadFileRespVos
())){
for
(
UploadFileRespVo
uploadFileRespVo
:
uploadFileListRespVoResultVo
.
getData
().
getUploadFileRespVos
())
{
EmailAttach
attach
=
new
EmailAttach
();
attach
.
setAttachId
(
uploadFileRespVo
.
getId
());
attach
.
setAttachName
(
uploadFileRespVo
.
getFileName
());
attach
.
setAttachSize
(
uploadFileRespVo
.
getSize
());
attach
.
setDownloadPath
(
uploadFileRespVo
.
getDownloadPath
());
attaches
.
add
(
attach
);
}
}
return
ResultVo
.
success
(
attaches
);
}
@ApiOperation
(
"草稿箱上传附件"
)
@PostMapping
(
"upload2"
)
public
ResultVo
upload
(
@RequestParam
(
"fileList"
)
MultipartFile
[]
fileList
,
@RequestParam
(
"businessId"
)
Long
businessId
)
{
AssertUtils
.
notEmpty
(
fileList
,
"文件不能为空"
);
OnlineUserDto
adminContext
=
TokenUtils
.
getAdminContext
();
AssertUtils
.
notNull
(
adminContext
,
"登录已失效,请重新登录后再次尝试!"
);
ResultVo
<
UploadFileListRespVo
>
uploadFileListRespVoResultVo
=
fileFeignClient
.
uploadFileList
(
fileList
,
EmailConstant
.
SYSTEM_TAG
,
adminContext
.
getUserId
(),
String
.
valueOf
(
businessId
));
AssertUtils
.
isTrue
(
uploadFileListRespVoResultVo
.
isSuccess
(),
"上传附件到文件服务失败"
);
AssertUtils
.
notNull
(
uploadFileListRespVoResultVo
.
getData
(),
"附件保存到文件服务失败"
);
List
<
EmailAttach
>
attaches
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
uploadFileListRespVoResultVo
.
getData
().
getUploadFileRespVos
())){
for
(
UploadFileRespVo
uploadFileRespVo
:
uploadFileListRespVoResultVo
.
getData
().
getUploadFileRespVos
())
{
EmailAttach
attach
=
new
EmailAttach
();
attach
.
setEmailContentId
(
businessId
);
attach
.
setAttachId
(
uploadFileRespVo
.
getId
());
attach
.
setAttachName
(
uploadFileRespVo
.
getFileName
());
attach
.
setAttachSize
(
uploadFileRespVo
.
getSize
());
attach
.
setDownloadPath
(
uploadFileRespVo
.
getDownloadPath
());
this
.
emailAttachService
.
save
(
attach
);
attaches
.
add
(
attach
);
}
}
return
ResultVo
.
success
(
attaches
);
}
@ApiOperation
(
"删除附件"
)
@PostMapping
(
"delete"
)
public
ResultVo
delete
(
@RequestParam
(
value
=
"id"
,
required
=
false
)
Long
id
,
@RequestParam
(
"attachId"
)
String
attachId
)
{
if
(
ObjectUtil
.
isNotEmpty
(
id
)){
this
.
emailAttachService
.
removeById
(
id
);
}
//fileFeignClient.
return
ResultVo
.
success
();
}
}
src/main/java/com/zq/email/controller/EmailManageController.java
View file @
3e5c0442
...
...
@@ -48,7 +48,7 @@ public class EmailManageController {
@PostMapping
(
"total"
)
public
ResultVo
total
(
@RequestBody
EmailSearchReqVo
vo
)
{
vo
.
setFolderId
(
EmailFolderEnum
.
FOLDER_ALREADY_SEND
.
getKey
());
AssertUtils
.
notNull
(
vo
.
getSendUserId
(),
"缺少参数:sendUserId"
);
//
AssertUtils.notNull(vo.getSendUserId(), "缺少参数:sendUserId");
return
ResultVo
.
success
(
emailPersonService
.
emailManageCount
(
vo
));
}
...
...
@@ -56,7 +56,7 @@ public class EmailManageController {
@PostMapping
(
"page"
)
public
ResultVo
page
(
@RequestBody
EmailSearchReqVo
vo
)
{
vo
.
setFolderId
(
EmailFolderEnum
.
FOLDER_ALREADY_SEND
.
getKey
());
AssertUtils
.
notNull
(
vo
.
getSendUserId
(),
"缺少参数:sendUserId"
);
//
AssertUtils.notNull(vo.getSendUserId(), "缺少参数:sendUserId");
return
ResultVo
.
success
(
emailPersonService
.
emailManagePage
(
vo
));
}
...
...
src/main/java/com/zq/email/controller/EmailPersonController.java
View file @
3e5c0442
...
...
@@ -17,8 +17,12 @@ import lombok.RequiredArgsConstructor;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collector
;
import
java.util.stream.Collectors
;
/**
* <p>
...
...
@@ -111,6 +115,16 @@ public class EmailPersonController {
return
ResultVo
.
success
();
}
//20240403ltm
@ApiOperation
(
"邮件撤回(发件箱列表撤回使用,如果该邮件存在收件人已读无法撤回)"
)
@PostMapping
(
"recallEmailBatch"
)
public
ResultVo
recallEmailBatch
(
@RequestParam
(
value
=
"contentIds"
)
String
contentIds
)
{
for
(
String
contentId
:
contentIds
.
split
(
","
))
{
this
.
emailPersonService
.
recallEmail
(
Long
.
valueOf
(
contentId
));
}
return
ResultVo
.
success
();
}
@ApiOperation
(
"回收站恢复(列表)"
)
@PostMapping
(
"resumeEmail"
)
...
...
src/main/java/com/zq/email/feign/AdminFeignClient.java
View file @
3e5c0442
...
...
@@ -58,8 +58,6 @@ public interface AdminFeignClient {
@GetMapping
(
"/systemInfo/getBySystemTag/{systemTag}"
)
ResultVo
<
SystemInfo
>
getBySystemTag
(
@PathVariable
String
systemTag
);
@Log
(
"获取指定人员"
)
@ApiOperation
(
"获取指定人员"
)
@AnonymousGetMapping
(
"/users/getUserById/{userId}"
)
...
...
src/main/java/com/zq/email/mapper/EmailPersonMapper.java
View file @
3e5c0442
...
...
@@ -24,5 +24,7 @@ public interface EmailPersonMapper extends BaseMapper<EmailPerson> {
Page
<
EmailPerson
>
selectSearchPage
(
Page
<
EmailPerson
>
page
,
@Param
(
"s"
)
EmailSearchReqVo
vo
);
Page
<
EmailPerson
>
selectSearchPage2
(
Page
<
EmailPerson
>
page
,
@Param
(
"s"
)
EmailSearchReqVo
vo
);
List
<
Person
>
recentlyContacts
(
List
<
Long
>
recentlySendEmail
,
Integer
personType
,
Integer
isSend
,
Integer
isPerson
);
}
src/main/java/com/zq/email/service/IEmailAttachService.java
View file @
3e5c0442
...
...
@@ -21,6 +21,8 @@ public interface IEmailAttachService extends IService<EmailAttach> {
List
<
EmailAttach
>
saveAttach
(
EmailEditVo
vo
,
EmailContent
content
);
List
<
EmailAttach
>
saveAttach2
(
List
<
EmailAttach
>
emailAttachList
,
EmailContent
content
);
List
<
EmailAttach
>
findByContentId
(
Long
contentId
);
String
getDownloadPath
(
Long
id
);
...
...
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
View file @
3e5c0442
...
...
@@ -58,77 +58,89 @@ public class EmailAttachServiceImpl extends ServiceImpl<EmailAttachMapper, Email
List
<
EmailAttach
>
list
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getFileIds
()))
{
for
(
String
fileId
:
vo
.
getFileIds
())
{
//先判断是不是旧附件
LambdaQueryWrapper
<
EmailAttach
>
eq
=
Wrappers
.
lambdaQuery
(
EmailAttach
.
class
)
.
eq
(
EmailAttach:
:
getAttachId
,
fileId
);
EmailAttach
emailAttach
=
this
.
getOne
(
eq
,
false
);
if
(
emailAttach
!=
null
){
if
(
StrUtil
.
isNotBlank
(
emailAttach
.
getDownloadPath
())){
ResultVo
<
SysFileUploadVo
>
uploadFileById
=
fileFeignClient
.
copyFile
(
fileId
,
EmailConstant
.
SYSTEM_TAG
);
//ResultVo<SysFileUploadVo> uploadFileById = fileFeignClient.getUploadFileById(fileId);
if
(
uploadFileById
.
isSuccess
()
&&
uploadFileById
.
getData
()!=
null
){
SysFileUploadVo
data
=
uploadFileById
.
getData
();
EmailAttach
newAttach
=
EmailAttach
.
builder
()
.
emailContentId
(
content
.
getId
())
.
attachId
(
data
.
getId
())
.
attachName
(
data
.
getFileName
())
.
attachSize
(
data
.
getSize
())
.
downloadPath
(
data
.
getDownloadPath
())
.
sendTime
(
content
.
getSendTime
())
.
build
();
list
.
add
(
newAttach
);
}
}
else
{
EmailAttach
newAttach
=
EmailAttach
.
builder
()
.
emailContentId
(
content
.
getId
())
.
attachId
(
emailAttach
.
getAttachId
())
.
attachName
(
emailAttach
.
getAttachName
())
//.attachSize(emailAttach.getAttachSize())
//.downloadPath(emailAttach.getDownloadPath())
.
sendTime
(
emailAttach
.
getSendTime
())
.
build
();
list
.
add
(
newAttach
);
}
}
}
}
//先检查旧附件
this
.
lambdaUpdate
().
eq
(
EmailAttach:
:
getEmailContentId
,
content
.
getId
()).
remove
();
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getFileList
()))
{
ResultVo
<
UploadFileListRespVo
>
uploadFileListRespVoResultVo
=
fileFeignClient
.
uploadFileList
(
vo
.
getFileList
().
toArray
(
new
MultipartFile
[
vo
.
getFileList
().
size
()]),
EmailConstant
.
SYSTEM_TAG
,
content
.
getSendUserId
(),
String
.
valueOf
(
content
.
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
(
content
.
getId
())
.
attachId
(
uploadFileRespVo
.
getId
())
.
attachName
(
uploadFileRespVo
.
getFileName
())
.
attachSize
(
uploadFileRespVo
.
getSize
())
.
downloadPath
(
uploadFileRespVo
.
getDownloadPath
())
.
sendTime
(
content
.
getSendTime
())
.
build
();
list
.
add
(
emailAttach
);
}
}
this
.
saveBatch
(
list
);
//
if(CollectionUtil.isNotEmpty(vo.getFileIds())) {
//
//
for (String fileId : vo.getFileIds()) {
//
//先判断是不是旧附件
//
LambdaQueryWrapper<EmailAttach> eq = Wrappers.lambdaQuery(EmailAttach.class)
//
.eq(EmailAttach::getAttachId, fileId);
//
EmailAttach emailAttach = this.getOne(eq, false);
//
//
if (emailAttach!=null){
//
if (StrUtil.isNotBlank(emailAttach.getDownloadPath())){
//
ResultVo<SysFileUploadVo> uploadFileById = fileFeignClient.copyFile(fileId, EmailConstant.SYSTEM_TAG);
//
//ResultVo<SysFileUploadVo> uploadFileById = fileFeignClient.getUploadFileById(fileId);
//
if (uploadFileById.isSuccess() && uploadFileById.getData()!=null){
//
SysFileUploadVo data = uploadFileById.getData();
//
EmailAttach newAttach = EmailAttach.builder()
//
.emailContentId(content.getId())
//
.attachId(data.getId())
//
.attachName(data.getFileName())
//
.attachSize(data.getSize())
//
.downloadPath(data.getDownloadPath())
//
.sendTime(content.getSendTime())
//
.build();
//
list.add(newAttach);
//
}
//
}else{
//
EmailAttach newAttach = EmailAttach.builder()
//
.emailContentId(content.getId())
//
.attachId(emailAttach.getAttachId())
//
.attachName(emailAttach.getAttachName())
//
//.attachSize(emailAttach.getAttachSize())
//
//.downloadPath(emailAttach.getDownloadPath())
//
.sendTime(emailAttach.getSendTime())
//
.build();
//
list.add(newAttach);
//
}
//
//
}
//
}
//
}
//
//先检查旧附件
//
this.lambdaUpdate().eq(EmailAttach::getEmailContentId, content.getId()).remove();
//
//
//
//
if(CollectionUtil.isNotEmpty(vo.getFileList())) {
//
ResultVo<UploadFileListRespVo> uploadFileListRespVoResultVo = fileFeignClient.uploadFileList(vo.getFileList().toArray(new MultipartFile[vo.getFileList().size()]),
//
EmailConstant.SYSTEM_TAG,
//
content.getSendUserId(),
//
String.valueOf(content.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(content.getId())
//
.attachId(uploadFileRespVo.getId())
//
.attachName(uploadFileRespVo.getFileName())
//
.attachSize(uploadFileRespVo.getSize())
//
.downloadPath(uploadFileRespVo.getDownloadPath())
//
.sendTime(content.getSendTime())
//
.build();
//
list.add(emailAttach);
//
}
//
}
//
this.saveBatch(list);
return
list
;
}
@Override
public
List
<
EmailAttach
>
saveAttach2
(
List
<
EmailAttach
>
emailAttachList
,
EmailContent
content
)
{
for
(
EmailAttach
emailAttach
:
emailAttachList
)
{
emailAttach
.
setEmailContentId
(
content
.
getId
());
}
this
.
saveBatch
(
emailAttachList
);
return
emailAttachList
;
}
@Override
public
List
<
EmailAttach
>
findByContentId
(
Long
contentId
)
{
List
<
EmailAttach
>
attaches
=
new
ArrayList
<>();
List
<
EmailAttach
>
list
=
this
.
lambdaQuery
().
eq
(
EmailAttach:
:
getEmailContentId
,
contentId
).
orderByAsc
(
EmailAttach:
:
getId
).
list
();
...
...
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
View file @
3e5c0442
...
...
@@ -191,7 +191,8 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
Page
<
EmailPerson
>
page
=
new
Page
<>(
vo
.
getPage
(),
vo
.
getSize
());
page
.
setSearchCount
(
false
).
setOptimizeCountSql
(
false
);
page
=
this
.
baseMapper
.
selectSearchPage
(
page
,
vo
);
page
=
this
.
baseMapper
.
selectSearchPage2
(
page
,
vo
);
if
(
page
!=
null
&&
page
.
getRecords
()!=
null
){
for
(
EmailPerson
person
:
page
.
getRecords
())
{
EmailContent
content
=
this
.
emailContentService
.
getById
(
person
.
getEmailContentId
());
...
...
@@ -200,6 +201,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
person
.
setEmailAttachList
(
this
.
emailAttachService
.
findByContentId
(
content
.
getId
()));
person
.
setReceiverList
(
this
.
findReceiverByContentId
(
content
.
getId
(),
null
));
}
//发送人头像
ResultVo
<
UserDto
>
senderVo
=
adminFeignClient
.
findById
(
content
.
getSendUserId
());
if
(
senderVo
.
isSuccess
()
&&
senderVo
.
getData
()
!=
null
){
...
...
@@ -233,7 +235,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
EmailContent
content
=
emailContentService
.
saveContent
(
vo
,
adminContext
);
if
(
content
!=
null
)
{
//附件
List
<
EmailAttach
>
emailAttaches
=
emailAttachService
.
saveAttach
(
vo
,
content
);
List
<
EmailAttach
>
emailAttaches
=
emailAttachService
.
saveAttach
2
(
vo
.
getAttaches
()
,
content
);
//是否存在附件
Integer
whether
=
CollectionUtil
.
isNotEmpty
(
emailAttaches
)
?
WhetherEnum
.
YES
.
getKey
()
:
WhetherEnum
.
NO
.
getKey
();
content
.
setIsFile
(
whether
);
...
...
@@ -258,7 +260,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
this
.
saveEmailReceiver
(
receiverList
,
content
,
EmailFolderEnum
.
FOLDER_INBOX
.
getKey
().
longValue
(),
WhetherEnum
.
YES
.
getKey
(),
vo
.
getIsSend
());
//发送短信
if
(
vo
.
getIsSend
().
equals
(
WhetherEnum
.
YES
.
getKey
())
&&
content
.
getSmsRemind
().
equals
(
WhetherEnum
.
YES
.
getKey
()))
{
smsUtil
.
sendBatchSms
(
receiverList
,
"您有一份来自"
+
content
.
getSendUserName
()+
"的邮件: "
+
content
.
getTitle
()
+
"。"
,
content
.
getId
());
smsUtil
.
sendBatchSms
(
receiverList
,
"您有一份来自"
+
content
.
getSendUserName
()+
"的邮件: "
+
content
.
getTitle
()
,
content
.
getId
(),
content
.
getSendUserEmail
());
}
//代办
if
(
vo
.
getIsSend
().
equals
(
WhetherEnum
.
YES
.
getKey
())
&&
(
content
.
getMessageRemind
()
!=
null
&&
content
.
getMessageRemind
().
equals
(
WhetherEnum
.
YES
.
getKey
())))
{
...
...
@@ -278,7 +280,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
this
.
saveEmailReceiver
(
deptUserList
,
content
,
EmailFolderEnum
.
FOLDER_DEPT_INBOX
.
getKey
().
longValue
(),
WhetherEnum
.
NO
.
getKey
(),
vo
.
getIsSend
());
//短信
if
(
vo
.
getIsSend
().
equals
(
WhetherEnum
.
YES
.
getKey
())
&&
content
.
getSmsRemind
().
equals
(
WhetherEnum
.
YES
.
getKey
())){
smsUtil
.
sendBatchSms
(
deptUserList
,
"您有一份来自"
+
content
.
getSendUserName
()+
"的邮件: "
+
content
.
getTitle
()
+
"。"
,
content
.
getId
());
smsUtil
.
sendBatchSms
(
deptUserList
,
"您有一份来自"
+
content
.
getSendUserName
()+
"的邮件: "
+
content
.
getTitle
()
,
content
.
getId
(),
content
.
getSendUserEmail
());
}
//代办
if
(
vo
.
getIsSend
().
equals
(
WhetherEnum
.
YES
.
getKey
())
&&
content
.
getMessageRemind
().
equals
(
WhetherEnum
.
YES
.
getKey
()))
{
...
...
@@ -951,7 +953,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
ArrayList
<
CustomerUserVo
>
toUserList
=
ListUtil
.
toList
(
toUserSet
);
this
.
saveEmailReceiver2
(
toUserList
,
content
,
EmailFolderEnum
.
FOLDER_INBOX
.
getKey
().
longValue
(),
WhetherEnum
.
YES
.
getKey
(),
WhetherEnum
.
YES
.
getKey
());
//短信
smsUtil
.
sendBatchSms2
(
toUserList
,
"您有一封新的邮件,标题为《"
+
content
.
getTitle
()
+
"》。请及时查收。"
,
content
.
getId
());
smsUtil
.
sendBatchSms2
(
toUserList
,
"您有一封新的邮件,标题为《"
+
content
.
getTitle
()
+
"》。请及时查收。"
,
content
.
getId
()
,
content
.
getSendUserEmail
()
);
//代办
msgUtil
.
sendMsg3
(
fromVo
.
getNickName
(),
content
,
toUserList
,
systemInfo
,
EmailFolderEnum
.
FOLDER_INBOX
.
getKey
());
return
content
;
...
...
@@ -984,7 +986,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
if
(
CollectionUtil
.
isNotEmpty
(
receiverList
)){
this
.
saveEmailReceiver2
(
receiverList
,
content
,
EmailFolderEnum
.
FOLDER_INBOX
.
getKey
().
longValue
(),
WhetherEnum
.
YES
.
getKey
(),
WhetherEnum
.
YES
.
getKey
());
if
(
vo
.
getIsSend
().
equals
(
WhetherEnum
.
YES
.
getKey
())
&&
content
.
getSmsRemind
().
equals
(
WhetherEnum
.
YES
.
getKey
()))
{
smsUtil
.
sendBatchSms2
(
receiverList
,
"您有一封新的邮件,标题为《"
+
content
.
getTitle
()
+
"》。请及时查收。"
,
content
.
getId
());
smsUtil
.
sendBatchSms2
(
receiverList
,
"您有一封新的邮件,标题为《"
+
content
.
getTitle
()
+
"》。请及时查收。"
,
content
.
getId
()
,
content
.
getSendUserEmail
()
);
}
if
(
vo
.
getIsSend
().
equals
(
WhetherEnum
.
YES
.
getKey
())
&&
content
.
getMessageRemind
().
equals
(
WhetherEnum
.
YES
.
getKey
()))
{
msgUtil
.
sendMsg3
(
byId
.
getNickName
(),
content
,
receiverList
,
systemInfo
,
EmailFolderEnum
.
FOLDER_INBOX
.
getKey
());
...
...
@@ -1018,7 +1020,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
if
(
CollectionUtil
.
isNotEmpty
(
deptUserList
)){
this
.
saveEmailReceiver2
(
deptUserList
,
content
,
EmailFolderEnum
.
FOLDER_DEPT_INBOX
.
getKey
().
longValue
(),
WhetherEnum
.
NO
.
getKey
(),
WhetherEnum
.
YES
.
getKey
());
if
(
vo
.
getIsSend
().
equals
(
WhetherEnum
.
YES
.
getKey
())
&&
content
.
getSmsRemind
().
equals
(
WhetherEnum
.
YES
.
getKey
()))
{
smsUtil
.
sendBatchSms2
(
deptUserList
,
"您有一封新的邮件,标题为《"
+
content
.
getTitle
()
+
"》。请及时查收。"
,
content
.
getId
());
smsUtil
.
sendBatchSms2
(
deptUserList
,
"您有一封新的邮件,标题为《"
+
content
.
getTitle
()
+
"》。请及时查收。"
,
content
.
getId
()
,
content
.
getSendUserEmail
()
);
}
if
(
vo
.
getIsSend
().
equals
(
WhetherEnum
.
YES
.
getKey
())
&&
content
.
getMessageRemind
().
equals
(
WhetherEnum
.
YES
.
getKey
()))
{
msgUtil
.
sendMsg3
(
byId
.
getNickName
(),
content
,
deptUserList
,
systemInfo
,
EmailFolderEnum
.
FOLDER_DEPT_INBOX
.
getKey
());
...
...
src/main/java/com/zq/email/utils/SmsUtil.java
View file @
3e5c0442
...
...
@@ -39,7 +39,7 @@ public class SmsUtil {
* @return
*/
@Async
public
void
sendBatchSms
(
List
<
UserDto
>
userVoList
,
String
content
,
Long
contentId
)
{
public
void
sendBatchSms
(
List
<
UserDto
>
userVoList
,
String
content
,
Long
contentId
,
String
sendUsername
)
{
String
regex
=
"^1[3-9]\\d{9}"
;
StringBuffer
sb
=
new
StringBuffer
();
for
(
UserDto
userVo
:
userVoList
)
{
...
...
@@ -51,7 +51,7 @@ public class SmsUtil {
if
(
sb
.
length
()
>
0
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"phones"
,
Base64
.
encode
(
sb
.
toString
().
getBytes
()));
map
.
put
(
"fromId"
,
Base64
.
encode
(
"oa_email"
.
getBytes
()));
map
.
put
(
"fromId"
,
Base64
.
encode
(
sendUsername
.
getBytes
()));
map
.
put
(
"content"
,
Base64
.
encode
(
content
.
getBytes
()));
map
.
put
(
"isReply"
,
Base64
.
encode
(
"0"
.
getBytes
()));
String
param
=
JSONUtil
.
toJsonStr
(
map
);
...
...
@@ -66,7 +66,7 @@ public class SmsUtil {
* @return
*/
@Async
public
void
sendBatchSms2
(
List
<
CustomerUserVo
>
userVoList
,
String
content
,
Long
contentId
)
{
public
void
sendBatchSms2
(
List
<
CustomerUserVo
>
userVoList
,
String
content
,
Long
contentId
,
String
sendUsername
)
{
String
regex
=
"^1[3-9]\\d{9}"
;
StringBuffer
sb
=
new
StringBuffer
();
for
(
CustomerUserVo
userVo
:
userVoList
)
{
...
...
@@ -78,7 +78,7 @@ public class SmsUtil {
if
(
sb
.
length
()
>
0
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"phones"
,
Base64
.
encode
(
sb
.
toString
().
getBytes
()));
map
.
put
(
"fromId"
,
Base64
.
encode
(
"oa_email"
.
getBytes
()));
map
.
put
(
"fromId"
,
Base64
.
encode
(
sendUsername
.
getBytes
()));
map
.
put
(
"content"
,
Base64
.
encode
(
content
.
getBytes
()));
map
.
put
(
"isReply"
,
Base64
.
encode
(
"0"
.
getBytes
()));
String
param
=
JSONUtil
.
toJsonStr
(
map
);
...
...
src/main/java/com/zq/email/vo/EmailEditVo.java
View file @
3e5c0442
package
com
.
zq
.
email
.
vo
;
import
com.zq.email.entity.EmailAttach
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
...
...
@@ -41,8 +42,8 @@ public class EmailEditVo {
@ApiModelProperty
(
"提醒方式"
)
private
List
<
Integer
>
remind
;
@ApiModelProperty
(
"附件id"
)
private
List
<
String
>
fileIds
;
//
@ApiModelProperty("附件id")
//
private List<String> fileIds;
@ApiModelProperty
(
"回复短信id"
)
private
Long
replyId
;
...
...
@@ -56,6 +57,9 @@ public class EmailEditVo {
@ApiModelProperty
(
"是否发送 0:发件箱 1:发送"
)
private
Integer
isSend
=
0
;
// @ApiModelProperty("附件")
// private List<MultipartFile> fileList;
@ApiModelProperty
(
"附件"
)
private
List
<
MultipartFile
>
fileList
;
private
List
<
EmailAttach
>
attaches
;
}
src/main/resources/application-dev.yml
View file @
3e5c0442
...
...
@@ -34,8 +34,10 @@ spring:
enabled
:
true
url-pattern
:
/druid/*
reset-enable
:
false
login-username
:
'
{cipher}de5d7ff75d4535cfc661426dd13202776c6af08f48bd46640e3d8de415bc8fad'
login-password
:
'
{cipher}365d86c1efeee8a078231d809bead42416df81d969c0f70d7815094b3e526e9c'
# login-username: '{cipher}de5d7ff75d4535cfc661426dd13202776c6af08f48bd46640e3d8de415bc8fad'
# login-password: '{cipher}365d86c1efeee8a078231d809bead42416df81d969c0f70d7815094b3e526e9c'
login-username
:
gxxc
login-password
:
GXxc@123
allow
:
127.0.0.1,147.1.*.*
filter
:
stat
:
...
...
src/main/resources/application-test.yml
View file @
3e5c0442
...
...
@@ -3,7 +3,7 @@ spring:
datasource
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
driverClassName
:
${jdbc.driver-class-name}
driverClassName
:
${jdbc.d
b1.d
river-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
...
...
@@ -34,8 +34,10 @@ spring:
enabled
:
true
url-pattern
:
/druid/*
reset-enable
:
false
login-username
:
'
{cipher}de5d7ff75d4535cfc661426dd13202776c6af08f48bd46640e3d8de415bc8fad'
login-password
:
'
{cipher}365d86c1efeee8a078231d809bead42416df81d969c0f70d7815094b3e526e9c'
# login-username: '{cipher}de5d7ff75d4535cfc661426dd13202776c6af08f48bd46640e3d8de415bc8fad'
# login-password: '{cipher}365d86c1efeee8a078231d809bead42416df81d969c0f70d7815094b3e526e9c'
login-username
:
gxxc
login-password
:
GXxc@123
allow
:
127.0.0.1,147.1.*.*
filter
:
stat
:
...
...
src/main/resources/bootstrap.yml
View file @
3e5c0442
...
...
@@ -8,8 +8,10 @@ spring:
discovery
:
enabled
:
true
service-id
:
CONFIG-SERVER
username
:
'
{cipher}6d5973291f0ee0a10758022d3e8f89e4eb9d4e18cb8e3b991d3851de4315ad7e'
password
:
'
{cipher}5a13ab499d94e634ac4132bb050e8251a2053698cef2ca68240f3c8a1569fdd9'
# username: '{cipher}6d5973291f0ee0a10758022d3e8f89e4eb9d4e18cb8e3b991d3851de4315ad7e'
# password: '{cipher}5a13ab499d94e634ac4132bb050e8251a2053698cef2ca68240f3c8a1569fdd9'
username
:
admin
password
:
GXfy2021
eureka
:
instance
:
...
...
src/main/resources/logback-spring.xml
View file @
3e5c0442
...
...
@@ -14,6 +14,7 @@
<!-- 彩色日志格式 -->
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"
/>
<!--输出到控制台-->
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
...
...
@@ -27,6 +28,13 @@
</encoder>
</appender>
<!-- <!– logstash –>-->
<!-- <appender name="stash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">-->
<!-- <destination>172.18.4.171:5044</destination>-->
<!-- <!– encoder必须配置,有多种可选 –>-->
<!-- <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder" />-->
<!-- </appender>-->
<!--输出到文件-->
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender
name=
"DEBUG_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
...
...
src/main/resources/mapper/EmailPersonMapper.xml
View file @
3e5c0442
...
...
@@ -95,6 +95,11 @@
<select
id=
"selectSearchPage"
resultType=
"com.zq.email.entity.EmailPerson"
parameterType=
"com.zq.email.vo.EmailSearchReqVo"
>
SELECT
EP1.*
FROM
...
...
@@ -187,6 +192,62 @@
</select>
<select
id=
"selectSearchPage2"
resultType=
"com.zq.email.entity.EmailPerson"
parameterType=
"com.zq.email.vo.EmailSearchReqVo"
>
SELECT
EP.*
FROM
"EMAIL_PERSON" EP
<where>
<if
test=
"s.sendUserId != null or (s.title!=null and s.title!='') or (s.content!=null and s.content!='')"
>
AND EP."EMAIL_CONTENT_ID" IN(
SELECT
EC."ID"
FROM
"EMAIL_CONTENT" EC
<where>
<if
test=
"s.sendUserId != null"
>
AND EC."SEND_USER_ID" = #{s.sendUserId}
</if>
<if
test=
"s.title != null and s.title !='' "
>
AND EC."TITLE" LIKE concat('%', #{s.title}, '%')
</if>
<if
test=
"s.content != null and s.content !='' "
>
AND EC."CONTENT" LIKE concat('%', #{s.content}, '%')
</if>
</where>
)
</if>
<if
test=
"s.startTime != null and s.endTime!=null "
>
AND EP."SEND_TIME"
>
= #{s.startTime}
AND EP."SEND_TIME"
<
= #{s.endTime}
</if>
<if
test=
"s.isRead != null"
>
AND EP."IS_READ" = #{s.isRead}
</if>
<if
test=
"s.receiveUserId != null"
>
AND EP."ID" IN(
SELECT
EP2."ID"
FROM
"EMAIL_PERSON" EP2
WHERE 1=1
AND EP2."PERSON_TYPE" = 2
AND EP2."IS_SEND" = 1
AND EP2."USER_ID" = #{s.receiveUserId}
)
</if>
</where>
</select>
<select
id=
"recentlyContacts"
resultType=
"com.zq.email.dto.Person"
>
SELECT
EP.USER_ID ID,
...
...
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