fix:推广员导出

feature/mall_product
tangqian 2023-06-16 10:37:28 +08:00
parent b7dcf93fb3
commit 3a9b7376f2
4 changed files with 34 additions and 9 deletions

View File

@ -20,10 +20,10 @@ public class PageParam implements Serializable {
@Min(value = 1, message = "页码最小值为 1")
private Integer pageNo = PAGE_NO;
@Schema(description = "每页条数,最大值为 1000", required = true, example = "10")
@Schema(description = "每页条数,最大值为 10000", required = true, example = "10")
@NotNull(message = "每页条数不能为空")
@Min(value = 1, message = "每页条数最小值为 1")
@Max(value = 100, message = "每页条数最大值为 1000")
@Max(value = 100, message = "每页条数最大值为 10000")
private Integer pageSize = PAGE_SIZE;
}

View File

@ -152,7 +152,7 @@
e.name as tenantName,
a.pay_time,
a.pay_time as payCompleteTime,
a.real_name,
x.nickname as realName,
a.paid,
a.user_phone,
a.confirm_phone,
@ -168,6 +168,7 @@
left join member_user b on a.promoter_id = b.id
left join system_dept d on d.id = a.dept_id
left join system_tenant e on e.id = a.tenant_id
left join member_user x on a.uid = x.id
<include refid="baseWhere">
</include>
</select>

View File

@ -5,8 +5,12 @@ import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Parameters;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -21,11 +25,13 @@ import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*;
@ -98,11 +104,12 @@ public class PromoterController {
@PreAuthorize("@ss.hasPermission('member:promoter:export')")
@OperateLog(type = EXPORT)
public void exportPromoterExcel(@Valid PromoterExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<PromoterExcelVO> list = promoterService.getPromoterList(exportReqVO);
// 导出 Excel
ExcelUtils.write(response, "推广员.xls", "数据", PromoterExcelVO.class, list);
}
@GetMapping("/get-import-template")
@Operation(summary = "获得导入推广员模板")
public void importTemplate(HttpServletResponse response) throws IOException {
@ -114,6 +121,7 @@ public class PromoterController {
// 输出
ExcelUtils.write(response, "推广员导入模板.xls", "推广员列表", PromoterImportExcelVO.class, list);
}
@PostMapping("/import")
@Operation(summary = "导入推广员")
// @Parameters({
@ -123,7 +131,7 @@ public class PromoterController {
// @PreAuthorize("@ss.hasPermission('system:user:import')")
@TenantIgnore
public CommonResult<PromoterImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
List<PromoterImportExcelVO> list = ExcelUtils.read(file, PromoterImportExcelVO.class);
return success(promoterService.importUserList(list, updateSupport));
}
@ -138,6 +146,25 @@ public class PromoterController {
return success(pageResult);
}
@GetMapping("/all-export-excel")
@Operation(summary = "导出所有推广员 Excel")
@OperateLog(type = EXPORT)
public void allExportExcel(@Valid PromoterPageReqVO pageVO,
HttpServletResponse response) throws IOException {
PageResult<PromoterRespVO> pageResult = promoterService.getPromoterPage(pageVO);
List<PromoterExcelVO> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(pageResult.getList())) {
pageResult.getList().forEach(e -> {
PromoterExcelVO vo = new PromoterExcelVO();
BeanUtils.copyProperties(e, vo);
list.add(vo);
});
}
// 导出 Excel
ExcelUtils.write(response, "推广员.xls", "数据", PromoterExcelVO.class, list);
}
@PutMapping("/tenantIgnoreUpdate")
@Operation(summary = "排除祖父更新推广员")
@TenantIgnore

View File

@ -1,10 +1,7 @@
package cn.iocoder.yudao.module.member.controller.admin.promoter.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 广 Excel VO