Browse Source

添加成本通知Api

yuanrf 1 year ago
parent
commit
3a6d6b558c

+ 53 - 0
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3798,6 +3798,59 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(true, "获取成功!", Data));
         }
 
+
+        /// <summary>
+        /// 成本通知
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<IActionResult> GroupIsShare(GroupIsShareDto dto)
+        {
+            if (dto.Diid < 0)
+            {
+                return Ok(JsonView(false));
+            }
+
+            JsonView jw = null;
+            var GroupCostParameter = _GroupCostParameterRepository.GetGroupCostParameterMainByDiid(dto.Diid);
+            if (GroupCostParameter != null)
+            {
+                int IsShare = 0;
+                if (GroupCostParameter.IsShare == 0) IsShare = 1;
+                else if (GroupCostParameter.IsShare == 1) IsShare = 0;
+
+                bool isTrue = await _GroupCostParameterRepository.UpdateIsShareById(GroupCostParameter.Id,IsShare);
+                string msg = string.Empty;
+
+                if (isTrue)
+                {
+                    if (IsShare == 0)
+                    {
+                        msg = "禁止通知,其他模块操作人员不可见此成本信息!";
+                    }
+                    else
+                    {
+                        msg = "通知成功,其他模块操作人员可见此成本信息!";
+                    }
+
+                    jw = JsonView(isTrue, msg);
+                }
+                else
+                {
+                    msg = "修改失败!";
+                    jw = JsonView(isTrue, msg);
+                }
+            }
+            else
+            {
+                jw = JsonView(false, "该团没有数据,请添加数据,保存后再操作!");
+            }
+
+            return Ok(jw);
+        }
+
+
         #endregion
 
         #region 酒店预定

+ 5 - 0
OASystem/OASystem.Domain/Dtos/Groups/GroupCostSavaDto.cs

@@ -32,6 +32,11 @@ namespace OASystem.Domain.Dtos.Groups
      
     }
 
+    public class GroupIsShareDto
+    {
+        public int Diid { get; set; }
+    }
+
     public class Grp_CheckBoxsDto
     {
         public int Diid { get; set; }

+ 10 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/GroupCostParameterRepository.cs

@@ -20,6 +20,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
            return Query(x=>x.DiId == diid).ToList();
         }
 
+        public Grp_GroupCostParameter GetGroupCostParameterMainByDiid(int diid)
+        {
+            return Query(x => x.DiId == diid).First(x => x.CostType == "A");
+        }
+
+        public async Task<bool> UpdateIsShareById(int id,int IsShare)
+        {
+            return await UpdateAsync(x => x.Id == id, x=>new Grp_GroupCostParameter { IsShare = IsShare });
+        }
+
         public async Task<bool> DeleteGroupCostParameterListByDiid(int diid) 
         {
             return await SoftDeleteAsync(x=>x.DiId == diid);