Bläddra i källkod

Merge pull request 'dev' (#44) from dev into test

Reviewed-on: http://39.105.23.186:3000/develop/digimeta-MultiSaas/pulls/44
tags/B.1.2.2.1_20230823_base
yinruoxi 2 år sedan
förälder
incheckning
ca12da2ca7
1 ändrade filer med 52 tillägg och 33 borttagningar
  1. +52
    -33
      xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/template/MeetingOrderTemplate.java

+ 52
- 33
xueyi-modules/xueyi-nlt/src/main/java/com/xueyi/nlt/nlt/template/MeetingOrderTemplate.java Visa fil

@@ -1,5 +1,6 @@
package com.xueyi.nlt.nlt.template;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONException;
import com.alibaba.fastjson2.JSONObject;
import com.xueyi.common.core.web.result.R;
@@ -51,41 +52,59 @@ public class MeetingOrderTemplate implements BaseTemplate {
// String prefix = "我想请你充当[SQL数据库],我需要的数据格式为{date:,start_time:,location:,meeting_theme:},没有数据不返回字段,数据只能来自于如下文段:\"已知现在是" +
// date.format(formatter) + ",";
// String suffix = "\",只输出最后的JSON结果。不要输出任何解释说明或者代码。";
String prefix = "当前时间是" +
date.format(formatter) + " " + date.getDayOfWeek() + "。我将提供一些用户输入的信息,请提取输入的内容进行结构化转换并输出对应 json 格式的代码。下面是结构的描述:会议日期date(格式为YYYY-MM-DD);具体时间start_time(格式HH:MM);会议室地点location; 下面是用户的输入信息:\"";
String suffix = "\"。请开始信息提取,你回复的内容必须是一个json结构,我只要json结果,不需要代码。";
log.info(prefix + content + suffix);
webSocketClient.sendMsg(prefix + content + suffix);
try {
WebSocketClient.LOCK.wait();
String result = redisTemplate.opsForValue().get("group:websocket:content");
try {
//对result进行解析,获取字符串第一个与'{'和最后一个'}'之间的字符串,即为json字符串
result = result.substring(result.indexOf("{"), result.lastIndexOf("}") + 1);
System.out.println(result);
JSONObject jo = JSONObject.parseObject(result);
R<List<JSONObject>> recentListR = null;
if (jo.get("start_time") != null ) {
if (jo.get("start_time").equals("00:00")) {
recentListR = remoteMeetingService.ableOrderList(devId, jo.getString("date"), null, null);
} else {
recentListR = remoteMeetingService.ableOrderList(devId, jo.getString("date"), null, jo.getString("start_time"));
}
if (recentListR.isOk()) {
jo.put("start_time",recentListR.getData().get(0).get("startTime"));
jo.put("location",recentListR.getData().get(0).get("roomId"));
}
}

return jo;
} catch (JSONException je) {
// 返回结果错误,计日志,存log,返回空结果
log.error(je.getMessage(),je);
return null;
}

} catch (InterruptedException e) {
log.warn(e.getMessage());
// String prefix = "当前时间是" +
// date.format(formatter) + " " + date.getDayOfWeek() + "。我将提供一些用户输入的信息,请提取输入的内容进行结构化转换并输出对应 json 格式的代码。下面是结构的描述:会议日期date(格式为YYYY-MM-DD);具体时间start_time(格式HH:MM);会议室地点location; 下面是用户的输入信息:\"";
// String suffix = "\"。请开始信息提取,你回复的内容必须是一个json结构,我只要json结果,不需要代码。";
// log.info(prefix + content + suffix);
// webSocketClient.sendMsg(prefix + content + suffix);
// try {
// WebSocketClient.LOCK.wait();
// String result = redisTemplate.opsForValue().get("group:websocket:content");
// try {
// //对result进行解析,获取字符串第一个与'{'和最后一个'}'之间的字符串,即为json字符串
// result = result.substring(result.indexOf("{"), result.lastIndexOf("}") + 1);
// System.out.println(result);
// JSONObject jo = JSONObject.parseObject(result);
// R<List<JSONObject>> recentListR = null;
// if (jo.get("start_time") != null ) {
// if (jo.get("start_time").equals("00:00")) {
// recentListR = remoteMeetingService.ableOrderList(devId, jo.getString("date"), null, null);
// } else {
// recentListR = remoteMeetingService.ableOrderList(devId, jo.getString("date"), null, jo.getString("start_time"));
// }
// if (recentListR.isOk()) {
// jo.put("start_time",recentListR.getData().get(0).get("startTime"));
// jo.put("location",recentListR.getData().get(0).get("roomId"));
// }
// }
//
// return jo;
// } catch (JSONException je) {
// // 返回结果错误,计日志,存log,返回空结果
// log.error(je.getMessage(),je);
// return null;
// }
//
// } catch (InterruptedException e) {
// log.warn(e.getMessage());
// }
JSONArray ja = new JSONArray();
R<List<JSONObject>> recentListR = null;
recentListR = remoteMeetingService.ableOrderList(devId,null,null,null);
if (recentListR.isOk()) {
recentListR.getData().forEach(item->{
JSONObject tJson = new JSONObject();
tJson.put("start_time",item.get("startTime"));
tJson.put("location",item.get("roomId"));
tJson.put("date",item.get(("orderDate")));
tJson.put("duration_hours",0.5);
ja.add(tJson);
});
JSONObject result = new JSONObject();
result.put("data",ja);
return result;
}
}
return null;


Laddar…
Avbryt
Spara