/// <summary> /// 获取用户的基本信息 /// </summary> /// <param name="studentNo">学号</param> /// <returns></returns> public string GetUserInfo(string studentNo) { AJM_HandleResult result = new AJM_HandleResult(); try { ReaderInfo reader = SeatManageDateService.GetReader(studentNo, false); if (reader == null) { result.Result = false; result.Msg = "对不起,不存在该读者信息!"; return(JSONSerializer.Serialize(result)); } AJM_Reader ajmReader = new AJM_Reader(); ajmReader.CardId = reader.CardID; ajmReader.StudentNo = reader.CardNo; ajmReader.Name = reader.Name; ajmReader.Sex = reader.Sex; ajmReader.Department = reader.Pro; ajmReader.ReaderType = reader.ReaderType; result.Result = true; result.Msg = JSONSerializer.Serialize(ajmReader); return(JSONSerializer.Serialize(result)); } catch (Exception ex) { WriteLog.Write(string.Format("根据学号获取读者信息遇到异常:{0}", ex.Message)); result.Result = false; result.Msg = "获取读者信息执行遇到异常!"; return(JSONSerializer.Serialize(result)); } }
/// <summary> /// 获取用户当前的在座状态 /// </summary> /// <param name="studentNo">学号</param> /// <returns></returns> public string GetUserNowState(string studentNo) { AJM_HandleResult result = new AJM_HandleResult(); try { if (string.IsNullOrEmpty(studentNo)) { result.Result = false; result.Msg = "学号不能为空"; return(JSONSerializer.Serialize(result)); } ReaderInfo readerInfo = SeatManageDateService.GetReader(studentNo, true); if (readerInfo == null) { result.Result = false; result.Msg = "未查询到该读者的当前状态"; return(JSONSerializer.Serialize(result)); } AJM_ReaderStatus ajmReaderStatus = new AJM_ReaderStatus(); if (readerInfo.EnterOutLog != null) { AJM_EnterOutLog ajmEnterOutLog = new AJM_EnterOutLog { EnterOutTime = readerInfo.EnterOutLog.EnterOutTime.ToString("yyyy-MM-dd HH:mm:ss"), EnterOutState = readerInfo.EnterOutLog.EnterOutState.ToString(), Id = readerInfo.EnterOutLog.EnterOutLogID, Operator = readerInfo.EnterOutLog.Flag.ToString(), Remark = readerInfo.EnterOutLog.Remark, RoomName = readerInfo.EnterOutLog.ReadingRoomName, RoomNo = readerInfo.EnterOutLog.ReadingRoomNo, SeatNo = readerInfo.EnterOutLog.SeatNo, SeatShortNo = readerInfo.EnterOutLog.ShortSeatNo }; switch (readerInfo.EnterOutLog.EnterOutState) { case EnterOutLogType.None: case EnterOutLogType.Leave: case EnterOutLogType.BookingCancel: case EnterOutLogType.WaitingCancel: case EnterOutLogType.BespeakWaiting: ajmReaderStatus.Status = ReaderStatus.Leave.ToString(); break; case EnterOutLogType.BookingConfirmation: case EnterOutLogType.CancelTime: case EnterOutLogType.ComeBack: case EnterOutLogType.ContinuedTime: case EnterOutLogType.ReselectSeat: case EnterOutLogType.SelectSeat: case EnterOutLogType.Timing: case EnterOutLogType.WaitingSuccess: ajmReaderStatus.Status = ReaderStatus.Seating.ToString(); break; case EnterOutLogType.ShortLeave: ajmReaderStatus.Status = ReaderStatus.ShortLeave.ToString(); break; case EnterOutLogType.Waiting: ajmReaderStatus.Status = ReaderStatus.Waiting.ToString(); break; } ajmReaderStatus.AjmEnterOutLog = ajmEnterOutLog; } if (readerInfo.WaitSeatLog != null) { AJM_WaitSeatLog ajmWaitSeatLog = new AJM_WaitSeatLog { RoomName = readerInfo.WaitSeatLog.EnterOutLog.ReadingRoomName, RoomNo = readerInfo.WaitSeatLog.ReadingRoomNo, SeatNo = readerInfo.WaitSeatLog.SeatNo, SeatShortNo = readerInfo.WaitSeatLog.EnterOutLog.ShortSeatNo, SeatWaitId = readerInfo.WaitSeatLog.SeatWaitingID, SeatWaitTime = readerInfo.WaitSeatLog.SeatWaitTime.ToString("yyyy-MM-dd HH:mm:ss"), StudentNo_A = readerInfo.WaitSeatLog.CardNo, StudentNo_B = readerInfo.WaitSeatLog.CardNoB }; ajmReaderStatus.AjmWaitSeatLogs = ajmWaitSeatLog; ajmReaderStatus.Status = ReaderStatus.Waiting.ToString(); } if (readerInfo.BespeakLog.Count > 0) { foreach (BespeakLogInfo model in readerInfo.BespeakLog) { if (model.BsepeakTime.Date == DateTime.Now.Date) { ajmReaderStatus.Status = ReaderStatus.Booking.ToString(); } AJM_BespeakLog ajmBespeakLog = new AJM_BespeakLog { Id = model.BsepeaklogID, BookTime = model.BsepeakTime.ToString("yyyy-MM-dd HH:mm:ss"), IsValid = true, Remark = model.Remark, RoomName = model.ReadingRoomName, RoomNo = model.ReadingRoomNo, SeatNo = model.SeatNo, SeatShortNo = model.ShortSeatNum, SubmitDateTime = model.SubmitTime.ToString("yyyy-MM-dd HH:mm:ss") }; ajmReaderStatus.AjmBespeakLogs.Add(ajmBespeakLog); } } result.Result = true; result.Msg = JSONSerializer.Serialize(ajmReaderStatus); return(JSONSerializer.Serialize(result)); } catch (Exception ex) { WriteLog.Write(string.Format("获取读者当前状态发生异常:{0}", ex.Message)); result.Result = false; result.Msg = "获取用户状态执行异常!"; return(JSONSerializer.Serialize(result)); } }
public string GetUserNowStateV2(string studentNo, bool isCheckCode) { AJM_HandleResult result = new AJM_HandleResult(); try { if (string.IsNullOrEmpty(studentNo)) { result.Result = false; result.Msg = "学号不能为空"; return(JSONSerializer.Serialize(result)); } ReaderInfo readerInfo = SeatManageDateService.GetReader(studentNo, true); if (readerInfo == null) { result.Result = false; result.Msg = "未查询到该读者的当前状态"; return(JSONSerializer.Serialize(result)); } AJM_UserNowStatus ajmReaderStatus = new AJM_UserNowStatus(); ajmReaderStatus.StudentNum = readerInfo.CardNo; ajmReaderStatus.Name = readerInfo.Name; ajmReaderStatus.Status = ajmReaderStatus.Status = ReaderStatus.Leave.ToString(); if (readerInfo.EnterOutLog != null && readerInfo.EnterOutLog.EnterOutState != EnterOutLogType.Leave) { switch (readerInfo.EnterOutLog.EnterOutState) { case EnterOutLogType.ComeBack: case EnterOutLogType.ContinuedTime: case EnterOutLogType.ReselectSeat: case EnterOutLogType.SelectSeat: case EnterOutLogType.WaitingSuccess: case EnterOutLogType.BookingConfirmation: ajmReaderStatus.Status = ReaderStatus.Seating.ToString(); ajmReaderStatus.CanOperation = "Leave;ShortLeave" + (isCheckCode && readerInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.IsCanContinuedTime && readerInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.Used ? ";ContiuneTime" : ""); break; case EnterOutLogType.ShortLeave: ajmReaderStatus.Status = ReaderStatus.ShortLeave.ToString(); ajmReaderStatus.CanOperation = "Leave;" + (isCheckCode ? ";ComeBack" : ""); break; } ajmReaderStatus.InRoom = readerInfo.AtReadingRoom.Name; ajmReaderStatus.SeatNum = readerInfo.EnterOutLog.ShortSeatNo; ajmReaderStatus.NowStatusRemark = readerInfo.EnterOutLog.Remark; ajmReaderStatus.Time = readerInfo.EnterOutLog.EnterOutTime.ToString(); } if (readerInfo.WaitSeatLog != null) { ajmReaderStatus.Status = ReaderStatus.Waiting.ToString(); ajmReaderStatus.InRoom = readerInfo.AtReadingRoom.Name; ajmReaderStatus.SeatNum = readerInfo.WaitSeatLog.EnterOutLog.ShortSeatNo; ajmReaderStatus.CanOperation = "CancelWait"; ajmReaderStatus.NowStatusRemark = string.Format("您正在等待,{0} {1}号座位。", ajmReaderStatus.InRoom, ajmReaderStatus.SeatNum); ajmReaderStatus.Time = readerInfo.WaitSeatLog.EnterOutLog.ToString(); } if (readerInfo.BespeakLog.Count > 0 && readerInfo.BespeakLog[0].BsepeakTime.Date == DateTime.Now.Date) { ajmReaderStatus.Status = ReaderStatus.Booking.ToString(); ajmReaderStatus.InRoom = readerInfo.BespeakLog[0].ReadingRoomName; ajmReaderStatus.SeatNum = readerInfo.BespeakLog[0].ShortSeatNum; ajmReaderStatus.CanOperation = "CancelBook" + (isCheckCode ? ";CheckBook" : "");; ajmReaderStatus.NowStatusRemark = readerInfo.BespeakLog[0].Remark; ajmReaderStatus.Time = readerInfo.BespeakLog[0].SubmitTime.ToString(); } result.Result = true; result.Msg = JSONSerializer.Serialize(ajmReaderStatus); return(JSONSerializer.Serialize(result)); } catch (Exception ex) { WriteLog.Write(string.Format("获取读者当前状态发生异常:{0}", ex.Message)); result.Result = false; result.Msg = "获取用户状态执行异常!"; return(JSONSerializer.Serialize(result)); } }
/// <summary> /// 获取登录读者详细信息 /// </summary> /// <param name="studentNo"></param> /// <returns></returns> public string GetUserInfo_WeiXin(string studentNo) { AJM_HandleResult result = new AJM_HandleResult(); try { if (string.IsNullOrEmpty(studentNo)) { result.Result = false; result.Msg = "学号不能为空!"; return(JSONSerializer.Serialize(result)); } ReaderInfo readerInfo = SeatManageDateService.GetReader(studentNo, true); if (readerInfo == null) { result.Result = false; result.Msg = "未查询到该读者的当前状态"; return(JSONSerializer.Serialize(result)); } AJM_WeiXinUserInfo ajmWeiXinUserInfo = new AJM_WeiXinUserInfo(); ajmWeiXinUserInfo.StudentNo = readerInfo.CardNo; ajmWeiXinUserInfo.Name = readerInfo.Name; ajmWeiXinUserInfo.ReaderType = readerInfo.ReaderType; //预约网站设置 ajmWeiXinUserInfo.AjmPecketBookSetting.UseBookComfirm = readerInfo.PecketWebSetting.UseBookComfirm; ajmWeiXinUserInfo.AjmPecketBookSetting.UseBookNextDaySeat = readerInfo.PecketWebSetting.UseBookNextDaySeat; ajmWeiXinUserInfo.AjmPecketBookSetting.UseBookNowDaySeat = readerInfo.PecketWebSetting.UseBookNowDaySeat; ajmWeiXinUserInfo.AjmPecketBookSetting.UseBookSeat = readerInfo.PecketWebSetting.UseBookSeat; ajmWeiXinUserInfo.AjmPecketBookSetting.UseCanLeave = readerInfo.PecketWebSetting.UseCanLeave; ajmWeiXinUserInfo.AjmPecketBookSetting.UseCancelBook = readerInfo.PecketWebSetting.UseCancelBook; ajmWeiXinUserInfo.AjmPecketBookSetting.UseCancelWait = readerInfo.PecketWebSetting.UseCancelWait; ajmWeiXinUserInfo.AjmPecketBookSetting.UseChangeSeat = readerInfo.PecketWebSetting.UseChangeSeat; ajmWeiXinUserInfo.AjmPecketBookSetting.UseComeBack = readerInfo.PecketWebSetting.UseComeBack; ajmWeiXinUserInfo.AjmPecketBookSetting.UseContinue = readerInfo.PecketWebSetting.UseContinue; ajmWeiXinUserInfo.AjmPecketBookSetting.UseSelectSeat = readerInfo.PecketWebSetting.UseSelectSeat; ajmWeiXinUserInfo.AjmPecketBookSetting.UseShortLeave = readerInfo.PecketWebSetting.UseShortLeave; ajmWeiXinUserInfo.AjmPecketBookSetting.UseWaitSeat = readerInfo.PecketWebSetting.UseWaitSeat; AJM_ReaderStatus ajmReaderStatus = new AJM_ReaderStatus(); if (readerInfo.EnterOutLog != null) { AJM_EnterOutLog ajmEnterOutLog = new AJM_EnterOutLog(); ajmEnterOutLog.EnterOutTime = readerInfo.EnterOutLog.EnterOutTime.ToString("yyyy-MM-dd HH:mm:ss"); ajmEnterOutLog.EnterOutState = readerInfo.EnterOutLog.EnterOutState.ToString(); ajmEnterOutLog.Id = readerInfo.EnterOutLog.EnterOutLogID; ajmEnterOutLog.Operator = readerInfo.EnterOutLog.Flag.ToString(); ajmEnterOutLog.Remark = readerInfo.EnterOutLog.Remark; ajmEnterOutLog.RoomName = readerInfo.EnterOutLog.ReadingRoomName; ajmEnterOutLog.RoomNo = readerInfo.EnterOutLog.ReadingRoomNo; ajmEnterOutLog.SeatNo = readerInfo.EnterOutLog.SeatNo; ajmEnterOutLog.SeatShortNo = readerInfo.EnterOutLog.ShortSeatNo; ajmWeiXinUserInfo.AjmReadingRoomState = GetSingleRoomOpenState(ajmEnterOutLog.RoomNo); switch (readerInfo.EnterOutLog.EnterOutState) { case EnumType.EnterOutLogType.None: case EnumType.EnterOutLogType.Leave: case EnumType.EnterOutLogType.BookingCancel: case EnumType.EnterOutLogType.WaitingCancel: case EnumType.EnterOutLogType.BespeakWaiting: ajmReaderStatus.Status = EnumType.ReaderStatus.Leave.ToString(); break; case EnumType.EnterOutLogType.BookingConfirmation: case EnumType.EnterOutLogType.CancelTime: case EnumType.EnterOutLogType.ComeBack: case EnumType.EnterOutLogType.ContinuedTime: case EnumType.EnterOutLogType.ReselectSeat: case EnumType.EnterOutLogType.SelectSeat: case EnumType.EnterOutLogType.Timing: case EnumType.EnterOutLogType.WaitingSuccess: ajmReaderStatus.Status = EnumType.ReaderStatus.Seating.ToString(); break; case EnumType.EnterOutLogType.ShortLeave: ajmReaderStatus.Status = EnumType.ReaderStatus.ShortLeave.ToString(); break; case EnumType.EnterOutLogType.Waiting: ajmReaderStatus.Status = EnumType.ReaderStatus.Waiting.ToString(); break; } ajmReaderStatus.AjmEnterOutLog = ajmEnterOutLog; } if (readerInfo.WaitSeatLog != null) { AJM_WaitSeatLog ajmWaitSeatLog = new AJM_WaitSeatLog(); ajmWaitSeatLog.RoomName = readerInfo.WaitSeatLog.EnterOutLog.ReadingRoomName; ajmWaitSeatLog.RoomNo = readerInfo.WaitSeatLog.ReadingRoomNo; ajmWaitSeatLog.SeatNo = readerInfo.WaitSeatLog.SeatNo; ajmWaitSeatLog.SeatShortNo = readerInfo.WaitSeatLog.EnterOutLog.ShortSeatNo; ajmWaitSeatLog.SeatWaitId = readerInfo.WaitSeatLog.SeatWaitingID; ajmWaitSeatLog.SeatWaitTime = readerInfo.WaitSeatLog.SeatWaitTime.ToString("yyyy-MM-dd HH:mm:ss"); ajmWaitSeatLog.StudentNo_A = readerInfo.WaitSeatLog.CardNo; ajmWaitSeatLog.StudentNo_B = readerInfo.WaitSeatLog.CardNoB; ajmWeiXinUserInfo.AjmReadingRoomState = GetSingleRoomOpenState(ajmWaitSeatLog.RoomNo); ajmReaderStatus.AjmWaitSeatLogs = ajmWaitSeatLog; ajmReaderStatus.Status = EnumType.ReaderStatus.Waiting.ToString(); } if (readerInfo.BespeakLog.Count > 0) { foreach (BespeakLogInfo model in readerInfo.BespeakLog) { if (model.BsepeakTime.Date == DateTime.Now.Date) { ajmReaderStatus.Status = EnumType.ReaderStatus.Booking.ToString(); } AJM_BespeakLog ajmBespeakLog = new AJM_BespeakLog { Id = model.BsepeaklogID, BookTime = model.BsepeakTime.ToString("yyyy-MM-dd HH:mm:ss"), IsValid = true, Remark = model.Remark, RoomName = model.ReadingRoomName, RoomNo = model.ReadingRoomNo, SeatNo = model.SeatNo, SeatShortNo = model.ShortSeatNum, SubmitDateTime = model.SubmitTime.ToString("yyyy-MM-dd HH:mm:ss") }; ajmReaderStatus.AjmBespeakLogs.Add(ajmBespeakLog); } } ajmWeiXinUserInfo.AjmReaderStatus = ajmReaderStatus; result.Result = true; result.Msg = JSONSerializer.Serialize(ajmWeiXinUserInfo); return(JSONSerializer.Serialize(result)); } catch (Exception ex) { WriteLog.Write(string.Format("获取登录读者详细信息遇到异常:{0}", ex.Message)); result.Result = false; result.Msg = "获取登录读者详细信息执行遇到异常!"; return(JSONSerializer.Serialize(result)); } }
public string QRcodeOperation(string codeStr, string studentNo) { try { AJM_HandleResult result = new AJM_HandleResult(); string[] scanResultArray = codeStr.Split('?'); ClientCheckCodeParamModel scancode = null; if (scanResultArray.Length >= 2) { string[] strParam = scanResultArray[1].Split('='); if (strParam.Length >= 2) { scancode = ClientCheckCodeParamModel.Prase(strParam[1]);//兼容url的二维码。 } } else { scancode = ClientCheckCodeParamModel.Prase(codeStr); } DateTime ndt = DateTime.Now; if (scancode == null) { result.Result = false; result.Msg = "对不起,二维码错误!"; return(JSONSerializer.Serialize(result)); } if (scancode.CodeTime.AddMinutes(1) <= ndt) { result.Result = false; result.Msg = "对不起,二维码超时!"; return(JSONSerializer.Serialize(result)); } if (string.IsNullOrEmpty(studentNo)) { result.Result = false; result.Msg = "读者学号为空。"; return(JSONSerializer.Serialize(result)); } ReaderInfo reader = SeatManageDateService.GetReader(studentNo, true); if (reader == null) { result.Result = false; result.Msg = "获取读者信息失败。"; return(JSONSerializer.Serialize(result)); } if (reader.EnterOutLog == null && reader.BespeakLog.Count < 1) { result.Result = false; result.Msg = "对不起,您还没有座位,请先选择或预约一个座位。"; } if (reader.EnterOutLog != null) { switch (reader.EnterOutLog.EnterOutState) { case EnterOutLogType.BookingConfirmation: //预约入座 case EnterOutLogType.SelectSeat: //选座 case EnterOutLogType.ContinuedTime: //续时 case EnterOutLogType.ComeBack: //暂离回来 case EnterOutLogType.ReselectSeat: //重新选座 case EnterOutLogType.WaitingSuccess: //等待入座 result.Result = false; result.Msg = "您当前已有座位。"; break; case EnterOutLogType.ShortLeave: reader.EnterOutLog.EnterOutState = EnterOutLogType.ComeBack; reader.EnterOutLog.Remark = string.Format("您在选座终端{0}扫描二维码恢复在座,本次暂离时长{1}分钟。", scancode.ClientNo, ((int)(ndt - reader.EnterOutLog.EnterOutTime).TotalMinutes)); reader.EnterOutLog.Flag = Operation.Reader; reader.EnterOutLog.EnterOutTime = ndt; result.Result = true; int newId = -1; if (SeatManageDateService.AddEnterOutLogInfo(reader.EnterOutLog, ref newId) != HandleResult.Successed) { result.Result = false; result.Msg = "对不起,暂离回来失败!"; return(JSONSerializer.Serialize(result)); } result.Result = true; result.Msg = reader.EnterOutLog.Remark; List <WaitSeatLogInfo> waitSeatLogs = SeatManageDateService.GetWaitLogList("", reader.EnterOutLog.EnterOutLogID, null, null, null); if (waitSeatLogs.Count > 0) { WaitSeatLogInfo waitSeatLog = waitSeatLogs[0]; waitSeatLog.NowState = LogStatus.Fail; waitSeatLog.OperateType = Operation.OtherReader; waitSeatLog.WaitingState = EnterOutLogType.WaitingCancel; SeatManageDateService.UpdateWaitLog(waitSeatLog); } break; case EnterOutLogType.Leave: result.Result = false; result.Msg = "对不起,您还没有座位,请先选择或预约一个座位。"; break; default: result.Result = false; result.Msg = "对不起,您还没有座位,请先选择或预约一个座位。"; break; } return(JSONSerializer.Serialize(result)); } ReadingRoomSetting set = reader.AtReadingRoom.Setting; DateTime dtBegin = reader.BespeakLog[0].BsepeakTime.AddMinutes(-double.Parse(set.SeatBespeak.ConfirmTime.BeginTime)); DateTime dtEnd = reader.BespeakLog[0].BsepeakTime.AddMinutes(double.Parse(set.SeatBespeak.ConfirmTime.EndTime)); if (!DateTimeOperate.DateAccord(dtBegin, dtEnd, ndt) && (!set.SeatBespeak.NowDayBespeak || reader.BespeakLog[0].SubmitTime != reader.BespeakLog[0].BsepeakTime)) { result.Result = false; result.Msg = "对不起,您预约的座位没有到达签到时间"; return(JSONSerializer.Serialize(result)); } EnterOutLogInfo seatUsedInfo = SeatManageDateService.GetEnterOutLogInfoBySeatNum(reader.BespeakLog[0].SeatNo); if (seatUsedInfo != null && seatUsedInfo.EnterOutState != EnterOutLogType.Leave) { //条件满足,说明座位正在使用。 seatUsedInfo.EnterOutState = EnterOutLogType.Leave; seatUsedInfo.EnterOutType = LogStatus.Valid; seatUsedInfo.Remark = "您正在使用的座位已被原预约的读者"; seatUsedInfo.Flag = Operation.OtherReader; int newId = -1; if (SeatManageDateService.AddEnterOutLogInfo(seatUsedInfo, ref newId) != HandleResult.Successed) { result.Result = false; result.Msg = "对不起,此阅览室尚未开放。"; return(JSONSerializer.Serialize(result)); } List <WaitSeatLogInfo> waitInfoList = SeatManageDateService.GetWaitLogList(null, seatUsedInfo.EnterOutLogID, null, null, null); if (waitInfoList.Count > 0) { WaitSeatLogInfo waitSeatLogModel = waitInfoList[0]; waitSeatLogModel.OperateType = Operation.Reader; waitSeatLogModel.WaitingState = EnterOutLogType.WaitingCancel; waitSeatLogModel.NowState = LogStatus.Valid; SeatManageDateService.UpdateWaitLog(waitSeatLogModel); } } EnterOutLogInfo newEnterOutLog = new EnterOutLogInfo();//构造 newEnterOutLog.CardNo = reader.BespeakLog[0].CardNo; newEnterOutLog.EnterOutLogNo = SeatComm.RndNum(); newEnterOutLog.EnterOutState = EnterOutLogType.BookingConfirmation; newEnterOutLog.EnterOutType = LogStatus.Valid; newEnterOutLog.Flag = Operation.Reader; newEnterOutLog.ReadingRoomNo = reader.BespeakLog[0].ReadingRoomNo; newEnterOutLog.ReadingRoomName = reader.BespeakLog[0].ReadingRoomName; newEnterOutLog.ShortSeatNo = reader.BespeakLog[0].ShortSeatNum; newEnterOutLog.SeatNo = reader.BespeakLog[0].SeatNo; newEnterOutLog.Remark = string.Format("您在选座终端{0}扫描二维码,签到入座预约的{1} {2}号座位", scancode.ClientNo, reader.BespeakLog[0].ReadingRoomName, reader.BespeakLog[0].ShortSeatNum); int logid = -1; if (SeatManageDateService.AddEnterOutLogInfo(newEnterOutLog, ref logid) == HandleResult.Successed) { reader.BespeakLog[0].BsepeakState = BookingStatus.Confinmed; reader.BespeakLog[0].CancelPerson = Operation.Reader; reader.BespeakLog[0].CancelTime = ndt; reader.BespeakLog[0].Remark = newEnterOutLog.Remark; SeatManageDateService.UpdateBespeakLogInfo(reader.BespeakLog[0]); } result.Result = true; result.Msg = newEnterOutLog.Remark; return(JSONSerializer.Serialize(result)); } catch (Exception ex) { WriteLog.Write("读者签到/回来遇到异常:" + ex.Message); AJM_HandleResult result = new AJM_HandleResult(); result.Result = false; result.Msg = "执行遇到异常"; return(JSONSerializer.Serialize(result)); } }
/// <summary> /// 获取座位信息以及操作 /// </summary> /// <param name="seatNo"></param> /// <param name="roomNo"></param> /// <param name="studentNo"></param> /// <param name="isMessager"></param> /// <returns></returns> public string GetSeatNowStatus(string seatNo, string roomNo, string studentNo) { AJM_HandleResult result = new AJM_HandleResult(); AJM_SeatNowStatus seatStatus = new AJM_SeatNowStatus(); try { if (string.IsNullOrEmpty(studentNo)) { result.Result = false; result.Msg = "学号不能为空"; return(JSONSerializer.Serialize(result)); } List <ReadingRoomInfo> readingRoomInfos = SeatManageDateService.GetReadingRoomInfo(new List <string> { roomNo }); if (readingRoomInfos.Count < 1) { result.Result = false; result.Msg = "阅览室不存在!"; return(JSONSerializer.Serialize(result)); } seatStatus.RoomNo = readingRoomInfos[0].No; seatStatus.RoomName = readingRoomInfos[0].Name; if (!readingRoomInfos[0].SeatList.Seats.ContainsKey(seatNo)) { result.Result = false; result.Msg = "该座位不存在!"; return(JSONSerializer.Serialize(result)); } seatStatus.SeatNo = readingRoomInfos[0].SeatList.Seats[seatNo].SeatNo; seatStatus.SeatShortNo = readingRoomInfos[0].SeatList.Seats[seatNo].ShortSeatNo; Seat seat = SeatManageDateService.GetSeatInfoBySeatNum(seatNo); ReaderInfo readerInfo = SeatManageDateService.GetReader(studentNo, true); if (readerInfo == null) { result.Result = false; result.Msg = "未查询到该读者的当前状态"; return(JSONSerializer.Serialize(result)); } bool isSelfSeat = readerInfo.EnterOutLog != null && readerInfo.EnterOutLog.EnterOutState != EnterOutLogType.Leave && seat.SeatNo == readerInfo.EnterOutLog.SeatNo; bool isOnSeat = (readerInfo.EnterOutLog != null && readerInfo.EnterOutLog.EnterOutState != EnterOutLogType.Leave); if (readingRoomInfos[0].SeatList.Seats[seatNo].IsSuspended) { seatStatus.Status = "StopUsed"; } else { switch (seat.SeatUsedState) { case EnterOutLogType.ComeBack: case EnterOutLogType.ContinuedTime: case EnterOutLogType.ReselectSeat: case EnterOutLogType.SelectSeat: case EnterOutLogType.WaitingSuccess: case EnterOutLogType.BookingConfirmation: seatStatus.Status = ReaderStatus.Seating.ToString(); seatStatus.CanOperation = isSelfSeat ? "Leave;ShortLeave" : ""; break; case EnterOutLogType.ShortLeave: seatStatus.Status = ReaderStatus.Seating.ToString(); seatStatus.CanOperation = isSelfSeat ? "Leave" : ""; break; case EnterOutLogType.Leave: seatStatus.Status = ReaderStatus.Leave.ToString(); seatStatus.CanOperation = !isSelfSeat && isOnSeat ? "ChangeSeat" : ""; break; } if (readerInfo.WaitSeatLog != null && readerInfo.WaitSeatLog.SeatNo == seat.SeatNo) { seatStatus.Status = ReaderStatus.Waiting.ToString(); seatStatus.CanOperation = "CancelWait"; } if (readerInfo.BespeakLog.Count > 0 && readerInfo.BespeakLog[0].BsepeakTime.Date == DateTime.Now.Date && readerInfo.BespeakLog[0].SeatNo == seat.SeatNo) { seatStatus.Status = ReaderStatus.Booking.ToString(); seatStatus.CanOperation = "CancelBook"; } if (readingRoomInfos[0].Setting.SeatBespeak.Used) { if (readingRoomInfos[0].Setting.SeatBespeak.NowDayBespeak && seat.SeatUsedState == EnterOutLogType.Leave && SeatManageDateService.GetBespeakLogInfoBySeatNo(seatNo, DateTime.Now).Count < 1) { seatStatus.CanBookingDate.Add(DateTime.Now.ToShortDateString()); } for (int i = 1; i <= readingRoomInfos[0].Setting.SeatBespeak.BespeakBeforeDays; i++) { if (SeatManageDateService.GetBespeakLogInfoBySeatNo(seatNo, DateTime.Now.AddDays(i)).Count < 1) { seatStatus.CanBookingDate.Add(DateTime.Now.AddDays(i).ToShortDateString()); } } } } result.Result = true; result.Msg = JSONSerializer.Serialize(seatStatus); return(JSONSerializer.Serialize(result)); } catch (Exception ex) { WriteLog.Write(string.Format("获取读者当前状态发生异常:{0}", ex.Message)); result.Result = false; result.Msg = "获取用户状态执行异常!"; return(JSONSerializer.Serialize(result)); } }