|
|
|
@@ -46,6 +46,7 @@ import java.time.LocalDateTime; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
@@ -167,13 +168,14 @@ public class MeetingOrderTemplate implements BaseTemplate { |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
//遍历roomListR.getData(),判断content中是否包含item.getName(),如果包含,则将item.getId()赋值给locationId |
|
|
|
for (DmMeetingRoomsDto roomsDto : roomListR.getData()) { |
|
|
|
List<DmMeetingRoomsDto> aaa = roomListR.getData().stream().sorted((x,y)->y.getName().length() - x.getName().length()).collect(Collectors.toList()); |
|
|
|
for (DmMeetingRoomsDto roomsDto : aaa) { |
|
|
|
if (content.contains(roomsDto.getName())) { |
|
|
|
// 更新session中的locationId与location |
|
|
|
session.getFormat().put("location",roomsDto.getName()); |
|
|
|
session.getFormat().put("locationId",roomsDto.getId()); |
|
|
|
content = content.replace(roomsDto.getName(), "啊啊啊"); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -183,15 +185,62 @@ public class MeetingOrderTemplate implements BaseTemplate { |
|
|
|
if (dateSession != null ){ |
|
|
|
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; |
|
|
|
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("半小时")){ |
|
|
|
session.getFormat().put("duration",30); |
|
|
|
} |
|
|
|
String[] intentList = {"例会","访客接待","面试","其他"}; |
|
|
|
for(String a: intentList){ |
|
|
|
if(content.contains(a)){ |
|
|
|
session.getFormat().put("meetingIntent", a); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
//判断会议室是否冲突,如果冲突,删除时间 |
|
|
|
JSONObject checkObject = session.getFormat(); |
|
|
|
if (checkObject.containsKey("date") && checkObject.containsKey("time") && checkObject.containsKey("location")) { |
|
|
|
JSONObject ret = remoteMeetingService.queryExist(checkObject.getLong("locationId"), checkObject.getString("date"), checkObject.getString("time"),tenantId,source.getMaster(), SecurityConstants.INNER); |
|
|
|
if (checkObject.containsKey("date") && checkObject.containsKey("start_time") && checkObject.containsKey("location") && checkObject.containsKey("duration")) { |
|
|
|
JSONObject ret= remoteMeetingService.queryExistOrder(checkObject.getLong("locationId"), checkObject.getString("date"), checkObject.getString("start_time"),checkObject.getInteger("duration"),tenantId,source.getMaster(), SecurityConstants.INNER); |
|
|
|
if (StringUtils.isNotEmpty(ret.getString("err"))) { |
|
|
|
// 会议室冲突,删除时间 |
|
|
|
session.getFormat().remove("time"); |
|
|
|
session.getFormat().remove("duration"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//判断是否为确认或取消指令 |
|
|
|
checkObject = session.getFormat(); |
|
|
|
if(checkObject.containsKey("date") && checkObject.containsKey("start_time") && checkObject.containsKey("location") && checkObject.containsKey("duration") && content.contains("确认")){ |
|
|
|
session.getFormat().put("confirm", 1); |
|
|
|
} |
|
|
|
if(content.contains("取消")){ |
|
|
|
session.getFormat().put("confirm", 0); |
|
|
|
} |
|
|
|
// redis缓存更新session |
|
|
|
objectRedisTemplate.opsForValue().set("group:device" + ":" + devId + ":" +"session", session, 1,TimeUnit.MINUTES); |
|
|
|
session.getFormat().put("skillCode", SkillConstants.SkillType.BOOK_MEETING_ROOM.getCode()); |
|
|
|
|