|
@@ -779,19 +779,17 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
}
|
|
}
|
|
}
|
|
}
|
|
StandardFile tempFile = new();
|
|
StandardFile tempFile = new();
|
|
- try
|
|
|
|
- {
|
|
|
|
- tempFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<StandardFile>(saveFile.id, new PartitionKey("StandardFile"));
|
|
|
|
- }
|
|
|
|
- catch
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
- if (tempFile.id != null)
|
|
|
|
|
|
+ if (saveFile.id != null)
|
|
{
|
|
{
|
|
- if (tempFile.id.Equals(saveFile.id))
|
|
|
|
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReplaceItemAsync<StandardFile>(saveFile, saveFile.id, new PartitionKey("StandardFile")); //直接替换以前的数据
|
|
|
|
- else
|
|
|
|
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveFile, new PartitionKey($"StandardFile")); // 需要删除原来的政策文件数据在进行添加
|
|
|
|
|
|
+ var respFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(saveFile.id, new PartitionKey("StandardFile"));
|
|
|
|
+ if (respFile.Status == 200)
|
|
|
|
+ {
|
|
|
|
+ using var json = await JsonDocument.ParseAsync(respFile.ContentStream);
|
|
|
|
+ tempFile = json.ToObject<StandardFile>();
|
|
|
|
+ await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemAsync<StandardFile>(tempFile.id, new PartitionKey("StandardFile"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveFile, new PartitionKey($"StandardFile")); // 需要删除原来的政策文件数据在进行添加
|
|
}
|
|
}
|
|
|
|
|
|
//新的区域设置
|
|
//新的区域设置
|
|
@@ -808,19 +806,17 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
}
|
|
}
|
|
|
|
|
|
AreaSetting tempSetting = new();
|
|
AreaSetting tempSetting = new();
|
|
- try
|
|
|
|
- {
|
|
|
|
- tempSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<AreaSetting>(saveSetting.id, new PartitionKey("StandardFile"));
|
|
|
|
- }
|
|
|
|
- catch
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
- if (tempSetting.id != null)
|
|
|
|
|
|
+ if (saveSetting.id != null)
|
|
{
|
|
{
|
|
- if (tempSetting.id.Equals(saveSetting.id))
|
|
|
|
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReplaceItemAsync<AreaSetting>(saveSetting, saveSetting.id, new PartitionKey($"AreaSetting")); //直接替换以前的数据
|
|
|
|
- else
|
|
|
|
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveSetting, new PartitionKey($"AreaSetting")); //需要删除原来的区域设置数据在进行添加
|
|
|
|
|
|
+ var respSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(saveSetting.id, new PartitionKey("AreaSetting"));
|
|
|
|
+ if (respSetting.Status == 200)
|
|
|
|
+ {
|
|
|
|
+ using var json = await JsonDocument.ParseAsync(respSetting.ContentStream);
|
|
|
|
+ tempSetting = json.ToObject<AreaSetting>();
|
|
|
|
+ await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemAsync<AreaSetting>(tempFile.id, new PartitionKey("AreaSetting"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ tempSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveSetting, new PartitionKey($"AreaSetting")); //需要删除原来的区域设置数据在进行添加
|
|
}
|
|
}
|
|
|
|
|
|
//发送消息分区键
|
|
//发送消息分区键
|