|
|
@@ -1,11 +1,15 @@
|
|
|
package com.uas.platform.b2c.common.lottery.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.platform.b2c.common.lottery.service.ActivityItemService;
|
|
|
+import com.uas.platform.b2c.common.lottery.service.LotteryService;
|
|
|
import com.uas.platform.b2c.common.lottery.service.PrizeService;
|
|
|
import com.uas.platform.b2c.common.lottery.service.UserInfoService;
|
|
|
import com.uas.platform.b2c.common.lottery.service.WinningHistoryService;
|
|
|
+import com.uas.platform.b2c.common.search.util.PageParams;
|
|
|
import com.uas.platform.b2c.trade.support.ResultMap;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@@ -28,12 +32,15 @@ public class LotteryController {
|
|
|
|
|
|
private final WinningHistoryService winningHistoryService;
|
|
|
|
|
|
+ private final LotteryService lotteryService;
|
|
|
+
|
|
|
@Autowired
|
|
|
- public LotteryController(UserInfoService userInfoService, ActivityItemService activityItemService, PrizeService prizeService, WinningHistoryService winningHistoryService) {
|
|
|
+ public LotteryController(UserInfoService userInfoService, ActivityItemService activityItemService, PrizeService prizeService, WinningHistoryService winningHistoryService, LotteryService lotteryService) {
|
|
|
this.userInfoService = userInfoService;
|
|
|
this.activityItemService = activityItemService;
|
|
|
this.prizeService = prizeService;
|
|
|
this.winningHistoryService = winningHistoryService;
|
|
|
+ this.lotteryService = lotteryService;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -77,4 +84,26 @@ public class LotteryController {
|
|
|
public ResultMap getWinningHistories(String activityCode, Integer size) {
|
|
|
return winningHistoryService.getWinningHistories(activityCode, size);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页获取个人中奖记录
|
|
|
+ * @param activityCode 活动编码
|
|
|
+ * @param pageParams 分页参数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/user/winninghistories/one", method = RequestMethod.GET, produces = "application/json")
|
|
|
+ public JSONObject getWinningHistoriesByUser(String activityCode, PageParams pageParams) {
|
|
|
+ return winningHistoryService.getWinningHistoriesByUser(activityCode, pageParams);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户抽奖
|
|
|
+ * @param activityCode 活动编号
|
|
|
+ * @param itemCode 等级编号
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/user/draw", method = RequestMethod.GET, produces = "application/json")
|
|
|
+ public ResultMap drawLottery(String activityCode, String itemCode) {
|
|
|
+ return lotteryService.drawLottery(activityCode, itemCode);
|
|
|
+ }
|
|
|
}
|