Beispiel #1
0
  /** 根据查询条件获取对象列表 */
  public List getSearchActivity(Map map) {

    Date startDate = (Date) map.get("startDate");
    Date endDate = (Date) map.get("endDate");
    String actName = (String) map.get("actName");
    String actType = (String) map.get("actType");
    String relationProject = (String) map.get("relationProject");
    String responsiblePerson = (String) map.get("responsiblePerson");

    StringBuffer hql = new StringBuffer();
    hql.append(" from CrmActivity ra where 1=1 ");

    if (!StringUtil.isStrEmpty(actName)) {
      hql.append(" and ra.name like '")
          .append(StringUtil.replaceBackSpaceWithDelim(actName, "%"))
          .append("'");
    }
    if (!StringUtil.isStrEmpty(actType)) {
      hql.append(" and ra.activityType = '").append(actType).append("'");
    }
    if (!StringUtil.isStrEmpty(relationProject)) {
      hql.append(" and ra.itemId = '").append(relationProject).append("'");
    }
    if (!StringUtil.isStrEmpty(responsiblePerson)) {
      hql.append(" and ra.responsiblePerson.id = ").append(responsiblePerson);
    }
    if (startDate != null) {
      hql.append(" and ra.startDate >= '").append(OperateUtil.getSysDate(startDate)).append("'");
    }
    if (endDate != null) {
      hql.append(" and ra.startDate <= '").append(OperateUtil.getSysDate(endDate)).append("'");
    }
    hql.append(" order by ra.startDate desc,  ra.endDate desc");
    return queryManager.find(hql.toString());
  }
 /**
  * 根据tablecode得到列表
  *
  * @return
  */
 public List getTableColumnList(String tableCode, String columnName) {
   List list = new ArrayList();
   StringBuffer sTable = new StringBuffer();
   sTable.append("from CrmTableColumn ctc where 1=1 ");
   if (!StringUtil.isStrEmpty(tableCode)) {
     sTable.append("and ctc.tableCode = ? ");
     list.add(tableCode);
   }
   if (!StringUtil.isStrEmpty(columnName)) {
     sTable.append("and ctc.columnDescription like ? ");
     list.add(columnName);
   }
   sTable.append(" and ctc.isValid.code = '700090001' ");
   return queryManager.find(sTable.toString(), list.toArray());
 }
 /** 页面初始化 */
 public void pageBeginRender(PageEvent event) {
   boolean isRewinding = event.getRequestCycle().isRewinding();
   if (!isRewinding) {
     if (!StringUtil.isStrEmpty(getDocID())) {
       StringBuffer versionHis = new StringBuffer();
       CrmDocument doc = getFolderService().getDocByID(getDocID());
       List docList = doc.getHistroyDocList();
       if (docList != null && docList.size() > 0) {
         Iterator it = docList.iterator();
         while (it.hasNext()) {
           CrmDocumentHistory dh = (CrmDocumentHistory) it.next();
           String version = dh.getVersion().toString();
           String newFileName = dh.getNewFileName();
           String updateDate = dh.getCreateDate();
           String updateTime = dh.getCreateTime();
           versionHis
               .append("<tr><td>")
               .append(StringUtil.parseAttFolderFileURL(version, newFileName))
               .append("</td><td>")
               .append(updateDate)
               .append("&nbsp;")
               .append(updateTime)
               .append("</td></tr>");
         }
       }
       setVersionHistory(versionHis.toString());
     }
   }
 }
Beispiel #4
0
  /**
   * 根据对象类型及活动的ID得到该活动的相关对象的ID记录
   *
   * @param targetType
   * @param userId
   * @return
   */
  public String getObjIdByAct(String targetType, String act) {
    String actIds = "";
    List list = new ArrayList();
    List lists = new ArrayList();
    StringBuffer hql = new StringBuffer();
    if (TargetTypeConstantValue.TARGETTYPE_CUSTOMER_TYPE.equals(targetType)) {
      hql.append("select actc.custid as ACIID  from");
      hql.append(" crm_activity_cust actc ");
      hql.append(" where actc.activateid = ?");
      list.add(act);
      lists = jdbcManager.queryForList(hql.toString(), list.toArray());
    } else if (TargetTypeConstantValue.TARGETTYPE_CHANNEL_TYPE.equals(targetType)) {
      hql.append("select actc.channelid as ACIID from");
      hql.append(" crm_activity_channel actc ");
      hql.append(" where  actc.activateid = ?");
      list.add(act);
      lists = jdbcManager.queryForList(hql.toString(), list.toArray());
    } else if (TargetTypeConstantValue.TARGETTYPE_CONTACTPERSON_TYPE.equals(targetType)) {
      hql.append("select actc.userid as ACIID from");
      hql.append(" crm_activity_contactperson actc ");
      hql.append(" where  actc.activateid = ?");
      list.add(act);
      lists = jdbcManager.queryForList(hql.toString(), list.toArray());
    } else if (TargetTypeConstantValue.TARGETTYPE_FELLOWSHIP_TYPE.equals(targetType)) {
      hql.append("select actc.fellowid as ACIID from");
      hql.append(" crm_activity_fellow actc ");
      hql.append(" where actc.activateid = ?");
      list.add(act);
      lists = jdbcManager.queryForList(hql.toString(), list.toArray());
    } else if ("123456".equals(targetType)) {
      hql.append("select actc.itemid as ACIID ");
      hql.append(" from crm_activity actc ");
      hql.append(" where actc.id  = ?");
      list.add(act);
      lists = jdbcManager.queryForList(hql.toString(), list.toArray());
    } else {
      lists = null;
    }
    if (lists != null) {
      Iterator it = lists.iterator();
      while (it.hasNext()) {
        Map param = (Map) it.next();
        String actId = param.get("ACIID").toString();
        actIds = actId + "," + actIds;
      }
    }

    if (!StringUtil.isStrEmpty(actIds)) {
      return actIds.substring(0, actIds.length() - 1);
    } else {
      return actIds;
    }
  }
