用户列表导出接口
This commit is contained in:
@@ -3,6 +3,7 @@ package com.czg.service.account.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.dto.shopuser.*;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
@@ -10,6 +11,7 @@ import com.czg.account.service.AShopUserService;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.czg.excel.ExcelExportUtil;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.market.entity.MemberLevelConfig;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
@@ -28,12 +30,14 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -124,6 +128,24 @@ public class AShopUserServiceImpl implements AShopUserService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportUserList(String key, Integer isVip, HttpServletResponse response) {
|
||||
Long mainIdByShopId = shopInfoService.getMainIdByShopId(StpKit.USER.getShopId());
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
List<ShopUserDTO> dtoList = shopUserMapper.selectPageByKeyAndIsVip(mainIdByShopId, isVip, key, null);
|
||||
|
||||
// 将 dtoList 转换为 ShopUserExportDTO 列表
|
||||
List<ShopUserExportDTO> exportList = new ArrayList<>();
|
||||
for (ShopUserDTO shopUserDTO : dtoList) {
|
||||
ShopUserExportDTO exportDTO = BeanUtil.copyProperties(shopUserDTO, ShopUserExportDTO.class);
|
||||
exportDTO.setVipRemark((isVip != null && isVip.equals(1)) ? "是" : "否");
|
||||
exportList.add(exportDTO);
|
||||
}
|
||||
|
||||
log.info(JSONObject.toJSONString(exportList));
|
||||
ExcelExportUtil.exportToResponse(exportList, ShopUserExportDTO.class, "店铺用户列表.xlsx", response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean updateInfo(Long shopId, ShopUserEditDTO shopUserEditDTO) {
|
||||
|
||||
Reference in New Issue
Block a user