Пример #1
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;
  }
Пример #2
0
  /** 电子邮件 Grid数据加载 */
  public String gridLoad() {
    B_V_Ufp_MailExample example = null;
    B_V_Ufp_MailExample.Criteria criteria = null;

    // 创建查询条件
    example = new B_V_Ufp_MailExample();
    criteria = example.createCriteria();
    String userSysName = SessionFactory.getSessionUserId();
    criteria.andIsDeleteEqualTo(0);

    if (StringTools.isNotNullAndHasValue(isNew)) {
      criteria.andIsNewEqualTo(Integer.valueOf(isNew));
    }

    if (StringTools.isNotNullAndHasValue(mailType)) {
      if (mailType.length() > 1) {
        criteria.andSpecificRecsysUserEqualTo(userSysName);
        String temps[] = mailType.split(",");
        List<Long> listType = new ArrayList<Long>();
        for (String temp : temps) {
          listType.add(Long.valueOf(temp));
        }
        criteria.andMailTypeIn(listType);
        if (StringTools.isNotNullAndHasValue(isNew)) {
          example
              .or()
              .andSpecificRecsysUserEqualTo(userSysName)
              .andIsNewEqualTo(Integer.valueOf(isNew))
              .andReplyFlagEqualTo(1);
        } else {
          // 收邮件显示所有邮件
          example.or().andSpecificRecsysUserEqualTo(userSysName).andReplyFlagEqualTo(1);
        }
      } else {
        if ("1".equals(mailType)) {
          // 发件箱邮件
          criteria.andMailTypeEqualTo(Long.valueOf(mailType));
          criteria.andSendSysUserEqualTo(userSysName);
          // 同时显示拷贝至发件箱
          example.or().andReplyFlagEqualTo(4);
        } else {
          // 垃圾箱和草稿箱
          criteria.andMailTypeEqualTo(Long.valueOf(mailType));
          criteria.andReplyFlagEqualTo(3);
        }
      }
    }

    // 记录条数的记录
    total = mapperMV.countByExample(example);
    // 分页
    example.or().setLimitValue(getRowStart(), getRowEnd());
    // 添加排序
    if (sort != null && !"".equals(sort) && order != null && !"".equals(order)) {
      if ("sendUser".equals(sort)) {
        sort = "SEND_USER";
      } else if ("title".equals(sort)) {
        sort = "title";
      } else if ("sendTime".equals(sort)) {
        sort = "send_time";
      } else if ("isNew".equals(sort)) {
        sort = "is_new";
      } else if ("receiverTime".equals(sort)) {
        sort = "receiver_time";
      } else if ("receiverUser".equals(sort)) {
        sort = "receiver_user";
      }
      example.setOrderByClause(sort + " " + order);
    }

    // 格式化result 一定要是JSONObject
    result = CommonLogic.getResult(total, mapperMV.selectByExample(example));

    return SUCCESS;
  }