From e1cc0d03fadc2d251d36c0dc3650f75e830d5363 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 07 四月 2022 19:12:42 +0800 Subject: [PATCH] 功能完善 --- app/src/main/java/com/yeshi/makemoney/app/utils/factory/UserMoneyRecordFactory.java | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/app/src/main/java/com/yeshi/makemoney/app/utils/factory/UserMoneyRecordFactory.java b/app/src/main/java/com/yeshi/makemoney/app/utils/factory/UserMoneyRecordFactory.java index b3f88a8..8549fcc 100644 --- a/app/src/main/java/com/yeshi/makemoney/app/utils/factory/UserMoneyRecordFactory.java +++ b/app/src/main/java/com/yeshi/makemoney/app/utils/factory/UserMoneyRecordFactory.java @@ -1,9 +1,11 @@ package com.yeshi.makemoney.app.utils.factory; import com.ks.lib.common.exception.ParamsException; +import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; import com.yeshi.makemoney.app.entity.money.Extract; import com.yeshi.makemoney.app.entity.money.UserMoneyRecord; import com.yeshi.makemoney.app.entity.money.UserMoneyType; +import com.yeshi.makemoney.app.entity.user.UserInfo; import org.yeshi.utils.StringUtil; import java.math.BigDecimal; @@ -71,4 +73,30 @@ } + public static UserMoneyRecord createGoldCornExchange(GoldCornConsumeRecord record) throws ParamsException { + if (record == null) { + throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "閲戝竵鍏戞崲璁板綍涓嶈兘涓虹┖"); + } + if (record.getId() == null) { + throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "閲戝竵鍏戞崲璁板綍涓婚敭涓嶈兘涓虹┖"); + } + if (record.getMoney() == null) { + throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "鍏戞崲閲戦涓嶈兘涓虹┖"); + } + if (record.getUid() == null) { + throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "鍏戞崲鐢ㄦ埛涓嶈兘涓虹┖"); + } + UserMoneyRecord detail = new UserMoneyRecord(); + detail.setCreateTime(new Date()); + detail.setSerialNo(UserMoneyType.goldCorn.name().toLowerCase() + "_" + record.getId()); + detail.setMoney(record.getMoney()); + detail.setType(UserMoneyType.goldCorn); + detail.setUpdateTime(new Date()); + detail.setUser(new UserInfo(record.getUid())); + detail.setShow(true); + detail.setAdd(true); + return detail; + } + + } -- Gitblit v1.8.0