Commit 59f73cf1 by chentianzhong

按照旧邮件的相同界面属性,分页和查询还需要再优化。固定先处理其他问题

parent c9f611df
...@@ -107,7 +107,7 @@ public class EmailAttachController { ...@@ -107,7 +107,7 @@ public class EmailAttachController {
} }
@ApiOperation("查看附件下载地址") @ApiOperation("返回附件下载地址")
@GetMapping("/downloadPath/{id}") @GetMapping("/downloadPath/{id}")
public ResultVo downloadPath(@PathVariable("id") String id) { public ResultVo downloadPath(@PathVariable("id") String id) {
EmailAttach emailAttach = emailAttachService.getById(id); EmailAttach emailAttach = emailAttachService.getById(id);
...@@ -129,7 +129,7 @@ public class EmailAttachController { ...@@ -129,7 +129,7 @@ public class EmailAttachController {
download.replaceAll("147.2.3.3", "172.28.1.70"); download.replaceAll("147.2.3.3", "172.28.1.70");
} }
} }
AssertUtils.hasText(download, "获取到的下载地址为空"); AssertUtils.hasText(download, "内部错误,获取下载地址空");
return ResultVo.success(download); return ResultVo.success(download);
} }
......
...@@ -89,7 +89,7 @@ public class EmailPersonController { ...@@ -89,7 +89,7 @@ public class EmailPersonController {
} }
@ApiOperation("单条记录收件记录撤回") @ApiOperation("邮件撤回(收件人列表使用,针对单条未读记录进行撤回)")
@PostMapping("recallPerson") @PostMapping("recallPerson")
public ResultVo recallPerson(@RequestBody EmailSendVo vo) { public ResultVo recallPerson(@RequestBody EmailSendVo vo) {
this.emailPersonService.recallPerson(vo); this.emailPersonService.recallPerson(vo);
...@@ -97,7 +97,7 @@ public class EmailPersonController { ...@@ -97,7 +97,7 @@ public class EmailPersonController {
} }
@ApiOperation("邮件撤回(只能撤回当前邮件中收件人未读的,前端要加上确认提示)") @ApiOperation("邮件撤回(发件箱列表撤回使用,如果该邮件存在收件人已读无法撤回)")
@PostMapping("recallEmail") @PostMapping("recallEmail")
public ResultVo recallEmail(@RequestParam(value = "contentId")Long contentId) { public ResultVo recallEmail(@RequestParam(value = "contentId")Long contentId) {
this.emailPersonService.recallEmail(contentId); this.emailPersonService.recallEmail(contentId);
......
...@@ -84,13 +84,6 @@ import java.util.concurrent.Executors; ...@@ -84,13 +84,6 @@ import java.util.concurrent.Executors;
@Slf4j @Slf4j
public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, EmailPerson> implements IEmailPersonService { public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, EmailPerson> implements IEmailPersonService {
private final static String DATE_FORMAT = "/yyyyMM/dd/";
private final static String DATE_FORMAT_WIN = "\\yyyyMM\\dd\\";
private final static String FILE_SAVE_PATH = "/data/file/oa-email/";
private final static String FILE_SAVE_PATH_WIN = "D:\\file\\oa-email\\";
private final IEmailContentService emailContentService; private final IEmailContentService emailContentService;
private final IEmailAttachService emailAttachService; private final IEmailAttachService emailAttachService;
private final AdminFeignClient adminFeignClient; private final AdminFeignClient adminFeignClient;
...@@ -122,6 +115,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email ...@@ -122,6 +115,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
public Page<EmailPerson> emailPage(EmailReqVo vo) { public Page<EmailPerson> emailPage(EmailReqVo vo) {
OnlineUserDto adminContext = TokenUtils.getAdminContext(); OnlineUserDto adminContext = TokenUtils.getAdminContext();
AssertUtils.notNull(adminContext, "登录已失效,请重新登录后再次尝试!"); AssertUtils.notNull(adminContext, "登录已失效,请重新登录后再次尝试!");
Page<EmailPerson> page = new Page<>(vo.getPage(), vo.getSize()); Page<EmailPerson> page = new Page<>(vo.getPage(), vo.getSize());
page.setSearchCount(false).setOptimizeCountSql(false); page.setSearchCount(false).setOptimizeCountSql(false);
...@@ -142,6 +136,8 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email ...@@ -142,6 +136,8 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
page = this.page(page, queryWrapper); page = this.page(page, queryWrapper);
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());
record.setEmailContent(this.emailContentService.getById(record.getEmailContentId())); record.setEmailContent(this.emailContentService.getById(record.getEmailContentId()));
} }
} }
...@@ -398,6 +394,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email ...@@ -398,6 +394,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
.eq( EmailPerson::getIsSend, WhetherEnum.YES.getKey()); .eq( EmailPerson::getIsSend, WhetherEnum.YES.getKey());
//.eq(EmailPerson::getPersonType, EmailConstant.TYPE_EMAIL_RECEIVE); //.eq(EmailPerson::getPersonType, EmailConstant.TYPE_EMAIL_RECEIVE);
if (type.equals(WhetherEnum.YES.getKey())){ //下 if (type.equals(WhetherEnum.YES.getKey())){ //下
queryWrapper.lt(EmailPerson::getSendTime, currentPerson.getSendTime()); queryWrapper.lt(EmailPerson::getSendTime, currentPerson.getSendTime());
queryWrapper.ge(EmailPerson::getSendTime, DateUtils.getRangeStart(vo.getSearchRange())); queryWrapper.ge(EmailPerson::getSendTime, DateUtils.getRangeStart(vo.getSearchRange()));
...@@ -413,7 +410,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email ...@@ -413,7 +410,7 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
Page<EmailPerson> queryPage = new Page<>(1, 5); Page<EmailPerson> queryPage = new Page<>(1, 5);
queryPage.setSearchCount(false); queryPage.setSearchCount(false);
//List<EmailPerson> list = this.list(queryWrapper); //List<EmailPerson> list = this.list(queryWrapper);
//EmailPerson person = this.getOne(queryWrapper, false); //EmailPerson person = this.getOne(queryWrapper, false); 分析下getone的sql是list后取第一条还是top(1)
Page<EmailPerson> page = this.page(queryPage,queryWrapper); Page<EmailPerson> page = this.page(queryPage,queryWrapper);
...@@ -442,7 +439,6 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email ...@@ -442,7 +439,6 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
.set(EmailPerson::getIsSend, vo.getIsSend()) .set(EmailPerson::getIsSend, vo.getIsSend())
.update(); .update();
new Thread(() -> {
for (Long id : vo.getPersonIdList()) { for (Long id : vo.getPersonIdList()) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params .put("systemTag", EmailConstant.SYSTEM_TAG); params .put("systemTag", EmailConstant.SYSTEM_TAG);
...@@ -453,7 +449,6 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email ...@@ -453,7 +449,6 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
ResultVo resultVo1 = messageFeignClient.revokeTodoBySysInfo(params); ResultVo resultVo1 = messageFeignClient.revokeTodoBySysInfo(params);
log.info("addToDo: {}" + JSONUtil.toJsonStr(resultVo1)); log.info("addToDo: {}" + JSONUtil.toJsonStr(resultVo1));
} }
}).start();
...@@ -579,12 +574,18 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email ...@@ -579,12 +574,18 @@ public class EmailPersonServiceImpl extends ServiceImpl<EmailPersonMapper, Email
vo.setPersonType(EmailConstant.TYPE_EMAIL_SEND); vo.setPersonType(EmailConstant.TYPE_EMAIL_SEND);
vo.setIsPerson(WhetherEnum.YES.getKey()); vo.setIsPerson(WhetherEnum.YES.getKey());
vo.setIsSend(WhetherEnum.YES.getKey()); vo.setIsSend(WhetherEnum.YES.getKey());
if (vo.getSendUserId()!=null){
vo.setReceiveUserId(vo.getSendUserId());
vo.setSendUserId(null);
}
break; break;
case FOLDER_ALREADY_DELETE: //回收站 case FOLDER_ALREADY_DELETE: //回收站
vo.setPersonType(EmailConstant.TYPE_EMAIL_RECEIVE); vo.setPersonType(EmailConstant.TYPE_EMAIL_RECEIVE);
vo.setIsSend(WhetherEnum.YES.getKey()); vo.setIsSend(WhetherEnum.YES.getKey());
break; break;
default: //其他文件夹 default: //其他文件夹
// vo.setPersonType(EmailConstant.TYPE_EMAIL_RECEIVE);
// vo.setIsSend(WhetherEnum.YES.getKey());
break; break;
} }
vo.setUserId(adminContext.getUserId()); vo.setUserId(adminContext.getUserId());
......
...@@ -57,12 +57,12 @@ public class SmsUtil { ...@@ -57,12 +57,12 @@ public class SmsUtil {
} }
private void sendRequest(String content, Long contentId) { private void sendRequest(String content, Long contentId) {
log.info("发送短信请求 => 邮件标识:{},请求地址:{}", contentId, smsProperties.getUrl()); log.debug("发送短信请求 => 邮件标识:{},请求地址:{}", contentId, smsProperties.getUrl());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("data", content); map.put("data", content);
String param = JSONUtil.toJsonStr(map); String param = JSONUtil.toJsonStr(map);
log.info("参数 => {}, 邮件标识:{}", contentId, param); log.debug("参数 => {}, 邮件标识:{}", contentId, param);
HttpRequest request = HttpUtil.createPost(smsProperties.getUrl()) HttpRequest request = HttpUtil.createPost(smsProperties.getUrl())
.header("APP_ID", Base64.encode(smsProperties.getAppId().getBytes())) .header("APP_ID", Base64.encode(smsProperties.getAppId().getBytes()))
.header("APP_KEY", Base64.encode(smsProperties.getAppKey().getBytes())) .header("APP_KEY", Base64.encode(smsProperties.getAppKey().getBytes()))
...@@ -71,9 +71,9 @@ public class SmsUtil { ...@@ -71,9 +71,9 @@ public class SmsUtil {
try { try {
HttpResponse response = request.execute(); HttpResponse response = request.execute();
String body = response.body(); String body = response.body();
log.info("发送短信响应 => {}, 邮件标识:{}", body, contentId); log.debug("发送短信响应 => {}, 邮件标识:{}", body, contentId);
ResultVo resultVo = JSONUtil.toBean(body, ResultVo.class); ResultVo resultVo = JSONUtil.toBean(body, ResultVo.class);
log.info("发送短信响应 => {}, 邮件标识:{}", resultVo.isSuccess(), contentId); log.debug("发送短信响应 => {}, 邮件标识:{}", resultVo.isSuccess(), contentId);
} catch (Exception e) { } catch (Exception e) {
log.error("调用短信接口失败"); log.error("调用短信接口失败");
log.error(e.getLocalizedMessage(), e); log.error(e.getLocalizedMessage(), e);
......
...@@ -31,7 +31,9 @@ public class EmailSearchReqVo extends PageReqVo { ...@@ -31,7 +31,9 @@ public class EmailSearchReqVo extends PageReqVo {
@ApiModelProperty(value = "发件人") @ApiModelProperty(value = "发件人")
private Long sendUserId; private Long sendUserId;
// @ApiModelProperty(value = "收件人") // @ApiModelProperty(value = "收件人")
// private List<Long> receiveUserId; // private List<Long> receiveUserIds;
@ApiModelProperty(value = "收件人")
private Long receiveUserId;
@ApiModelProperty(value = "标题关键字") @ApiModelProperty(value = "标题关键字")
private String title; private String title;
@ApiModelProperty(value = "内容关键字") @ApiModelProperty(value = "内容关键字")
......
...@@ -36,6 +36,21 @@ ...@@ -36,6 +36,21 @@
AND EP."SEND_TIME" &lt;= #{s.endTime} AND EP."SEND_TIME" &lt;= #{s.endTime}
</if> </if>
<!-- 已发送,收件人 -->
<if test="s.receiveUserId != null">
AND EP."ID" IN(
SELECT
EP2."ID"
FROM
"EMAIL_PERSON" EP2
WHERE
EP2."PERSON_TYPE" = 2
AND EP2."IS_SEND" = 1
AND EP2."USER_ID" = #{s.receiveUserId}
)
</if>
<!-- 其他文件夹,发件人、标题、内容 -->
<if test="s.sendUserId != null or (s.title!=null and s.title!='') or (s.content!=null and s.content!='')"> <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( AND EP."EMAIL_CONTENT_ID" IN(
SELECT SELECT
...@@ -57,7 +72,7 @@ ...@@ -57,7 +72,7 @@
</where> </where>
) )
</if> </if>
<!-- 附件名称-->
<if test="s.attachName!=null and s.attachName!=''"> <if test="s.attachName!=null and s.attachName!=''">
AND EP."EMAIL_CONTENT_ID" IN( AND EP."EMAIL_CONTENT_ID" IN(
SELECT SELECT
...@@ -106,6 +121,21 @@ ...@@ -106,6 +121,21 @@
AND EP."SEND_TIME" &lt;= #{s.endTime} AND EP."SEND_TIME" &lt;= #{s.endTime}
</if> </if>
<!-- 已发送,收件人 -->
<if test="s.receiveUserId != null">
AND EP."ID" IN(
SELECT
EP2."ID"
FROM
"EMAIL_PERSON" EP2
WHERE
EP2."PERSON_TYPE" = 2
AND EP2."IS_SEND" = 1
AND EP2."USER_ID" = #{s.receiveUserId}
)
</if>
<if test="s.sendUserId != null or (s.title!=null and s.title!='') or (s.content!=null and s.content!='')"> <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( AND EP."EMAIL_CONTENT_ID" IN(
SELECT SELECT
......
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