Quellcode durchsuchen

处理新区同步两个区的信息异常的问题

chenmy vor 2 Jahren
Ursprung
Commit
96d48b1a4f
1 geänderte Dateien mit 221 neuen und 212 gelöschten Zeilen
  1. 221 212
      TEAMModelBI/Controllers/BINormal/BatchAreaController.cs

+ 221 - 212
TEAMModelBI/Controllers/BINormal/BatchAreaController.cs

@@ -1018,272 +1018,281 @@ namespace TEAMModelBI.Controllers.BINormal
         [HttpPost("cut-full-statndard")]
         public async Task<IActionResult> CutFullStandard(JsonElement jsonElement)
         {
-            string _oldId = "bde5c011-2ae4-461a-b46c-5483ba72ae45";
-            string _oldStandard = "standard27";
-            string standardFileId = "02944f32-f534-3397-ea56-e6f1fc6c3714";
-            string standard = "standard2";
-
-            List<CopyStandard> copyStand = new()
+            try
             {
-                new CopyStandard() { id = standardFileId, standard = standard },
-                new CopyStandard() { id = "99a4a33b-e21b-44ac-80a1-b31dc40496e0", standard = "standard3" }
-            };
+                string _oldId = "bde5c011-2ae4-461a-b46c-5483ba72ae45";
+                string _oldStandard = "standard27";
+                string standardFileId = "02944f32-f534-3397-ea56-e6f1fc6c3714";
+                string standard = "standard2";
 
-            var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
-            var tableClient = _azureStorage.GetCloudTableClient();
-            var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
-            var cosmosClient = _azureCosmos.GetCosmosClient();
-            var serBusClient = _serviceBus.GetServiceBusClient();
-            var activeTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");//秘钥地址
+                List<CopyStandard> copyStand = new()
+                {
+                    new CopyStandard() { id = standardFileId, standard = standard },
+                    new CopyStandard() { id = "99a4a33b-e21b-44ac-80a1-b31dc40496e0", standard = "standard3" }
+                };
 
-            var table = tableClient.GetTableReference("IESLogin");
+                var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
+                var tableClient = _azureStorage.GetCloudTableClient();
+                var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
+                var cosmosClient = _azureCosmos.GetCosmosClient();
+                var serBusClient = _serviceBus.GetServiceBusClient();
+                var activeTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");//秘钥地址
 
-            var responseSet = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync($"{_oldId}", new PartitionKey("AreaSetting"));
-            if (responseSet.Status == 200)
-            {
-                using var fileJson = await JsonDocument.ParseAsync(responseSet.ContentStream);
-                AreaSetting delSet = fileJson.ToObject<AreaSetting>();
-                if (!string.IsNullOrEmpty(delSet.accessConfig))
-                    return Ok(new { state = 401, msg = "区域已经规定了,不能切换能能力" });
-            }
+                var table = tableClient.GetTableReference("IESLogin");
 
-            List<string> abilityIds = new List<string>();  //册别的ID集合
+                var responseSet = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync($"{_oldId}", new PartitionKey("AreaSetting"));
+                if (responseSet.Status == 200)
+                {
+                    using var fileJson = await JsonDocument.ParseAsync(responseSet.ContentStream);
+                    AreaSetting delSet = fileJson.ToObject<AreaSetting>();
+                    if (!string.IsNullOrEmpty(delSet.accessConfig))
+                        return Ok(new { state = 401, msg = "区域已经规定了,不能切换能能力" });
+                }
 
-            //查询册别信息
-            await foreach (var tempAbility in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{_oldStandard}") }))
-            {
-                abilityIds.Add(tempAbility.id);  //查询出来册别ID添加册别ID集合
-            }
-            //删除册别
-            if (abilityIds.IsNotEmpty())
-            {
-                var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityIds, $"Ability-{_oldStandard}");
-            }
+                List<string> abilityIds = new List<string>();  //册别的ID集合
 
-            List<string> abilityTaskIds = new List<string>();  //章节ID集合
-            await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AbilityTask>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{_oldStandard}") }))
-            {
-                abilityTaskIds.Add(item.id);   //查询出来的章节信息ID添加到战绩集合
-            }
-            //删除章节
-            if (abilityTaskIds.IsNotEmpty())
-            {
-                var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityTaskIds, $"AbilityTask-{_oldStandard}");
-            }
-            List<Task<ItemResponse<Ability>>> abilities = new();      //存储册别数据
-            List<Task<ItemResponse<AbilityTask>>> abilityTasks = new();  //存储章节
+                //查询册别信息
+                await foreach (var tempAbility in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{_oldStandard}") }))
+                {
+                    abilityIds.Add(tempAbility.id);  //查询出来册别ID添加册别ID集合
+                }
+                //删除册别
+                if (abilityIds.IsNotEmpty())
+                {
+                    var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityIds, $"Ability-{_oldStandard}");
+                }
 
