示例#1
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);
  }
示例#2
0
  /** 电子邮件发邮件列表加载 */
  public String sendlistLoad() {
    allPermission = "*";

    String sendUser = SessionFactory.getSessionUserNm();
    String sendSysUser = SessionFactory.getSessionUserId();
    if (StringTools.isNotNullAndHasValue(mainDocId)) {
      if ("1".equals(isReplyTrun)) {
        // 转发邮件
        b_T_Ufp_Mail_Attribute = mapperMAT.selectByPrimaryKey(mainDocId);
        b_T_Ufp_Mail_Relation = mapperMRT.selectByPrimaryKey(mainDocId);
        b_T_Ufp_Mail_Content = mapperMCT.selectByPrimaryKey(mainDocId);
        b_T_Ufp_Mail_Attribute.setTitle(titleS);
        b_T_Ufp_Mail_Relation.setUserId("");
        b_T_Ufp_Mail_Relation.setUserName("");
        // 回复时,清空抄送人和密送人
        b_T_Ufp_Mail_Attribute.setCopySysUser("");
        b_T_Ufp_Mail_Attribute.setCopyUser("");
        b_T_Ufp_Mail_Attribute.setDarkSysUser("");
        b_T_Ufp_Mail_Attribute.setDarkUser("");
        String receiptText = String.valueOf(b_T_Ufp_Mail_Attribute.getIsReceipt());
        checkBoxIsChecked(receiptText);
      } else if ("0".equals(isReplyTrun)) {
        // 回复邮件
        b_T_Ufp_Mail_Attribute = mapperMAT.selectByPrimaryKey(mainDocId);
        b_T_Ufp_Mail_Relation = mapperMRT.selectByPrimaryKey(mainDocId);
        b_T_Ufp_Mail_Relation.setUserId(b_T_Ufp_Mail_Attribute.getSendSysUser());
        b_T_Ufp_Mail_Relation.setUserName(b_T_Ufp_Mail_Attribute.getSendUser());
        b_T_Ufp_Mail_Attribute.setTitle(titleS);
        b_T_Ufp_Mail_Attribute.setSendUser(sendUser);
        b_T_Ufp_Mail_Attribute.setSendSysUser(sendSysUser);
        // 回复时,清空抄送人和密送人
        b_T_Ufp_Mail_Attribute.setCopySysUser("");
        b_T_Ufp_Mail_Attribute.setCopyUser("");
        b_T_Ufp_Mail_Attribute.setDarkSysUser("");
        b_T_Ufp_Mail_Attribute.setDarkUser("");
        // 回复邮件去掉原始邮件的附件
        newFileIds = "";
        b_T_Ufp_Mail_Attribute.setUuid("");
        b_T_Ufp_Mail_Content = mapperMCT.selectByPrimaryKey(mainDocId);
        String receiptText = String.valueOf(b_T_Ufp_Mail_Attribute.getIsReceipt());
        checkBoxIsChecked(receiptText);
      }
      if ("2".equals(mailType)) {
        b_T_Ufp_Mail_Attribute = mapperMAT.selectByPrimaryKey(mainDocId);
        b_T_Ufp_Mail_Relation = mapperMRT.selectByPrimaryKey(mainDocId);
        b_T_Ufp_Mail_Content = mapperMCT.selectByPrimaryKey(mainDocId);
        mailSaveSendFlag = "1"; // 默认勾选保存至发件箱
        isReceipt = b_T_Ufp_Mail_Attribute.getIsReceipt().toString(); // 默认不勾选回执
        isSendMsg = b_T_Ufp_Mail_Attribute.getIsSendMsg().toString(); // 默认不勾选发送短信
      }
    } else {
      // 发邮件
      if (b_T_Ufp_Mail_Attribute == null) {
        b_T_Ufp_Mail_Attribute = new B_T_Ufp_Mail_Attribute();
        b_T_Ufp_Mail_Attribute.setSendUser(SessionFactory.getSessionUserNm());
        b_T_Ufp_Mail_Attribute.setImportantLeve("2");
        b_T_Ufp_Mail_Attribute.setPriorityLeve("2");
        mailSaveSendFlag = "1"; // 默认勾选保存至发件箱
        isReceipt = "0"; // 默认不勾选回执
        isSendMsg = "0"; // 默认不勾选发送短信
      }
    }
    return SUCCESS;
  }
