|
@@ -582,6 +582,8 @@ namespace TEAMModeBI.Controllers.BISchool
|
|
|
await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}"));
|
|
|
}
|
|
|
|
|
|
+ StandardFile saveFile = new StandardFile();
|
|
|
+
|
|
|
//新政策文件
|
|
|
await foreach (StandardFile standardFile in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<StandardFile>(queryText: $"select value(c) from c where c.id='{_newId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StandardFile") }))
|
|
|
{
|
|
@@ -589,23 +591,49 @@ namespace TEAMModeBI.Controllers.BISchool
|
|
|
{
|
|
|
standardFile.standard = $"{_oldStandard}";
|
|
|
standardFile.id = $"{_oldId}";
|
|
|
- //await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(standardFile, new PartitionKey($"StandardFile")); // 需要删除原来的政策文件数据在进行添加
|
|
|
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReplaceItemAsync<StandardFile>(standardFile, standardFile.id, new PartitionKey("StandardFile")); //直接替换以前的数据
|
|
|
+
|
|
|
+ saveFile = standardFile;
|
|
|
}
|
|
|
}
|
|
|
+ StandardFile tempFile = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ tempFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<StandardFile>(saveFile.id, new PartitionKey("StandardFile"));
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ }
|
|
|
+ if (tempFile != null)
|
|
|
+ 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")); // 需要删除原来的政策文件数据在进行添加
|
|
|
|
|
|
//新的区域设置
|
|
|
+ AreaSetting saveSetting = new AreaSetting();
|
|
|
await foreach (AreaSetting areaSetting in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AreaSetting>(queryText: $"select value(c) from c where c.id='{_newId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("AreaSetting") }))
|
|
|
{
|
|
|
if (areaSetting != null)
|
|
|
{
|
|
|
areaSetting.accessConfig = null;
|
|
|
areaSetting.id = $"{_oldId}";
|
|
|
- //await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(areaSetting, new PartitionKey($"AreaSetting")); //需要删除原来的区域设置数据在进行添加
|
|
|
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReplaceItemAsync<AreaSetting>(areaSetting, areaSetting.id, new PartitionKey($"AreaSetting")); //直接替换以前的数据
|
|
|
+
|
|
|
+ saveSetting = areaSetting;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ AreaSetting tempSetting = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ tempSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<AreaSetting>(saveSetting.id, new PartitionKey("StandardFile"));
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ }
|
|
|
+ if (tempSetting != null)
|
|
|
+ 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")); //需要删除原来的区域设置数据在进行添加
|
|
|
+
|
|
|
//发送消息分区键
|
|
|
string partitionCode = "DelBeforeCopyAbility-mark";
|
|
|
|