fix:新增小程序账户列表及流水接口

This commit is contained in:
wangff
2025-11-17 18:01:01 +08:00
parent f2a18f7893
commit f5283b783c
10 changed files with 300 additions and 79 deletions

View File

@@ -0,0 +1,84 @@
package com.cool.store.dto.wallet;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
/**
* @Author suzhuhong
* @Date 2025/11/14 10:31
* @Version 1.0
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class BillDTO {
/**
* 业务系统付款单号(如 CRM 单号)
*/
private String reqNo;
/**
* 交易Id营帐通
*/
private Long tradeId;
/**
* 交易编号(扫呗)
*/
private String outTradeNo;
/**
* 费用科目
*/
private Integer feeItemId;
/**
* 费用科目名称
*/
private String feeItemName;
/**
* 门店账户编号
*/
private String storeAccountNo;
/**
* 公司编号
*/
private String companyCode;
/**
* 公司账户编号
*/
private String companyAccountNo;
/**
* 提现银行卡
*/
private String withdrawalBankCradNo;
/**
* 提现银行卡户名
*/
private String withdrawalBankCradName;
/**
* 金额(元)
*/
private String amount;
/**
* 交易状态 1.成功 2.失败 3.处理中
*/
private Integer tradeStatus;
/**
* 交易类型 1.转账 2.提现
*/
private Integer tradeType;
/**
* 交易发起时间
*/
private String createTime;
}

View File

@@ -1,76 +1,23 @@
package com.cool.store.dto.wallet;
import com.cool.store.request.wallet.WalletBasicPageInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/11/14 10:31
* @Version 1.0
* <p>
* 交易列表DTO
* </p>
*
* @author wangff
* @since 2025/11/17
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class BillPageDTO {
private List<BillDTO> data;
/**
* 业务系统付款单号(如 CRM 单号)
*/
private String reqNo;
/**
* 交易Id营帐通
*/
private Long tradeId;
/**
* 交易编号(扫呗)
*/
private String outTradeNo;
/**
* 交易科目
*/
private Integer feeItemId;
/**
* 门店账户编号
*/
private String storeAccountNo;
/**
* 公司编号
*/
private String companyCode;
/**
* 公司账户编号
*/
private String companyAccountNo;
/**
* 提现银行卡
*/
private String withdrawalBankCradNo;
/**
* 提现银行卡户名
*/
private String withdrawalBankCradName;
/**
* 金额(元)
*/
private String amount;
/**
* 交易状态 1.成功 2.失败 3.处理中
*/
private Integer tradeStatus;
/**
* 交易类型 1.转账 2.提现
*/
private Integer tradeType;
private WalletBasicPageInfo page;
}

View File

@@ -0,0 +1,36 @@
package com.cool.store.request.wallet;
import com.cool.store.common.PageBasicInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 交易流水查询Request
* </p>
*
* @author wangff
* @since 2025/11/17
*/
@Data
public class AccountBillQueryRequest extends PageBasicInfo {
@ApiModelProperty("门店id")
private Long shopId;
@ApiModelProperty("交易开始时间,不传查当月")
private Date beginDate;
@ApiModelProperty("交易结束时间")
private Date endDate;
@ApiModelProperty(value = "是否签约人账户 0 否 1 是")
private Integer isLegal;
@ApiModelProperty(value = "交易类型: 0.全部,1.支出 2.收入")
private Integer recordType;
@ApiModelProperty(value = "费用类型ID", required = true)
private Long feeItemId;
}

View File