-            List<string> repeatAbilityId = new();
-            List<string> repeatAbilityTaskId = new();
+                List<string> abilityTaskIds = new List<string>();  //章节ID集合
+                await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AbilityTask>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{_oldStandard}") }))
+                {
+                    abilityTaskIds.Add(item.id);   //查询出来的章节信息ID添加到战绩集合
+                }
+                //删除章节
+                if (abilityTaskIds.IsNotEmpty())
+                {
+                    var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityTaskIds, $"AbilityTask-{_oldStandard}");
+                }
+                List<Task<ItemResponse<Ability>>> abilities = new();      //存储册别数据
+                List<Task<ItemResponse<AbilityTask>>> abilityTasks = new();  //存储章节
 
-            foreach (var newstand in copyStand)
-            {
-                try
+                List<string> repeatAbilityId = new();
+                List<string> repeatAbilityTaskId = new();
+
+                foreach (var newstand in copyStand)
                 {
-                    //查询要复制区域的能力标准点 
-                    await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{newstand.standard}") }))
+                    try
                     {
-                        if (!string.IsNullOrEmpty(item.blob))
-                            item.blob = item.blob.Replace($"/{newstand.standard}/", $"/{_oldStandard}/");
+                        //查询要复制区域的能力标准点 
+                        await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{newstand.standard}") }))
+                        {
+                            if (!string.IsNullOrEmpty(item.blob))
+                                item.blob = item.blob.Replace($"/{newstand.standard}/", $"/{_oldStandard}/");
 
-                        item.standard = $"{_oldStandard}";
-                        item.code = $"Ability-{_oldStandard}";
-                        item.school = $"{_oldStandard}";
+                            item.standard = $"{_oldStandard}";
+                            item.code = $"Ability-{_oldStandard}";
+                            item.school = $"{_oldStandard}";
 
-                        //添加区能力标准点
-                        //abilities.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{_oldStandard}")));
-                        //await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{_oldStandard}"));
+                            //添加区能力标准点
+                            //abilities.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{_oldStandard}")));
+                            //await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{_oldStandard}"));
 
-                        var respond = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(item.id, new PartitionKey(item.code));
-                        if (respond.Status != 200)
-                            abilities.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{_oldStandard}")));
-                        else
-                            repeatAbilityId.Add(item.id);
+                            var respond = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(item.id, new PartitionKey(item.code));
+                            if (respond.Status != 200)
+                                abilities.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{_oldStandard}")));
+                            else
+                                repeatAbilityId.Add(item.id);
+                        }
                     }
-                }
-                catch
-                {
-                    return Ok(new { state = 200, msg = "创区成功,能力标准点复制失败,遗留数据影响!" });
-                }
-
-                try
-                {
-                    if (abilities.Count < 256)
+                    catch
                     {
-                        await Task.WhenAll(abilities);
+                        return Ok(new { state = 200, msg = "创区成功,能力标准点复制失败,遗留数据影响!" });
                     }
-                    else
+
+                    try
                     {
-                        int pages = (abilities.Count + 255) / 256;
-                        for (int i = 0; i < pages; i++)
+                        if (abilities.Count < 256)
                         {
-                            List<Task<ItemResponse<Ability>>> tempAbility = abilities.Skip((i) * 256).Take(256).ToList();
-                            await Task.WhenAll(tempAbility);
+                            await Task.WhenAll(abilities);
+                        }
+                        else
+                        {
+                            int pages = (abilities.Count + 255) / 256;
+                            for (int i = 0; i < pages; i++)
+                            {
+                                List<Task<ItemResponse<Ability>>> tempAbility = abilities.Skip((i) * 256).Take(256).ToList();
+                                await Task.WhenAll(tempAbility);
+                            }
                         }
                     }
-                }
-                catch
-                {
-                    return Ok(new { state = 200, msg = "创区成功,能力标准点复制失败,遗留数据影响!" });
-                }
+                    catch
+                    {
+                        return Ok(new { state = 200, msg = "创区成功,能力标准点复制失败,遗留数据影响!" });
+                    }
 
-                try
-                {
-                    //微能力点
-                    await foreach (var atask in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AbilityTask>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{newstand.standard}") }))
+                    try
                     {
-                        List<Tnode> tnodes = new();
-                        foreach (Tnode tnode in atask.children)
+                        //微能力点
+                        await foreach (var atask in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AbilityTask>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{newstand.standard}") }))
                         {
-                            if (tnode.rnodes != null)
+                            List<Tnode> tnodes = new();
+                            foreach (Tnode tnode in atask.children)
                             {
-                                List<Rnode> rnodes = new();
-                                foreach (Rnode rnode in tnode.rnodes)
+                                if (tnode.rnodes != null)
                                 {
-                                    if (!string.IsNullOrEmpty($"{rnode.link}"))
+                                    List<Rnode> rnodes = new();
+                                    foreach (Rnode rnode in tnode.rnodes)
                                     {
-                                        rnode.link = rnode.link.Replace($"/{newstand.standard}/", $"/{_oldStandard}/");
+                                        if (!string.IsNullOrEmpty($"{rnode.link}"))
+                                        {
+                                            rnode.link = rnode.link.Replace($"/{newstand.standard}/", $"/{_oldStandard}/");
+                                        }
+                                        rnodes.Add(rnode);
                                     }
-                                    rnodes.Add(rnode);
+                                    tnode.rnodes = rnodes;
                                 }
-                                tnode.rnodes = rnodes;
+                                tnodes.Add(tnode);
                             }
-                            tnodes.Add(tnode);
-                        }
 
-                        atask.children = tnodes;
-                        atask.code = $"AbilityTask-{_oldStandard}";
-                        atask.standard = $"{_oldStandard}";
-                        atask.codeval = $"{_oldStandard}";
+                            atask.children = tnodes;
+                            atask.code = $"AbilityTask-{_oldStandard}";
+                            atask.standard = $"{_oldStandard}";
+                            atask.codeval = $"{_oldStandard}";
+
+                            var respond = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(atask.id, new PartitionKey(atask.code));
+                            if (respond.Status != 200)
+                                ////添加区能力标准点中的节点 
+                                //abilityTasks.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}")));
+                                await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}"));
+                            else
+                                repeatAbilityTaskId.Add(atask.id);
+                        }
+                    }
+                    catch
+                    {
+                        return Ok(new { state = 200, msg = "创区成功,能力标准创建成功,微能力点复制失败,遗留数据影响!" });
+                    }
 
-                        var respond = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(atask.id, new PartitionKey(atask.code));
-                        if (respond.Status != 200)
-                            ////添加区能力标准点中的节点 
-                            //abilityTasks.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}")));
-                            await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}"));
-                        else
-                            repeatAbilityTaskId.Add(atask.id);
+                    //发送消息分区键
+                    string partitionCode = "DelBeforeCopyAbility-mark";
+
+                    //执行复制操作
+                    BatchCopyFile batchCopyFile = new();
+                    batchCopyFile.blobCntr = "teammodelos";
+                    batchCopyFile.oldFileName = $"{newstand.standard}";
+                    batchCopyFile.newFileName = $"{_oldStandard}";
+                    batchCopyFile.tmdid = $"{_tmdId}";
+                    batchCopyFile.tmdIds = new List<string> { $"{_tmdId}" };
+                    batchCopyFile.codeKey = partitionCode;
+                    batchCopyFile.tmdName = $"{_tmdName}";
+                    var messageBatchCopyFile = new ServiceBusMessage(batchCopyFile.ToJsonString());
+                    messageBatchCopyFile.ApplicationProperties.Add("name", "CopyStandardFile");
+                    try
+                    {
+                        //await _serviceBus.GetServiceBusClient().SendMessageAsync(activeTask, messageBatchCopyFile);  //先执行删除操作,在执行复制  单一
+                        await serBusClient.SendMessageAsync(activeTask, messageBatchCopyFile);  //先执行删除操作,在执行复制
+                    }
+                    catch (Exception)
+                    {
+                        return Ok(new { state = 201, msg = "能力点复制成功,复制能力点的文件失败," });
                     }
-                }
-                catch
-                {
-                    return Ok(new { state = 200, msg = "创区成功,能力标准创建成功,微能力点复制失败,遗留数据影响!" });
-                }
 
