diff --git a/src/main/java/com/example/demo/controller/cash/CashCollectionController.java b/src/main/java/com/example/demo/controller/cash/CashCollectionController.java index e8dcd76..75bee1f 100644 --- a/src/main/java/com/example/demo/controller/cash/CashCollectionController.java +++ b/src/main/java/com/example/demo/controller/cash/CashCollectionController.java @@ -2,11 +2,13 @@ package com.example.demo.controller.cash; import com.example.demo.Util.JWTUtil; import com.example.demo.Util.LanguageTranslationUtil; +import com.example.demo.config.interfac.Log; import com.example.demo.domain.DTO.PerformanceDTO; import com.example.demo.domain.entity.*; import com.example.demo.domain.vo.cash.*; import com.example.demo.domain.vo.coin.Page; import com.example.demo.domain.vo.coin.Result; +import com.example.demo.service.Wallet.WalletService; import com.example.demo.service.cash.CashCollectionService; import com.example.demo.service.coin.TranslationService; import com.github.pagehelper.PageInfo; @@ -46,6 +48,9 @@ public class CashCollectionController { @Autowired private TranslationService translationService; + @Autowired + private WalletService walletService; + //根据精网号获取姓名和地区 @PostMapping("/getNameAndMarket") public Result getNameAndMarket(@RequestBody Integer jwcode, @RequestHeader(defaultValue = "zh_CN") String lang) { @@ -429,6 +434,33 @@ public class CashCollectionController { } /** + * 查询所有钱包类型 + */ + @Log("查询所有钱包类型") + @PostMapping("/selectAllWallets") + public Result selectAllWallets(@RequestHeader(defaultValue = "zh_CN") String lang) { + try { + List wallets = walletService.selectAllWallets(); + + // 对钱包名称进行多语言转换 + if (wallets != null && !"zh".equalsIgnoreCase(parseLanguageCode(lang)) + && !"zh_cn".equalsIgnoreCase(parseLanguageCode(lang))) { + for (Wallet wallet : wallets) { + if (wallet.getWalletName() != null) { + wallet.setWalletName( + languageTranslationUtil.translate(wallet.getWalletName().toString(), lang) + ); + } + } + } + + return Result.success(wallets); + } catch (Exception e) { + log.error("查询所有钱包类型失败", e); + return Result.error("查询失败"); + } + } + /** * 转换用户钱包 VO 的多语言字段 */ private void translateUserWalletVO(UserWalletVO vo, String lang) { diff --git a/src/main/java/com/example/demo/domain/entity/Wallet.java b/src/main/java/com/example/demo/domain/entity/Wallet.java index dd3e69b..3c556d2 100644 --- a/src/main/java/com/example/demo/domain/entity/Wallet.java +++ b/src/main/java/com/example/demo/domain/entity/Wallet.java @@ -18,6 +18,6 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class Wallet { private Integer id; //钱包id - private Integer walletName; // 钱包名称 + private String walletName; // 钱包名称 private Integer priority; // 优先级 } diff --git a/src/main/java/com/example/demo/mapper/coin/WalletMapper.java b/src/main/java/com/example/demo/mapper/coin/WalletMapper.java index 1e8b8c2..2a34c8a 100644 --- a/src/main/java/com/example/demo/mapper/coin/WalletMapper.java +++ b/src/main/java/com/example/demo/mapper/coin/WalletMapper.java @@ -23,4 +23,7 @@ public interface WalletMapper { List selectWalletRecord(Integer jwcode, String orderCode); void updateWalletRecord(Integer id); GOrder MysqlConnection(String linkId); + + // 查询所有钱包类型 + List selectAllWallets(); } diff --git a/src/main/java/com/example/demo/service/Wallet/WalletService.java b/src/main/java/com/example/demo/service/Wallet/WalletService.java index 271bc7d..d9ce6eb 100644 --- a/src/main/java/com/example/demo/service/Wallet/WalletService.java +++ b/src/main/java/com/example/demo/service/Wallet/WalletService.java @@ -1,9 +1,6 @@ package com.example.demo.service.Wallet; -import com.example.demo.domain.entity.GOrder; -import com.example.demo.domain.entity.UserGoldRecord; -import com.example.demo.domain.entity.UserRegionWallet; -import com.example.demo.domain.entity.UserWalletRecord; +import com.example.demo.domain.entity.*; import org.springframework.stereotype.Service; import java.util.List; @@ -22,4 +19,6 @@ public interface WalletService { void updateUserWalletRecord(Integer id); GOrder MysqlConnection(String linkId); + // 查询所有钱包类型 + List selectAllWallets(); } diff --git a/src/main/java/com/example/demo/serviceImpl/Wallet/WalletServiceImpl.java b/src/main/java/com/example/demo/serviceImpl/Wallet/WalletServiceImpl.java index 9f11af0..9745d92 100644 --- a/src/main/java/com/example/demo/serviceImpl/Wallet/WalletServiceImpl.java +++ b/src/main/java/com/example/demo/serviceImpl/Wallet/WalletServiceImpl.java @@ -1,10 +1,7 @@ package com.example.demo.serviceImpl.Wallet; import com.example.demo.Util.BusinessException; -import com.example.demo.domain.entity.GOrder; -import com.example.demo.domain.entity.UserGoldRecord; -import com.example.demo.domain.entity.UserRegionWallet; -import com.example.demo.domain.entity.UserWalletRecord; +import com.example.demo.domain.entity.*; import com.example.demo.exception.SystemException; import com.example.demo.mapper.coin.WalletMapper; import com.example.demo.service.Wallet.WalletService; @@ -69,4 +66,9 @@ public class WalletServiceImpl implements WalletService { return gOrder; } + + @Override + public List selectAllWallets() { + return walletMapper.selectAllWallets(); + } } diff --git a/src/main/resources/mapper/WalletMapper.xml b/src/main/resources/mapper/WalletMapper.xml index 0522ecf..bd31a9c 100644 --- a/src/main/resources/mapper/WalletMapper.xml +++ b/src/main/resources/mapper/WalletMapper.xml @@ -1,18 +1,38 @@ + + + + + + + + + + + + + + + + + - update user_region_wallet set current_permanent_gold = #{currentPermanentGold} where jwcode = #{jwcode} and wallet_id = #{walletId}} + update user_region_wallet set current_permanent_gold = #{currentPermanentGold} where jwcode = #{jwcode} and wallet_id = #{walletId} + update user_wallet_record set status = 1 where id = #{id} + + + + + + \ No newline at end of file