|
|
|
@@ -85,6 +85,12 @@ public class MeetingOrderTemplate implements BaseTemplate { |
|
|
|
|
|
|
|
private static final List<MeetingParamVo> MEETING_PARAMS = new ArrayList<>(); |
|
|
|
|
|
|
|
private static JSONObject MEETING_DURATION = new JSONObject(); |
|
|
|
|
|
|
|
private static List<String> MEETING_TOPIC = new ArrayList<>(); |
|
|
|
|
|
|
|
private static JSONObject MEETING_CONFIRM = new JSONObject(); |
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
private void init() { |
|
|
|
try { |
|
|
|
@@ -140,6 +146,10 @@ public class MeetingOrderTemplate implements BaseTemplate { |
|
|
|
log.error("解析会议参数失败", e); |
|
|
|
} |
|
|
|
} |
|
|
|
MEETING_DURATION = JSONObject.parseObject(nacosConfigManager.getConfigService().getConfig("meeting_duration_hour", "DEFAULT_GROUP", 5000)); |
|
|
|
String topics = nacosConfigManager.getConfigService().getConfig("meeting_topic", "DEFAULT_GROUP", 5000); |
|
|
|
MEETING_TOPIC.addAll(List.of(topics.split(","))); |
|
|
|
MEETING_CONFIRM = JSONObject.parseObject(nacosConfigManager.getConfigService().getConfig("meeting_confirm_cancel", "DEFAULT_GROUP", 5000)); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("获取会议参数失败", e); |
|
|
|
} |
|
|
|
@@ -174,6 +184,13 @@ public class MeetingOrderTemplate implements BaseTemplate { |
|
|
|
String[] number = {"1","2","3","4","5","6","7","8","9","10"}; |
|
|
|
for (DmMeetingRoomsDto roomsDto : roomsDtoList) { |
|
|
|
String roomName = roomsDto.getName(); |
|
|
|
if (content.contains(roomName)) { |
|
|
|
// 更新session中的locationId与location |
|
|
|
session.getFormat().put("location",roomsDto.getName()); |
|
|
|
session.getFormat().put("locationId",roomsDto.getId()); |
|
|
|
content = content.replace(roomsDto.getName(), "啊啊啊"); |
|
|
|
break; |
|
|
|
} |
|
|
|
for(int i = 0;i<10;i++){ |
|
|
|
if(roomName.contains(chinesenumber[i])){ |
|
|
|
roomName = roomName.replace(chinesenumber[i], number[i]); |
|
|
|
@@ -194,40 +211,17 @@ public class MeetingOrderTemplate implements BaseTemplate { |
|
|
|
session = dateSession; |
|
|
|
} |
|
|
|
//判断是否击中持续时间的正则 |
|
|
|
boolean flag = false; |
|
|
|
String[] chinese = {"一","两","三","四","五","六","七","八"}; |
|
|
|
for(int i=1;i<=8;i++){ |
|
|
|
if(flag){ |
|
|
|
break; |
|
|
|
} |
|
|
|
String a = String.format("%d小时", i); |
|
|
|
String b = String.format("%s个小时", chinese[i-1]); |
|
|
|
if(content.contains(a)||content.contains(b)){ |
|
|
|
session.getFormat().put("duration", i * 60); |
|
|
|
content = content.replace(a, "啊啊啊"); |
|
|
|
content = content.replace(b, "啊啊啊"); |
|
|
|
flag = true; |
|
|
|
for(String key:MEETING_DURATION.keySet()){ |
|
|
|
if(content.contains(key)){ |
|
|
|
session.getFormat().put("duration", MEETING_DURATION.getIntValue(key)); |
|
|
|
content = content.replace(key, "啊啊啊"); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
for(int i=1;i<8;i++){ |
|
|
|
if(flag){ |
|
|
|
break; |
|
|
|
} |
|
|
|
if(content.contains(String.format("%s个半小时", chinese[i-1]))){ |
|
|
|
session.getFormat().put("duration", i * 60 +30); |
|
|
|
content = content.replace(String.format("%s个半小时", chinese[i-1]), "啊啊啊"); |
|
|
|
flag = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if(!flag && (content.contains("半小时")||content.contains("半个小时"))){ |
|
|
|
session.getFormat().put("duration",30); |
|
|
|
} |
|
|
|
String[] intentList = {"例会","访客接待","面试","其他"}; |
|
|
|
for(String a: intentList){ |
|
|
|
if(content.contains(a)){ |
|
|
|
session.getFormat().put("meetingIntent", a); |
|
|
|
|
|
|
|
for(String topic: MEETING_TOPIC){ |
|
|
|
if(content.contains(topic)){ |
|
|
|
session.getFormat().put("meetingIntent", topic); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -247,16 +241,23 @@ public class MeetingOrderTemplate implements BaseTemplate { |
|
|
|
//判断是否为确认或取消指令 |
|
|
|
checkObject = session.getFormat(); |
|
|
|
if(checkObject.containsKey("date") && checkObject.containsKey("start_time") && checkObject.containsKey("location") && checkObject.containsKey("duration")){ |
|
|
|
if(content.contains("确定") || content.contains("确认")){ |
|
|
|
if(checkObject.containsKey("conflict")){ |
|
|
|
if(checkObject.getInteger("conflict") == 0){ |
|
|
|
session.getFormat().put("confirm", 1); |
|
|
|
for(String confirmWord: MEETING_CONFIRM.getList("confirm", String.class)){ |
|
|
|
System.out.println(confirmWord); |
|
|
|
if(content.contains(confirmWord)){ |
|
|
|
if(checkObject.containsKey("conflict")){ |
|
|
|
if(checkObject.getInteger("conflict") == 0){ |
|
|
|
session.getFormat().put("confirm", 1); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(content.contains("取消")){ |
|
|
|
session.getFormat().put("confirm", 0); |
|
|
|
for(String cancelWord: MEETING_CONFIRM.getList("cancel", String.class)){ |
|
|
|
if(content.contains(cancelWord)){ |
|
|
|
session.getFormat().put("confirm", 0); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
// redis缓存更新session |
|
|
|
objectRedisTemplate.opsForValue().set("group:device" + ":" + devId + ":" +"session", session, 1,TimeUnit.MINUTES); |
|
|
|
@@ -377,8 +378,6 @@ public class MeetingOrderTemplate implements BaseTemplate { |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
String regex = "(\\d{4})[-|\\/|年](\\d{1,2})[-|\\/|月](\\d{1,2})[日|号]?\\s*(\\d{1,2})[:|时](\\d{1,2})[:|分]?"; |
|
|
|
String regexStr = "[\n" + |
|
|
|
|