package com.bonus.canteen.core.account.domain.vo;

import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.account.constants.AccTradeStateEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
public class AccOperationListVO {
   @ApiModelProperty("补贴时间")
   @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
   private LocalDateTime tradeTime;
   @ApiModelProperty("人员id")
   private Long userId;
   @ApiModelProperty("用户姓名")
   private String nickName;
   @ApiModelProperty("用户手机号")
   private String phoneNumber;
   @ApiModelProperty("所属组织")
   private String deptName;
   @ApiModelProperty("人员类别")
   private Integer userType;
   @ApiModelProperty("用户类别(展示)")
   private String userTypeName;
   @ApiModelProperty("金额")
   private BigDecimal amount;
   @ApiModelProperty("钱包余额")
   private BigDecimal walletBal;
   @ApiModelProperty("交易状态")
   private Integer tradeState;
   @ApiModelProperty("结果名称")
   private String tradeStateName;
   @ApiModelProperty("操作员")
   private String createBy;
   @ApiModelProperty("交易单号")
   private Long tradeId;

   public String getTradeStateName() {
      if (ObjectUtil.isNotNull(this.tradeState)) {
         return AccTradeStateEnum.TAKE_EFFECT.getKey().equals(this.tradeState) ? "成功" : AccTradeStateEnum.getDesc(this.tradeState);
      } else {
         return this.tradeStateName;
      }
   }
}
