mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 10:18:42 +08:00 
			
		
		
		
	Merge branch 'master-jdk21' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into develop
# Conflicts: # yudao-dependencies/pom.xml # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java # yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/ErpPurchaseOrderController.java
This commit is contained in:
		| @@ -1,13 +1,13 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.business; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.iocoder.yudao.framework.apilog.core.annotations.ApiAccessLog; | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||||
| import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; | ||||
| @@ -39,11 +39,11 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Stream; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | ||||
| import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||||
| import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS; | ||||
|  | ||||
| @@ -167,7 +167,7 @@ public class CrmBusinessController { | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出商机 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:business:export')") | ||||
|     @OperateLog(type = EXPORT) | ||||
|     @ApiAccessLog(operateType = EXPORT) | ||||
|     public void exportBusinessExcel(@Valid CrmBusinessPageReqVO exportReqVO, | ||||
|                                     HttpServletResponse response) throws IOException { | ||||
|         exportReqVO.setPageSize(PAGE_SIZE_NONE); | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.clue; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.iocoder.yudao.framework.apilog.core.annotations.ApiAccessLog; | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||||
| @@ -8,7 +9,6 @@ import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||||
| import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | ||||
| import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueRespVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueSaveReqVO; | ||||
| @@ -37,11 +37,11 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Stream; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||||
| import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||||
| import static java.util.Collections.singletonList; | ||||
|  | ||||
| @@ -112,7 +112,7 @@ public class CrmClueController { | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出线索 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:clue:export')") | ||||
|     @OperateLog(type = EXPORT) | ||||
|     @ApiAccessLog(operateType = EXPORT) | ||||
|     public void exportClueExcel(@Valid CrmCluePageReqVO pageReqVO, HttpServletResponse response) throws IOException { | ||||
|         pageReqVO.setPageSize(PAGE_SIZE_NONE); | ||||
|         List<CrmClueDO> list = clueService.getCluePage(pageReqVO, getLoginUserId()).getList(); | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.contact; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.lang.Assert; | ||||
| import cn.iocoder.yudao.framework.apilog.core.annotations.ApiAccessLog; | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||||
| @@ -9,7 +10,6 @@ import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||||
| import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | ||||
| import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | ||||
| @@ -37,11 +37,11 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Stream; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; | ||||
| import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||||
| import static java.util.Collections.singletonList; | ||||
|  | ||||
| @@ -73,7 +73,6 @@ public class CrmContactController { | ||||
|  | ||||
|     @PutMapping("/update") | ||||
|     @Operation(summary = "更新联系人") | ||||
|     @OperateLog(enable = false) | ||||
|     @PreAuthorize("@ss.hasPermission('crm:contact:update')") | ||||
|     public CommonResult<Boolean> updateContact(@Valid @RequestBody CrmContactSaveReqVO updateReqVO) { | ||||
|         contactService.updateContact(updateReqVO); | ||||
| @@ -142,7 +141,7 @@ public class CrmContactController { | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出联系人 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:contact:export')") | ||||
|     @OperateLog(type = EXPORT) | ||||
|     @ApiAccessLog(operateType = EXPORT) | ||||
|     public void exportContactExcel(@Valid CrmContactPageReqVO exportReqVO, | ||||
|                                    HttpServletResponse response) throws IOException { | ||||
|         exportReqVO.setPageNo(PAGE_SIZE_NONE); | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.controller.admin.contract; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.lang.Assert; | ||||
| import cn.iocoder.yudao.framework.apilog.core.annotations.ApiAccessLog; | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| @@ -9,7 +10,6 @@ import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||||
| import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractPageReqVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractRespVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractSaveReqVO; | ||||
| @@ -47,10 +47,10 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Stream; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; | ||||
| import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||||
| import static java.util.Collections.singletonList; | ||||
|  | ||||
| @@ -154,7 +154,7 @@ public class CrmContractController { | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出合同 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:contract:export')") | ||||
|     @OperateLog(type = EXPORT) | ||||
|     @ApiAccessLog(operateType = EXPORT) | ||||
|     public void exportContractExcel(@Valid CrmContractPageReqVO exportReqVO, | ||||
|                                     HttpServletResponse response) throws IOException { | ||||
|         PageResult<CrmContractDO> pageResult = contractService.getContractPage(exportReqVO, getLoginUserId()); | ||||
|   | ||||
| @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.map.MapUtil; | ||||
| import cn.iocoder.yudao.framework.apilog.core.annotations.ApiAccessLog; | ||||
| import cn.iocoder.yudao.framework.common.core.KeyValue; | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||||
| @@ -11,7 +13,6 @@ import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||||
| import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | ||||
| import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.customer.*; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | ||||
| @@ -40,10 +41,10 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Stream; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | ||||
| import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||||
| import static java.util.Collections.singletonList; | ||||
|  | ||||
| @@ -235,7 +236,7 @@ public class CrmCustomerController { | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出客户 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:customer:export')") | ||||
|     @OperateLog(type = EXPORT) | ||||
|     @ApiAccessLog(operateType = EXPORT) | ||||
|     public void exportCustomerExcel(@Valid CrmCustomerPageReqVO pageVO, | ||||
|                                     HttpServletResponse response) throws IOException { | ||||
|         pageVO.setPageSize(PAGE_SIZE_NONE); // 不分页 | ||||
| @@ -264,7 +265,7 @@ public class CrmCustomerController { | ||||
|     @PostMapping("/import") | ||||
|     @Operation(summary = "导入客户") | ||||
|     @PreAuthorize("@ss.hasPermission('system:customer:import')") | ||||
|     public CommonResult<CrmCustomerImportRespVO> importExcel(@Valid @RequestBody CrmCustomerImportReqVO importReqVO) | ||||
|     public CommonResult<CrmCustomerImportRespVO> importExcel(@Valid CrmCustomerImportReqVO importReqVO) | ||||
|             throws Exception { | ||||
|         List<CrmCustomerImportExcelVO> list = ExcelUtils.read(importReqVO.getFile(), CrmCustomerImportExcelVO.class); | ||||
|         return success(customerService.importCustomerList(list, importReqVO)); | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.operatelog.vo.CrmOperateLogR | ||||
| import cn.iocoder.yudao.module.crm.enums.LogRecordConstants; | ||||
| import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | ||||
| import cn.iocoder.yudao.module.system.api.logger.OperateLogApi; | ||||
| import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogV2PageReqDTO; | ||||
| import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogPageReqDTO; | ||||
| import io.swagger.v3.oas.annotations.Operation; | ||||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||||
| import jakarta.annotation.Resource; | ||||
| @@ -55,9 +55,9 @@ public class CrmOperateLogController { | ||||
|     @Operation(summary = "获得操作日志") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:operate-log:query')") | ||||
|     public CommonResult<PageResult<CrmOperateLogRespVO>> getCustomerOperateLog(@Valid CrmOperateLogPageReqVO pageReqVO) { | ||||
|         OperateLogV2PageReqDTO reqDTO = new OperateLogV2PageReqDTO(); | ||||
|         OperateLogPageReqDTO reqDTO = new OperateLogPageReqDTO(); | ||||
|         reqDTO.setPageSize(PAGE_SIZE_NONE); // 默认不分页,需要分页需注释 | ||||
|         reqDTO.setBizType(BIZ_TYPE_MAP.get(pageReqVO.getBizType())).setBizId(pageReqVO.getBizId()); | ||||
|         reqDTO.setType(BIZ_TYPE_MAP.get(pageReqVO.getBizType())).setBizId(pageReqVO.getBizId()); | ||||
|         return success(BeanUtils.toBean(operateLogApi.getOperateLogPage(reqDTO), CrmOperateLogRespVO.class)); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,23 +1,19 @@ | ||||
| package cn.iocoder.yudao.module.crm.controller.admin.product; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.iocoder.yudao.framework.apilog.core.annotations.ApiAccessLog; | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||||
| import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||||
| import cn.iocoder.yudao.framework.translate.core.TranslateUtils; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProductPageReqVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProductRespVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProductSaveReqVO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; | ||||
| import cn.iocoder.yudao.module.crm.enums.product.CrmProductStatusEnum; | ||||
| import cn.iocoder.yudao.module.crm.service.product.CrmProductCategoryService; | ||||
| import cn.iocoder.yudao.module.crm.service.product.CrmProductService; | ||||
| import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||||
| import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||||
| import io.swagger.v3.oas.annotations.Operation; | ||||
| import io.swagger.v3.oas.annotations.Parameter; | ||||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||||
| @@ -29,15 +25,11 @@ import org.springframework.validation.annotation.Validated; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Stream; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | ||||
| import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static java.util.Collections.singletonList; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||||
|  | ||||
| @Tag(name = "管理后台 - CRM 产品") | ||||
| @RestController | ||||
| @@ -47,9 +39,6 @@ public class CrmProductController { | ||||
|  | ||||
|     @Resource | ||||
|     private CrmProductService productService; | ||||
|     @Resource | ||||
|     private CrmProductCategoryService productCategoryService; | ||||
|  | ||||
|     @Resource | ||||
|     private AdminUserApi adminUserApi; | ||||
|  | ||||
| @@ -83,14 +72,7 @@ public class CrmProductController { | ||||
|     @PreAuthorize("@ss.hasPermission('crm:product:query')") | ||||
|     public CommonResult<CrmProductRespVO> getProduct(@RequestParam("id") Long id) { | ||||
|         CrmProductDO product = productService.getProduct(id); | ||||
|         return success(buildProductDetail(product)); | ||||
|     } | ||||
|  | ||||
|     private CrmProductRespVO buildProductDetail(CrmProductDO product) { | ||||
|         if (product == null) { | ||||
|             return null; | ||||
|         } | ||||
|         return buildProductDetailList(singletonList(product)).get(0); | ||||
|         return success(BeanUtils.toBean(product, CrmProductRespVO.class)); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/simple-list") | ||||
| @@ -106,40 +88,20 @@ public class CrmProductController { | ||||
|     @PreAuthorize("@ss.hasPermission('crm:product:query')") | ||||
|     public CommonResult<PageResult<CrmProductRespVO>> getProductPage(@Valid CrmProductPageReqVO pageVO) { | ||||
|         PageResult<CrmProductDO> pageResult = productService.getProductPage(pageVO); | ||||
|         return success(new PageResult<>(buildProductDetailList(pageResult.getList()), pageResult.getTotal())); | ||||
|         return success(BeanUtils.toBean(pageResult, CrmProductRespVO.class)); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出产品 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:product:export')") | ||||
|     @OperateLog(type = EXPORT) | ||||
|     @ApiAccessLog(operateType = EXPORT) | ||||
|     public void exportProductExcel(@Valid CrmProductPageReqVO exportReqVO, | ||||
|                                    HttpServletResponse response) throws IOException { | ||||
|         exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||||
|         List<CrmProductDO> list = productService.getProductPage(exportReqVO).getList(); | ||||
|         // 导出 Excel | ||||
|         ExcelUtils.write(response, "产品.xls", "数据", CrmProductRespVO.class, | ||||
|                 buildProductDetailList(list)); | ||||
|     } | ||||
|  | ||||
|     private List<CrmProductRespVO> buildProductDetailList(List<CrmProductDO> list) { | ||||
|         if (CollUtil.isEmpty(list)) { | ||||
|             return Collections.emptyList(); | ||||
|         } | ||||
|         // 1.1 获得用户信息 | ||||
|         Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( | ||||
|                 convertSetByFlatMap(list, user -> Stream.of(Long.valueOf(user.getCreator()), user.getOwnerUserId()))); | ||||
|         // 1.2 获得分类信息 | ||||
|         Map<Long, CrmProductCategoryDO> categoryMap = productCategoryService.getProductCategoryMap( | ||||
|                 convertSet(list, CrmProductDO::getCategoryId)); | ||||
|         // 2. 拼接数据 | ||||
|         return BeanUtils.toBean(list, CrmProductRespVO.class, productVO -> { | ||||
|             // 2.1 设置用户信息 | ||||
|             MapUtils.findAndThen(userMap, productVO.getOwnerUserId(), user -> productVO.setOwnerUserName(user.getNickname())); | ||||
|             MapUtils.findAndThen(userMap, Long.valueOf(productVO.getCreator()), user -> productVO.setCreatorName(user.getNickname())); | ||||
|             // 2.2 设置分类名称 | ||||
|             MapUtils.findAndThen(categoryMap, productVO.getCategoryId(), category -> productVO.setCategoryName(category.getName())); | ||||
|         }); | ||||
|                 TranslateUtils.translate(BeanUtils.toBean(list, CrmProductRespVO.class))); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -2,9 +2,13 @@ package cn.iocoder.yudao.module.crm.controller.admin.product.vo.product; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||||
| import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||||
| import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO; | ||||
| import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; | ||||
| import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||
| import com.alibaba.excel.annotation.ExcelProperty; | ||||
| import com.fhs.core.trans.anno.Trans; | ||||
| import com.fhs.core.trans.constant.TransType; | ||||
| import com.fhs.core.trans.vo.VO; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
|  | ||||
| @@ -14,7 +18,7 @@ import java.time.LocalDateTime; | ||||
| @Schema(description = "管理后台 - CRM 产品 Response VO") | ||||
| @Data | ||||
| @ExcelIgnoreUnannotated | ||||
| public class CrmProductRespVO { | ||||
| public class CrmProductRespVO implements VO { | ||||
|  | ||||
|     @Schema(description = "产品编号", example = "20529") | ||||
|     @ExcelProperty("产品编号") | ||||
| @@ -43,6 +47,7 @@ public class CrmProductRespVO { | ||||
|     private Integer status; | ||||
|  | ||||
|     @Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||||
|     @Trans(type = TransType.SIMPLE, target = CrmProductCategoryDO.class, fields = "name", ref = "categoryName") | ||||
|     private Long categoryId; | ||||
|     @Schema(description = "产品分类名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "衣服") | ||||
|     @ExcelProperty("产品分类") | ||||
| @@ -53,12 +58,16 @@ public class CrmProductRespVO { | ||||
|     private String description; | ||||
|  | ||||
|     @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31926") | ||||
|     @Trans(type = TransType.RPC, targetClassName = "cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO", | ||||
|             fields = "nickname", ref = "ownerUserName") | ||||
|     private Long ownerUserId; | ||||
|     @Schema(description = "负责人的用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") | ||||
|     @ExcelProperty("负责人") | ||||
|     private String ownerUserName; | ||||
|  | ||||
|     @Schema(description = "创建人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||||
|     @Trans(type = TransType.RPC, targetClassName = "cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO", | ||||
|             fields = "nickname", ref = "creatorName") | ||||
|     private String creator; | ||||
|     @Schema(description = "创建人名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") | ||||
|     @ExcelProperty("创建人") | ||||
|   | ||||
| @@ -2,13 +2,13 @@ package cn.iocoder.yudao.module.crm.controller.admin.receivable; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.lang.Assert; | ||||
| import cn.iocoder.yudao.framework.apilog.core.annotations.ApiAccessLog; | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||||
| import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractRespVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO; | ||||
| @@ -39,11 +39,12 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Stream; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; | ||||
| import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||||
|  | ||||
| @Tag(name = "管理后台 - CRM 回款") | ||||
| @@ -123,7 +124,7 @@ public class CrmReceivableController { | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出回款 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:receivable:export')") | ||||
|     @OperateLog(type = EXPORT) | ||||
|     @ApiAccessLog(operateType = EXPORT) | ||||
|     public void exportReceivableExcel(@Valid CrmReceivablePageReqVO exportReqVO, | ||||
|                                       HttpServletResponse response) throws IOException { | ||||
|         exportReqVO.setPageSize(PAGE_SIZE_NONE); | ||||
|   | ||||
| @@ -2,12 +2,12 @@ package cn.iocoder.yudao.module.crm.controller.admin.receivable; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.lang.Assert; | ||||
| import cn.iocoder.yudao.framework.apilog.core.annotations.ApiAccessLog; | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||||
| import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanRespVO; | ||||
| import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanSaveReqVO; | ||||
| @@ -39,11 +39,11 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Stream; | ||||
|  | ||||
| import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||
| import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | ||||
| import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; | ||||
| import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||||
| import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||||
|  | ||||
| @Tag(name = "管理后台 - CRM 回款计划") | ||||
| @@ -123,7 +123,7 @@ public class CrmReceivablePlanController { | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出回款计划 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('crm:receivable-plan:export')") | ||||
|     @OperateLog(type = EXPORT) | ||||
|     @ApiAccessLog(operateType = EXPORT) | ||||
|     public void exportReceivablePlanExcel(@Valid CrmReceivablePlanPageReqVO exportReqVO, | ||||
|                                           HttpServletResponse response) throws IOException { | ||||
|         exportReqVO.setPageSize(PAGE_SIZE_NONE); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV