Parcourir la source

会务流程添加

yuanrf il y a 8 heures
Parent
commit
a7ad4ed7c8

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

@@ -27997,6 +27997,147 @@ ORDER BY
         }
 
 
+        #endregion
+
+        #region 会务流程
+
+        /// <summary>
+        /// 会务流程 - 数据初始化
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns>团组基本信息、团组列表和会务基本信息列表</returns>
+        [HttpPost]
+        public async Task<IActionResult> ConferenceProceduresInit(ConferenceProceduresInitDto dto)
+        {
+            try
+            {
+                Grp_DelegationInfo targetGroup = null;
+
+                targetGroup = await _sqlSugar.Queryable<Grp_DelegationInfo>()
+                    .Where(x => x.Id == dto.GroupId && x.IsDel == 0)
+                    .FirstAsync();
+
+                if (targetGroup == null)
+                {
+                    targetGroup = await _sqlSugar.Queryable<Grp_DelegationInfo>()
+                        .Where(x => x.IsDel == 0)
+                        .OrderByDescending(x => x.CreateTime)
+                        .FirstAsync();
+                }
+
+                if (targetGroup == null)
+                {
+                    return Ok(JsonView(false, "未找到任何团组信息"));
+                }
+
+                var groupList = await _sqlSugar.Queryable<Grp_DelegationInfo>()
+                    .Where(x => x.IsDel == 0)
+                    .OrderByDescending(x => x.CreateTime)
+                    .Select(x => new { x.Id, x.TeamName })
+                    .ToListAsync();
+
+                var conferenceProceduresList = await _sqlSugar.Queryable<Grp_ConferenceProcedures>()
+                    .Where(x => x.DiId == targetGroup.Id && x.IsDel == 0)
+                    .Select(x => new { x.Id, x.Title, x.DataDetails, x.Details, x.Remark })
+                    .ToListAsync();
+
+                var conferenceProceduresGroupByTitle = conferenceProceduresList
+                .GroupBy(x => x.Title)
+                .Select(x => new
+                {
+                    title = x.Key,
+                    itmes = x.Select(y => new
+                    {
+                        y.Id,
+                        y.DataDetails,
+                        y.Details,
+                        y.Remark
+                    }).ToList()
+                })
+                .ToList();
+
+                var response = new
+                {
+                    GroupInfo = new
+                    {
+                        targetGroup.Id,
+                        targetGroup.TeamName,
+                        targetGroup.VisitDate,
+                        targetGroup.VisitDays,
+                        targetGroup.VisitPNumber,
+                        targetGroup.VisitCountry,
+                        targetGroup.VisitStartDate,
+                        targetGroup.VisitEndDate
+                    },
+                    GroupList = groupList,
+                    ConferenceProceduresList = conferenceProceduresList,
+                    conferenceProceduresGroupByTitle = conferenceProceduresGroupByTitle
+                };
+
+                return Ok(JsonView(true, "SUCCESS", response));
+            }
+            catch (Exception ex)
+            {
+                _logger.LogError(ex, "数据初始化失败");
+                return Ok(JsonView(false, $"ERROR:{ex.Message}"));
+            }
+        }
+
+
+        /// <summary>
+        /// 会务流程 - 保存
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<IActionResult> ConferenceProceduresSave(ConferenceProceduresSaveDto dto)
+        {
+            _sqlSugar.BeginTran();
+
+            try
+            {
+                //删除旧数据
+                _sqlSugar.Updateable<Grp_ConferenceProcedures>()
+                    .Where(x => x.DiId == dto.GroupId && x.IsDel == 0)
+                    .SetColumns(x => new Grp_ConferenceProcedures
+                    {
+                        IsDel = 1,
+                        DeleteTime = DateTime.Now.ToString("yyyy-MM-dd"),
+                        DeleteUserId = dto.UserId
+                    })
+                    .ExecuteCommand();
+
+                //添加新数据
+                var newData = new List<Grp_ConferenceProcedures>();
+                foreach (var item in dto.ConferenceProceduresSaveItem)
+                {
+                    foreach (var item2 in item.itmes)
+                    {
+                        newData.Add(new Grp_ConferenceProcedures
+                        {
+                            DiId = dto.GroupId,
+                            Title = item.title,
+                            DataDetails = item2.DataDetails,
+                            Details = item2.details,
+                            Remark = item2.Remark,
+                            CreateTime = DateTime.Now,
+                            CreateUserId = dto.UserId
+                        });
+                    }
+                }
+
+                _sqlSugar.Insertable(newData).ExecuteCommand();
+                _sqlSugar.CommitTran();
+            }
+            catch (Exception ex)
+            {
+                _sqlSugar.RollbackTran();
+                return Ok(JsonView(false, $"ERROR:{ex.Message}"));
+            }
+
+            return Ok(JsonView(true, "SUCCESS"));
+        }
+
         #endregion
 
         #region 团组签证流程