示例#3
0
  /** 电子邮件详细信息页面加载 */
  public String detailsLoad() throws Exception {
    allPermission = "*";
    C_T_Sys_FileExample example = null;
    B_T_Ufp_Mail_Relation recordRelation = null;
    B_V_Ufp_MailExample exampleVMail = null;
    B_V_Ufp_MailExample.Criteria criteriaVMail = null;
    try {
      example = new C_T_Sys_FileExample();
      exampleVMail = new B_V_Ufp_MailExample();
      criteriaVMail = exampleVMail.createCriteria();

      if (StringTools.isNotNullAndHasValue(allReplyFlag) && "1".equals(allReplyFlag)) {
        // 显示全部文件名
        if (StringTools.isNotNullAndHasValue(titleS)) {
          criteriaVMail.andTitleLike("%" + titleS + "%");
        }
        criteriaVMail.andReplyFlagEqualTo(1);
        criteriaVMail.andSendTimeLessThanOrEqualTo(sendTimeS);
        exampleVMail
            .or()
            .andTitleEqualTo(titleS)
            .andReplyFlagEqualTo(1)
            .andSendTimeLessThanOrEqualTo(sendTimeS)
            .andSpecificRecsysUserIsNull();
        exampleVMail.setOrderByClause("SEND_TIME desc");
        b_V_Ufp_Mail_list = mapperMV.selectByExample(exampleVMail);
        String fileNameTemp = null;
        if (b_V_Ufp_Mail_list != null) {
          for (B_V_Ufp_Mail b_V_Ufp_Mail : b_V_Ufp_Mail_list) {
            fileNameTemp = searchFileName(example, b_V_Ufp_Mail.getUuid());
            fileNameList.add(fileNameTemp);
          }
        }
        ActionContext.getContext().getSession().put("fileNameList", fileNameList);
      }
      // 当前登录人系统名
      String loginId = SessionFactory.getSessionUserId();
      b_T_Ufp_Mail_Attribute = mapperMAT.selectByPrimaryKey(mainDocId);
      b_T_Ufp_Mail_Relation = mapperMRT.selectByPrimaryKey(mainDocId);
      b_T_Ufp_Mail_Content = mapperMCT.selectByPrimaryKey(mainDocId);
      fileName = searchFileName(example, mainDocId);
      mailSaveSendFlag = String.valueOf(b_T_Ufp_Mail_Relation.getMailType());
      isSendMsg = String.valueOf(b_T_Ufp_Mail_Attribute.getIsSendMsg());

      if (b_T_Ufp_Mail_Relation.getIsNew() != null && b_T_Ufp_Mail_Relation.getIsNew() == 0) {
        if (b_T_Ufp_Mail_Attribute.getIsReceipt() != null
            && b_T_Ufp_Mail_Attribute.getIsReceipt() == 1) {
          // 修改 by:youjh  2015-10-21
          String uuid = new GUID().toString();

          B_T_Ufp_Mail_Attribute newMailAttribute = new B_T_Ufp_Mail_Attribute();
          B_T_Ufp_Mail_Relation mailRelation = new B_T_Ufp_Mail_Relation();

          newMailAttribute.setUuid(uuid);
          newMailAttribute.setTitle("回复:收到:" + b_T_Ufp_Mail_Attribute.getTitle());
          newMailAttribute.setSendTime(DateTools.getServerDateTime(10));
          newMailAttribute.setCreateTime(DateTools.getServerDateTime(10));
          newMailAttribute.setCreateUser(loginId);
          newMailAttribute.setSendUser(SessionFactory.getSessionUserNm());
          newMailAttribute.setSendSysUser(loginId);
          newMailAttribute.setImportantLeve("3");
          newMailAttribute.setPriorityLeve("3");
          mapperMAT.insertSelective(newMailAttribute);

          mailRelation.setUuid(uuid);
          mailRelation.setMailContentId(uuid);
          mailRelation.setMailAttributeId(uuid);
          mailRelation.setMailType(new Long(4));
          mailRelation.setUserId(b_T_Ufp_Mail_Attribute.getSendSysUser());
          mailRelation.setCreateTime(DateTools.getServerDateTime(10));
          mailRelation.setReceiverTime(DateTools.getServerDateTime(10));
          mailRelation.setReplyFlag(1);
          mailRelation.setCreateUser(loginId);
          mailRelation.setSpecificRecsysUser(b_T_Ufp_Mail_Attribute.getSendSysUser());
          mailRelation.setUserName(SessionFactory.getSessionUserNm());

          mapperMRT.insertSelective(mailRelation);

          // 插入邮件正文表
          b_T_Ufp_Mail_Content.setUuid(uuid);
          b_T_Ufp_Mail_Content.setContent(
              "回复:您发送的邮件已收到:"
                  + ""
                  + b_T_Ufp_Mail_Content.getContent()
                  + ""
                  + "发送人:"
                  + SessionFactory.getSessionUserNm());
          mapperMCT.insertSelective(b_T_Ufp_Mail_Content);
          addForAllRecUser(uuid);
        }
      }

      // 阅读邮件
      recordRelation = updateIsNewMail(recordRelation, loginId);

      String copySysUser = b_T_Ufp_Mail_Attribute.getCopySysUser();
      String darkSysUser = b_T_Ufp_Mail_Attribute.getDarkSysUser();
      copyDarkUserShow(loginId, copySysUser, darkSysUser);
    } catch (Exception e) {
      throw e;
    } finally {
      // 释放资源
      example = null;
      recordRelation = null;
      exampleVMail = null;
      criteriaVMail = null;
    }
    return SUCCESS;
  }