Commit 93eabb4efd61c74065bdec3223211dac2943a980

Authored by YunaiV
1 parent ca367c37

feat(crm):新增 list-by-contact 接口,适配 admin uniapp 不分页下拉

yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
@@ -149,6 +149,15 @@ public class CrmBusinessController { @@ -149,6 +149,15 @@ public class CrmBusinessController {
149 .setCustomerId(business.getCustomerId()))); 149 .setCustomerId(business.getCustomerId())));
150 } 150 }
151 151
  152 + @GetMapping("/list-by-contact")
  153 + @Operation(summary = "获得商机列表,基于指定联系人")
  154 + @Parameter(name = "contactId", description = "联系人编号", required = true)
  155 + @PreAuthorize("@ss.hasPermission('crm:business:query')")
  156 + public CommonResult<List<CrmBusinessRespVO>> getBusinessListByContact(@RequestParam("contactId") Long contactId) {
  157 + List<CrmBusinessDO> list = businessService.getBusinessListByContact(contactId);
  158 + return success(buildBusinessDetailList(list));
  159 + }
  160 +
152 @GetMapping("/page") 161 @GetMapping("/page")
153 @Operation(summary = "获得商机分页") 162 @Operation(summary = "获得商机分页")
154 @PreAuthorize("@ss.hasPermission('crm:business:query')") 163 @PreAuthorize("@ss.hasPermission('crm:business:query')")
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java
@@ -204,6 +204,14 @@ public interface CrmBusinessService { @@ -204,6 +204,14 @@ public interface CrmBusinessService {
204 List<CrmBusinessDO> getBusinessListByCustomerId(Long customerId); 204 List<CrmBusinessDO> getBusinessListByCustomerId(Long customerId);
205 205
206 /** 206 /**
  207 + * 获得商机列表,基于指定联系人
  208 + *
  209 + * @param contactId 联系人编号
  210 + * @return 商机列表
  211 + */
  212 + List<CrmBusinessDO> getBusinessListByContact(Long contactId);
  213 +
  214 + /**
207 * 获得商机分页,目前用于【数据统计】 215 * 获得商机分页,目前用于【数据统计】
208 * 216 *
209 * @param pageVO 请求 217 * @param pageVO 请求
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
@@ -384,6 +384,18 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { @@ -384,6 +384,18 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
384 } 384 }
385 385
386 @Override 386 @Override
  387 + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACT, bizId = "#contactId", level = CrmPermissionLevelEnum.READ)
  388 + public List<CrmBusinessDO> getBusinessListByContact(Long contactId) {
  389 + // 1. 查询关联的商机编号
  390 + List<CrmContactBusinessDO> contactBusinessList = contactBusinessService.getContactBusinessListByContactId(contactId);
  391 + if (CollUtil.isEmpty(contactBusinessList)) {
  392 + return ListUtil.empty();
  393 + }
  394 + // 2. 查询商机列表
  395 + return businessMapper.selectByIds(convertSet(contactBusinessList, CrmContactBusinessDO::getBusinessId));
  396 + }
  397 +
  398 + @Override
387 public PageResult<CrmBusinessDO> getBusinessPageByDate(CrmStatisticsFunnelReqVO pageVO) { 399 public PageResult<CrmBusinessDO> getBusinessPageByDate(CrmStatisticsFunnelReqVO pageVO) {
388 return businessMapper.selectPage(pageVO); 400 return businessMapper.selectPage(pageVO);
389 } 401 }