package com.uas.service.donate.controller; import com.alibaba.fastjson.JSONObject; import com.uas.service.donate.model.ActivityRecode; import com.uas.service.donate.service.ActivityRecodeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @Controller @RequestMapping("/activityRecode") public class ActivityRecodeController { @Autowired private ActivityRecodeService activityRecodeService; /** * 参与活动 */ @ResponseBody @RequestMapping("/join") public ActivityRecode join(Long activityId,Long uuid){ ActivityRecode activityRecode=new ActivityRecode(); activityRecode.setActivityId(activityId); activityRecode.setUuid(uuid); activityRecode.setStatus(0); ActivityRecode activity=activityRecodeService.save(activityRecode); return activity; } /** *查询某一用户参加过的活动 */ @ResponseBody @RequestMapping("/queryOne") public List queryOne(Long uuid){ return activityRecodeService.queryOne(uuid); } /** * 查询某一活动参与者 * @param activityId * @return */ @ResponseBody @RequestMapping("/joins") public List joins(Long activityId){ return activityRecodeService.joins(activityId); } /** * 领奖 1.未领取 2.已领取 */ @ResponseBody @RequestMapping("/receive") public ActivityRecode receive(Long activityId,Long uuid){ ActivityRecode activityRecode=activityRecodeService.findOne(activityId,uuid); activityRecode.setStatus(2); activityRecode.setReceiveTime(new Date()); return activityRecode; } }