-                //发送消息分区键
-                string partitionCode = "DelBeforeCopyAbility-mark";
+                    //发送消息实体
+                    Notification notification = new()
+                    {
+                        hubName = "hita",
+                        type = "msg",
+                        from = $"BI:{_option.Location}:private",
+                        to = new List<string> { $"{_tmdId}" },
+                        label = $"{partitionCode}_start",
+                        body = new { location = _option.Location, biz = partitionCode, tmdid = $"{_tmdId}", tmdname = $"{_tmdName}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
+                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
+                    };
 
-                //执行复制操作
-                BatchCopyFile batchCopyFile = new();
-                batchCopyFile.blobCntr = "teammodelos";
-                batchCopyFile.oldFileName = $"{newstand.standard}";
-                batchCopyFile.newFileName = $"{_oldStandard}";
-                batchCopyFile.tmdid = $"{_tmdId}";
-                batchCopyFile.tmdIds = new List<string> { $"{_tmdId}" };
-                batchCopyFile.codeKey = partitionCode;
-                batchCopyFile.tmdName = $"{_tmdName}";
-                var messageBatchCopyFile = new ServiceBusMessage(batchCopyFile.ToJsonString());
-                messageBatchCopyFile.ApplicationProperties.Add("name", "CopyStandardFile");
-                try
-                {
-                    //await _serviceBus.GetServiceBusClient().SendMessageAsync(activeTask, messageBatchCopyFile);  //先执行删除操作,在执行复制  单一
-                    await serBusClient.SendMessageAsync(activeTask, messageBatchCopyFile);  //先执行删除操作,在执行复制
-                }
-                catch (Exception)
-                {
-                    return Ok(new { state = 201, msg = "能力点复制成功,复制能力点的文件失败," });
+                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
+                    var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
+                    var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
+                    var location = _option.Location;
+                    await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //发送站内发送消息
                 }
 
-                //发送消息实体
-                Notification notification = new()
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"BI:{_option.Location}:private",
-                    to = new List<string> { $"{_tmdId}" },
-                    label = $"{partitionCode}_start",
-                    body = new { location = _option.Location, biz = partitionCode, tmdid = $"{_tmdId}", tmdname = $"{_tmdName}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-
-                var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                var location = _option.Location;
-                await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //发送站内发送消息
-            }
-
-            StandardFile saveFile = new();
-            //新政策文件
-            await foreach (StandardFile standardFile in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<StandardFile>(queryText: $"select value(c) from c where  c.id='{standardFileId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StandardFile") }))
-            {
-                if (standardFile != null)
+                StandardFile saveFile = new();
+                //新政策文件
+                await foreach (StandardFile standardFile in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<StandardFile>(queryText: $"select value(c) from c where  c.id='{standardFileId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StandardFile") }))
                 {
-                    standardFile.standard = $"{_oldStandard}";
-                    standardFile.id = $"{_oldId}";
+                    if (standardFile != null)
+                    {
+                        standardFile.standard = $"{_oldStandard}";
+                        standardFile.id = $"{_oldId}";
 
-                    saveFile = standardFile;
+                        saveFile = standardFile;
+                    }
                 }
