fix: 导出全部数据和商务角色过滤
This commit is contained in:
@@ -15,6 +15,7 @@ import org.agt.framework.common.util.object.BeanUtils;
|
||||
import org.agt.framework.excel.core.util.ExcelUtils;
|
||||
import org.agt.framework.ip.core.utils.AreaUtils;
|
||||
import org.agt.framework.security.core.service.SecurityFrameworkService;
|
||||
import org.agt.module.license.controller.admin.common.vo.CommonExportReqVO;
|
||||
import org.agt.module.license.controller.admin.customer.vo.CustomerImportRespVO;
|
||||
import org.agt.module.license.controller.admin.customer.vo.CustomerPageReqVO;
|
||||
import org.agt.module.license.controller.admin.customer.vo.CustomerRespVO;
|
||||
@@ -38,6 +39,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.agt.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static org.agt.framework.common.pojo.CommonResult.success;
|
||||
@@ -167,9 +169,16 @@ public class CustomerController {
|
||||
public void exportCustomerExcel(@Valid CustomerPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
if ("all".equals(pageReqVO.getMode())) {
|
||||
CommonExportReqVO exportReqVO = BeanUtils.toBean(pageReqVO, CommonExportReqVO.class);
|
||||
pageReqVO = BeanUtils.toBean(exportReqVO, CustomerPageReqVO.class);
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
}
|
||||
PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageReqVO);
|
||||
|
||||
if (!securityFrameworkService.hasRole("business")) {
|
||||
pageReqVO.setIncludeFields(pageReqVO.getIncludeFields().stream()
|
||||
.filter(c -> !Arrays.asList("contacts", "role", "phone").contains(c)).collect(Collectors.toSet()));
|
||||
}
|
||||
// 导出 Excel
|
||||
ExcelUtils.writeSelected(response, "", pageReqVO.getSheetName(), CustomerRespVO.class,
|
||||
buildCustomerVOList(pageResult).getList(), pageReqVO.getIncludeFields());
|
||||
|
||||
@@ -11,8 +11,10 @@ import org.agt.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import org.agt.framework.common.pojo.CommonResult;
|
||||
import org.agt.framework.common.pojo.PageParam;
|
||||
import org.agt.framework.common.pojo.PageResult;
|
||||
import org.agt.framework.common.util.object.BeanUtils;
|
||||
import org.agt.framework.excel.core.util.ExcelUtils;
|
||||
import org.agt.framework.translate.core.TranslateUtils;
|
||||
import org.agt.module.license.controller.admin.common.vo.CommonExportReqVO;
|
||||
import org.agt.module.license.controller.admin.license.vo.ImportRespVO;
|
||||
import org.agt.module.license.controller.admin.license.vo.LicenseCodeImportExcelVO;
|
||||
import org.agt.module.license.controller.admin.license.vo.LicenseDetailVO;
|
||||
@@ -138,6 +140,8 @@ public class LicenseController {
|
||||
public void exportLicenseExcel(@Valid LicensePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
if ("all".equals(pageReqVO.getMode())) {
|
||||
CommonExportReqVO exportReqVO = BeanUtils.toBean(pageReqVO, CommonExportReqVO.class);
|
||||
pageReqVO = BeanUtils.toBean(exportReqVO, LicensePageReqVO.class);
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
}
|
||||
List<LicenseRespVO> voList = licenseService.getLicensePage(pageReqVO).getList();
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.agt.framework.common.pojo.PageResult;
|
||||
import org.agt.framework.common.util.object.BeanUtils;
|
||||
import org.agt.framework.excel.core.util.ExcelUtils;
|
||||
import org.agt.framework.translate.core.TranslateUtils;
|
||||
import org.agt.module.license.controller.admin.common.vo.CommonExportReqVO;
|
||||
import org.agt.module.license.controller.admin.license.vo.ImportRespVO;
|
||||
import org.agt.module.license.controller.admin.project.vo.ProjectImportRespVO;
|
||||
import org.agt.module.license.controller.admin.project.vo.ProjectListReqVO;
|
||||
@@ -107,6 +108,8 @@ public class ProjectController {
|
||||
public void exportProjectExcel(@Valid ProjectPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
if ("all".equals(pageReqVO.getMode())) {
|
||||
CommonExportReqVO exportReqVO = BeanUtils.toBean(pageReqVO, CommonExportReqVO.class);
|
||||
pageReqVO = BeanUtils.toBean(exportReqVO, ProjectPageReqVO.class);
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
}
|
||||
List<ProjectRespVO> list = projectService.getProjectPage(pageReqVO).getList();
|
||||
|
||||
Reference in New Issue
Block a user