提交 8dae16e7 authored 作者: liuhaiquan's avatar liuhaiquan

修改货主借款账户信息接口

上级 94b45f9e
package com.clx.performance.vo.pc.loan.owner;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.math.BigDecimal;
/**
* @Author: aiqinguo
* @Description: 货主借款账户
* @Date: 2024/01/22 18:17:57
* @Version: 1.0
*/
@ApiModel(description = "货主借款账户")
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class OwnerAccountVO {
@ApiModelProperty(value = "货主编码", example = "10000000")
private Long ownerUserNo;
@ApiModelProperty(value = "货主名称", example = "张三")
private String ownerUserName;
@ApiModelProperty(value = "联系电话", example = "13000000000")
private String mobile;
@ApiModelProperty(value = "默认 3:借款账户", example = "3")
private Integer accountType;
@ApiModelProperty(value = "是否开通借款账户 0:未开通 1:已开通", example = "3")
private Integer openAccount;
@ApiModelProperty(value = "可用余额 (元) ", example = "1.23")
private BigDecimal amount;
public BigDecimal getAmount() {
return BigDecimal.ZERO.add(fundingUsableBalance==null? BigDecimal.ZERO : fundingUsableBalance).add(virtuallyUsableBalance==null? BigDecimal.ZERO : virtuallyUsableBalance);
}
@ApiModelProperty(value = "冻结金额(元) ", example = "1.23")
private BigDecimal frozenAmount;
public BigDecimal getFrozenAmount() {
return BigDecimal.ZERO.add(fundingFrozenBalance==null? BigDecimal.ZERO : fundingFrozenBalance).add(virtuallyFrozenBalance==null? BigDecimal.ZERO : virtuallyFrozenBalance);
}
@ApiModelProperty(value = "欠款金额 (元)", example = "1.23")
private BigDecimal arrears;
public BigDecimal getArrears() {
return BigDecimal.ZERO.add(fundingArrears==null? BigDecimal.ZERO : fundingArrears).add(virtuallyArrears==null? BigDecimal.ZERO : virtuallyArrears);
}
@JsonIgnore
@ApiModelProperty(value = "资金账户余额", example = "", hidden = true)
@MoneyOutConvert
private BigDecimal fundingAccountBalance;
@JsonIgnore
@ApiModelProperty(value = "资金可用余额", example = "", hidden = true)
@MoneyOutConvert
private BigDecimal fundingUsableBalance;
@JsonIgnore
@ApiModelProperty(value = "资金冻结余额", example = "", hidden = true)
@MoneyOutConvert
private BigDecimal fundingFrozenBalance;
@JsonIgnore
@ApiModelProperty(value = "虚拟币账户余额", example = "", hidden = true)
@MoneyOutConvert
private BigDecimal virtuallyAccountBalance;
@JsonIgnore
@ApiModelProperty(value = "虚拟币可用余额", example = "", hidden = true)
@MoneyOutConvert
private BigDecimal virtuallyUsableBalance;
@JsonIgnore
@ApiModelProperty(value = "虚拟币冻结余额", example = "", hidden = true)
@MoneyOutConvert
private BigDecimal virtuallyFrozenBalance;
@JsonIgnore
@ApiModelProperty(value = "资金欠款", example = "1.23", hidden = true)
@MoneyOutConvert
private BigDecimal fundingArrears;
@JsonIgnore
@ApiModelProperty(value = "虚拟币欠款", example = "1.23", hidden = true)
@MoneyOutConvert
private BigDecimal virtuallyArrears;
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.clx.performance.service.loan.OwnerLoanAccountApproveService; ...@@ -5,6 +5,7 @@ import com.clx.performance.service.loan.OwnerLoanAccountApproveService;
import com.clx.performance.service.loan.OwnerLoanAccountService; import com.clx.performance.service.loan.OwnerLoanAccountService;
import com.clx.performance.service.loan.OwnerLoanRecordService; import com.clx.performance.service.loan.OwnerLoanRecordService;
import com.clx.performance.vo.pc.loan.carrier.OwnerLoanAccountVO; import com.clx.performance.vo.pc.loan.carrier.OwnerLoanAccountVO;
import com.clx.performance.vo.pc.loan.owner.OwnerAccountVO;
import com.msl.common.convertor.aspect.UnitCovert; import com.msl.common.convertor.aspect.UnitCovert;
import com.msl.common.result.Result; import com.msl.common.result.Result;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -49,8 +50,8 @@ public class OwnerLoanAccountController { ...@@ -49,8 +50,8 @@ public class OwnerLoanAccountController {
@ApiOperation(value = "货主借款账户信息",notes = "<br>By:刘海泉") @ApiOperation(value = "货主借款账户信息",notes = "<br>By:刘海泉")
@GetMapping("/getOwnerLoanAccount") @GetMapping("/getOwnerLoanAccount")
@UnitCovert(param = false) @UnitCovert(param = false)
public Result<OwnerLoanAccountVO> getOwnerLoanAccount() { public Result<OwnerAccountVO> getOwnerLoanAccount() {
OwnerLoanAccountVO ownerLoanAccountVO = ownerLoanAccountService.getOwnerLoanAccount(); OwnerAccountVO ownerAccount = ownerLoanAccountService.getOwnerLoanAccount();
return Result.ok(ownerLoanAccountVO); return Result.ok(ownerAccount);
} }
} }
...@@ -8,6 +8,8 @@ import com.clx.performance.param.pc.loan.carrier.PageOwnerLoanAccountParam; ...@@ -8,6 +8,8 @@ import com.clx.performance.param.pc.loan.carrier.PageOwnerLoanAccountParam;
import com.clx.performance.service.loan.OwnerLoanAccountService; import com.clx.performance.service.loan.OwnerLoanAccountService;
import com.clx.performance.struct.loan.OwnerLoanAccountStruct; import com.clx.performance.struct.loan.OwnerLoanAccountStruct;
import com.clx.performance.vo.pc.loan.carrier.OwnerLoanAccountVO; import com.clx.performance.vo.pc.loan.carrier.OwnerLoanAccountVO;
import com.clx.performance.vo.pc.loan.owner.OwnerAccountVO;
import com.msl.common.base.Optional;
import com.msl.common.convertor.aspect.UnitCovert; import com.msl.common.convertor.aspect.UnitCovert;
import com.msl.user.data.UserSessionData; import com.msl.user.data.UserSessionData;
import com.msl.user.utils.TokenUtil; import com.msl.user.utils.TokenUtil;
...@@ -58,10 +60,14 @@ public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService { ...@@ -58,10 +60,14 @@ public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService {
} }
@Override @Override
public OwnerLoanAccountVO getOwnerLoanAccount() { public OwnerAccountVO getOwnerLoanAccount() {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo(); UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
OwnerLoanAccount ownerLoanAccount = ownerLoanAccountDao.getOneByField(OwnerLoanAccount :: getOwnerUserNo,loginUserInfo.getUserNo()).orElseThrow( Optional<OwnerLoanAccount> optional = ownerLoanAccountDao.getOneByField(OwnerLoanAccount::getOwnerUserNo,
PerformanceResultEnum.DATA_NOT_FIND); loginUserInfo.getUserNo());
if(!optional.isPresent()){
return OwnerAccountVO.builder().openAccount(0).build();
}
OwnerLoanAccount ownerLoanAccount = optional.get();
return ownerLoanAccountStruct.convertVO(ownerLoanAccount); return ownerLoanAccountStruct.convertVO(ownerLoanAccount);
} }
} }
...@@ -3,6 +3,7 @@ package com.clx.performance.service.loan; ...@@ -3,6 +3,7 @@ package com.clx.performance.service.loan;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.loan.carrier.PageOwnerLoanAccountParam; import com.clx.performance.param.pc.loan.carrier.PageOwnerLoanAccountParam;
import com.clx.performance.vo.pc.loan.carrier.OwnerLoanAccountVO; import com.clx.performance.vo.pc.loan.carrier.OwnerLoanAccountVO;
import com.clx.performance.vo.pc.loan.owner.OwnerAccountVO;
/** /**
* @author kavin * @author kavin
...@@ -15,5 +16,5 @@ public interface OwnerLoanAccountService { ...@@ -15,5 +16,5 @@ public interface OwnerLoanAccountService {
IPage<OwnerLoanAccountVO> pageOwnerLoanAccount(PageOwnerLoanAccountParam param); IPage<OwnerLoanAccountVO> pageOwnerLoanAccount(PageOwnerLoanAccountParam param);
OwnerLoanAccountVO getOwnerLoanAccount(); OwnerAccountVO getOwnerLoanAccount();
} }
...@@ -2,6 +2,7 @@ package com.clx.performance.struct.loan; ...@@ -2,6 +2,7 @@ package com.clx.performance.struct.loan;
import com.clx.performance.model.loan.OwnerLoanAccount; import com.clx.performance.model.loan.OwnerLoanAccount;
import com.clx.performance.vo.pc.OwnerLoanAccountVO; import com.clx.performance.vo.pc.OwnerLoanAccountVO;
import com.clx.performance.vo.pc.loan.owner.OwnerAccountVO;
import com.msl.common.utils.DateStructUtil; import com.msl.common.utils.DateStructUtil;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
...@@ -13,6 +14,6 @@ public interface OwnerLoanAccountStruct { ...@@ -13,6 +14,6 @@ public interface OwnerLoanAccountStruct {
OwnerLoanAccountVO convert(OwnerLoanAccount account); OwnerLoanAccountVO convert(OwnerLoanAccount account);
com.clx.performance.vo.pc.loan.carrier.OwnerLoanAccountVO convertVO(OwnerLoanAccount account); OwnerAccountVO convertVO(OwnerLoanAccount account);
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论