package com.yeshi.makemoney.app.utils.factory.msg;
|
|
import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord;
|
import com.yeshi.makemoney.app.entity.msg.UserMsg;
|
import com.yeshi.makemoney.app.entity.msg.UserMsgType;
|
import org.yeshi.utils.StringUtil;
|
|
import java.math.BigDecimal;
|
import java.math.RoundingMode;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* @author hxh
|
* @title: UserMsgFactory
|
* @description: 用户消息工厂
|
* @date 2022/4/7 15:51
|
*/
|
public class UserMsgFactory {
|
|
/**
|
* @return com.yeshi.makemoney.app.entity.msg.UserMsg
|
* @author hxh
|
* @description 金币兑换
|
* @date 16:02 2022/4/7
|
* @param: record
|
* @param: balance
|
**/
|
public static UserMsg createGoldCornExchange(GoldCornConsumeRecord record, BigDecimal balance) {
|
UserMsg userMsg = new UserMsg();
|
userMsg.setType(UserMsgType.goldcornexchange);
|
userMsg.setUid(record.getUid());
|
List<UserMsg.UserMsgItem> contentList = new ArrayList<>();
|
contentList.add(new UserMsg.UserMsgItem("折算金币", record.getCornNum() + ""));
|
contentList.add(new UserMsg.UserMsgItem("折算金额", new BigDecimal(record.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR).toString() + "元"));
|
contentList.add(new UserMsg.UserMsgItem("账户余额", balance.toString() + "元"));
|
userMsg.setContentList(contentList);
|
return userMsg;
|
}
|
|
|
/**
|
* @return com.yeshi.makemoney.app.entity.msg.UserMsg
|
* @author hxh
|
* @description 提现成功
|
* @date 16:02 2022/4/7
|
* @param: uid
|
* @param: money
|
**/
|
public static UserMsg createExtractSuccess(Long uid, BigDecimal money) {
|
UserMsg userMsg = new UserMsg();
|
userMsg.setType(UserMsgType.extract);
|
userMsg.setUid(uid);
|
List<UserMsg.UserMsgItem> contentList = new ArrayList<>();
|
contentList.add(new UserMsg.UserMsgItem("提现金额", money.toString() + "元"));
|
contentList.add(new UserMsg.UserMsgItem("提现状态", "提现成功"));
|
userMsg.setContentList(contentList);
|
return userMsg;
|
}
|
|
/**
|
* @return com.yeshi.makemoney.app.entity.msg.UserMsg
|
* @author hxh
|
* @description 提现失败
|
* @date 16:02 2022/4/7
|
* @param: uid
|
* @param: money
|
**/
|
|
public static UserMsg createExtractFail(Long uid, BigDecimal money, String beizhu) {
|
UserMsg userMsg = new UserMsg();
|
userMsg.setType(UserMsgType.extract);
|
userMsg.setUid(uid);
|
List<UserMsg.UserMsgItem> contentList = new ArrayList<>();
|
contentList.add(new UserMsg.UserMsgItem("提现金额", money.toString() + "元"));
|
contentList.add(new UserMsg.UserMsgItem("提现状态", "提现失败"));
|
if (!StringUtil.isNullOrEmpty(beizhu)) {
|
contentList.add(new UserMsg.UserMsgItem("备注", beizhu));
|
}
|
userMsg.setContentList(contentList);
|
return userMsg;
|
}
|
|
|
/**
|
* @return com.yeshi.makemoney.app.entity.msg.UserMsg
|
* @author hxh
|
* @description 创建系统消息
|
* @date 16:02 2022/4/7
|
* @param: uid
|
* @param: reason
|
* @param: operate
|
**/
|
public static UserMsg createSystem(Long uid, String reason, String operate) {
|
UserMsg userMsg = new UserMsg();
|
userMsg.setType(UserMsgType.system);
|
userMsg.setUid(uid);
|
List<UserMsg.UserMsgItem> contentList = new ArrayList<>();
|
contentList.add(new UserMsg.UserMsgItem("事 由", reason));
|
contentList.add(new UserMsg.UserMsgItem("处 理", operate));
|
userMsg.setContentList(contentList);
|
return userMsg;
|
}
|
|
|
}
|