Merge remote-tracking branch 'hsayi/dev/feat/partner1.6_20231226' into dev/feat/partner1.6_20231226
This commit is contained in:
@@ -9,28 +9,33 @@ import com.alibaba.fastjson.JSONObject;
|
||||
*/
|
||||
public enum FeiShuNoticeMsgEnum {
|
||||
|
||||
common_notice("工作台通知", "{0}", "img_v2_45d7a901-1eab-498b-a760-b38d287f0c1g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
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", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
BATCH_TRANS_INVESTMENT_MANAGER("收到新线索", "有{0}条新线索于 {1} 转让给您,请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
EC_RECEIVE_LINE("收到EC新线索", "有{0}条新线索于EC同步给您,线索信息 {1},请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
INTENTION_APPLY("加盟意向申请", "您有一个【加盟意向申请】待审核,申请人 {0} 手机号 {1} 于 {2} 提交加盟意向申请,请及时处理", "img_v2_c909097d-67d1-4c11-a911-a2584b67ca6g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
FOLLOW_TASK("线索跟进任务", "{0}", "img_v2_1960b7ef-8c4e-4c3d-8b67-3d918a85578g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
INTERVIEW_APPOINTMENT("面试预约申请", "您有一个【面试预约申请】待处理,预约人 {0} 手机号 {1} ,预约面试时间 {2} ","img_v2_107bb06b-2a7a-43e1-a6ae-e5d2f2dae17g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
EXHIBITION_COLLABORATOR("会销协作通知", "{0} 已将您添加为【{1}】的会销协作人,日期为 {2},地点为“{3}” ","img_v2_107bb06b-2a7a-43e1-a6ae-e5d2f2dae17g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
PARTNER_SIGNUP_EXHIBITION("线索已报名会销", "您跟进的线索客户{0} {1} 已报名于 {2} 举办的【{3}】 ,地点为“{4}”","img_v2_107bb06b-2a7a-43e1-a6ae-e5d2f2dae17g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
common_notice("工作台通知", "{0}", "img_v2_45d7a901-1eab-498b-a760-b38d287f0c1g", "1567d83b966f2d312fd7fcd2e72dbce9", "/work/bench", ""),
|
||||
ALLOCATION_INVESTMENT_MANAGER("分配招商经理", "有新的线索于 {0} 分配给您,线索信息 {1} 手机号 {2},请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g", "1567d83b966f2d312fd7fcd2e72dbce9", "/work/bench", "/mobile"),
|
||||
TRANS_INVESTMENT_MANAGER("转让招商经理", "有新的线索于 {0} 转让给您,线索信息 {1} 手机号 {2},请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g", "1567d83b966f2d312fd7fcd2e72dbce9", "/work/bench", "/mobile"),
|
||||
BATCH_TRANS_INVESTMENT_MANAGER("收到新线索", "有{0}条新线索于 {1} 转让给您,请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g", "1567d83b966f2d312fd7fcd2e72dbce9", "/work/bench", "/mobile"),
|
||||
EC_RECEIVE_LINE("收到EC新线索", "有{0}条新线索于EC同步给您,线索信息 {1},请及时跟进", "img_v2_33296002-829e-490e-bd11-0d9ae763a67g", "1567d83b966f2d312fd7fcd2e72dbce9", "/work/bench", "/mobile"),
|
||||
INTENTION_APPLY("加盟意向申请", "您有一个【加盟意向申请】待审核,申请人 {0} 手机号 {1} 于 {2} 提交加盟意向申请,请及时处理", "img_v2_c909097d-67d1-4c11-a911-a2584b67ca6g", "1567d83b966f2d312fd7fcd2e72dbce9", "/work/bench", "/mobile"),
|
||||
FOLLOW_TASK("线索跟进任务", "{0}", "img_v2_1960b7ef-8c4e-4c3d-8b67-3d918a85578g", "1567d83b966f2d312fd7fcd2e72dbce9", "/work/bench", "/"),
|
||||
INTERVIEW_APPOINTMENT("面试预约申请", "您有一个【面试预约申请】待处理,预约人 {0} 手机号 {1} ,预约面试时间 {2} ","img_v2_107bb06b-2a7a-43e1-a6ae-e5d2f2dae17g", "1567d83b966f2d312fd7fcd2e72dbce9", "/work/bench", "/mobile"),
|
||||
EXHIBITION_COLLABORATOR("会销协作通知", "{0} 已将您添加为【{1}】的会销协作人,日期为 {2},地点为“{3}” ","img_v3_026c_d561bb71-f085-40ca-9c36-5fe134cacd2g", "1567d83b966f2d312fd7fcd2e72dbce9", "/joint-sales/manage-detail", "/mobile/joint-sales/manage-detail"),
|
||||
PARTNER_SIGNUP_EXHIBITION("线索已报名会销", "您跟进的线索客户{0} {1} 已报名于 {2} 举办的【{3}】 ,地点为“{4}”","img_v3_026c_5bcf178d-19e6-4445-9677-f748a3f916fg", "1567d83b966f2d312fd7fcd2e72dbce9", "/work/bench", "/mobile"),
|
||||
;
|
||||
|
||||
private String title;
|
||||
private String content;
|
||||
private String imageMediaId;
|
||||
private String templateCode;
|
||||
//卡片对应的跳转地址
|
||||
private String PCPath;
|
||||
private String mobilePath;
|
||||
|
||||
FeiShuNoticeMsgEnum(String title, String content, String imageMediaId, String templateCode) {
|
||||
FeiShuNoticeMsgEnum(String title, String content, String imageMediaId, String templateCode, String PCPath, String mobilePath) {
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.imageMediaId = imageMediaId;
|
||||
this.templateCode = templateCode;
|
||||
this.PCPath = PCPath;
|
||||
this.mobilePath = mobilePath;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
@@ -49,6 +54,14 @@ public enum FeiShuNoticeMsgEnum {
|
||||
return templateCode;
|
||||
}
|
||||
|
||||
public String getPCPath() {
|
||||
return PCPath;
|
||||
}
|
||||
|
||||
public String getMobilePath() {
|
||||
return mobilePath;
|
||||
}
|
||||
|
||||
public JSONObject getMessageObject() {
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("name", this.title);
|
||||
|
||||
@@ -11,7 +11,6 @@ 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.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -21,6 +20,7 @@ import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/10/23 10:01
|
||||
@@ -76,19 +76,24 @@ public class EventCenterHttpRequest {
|
||||
* 发送飞书通知
|
||||
* @param msgEnum {@link com.cool.store.enums.FeiShuNoticeMsgEnum}
|
||||
* @param receiverIds 接收者 id,飞书为 user_id,不是 open_id
|
||||
* @param objects 消息参数,飞书消息卡片为 参数名:参数
|
||||
* @param objects 消息参数,飞书消息卡片为 参数名:参数,若路径跳转需要路径参数,也一起包含在里面
|
||||
*/
|
||||
@Async
|
||||
public void sendFeiShuNotice(FeiShuNoticeMsgEnum msgEnum, List<String> receiverIds, Object... objects) throws ApiException {
|
||||
//1. 组织消息参数,SendMsgRequest 的 cardParams,需要填入的参数为模板中 ${} 中的参数
|
||||
HashMap<String, String> cardParams = new HashMap<>();
|
||||
String PCPath = msgEnum.getPCPath();
|
||||
String mobilePath = msgEnum.getMobilePath();
|
||||
String pathVariable = getPathVariable(msgEnum, objects);
|
||||
String PCWholePath = PCLinkUrl + PCPath + pathVariable;
|
||||
String mobileWholePath = mobileLinkUrl + mobilePath + pathVariable;
|
||||
cardParams.put("title", msgEnum.getTitle());
|
||||
cardParams.put("content", MessageFormat.format(msgEnum.getContent(),objects));
|
||||
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);
|
||||
cardParams.put("common_url", PCWholePath);
|
||||
cardParams.put("pc_url", PCWholePath);
|
||||
cardParams.put("ios_url", mobileWholePath);
|
||||
cardParams.put("android_url", mobileWholePath);
|
||||
|
||||
//2. 组织消息发送请求体,即 CreateSingleEventRequest 的 content 字段
|
||||
SendMsgRequest sendFeiShuMsgRequest = SendMsgRequest.builder()
|
||||
@@ -144,4 +149,13 @@ public class EventCenterHttpRequest {
|
||||
createSingleEvent(createEventRequest);
|
||||
}
|
||||
|
||||
private String getPathVariable(FeiShuNoticeMsgEnum msgEnum, Object... objects) {
|
||||
String pathVariable = "";
|
||||
if (Objects.requireNonNull(msgEnum) == FeiShuNoticeMsgEnum.EXHIBITION_COLLABORATOR) {
|
||||
pathVariable = "?id=" + objects[0];
|
||||
System.arraycopy(objects, 1, objects, 0, objects.length - 1);
|
||||
}
|
||||
return pathVariable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.constants.MessageConstants;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.log.BlackListLogDTO;
|
||||
import com.cool.store.dto.log.LineLogInfo;
|
||||
|
||||
@@ -843,7 +843,7 @@ public class ExhibitionServiceImpl implements ExhibitionService {
|
||||
List<String> userIds = exhibitionDTO.getCollaborators().stream().map(CollaboratorDTO::getCollaborateId).collect(Collectors.toList());
|
||||
List<String> userIdsByUserIds = enterpriseUserDAO.getFeishuUserIdListByUserIds(userIds);
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.EXHIBITION_COLLABORATOR, userIdsByUserIds,userInfo.getName(),
|
||||
exhibitionDTO.getExhibitionName(),exhibitionDTO.getStartDate(),exhibitionDTO.getLocation());
|
||||
exhibitionDTO.getId(),exhibitionDTO.getExhibitionName(),exhibitionDTO.getStartDate(),exhibitionDTO.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,27 +31,29 @@ public class EventRequestTest extends AbstractJUnit4SpringContextTests {
|
||||
@Test
|
||||
public void testSendFeiShuNotice() throws ApiException {
|
||||
//招商企业
|
||||
//eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.common_notice, Arrays.asList("9818f98c"), "测试");
|
||||
//eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.common_notice, Arrays.asList("34f4a9ga"), "测试");
|
||||
//任务中枢企业
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.ALLOCATION_INVESTMENT_MANAGER, Arrays.asList("661c6cfg"), "2023-10-24 10:09:04", "测试", "1008611");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeishuNotice() throws ApiException {
|
||||
//1. 工作台通知
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.common_notice, Arrays.asList("9818f98c"), "测试");
|
||||
//2. 分配招商经理
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.ALLOCATION_INVESTMENT_MANAGER, Arrays.asList("9818f98c"), "2011-11-11 11:11:11", "测试", "1008611");
|
||||
//3. 转让招商经理
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.TRANS_INVESTMENT_MANAGER, Arrays.asList("9818f98c"), "2011-11-11 11:11:11", "测试", "1008611");
|
||||
//4. 收到新线索
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.BATCH_TRANS_INVESTMENT_MANAGER, Arrays.asList("9818f98c"), "1", "2023-10-24 16:40:07");
|
||||
//5. 加盟意向申请
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.INTENTION_APPLY, Arrays.asList("9818f98c"), "测试", "1008611", "2023-10-24 16:40:07");
|
||||
//6. 线索跟进任务
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.FOLLOW_TASK, Arrays.asList("9818f98c"), "测试线索跟进任务");
|
||||
//7. 面试预约申请
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.INTERVIEW_APPOINTMENT, Arrays.asList("9818f98c"), "测试", "1008611", "2023-10-24 16:40:07");
|
||||
// //1. 工作台通知
|
||||
// eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.common_notice, Arrays.asList("34f4a9ga"), "测试");
|
||||
// //2. 分配招商经理
|
||||
// eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.ALLOCATION_INVESTMENT_MANAGER, Arrays.asList("34f4a9ga"), "2011-11-11 11:11:11", "测试", "1008611");
|
||||
// //3. 转让招商经理
|
||||
// eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.TRANS_INVESTMENT_MANAGER, Arrays.asList("34f4a9ga"), "2011-11-11 11:11:11", "测试", "1008611");
|
||||
// //4. 收到新线索
|
||||
// eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.BATCH_TRANS_INVESTMENT_MANAGER, Arrays.asList("34f4a9ga"), "1", "2023-10-24 16:40:07");
|
||||
// //5. 加盟意向申请
|
||||
// eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.INTENTION_APPLY, Arrays.asList("34f4a9ga"), "测试", "1008611", "2023-10-24 16:40:07");
|
||||
// //6. 线索跟进任务
|
||||
// eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.FOLLOW_TASK, Arrays.asList("34f4a9ga"), "测试线索跟进任务");
|
||||
// //7. 面试预约申请
|
||||
// eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.INTERVIEW_APPOINTMENT, Arrays.asList("34f4a9ga"), "测试", "1008611", "2023-10-24 16:40:07");
|
||||
//8. 会销协作通知
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.EXHIBITION_COLLABORATOR, Arrays.asList("34f4a9ga"), "6", "老大", "会销", "2023-12-31", "系东方大酒店");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user