Commit b5ca189c by zhouhaibao

代码提交

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