From ee2316e2cb7afde1c54f5e4216a1b0d1e055749e Mon Sep 17 00:00:00 2001 From: xinyb <574600396@qq.com> Date: 星期五, 27 九月 2024 17:33:14 +0800 Subject: [PATCH] CRM邮箱配置调整 --- src/com/yc/crm/mail/action/MailController.java | 123 ++++++++++++++++++++++++++++++++++++---- 1 files changed, 110 insertions(+), 13 deletions(-) diff --git a/src/com/yc/crm/mail/action/MailController.java b/src/com/yc/crm/mail/action/MailController.java index 5649883..fcfabb9 100644 --- a/src/com/yc/crm/mail/action/MailController.java +++ b/src/com/yc/crm/mail/action/MailController.java @@ -82,6 +82,7 @@ } return msg; } + /** * 宸﹁竟缁撴瀯涓嬪眰 * @@ -99,7 +100,7 @@ } DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//鑾峰彇鏁版嵁婧愪俊鎭� SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//鍒囨崲鏁版嵁婧� - List<MailModuleBelowEntity> list =emailIfc.getMailModuleBelowList(userCode); + List<MailModuleBelowEntity> list = emailIfc.getMailModuleBelowList(userCode); msg.setSuccess("鎵ц鎴愬姛", list); } catch (Exception e) { msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); @@ -134,14 +135,16 @@ DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//鑾峰彇鏁版嵁婧愪俊鎭� SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//鍒囨崲鏁版嵁婧� List<t482101HList> t482101HEntityList = emailIfc.getReceivingMailList(mail, mailType, isNoRead, userCode, page, limit); + Map<String, Object> map = new HashMap<>(); + map.put("page", page); + map.put("limit", limit); if (t482101HEntityList.size() > 0) { - Map<String,Object> map=new HashMap<>(); - map.put("page",page); - map.put("limit",limit); - map.put("total",emailIfc.getMailTotal(mail,mailType,isNoRead,userCode)); - map.put("list",t482101HEntityList); - msg.setSuccess("鎵ц瀹屾垚", map); + map.put("total", emailIfc.getMailTotal(mail, mailType, isNoRead, null, userCode)); + map.put("list", t482101HEntityList); + } else { + map.put("list", new ArrayList<>()); } + msg.setSuccess("鎵ц瀹屾垚", map); } catch (Exception e) { msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); } finally { @@ -175,14 +178,16 @@ DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//鑾峰彇鏁版嵁婧愪俊鎭� SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//鍒囨崲鏁版嵁婧� List<t482101HList> t482101HEntityList = emailIfc.getHandleMailList(mail, userCode, page, limit); + Map<String, Object> map = new HashMap<>(); + map.put("page", page); + map.put("limit", limit); if (t482101HEntityList.size() > 0) { - Map<String,Object> map=new HashMap<>(); - map.put("page",page); - map.put("limit",limit); - map.put("total",emailIfc.getMailTotal(mail,3,false,userCode)); - map.put("list",t482101HEntityList); - msg.setSuccess("鎵ц瀹屾垚", map); + map.put("total", emailIfc.getMailTotal(mail, 3, false, null, userCode)); + map.put("list", t482101HEntityList); + } else { + map.put("list", new ArrayList<>()); } + msg.setSuccess("鎵ц瀹屾垚", map); } catch (Exception e) { msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); } finally { @@ -530,6 +535,98 @@ } /** + * 绉诲姩閭欢鍒嗙被 + * + * @param request + * @param response + * @return + */ + @PostMapping("/updateMailType.do") + public AllBackMsg updateMailType(@RequestBody Map<String, Object> map, HttpServletRequest request, HttpServletResponse response) throws Exception { + AllBackMsg msg = new AllBackMsg(); + try { + HttpSession session = request.getSession(); + String userCode = (String) session.getAttribute(SessionKey.USERCODE);//褰撳墠鐧诲綍鐢ㄦ埛 + if (StringUtils.isBlank(userCode)) {//鑾峰彇涓嶅埌褰撳墠鐢ㄦ埛鐩存帴缁撴潫 + msg.setFail("鑾峰彇涓嶅埌鐢ㄦ埛淇℃伅"); + return msg; + } + if (map.get("docCode") == null) { + msg.setFail("鑾峰彇涓嶅埌绉诲姩閭欢缂栧彿docCode"); + return msg; + } + String docCode = (String) map.get("docCode"); + Integer folderId = map.get("folderId") == null ? 0 : (Integer) map.get("folderId"); + List<String> tagArray = (List<String>) map.get("tagId"); + if (folderId.equals(0) && (tagArray == null || tagArray.size() == 0)) { + msg.setFail("绉诲姩閭欢鍒嗙被涓嶈兘涓虹┖"); + return msg; + } + String tagId = ""; + if (tagArray != null && tagArray.size() > 0) { + tagId = StringUtils.join(tagArray, ","); + } + DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//鑾峰彇鏁版嵁婧愪俊鎭� + SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//鍒囨崲鏁版嵁婧� + emailIfc.updateMailType(docCode, folderId, tagId); + msg.setOk("绉诲姩鎴愬姛"); + } catch (Exception e) { + msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); + } finally { + SpObserver.setDBtoInstance(); + } + return msg; + } + + /** + * 鍔犺浇涓嶅悓鐩綍閲岀殑閭欢 + * + * @param request + * @param response + * @return + */ + @GetMapping("/classificationMail.do") + public AllBackMsg classificationMail(@RequestParam(defaultValue = "-1") Integer id, String type, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "20") Integer limit, + HttpServletRequest request, HttpServletResponse response) throws Exception { + AllBackMsg msg = new AllBackMsg(); + try { + HttpSession session = request.getSession(); + String userCode = (String) session.getAttribute(SessionKey.USERCODE);//褰撳墠鐧诲綍鐢ㄦ埛 + if (StringUtils.isBlank(userCode)) {//鑾峰彇涓嶅埌褰撳墠鐢ㄦ埛鐩存帴缁撴潫 + msg.setFail("鑾峰彇涓嶅埌鐢ㄦ埛淇℃伅"); + return msg; + } + if (id == null || id.equals(-1)) { + msg.setFail("鑾峰彇涓嶅埌鏂囦欢Id"); + return msg; + } + if (StringUtils.isBlank(type)) { + msg.setFail("鑾峰彇涓嶅埌鏂囦欢绫诲瀷"); + return msg; + } + type = type + "_" + id;//缁勮涓� + DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//鑾峰彇鏁版嵁婧愪俊鎭� + SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//鍒囨崲鏁版嵁婧� + List<t482101HList> t482101 = emailIfc.getFolderMailList(type, userCode, page, limit); + Map<String, Object> map = new HashMap<>(); + map.put("page", page); + map.put("limit", limit); + if (t482101.size() > 0) { + map.put("total", emailIfc.getMailTotal(null, 6, false, type, userCode)); + map.put("list", t482101); + } else { + map.put("list", new ArrayList<>()); + } + msg.setSuccess("鎵ц瀹屾垚", map); + } catch (Exception e) { + msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); + } finally { + SpObserver.setDBtoInstance(); + } + return msg; + } + + /** * 寰呭鐞嗛偖浠� * * @param request -- Gitblit v1.8.0