兼容旧版本数据,后台操作货币类型用WalletCurrencyType,usd操作数量存储字段diamond_num

This commit is contained in:
2025-07-25 15:17:39 +08:00
parent ee16eaea2e
commit f530fbd9a7
6 changed files with 72 additions and 54 deletions

View File

@@ -10,9 +10,6 @@ import java.util.Date;
@ApiModel
@Data
public class OfficialGoldAllRecordVo {
@ApiModelProperty("操作时间")
@ExcelProperty("操作时间")
private Date createTime;
@ApiModelProperty("用户ID")
@ExcelProperty("用户ID")
private Long erbanNo;
@@ -22,27 +19,24 @@ public class OfficialGoldAllRecordVo {
@ApiModelProperty("区域")
@ExcelProperty("区域")
private String partitionDesc;
@ApiModelProperty("实时金币余额")
@ExcelProperty("实时金币余额")
private Long money;
@ApiModelProperty("赠送金币数量")
@ExcelProperty("赠送金币数量")
private Long goldNum;
@ApiModelProperty("赠送钻石数量")
@ExcelProperty("赠送钻石数量")
private Long diamondNum;
@ApiModelProperty("操作数量")
@ExcelProperty("操作数量")
private BigDecimal operationNum;
@ApiModelProperty("打款金额")
@ExcelProperty("打款金额")
private BigDecimal actualAmount;
@ApiModelProperty("赠送类型")
@ExcelProperty("赠送类型")
private String typeDesc;
@ApiModelProperty("赠送分类")
@ExcelProperty("赠送分类")
private String currencyTypeDesc;
@ApiModelProperty("打款金额")
@ExcelProperty("打款金额")
private BigDecimal actualAmount;
@ApiModelProperty("备注")
@ExcelProperty("备注")
private String remark;
@ApiModelProperty("操作时间")
@ExcelProperty("操作时间")
private Date createTime;
@ApiModelProperty("操作人")
@ExcelProperty("操作人")
private String operatorName;

View File

@@ -6,11 +6,14 @@ import com.accompany.business.model.OfficialGoldBusTypeExample;
import com.accompany.business.mybatismapper.OfficialGoldBusTypeMapper;
import com.accompany.core.service.base.BaseService;
import com.accompany.core.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.Collections.EMPTY_MAP;
/**
* {这里添加描述}
@@ -82,4 +85,18 @@ public class OfficialGoldBusTypeAdminService extends BaseService {
return officialGoldBusTypeMapper.updateByPrimaryKeySelective(record);
}
public Map<Integer, String> busTypeNameMap(Set<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
return EMPTY_MAP;
}
OfficialGoldBusTypeExample example = new OfficialGoldBusTypeExample();
OfficialGoldBusTypeExample.Criteria criteria = example.createCriteria();
criteria.andIdIn(new ArrayList<>(ids));
List<OfficialGoldBusType> list = officialGoldBusTypeMapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
return EMPTY_MAP;
}
return list.stream().collect(Collectors.toMap(OfficialGoldBusType::getId, OfficialGoldBusType::getBusName));
}
}

View File

@@ -412,7 +412,7 @@ public class OfficialGoldRecordService extends BaseService {
if (Constant.OfficialType.interSendGold.byteValue() == type
|| Constant.OfficialType.clearUserGold.byteValue() == type
|| Constant.OfficialType.plusGuildUsd == type
||Constant.OfficialType.miunsGuildUsd == type) {
|| Constant.OfficialType.miunsGuildUsd == type) {
diamondNum = num;
} else {
goldNum = num;
@@ -684,8 +684,8 @@ public class OfficialGoldRecordService extends BaseService {
}
public BusiResult<PageResult<OfficialGoldAllRecordVo>> allRecord(Integer partitionId, Long erbanNo, OfficalSendTypeEnum type, Date beginDate, Date endDate,
Integer pageNo, Integer pageSize) {
public BusiResult<PageResult<OfficialGoldAllRecordVo>> allRecord(Integer partitionId, Long erbanNo, OfficalSendTypeEnum type,
Date beginDate, Date endDate, Integer pageNo, Integer pageSize) {
Page<OfficialGoldRecordVo> p = new Page<>(pageNo, pageSize);
Long uid = null;
if (erbanNo != null) {
@@ -699,37 +699,45 @@ public class OfficialGoldRecordService extends BaseService {
if (type != null) {
typeValue = type.getValue();
}
Page<OfficialGoldRecordVo> allOfficialGoldRecord = officialGoldRecordMapperExpand.getAllOfficialGoldRecord(p, partitionId, uid, typeValue, beginDate, endDate);
Page<OfficialGoldRecordVo> allOfficialGoldRecord = officialGoldRecordMapperExpand
.getAllOfficialGoldRecord(p, partitionId, uid, typeValue, beginDate, endDate);
List<OfficialGoldAllRecordVo> resultList = new ArrayList<>();
List<OfficialGoldRecordVo> records = allOfficialGoldRecord.getRecords();
if (CollectionUtils.isNotEmpty(records)) {
for (OfficialGoldRecordVo record : records) {
OfficialGoldAllRecordVo vo = new OfficialGoldAllRecordVo();
vo.setCreateTime(record.getCreateTime());
vo.setErbanNo(record.getErbanNo());
vo.setNick(record.getNick());
vo.setPartitionDesc( PartitionEnum.getByPartitionId(record.getPartitionId()).getDesc());
vo.setMoney(record.getMoney());
OfficalSendTypeEnum officalSendTypeEnum = OfficalSendTypeEnum.get(record.getType());
vo.setTypeDesc(officalSendTypeEnum.getDesc());
if (officalSendTypeEnum.getCurrencyType() == 0) {
vo.setDiamondNum(record.getGoldNum());
vo.setGoldNum(0L);
vo.setCurrencyTypeDesc("官方操作钻石");
} else if (officalSendTypeEnum.getCurrencyType() == 2) {
vo.setGoldNum(record.getGoldNum());
vo.setDiamondNum(0L);
vo.setCurrencyTypeDesc("官方操作金币");
}
vo.setActualAmount(record.getActualAmount());
vo.setRemark(record.getRemark());
vo.setOperatorName(record.getOperatorName());
resultList.add(vo);
}
}
PageResult<OfficialGoldAllRecordVo> pageResult = new PageResult<>();
pageResult.setTotal((int)allOfficialGoldRecord.getTotal());
pageResult.setRows(resultList);
if (CollectionUtils.isEmpty(records)) {
return BusiResult.success(pageResult);
}
Set<Integer> busTypeIds = records.stream().filter(record -> record.getBusType() != null)
.map(OfficialGoldRecordVo::getBusType).collect(Collectors.toSet());
Map<Integer, String> busTypeNameMap = officialGoldBusTypeAdminService.busTypeNameMap(busTypeIds);
for (OfficialGoldRecordVo record : records) {
OfficialGoldAllRecordVo vo = new OfficialGoldAllRecordVo();
vo.setCreateTime(record.getCreateTime());
vo.setErbanNo(record.getErbanNo());
vo.setNick(record.getNick());
vo.setPartitionDesc( PartitionEnum.getByPartitionId(record.getPartitionId()).getDesc());
OfficalSendTypeEnum officalSendTypeEnum = OfficalSendTypeEnum.get(record.getType());
vo.setTypeDesc(officalSendTypeEnum.getDesc());
if (record.getBusType() != null) {
vo.setCurrencyTypeDesc(busTypeNameMap.get(record.getBusType()));
}
if (Constant.WalletCurrencyType.gold.equals(officalSendTypeEnum.getCurrencyType())) {
vo.setOperationNum(BigDecimal.valueOf(record.getDiamondNum()));
} else if (Constant.WalletCurrencyType.diamonds.equals(officalSendTypeEnum.getCurrencyType())) {
vo.setOperationNum(BigDecimal.valueOf(record.getGoldNum()));
} else if (Constant.WalletCurrencyType.usd.equals(officalSendTypeEnum.getCurrencyType())) {
vo.setOperationNum(BigDecimal.valueOf(record.getDiamondNum()));
}
vo.setActualAmount(record.getActualAmount());
vo.setRemark(record.getRemark());
vo.setOperatorName(record.getOperatorName());
resultList.add(vo);
}
return BusiResult.success(pageResult);
}
}

View File

@@ -2528,9 +2528,9 @@ public class Constant {
}
public static class WalletCurrencyType {
public static final Byte gold = 0; // 金币
public static final Byte gold = 0; // 金币 现为钻石
public static final Byte radish = 1; // 水晶
public static final Byte diamonds = 2; //钻石
public static final Byte diamonds = 2; //钻石 现为金币
public static final Byte usd = 4;
}

View File

@@ -2,7 +2,6 @@ package com.accompany.business.constant;
import com.accompany.common.constant.Constant;
import com.accompany.core.enumeration.CurrencyEnum;
import java.util.Arrays;
import java.util.Optional;
@@ -23,9 +22,9 @@ public enum OfficalSendTypeEnum {
OFFICAL_REDUCE_DIAMONDS(Constant.OfficialType.officalDiamondReduce,"官方金币消除", (byte)2),
OFFICAL_MINUS_GUILD_USD(Constant.OfficialType.miunsGuildUsd, "官方消除薪资", CurrencyEnum.GUILD_USD.getValue()),
OFFICAL_MINUS_GUILD_USD(Constant.OfficialType.miunsGuildUsd, "消除薪资", Constant.WalletCurrencyType.usd),
OFFICAL_PLUS_GUILD_USD(Constant.OfficialType.plusGuildUsd,"官方赠送薪资", CurrencyEnum.GUILD_USD.getValue()),
OFFICAL_PLUS_GUILD_USD(Constant.OfficialType.plusGuildUsd,"赠送薪资", Constant.WalletCurrencyType.usd),
;
private byte value;

View File

@@ -33,7 +33,6 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@@ -114,12 +113,13 @@ public class GuildUsdBillRecordService extends ServiceImpl<GuildUsdBillRecordMap
.eq(Constant.status.valid.equals(type), GuildUsdBillRecord::getTargetUid, uid)
.in(Constant.status.valid.equals(type), GuildUsdBillRecord::getType,
List.of(GuildUsdOperateTypeEnum.DIAMOND_WITHDRAW_USD.getType(), GuildUsdOperateTypeEnum.USD_TO_GUILD_OWNER.getType(),
GuildUsdOperateTypeEnum.GUILD_USD_SETTLEMENT.getType(), GuildUsdOperateTypeEnum.USD_WITHDRAW_REJECT.getType()))
GuildUsdOperateTypeEnum.GUILD_USD_SETTLEMENT.getType(), GuildUsdOperateTypeEnum.USD_WITHDRAW_REJECT.getType(),
GuildUsdOperateTypeEnum.SYSTEM_PLUS_USD.getType()))
.eq(Constant.status.invalid.equals(type), GuildUsdBillRecord::getUid, uid)
.in(Constant.status.invalid.equals(type), GuildUsdBillRecord::getType,
List.of(GuildUsdOperateTypeEnum.USD_TO_PLATFORM.getType(), GuildUsdOperateTypeEnum.USD_TO_GUILD_OWNER.getType(),
GuildUsdOperateTypeEnum.USD_TO_RECHARGE_USER.getType(), GuildUsdOperateTypeEnum.OWNER_USD_WITHDRAW.getType(),
GuildUsdOperateTypeEnum.MEMBER_USD_WITHDRAW.getType()))
GuildUsdOperateTypeEnum.MEMBER_USD_WITHDRAW.getType(),GuildUsdOperateTypeEnum.SYSTEM_MIUNS_USD.getType()))
.orderByDesc(GuildUsdBillRecord::getId);
this.page(poPage, queryWrapper);