diff --git a/EOM.TSHotelManagement.Application/Application/NavBar/NavBarService.cs b/EOM.TSHotelManagement.Application/Application/NavBar/NavBarService.cs
index f509d22caa7ddd7ab53fcda6e62a68e94a251ea5..78d4d8ef206b60185b748424cb817a1f1b254c03 100644
--- a/EOM.TSHotelManagement.Application/Application/NavBar/NavBarService.cs
+++ b/EOM.TSHotelManagement.Application/Application/NavBar/NavBarService.cs
@@ -52,7 +52,6 @@ namespace EOM.TSHotelManagement.Application
{
var navBar = new NavBar
{
- Id = input.Id,
NavigationBarEvent = input.NavigationBarEvent,
NavigationBarImage = input.NavigationBarImage,
NavigationBarName = input.NavigationBarName,
diff --git a/EOM.TSHotelManagement.Application/Business/Asset/AssetService.cs b/EOM.TSHotelManagement.Application/Business/Asset/AssetService.cs
index dffc2a46dd014ae29c7a0b681b04353eb48929d7..8d6f79976bbf5c7034db0f1e05cefd79fe58f402 100644
--- a/EOM.TSHotelManagement.Application/Business/Asset/AssetService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Asset/AssetService.cs
@@ -25,6 +25,7 @@ using EOM.TSHotelManagement.Common.Contract;
using EOM.TSHotelManagement.Common.Core;
using EOM.TSHotelManagement.Common.Util;
using EOM.TSHotelManagement.EntityFramework;
+using jvncorelib.EntityLib;
using SqlSugar;
namespace EOM.TSHotelManagement.Application
@@ -173,11 +174,13 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- if (!assetRepository.IsAny(a => a.AssetNumber == asset.AssetNumber))
+ var dbAsset = assetRepository.GetFirst(a => a.AssetNumber == asset.AssetNumber);
+ if (dbAsset.IsNullOrEmpty())
{
return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("asset number does not exist.", "资产编号不存在"), Code = BusinessStatusCode.InternalServerError };
}
- assetRepository.SoftDelete(new Asset { IsDelete = asset.IsDelete, AssetNumber = asset.AssetNumber, Id = asset.Id });
+ dbAsset.IsDelete = asset.IsDelete;
+ assetRepository.SoftDelete(dbAsset);
}
catch (Exception ex)
{
diff --git a/EOM.TSHotelManagement.Application/Business/Customer/CustomerAccountService.cs b/EOM.TSHotelManagement.Application/Business/Customer/CustomerAccountService.cs
index 0a277bdaab90577017c5ac167513cfe4939d4711..b2d15b1b833971f9d3cb5d01b054e12c801b7c83 100644
--- a/EOM.TSHotelManagement.Application/Business/Customer/CustomerAccountService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Customer/CustomerAccountService.cs
@@ -4,13 +4,15 @@ using EOM.TSHotelManagement.Common.Util;
using EOM.TSHotelManagement.EntityFramework;
using jvncorelib.CodeLib;
using jvncorelib.EntityLib;
+using Microsoft.AspNetCore.Http;
using System.Security.Claims;
using System.Text.Json;
+using System.Text.RegularExpressions;
using System.Transactions;
namespace EOM.TSHotelManagement.Application
{
- public class CustomerAccountService : ICustomerAccountService
+ public partial class CustomerAccountService : ICustomerAccountService
{
///
/// 客户账号
@@ -32,12 +34,28 @@ namespace EOM.TSHotelManagement.Application
///
private readonly JWTHelper jWTHelper;
- public CustomerAccountService(GenericRepository customerAccountRepository, GenericRepository customerRepository, DataProtectionHelper dataProtector, JWTHelper jWTHelper)
+
+ private readonly IHttpContextAccessor _httpContextAccessor;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public CustomerAccountService(GenericRepository customerAccountRepository, GenericRepository customerRepository, DataProtectionHelper dataProtector, JWTHelper jWTHelper, IHttpContextAccessor httpContextAccessor, Regex accountRegex, Regex passwordRegex)
{
this.customerAccountRepository = customerAccountRepository;
this.customerRepository = customerRepository;
this.dataProtector = dataProtector;
this.jWTHelper = jWTHelper;
+ _httpContextAccessor = httpContextAccessor;
+ AccountRegex = accountRegex;
+ PasswordRegex = passwordRegex;
}
///
@@ -57,17 +75,18 @@ namespace EOM.TSHotelManagement.Application
if (!dataProtector.CompareCustomerData(customerAccount.Password, readCustomerAccountInputDto.Password))
return new SingleOutputDto() { Code = BusinessStatusCode.Unauthorized, Message = LocalizationHelper.GetLocalizedString("Invalid account or password", "账号或密码错误"), Data = new ReadCustomerAccountOutputDto() };
- customerAccount.Password = null;
+ var copyCustomerAccount = customerAccount;
- customerAccountRepository.Update(new CustomerAccount
- {
- Id = customerAccount.Id,
- Account = customerAccount.Account,
- LastLoginIp = customerAccount.LastLoginIp,
- LastLoginTime = customerAccount.LastLoginTime
- });
+ var context = _httpContextAccessor.HttpContext;
+ var ipAddress = context.Connection.RemoteIpAddress?.ToString() ?? string.Empty;
- customerAccount.UserToken = jWTHelper.GenerateJWT(new ClaimsIdentity(new Claim[]
+ customerAccount.LastLoginIp = ipAddress;
+ customerAccount.LastLoginTime = DateTime.Now;
+ customerAccountRepository.Update(customerAccount);
+
+ copyCustomerAccount.Password = null;
+
+ copyCustomerAccount.UserToken = jWTHelper.GenerateJWT(new ClaimsIdentity(new Claim[]
{
new Claim(ClaimTypes.Name, customerAccount.Name),
new Claim(ClaimTypes.SerialNumber, customerAccount.CustomerNumber),
@@ -81,13 +100,13 @@ namespace EOM.TSHotelManagement.Application
Message = LocalizationHelper.GetLocalizedString("Login successful", "登录成功"),
Data = new ReadCustomerAccountOutputDto
{
- Account = customerAccount.Account,
- EmailAddress = customerAccount.EmailAddress,
- Name = customerAccount.Name,
- LastLoginIp = customerAccount.LastLoginIp,
- LastLoginTime = customerAccount.LastLoginTime,
- Status = customerAccount.Status,
- UserToken = customerAccount.UserToken
+ Account = copyCustomerAccount.Account,
+ EmailAddress = copyCustomerAccount.EmailAddress,
+ Name = copyCustomerAccount.Name,
+ LastLoginIp = copyCustomerAccount.LastLoginIp,
+ LastLoginTime = copyCustomerAccount.LastLoginTime,
+ Status = copyCustomerAccount.Status,
+ UserToken = copyCustomerAccount.UserToken
},
};
}
@@ -99,18 +118,17 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto Register(ReadCustomerAccountInputDto readCustomerAccountInputDto)
{
+
if (readCustomerAccountInputDto.Account.IsNullOrEmpty() || readCustomerAccountInputDto.Password.IsNullOrEmpty())
return new SingleOutputDto() { Code = BusinessStatusCode.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account or Password cannot be empty", "账号或密码不能为空"), Data = new ReadCustomerAccountOutputDto() };
if (readCustomerAccountInputDto.Account.Length < 3 || readCustomerAccountInputDto.Account.Length > 20)
return new SingleOutputDto() { Code = BusinessStatusCode.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account length must be between 3 and 20 characters", "账号长度必须在3到20个字符之间"), Data = new ReadCustomerAccountOutputDto() };
- var accountRegex = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z0-9_]+$");
- if (!accountRegex.IsMatch(readCustomerAccountInputDto.Account))
+ if (!AccountRegex.IsMatch(readCustomerAccountInputDto.Account))
return new SingleOutputDto() { Code = BusinessStatusCode.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account can only contain letters, numbers, and underscores", "账号只能包含字母、数字和下划线"), Data = new ReadCustomerAccountOutputDto() };
- var passwordRegex = new System.Text.RegularExpressions.Regex(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$");
- if (!passwordRegex.IsMatch(readCustomerAccountInputDto.Password))
+ if (!PasswordRegex.IsMatch(readCustomerAccountInputDto.Password))
return new SingleOutputDto() { Code = BusinessStatusCode.BadRequest, Message = LocalizationHelper.GetLocalizedString("Password must be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, and one number", "密码必须至少8个字符,并且包含至少一个大写字母、一个小写字母和一个数字"), Data = new ReadCustomerAccountOutputDto() };
var customerAccount = customerAccountRepository.AsQueryable().Single(x => x.Account == readCustomerAccountInputDto.Account);
@@ -190,5 +208,9 @@ namespace EOM.TSHotelManagement.Application
};
}
}
+
+ private readonly Regex AccountRegex = new Regex(@"^[a-zA-Z0-9_]+$", RegexOptions.Compiled);
+ private readonly Regex PasswordRegex = new Regex(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$", RegexOptions.Compiled);
+
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/Customer/CustomerService.cs b/EOM.TSHotelManagement.Application/Business/Customer/CustomerService.cs
index c2f5f7276e5e3d0305aa1e219143f65d4b8ed44a..6f96b560c244a7fae76b7e324d00579481817290 100644
--- a/EOM.TSHotelManagement.Application/Business/Customer/CustomerService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Customer/CustomerService.cs
@@ -219,7 +219,7 @@ namespace EOM.TSHotelManagement.Application
where = where.And(a => a.IsDelete == readCustomerInputDto.IsDelete);
if (!readCustomerInputDto.CustomerNumber.IsNullOrEmpty())
{
- where = where.And(a => a.CustomerNumber.Equals(readCustomerInputDto.CustomerNumber));
+ where = where.And(a => a.CustomerNumber.Contains(readCustomerInputDto.CustomerNumber));
}
if (!readCustomerInputDto.CustomerName.IsNullOrEmpty())
{
diff --git a/EOM.TSHotelManagement.Application/Business/PromotionContent/PromotionContentService.cs b/EOM.TSHotelManagement.Application/Business/PromotionContent/PromotionContentService.cs
index 074a652b4beb04d0e67389f3d9c329ed725b4733..fbe20ed4400af43e264920efc17e1aa7d14e3cf5 100644
--- a/EOM.TSHotelManagement.Application/Business/PromotionContent/PromotionContentService.cs
+++ b/EOM.TSHotelManagement.Application/Business/PromotionContent/PromotionContentService.cs
@@ -137,14 +137,9 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- fontsRepository.SoftDelete(new PromotionContent
- {
- Id = deletePromotionContentInputDto.Id,
- PromotionContentNumber = deletePromotionContentInputDto.PromotionContentNumber,
- IsDelete = deletePromotionContentInputDto.IsDelete,
- DataChgUsr = deletePromotionContentInputDto.DataChgUsr,
- DataChgDate = deletePromotionContentInputDto.DataChgDate
- });
+ var font = fontsRepository.GetFirst(a => a.PromotionContentNumber == deletePromotionContentInputDto.PromotionContentNumber && a.IsDelete != 1);
+ font.IsDelete = deletePromotionContentInputDto.IsDelete;
+ fontsRepository.SoftDelete(font);
}
catch (Exception ex)
{
diff --git a/EOM.TSHotelManagement.Application/Business/Reser/IReserService.cs b/EOM.TSHotelManagement.Application/Business/Reser/IReserService.cs
index 431543c0a15bd78eb87adab373b874ef0be192ec..f6e12473e32fd582367f84c5f03b9f74a1c30109 100644
--- a/EOM.TSHotelManagement.Application/Business/Reser/IReserService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Reser/IReserService.cs
@@ -65,5 +65,11 @@ namespace EOM.TSHotelManagement.Application
///
BaseResponse InserReserInfo(CreateReserInputDto r);
+ ///
+ /// 查询所有预约类型
+ ///
+ ///
+ ListOutputDto SelectReserTypeAll();
+
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Business/Reser/ReserService.cs b/EOM.TSHotelManagement.Application/Business/Reser/ReserService.cs
index d174671f9417302361665dc197c1fa736471d97b..6a7a2e3dd862116b03c1df1f950a19949042eb9a 100644
--- a/EOM.TSHotelManagement.Application/Business/Reser/ReserService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Reser/ReserService.cs
@@ -70,6 +70,17 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectReserAll(ReadReserInputDto readReserInputDto)
{
+ var helper = new EnumHelper();
+ var reserType = Enum.GetValues(typeof(ReserType))
+ .Cast()
+ .Select(e => new EnumDto
+ {
+ Id = (int)e,
+ Name = e.ToString(),
+ Description = helper.GetEnumDescription(e)
+ })
+ .ToList();
+
var where = Expressionable.Create();
where = where.And(a => a.IsDelete == readReserInputDto.IsDelete);
var count = 0;
@@ -83,8 +94,10 @@ namespace EOM.TSHotelManagement.Application
Data = reserRepository.AsQueryable().Where(where.ToExpression()).ToList();
count = Data.Count;
}
- Data.ForEach(source =>
+ var mapped = EntityMapper.MapList(Data);
+ mapped.ForEach(source =>
{
+ source.ReservationChannelDescription = reserType.Where(a => a.Name == source.ReservationChannel).Single().Description;
try
{
var sourceTelStr = dataProtector.DecryptReserData(source.ReservationPhoneNumber);
@@ -95,7 +108,6 @@ namespace EOM.TSHotelManagement.Application
source.ReservationPhoneNumber = source.ReservationPhoneNumber;
}
});
- var mapped = EntityMapper.MapList(Data);
return new ListOutputDto
{
Data = new PagedData
@@ -113,6 +125,17 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SelectReserInfoByRoomNo(ReadReserInputDto readReserInputDt)
{
+ var helper = new EnumHelper();
+ var reserType = Enum.GetValues(typeof(ReserType))
+ .Cast()
+ .Select(e => new EnumDto
+ {
+ Id = (int)e,
+ Name = e.ToString(),
+ Description = helper.GetEnumDescription(e)
+ })
+ .ToList();
+
Reser res = null;
res = reserRepository.GetFirst(a => a.ReservationRoomNumber == readReserInputDt.ReservationRoomNumber && a.IsDelete != 1);
//解密联系方式
@@ -121,6 +144,8 @@ namespace EOM.TSHotelManagement.Application
var outputReser = EntityMapper.Map(res);
+ outputReser.ReservationChannelDescription = reserType.Where(a => a.Name == outputReser.ReservationChannel).Single().Description;
+
return new SingleOutputDto { Data = outputReser };
}
@@ -135,14 +160,8 @@ namespace EOM.TSHotelManagement.Application
using (TransactionScope scope = new TransactionScope())
{
- var result = reserRepository.SoftDelete(new Reser()
- {
- Id = reserInfo.Id,
- ReservationId = reser.ReservationId,
- IsDelete = reser.IsDelete,
- DataChgUsr = reser.DataChgUsr,
- DataChgDate = reser.DataChgDate
- });
+ reserInfo.IsDelete = reser.IsDelete;
+ var result = reserRepository.SoftDelete(reserInfo);
if (result)
{
@@ -224,5 +243,33 @@ namespace EOM.TSHotelManagement.Application
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
}
}
+
+ ///
+ /// 查询所有预约类型
+ ///
+ ///
+ public ListOutputDto SelectReserTypeAll()
+ {
+ var helper = new EnumHelper();
+ var enumList = Enum.GetValues(typeof(ReserType))
+ .Cast()
+ .Select(e => new EnumDto
+ {
+ Id = (int)e,
+ Name = e.ToString(),
+ Description = helper.GetEnumDescription(e)
+ })
+ .ToList();
+
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = enumList,
+ TotalCount = enumList.Count
+ }
+ };
+ }
+
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/Room/RoomService.cs b/EOM.TSHotelManagement.Application/Business/Room/RoomService.cs
index 1c3b931e00019505666287626098df72dde8ab36..082950b1adb3cd2381b057487ac0e42b0a908f30 100644
--- a/EOM.TSHotelManagement.Application/Business/Room/RoomService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Room/RoomService.cs
@@ -141,6 +141,31 @@ namespace EOM.TSHotelManagement.Application
var result = EntityMapper.MapList(rooms);
+ var listRoomTypeIds = result.Select(a => a.RoomTypeId).ToList();
+ var listRoomType = roomTypeRepository.AsQueryable().Where(a => listRoomTypeIds.Contains(a.RoomTypeId)).ToList();
+
+ var listCustomerNumbers = result.Select(a => a.CustomerNumber).ToList();
+ var listCustomer = custoRepository.AsQueryable().Where(a => listCustomerNumbers.Contains(a.CustomerNumber)).ToList();
+
+ result.ForEach(r =>
+ {
+ var roomType = listRoomType.SingleOrDefault(a => a.RoomTypeId == r.RoomTypeId);
+ r.RoomName = roomType?.RoomTypeName ?? string.Empty;
+ var customer = listCustomer.SingleOrDefault(a => a.CustomerNumber == r.CustomerNumber);
+ r.CustomerName = customer?.CustomerName ?? string.Empty;
+ var helper = new EnumHelper();
+ var roomStates = Enum.GetValues(typeof(RoomState))
+ .Cast()
+ .Select(e => new EnumDto
+ {
+ Id = (int)e,
+ Name = e.ToString(),
+ Description = helper.GetEnumDescription(e)
+ })
+ .ToList();
+ r.RoomState = roomStates.Where(a => a.Id == r.RoomStateId).Single().Description;
+ });
+
return new ListOutputDto
{
Data = new PagedData
@@ -195,8 +220,11 @@ namespace EOM.TSHotelManagement.Application
count = rooms.Count;
}
+ var customers = custoRepository.AsQueryable().Where(a => rooms.Select(a => a.CustomerNumber).ToList().Contains(a.CustomerNumber));
+
var result = EntityMapper.MapList(rooms);
var roomTypes = roomTypeRepository.AsQueryable().Where(a => a.IsDelete != 1).ToList();
+
foreach (var item in result)
{
var helper = new EnumHelper();
@@ -212,6 +240,8 @@ namespace EOM.TSHotelManagement.Application
item.RoomState = roomStates.Where(a => a.Id == item.RoomStateId).Single().Description;
var roomType = roomTypes.Single(a => a.RoomTypeId == item.RoomTypeId);
item.RoomName = roomType.RoomTypeName;
+ var customer = customers.Single(a => a.CustomerNumber == item.CustomerNumber);
+ item.CustomerName = customer?.CustomerName ?? string.Empty;
}
return new ListOutputDto
{
@@ -250,6 +280,17 @@ namespace EOM.TSHotelManagement.Application
count = rooms.Count;
}
+ var customerNumbers = custoRepository.AsQueryable().Where(a => rooms.Select(a => a.CustomerNumber).ToList().Contains(a.CustomerNumber));
+
+ var roomTypes = roomTypeRepository.AsQueryable().Where(a => a.IsDelete != 1).ToList();
+ rooms.ForEach(room =>
+ {
+ var customer = customerNumbers.Single(a => a.CustomerNumber == room.CustomerNumber);
+ room.CustomerName = customer?.CustomerName ?? string.Empty;
+ var roomType = roomTypes.Single(a => a.RoomTypeId == room.RoomTypeId);
+ room.RoomName = roomType.RoomTypeName;
+ });
+
var result = EntityMapper.MapList(rooms);
return new ListOutputDto
@@ -324,16 +365,13 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- roomRepository.Update(new Room()
- {
- Id = r.Id,
- RoomNumber = r.RoomNumber,
- LastCheckInTime = r.LastCheckInTime,
- RoomStateId = r.RoomStateId,
- CustomerNumber = r.CustomerNumber,
- DataChgDate = r.DataChgDate,
- DataChgUsr = r.DataChgUsr,
- });
+ var room = this.roomRepository.GetFirst(a => a.RoomNumber == r.RoomNumber);
+ room.RoomStateId = r.RoomStateId;
+ room.CustomerNumber = r.CustomerNumber;
+ room.LastCheckInTime = r.LastCheckInTime;
+ room.DataChgDate = r.DataChgDate;
+ room.DataChgUsr = r.DataChgUsr;
+ roomRepository.Update(room);
}
catch (Exception ex)
{
@@ -342,7 +380,7 @@ namespace EOM.TSHotelManagement.Application
return new BaseResponse();
}
- ///
+ ///
/// 根据房间编号修改房间信息(预约)
///
///
@@ -351,14 +389,11 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- roomRepository.Update(new Room()
- {
- Id = r.Id,
- RoomNumber = r.RoomNumber,
- RoomStateId = r.RoomStateId,
- DataChgUsr = r.DataChgUsr,
- DataInsDate = r.DataInsDate,
- });
+ var room = this.roomRepository.GetFirst(a => a.RoomNumber == r.RoomNumber);
+ room.RoomStateId = r.RoomStateId;
+ room.DataChgDate = r.DataChgDate;
+ room.DataChgUsr = r.DataChgUsr;
+ roomRepository.Update(room);
}
catch (Exception ex)
{
@@ -506,12 +541,8 @@ namespace EOM.TSHotelManagement.Application
try
{
var room = roomRepository.GetFirst(a => a.RoomNumber == updateRoomInputDto.RoomNumber);
- roomRepository.Update(new Room()
- {
- Id = room.Id,
- RoomNumber = room.RoomNumber,
- RoomStateId = updateRoomInputDto.RoomStateId
- });
+ room.RoomStateId = updateRoomInputDto.RoomStateId;
+ roomRepository.Update(room);
}
catch (Exception ex)
{
@@ -650,9 +681,7 @@ namespace EOM.TSHotelManagement.Application
{
custoRepository.Update(a => new Customer
{
- CustomerType = newLevelId,
- DataChgUsr = transferRoomDto.DataChgUsr,
- DataChgDate = DateTime.Now
+ CustomerType = newLevelId
}, a => a.CustomerNumber == transferRoomDto.CustomerNumber);
}
@@ -660,33 +689,23 @@ namespace EOM.TSHotelManagement.Application
if (customerType.IsNullOrEmpty())
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("The customer type does not exist", "客户类型不存在"), Code = BusinessStatusCode.InternalServerError };
- decimal discountFactor = customerType.Discount / 100M;
- decimal originalRoomBill = originalRoom.RoomRent * stayDays * discountFactor;
+ decimal discount = (customerType != null && customerType.Discount > 0 && customerType.Discount < 100)
+ ? customerType.Discount / 100M
+ : 1M;
+ decimal originalRoomBill = originalRoom.RoomRent * stayDays * discount;
//更新目标房间状态
- roomRepository.Update(new Room
- {
- Id = targetRoom.Id,
- RoomNumber = targetRoom.RoomNumber,
- CustomerNumber = originalRoom.CustomerNumber,
- LastCheckInTime = DateOnly.FromDateTime(DateTime.Now),
- RoomStateId = (int)RoomState.Occupied,
- DataChgDate = transferRoomDto.DataChgDate,
- DataChgUsr = transferRoomDto.DataChgUsr
- });
+ targetRoom.CustomerNumber = originalRoom.CustomerNumber;
+ targetRoom.RoomStateId = (int)RoomState.Occupied;
+ targetRoom.LastCheckInTime = DateOnly.FromDateTime(DateTime.Now);
+ roomRepository.Update(targetRoom);
//更新原房间状态
- roomRepository.Update(new Room
- {
- Id = originalRoom.Id,
- RoomNumber = originalRoom.RoomNumber,
- CustomerNumber = string.Empty,
- LastCheckInTime = DateOnly.MinValue,
- LastCheckOutTime = DateOnly.FromDateTime(DateTime.Now),
- RoomStateId = (int)RoomState.Dirty,
- DataChgDate = transferRoomDto.DataChgDate,
- DataChgUsr = transferRoomDto.DataChgUsr
- });
+ originalRoom.CustomerNumber = string.Empty;
+ originalRoom.RoomStateId = (int)RoomState.Dirty;
+ originalRoom.LastCheckInTime = DateOnly.MinValue;
+ originalRoom.LastCheckOutTime = DateOnly.MinValue;
+ roomRepository.Update(originalRoom);
//转移原房间消费记录
if (originalSpendNumbers.Count > 0)
@@ -706,7 +725,7 @@ namespace EOM.TSHotelManagement.Application
//添加旧房间消费记录
var originalSpend = new Spend
{
- CustomerNumber = originalRoom.CustomerNumber,
+ CustomerNumber = transferRoomDto.CustomerNumber,
RoomNumber = transferRoomDto.TargetRoomNumber,
SpendNumber = uniqueCode.GetNewId("SP-"),
ProductNumber = transferRoomDto.OriginalRoomNumber,
@@ -717,9 +736,7 @@ namespace EOM.TSHotelManagement.Application
ConsumptionQuantity = stayDays,
ConsumptionAmount = originalRoomBill,
ConsumptionType = SpendType.Room.Code,
- IsDelete = 0,
- DataInsDate = transferRoomDto.DataChgDate,
- DataInsUsr = transferRoomDto.DataChgUsr
+ IsDelete = 0
};
spendRepository.Insert(originalSpend);
@@ -751,17 +768,10 @@ namespace EOM.TSHotelManagement.Application
var room = roomRepository.GetFirst(a => a.RoomNumber == checkoutRoomDto.RoomNumber);
//更新房间状态
- roomRepository.Update(new Room
- {
- Id = room.Id,
- RoomNumber = room.RoomNumber,
- CustomerNumber = null,
- LastCheckInTime = DateOnly.MinValue,
- LastCheckOutTime = DateOnly.FromDateTime(DateTime.Now),
- RoomStateId = (int)RoomState.Dirty,
- DataChgDate = checkoutRoomDto.DataChgDate,
- DataChgUsr = checkoutRoomDto.DataChgUsr
- });
+ room.CustomerNumber = string.Empty;
+ room.LastCheckOutTime = DateOnly.FromDateTime(DateTime.Now);
+ room.RoomStateId = (int)RoomState.Dirty;
+ roomRepository.Update(room);
//添加能源使用记录
var energy = new EnergyManagement
@@ -774,37 +784,21 @@ namespace EOM.TSHotelManagement.Application
Recorder = checkoutRoomDto.DataChgUsr,
CustomerNumber = room.CustomerNumber,
RoomNumber = checkoutRoomDto.RoomNumber,
- IsDelete = 0,
- DataInsDate = checkoutRoomDto.DataChgDate,
- DataInsUsr = checkoutRoomDto.DataChgUsr
+ IsDelete = 0
};
energyRepository.Insert(energy);
//结算消费记录
var spendNumbers = spendRepository.GetList(a => a.RoomNumber == checkoutRoomDto.RoomNumber
- && a.CustomerNumber.Equals(checkoutRoomDto.CustomerNumber) && a.SettlementStatus.Equals(ConsumptionConstant.UnSettle)
+ && a.CustomerNumber.Equals(checkoutRoomDto.CustomerNumber) && a.SettlementStatus == ConsumptionConstant.UnSettle.Code
&& a.IsDelete == 0).ToList();
if (spendNumbers.Count > 0)
{
var spends = new List();
foreach (var spend in spendNumbers)
{
- spends.Add(new Spend
- {
- SpendNumber = spend.SpendNumber,
- RoomNumber = checkoutRoomDto.RoomNumber,
- CustomerNumber = checkoutRoomDto.CustomerNumber,
- ProductName = spend.ProductName,
- ProductPrice = spend.ProductPrice,
- ConsumptionQuantity = spend.ConsumptionQuantity,
- ConsumptionAmount = spend.ConsumptionAmount,
- ConsumptionTime = DateTime.Now,
- SettlementStatus = ConsumptionConstant.Settled.Code,
- ConsumptionType = spend.ConsumptionType,
- IsDelete = 0,
- DataInsDate = checkoutRoomDto.DataChgDate,
- DataInsUsr = checkoutRoomDto.DataChgUsr
- });
+ spend.SettlementStatus = ConsumptionConstant.Settled.Code;
+ spends.Add(spend);
}
spendRepository.UpdateRange(spends);
@@ -853,16 +847,10 @@ namespace EOM.TSHotelManagement.Application
}
var room = roomRepository.GetFirst(a => a.RoomNumber == checkinRoomByReservationDto.RoomNumber && a.IsDelete != 1);
- var roomUpdateResult = roomRepository.Update(new Room()
- {
- RoomNumber = room.RoomNumber,
- Id = room.Id,
- LastCheckInTime = DateOnly.FromDateTime(DateTime.Now),
- CustomerNumber = customer.CustomerNumber,
- RoomStateId = new EnumHelper().GetEnumValue(RoomState.Occupied),
- DataChgDate = checkinRoomByReservationDto.DataChgDate,
- DataChgUsr = checkinRoomByReservationDto.DataChgUsr
- });
+ room.LastCheckInTime = DateOnly.FromDateTime(DateTime.Now);
+ room.CustomerNumber = customer.CustomerNumber;
+ room.RoomStateId = new EnumHelper().GetEnumValue(RoomState.Occupied);
+ var roomUpdateResult = roomRepository.Update(room);
if (!roomUpdateResult)
{
@@ -870,14 +858,8 @@ namespace EOM.TSHotelManagement.Application
}
var reser = reserRepository.GetFirst(a => a.ReservationId == checkinRoomByReservationDto.ReservationId && a.IsDelete != 1);
- var reserUpdateResult = reserRepository.Update(new Reser
- {
- ReservationId = reser.ReservationId,
- Id = reser.Id,
- IsDelete = 1,
- DataChgUsr = checkinRoomByReservationDto.DataChgUsr,
- DataChgDate = checkinRoomByReservationDto.DataChgDate
- });
+ reser.IsDelete = 1;
+ var reserUpdateResult = reserRepository.Update(reser);
if (!reserUpdateResult)
{
diff --git a/EOM.TSHotelManagement.Application/Business/Room/RoomTypeService.cs b/EOM.TSHotelManagement.Application/Business/Room/RoomTypeService.cs
index 71006dc7c090de7b4b0896147142073d7a3c1b6d..c96c78151cc35e46c4ce34146ee39a2f61740e8b 100644
--- a/EOM.TSHotelManagement.Application/Business/Room/RoomTypeService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Room/RoomTypeService.cs
@@ -182,12 +182,9 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- roomTypeRepository.SoftDelete(new RoomType
- {
- RoomTypeId = roomType.RoomTypeId,
- Id = roomType.Id,
- IsDelete = 1
- });
+ var existRoomType = roomTypeRepository.GetFirst(a => a.RoomTypeId == roomType.RoomTypeId && a.IsDelete != 1);
+ existRoomType.IsDelete = roomType.IsDelete;
+ roomTypeRepository.SoftDelete(existRoomType);
}
catch (Exception ex)
{
diff --git a/EOM.TSHotelManagement.Application/Business/Sellthing/ISellService.cs b/EOM.TSHotelManagement.Application/Business/Sellthing/ISellService.cs
index 6d778f407cc5d9c3df7d80aac747c86f571203c0..c5b2a38b35736c9faf7eee078bf9a3c5e281ef40 100644
--- a/EOM.TSHotelManagement.Application/Business/Sellthing/ISellService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Sellthing/ISellService.cs
@@ -48,7 +48,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseResponse UpdateSellthingInfo(UpdateSellThingInputDto sellThing);
+ BaseResponse UpdateSellthing(UpdateSellThingInputDto sellThing);
///
/// 撤回客户消费信息
diff --git a/EOM.TSHotelManagement.Application/Business/Sellthing/SellService.cs b/EOM.TSHotelManagement.Application/Business/Sellthing/SellService.cs
index 0a9c788029d42ec4e0ba908e390987521650199d..0281fd2038c93f6bca8adc83f1f442c94bf45fe7 100644
--- a/EOM.TSHotelManagement.Application/Business/Sellthing/SellService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Sellthing/SellService.cs
@@ -76,7 +76,7 @@ namespace EOM.TSHotelManagement.Application
//商品名称
if (!sellThing.ProductName.IsNullOrEmpty())
{
- exp = exp.Or(a => a.ProductName.Contains(sellThing.ProductName));
+ exp = exp.And(a => a.ProductName.Contains(sellThing.ProductName));
}
//商品规格
@@ -124,16 +124,11 @@ namespace EOM.TSHotelManagement.Application
try
{
var product = sellThingRepository.GetFirst(a => a.ProductNumber == updateSellThingInputDto.ProductNumber);
- sellThingRepository.Update(new SellThing()
- {
- Id = updateSellThingInputDto.Id,
- Specification = updateSellThingInputDto.Specification,
- ProductPrice = updateSellThingInputDto.ProductPrice,
- ProductName = updateSellThingInputDto.ProductName,
- ProductNumber = product.ProductNumber,
- Stock = Convert.ToInt32(updateSellThingInputDto.Stock),
- DataChgDate = DateTime.Now
- });
+ product.Stock = updateSellThingInputDto.Stock;
+ product.Specification = updateSellThingInputDto.Specification;
+ product.ProductPrice = updateSellThingInputDto.ProductPrice;
+ product.ProductName = updateSellThingInputDto.ProductName;
+ sellThingRepository.Update(product);
}
catch (Exception ex)
{
@@ -147,18 +142,16 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseResponse UpdateSellthingInfo(UpdateSellThingInputDto sellThing)
+ public BaseResponse UpdateSellthing(UpdateSellThingInputDto sellThing)
{
try
{
var product = sellThingRepository.GetFirst(a => a.ProductNumber == sellThing.ProductNumber);
- sellThingRepository.Update(new SellThing()
- {
- ProductName = product.ProductName,
- ProductPrice = product.ProductPrice,
- Stock = sellThing.Stock,
- Specification = sellThing.Specification,
- });
+ product.ProductName = product.ProductName;
+ product.ProductPrice = product.ProductPrice;
+ product.Stock = sellThing.Stock;
+ product.Specification = sellThing.Specification;
+ sellThingRepository.Update(product);
}
catch (Exception ex)
{
@@ -177,12 +170,8 @@ namespace EOM.TSHotelManagement.Application
try
{
var product = sellThingRepository.GetFirst(a => a.ProductNumber == deleteSellThingInputDto.ProductNumber);
- sellThingRepository.SoftDelete(new SellThing()
- {
- Id = product.Id,
- ProductNumber = deleteSellThingInputDto.ProductNumber,
- IsDelete = deleteSellThingInputDto.IsDelete,
- });
+ product.IsDelete = deleteSellThingInputDto.IsDelete;
+ sellThingRepository.SoftDelete(product);
}
catch (Exception ex)
{
diff --git a/EOM.TSHotelManagement.Application/Business/Spend/SpendService.cs b/EOM.TSHotelManagement.Application/Business/Spend/SpendService.cs
index 3d744517827c9778526999860383360cf3bd2528..61870d66d5f2f421f3f6a5d33b321d176b3f2ffc 100644
--- a/EOM.TSHotelManagement.Application/Business/Spend/SpendService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Spend/SpendService.cs
@@ -28,6 +28,7 @@ using EOM.TSHotelManagement.EntityFramework;
using EOM.TSHotelManagement.Shared;
using jvncorelib.CodeLib;
using jvncorelib.EntityLib;
+using Microsoft.AspNetCore.Http;
using SqlSugar;
using System.Transactions;
@@ -72,16 +73,9 @@ namespace EOM.TSHotelManagement.Application
private readonly GenericRepository operationLogRepository;
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public SpendService(GenericRepository spendRepository, GenericRepository sellThingRepository, GenericRepository roomRepository, GenericRepository customerRepository, GenericRepository custoTypeRepository, GenericRepository operationLogRepository)
+ private readonly IHttpContextAccessor _httpContextAccessor;
+
+ public SpendService(GenericRepository spendRepository, GenericRepository sellThingRepository, GenericRepository roomRepository, GenericRepository customerRepository, GenericRepository custoTypeRepository, GenericRepository operationLogRepository, IHttpContextAccessor httpContextAccessor)
{
this.spendRepository = spendRepository;
this.sellThingRepository = sellThingRepository;
@@ -89,6 +83,7 @@ namespace EOM.TSHotelManagement.Application
this.customerRepository = customerRepository;
this.custoTypeRepository = custoTypeRepository;
this.operationLogRepository = operationLogRepository;
+ _httpContextAccessor = httpContextAccessor;
}
#region 根据客户编号查询历史消费信息
@@ -116,6 +111,22 @@ namespace EOM.TSHotelManagement.Application
count = spends.Count;
}
var result = EntityMapper.MapList(spends);
+
+ result.ForEach(r =>
+ {
+ r.SettlementStatusDescription = r.SettlementStatus.IsNullOrEmpty() ? ""
+ : r.SettlementStatus.Equals(ConsumptionConstant.Settled.Code) ? "已结算" : "未结算";
+
+ r.ProductPriceFormatted = (r.ProductPrice + "").IsNullOrEmpty() ? ""
+ : Decimal.Parse(r.ProductPrice.ToString()).ToString("#,##0.00").ToString();
+
+ r.ConsumptionAmountFormatted = (r.ConsumptionAmount + "").IsNullOrEmpty() ? ""
+ : Decimal.Parse(r.ConsumptionAmount.ToString()).ToString("#,##0.00").ToString();
+
+ r.ConsumptionTypeDescription = r.ConsumptionType == SpendType.Product.Code ? SpendType.Product.Description :
+ r.ConsumptionType == SpendType.Room.Code ? SpendType.Room.Description : SpendType.Other.Description;
+ });
+
return new ListOutputDto
{
Data = new PagedData
@@ -136,10 +147,27 @@ namespace EOM.TSHotelManagement.Application
public ListOutputDto SelectSpendByRoomNo(ReadSpendInputDto readSpendInputDto)
{
var where = Expressionable.Create();
+
+ if (!readSpendInputDto.CustomerNumber.IsNullOrEmpty())
+ {
+ where = where.And(a => a.CustomerNumber == readSpendInputDto.CustomerNumber);
+ }
+
+ if (!readSpendInputDto.SettlementStatus.IsNullOrEmpty())
+ {
+ where = where.And(a => a.SettlementStatus == readSpendInputDto.SettlementStatus);
+ }
+
if (!readSpendInputDto.RoomNumber.IsNullOrEmpty())
{
where = where.And(a => a.RoomNumber == readSpendInputDto.RoomNumber);
}
+
+ if (!readSpendInputDto.SpendNumber.IsNullOrEmpty())
+ {
+ where = where.And(a => a.SpendNumber.Contains(readSpendInputDto.SpendNumber));
+ }
+
var count = 0;
List spends = new List();
if (!readSpendInputDto.IgnorePaging && readSpendInputDto.Page != 0 && readSpendInputDto.PageSize != 0)
@@ -152,6 +180,22 @@ namespace EOM.TSHotelManagement.Application
count = spends.Count;
}
var result = EntityMapper.MapList(spends);
+
+ result.ForEach(r =>
+ {
+ r.SettlementStatusDescription = r.SettlementStatus.IsNullOrEmpty() ? ""
+ : r.SettlementStatus.Equals(ConsumptionConstant.Settled.Code) ? "已结算" : "未结算";
+
+ r.ProductPriceFormatted = (r.ProductPrice + "").IsNullOrEmpty() ? ""
+ : Decimal.Parse(r.ProductPrice.ToString()).ToString("#,##0.00").ToString();
+
+ r.ConsumptionAmountFormatted = (r.ConsumptionAmount + "").IsNullOrEmpty() ? ""
+ : Decimal.Parse(r.ConsumptionAmount.ToString()).ToString("#,##0.00").ToString();
+
+ r.ConsumptionTypeDescription = r.ConsumptionType == SpendType.Product.Code ? SpendType.Product.Description :
+ r.ConsumptionType == SpendType.Room.Code ? SpendType.Room.Description : SpendType.Other.Description;
+ });
+
return new ListOutputDto
{
Data = new PagedData
@@ -183,58 +227,28 @@ namespace EOM.TSHotelManagement.Application
count = spends.Count;
}
var result = EntityMapper.MapList(spends);
- return new ListOutputDto
- {
- Data = new PagedData
- {
- Items = result,
- TotalCount = count
- }
- };
- }
- #endregion
- #region 根据房间号查询消费的所有信息
- ///
- /// 根据房间号查询消费的所有信息
- ///
- ///
- public ListOutputDto SelectSpendInfoRoomNo(ReadSpendInputDto readSpendInputDto)
- {
- List ls = spendRepository.GetList(a => a.RoomNumber == readSpendInputDto.RoomNumber && a.IsDelete != 1 && a.SettlementStatus.Equals(ConsumptionConstant.UnSettle));
- var spendNames = ls.Select(a => a.ProductName).ToList();
- var spendInfos = sellThingRepository.AsQueryable().Where(a => spendNames.Contains(a.ProductName)).ToList();
- ls.ForEach(source =>
+ result.ForEach(r =>
{
- if (source.ProductNumber.IsNullOrEmpty())
- {
- var spendInfo = spendInfos.SingleOrDefault(a => a.ProductName.Equals(source.ProductName));
- if (spendInfo != null)
- {
- source.ProductNumber = spendInfo.ProductNumber;
- }
- }
+ r.SettlementStatusDescription = r.SettlementStatus.IsNullOrEmpty() ? ""
+ : r.SettlementStatus.Equals(ConsumptionConstant.Settled.Code) ? "已结算" : "未结算";
- source.SettlementStatusDescription = source.SettlementStatus.IsNullOrEmpty() ? ""
- : source.SettlementStatus.Equals(ConsumptionConstant.Settled) ? "已结算" : "未结算";
+ r.ProductPriceFormatted = (r.ProductPrice + "").IsNullOrEmpty() ? ""
+ : Decimal.Parse(r.ProductPrice.ToString()).ToString("#,##0.00").ToString();
- source.ProductPriceFormatted = (source.ProductPrice + "").IsNullOrEmpty() ? ""
- : Decimal.Parse(source.ProductPrice.ToString()).ToString("#,##0.00").ToString();
+ r.ConsumptionAmountFormatted = (r.ConsumptionAmount + "").IsNullOrEmpty() ? ""
+ : Decimal.Parse(r.ConsumptionAmount.ToString()).ToString("#,##0.00").ToString();
- source.ConsumptionAmountFormatted = (source.ConsumptionAmount + "").IsNullOrEmpty() ? ""
- : Decimal.Parse(source.ConsumptionAmount.ToString()).ToString("#,##0.00").ToString();
-
- source.ConsumptionTypeDescription = source.ConsumptionType == SpendType.Product.Code ? SpendType.Product.Description :
- source.ConsumptionType == SpendType.Room.Code ? SpendType.Room.Description : SpendType.Other.Description;
+ r.ConsumptionTypeDescription = r.ConsumptionType == SpendType.Product.Code ? SpendType.Product.Description :
+ r.ConsumptionType == SpendType.Room.Code ? SpendType.Room.Description : SpendType.Other.Description;
});
- var mapped = EntityMapper.MapList(ls);
return new ListOutputDto
{
Data = new PagedData
{
- Items = mapped,
- TotalCount = mapped.Count
+ Items = result,
+ TotalCount = count
}
};
}
@@ -248,7 +262,7 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SumConsumptionAmount(ReadSpendInputDto readSpendInputDto)
{
- var TotalCountAmount = spendRepository.GetList(a => a.RoomNumber == readSpendInputDto.RoomNumber && a.CustomerNumber == readSpendInputDto.CustomerNumber && a.SettlementStatus.Equals(ConsumptionConstant.UnSettle)).Sum(a => a.ConsumptionAmount);
+ var TotalCountAmount = spendRepository.GetList(a => a.RoomNumber == readSpendInputDto.RoomNumber && a.CustomerNumber == readSpendInputDto.CustomerNumber && a.SettlementStatus == ConsumptionConstant.UnSettle.Code).Sum(a => a.ConsumptionAmount);
return new SingleOutputDto { Data = new ReadSpendInputDto { ConsumptionAmount = TotalCountAmount } };
}
#endregion
@@ -262,15 +276,9 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- var existingSpend = spendRepository.AsQueryable().Where(a => a.SpendNumber == updateSpendInputDto.SpendNumber && a.IsDelete != 1).Single();
- spendRepository.Update(new Spend()
- {
- Id = existingSpend.Id,
- SpendNumber = existingSpend.SpendNumber,
- IsDelete = 1,
- DataChgDate = updateSpendInputDto.DataChgDate,
- DataChgUsr = updateSpendInputDto.DataChgUsr
- });
+ var existingSpend = spendRepository.GetFirst(a => a.SpendNumber == updateSpendInputDto.SpendNumber && a.IsDelete != 1);
+ existingSpend.IsDelete = 1;
+ spendRepository.Update(existingSpend);
}
catch (Exception ex)
{
@@ -308,10 +316,11 @@ namespace EOM.TSHotelManagement.Application
}
var customerType = custoTypeRepository.AsQueryable().Single(a => a.CustomerType == customer.CustomerType);
- decimal discountPercent = customerType?.Discount ?? 100m;
+ decimal discount = (customerType != null && customerType.Discount > 0 && customerType.Discount < 100)
+ ? customerType.Discount / 100M
+ : 1M;
- decimal originalAmount = addCustomerSpendInputDto.Price * addCustomerSpendInputDto.Quantity;
- decimal realAmount = DiscountHelper.RealAmount(discountPercent, originalAmount);
+ decimal realAmount = addCustomerSpendInputDto.Price * addCustomerSpendInputDto.Quantity * discount;
var existingSpend = spendRepository.AsQueryable().Single(a => a.RoomNumber == addCustomerSpendInputDto.RoomNumber && a.ProductNumber == addCustomerSpendInputDto.ProductNumber && a.IsDelete != 1 && a.SettlementStatus == ConsumptionConstant.UnSettle.Code);
@@ -356,12 +365,8 @@ namespace EOM.TSHotelManagement.Application
}
var product = sellThingRepository.AsQueryable().Single(a => a.ProductNumber == addCustomerSpendInputDto.ProductNumber);
- var updateResult = sellThingRepository.Update(new SellThing
- {
- ProductNumber = product.ProductNumber,
- Id = product.Id,
- Stock = product.Stock - addCustomerSpendInputDto.Quantity
- });
+ product.Stock = product.Stock - addCustomerSpendInputDto.Quantity;
+ var updateResult = sellThingRepository.Update(product);
if (!updateResult)
{
return new BaseResponse() { Message = "商品库存更新失败", Code = BusinessStatusCode.InternalServerError };
@@ -373,11 +378,14 @@ namespace EOM.TSHotelManagement.Application
$"数量 {addCustomerSpendInputDto.Quantity}, " +
$"金额 {realAmount.ToString("#,##0.00")}";
+ var context = _httpContextAccessor.HttpContext;
var log = new OperationLog
{
+ OperationId = new UniqueCode().GetNewId("OP-"),
OperationTime = Convert.ToDateTime(DateTime.Now),
LogContent = logContent,
+ LoginIpAddress = context.Connection.RemoteIpAddress?.ToString() ?? string.Empty,
OperationAccount = addCustomerSpendInputDto.WorkerNo,
LogLevel = LogLevel.Warning,
SoftwareVersion = addCustomerSpendInputDto.SoftwareVersion,
@@ -410,19 +418,14 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- spendRepository.Update(new Spend()
- {
- Id = spend.Id,
- SpendNumber = spend.SpendNumber,
- SettlementStatus = ConsumptionConstant.UnSettle.Code,
- RoomNumber = spend.RoomNumber,
- CustomerNumber = spend.CustomerNumber,
- ProductName = spend.ProductName,
- ConsumptionQuantity = spend.ConsumptionQuantity,
- ConsumptionAmount = spend.ConsumptionAmount,
- DataChgDate = spend.DataChgDate,
- DataChgUsr = spend.DataChgUsr
- });
+ var dbSpend = spendRepository.GetFirst(a => a.SpendNumber == spend.SpendNumber && a.IsDelete != 1);
+ dbSpend.SettlementStatus = spend.SettlementStatus;
+ dbSpend.RoomNumber = spend.RoomNumber;
+ dbSpend.CustomerNumber = spend.CustomerNumber;
+ dbSpend.ProductName = spend.ProductName;
+ dbSpend.ConsumptionQuantity = spend.ConsumptionQuantity;
+ dbSpend.ConsumptionAmount = spend.ConsumptionAmount;
+ spendRepository.Update(dbSpend);
}
catch (Exception ex)
{
diff --git a/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs b/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs
index 71f7d88df498a0ee3cd4ff0e0af4d07b066740b0..601cd33a6333e05a8b0a915eb22b453e8bc129c1 100644
--- a/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs
@@ -458,15 +458,9 @@ namespace EOM.TSHotelManagement.Application
mailHelper.SendMail(new List { employee.EmailAddress }, mailTemplate.Subject, mailTemplate.Body, new List { employee.EmailAddress });
}
- workerRepository.Update(new Employee()
- {
- Id = employee.Id,
- EmployeeId = employee.EmployeeId,
- Password = encrypted,
- IsInitialize = 1,
- DataChgUsr = updateEmployeeInputDto.DataChgUsr,
- DataChgDate = updateEmployeeInputDto.DataChgDate
- });
+ employee.Password = encrypted;
+ employee.IsInitialize = 1;
+ workerRepository.Update(employee);
}
catch (Exception ex)
{
@@ -512,14 +506,9 @@ namespace EOM.TSHotelManagement.Application
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("E-Mail Config Invaild, Reset Password Faild", "电子邮件配置无效,重置密码失败"), Code = BusinessStatusCode.InternalServerError };
}
- workerRepository.Update(new Employee()
- {
- Id = employee.Id,
- EmployeeId = employee.EmployeeId,
- Password = encrypted,
- DataChgUsr = updateEmployeeInputDto.DataChgUsr,
- DataChgDate = updateEmployeeInputDto.DataChgDate
- });
+ employee.Password = encrypted;
+
+ workerRepository.Update(employee);
}
catch (Exception ex)
{
diff --git a/EOM.TSHotelManagement.Application/Employee/Photo/EmployeePhotoService.cs b/EOM.TSHotelManagement.Application/Employee/Photo/EmployeePhotoService.cs
index 5fb53cd9b00d874dc30f09848fc8cd3ffb3e274e..72ab9027ecad85baf7440fd98a42c78e21dcc1dd 100644
--- a/EOM.TSHotelManagement.Application/Employee/Photo/EmployeePhotoService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/Photo/EmployeePhotoService.cs
@@ -124,12 +124,9 @@ namespace EOM.TSHotelManagement.Application
}
else
{
- workerPicRepository.Update(new EmployeePhoto
- {
- Id = workerPicData.Id,
- EmployeeId = workerPicData.EmployeeId,
- PhotoPath = imageUrl
- });
+ workerPicData = workerPicRepository.GetFirst(a => a.EmployeeId.Equals(createEmployeePhotoInputDto.EmployeeId));
+ workerPicData.PhotoPath = imageUrl;
+ workerPicRepository.Update(workerPicData);
}
return new SingleOutputDto
@@ -176,12 +173,8 @@ namespace EOM.TSHotelManagement.Application
try
{
var workerPicData = workerPicRepository.GetFirst(a => a.EmployeeId.Equals(updateEmployeePhotoInputDto.EmployeeId));
- workerPicRepository.Update(new EmployeePhoto
- {
- Id = workerPicData.Id,
- EmployeeId = workerPicData.EmployeeId,
- PhotoPath = updateEmployeePhotoInputDto.PhotoUrl
- });
+ workerPicData.PhotoPath = updateEmployeePhotoInputDto.PhotoUrl;
+ workerPicRepository.Update(workerPicData);
}
catch (Exception ex)
{
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Base/BaseService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Base/BaseService.cs
index ed739fc1b662a26c3f5eacfc7112cc8f783c51d5..56a9f007df67359957cd41ddacbe9c25b6dd2b80 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Base/BaseService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Base/BaseService.cs
@@ -113,6 +113,37 @@ namespace EOM.TSHotelManagement.Application
this.appointmentNoticeTypeRepository = appointmentNoticeTypeRepository;
}
+ #region 预约类型模块
+
+ ///
+ /// 查询所有预约类型
+ ///
+ ///
+ public ListOutputDto SelectReserTypeAll()
+ {
+ var helper = new EnumHelper();
+ var enumList = Enum.GetValues(typeof(ReserType))
+ .Cast()
+ .Select(e => new EnumDto
+ {
+ Id = (int)e,
+ Name = e.ToString(),
+ Description = helper.GetEnumDescription(e)
+ })
+ .ToList();
+
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = enumList,
+ TotalCount = enumList.Count
+ }
+ };
+ }
+
+ #endregion
+
#region 性别模块
///
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Base/IBaseService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Base/IBaseService.cs
index 2ecafd4ef1a208aa0f3b3ee48efaef1f68a4ccfa..0b593941c731d46fd65196c19b0a157e0b07dd51 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Base/IBaseService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Base/IBaseService.cs
@@ -30,6 +30,16 @@ namespace EOM.TSHotelManagement.Application
///
public interface IBaseService
{
+ #region 预约类型模块
+
+ ///
+ /// 查询所有预约类型
+ ///
+ ///
+ ListOutputDto SelectReserTypeAll();
+
+ #endregion
+
#region 性别模块
///
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs b/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs
index 772e27093d6241aea42d26a0356f393c8d4c609d..b4dd1f602b647504c8638d7cb4b9c18e71e8f25b 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs
@@ -110,20 +110,14 @@ namespace EOM.TSHotelManagement.Application
try
{
var supervisionStatistics = checkInfoRepository.GetFirst(a => a.StatisticsNumber == checkInfo.StatisticsNumber);
- checkInfoRepository.Update(new SupervisionStatistics
- {
- Id = supervisionStatistics.Id,
- StatisticsNumber = supervisionStatistics.StatisticsNumber,
- SupervisingDepartment = checkInfo.SupervisingDepartment,
- SupervisionLoss = checkInfo.SupervisionLoss,
- SupervisionScore = checkInfo.SupervisionScore,
- SupervisionAdvice = checkInfo.SupervisionAdvice,
- SupervisionStatistician = checkInfo.SupervisionStatistician,
- SupervisionProgress = checkInfo.SupervisionProgress,
- IsDelete = 0,
- DataChgUsr = checkInfo.DataChgUsr,
- DataChgDate = checkInfo.DataChgDate
- });
+ supervisionStatistics.SupervisingDepartment = checkInfo.SupervisingDepartment;
+ supervisionStatistics.SupervisionLoss = checkInfo.SupervisionLoss;
+ supervisionStatistics.SupervisionScore = checkInfo.SupervisionScore;
+ supervisionStatistics.SupervisionAdvice = checkInfo.SupervisionAdvice;
+ supervisionStatistics.SupervisionStatistician = checkInfo.SupervisionStatistician;
+ supervisionStatistics.SupervisionProgress = checkInfo.SupervisionProgress;
+
+ checkInfoRepository.Update(supervisionStatistics);
}
catch (Exception ex)
{
@@ -141,14 +135,9 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- checkInfoRepository.SoftDelete(new SupervisionStatistics
- {
- StatisticsNumber = checkInfo.StatisticsNumber,
- Id = checkInfo.Id,
- IsDelete = 1,
- DataChgUsr = checkInfo.DataChgUsr,
- DataChgDate = checkInfo.DataChgDate
- });
+ var existing = checkInfoRepository.GetFirst(a => a.StatisticsNumber == checkInfo.StatisticsNumber && a.IsDelete == 0);
+ existing.IsDelete = 1;
+ checkInfoRepository.SoftDelete(existing);
}
catch (Exception ex)
{
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/VipRule/VipRuleAppService.cs b/EOM.TSHotelManagement.Application/SystemManagement/VipRule/VipRuleAppService.cs
index 6ae5a6c8fc4fff8bfa89a7fddbd42225ec7c98ae..6a67a39bc9dfb344bbadf65d12a7b247e6089ed8 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/VipRule/VipRuleAppService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/VipRule/VipRuleAppService.cs
@@ -148,13 +148,9 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- vipRuleRepository.SoftDelete(new VipLevelRule
- {
- Id = vipRule.Id,
- RuleSerialNumber = vipRule.RuleSerialNumber,
- IsDelete = vipRule.IsDelete,
- DataChgUsr = vipRule.DataChgUsr,
- });
+ var dbVipRule = vipRuleRepository.GetFirst(a => a.RuleSerialNumber == vipRule.RuleSerialNumber && a.IsDelete != 1);
+ dbVipRule.IsDelete = vipRule.IsDelete;
+ vipRuleRepository.SoftDelete(dbVipRule);
}
catch (Exception ex)
{
@@ -172,16 +168,10 @@ namespace EOM.TSHotelManagement.Application
{
try
{
- vipRuleRepository.Update(new VipLevelRule
- {
- Id = vipRule.Id,
- RuleSerialNumber = vipRule.RuleSerialNumber,
- RuleName = vipRule.RuleName,
- RuleValue = vipRule.RuleValue,
- IsDelete = vipRule.IsDelete,
- DataChgUsr = vipRule.DataChgUsr,
- DataChgDate = vipRule.DataChgDate
- });
+ var dbVipRule = vipRuleRepository.GetFirst(a => a.RuleSerialNumber == vipRule.RuleSerialNumber && a.IsDelete != 1);
+ dbVipRule.RuleName = vipRule.RuleName;
+ dbVipRule.RuleValue = vipRule.RuleValue;
+ vipRuleRepository.Update(dbVipRule);
}
catch (Exception ex)
{
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseDto.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseDto.cs
index b937dcae65ffd11c1a4450fff59b7a77c0566c76..6a9c066dd064c9b1a665e89f0c485bdfa2813eaf 100644
--- a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseDto.cs
@@ -2,7 +2,7 @@
{
public class BaseDto
{
- public int Id { get; set; }
+ public int Id { get; set; } = 0;
///
/// Token
///
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Reser/Dto/ReadReserOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Reser/Dto/ReadReserOutputDto.cs
index b36b8dcbda3e6bbf4721a4d7cc768d30cc06962b..0f3bd0dbbbf275e823fba31133b41bc0278e4086 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Reser/Dto/ReadReserOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Reser/Dto/ReadReserOutputDto.cs
@@ -15,6 +15,7 @@ namespace EOM.TSHotelManagement.Common.Contract
public string ReservationRoomNumber { get; set; }
[UIDisplay("ԤԼ")]
public string ReservationChannel { get; set; }
+ public string ReservationChannelDescription { get; set; }
[UIDisplay("ԤԼʼ")]
public DateTime ReservationStartDate { get; set; }
[UIDisplay("ԤԼֹ")]
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/CreateSellThingInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/CreateSellThingInputDto.cs
index 5e08c5990136f0d200e2d01fef5da15147fb72af..7dbcbc7fb572ddb3c673a08fed5282987b819321 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/CreateSellThingInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/CreateSellThingInputDto.cs
@@ -6,7 +6,7 @@ namespace EOM.TSHotelManagement.Common.Contract
public string ProductName { get; set; }
public decimal ProductPrice { get; set; }
public string Specification { get; set; }
- public decimal Stock { get; set; }
+ public int Stock { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/ReadSellThingOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/ReadSellThingOutputDto.cs
index 28631278f1f8b29ee158d5b93c94c867f2cc3a96..78bd59c485bd6b38d13031d2f90f7761582e3fe2 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/ReadSellThingOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/ReadSellThingOutputDto.cs
@@ -13,8 +13,8 @@ namespace EOM.TSHotelManagement.Common.Contract
public decimal ProductPrice { get; set; }
[UIDisplay("ͺ")]
public string Specification { get; set; }
- [UIDisplay("")]
- public decimal Stock { get; set; }
+ [UIDisplay("",true,true)]
+ public int Stock { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/UpdateSellThingInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/UpdateSellThingInputDto.cs
index 35ec42ae3ec5ac611270747d4991a28ae57c4536..e9c6ce8840dd3e54737a57e525d888301eca776e 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/UpdateSellThingInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/UpdateSellThingInputDto.cs
@@ -6,7 +6,7 @@ namespace EOM.TSHotelManagement.Common.Contract
public string ProductName { get; set; }
public decimal ProductPrice { get; set; }
public string Specification { get; set; }
- public decimal Stock { get; set; }
+ public int Stock { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/CreateOperationLogInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/CreateOperationLogInputDto.cs
index 7ec26aac06debf4655259d7dada6a5155fa81a7c..03becf9d3564d717b74f0299ac558f385a9120c3 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/CreateOperationLogInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/CreateOperationLogInputDto.cs
@@ -4,6 +4,7 @@ namespace EOM.TSHotelManagement.Common.Contract
{
public class CreateOperationLogInputDto : BaseInputDto
{
+ public string OperationId { get; set; }
public DateTime OperationTime { get; set; }
public string LogContent { get; set; }
public string OperationAccount { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Core/Business/Reser/ReserType.cs b/EOM.TSHotelManagement.Common.Core/Business/Reser/ReserType.cs
new file mode 100644
index 0000000000000000000000000000000000000000..4baa453eed5cdbce83bf415fd83afc70786faf2b
--- /dev/null
+++ b/EOM.TSHotelManagement.Common.Core/Business/Reser/ReserType.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EOM.TSHotelManagement.Common.Core
+{
+ public enum ReserType
+ {
+ [Description("线下")]
+ Offline = 1,
+
+ [Description("应用程序")]
+ App = 2,
+
+ [Description("小程序")]
+ Applet = 3,
+
+ [Description("网页端")]
+ Website = 4,
+ }
+}
diff --git a/EOM.TSHotelManagement.Common.Core/Business/Sellthing/SellThing.cs b/EOM.TSHotelManagement.Common.Core/Business/Sellthing/SellThing.cs
index d212278390379b95a3401b5c74ad74b88cbf0bff..e4072048489c2cab8f9ebd56b3427acb4e8ad333 100644
--- a/EOM.TSHotelManagement.Common.Core/Business/Sellthing/SellThing.cs
+++ b/EOM.TSHotelManagement.Common.Core/Business/Sellthing/SellThing.cs
@@ -102,7 +102,7 @@ namespace EOM.TSHotelManagement.Common.Core
DecimalDigits = 0,
DefaultValue = "0"
)]
- public decimal Stock { get; set; }
+ public int Stock { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Core/Util/OperationLog.cs b/EOM.TSHotelManagement.Common.Core/Util/OperationLog.cs
index ba84ed7de3766a93a1aa98dd525a7f6e8424c6c6..33a9ba1b32ecad93ebb956b8c318be871959f0cf 100644
--- a/EOM.TSHotelManagement.Common.Core/Util/OperationLog.cs
+++ b/EOM.TSHotelManagement.Common.Core/Util/OperationLog.cs
@@ -141,82 +141,5 @@ namespace EOM.TSHotelManagement.Common.Core
///
[SugarColumn(IsIgnore = true)]
public string LogLevelName { get; set; }
-
- ///
- /// 请求路径 (Request Path)
- ///
- [SugarColumn(
- ColumnName = "request_path",
- ColumnDescription = "请求路径 (Request Path)",
- IsNullable = false,
- Length = 500
- )]
- public string RequestPath { get; set; }
-
- ///
- /// 查询字符串 (Query String)
- ///
- [SugarColumn(
- ColumnName = "query_string",
- ColumnDescription = "查询参数 (Query String)",
- IsNullable = true,
- Length = 2000
- )]
- public string QueryString { get; set; }
-
- ///
- /// 响应时间 (Elapsed Time)
- ///
- [SugarColumn(
- ColumnName = "elapsed_time",
- ColumnDescription = "响应时间(毫秒) (Elapsed Time in ms)",
- IsNullable = false,
- DefaultValue = "0"
- )]
- public long ElapsedTime { get; set; }
-
- ///
- /// 请求方法 (Http Method)
- ///
- [SugarColumn(
- ColumnName = "http_method",
- ColumnDescription = "HTTP请求方法 (HTTP Method)",
- IsNullable = false,
- Length = 10
- )]
- public string HttpMethod { get; set; }
-
- ///
- /// 状态码 (Status Code)
- ///
- [SugarColumn(
- ColumnName = "status_code",
- ColumnDescription = "HTTP状态码 (HTTP Status Code)",
- IsNullable = false,
- DefaultValue = "200"
- )]
- public int StatusCode { get; set; }
-
- ///
- /// 异常消息 (Exception Message)
- ///
- [SugarColumn(
- ColumnName = "exception_message",
- ColumnDescription = "异常消息内容 (Exception Message)",
- IsNullable = true,
- Length = 2000
- )]
- public string ExceptionMessage { get; set; }
-
- ///
- /// 异常堆栈 (Exception Stack Trace)
- ///
- [SugarColumn(
- ColumnName = "exception_stacktrace",
- ColumnDescription = "异常堆栈信息 (Exception Stack Trace)",
- IsNullable = true,
- Length = 4000
- )]
- public string ExceptionStackTrace { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Util/EOM.TSHotelManagement.Common.Util.csproj b/EOM.TSHotelManagement.Common.Util/EOM.TSHotelManagement.Common.Util.csproj
index a885042cab99fe552f2e6e4f1d878dd347899132..04b9e2311b25f13a9d6fc2f851b94462405bae10 100644
--- a/EOM.TSHotelManagement.Common.Util/EOM.TSHotelManagement.Common.Util.csproj
+++ b/EOM.TSHotelManagement.Common.Util/EOM.TSHotelManagement.Common.Util.csproj
@@ -10,7 +10,6 @@
-
diff --git a/EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/DatabaseInitializer.cs b/EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/DatabaseInitializer.cs
index baee303d9ee41155364940c6adaac2d5dff9d7eb..57ea31329942d86fcaf831d74edc41b3f4892603 100644
--- a/EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/DatabaseInitializer.cs
+++ b/EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/DatabaseInitializer.cs
@@ -1,11 +1,8 @@
using EOM.TSHotelManagement.Common.Core;
using EOM.TSHotelManagement.Migration;
using EOM.TSHotelManagement.Shared;
-using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using MySqlConnector;
-using Npgsql;
-using Oracle.ManagedDataAccess.Client;
using SqlSugar;
namespace EOM.TSHotelManagement.EntityFramework
@@ -104,15 +101,15 @@ namespace EOM.TSHotelManagement.EntityFramework
case DbType.MySqlConnector:
var builder = new MySqlConnectionStringBuilder(connectionString);
return (builder.Database, dbType);
- case DbType.SqlServer:
- var sqlBuilder = new SqlConnectionStringBuilder(connectionString);
- return (sqlBuilder.InitialCatalog, dbType);
- case DbType.Oracle:
- var oracleBuilder = new OracleConnectionStringBuilder(connectionString);
- return (oracleBuilder.DataSource, dbType);
- case DbType.PostgreSQL:
- var pgsqlBuilder = new NpgsqlConnectionStringBuilder(connectionString);
- return (pgsqlBuilder.Database, dbType);
+ //case DbType.SqlServer: //This project not include reference Package.Please manual install Microsoft.EntityFrameworkCore.SqlServer
+ // var sqlBuilder = new SqlConnectionStringBuilder(connectionString);
+ // return (sqlBuilder.InitialCatalog, dbType);
+ //case DbType.Oracle: //This project not include reference Package.Please manual install Oracle.ManagedDataAccess.Core
+ // var oracleBuilder = new OracleConnectionStringBuilder(connectionString);
+ // return (oracleBuilder.DataSource, dbType);
+ //case DbType.PostgreSQL: //This project not include reference Package.Please manual install Npgsql.EntityFrameworkCore.PostgreSQL
+ // var pgsqlBuilder = new NpgsqlConnectionStringBuilder(connectionString);
+ // return (pgsqlBuilder.Database, dbType);
default:
throw new NotSupportedException($"Unsupported DbType: {dbType}");
}
@@ -133,27 +130,27 @@ namespace EOM.TSHotelManagement.EntityFramework
Database = null,
};
break;
- case DbType.SqlServer:
- builder = new SqlConnectionStringBuilder(connectionString)
- {
- InitialCatalog = "master",
- ConnectTimeout = 30
- };
- break;
- case DbType.Oracle:
- builder = new OracleConnectionStringBuilder(connectionString)
- {
- UserID = "sys as sysdba",
- };
- break;
- case DbType.PostgreSQL:
- builder = new NpgsqlConnectionStringBuilder(connectionString)
- {
- Database = "postgres",
- Timeout = 30,
- Pooling = false
- };
- break;
+ //case DbType.SqlServer: //This project not include reference Package.Please manual install Microsoft.EntityFrameworkCore.SqlServer
+ // builder = new SqlConnectionStringBuilder(connectionString)
+ // {
+ // InitialCatalog = "master",
+ // ConnectTimeout = 30
+ // };
+ // break;
+ //case DbType.Oracle: //This project not include reference Package.Please manual install Oracle.ManagedDataAccess.Core
+ // builder = new OracleConnectionStringBuilder(connectionString)
+ // {
+ // UserID = "sys as sysdba",
+ // };
+ // break;
+ //case DbType.PostgreSQL: //This project not include reference Package.Please manual install Npgsql.EntityFrameworkCore.PostgreSQL
+ // builder = new NpgsqlConnectionStringBuilder(connectionString)
+ // {
+ // Database = "postgres",
+ // Timeout = 30,
+ // Pooling = false
+ // };
+ // break;
}
return new SqlSugarClient(new ConnectionConfig
diff --git a/EOM.TSHotelManagement.EntityFramework/EOM.TSHotelManagement.EntityFramework.csproj b/EOM.TSHotelManagement.EntityFramework/EOM.TSHotelManagement.EntityFramework.csproj
index 9251206fc0d20e7e516528351294bc5d87dc01e7..35ae5c0fd5aca78402ee9d6dbf90fb029206a779 100644
--- a/EOM.TSHotelManagement.EntityFramework/EOM.TSHotelManagement.EntityFramework.csproj
+++ b/EOM.TSHotelManagement.EntityFramework/EOM.TSHotelManagement.EntityFramework.csproj
@@ -9,10 +9,8 @@
-
+
-
-
diff --git a/EOM.TSHotelManagement.EntityFramework/Repository/GenericRepository.cs b/EOM.TSHotelManagement.EntityFramework/Repository/GenericRepository.cs
index 0c7cdfeb8e611de09ee716ca11622e58f938a357..3fb2db88817899bf313dcd1548a08c7aa77bf260 100644
--- a/EOM.TSHotelManagement.EntityFramework/Repository/GenericRepository.cs
+++ b/EOM.TSHotelManagement.EntityFramework/Repository/GenericRepository.cs
@@ -2,12 +2,12 @@
using EOM.TSHotelManagement.Common.Util;
using Microsoft.AspNetCore.Http;
using SqlSugar;
+using System.Linq.Expressions;
namespace EOM.TSHotelManagement.EntityFramework
{
public class GenericRepository : SimpleClient where T : class, new()
{
-
///
/// HTTP上下文访问器
///
@@ -44,8 +44,10 @@ namespace EOM.TSHotelManagement.EntityFramework
if (entity is BaseEntity baseEntity)
{
var currentUser = GetCurrentUser();
- baseEntity.DataInsDate = DateTime.Now;
- baseEntity.DataInsUsr = currentUser;
+ if (!baseEntity.DataInsDate.HasValue)
+ baseEntity.DataInsDate = DateTime.Now;
+ if (string.IsNullOrEmpty(baseEntity.DataInsUsr))
+ baseEntity.DataInsUsr = currentUser;
}
return base.Insert(entity);
}
@@ -55,10 +57,63 @@ namespace EOM.TSHotelManagement.EntityFramework
if (entity is BaseEntity baseEntity)
{
var currentUser = GetCurrentUser();
- baseEntity.DataChgDate = DateTime.Now;
- baseEntity.DataChgUsr = currentUser;
+ if (!baseEntity.DataChgDate.HasValue)
+ baseEntity.DataChgDate = DateTime.Now;
+ if (string.IsNullOrEmpty(baseEntity.DataChgUsr))
+ baseEntity.DataChgUsr = currentUser;
+ }
+
+ var primaryKeys = base.Context.EntityMaintenance.GetEntityInfo().Columns
+ .Where(it => it.IsPrimarykey)
+ .Select(it => it.PropertyName)
+ .ToList();
+
+ if (primaryKeys.Count <= 1)
+ {
+ return base.Context.Updateable(entity)
+ .IgnoreColumns(true, false)
+ .ExecuteCommand() > 0;
+ }
+
+ var idProperty = entity.GetType().GetProperty("Id");
+ if (idProperty != null)
+ {
+ var idValue = Convert.ToInt64(idProperty.GetValue(entity));
+
+ if (idValue == 0)
+ {
+ var otherPrimaryKeys = primaryKeys.Where(pk => pk != "Id").ToList();
+
+ var parameter = Expression.Parameter(typeof(T), "it");
+ Expression whereExpression = null;
+
+ foreach (var key in otherPrimaryKeys)
+ {
+ var property = Expression.Property(parameter, key);
+ var value = entity.GetType().GetProperty(key).GetValue(entity);
+ var constant = Expression.Constant(value);
+ var equal = Expression.Equal(property, constant);
+
+ whereExpression = whereExpression == null
+ ? equal
+ : Expression.AndAlso(whereExpression, equal);
+ }
+
+ if (whereExpression != null)
+ {
+ var lambda = Expression.Lambda>(whereExpression, parameter);
+
+ return base.Context.Updateable(entity)
+ .Where(lambda)
+ .IgnoreColumns(true, false)
+ .ExecuteCommand() > 0;
+ }
+ }
}
- return base.Context.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true, false, true).ExecuteCommand() > 0;
+
+ return base.Context.Updateable(entity)
+ .IgnoreColumns(true, false)
+ .ExecuteCommand() > 0;
}
public override bool UpdateRange(List updateObjs)
@@ -68,12 +123,16 @@ namespace EOM.TSHotelManagement.EntityFramework
if (entity is BaseEntity baseEntity)
{
var currentUser = GetCurrentUser();
- baseEntity.DataChgDate = DateTime.Now;
- baseEntity.DataChgUsr = currentUser;
+ if (!baseEntity.DataChgDate.HasValue)
+ baseEntity.DataChgDate = DateTime.Now;
+ if (string.IsNullOrEmpty(baseEntity.DataChgUsr))
+ baseEntity.DataChgUsr = currentUser;
}
}
- return base.Context.Updateable(updateObjs).IgnoreColumns(ignoreAllNullColumns: true, false, true).ExecuteCommand() > 0;
+ return base.Context.Updateable(updateObjs)
+ .IgnoreColumns(ignoreAllNullColumns: true)
+ .ExecuteCommand() > 0;
}
public bool SoftDelete(T entity)
@@ -81,10 +140,63 @@ namespace EOM.TSHotelManagement.EntityFramework
if (entity is BaseEntity baseEntity)
{
var currentUser = GetCurrentUser();
- baseEntity.DataChgDate = DateTime.Now;
- baseEntity.DataChgUsr = currentUser;
+ if (!baseEntity.DataChgDate.HasValue)
+ baseEntity.DataChgDate = DateTime.Now;
+ if (string.IsNullOrEmpty(baseEntity.DataChgUsr))
+ baseEntity.DataChgUsr = currentUser;
+ }
+
+ var primaryKeys = base.Context.EntityMaintenance.GetEntityInfo().Columns
+ .Where(it => it.IsPrimarykey)
+ .Select(it => it.PropertyName)
+ .ToList();
+
+ if (primaryKeys.Count <= 1)
+ {
+ return base.Context.Updateable(entity)
+ .IgnoreColumns(ignoreAllNullColumns: true, false, true)
+ .ExecuteCommand() > 0;
}
- return base.Context.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true, false, true).ExecuteCommand() > 0;
+
+ var idProperty = entity.GetType().GetProperty("Id");
+ if (idProperty != null)
+ {
+ var idValue = Convert.ToInt64(idProperty.GetValue(entity));
+
+ if (idValue == 0)
+ {
+ var otherPrimaryKeys = primaryKeys.Where(pk => pk != "Id").ToList();
+
+ var parameter = Expression.Parameter(typeof(T), "it");
+ Expression whereExpression = null;
+
+ foreach (var key in otherPrimaryKeys)
+ {
+ var property = Expression.Property(parameter, key);
+ var value = entity.GetType().GetProperty(key).GetValue(entity);
+ var constant = Expression.Constant(value);
+ var equal = Expression.Equal(property, constant);
+
+ whereExpression = whereExpression == null
+ ? equal
+ : Expression.AndAlso(whereExpression, equal);
+ }
+
+ if (whereExpression != null)
+ {
+ var lambda = Expression.Lambda>(whereExpression, parameter);
+
+ return base.Context.Updateable(entity)
+ .Where(lambda)
+ .IgnoreColumns(ignoreAllNullColumns: true)
+ .ExecuteCommand() > 0;
+ }
+ }
+ }
+
+ return base.Context.Updateable(entity)
+ .IgnoreColumns(ignoreAllNullColumns: true)
+ .ExecuteCommand() > 0;
}
}
}
diff --git a/EOM.TSHotelManagement.Migration/EntityBuilder.cs b/EOM.TSHotelManagement.Migration/EntityBuilder.cs
index 65be0a2b621b3a363c67441d81f0610e1ef3187f..80713ad4edc33f271929213003cbb1324a182c89 100644
--- a/EOM.TSHotelManagement.Migration/EntityBuilder.cs
+++ b/EOM.TSHotelManagement.Migration/EntityBuilder.cs
@@ -476,6 +476,17 @@ namespace EOM.TSHotelManagement.Migration
DataInsUsr = "System",
DataInsDate = DateTime.Now,
},
+ new Menu // 38
+ {
+ Key = "requestlog",
+ Title = "请求日志",
+ Path = "/requestlog",
+ Parent = 29,
+ Icon = "SolutionOutlined",
+ IsDelete = 0,
+ DataInsUsr = "System",
+ DataInsDate = DateTime.Now,
+ },
new NavBar
{
NavigationBarName = "客房管理",
diff --git a/EOM.TSHotelManagement.Shared/Helper/DiscountHelper.cs b/EOM.TSHotelManagement.Shared/Helper/DiscountHelper.cs
index 1e171f7ef3ed053380304e19386a4f97089f8966..0ac108447b77af707d1f43a052e3d0143de0fb8a 100644
--- a/EOM.TSHotelManagement.Shared/Helper/DiscountHelper.cs
+++ b/EOM.TSHotelManagement.Shared/Helper/DiscountHelper.cs
@@ -57,26 +57,5 @@
9 => "九",
_ => throw new ArgumentOutOfRangeException(nameof(num), "仅支持0-9数字转换")
};
-
- public static decimal RealAmount(decimal discountPercent, decimal itemAmount)
- {
- decimal discountedAmount;
-
- if (discountPercent == 0)
- {
- discountedAmount = 0;
- }
- else if (discountPercent == 100)
- {
- discountedAmount = itemAmount;
- }
- else
- {
- decimal discountRate = discountPercent / 100M;
- discountedAmount = itemAmount * discountRate;
- }
-
- return discountedAmount;
- }
}
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Business/Reser/ReserController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Business/Reser/ReserController.cs
index 85c0894842d7fb8dae9130065e1b46326392b189..a284922560ecc85925042eecda0e5213b6e3c528 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Business/Reser/ReserController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Business/Reser/ReserController.cs
@@ -76,5 +76,16 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
{
return reserService.InserReserInfo(r);
}
+
+ ///
+ /// 查询所有预约类型
+ ///
+ ///
+ [HttpGet]
+ public ListOutputDto SelectReserTypeAll()
+ {
+ return reserService.SelectReserTypeAll();
+ }
+
}
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Business/Sellthing/SellthingController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Business/Sellthing/SellthingController.cs
index 2965edf0cf79ee0412160380ae692984d7521ab1..3e2ee06fd7ac1961ac6c60b68d24269f97125140 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Business/Sellthing/SellthingController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Business/Sellthing/SellthingController.cs
@@ -44,9 +44,9 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseResponse UpdateSellthingInfo([FromBody] UpdateSellThingInputDto sellThing)
+ public BaseResponse UpdateSellthing([FromBody] UpdateSellThingInputDto sellThing)
{
- return sellService.UpdateSellthingInfo(sellThing);
+ return sellService.UpdateSellthing(sellThing);
}
///
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Base/BaseController.cs b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Base/BaseController.cs
index 666d01876fe42bbda24c3de58c6bcddf4d4a8729..cb722bbbba712ddb281c9a9e0585c0da7942582e 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Base/BaseController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Base/BaseController.cs
@@ -16,6 +16,20 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
this.baseService = baseService;
}
+ #region 预约类型模块
+
+ ///
+ /// 查询所有预约类型
+ ///
+ ///
+ [HttpGet]
+ public ListOutputDto SelectReserTypeAll()
+ {
+ return baseService.SelectReserTypeAll();
+ }
+
+ #endregion
+
#region 性别模块
///
diff --git a/EOM.TSHotelManagement.WebApi/EOM.TSHotelManagement.WebApi.csproj b/EOM.TSHotelManagement.WebApi/EOM.TSHotelManagement.WebApi.csproj
index 6a750efcf01dda8bf38c2071f998debc746d867c..1117457ea70e62205148cc84aae67bdecaf58332 100644
--- a/EOM.TSHotelManagement.WebApi/EOM.TSHotelManagement.WebApi.csproj
+++ b/EOM.TSHotelManagement.WebApi/EOM.TSHotelManagement.WebApi.csproj
@@ -36,7 +36,6 @@
-
diff --git a/EOM.TSHotelManagement.WebApi/Startup.cs b/EOM.TSHotelManagement.WebApi/Startup.cs
index 3fcf99c62c6932ad10e535087957912b6ea2153a..7dea910ad7e2c0dafb6a34e945ed52015d754897 100644
--- a/EOM.TSHotelManagement.WebApi/Startup.cs
+++ b/EOM.TSHotelManagement.WebApi/Startup.cs
@@ -126,6 +126,7 @@ namespace EOM.TSHotelManagement.WebApi
{
options.Conventions.Add(new AuthorizeAllControllersConvention());
options.RespectBrowserAcceptHeader = true;
+ options.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = true;
}).AddJsonOptions(options =>
{
options.JsonSerializerOptions.PropertyNamingPolicy = null;