|
@@ -1,10 +1,16 @@
|
|
package com.game.business.controller;
|
|
package com.game.business.controller;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
+import com.game.business.domain.AppGameBetting;
|
|
|
|
+import com.game.business.vo.AppGameBettingVO;
|
|
|
|
+import com.game.business.vo.AppGameItemVO;
|
|
import com.game.common.core.domain.HttpRetArr;
|
|
import com.game.common.core.domain.HttpRetArr;
|
|
import com.game.common.core.domain.R;
|
|
import com.game.common.core.domain.R;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -59,10 +65,26 @@ public class AppGameItemController extends BaseController
|
|
*/
|
|
*/
|
|
@GetMapping("/listAll")
|
|
@GetMapping("/listAll")
|
|
@ApiOperation(value = "查询游戏所有选项", notes = "查询游戏所有选项")
|
|
@ApiOperation(value = "查询游戏所有选项", notes = "查询游戏所有选项")
|
|
- public HttpRetArr<AppGameItem> listAll(AppGameItem appGameItem)
|
|
|
|
|
|
+ public HttpRetArr<AppGameItemVO> listAll(AppGameItem appGameItem)
|
|
{
|
|
{
|
|
|
|
+ List<AppGameItemVO> resultList = new ArrayList<>();
|
|
List<AppGameItem> list = appGameItemService.selectAppGameItemList(appGameItem);
|
|
List<AppGameItem> list = appGameItemService.selectAppGameItemList(appGameItem);
|
|
- return HttpRetArr.success("查询成功", list);
|
|
|
|
|
|
+
|
|
|
|
+ if(list != null && !list.isEmpty()){
|
|
|
|
+
|
|
|
|
+ int lotterySum = list.stream().mapToInt(AppGameItem::getLotteryCount).sum();
|
|
|
|
+ BigDecimal lotteryCountSum = new BigDecimal(lotterySum);
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
+ AppGameItem gameItem = list.get(i);
|
|
|
|
+ AppGameItemVO appGameItemVO = new AppGameItemVO();
|
|
|
|
+ BeanUtils.copyProperties(gameItem, appGameItemVO);
|
|
|
|
+ BigDecimal lotteryCount = new BigDecimal(gameItem.getLotteryCount());
|
|
|
|
+ appGameItemVO.setLotteryRate(lotteryCount.divide(lotteryCountSum).setScale(2, BigDecimal.ROUND_DOWN).doubleValue());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return HttpRetArr.success("查询成功", resultList);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|