From 919de23c2e5890ec63279b6053eaa46c6ee1f22a Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Fri, 31 May 2024 08:34:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E3=80=90=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E4=B8=9A=E5=8A=A1=E6=95=B0=E6=8D=AEid=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E8=8E=B7=E5=8F=96=E8=81=94=E7=B3=BB=E4=BA=BA=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E3=80=91=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ContactsController.java | 14 +++++++++++++ .../contacts/service/ContactsService.java | 1 + .../service/impl/ContactsServiceImpl.java | 21 +++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/controller/ContactsController.java b/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/controller/ContactsController.java index e2aaa1a7..03507dbb 100644 --- a/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/controller/ContactsController.java +++ b/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/controller/ContactsController.java @@ -100,4 +100,18 @@ public class ContactsController { contactsService.queryContactsListByObject(inputObject, outputObject); } + /** + * 根据业务数据id批量获取联系人列表 + * + * @param inputObject 入参以及用户信息等获取对象 + * @param outputObject 出参以及提示信息的返回值对象 + */ + @ApiOperation(id = "queryContactsListByObjectIds", value = "根据业务数据id批量获取联系人列表", method = "POST", allUse = "2") + @ApiImplicitParams(value = { + @ApiImplicitParam(id = "objectIds", name = "objectIds", value = "业务数据id集合", required = "json")}) + @RequestMapping("/post/ContactsController/queryContactsListByObjectIds") + public void queryContactsListByObjectIds(InputObject inputObject, OutputObject outputObject) { + contactsService.queryContactsListByObjectIds(inputObject, outputObject); + } + } diff --git a/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/service/ContactsService.java b/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/service/ContactsService.java index 7e74f9d3..d92cc724 100644 --- a/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/service/ContactsService.java +++ b/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/service/ContactsService.java @@ -21,4 +21,5 @@ public interface ContactsService extends SkyeyeTeamAuthService { void queryContactsListByObject(InputObject inputObject, OutputObject outputObject); + void queryContactsListByObjectIds(InputObject inputObject, OutputObject outputObject); } diff --git a/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/service/impl/ContactsServiceImpl.java b/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/service/impl/ContactsServiceImpl.java index d38a88b8..e7cae661 100644 --- a/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/service/impl/ContactsServiceImpl.java +++ b/skyeye-promote/skyeye-base-server/src/main/java/com/skyeye/contacts/service/impl/ContactsServiceImpl.java @@ -4,9 +4,12 @@ package com.skyeye.contacts.service.impl; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.skyeye.annotation.service.SkyeyeService; import com.skyeye.base.business.service.impl.SkyeyeTeamAuthServiceImpl; +import com.skyeye.common.constans.CommonNumConstants; import com.skyeye.common.entity.search.CommonPageInfo; import com.skyeye.common.enumeration.DeleteFlagEnum; import com.skyeye.common.enumeration.IsDefaultEnum; @@ -23,6 +26,7 @@ import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @ClassName: ContactsServiceImpl @@ -83,4 +87,21 @@ public class ContactsServiceImpl extends SkyeyeTeamAuthServiceImpl objectIds = JSONUtil.toList(objectIdsStr, null); + if (CollectionUtil.isEmpty(objectIds)) { + return; + } + objectIds = objectIds.stream().distinct().collect(Collectors.toList()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in(MybatisPlusUtil.toColumns(Contacts::getObjectId), objectIds); + queryWrapper.eq(MybatisPlusUtil.toColumns(Contacts::getDeleteFlag), DeleteFlagEnum.NOT_DELETE.getKey()); + List contactsList = list(queryWrapper); + Map> result = contactsList.stream().collect(Collectors.groupingBy(Contacts::getObjectId)); + outputObject.setBean(result); + outputObject.settotal(CommonNumConstants.NUM_ONE); + } }