src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java
@@ -20,8 +20,7 @@ registration.addPathPatterns("/api/**"); registration.excludePathPatterns("/api/login/register"); registration.excludePathPatterns("/api/login/toLogin"); registration.excludePathPatterns("/api/login/pwdForget"); registration.excludePathPatterns("/api/login/addRegisterAppeal"); registration.excludePathPatterns("/api/login/roomType"); registration.excludePathPatterns("/api/common/**"); registration.excludePathPatterns("/api/category/**"); registration.excludePathPatterns("/api/goods/**"); @@ -32,10 +31,6 @@ registration.excludePathPatterns("/api/unipay/agreeMentPayCallBack"); registration.excludePathPatterns("/api/unipay/singlePayCallBack"); registration.excludePathPatterns("/api/order/myScoreSet"); registration.excludePathPatterns("/api/login/createAccount"); registration.excludePathPatterns("/api/login/createKey"); registration.excludePathPatterns("/api/login/memberSpeak"); // registration.excludePathPatterns("/api/member/teamFcmList"); } @Override src/main/java/cc/mrbird/febs/common/enumerates/GameFlowTypeEnum.java
New file @@ -0,0 +1,24 @@ package cc.mrbird.febs.common.enumerates; import lombok.Getter; /** * * @author wzy * @date 2021-09-24 **/ @Getter public enum GameFlowTypeEnum { PLAYER_CHARGE(4,"充值"), OWNER_PERK(3,"开奖结果:{},{}"), PLAYER_PERK(2,"开奖结果:{},{},您的选择:{}"), PLAYER_PICK_NUM(1,"房间:{},选择:{}"); private int value; private String descrition; GameFlowTypeEnum(int value, String descrition) { this.value = value; this.descrition = descrition; } } src/main/java/cc/mrbird/febs/common/enumerates/GamePNGEnum.java
New file @@ -0,0 +1,57 @@ package cc.mrbird.febs.common.enumerates; import lombok.Getter; import java.util.ArrayList; import java.util.List; @Getter public enum GamePNGEnum { HU_LU(6, "葫芦",6), XIA(5, "虾",5), PANG_XIE(4, "螃蟹",4), YU(3, "鱼",3), LAO_HU(2, "老虎",2), SHI_ZI(1, "狮子",1); private Integer pngCode;//号码 private String pngName;//名称 private Integer pngTimes;//倍数 GamePNGEnum(Integer pngCode,String pngName,Integer pngTimes) { this.pngCode = pngCode; this.pngName = pngName; this.pngTimes = pngTimes; } /** * 获取全部列表 * @return */ public List<GamePNGEnum> getGamePng() { List<GamePNGEnum> objects = new ArrayList<>(); for (GamePNGEnum value : GamePNGEnum.values()) { objects.add(value); } return objects; } public GamePNGEnum getPng(int pngCode) { for (GamePNGEnum value : GamePNGEnum.values()) { if (value.pngCode == pngCode) { return value; } } return null; } public String getPngName(int pngCode) { for (GamePNGEnum value : GamePNGEnum.values()) { if (value.pngCode == pngCode) { return value.pngName; } } return null; } } src/main/java/cc/mrbird/febs/common/enumerates/GameRoomTypeEnum.java
New file @@ -0,0 +1,69 @@ package cc.mrbird.febs.common.enumerates; import lombok.Getter; import java.util.ArrayList; import java.util.List; @Getter public enum GameRoomTypeEnum { /** private String roomName;//名称 private Integer roomType;//房间类型 1-初级房2-土豪房3-尊爵房 private BigDecimal roomAmount;//进入最小金额 private BigDecimal minAmount;//投注最小金额 private BigDecimal maxAmount;//投注最大金额 private List<BigDecimal> amounts;//投注金额 */ ROOM_THREE("ROOM_THREE", "尊爵房",3,20000,1000,5000,"1000,2000,3000,4000,5000"), ROOM_TWO("ROOM_TWO", "土豪房",2,5000,100,500,"100,200,300,400,500"), ROOM_ONE("ROOM_ONE", "初级房",1,1000,10,50,"10,20,30,40,50"); private String roomCode;//名称 private String roomName;//名称 private Integer roomType;//房间类型 1-初级房2-土豪房3-尊爵房 private Integer roomAmount;//进入最小金额 private Integer minAmount;//投注最小金额 private Integer maxAmount;//投注最大金额 private String amounts;//投注金额 GameRoomTypeEnum(String roomCode, String roomName, Integer roomType, Integer roomAmount, Integer minAmount, Integer maxAmount, String amounts) { this.roomCode = roomCode; this.roomName = roomName; this.roomType = roomType; this.roomAmount = roomAmount; this.minAmount = minAmount; this.maxAmount = maxAmount; this.amounts = amounts; } /** * 获取全部列表 * @return */ public List<GameRoomTypeEnum> getRoomList() { List<GameRoomTypeEnum> objects = new ArrayList<>(); for (GameRoomTypeEnum value : GameRoomTypeEnum.values()) { objects.add(value); } return objects; } public GameRoomTypeEnum getRoom(int roomType) { for (GameRoomTypeEnum value : GameRoomTypeEnum.values()) { if (value.roomType == roomType) { return value; } } return null; } } src/main/java/cc/mrbird/febs/common/interceptor/LoginInterceptor.java
@@ -92,7 +92,7 @@ boolean isDebug = true; if (!isDebug) { long currentTime = System.currentTimeMillis(); return currentTime - time <= 30000; return currentTime - time <= 3600000; } return true; } src/main/java/cc/mrbird/febs/common/utils/AppContants.java
@@ -85,4 +85,7 @@ public static final int MEMBER_FLOW_DONE = 2; public static final int MEMBER_PARTNER_YES = 1; public static final int MEMBER_PARTNER_NO = 2; } src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
@@ -646,9 +646,7 @@ String account = new StringBuilder().append("bbsz").append(ShareCodeUtil.toSerialNumberCode(selectCount)).toString(); String key = ShareCodeUtil.toSerialNumberCode(selectCount); registerDto.setAccountLogin(account); registerDto.setUserKey(key); registerDto.setPassword("a123456"); registerDto.setTradePassword("123456"); registerDto.setInviteId(member.getInviteId()); apiMallMemberService.register(registerDto); return new FebsResponse().success(); src/main/java/cc/mrbird/febs/mall/controller/ApiGameController.java
New file @@ -0,0 +1,58 @@ package cc.mrbird.febs.mall.controller; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.service.GameService; import cc.mrbird.febs.mall.vo.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; /** * @author wzy * @date 2021-09-16 **/ @Slf4j @RestController @CrossOrigin("*") @RequestMapping(value = "/api/gameOwner") @RequiredArgsConstructor @Api(value = "ApiGameController", tags = "GUESS游戏房主接口类") public class ApiGameController { private final GameService gameService; @ApiOperation(value = "GUESS创建房间", notes = "GUESS创建房间") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiCreateRoomVo.class) }) @PostMapping(value = "/createRoom") public FebsResponse createRoom(@RequestBody @Valid ApiCreateRoomDto apiCreateRoomDto) { return gameService.createRoom(apiCreateRoomDto); } @ApiOperation(value = "GUESS点击开始", notes = "GUESS点击开始") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiStartGameVo.class) }) @PostMapping(value = "/startGame") public FebsResponse startGame(@RequestBody @Valid ApiStartGameDto startGameDto) { return gameService.startGame(startGameDto); } @ApiOperation(value = "GUESS点击结束", notes = "GUESS点击结束") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiEndGameVo.class) }) @PostMapping(value = "/endGame") public FebsResponse endGame(@RequestBody @Valid ApiEndGameDto endGameDto) { return gameService.endGame(endGameDto); } } src/main/java/cc/mrbird/febs/mall/controller/ApiGamePlayerController.java
New file @@ -0,0 +1,73 @@ package cc.mrbird.febs.mall.controller; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.service.GameService; import cc.mrbird.febs.mall.vo.ApiCreateRoomVo; import cc.mrbird.febs.mall.vo.ApiFlashGameVo; import cc.mrbird.febs.mall.vo.ApiGamePlayerVo; import cc.mrbird.febs.mall.vo.ApiNextGameVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; /** * @author wzy * @date 2021-09-16 **/ @Slf4j @RestController @CrossOrigin("*") @RequestMapping(value = "/api/gamePlayer") @RequiredArgsConstructor @Api(value = "ApiGamePlayerController", tags = "GUESS游戏玩家接口类") public class ApiGamePlayerController { private final GameService gameService; @ApiOperation(value = "GUESS进入游戏", notes = "GUESS进入游戏") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiGamePlayerVo.class) }) @PostMapping(value = "/gameIn") public FebsResponse gameIn(@RequestBody @Valid ApiGameDto apiGameDto) { return gameService.gameIn(apiGameDto); } @ApiOperation(value = "GUESS投注", notes = "GUESS投注") @PostMapping(value = "/chooseNum") public FebsResponse chooseNum(@RequestBody @Valid ApiChooseNumDto apiChooseNumDto) { return gameService.chooseNum(apiChooseNumDto); } @ApiOperation(value = "GUESS刷新当前一局", notes = "GUESS刷新当前一局") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiNextGameVo.class) }) @PostMapping(value = "/nextGame") public FebsResponse nextGame(@RequestBody @Valid ApiNextGameDto apiNextGameDto) { return gameService.nextGame(apiNextGameDto); } @ApiOperation(value = "GUESS刷新当前投注信息", notes = "GUESS刷新当前投注信息") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiFlashGameVo.class) }) @PostMapping(value = "/flashGame") public FebsResponse flashGame(@RequestBody @Valid ApiFlashGameDto apiFlashGameDto) { return gameService.flashGame(apiFlashGameDto); } @ApiOperation(value = "GUESS退出", notes = "GUESS退出") @PostMapping(value = "/existGame") public FebsResponse existGame(@RequestBody @Valid ApiExistGameDto apiExistGameDto) { return gameService.existGame(apiExistGameDto); } } src/main/java/cc/mrbird/febs/mall/controller/ApiLoginController.java
@@ -3,9 +3,12 @@ import cc.mrbird.febs.common.annotation.Limit; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.service.GameService; import cc.mrbird.febs.mall.service.IApiMallMemberService; import cc.mrbird.febs.mall.vo.ApiRegisterVo; import cc.mrbird.febs.mall.vo.MallMemberPaymentVo; import cc.mrbird.febs.mall.vo.MallMemberVo; import cc.mrbird.febs.mall.vo.RoomTypeVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; @@ -26,26 +29,13 @@ @RequiredArgsConstructor @RestController @RequestMapping(value = "/api/login") @Api(value = "ApiLoginController", tags = "登录注册类") @Api(value = "ApiLoginController", tags = "GUESS登录注册类") public class ApiLoginController { private final IApiMallMemberService memberService; private final GameService gameService; @ApiOperation(value = "FCM-点击生成账号", notes = "FCM-点击生成账号") @GetMapping(value = "/createAccount") @Limit(key = "createAccount", period = 60, count = 5, name = "点击生成账号", prefix = "limit") public FebsResponse createAccount() { return memberService.createAccount(); } @ApiOperation(value = "FCM-点击生成密钥", notes = "FCM-点击生成密钥") @GetMapping(value = "/createKey") @Limit(key = "createKey", period = 60, count = 5, name = "点击生成密钥", prefix = "limit") public FebsResponse createKey() { return memberService.createKey(); } @ApiOperation(value = "FCM-app注册接口", notes = "FCM-app注册接口") @ApiOperation(value = "GUESS注册接口", notes = "GUESS注册接口") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiRegisterVo.class) }) @@ -54,39 +44,19 @@ return memberService.register(registerDto); } @ApiOperation(value = "FCM-账号密码登录接口", notes = "FCM-账号密码登录接口") @ApiOperation(value = "GUESS账号密码登录接口", notes = "GUESS账号密码登录接口") @PostMapping(value = "/toLogin") public FebsResponse login(@RequestBody @Valid LoginDto loginDto) { return memberService.toLogin(loginDto); } @ApiOperation(value = "FCM-忘记/修改密码", notes = "FCM-忘记/修改密码") @PostMapping(value = "/forgetPwd") public FebsResponse forgetPwd(@RequestBody @Valid ForgetPwdDto forgetPwdDto) { return memberService.forgetPwd(forgetPwdDto); @ApiOperation(value = "GUES获取大厅信息", notes = "GUES获取大厅信息") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = RoomTypeVo.class) }) @PostMapping(value = "/roomType") public FebsResponse roomType() { return gameService.roomType(); } @ApiOperation(value = "FCM-忘记密码", notes = "FCM-忘记/修改密码") @PostMapping(value = "/pwdForget") public FebsResponse pwdForget(@RequestBody @Valid ForgetPwdDto forgetPwdDto) { return memberService.pwdForget(forgetPwdDto); } @ApiOperation(value = "提交注册申诉", notes = "提交注册申诉") @PostMapping(value = "addRegisterAppeal") public FebsResponse addRegisterAppeal(@RequestBody @Valid RegisterAppealDto registerAppeal) { memberService.addRegisterAppeal(registerAppeal); return new FebsResponse().success().message("申请成功"); } @ApiOperation(value = "客户留言", notes = "客户留言") @PostMapping(value = "memberSpeak") @Limit(key = "memberSpeak", period = 60, count = 2, name = "客户留言", prefix = "limit") public FebsResponse memberSpeak(@RequestBody @Valid ApiMemberSpeakDto memberSpeakDto) { return memberService.memberSpeak(memberSpeakDto); } } src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java
@@ -29,14 +29,14 @@ @CrossOrigin("*") @RequestMapping(value = "/api/member") @RequiredArgsConstructor @Api(value = "ApiMallMemberController", tags = "商城用户接口类") @Api(value = "ApiMallMemberController", tags = "GUESS用户接口类") public class ApiMallMemberController { private final IApiMallMemberService memberService; private final IMallMemberWithdrawService mallMemberWithdrawService; private final IApiMallMemberWalletService walletService; @ApiOperation(value = "FCM-获取商城用户信息", notes = "FCM-获取商城用户信息") @ApiOperation(value = "GUESS用户信息", notes = "GUESS用户信息") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = MallMemberVo.class) }) @@ -45,47 +45,13 @@ return memberService.findMemberInfo(); } @ApiOperation(value = "FCM-修改用户信息") @PostMapping(value = "/modifyInfo") public FebsResponse modifyInfo(@RequestBody @Valid ModifyMemberInfoDto modifyMemberInfoDto) { return memberService.modifyMemberInfo(modifyMemberInfoDto); } @ApiOperation(value = "FCM-解除冻结") @PostMapping(value = "/unfreeze") public FebsResponse unfreeze(@RequestBody @Valid UnfreezeDto unfreezeDto) { return memberService.unfreeze(unfreezeDto); } @ApiOperation(value = "FCM-找回密钥") @PostMapping(value = "/getKey") public FebsResponse getKey(@RequestBody @Valid GetKeyDto getKeyDto) { return memberService.getKey(getKeyDto); } @ApiOperation(value = "FCM-获取收款信息", notes = "FCM-获取收款信息") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = MallMemberPaymentVo.class) }) @GetMapping(value = "/getPayment") public FebsResponse getPayment() { return memberService.getPayment(); } @ApiOperation(value = "FCM-修改收款信息", notes = "FCM-修改收款信息") @PostMapping(value = "/updatePayment") public FebsResponse updatePayment(@RequestBody @Valid UpdatePaymentDto updatePaymentDto) { return memberService.updatePayment(updatePaymentDto); } @ApiOperation(value = "FCM-充值", notes = "FCM-充值") @ApiOperation(value = "GUESS充值", notes = "GUESS充值") @PostMapping(value = "/chargeBalance") public FebsResponse chargeBalance(@RequestBody @Valid ApiChargeBalanceDto apiChargeBalanceDto) { return memberService.chargeBalance(apiChargeBalanceDto); } @ApiOperation(value = "FCM-提现") @ApiOperation(value = "GUESS提现") @PostMapping(value = "/withdrawalBalance") public FebsResponse withdrawalBalance(@RequestBody @Validated WithdrawalBalanceDto withdrawalBalanceDto) { mallMemberWithdrawService.withdrawalBalance(withdrawalBalanceDto); @@ -93,193 +59,40 @@ } @ApiOperation(value = "FCM-推出登录", notes = "FCM-推出登录") @ApiOperation(value = "GUESS推出登录", notes = "GUESS推出登录") @PostMapping(value = "/logout") public FebsResponse logout() { return memberService.logout(); } @ApiOperation(value = "获取购物车、订单等角标数量") @GetMapping(value = "/findMarkCnt") public FebsResponse findMarkCnt() { return memberService.findMemberMarkCnt(); } @ApiOperation(value = "FCM-设置支付密码") @PostMapping(value = "/setTradePwd") public FebsResponse setTradePwd(@RequestBody ForgetPwdDto forgetPwdDto) { return memberService.setTradePwd(forgetPwdDto); } @ApiOperation(value = "我的团队列表") @ApiOperation(value = "GUESS我的团队规模") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = MyTeamVo.class) }) @PostMapping(value = "/teamList") public FebsResponse teamList(@RequestBody TeamListDto teamListDto) { return memberService.teamList(teamListDto); public FebsResponse teamList() { return memberService.teamList(); } @ApiOperation(value = "FCM-我的团队列表") @ApiOperation(value = "GUESS我的团队详情") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = MyFcmTeamVo.class) }) @PostMapping(value = "/teamFcmList") public FebsResponse teamFcmList(@RequestBody TeamListDto teamListDto) { return memberService.teamFcmList(teamListDto); @PostMapping(value = "/teamInfo") public FebsResponse teamInfo() { return memberService.teamFcmList(); } @ApiOperation(value = "FCM-资金流水列表") @ApiOperation(value = "GUESS资金流水列表") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = MoneyFlowVo.class) }) @PostMapping(value = "/moneyFlow") public FebsResponse moneyFlow(@RequestBody MoneyFlowDto moneyFlowDto) { return memberService.moneyFlows(moneyFlowDto); } @ApiOperation(value = "FCM-资金流水列表-互转记录") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = MoneyFlowVo.class) }) @PostMapping(value = "/moneyFlowInside") public FebsResponse moneyFlowInside(@RequestBody MoneyFlowDto moneyFlowDto) { return memberService.moneyFlowInside(moneyFlowDto); } @ApiOperation(value = "FCM-转账") @PostMapping(value = "/transfer") public FebsResponse transfer(@RequestBody @Validated TransferDto transferDto) { memberService.transfer(transferDto); return new FebsResponse().success().message("操作成功"); } @ApiOperation(value = "提现规则", notes = "提现规则") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = CashOutSettingVo.class) }) @GetMapping(value = "/cashOutSetting") public FebsResponse cashOutSetting() { return new FebsResponse().success().data(memberService.cashOutSetting()); } @ApiOperation(value = "提现") @PostMapping(value = "/withdrawal") public FebsResponse withdrawal(@RequestBody @Validated WithdrawalDto withdrawalDto) { mallMemberWithdrawService.withdrawal(withdrawalDto); return new FebsResponse().success().message("提交成功"); } @ApiOperation(value = "设置收款方式") @PostMapping(value = "/setPayment") public FebsResponse setPayment(@RequestBody MallMemberPayment mallMemberPayment) { memberService.setPayment(mallMemberPayment); return new FebsResponse().success().message("设置成功"); } @ApiOperation(value = "获取收款方式") @GetMapping(value = "/findPayment") public FebsResponse findPayment() { return new FebsResponse().success().data(memberService.findMemberPayment()); } @ApiOperation(value = "绑定手机号") @PostMapping(value = "/bindPhone") public FebsResponse bindPhone(@RequestBody AccountAndCodeDto accountAndCodeDto) { memberService.bindPhone(accountAndCodeDto); return new FebsResponse().success().message("绑定成功"); } @ApiOperation(value = "可提现金额") @GetMapping(value = "/canWithdrawal") public FebsResponse canWithdrawal() { return new FebsResponse().success().data(memberService.canMoney()); } @ApiOperation(value = "用户消费排名") @PostMapping(value = "/findRankList") public FebsResponse findRankList(@RequestBody RankListDto rankListDto) { // return new FebsResponse().success().data(memberService.findRankList(rankListDto)); return new FebsResponse().success(); } @ApiOperation(value = "根据邀请码或者手机号获取昵称") @PostMapping(value = "/findMemberInfoByAccount/{phone}") public FebsResponse findMemberInfoByAccount(@PathVariable("phone") String phone) { MallMember account = memberService.findMemberInfoByAccount(phone); if (account == null) { return new FebsResponse().fail().message("用户不存在"); } MallMemberVo member = new MallMemberVo(); member.setName(account.getName()); return new FebsResponse().success().data(member); } @ApiOperation(value = "佣金划转") @PostMapping(value = "/commissionChange") public FebsResponse commissionChange(@RequestBody @Validated CommissionChangeDto commissionChange) { walletService.commissionChange(commissionChange); return new FebsResponse().success(); } @ApiOperation(value = "我的权益") @ApiResponses( @ApiResponse(code = 200, message = "success", response = MyCommissionVo.class) ) @PostMapping(value = "/myCommission") public FebsResponse myCommission() { return new FebsResponse().success().data(memberService.myCommission()); } @ApiOperation(value = "商铺申请是否存在") @PostMapping(value = "/shopApplyIsExist") public FebsResponse shopApplyIsExist() { return null; } @ApiOperation(value = "新增银行卡") @PostMapping(value = "/addMemberBank") public FebsResponse addMemberBank(@RequestBody AddMemberBankDto addMemberBankDto) { return memberService.addMemberBank(addMemberBankDto); } @ApiOperation(value = "银行卡列表", notes = "银行卡列表") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = MemberBankListVo.class) }) @PostMapping(value = "/memberBankList") public FebsResponse memberBankList(@RequestBody MemberBankListDto memberBankListDto) { return memberService.findMemberBankList(memberBankListDto); } @ApiOperation(value = "银行卡详情", notes = "银行卡详情") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = MemberBankListVo.class) }) @GetMapping(value = "/memberBankDetails/{id}") public FebsResponse memberBankDetails(@PathVariable("id") Long id) { return memberService.findBankDetailsById(id); } @ApiOperation(value = "更新银行卡") @PostMapping(value = "/updateMemberBank") public FebsResponse updateMemberBank(@RequestBody UpdateMemberBankDto updateMemberBankDto) { return memberService.updateMemberBank(updateMemberBankDto); } @ApiOperation(value = "删除银行卡", notes = "删除银行卡") @PostMapping(value = "/delMemberBank/{id}") public FebsResponse delMemberBank(@PathVariable("id") Long id) { return memberService.delMemberBank(id); } @ApiOperation(value = "银行名称列表", notes = "银行名称列表") @GetMapping(value = "/memberBankName") public FebsResponse memberBankDetails() { return memberService.findBankName(); } } src/main/java/cc/mrbird/febs/mall/dto/ApiChooseNumDto.java
New file @@ -0,0 +1,32 @@ package cc.mrbird.febs.mall.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import java.math.BigDecimal; @Data @ApiModel(value = "ApiChooseNumDto", description = "参数接收类") public class ApiChooseNumDto { @NotNull(message = "参数不能为空") @ApiModelProperty(value = "房间ID") private Long roomId; @NotNull(message = "参数不能为空") @ApiModelProperty(value = "游戏ID") private Long gameId; @NotNull(message = "参数不能为空") @ApiModelProperty(value = "投注数字") private Integer chooseNum; @Min(10) @NotNull(message = "参数不能为空") @ApiModelProperty(value = "投注金额") private BigDecimal amount; } src/main/java/cc/mrbird/febs/mall/dto/ApiCreateRoomDto.java
New file @@ -0,0 +1,22 @@ package cc.mrbird.febs.mall.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; import java.math.BigDecimal; @Data @ApiModel(value = "ApiCreateRoomDto", description = "参数接收类") public class ApiCreateRoomDto { @NotNull(message = "参数不能为空") @ApiModelProperty(value = "房间类型 1-初级房2-土豪房3-尊爵房", example = "1") private Integer roomType; @NotNull(message = "参数不能为空") @ApiModelProperty(value = "一局游戏时长", example = "1") private Integer gameTime; } src/main/java/cc/mrbird/febs/mall/dto/ApiEndGameDto.java
New file @@ -0,0 +1,21 @@ package cc.mrbird.febs.mall.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; @Data @ApiModel(value = "ApiEndGameDto", description = "参数接收类") public class ApiEndGameDto { @NotNull(message = "参数不能为空") @ApiModelProperty(value = "房间ID") private Long roomId; @NotNull(message = "参数不能为空") @ApiModelProperty(value = "游戏ID") private Long gameId; } src/main/java/cc/mrbird/febs/mall/dto/ApiExistGameDto.java
New file @@ -0,0 +1,17 @@ package cc.mrbird.febs.mall.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; @Data @ApiModel(value = "ApiExistGameDto", description = "参数接收类") public class ApiExistGameDto { @NotNull(message = "参数不能为空") @ApiModelProperty(value = "房间ID") private Long roomId; } src/main/java/cc/mrbird/febs/mall/dto/ApiFlashGameDto.java
New file @@ -0,0 +1,16 @@ package cc.mrbird.febs.mall.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; @Data @ApiModel(value = "ApiFlashGameDto", description = "参数接收类") public class ApiFlashGameDto { @NotNull(message = "参数不能为空") @ApiModelProperty(value = "游戏ID") private Long gameId; } src/main/java/cc/mrbird/febs/mall/dto/ApiGameDto.java
New file @@ -0,0 +1,17 @@ package cc.mrbird.febs.mall.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; @Data @ApiModel(value = "ApiGameDto", description = "参数接收类") public class ApiGameDto { @NotNull(message = "参数不能为空") @ApiModelProperty(value = "房间唯一编码,自动生成", example = "1") private String password; } src/main/java/cc/mrbird/febs/mall/dto/ApiNextGameDto.java
New file @@ -0,0 +1,16 @@ package cc.mrbird.febs.mall.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; @Data @ApiModel(value = "ApiNextGameDto", description = "参数接收类") public class ApiNextGameDto { @NotNull(message = "参数不能为空") @ApiModelProperty(value = "游戏ID") private Long gameId; } src/main/java/cc/mrbird/febs/mall/dto/ApiStartGameDto.java
New file @@ -0,0 +1,16 @@ package cc.mrbird.febs.mall.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; @Data @ApiModel(value = "ApiStartGameDto", description = "请求类") public class ApiStartGameDto { @NotNull(message = "参数不能为空") @ApiModelProperty(value = "房间ID") private Long roomId; } src/main/java/cc/mrbird/febs/mall/dto/MoneyFlowDto.java
@@ -19,15 +19,6 @@ @ApiModelProperty(value = "页码", example = "1") private Integer pageNum; @ApiModelProperty(value = "类型 ") private Integer type; @ApiModelProperty(value = "类型 1-全部 2-支出 3-收入") private Integer inOrOut; @ApiModelProperty(value = "流水类型 1-FCM代币 2-令牌 3-NFT") private Integer flowType; @ApiModelProperty(hidden = true) private Long memberId; } src/main/java/cc/mrbird/febs/mall/dto/RegisterDto.java
@@ -18,17 +18,9 @@ @ApiModelProperty(value = "账号", example = "hjsj") private String accountLogin; // @NotBlank(message = "密钥不能为空") @ApiModelProperty(value = "密钥", example = "15773001234") private String userKey; @NotBlank(message = "登录密码不能为空") @ApiModelProperty(value = "登录密码", example = "123456") private String password; @NotBlank(message = "交易密码不能为空") @ApiModelProperty(value = "交易密码", example = "123456") private String tradePassword; @NotBlank(message = "邀请码不能为空") @ApiModelProperty(value = "邀请码") src/main/java/cc/mrbird/febs/mall/entity/GameGame.java
New file @@ -0,0 +1,34 @@ package cc.mrbird.febs.mall.entity; import cc.mrbird.febs.common.entity.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.math.BigDecimal; import java.util.Date; @Data @TableName("game_game") public class GameGame extends BaseEntity { private Long roomId;// private Long memberId;//房主用户表ID private Integer firstNum;//第一个数 private Integer secondNum;//第二个数 private Integer state;//1-等待投注中 2-结束投注(10秒倒计时,结束投注) 3-结算中 4-已结算 public static final Integer STATE_READY = 1; public static final Integer STATE_DONE = 2; public static final Integer STATE_PERK = 3; public static final Integer STATE_OVER = 4; private BigDecimal pickOne;//投注1的总金额 private BigDecimal pickTwo; private BigDecimal pickThree; private BigDecimal pickFour; private BigDecimal pickFive; private BigDecimal pickSix; private Date perkTime;//开奖时间 } src/main/java/cc/mrbird/febs/mall/entity/GameGameChild.java
New file @@ -0,0 +1,31 @@ package cc.mrbird.febs.mall.entity; import cc.mrbird.febs.common.entity.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.math.BigDecimal; @Data @TableName("game_game_child") public class GameGameChild extends BaseEntity { private Long gameId;// private Long memberId;//用户表ID private BigDecimal amount;//投注金额 private Integer pickNum;//投注数字 private Integer state;//投注状态1-待结算2-已结算 public static final Integer STATE_ING = 1; public static final Integer STATE_DONE = 2; private Integer perkNumOne;//开出来的号码1 private Integer perkNumTwo;//开出来的号码2 private Integer perkState;//中奖状态 1-中奖 2-未中奖 public static final Integer PERK_STATE_YES = 1; public static final Integer PERK_STATE_NO = 2; private BigDecimal perkAmount;//中奖金额 } src/main/java/cc/mrbird/febs/mall/entity/GameRoom.java
New file @@ -0,0 +1,23 @@ package cc.mrbird.febs.mall.entity; import cc.mrbird.febs.common.entity.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data @TableName("game_room") public class GameRoom extends BaseEntity { private Integer roomType;//房间类型 1-初级房2-土豪房3-尊爵房 private String password;//房间密码(房间唯一编码,自动生成) private Long ownerMemberId;//房主用户表ID private Integer state;//房间状态0-未开始1-正常2-结束 public static final Integer STATE_READY = 0; public static final Integer STATE_ING = 1; public static final Integer STATE_DONE = 2; private Integer gameTime;//游戏时长 } src/main/java/cc/mrbird/febs/mall/entity/GameRoomChild.java
New file @@ -0,0 +1,18 @@ package cc.mrbird.febs.mall.entity; import cc.mrbird.febs.common.entity.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data @TableName("game_room_child") public class GameRoomChild extends BaseEntity { private Long roomId;// private Long memberId;//用户表ID private Integer ownerState;//1-房主 2-玩家 public static final Integer OWNER_TRUE = 1; public static final Integer OWNER_FALSE = 2; } src/main/java/cc/mrbird/febs/mall/entity/MallMember.java
@@ -148,7 +148,7 @@ private Integer creater; /** * 合伙人 1-是 2-否 节点 * 代理 1-是 2-否(初始化) */ private Integer partner; /** src/main/java/cc/mrbird/febs/mall/mapper/GameGameChildMapper.java
New file @@ -0,0 +1,7 @@ package cc.mrbird.febs.mall.mapper; import cc.mrbird.febs.mall.entity.GameGameChild; import com.baomidou.mybatisplus.core.mapper.BaseMapper; public interface GameGameChildMapper extends BaseMapper<GameGameChild> { } src/main/java/cc/mrbird/febs/mall/mapper/GameGameMapper.java
New file @@ -0,0 +1,7 @@ package cc.mrbird.febs.mall.mapper; import cc.mrbird.febs.mall.entity.GameGame; import com.baomidou.mybatisplus.core.mapper.BaseMapper; public interface GameGameMapper extends BaseMapper<GameGame> { } src/main/java/cc/mrbird/febs/mall/mapper/GameRoomChildMapper.java
New file @@ -0,0 +1,7 @@ package cc.mrbird.febs.mall.mapper; import cc.mrbird.febs.mall.entity.GameRoomChild; import com.baomidou.mybatisplus.core.mapper.BaseMapper; public interface GameRoomChildMapper extends BaseMapper<GameRoomChild> { } src/main/java/cc/mrbird/febs/mall/mapper/GameRoomMapper.java
New file @@ -0,0 +1,7 @@ package cc.mrbird.febs.mall.mapper; import cc.mrbird.febs.mall.entity.GameRoom; import com.baomidou.mybatisplus.core.mapper.BaseMapper; public interface GameRoomMapper extends BaseMapper<GameRoom> { } src/main/java/cc/mrbird/febs/mall/mapper/MallMoneyFlowMapper.java
@@ -55,4 +55,8 @@ MallMoneyFlow selectByOrderAndType(@Param("orderNo")String orderNo, @Param("type")int type, @Param("flowType")int flowType, @Param("memberId")Long memberId); IPage<MoneyFlowVo> selectApiFcmMoneyFlowInsideInPage(IPage<MoneyFlowVo> page, @Param("record") MoneyFlowDto moneyFlowDto); BigDecimal selectSumAmountByMemberIdAndType(@Param("list")List<Long> memberId, @Param("type")int type); BigDecimal selectSumByMemberIdAndType(@Param("memberId")Long memberId, @Param("type")int type); } src/main/java/cc/mrbird/febs/mall/service/GameService.java
New file @@ -0,0 +1,48 @@ package cc.mrbird.febs.mall.service; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.entity.GameRoom; import com.baomidou.mybatisplus.extension.service.IService; import java.math.BigDecimal; import java.util.List; public interface GameService extends IService<GameRoom> { FebsResponse roomType(); FebsResponse createRoom(ApiCreateRoomDto apiCreateRoomDto); FebsResponse startGame(ApiStartGameDto startGameDto); /** * 给房间的每一个人发消息 * @param roomId * @param msg 消息:房间ID */ void sendMsgByRoomId(Long roomId,String msg); void sendMsgByMemberIds(List<Long> memberIds,String msg); /** * 给每一个人发消息 * @param memberId * @param msg 自定义消息 */ void sendMsgByMemberId(Long memberId,String msg); FebsResponse chooseNum(ApiChooseNumDto apiChooseNumDto); FebsResponse gameIn(ApiGameDto apiGameDto); FebsResponse endGame(ApiEndGameDto endGameDto); BigDecimal perkGameGameChild(Long gameId,int firstNum,int secondNum); FebsResponse nextGame(ApiNextGameDto apiNextGameDto); FebsResponse existGame(ApiExistGameDto apiExistGameDto); FebsResponse flashGame(ApiFlashGameDto apiFlashGameDto); } src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java
@@ -31,9 +31,9 @@ FebsResponse modifyMemberInfo(ModifyMemberInfoDto modifyMemberInfoDto); FebsResponse teamList(TeamListDto teamListDto); FebsResponse teamList(); FebsResponse teamFcmList(TeamListDto teamListDto); FebsResponse teamFcmList(); MyTeamVo teamListForMine(TeamListDto teamListDto); src/main/java/cc/mrbird/febs/mall/service/IMallMoneyFlowService.java
@@ -11,6 +11,8 @@ void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, Integer flowType); void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, String description); void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, Integer flowType, Integer isReturn); void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, Long rtMemberId, Integer flowType); src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -475,7 +475,12 @@ } else { iApiMallMemberWalletService.add(mallSystemPayDto.getAddBalance(), mallSystemPayDto.getId(), filedType); } mallMoneyFlowService.addMoneyFlow(memberId, bigDecimal, MoneyFlowTypeEnum.SYSTEM.getValue(), null, type); mallMoneyFlowService.addMoneyFlow( memberId, bigDecimal, GameFlowTypeEnum.PLAYER_CHARGE.getValue(), MallUtils.getOrderNum("CZ"), GameFlowTypeEnum.PLAYER_CHARGE.getDescrition()); return new FebsResponse().success(); } src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
@@ -114,7 +114,6 @@ mallMember.setAccountLogin(accountLogin); mallMember.setPassword(SecureUtil.md5(registerDto.getPassword())); mallMember.setUserKey(userKey); mallMember.setTradePassword(SecureUtil.md5(registerDto.getTradePassword())); Integer count = this.baseMapper.selectCount(null); if (count != null && count != 0) { @@ -124,16 +123,11 @@ } mallMember.setReferrerId(registerDto.getInviteId()); } // mallMember.setName(registerDto.getName()); // mallMember.setAccountStatus(MallMember.ACCOUNT_STATUS_ENABLE); mallMember.setAccountStatus(MallMember.ACCOUNT_STATUS_ENABLE); mallMember.setAccountType(MallMember.ACCOUNT_TYPE_NORMAL); mallMember.setLevel(AgentLevelEnum.ZERO_LEVEL.getCode()); mallMember.setIsFrozen(ProductEnum.MEMBER_UNFROZEN.getValue()); mallMember.setPartner(2); // mallMember.setSex("男"); // mallMember.setBindPhone(registerDto.getAccount()); this.baseMapper.insert(mallMember); String inviteId = ShareCodeUtil.toSerialNumberCodeTwo(mallMember.getId()); @@ -170,17 +164,10 @@ MallMemberWallet wallet = new MallMemberWallet(); wallet.setMemberId(mallMember.getId()); mallMemberWalletMapper.insert(wallet); MallMemberAmount mallMemberAmount = new MallMemberAmount(); mallMemberAmount.setMemberId(mallMember.getId()); mallMemberAmountMapper.insert(mallMemberAmount); MallMemberPayment mallMemberPayment = new MallMemberPayment(); mallMemberPayment.setMemberId(mallMember.getId()); mallMemberPaymentMapper.insert(mallMemberPayment); ApiRegisterVo apiRegisterVo = new ApiRegisterVo(); apiRegisterVo.setAccount(mallMember.getAccountLogin()); apiRegisterVo.setUserKey(mallMember.getUserKey()); apiRegisterVo.setUserKey(registerDto.getPassword()); return new FebsResponse().success().data(apiRegisterVo); } @@ -253,115 +240,8 @@ MallMember mallMember = this.baseMapper.selectById(id); MallMemberVo mallMemberVo = MallMemberConversion.INSTANCE.entityToVo(mallMember); MallMember referMember = this.baseMapper.selectInfoByInviteId(mallMember.getReferrerId()); if (referMember != null) { mallMemberVo.setReferrerName(referMember.getName()); } MallMemberPayment payment = mallMemberPaymentMapper.selectByMemberId(id); if (payment != null) { mallMemberVo.setHasPayment(1); } DataDictionaryCustom nftMinDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.NFT_MIN.getType(), DataDictionaryEnum.NFT_MIN.getCode()); mallMemberVo.setNftMin(ObjectUtil.isEmpty(nftMinDic) ? new BigDecimal(100) : new BigDecimal(nftMinDic.getValue())); DataDictionaryCustom outFcmMinDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.OUT_FCM_MIN.getType(), DataDictionaryEnum.OUT_FCM_MIN.getCode()); mallMemberVo.setOutFcmMin(ObjectUtil.isEmpty(outFcmMinDic) ? new BigDecimal(100) : new BigDecimal(outFcmMinDic.getValue())); DataDictionaryCustom fcmPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.FCM_PRICE.getType(), DataDictionaryEnum.FCM_PRICE.getCode()); mallMemberVo.setFcmPrice(ObjectUtil.isEmpty(fcmPriceDic) ? new BigDecimal(8) : new BigDecimal(fcmPriceDic.getValue())); DataDictionaryCustom outFcmFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.OUT_FCM_FEE.getType(), DataDictionaryEnum.OUT_FCM_FEE.getCode()); mallMemberVo.setOutFcmFee(ObjectUtil.isEmpty(outFcmFeeDic) ? new BigDecimal(20) : new BigDecimal(outFcmFeeDic.getValue())); DataDictionaryCustom nftFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.NFT_FEE.getType(), DataDictionaryEnum.NFT_FEE.getCode()); BigDecimal nftFeePercent = ObjectUtil.isEmpty(nftFeeDic) ? new BigDecimal(20) : new BigDecimal(nftFeeDic.getValue()); mallMemberVo.setNftFee(nftFeePercent); DataDictionaryCustom memberFrozenFcmCntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.MEMBER_FROZEN_FCM_CNT.getType(), DataDictionaryEnum.MEMBER_FROZEN_FCM_CNT.getCode() ); BigDecimal memberFrozenFcmCnt = ObjectUtil.isEmpty(memberFrozenFcmCntDic) ? new BigDecimal(100) : new BigDecimal(memberFrozenFcmCntDic.getValue()); mallMemberVo.setUnfrozenCnt(memberFrozenFcmCnt); DataDictionaryCustom insureMinuteDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.INSURE_END_MINUTE.getType(), DataDictionaryEnum.INSURE_END_MINUTE.getCode() ); Integer insureMinute = Integer.parseInt(ObjectUtil.isEmpty(insureMinuteDic) ? "60" : insureMinuteDic.getValue()); mallMemberVo.setMinuteCnt(insureMinute); DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(mallMember.getLevel(), mallMember.getLevel()); if (dic != null) { mallMemberVo.setLevelName(dic.getDescription()); }else{ mallMemberVo.setLevelName("非会员"); } MallMemberAmount mallMemberAmount = mallMemberAmountMapper.selectByMemberId(mallMember.getId()); mallMemberVo.setGsd(mallMemberAmount.getGsd()); mallMemberVo.setStaticNft(mallMemberAmount.getStaticNft()); mallMemberVo.setTrendsNft(mallMemberAmount.getTrendsNft()); mallMemberVo.setFrozenNft(mallMemberAmount.getFrozenNft()); mallMemberVo.setFcmCntAva(mallMemberAmount.getFcmCntAva()); mallMemberVo.setFcmCntFrozen(mallMemberAmount.getFcmCntFrozen()); mallMemberVo.setTokenAva(mallMemberAmount.getTokenAva()); mallMemberVo.setTokenFrozen(mallMemberAmount.getTokenFrozen()); mallMemberVo.setTotalPerk(mallMemberAmount.getTotalPerk()); DataDictionaryCustom startTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.YU_YUE_START_TIME.getType(), DataDictionaryEnum.YU_YUE_START_TIME.getCode() ); mallMemberVo.setStartTime(startTimeDic.getValue()); DataDictionaryCustom endTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.YU_YUE_END_TIME.getType(), DataDictionaryEnum.YU_YUE_END_TIME.getCode() ); mallMemberVo.setEndTime(endTimeDic.getValue()); Integer pickCount = mallProductBuyMapper.selectListByMemberIdAndState(id); mallMemberVo.setPickCount(pickCount); // BigDecimal totalPerk = mallProductBuyMapper.selectTotalPerkByMemberId(mallMember.getId()); // mallMemberVo.setTotalPerk(totalPerk); DataDictionaryCustom insideNFTPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.FCM_INSIDE_NFT_PERCENT.getType(), DataDictionaryEnum.FCM_INSIDE_NFT_PERCENT.getCode() ); mallMemberVo.setInsideNFTPercent(insideNFTPercentDic.getValue()); DataDictionaryCustom chargeAddressDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.CHARGE_ADDRESS.getType(), DataDictionaryEnum.CHARGE_ADDRESS.getCode() ); mallMemberVo.setChargeAddress(chargeAddressDic.getValue()); DataDictionaryCustom withdrawAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.WITHDRAW_AMOUNT.getType(), DataDictionaryEnum.WITHDRAW_AMOUNT.getCode() ); BigDecimal withdrawAmount = new BigDecimal(withdrawAmountDic.getValue()).setScale(2, BigDecimal.ROUND_DOWN); mallMemberVo.setWithdrawAmount(withdrawAmount); DataDictionaryCustom usdtPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.USDT_PRICE.getType(), DataDictionaryEnum.USDT_PRICE.getCode() ); BigDecimal usdtPrice = new BigDecimal(usdtPriceDic.getValue()).setScale(2, BigDecimal.ROUND_DOWN); mallMemberVo.setUsdtPrice(usdtPrice); MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(mallMember.getId()); mallMemberVo.setBalance(mallMemberWallet.getBalance()); return new FebsResponse().success().data(mallMemberVo); } @@ -416,90 +296,98 @@ } @Override public FebsResponse teamList(TeamListDto teamListDto) { Long memberId = null; if (teamListDto.getId() == null) { memberId = LoginUserUtil.getLoginUser().getId(); } else { memberId = teamListDto.getId(); } public FebsResponse teamList() { Long memberId = LoginUserUtil.getLoginUser().getId(); MallMember mallMember = this.baseMapper.selectById(memberId); List<TeamListVo> list = this.baseMapper.selectTeamListByInviteId(mallMember.getInviteId()); MyTeamVo myTeamVo = new MyTeamVo(); myTeamVo.setTeam(list); BigDecimal myAchieve = this.baseMapper.selectAchieveByMemberId(mallMember.getInviteId(), 1); myTeamVo.setMyAchieve(myAchieve); BigDecimal myTeamAchieve = this.baseMapper.selectAchieveByMemberId(mallMember.getInviteId(), 2); myTeamVo.setMyTeamAchieve(myTeamAchieve.add(myAchieve)); myTeamVo.setMyTeamCnt(this.baseMapper.selectAllChildAgentListByInviteId(mallMember.getInviteId()).size()); /** * 团队人数,只有直属两级 */ ArrayList<Long> memberIdList = new ArrayList<>(); memberIdList.add(memberId); QueryWrapper<MallMember> objectQueryWrapper = new QueryWrapper<>(); objectQueryWrapper.eq("referrer_id",mallMember.getInviteId()); List<MallMember> mallMembers = this.baseMapper.selectList(objectQueryWrapper); if(CollUtil.isNotEmpty(mallMembers)){ for(MallMember directMember : mallMembers){ //第一代 memberIdList.add(directMember.getId()); QueryWrapper<MallMember> directWrapper = new QueryWrapper<>(); directWrapper.eq("referrer_id",directMember.getInviteId()); List<MallMember> refMembers = this.baseMapper.selectList(directWrapper); if(CollUtil.isNotEmpty(refMembers)){ for(MallMember refMember : refMembers){ //第二代 memberIdList.add(refMember.getId()); } } } } BigDecimal chargeAmount = mallMoneyFlowMapper.selectSumAmountByMemberIdAndType(memberIdList,GameFlowTypeEnum.PLAYER_CHARGE.getValue()); myTeamVo.setMyTeamCnt(memberIdList.size()); myTeamVo.setMyAchieve(chargeAmount); return new FebsResponse().success().data(myTeamVo); } @Override public FebsResponse teamFcmList(TeamListDto teamListDto) { Long memberId = null; if (ObjectUtil.isEmpty(teamListDto.getId())) { memberId = LoginUserUtil.getLoginUser().getId(); } else { memberId = teamListDto.getId(); } public FebsResponse teamFcmList() { Long memberId = LoginUserUtil.getLoginUser().getId(); MallMember mallMember = this.baseMapper.selectById(memberId); MyFcmTeamVo myTeamVo = new MyFcmTeamVo(); myTeamVo.setMemberId(mallMember.getId()); myTeamVo.setAccountLogin(mallMember.getAccountLogin()); myTeamVo.setIsFrozen(mallMember.getIsFrozen()); myTeamVo.setLevelName(MemberLevelNewEnum.ZERO_LEVEL.getLevelName(mallMember.getLevel())); BigDecimal myAchieveBuy = this.baseMapper.selectAchieveBuyByMemberId(mallMember.getInviteId(), 1); myTeamVo.setMyAchieveBuy(myAchieveBuy); BigDecimal myAchieveSell = this.baseMapper.selectAchieveSellByMemberId(mallMember.getInviteId(), 1); myTeamVo.setMyAchieveSell(myAchieveSell); BigDecimal myTeamAchieveBuy = this.baseMapper.selectAchieveBuyByMemberId(mallMember.getInviteId(), 2); myTeamVo.setMyTeamAchieveBuy(myTeamAchieveBuy.add(myAchieveBuy)); BigDecimal myTeamAchieveSell = this.baseMapper.selectAchieveSellByMemberId(mallMember.getInviteId(), 2); myTeamVo.setMyTeamAchieveSell(myTeamAchieveSell.add(myAchieveSell)); myTeamVo.setMyTeamMemberCnt(this.baseMapper.selectAllChildAgentListByInviteId(mallMember.getInviteId()).size()); Integer buyCnt = this.baseMapper.selectAchieveBuyOrderCntByMemberId(mallMember.getInviteId()); Integer sellCnt = this.baseMapper.selectAchieveSellOrderCntByMemberId(mallMember.getInviteId()); myTeamVo.setMyTeamOrderCnt(buyCnt+sellCnt); ArrayList<MyFcmTeamVo> myFcmTeamVos = new ArrayList<>(); /** * 团队人数,只有直属两级 */ ArrayList<Long> memberIdList = new ArrayList<>(); memberIdList.add(memberId); List<MallMember> mallMembersDirects = this.baseMapper.selectChildAgentListByInviteId(mallMember.getInviteId()); List<MyFcmTeamVo> list = new ArrayList<>(); if(CollUtil.isNotEmpty(mallMembersDirects)){ for(MallMember mallMembersDirect : mallMembersDirects){ MyFcmTeamVo myTeamDirectVo = new MyFcmTeamVo(); myTeamDirectVo.setMemberId(mallMembersDirect.getId()); myTeamDirectVo.setAccountLogin(mallMembersDirect.getAccountLogin()); myTeamDirectVo.setIsFrozen(mallMembersDirect.getIsFrozen()); myTeamDirectVo.setLevelName( dataDictionaryCustomMapper.selectDicDataByTypeAndCode(mallMembersDirect.getLevel(),mallMembersDirect.getLevel()).getDescription() ); QueryWrapper<MallMember> objectQueryWrapper = new QueryWrapper<>(); objectQueryWrapper.eq("referrer_id",mallMember.getInviteId()); List<MallMember> mallMembers = this.baseMapper.selectList(objectQueryWrapper); if(CollUtil.isNotEmpty(mallMembers)){ for(MallMember directMember : mallMembers){ //第一代 memberIdList.add(directMember.getId()); BigDecimal myAchieveBuyDirect = this.baseMapper.selectAchieveBuyByMemberId(mallMembersDirect.getInviteId(), 1); myTeamDirectVo.setMyAchieveBuy(myAchieveBuyDirect); BigDecimal myAchieveSellDirect = this.baseMapper.selectAchieveSellByMemberId(mallMembersDirect.getInviteId(), 1); myTeamDirectVo.setMyAchieveSell(myAchieveSellDirect); BigDecimal myTeamAchieveBuyDirect = this.baseMapper.selectAchieveBuyByMemberId(mallMembersDirect.getInviteId(), 2); myTeamDirectVo.setMyTeamAchieveBuy(myTeamAchieveBuyDirect.add(myAchieveBuyDirect)); BigDecimal myTeamAchieveSellDirect = this.baseMapper.selectAchieveSellByMemberId(mallMembersDirect.getInviteId(), 2); myTeamDirectVo.setMyTeamAchieveSell(myTeamAchieveSellDirect.add(myAchieveSellDirect)); myTeamDirectVo.setMyTeamMemberCnt(this.baseMapper.selectAllChildAgentListByInviteId(mallMembersDirect.getInviteId()).size()); Integer buyCntDirect = this.baseMapper.selectAchieveBuyOrderCntByMemberId(mallMembersDirect.getInviteId()); Integer sellCntDirect = this.baseMapper.selectAchieveSellOrderCntByMemberId(mallMembersDirect.getInviteId()); myTeamDirectVo.setMyTeamOrderCnt(buyCntDirect+sellCntDirect); list.add(myTeamDirectVo); QueryWrapper<MallMember> directWrapper = new QueryWrapper<>(); directWrapper.eq("referrer_id",directMember.getInviteId()); List<MallMember> refMembers = this.baseMapper.selectList(directWrapper); if(CollUtil.isNotEmpty(refMembers)){ for(MallMember refMember : refMembers){ //第二代 memberIdList.add(refMember.getId()); } } } } myTeamVo.setTeam(list); for(Long id : memberIdList){ MyFcmTeamVo myFcmTeamVo = new MyFcmTeamVo(); MallMember member = this.baseMapper.selectById(id); myFcmTeamVo.setAccountLogin(member.getAccountLogin()); BigDecimal chargeAmount = mallMoneyFlowMapper.selectSumByMemberIdAndType(id,GameFlowTypeEnum.PLAYER_CHARGE.getValue()); myFcmTeamVo.setChargeAmount(chargeAmount); return new FebsResponse().success().data(myTeamVo); MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(id); myFcmTeamVo.setBalance(mallMemberWallet.getBalance()); BigDecimal amountBuy = mallMoneyFlowMapper.selectSumByMemberIdAndType(id,GameFlowTypeEnum.PLAYER_PICK_NUM.getValue()); myFcmTeamVo.setAmountBuy(amountBuy); BigDecimal playerPerk = mallMoneyFlowMapper.selectSumByMemberIdAndType(id,GameFlowTypeEnum.PLAYER_PERK.getValue()); BigDecimal ownerPerk = mallMoneyFlowMapper.selectSumByMemberIdAndType(id,GameFlowTypeEnum.OWNER_PERK.getValue()); myFcmTeamVo.setAmountPerk(amountBuy.add(playerPerk).add(ownerPerk)); myFcmTeamVos.add(myFcmTeamVo); } return new FebsResponse().success().data(myFcmTeamVos); } @Override @@ -512,7 +400,6 @@ IPage<MoneyFlowVo> page = new Page<>(moneyFlowDto.getPageNum(), moneyFlowDto.getPageSize()); Long id = LoginUserUtil.getLoginUser().getId(); moneyFlowDto.setMemberId(id); // IPage<MoneyFlowVo> pages = mallMoneyFlowMapper.selectApiMoneyFlowInPage(page, moneyFlowDto); IPage<MoneyFlowVo> pages = mallMoneyFlowMapper.selectApiFcmMoneyFlowInPage(page, moneyFlowDto); return new FebsResponse().success().data(pages); } src/main/java/cc/mrbird/febs/mall/service/impl/GameServiceImpl.java
New file @@ -0,0 +1,795 @@ package cc.mrbird.febs.mall.service.impl; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.common.enumerates.*; import cc.mrbird.febs.common.exception.FebsException; import cc.mrbird.febs.common.utils.AppContants; import cc.mrbird.febs.common.utils.LoginUserUtil; import cc.mrbird.febs.common.utils.MallUtils; import cc.mrbird.febs.common.utils.ShareCodeUtil; import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.mapper.*; import cc.mrbird.febs.mall.service.GameService; import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; import cc.mrbird.febs.mall.service.IMallMoneyFlowService; import cc.mrbird.febs.mall.vo.*; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.formula.functions.Choose; import org.springframework.stereotype.Service; import cc.mrbird.febs.websocket.WsSessionManager; import org.springframework.transaction.annotation.Transactional; import sun.net.www.content.image.png; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @Slf4j @Service @RequiredArgsConstructor public class GameServiceImpl extends ServiceImpl<GameRoomMapper, GameRoom> implements GameService { private final DataDictionaryCustomMapper dataDictionaryCustomMapper; private final MallMemberMapper mallMemberMapper; private final MallMemberWalletMapper mallMemberWalletMapper; private final GameRoomMapper gameRoomMapper; private final GameRoomChildMapper gameRoomChildMapper; private final GameGameMapper gameGameMapper; private final GameGameChildMapper gameGameChildMapper; private final IApiMallMemberWalletService memberWalletService; private final IMallMoneyFlowService mallMoneyFlowService; @Override public FebsResponse roomType() { ArrayList<RoomTypeVo> objects = new ArrayList<>(); List<GameRoomTypeEnum> roomLists = GameRoomTypeEnum.ROOM_ONE.getRoomList(); if(CollUtil.isNotEmpty(roomLists)){ for(GameRoomTypeEnum gameRoomTypeEnum : roomLists){ RoomTypeVo roomTypeVo = new RoomTypeVo(); roomTypeVo.setRoomName(gameRoomTypeEnum.getRoomName()); roomTypeVo.setRoomType(gameRoomTypeEnum.getRoomType()); roomTypeVo.setRoomAmount(new BigDecimal(gameRoomTypeEnum.getRoomAmount())); roomTypeVo.setMinAmount(new BigDecimal(gameRoomTypeEnum.getMinAmount())); roomTypeVo.setMaxAmount(new BigDecimal(gameRoomTypeEnum.getMaxAmount())); String amounts = gameRoomTypeEnum.getAmounts(); // 使用split方法将字符串按照逗号分割成数组 String[] numbersArray = amounts.split(","); // 将数组转换成Stream List<BigDecimal> numbersList = Arrays.stream(numbersArray) // 使用map方法将每个字符串元素转换成BigDecimal .map(BigDecimal::new) // 收集到List中 .collect(Collectors.toList()); roomTypeVo.setAmounts(numbersList); objects.add(roomTypeVo); } } return new FebsResponse().success().data(objects); } @Override @Transactional(rollbackFor = Exception.class) public FebsResponse createRoom(ApiCreateRoomDto apiCreateRoomDto) { /** * 用户登录 * 判断是否是代理,只有代理才能创建房间 * 初始化一条主房间记录 * 初始化一条子房间记录 * 返回房间信息 */ Long memberId = LoginUserUtil.getLoginUser().getId(); //每局时间倒计时 Integer gameTime = apiCreateRoomDto.getGameTime(); if(1 > gameTime || 60 < gameTime){ throw new FebsException("请输入合适的数字"); } //代理身份才能创建房间 MallMember mallMember = mallMemberMapper.selectById(memberId); Integer partner = ObjectUtil.isEmpty(mallMember.getPartner()) ? 2 : mallMember.getPartner(); if(AppContants.MEMBER_PARTNER_NO == partner){ throw new FebsException("用户没有创建房间的权限!"); } Integer roomType = apiCreateRoomDto.getRoomType(); GameRoomTypeEnum room = GameRoomTypeEnum.ROOM_ONE.getRoom(roomType); if(ObjectUtil.isEmpty(room)){ throw new FebsException("请选择正确的房间类型!"); } //创建房间的最小金额 BigDecimal roomAmount = new BigDecimal(room.getRoomAmount()).setScale(2, BigDecimal.ROUND_DOWN); MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); if(roomAmount.compareTo(mallMemberWallet.getBalance()) > 0){ throw new FebsException("金额不足,请充值!"); } //初始化一条主房间记录 GameRoom gameRoom = new GameRoom(); gameRoom.setRoomType(roomType); gameRoom.setState(GameRoom.STATE_READY); gameRoom.setOwnerMemberId(memberId); gameRoom.setGameTime(gameTime); gameRoomMapper.insert(gameRoom); boolean flag = false; String password = ShareCodeUtil.toSerialNumberCodeTwo(gameRoom.getId()); while (!flag){ QueryWrapper<GameRoom> objectQueryWrapper = new QueryWrapper<>(); objectQueryWrapper.eq("password",password); List<GameRoom> gameRooms = gameRoomMapper.selectList(objectQueryWrapper); if(CollUtil.isEmpty(gameRooms)){ flag = true; }else{ password = ShareCodeUtil.toSerialNumberCodeTwo(gameRoom.getId()); } } gameRoom.setPassword(password); gameRoomMapper.updateById(gameRoom); //初始化一条子房间记录 GameRoomChild gameRoomChild = new GameRoomChild(); gameRoomChild.setRoomId(gameRoom.getId()); gameRoomChild.setOwnerState(GameRoomChild.OWNER_TRUE); gameRoomChild.setMemberId(memberId); gameRoomChildMapper.insert(gameRoomChild); ApiCreateRoomVo apiCreateRoomVo = new ApiCreateRoomVo(); apiCreateRoomVo.setRoomType(roomType); apiCreateRoomVo.setRoomId(gameRoom.getId()); apiCreateRoomVo.setPassword(password); apiCreateRoomVo.setState(gameRoom.getState()); return new FebsResponse().success().data(apiCreateRoomVo); } @Override @Transactional(rollbackFor = Exception.class) public FebsResponse startGame(ApiStartGameDto startGameDto) { Long memberId = LoginUserUtil.getLoginUser().getId(); MallMember mallMember = mallMemberMapper.selectById(memberId); Long roomId = startGameDto.getRoomId(); QueryWrapper<GameRoom> roomQueryWrapper = new QueryWrapper<>(); roomQueryWrapper.eq("owner_member_id",memberId); roomQueryWrapper.eq("id",roomId); GameRoom gameRoom = gameRoomMapper.selectOne(roomQueryWrapper); if(ObjectUtil.isEmpty(gameRoom)){ throw new FebsException("房间不存在"); } if(GameRoom.STATE_READY != gameRoom.getState()){ throw new FebsException("游戏已开始"); } Integer roomType = gameRoom.getRoomType(); GameRoomTypeEnum room = GameRoomTypeEnum.ROOM_ONE.getRoom(roomType); if(ObjectUtil.isEmpty(room)){ throw new FebsException("请选择正确的房间类型!"); } //创建房间的最小金额 BigDecimal roomAmount = new BigDecimal(room.getRoomAmount()).setScale(2, BigDecimal.ROUND_DOWN); MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); if(roomAmount.compareTo(mallMemberWallet.getBalance()) > 0){ throw new FebsException("金额不足,请充值!"); } gameRoom.setState(GameRoom.STATE_ING); gameRoomMapper.updateById(gameRoom); GameGame gameGame = new GameGame(); gameGame.setMemberId(memberId); gameGame.setRoomId(roomId); gameGame.setState(GameGame.STATE_READY); gameGameMapper.insert(gameGame); /** * 给房间里面的所有人发送一个开始的信息 */ this.sendMsgByRoomId(roomId,"START:"+gameGame.getId()); ApiStartGameVo apiStartGameVo = new ApiStartGameVo(); apiStartGameVo.setRoomType(gameRoom.getRoomType()); apiStartGameVo.setRoomId(gameRoom.getId()); apiStartGameVo.setPassword(gameRoom.getPassword()); apiStartGameVo.setState(gameRoom.getState()); apiStartGameVo.setCreatedTime(gameGame.getCreatedTime()); return new FebsResponse().success().data(apiStartGameVo); } @Override public void sendMsgByRoomId(Long roomId,String msg) { QueryWrapper<GameRoomChild> gameRoomChildQueryWrapper = new QueryWrapper<>(); gameRoomChildQueryWrapper.eq("room_id",roomId); List<GameRoomChild> gameRoomChildrens = gameRoomChildMapper.selectList(gameRoomChildQueryWrapper); if(CollUtil.isEmpty(gameRoomChildrens)){ return; } List<Long> playerMemberIds = gameRoomChildrens.stream().map(GameRoomChild::getMemberId).collect(Collectors.toList()); this.sendMsgByMemberIds(playerMemberIds,msg); } @Override public void sendMsgByMemberIds(List<Long> memberIds,String msg) { QueryWrapper<MallMember> memberQueryWrapper = new QueryWrapper<>(); memberQueryWrapper.in("id",memberIds); List<MallMember> mallMembers = mallMemberMapper.selectList(memberQueryWrapper); if(CollUtil.isEmpty(mallMembers)){ return; } String inviteIdsString = mallMembers.stream() .map(MallMember::getInviteId) // 提取每个MallMember的inviteId .collect(Collectors.joining(",")); // 使用逗号连接所有inviteId WsSessionManager.sendMsgToMany(inviteIdsString,msg); } @Override public void sendMsgByMemberId(Long memberId,String msg) { MallMember mallMembers = mallMemberMapper.selectById(memberId); if(ObjectUtil.isEmpty(mallMembers)){ return; } WsSessionManager.sendMsgToOne(mallMembers.getInviteId(),msg); } @Override @Transactional(rollbackFor = Exception.class) public FebsResponse chooseNum(ApiChooseNumDto apiChooseNumDto) { /** * 判断这个房间投注人是否在房间中 * 判断游戏的状态是否是投注中 * 判断房间类型是否满足投注金额 * 判断游戏的投注金额是否足够 */ Long memberId = LoginUserUtil.getLoginUser().getId(); Long roomId = apiChooseNumDto.getRoomId(); Integer chooseNum = apiChooseNumDto.getChooseNum(); BigDecimal amount = apiChooseNumDto.getAmount(); Long gameId = apiChooseNumDto.getGameId(); GameRoom gameRoom = gameRoomMapper.selectById(roomId); if(ObjectUtil.isEmpty(gameRoom)){ throw new FebsException("房间不存在"); } if(GameRoom.STATE_DONE == gameRoom.getState()){ throw new FebsException("房主关闭了房间"); } if(GameRoom.STATE_READY == gameRoom.getState()){ throw new FebsException("请等待房主开始游戏"); } QueryWrapper<GameRoomChild> gameRoomChildQueryWrapper = new QueryWrapper<>(); gameRoomChildQueryWrapper.eq("room_id",gameRoom.getId()); gameRoomChildQueryWrapper.eq("member_id",memberId); GameRoomChild gameRoomChildExist = gameRoomChildMapper.selectOne(gameRoomChildQueryWrapper); if(ObjectUtil.isEmpty(gameRoomChildExist)){ throw new FebsException("请重新进入房间"); } MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); BigDecimal balance = mallMemberWallet.getBalance(); if(BigDecimal.ZERO.compareTo(balance) > 0){ throw new FebsException("余额不足"); } if(amount.compareTo(balance) > 0){ throw new FebsException("请减小金额"); } GameRoomTypeEnum room = GameRoomTypeEnum.ROOM_ONE.getRoom(gameRoom.getRoomType()); // 使用split方法将字符串按照逗号分割成数组 String[] numbersArray = room.getAmounts().split(","); // 将数组转换成Stream List<BigDecimal> numbersList = Arrays.stream(numbersArray) // 使用map方法将每个字符串元素转换成BigDecimal .map(BigDecimal::new) // 收集到List中 .collect(Collectors.toList()); boolean contains = numbersList.contains(amount); if(!contains){ throw new FebsException("请选择正确的金额"); } if(chooseNum < 1 || chooseNum > 6){ throw new FebsException("请选择正确的投注"); } GameGame gameGame = gameGameMapper.selectById(gameId); if(ObjectUtil.isEmpty(gameGame)){ throw new FebsException("请重新进入游戏"); } if(GameGame.STATE_READY != gameGame.getState()){ throw new FebsException("本轮已结束"); } /** * 开始投注 * 初始化一条投注子记录 * 更新游戏主记录 * 通知房主,更新页面。 * 减少用户的金额 * 初始化一条流水记录 */ memberWalletService.reduceBalance(amount,memberId); mallMoneyFlowService.addMoneyFlow( mallMemberWallet.getMemberId(), amount.negate(), GameFlowTypeEnum.PLAYER_PICK_NUM.getValue(), MallUtils.getOrderNum("TZ"), StrUtil.format( GameFlowTypeEnum.PLAYER_PICK_NUM.getDescrition(), gameRoom.getPassword(), GamePNGEnum.SHI_ZI.getPngName(chooseNum))); GameGameChild gameGameChild = new GameGameChild(); gameGameChild.setGameId(gameId); gameGameChild.setMemberId(memberId); gameGameChild.setAmount(amount); gameGameChild.setPickNum(chooseNum); gameGameChild.setState(GameGameChild.STATE_ING); gameGameChildMapper.insert(gameGameChild); if(1 == chooseNum){ BigDecimal add = gameGame.getPickOne().add(amount).setScale(2,BigDecimal.ROUND_DOWN); gameGame.setPickOne(add); } if(2 == chooseNum){ BigDecimal add = gameGame.getPickTwo().add(amount).setScale(2,BigDecimal.ROUND_DOWN); gameGame.setPickTwo(add); } if(3 == chooseNum){ BigDecimal add = gameGame.getPickThree().add(amount).setScale(2,BigDecimal.ROUND_DOWN); gameGame.setPickThree(add); } if(4 == chooseNum){ BigDecimal add = gameGame.getPickFour().add(amount).setScale(2,BigDecimal.ROUND_DOWN); gameGame.setPickFour(add); } if(5 == chooseNum){ BigDecimal add = gameGame.getPickFive().add(amount).setScale(2,BigDecimal.ROUND_DOWN); gameGame.setPickFive(add); } if(6 == chooseNum){ BigDecimal add = gameGame.getPickSix().add(amount).setScale(2,BigDecimal.ROUND_DOWN); gameGame.setPickSix(add); } gameGameMapper.updateById(gameGame); /** * 给房间里面的所有人发送一个开始的信息 */ this.sendMsgByRoomId(roomId,"TZ:"+gameGame.getId()); return new FebsResponse().success().message("操作成功"); } @Override @Transactional(rollbackFor = Exception.class) public FebsResponse gameIn(ApiGameDto apiGameDto) { Long memberId = LoginUserUtil.getLoginUser().getId(); /** * 验证唯一房间编码是否存在 * 验证当前是否已经加入过该房间 * 验证当前用户的钱是否足够进入该房间 * 获取房间状态信息、房间游戏信息 * 初始化房间子表的数据 */ String password = apiGameDto.getPassword(); QueryWrapper<GameRoom> objectQueryWrapper = new QueryWrapper<>(); objectQueryWrapper.eq("password", password); GameRoom gameRoom = gameRoomMapper.selectOne(objectQueryWrapper); if(ObjectUtil.isEmpty(gameRoom)){ throw new FebsException("房间不存在"); } if(GameRoom.STATE_DONE == gameRoom.getState()){ throw new FebsException("房间已失效"); } ApiGamePlayerVo apiGamePlayerVo = new ApiGamePlayerVo(); QueryWrapper<GameRoomChild> gameRoomChildQueryWrapper = new QueryWrapper<>(); gameRoomChildQueryWrapper.eq("room_id",gameRoom.getId()); gameRoomChildQueryWrapper.eq("member_id",memberId); GameRoomChild gameRoomChildExist = gameRoomChildMapper.selectOne(gameRoomChildQueryWrapper); MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); BigDecimal balance = mallMemberWallet.getBalance(); GameRoomTypeEnum room = GameRoomTypeEnum.ROOM_ONE.getRoom(gameRoom.getRoomType()); if(ObjectUtil.isNotEmpty(gameRoomChildExist)){ Integer ownerState = gameRoomChildExist.getOwnerState(); if(GameRoomChild.OWNER_TRUE == ownerState){ BigDecimal roomAmount = new BigDecimal(room.getRoomAmount()).setScale(2,BigDecimal.ROUND_DOWN); if(roomAmount.compareTo(balance) > 0){ throw new FebsException("进入房间,需要"+roomAmount+",请先充值"); } }else{ BigDecimal minAmount = new BigDecimal(room.getMinAmount()).setScale(2,BigDecimal.ROUND_DOWN); if(minAmount.compareTo(balance) > 0){ throw new FebsException("继续游戏需要"+minAmount+",请先充值"); } } }else{ BigDecimal minAmount = new BigDecimal(room.getMinAmount()).setScale(2,BigDecimal.ROUND_DOWN); if(minAmount.compareTo(balance) > 0){ throw new FebsException("继续游戏需要"+minAmount+",请先充值"); } } if(ObjectUtil.isNotEmpty(gameRoomChildExist)){ apiGamePlayerVo.setPlayerType(gameRoomChildExist.getOwnerState()); }else{ GameRoomChild gameRoomChild = new GameRoomChild(); gameRoomChild.setRoomId(gameRoom.getId()); gameRoomChild.setMemberId(memberId); gameRoomChild.setOwnerState(GameRoomChild.OWNER_FALSE); gameRoomChildMapper.insert(gameRoomChild); apiGamePlayerVo.setPlayerType(gameRoomChild.getOwnerState()); } apiGamePlayerVo.setBalance(balance); apiGamePlayerVo.setRoomType(gameRoom.getRoomType()); apiGamePlayerVo.setRoomId(gameRoom.getId()); apiGamePlayerVo.setPassword(gameRoom.getPassword()); apiGamePlayerVo.setState(gameRoom.getState()); apiGamePlayerVo.setGameTime(gameRoom.getGameTime()); QueryWrapper<GameGame> gameGameQueryWrapper = new QueryWrapper<>(); gameGameQueryWrapper.eq("room_id",gameRoom.getId()); gameGameQueryWrapper.orderByDesc("CREATED_TIME"); gameGameQueryWrapper.last("limit 5"); List<GameGame> gameGames = gameGameMapper.selectList(gameGameQueryWrapper); List<ApiGameGameVo> apiGameGameVos = new ArrayList<>(); if(CollUtil.isNotEmpty(gameGames)){ for(GameGame gameGame : gameGames){ ApiGameGameVo apiGameGameVo = new ApiGameGameVo(); apiGameGameVo.setFirstNum(ObjectUtil.isEmpty(gameGame.getFirstNum()) ? 0 : gameGame.getFirstNum()); apiGameGameVo.setSecondNum(ObjectUtil.isEmpty(gameGame.getSecondNum()) ? 0 : gameGame.getSecondNum()); apiGameGameVo.setState(gameGame.getState()); apiGameGameVo.setPerkTime(gameGame.getPerkTime()); if(GameGame.STATE_READY == gameGame.getState()){ apiGamePlayerVo.setGameId(gameGame.getId()); apiGamePlayerVo.setCreatedTime(gameGame.getCreatedTime()); } apiGameGameVos.add(apiGameGameVo); } } apiGamePlayerVo.setApiGameGameVos(apiGameGameVos); return new FebsResponse().success().data(apiGamePlayerVo); } @Override @Transactional(rollbackFor = Exception.class) public FebsResponse endGame(ApiEndGameDto endGameDto) { Long memberId = LoginUserUtil.getLoginUser().getId(); Long roomId = endGameDto.getRoomId(); Long gameId = endGameDto.getGameId(); /** * 只有房主才能结束本轮游戏 * 判断本轮游戏状态 * 结算 * 判断房主是否还够资金开启下一轮游戏 * 等待房主开始 */ GameRoom gameRoom = gameRoomMapper.selectById(roomId); if(ObjectUtil.isEmpty(gameRoom)){ throw new FebsException("房间不存在"); } QueryWrapper<GameRoomChild> gameRoomChildQueryWrapper = new QueryWrapper<>(); gameRoomChildQueryWrapper.eq("room_id",roomId); gameRoomChildQueryWrapper.eq("member_id",memberId); gameRoomChildQueryWrapper.eq("owner_state",GameRoomChild.OWNER_TRUE); GameRoomChild gameRoomChildExist = gameRoomChildMapper.selectOne(gameRoomChildQueryWrapper); if(ObjectUtil.isEmpty(gameRoomChildExist)){ throw new FebsException("房间不存在"); } QueryWrapper<GameGame> gameGameQueryWrapper = new QueryWrapper<>(); gameGameQueryWrapper.eq("id",gameId); gameGameQueryWrapper.eq("room_id",roomId); gameGameQueryWrapper.eq("member_id",memberId); gameGameQueryWrapper.eq("state",GameGame.STATE_READY); GameGame gameGameExist = gameGameMapper.selectOne(gameGameQueryWrapper); if(ObjectUtil.isEmpty(gameGameExist)){ throw new FebsException("本轮游戏已结束"); } //将游戏房间更新为准备中 gameRoom.setState(GameRoom.STATE_READY); gameRoomMapper.updateById(gameRoom); //产生两个随机的1-6的数字 int firstNum = RandomUtil.randomInt(1, 7); int secondNum = RandomUtil.randomInt(1, 7); gameGameExist.setFirstNum(firstNum); gameGameExist.setSecondNum(secondNum); gameGameExist.setState(GameGame.STATE_DONE); gameGameExist.setPerkTime(new Date()); gameGameMapper.updateById(gameGameExist); //结算 todo 改成rabbitMq消息推送,注意游戏主表的状态变化 this.perkGameGameChild(gameId,firstNum,secondNum); this.sendMsgByRoomId(roomId,"DONE:"+gameId); ApiEndGameVo apiEndGameVo = new ApiEndGameVo(); apiEndGameVo.setRoomId(roomId); return new FebsResponse().success().data(apiEndGameVo); } @Override public BigDecimal perkGameGameChild(Long gameId,int firstNum,int secondNum) { BigDecimal totalPerk = BigDecimal.ZERO; /** * 获取本局游戏的全部参与人员 * 结算金额 */ QueryWrapper<GameGameChild> objectQueryWrapper = new QueryWrapper<>(); objectQueryWrapper.eq("game_id",gameId); objectQueryWrapper.eq("state",GameGameChild.STATE_ING); List<GameGameChild> gameGameChildrens = gameGameChildMapper.selectList(objectQueryWrapper); if(CollUtil.isEmpty(gameGameChildrens)){ return totalPerk; } for(GameGameChild gameChild : gameGameChildrens){ Long memberId = gameChild.getMemberId(); //投入金额 BigDecimal amount = gameChild.getAmount(); //投注号码 Integer pickNum = gameChild.getPickNum(); //中奖金额 BigDecimal perkAmount = BigDecimal.ZERO; if(pickNum == firstNum){ GamePNGEnum png = GamePNGEnum.SHI_ZI.getPng(firstNum); if(ObjectUtil.isNotEmpty(png)){ Integer pngTimes = png.getPngTimes(); perkAmount = perkAmount.add(amount.multiply(new BigDecimal(pngTimes)).setScale(2,BigDecimal.ROUND_DOWN)); } } if(pickNum == secondNum){ GamePNGEnum png = GamePNGEnum.SHI_ZI.getPng(secondNum); if(ObjectUtil.isNotEmpty(png)){ Integer pngTimes = png.getPngTimes(); perkAmount = perkAmount.add(amount.multiply(new BigDecimal(pngTimes)).setScale(2,BigDecimal.ROUND_DOWN)); } } if(BigDecimal.ZERO.compareTo(perkAmount) >= 0){//说明两个号码没中, gameChild.setPerkState(GameGameChild.PERK_STATE_NO); gameChild.setPerkAmount(amount.negate()); mallMoneyFlowService.addMoneyFlow( gameChild.getMemberId(), BigDecimal.ZERO, GameFlowTypeEnum.PLAYER_PERK.getValue(), MallUtils.getOrderNum("ZJ"), StrUtil.format( GameFlowTypeEnum.PLAYER_PERK.getDescrition(), GamePNGEnum.SHI_ZI.getPngName(firstNum), GamePNGEnum.SHI_ZI.getPngName(secondNum), GamePNGEnum.SHI_ZI.getPngName(pickNum) )); totalPerk = totalPerk.add(amount); }else{ gameChild.setPerkState(GameGameChild.PERK_STATE_YES); gameChild.setPerkAmount(perkAmount); BigDecimal memberTotalPerk = perkAmount.add(amount); memberWalletService.addBalance(memberTotalPerk,gameChild.getMemberId()); mallMoneyFlowService.addMoneyFlow( gameChild.getMemberId(), memberTotalPerk, GameFlowTypeEnum.PLAYER_PERK.getValue(), MallUtils.getOrderNum("ZJ"), StrUtil.format( GameFlowTypeEnum.PLAYER_PERK.getDescrition(), GamePNGEnum.SHI_ZI.getPngName(firstNum), GamePNGEnum.SHI_ZI.getPngName(secondNum), GamePNGEnum.SHI_ZI.getPngName(pickNum) )); totalPerk = totalPerk.subtract(perkAmount); } gameChild.setPerkNumOne(firstNum); gameChild.setPerkNumTwo(secondNum); gameChild.setState(GameGameChild.STATE_DONE); gameGameChildMapper.updateById(gameChild); } GameGame gameGame = gameGameMapper.selectById(gameId); Long memberId = gameGame.getMemberId(); memberWalletService.addBalance(totalPerk,memberId); mallMoneyFlowService.addMoneyFlow( memberId, totalPerk, GameFlowTypeEnum.OWNER_PERK.getValue(), MallUtils.getOrderNum("KJ"), StrUtil.format( GameFlowTypeEnum.OWNER_PERK.getDescrition(), GamePNGEnum.SHI_ZI.getPngName(firstNum), GamePNGEnum.SHI_ZI.getPngName(secondNum) )); gameGame.setState(GameGame.STATE_OVER); gameGameMapper.updateById(gameGame); return totalPerk; } @Override public FebsResponse nextGame(ApiNextGameDto apiNextGameDto) { Long memberId = LoginUserUtil.getLoginUser().getId(); /** * 验证唯一房间编码是否存在 * 验证当前是否已经加入过该房间 * 验证当前用户的钱是否足够进入该房间 * 获取房间状态信息、房间游戏信息 * 初始化房间子表的数据 */ Long gameId = apiNextGameDto.getGameId(); GameGame gameGameNow = gameGameMapper.selectById(gameId); if(ObjectUtil.isEmpty(gameGameNow)){ throw new FebsException("游戏等待中"); } GameRoom gameRoom = gameRoomMapper.selectById(gameGameNow.getRoomId()); if(ObjectUtil.isEmpty(gameRoom)){ throw new FebsException("房间不存在"); } if(GameRoom.STATE_DONE == gameRoom.getState()){ throw new FebsException("房间已失效"); } ApiNextGameVo apiGamePlayerVo = new ApiNextGameVo(); QueryWrapper<GameRoomChild> gameRoomChildQueryWrapper = new QueryWrapper<>(); gameRoomChildQueryWrapper.eq("room_id",gameRoom.getId()); gameRoomChildQueryWrapper.eq("member_id",memberId); GameRoomChild gameRoomChildExist = gameRoomChildMapper.selectOne(gameRoomChildQueryWrapper); MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); BigDecimal balance = mallMemberWallet.getBalance(); GameRoomTypeEnum room = GameRoomTypeEnum.ROOM_ONE.getRoom(gameRoom.getRoomType()); if(ObjectUtil.isNotEmpty(gameRoomChildExist)){ Integer ownerState = gameRoomChildExist.getOwnerState(); if(GameRoomChild.OWNER_TRUE == ownerState){ BigDecimal roomAmount = new BigDecimal(room.getRoomAmount()).setScale(2,BigDecimal.ROUND_DOWN); if(roomAmount.compareTo(balance) > 0){ throw new FebsException("进入房间,需要"+roomAmount+",请先充值"); } }else{ BigDecimal minAmount = new BigDecimal(room.getMinAmount()).setScale(2,BigDecimal.ROUND_DOWN); if(minAmount.compareTo(balance) > 0){ throw new FebsException("继续游戏需要"+minAmount+",请先充值"); } } }else{ BigDecimal minAmount = new BigDecimal(room.getMinAmount()).setScale(2,BigDecimal.ROUND_DOWN); if(minAmount.compareTo(balance) > 0){ throw new FebsException("继续游戏需要"+minAmount+",请先充值"); } } if(ObjectUtil.isNotEmpty(gameRoomChildExist)){ apiGamePlayerVo.setPlayerType(gameRoomChildExist.getOwnerState()); }else{ GameRoomChild gameRoomChild = new GameRoomChild(); gameRoomChild.setRoomId(gameRoom.getId()); gameRoomChild.setMemberId(memberId); gameRoomChild.setOwnerState(GameRoomChild.OWNER_FALSE); gameRoomChildMapper.insert(gameRoomChild); apiGamePlayerVo.setPlayerType(gameRoomChild.getOwnerState()); } apiGamePlayerVo.setBalance(balance); apiGamePlayerVo.setRoomType(gameRoom.getRoomType()); apiGamePlayerVo.setRoomId(gameRoom.getId()); apiGamePlayerVo.setPassword(gameRoom.getPassword()); apiGamePlayerVo.setState(gameRoom.getState()); apiGamePlayerVo.setGameTime(gameRoom.getGameTime()); QueryWrapper<GameGame> gameGameQueryWrapper = new QueryWrapper<>(); gameGameQueryWrapper.eq("room_id",gameRoom.getId()); gameGameQueryWrapper.orderByDesc("CREATED_TIME"); gameGameQueryWrapper.last("limit 5"); List<GameGame> gameGames = gameGameMapper.selectList(gameGameQueryWrapper); List<ApiGameGameVo> apiGameGameVos = new ArrayList<>(); if(CollUtil.isNotEmpty(gameGames)){ for(GameGame gameGame : gameGames){ ApiGameGameVo apiGameGameVo = new ApiGameGameVo(); apiGameGameVo.setFirstNum(ObjectUtil.isEmpty(gameGame.getFirstNum()) ? 0 : gameGame.getFirstNum()); apiGameGameVo.setSecondNum(ObjectUtil.isEmpty(gameGame.getSecondNum()) ? 0 : gameGame.getSecondNum()); apiGameGameVo.setState(gameGame.getState()); apiGameGameVo.setPerkTime(gameGame.getPerkTime()); if(GameGame.STATE_READY == gameGame.getState()){ apiGamePlayerVo.setGameId(gameGame.getId()); apiGamePlayerVo.setCreatedTime(gameGame.getCreatedTime()); } apiGameGameVos.add(apiGameGameVo); } } apiGamePlayerVo.setApiGameGameVos(apiGameGameVos); return new FebsResponse().success().data(apiGamePlayerVo); } @Override public FebsResponse existGame(ApiExistGameDto apiExistGameDto) { Long memberId = LoginUserUtil.getLoginUser().getId(); Long roomId = apiExistGameDto.getRoomId(); /** * 删除房间子表的数据 */ MallMember mallMember = mallMemberMapper.selectById(memberId); QueryWrapper<GameRoomChild> gameRoomChildQueryWrapper = new QueryWrapper<>(); gameRoomChildQueryWrapper.eq("room_id",roomId); gameRoomChildQueryWrapper.eq("member_id",memberId); GameRoomChild gameRoomChildExist = gameRoomChildMapper.selectOne(gameRoomChildQueryWrapper); if(ObjectUtil.isEmpty(gameRoomChildExist)){ throw new FebsException("房间不存在"); } Integer ownerState = gameRoomChildExist.getOwnerState(); //如果退出的是房主,那么游戏结束 if(GameRoomChild.OWNER_TRUE == ownerState){ GameRoom gameRoom = gameRoomMapper.selectById(roomId); if(ObjectUtil.isNotEmpty(gameRoom)){ gameRoom.setState(GameRoom.STATE_DONE); gameRoomMapper.updateById(gameRoom); this.sendMsgByRoomId(roomId,"OVER"); } } //断开websocket WsSessionManager.remove(mallMember.getInviteId()); return new FebsResponse().success(); } @Override public FebsResponse flashGame(ApiFlashGameDto apiFlashGameDto) { Long memberId = LoginUserUtil.getLoginUser().getId(); Long gameId = apiFlashGameDto.getGameId(); GameGame gameGame = gameGameMapper.selectById(gameId); if(ObjectUtil.isEmpty(gameGame)){ throw new FebsException("游戏已结束"); } ApiFlashGameVo apiFlashGameVo = new ApiFlashGameVo(); apiFlashGameVo.setRoomId(gameGame.getRoomId()); apiFlashGameVo.setFirstNum(gameGame.getFirstNum()); apiFlashGameVo.setSecondNum(gameGame.getSecondNum()); apiFlashGameVo.setState(gameGame.getState()); apiFlashGameVo.setPickOne(gameGame.getPickOne()); apiFlashGameVo.setPickTwo(gameGame.getPickTwo()); apiFlashGameVo.setPickThree(gameGame.getPickThree()); apiFlashGameVo.setPickFour(gameGame.getPickFour()); apiFlashGameVo.setPickFive(gameGame.getPickFive()); apiFlashGameVo.setPickSix(gameGame.getPickSix()); return new FebsResponse().success().data(apiFlashGameVo); } public static void main(String[] args) { System.out.println(ShareCodeUtil.toSerialNumberCodeTwo(1L)); List<GameRoomTypeEnum> roomLists = GameRoomTypeEnum.ROOM_ONE.getRoomList(); for(GameRoomTypeEnum gameRoomTypeEnum : roomLists){ String amounts = gameRoomTypeEnum.getAmounts(); // 使用split方法将字符串按照逗号分割成数组 String[] numbersArray = amounts.split(","); // 将数组转换成Stream List<BigDecimal> numbersList = Arrays.stream(numbersArray) // 使用map方法将每个字符串元素转换成BigDecimal .map(BigDecimal::new) // 收集到List中 .collect(Collectors.toList()); numbersList.forEach(System.out::println); } } } src/main/java/cc/mrbird/febs/mall/service/impl/MallMoneyFlowServiceImpl.java
@@ -41,6 +41,11 @@ } @Override public void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, String description) { this.addMoneyFlow(memberId, amount, type, orderNo, description, null, null, null, null, null); } @Override public void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, Integer flowType, Integer isReturn) { this.addMoneyFlow(memberId, amount, type, orderNo, null, null, null, null, flowType, isReturn); } src/main/java/cc/mrbird/febs/mall/vo/AdminMallMemberVo.java
@@ -102,6 +102,7 @@ private Integer isFrozen;//是否冻结 1:是 0 :否 private BigDecimal balance; private BigDecimal staticNft; private BigDecimal trendsNft; private BigDecimal frozenNft; src/main/java/cc/mrbird/febs/mall/vo/ApiCreateRoomVo.java
New file @@ -0,0 +1,23 @@ package cc.mrbird.febs.mall.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "ApiCreateRoomVo", description = "信息返回类") public class ApiCreateRoomVo { @ApiModelProperty(value = "房间ID") private Long roomId; @ApiModelProperty(value = "房间类型 1-初级房2-土豪房3-尊爵房") private Integer roomType;//房间类型 1-初级房2-土豪房3-尊爵房 @ApiModelProperty(value = "房间状态0-未开始1-正常2-结束") private Integer state;//房间状态0-未开始1-正常2-结束 @ApiModelProperty(value = "房间唯一编码,自动生成") private String password;//房间密码(房间唯一编码,自动生成) } src/main/java/cc/mrbird/febs/mall/vo/ApiEndGameVo.java
New file @@ -0,0 +1,14 @@ package cc.mrbird.febs.mall.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "ApiEndGameVo", description = "信息返回类") public class ApiEndGameVo { @ApiModelProperty(value = "房间ID") private Long roomId; } src/main/java/cc/mrbird/febs/mall/vo/ApiFlashGameVo.java
New file @@ -0,0 +1,45 @@ package cc.mrbird.febs.mall.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; @Data @ApiModel(value = "ApiFlashGameVo", description = "信息返回类") public class ApiFlashGameVo { @ApiModelProperty(value = "房间ID") private Long roomId;// @ApiModelProperty(value = "第一个数") private Integer firstNum;//第一个数 @ApiModelProperty(value = "第二个数") private Integer secondNum;//第二个数 @ApiModelProperty(value = "1-等待投注中 2-结束投注(10秒倒计时,结束投注) 3-结算中 4-已结算") private Integer state; @ApiModelProperty(value = "投注1的总金额") private BigDecimal pickOne;//投注1的总金额 @ApiModelProperty(value = "投注2的总金额") private BigDecimal pickTwo; @ApiModelProperty(value = "投注3的总金额") private BigDecimal pickThree; @ApiModelProperty(value = "投注4的总金额") private BigDecimal pickFour; @ApiModelProperty(value = "投注5的总金额") private BigDecimal pickFive; @ApiModelProperty(value = "投注6的总金额") private BigDecimal pickSix; } src/main/java/cc/mrbird/febs/mall/vo/ApiGameGameVo.java
New file @@ -0,0 +1,27 @@ package cc.mrbird.febs.mall.vo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @Data @ApiModel(value = "ApiGameGameVo", description = "信息返回类") public class ApiGameGameVo { @ApiModelProperty(value = "第一个数") private Integer firstNum;//第一个数 @ApiModelProperty(value = "第二个数") private Integer secondNum;//第二个数 @ApiModelProperty(value = "房间状态1-等待投注中 2-结束投注(10秒倒计时,结束投注) 3-结算中 4-已结算") private Integer state;//1-等待投注中 2-结束投注(10秒倒计时,结束投注) 3-结算中 4-已结算 @ApiModelProperty(value = "时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date perkTime; } src/main/java/cc/mrbird/febs/mall/vo/ApiGamePlayerVo.java
New file @@ -0,0 +1,48 @@ package cc.mrbird.febs.mall.vo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.Date; import java.util.List; @Data @ApiModel(value = "ApiGamePlayerVo", description = "信息返回类") public class ApiGamePlayerVo { @ApiModelProperty(value = "房间ID") private Long roomId; @ApiModelProperty(value = "当前局游戏ID") private Long gameId; @ApiModelProperty(value = "身份类型 1-房主 2-玩家") private Integer playerType;//房间类型 1-初级房2-土豪房3-尊爵房 @ApiModelProperty(value = "余额") private BigDecimal balance; @ApiModelProperty(value = "时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createdTime; @ApiModelProperty(value = "一局游戏时长") private Integer gameTime; @ApiModelProperty(value = "房间类型 1-初级房2-土豪房3-尊爵房") private Integer roomType;//房间类型 1-初级房2-土豪房3-尊爵房 @ApiModelProperty(value = "房间状态0-未开始1-正常2-结束") private Integer state;//房间状态0-未开始1-正常2-结束 @ApiModelProperty(value = "房间唯一编码,自动生成") private String password;//房间密码(房间唯一编码,自动生成) @ApiModelProperty(value = "历史开奖记录目前是5局") private List<ApiGameGameVo> apiGameGameVos;//房间密码(房间唯一编码,自动生成) } src/main/java/cc/mrbird/febs/mall/vo/ApiNextGameVo.java
New file @@ -0,0 +1,47 @@ package cc.mrbird.febs.mall.vo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.Date; import java.util.List; @Data @ApiModel(value = "ApiNextGameVo", description = "信息返回类") public class ApiNextGameVo { @ApiModelProperty(value = "房间ID") private Long roomId; @ApiModelProperty(value = "当前局游戏ID") private Long gameId; @ApiModelProperty(value = "身份类型 1-房主 2-玩家") private Integer playerType;//房间类型 1-初级房2-土豪房3-尊爵房 @ApiModelProperty(value = "余额") private BigDecimal balance; @ApiModelProperty(value = "时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createdTime; @ApiModelProperty(value = "一局游戏时长") private Integer gameTime; @ApiModelProperty(value = "房间类型 1-初级房2-土豪房3-尊爵房") private Integer roomType;//房间类型 1-初级房2-土豪房3-尊爵房 @ApiModelProperty(value = "房间状态0-未开始1-正常2-结束") private Integer state;//房间状态0-未开始1-正常2-结束 @ApiModelProperty(value = "房间唯一编码,自动生成") private String password;//房间密码(房间唯一编码,自动生成) @ApiModelProperty(value = "历史开奖记录目前是5局") private List<ApiGameGameVo> apiGameGameVos;//房间密码(房间唯一编码,自动生成) } src/main/java/cc/mrbird/febs/mall/vo/ApiRegisterVo.java
@@ -11,7 +11,7 @@ @ApiModelProperty(value = "账号") private String account; @ApiModelProperty(value = "密钥") @ApiModelProperty(value = "密码") private String userKey; } src/main/java/cc/mrbird/febs/mall/vo/ApiStartGameVo.java
New file @@ -0,0 +1,29 @@ package cc.mrbird.febs.mall.vo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @Data @ApiModel(value = "ApiStartGameVo", description = "返回参数类") public class ApiStartGameVo { @ApiModelProperty(value = "房间ID") private Long roomId; @ApiModelProperty(value = "房间类型 1-初级房2-土豪房3-尊爵房") private Integer roomType;//房间类型 1-初级房2-土豪房3-尊爵房 @ApiModelProperty(value = "房间状态0-未开始1-正常2-结束") private Integer state;//房间状态0-未开始1-正常2-结束 @ApiModelProperty(value = "房间唯一编码,自动生成") private String password;//房间密码(房间唯一编码,自动生成) @ApiModelProperty(value = "时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createdTime; } src/main/java/cc/mrbird/febs/mall/vo/MallMemberVo.java
@@ -16,32 +16,14 @@ @ApiModelProperty(value = "id") private Long id; @ApiModelProperty(value = "memberId") private Long memberId; @ApiModelProperty(value = "登录账号") private String accountLogin; @ApiModelProperty(value = "头像") private String avatar; @ApiModelProperty(value = "用户名") private String name; @ApiModelProperty(value = "手机号") private String phone; @ApiModelProperty(value = "邀请码") private String inviteId; @ApiModelProperty(value = "代理层级") private String level; @ApiModelProperty(value = "代理等级") private String levelName; @ApiModelProperty(value = "推荐人昵称") private String referrerName; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createdTime; /** * 账户状态;1-正常 2-禁用 @@ -50,79 +32,13 @@ public static final int ACCOUNTSTATUS_Y = 1; public static final int ACCOUNTSTATUS_N = 2; @ApiModelProperty(value = "是否设置收款信息", example = "1是2否") private Integer hasPayment = 2; /** * 董事 */ @ApiModelProperty(value = "是否为董事 1-是 2-否") private Integer director; /** * 董事 */ @ApiModelProperty(value = "是否为节点 1-是 2-否") @ApiModelProperty(value = "是否为代理 1-是 2-否") private Integer partner; /** * 店长 */ @ApiModelProperty(value = "是否店长 1-是 2-否") private Integer storeMaster; @ApiModelProperty(value = "内转标识 1:开启 2:关闭") private Integer insideWith; @ApiModelProperty(value = "GFD") private BigDecimal gsd;//GFD @ApiModelProperty(value = "静态NFT") private BigDecimal staticNft;//静态NFT @ApiModelProperty(value = "动态NFT") private BigDecimal trendsNft;//动态NFT @ApiModelProperty(value = "冻结NFT") private BigDecimal frozenNft;//冻结NFT @ApiModelProperty(value = "FCM代币可用") private BigDecimal fcmCntAva;//FCM代币可用 @ApiModelProperty(value = "FCM代币冻结") private BigDecimal fcmCntFrozen;//FCM代币冻结 @ApiModelProperty(value = "令牌可用") private BigDecimal tokenAva;//令牌可用 @ApiModelProperty(value = "令牌冻结") private BigDecimal tokenFrozen;//令牌冻结 @ApiModelProperty(value = "FCM提现收续费") private BigDecimal outFcmFee;//FCM提现收续费 @ApiModelProperty(value = "FCM提现最小数量") private BigDecimal outFcmMin;//FCM提现收续费 @ApiModelProperty(value = "NFT提现收续费") private BigDecimal nftFee;//FCM提现收续费 @ApiModelProperty(value = "NFT提现最小数量") private BigDecimal nftMin;//FCM提现收续费 @ApiModelProperty(value = "FCM价格") private BigDecimal fcmPrice;//FCM价格 @ApiModelProperty(value = "预约开始时间") private String startTime;//FCM价格 @ApiModelProperty(value = "预约结束时间") private String endTime;//FCM价格 @ApiModelProperty(value = "解冻收费FCM") private BigDecimal unfrozenCnt;//FCM提现收续费 @ApiModelProperty(value = "是否冻结 1:是 0 :否") private Integer isFrozen; @ApiModelProperty(value = "已排单") private Integer pickCount; @ApiModelProperty(value = "支付后,确认倒计时的分钟数,60,为paytime开始计算60分钟的倒计时") private Integer minuteCnt; @ApiModelProperty(value = "收益总额") private BigDecimal totalPerk; @ApiModelProperty(value = "卡牌互转手续费") private String insideNFTPercent; @ApiModelProperty(value = "充值地址") private String chargeAddress; @ApiModelProperty(value = "最小提现金额") private BigDecimal withdrawAmount; @ApiModelProperty(value = "USDT价格") private BigDecimal usdtPrice; @ApiModelProperty(value = "余额") private BigDecimal balance; } src/main/java/cc/mrbird/febs/mall/vo/MoneyFlowVo.java
@@ -25,9 +25,6 @@ @ApiModelProperty(value = "类型") private Integer type; @ApiModelProperty(value = "流水类型 1-FCM代币 2-令牌 3-NFT") private Integer flowType; @ApiModelProperty(value = "提现状态 1-提现中2-成功 3-拒绝") private String description; src/main/java/cc/mrbird/febs/mall/vo/MyFcmTeamVo.java
@@ -11,36 +11,19 @@ @ApiModel(value = "MyFcmTeamVo", description = "我的团队返回参数类") public class MyFcmTeamVo { @ApiModelProperty(value = "ID") private Long memberId; @ApiModelProperty(value = "是否冻结 1:是 0 :否") private Integer isFrozen; @ApiModelProperty(value = "账号") private String accountLogin; @ApiModelProperty(value = "代理等级") private String levelName; @ApiModelProperty(value = "总充值") private BigDecimal chargeAmount; @ApiModelProperty(value = "个人买入总额") private BigDecimal myAchieveBuy; @ApiModelProperty(value = "余额") private BigDecimal balance; @ApiModelProperty(value = "个人卖出总额") private BigDecimal myAchieveSell; @ApiModelProperty(value = "总投入") private BigDecimal amountBuy; @ApiModelProperty(value = "团队买入总额") private BigDecimal myTeamAchieveBuy; @ApiModelProperty(value = "盈亏") private BigDecimal amountPerk; @ApiModelProperty(value = "团队卖出总额") private BigDecimal myTeamAchieveSell; @ApiModelProperty(value = "团队总单量") private int myTeamOrderCnt; @ApiModelProperty(value = "团队总人数") private int myTeamMemberCnt; @ApiModelProperty(value = "团队列表") private List<MyFcmTeamVo> team; } src/main/java/cc/mrbird/febs/mall/vo/MyTeamVo.java
@@ -11,15 +11,10 @@ @ApiModel(value = "MyTeamVo", description = "我的团队返回参数类") public class MyTeamVo { @ApiModelProperty(value = "我的业绩") @ApiModelProperty(value = "总充值") private BigDecimal myAchieve; @ApiModelProperty(value = "我的团队业绩") private BigDecimal myTeamAchieve; @ApiModelProperty(value = "团队数量") @ApiModelProperty(value = "团队人数") private int myTeamCnt; @ApiModelProperty(value = "团队列表") private List<TeamListVo> team; } src/main/java/cc/mrbird/febs/mall/vo/RoomTypeVo.java
New file @@ -0,0 +1,24 @@ package cc.mrbird.febs.mall.vo; import io.swagger.annotations.ApiModel; import lombok.Data; import java.math.BigDecimal; import java.util.List; /** * @author wzy * @date 2022-05-09 **/ @Data @ApiModel(value = "ScoreSignVo", description = "积分签到返回参数接口") public class RoomTypeVo { private String roomName;//名称 private Integer roomType;//房间类型 1-初级房2-土豪房3-尊爵房 private BigDecimal roomAmount;//进入最小金额 private BigDecimal minAmount;//投注最小金额 private BigDecimal maxAmount;//投注最大金额 private List<BigDecimal> amounts;//投注金额 } src/main/resources/mapper/modules/MallMemberMapper.xml
@@ -537,19 +537,12 @@ <select id="getFcmMallMemberList" resultType="cc.mrbird.febs.mall.vo.AdminMallMemberVo"> SELECT m.*, b.static_nft staticNft, b.trends_nft trendsNft, b.frozen_nft frozenNft, b.fcm_cnt_ava fcmCntAva, b.fcm_cnt_frozen fcmCntFrozen, b.token_ava tokenAva, b.total_perk totalPerk, b.token_frozen tokenFrozen, b.balance balance, a.account_login referrerName, d.description levelName FROM mall_member m left join mall_member a on m.referrer_id = a.invite_id left join mall_member_amount b on b.member_id = m.id left join mall_member_wallet b on b.member_id = m.id LEFT JOIN data_dictionary_custom d on d.code = m.level and d.type = m.level <where> <if test="record != null" > @@ -583,7 +576,7 @@ <select id="getMallmemberAmountByMemberId" resultType="cc.mrbird.febs.mall.vo.MallMemberVo"> SELECT a.* FROM mall_member_amount a FROM mall_member_wallet a where a.member_id = #{memberId} </select> src/main/resources/mapper/modules/MallMoneyFlowMapper.xml
@@ -47,23 +47,8 @@ a.* from mall_money_flow a <where> and a.type != 16 and a.type != 19 and a.type != 20 <if test="record.inOrOut == 3"> and a.amount > 0 </if> <if test="record.inOrOut == 2"> and 0 > a.amount </if> <if test="record.memberId != null"> and a.member_id=#{record.memberId} </if> <if test="record.flowType != null and record.flowType != ''"> and a.flow_type=#{record.flowType} </if> <if test="record.type != null and record.type != ''"> and a.type=#{record.type} </if> </where> order by a.created_time desc @@ -303,4 +288,25 @@ </where> order by a.created_time desc </select> <select id="selectSumAmountByMemberIdAndType" resultType="java.math.BigDecimal"> select ifnull(sum(amount),0) from mall_money_flow where type = #{type} and member_id IN <foreach collection = "list" item = "item" separator="," open = "(" close = ")" > #{item} </foreach > </select> <select id="selectSumByMemberIdAndType" resultType="java.math.BigDecimal"> select ifnull(sum(amount),0) from mall_money_flow where type = #{type} and member_id = #{memberId} </select> </mapper> src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html
@@ -13,43 +13,6 @@ <input type="text" placeholder="登录账户" name="accountLogin" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-inline"> <label class="layui-form-label">名称:</label> <div class="layui-input-inline"> <input type="text" placeholder="名称" name="name" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-inline"> <label class="layui-form-label">账号:</label> <div class="layui-input-inline"> <input type="text" placeholder="手机号码/邀请码" name="account" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-inline"> <label class="layui-form-label">账户状态:</label> <div class="layui-input-inline"> <select name="accountStatus"> <option value="">请选择</option> <option value="1">正常</option> <option value="2">禁用</option> </select> </div> </div> <div class="layui-inline"> <label class="layui-form-label">会员类型:</label> <div class="layui-input-inline"> <select name="level"> <option value="">请选择</option> <option value="ZERO_LEVEL">普通会员</option> <option value="SECOND_LEVEL">1星</option> <option value="THIRD_LEVEL">2星</option> <option value="FOUR_LEVEL">3星</option> <option value="FIFTH_LEVEL">4星</option> <option value="SIX_LEVEL">5星</option> <option value="SEVEN_LEVEL">6星</option> </select> </div> </div> </div> </div> <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> @@ -81,46 +44,11 @@ <input type="checkbox" value={{d.id}} lay-text="正常|禁用" lay-skin="switch" lay-filter="switchStatus"> {{# } }} </script> <script type="text/html" id="switchStoreMaster"> {{# if(d.storeMaster === 1) { }} <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchStoreMaster"> {{# } else { }} <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchStoreMaster"> {{# } }} </script> <script type="text/html" id="switchDirector"> {{# if(d.director === 1) { }} <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchDirector"> {{# } else { }} <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchDirector"> {{# } }} </script> <script type="text/html" id="switchCreate"> {{# if(d.creater === 1) { }} <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchCreate"> {{# } else { }} <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchCreate"> {{# } }} </script> <script type="text/html" id="switchPartner"> {{# if(d.partner === 1) { }} <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchPartner"> {{# } else { }} <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchPartner"> {{# } }} </script> <script type="text/html" id="switchInsideWith"> {{# if(d.insideWith === 1) { }} <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchInsideWith"> {{# } else { }} <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchInsideWith"> {{# } }} </script> <script type="text/html" id="switchOutsideWith"> {{# if(d.outsideWith === 1) { }} <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchOutsideWith"> {{# } else { }} <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchOutsideWith"> {{# } }} </script> <script type="text/html" id="switchFrozenWith"> @@ -137,15 +65,8 @@ </style> <script type="text/html" id="tableMemberBar"> <div class="layui-btn-container"> <!-- <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="exportMember">导出会员信息</button>--> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="addMember:update" lay-event="registMember">添加会员</button> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="mallSystemPay:update" lay-event="balance">拨付动态卡牌</button> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="mallSystemPay:update" lay-event="score">拨付代币可用</button> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="mallSystemPay:update" lay-event="prizeScore">拨付宝石可用</button> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="mallSystemPay:update" lay-event="balance">拨付葫芦</button> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="resetPwd:update" lay-event="resetPwd">重置登录密码</button> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="resetPwd:update" lay-event="resetPayPwd">重置支付密码</button> <!-- <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="agentLevelSet:update" lay-event="agentLevel">设置代理等级</button>--> <!-- <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="voucherUpdate:update" lay-event="voucherUpdate">拨付绿色凭证</button>--> </div> </script> <!-- 表格操作栏 end --> @@ -178,46 +99,6 @@ table.on('tool(userTable)', function (obj) { var data = obj.data, layEvent = obj.event; if (layEvent === 'close') { febs.modal.confirm('禁用', '确认禁用该账号?', function () { closeAccount(data.id); }); } if (layEvent === 'open') { febs.modal.confirm('开启', '确认开启该账号?', function () { openAccount(data.id); }); } if (layEvent === 'see') { febs.modal.open( '个人信息', 'modules/mallMember/detail/' + data.id, { btn: ['提交', '取消'], yes: function (index, layero) { $('#user-update').find('#submit').trigger('click'); }, btn2: function () { layer.closeAll(); } }); } if (layEvent === 'moneyFlow') { febs.modal.open( '用户资金流水', 'modules/mallMember/moneyFlow/' + data.id, { maxmin: true, }); } if (layEvent == 'updateReferer') { febs.modal.open( '修改推荐人', 'modules/mallMember/updateReferer/' + data.id, { btn: ['提交', '取消'], yes: function (index, layero) { $('#referer-update').find('#submit').trigger('click'); }, btn2: function () { layer.closeAll(); } }); } }); function frozenWithYes(id) { @@ -293,7 +174,7 @@ // 查询按钮 $query.on('click', function () { var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); tableIns.reload({where: params, page: {curr: currPageGoods}}); tableIns.reload({where: params, page: {curr: 1}}); }); // 刷新按钮 @@ -318,21 +199,8 @@ {field: 'accountLogin', title: '登录账户', minWidth: 150,align:'left'}, {field: 'inviteId', title: '邀请码', minWidth: 100,align:'left'}, {field: 'referrerName', title: '推荐人', minWidth: 100,align:'left'}, {field: 'staticNft', title: '静态卡牌', minWidth: 120,align:'left'}, {field: 'trendsNft', title: '动态卡牌', minWidth: 120,align:'left'}, {field: 'totalPerk', title: '封存卡牌', minWidth: 120,align:'left'}, // {field: 'frozenNft', title: '冻结卡牌', minWidth: 120,align:'left'}, {field: 'fcmCntAva', title: '代币可用', minWidth: 120,align:'left'}, {field: 'fcmCntFrozen', title: '代币冻结', minWidth: 120,align:'left'}, {field: 'tokenAva', title: '宝石可用', minWidth: 120,align:'left'}, {field: 'tokenFrozen', title: '宝石冻结', minWidth: 120,align:'left'}, {field: 'levelName', title: '会员类型', minWidth: 100,align:'left'}, // {field: 'storeMaster', title: '线下服务中心', templet:'#switchStoreMaster', minWidth: 120,align:'left',hide:toolbarMallmember}, // {field: 'director', title: '代理商', templet:'#switchDirector', minWidth: 120,align:'left' ,hide:toolbarMallmember}, // {field: 'creater', title: '联创', templet:'#switchCreate', minWidth: 120,align:'left' ,hide:toolbarMallmember}, {field: 'partner', title: '节点', templet:'#switchPartner', minWidth: 120,align:'left' ,hide:toolbarMallmember}, // {field: 'insideWith', title: '是否内转', templet:'#switchInsideWith', minWidth: 120,align:'left' ,hide:toolbarMallmember}, // {field: 'outsideWith', title: '是否提现', templet:'#switchOutsideWith', minWidth: 120,align:'left' ,hide:toolbarMallmember}, {field: 'balance', title: '葫芦', minWidth: 100,align:'left'}, {field: 'partner', title: '代理', templet:'#switchPartner', minWidth: 120,align:'left' ,hide:toolbarMallmember}, {field: 'isFrozen', title: '是否冻结', templet:'#switchFrozenWith', minWidth: 120,align:'left' ,hide:toolbarMallmember}, {field: 'accountType', title: '账号类型', templet: function (d) { @@ -346,15 +214,7 @@ }, minWidth: 100,align:'left'}, {field: 'accountStatus', title: '账号状态', templet: '#switchStatus', minWidth: 100,align:'left',hide:toolbarMallmember}, {field: 'createdTime', title: '注册时间', minWidth: 180,align:'left'}, // {title: '操作', // templet: function (d) { // // '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="see" shiro:hasPermission="user:update">详情</button>' // return '<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="moneyFlow:update" lay-event="moneyFlow">资金流水</button>' // + '<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="user:update" lay-event="updateReferer">修改推荐人</button>' // // '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="moneyFlow" shiro:hasPermission="moneyFlow:update">资金流水</button>' // // + '<button class="layui-btn layui-btn-normal layui-btn-xs" type="button" lay-event="updateReferer" shiro:hasPermission="user:update">修改推荐人</button>' // },minWidth: 200,align:'center', fixed:"right"} {title: '操作', minWidth: 200 ,toolbar: '#mallmember-option',hide:toolbarMallmember,align:'left', fixed:'right'} // {title: '操作', minWidth: 200 ,toolbar: '#mallmember-option',hide:toolbarMallmember,align:'left', fixed:'right'} ]] }); } @@ -366,27 +226,6 @@ if (layEvent === 'exportMember') { window.location.href = ctx + "admin/mallMember/exportMember"; } if (layEvent === 'registMember') { febs.modal.open( '添加会员', 'modules/mallMember/addMember', { btn: ['提交', '取消'], yes: function (index, layero) { $('#member-add').find('#submit').trigger('click'); }, btn2: function () { layer.closeAll(); } }); return; } // var checkData = table.checkStatus('userTable').data; // if (checkData.length <= 0) { // febs.alert.warn('请选择需要的用户'); // return; // } if (layEvent === 'resetPwd') { var checkData = table.checkStatus('userTable').data; @@ -403,22 +242,6 @@ }); } if (layEvent === 'resetPayPwd') { var checkData = table.checkStatus('userTable').data; if (checkData.length <= 0) { febs.alert.warn('请选择需要的用户'); return; } febs.modal.confirm('重置交易密码', '是否重置选中账号交易密码为【123456】?', function () { var ids = []; layui.each(checkData, function (key, item) { ids.push(item.id) }); resetPwd(ids.join(','), 1); }); } if (layEvent === 'balance') { var checkData = table.checkStatus('userTable').data; if (checkData.length <= 0) { @@ -429,81 +252,9 @@ febs.alert.warn('只能选择一个用户'); return; } systemPay("动态卡牌", checkData[0].id, 1); } if (layEvent === 'voucherUpdate') { var checkData = table.checkStatus('userTable').data; if (checkData.length <= 0) { febs.alert.warn('请选择需要的用户'); return; } if (checkData.length > 1) { febs.alert.warn('请选择一个用户'); return; } voucherUpdate("拨付绿色凭证", checkData[0].id, 1); } if (layEvent === 'score') { var checkData = table.checkStatus('userTable').data; if (checkData.length <= 0) { febs.alert.warn('请选择需要的用户'); return; } if (checkData.length > 1) { febs.alert.warn('请选择一个用户'); return; } systemPay("代币可用", checkData[0].id, 2); } if (layEvent === 'prizeScore') { var checkData = table.checkStatus('userTable').data; if (checkData.length <= 0) { febs.alert.warn('请选择需要的用户'); return; } if (checkData.length > 1) { febs.alert.warn('请选择一个用户'); return; } systemPay("宝石可用", checkData[0].id, 3); } if (layEvent === 'agentLevel') { var checkData = table.checkStatus('userTable').data; if (checkData.length <= 0) { febs.alert.warn('请选择需要的用户'); return; } if (checkData.length > 1) { febs.alert.warn('请选择一个用户'); return; } febs.modal.open('设置代理级别', 'modules/mallMember/agentLevelSet/' + checkData[0].id, { btn: ['确认', '取消'], yes: function (index, layero) { $('#agent-level-set').find('#submit').trigger('click'); }, btn2: function () { layer.closeAll(); } }); systemPay("葫芦", checkData[0].id, 1); } }); function voucherUpdate(text, id, type) { febs.modal.open(text, 'modules/mallMember/voucherUpdate/' + type +'/'+ id, { btn: ['提交', '取消'], yes: function (index, layero) { $('#voucher-update').find('#submit').trigger('click'); }, btn2: function () { layer.closeAll(); } }); } function systemPay(text, id, type) { febs.modal.open(text, 'modules/mallMember/mallSystemPay/' + type +'/'+ id, { @@ -520,29 +271,10 @@ // 获取查询参数 function getQueryParams() { return { name: $searchForm.find('input[name="name"]').val().trim(), account: $searchForm.find('input[name="account"]').val().trim(), accountLogin: $searchForm.find('input[name="accountLogin"]').val().trim(), accountStatus: $searchForm.find("select[name='accountStatus']").val(), level: $searchForm.find("select[name='level']").val(), }; } form.on('switch(switchInsideWith)', function (data) { if (data.elem.checked) { insideWithYes(data.value); } else { insideWithNo(data.value); } }) form.on('switch(switchOutsideWith)', function (data) { if (data.elem.checked) { outsideWithYes(data.value); } else { outsideWithNo(data.value); } }) form.on('switch(switchFrozenWith)', function (data) { if (data.elem.checked) { frozenWithYes(data.value); @@ -556,30 +288,6 @@ openAccount(data.value); } else { closeAccount(data.value); } }) form.on('switch(switchStoreMaster)', function (data) { if (data.elem.checked) { changeIdentityYes(2, data.value); } else { changeIdentityNo(2, data.value); } }) form.on('switch(switchDirector)', function (data) { if (data.elem.checked) { changeIdentityYes(1, data.value); } else { changeIdentityNo(1, data.value); } }) form.on('switch(switchCreate)', function (data) { if (data.elem.checked) { changeIdentityYes(3, data.value); } else { changeIdentityNo(3, data.value); } }) src/main/resources/templates/febs/views/modules/mallMember/mallSystemPay.html
@@ -75,23 +75,23 @@ function initUserValue() { var balance; if (type == 1) { balance = systemPay.trendsNft balance = systemPay.balance } else if (type == 2) { balance = systemPay.fcmCntAva balance = systemPay.balance } else if (type ==3) { balance = systemPay.tokenAva balance = systemPay.balance } else { } form.val("systemPay-update-form", { "id": systemPay.id, "id": systemPay.memberId, "balance": balance, }); } form.on('submit(systemPay-update-form-submit)', function (data) { data.field.type = type; febs.post(ctx + 'admin/mallMember/updateSystemPayInfo', data.field, function () { febs.post(ctx + 'admin/mallMember/updateSystemPay', data.field, function () { layer.closeAll(); febs.alert.success('操作成功'); $('#febs-member-list').find('#reset').click(); src/test/java/cc/mrbird/febs/AgentTest.java
@@ -5,10 +5,12 @@ import cc.mrbird.febs.common.exception.FebsException; import cc.mrbird.febs.common.utils.LoginUserUtil; import cc.mrbird.febs.mall.dto.AgentLevelUpdateDto; import cc.mrbird.febs.mall.dto.ApiCreateRoomDto; import cc.mrbird.febs.mall.dto.ApiMallActWinDetailsDto; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.mapper.*; import cc.mrbird.febs.mall.quartz.ProfitJob; import cc.mrbird.febs.mall.service.GameService; import cc.mrbird.febs.mall.service.IAgentService; import cc.mrbird.febs.mall.vo.ApiMallActWinDetailsVo; import cc.mrbird.febs.mall.vo.ApiMallAwardDetailsVo; @@ -39,590 +41,19 @@ @SpringBootTest public class AgentTest { // @Autowired // private AgentProducer agentProducer; // // @Autowired // private DataDictionaryCustomMapper dataDictionaryCustomMapper; // // @Autowired // private IAgentService agentService; // // @Autowired // private MallGoodsStyleMapper mallGoodsStyleMapper; // // @Autowired // private MallActAwardSetMapper mallActAwardSetMapper; // @Autowired // private MallMemberMapper mallMemberMapper; // @Autowired // private MallActWinRecordMapper mallActWinRecordMapper; // @Autowired // private MallActLuckdrawRecordMapper mallActLuckdrawRecordMapper; // @Autowired // private MallMemberWalletMapper mallMemberWalletMapper; // @Autowired // private MallActSetMapper mallActSetMapper; // @Test // public void skusTest() { // ApiMallAwardDetailsVo apiMallAwardDetailsVo = new ApiMallAwardDetailsVo(); // Long memberId = 4L; // Long actId = 1L; // MallMember mallMember = mallMemberMapper.selectById(memberId); // if(ObjectUtil.isEmpty(mallMember)){ // throw new FebsException("用户不存在"); // } // // MallActSet mallActSet = mallActSetMapper.selectById(actId); // if(ObjectUtil.isEmpty(mallActSet)){ // throw new FebsException("活动不存在"); // } // Integer actStatus = mallActSet.getActStatus(); // if(MallActSet.ACT_STATUS_DISABLED == actStatus){ // throw new FebsException("活动还没开始"); // } // /** // * 获取用户积分数,判断能不能抽奖 // * 减少对应的积分数量 // * 较少奖品的已抽奖 // * 生成一条抽奖记录 // */ // // MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); // if(ObjectUtil.isEmpty(wallet)){ // throw new FebsException("账户不存在"); // } // BigDecimal commission = wallet.getCommission(); // BigDecimal prizeScore = wallet.getPrizeScore(); // Integer actScoreCnt = mallActSet.getActScoreCnt(); // if(prizeScore.compareTo(new BigDecimal(actScoreCnt))<0){ // throw new FebsException("竞猜积分不足"); // } // /** // * 中奖概率 20% // * 每次抽奖产生一个随机数要大于8,则中奖 // * 历史10条抽奖记录有中奖过,中奖记录少于两条,则中奖 // */ // //获取中奖概率 // DataDictionaryCustom scoreDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( // DataDictionaryEnum.WIN_SCORE.getType(), // DataDictionaryEnum.WIN_SCORE.getCode()); // DataDictionaryCustom cashDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( // DataDictionaryEnum.WIN_CASH.getType(), // DataDictionaryEnum.WIN_CASH.getCode()); // String scoreDicValue = scoreDic.getValue(); // String cashDicValue = cashDic.getValue(); // BigDecimal totalProbability = new BigDecimal(scoreDicValue).add(new BigDecimal(cashDicValue)); // //获取那个更大一点的几率 // BigDecimal maxProbability = BigDecimal.ZERO; // BigDecimal minProbability = BigDecimal.ZERO; // Integer maxAwardType = 0; // Integer minAwardType = 0; // if(new BigDecimal(scoreDicValue).compareTo(new BigDecimal(cashDicValue)) < 0){ // maxProbability = new BigDecimal(cashDicValue); // minProbability = new BigDecimal(scoreDicValue); // maxAwardType = MallActAwardSet.AWARD_TYPE_YJ; // minAwardType = MallActAwardSet.AWARD_TYPE_JF; // }else{ // maxProbability = new BigDecimal(scoreDicValue); // minProbability = new BigDecimal(cashDicValue); // maxAwardType = MallActAwardSet.AWARD_TYPE_JF; // minAwardType = MallActAwardSet.AWARD_TYPE_YJ; // } // // BigDecimal multiply = totalProbability.multiply(new BigDecimal(100)); // BigDecimal failureScope = new BigDecimal(100).subtract(multiply); // int randomInt = 90; // //小于failureScope这个数字,则没中奖 // if(new BigDecimal(randomInt).compareTo(failureScope) <= 0){ // //抽奖记录 // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); // if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ // apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); // apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); // }else{ // apiMallAwardDetailsVo.setAwardName("未中奖"); // } // }else if(new BigDecimal(randomInt).compareTo(failureScope) > 0 // && new BigDecimal(randomInt).compareTo(failureScope.add(maxProbability.multiply(new BigDecimal(100)))) <= 0){ // //大于failureScope.add(maxProbability.multiply(new BigDecimal(100)))这个数字,则中奖 // //获取最新的十条抽奖记录 // List<MallActLuckdrawRecord> records = mallActLuckdrawRecordMapper.selectRecordByMemberIdAndActId(memberId,actId); // if(CollUtil.isNotEmpty(records)){ // //中奖次数 // Integer count = 0; // for(MallActLuckdrawRecord mallActLuckdrawRecord : records){ // Integer status = mallActLuckdrawRecord.getStatus(); // if(MallActLuckdrawRecord.STATUS_ENABLE == status){ // count = count + 1; // } // } // if(new BigDecimal(count).compareTo(maxProbability.multiply(new BigDecimal(10))) < 0){ // //获取活动下该类别的奖品 // List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,maxAwardType); // if(CollUtil.isEmpty(mallActAwardSets)){ // //抽奖记录 // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); // if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ // apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); // apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); // }else{ // apiMallAwardDetailsVo.setAwardName("未中奖"); // } // }else{ // List<MallActAwardSet> idList = new ArrayList(); // for(MallActAwardSet mallActAwardSet : mallActAwardSets){ // Integer awardTotal = mallActAwardSet.getAwardTotal(); // Integer awardCnt = mallActAwardSet.getAwardCnt(); // if(awardCnt < awardTotal){ // idList.add(mallActAwardSet); // } // } // MallActAwardSet mallActAwardSet = new MallActAwardSet(); // if(idList.size() <= 1){ // mallActAwardSet = idList.get(0); // }else{ // int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); // mallActAwardSet = idList.get(randomIdIndex); // } // mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); // mallActAwardSetMapper.updateById(mallActAwardSet); // // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // MallActWinRecord mallActWinRecord = new MallActWinRecord(); // mallActWinRecord.setMemberId(memberId); // mallActWinRecord.setActId(actId); // mallActWinRecord.setActName(mallActSet.getActName()); // mallActWinRecord.setAwardId(mallActAwardSet.getId()); // mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); // mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); // mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); // mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); // mallActWinRecordMapper.insert(mallActWinRecord); // // apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); // apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); // apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); // apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); // // if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ // prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); // }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ // commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); // } // } // }else{ // //抽奖记录 // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); // if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ // apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); // apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); // }else{ // apiMallAwardDetailsVo.setAwardName("未中奖"); // } // } // }else{ // //获取活动下该类别的奖品 // List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,maxAwardType); // if(CollUtil.isEmpty(mallActAwardSets)){ // //抽奖记录 // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); // if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ // apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); // apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); // }else{ // apiMallAwardDetailsVo.setAwardName("未中奖"); // } // }else{ // List<MallActAwardSet> idList = new ArrayList(); // for(MallActAwardSet mallActAwardSet : mallActAwardSets){ // Integer awardTotal = mallActAwardSet.getAwardTotal(); // Integer awardCnt = mallActAwardSet.getAwardCnt(); // if(awardCnt < awardTotal){ // idList.add(mallActAwardSet); // } // } // MallActAwardSet mallActAwardSet = new MallActAwardSet(); // if(idList.size() <= 1){ // mallActAwardSet = idList.get(0); // }else{ // int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); // mallActAwardSet = idList.get(randomIdIndex); // } // mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); // mallActAwardSetMapper.updateById(mallActAwardSet); // // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // MallActWinRecord mallActWinRecord = new MallActWinRecord(); // mallActWinRecord.setMemberId(memberId); // mallActWinRecord.setActId(actId); // mallActWinRecord.setActName(mallActSet.getActName()); // mallActWinRecord.setAwardId(mallActAwardSet.getId()); // mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); // mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); // mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); // mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); // mallActWinRecordMapper.insert(mallActWinRecord); // // apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); // apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); // apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); // apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); // // if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ // prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); // }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ // commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); // } // } // } // }else{ // //中奖 // //获取最新的十条抽奖记录 // List<MallActLuckdrawRecord> records = mallActLuckdrawRecordMapper.selectRecordByMemberIdAndActId(memberId,actId); // if(CollUtil.isNotEmpty(records)){ // //中奖次数 // Integer count = 0; // for(MallActLuckdrawRecord mallActLuckdrawRecord : records){ // Integer status = mallActLuckdrawRecord.getStatus(); // if(MallActLuckdrawRecord.STATUS_ENABLE == status){ // count = count + 1; // } // } // if(new BigDecimal(count).compareTo(minProbability.multiply(new BigDecimal(10))) < 0){ // //获取活动下该类别的奖品 // List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,minAwardType); // if(CollUtil.isEmpty(mallActAwardSets)){ // //抽奖记录 // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); // if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ // apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); // apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); // }else{ // apiMallAwardDetailsVo.setAwardName("未中奖"); // } // }else{ // List<MallActAwardSet> idList = new ArrayList(); // for(MallActAwardSet mallActAwardSet : mallActAwardSets){ // Integer awardTotal = mallActAwardSet.getAwardTotal(); // Integer awardCnt = mallActAwardSet.getAwardCnt(); // if(awardCnt < awardTotal){ // idList.add(mallActAwardSet); // } // } // MallActAwardSet mallActAwardSet = new MallActAwardSet(); // if(idList.size() <= 1){ // mallActAwardSet = idList.get(0); // }else{ // int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); // mallActAwardSet = idList.get(randomIdIndex); // } // mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); // mallActAwardSetMapper.updateById(mallActAwardSet); // // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // MallActWinRecord mallActWinRecord = new MallActWinRecord(); // mallActWinRecord.setMemberId(memberId); // mallActWinRecord.setActId(actId); // mallActWinRecord.setActName(mallActSet.getActName()); // mallActWinRecord.setAwardId(mallActAwardSet.getId()); // mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); // mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); // mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); // mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); // mallActWinRecordMapper.insert(mallActWinRecord); // // apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); // apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); // apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); // apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); // // if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ // prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); // }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ // commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); // } // } // }else{ // //抽奖记录 // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); // if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ // apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); // apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); // }else{ // apiMallAwardDetailsVo.setAwardName("未中奖"); // } // } // }else{ // //获取活动下该类别的奖品 // List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,minAwardType); // if(CollUtil.isEmpty(mallActAwardSets)){ // //抽奖记录 // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); // if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ // apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); // apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); // }else{ // apiMallAwardDetailsVo.setAwardName("未中奖"); // } // }else{ // List<MallActAwardSet> idList = new ArrayList(); // for(MallActAwardSet mallActAwardSet : mallActAwardSets){ // Integer awardTotal = mallActAwardSet.getAwardTotal(); // Integer awardCnt = mallActAwardSet.getAwardCnt(); // if(awardCnt < awardTotal){ // idList.add(mallActAwardSet); // } // } // MallActAwardSet mallActAwardSet = new MallActAwardSet(); // if(idList.size() <= 1){ // mallActAwardSet = idList.get(0); // }else{ // int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); // mallActAwardSet = idList.get(randomIdIndex); // } // mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); // mallActAwardSetMapper.updateById(mallActAwardSet); // // MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); // mallActLuckdrawRecord.setActId(actId); // mallActLuckdrawRecord.setActName(mallActSet.getActName()); // mallActLuckdrawRecord.setMemberId(memberId); // mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); // mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); // mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); // // MallActWinRecord mallActWinRecord = new MallActWinRecord(); // mallActWinRecord.setMemberId(memberId); // mallActWinRecord.setActId(actId); // mallActWinRecord.setActName(mallActSet.getActName()); // mallActWinRecord.setAwardId(mallActAwardSet.getId()); // mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); // mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); // mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); // mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); // mallActWinRecordMapper.insert(mallActWinRecord); // // apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); // apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); // apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); // apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); // // if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ // prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); // }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ // commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); // } // } // } // } // // //扣竞猜积分 // prizeScore = prizeScore.subtract(new BigDecimal(actScoreCnt)); // wallet.setPrizeScore(prizeScore); // wallet.setCommission(commission); // mallMemberWalletMapper.updateAmountWithVersion(wallet); // // System.out.println(apiMallAwardDetailsVo); // } // // @Test // public void agentTest() { //// agentProducer.sendDelayMsg(1L, 10000L); // // ApiMallActWinDetailsDto apiMallActWinDetailsDto = new ApiMallActWinDetailsDto(); // apiMallActWinDetailsDto.setActId(1L); // apiMallActWinDetailsDto.setPageNow(1); // apiMallActWinDetailsDto.setPageSize(10); // Long memberId = 4L; // MallMember mallMember = mallMemberMapper.selectById(memberId); // if(ObjectUtil.isEmpty(mallMember)){ // throw new FebsException("用户不存在"); // } // apiMallActWinDetailsDto.setMemberId(memberId); // // Long actId = apiMallActWinDetailsDto.getActId(); // MallActSet mallActSet = mallActSetMapper.selectById(actId); // if(ObjectUtil.isEmpty(mallActSet)){ // throw new FebsException("活动不存在"); // } // Page<ApiMallActWinDetailsVo> page = new Page<>(apiMallActWinDetailsDto.getPageNow(), apiMallActWinDetailsDto.getPageSize()); // IPage<ApiMallActWinDetailsVo> apiMallActWinDetailsVoIPage = mallActWinRecordMapper.selectApiMallActWinDetailsListInPage(apiMallActWinDetailsDto, page); // System.out.println(apiMallActWinDetailsVoIPage); // } // // @Test // public void insertAgentTest() { //// AgentInfo agentInfo = new AgentInfo(); //// agentInfo.setOrderType(2); //// agentInfo.setOrderCnt(2000); //// agentInfo.setLastCnt(3); //// agentInfo.setDirectIncome(BigDecimal.valueOf(50)); //// agentInfo.setTeamIncome(BigDecimal.valueOf(15)); //// agentInfo.setTeamIncomeType(2); //// //// DataDictionaryCustom data = new DataDictionaryCustom(); //// data.setType("AGENT_LEVEL_REQUIRE"); //// data.setCode(AgentLevelEnum.FOUR_LEVEL.name()); //// data.setValue(JSONObject.toJSONString(agentInfo)); //// dataDictionaryCustomMapper.insert(data); // } // // @Test // public void insertData() { // int i = 1; // for (AgentLevelEnum value : AgentLevelEnum.values()) { // DataDictionaryCustom data = new DataDictionaryCustom(); // data.setType("AGENT_LEVEL"); // data.setDescription(value.getName()); // data.setCode(value.name()); // data.setValue(String.valueOf(i)); // dataDictionaryCustomMapper.insert(data); // } // // } // // public static void main(String[] args) { // getJson(); // } // // public static void getJson(){ // AgentLevelUpdateDto adminAgentLevelUpdateInfoVo = new AgentLevelUpdateDto(); // String jsonStr = "{\"directIncome\":50,\"lastCnt\":3,\"orderCnt\":2000,\"orderType\":2,\"teamIncome\":15,\"teamIncomeType\":2}"; // JSONObject jsonObject = JSONObject.parseObject(jsonStr); // adminAgentLevelUpdateInfoVo.setDirectIncome(new BigDecimal((jsonObject.get("directIncome")==null?0:jsonObject.get("directIncome")).toString())); // adminAgentLevelUpdateInfoVo.setLastCnt(Integer.parseInt((jsonObject.get("lastCnt")==null?0:jsonObject.get("lastCnt")).toString())); // adminAgentLevelUpdateInfoVo.setOrderCnt(Integer.parseInt((jsonObject.get("orderCnt")==null?0:jsonObject.get("orderCnt")).toString())); // adminAgentLevelUpdateInfoVo.setOrderType(Integer.parseInt(jsonObject.get("orderType").toString())); // adminAgentLevelUpdateInfoVo.setTeamIncome(new BigDecimal((jsonObject.get("teamIncome")==null?0:jsonObject.get("teamIncome")).toString())); // adminAgentLevelUpdateInfoVo.setTeamIncomeType(Integer.parseInt(jsonObject.get("orderType").toString())); // adminAgentLevelUpdateInfoVo.setId(14L); // AgentLevelUpdateDto agentLevelUpdateDtoJson = new AgentLevelUpdateDto(); // agentLevelUpdateDtoJson.setDirectIncome(adminAgentLevelUpdateInfoVo.getDirectIncome()); // agentLevelUpdateDtoJson.setLastCnt(adminAgentLevelUpdateInfoVo.getLastCnt()); // agentLevelUpdateDtoJson.setOrderCnt(adminAgentLevelUpdateInfoVo.getOrderCnt()); // agentLevelUpdateDtoJson.setTeamIncome(adminAgentLevelUpdateInfoVo.getTeamIncome()); // agentLevelUpdateDtoJson.setOrderType(adminAgentLevelUpdateInfoVo.getOrderType()); // agentLevelUpdateDtoJson.setTeamIncomeType(adminAgentLevelUpdateInfoVo.getTeamIncomeType()); // JSONObject jsonObjectA = (JSONObject)JSONObject.toJSON(agentLevelUpdateDtoJson); // System.out.println(jsonObjectA.toJSONString()); // } // // @Test // public void autoLevelUp() { // // agentService.autoUpAgentLevel(3L); //// agentProducer.sendAutoLevelUpMsg(5L); // // agentProducer.sendReturnMoneyMsg(2L); // } // // @Test // public void returnMoney() { // // agentService.autoUpAgentLevel(3L); //// agentProducer.sendAutoLevelUpMsg(5L); //// agentProducer.sendReturnMoneyMsg(52L); // agentService.returnMoneyToAgent(52L); // } // // @Test // public void bigdecimalTest() { // BigDecimal aa = new BigDecimal("1.345"); // // System.out.println(aa.setScale(2, RoundingMode.DOWN)); // System.out.println(aa.setScale(2, RoundingMode.UP)); // } // // @Autowired // private ProfitJob profitJob; // // @Test // public void profitJobTest() { //// profitJob.profitJob(); // } // // // @Autowired // private AgentConsumer agentConsumer; // // @Test // public void orderReturnTest() { //// agentConsumer.orderReturnMoney("7"); // } @Autowired private GameService gameService; /** * 房主操作 */ //创建房间 @Test public void createRoom() { ApiCreateRoomDto apiCreateRoomDto = new ApiCreateRoomDto(); apiCreateRoomDto.setRoomType(1); apiCreateRoomDto.setGameTime(10); gameService.createRoom(apiCreateRoomDto); } }