Browse Source

新增出入境费用草稿相关功能和 DTO

在 `GroupsController.cs` 中添加了 `EnterExitCostDraftRepository` 私有字段,并实现了多个与出入境费用草稿相关的 API 方法,包括数据源获取、费用提示、信息查询、操作和下载等功能。

在 `EnterExitCostDraftDto.cs` 中新增了多个 DTO 类,用于处理出入境费用草稿的相关数据传输,包括一键清空和子项删除的 DTO。

在 `EnterExitCostDraftView.cs` 中添加了出入境费用子项删除的 DTO 类。

在 `EnterExitCostDraftRepository.cs` 中删除了确认费用的相关方法,并重命名了部分方法以更好地反映其功能,同时更新了与出入境费用草稿相关的数据库操作逻辑,确保数据的正确性和一致性。
LEIYI 2 months ago
parent
commit
9b2260fd3c

File diff suppressed because it is too large
+ 1277 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs


+ 35 - 0
OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDraftDto.cs

@@ -252,4 +252,39 @@ namespace OASystem.Domain.Dtos.Groups
         #endregion
 
     }
+
+    public class EnterExitCostDraftCorrelationTipsDto : PortDtoBase { }
+
+    /// <summary>
+    /// 出入境费用 - 表格导出 Dto
+    /// </summary>
+    public class EnterExitCostDraftDownloadDto : PortDtoBase
+    {
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 模板类型
+        /// 1 明细表
+        /// 2 表格
+        /// 3 团组成员名单
+        /// </summary>
+        public int ExportType { get; set; }
+
+        /// <summary>
+        /// 类型Id
+        /// </summary>
+        public int SubTypeId { get; set; }
+    }
+
+    /// <summary>
+    /// 出入境费用 - 一键清空 dto
+    /// </summary>
+    public class EnterExitCostDraftOneClickEmptyDto : PortDtoBase
+    {
+        public int UserId { get; set; }
+
+        public int Id { get; set; }
+    }
+
+    public class EnterExitCostDraftOtherExpensesDelDto : DelBaseDto { }
 }

+ 7 - 2
OASystem/OASystem.Domain/ViewModels/Groups/EnterExitCostDraftView.cs

@@ -1,4 +1,5 @@
-using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.Dtos;
+using OASystem.Domain.Entities.Groups;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -417,5 +418,9 @@ namespace OASystem.Domain.ViewModels.Groups
         public string Remark { get; set; }
     }
 
-
+    /// <summary>
+    /// 出入境费用子项删除
+    /// </summary>
+    public class EnterExitCostDraftSubItemDelDto : DelBaseDto
+    { }
 }

+ 33 - 121
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostDraftRepository.cs

@@ -266,53 +266,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return result;
         }
 
