Browse Source

收益明细

master
张彭杰 1 year ago
parent
commit
525556ed0b
5 changed files with 85 additions and 6 deletions
  1. 12
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/walletaccount/user/WalletAccountUserQueryController.java
  2. 41
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/walletaccount/user/response/WalletAccountRecordExportVo.java
  3. 2
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/walletaccount/WalletAccountQueryService.java
  4. 36
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/walletaccount/impl/WalletAccountQueryServiceImpl.java
  5. BIN
      dating-agency-mall-server/src/main/resources/templates/walletAccountRecordExport.xlsx

12
dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/walletaccount/user/WalletAccountUserQueryController.java

@ -1,19 +1,14 @@
package com.qniao.dam.api.query.walletaccount.user;
import com.qniao.dam.api.query.revenuereward.user.request.UsePageRevenueRewardRecordByOperatorQueryParams;
import com.qniao.dam.api.query.revenuereward.user.response.UsePageRevenueRewardRecordByOperatorVo;
import com.qniao.dam.api.query.walletaccount.user.request.UsePageWalletAccountRecordByOperatorQueryParams;
import com.qniao.dam.api.query.walletaccount.user.request.UserPageWalletAccountRecordQueryParam;
import com.qniao.dam.api.query.walletaccount.user.response.UseGetWalletAccountAbstractByOperatorVo;
import com.qniao.dam.api.query.walletaccount.user.response.UsePageWalletAccountRecordByOperatorVo;
import com.qniao.dam.api.query.walletaccount.user.response.UserGetWalletAccountRecordVo;
import com.qniao.dam.api.query.walletaccount.user.response.UserGetWalletAccountVo;
import com.qniao.dam.domain.aggregate.walletaccount.entity.WalletAccount;
import com.qniao.dam.query.walletaccount.WalletAccountQueryService;
import com.qniao.dau.infrastructure.constant.RequestHeaderFields;
import com.qniao.domain.QnPage;
import com.qniao.framework.utils.PageUtil;
import com.qniao.framework.utils.TypeConvertUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@ -58,4 +53,11 @@ public class WalletAccountUserQueryController {
UsePageWalletAccountRecordByOperatorQueryParams queryParams) {
return PageUtil.convert(walletAccountQueryService.pageWalletAccountRecordByOperator(pageUtil, queryParams), UsePageWalletAccountRecordByOperatorVo.class);
}
@ApiOperation("运营端导出用户收益记录分页")
@GetMapping("/export/wallet-account-record/by/operator")
public String userExportWalletAccountRecordByOperator(UsePageWalletAccountRecordByOperatorQueryParams queryParams) {
return walletAccountQueryService.exportData(queryParams);
}
}

41
dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/walletaccount/user/response/WalletAccountRecordExportVo.java

@ -0,0 +1,41 @@
package com.qniao.dam.api.query.walletaccount.user.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class WalletAccountRecordExportVo {
@ApiModelProperty("流水明细ID")
private Long associateId;
@ApiModelProperty("交易类型")
private String tradeTypeVal;
@ApiModelProperty("是否收入")
private String isIncome;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("手机号")
private String phone;
@ApiModelProperty("红娘等级")
private String matchmakerLevelVal;
@ApiModelProperty("交易金额")
private BigDecimal tradeAmount;
@ApiModelProperty("原始金额")
private BigDecimal originalBalance;
@ApiModelProperty("当前金额")
private BigDecimal currentBalance;
}

2
dating-agency-mall-server/src/main/java/com/qniao/dam/query/walletaccount/WalletAccountQueryService.java

@ -25,4 +25,6 @@ public interface WalletAccountQueryService {
BigDecimal countAvailableWithdrawBalance(WalletAccount walletAccount);
IPage<UsePageWalletAccountRecordByOperatorVo> pageWalletAccountRecordByOperator(PageUtil pageUtil, UsePageWalletAccountRecordByOperatorQueryParams queryParams);
String exportData(UsePageWalletAccountRecordByOperatorQueryParams queryParams);
}

