Bläddra i källkod

增强团组前期信息接口,支持移动端访问

在 `GroupsController.cs` 中,`GroupOrderPreInfo` 方法增加了 `portType` 参数,并新增 `GroupOrderPreMobileInfo` 方法以支持移动端信息获取。更新了相关 XML 注释。

在 `_baseMappingProfile.cs` 中,删除了与费用相关的映射配置,并添加了 `AutoMapperConfig` 类。

在 `GroupOrderPreInfoDtos.cs` 中,`GroupOrderPreInfoDto` 类增加了默认值为 1404 的 `TempId` 属性。

在 `OrderPreInfoView.cs` 中,重命名了 `GrpOrderPreInfoView` 为 `GrpOrderPreInfoBasicView`,并创建了新的 `GrpOrderPreInfoView` 类以包含 `Items` 属性,同时添加了 `GrpOrderPreInfoMobileView` 类。

在 `FeeAuditRepository.cs` 中,移除了重复的 `using` 语句,并对查询进行了格式化。

在 `GroupOrderPreInfoRepository.cs` 中,新增 `TempMobileInfoById` 方法以异步获取模板信息,并增加了 `MobileInfoAsync` 方法以获取移动端的团组下单前信息,包含模板字段补充逻辑。
LEIYI 3 månader sedan
förälder
incheckning
bff16b0f00

+ 15 - 2
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -442,7 +442,6 @@ namespace OASystem.API.Controllers
                 //.ToPageListAsync(dto.PageIndex, dto.PageSize, total);
                 .ToListAsync();
 
-
             var listPageData = list.WhereIF(!string.IsNullOrEmpty(search), x => x.Name.Contains(search) || x.UnitName.Contains(search) || x.VisitCountrys.Contains(search)).ToList();
             int total = list.Count;
             int totalPageCount = (int)Math.Ceiling(list.Count / (double)dto.PageSize);
@@ -591,14 +590,28 @@ namespace OASystem.API.Controllers
         ///  团组前期信息 Info
         /// </summary>
         /// <param name="dto">Id</param>
+        /// <param name="portType">Id</param>
         /// <returns></returns>
         [HttpGet("{Id}/{TempId}")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GroupOrderPreInfo([FromRoute] GroupOrderPreInfoDto dto)
+        public async Task<IActionResult> GroupOrderPreInfo([FromRoute] GroupOrderPreInfoDto dto,int portType=1)
         {
             return Ok(await _grpOrderPreInfoRep.InfoAsync(dto.Id, dto.TempId));
         }
 
+        /// <summary>
+        ///  团组前期信息 移动端 Info
+        /// </summary>
+        /// <param name="dto">Id</param>
+        /// <param name="portType">Id</param>
+        /// <returns></returns>
+        [HttpGet("{Id}/{TempId}")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GroupOrderPreMobileInfo([FromRoute] GroupOrderPreInfoDto dto)
+        {
+            return Ok(await _grpOrderPreInfoRep.MobileInfoAsync(dto.Id, dto.TempId));
+        }
+
         /// <summary>
         ///  团组前期信息 Save
         /// </summary>

+ 2 - 1
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -174,7 +174,6 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<OpVisaPriceDto, Grp_CreditCardPayment>();
             #endregion
 
-
             #region op费用
             CreateMap<OpCarTouristGuideGroundDto, Grp_CarTouristGuideGroundReservations>();
             CreateMap<Grp_CreditCardPayment, CarTouristCreditCardPaymentView>();
@@ -372,6 +371,8 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<MarketingSalesVCOperrateDto, Grp_VisitingClients>();
             CreateMap<VisitingClientsListView, Grp_VisitingClients>();
             #endregion
+
+
         }
     }
 

+ 1 - 0
OASystem/OASystem.Domain/Dtos/Groups/GroupOrderPreInfoDtos.cs

