|
@@ -7,6 +7,7 @@ import com.persagy.domain.ReservationVo;
|
|
import com.persagy.domain.Room;
|
|
import com.persagy.domain.Room;
|
|
import com.persagy.service.ReservationService;
|
|
import com.persagy.service.ReservationService;
|
|
import com.persagy.service.RoomService;
|
|
import com.persagy.service.RoomService;
|
|
|
|
+import com.persagy.service.UserService;
|
|
import com.persagy.util.PinyinUtils;
|
|
import com.persagy.util.PinyinUtils;
|
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
import org.apache.http.client.methods.HttpPost;
|
|
import org.apache.http.client.methods.HttpPost;
|
|
@@ -36,7 +37,8 @@ public class OrdinaryController {
|
|
|
|
|
|
@Resource(name = "roomServiceImpl")
|
|
@Resource(name = "roomServiceImpl")
|
|
private RoomService roomService;
|
|
private RoomService roomService;
|
|
-
|
|
|
|
|
|
+ @Resource(name = "userServiceImpl")
|
|
|
|
+ private UserService userService;
|
|
@Resource(name = "reservationServiceImpl")
|
|
@Resource(name = "reservationServiceImpl")
|
|
private ReservationService reservationService;
|
|
private ReservationService reservationService;
|
|
//获取CorpAccessToken URL
|
|
//获取CorpAccessToken URL
|
|
@@ -86,6 +88,7 @@ public class OrdinaryController {
|
|
private Room queryRoomById(@RequestBody String roomID) throws Exception {
|
|
private Room queryRoomById(@RequestBody String roomID) throws Exception {
|
|
JSONObject jsonObject = JSONObject.parseObject(roomID);
|
|
JSONObject jsonObject = JSONObject.parseObject(roomID);
|
|
Integer id = jsonObject.getInteger("roomID");
|
|
Integer id = jsonObject.getInteger("roomID");
|
|
|
|
+ String date = jsonObject.getString("date");
|
|
Room room = roomService.findById(id);
|
|
Room room = roomService.findById(id);
|
|
return room;
|
|
return room;
|
|
}
|
|
}
|
|
@@ -154,7 +157,6 @@ public class OrdinaryController {
|
|
JSONObject jsonObject = JSONObject.parseObject(reservation);
|
|
JSONObject jsonObject = JSONObject.parseObject(reservation);
|
|
String roomName = jsonObject.getString("roomName");
|
|
String roomName = jsonObject.getString("roomName");
|
|
int roomId = jsonObject.getIntValue("roomId");
|
|
int roomId = jsonObject.getIntValue("roomId");
|
|
- int userID = jsonObject.getIntValue("userID");
|
|
|
|
int alarmminute = jsonObject.getIntValue("alarmminute");
|
|
int alarmminute = jsonObject.getIntValue("alarmminute");
|
|
String userName = jsonObject.getString("userName");
|
|
String userName = jsonObject.getString("userName");
|
|
String department = jsonObject.getString("department");
|
|
String department = jsonObject.getString("department");
|
|
@@ -167,6 +169,7 @@ public class OrdinaryController {
|
|
String date = json.getString("date");
|
|
String date = json.getString("date");
|
|
String beginTime = json.getString("beginTime");
|
|
String beginTime = json.getString("beginTime");
|
|
String endTime = json.getString("endTime");
|
|
String endTime = json.getString("endTime");
|
|
|
|
+// String a = date+""+
|
|
ReservationCustom reservationCustom = new ReservationCustom();
|
|
ReservationCustom reservationCustom = new ReservationCustom();
|
|
reservationCustom.setDate(date);
|
|
reservationCustom.setDate(date);
|
|
reservationCustom.setBeginTime(beginTime);
|
|
reservationCustom.setBeginTime(beginTime);
|
|
@@ -183,7 +186,35 @@ public class OrdinaryController {
|
|
reservationCustom.setAlarmminute(alarmminute);
|
|
reservationCustom.setAlarmminute(alarmminute);
|
|
reservationService.addReservation(reservationCustom);
|
|
reservationService.addReservation(reservationCustom);
|
|
}
|
|
}
|
|
|
|
+ //发送消息
|
|
|
|
+ //0. 获取所有人员
|
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
|
+ JSONArray users = new JSONArray();
|
|
|
|
+ users.add(userService.findUserById(userName).getFsuid());
|
|
|
|
+ if(enterUsers !=null){
|
|
|
|
+ for (int i = 0; i < enterUsers.size(); i++) {
|
|
|
|
+ JSONObject object = enterUsers.getJSONObject(i);
|
|
|
|
+ String id = object.getString("id");
|
|
|
|
+ users.add(id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.put("users",users);
|
|
|
|
+ JSONObject message = new JSONObject();
|
|
|
|
+ JSONObject head = new JSONObject();
|
|
|
|
+ head.put("title","会议参加提醒");
|
|
|
|
+ JSONObject first = new JSONObject();
|
|
|
|
+ head.put("first","欢迎参加“"+userName+"”组织的【"+theme+"】会议,会议将于");
|
|
|
|
+// message.put("head,new )
|
|
|
|
+// {
|
|
|
|
+// "head":{
|
|
|
|
+// "title":"会议室提醒"
|
|
|
|
+// },
|
|
|
|
+// "first":{
|
|
|
|
+// "content":"2019-08-24"
|
|
|
|
+// }
|
|
|
|
|
|
|
|
+ result.put("text","theme");
|
|
|
|
+// sendMessage(result.toString());
|
|
|
|
|
|
return "success";
|
|
return "success";
|
|
}
|
|
}
|
|
@@ -199,11 +230,34 @@ public class OrdinaryController {
|
|
|
|
|
|
//取消预约申请业务实现
|
|
//取消预约申请业务实现
|
|
@RequestMapping(value = "/cancelApply", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/cancelApply", method = RequestMethod.POST)
|
|
- public String cancelApplication(@RequestBody String id) throws Exception{
|
|
|
|
|
|
+ public ReservationVo cancelApplication(@RequestBody String id) throws Exception{
|
|
JSONObject jsonObject = JSONObject.parseObject(id);
|
|
JSONObject jsonObject = JSONObject.parseObject(id);
|
|
Integer cancelID = jsonObject.getInteger("id");
|
|
Integer cancelID = jsonObject.getInteger("id");
|
|
reservationService.cancelApplication(cancelID);
|
|
reservationService.cancelApplication(cancelID);
|
|
- return "success";
|
|
|
|
|
|
+
|
|
|
|
+ ReservationVo reservationVo =reservationService.findByReservationId(cancelID);
|
|
|
|
+ String user = reservationVo.getUser();
|
|
|
|
+ String theme =reservationVo.getTheme();
|
|
|
|
+
|
|
|
|
+ String StringEnterUsers = reservationVo.getEnterUsers();
|
|
|
|
+ JSONArray enterUsers = JSONArray.parseArray(StringEnterUsers);
|
|
|
|
+ //发送消息
|
|
|
|
+ //0. 获取所有人员
|
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
|
+ JSONArray users = new JSONArray();
|
|
|
|
+ users.add(user);
|
|
|
|
+ if(enterUsers!=null){
|
|
|
|
+ for (int i = 0; i < enterUsers.size(); i++) {
|
|
|
|
+ JSONObject object = enterUsers.getJSONObject(i);
|
|
|
|
+ String uid= object.getString("id");
|
|
|
|
+ users.add(uid);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.put("users",users);
|
|
|
|
+ result.put("text","取消会议:"+theme);
|
|
|
|
+ sendMessage(result.toString());
|
|
|
|
+
|
|
|
|
+ return reservationVo;
|
|
}
|
|
}
|
|
//获取数字签名
|
|
//获取数字签名
|
|
public void getSignature() throws Exception{
|
|
public void getSignature() throws Exception{
|
|
@@ -368,6 +422,8 @@ public class OrdinaryController {
|
|
String text = jsonObject.getString("text");
|
|
String text = jsonObject.getString("text");
|
|
//发送人
|
|
//发送人
|
|
JSONArray users = jsonObject.getJSONArray("users");
|
|
JSONArray users = jsonObject.getJSONArray("users");
|
|
|
|
+
|
|
|
|
+
|
|
// JSONArray users = new JSONArray();
|
|
// JSONArray users = new JSONArray();
|
|
// users.add("FSUID_782A9585B3CEB91B9DC0C709FA4D3119");
|
|
// users.add("FSUID_782A9585B3CEB91B9DC0C709FA4D3119");
|
|
|
|
|