36
dating-agency-mall-server/src/main/java/com/qniao/dam/query/walletaccount/impl/WalletAccountQueryServiceImpl.java

@ -7,9 +7,11 @@ import com.qniao.dam.api.query.walletaccount.user.request.UserPageWalletAccountR
import com.qniao.dam.api.query.walletaccount.user.response.UsePageWalletAccountRecordByOperatorVo;
import com.qniao.dam.api.query.walletaccount.user.response.UserGetWalletAccountRecordVo;
import com.qniao.dam.api.query.walletaccount.user.response.UserGetWalletAccountVo;
import com.qniao.dam.api.query.walletaccount.user.response.WalletAccountRecordExportVo;
import com.qniao.dam.domain.aggregate.walletaccount.valueobj.WalletAccountRecord;
import com.qniao.dam.domian.aggregate.walletaccount.constant.IdentityTypeEnum;
import com.qniao.dam.domian.aggregate.walletaccount.constant.TradeTypeEnum;
import com.qniao.dam.infrastructure.easyexcel.EasyExcelUtil;
import com.qniao.dam.infrastructure.persistent.dao.domain.WalletAccountRecordDao;
import com.qniao.dam.infrastructure.persistent.dao.view.WalletAccountViewDao;
import com.qniao.dam.query.matchmaker.MatchmakerQueryService;
@ -18,13 +20,14 @@ import com.qniao.dam.domain.aggregate.walletaccount.entity.WalletAccount;
import com.qniao.dam.infrastructure.persistent.dao.domain.WalletAccountDao;
import com.qniao.framework.utils.PageUtil;
import com.qniao.framework.utils.TypeConvertUtils;
import com.thoughtworks.xstream.converters.time.LocalDateTimeConverter;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Service
@ -38,6 +41,8 @@ public class WalletAccountQueryServiceImpl implements WalletAccountQueryService
private WalletAccountRecordDao walletAccountRecordDao;
@Resource
private MatchmakerQueryService matchmakerQueryService;
@Resource
private EasyExcelUtil easyExcelUtil;
@Override
public WalletAccount queryByUserId(Long userId) {
@ -106,6 +111,35 @@ public class WalletAccountQueryServiceImpl implements WalletAccountQueryService
return page;
}
@Override
public String exportData(UsePageWalletAccountRecordByOperatorQueryParams queryParams) {
PageUtil pageUtil = new PageUtil();
pageUtil.setOrders(null);
pageUtil.setPageNum(1);
pageUtil.setPageSize(-1);
IPage<UsePageWalletAccountRecordByOperatorVo> page = pageWalletAccountRecordByOperator(pageUtil, queryParams);
List<WalletAccountRecordExportVo> list = transformExport(page.getRecords());
return easyExcelUtil.writeToFilePath(
easyExcelUtil.getTemplateFileAsStream("walletAccountRecordExport"),
list
);
}
private List<WalletAccountRecordExportVo> transformExport(List<UsePageWalletAccountRecordByOperatorVo> recordList) {
List<WalletAccountRecordExportVo> list = new ArrayList<>();
for (UsePageWalletAccountRecordByOperatorVo record : recordList) {
WalletAccountRecordExportVo exportVo = TypeConvertUtils.convert(record, WalletAccountRecordExportVo.class, (rVo, eVo) -> {
if (Objects.nonNull(rVo.getMatchmakerLevel())) {
eVo.setMatchmakerLevelVal(rVo.getMatchmakerLevel().getDesc());
}
eVo.setTradeTypeVal(rVo.getTradeType().getDesc());
eVo.setIsIncome(rVo.getIsIncome()?"收入":"支出");
});
list.add(exportVo);
}
return list;
}
private BigDecimal countUnavailableWithdrawBalance(Long walletAccountId, LocalDate date, int month) {
LocalDateTime dateTime = date.minusMonths(month).withDayOfMonth(1).atStartOfDay();
return walletAccountRecordDao.selectList(new LambdaQueryWrapper<WalletAccountRecord>()

BIN
dating-agency-mall-server/src/main/resources/templates/walletAccountRecordExport.xlsx

Loading…
Cancel
Save