package com.uas.console.donate.controller; import com.alibaba.fastjson.JSONObject; import com.uas.console.donate.model.ActivityRecode; import com.uas.console.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.util.ArrayList; import java.util.List; @Controller @RequestMapping("/activityRecode") public class ActivityRecodeController { @Autowired private ActivityRecodeService activityRecodeService; /** * 保存活动参与人信息 */ @ResponseBody @RequestMapping("/join") public ActivityRecode join(String jsonStr){ ActivityRecode activityRecode= JSONObject.parseObject(jsonStr, ActivityRecode.class); 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); } /** * 抽奖 */ /* @ResponseBody @RequestMapping("/extract") public List extract(Long activityId){ //根据活动id查询谁参与了抽奖 List list=activityRecodeService.joins(activityId); //根据活动id查询有哪些奖品 List list1=new ArrayList(); for(ActivityRecode joinActivity:list){ ActivityRecode join= activityRecodeService.extract(joinActivity.getUuid()); list1.add(join); } return list1; }*/ }