From f39e494173dfb8789d97beee4fc53123b8a6b21d Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 24 Nov 2021 15:51:03 +0800
Subject: [PATCH] 20211124 fish
---
src/main/java/com/xcong/excoin/modules/fish/dao/MemberAccountGoldDao.java | 3 +
src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java | 25 ++++++++
src/main/java/com/xcong/excoin/modules/fish/dao/CannonOwnRecordDao.java | 2
src/main/resources/mapper/fish/CannonOwnRecordDao.xml | 7 ++
src/main/resources/mapper/fish/MemberAccountGoldDao.xml | 4 +
src/main/java/com/xcong/excoin/modules/fish/vo/CannonSettingVo.java | 2
src/main/java/com/xcong/excoin/modules/fish/vo/OwnCannonVo.java | 25 ++++++++
src/main/java/com/xcong/excoin/modules/fish/controller/MemberCannonController.java | 41 ++++++++++---
src/main/java/com/xcong/excoin/modules/fish/service/MemberCannonService.java | 4 +
src/main/java/com/xcong/excoin/modules/fish/vo/GoldAccountVo.java | 20 ++++++
10 files changed, 122 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/fish/controller/MemberCannonController.java b/src/main/java/com/xcong/excoin/modules/fish/controller/MemberCannonController.java
index 84c8a7a..4feb965 100644
--- a/src/main/java/com/xcong/excoin/modules/fish/controller/MemberCannonController.java
+++ b/src/main/java/com/xcong/excoin/modules/fish/controller/MemberCannonController.java
@@ -1,21 +1,22 @@
package com.xcong.excoin.modules.fish.controller;
import com.xcong.excoin.common.response.Result;
+import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletAgentInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo;
import com.xcong.excoin.modules.fish.dto.CannonExchangeDto;
import com.xcong.excoin.modules.fish.dto.CoinGoldExchangeDto;
import com.xcong.excoin.modules.fish.dto.GetCannonsDto;
import com.xcong.excoin.modules.fish.dto.GoldExchangeDto;
import com.xcong.excoin.modules.fish.service.MemberCannonService;
+import com.xcong.excoin.modules.fish.vo.CannonSettingVo;
+import com.xcong.excoin.modules.fish.vo.GoldAccountVo;
+import com.xcong.excoin.modules.fish.vo.OwnCannonVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -29,6 +30,16 @@
private MemberCannonService memberCannonService;
/**
+ * 获取金币账户
+ */
+ @ApiOperation(value="获取金币账户", notes="获取金币账户")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = GoldAccountVo.class)})
+ @GetMapping(value="/getGoldAccount")
+ public Result getGoldAccount() {
+ return memberCannonService.getGoldAccount();
+ }
+
+ /**
* 代币金币互转
*/
@ApiOperation(value = "代币金币互转")
@@ -40,17 +51,17 @@
/**
* USDT购买金币
*/
- @ApiOperation(value = "USDT购买金币")
- @PostMapping(value = "/goldExchange")
- public Result goldExchange(@RequestBody GoldExchangeDto goldExchangeDto) {
- return memberCannonService.goldExchange(goldExchangeDto);
- }
+// @ApiOperation(value = "USDT购买金币")
+// @PostMapping(value = "/goldExchange")
+// public Result goldExchange(@RequestBody GoldExchangeDto goldExchangeDto) {
+// return memberCannonService.goldExchange(goldExchangeDto);
+// }
/**
* 获取大炮列表
*/
@ApiOperation(value = "获取大炮列表")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealVo.class)})
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = CannonSettingVo.class)})
@PostMapping(value = "/getCannons")
public Result getCannons(@RequestBody GetCannonsDto getCannonsDto) {
return memberCannonService.getCannons(getCannonsDto);
@@ -65,5 +76,15 @@
return memberCannonService.cannonExchange(cannonExchangeDto);
}
+ /**
+ * 获取用户拥有的炮台
+ */
+ @ApiOperation(value="获取用户拥有的炮台", notes="获取用户拥有的炮台")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = OwnCannonVo.class)})
+ @GetMapping(value="/getOwnCannon")
+ public Result getOwnCannon() {
+ return memberCannonService.getOwnCannon();
+ }
+
}
diff --git a/src/main/java/com/xcong/excoin/modules/fish/dao/CannonOwnRecordDao.java b/src/main/java/com/xcong/excoin/modules/fish/dao/CannonOwnRecordDao.java
index 4ce4f00..5f3056b 100644
--- a/src/main/java/com/xcong/excoin/modules/fish/dao/CannonOwnRecordDao.java
+++ b/src/main/java/com/xcong/excoin/modules/fish/dao/CannonOwnRecordDao.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xcong.excoin.modules.fish.entity.CannonOwnRecord;
+import com.xcong.excoin.modules.fish.vo.OwnCannonVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -10,4 +11,5 @@
List<CannonOwnRecord> selectCannonOwnRecordsByMemberIdAndCannonCode(@Param("memberId")Long memberId, @Param("code")String code);
+ List<OwnCannonVo> selectCannonOwnRecordsByMemberId(@Param("memberId")Long memberId);
}
diff --git a/src/main/java/com/xcong/excoin/modules/fish/dao/MemberAccountGoldDao.java b/src/main/java/com/xcong/excoin/modules/fish/dao/MemberAccountGoldDao.java
index 5b69ac8..5bc26ca 100644
--- a/src/main/java/com/xcong/excoin/modules/fish/dao/MemberAccountGoldDao.java
+++ b/src/main/java/com/xcong/excoin/modules/fish/dao/MemberAccountGoldDao.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xcong.excoin.modules.fish.entity.MemberAccountGold;
+import com.xcong.excoin.modules.fish.vo.GoldAccountVo;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
@@ -11,4 +12,6 @@
MemberAccountGold selectAccountGoldByMemberId(@Param("memberId")Long memberId);
int updateTotalBalanceAndAvailableBalance(@Param("id") Long id, @Param("availableBalance") BigDecimal availableBalance, @Param("totalBalance") BigDecimal totalBalance, @Param("frozenBalance") BigDecimal frozenBalance);
+
+ GoldAccountVo selectAccountGoldVoByMemberId(Long memberId);
}
diff --git a/src/main/java/com/xcong/excoin/modules/fish/service/MemberCannonService.java b/src/main/java/com/xcong/excoin/modules/fish/service/MemberCannonService.java
index 1f363dd..8c60692 100644
--- a/src/main/java/com/xcong/excoin/modules/fish/service/MemberCannonService.java
+++ b/src/main/java/com/xcong/excoin/modules/fish/service/MemberCannonService.java
@@ -22,4 +22,8 @@
Result cannonExchange(CannonExchangeDto cannonExchangeDto);
Result goldExchange(GoldExchangeDto goldExchangeDto);
+
+ Result getGoldAccount();
+
+ Result getOwnCannon();
}
diff --git a/src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java b/src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java
index d13af5a..eb9bb9c 100644
--- a/src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java
@@ -21,6 +21,8 @@
import com.xcong.excoin.modules.fish.entity.*;
import com.xcong.excoin.modules.fish.service.MemberCannonService;
import com.xcong.excoin.modules.fish.vo.CannonSettingVo;
+import com.xcong.excoin.modules.fish.vo.GoldAccountVo;
+import com.xcong.excoin.modules.fish.vo.OwnCannonVo;
import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
import com.xcong.excoin.utils.RedisUtils;
@@ -191,6 +193,29 @@
return Result.ok("兑换成功");
}
+ @Override
+ public Result getGoldAccount() {
+ Long memberId = LoginUserUtils.getAppLoginUser().getId();
+ MemberAccountGold memberAccountGold = memberAccountGoldDao.selectAccountGoldByMemberId(memberId);
+ if(ObjectUtil.isEmpty(memberAccountGold)){
+ MemberAccountGold memberAccountGoldNew = new MemberAccountGold();
+ memberAccountGoldNew.setMemberId(memberId);
+ memberAccountGoldNew.setTotalBalance(BigDecimal.ZERO);
+ memberAccountGoldNew.setAvailableBalance(BigDecimal.ZERO);
+ memberAccountGoldNew.setFrozenBalance(BigDecimal.ZERO);
+ memberAccountGoldDao.insert(memberAccountGoldNew);
+ }
+ GoldAccountVo goldAccountVo = memberAccountGoldDao.selectAccountGoldVoByMemberId(memberId);
+ return Result.ok(goldAccountVo);
+ }
+
+ @Override
+ public Result getOwnCannon() {
+ Long memberId = LoginUserUtils.getAppLoginUser().getId();
+ List<OwnCannonVo> cannonOwnRecords = cannonOwnRecordDao.selectCannonOwnRecordsByMemberId(memberId);
+ return Result.ok(cannonOwnRecords);
+ }
+
public static void main(String[] args) {
System.out.println(UUID.randomUUID().toString());
}
diff --git a/src/main/java/com/xcong/excoin/modules/fish/vo/CannonSettingVo.java b/src/main/java/com/xcong/excoin/modules/fish/vo/CannonSettingVo.java
index c1dc0fd..aba8c44 100644
--- a/src/main/java/com/xcong/excoin/modules/fish/vo/CannonSettingVo.java
+++ b/src/main/java/com/xcong/excoin/modules/fish/vo/CannonSettingVo.java
@@ -18,7 +18,7 @@
private String code;
@ApiModelProperty(value = "兑换价格")//兑换价格
private BigDecimal exchangePrice;
- @ApiModelProperty(value = "1发炮弹消耗金币数")//消耗金币
+ @ApiModelProperty(value = "每发炮弹消耗金币数")//消耗金币
private BigDecimal goldConsume;
}
diff --git a/src/main/java/com/xcong/excoin/modules/fish/vo/GoldAccountVo.java b/src/main/java/com/xcong/excoin/modules/fish/vo/GoldAccountVo.java
new file mode 100644
index 0000000..81ebf0d
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/fish/vo/GoldAccountVo.java
@@ -0,0 +1,20 @@
+package com.xcong.excoin.modules.fish.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel(value = "GoldAccountVo", description = "金币账户")
+public class GoldAccountVo {
+
+ private Long memberId;
+ @ApiModelProperty(value = "金币可用余额")//金币可用余额
+ private BigDecimal availableBalance;
+ @ApiModelProperty(value = "金币总金额")//金币总金额
+ private BigDecimal totalBalance;
+ @ApiModelProperty(value = "金币冻结余额")//金币冻结余额
+ private BigDecimal frozenBalance;
+}
diff --git a/src/main/java/com/xcong/excoin/modules/fish/vo/OwnCannonVo.java b/src/main/java/com/xcong/excoin/modules/fish/vo/OwnCannonVo.java
new file mode 100644
index 0000000..23823f8
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/fish/vo/OwnCannonVo.java
@@ -0,0 +1,25 @@
+package com.xcong.excoin.modules.fish.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+@Data
+@ApiModel(value = "OwnCannonVo", description = "金币账户")
+public class OwnCannonVo {
+
+ private Long memberId;
+ @ApiModelProperty(value = "炮台UUID")//炮台UUID
+ private String cannonUuid;
+ @ApiModelProperty(value = "炮台名称")//炮台名称
+ private String cannonName;
+ @ApiModelProperty(value = "炮台编码")//炮台编码
+ private String cannonCode;
+ @ApiModelProperty(value = "炮台兑换价格")//炮台兑换价格
+ private BigDecimal cannonPrice;
+ @ApiModelProperty(value = "每发炮弹消耗金币数")//消耗金币
+ private BigDecimal goldConsume;
+ @ApiModelProperty(value = "1:主动购买 2:系统赠送")//1:主动购买 2:系统赠送
+ private Integer type;
+}
diff --git a/src/main/resources/mapper/fish/CannonOwnRecordDao.xml b/src/main/resources/mapper/fish/CannonOwnRecordDao.xml
index bd80702..e79ff28 100644
--- a/src/main/resources/mapper/fish/CannonOwnRecordDao.xml
+++ b/src/main/resources/mapper/fish/CannonOwnRecordDao.xml
@@ -6,4 +6,11 @@
select a.* from cannon_own_record a where a.member_id = #{memberId} and a.cannon_code = #{code}
</select>
+ <select id="selectCannonOwnRecordsByMemberId" resultType="com.xcong.excoin.modules.fish.vo.OwnCannonVo">
+ select a.*,b.gold_consume goldConsume
+ from cannon_own_record a
+ left join cannon_setting b on a.cannon_code = b.code
+ where a.member_id = #{memberId}
+ </select>
+
</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/fish/MemberAccountGoldDao.xml b/src/main/resources/mapper/fish/MemberAccountGoldDao.xml
index 199f771..bf8057b 100644
--- a/src/main/resources/mapper/fish/MemberAccountGoldDao.xml
+++ b/src/main/resources/mapper/fish/MemberAccountGoldDao.xml
@@ -28,4 +28,8 @@
where id=#{id}
</update>
+ <select id="selectAccountGoldVoByMemberId" resultType="com.xcong.excoin.modules.fish.vo.GoldAccountVo">
+ select a.* from member_account_gold a where a.member_id = #{memberId}
+ </select>
+
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1