🎨 代码优化
This commit is contained in:
parent
ef22670d1a
commit
8cdcdfeff0
@ -24,7 +24,7 @@ public class Sponsor implements Serializable, Cloneable {
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
private String dataType;
|
||||
private Integer dataType;
|
||||
/**
|
||||
* 数据主键
|
||||
*/
|
||||
|
@ -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() {
|
||||
|
@ -57,7 +57,7 @@ public class TransactionRecordServiceImpl extends AbstractService<TransactionRec
|
||||
@Override
|
||||
public List<TransactionRecordDTO> findTransactionRecords(String bankAccount, String startDate, String endDate) {
|
||||
List<TransactionRecordDTO> list = transactionRecordMapper.selectTransactionRecords(bankAccount, startDate, endDate);
|
||||
list.forEach(transactionRecordDTO -> genTransactionRecord(transactionRecordDTO));
|
||||
list.forEach(this::genTransactionRecord);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user