From f632e7d7c25d8a86b1f6718f467bfef0d3c09058 Mon Sep 17 00:00:00 2001
From: xinyb <574600396@qq.com>
Date: 星期四, 26 九月 2024 18:01:06 +0800
Subject: [PATCH] CRM邮箱功能调整

---
 src/com/yc/crm/custom/service/CustomImpl.java      |   12 +++---
 src/com/yc/crm/mail/action/MailAccount.java        |   65 ++++++++++++++++++++++++++++++++
 src/com/yc/crm/mail/action/MailFolder.java         |    8 +++-
 src/com/yc/crm/custom/entity/T480601Entity.java    |    6 +-
 src/com/yc/crm/custom/action/CustomController.java |    6 +-
 src/com/yc/crm/custom/service/CustomIfc.java       |   10 ++--
 src/com/yc/crm/mail/service/MailFolderImpl.java    |    2 
 7 files changed, 88 insertions(+), 21 deletions(-)

diff --git a/src/com/yc/crm/custom/action/CustomController.java b/src/com/yc/crm/custom/action/CustomController.java
index 26ac42e..2e957e4 100644
--- a/src/com/yc/crm/custom/action/CustomController.java
+++ b/src/com/yc/crm/custom/action/CustomController.java
@@ -1,6 +1,6 @@
 package com.yc.crm.custom.action;
 
-import com.yc.crm.custom.entity.T480601HEntity;
+import com.yc.crm.custom.entity.T480601Entity;
 import com.yc.crm.custom.service.CustomIfc;
 import com.yc.crm.mail.entity.MailModuleEntity;
 import com.yc.crm.mail.util.AllBackMsg;
@@ -68,7 +68,7 @@
      * @return
      */
     @PostMapping("/saveCustom.do")
