@Override
  public Component getListCellRendererComponent(
      JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    super.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus);
    TicketInfo tkt = (TicketInfo) value;
    int ticketType = tkt.getTicketType();
    String sCustomer;
    if (tkt.getCustomer() == null) {
      sCustomer = "";
    } else {
      sCustomer = tkt.getCustomer().getName();
    }
    int ticketId = tkt.getTicketId();
    Date date = tkt.getDate();
    double total = tkt.getTotalPaid();
    String name = tkt.getUser().getName();
    String sHtml =
        "<tr><td width=\"30\">"
            + "["
            + ticketId
            + "]"
            + "</td>"
            + "<td width=\"100\">"
            + Formats.TIMESTAMP.formatValue(date)
            + "</td>"
            + "<td align=\"center\" width=\"100\">"
            + sCustomer
            + "</td>"
            + "<td align=\"right\" width=\"100\">"
            + Formats.CURRENCY.formatValue(total)
            + "</td>"
            + "<td width=\"100\">"
            + Formats.STRING.formatValue(name)
            + "</td></tr>";

    setText("<html><table>" + sHtml + "</table></html>");
    switch (ticketType) {
      case TicketInfo.RECEIPT_NORMAL:
        setIcon(icoTicketNormal);
        break;
      case TicketInfo.RECEIPT_REFUND:
        setIcon(icoTicketRefund);
        break;
      case TicketInfo.RECEIPT_PAYMENT:
        setIcon(icoTicketDebt);
        break;
    }

    return this;
  }
Пример #2
0
  // According to userid, pasrse the teamrecord data group by user and assignmentid
  public List<TaskData> parseTaskData(List<TeamRecord> records) throws SQLException {

    Map<String, TaskData> ticket_map = new HashMap<String, TaskData>();

    for (TeamRecord rcd : records) {
      // If this line's rmlogin is not in the database, we need to delete this line
      if (!rmLoginNames.contains(rcd.getRmlogin())) {
        // need to add a log
        continue;
      }

      // to find userid according rmlogin, rmlogin is the remedy's name
      // useridtd is String array, useridtd[0] is userId, useridtd[1] is
      // timesheetid, useridtd[2] is staffid
      String[] strs = trackingTicketScriptDao.findUserId(rcd.getRmlogin(), startDate, endDate);
      String uid = strs[0];
      String tid = strs[1];
      String sid = strs[2];

      String assignmentid = trackingTicketScriptDao.findassignmentId(rcd.getTask());

      // distinguish the data by assignmentid and id, to confirm each task's ticket_id
      if (!ticket_map.containsKey(assignmentid + ":" + uid)) {
        TaskData taskdata = new TaskData();
        taskdata.setAssignmentid(assignmentid);
        ticket_map.put(assignmentid + ":" + uid, taskdata);
      }

      TaskData taskdata = ticket_map.get(assignmentid + ":" + uid);
      taskdata.setRmlogin(rcd.getRmlogin());
      TicketInfo ticketinfo = new TicketInfo();
      ticketinfo.setDescription(rcd.getTask());
      ticketinfo.setAssignee(uid);
      ticketinfo.setTicket_id(rcd.getTicketNumber());
      String ticket_id =
          new Integer(trackingTicketScriptDao.getticket_id(rcd.getTicketNumber())).toString();

      // gain the TicketInfo data information from excel
      ticketinfo.setId(ticket_id);
      ticketinfo.setFunctionPoint(rcd.getFp());
      ticketinfo.setEstimation(rcd.getEst());
      ticketinfo.setProgress(rcd.getProgress());
      ticketinfo.setInternalCommentsCount(rcd.getInternal_Comments());
      ticketinfo.setWmCommentsCount(rcd.getWm_Comments());
      ticketinfo.setInternalReviewEffort(rcd.getInternal_Review_Effort());
      ticketinfo.setInternalReworkEffort(rcd.getInternal_Rework_Effort());
      ticketinfo.setExternalReworkEffort(rcd.getExternal_Rework_Effort());
      ticketinfo.setTransactionCount(rcd.getTransaction());
      ticketinfo.setUpdateBy(sid);

      // gain the TicketLog data information from excel
      TicketLog ticketLog = new TicketLog();
      ticketLog.setAssignmentId(trackingTicketScriptDao.findassignmentId(rcd.getTask()));
      ticketLog.setHourSpends(rcd.getDays());
      ticketLog.setTimesheetId(tid);
      ticketLog.setAssigneeId(sid);
      ticketLog.setTicketId(ticket_id);
      ticketLog.setComment(rcd.getComment());

      taskdata.ticketinfos.add(ticketinfo);
      taskdata.ticketLogs.add(ticketLog);
      taskdata.setWrong_log(rcd.getWrong_log());
    }

    List<TaskData> list = new ArrayList<TaskData>(ticket_map.values());
    return list;
  }