@@ -29,5 +29,6 @@ namespace OASystem.Domain.Dtos.Groups
     {
         public int Id { get; set; }
         public int TempId { get; set; } = 1404;
+
     }
 }

+ 109 - 6
OASystem/OASystem.Domain/ViewModels/Groups/OrderPreInfoView.cs

@@ -46,7 +46,7 @@ namespace OASystem.Domain.ViewModels.Groups
         public DateTime OperationTime { get; set; }
     }
 
-    public class GrpOrderPreInfoView
+    public class GrpOrderPreInfoBasicView
     {
         public int Id { get; set; }
 
@@ -56,10 +56,19 @@ namespace OASystem.Domain.ViewModels.Groups
 
         public int GroupId { get; set; }
 
+    }
+
+    public class GrpOrderPreInfoView: GrpOrderPreInfoBasicView
+    {
         public GrpOrderPreItemView[] Items { get; set; }
     }
 
-    public class GrpOrderPreItemView
+    public class GrpOrderPreInfoMobileView : GrpOrderPreInfoBasicView
+    {
+        public GrpOrderPreItemMobileView[] Items { get; set; }
+    }
+
+    public class GrpOrderPreItemBasicView
     {
         public int Id { get; set; }
         public int ParentId { get; set; }
@@ -70,6 +79,16 @@ namespace OASystem.Domain.ViewModels.Groups
         public string FieldTypeName { get; set; }
         public string OriginVal { get; set; }
 
+
+        public string Remark { get; set; }
+        public bool IsRequired { get; set; }
+        public bool IsRemark { get; set; }
+        public int Index { get; set; }
+    }
+
+
+    public class GrpOrderPreItemView: GrpOrderPreItemBasicView
+    {
         private object _newValue;
 
         public object NewValue
@@ -157,9 +176,93 @@ namespace OASystem.Domain.ViewModels.Groups
             set { _newValue = value; }
         }
 
-        public string Remark { get; set; }
-        public bool IsRequired { get; set; }
-        public bool IsRemark { get; set; }
-        public int Index { get; set; }
+    }
+
+    public class GrpOrderPreItemMobileView : GrpOrderPreItemBasicView
+    {
+        private object _newValue;
+
+        public object NewValue
+        {
+            get
+            {
+                if (string.IsNullOrEmpty(OriginVal)) return _newValue;
+
+                if (FieldTypeName.Equals("文本"))
+                {
+                    if (_newValue != null)
+                    {
+                        OriginVal = _newValue.ToString();
+                    }
+
+                    if (OriginVal.Equals("-")) return _newValue;
+
+                    return OriginVal;
+                }
+                else if (FieldTypeName.Equals("搜索框"))
+                {
+                    if (_newValue != null)
+                    {
+                        if (_newValue is Array)
+                        {
+                            return string.Join(",", (Array)_newValue);
+                        }
+                        else if (_newValue is string[])
+                        {
+                            return string.Join(",", (string[])_newValue);
+                        }
+                        else if (_newValue is IEnumerable)
+                        {
+                            return string.Join(",", ((IEnumerable)_newValue).Cast<object>().Select(x => x.ToString()).ToArray());
+                        }
+                        else
+                        {
+                            return _newValue;
+                        }
+                    }
+
+                    var val = Array.Empty<string>();
+                    try
+                    {
+                        return string.Join(",", JsonConvert.DeserializeObject<string[]>(OriginVal));
+                    }
+                    catch (Exception)
+                    {
+                        return "";
+                    }
+                }
+                else if (FieldTypeName.Equals("下拉选择框") || FieldTypeName.Equals("复选框") || FieldTypeName.Equals("数字"))
+                {
+                    if (_newValue != null)
+                    {
+                        int.TryParse(_newValue.ToString(), out int val);
+                        OriginVal = val.ToString();
+                    }
+                    else
+                    {
+                        int.TryParse(OriginVal, out int val);
+                        OriginVal = val.ToString();
+                    }
+
+                    return OriginVal;
+                }
+                else if (FieldTypeName.Equals("单选按钮"))
+                {
+                    var val = "无";
+                    if (OriginVal.Equals("有")) val = "有";
+
+                    if (_newValue != null)
+                    {
+                        if (_newValue.ToString().Equals("有")) val = "有";
+                    }
+
+                    OriginVal = val;
+                    return OriginVal;
+                }
+                return "";
+            }
+            set { _newValue = value; }
+        }
+
     }
 }

