// insert the data that has been validated private void updateTracktingTicketData(List<UserTicketTrackingData> userdatas) throws SQLException { for (UserTicketTrackingData userdata : userdatas) { String user_sid = trackingTicketScriptDao.finduser_id(userdata.getUserId()); String user_uid_timesheetid = userdata.getTimesheetId(); List<TaskData> user_taskdata = userdata.getTaskdatas(); for (TaskData taskdata : user_taskdata) { String user_task_assignmentId = taskdata.assignmentid; List<TicketInfo> tickets = taskdata.ticketinfos; List<TicketLog> ticketLogs = taskdata.ticketLogs; updateTicketsForOneUser( user_sid, user_task_assignmentId, user_uid_timesheetid, tickets, ticketLogs); } } }
// According to userid and assignmentid, pasrse the teamrecord data group by user public List<UserTicketTrackingData> parseUserData(List<TaskData> taskdatas) throws SQLException { Map<String, UserTicketTrackingData> userid_map = new HashMap<String, UserTicketTrackingData>(); for (TaskData user_assignmetid_taskData : taskdatas) { String userid = user_assignmetid_taskData.ticketinfos.get(0).assignee; String timesheetid = trackingTicketScriptDao.findtimeSheetId(userid, startDate, endDate); String rmlogin = user_assignmetid_taskData.getRmlogin(); if (!userid_map.containsKey(userid)) { UserTicketTrackingData userdata = new UserTicketTrackingData(); userdata.setUserId(userid); userdata.setTimesheetId(timesheetid); userdata.setRmlogin(rmlogin); // userdata.taskdatas.add(user_assignmetid_taskData); userid_map.put(userid, userdata); } UserTicketTrackingData userdata = userid_map.get(userid); userdata.getTaskdatas().add(user_assignmetid_taskData); } List<UserTicketTrackingData> list = new ArrayList<UserTicketTrackingData>(userid_map.values()); return list; }