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
bcebb72a
Commit
bcebb72a
authored
Jul 17, 2023
by
chentianzhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
8b347ae8
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
16 deletions
+50
-16
src/main/java/com/zq/email/config/TokenFilter.java
+13
-9
src/main/java/com/zq/email/entity/EmailFolder.java
+1
-1
src/main/java/com/zq/email/entity/EmailPerson.java
+7
-1
src/main/java/com/zq/email/feign/FileFeignClient.java
+5
-0
src/main/java/com/zq/email/feign/fallback/FileFeignFallbackFactory.java
+6
-0
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
+3
-1
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
+10
-2
src/main/java/com/zq/email/utils/MsgUtil.java
+4
-1
src/main/resources/application-dev.yml
+1
-1
No files found.
src/main/java/com/zq/email/config/TokenFilter.java
View file @
bcebb72a
...
@@ -64,15 +64,19 @@ public class TokenFilter extends GenericFilterBean {
...
@@ -64,15 +64,19 @@ public class TokenFilter extends GenericFilterBean {
String
token
=
resolveToken
(
httpServletRequest
);
String
token
=
resolveToken
(
httpServletRequest
);
// 对于 Token 为空的不需要去查 Redis
// 对于 Token 为空的不需要去查 Redis
if
(
StrUtil
.
isNotBlank
(
token
))
{
if
(
StrUtil
.
isNotBlank
(
token
))
{
OnlineUserDto
onlineUserDto
=
adminFeignClient
.
getTokenUserInfo
();
try
{
AssertUtils
.
notNull
(
onlineUserDto
,
401
,
"微服务异常,当前登录用户失效"
);
OnlineUserDto
onlineUserDto
=
adminFeignClient
.
getTokenUserInfo
();
if
(
onlineUserDto
!=
null
&&
StringUtils
.
hasText
(
token
))
{
AssertUtils
.
notNull
(
onlineUserDto
,
401
,
"微服务异常,当前登录用户失效"
);
Authentication
authentication
=
tokenProvider
.
getAuthentication
(
token
);
if
(
onlineUserDto
!=
null
&&
StringUtils
.
hasText
(
token
))
{
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
Authentication
authentication
=
tokenProvider
.
getAuthentication
(
token
);
// Token 续期
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
tokenProvider
.
checkRenewal
(
token
);
// Token 续期
// 设置当前用户
tokenProvider
.
checkRenewal
(
token
);
TokenUtils
.
setAdminContext
(
onlineUserDto
);
// 设置当前用户
TokenUtils
.
setAdminContext
(
onlineUserDto
);
}
}
catch
(
Exception
e
){
AssertUtils
.
isTrue
(
false
,
401
,
"微服务异常,当前登录用户失效"
);
}
}
}
}
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
...
...
src/main/java/com/zq/email/entity/EmailFolder.java
View file @
bcebb72a
...
@@ -25,7 +25,7 @@ public class EmailFolder implements Serializable {
...
@@ -25,7 +25,7 @@ public class EmailFolder implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"folder_id"
,
type
=
IdType
.
AUTO
)
@TableId
(
value
=
"folder_id"
,
type
=
IdType
.
INPUT
)
private
Long
folderId
;
private
Long
folderId
;
private
Long
userId
;
private
Long
userId
;
...
...
src/main/java/com/zq/email/entity/EmailPerson.java
View file @
bcebb72a
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
...
@@ -6,6 +6,7 @@ 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
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -65,9 +66,14 @@ public class EmailPerson implements Serializable {
...
@@ -65,9 +66,14 @@ public class EmailPerson implements Serializable {
private
Integer
isTask
;
private
Integer
isTask
;
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
EmailContent
emailContent
;
private
EmailContent
emailContent
;
@TableField
(
exist
=
false
)
private
List
<
EmailAttach
>
emailAttachList
;
@TableField
(
exist
=
false
)
private
List
<
EmailPerson
>
receiverList
;
}
}
src/main/java/com/zq/email/feign/FileFeignClient.java
View file @
bcebb72a
package
com
.
zq
.
email
.
feign
;
package
com
.
zq
.
email
.
feign
;
import
com.zq.common.annotation.rest.AnonymousGetMapping
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.common.vo.SysFileUploadVo
;
import
com.zq.common.vo.SysFileUploadVo
;
import
com.zq.common.vo.UploadFileListRespVo
;
import
com.zq.common.vo.UploadFileListRespVo
;
...
@@ -25,6 +26,10 @@ public interface FileFeignClient {
...
@@ -25,6 +26,10 @@ public interface FileFeignClient {
@GetMapping
(
value
=
"/getUploadFileById/{id}"
)
@GetMapping
(
value
=
"/getUploadFileById/{id}"
)
ResultVo
<
SysFileUploadVo
>
getUploadFileById
(
@PathVariable
String
id
);
ResultVo
<
SysFileUploadVo
>
getUploadFileById
(
@PathVariable
String
id
);
@AnonymousGetMapping
(
"/copy"
)
public
ResultVo
<
SysFileUploadVo
>
copyFile
(
@RequestParam
String
fileId
,
@RequestParam
String
systemTag
);
@GetMapping
(
value
=
"/downloadFile/{fileId}"
)
@GetMapping
(
value
=
"/downloadFile/{fileId}"
)
ResponseEntity
<
Resource
>
download
(
@PathVariable
String
fileId
);
ResponseEntity
<
Resource
>
download
(
@PathVariable
String
fileId
);
...
...
src/main/java/com/zq/email/feign/fallback/FileFeignFallbackFactory.java
View file @
bcebb72a
...
@@ -40,6 +40,12 @@ public class FileFeignFallbackFactory implements FallbackFactory<FileFeignClient
...
@@ -40,6 +40,12 @@ public class FileFeignFallbackFactory implements FallbackFactory<FileFeignClient
}
}
@Override
@Override
public
ResultVo
<
SysFileUploadVo
>
copyFile
(
String
fileId
,
String
systemTag
)
{
LOG
.
error
(
"调用文件服务 ,复制文件失败"
);
return
ResultVo
.
fail
(
"根据文件服务id获取文件对象失败"
);
}
@Override
public
ResponseEntity
<
Resource
>
download
(
String
fileId
)
{
public
ResponseEntity
<
Resource
>
download
(
String
fileId
)
{
LOG
.
error
(
"下载文件失败(fileId:"
+
fileId
+
")"
);
LOG
.
error
(
"下载文件失败(fileId:"
+
fileId
+
")"
);
return
null
;
return
null
;
...
...
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
View file @
bcebb72a
...
@@ -50,12 +50,14 @@ public class EmailAttachServiceImpl extends ServiceImpl<EmailAttachMapper, Email
...
@@ -50,12 +50,14 @@ public class EmailAttachServiceImpl extends ServiceImpl<EmailAttachMapper, Email
public
List
<
EmailAttach
>
saveAttach
(
EmailEditVo
vo
,
EmailContent
content
)
{
public
List
<
EmailAttach
>
saveAttach
(
EmailEditVo
vo
,
EmailContent
content
)
{
List
<
EmailAttach
>
list
=
new
ArrayList
<>();
List
<
EmailAttach
>
list
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getFileIds
()))
{
if
(
CollectionUtil
.
isNotEmpty
(
vo
.
getFileIds
()))
{
//拿到旧附件
//拿到旧附件
//list = this.lambdaQuery().eq(EmailAttach::getEmailContentId, content.getId()).in(EmailAttach::getAttachId, vo.getFileIds()).list();
//list = this.lambdaQuery().eq(EmailAttach::getEmailContentId, content.getId()).in(EmailAttach::getAttachId, vo.getFileIds()).list();
//list = this.lambdaQuery().in(EmailAttach::getAttachId, vo.getFileIds()).list();
//list = this.lambdaQuery().in(EmailAttach::getAttachId, vo.getFileIds()).list();
for
(
String
fileId
:
vo
.
getFileIds
())
{
for
(
String
fileId
:
vo
.
getFileIds
())
{
ResultVo
<
SysFileUploadVo
>
uploadFileById
=
fileFeignClient
.
getUploadFileById
(
fileId
);
ResultVo
<
SysFileUploadVo
>
uploadFileById
=
fileFeignClient
.
copyFile
(
fileId
,
EmailConstant
.
SYSTEM_TAG
);
//ResultVo<SysFileUploadVo> uploadFileById = fileFeignClient.getUploadFileById(fileId);
if
(
uploadFileById
.
isSuccess
()
&&
uploadFileById
.
getData
()!=
null
){
if
(
uploadFileById
.
isSuccess
()
&&
uploadFileById
.
getData
()!=
null
){
SysFileUploadVo
data
=
uploadFileById
.
getData
();
SysFileUploadVo
data
=
uploadFileById
.
getData
();
EmailAttach
emailAttach
=
EmailAttach
.
builder
()
EmailAttach
emailAttach
=
EmailAttach
.
builder
()
...
...
src/main/java/com/zq/email/service/impl/EmailPersonServiceImpl.java
View file @
bcebb72a
...
@@ -113,8 +113,12 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
...
@@ -113,8 +113,12 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
if
(
page
!=
null
&&
CollectionUtil
.
isNotEmpty
(
page
.
getRecords
())){
if
(
page
!=
null
&&
CollectionUtil
.
isNotEmpty
(
page
.
getRecords
())){
for
(
EmailPerson
record
:
page
.
getRecords
())
{
for
(
EmailPerson
record
:
page
.
getRecords
())
{
EmailContent
byId
=
this
.
emailContentService
.
getById
(
record
.
getEmailContentId
());
EmailContent
content
=
this
.
emailContentService
.
getById
(
record
.
getEmailContentId
());
record
.
setEmailContent
(
byId
);
record
.
setEmailContent
(
content
);
if
(
vo
.
getFolderId
().
equals
(
EmailFolderEnum
.
FOLDER_ALREADY_SEND
.
getKey
()))
{
record
.
setEmailAttachList
(
this
.
emailAttachService
.
findByContentId
(
content
.
getId
()));
record
.
setReceiverList
(
this
.
findReceiverByContentId
(
content
.
getId
(),
null
));
}
}
}
}
}
return
page
;
return
page
;
...
@@ -705,6 +709,10 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
...
@@ -705,6 +709,10 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
for
(
EmailPerson
person
:
page
.
getRecords
())
{
for
(
EmailPerson
person
:
page
.
getRecords
())
{
EmailContent
content
=
this
.
emailContentService
.
getById
(
person
.
getEmailContentId
());
EmailContent
content
=
this
.
emailContentService
.
getById
(
person
.
getEmailContentId
());
person
.
setEmailContent
(
content
);
person
.
setEmailContent
(
content
);
if
(
vo
.
getFolderId
().
equals
(
EmailFolderEnum
.
FOLDER_ALREADY_SEND
.
getKey
())){
person
.
setEmailAttachList
(
this
.
emailAttachService
.
findByContentId
(
content
.
getId
()));
person
.
setReceiverList
(
this
.
findReceiverByContentId
(
content
.
getId
(),
null
));
}
}
}
}
}
return
page
;
return
page
;
...
...
src/main/java/com/zq/email/utils/MsgUtil.java
View file @
bcebb72a
...
@@ -7,6 +7,7 @@ import com.zq.email.dto.SystemInfo;
...
@@ -7,6 +7,7 @@ import com.zq.email.dto.SystemInfo;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.entity.EmailContent
;
import
com.zq.email.feign.MessageFeignClient
;
import
com.zq.email.feign.MessageFeignClient
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.SetUtils
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -94,7 +95,9 @@ public class MsgUtil {
...
@@ -94,7 +95,9 @@ public class MsgUtil {
public
void
doneMsgByBusinessIdAndReceiverId
(
Long
businessId
,
Long
receiverId
)
{
public
void
doneMsgByBusinessIdAndReceiverId
(
Long
businessId
,
Long
receiverId
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"systemTag"
,
EmailConstant
.
SYSTEM_TAG
);
params
.
put
(
"systemTag"
,
EmailConstant
.
SYSTEM_TAG
);
params
.
put
(
"id"
,
receiverId
);
params
.
put
(
"businessId"
,
businessId
);
params
.
put
(
"todoUserId"
,
receiverId
);
params
.
put
(
"ids"
,
SetUtils
.
newIdentityHashSet
().
add
(
receiverId
));
log
.
debug
(
"---已读消息代办: {}"
,
JSONUtil
.
toJsonStr
(
params
));
log
.
debug
(
"---已读消息代办: {}"
,
JSONUtil
.
toJsonStr
(
params
));
messageFeignClient
.
batchSetReadByUser
(
params
,
String
.
valueOf
(
businessId
));
messageFeignClient
.
batchSetReadByUser
(
params
,
String
.
valueOf
(
businessId
));
messageFeignClient
.
doneByBusinessIdAndSystemTagAndTodoUserId
(
params
);
messageFeignClient
.
doneByBusinessIdAndSystemTagAndTodoUserId
(
params
);
...
...
src/main/resources/application-dev.yml
View file @
bcebb72a
...
@@ -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.171:54321/EMAIL
_NEW
url
:
jdbc:kingbase8://172.18.4.171:54321/EMAIL
username
:
oa_system
username
:
oa_system
password
:
123456
password
:
123456
driver-class-name
:
com.kingbase8.Driver
driver-class-name
:
com.kingbase8.Driver
...
...
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