| | |
| | | |
| | | import com.yc.crm.mail.entity.T482102Entity; |
| | | import com.yc.crm.mail.entity.t482101HEntity; |
| | | import com.yc.crm.mail.entity.t482101HList; |
| | | import com.yc.crm.mail.service.MailAccountIfc; |
| | | import com.yc.crm.mail.service.MailIfc; |
| | | import com.yc.crm.mail.util.AllBackMsg; |
| | |
| | | } |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息 |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源 |
| | | List<t482101HEntity> t482101HEntityList = emailIfc.getReceivingMailList(mail, mailType, isNoRead); |
| | | List<t482101HList> t482101HEntityList = emailIfc.getReceivingMailList(mail, mailType, isNoRead); |
| | | if (t482101HEntityList.size() > 0) { |
| | | msg.setSuccess("执行完成", t482101HEntityList); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getMailInfo.do") |
| | | public AllBackMsg getMailInfo(String mail, String docCode, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | public AllBackMsg getMailInfo(String docCode, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | AllBackMsg msg = new AllBackMsg(); |
| | | try { |
| | | if (StringUtils.isBlank(docCode)) {//获取不到当前用户直接结束 |
| | | msg.setFail("缺少邮箱唯一码docCode,请检查"); |
| | | return msg; |
| | | } |
| | | if (StringUtils.isNotBlank(mail)) { |
| | | if (!EMAIL_PATTERN.matcher(mail).matches()) { |
| | | msg.setFail("邮箱的格式不正确"); |
| | | return msg; |
| | | } |
| | | } |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息 |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源 |
| | | t482101HEntity t482101HEntity = emailIfc.getReceivingMailInfo(mail, docCode); |
| | | t482101HEntity t482101HEntity = emailIfc.getReceivingMailInfo(docCode); |
| | | if (t482101HEntity != null) { |
| | | msg.setSuccess("执行完成", t482101HEntity); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取邮件详情 |
| | | * 删除邮件 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/deleteReceivingMail.do") |
| | | public AllBackMsg deleteReceivingMail(String docCode, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | @PostMapping("/deleteReceivingMail.do") |
| | | public AllBackMsg deleteReceivingMail(@RequestBody List<String> docCode, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | AllBackMsg msg = new AllBackMsg(); |
| | | try { |
| | | if (StringUtils.isBlank(docCode)) {//获取不到当前用户直接结束 |
| | | msg.setFail("缺少邮箱唯一码docCode,请检查"); |
| | | if (docCode == null && docCode.size() == 0) {//获取不到当前用户直接结束 |
| | | msg.setFail("请选中删除的邮件"); |
| | | return msg; |
| | | } |
| | | String arrayCode = StringUtils.join(docCode, ","); |
| | | HttpSession session = request.getSession(); |
| | | String userCode = (String) session.getAttribute(SessionKey.USERCODE);//当前登录用户 |
| | | if (StringUtils.isBlank(userCode)) {//获取不到当前用户直接结束 |
| | |
| | | } |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息 |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源 |
| | | Integer cont = emailIfc.deleteReceivingMail(userCode, docCode); |
| | | Integer cont = emailIfc.deleteReceivingMail(userCode, arrayCode); |
| | | if (cont > 0) { |
| | | msg.setOk("邮件已删除"); |
| | | } |
| | |
| | | return msg; |
| | | } |
| | | } |
| | | if (StringUtils.isNotBlank(t482101H.getReceiver())) { |
| | | if (!EMAIL_PATTERN.matcher(t482101H.getReceiver()).matches()) { |
| | | msg.setFail("收件人邮箱:" + t482101H.getReceiver() + "的格式不正确"); |
| | | return msg; |
| | | if (t482101H.getReceiver()!=null && t482101H.getReceiver().size()>0) { |
| | | for (String mail : t482101H.getReceiver()) { |
| | | if (!EMAIL_PATTERN.matcher(mail).matches()) { |
| | | msg.setFail("收件人邮箱:" + mail + "的格式不正确"); |
| | | return msg; |
| | | } |
| | | } |
| | | |
| | | } |
| | | String companyId = (String) session.getAttribute(SessionKey.COMPANY_ID); |
| | | String companyName = (String) session.getAttribute(SessionKey.COMPANY_NAME); |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("docCode", t482101H.getDocCode()); |
| | | msg.setSuccess("执行成功", map); |
| | | // msg.setOk("执行成功"); |
| | | } catch (Exception e) { |
| | | msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); |
| | | } finally { |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/deleteMailDrafts.do") |
| | | public AllBackMsg deleteMailDrafts(String docCode, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | @PostMapping("/deleteMailDrafts.do") |
| | | public AllBackMsg deleteMailDrafts(@RequestBody List<String> docCode, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | AllBackMsg msg = new AllBackMsg(); |
| | | try { |
| | | if (StringUtils.isBlank(docCode)) {//获取不到当前用户直接结束 |
| | | msg.setFail("缺少邮箱唯一码docCode,请检查"); |
| | | if (docCode == null && docCode.size() == 0) {//获取不到当前用户直接结束 |
| | | msg.setFail("请选中删除的邮件"); |
| | | return msg; |
| | | } |
| | | String arrayCode=StringUtils.join(docCode,","); |
| | | HttpSession session = request.getSession(); |
| | | String userCode = (String) session.getAttribute(SessionKey.USERCODE);//当前登录用户 |
| | | if (StringUtils.isBlank(userCode)) {//获取不到当前用户直接结束 |
| | | msg.setFail("获取不到用户信息"); |
| | | return msg; |
| | | } |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息 |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源 |
| | | int cont = emailIfc.deleteMailDrafts(docCode); |
| | | int cont = emailIfc.deleteMailDrafts(userCode,arrayCode); |
| | | if (cont > 0) { |
| | | msg.setOk("删除成功"); |
| | | } |
| | |
| | | return msg; |
| | | } |
| | | } |
| | | if (StringUtils.isNotBlank(t482101H.getReceiver())) { |
| | | if (!EMAIL_PATTERN.matcher(t482101H.getReceiver()).matches()) { |
| | | msg.setFail("收件人邮箱:" + t482101H.getReceiver() + "的格式不正确"); |
| | | return msg; |
| | | if (t482101H.getReceiver()!=null && t482101H.getReceiver().size()>0) { |
| | | for (String mail : t482101H.getReceiver()) { |
| | | if (!EMAIL_PATTERN.matcher(mail).matches()) { |
| | | msg.setFail("收件人邮箱:" + mail + "的格式不正确"); |
| | | return msg; |
| | | } |
| | | } |
| | | |
| | | } |
| | | String companyId = (String) session.getAttribute(SessionKey.COMPANY_ID); |
| | | String companyName = (String) session.getAttribute(SessionKey.COMPANY_NAME); |
| | |
| | | } |
| | | return msg; |
| | | } |
| | | |
| | | /** |
| | | * 标记已读 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateRead.do") |
| | | public AllBackMsg updateRead(@RequestBody List<String> docCode, 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 (docCode == null && docCode.size() == 0) { |
| | | msg.setFail("请选择标记邮件"); |
| | | return msg; |
| | | } |
| | | String arrayCode = StringUtils.join(docCode, ","); |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息 |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源 |
| | | emailIfc.updateRead(arrayCode); |
| | | msg.setOk("标记成功"); |
| | | } catch (Exception e) { |
| | | msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | | return msg; |
| | | } |
| | | |
| | | } |