|
|
@ -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.UsePageWalletAccountRecordByOperatorVo; |
|
|
import com.qniao.dam.api.query.walletaccount.user.response.UserGetWalletAccountRecordVo; |
|
|
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.UserGetWalletAccountVo; |
|
|
|
|
|
import com.qniao.dam.api.query.walletaccount.user.response.WalletAccountRecordExportVo; |
|
|
import com.qniao.dam.domain.aggregate.walletaccount.valueobj.WalletAccountRecord; |
|
|
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.IdentityTypeEnum; |
|
|
import com.qniao.dam.domian.aggregate.walletaccount.constant.TradeTypeEnum; |
|
|
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.domain.WalletAccountRecordDao; |
|
|
import com.qniao.dam.infrastructure.persistent.dao.view.WalletAccountViewDao; |
|
|
import com.qniao.dam.infrastructure.persistent.dao.view.WalletAccountViewDao; |
|
|
import com.qniao.dam.query.matchmaker.MatchmakerQueryService; |
|
|
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.dam.infrastructure.persistent.dao.domain.WalletAccountDao; |
|
|
import com.qniao.framework.utils.PageUtil; |
|
|
import com.qniao.framework.utils.PageUtil; |
|
|
import com.qniao.framework.utils.TypeConvertUtils; |
|
|
import com.qniao.framework.utils.TypeConvertUtils; |
|
|
import com.thoughtworks.xstream.converters.time.LocalDateTimeConverter; |
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDateTime; |
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.List; |
|
|
import java.util.Objects; |
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
@ -38,6 +41,8 @@ public class WalletAccountQueryServiceImpl implements WalletAccountQueryService |
|
|
private WalletAccountRecordDao walletAccountRecordDao; |
|
|
private WalletAccountRecordDao walletAccountRecordDao; |
|
|
@Resource |
|
|
@Resource |
|
|
private MatchmakerQueryService matchmakerQueryService; |
|
|
private MatchmakerQueryService matchmakerQueryService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private EasyExcelUtil easyExcelUtil; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public WalletAccount queryByUserId(Long userId) { |
|
|
public WalletAccount queryByUserId(Long userId) { |
|
|
@ -106,6 +111,35 @@ public class WalletAccountQueryServiceImpl implements WalletAccountQueryService |
|
|
return page; |
|
|
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) { |
|
|
private BigDecimal countUnavailableWithdrawBalance(Long walletAccountId, LocalDate date, int month) { |
|
|
LocalDateTime dateTime = date.minusMonths(month).withDayOfMonth(1).atStartOfDay(); |
|
|
LocalDateTime dateTime = date.minusMonths(month).withDayOfMonth(1).atStartOfDay(); |
|
|
return walletAccountRecordDao.selectList(new LambdaQueryWrapper<WalletAccountRecord>() |
|
|
return walletAccountRecordDao.selectList(new LambdaQueryWrapper<WalletAccountRecord>() |
|
|
|