@@ -1,7 +1,10 @@
package com.cool.store.request.wallet;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author suzhuhong
@@ -9,6 +12,9 @@ import lombok.Data;
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class BillPageRequest {
@ApiModelProperty(value = "门店ID", required = true)

View File

@@ -0,0 +1,40 @@
package com.cool.store.vo.wallet;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 账户交易列表VO
* </p>
*
* @author wangff
* @since 2025/11/17
*/
@Data
public class AccountBillListVO {
@ApiModelProperty("交易Id营帐通")
private Long tradeId;
@ApiModelProperty("交易编号(扫呗)")
private String outTradeNo;
@ApiModelProperty("费用科目")
private Integer feeItemId;
@ApiModelProperty("费用科目名称")
private String feeItemName;
@ApiModelProperty("金额(元)")
private String amount;
@ApiModelProperty("交易发起时间")
private String createTime;
@ApiModelProperty("交易状态 1.成功 2.失败 3.处理中")
private Integer tradeStatus;
@ApiModelProperty("交易类型 1.转账 2.提现")
private Integer tradeType;
}

View File

@@ -0,0 +1,36 @@
package com.cool.store.vo.wallet;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 账户信息VO
* </p>
*
* @author wangff
* @since 2025/11/17
*/
@Data
public class AccountInfoVO {
@ApiModelProperty(value = "账户状态 1:待提交 2:待鉴权 3:鉴权中 4:开通")
private Integer accountStatus;
@ApiModelProperty(value = "是否签约人账户 0 否 1 是")
private Integer isLegal;
@ApiModelProperty(value = "账户编号")
private String accountNo;
@ApiModelProperty(value = "账户名称")
private String accountName;
@ApiModelProperty(value = "结算银行卡号")
private String accountCardNo;
@ApiModelProperty(value = "开户支行名称")
private String bankName;
@ApiModelProperty(value = "账户余额")
private String totalAmount;
}

View File

@@ -122,7 +122,7 @@ public class WalletApiService {
* @return
*/
public WithDrawerDTO withdraw(WithDrawerRequest request){
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/trans/v1/withdraw", request, WithDrawerDTO.class);
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/trans/v1/withdrawer", request, WithDrawerDTO.class);
}
/**

View File

@@ -2,9 +2,13 @@ package com.cool.store.service.wallet;
import com.cool.store.request.wallet.*;
import com.cool.store.vo.wallet.AccountAuthenticationVO;
import com.cool.store.vo.wallet.AccountBillListVO;
import com.cool.store.vo.wallet.AccountInfoVO;
import com.cool.store.vo.wallet.BankVO;
import com.github.pagehelper.PageInfo;
import java.util.List;
/**
* <p>
* 钱包 服务类
@@ -56,4 +60,18 @@ public interface WalletService {
* @return
*/
Boolean addTagCallback(AddTagCallbackNoticeRequest request);
/**
* 查询账户列表
* @param request 钱包门店Request
* @return 账户信息VO列表
*/
List<AccountInfoVO> getAccountList(WalletShopRequest request);
/**
* 交易流水
* @param request 交易流水查询Request
* @return 账户交易列表VO列表
*/
PageInfo<AccountBillListVO> getBillPage(AccountBillQueryRequest request);
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.service.wallet.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.RegionDao;
@@ -15,7 +16,6 @@ import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.enums.wallet.BankAccountTypeEnum;
import com.cool.store.enums.wallet.BankBusinessTypeEnum;
import com.cool.store.enums.wallet.PingAnAccountStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.ApplyLicenseMapper;
import com.cool.store.request.wallet.*;
@@ -23,6 +23,8 @@ import com.cool.store.service.wallet.WalletApiService;
import com.cool.store.service.wallet.WalletService;
import com.cool.store.utils.BeanUtil;
import com.cool.store.vo.wallet.AccountAuthenticationVO;
import com.cool.store.vo.wallet.AccountBillListVO;
import com.cool.store.vo.wallet.AccountInfoVO;
import com.cool.store.vo.wallet.BankVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
@@ -31,7 +33,10 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.sql.Date;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@@ -132,15 +137,16 @@ public class WalletServiceImpl implements WalletService {
getBankRequest.setHeadName(request.getHeadName());
getBankRequest.setKeyword(request.getKeyword());
BankListDTO bankListDTO = walletApiService.getBankList(getBankRequest);
PageInfo<BankVO> result = new PageInfo<>();
result.setPageNum(request.getPageNum());
result.setPageSize(request.getPageSize());
if (Objects.nonNull(bankListDTO)) {
WalletBasicPageInfo pageInfo = bankListDTO.getPage();
result.setTotal(pageInfo.getTotal());
result.setPages(pageInfo.getCount());
result.setList(BeanUtil.toList(bankListDTO.getPageData(), BankVO.class));
}
return toPageInfo(bankListDTO.getPageData(), BankVO.class, bankListDTO.getPage());
}
public static <T, R> PageInfo<R> toPageInfo(List<T> list, Class<R> clazz, WalletBasicPageInfo page) {
PageInfo<R> result = new PageInfo<>();
result.setPageNum(page.getCurrentPage());
result.setPageSize(page.getPageSize());
result.setPages(page.getCount());
result.setTotal(page.getTotal());
result.setList(CollectionUtils.isNotEmpty(list) ? BeanUtil.toList(list, clazz) : Collections.emptyList());
return result;
}
@@ -185,6 +191,41 @@ public class WalletServiceImpl implements WalletService {
return Boolean.TRUE;
}
@Override
public List<AccountInfoVO> getAccountList(WalletShopRequest request) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
if (Objects.isNull(shopInfo)) {
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
List<AccountInfoDTO> accountInfo = walletApiService.getAccountInfo(new OutStoreIdRequest(shopInfo.getStoreId()));
return BeanUtil.toList(accountInfo, AccountInfoVO.class);
}
@Override
public PageInfo<AccountBillListVO> getBillPage(AccountBillQueryRequest request) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
if (Objects.isNull(shopInfo)) {
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
LocalDate now = LocalDate.now();
if (Objects.isNull(request.getBeginDate()) || Objects.isNull(request.getEndDate())) {
request.setBeginDate(Date.valueOf(now.withDayOfMonth(1)));
request.setEndDate(Date.valueOf(now));
}
BillPageRequest billPageRequest = BillPageRequest.builder()
.outStoreId(shopInfo.getStoreId())
.beginDate(DateUtil.format(request.getBeginDate(), "yyyy-MM-dd HH:mm:ss"))
.endDate(DateUtil.format(request.getEndDate(), "yyyy-MM-dd HH:mm:ss"))
.walletType(CommonConstants.INDEX_ONE.equals(request.getIsLegal()) ? 2 : 1)
.recordType(request.getRecordType())
.feeItemId(request.getFeeItemId())
.currentPage(request.getPageNum())
.pageSize(request.getPageSize())
.build();
BillPageDTO billPage = walletApiService.getBillPage(billPageRequest);
return toPageInfo(billPage.getData(), AccountBillListVO.class, billPage.getPage());
}
/**
* 查询并校验门店是否存在以及阶段是否处于平安钱包未开通状态
*/

View File

@@ -1,12 +1,11 @@
package com.cool.store.controller.webc;
import com.cool.store.request.wallet.AccountCreateRequest;
import com.cool.store.request.wallet.AccountOpenRequest;
import com.cool.store.request.wallet.BankListRequest;
import com.cool.store.request.wallet.WalletShopRequest;
import com.cool.store.request.wallet.*;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.wallet.WalletService;
import com.cool.store.vo.wallet.AccountAuthenticationVO;
import com.cool.store.vo.wallet.AccountBillListVO;
import com.cool.store.vo.wallet.AccountInfoVO;
import com.cool.store.vo.wallet.BankVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
@@ -15,6 +14,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* Mini钱包 前端控制器
@@ -53,4 +54,16 @@ public class MiniWalletController {
public ResponseResult<PageInfo<BankVO>> getBankList(@RequestBody BankListRequest request) {
return ResponseResult.success(walletService.getBankList(request));
}
@ApiOperation("账户列表")
@GetMapping("/accountList")
public ResponseResult<List<AccountInfoVO>> getAccountList(@RequestBody WalletShopRequest request) {
return ResponseResult.success(walletService.getAccountList(request));
}
@ApiOperation("账户流水")
@GetMapping("/billPage")
public ResponseResult<PageInfo<AccountBillListVO>> getBillPage(@RequestBody AccountBillQueryRequest request) {
return ResponseResult.success(walletService.getBillPage(request));
}
}