|
|
package com.yoho.activity.restapi;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import com.yoho.activity.service.DrawService;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.service.model.union.request.DrawRequestBO;
|
|
|
import com.yoho.service.model.union.response.DrawInfoResponseBO;
|
|
|
import com.yoho.service.model.user.other.response.DrawResponseBO;
|
|
|
import com.yoho.unions.common.ApiResponse;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping("/ActivityRest")
|
|
|
public class ActivityRest {
|
|
|
|
|
|
static Logger log = LoggerFactory.getLogger(ActivityRest.class);
|
|
|
|
|
|
@Resource
|
|
|
DrawService drawService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 元宵节抽签活动
|
|
|
* @param req
|
|
|
* @return
|
|
|
* @throws ServiceException
|
|
|
*/
|
|
|
@RequestMapping("/draw")
|
|
|
@ResponseBody public ApiResponse draw(@RequestBody DrawRequestBO req) throws ServiceException {
|
|
|
log.info("enter draw with param is {}", req);
|
|
|
DrawResponseBO resp = drawService.draw(req);
|
|
|
log.info("draw with param is {}. and response is {}", req, resp);
|
|
|
return new ApiResponse.ApiResponseBuilder().data(resp).build();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据uid,获取用户抽签情况
|
|
|
* @param req
|
|
|
* @return
|
|
|
* @throws ServiceException
|
|
|
*/
|
|
|
@RequestMapping("/getDrawInfo")
|
|
|
@ResponseBody public ApiResponse getDrawInfo(@RequestBody DrawRequestBO req) throws ServiceException {
|
|
|
log.info("enter getDrawInfo with param is {}", req);
|
|
|
DrawInfoResponseBO resp = drawService.getDrawInfo(req.getUid());
|
|
|
log.info("getDrawInfo with param is {}. and response is {}", req, resp);
|
|
|
return new ApiResponse.ApiResponseBuilder().data(resp).build();
|
|
|
}
|
|
|
} |
|
|
//package com.yoho.activity.restapi;
|
|
|
//
|
|
|
//import javax.annotation.Resource;
|
|
|
//
|
|
|
//import org.slf4j.Logger;
|
|
|
//import org.slf4j.LoggerFactory;
|
|
|
//import org.springframework.stereotype.Controller;
|
|
|
//import org.springframework.web.bind.annotation.RequestBody;
|
|
|
//import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
//import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
//
|
|
|
//import com.yoho.activity.service.DrawService;
|
|
|
//import com.yoho.error.exception.ServiceException;
|
|
|
//import com.yoho.service.model.union.request.DrawRequestBO;
|
|
|
//import com.yoho.service.model.union.response.DrawInfoResponseBO;
|
|
|
//import com.yoho.service.model.user.other.response.DrawResponseBO;
|
|
|
//import com.yoho.unions.common.ApiResponse;
|
|
|
//
|
|
|
//@Controller
|
|
|
//@RequestMapping("/ActivityRest")
|
|
|
//public class ActivityRest {
|
|
|
//
|
|
|
// static Logger log = LoggerFactory.getLogger(ActivityRest.class);
|
|
|
//
|
|
|
// @Resource
|
|
|
// DrawService drawService;
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
// /**
|
|
|
// * 元宵节抽签活动
|
|
|
// * @param req
|
|
|
// * @return
|
|
|
// * @throws ServiceException
|
|
|
// */
|
|
|
// @RequestMapping("/draw")
|
|
|
// @ResponseBody public ApiResponse draw(@RequestBody DrawRequestBO req) throws ServiceException {
|
|
|
// log.info("enter draw with param is {}", req);
|
|
|
// DrawResponseBO resp = drawService.draw(req);
|
|
|
// log.info("draw with param is {}. and response is {}", req, resp);
|
|
|
// return new ApiResponse.ApiResponseBuilder().data(resp).build();
|
|
|
// }
|
|
|
//
|
|
|
// /**
|
|
|
// * 根据uid,获取用户抽签情况
|
|
|
// * @param req
|
|
|
// * @return
|
|
|
// * @throws ServiceException
|
|
|
// */
|
|
|
// @RequestMapping("/getDrawInfo")
|
|
|
// @ResponseBody public ApiResponse getDrawInfo(@RequestBody DrawRequestBO req) throws ServiceException {
|
|
|
// log.info("enter getDrawInfo with param is {}", req);
|
|
|
// DrawInfoResponseBO resp = drawService.getDrawInfo(req.getUid());
|
|
|
// log.info("getDrawInfo with param is {}. and response is {}", req, resp);
|
|
|
// return new ApiResponse.ApiResponseBuilder().data(resp).build();
|
|
|
// }
|
|
|
//} |
...
|
...
|
|