diff --git a/accompany-admin/accompany-admin-sdk/src/main/java/com/accompany/admin/vo/OfficialGoldAllRecordVo.java b/accompany-admin/accompany-admin-sdk/src/main/java/com/accompany/admin/vo/OfficialGoldAllRecordVo.java index b3e32ce10..2701491be 100644 --- a/accompany-admin/accompany-admin-sdk/src/main/java/com/accompany/admin/vo/OfficialGoldAllRecordVo.java +++ b/accompany-admin/accompany-admin-sdk/src/main/java/com/accompany/admin/vo/OfficialGoldAllRecordVo.java @@ -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; diff --git a/accompany-admin/accompany-admin-service/src/main/java/com/accompany/admin/service/record/OfficialGoldBusTypeAdminService.java b/accompany-admin/accompany-admin-service/src/main/java/com/accompany/admin/service/record/OfficialGoldBusTypeAdminService.java index e0936088d..5f17f8841 100644 --- a/accompany-admin/accompany-admin-service/src/main/java/com/accompany/admin/service/record/OfficialGoldBusTypeAdminService.java +++ b/accompany-admin/accompany-admin-service/src/main/java/com/accompany/admin/service/record/OfficialGoldBusTypeAdminService.java @@ -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 busTypeNameMap(Set ids) { + if (CollectionUtils.isEmpty(ids)) { + return EMPTY_MAP; + } + OfficialGoldBusTypeExample example = new OfficialGoldBusTypeExample(); + OfficialGoldBusTypeExample.Criteria criteria = example.createCriteria(); + criteria.andIdIn(new ArrayList<>(ids)); + List list = officialGoldBusTypeMapper.selectByExample(example); + if (CollectionUtils.isEmpty(list)) { + return EMPTY_MAP; + } + return list.stream().collect(Collectors.toMap(OfficialGoldBusType::getId, OfficialGoldBusType::getBusName)); + } + } diff --git a/accompany-admin/accompany-admin-service/src/main/java/com/accompany/admin/service/record/OfficialGoldRecordService.java b/accompany-admin/accompany-admin-service/src/main/java/com/accompany/admin/service/record/OfficialGoldRecordService.java index 5bff31928..d06f0d577 100644 --- a/accompany-admin/accompany-admin-service/src/main/java/com/accompany/admin/service/record/OfficialGoldRecordService.java +++ b/accompany-admin/accompany-admin-service/src/main/java/com/accompany/admin/service/record/OfficialGoldRecordService.java @@ -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> allRecord(Integer partitionId, Long erbanNo, OfficalSendTypeEnum type, Date beginDate, Date endDate, - Integer pageNo, Integer pageSize) { + public BusiResult> allRecord(Integer partitionId, Long erbanNo, OfficalSendTypeEnum type, + Date beginDate, Date endDate, Integer pageNo, Integer pageSize) { Page 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 allOfficialGoldRecord = officialGoldRecordMapperExpand.getAllOfficialGoldRecord(p, partitionId, uid, typeValue, beginDate, endDate); + Page allOfficialGoldRecord = officialGoldRecordMapperExpand + .getAllOfficialGoldRecord(p, partitionId, uid, typeValue, beginDate, endDate); + List resultList = new ArrayList<>(); List 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 pageResult = new PageResult<>(); pageResult.setTotal((int)allOfficialGoldRecord.getTotal()); pageResult.setRows(resultList); + + if (CollectionUtils.isEmpty(records)) { + return BusiResult.success(pageResult); + } + Set busTypeIds = records.stream().filter(record -> record.getBusType() != null) + .map(OfficialGoldRecordVo::getBusType).collect(Collectors.toSet()); + Map 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); } } diff --git a/accompany-base/accompany-core/src/main/java/com/accompany/common/constant/Constant.java b/accompany-base/accompany-core/src/main/java/com/accompany/common/constant/Constant.java index bbff4cc7c..67e3cc298 100644 --- a/accompany-base/accompany-core/src/main/java/com/accompany/common/constant/Constant.java +++ b/accompany-base/accompany-core/src/main/java/com/accompany/common/constant/Constant.java @@ -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; } diff --git a/accompany-business/accompany-business-sdk/src/main/java/com/accompany/business/constant/OfficalSendTypeEnum.java b/accompany-business/accompany-business-sdk/src/main/java/com/accompany/business/constant/OfficalSendTypeEnum.java index 3a1e1c995..2154a9227 100644 --- a/accompany-business/accompany-business-sdk/src/main/java/com/accompany/business/constant/OfficalSendTypeEnum.java +++ b/accompany-business/accompany-business-sdk/src/main/java/com/accompany/business/constant/OfficalSendTypeEnum.java @@ -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; diff --git a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/guild/GuildUsdBillRecordService.java b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/guild/GuildUsdBillRecordService.java index 9ca98e8cd..074e7de35 100644 --- a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/guild/GuildUsdBillRecordService.java +++ b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/guild/GuildUsdBillRecordService.java @@ -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