Selaa lähdekoodia

查看钱包余额

linxk 2 viikkoa sitten
vanhempi
sitoutus
6e0c486908

+ 34 - 167
cif-api/src/main/java/com/txz/cif/dto/AccountDTO.java

@@ -1,20 +1,18 @@
-/*
-*
-* AccountDTO.java
-* Copyright(C) 2017-2020 fendo公司
-* @date 2022-11-04
-*/
 package com.txz.cif.dto;
 
-import java.io.Serializable;
+import lombok.*;
+
 import java.math.BigDecimal;
 import java.util.Date;
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class AccountDTO {
+    private Long id;
 
-public class AccountDTO implements Serializable {
-    /**
-     * 
-     */
-    private Integer id;
+    private Long userId;
 
     /**
      * 备注
@@ -26,11 +24,20 @@ public class AccountDTO implements Serializable {
      */
     private String name;
 
+    private String direction;
+
+
     /**
      * 类型 1外部账户 2内部账户 3手续费账户 4营销账户
      */
     private Integer type;
 
+    private String aliases;
+
+    private Integer subjectType;
+
+    private Integer bizType;
+
     /**
      * 余额
      */
@@ -41,188 +48,48 @@ public class AccountDTO implements Serializable {
      */
     private BigDecimal freezeAmount;
 
-    /**
-     * 上日余额
-     */
-    private BigDecimal beforeDayBalance;
-
-    /**
-     * 上日余额更新时间
-     */
-    private Date beforeDayTime;
-
-    /**
-     * 创建时间
-     */
-    private Date createTime;
-
-    /**
-     * 更新时间
-     */
-    private Date updateTime;
-
-    /**
-     * c_account
-     */
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 
-     * @return id 
-     */
-    public Integer getId() {
-        return id;
-    }
-
-    /**
-     * 
-     * @param id 
-     */
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    /**
-     * 备注
-     * @return remark 备注
-     */
-    public String getRemark() {
-        return remark;
-    }
-
-    /**
-     * 备注
-     * @param remark 备注
-     */
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-
-    /**
-     * 名称
-     * @return name 名称
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * 名称
-     * @param name 名称
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /**
-     * 类型 1外部账户 2内部账户 3手续费账户 4营销账户
-     * @return type 类型 1外部账户 2内部账户 3手续费账户 4营销账户
-     */
-    public Integer getType() {
-        return type;
-    }
-
-    /**
-     * 类型 1外部账户 2内部账户 3手续费账户 4营销账户
-     * @param type 类型 1外部账户 2内部账户 3手续费账户 4营销账户
-     */
-    public void setType(Integer type) {
-        this.type = type;
-    }
-
     /**
      * 余额
-     * @return balance 余额
      */
-    public BigDecimal getBalance() {
-        return balance;
-    }
-
-    /**
-     * 余额
-     * @param balance 余额
-     */
-    public void setBalance(BigDecimal balance) {
-        this.balance = balance;
-    }
+    private BigDecimal totalInamount;
 
     /**
      * 冻结金额
-     * @return freeze_amount 冻结金额
      */
-    public BigDecimal getFreezeAmount() {
-        return freezeAmount;
-    }
-
-    /**
-     * 冻结金额
-     * @param freezeAmount 冻结金额
-     */
-    public void setFreezeAmount(BigDecimal freezeAmount) {
-        this.freezeAmount = freezeAmount;
-    }
+    private BigDecimal totalOutAmount;
 
     /**
      * 上日余额
-     * @return before_day_balance 上日余额
      */
-    public BigDecimal getBeforeDayBalance() {
-        return beforeDayBalance;
-    }
+    private BigDecimal beforeDayBalance;
 
-    /**
-     * 上日余额
-     * @param beforeDayBalance 上日余额
-     */
-    public void setBeforeDayBalance(BigDecimal beforeDayBalance) {
-        this.beforeDayBalance = beforeDayBalance;
-    }
+    private BigDecimal beforeDayInitBalance;
 
-    /**
-     * 上日余额更新时间
-     * @return before_day_time 上日余额更新时间
-     */
-    public Date getBeforeDayTime() {
-        return beforeDayTime;
-    }
 
     /**
      * 上日余额更新时间
-     * @param beforeDayTime 上日余额更新时间
-     */
-    public void setBeforeDayTime(Date beforeDayTime) {
-        this.beforeDayTime = beforeDayTime;
-    }
-
-    /**
-     * 创建时间
-     * @return create_time 创建时间
      */
-    public Date getCreateTime() {
-        return createTime;
-    }
+    private Date beforeDayTime;
 
     /**
      * 创建时间
-     * @param createTime 创建时间
      */
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
+    private Date createTime;
 
     /**
      * 更新时间
-     * @return update_time 更新时间
      */
-    public Date getUpdateTime() {
-        return updateTime;
-    }
+    private Date updateTime;
+
+
+    private String version;
 
     /**
-     * 更新时间
-     * @param updateTime 更新时间
+     * 获取有效余额
      */
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
+    public BigDecimal getEffectiveBalance() {
+        return balance.subtract(freezeAmount);
     }
+
+
 }

+ 3 - 0
cif-api/src/main/java/com/txz/cif/service/AccountDubboService.java

@@ -14,6 +14,9 @@ public interface AccountDubboService {
     Result createAccount(Long userId);
 
 
+    Result getWalletAccount(Long userId);
+
+
 
 
     /**

+ 11 - 0
cif-service/src/main/java/com/txz/cif/dubbo/impl/AccountDubboServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.txz.cif.core.ServiceException;
+import com.txz.cif.dto.AccountDTO;
 import com.txz.cif.dto.Result;
 import com.txz.cif.dubbo.client.OperatingConfigDubboServiceClient;
 import com.txz.cif.enums.BizTypeEnum;
@@ -76,6 +77,16 @@ public class AccountDubboServiceImpl implements AccountDubboService {
         return Result.genSuccessResult();
     }
 
+    @Override
+    public Result getWalletAccount(Long userId) {
+        Account account = accountService.getAccount(userId, 1);
+        if (account == null){
+            return Result.genFailResult("没有找到");
+        }
+        AccountDTO dto = BeanUtil.toBean(account,AccountDTO.class);
+        return Result.genSuccessResult(dto);
+    }
+
     @Override
     public Result openGroup(OpenParam param) {
         //支付