From 1956855b43808d81f246d9570d477ac1cbc404b7 Mon Sep 17 00:00:00 2001
From: xinyb <574600396@qq.com>
Date: 星期四, 19 九月 2024 11:25:36 +0800
Subject: [PATCH] CRM邮箱接口优化

---
 src/com/yc/crm/mail/action/MailController.java |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/com/yc/crm/mail/action/MailController.java b/src/com/yc/crm/mail/action/MailController.java
index d3b2880..e182c91 100644
--- a/src/com/yc/crm/mail/action/MailController.java
+++ b/src/com/yc/crm/mail/action/MailController.java
@@ -2,6 +2,7 @@
 
 import com.yc.crm.mail.entity.*;
 import com.yc.crm.mail.service.MailAccountIfc;
+import com.yc.crm.mail.service.MailFileIfc;
 import com.yc.crm.mail.service.MailIfc;
 import com.yc.crm.mail.service.MailServiceIfc;
 import com.yc.crm.mail.util.AllBackMsg;
@@ -47,6 +48,8 @@
     MailIfc emailIfc;
     @Autowired
     MailServiceIfc mailServiceIfc;
+    @Autowired
+    MailFileIfc mailFileIfc;
 
     private static final Pattern EMAIL_PATTERN =
             Pattern.compile("^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$");
@@ -85,7 +88,8 @@
      * @return
      */
     @GetMapping("/getMailList.do")
-    public AllBackMsg getMailList(String mail, @RequestParam(defaultValue = "1") Integer mailType, boolean isNoRead, HttpServletRequest request, HttpServletResponse response) throws Exception {
+    public AllBackMsg getMailList(String mail, @RequestParam(defaultValue = "1") Integer mailType,
+                                  @RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "20") Integer limit, boolean isNoRead, HttpServletRequest request, HttpServletResponse response) throws Exception {
         AllBackMsg msg = new AllBackMsg();
         try {
             if (StringUtils.isNotBlank(mail)) {
@@ -102,7 +106,7 @@
             }
             DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//鑾峰彇鏁版嵁婧愪俊鎭�
             SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//鍒囨崲鏁版嵁婧�
-            List<t482101HList> t482101HEntityList = emailIfc.getReceivingMailList(mail, mailType, isNoRead, userCode);
+            List<t482101HList> t482101HEntityList = emailIfc.getReceivingMailList(mail, mailType, isNoRead, userCode,page,limit);
             if (t482101HEntityList.size() > 0) {
                 msg.setSuccess("鎵ц瀹屾垚", t482101HEntityList);
             }
@@ -120,7 +124,8 @@
      * @return
      */
     @GetMapping("/getHandleMailList.do")
-    public AllBackMsg getHandleMailList(String mail, HttpServletRequest request, HttpServletResponse response) throws Exception {
+    public AllBackMsg getHandleMailList(String mail,@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "20") Integer limit,
+                                        HttpServletRequest request, HttpServletResponse response) throws Exception {
         AllBackMsg msg = new AllBackMsg();
         try {
             if (StringUtils.isNotBlank(mail)) {
@@ -137,7 +142,7 @@
             }
             DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//鑾峰彇鏁版嵁婧愪俊鎭�
             SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//鍒囨崲鏁版嵁婧�
-            List<t482101HList> t482101HEntityList = emailIfc.getHandleMailList(mail, userCode);
+            List<t482101HList> t482101HEntityList = emailIfc.getHandleMailList(mail, userCode,page,limit);
             if (t482101HEntityList.size() > 0) {
                 msg.setSuccess("鎵ц瀹屾垚", t482101HEntityList);
             }
@@ -168,11 +173,11 @@
             if (t482101HEntity != null) {
                 if (StringUtils.isNotBlank(t482101HEntity.getAttachmentList())) {//闄勪欢鐨勫鐞�
                     //鑾峰彇鍒伴檮浠跺唴瀹�
-                    List<AttachmentEntity> attachmentEntities = emailIfc.getAttachmentEntityList(t482101HEntity.getAttachmentList());
+                    List<AttachmentEntity> attachmentEntities = mailFileIfc.getAttachmentEntityList(t482101HEntity.getAttachmentList());
                     List<String> list = new ArrayList<>();
                     if (attachmentEntities.size() > 0) {
                         for (AttachmentEntity a : attachmentEntities) {
-                            list.add(shoppingImageServer + "/uploads/attachment/" + dataSourceEntity.getDbId() + "/482101/" + a.getUnid() + "@p@" + a.getPhysicalFile());
+                            list.add(shoppingImageServer + "/uploads/email/" + dataSourceEntity.getDbId() + "/482101/" + a.getUnid() + "@p@" + a.getPhysicalFile());
                         }
                         t482101HEntity.setAttachmentPath(list);
                     }

--
Gitblit v1.8.0