Merge remote-tracking branch 'origin/dev/feat/partner1.5_20231106' into dev/feat/partner1.5_20231106
This commit is contained in:
@@ -9,23 +9,25 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
*/
|
*/
|
||||||
public enum FeiShuNoticeMsgEnum {
|
public enum FeiShuNoticeMsgEnum {
|
||||||
|
|
||||||
common_notice("工作台通知", "{0}", "img_v2_45d7a901-1eab-498b-a760-b38d287f0c1g"),
|
common_notice("工作台通知", "{0}", "img_v2_45d7a901-1eab-498b-a760-b38d287f0c1g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||||
ALLOCATION_INVESTMENT_MANAGER("分配招商经理", "有新的线索于 {0} 分配给您,线索信息 {1} 手机号 {2},请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g"),
|
ALLOCATION_INVESTMENT_MANAGER("分配招商经理", "有新的线索于 {0} 分配给您,线索信息 {1} 手机号 {2},请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||||
TRANS_INVESTMENT_MANAGER("转让招商经理", "有新的线索于 {0} 转让给您,线索信息 {1} 手机号 {2},请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g"),
|
TRANS_INVESTMENT_MANAGER("转让招商经理", "有新的线索于 {0} 转让给您,线索信息 {1} 手机号 {2},请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||||
BATCH_TRANS_INVESTMENT_MANAGER("收到新线索", "有{0}条新线索于 {1} 转让给您,请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g"),
|
BATCH_TRANS_INVESTMENT_MANAGER("收到新线索", "有{0}条新线索于 {1} 转让给您,请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||||
INTENTION_APPLY("加盟意向申请", "您有一个【加盟意向申请】待审核,申请人 {0} 手机号 {1} 于 {2} 提交加盟意向申请,请及时处理", "img_v2_c909097d-67d1-4c11-a911-a2584b67ca6g"),
|
INTENTION_APPLY("加盟意向申请", "您有一个【加盟意向申请】待审核,申请人 {0} 手机号 {1} 于 {2} 提交加盟意向申请,请及时处理", "img_v2_c909097d-67d1-4c11-a911-a2584b67ca6g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||||
FOLLOW_TASK("线索跟进任务", "{0}", "img_v2_1960b7ef-8c4e-4c3d-8b67-3d918a85578g"),
|
FOLLOW_TASK("线索跟进任务", "{0}", "img_v2_1960b7ef-8c4e-4c3d-8b67-3d918a85578g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||||
INTERVIEW_APPOINTMENT("面试预约申请", "您有一个【面试预约申请】待处理,预约人 {0} 手机号 {1} ,预约面试时间 {2} ","img_v2_107bb06b-2a7a-43e1-a6ae-e5d2f2dae17g"),
|
INTERVIEW_APPOINTMENT("面试预约申请", "您有一个【面试预约申请】待处理,预约人 {0} 手机号 {1} ,预约面试时间 {2} ","img_v2_107bb06b-2a7a-43e1-a6ae-e5d2f2dae17g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||||
;
|
;
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
private String content;
|
private String content;
|
||||||
private String imageMediaId;
|
private String imageMediaId;
|
||||||
|
private String templateCode;
|
||||||
|
|
||||||
FeiShuNoticeMsgEnum(String title, String content, String imageMediaId) {
|
FeiShuNoticeMsgEnum(String title, String content, String imageMediaId, String templateCode) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.content = content;
|
this.content = content;
|
||||||
this.imageMediaId = imageMediaId;
|
this.imageMediaId = imageMediaId;
|
||||||
|
this.templateCode = templateCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
@@ -40,6 +42,10 @@ public enum FeiShuNoticeMsgEnum {
|
|||||||
return imageMediaId;
|
return imageMediaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTemplateCode() {
|
||||||
|
return templateCode;
|
||||||
|
}
|
||||||
|
|
||||||
public JSONObject getMessageObject() {
|
public JSONObject getMessageObject() {
|
||||||
JSONObject object = new JSONObject();
|
JSONObject object = new JSONObject();
|
||||||
object.put("name", this.title);
|
object.put("name", this.title);
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ public class CreateQualifyVerifyReq {
|
|||||||
@ApiModelProperty(value = "加盟商类型", required = true)
|
@ApiModelProperty(value = "加盟商类型", required = true)
|
||||||
private KeyText fraType;
|
private KeyText fraType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "加盟类型", required = true, allowableValues = "1: {StandardStore: 4.0标准版店铺} 2: {LiteEditionStore: 轻享版店铺}")
|
||||||
|
private KeyText franchiseType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "请求来源", required = true)
|
@ApiModelProperty(value = "请求来源", required = true)
|
||||||
private KeyText fraSource;
|
private KeyText fraSource;
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ public class RpcCreateQualifyVerifyReq {
|
|||||||
@ApiModelProperty(value = "加盟商类型", required = true)
|
@ApiModelProperty(value = "加盟商类型", required = true)
|
||||||
private KeyText fraType;
|
private KeyText fraType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "加盟类型", required = true, allowableValues = "1: {StandardStore: 4.0标准版店铺} 2: {LiteEditionStore: 轻享版店铺}")
|
||||||
|
private KeyText franchiseType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "意向人email", required = true)
|
@ApiModelProperty(value = "意向人email", required = true)
|
||||||
private String intendedEmail;
|
private String intendedEmail;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.cool.store.request.event;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Fun Li 2023/10/23 10:41
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class CreateSingleEventRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件 id
|
||||||
|
*/
|
||||||
|
private String thirdPartyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统来源
|
||||||
|
*/
|
||||||
|
private String bizSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件类型
|
||||||
|
*/
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件请求内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件主题,可选
|
||||||
|
*/
|
||||||
|
private String subject;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.cool.store.request.event;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Fun Li 2023/10/23 11:27
|
||||||
|
* @version 1.0
|
||||||
|
* 携带消息参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class SendMsgRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息参数,短信为 手机号:参数1,参数2 (按顺序),飞书消息卡片为 参数名:参数
|
||||||
|
*/
|
||||||
|
private Map<String, String> cardParams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FEISHU 或者 SHORT_MESSAGE
|
||||||
|
*/
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收者 id,飞书为 user_id,不是 open_id,短信不填
|
||||||
|
*/
|
||||||
|
private List<String> receiverIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加盟商全生命周期只发送这种类型的消息
|
||||||
|
*/
|
||||||
|
private final String msgType = "INTERACTIVE_CARD";
|
||||||
|
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加盟商全生命周期只给个人发送消息
|
||||||
|
*/
|
||||||
|
private final String receiverType = "INDIVIDUAL";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.cool.store.response.event;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Fun Li 2023/10/23 10:29
|
||||||
|
* @version 1.0
|
||||||
|
* 使用沪上阿姨事件中心创建事件的响应体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CreateEventResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求 ID
|
||||||
|
*/
|
||||||
|
private String requestId;
|
||||||
|
|
||||||
|
private String resourceOwnerAccountId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败次数
|
||||||
|
*/
|
||||||
|
private Integer failedEntryCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件请求列表
|
||||||
|
*/
|
||||||
|
private List<EventEntry> entryList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应码,200 为成功
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应信息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
private static class EventEntry {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件 id
|
||||||
|
*/
|
||||||
|
private String eventId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易 id
|
||||||
|
*/
|
||||||
|
private String traceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败 code
|
||||||
|
*/
|
||||||
|
private Integer errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败信息
|
||||||
|
*/
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.cool.store.http;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.cool.store.enums.FeiShuNoticeMsgEnum;
|
||||||
|
import com.cool.store.exception.ApiException;
|
||||||
|
import com.cool.store.mq.util.HttpRestTemplateService;
|
||||||
|
import com.cool.store.request.event.CreateSingleEventRequest;
|
||||||
|
import com.cool.store.request.event.SendMsgRequest;
|
||||||
|
import com.cool.store.response.event.CreateEventResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Fun Li 2023/10/23 10:01
|
||||||
|
* @version 1.0
|
||||||
|
* 对接沪上阿姨事件中心
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class EventCenterHttpRequest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private HttpRestTemplateService httpRestTemplateService;
|
||||||
|
|
||||||
|
@Value("${hsay.event.url}")
|
||||||
|
private String eventUrl;
|
||||||
|
|
||||||
|
@Value("${feishu.notice.link.url}")
|
||||||
|
private String PCLinkUrl;
|
||||||
|
|
||||||
|
@Value("${feishu.notice.link.url.mobile}")
|
||||||
|
private String mobileLinkUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本系统来源
|
||||||
|
*/
|
||||||
|
private final static String source = "hsay_partner";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建单个事件
|
||||||
|
* @param request {@link com.cool.store.request.event.CreateSingleEventRequest}
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private CreateEventResponse createSingleEvent(CreateSingleEventRequest request) throws ApiException {
|
||||||
|
CreateEventResponse response = httpRestTemplateService.postForObject(eventUrl + "/event/create", request, CreateEventResponse.class);
|
||||||
|
log.info("创建沪上阿姨事件中心事件,request: {}, response: {}", JSON.toJSONString(request), JSON.toJSONString(response));
|
||||||
|
if (response.getCode() != 200) {
|
||||||
|
throw new ApiException("创建事件失败!");
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendFeiShuCardMessage(FeiShuNoticeMsgEnum msgEnum, List<String> receiverIds) throws ApiException {
|
||||||
|
//1. 组织消息参数,SendMsgRequest 的 cardParams
|
||||||
|
HashMap<String, String> cardParams = new HashMap<>();
|
||||||
|
cardParams.put("title", msgEnum.getTitle());
|
||||||
|
cardParams.put("content", msgEnum.getContent());
|
||||||
|
cardParams.put("img_key", msgEnum.getImageMediaId());
|
||||||
|
cardParams.put("common_url", PCLinkUrl);
|
||||||
|
cardParams.put("pc_url", PCLinkUrl);
|
||||||
|
cardParams.put("ios_url", mobileLinkUrl);
|
||||||
|
cardParams.put("android_url", mobileLinkUrl);
|
||||||
|
|
||||||
|
//2. 组织消息发送请求体,即 CreateSingleEventRequest 的 content 字段
|
||||||
|
SendMsgRequest sendFeiShuMsgRequest = SendMsgRequest.builder()
|
||||||
|
.receiverIds(receiverIds)
|
||||||
|
.platform("FEISHU")
|
||||||
|
.templateId(msgEnum.getTemplateCode())
|
||||||
|
.cardParams(cardParams)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
//3. 组织创建事件参数
|
||||||
|
String randomNum = RandomUtil.randomNumbers(32);
|
||||||
|
CreateSingleEventRequest createEventRequest = CreateSingleEventRequest.builder()
|
||||||
|
.thirdPartyId(randomNum)
|
||||||
|
.eventType("push_msg")
|
||||||
|
.bizSource("hsay_partner")
|
||||||
|
.content(JSON.toJSONString(sendFeiShuMsgRequest))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
//4. 创建事件
|
||||||
|
createSingleEvent(createEventRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user