|
@@ -24,10 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Set;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -116,15 +113,24 @@ public class OrdinaryController {
|
|
*/
|
|
*/
|
|
@RequestMapping("/showRecordByRoomId")
|
|
@RequestMapping("/showRecordByRoomId")
|
|
public List<ReservationVo> findAllReservationByRoomId(@RequestBody String id) throws Exception {
|
|
public List<ReservationVo> findAllReservationByRoomId(@RequestBody String id) throws Exception {
|
|
|
|
+
|
|
JSONObject jsonObject = JSONObject.parseObject(id);
|
|
JSONObject jsonObject = JSONObject.parseObject(id);
|
|
Integer roomId = jsonObject.getInteger("id");
|
|
Integer roomId = jsonObject.getInteger("id");
|
|
String date = jsonObject.getString("date");
|
|
String date = jsonObject.getString("date");
|
|
|
|
+ List<ReservationVo> list2 = new ArrayList<>();
|
|
List<ReservationVo> list = null;
|
|
List<ReservationVo> list = null;
|
|
list = reservationService.findByRoomId(roomId);
|
|
list = reservationService.findByRoomId(roomId);
|
|
if(!StringUtils.isEmpty(date)){
|
|
if(!StringUtils.isEmpty(date)){
|
|
- list = list.stream().filter(reservationVo->date.equals(reservationVo.getDate())).collect(Collectors.toList());
|
|
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
+ ReservationVo vo = list.get(i);
|
|
|
|
+ if(date.equals(vo.getDate())){
|
|
|
|
+ list2.add(vo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ return list;
|
|
}
|
|
}
|
|
- return list;
|
|
|
|
|
|
+ return list2;
|
|
}
|
|
}
|
|
|
|
|
|
//搜索借用人
|
|
//搜索借用人
|
|
@@ -204,22 +210,25 @@ public class OrdinaryController {
|
|
if(enterUsers !=null){
|
|
if(enterUsers !=null){
|
|
for (int i = 0; i < enterUsers.size(); i++) {
|
|
for (int i = 0; i < enterUsers.size(); i++) {
|
|
JSONObject object = enterUsers.getJSONObject(i);
|
|
JSONObject object = enterUsers.getJSONObject(i);
|
|
- String id = object.getString("id");
|
|
|
|
- users.add(id);
|
|
|
|
|
|
+ String uid = object.getString("id");
|
|
|
|
+ users.add(userService.findUserById(uid).getFsuid());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
result.put("users",users);
|
|
result.put("users",users);
|
|
JSONObject result2 = new JSONObject();
|
|
JSONObject result2 = new JSONObject();
|
|
JSONObject message = new JSONObject();
|
|
JSONObject message = new JSONObject();
|
|
JSONObject head = new JSONObject();
|
|
JSONObject head = new JSONObject();
|
|
|
|
+ JSONObject head2 = new JSONObject();
|
|
|
|
+ head2.put("title","详情");
|
|
|
|
+ head2.put("url","http://www.fxiaoke.com");
|
|
head.put("title","会议参加提醒");
|
|
head.put("title","会议参加提醒");
|
|
JSONObject first = new JSONObject();
|
|
JSONObject first = new JSONObject();
|
|
- first.put("first","欢迎参加“"+userName+"”组织的【"+theme+"】会议," +
|
|
|
|
|
|
+ first.put("content","欢迎参加“"+userName+"”组织的【"+theme+"】会议," +
|
|
"会议将于"+date+" "+beginTime+"-"+endTime+"召开,请届时参见");
|
|
"会议将于"+date+" "+beginTime+"-"+endTime+"召开,请届时参见");
|
|
message.put("head",head);
|
|
message.put("head",head);
|
|
message.put("first",first);
|
|
message.put("first",first);
|
|
- result2.put("composite",message);
|
|
|
|
- result.put("text",result2);
|
|
|
|
|
|
+ message.put("link",head2);
|
|
|
|
+ result.put("text",message);
|
|
sendMessage(result.toString());
|
|
sendMessage(result.toString());
|
|
|
|
|
|
return "success";
|
|
return "success";
|
|
@@ -260,20 +269,34 @@ public class OrdinaryController {
|
|
|
|
|
|
String StringEnterUsers = reservationVo.getEnterUsers();
|
|
String StringEnterUsers = reservationVo.getEnterUsers();
|
|
JSONArray enterUsers = JSONArray.parseArray(StringEnterUsers);
|
|
JSONArray enterUsers = JSONArray.parseArray(StringEnterUsers);
|
|
|
|
+
|
|
//发送消息
|
|
//发送消息
|
|
//0. 获取所有人员
|
|
//0. 获取所有人员
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
JSONArray users = new JSONArray();
|
|
JSONArray users = new JSONArray();
|
|
- users.add(user);
|
|
|
|
- if(enterUsers!=null){
|
|
|
|
|
|
+ users.add(userService.findUserById(user).getFsuid());
|
|
|
|
+ if(enterUsers !=null){
|
|
for (int i = 0; i < enterUsers.size(); i++) {
|
|
for (int i = 0; i < enterUsers.size(); i++) {
|
|
JSONObject object = enterUsers.getJSONObject(i);
|
|
JSONObject object = enterUsers.getJSONObject(i);
|
|
- String uid= object.getString("id");
|
|
|
|
- users.add(uid);
|
|
|
|
|
|
+ String uid = object.getString("id");
|
|
|
|
+ users.add(userService.findUserById(uid).getFsuid());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
result.put("users",users);
|
|
result.put("users",users);
|
|
- result.put("text","取消会议:"+theme);
|
|
|
|
|
|
+ JSONObject result2 = new JSONObject();
|
|
|
|
+ JSONObject message = new JSONObject();
|
|
|
|
+ JSONObject head = new JSONObject();
|
|
|
|
+ JSONObject head2 = new JSONObject();
|
|
|
|
+ head2.put("title","详情");
|
|
|
|
+ head2.put("url","http://www.fxiaoke.com");
|
|
|
|
+ head.put("title","会议参加提醒");
|
|
|
|
+ JSONObject first = new JSONObject();
|
|
|
|
+ first.put("content","欢迎参加“"+user+"”组织的【"+theme+"】会议," +
|
|
|
|
+ "会议将于"+reservationVo.getDate()+" "+reservationVo.getBeginTime()+"-"+reservationVo.getEndTime()+"召开,请届时参见");
|
|
|
|
+ message.put("head",head);
|
|
|
|
+ message.put("first",first);
|
|
|
|
+ message.put("link",head2);
|
|
|
|
+ result.put("text",message);
|
|
sendMessage(result.toString());
|
|
sendMessage(result.toString());
|
|
|
|
|
|
return reservationVo;
|
|
return reservationVo;
|