|
@@ -38,6 +38,8 @@ using WingInterfaceLibrary.DTO.LiveRoom;
|
|
|
using WingInterfaceLibrary.Request.DBRequest;
|
|
|
using WingInterfaceLibrary.DTO.Record;
|
|
|
using WingInterfaceLibrary.DTO.Consultation;
|
|
|
+using WingServerCommon.Interfaces.Cache;
|
|
|
+using System.Collections.Concurrent;
|
|
|
|
|
|
namespace WingDeviceService.Service
|
|
|
{
|
|
@@ -46,7 +48,7 @@ namespace WingDeviceService.Service
|
|
|
/// </summary>
|
|
|
public partial class DeviceService : JsonRpcService, IDeviceService
|
|
|
{
|
|
|
-
|
|
|
+ private ConcurrentDictionary<string, CacheControllingParameter> _controllingParameterDevices = new ConcurrentDictionary<string, CacheControllingParameter>();
|
|
|
private IUserDBService _userServiceProxy;
|
|
|
|
|
|
private IDeviceInfoDBService _deviceInfoDBServiceProxy;
|
|
@@ -75,6 +77,7 @@ namespace WingDeviceService.Service
|
|
|
private IConsultationRecordDBService _consultationRecordDBService;
|
|
|
private IRemedicalDBService _remedicalDBService;
|
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Init service
|
|
|
/// </summary>
|
|
@@ -1089,12 +1092,14 @@ namespace WingDeviceService.Service
|
|
|
DeviceCode = deviceCode,
|
|
|
IsResponse = true
|
|
|
};
|
|
|
- CacheMaintenance.Instance.Get<IControllingParametersManager>().Remove(deviceCode);
|
|
|
- CacheMaintenance.Instance.Get<IControllingParametersManager>().Add(new CacheControllingParameter()
|
|
|
+ var cacheControllingParameter = new CacheControllingParameter()
|
|
|
{
|
|
|
Code = deviceCode,
|
|
|
ProbeApplication = Newtonsoft.Json.JsonConvert.SerializeObject(request.ProbeApplication),
|
|
|
Parameter = Newtonsoft.Json.JsonConvert.SerializeObject(request.Parameter),
|
|
|
+ };
|
|
|
+ _controllingParameterDevices.AddOrUpdate(deviceCode,(k)=>cacheControllingParameter,(k,exist)=>{
|
|
|
+ return cacheControllingParameter;
|
|
|
});
|
|
|
var notificationRequest = new SendNotificationRequest()
|
|
|
{
|
|
@@ -1123,7 +1128,7 @@ namespace WingDeviceService.Service
|
|
|
{
|
|
|
ThrowCustomerException(CustomerRpcCode.DeviceCodeIsEmpty, "Required parameter:DeviceCode cannot be empty");
|
|
|
}
|
|
|
- var controlParameterData = CacheMaintenance.Instance.Get<IControllingParametersManager>().Get(request.DeviceCode);
|
|
|
+ _controllingParameterDevices.TryGetValue(deviceCode,out var controlParameterData);
|
|
|
if (controlParameterData != null)
|
|
|
{
|
|
|
return new DeviceControlParameterDataDTO()
|