-            }
 
-            StandardFile tempFile = new();
-            if (saveFile.id != null)
-            {
-                var respFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(saveFile.id, new PartitionKey("StandardFile"));
-                if (respFile.Status == 200)
+                StandardFile tempFile = new();
+                if (saveFile.id != null)
                 {
-                    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"));
-                }
+                    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"));
+                    }
 
-                tempFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveFile, new PartitionKey($"StandardFile")); // 需要删除原来的政策文件数据在进行添加
-            }
+                    tempFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveFile, new PartitionKey($"StandardFile")); // 需要删除原来的政策文件数据在进行添加
+                }
 
-            //if (tempFile.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")); // 需要删除原来的政策文件数据在进行添加
-            //}
+                //if (tempFile.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")); // 需要删除原来的政策文件数据在进行添加
+                //}
 
-            //新的区域设置
-            AreaSetting saveSetting = new();
-            await foreach (AreaSetting areaSetting in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AreaSetting>(queryText: $"select value(c) from c where c.id='{standardFileId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("AreaSetting") }))
-            {
-                if (areaSetting != null)
+                //新的区域设置
+                AreaSetting saveSetting = new();
+                await foreach (AreaSetting areaSetting in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AreaSetting>(queryText: $"select value(c) from c where c.id='{standardFileId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("AreaSetting") }))
                 {
-                    areaSetting.accessConfig = null;
-                    areaSetting.id = $"{_oldId}";
+                    if (areaSetting != null)
+                    {
+                        areaSetting.accessConfig = null;
+                        areaSetting.id = $"{_oldId}";
 
-                    saveSetting = areaSetting;
+                        saveSetting = areaSetting;
+                    }
                 }
-            }
 
-            AreaSetting tempSetting = new();
-            if (saveSetting.id != null)
-            {
-                var respSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(saveSetting.id, new PartitionKey("AreaSetting"));
-                if (respSetting.Status == 200)
+                AreaSetting tempSetting = new();
+                if (saveSetting.id != null)
                 {
-                    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"));
+                    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>(saveSetting.id, new PartitionKey("AreaSetting"));
+                    }
+
+                    tempSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveSetting, new PartitionKey($"AreaSetting"));  //需要删除原来的区域设置数据在进行添加
                 }
 
-                tempSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveSetting, new PartitionKey($"AreaSetting"));  //需要删除原来的区域设置数据在进行添加
-            }
+                //if (tempSetting.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"));  //需要删除原来的区域设置数据在进行添加
+                //}
 
-            //if (tempSetting.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"));  //需要删除原来的区域设置数据在进行添加
-            //}
+                return Ok(new { state = RespondCode.Ok, repeatAbilityId, repeatAbilityTaskId });
 
-            return Ok(new { state = RespondCode.Ok, repeatAbilityId, repeatAbilityTaskId });
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"BI,{_option.Location} batcharea/cut-full-statndard \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
+                return BadRequest();
+            }
         }
 
         /// <summary>