-        /// <summary>
-        /// 确认费用
-        /// </summary>
-        /// <param name="id"></param>
-        /// <returns></returns>
-        public async Task<JsonView> ConfirmCost(ConfirmCostDto dto)
-        {
-            var _view = new JsonView() { Code = 20001, Msg = "操作失败!" };
-            if (dto.Id < 1)
-            {
-                _view.Msg = MsgTips.Id;
-                return _view;
-            }
-
-            int confirm = 1;
-            if (dto.Type == 1) confirm = 2; // 确认
-            else if (dto.Type == 2) { confirm = 1; } // 撤回
-            else
-            {
-                _view.Msg = "请传入正确的type;1:确认 2:撤回";
-                return _view;
-            }
-            var update = await _sqlSugar.Updateable<Grp_EnterExitCost>()
-                                        .SetColumns(x => new Grp_EnterExitCost() { IsConfirm = confirm })
-                                        .Where(x => x.Id == dto.Id)
-                                        .ExecuteCommandAsync();
-            if (update > 0)
-            {
-                _view.Code = 200;
-                _view.Msg = "操作成功!";
-                return _view;
-            }
-
-            return _view;
-        }
-
-
         /// <summary>
         /// Del
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
-        public async Task<Result> PostEnterExitCostSubItemDel(EnterExitCostSubItemDelDto dto)
+        public async Task<Result> EnterExitCostDraftSubItemDel(EnterExitCostDraftSubItemDelDto dto)
         {
             Result result = new Result();
 
-            var data = new Grp_DayAndCost()
+            var data = new Grp_DayAndCostDraft()
             {
                 Id = dto.Id,
                 IsDel = 1,
@@ -328,102 +291,55 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return result;
         }
 
-        /// <summary>
-        /// 团组模块 - 出入境国家费用标准 - Add Or Update
-        /// </summary>
-        /// <param name="dto"></param>
-        /// <returns></returns>
-        public async Task<Result> PostNationalTravelFeeOperate(NationalTravelFeeOperateDto dto)
-        {
-            Result result = new Result();
-
-            Grp_NationalTravelFee nationalTravelFee = _mapper.Map<Grp_NationalTravelFee>(dto);
-            nationalTravelFee.LastUpdateUserId = dto.UserId;
-            nationalTravelFee.CreateUserId = dto.UserId;
-
-            if (dto.PortType == 1) //web
-            {
-
-                var _nationalTravelFee = _sqlSugar.Storageable<Grp_NationalTravelFee>(nationalTravelFee).ToStorage();
-                if (dto.Id == 0) //新增
-                {
-                    string selectSql = string.Format(@"Select * From Grp_NationalTravelFee 
-                                                   Where IsDel = 0 
-                                                   And Continent = '{0}' 
-                                                   And Country = '{1}'
-                                                   And City = '{2}'", dto.Continent, dto.Country, dto.City);
-                    Grp_NationalTravelFee nationalTravelFee1 = new Grp_NationalTravelFee();
-                    nationalTravelFee1 = await _sqlSugar.SqlQueryable<Grp_NationalTravelFee>(selectSql).FirstAsync();
-                    if (nationalTravelFee1 != null)
-                    {
-                        result.Msg = "该国家 城市已存在,请勿重复添加!";
-                        return result;
-                    }
-
-                    _nationalTravelFee.AsInsertable.ExecuteCommand();   //不存在插入
-                }
-                else
-                {
-                    _nationalTravelFee.AsUpdateable
-                    .IgnoreColumns(it => new { it.CreateUserId, it.CreateTime, it.IsDel })
-                    .WhereColumns(it => it.Id)
-                    .ExecuteCommand();   //存在更新
-                }
-
-                result.Code = 0;
-            }
-            else if (dto.PortType == 2) //Android
-            {
-
-            }
-            else if (dto.PortType == 3) //Ios
-            {
-
-            }
-            else result.Msg = MsgTips.Port;
-
-            return result;
-        }
-
-
         /// <summary>
         /// 一键清空
         /// 删除主表数据 Update
         /// 删除子表数据 delete
         /// </summary>
         /// <param name="id"></param>
-        /// <param name="diid"></param>
+        /// <param name="userId"></param>
         /// <returns></returns>
-        public async Task<Result> _OneClickClear(int id, int diId, int userId)
+        public async Task<Result> OneClickEmpty(int id, int userId)
         {
             Result result = new Result() { Code = -1, Msg = "操作成功!" };
 
             if (id < 1) return result = new Result() { Code = -1, Msg = "请传入有效的Id参数!" };
-            if (diId < 1) return result = new Result() { Code = -1, Msg = "请传入有效的Id参数!" };
             if (userId < 1) return result = new Result() { Code = -1, Msg = "请传入有效的UserId参数!" };
 
             BeginTran();
-            Grp_EnterExitCost _EnterExitCost = new Grp_EnterExitCost()
-            {
-                Id = id,
-                IsDel = 1,
-                DeleteUserId = userId,
-                DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
-            };
 
-            //int update = await _sqlSugar.Updateable<Grp_EnterExitCost>(_EnterExitCost).Where(it => it.Id == id).ExecuteCommandAsync();
-            int update = await _sqlSugar.Updateable<Grp_EnterExitCost>(_EnterExitCost)
-                                        .UpdateColumns(it => new {
-                                            it.IsDel,
-                                            it.DeleteUserId,
-                                            it.DeleteTime
-                                        })
-                                        .Where(it => it.Id == id).ExecuteCommandAsync();
+            int update = await _sqlSugar.Updateable<Grp_EnterExitCostDraft>()
+                .SetColumns(it => new Grp_EnterExitCostDraft()
+                {
+                    IsDel = 1,
+                    DeleteUserId = userId,
+                    DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                })
+                .Where(it => it.Id == id)
+                .ExecuteCommandAsync();
 
             if (update > 0)
             {
-                string sqlDelete = string.Format(@"Delete From Grp_DayAndCost Where Diid = {0} ", diId);
-                await ExecuteCommandAsync(sqlDelete);
+                await _sqlSugar.Updateable<Grp_DayAndCostDraft>()
+                    .SetColumns(it => new Grp_DayAndCostDraft()
+                    {
+                        IsDel = 1,
+                        DeleteUserId = userId,
+                        DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                    })
+                    .Where(it => it.ParentId == id)
+                    .ExecuteCommandAsync();
+
+                await _sqlSugar.Updateable<Grp_DayOtherPriceDraft>()
+                    .SetColumns(it => new Grp_DayOtherPriceDraft()
+                    {
+                        IsDel = 1,
+                        DeleteUserId = userId,
+                        DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                    })
+                    .Where(it => it.ParentId == id)
+                    .ExecuteCommandAsync();
+
                 result.Code = 0;
                 result.Msg = "操作成功!";
                 CommitTran();
@@ -436,9 +352,5 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             return result;
         }
-
-
-
-
     }
 }