| | |
| | | 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.module.crm.controller.admin.clue.vo.CrmClueImportExcelVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueImportReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueImportRespVO; |
| | | 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; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得线索") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('crm:clue:query')") |
| | | public CommonResult<CrmClueRespVO> getClue(@RequestParam("id") Long id) { |
| | | CrmClueDO clue = clueService.getClue(id); |
| | | return success(buildClueDetail(clue)); |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得线索分页") |
| | | @PreAuthorize("@ss.hasPermission('crm:clue:query')") |
| | | public CommonResult<PageResult<CrmClueRespVO>> getCluePage(@Valid CrmCluePageReqVO pageVO) { |
| | | PageResult<CrmClueDO> pageResult = clueService.getCluePage(pageVO, getLoginUserId()); |
| | | return success(new PageResult<>(buildClueDetailList(pageResult.getList()), pageResult.getTotal())); |
| | |
| | | List<CrmClueDO> list = clueService.getCluePage(pageReqVO, getLoginUserId()).getList(); |
| | | // 导出 Excel |
| | | ExcelUtils.write(response, "线索.xls", "数据", CrmClueRespVO.class, buildClueDetailList(list)); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得导入线索模板") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | // 手动创建导出 demo |
| | | List<CrmClueImportExcelVO> list = Arrays.asList( |
| | | CrmClueImportExcelVO.builder().name("示例线索") |
| | | .mobile("13800138000").telephone("").qq("").wechat("").email("") |
| | | .areaId(null).detailAddress("").industryId(null).level(null).source(null).remark("").build() |
| | | ); |
| | | // 输出 |
| | | ExcelUtils.write(response, "线索导入模板.xls", "线索列表", CrmClueImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入线索") |
| | | @PreAuthorize("@ss.hasPermission('crm:clue:import')") |
| | | public CommonResult<CrmClueImportRespVO> importExcel(@Valid CrmClueImportReqVO importReqVO) |
| | | throws Exception { |
| | | List<CrmClueImportExcelVO> list = ExcelUtils.read(importReqVO.getFile(), CrmClueImportExcelVO.class); |
| | | return success(clueService.importClueList(list, importReqVO)); |
| | | } |
| | | |
| | | private List<CrmClueRespVO> buildClueDetailList(List<CrmClueDO> list) { |
| | |
| | | |
| | | @GetMapping("/follow-count") |
| | | @Operation(summary = "获得分配给我的、待跟进的线索数量") |
| | | @PreAuthorize("@ss.hasPermission('crm:clue:query')") |
| | | public CommonResult<Long> getFollowClueCount() { |
| | | return success(clueService.getFollowClueCount(getLoginUserId())); |
| | | } |