+ 8 - 7
OASystem/OASystem.Infrastructure/Repositories/Groups/FeeAuditRepository.cs

@@ -1,4 +1,5 @@
-using EyeSoft.Logging;
+using EyeSoft.Extensions;
+using EyeSoft.Logging;
 using NPOI.SS.Formula.Functions;
 using OASystem.Domain;
 using OASystem.Domain.Entities.Groups;
@@ -395,7 +396,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 var teNames = setData.Where(x => x.STid == 91).Select(x => x.Name).ToList();
                 var otherFeeDatas = _sqlSugar.Queryable<Grp_DecreasePayments>()
                     .InnerJoin<Grp_CreditCardPayment>((dp, ccp) => dp.Id == ccp.CId && ccp.CTable == 98 && ccp.IsDel == 0)
-                    .Where((dp, ccp) => dp.IsDel == 0 && dp.DiId == diId)
+                    .Where((dp, ccp) => dp.IsDel == 0 && ccp.IsDel == 0 && dp.DiId == diId)
                     .ToList();
 
                 var ids = new List<int>();
@@ -447,11 +448,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 if (isAutoAudit)
                 {
                     var ccpUpdate = _sqlSugar.Updateable<Grp_CreditCardPayment>()
-                                       .SetColumns(it => it.IsAuditGM == 3)
-                                       .SetColumns(it => it.AuditGMOperate == 4)
-                                       .SetColumns(it => it.AuditGMDate == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
-                                       .Where(s => s.DIId == diId && s.CTable == currModule && s.CId == dataId)
-                                       .ExecuteCommand();
+                        .SetColumns(it => it.IsAuditGM == 3)
+                        .SetColumns(it => it.AuditGMOperate == 4)
+                        .SetColumns(it => it.AuditGMDate == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
+                        .Where(s => s.DIId == diId && s.CTable == currModule && s.CId == dataId)
+                        .ExecuteCommand();
                     if (ccpUpdate > 0)
                     {
                         _view.Code = 200;

+ 101 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/GroupOrderPreInfoRepository.cs

@@ -60,7 +60,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return jw;
         }
 
-
         /// <summary>
         /// 获取模板信息
         /// </summary>
@@ -90,11 +89,41 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return tempInfos;
         }
 
+        /// <summary>
+        /// 获取模板信息
+        /// </summary>
+        /// <param name="tempId">模板编号,默认 1404</param>
+        /// <returns></returns>
+        public async Task<GrpOrderPreItemMobileView[]> TempMobileInfoById(int tempId = 1404)
+        {
+            var tempInfos = await _sqlSugar.Queryable<Sys_FormTemp, Sys_SetData, Sys_SetData>((ft, sd1, sd2) =>
+                new JoinQueryInfos(
+                    JoinType.Left, ft.FieldNameId == sd1.Id,
+                    JoinType.Left, ft.FieldTypeId == sd2.Id
+                    ))
+                .Where((ft, sd1, sd2) => ft.IsDel == 0 && ft.TempId == tempId)
+                .OrderBy((ft, sd1, sd2) => ft.Index)
+                .Select((ft, sd1, sd2) => new GrpOrderPreItemMobileView()
+                {
+                    FieldTempId = ft.Id,
+                    FieldName = sd1.Name,
+                    OriginVal = "-",
+                    // FieldTypeName = !string.IsNullOrEmpty(ft.Remark) ? sd2.Name +"-"+ ft.Remark : sd2.Name,
+                    FieldTypeName = sd2.Name,
+                    IsRequired = ft.IsRequired,
+                    IsRemark = ft.IsRemark,
+                    Index = ft.Index
+                })
+                .ToArrayAsync();
+            return tempInfos;
+        }
+
         /// <summary>
         /// 获取团组下单前信息
         /// </summary>
         /// <param name="id">下单前信息Id</param>
         /// <param name="tempId">模板编号,默认 1404</param>
+        /// <param name="portType">端口号</param>
         /// <returns></returns>
         public async Task<JsonView> InfoAsync(int id, int tempId = 1404)
         {
@@ -106,7 +135,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             var temps = await TempInfoById(tempId);
             if (info == null)
             {
-                view.Items = temps;
+                view.Items = temps; 
                 jw.Data = view;
                 return jw;
             }
@@ -159,6 +188,76 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return jw;
         }
 
+        /// <summary>
+        /// 获取团组下单前信息
+        /// </summary>
+        /// <param name="id">下单前信息Id</param>
+        /// <param name="tempId">模板编号,默认 1404</param>
+        /// <param name="portType">端口号</param>
+        /// <returns></returns>
+        public async Task<JsonView> MobileInfoAsync(int id, int tempId = 1404)
+        {
+            var jw = new JsonView() { Code = StatusCodes.Status200OK, Msg = "操作成功!" };
+            var view = new GrpOrderPreInfoMobileView();
+            var info = await _sqlSugar.Queryable<Grp_OrderPreInfo>()
+                .FirstAsync(x => x.IsDel == 0 && x.Id == id);
+
+            var temps = await TempMobileInfoById(tempId);
+            if (info == null)
+            {
+                view.Items = temps;
+                jw.Data = view;
+                return jw;
+            }
+
+            view.Id = id;
+            view.Name = info.Name;
+            view.GroupId = info.GroupId;
+            var items = await _sqlSugar.Queryable<Sys_FormTemp, Grp_OrderPreItem, Sys_SetData, Sys_SetData>((ft, opi, sd1, sd2) =>
+                new JoinQueryInfos(
+                    JoinType.Inner, ft.Id == opi.FormTempId,
+                    JoinType.Left, ft.FieldNameId == sd1.Id,
+                    JoinType.Left, ft.FieldTypeId == sd2.Id
+                    ))
+                .Where((ft, opi, sd1, sd2) => ft.IsDel == 0 && opi.IsDel == 0 && opi.ParentId == id && ft.TempId == tempId)
+                .OrderBy((ft, opi, sd1, sd2) => ft.Index)
+                .Select((ft, opi, sd1, sd2) => new GrpOrderPreItemMobileView()
+                {
+                    Id = opi.Id,
+                    ParentId = opi.ParentId,
+                    FieldTempId = ft.Id,
+                    FieldName = sd1.Name,
+                    FieldTypeName = sd2.Name,
+                    OriginVal = opi.Value,
+                    Remark = opi.Remark,
+                    IsRequired = ft.IsRequired,
+                    IsRemark = ft.IsRemark,
+                    Index = ft.Index
+                })
+                .ToArrayAsync();
+
+            // 如果原始数据不存在或者数量不匹配,则补充模板中缺失的字段
+            if (!items.Any())
+            {
+                view.Items = temps;
+            }
+            else
+            {
+                var itemsList = items.ToList();
+                foreach (var temp in temps)
+                {
+                    if (!itemsList.Any(x => x.FieldName.Equals(temp.FieldName)))
+                    {
+                        itemsList.Add(temp);
+                    }
+                }
+                view.Items = itemsList.OrderBy(x => x.Index).ToArray();
+            }
+
+            jw.Data = view;
+            return jw;
+        }
+
         /// <summary>
         /// 获取团组下单前信息 op
         /// </summary>