Commit b5ca189c by zhouhaibao

代码提交

1 parent 4f4f4d42
......@@ -55,9 +55,7 @@ public class SopHelper {
private final static String secret = "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b";
private final static String baseurl = "http://scrm.dev.glsx.com.cn/rop-scrm-stoassistant/router";
private final static String getOneIdsByTagMethod = "scrm.api.sop.marketing.task.customer";
private final static String getOneIdsByTagMethod = "scrm.api.datahub.user.queryOneIdListByLabel";
public static boolean lockInst(SopInst inst) {
String key = SOP_INST_LOCK_NAMESPACE + inst.getInstId();
......@@ -125,7 +123,7 @@ public class SopHelper {
// 拿到过滤出阶段的客户
List<CustomerInfo> customerInfoList = JSON.parseArray(JSON.toJSONString(resultData.get(key)), CustomerInfo.class);
String diffday = SopHelper.getValueFromJsonString(nodeParam, "day");
String label = SopHelper.getValueFromJsonString(nodeParam, "label");
String label = SopHelper.getListValueFromJsonString(nodeParam, "dataTag");
if (org.apache.commons.lang3.StringUtils.isEmpty(diffday)) {
return null;
}
......@@ -173,7 +171,7 @@ public class SopHelper {
}
}
try {
RopResponse ropResponse = post(params, RopResponse.class, baseurl, getOneIdsByTagMethod);
RopResponse ropResponse = post(params, RopResponse.class, ConfigUtils.getProperty("scrm.data.baseurl"), getOneIdsByTagMethod);
if (("0").equals(ropResponse.getCode())) {
Page<String> getOneIdsByGroupIdList = new Page<String>();
getOneIdsByGroupIdList = converRopPage(ropResponse);
......
......@@ -55,32 +55,38 @@ public class ControllerSendMessageDemo {
Iterator<Entry<String, List<CustomerInfo>>> iterator = collect.entrySet().iterator();
CustomerTouchModel customerTouchModel = new CustomerTouchModel();
while (iterator.hasNext()) {
List<SopTaskExecuteStaffModel> sopTaskExecuteStaffModels=new ArrayList<>();
customerTouchModel.setSendType(Integer.parseInt(sendType));
List<SopTaskExecuteStaffModel> sopTaskExecuteStaffModels = new ArrayList<>();
Entry<String, List<CustomerInfo>> next = iterator.next();
String key = next.getKey();
List<CustomerInfo> value = next.getValue();
switch (sendType) {
case "1":
buildMessageParam(customerTouchModel, value, nodeParam, sopInst, sopInstNode,sopTaskExecuteStaffModels);
case "10":
buildMessageParam(customerTouchModel, value, nodeParam, sopInst, sopInstNode,
sopTaskExecuteStaffModels);
customerTouchModel.setSendType(1);
break;
case "2":
buildMassParam(customerTouchModel, key, value, nodeParam, sopInst, sopInstNode,sopTaskExecuteStaffModels);
case "8":
buildMassParam(customerTouchModel, key, value, nodeParam, sopInst, sopInstNode,
sopTaskExecuteStaffModels);
customerTouchModel.setChatType("single");
customerTouchModel.setSendType(2);
break;
case "3":
buildMassParam(customerTouchModel, key, value, nodeParam, sopInst, sopInstNode,sopTaskExecuteStaffModels);
case "9":
buildMassParam(customerTouchModel, key, value, nodeParam, sopInst, sopInstNode,
sopTaskExecuteStaffModels);
customerTouchModel.setSendType(3);
break;
default:
break;
}
}
RestTemplate restTemplate = new RestTemplate();
System.out.println("发送消息参数"+JSONObject.toJSONString(customerTouchModel));
System.out.println("发送消息参数" + JSONObject.toJSONString(customerTouchModel));
post = restTemplate.postForObject(ConfigUtils.getProperty("sop.baseurl") + sendCustomerUrl,
customerTouchModel, Object.class);
System.out.println("发送消息参数结果" + JSONObject.toJSONString(post));
return (JSONObject) JSONObject.toJSON(collect);
}
return (JSONObject) JSONObject.toJSON(post);
}
return null;
}
......@@ -105,7 +111,7 @@ public class ControllerSendMessageDemo {
.filter(index -> StringUtils.isNotEmpty(index.getCustomerPhone()))
.map(CustomerInfo::getExternalUserId).collect(
Collectors.toList());
SopTaskExecuteStaffModel sopTaskExecuteStaffModel=new SopTaskExecuteStaffModel();
SopTaskExecuteStaffModel sopTaskExecuteStaffModel = new SopTaskExecuteStaffModel();
sopTaskExecuteStaffModel.setSendExternalUserId(collect);
sopTaskExecuteStaffModel.setSendUserId(key);
sopTaskExecuteStaffModels.add(sopTaskExecuteStaffModel);
......@@ -115,17 +121,37 @@ public class ControllerSendMessageDemo {
private static void buildDefaultParam(CustomerTouchModel customerTouchModel, SopInst sopInst,
SopInstNode sopInstNode, String nodeParam,
List<SopTaskExecuteStaffModel> sopTaskExecuteStaffModels) {
String contentlists = SopHelper.getListValueFromJsonString(nodeParam, "contentlists");
String taskParam = SopHelper.getListValueFromJsonString(nodeParam, "taskParam");
String contentlists = SopHelper.getListValueFromJsonString(taskParam, "attachments");
customerTouchModel.setInstId(sopInst.getInstId());
customerTouchModel.setNodeId(sopInstNode.getNodeId());
customerTouchModel.setContentList(JSONObject.parseArray(contentlists,
CustomerTouchSourceModel.class));
String supMerchantNo = SopHelper.getValueFromJsonString(sopInst.getInstParam(), "supMerchantNo");
String supMerchantNo = SopHelper.getValueFromJsonString(sopInst.getInstParam(),
"supMerchantNo");
String merchantId = SopHelper.getValueFromJsonString(sopInst.getInstParam(), "merchantId");
customerTouchModel.setMerchantId(Integer.parseInt(merchantId));
setConverContentList(contentlists, customerTouchModel, sopInst.getInstId(),
sopInstNode.getNodeId(), merchantId);
customerTouchModel.setSupMerchantNo(Integer.parseInt(supMerchantNo));
}
private static void setConverContentList(String contentlists,
CustomerTouchModel customerTouchModel, String instId, Integer nodeId, String merchantId) {
List<CustomerTouchSourceModel> customerTouchSourceModels = JSONObject.parseArray(contentlists,
CustomerTouchSourceModel.class);
if (CollectionUtils.isNotEmpty(customerTouchSourceModels)) {
for (CustomerTouchSourceModel customerTouchSourceModel : customerTouchSourceModels) {
Integer attType = customerTouchSourceModel.getAttType();
if (4 == attType.intValue()) {
String attContent = customerTouchSourceModel.getAttContent();
String replace = attContent.replace("{1}", merchantId).replace("{2}", nodeId + "")
.replace("{3}", instId);
customerTouchSourceModel.setAttContent(replace);
}
}
}
customerTouchModel.setContentList(customerTouchSourceModels);
}
/**
* 构建短信参数
*
......@@ -139,7 +165,8 @@ public class ControllerSendMessageDemo {
private static void buildMessageParam(CustomerTouchModel customerTouchModel,
List<CustomerInfo> value, String nodeParam, SopInst sopInst, SopInstNode sopInstNode,
List<SopTaskExecuteStaffModel> sopTaskExecuteStaffModels) {
buildDefaultParam(customerTouchModel, sopInst, sopInstNode, nodeParam,sopTaskExecuteStaffModels);
buildDefaultParam(customerTouchModel, sopInst, sopInstNode, nodeParam,
sopTaskExecuteStaffModels);
List<String> phones = value.stream()
.filter(index -> StringUtils.isNotEmpty(index.getCustomerPhone()))
.map(CustomerInfo::getCustomerPhone).collect(
......
......@@ -54,12 +54,12 @@ public class ControllerSendRemindDemo {
List<String> filterUserList = null;
// 获取营销类型 发送提醒
String sendType = SopHelper.getValueFromJsonString(nodeParam, "taskType");
String userIds = SopHelper.getValueFromJsonString(nodeParam, "userIds");
String taskParam = SopHelper.getListValueFromJsonString(nodeParam, "taskParam");
String userIds = SopHelper.getValueFromJsonString(taskParam, "staffUserIds");
if (StringUtils.isNotEmpty(userIds)) {
filterUserList = Arrays.asList(userIds.split(","));
}
if (StringUtils.isNotEmpty(sendType)) {
List<CustomerTouchModel> customerTouchModels = new ArrayList<>();
Map<String, List<CustomerInfo>> collect = customerInfoList.stream()
.collect(Collectors.groupingBy(CustomerInfo::getUserId));
Iterator<Entry<String, List<CustomerInfo>>> iterator = collect.entrySet().iterator();
......@@ -87,6 +87,7 @@ public class ControllerSendRemindDemo {
RestTemplate restTemplate = new RestTemplate();
System.out.println("发送提醒参数"+JSONObject.toJSONString(customerTouchModel));
post = restTemplate.postForObject(ConfigUtils.getProperty("sop.baseurl")+sendStaffUrl, customerTouchModel, Object.class);
System.out.println("发送提醒参数结果"+JSONObject.toJSONString(customerTouchModel));
return (JSONObject) JSONObject.toJSON(collect);
}
}
......@@ -105,7 +106,8 @@ public class ControllerSendRemindDemo {
*/
private static void buildDefaultParam(SopTaskToStaffExecuteModel customerTouchModel, SopInst sopInst,
SopInstNode sopInstNode, String nodeParam, String notebatchNo, String batchNo) {
String noticeContent = SopHelper.getValueFromJsonString(nodeParam, "noticeContent");
String taskParam = SopHelper.getListValueFromJsonString(nodeParam, "taskParam");
String noticeContent = SopHelper.getValueFromJsonString(taskParam, "content");
SopTaskExecuteStaffModel sopTaskExecuteStaffModel = customerTouchModel.getExecuteStaffRequestList()
.get(0);
int size = sopTaskExecuteStaffModel.getSendExternalUserId().size();
......
scrm.baseurl=http://scrm.dev.glsx.com.cn
scrm.data.baseurl=http://scrm.dev.glsx.com.cn/rop-scrm-datahub/router
sop.baseurl=http://192.168.3.122:9821
notict.url=http://xxxxxxx
\ No newline at end of file
notict.url=http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-attachment-customer/#/task
\ No newline at end of file
scrm.baseurl=http://scrm.test.glsx.com.cn
sop.baseurl=http://gateway.platform.test.glsx.com.cn
\ No newline at end of file
sop.baseurl=http://gateway.platform.test.glsx.com.cn
notict.url=http://scrm.test.glsx.com.cn/dj-scrm-wx-work-attachment-customer/#/task
scrm.data.baseurl=http://scrm.test.glsx.com.cn/rop-scrm-datahub/router
\ No newline at end of file
......@@ -160,7 +160,7 @@ public class JavaNodeTestApplication {
customerInfo.setExternalUserId("wm-ZewEAAA22dA72qtla54HxDPHBQfcg");
customerInfo.setUserId("wo-ZewEAAA3Ew-zJPQGZHxsU48lRzw-w");
customerInfo.setSopJourneyStage("潜客");
customerInfo.setSopJourneyStageEnterTime(DateUtils.parse("2023-12-27"));
customerInfo.setSopJourneyStageEnterTime(DateUtils.parse("2024-01-02"));
resultData.put("user1", Arrays.asList(customerInfo));
SopStruct sopStruct = sopService.loadSop("xblc7");
SopInstNode sopInstNode = sopStruct.getInstNodeMap().get(3);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!