-    public AllBackMsg saveCustom(@RequestBody T480601HEntity custom, HttpServletRequest request, HttpServletResponse response) throws Exception {
+    public AllBackMsg saveCustom(@RequestBody T480601Entity custom, HttpServletRequest request, HttpServletResponse response) throws Exception {
         AllBackMsg msg = new AllBackMsg();
         try {
             HttpSession session = request.getSession();
@@ -106,7 +106,7 @@
      * @return
      */
     @PostMapping("/updateCustom.do")
-    public AllBackMsg updateCustom(@RequestBody T480601HEntity custom, HttpServletRequest request, HttpServletResponse response) throws Exception {
+    public AllBackMsg updateCustom(@RequestBody T480601Entity custom, HttpServletRequest request, HttpServletResponse response) throws Exception {
         AllBackMsg msg = new AllBackMsg();
         try {
             HttpSession session = request.getSession();
diff --git a/src/com/yc/crm/custom/entity/T480601HEntity.java b/src/com/yc/crm/custom/entity/T480601Entity.java
similarity index 97%
rename from src/com/yc/crm/custom/entity/T480601HEntity.java
rename to src/com/yc/crm/custom/entity/T480601Entity.java
index 43cdec0..4481fb2 100644
--- a/src/com/yc/crm/custom/entity/T480601HEntity.java
+++ b/src/com/yc/crm/custom/entity/T480601Entity.java
@@ -15,7 +15,7 @@
  * @Description:瀹㈡埛
  */
 @Data
-public class T480601HEntity {
+public class T480601Entity {
 //    private String docCode;//鍗曞彿
 //    private Integer formId;//鍔熻兘鍙�
 ////    private String userCode;//鐢ㄦ埛
@@ -159,8 +159,8 @@
     private Integer pageCount;
     private String ccCode;
     private String ccName;
-    private  List<FileEntity> files;
-    private List<AuditEntity> auditRecords;
+    private  List<FileEntity> files;//闄勪欢
+    private List<AuditEntity> auditRecords;//瀹¤瀹炰綋
     private Integer systemFlag;//绯荤粺鏍囩
     private Integer cluesStatusFlag;//绾跨储鐘舵��
 }
diff --git a/src/com/yc/crm/custom/service/CustomIfc.java b/src/com/yc/crm/custom/service/CustomIfc.java
index 5e98a9f..e1a992d 100644
--- a/src/com/yc/crm/custom/service/CustomIfc.java
+++ b/src/com/yc/crm/custom/service/CustomIfc.java
@@ -1,6 +1,6 @@
 package com.yc.crm.custom.service;
 
-import com.yc.crm.custom.entity.T480601HEntity;
+import com.yc.crm.custom.entity.T480601Entity;
 
 import java.util.List;
 
@@ -10,14 +10,14 @@
      *
      * @param custom
      */
-    abstract String saveCustom(T480601HEntity custom);
+    abstract String saveCustom(T480601Entity custom);
 
     /**
      * 淇敼瀹㈡埛
      * @param custom
      * @return
      */
-    abstract Integer updateCustom(T480601HEntity custom);
+    abstract Integer updateCustom(T480601Entity custom);
 
     /**
      * 鍒犻櫎瀹㈡埛
@@ -32,7 +32,7 @@
      * @param userCode
      * @return
      */
-    abstract List<T480601HEntity> getCustomList(String userCode);
+    abstract List<T480601Entity> getCustomList(String userCode);
 
     /**
      * 鏌ヨ瀹㈡埛璇︽儏
@@ -40,5 +40,5 @@
      * @param userCode
      * @return
      */
-    abstract T480601HEntity getCustomInfo(String docCode,String userCode);
+    abstract T480601Entity getCustomInfo(String docCode, String userCode);
 }
diff --git a/src/com/yc/crm/custom/service/CustomImpl.java b/src/com/yc/crm/custom/service/CustomImpl.java
index c41a0fe..d5ed994 100644
--- a/src/com/yc/crm/custom/service/CustomImpl.java
+++ b/src/com/yc/crm/custom/service/CustomImpl.java
@@ -2,7 +2,7 @@
 
 import com.yc.action.grid.GridUtils;
 import com.yc.crm.clues.entity.T482103Entity;
-import com.yc.crm.custom.entity.T480601HEntity;
+import com.yc.crm.custom.entity.T480601Entity;
 import com.yc.service.BaseService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -20,11 +20,11 @@
 public class CustomImpl extends BaseService implements CustomIfc {
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public String saveCustom(T480601HEntity custom) {
+    public String saveCustom(T480601Entity custom) {
         String sql = "set nocount on\n";
         try {
             sql += "declare @docCode varchar(50) \n";
-            sql += "exec sp_newdoccode 482101," + GridUtils.prossSqlParm(custom.getEnterCode()) + ",@docCode output \n";
+            sql += "exec sp_newdoccode t480601," + GridUtils.prossSqlParm(custom.getEnterCode()) + ",@docCode output \n";
             sql += "insert into t480601H(formId,docDate,periodId,docStatus,companyId,companyName,enterCode,enterName,enterDate," +
                     "postCode,postName,postDate,cltCode,cltName,country,province,city,district,street) " +
                     "values (" + custom.getFormId() + ",convert(varchar(10),getdate(),120),convert(varchar(7),getdate(),120),0," +
@@ -52,7 +52,7 @@
     }
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public Integer updateCustom(T480601HEntity custom) {
+    public Integer updateCustom(T480601Entity custom) {
         String sql = "set nocunt on \n";
         try {
             sql += "update t480601H set modifyCode=" + GridUtils.prossSqlParm(custom.getEnterCode()) + ",modifyName=" + GridUtils.prossSqlParm(custom.getEnterName()) + "," +
@@ -79,7 +79,7 @@
     }
 
     @Override
-    public List<T480601HEntity> getCustomList(String userCode) {
+    public List<T480601Entity> getCustomList(String userCode) {
         try {
             return null;
         } catch (Exception e) {
@@ -88,7 +88,7 @@
     }
 
     @Override
-    public T480601HEntity getCustomInfo(String docCode, String userCode) {
+    public T480601Entity getCustomInfo(String docCode, String userCode) {
         try {
             return null;
         } catch (Exception e) {
diff --git a/src/com/yc/crm/mail/action/MailAccount.java b/src/com/yc/crm/mail/action/MailAccount.java
index 12f9991..30a2f3d 100644
--- a/src/com/yc/crm/mail/action/MailAccount.java
+++ b/src/com/yc/crm/mail/action/MailAccount.java
@@ -411,7 +411,7 @@
     }
 
     /**
-     * 妫�娴嬬粦瀹氭槸鍚︽湁鏁�
+     * 妫�娴嬬粦瀹氭槸鍚﹀凡缁忓瓨鍦紙鏄惁宸茬粦瀹氾級
      *
      * @param email
      * @param request
@@ -596,6 +596,69 @@
         return errorMsg;
     }
 
+    /**
+     * 甯歌鏌ヨ
+     * @param request
+     * @param response
+     * @return
+     */
+    @GetMapping("/getConvention.do")
+    public AllBackMsg getConvention(HttpServletRequest request, HttpServletResponse response) {
+        AllBackMsg msg = new AllBackMsg();
+
+        try {
+            HttpSession session = request.getSession();
+            String userCode = (String) session.getAttribute(SessionKey.USERCODE);
+            if (StringUtils.isBlank(userCode)) {
+                msg.setFail("鐧诲綍鐢ㄦ埛宸茶繃鏈燂紝璇锋鏌�");
+                return msg;
+            }
+
+            DataSourceEntity dataSource = MultiDataSource.getDataSourceMap(request);//鑾峰彇鏁版嵁婧�
+            SpObserver.setDBtoInstance("_" + dataSource.getDbId());
+            //鏍规嵁褰撳墠鐢ㄦ埛鏌ヨ缁戝畾鐨勯偖绠变俊鎭�
+
+        } catch (MessagingException e) {
+            msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
+        } catch (Exception e) {
+            msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
+        } finally {
+            SpObserver.setDBtoInstance();
+        }
+        return msg;
+    }
+
+    /**
+     * 甯歌鏇存柊
+     * @param request
+     * @param response
+     * @return
+     */
+    @GetMapping("/updateConvention.do")
+    public AllBackMsg updateConvention(HttpServletRequest request, HttpServletResponse response) {
+        AllBackMsg msg = new AllBackMsg();
+        try {
+            HttpSession session = request.getSession();
+            String userCode = (String) session.getAttribute(SessionKey.USERCODE);
+            if (StringUtils.isBlank(userCode)) {
+                msg.setFail("鐧诲綍鐢ㄦ埛宸茶繃鏈燂紝璇锋鏌�");
+                return msg;
+            }
+
+            DataSourceEntity dataSource = MultiDataSource.getDataSourceMap(request);//鑾峰彇鏁版嵁婧�
+            SpObserver.setDBtoInstance("_" + dataSource.getDbId());
+            //鏍规嵁褰撳墠鐢ㄦ埛鏌ヨ缁戝畾鐨勯偖绠变俊鎭�
+
+        } catch (MessagingException e) {
+            msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
+        } catch (Exception e) {
+            msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
+        } finally {
+            SpObserver.setDBtoInstance();
+        }
+        return msg;
+    }
+
     private T482102Entity getMailConfigProperties(T482102Entity t482102) {
         try {
             String email = t482102.getEmail();
diff --git a/src/com/yc/crm/mail/action/MailFolder.java b/src/com/yc/crm/mail/action/MailFolder.java
index 7924021..1753624 100644
--- a/src/com/yc/crm/mail/action/MailFolder.java
+++ b/src/com/yc/crm/mail/action/MailFolder.java
@@ -207,7 +207,9 @@
                             folderEntity.setRowId(y.getRowId());
                             folderEntity.setParentRowId(y.getParentRowId());
                             folderEntity.setTreeControl(y.getTreeControl());
-                            folderEntity.setList(getFolderList(t482107, y.getRowId()));
+                            if (!y.getRowId().equals(y.getParentRowId())) {
+                                folderEntity.setList(getFolderList(t482107, y.getRowId()));
+                            }
                             folder.add(folderEntity);
                         }
                     }
@@ -238,7 +240,9 @@
                             folder1.setKey(y.getRowId());
                             folder1.setParentKey(y.getParentRowId());
                             folder1.setName(y.getFolderName());
-                            folder1.setList(getFolderModule(t482107, y.getRowId()));
+                            if (!y.getRowId().equals(y.getParentRowId())) {
+                                folder1.setList(getFolderModule(t482107, y.getRowId()));
+                            }
                             folder.add(folder1);
                         }
                     } else {
diff --git a/src/com/yc/crm/mail/service/MailFolderImpl.java b/src/com/yc/crm/mail/service/MailFolderImpl.java
index 5b3da2e..3f6b20f 100644
--- a/src/com/yc/crm/mail/service/MailFolderImpl.java
+++ b/src/com/yc/crm/mail/service/MailFolderImpl.java
@@ -45,7 +45,7 @@
             sql += "update t482107 set folder_name=" + GridUtils.prossSqlParm(folder.getFolderName()) +
                     ",sort_id=" + folder.getSortId() + ",update_time=getdate() " + //",rowId=" + GridUtils.prossSqlParm(folder.getRowId()) +
                     ",treeControl=" + GridUtils.prossSqlParm(folder.getTreeControl()) + ",parentRowId=" + GridUtils.prossSqlParm(folder.getParentRowId()) +
-                    "where folder_id=" + folder.getFolderId() + " and userCode=" + GridUtils.prossSqlParm(folder.getUserCode()) + "\n";
+                    " where folder_id=" + folder.getFolderId() + " and userCode=" + GridUtils.prossSqlParm(folder.getUserCode()) + "\n";
             sql += "select @@ROWCOUNT";
             return jdbcTemplate.queryForObject(sql, Integer.class);
         } catch (Exception e) {

--
Gitblit v1.8.0