示例#1
0
 /**
  * 给回复,转发邮件设置附件
  *
  * @param mapperFile
  * @param example
  * @param criteria
  * @param uuid
  * @throws IllegalAccessException
  * @throws UnsupportedEncodingException
  * @throws InvocationTargetException
  * @throws NoSuchMethodException
  * @throws IOException
  * @throws ClassNotFoundException
  */
 private void replyMailFile(
     C_T_Sys_FileExample example, C_T_Sys_FileExample.Criteria criteria, String uuid)
     throws Exception {
   // newFileIds原始附件主键
   if (StringTools.isNotNullAndHasValue(newFileIds)) {
     // 将新增附件保存进当前回复中
     // 修改by:youjh 2015-10-21
     newFileIds = newFileIds.replaceAll("[?]", "%3F");
     String[] listTemp = newFileIds.split("%3F");
     C_T_Sys_File c_T_Sys_File = null;
     // 设置转发邮件附件
     for (String temp : listTemp) {
       if (StringTools.isNotNullAndHasValue(temp.trim())) {
         c_T_Sys_File = mapperFT.selectByPrimaryKey(temp);
         if (c_T_Sys_File != null) {
           c_T_Sys_File.setUuid(new GUID().toString());
           c_T_Sys_File.setMainId(uuid); // 回复(转发)邮件主键
           mapperFT.insertSelective(c_T_Sys_File);
         } else {
           // 如果是逻辑删除附件,则可以恢复原始邮件附件
           criteria.andMainIdEqualTo(mainDocId);
           criteria.andIsDeleteEqualTo(1);
           List<C_T_Sys_File> c_T_Sys_File_list = mapperFT.selectByExample(example);
           if (c_T_Sys_File_list != null) {
             for (C_T_Sys_File file : c_T_Sys_File_list) {
               file.setUuid(new GUID().toString());
               file.setMainId(mainDocId); // 回复原始邮件附件
               file.setIsDelete(0);
               mapperFT.insertSelective(file);
             }
           }
         }
       }
     } // --for
   }
 }
示例#2
0
  /**
   * 拷贝至对应邮箱
   *
   * @param sqlSession
   * @param mapper
   * @param mapperRelation
   * @param mapperContent
   * @param record
   * @param recordRelation
   * @param recordContent
   * @param temp
   * @throws IllegalAccessException
   * @throws UnsupportedEncodingException
   */
  private void copyMail(
      B_T_Ufp_Mail_Attribute record,
      B_T_Ufp_Mail_Relation recordRelation,
      B_T_Ufp_Mail_Content recordContent,
      String temp,
      C_T_Sys_FileExample example,
      C_T_Sys_FileExample.Criteria criteria)
      throws IllegalAccessException, UnsupportedEncodingException {
    String uuid = new GUID().toString();
    // 拷贝邮件时同时拷贝邮件带的附件
    criteria.andMainIdEqualTo(temp.trim());
    List<C_T_Sys_File> c_T_Sys_File_list = mapperFT.selectByExample(example);
    if (c_T_Sys_File_list != null) {
      for (C_T_Sys_File file : c_T_Sys_File_list) {
        file.setUuid(new GUID().toString());
        file.setMainId(uuid); // 设置原始邮件附件
        mapperFT.insertSelective(file);
      }
    }
    // 插入邮件关联表
    b_T_Ufp_Mail_Relation.setUuid(uuid);
    if ("1".equals(mailTypeS)) {
      b_T_Ufp_Mail_Relation.setReplyFlag(4); // 拷贝至发件箱:4
    } else if ("7".equals(mailTypeS)) {
      b_T_Ufp_Mail_Relation.setReplyFlag(1); // 收件箱:1
      // 拷贝至收件箱设置特定收件人为当前登录人
      b_T_Ufp_Mail_Relation.setSpecificRecsysUser(SessionFactory.getSessionUserId());
    } else if ("2".equals(mailTypeS)) {
      b_T_Ufp_Mail_Relation.setReplyFlag(3); // 草稿箱:3
    } else if ("3".equals(mailTypeS)) {
      b_T_Ufp_Mail_Relation.setReplyFlag(3); // 垃圾箱:3
    }
    b_T_Ufp_Mail_Relation.setMailType(Long.valueOf(mailTypeS));
    b_T_Ufp_Mail_Relation.setMailAttributeId(uuid);
    b_T_Ufp_Mail_Relation.setMailContentId(uuid);

    mapperMRT.insertSelective(b_T_Ufp_Mail_Relation);
    // 插入邮件属性表
    b_T_Ufp_Mail_Attribute = mapperMAT.selectByPrimaryKey(temp);
    b_T_Ufp_Mail_Attribute.setUuid(uuid);
    mapperMAT.insertSelective(b_T_Ufp_Mail_Attribute);
    // 插入邮件正文表
    b_T_Ufp_Mail_Content = mapperMCT.selectByPrimaryKey(temp);
    b_T_Ufp_Mail_Content.setUuid(uuid);
    mapperMCT.insertSelective(b_T_Ufp_Mail_Content);
  }
示例#3
0
 /**
  * 给所有收件人的邮件附上附件
  *
  * @param mapperFile
  * @param guid
  * @throws IllegalAccessException
  * @throws UnsupportedEncodingException
  */
 private void addForAllRecUser(String guid) throws Exception {
   // newFileIds所有原始附件主键(发邮件时,给每个收邮件的附上附件)
   if (StringTools.isNotNullAndHasValue(newFileIds)) {
     // 将新增附件保存进当前回复中
     // 修改by:youjh 2015-10-21
     newFileIds = newFileIds.replaceAll("[?]", "%3F");
     String[] listTemp = newFileIds.split("%3F");
     C_T_Sys_File c_T_Sys_File = null;
     // 设置回复邮件附件
     for (String file : listTemp) {
       if (StringTools.isNotNullAndHasValue(file.trim())) {
         c_T_Sys_File = mapperFT.selectByPrimaryKey(file);
         if (c_T_Sys_File != null) {
           c_T_Sys_File.setUuid(new GUID().toString());
           c_T_Sys_File.setMainId(guid); // 回复邮件主键
           mapperFT.insertSelective(c_T_Sys_File);
         }
       }
     }
   }
 }