会员余额明细获取
This commit is contained in:
parent
9696b0edc3
commit
25a80d5bb5
|
|
@ -16,9 +16,12 @@ import com.czg.utils.PageUtil;
|
|||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 店铺用户管理
|
||||
*
|
||||
|
|
@ -49,6 +52,8 @@ public class ShopUserController {
|
|||
/**
|
||||
* 获取店铺用户充值记录
|
||||
* @param userId 用户id
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param bizCode 充值类型 类型:
|
||||
* cashIn 现金充值,
|
||||
* wechatIn 微信小程序充值,
|
||||
|
|
@ -64,8 +69,24 @@ public class ShopUserController {
|
|||
@SaAdminCheckPermission(value = "shopUser:flow", name = "店铺用户充值记录")
|
||||
@GetMapping("/flow")
|
||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||
public CzgResult<Page<ShopUserFlowVO>> flow(Integer userId, String bizCode) {
|
||||
return CzgResult.success(shopUserFlowService.pageInfo(StpKit.USER.getShopId(), userId, bizCode));
|
||||
public CzgResult<Page<ShopUserFlowVO>> flow(Integer userId, String bizCode, String startTime, String endTime) {
|
||||
return CzgResult.success(shopUserFlowService.pageInfo(StpKit.USER.getShopId(), userId, bizCode, startTime, endTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 余额明细记录导出
|
||||
* @param userId 用户id
|
||||
* @param bizCode 代码
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param response 响应
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "shopUser:flow:downLoad", name = "店铺用户充值记录导出")
|
||||
@GetMapping("/flow/download")
|
||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||
public void flowDownload(Integer userId, String bizCode, String startTime, String endTime, HttpServletResponse response) throws IOException {
|
||||
shopUserFlowService.flowDownload(StpKit.USER.getShopId(), userId, bizCode, startTime, endTime, response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import com.czg.account.entity.ShopUserFlow;
|
|||
import com.czg.account.vo.ShopUserFlowVO;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
|
@ -17,5 +19,7 @@ public interface ShopUserFlowService extends IService<ShopUserFlow> {
|
|||
|
||||
void updateRefund(Long id, BigDecimal refundAmount);
|
||||
|
||||
Page<ShopUserFlowVO> pageInfo(Long shopId, Integer userId, String bizCode);
|
||||
Page<ShopUserFlowVO> pageInfo(Long shopId, Integer userId, String bizCode, String startTime, String endTime);
|
||||
|
||||
void flowDownload(Long shopId, Integer userId, String bizCode, String startTime, String endTime, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ import java.util.List;
|
|||
*/
|
||||
public interface ShopUserFlowMapper extends BaseMapper<ShopUserFlow> {
|
||||
|
||||
List<ShopUserFlowVO> pageInfo(@Param("shopId") Long shopId, @Param("userId") Integer userId, @Param("bizCode") String bizCode);
|
||||
List<ShopUserFlowVO> pageInfo(@Param("shopId") Long shopId, @Param("userId") Integer userId, @Param("bizCode") String bizCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.czg.account.entity.ShopUserFlow;
|
||||
import com.czg.account.service.ShopUserFlowService;
|
||||
import com.czg.account.vo.ShopUserFlowVO;
|
||||
import com.czg.account.vo.SysUserDetailVO;
|
||||
import com.czg.service.account.mapper.ShopUserFlowMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
|
@ -10,9 +13,13 @@ import com.github.pagehelper.PageInfo;
|
|||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.update.UpdateChain;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户余额流水 服务层实现。
|
||||
|
|
@ -32,8 +39,29 @@ public class ShopUserFlowServiceImpl extends ServiceImpl<ShopUserFlowMapper, Sho
|
|||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopUserFlowVO> pageInfo(Long shopId, Integer userId, String bizCode) {
|
||||
public Page<ShopUserFlowVO> pageInfo(Long shopId, Integer userId, String bizCode, String startTime, String endTime) {
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
return PageUtil.convert(new PageInfo<>(mapper.pageInfo(shopId, userId, bizCode)));
|
||||
return PageUtil.convert(new PageInfo<>(mapper.pageInfo(shopId, userId, bizCode, startTime, endTime)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flowDownload(Long shopId, Integer userId, String bizCode, String startTime, String endTime, HttpServletResponse response) throws IOException {
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
List<ShopUserFlowVO> shopUserFlowVOS = mapper.pageInfo(shopId, userId, bizCode, startTime, endTime);
|
||||
|
||||
// 1. 创建 ExcelWriter
|
||||
// true 表示使用 XLSX 格式
|
||||
ExcelWriter writer = ExcelUtil.getWriter(true);
|
||||
|
||||
// 2. 写入数据
|
||||
writer.write(shopUserFlowVOS, true);
|
||||
|
||||
// 3. 设置响应头,返回 Excel
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("余额明细.xlsx", "UTF-8"));
|
||||
|
||||
// 4. 写入到响应流
|
||||
writer.flush(response.getOutputStream(), true);
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,13 @@
|
|||
<if test="userId != null">
|
||||
and a.user_id=#{userId}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
and a.create_time >= #{startTime}
|
||||
</if>
|
||||
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and a.create_time <= #{endTime}
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue