|
@@ -413,12 +413,14 @@ public class TbServiceImpl implements TBService {
|
|
|
JSONObject fileObject = resultArray.getJSONObject(i);//新下载地址
|
|
JSONObject fileObject = resultArray.getJSONObject(i);//新下载地址
|
|
|
String downloadUrl1 = fileObject.getString("downloadUrl");
|
|
String downloadUrl1 = fileObject.getString("downloadUrl");
|
|
|
long millisTimestamp = System.currentTimeMillis();//当前时间戳
|
|
long millisTimestamp = System.currentTimeMillis();//当前时间戳
|
|
|
- String fileName = millisTimestamp + "_" + fileObject.getString("fileName");
|
|
|
|
|
|
|
+// String fileName = millisTimestamp + "_" + fileObject.getString("fileName");//去掉了时间戳
|
|
|
|
|
+ String fileName = fileObject.getString("fileName");
|
|
|
try{
|
|
try{
|
|
|
String savePath = downloadFile(downloadUrl1,basedir,fileName);//TODO;存储图片至file目录下
|
|
String savePath = downloadFile(downloadUrl1,basedir,fileName);//TODO;存储图片至file目录下
|
|
|
successDownloads.add(fileName + "->" + savePath);
|
|
successDownloads.add(fileName + "->" + savePath);
|
|
|
System.out.println("文件存储成功["+i+"]=====>"+fileName+"保存路径:"+savePath);
|
|
System.out.println("文件存储成功["+i+"]=====>"+fileName+"保存路径:"+savePath);
|
|
|
- String newsavepath = "http://ounuo.raresoft.net:7880/file/"+fileName;
|
|
|
|
|
|
|
+// String newsavepath = "http://ounuo.raresoft.net:7880/file/"+fileName;
|
|
|
|
|
+ String newsavepath = "http://192.168.22.152:7880/file/"+fileName;//换成欧诺公司内部的访问地址
|
|
|
newdownloadUrls.add(newsavepath);
|
|
newdownloadUrls.add(newsavepath);
|
|
|
}catch (IOException e){
|
|
}catch (IOException e){
|
|
|
faileDownloads.add(fileName+"->"+e.getMessage());
|
|
faileDownloads.add(fileName+"->"+e.getMessage());
|
|
@@ -453,6 +455,8 @@ public class TbServiceImpl implements TBService {
|
|
|
cardData.put("name_customer", customerName);
|
|
cardData.put("name_customer", customerName);
|
|
|
cardData.put("arr_picture", valueAsString);//todo:里面的每个需要转成jsonString类型
|
|
cardData.put("arr_picture", valueAsString);//todo:里面的每个需要转成jsonString类型
|
|
|
cardData.put("link","https://www.teambition.com/project/6878b323386fac7ab9dbe5e9/tasks/view/6878b323cc336006f34d1d22/task/"+taskId);
|
|
cardData.put("link","https://www.teambition.com/project/6878b323386fac7ab9dbe5e9/tasks/view/6878b323cc336006f34d1d22/task/"+taskId);
|
|
|
|
|
+ cardData.put("picture_link",generateHtmlLinks(valueAsString));
|
|
|
|
|
+
|
|
|
JSONObject message = new JSONObject();
|
|
JSONObject message = new JSONObject();
|
|
|
message.put("cardData", cardData);
|
|
message.put("cardData", cardData);
|
|
|
message.put("outTrackId", String.valueOf(System.currentTimeMillis()));
|
|
message.put("outTrackId", String.valueOf(System.currentTimeMillis()));
|
|
@@ -473,8 +477,8 @@ public class TbServiceImpl implements TBService {
|
|
|
}else if("鲁萍".equals(businessManager)){
|
|
}else if("鲁萍".equals(businessManager)){
|
|
|
message.put("openSpaceId","dtv1.card//IM_GROUP.cidibXgbOJLBc5L8xHNRzo5Jg==");
|
|
message.put("openSpaceId","dtv1.card//IM_GROUP.cidibXgbOJLBc5L8xHNRzo5Jg==");
|
|
|
}
|
|
}
|
|
|
-// message.put("openSpaceId", "dtv1.card//IM_GROUP.cidTppONwRCrkshRlCt28O+NA==");//正式群id:cidTppONwRCrkshRlCt28O+NA== 测试群id:cidKoVDKhvynnj+73h0uxSJBA==
|
|
|
|
|
- message.put("cardTemplateId", "160b26bf-d699-49fc-a6dc-9cd20eed7750.schema");
|
|
|
|
|
|
|
+// message.put("openSpaceId", "dtv1.card//IM_GROUP.cidKoVDKhvynnj+73h0uxSJBA==");//正式群id:cidTppONwRCrkshRlCt28O+NA== 测试群id:cidKoVDKhvynnj+73h0uxSJBA==
|
|
|
|
|
+ message.put("cardTemplateId", "7c91d56c-5dee-4294-88a5-f68238854030.schema");//160b26bf-d699-49fc-a6dc-9cd20eed7750.schema
|
|
|
message.put("robotCode", "dinghhozexm92tupobfo");
|
|
message.put("robotCode", "dinghhozexm92tupobfo");
|
|
|
// message.put("link","https://www.teambition.com/project/6878b323386fac7ab9dbe5e9/tasks/view/6878b323cc336006f34d1d22/task/" + taskId);
|
|
// message.put("link","https://www.teambition.com/project/6878b323386fac7ab9dbe5e9/tasks/view/6878b323cc336006f34d1d22/task/" + taskId);
|
|
|
createAndDeliverCard(message);//调用卡片推送
|
|
createAndDeliverCard(message);//调用卡片推送
|
|
@@ -811,12 +815,27 @@ public class TbServiceImpl implements TBService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private DDClient_Extension ddClientExtension;
|
|
private DDClient_Extension ddClientExtension;
|
|
|
/*群消息卡片推送*/
|
|
/*群消息卡片推送*/
|
|
|
|
|
+ @SneakyThrows
|
|
|
public McR createAndDeliverCard(@RequestBody JSONObject param){
|
|
public McR createAndDeliverCard(@RequestBody JSONObject param){
|
|
|
log.info("推送消息:{}",param);
|
|
log.info("推送消息:{}",param);
|
|
|
McException.assertParamException_Null(param,"cardData","outTrackId","openSpaceId","robotCode","cardTemplateId");
|
|
McException.assertParamException_Null(param,"cardData","outTrackId","openSpaceId","robotCode","cardTemplateId");
|
|
|
Map<String,Object> data = new HashMap();
|
|
Map<String,Object> data = new HashMap();
|
|
|
data.put("imGroupOpenDeliverModel", UtilMap.map("robotCode",param.getString("robotCode")));
|
|
data.put("imGroupOpenDeliverModel", UtilMap.map("robotCode",param.getString("robotCode")));
|
|
|
- data.put("imGroupOpenSpaceModel",UtilMap.map("supportForward",true));
|
|
|
|
|
|
|
+ /*卡片支持群搜索*/
|
|
|
|
|
+ HashMap<String, Object> searchSupport = new HashMap<>();
|
|
|
|
|
+ searchSupport.put("searchTypeName","群卡片");
|
|
|
|
|
+ String cardData = param.getString("cardData");
|
|
|
|
|
+ // 1. 提取 JSON 部分(从第一个 '{' 到最后一个 '}')
|
|
|
|
|
+ int start = cardData.indexOf('{');
|
|
|
|
|
+ int end = cardData.lastIndexOf('}');
|
|
|
|
|
+ String jsonStr = cardData.substring(start, end + 1);
|
|
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
+ JsonNode node = mapper.readTree(jsonStr);
|
|
|
|
|
+ String nameTask = node.get("name_task").asText(); // "20260508测试"
|
|
|
|
|
+ String nameCustomer = node.get("name_customer").asText(); // "客户A"
|
|
|
|
|
+ String namePerson = node.get("name_person").asText(); // "鲜明阳,牧之"
|
|
|
|
|
+ searchSupport.put("searchDesc",nameTask + nameCustomer + namePerson);
|
|
|
|
|
+ data.put("imGroupOpenSpaceModel",UtilMap.map("supportForward, searchSupport",true,searchSupport));//增加查询条件
|
|
|
if(param.containsKey("extInfo")){
|
|
if(param.containsKey("extInfo")){
|
|
|
data.putAll(param.getJSONObject("extInfo"));
|
|
data.putAll(param.getJSONObject("extInfo"));
|
|
|
}
|
|
}
|
|
@@ -825,4 +844,17 @@ public class TbServiceImpl implements TBService {
|
|
|
return McR.success(map);
|
|
return McR.success(map);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static String generateHtmlLinks(String jsonArrayStr) throws Exception {
|
|
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
+ JsonNode root = mapper.readTree(jsonArrayStr);
|
|
|
|
|
+ StringBuilder html = new StringBuilder();
|
|
|
|
|
+ for (JsonNode node : root) {
|
|
|
|
|
+ String url = node.get("arr").asText();
|
|
|
|
|
+ // 生成 <a> 标签,链接地址和显示文字均为 URL
|
|
|
|
|
+ html.append("<a href=\"").append(url).append("\">").append(url).append("</a>");
|
|
|
|
|
+ html.append("<br/>"); // 换行
|
|
|
|
|
+ }
|
|
|
|
|
+ return html.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|