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
d86f2bdf
Commit
d86f2bdf
authored
Mar 09, 2023
by
chentianzhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提一个版本
parent
6ee498e4
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
262 additions
and
13 deletions
+262
-13
src/main/java/com/zq/email/controller/EmailContentController.java
+11
-0
src/main/java/com/zq/email/controller/EmailController.java
+1
-1
src/main/java/com/zq/email/controller/EmailOtherController.java
+15
-2
src/main/java/com/zq/email/controller/EmailPersonController.java
+34
-1
src/main/java/com/zq/email/entity/EmailContent.java
+4
-0
src/main/java/com/zq/email/entity/EmailPerson.java
+2
-0
src/main/java/com/zq/email/enums/EmailDegreeEnum.java
+75
-0
src/main/java/com/zq/email/service/IEmailContentService.java
+3
-0
src/main/java/com/zq/email/service/IEmailPersonService.java
+10
-0
src/main/java/com/zq/email/service/impl/EmailContentServiceImpl.java
+6
-0
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
+60
-8
src/main/java/com/zq/email/vo/EmailDegreeVo.java
+19
-0
src/main/java/com/zq/email/vo/EmailFolderMoveVo.java
+2
-0
src/main/java/com/zq/email/vo/EmailLastAndAfterReqVo.java
+1
-1
src/main/java/com/zq/email/vo/EmailSendVo.java
+19
-0
No files found.
src/main/java/com/zq/email/controller/EmailContentController.java
View file @
d86f2bdf
...
...
@@ -4,6 +4,7 @@ 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.EmailDegreeVo
;
import
com.zq.email.vo.EmailReqVo
;
import
com.zq.email.vo.EmailTaskVo
;
import
io.swagger.annotations.Api
;
...
...
@@ -42,4 +43,14 @@ public class EmailContentController {
return
ResultVo
.
success
();
}
@ApiOperation
(
"设置邮件紧急程度"
)
@PostMapping
(
"setDegreeEmail"
)
public
ResultVo
setDegreeEmail
(
@RequestBody
EmailDegreeVo
vo
)
{
AssertUtils
.
notEmpty
(
vo
.
getContentId
(),
"缺少参数: contentId"
);
AssertUtils
.
notNull
(
vo
.
getDegree
(),
"缺少参数: degree"
);
emailContentService
.
setDegreeEmail
(
vo
);
return
ResultVo
.
success
();
}
}
src/main/java/com/zq/email/controller/EmailController.java
View file @
d86f2bdf
...
...
@@ -161,7 +161,7 @@ public class EmailController {
@PostMapping
(
"afterEmail"
)
public
ResultVo
afterEmail
(
@RequestBody
EmailLastAndAfterReqVo
vo
)
{
AssertUtils
.
notNull
(
vo
.
getFolderId
(),
"缺少参数:folderId"
);
EmailPerson
person
=
this
.
emailPersonService
.
lastAndAfterEmail
(
vo
,
0
);
EmailPerson
person
=
this
.
emailPersonService
.
lastAndAfterEmail
(
vo
,
1
);
AssertUtils
.
notNull
(
person
,
"没有下一封了"
);
return
ResultVo
.
success
(
person
);
}
...
...
src/main/java/com/zq/email/controller/Email
Label
Controller.java
→
src/main/java/com/zq/email/controller/Email
Other
Controller.java
View file @
d86f2bdf
package
com
.
zq
.
email
.
controller
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.email.enums.EmailDegreeEnum
;
import
io.swagger.annotations.ApiOperation
;
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.RestController
;
import
java.util.List
;
/**
* <p>
* 前端控制器
...
...
@@ -14,7 +22,12 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2023-03-06
*/
@RestController
@RequestMapping
(
"/email/
emailLabel
"
)
public
class
Email
Label
Controller
{
@RequestMapping
(
"/email/
other
"
)
public
class
Email
Other
Controller
{
@ApiOperation
(
"获取紧急程度"
)
@PostMapping
(
"degreeList"
)
public
ResultVo
degreeList
()
{
return
ResultVo
.
success
(
EmailDegreeEnum
.
toList
());
}
}
src/main/java/com/zq/email/controller/EmailPersonController.java
View file @
d86f2bdf
...
...
@@ -9,6 +9,7 @@ import com.zq.email.service.IEmailPersonService;
import
com.zq.email.vo.EmailDetailVo
;
import
com.zq.email.vo.EmailFolderMoveVo
;
import
com.zq.email.vo.EmailReadVo
;
import
com.zq.email.vo.EmailSendVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -42,8 +43,15 @@ public class EmailPersonController {
}
@ApiOperation
(
"任务邮件回复详情"
)
@PostMapping
(
"findTaskEmailByContentId"
)
public
ResultVo
findTaskEmailByContentId
(
@RequestBody
EmailDetailVo
vo
)
{
AssertUtils
.
notNull
(
vo
.
getContentId
(),
"缺少参数:contentId"
);
return
ResultVo
.
success
(
emailPersonService
.
findTaskEmailByContentId
(
vo
.
getContentId
()));
}
@ApiOperation
(
"邮件收件人详情"
)
@PostMapping
(
"findReceiverByContentId"
)
@PostMapping
(
"findReceiverByContentId"
)
public
ResultVo
findReceiverByContentId
(
@RequestBody
EmailDetailVo
vo
)
{
AssertUtils
.
notNull
(
vo
.
getContentId
(),
"缺少参数:contentId"
);
return
ResultVo
.
success
(
emailPersonService
.
findReceiverByContentId
(
vo
.
getContentId
()));
...
...
@@ -81,6 +89,31 @@ public class EmailPersonController {
}
@ApiOperation
(
"单条记录收件记录撤回"
)
@PostMapping
(
"recallPerson"
)
public
ResultVo
recallPerson
(
@RequestBody
EmailSendVo
vo
)
{
this
.
emailPersonService
.
recallPerson
(
vo
);
return
ResultVo
.
success
();
}
@ApiOperation
(
"邮件撤回(只能撤回收件人未读的邮件)"
)
@PostMapping
(
"recallEmail"
)
public
ResultVo
recallEmail
(
@RequestParam
(
value
=
"contentId"
)
Long
contentId
)
{
this
.
emailPersonService
.
recallEmail
(
contentId
);
return
ResultVo
.
success
();
}
@ApiOperation
(
"回收站恢复"
)
@PostMapping
(
"resumeEmail"
)
public
ResultVo
resumeEmail
(
@RequestBody
List
<
Long
>
personIdList
)
{
this
.
emailPersonService
.
resumeEmail
(
personIdList
);
return
ResultVo
.
success
();
}
...
...
src/main/java/com/zq/email/entity/EmailContent.java
View file @
d86f2bdf
...
...
@@ -53,6 +53,10 @@ public class EmailContent implements Serializable {
private
Long
replyId
;
private
String
replyContent
;
private
String
userList
;
private
String
deptList
;
private
Integer
isTask
;
...
...
src/main/java/com/zq/email/entity/EmailPerson.java
View file @
d86f2bdf
...
...
@@ -55,6 +55,8 @@ public class EmailPerson implements Serializable {
private
Long
folderId
;
private
Long
oldFolderId
;
private
Integer
isRead
;
private
Integer
isSend
;
...
...
src/main/java/com/zq/email/enums/EmailDegreeEnum.java
0 → 100644
View file @
d86f2bdf
package
com
.
zq
.
email
.
enums
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 文件夹
*/
public
enum
EmailDegreeEnum
{
DEGREE_COMMON
(
0
,
"一般"
),
DEGREE_IMPORTANT
(
1
,
"紧急"
),
DEGREE_URGENT
(
2
,
"重要"
),
;
private
Integer
key
;
private
String
value
;
EmailDegreeEnum
(
Integer
key
,
String
value
)
{
this
.
key
=
key
;
this
.
value
=
value
;
}
public
static
EmailDegreeEnum
getEnumByKey
(
Integer
key
){
for
(
EmailDegreeEnum
value
:
EmailDegreeEnum
.
values
())
{
if
(
value
.
getKey
()
==
key
){
return
value
;
}
}
return
null
;
}
/**
* 根据keu获取秘密级别值
* @param key
* @return
*/
public
static
String
getValueByKey
(
Integer
key
)
{
for
(
EmailDegreeEnum
value
:
EmailDegreeEnum
.
values
())
{
if
(
value
.
getKey
().
equals
(
key
))
{
return
value
.
getValue
();
}
}
return
null
;
}
public
static
List
<
Map
<
Integer
,
String
>>
toList
(){
List
<
Map
<
Integer
,
String
>>
list
=
new
ArrayList
<>();
for
(
EmailDegreeEnum
degreeEnum
:
EmailDegreeEnum
.
values
())
{
Map
<
Integer
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
degreeEnum
.
getKey
(),
degreeEnum
.
getValue
());
list
.
add
(
map
);
}
return
list
;
}
public
Integer
getKey
()
{
return
key
;
}
public
void
setKey
(
Integer
key
)
{
this
.
key
=
key
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
src/main/java/com/zq/email/service/IEmailContentService.java
View file @
d86f2bdf
...
...
@@ -3,6 +3,7 @@ package com.zq.email.service;
import
com.zq.common.vo.OnlineUserDto
;
import
com.zq.email.entity.EmailContent
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zq.email.vo.EmailDegreeVo
;
import
com.zq.email.vo.EmailEditVo
;
import
com.zq.email.vo.EmailTaskVo
;
...
...
@@ -19,4 +20,6 @@ public interface IEmailContentService extends IService<EmailContent> {
EmailContent
saveContent
(
EmailEditVo
vo
,
OnlineUserDto
adminContext
);
void
setTaskEmail
(
EmailTaskVo
vo
);
void
setDegreeEmail
(
EmailDegreeVo
vo
);
}
src/main/java/com/zq/email/service/IEmailPersonService.java
View file @
d86f2bdf
...
...
@@ -32,6 +32,8 @@ public interface IEmailPersonService extends IService<EmailPerson> {
List
<
EmailPerson
>
findReceiverByContentId
(
Long
contentId
);
List
<
EmailPerson
>
findTaskEmailByContentId
(
Long
contentId
);
List
<
DeptSimpleDto
>
findReceiveDeptByContentId
(
Long
contentId
);
void
readAllEmails
(
Long
folderId
);
...
...
@@ -48,4 +50,12 @@ public interface IEmailPersonService extends IService<EmailPerson> {
// 0上一封 1下一封
EmailPerson
lastAndAfterEmail
(
EmailLastAndAfterReqVo
vo
,
Integer
type
);
void
recallPerson
(
EmailSendVo
vo
);
void
recallEmail
(
Long
contentId
);
void
resumeEmail
(
List
<
Long
>
personIdList
);
}
src/main/java/com/zq/email/service/impl/EmailContentServiceImpl.java
View file @
d86f2bdf
...
...
@@ -10,6 +10,7 @@ import com.zq.email.enums.WhetherEnum;
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.EmailTaskVo
;
import
net.bytebuddy.matcher.CollectionErasureMatcher
;
...
...
@@ -73,4 +74,9 @@ public class EmailContentServiceImpl extends ServiceImpl<EmailContentMapper, Ema
public
void
setTaskEmail
(
EmailTaskVo
vo
)
{
this
.
lambdaUpdate
().
in
(
EmailContent:
:
getId
,
vo
.
getContentId
()).
set
(
EmailContent:
:
getIsTask
,
vo
.
getIsTask
()).
update
();
}
@Override
public
void
setDegreeEmail
(
EmailDegreeVo
vo
)
{
this
.
lambdaUpdate
().
in
(
EmailContent:
:
getId
,
vo
.
getContentId
()).
set
(
EmailContent:
:
getDegree
,
vo
.
getDegree
()).
update
();
}
}
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
View file @
d86f2bdf
...
...
@@ -115,6 +115,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
queryWrapper
.
ge
(
EmailPerson:
:
getSendTime
,
DateUtils
.
getRangeStart
(
vo
.
getSearchRange
()));
queryWrapper
.
le
(
EmailPerson:
:
getSendTime
,
LocalDateTime
.
now
());
}
queryWrapper
.
orderByDesc
(
EmailPerson:
:
getId
).
orderByAsc
(
EmailPerson:
:
getIsRead
);
page
=
this
.
page
(
page
,
queryWrapper
);
if
(
page
!=
null
&&
CollectionUtil
.
isNotEmpty
(
page
.
getRecords
())){
for
(
EmailPerson
record
:
page
.
getRecords
())
{
...
...
@@ -154,11 +155,12 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
@Override
public
void
moveEmailFolder
(
EmailFolderMoveVo
vo
)
{
List
<
EmailPerson
>
emailPeople
=
this
.
listByIds
(
vo
.
getPersonIdList
());
for
(
EmailPerson
emailPerson
:
emailPeople
)
{
List
<
EmailPerson
>
personList
=
this
.
listByIds
(
vo
.
getPersonIdList
());
for
(
EmailPerson
emailPerson
:
personList
)
{
emailPerson
.
setOldFolderId
(
emailPerson
.
getFolderId
());
emailPerson
.
setFolderId
(
vo
.
getFolderId
());
}
this
.
updateBatchById
(
emailPeople
);
this
.
updateBatchById
(
personList
);
}
@Override
...
...
@@ -170,6 +172,24 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
}
@Override
public
List
<
EmailPerson
>
findTaskEmailByContentId
(
Long
contentId
)
{
List
<
EmailPerson
>
personList
=
this
.
lambdaQuery
()
.
eq
(
EmailPerson:
:
getEmailContentId
,
contentId
)
.
eq
(
EmailPerson:
:
getPersonType
,
EmailConstant
.
TYPE_EMAIL_RECEIVE
)
.
orderByAsc
(
EmailPerson:
:
getId
).
list
();
for
(
EmailPerson
person
:
personList
)
{
List
<
EmailContent
>
list
=
this
.
emailContentService
.
lambdaQuery
()
.
eq
(
EmailContent:
:
getReplyId
,
person
.
getEmailContentId
())
.
eq
(
EmailContent:
:
getSendUserId
,
person
.
getUserId
())
.
list
();
if
(
CollectionUtil
.
isNotEmpty
(
list
)){
person
.
setEmailContent
(
list
.
get
(
0
));
}
}
return
personList
;
}
@Override
public
List
<
DeptSimpleDto
>
findReceiveDeptByContentId
(
Long
contentId
)
{
List
<
DeptSimpleDto
>
deptDtoList
=
new
ArrayList
<>();
EmailContent
content
=
this
.
emailContentService
.
getById
(
contentId
);
...
...
@@ -210,9 +230,10 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
this
.
lambdaUpdate
()
.
eq
(
EmailPerson:
:
getUserId
,
adminContext
.
getUserId
())
.
eq
(
EmailPerson:
:
getFolderId
,
folderId
)
//.eq(EmailPerson::getFolderId, EmailFolderEnum.FOLDER_INBOX.getKey())
.
eq
(
EmailPerson:
:
getPersonType
,
EmailConstant
.
TYPE_EMAIL_RECEIVE
)
.
eq
(
EmailPerson:
:
getIsRead
,
WhetherEnum
.
YES
.
getKey
())
.
set
(
EmailPerson:
:
getFolderId
,
EmailFolderEnum
.
FOLDER_
OUTBOX
.
getKey
())
.
set
(
EmailPerson:
:
getFolderId
,
EmailFolderEnum
.
FOLDER_
ALREADY_DELETE
.
getKey
())
.
update
();
}
...
...
@@ -296,16 +317,17 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
LambdaQueryWrapper
<
EmailPerson
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
EmailPerson:
:
getUserId
,
adminContext
.
getUserId
())
.
eq
(
EmailPerson:
:
getFolderId
,
vo
.
getFolderId
())
.
eq
(
EmailPerson:
:
getPersonType
,
EmailConstant
.
TYPE_EMAIL_RECEIVE
);
.
eq
(
EmailPerson:
:
getFolderId
,
vo
.
getFolderId
())
;
//
.eq(EmailPerson::getPersonType, EmailConstant.TYPE_EMAIL_RECEIVE);
if
(
type
.
equals
(
WhetherEnum
.
YES
.
getKey
())){
queryWrapper
.
gt
(
EmailPerson:
:
getId
,
vo
.
getCurrentPersonId
());
}
else
if
(
type
.
equals
(
WhetherEnum
.
NO
.
getKey
())){
queryWrapper
.
lt
(
EmailPerson:
:
getId
,
vo
.
getCurrentPersonId
());
}
else
if
(
type
.
equals
(
WhetherEnum
.
NO
.
getKey
())){
queryWrapper
.
gt
(
EmailPerson:
:
getId
,
vo
.
getCurrentPersonId
());
}
else
{
AssertUtils
.
isTrue
(
false
,
"向上或向下查询参数不对"
);
}
List
<
EmailPerson
>
list
=
this
.
list
(
queryWrapper
);
EmailPerson
person
=
this
.
getOne
(
queryWrapper
,
false
);
if
(
person
!=
null
){
EmailContent
content
=
this
.
emailContentService
.
getById
(
person
.
getEmailContentId
());
...
...
@@ -316,6 +338,36 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
return
null
;
}
@Override
public
void
recallPerson
(
EmailSendVo
vo
){
this
.
lambdaUpdate
()
.
in
(
EmailPerson:
:
getId
,
vo
.
getPersonIdList
())
.
set
(
EmailPerson:
:
getIsSend
,
vo
.
getIsSend
())
.
update
();
}
@Override
public
void
recallEmail
(
Long
contentId
)
{
this
.
lambdaUpdate
()
.
eq
(
EmailPerson:
:
getEmailContentId
,
contentId
)
.
eq
(
EmailPerson:
:
getIsRead
,
WhetherEnum
.
NO
.
getKey
())
.
set
(
EmailPerson:
:
getIsSend
,
WhetherEnum
.
NO
.
getKey
()).
update
();
}
@Override
public
void
resumeEmail
(
List
<
Long
>
personIdList
)
{
List
<
EmailPerson
>
personList
=
new
ArrayList
<>();
for
(
Long
id
:
personIdList
)
{
EmailPerson
person
=
this
.
getById
(
id
);
if
(
person
!=
null
&&
person
.
getOldFolderId
()!=
null
){
person
.
setFolderId
(
person
.
getOldFolderId
());
person
.
setOldFolderId
(
null
);
personList
.
add
(
person
);
}
}
this
.
updateBatchById
(
personList
);
}
private
void
saveEmailSender
(
OnlineUserDto
adminContext
,
EmailContent
content
,
EmailEditVo
vo
)
{
EmailPerson
sender
=
EmailPerson
.
builder
()
.
emailContentId
(
content
.
getId
())
...
...
src/main/java/com/zq/email/vo/EmailDegreeVo.java
0 → 100644
View file @
d86f2bdf
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
EmailDegreeVo
{
@ApiModelProperty
(
"contentId集合"
)
private
List
<
Long
>
contentId
;
@ApiModelProperty
(
"0:一般 1 重要 2紧急"
)
private
Integer
degree
;
}
src/main/java/com/zq/email/vo/EmailFolderMoveVo.java
View file @
d86f2bdf
...
...
@@ -14,6 +14,8 @@ public class EmailFolderMoveVo {
private
Long
folderId
;
private
Long
oldFolderId
;
private
List
<
Long
>
personIdList
;
...
...
src/main/java/com/zq/email/vo/EmailLastAndAfterReqVo.java
View file @
d86f2bdf
...
...
@@ -18,7 +18,7 @@ public class EmailLastAndAfterReqVo {
private
Integer
isPerson
;
@ApiModelProperty
(
"是否已发送"
)
private
Integer
isSend
;
@ApiModelProperty
(
"
查询范围,默认最近三个月
"
)
@ApiModelProperty
(
"
当前对象的personId
"
)
private
Long
currentPersonId
;
}
src/main/java/com/zq/email/vo/EmailSendVo.java
0 → 100644
View file @
d86f2bdf
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
EmailSendVo
{
@ApiModelProperty
(
"personId集合"
)
private
List
<
Long
>
personIdList
;
@ApiModelProperty
(
"0:未读 1:已读"
)
private
Integer
isSend
;
}
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