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; }