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