Browse Source

20260315 钱包查询

milestone-20260224-现金钱包
wangguorui 4 weeks ago
parent
commit
41690ec3a5
  1. 32
      src/main/java/com/example/demo/controller/cash/CashCollectionController.java
  2. 2
      src/main/java/com/example/demo/domain/entity/Wallet.java
  3. 3
      src/main/java/com/example/demo/mapper/coin/WalletMapper.java
  4. 7
      src/main/java/com/example/demo/service/Wallet/WalletService.java
  5. 10
      src/main/java/com/example/demo/serviceImpl/Wallet/WalletServiceImpl.java
  6. 37
      src/main/resources/mapper/WalletMapper.xml

32
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<Wallet> 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) {

2
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; // 优先级
}

3
src/main/java/com/example/demo/mapper/coin/WalletMapper.java

@ -23,4 +23,7 @@ public interface WalletMapper {
List<UserWalletRecord> selectWalletRecord(Integer jwcode, String orderCode);
void updateWalletRecord(Integer id);
GOrder MysqlConnection(String linkId);
// 查询所有钱包类型
List<Wallet> selectAllWallets();
}

7
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<Wallet> selectAllWallets();
}

10
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<Wallet> selectAllWallets() {
return walletMapper.selectAllWallets();
}
}

37
src/main/resources/mapper/WalletMapper.xml

@ -1,18 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.demo.mapper.coin.WalletMapper">
<!-- 结果映射 -->
<resultMap id="WalletResult" type="com.example.demo.domain.entity.Wallet">
<id property="id" column="id"/>
<result property="walletName" column="wallet_name"/>
<result property="priority" column="priority"/>
</resultMap>
<resultMap id="UserRegionWalletResult" type="com.example.demo.domain.entity.UserRegionWallet">
<id property="id" column="id"/>
<result property="jwcode" column="jwcode"/>
<result property="walletId" column="wallet_id"/>
<result property="currentPermanentGold" column="current_permanent_gold"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<update id="updateWallet">
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>
<update id="updateWalletRecord">
update user_wallet_record set status = 1 where id = #{id}
</update>
<select id="selectWallet" resultType="com.example.demo.domain.entity.UserRegionWallet">
select jwcode,
wallet_id,
current_permanent_gold
from user_region_wallet where jwcode = #{jwcode} and wallet_id = #{walletId}
</select>
<select id="selectWalletRecord" resultType="com.example.demo.domain.entity.UserWalletRecord">
select jwcode,
wallet_id,
@ -24,6 +44,7 @@
id
from user_wallet_record where jwcode = #{jwcode} and order_code = #{orderCode}
</select>
<select id="MysqlConnection" resultType="com.example.demo.domain.entity.GOrder">
select id,
jwcode,
@ -32,7 +53,17 @@
merchant_id,
price,
count,
pay_style,
from g_order where id = {linkId}
pay_style
from g_order where id = #{linkId}
</select>
<!-- 查询所有钱包类型 -->
<select id="selectAllWallets" resultMap="WalletResult">
SELECT
id,
wallet_name,
priority
FROM wallet
ORDER BY priority ASC
</select>
</mapper>
Loading…
Cancel
Save