Commit b1398e45 by 张富康

feat(order): 添加客户群信息管理功能

- 在CustomerProfileInfoRequest中新增customerGroupParam字段用于客户群信息参数传递
- 新增getCustomerGroupInfo接口实现获取客户群信息功能
- 新增getCustomerGroupMemberInfo接口实现获取群成员信息功能
- 集成企微机器人API通过HTTP请求获取群组和成员数据
- 新增ContactDTO数据传输对象定义群组和成员信息结构
- 新增ContactListDTO数据传输对象定义群组列表响应结构
- 配置相关属性配置项包括机器人ID和群组服务URL地址
1 parent 6c43a554
...@@ -8,6 +8,8 @@ import cn.com.glsx.dj.pad.request.order.PreliminaryOrderBatchRequest; ...@@ -8,6 +8,8 @@ import cn.com.glsx.dj.pad.request.order.PreliminaryOrderBatchRequest;
import cn.com.glsx.dj.pad.response.HistoryOrderPageResponse; import cn.com.glsx.dj.pad.response.HistoryOrderPageResponse;
import cn.com.glsx.dj.pad.service.category.GoodsOrderService; import cn.com.glsx.dj.pad.service.category.GoodsOrderService;
import cn.com.glsx.dj.pad.util.CommonUtil; import cn.com.glsx.dj.pad.util.CommonUtil;
import cn.com.glsx.dj.smartcarlife.dto.ContactDTO;
import cn.com.glsx.dj.smartcarlife.dto.ContactListDTO;
import cn.com.glsx.dj.smartcarlife.dto.CustomerProfileInfoDTO; import cn.com.glsx.dj.smartcarlife.dto.CustomerProfileInfoDTO;
import cn.com.glsx.dj.smartcarlife.dto.GoodsOrderCustomerDTO; import cn.com.glsx.dj.smartcarlife.dto.GoodsOrderCustomerDTO;
import cn.com.glsx.dj.smartcarlife.dto.GoodsOrderDTO; import cn.com.glsx.dj.smartcarlife.dto.GoodsOrderDTO;
...@@ -23,6 +25,8 @@ import cn.com.glsx.framework.core.exception.RpcServiceException; ...@@ -23,6 +25,8 @@ import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse; import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.scrm.proxy.enums.UserTypeEnum; import cn.com.glsx.scrm.proxy.enums.UserTypeEnum;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.rop.annotation.NeedInSessionType; import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod; import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean; import com.rop.annotation.ServiceMethodBean;
...@@ -31,6 +35,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -31,6 +35,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.oreframework.boot.env.OrePropertyConfigurer;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.List; import java.util.List;
...@@ -178,5 +183,66 @@ public class GoodsOrderController { ...@@ -178,5 +183,66 @@ public class GoodsOrderController {
return CommonUtil.convertRopResponse(res); return CommonUtil.convertRopResponse(res);
} }
/**
* 获取客户群信息
*/
@ServiceMethod(method = "dj.api.smartcarlife.order.getCustomerGroupInfo", needInSession = NeedInSessionType.YES)
@ApiOperation("获取客户群信息")
public RopResponse<ContactDTO> getCustomerGroupInfo(CustomerProfileInfoRequest request) {
// 1、先用 机器人id + 类型为企微外部群 + 名称:客户姓名 查询对应的群 存个多个怎么处理?
// 2、在通过 机器人id + 群id 搜索类型:群成员 通许录ID = "contact_id": "R:10976960540246131" 获取群成员列表
String botId = OrePropertyConfigurer.getProperty("dj.customer.botId", String.class,"");
String baseUrl = OrePropertyConfigurer.getProperty("dj.customer.groupUrl", String.class,"http://yjy.dev.glsx.com.cn/imhub/api/core/contacts");
String channel = OrePropertyConfigurer.getProperty("dj.customer.channel", String.class,"yjy_ww");
String url = baseUrl +
"?channel=" + channel +
"&bot_id=" + botId +
"&contact_type=ww_group_external" +
"&contact_name=" + request.getCustomerGroupParam() +
"&limit=10000" +
"&offset=0";
String result = HttpUtil.get(url);
ContactListDTO resultDTO = JSONUtil.toBean(result, ContactListDTO.class);
if (ObjectUtil.isNotEmpty(resultDTO)) {
List<ContactDTO> contacts = resultDTO.getContacts();
if (ObjectUtil.isNotEmpty(contacts)) {
if (contacts.size() > 1) {
return RopResponse.success(null);
}
ContactDTO contact = contacts.get(0);
return RopResponse.success(contact);
}
return RopResponse.success(null);
}
return RopResponse.success(null);
}
/**
* 获取群成员信息
*/
@ServiceMethod(method = "dj.api.smartcarlife.order.getCustomerGroupMemberInfo", needInSession = NeedInSessionType.YES)
@ApiOperation("获取群成员信息")
public RopResponse<List<ContactDTO>> getCustomerGroupMemberInfo(CustomerProfileInfoRequest request) {
// 1、先用 机器人id + 类型为企微外部群 + 名称:客户姓名 查询对应的群 存个多个怎么处理?
// 2、在通过 机器人id + 群id 搜索类型:群成员 通许录ID = "contact_id": "R:10976960540246131" 获取群成员列表
String botId = OrePropertyConfigurer.getProperty("dj.customer.botId", String.class,"");
String baseUrl = OrePropertyConfigurer.getProperty("dj.customer.groupUrl", String.class,"http://yjy.dev.glsx.com.cn/imhub/api/core/contacts");
String channel = OrePropertyConfigurer.getProperty("dj.customer.channel", String.class,"yjy_ww");
String url = baseUrl +
"?channel=" + channel +
"&bot_id=" + botId +
"&contact_type=group_member" +
"&contact_id=" + request.getQwGroupId() +
"&limit=10000" +
"&offset=0";
String result = HttpUtil.get(url);
ContactListDTO resultDTO = JSONUtil.toBean(result, ContactListDTO.class);
if (ObjectUtil.isNotEmpty(resultDTO)) {
List<ContactDTO> contacts = resultDTO.getContacts();
return RopResponse.success(contacts);
}
return RopResponse.success(null);
}
} }
...@@ -194,6 +194,12 @@ public class CustomerProfileInfoRequest extends AbstractRopRequest implements Se ...@@ -194,6 +194,12 @@ public class CustomerProfileInfoRequest extends AbstractRopRequest implements Se
private List<CustomerInviteRecord> inviteRecord; private List<CustomerInviteRecord> inviteRecord;
/** /**
* 客户群信息参数
*/
@ApiModelProperty(notes = "客户群信息参数")
private String customerGroupParam;
/**
* 分页参数 pageNum * 分页参数 pageNum
*/ */
@ApiModelProperty(notes = "分页参数 pageNum") @ApiModelProperty(notes = "分页参数 pageNum")
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!