Beispiel #5
0
  /**
   * 得到标签的活动列表
   *
   * @param map
   * @return
   */
  public List getActListTag(Map map) {
    Date startDate = (Date) map.get("startDate");
    Date endDate = (Date) map.get("endDate");
    String responDept = (String) map.get("responDept");
    String responUser = (String) map.get("responUser");
    String targetType = (String) map.get("targetType");
    String userId = (String) map.get("userId");
    String contacId = getActIdByContable(targetType, userId);

    StringBuffer hql = new StringBuffer();
    hql.append(" from CrmActivity ra where 1=1 ");
    if (!StringUtil.isStrEmpty(targetType)
        && !StringUtil.isStrEmpty(userId)
        && "123456".equals(targetType)) {
      hql.append(" and ra.itemId.id =").append(userId);
    }
    if (!StringUtil.isStrEmpty(contacId)) {
      hql.append(" and ra.id in (").append(contacId).append(")");
    } else {
      hql.append(" and ra.id in ( null )");
    }

    if (!StringUtil.isStrEmpty(responDept)) {
      hql.append(" and ra.departmentId =").append(responDept);
    }
    if (!StringUtil.isStrEmpty(responUser)) {
      hql.append(" and ra.responsiblePerson = ").append(responUser);
    }
    if (startDate != null) {
      hql.append(" and ra.startDate >= '").append(OperateUtil.getSysDate(startDate)).append("'");
    }
    if (endDate != null) {
      hql.append(" and ra.startDate <= '").append(OperateUtil.getSysDate(endDate)).append("'");
    }
    hql.append(" order by ra.startDate desc");
    return queryManager.find(hql.toString());
  }
 /**
  * 根据主表与从表确定crm_table_relation, 得到他的columcode,从而得到TableColumn对象
  *
  * @param maintable
  * @param subtable
  * @return
  */
 public CrmTableColumn getTableColumn(String maintable, String subtable) {
   CrmTableColumn tableColumn = null;
   StringBuffer sb = new StringBuffer();
   String column = "";
   sb.append(
       "select tr.maincolumn as COL from crm_table_relation tr  "
           + "where tr.maintable ="
           + maintable
           + " and tr.subtable ="
           + subtable);
   List list = jdbcManager.queryForList(sb.toString());
   if (list != null && list.size() > 0) {
     column = ((Map) list.get(0)).get("COL").toString();
   }
   if (!StringUtil.isStrEmpty(column)) {
     tableColumn = getTableColumnByCode(column);
   }
   return tableColumn;
 }
Beispiel #7
0
  /**
   * 根据类型得到查询语句
   *
   * @param targetType
   * @param actId
   * @param objId
   * @return
   */
  private void inserSqlByTaregtType(String targetType, String actId, String objId) {
    StringBuffer sb = new StringBuffer();
    if (TargetTypeConstantValue.TARGETTYPE_CONTACTPERSON_TYPE.equals(targetType)) { // 联系人
      sb.append(
          "insert into crm_activity_contactperson (activateid,userid)"
              + " values ("
              + actId
              + ","
              + objId
              + ")");

    } else if (TargetTypeConstantValue.TARGETTYPE_CUSTOMER_TYPE.equals(targetType)) { // 客户
      sb.append(
          "insert into crm_activity_cust (activateid, custid)"
              + " values ("
              + actId
              + ","
              + objId
              + ")");

    } else if (TargetTypeConstantValue.TARGETTYPE_CHANNEL_TYPE.equals(targetType)) { // 渠道
      sb.append(
          "insert into crm_activity_channel (activateid, channelid)"
              + " values ("
              + actId
              + ","
              + objId
              + ")");

    } else if (TargetTypeConstantValue.TARGETTYPE_FELLOWSHIP_TYPE.equals(targetType)) { // 合作伙伴
      sb.append(
          "insert into crm_activity_fellow (activateid, fellowid)"
              + " values ("
              + actId
              + ","
              + objId
              + ")");
    }
    if (!StringUtil.isStrEmpty(sb.toString())) {
      this.jdbcManager.excute(sb.toString());
    }
  }