|
@@ -86,7 +86,7 @@ namespace GxPress.Api.AppControllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet("rooms/{id}")]
|
|
|
- public async Task<MeetingRoomResult> RoomGet([FromRoute]int id)
|
|
|
+ public async Task<MeetingRoomResult> RoomGet([FromRoute] int id)
|
|
|
{
|
|
|
var room = await _meetingRoomRepository.GetAsync(id);
|
|
|
room.Address = await _meetingLocationRepository.GetAddress(room.LocationId);
|
|
@@ -94,15 +94,12 @@ namespace GxPress.Api.AppControllers
|
|
|
var orders = new SortedDictionary<string, List<int>>();
|
|
|
foreach (var meetingOrder in orderList)
|
|
|
{
|
|
|
-
|
|
|
var data = meetingOrder.Date.ToString().Insert(4, "-").Insert(7, "-");
|
|
|
var key = StringUtils.GetDate(Convert.ToDateTime(data)).ToString();
|
|
|
// var key = StringUtils.GetDate(meetingOrder.CreatedDate).ToString();
|
|
|
-
|
|
|
if (orders.TryGetValue(key, out var hourList))
|
|
|
{
|
|
|
hourList.Add(meetingOrder.Hour);
|
|
|
-
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -114,20 +111,29 @@ namespace GxPress.Api.AppControllers
|
|
|
}
|
|
|
var orderLists = new List<TimeDictionary>();
|
|
|
//新版
|
|
|
- foreach (var item in orderList.Select(n => n.Date).Distinct())
|
|
|
+ foreach (var item in orderList)
|
|
|
{
|
|
|
- var timeDictionary = new TimeDictionary();
|
|
|
- timeDictionary.TimeKey = item.ToString();
|
|
|
- timeDictionary.TimeValues = orderList.Where(n => n.Date == item).Select(n => n.Hour).Distinct().ToList();
|
|
|
+ if (orderLists.Any(n => n.TimeKey == item.Date.ToString()))
|
|
|
+ continue;
|
|
|
+ var timeDictionary = new TimeDictionary()
|
|
|
+ {
|
|
|
+ TimeKey = item.Date.ToString(),
|
|
|
+ };
|
|
|
+ foreach (var data in orderList.Where(n => n.Date == Convert.ToInt32(item.Date)).Distinct().ToList())
|
|
|
+ timeDictionary.TimeValues.Add(new TimeValue { Key = data.Hour, Value = data.UserName });
|
|
|
orderLists.Add(timeDictionary);
|
|
|
}
|
|
|
-
|
|
|
+ // foreach (var item in orderLists)
|
|
|
+ // {
|
|
|
+ // foreach (var data in orderList.Where(n => n.Date == Convert.ToInt32(item.TimeKey)).Distinct().ToList())
|
|
|
+ // item.TimeValues.Add(new TimeValue { Key = data.Hour, Value = data.UserName });
|
|
|
+ // }
|
|
|
return new MeetingRoomResult
|
|
|
{
|
|
|
RoomName = room.Name,
|
|
|
Disabled = room.Disabled,
|
|
|
Orders = orders,
|
|
|
- OrderList = orderLists
|
|
|
+ OrderList = orderLists.Distinct().ToList()
|
|
|
};
|
|
|
}
|
|
|
|
|
@@ -136,7 +142,7 @@ namespace GxPress.Api.AppControllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("rooms/{id}/actions/order")]
|
|
|
- public async Task<DefaultResult> Order([FromRoute]int id, [FromBody] MeetingOrderRequest request)
|
|
|
+ public async Task<DefaultResult> Order([FromRoute] int id, [FromBody] MeetingOrderRequest request)
|
|
|
{
|
|
|
var room = await _meetingRoomRepository.GetAsync(id);
|
|
|
var meeting = new Meeting();
|
|
@@ -387,7 +393,7 @@ namespace GxPress.Api.AppControllers
|
|
|
foreach (var item in request.AddresseeUserMiddles)
|
|
|
{
|
|
|
item.DataSourceId = id;
|
|
|
- item.MiddleType = GxPress.EnumConst.AllTypeConst.MeetingSummary.GetHashCode();
|
|
|
+ item.MiddleType = GxPress.EnumConst.AllTypeConst.MeetingSummary.GetHashCode();
|
|
|
}
|
|
|
await _userMiddleService.AddUserMiddleAsync(request.AddresseeUserMiddles);
|
|
|
var users = await _userMiddleService.FindUsersAsync(request.AddresseeUserMiddles, summary.UserId);
|
|
@@ -432,7 +438,7 @@ namespace GxPress.Api.AppControllers
|
|
|
var meeting = await _meetingRepository.GetAsync(summary.MeetingId);
|
|
|
var address = await _meetingLocationRepository.GetAddress(meeting.LocationId);
|
|
|
//获取新版
|
|
|
- var addresseeUserMiddles = await _userMiddleService.FindUserMiddlesAsync( GxPress.EnumConst.AllTypeConst.MeetingSummary.GetHashCode(), id);
|
|
|
+ var addresseeUserMiddles = await _userMiddleService.FindUserMiddlesAsync(GxPress.EnumConst.AllTypeConst.MeetingSummary.GetHashCode(), id);
|
|
|
var meetingSummaryResult = new MeetingSummaryResult
|
|
|
{
|
|
|
Id = summary.Id,
|
|
@@ -555,7 +561,7 @@ namespace GxPress.Api.AppControllers
|
|
|
var meetingTime = meetingTimeList.FirstOrDefault();
|
|
|
var TimeValuelast = meetingTime.TimeValues.Last();
|
|
|
var data = meetingTime.TimeKey.ToString().Insert(4, "-").Insert(7, "-");
|
|
|
- var key = Convert.ToDateTime(data).AddHours(TimeValuelast);
|
|
|
+ var key = Convert.ToDateTime(data).AddHours(TimeValuelast.Key);
|
|
|
if (key < DateTime.Now)
|
|
|
status = 1;
|
|
|
}
|
|
@@ -622,7 +628,7 @@ namespace GxPress.Api.AppControllers
|
|
|
var meetingTime = meetingTimeList.FirstOrDefault();
|
|
|
var TimeValuelast = meetingTime.TimeValues.Last();
|
|
|
var data = meetingTime.TimeKey.ToString().Insert(4, "-").Insert(7, "-");
|
|
|
- var key = Convert.ToDateTime(data).AddHours(TimeValuelast);
|
|
|
+ var key = Convert.ToDateTime(data).AddHours(TimeValuelast.Key);
|
|
|
if (key < DateTime.Now)
|
|
|
status = 1;
|
|
|
}
|
|
@@ -682,11 +688,14 @@ namespace GxPress.Api.AppControllers
|
|
|
var orderLists = new List<TimeDictionary>();
|
|
|
var orderAllList = await _meetingOrderRepository.GetListAsyncSinceNow(room.Id);
|
|
|
//新版
|
|
|
- foreach (var item in orderAllList.Select(n => n.Date).Distinct())
|
|
|
+ foreach (var item in orderAllList)
|
|
|
{
|
|
|
+ if (orderLists.Any(n => n.TimeKey == item.Date.ToString()))
|
|
|
+ continue;
|
|
|
var timeDictionary = new TimeDictionary();
|
|
|
- timeDictionary.TimeKey = item.ToString();
|
|
|
- timeDictionary.TimeValues = orderAllList.Where(n => n.Date == item).OrderBy(n => n.Hour).Select(n => n.Hour).Distinct().ToList();
|
|
|
+ timeDictionary.TimeKey = item.Date.ToString();
|
|
|
+ foreach (var date in orderAllList.Where(n => n.Date == item.Date).OrderBy(n => n.Hour).Select(n => n.Hour).Distinct().ToList())
|
|
|
+ timeDictionary.TimeValues.Add(new TimeValue { Key = date, Value = item.UserName });
|
|
|
orderLists.Add(timeDictionary);
|
|
|
}
|
|
|
#endregion
|
|
@@ -723,7 +732,7 @@ namespace GxPress.Api.AppControllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("{id}/actions/cancel")]
|
|
|
- public async Task<DefaultResult> Cancel([FromRoute]int id)
|
|
|
+ public async Task<DefaultResult> Cancel([FromRoute] int id)
|
|
|
{
|
|
|
await _meetingRepository.DeleteAsync(id);
|
|
|
|
|
@@ -738,7 +747,7 @@ namespace GxPress.Api.AppControllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("actions/users")]
|
|
|
- public async Task<IEnumerable<MeetingUserResult>> GetUsers([FromBody]MeetingUsersRequest request)
|
|
|
+ public async Task<IEnumerable<MeetingUserResult>> GetUsers([FromBody] MeetingUsersRequest request)
|
|
|
{
|
|
|
return await _meetingRepository.GetUserByMeeting(request);
|
|
|
}
|