From 8cdcdfeff09078676aff66ea3d342785f25fafb7 Mon Sep 17 00:00:00 2001 From: ronger Date: Mon, 6 Jun 2022 11:55:31 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/rymcu/forest/entity/Sponsor.java | 2 +- .../forest/enumerate/TransactionEnum.java | 21 +++++++------------ .../impl/TransactionRecordServiceImpl.java | 2 +- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/rymcu/forest/entity/Sponsor.java b/src/main/java/com/rymcu/forest/entity/Sponsor.java index 46ad4b3..a9eeaef 100644 --- a/src/main/java/com/rymcu/forest/entity/Sponsor.java +++ b/src/main/java/com/rymcu/forest/entity/Sponsor.java @@ -24,7 +24,7 @@ public class Sponsor implements Serializable, Cloneable { /** * 数据类型 */ - private String dataType; + private Integer dataType; /** * 数据主键 */ diff --git a/src/main/java/com/rymcu/forest/enumerate/TransactionEnum.java b/src/main/java/com/rymcu/forest/enumerate/TransactionEnum.java index 6b6c8de..fec7f07 100644 --- a/src/main/java/com/rymcu/forest/enumerate/TransactionEnum.java +++ b/src/main/java/com/rymcu/forest/enumerate/TransactionEnum.java @@ -7,29 +7,22 @@ import java.util.Arrays; */ public enum TransactionEnum { - ArticleSponsor("0", 20, "文章赞赏"), - Answer("1", 30, "答题奖励"), - CorrectAnswer("2", 50, "答题奖励"), - NewbieRewards("3", 200, "新手奖励"); - - private String dataType; + ArticleSponsor(20, "文章赞赏"), + Answer(30, "答题奖励"), + CorrectAnswer(50, "答题奖励"), + NewbieRewards(200, "新手奖励"); private Integer money; private String description; - TransactionEnum(String dataType, Integer money, String description) { - this.dataType = dataType; + TransactionEnum(Integer money, String description) { this.money = money; this.description = description; } - public static TransactionEnum findTransactionEnum(String dataType) { - return Arrays.stream(TransactionEnum.values()).filter(transactionEnum -> transactionEnum.getDataType().equals(dataType)).findFirst().orElse(TransactionEnum.ArticleSponsor); - } - - public String getDataType() { - return this.dataType; + public static TransactionEnum findTransactionEnum(int dataType) { + return Arrays.stream(TransactionEnum.values()).filter(transactionEnum -> transactionEnum.ordinal() == dataType).findFirst().orElse(TransactionEnum.ArticleSponsor); } public Integer getMoney() { diff --git a/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java index af8856f..4a2f7cb 100644 --- a/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/TransactionRecordServiceImpl.java @@ -57,7 +57,7 @@ public class TransactionRecordServiceImpl extends AbstractService findTransactionRecords(String bankAccount, String startDate, String endDate) { List list = transactionRecordMapper.selectTransactionRecords(bankAccount, startDate, endDate); - list.forEach(transactionRecordDTO -> genTransactionRecord(transactionRecordDTO)); + list.forEach(this::genTransactionRecord); return list; }