| | |
| | | buildBusinessDetailList(list)); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得导入商机模板") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | // 手动创建导出 demo |
| | | List<CrmBusinessImportExcelVO> list = Arrays.asList( |
| | | CrmBusinessImportExcelVO.builder().name("示例商机").customerName("示例客户") |
| | | .dealTime(null).totalProductPrice(null).discountPercent(null).totalPrice(null).remark("").build() |
| | | ); |
| | | // 输出 |
| | | ExcelUtils.write(response, "商机导入模板.xls", "商机列表", CrmBusinessImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入商机") |
| | | @PreAuthorize("@ss.hasPermission('crm:business:import')") |
| | | public CommonResult<CrmBusinessImportRespVO> importExcel(@Valid CrmBusinessImportReqVO importReqVO) |
| | | throws Exception { |
| | | List<CrmBusinessImportExcelVO> list = ExcelUtils.read(importReqVO.getFile(), CrmBusinessImportExcelVO.class); |
| | | return success(businessService.importBusinessList(list, importReqVO)); |
| | | } |
| | | |
| | | public List<CrmBusinessRespVO> buildBusinessDetailList(List<CrmBusinessDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |