Parcourir la source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

Lyyyi il y a 1 jour
Parent
commit
9f4ae97e60
1 fichiers modifiés avec 80 ajouts et 20 suppressions
  1. 80 20
      OASystem/OASystem.Api/Controllers/GroupsController.cs

+ 80 - 20
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -11931,7 +11931,7 @@ FROM
                         }
                         }
                         else dic.Add("SubZS", "0.00");
                         else dic.Add("SubZS", "0.00");
                         //删除多余行
                         //删除多余行
-                        while (table1!=null && table1.Rows.Count > table1Row)
+                        while (table1 != null && table1.Rows.Count > table1Row)
                         {
                         {
                             table1.Rows.RemoveAt(table1Row);
                             table1.Rows.RemoveAt(table1Row);
                         }
                         }
@@ -32162,24 +32162,24 @@ ORDER BY
 
 
             var result = new
             var result = new
             {
             {
-                index = queryList.Count + 1,  
-                priceType = "",               
-                priceName = "",               
-                costPrice = 0m,               
-                currency = 836,               
-                rate = 1m,                    
-                count = 0,                    
-                unit = "",                    
-                coefficient = 0m,             
-                baoJiaPrice = 0m,             
-                addedValue = 0m,              
-                details = "",                 
-                reviewStatus = 0,             
-                diid = Dto.diid,          
-                imgs = "",                    
+                index = queryList.Count + 1,
+                priceType = "",
+                priceName = "",
+                costPrice = 0m,
+                currency = 836,
+                rate = 1m,
+                count = 0,
+                unit = "",
+                coefficient = 0m,
+                baoJiaPrice = 0m,
+                addedValue = 0m,
+                details = "",
+                reviewStatus = 0,
+                diid = Dto.diid,
+                imgs = "",
                 imgsList = new List<string>(),
                 imgsList = new List<string>(),
-                id = child.Id,                
-                remark = ""                   
+                id = child.Id,
+                remark = ""
             };
             };
 
 
             return Ok(JsonView(true, "新增成功!", result));
             return Ok(JsonView(true, "新增成功!", result));
@@ -32440,7 +32440,11 @@ ORDER BY
             return Ok(JsonView(true, $"成功删除 {deletedCount} 张图片", updatedImgs));
             return Ok(JsonView(true, $"成功删除 {deletedCount} 张图片", updatedImgs));
         }
         }
 
 
-
+        /// <summary>
+        /// 会务流程word下载
+        /// </summary>
+        /// <param name="Dto"></param>
+        /// <returns></returns>
         [HttpPost]
         [HttpPost]
         public async Task<IActionResult> InspectionReportFileDown(InspectionReportFileDownDto Dto)
         public async Task<IActionResult> InspectionReportFileDown(InspectionReportFileDownDto Dto)
         {
         {
@@ -32466,7 +32470,7 @@ ORDER BY
             var doc = new Document(templatePath);
             var doc = new Document(templatePath);
 
 
             var chiList = _sqlSugar.Queryable<Grp_ConferenceAffairsCostChild>()
             var chiList = _sqlSugar.Queryable<Grp_ConferenceAffairsCostChild>()
-                .Where(x => x.IsDel == 0 && x.Diid == Dto.Diid)
+                .Where(x => x.IsDel == 0 && x.Diid == Dto.Diid && x.PriceType > 0 && x.Unit > 0)
                 .Select(x => new
                 .Select(x => new
                 {
                 {
                     x.Index,
                     x.Index,
@@ -33079,6 +33083,62 @@ ORDER BY
                 .Any(x => x.ReviewStatus == 1);
                 .Any(x => x.ReviewStatus == 1);
             if (isAudit) return Ok(JsonView(false, "包含已审核数据无法删除!"));
             if (isAudit) return Ok(JsonView(false, "包含已审核数据无法删除!"));
 
 
+            var queryData = _sqlSugar.Queryable<Grp_ConferenceAffairsCostChild>()
+            .Where(x => x.IsDel == 0 && Dto.ids.Contains(x.Id))
+            .ToList();
+
+            //删除图片
+            foreach (var item in queryData)
+            {
+                if (!string.IsNullOrEmpty(item.Imgs))
+                {
+                    var imgList = item.Imgs.Split(',').Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
+                    string baseUrl = AppSettingsHelper.Get("ConferenceCostImageBaseUrl");
+                    string basePath = AppSettingsHelper.Get("ConferenceCostImageBasePath");
+
+                    foreach (var imgUrl in imgList)
+                    {
+                        try
+                        {
+                            string localPath = "";
+
+                            // 判断是否为完整URL
+                            if (imgUrl.StartsWith("http://") || imgUrl.StartsWith("https://"))
+                            {
+                                // 尝试从URL转换为本地路径
+                                if (imgUrl.Contains("/child/"))
+                                {
+                                    var pathPart = imgUrl.Substring(imgUrl.IndexOf("/child/"));
+                                    localPath = Path.Combine(basePath, pathPart.TrimStart('/').Replace("/", "\\"));
+                                }
+                            }
+                            else
+                            {
+                                // 文件名,构造本地路径
+                                localPath = Path.Combine(basePath, "child", item.Index.ToString(), imgUrl);
+                            }
+
+                            if (!string.IsNullOrEmpty(localPath) && System.IO.File.Exists(localPath))
+                            {
+                                _logger.LogInformation($"-----------------------");
+                                _logger.LogInformation($"删除图片: {localPath}");
+                                System.IO.File.Delete(localPath);
+                                _logger.LogInformation($"删除成功");
+                                _logger.LogInformation($"-----------------------");
+                            }
+                            else
+                            {
+                                _logger.LogWarning($"图片文件不存在或路径为空: {imgUrl} -> {localPath}");
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                            _logger.LogError(ex, $"删除图片失败: {imgUrl}");
+                        }
+                    }
+                }
+            }
+
             var count = _sqlSugar.Updateable<Grp_ConferenceAffairsCostChild>()
             var count = _sqlSugar.Updateable<Grp_ConferenceAffairsCostChild>()
                        .Where(x => Dto.ids.Contains(x.Id) && x.IsDel == 0)
                        .Where(x => Dto.ids.Contains(x.Id) && x.IsDel == 0)
                        .SetColumns(x => new Grp_ConferenceAffairsCostChild
                        .SetColumns(x => new Grp_ConferenceAffairsCostChild