Browse Source

保险接口编辑

wangh 1 year ago
parent
commit
5747340500
1 changed files with 59 additions and 18 deletions
  1. 59 18
      OASystem/OASystem.Api/Controllers/GroupsController.cs

+ 59 - 18
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3621,19 +3621,40 @@ namespace OASystem.API.Controllers
                 //int id = 0;
                 filePath = fileDir + "/酒店费用录入相关文件/" + dto.fileName;
                 // 删除该文件
-                System.IO.File.Delete(filePath);
-                var result = await _sqlSugar.Updateable<Grp_HotelReservations>().Where(a => a.Id == dto.Id && a.IsDel==0).SetColumns(a => new Grp_HotelReservations()
-                {
-                    Attachment = "",
-                }).ExecuteCommandAsync();
-                if (result != 0)
+                try
                 {
-                    return Ok(JsonView(true, "成功!"));
+                    System.IO.File.Delete(filePath);
+                    var result = await _sqlSugar.Updateable<Grp_HotelReservations>().Where(a => a.Id == dto.Id && a.IsDel == 0).SetColumns(a => new Grp_HotelReservations()
+                    {
+                        Attachment = "",
+                    }).ExecuteCommandAsync();
+                    if (result != 0)
+                    {
+                        return Ok(JsonView(true, "成功!"));
+                    }
+                    else
+                    {
+                        return Ok(JsonView(false, "失败!"));
+                    }
                 }
-                else
+                catch (Exception)
                 {
-                    return Ok(JsonView(false, "失败!"));
+                    var result = await _sqlSugar.Updateable<Grp_HotelReservations>().Where(a => a.Id == dto.Id && a.IsDel == 0).SetColumns(a => new Grp_HotelReservations()
+                    {
+                        Attachment = "",
+                    }).ExecuteCommandAsync();
+                    if (result != 0)
+                    {
+                        return Ok(JsonView(true, "成功!"));
+                    }
+                    else
+                    {
+                        return Ok(JsonView(false, "失败!"));
+                    }
+                    throw;
                 }
+               
+                
             }
             catch (Exception ex)
             {
@@ -4258,19 +4279,39 @@ namespace OASystem.API.Controllers
                 //int id = 0;
                 filePath = fileDir + "/保险费用文件上传/" + dto.fileName;
                 // 删除该文件
-                System.IO.File.Delete(filePath);
-                var result = await _sqlSugar.Updateable<Grp_Customers>().Where(a => a.Id == dto.Id && a.IsDel == 0).SetColumns(a => new Grp_Customers()
-                {
-                    Attachment = "",
-                }).ExecuteCommandAsync();
-                if (result != 0)
+                try
                 {
-                    return Ok(JsonView(true, "成功!"));
+                    System.IO.File.Delete(filePath);
+                    var result = await _sqlSugar.Updateable<Grp_Customers>().Where(a => a.Id == dto.Id && a.IsDel == 0 && a.Attachment == dto.fileName).SetColumns(a => new Grp_Customers()
+                    {
+                        Attachment = "",
+                    }).ExecuteCommandAsync();
+                    if (result != 0)
+                    {
+                        return Ok(JsonView(true, "成功!"));
+                    }
+                    else
+                    {
+                        return Ok(JsonView(false, "失败!"));
+                    }
                 }
-                else
+                catch (Exception)
                 {
-                    return Ok(JsonView(false, "失败!"));
+                    var result = await _sqlSugar.Updateable<Grp_Customers>().Where(a => a.Id == dto.Id && a.IsDel == 0 && a.Attachment == dto.fileName).SetColumns(a => new Grp_Customers()
+                    {
+                        Attachment = "",
+                    }).ExecuteCommandAsync();
+                    if (result != 0)
+                    {
+                        return Ok(JsonView(true, "成功!"));
+                    }
+                    else
+                    {
+                        return Ok(JsonView(false, "失败!"));
+                    }
                 }
+                
+                
             }
             catch (Exception ex)
             {