@Override public void missActivity(int userId, int activityId) { User user = userDao.getUserById(userId); Activity activity = activityDao.getActivityById(activityId); ActivityRecord activityRecord = activityDao.getActivityRecord(user, activity); activityRecord.setStatus(2); activityDao.updateObject(activityRecord); }
@Override public void reserveActivity(int userId, int activityId) { ActivityRecord activityRecord = new ActivityRecord(); User user = userDao.getUserById(userId); activityRecord.setUser(user); Activity activity = activityDao.getActivityById(activityId); activityRecord.setActivity(activity); activityRecord.setStatus(0); activityDao.saveObject(activityRecord); }
@Override public ArrayList<ActivityForm> showActivityRecord(int userId) { User user = userDao.getUserById(userId); ArrayList<ActivityRecord> activityRecordList = activityDao.getActivityRecord(user); ArrayList<ActivityForm> activityFormList = new ArrayList<ActivityForm>(); for (ActivityRecord activityRecord : activityRecordList) { ActivityForm activityForm = new ActivityForm(); BeanUtils.copyProperties(activityRecord, activityForm); BeanUtils.copyProperties(activityRecord.getActivity(), activityForm); activityForm.setUserId(userId); activityFormList.add(activityForm); } return activityFormList; }