+ 54 - 4
OASystem/OASystem.Domain/Dtos/Groups/GroupListDto.cs

@@ -20,7 +20,7 @@ namespace OASystem.Domain.Dtos.Groups
     public class GroupCostEditGroupInfoDto
     {
         // 团组Id
-        public int Diid{ get; set; }
+        public int Diid { get; set; }
         // 访问日期
         public string VisitDate { get; set; }
 
@@ -84,6 +84,54 @@ namespace OASystem.Domain.Dtos.Groups
         public int Id { get; set; }
     }
 
+    /// <summary>
+    /// 数据初始化请求DTO
+    /// </summary>
+    public class ConferenceProceduresInitDto
+    {
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int GroupId { get; set; }
+    }
+
+    public class ConferenceProceduresSaveDto
+    {
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int GroupId { get; set; }
+        /// <summary>
+        /// 操作用户Id
+        /// </summary>
+        public int UserId { get; set; }
+        public List<ConferenceProceduresSaveItemDto> ConferenceProceduresSaveItem { get; set; }
+
+    }
+
+    public class ConferenceProceduresSaveItemDto
+    {
+        public string title { get; set; }
+
+        public List<ConferenceProceduresSaveItem> itmes { get; set; }
+    }
+
+    public class ConferenceProceduresSaveItem
+    {
+        /// <summary>
+        /// 时间安排内容
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string DataDetails { get; set; }
+
+        /// <summary>
+        /// 详细内容
+        /// </summary>
+        public string details { get; set; }
+
+        public string Remark { get; set; }
+    }
+
     /// <summary>
     /// 团组信息 操作
     /// 请求dto
@@ -305,14 +353,15 @@ namespace OASystem.Domain.Dtos.Groups
         public int UserId { get; set; }
     }
 
-    public class EnterpriseWeChatNotificationAsyncBaoPiDto {
+    public class EnterpriseWeChatNotificationAsyncBaoPiDto
+    {
         public int currUserId { get; set; }
         public int diid { get; set; }
     }
 
     public class tableSetting
     {
-        public int Index { get;set; }
+        public int Index { get; set; }
 
         public string Property { get; set; }
     }
@@ -328,7 +377,8 @@ namespace OASystem.Domain.Dtos.Groups
 
     public class GroupNameScreenDtoFoaValidator : AbstractValidator<GroupNameScreenDto>
     {
-        public GroupNameScreenDtoFoaValidator() {
+        public GroupNameScreenDtoFoaValidator()
+        {
             RuleFor(it => it.PortType)
                 .NotNull()
                 .NotEmpty()

+ 47 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_ConferenceProcedures.cs

@@ -0,0 +1,47 @@
+using System;
+
+namespace OASystem.Domain.Entities.Groups
+{
+    /// <summary>
+    /// 会务流程
+    /// </summary>
+    [SugarTable("Grp_ConferenceProcedures")]
+    public class Grp_ConferenceProcedures : EntityBase
+    {
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int DiId { get; set; }
+
+        /// <summary>
+        /// 标题Id
+        /// </summary>
+        //[SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        //public int TitleId { get; set; }
+
+        /// <summary>
+        /// 标题
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string Title { get; set; }
+
+        /// <summary>
+        /// 时间安排
+        /// </summary>
+        //[SugarColumn(IsNullable = true, ColumnDataType = "DateTime")]
+        //public DateTime Date { get; set; }
+
+        /// <summary>
+        /// 时间安排内容
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string DataDetails { get; set; }
+
+        /// <summary>
+        /// 详细内容
+        /// </summary>
+        public string Details { get; set; }
+    }
+
+}