查询导出充值记录

This commit is contained in:
GYJ
2024-07-09 16:04:25 +08:00
parent 8ad974bfa4
commit a09a46e0ea
8 changed files with 159 additions and 20 deletions

View File

@@ -1,5 +1,8 @@
package cn.ysk.cashier.service.impl.shopimpl;
import cn.hutool.core.date.DateUtil;
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
import cn.ysk.cashier.dto.shop.TbShopUserDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopUserMapper;
@@ -22,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -47,7 +51,7 @@ public class TbShopUserServiceImpl implements TbShopUserService {
public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria) {
IPage<ShopUserInfoVo> iPage = shopUserMapper.queryUser(criteria,
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(criteria.getPage(), criteria.getSize()));
return PageUtil.toPlusPage(iPage.getRecords(),Integer.valueOf(iPage.getTotal()+""));
return PageUtil.toPlusPage(iPage.getRecords(), Integer.valueOf(iPage.getTotal() + ""));
}
@Override
@@ -129,4 +133,34 @@ public class TbShopUserServiceImpl implements TbShopUserService {
FileUtil.downloadExcel(list, response);
}
@Override
public IPage<TbShopRechargeRespDto> rechargeList(TbShopRechargeListDto criteria, Pageable pageable) {
if (criteria.getStartTime() == null) {
criteria.setStartTime(DateUtil.parseDate("2024-01-01 00:00:00"));
}
if (criteria.getEndTime() == null) {
criteria.setEndTime(DateUtil.date(Instant.now()));
}
return shopUserMapper.queryRechargeList(criteria,
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageable == null ? 0 : pageable.getPageNumber(), pageable == null ? 1000000 : pageable.getPageSize()));
}
@Override
public void rechargeListDownload(HttpServletResponse response, TbShopRechargeListDto criteria) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
IPage<TbShopRechargeRespDto> page = rechargeList(criteria, null);
for (TbShopRechargeRespDto tbShopRechargeRespDto : page.getRecords()) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("id", tbShopRechargeRespDto.getId());
map.put("门店", tbShopRechargeRespDto.getShopName());
map.put("用户手机号", tbShopRechargeRespDto.getUserPhone());
map.put("用户名", tbShopRechargeRespDto.getUserName());
map.put("充值金额", tbShopRechargeRespDto.getRechargeAmount());
map.put("充值类型", tbShopRechargeRespDto.getRechargeType());
map.put("充值时间", tbShopRechargeRespDto.getRechargeTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -1,8 +1,12 @@
package cn.ysk.cashier.service.shop;
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.dto.shop.TbShopUserDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
@@ -75,4 +79,14 @@ public interface TbShopUserService {
*/
void download(List<TbShopUserDto> all, HttpServletResponse response) throws IOException;
/**
* 充值记录
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
IPage<TbShopRechargeRespDto> rechargeList(TbShopRechargeListDto criteria, Pageable pageable);
void rechargeListDownload(HttpServletResponse response, TbShopRechargeListDto criteria) throws IOException;
}