| | |
| | | |
| | | 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.exception.util.ServiceExceptionUtil.exception0; |
| | | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; |
| | | 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; |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得联系人") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('crm:contact:query')") |
| | | public CommonResult<CrmContactRespVO> getContact(@RequestParam("id") Long id) { |
| | | CrmContactDO contact = contactService.getContact(id); |
| | | return success(buildContactDetail(contact)); |
| | |
| | | |
| | | @GetMapping("/simple-all-list") |
| | | @Operation(summary = "获得联系人的精简列表") |
| | | @PreAuthorize("@ss.hasPermission('crm:contact:query')") |
| | | public CommonResult<List<CrmContactRespVO>> getSimpleContactList() { |
| | | List<CrmContactDO> list = contactService.getContactList(getLoginUserId()); |
| | | return success(convertList(list, contact -> // 只返回 id、name 字段 |
| | |
| | | @GetMapping("/list-by-customer") |
| | | @Operation(summary = "获得联系人列表,基于指定客户") |
| | | @Parameter(name = "customerId", description = "客户编号", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:contact:query')") |
| | | public CommonResult<List<CrmContactRespVO>> getContactListByCustomer(@RequestParam("customerId") Long customerId) { |
| | | List<CrmContactDO> list = contactService.getContactListByCustomerId(customerId); |
| | | return success(convertList(list, contact -> // 只返回 id、name 字段 |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得联系人分页") |
| | | @PreAuthorize("@ss.hasPermission('crm:contact:query')") |
| | | public CommonResult<PageResult<CrmContactRespVO>> getContactPage(@Valid CrmContactPageReqVO pageVO) { |
| | | PageResult<CrmContactDO> pageResult = contactService.getContactPage(pageVO, getLoginUserId()); |
| | | return success(new PageResult<>(buildContactDetailList(pageResult.getList()), pageResult.getTotal())); |
| | |
| | | @GetMapping("/page-by-customer") |
| | | @Operation(summary = "获得联系人分页,基于指定客户") |
| | | public CommonResult<PageResult<CrmContactRespVO>> getContactPageByCustomer(@Valid CrmContactPageReqVO pageVO) { |
| | | Assert.notNull(pageVO.getCustomerId(), "客户编号不能为空"); |
| | | if (pageVO.getCustomerId() == null) { |
| | | throw exception0(BAD_REQUEST.getCode(), "客户编号不能为空"); |
| | | } |
| | | PageResult<CrmContactDO> pageResult = contactService.getContactPageByCustomerId(pageVO); |
| | | return success(new PageResult<>(buildContactDetailList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | |
| | | @GetMapping("/page-by-business") |
| | | @Operation(summary = "获得联系人分页,基于指定商机") |
| | | public CommonResult<PageResult<CrmContactRespVO>> getContactPageByBusiness(@Valid CrmContactPageReqVO pageVO) { |
| | | Assert.notNull(pageVO.getBusinessId(), "商机编号不能为空"); |
| | | if (pageVO.getBusinessId() == null) { |
| | | throw exception0(BAD_REQUEST.getCode(), "商机编号不能为空"); |
| | | } |
| | | PageResult<CrmContactDO> pageResult = contactService.getContactPageByBusinessId(pageVO); |
| | | return success(new PageResult<>(buildContactDetailList(pageResult.getList()), pageResult.getTotal())); |
| | | } |