Commit bcebb72a by chentianzhong

更新

parent 8b347ae8
...@@ -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);
......
...@@ -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;
......
...@@ -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;
} }
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);
......
...@@ -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;
......
...@@ -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()
......
...@@ -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;
......
...@@ -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);
......
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment