浏览代码

优化出入境费用相关方法和数据源查询

在 `GroupsController.cs` 中删除了过时的方法,并新增了用于获取草稿省份归属的基础数据源方法。优化了 `GetEnterExitCostDataSource` 方法,使用 LINQ 替代 SQL 字符串格式化,移除了硬编码的省份 ID 检查。新增 `EnterExitCostDraftFileOwner` 方法以支持草稿文件类型的获取,并更新了相关 DTO 类型。整体提升了代码的灵活性和可维护性。
LEIYI 1 周之前
父节点
当前提交
8cbb754071

+ 184 - 131
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -5603,20 +5603,6 @@ FROM
 
         #region 团组经理模块 出入境费用
 
-        /// <summary>
-        /// 团组模块 - 出入境费用 - 基础数据源 - 省份归属
-        /// </summary>
-        /// <returns></returns>
-        [HttpGet]
-        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GetEnterExitProvBelongCostDataSource()
-        {
-            var provData = await _groupRepository.ProvinceBasicSource();
-
-            return Ok(JsonView(true, "查询成功!", provData));
-        }
-
-
         /// <summary>
         /// 团组模块 - 出入境费用 - 基础数据源(团组名称/币种类型)
         /// </summary>
@@ -5628,9 +5614,8 @@ FROM
             var groupNameData = await _groupRepository.EnterExitCostGroupNameAsync();
             var groupNamFirst = groupNameData.FirstOrDefault();
 
-            string sql = string.Format("Select * From Sys_SetData Where IsDel = 0");
             //SetDataInfoView
-            var dataSource = await _sqlSugar.SqlQueryable<Sys_SetData>(sql).ToListAsync();
+            var dataSource = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 66) .ToListAsync();
 
             var currencyData = dataSource.Where(it => it.STid == 66).ToList(); //所有币种
             List<SetDataInfoView> _CurrencyData = _mapper.Map<List<SetDataInfoView>>(currencyData);
@@ -5639,43 +5624,7 @@ FROM
             int provinceId = 122;
             if (groupNamFirst != null) provinceId = groupNamFirst.ProvinceId;
 
-            var wordTypeData = Array.Empty<SetDataInfoView>();
-            var excelTypeData = Array.Empty<SetDataInfoView>();
-            /*
-             * 122 四川
-             * 108 贵州
-             * 103 重庆
-             * 132 云南
-             */
-            if (provinceId == 122) //四川
-            {
-                //三公费用-Word明细类型
-                wordTypeData = dataSource
-                    .Where(it => it.STid == 72)
-                    .Select(x => new SetDataInfoView
-                    {
-                        Id = x.Id,
-                        Name = x.Name,
-                        Remark = x.Remark
-                    })
-                    .ToArray();
-
-                excelTypeData = dataSource
-                    .Where(it => it.STid == 73)
-                    .Select(x => new SetDataInfoView
-                    {
-                        Id = x.Id,
-                        Name = x.Name,
-                        Remark = x.Remark
-                    })
-                    .ToArray();
-            }
-            else if (provinceId == 108) //贵州
-            { }
-            else if (provinceId == 103) //重庆
-            { }
-            else if (provinceId == 132) //云南
-            { }
+            (SetDataInfoView[] wordTypeData, SetDataInfoView[] excelTypeData) = await _enterExitCostRep.FileOwner(provinceId);
 
             var _currencyInfos = await GeneralMethod.EnterExitCostInitRate();
 
@@ -5691,6 +5640,7 @@ FROM
             }));
         }
 
+
         /// <summary>
         /// 团组模块 - 出入境费用 
         /// 实时汇率 tips
@@ -7805,13 +7755,52 @@ FROM
 
         #region 团组经理模块 出入境费用-草稿
 
+        /// <summary>
+        /// 团组模块 - 出入境费用-草稿 - 基础数据源 - 省份归属
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> EnterExitDraftProvBelongCostDataSource()
+        {
+            var provData = await _groupRepository.ProvinceBasicSource();
+
+            return Ok(JsonView(true, "查询成功!", provData));
+        }
+
+        /// <summary>
+        /// 团组模块 - 出入境费用-草稿 - 文件类型list 更据省份Id获取
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("{provinceId}")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> EnterExitCostDraftFileOwner([FromRoute] int provinceId = 122)
+        {
+            //验证城市归属并给默认值
+            if (provinceId < 1) provinceId = 122;
+
+            /*
+             * 122 四川
+             * 108 贵州
+             * 103 重庆
+             * 132 云南
+             */
+            (SetDataInfoView[] wordTypeData, SetDataInfoView[] excelTypeData) = await _enterExitCostDraftRep.FileOwner(provinceId);
+
+            return Ok(JsonView(true, "查询成功!", new
+            {
+                WordTypeData = wordTypeData,
+                ExcelTypeData = excelTypeData,
+            }));
+        }
+
         /// <summary>
         /// 团组模块 - 出入境费用-草稿 - 基础数据源(团组名称/币种类型)
         /// </summary>
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> EnterExitCostDraftDataSource(PortDtoBase dto)
+        public async Task<IActionResult> EnterExitCostDraftDataSource(EnterExitCostDraftDataSourceDto dto)
         {
             var draftNameDatas = await _sqlSugar.Queryable<Grp_EnterExitCostDraft>()
                      .Where(x => x.IsDel == 0)
@@ -7821,16 +7810,21 @@ FROM
 
             string sql = string.Format("Select * From Sys_SetData Where IsDel = 0");
             //SetDataInfoView
-            var dataSource = await _sqlSugar.SqlQueryable<Sys_SetData>(sql).ToListAsync();
+            var dataSource = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 66).ToListAsync();
 
             var currencyData = dataSource.Where(it => it.STid == 66).ToList(); //所有币种
             var _CurrencyData = _mapper.Map<List<SetDataInfoView>>(currencyData);
 
-            var wordTypeData = dataSource.Where(it => it.STid == 72).ToList();  //三公费用-Word明细类型
-            var _WordTypeData = _mapper.Map<List<SetDataInfoView>>(wordTypeData);
+            int provinceId = dto.ProvinceId;
+            if (provinceId < 1) provinceId = 122;
 
-            var excelTypeData = dataSource.Where(it => it.STid == 73).ToList(); //三公费用-Excel明细类型
-            var _ExcelTypeData = _mapper.Map<List<SetDataInfoView>>(excelTypeData);
+            /*
+             * 122 四川
+             * 108 贵州
+             * 103 重庆
+             * 132 云南
+             */
+            (SetDataInfoView[] wordTypeData, SetDataInfoView[] excelTypeData) = await _enterExitCostRep.FileOwner(provinceId);
 
             //默认币种显示
             var _currencyInfos = await GeneralMethod.EnterExitCostInitRate();
@@ -7841,8 +7835,8 @@ FROM
             {
                 DraftNameDatas = draftNameDatas,
                 CurrencyData = _CurrencyData,
-                WordTypeData = _WordTypeData,
-                ExcelTypeData = _ExcelTypeData,
+                WordTypeData = wordTypeData,
+                ExcelTypeData = excelTypeData,
                 CurrencyInit = _currencyInfos,
                 ViewPermissionData = viewPermissionData
             }));
@@ -9316,47 +9310,39 @@ FROM
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostMobileDataSource(EnterExitCostMobileDataSourceDto dto)
         {
-            string sql = string.Format("Select * From Sys_SetData Where IsDel = 0");
-            //SetDataInfoView
-            var dataSource = await _sqlSugar.SqlQueryable<Sys_SetData>(sql).ToListAsync();
-
-            var fileTypes = new List<EecSetDataInfoView>();
-
             //验证城市归属并给默认值
             int provinceId = dto.ProvinceId;
             if (provinceId < 1) provinceId = 122;
 
-            if (provinceId == 122) //四川
-            {
-                //三公费用-Word明细类型
-                var wordTypeData = dataSource
-                    .Where(it => it.STid == 72)
-                    .Select(x => new EecSetDataInfoView
-                    {
-                        ParentId = 1,
-                        Id = x.Id,
-                        Name = x.Name
-                    })
-                    .ToArray();
+            var dataSource = await _sqlSugar
+                .Queryable<Sys_SetData>()
+                .Where(x => x.IsDel == 0 && (x.STid == 72 || x.STid == 73) && x.Remark.Contains(provinceId.ToString())) 
+                .ToListAsync();
 
-                if (wordTypeData.Any()) fileTypes.AddRange(wordTypeData);
-                var excelTypeData = dataSource
-                    .Where(it => it.STid == 73)
-                    .Select(x => new EecSetDataInfoView
-                    {
-                        ParentId = 2,
-                        Id = x.Id,
-                        Name = x.Name
-                    })
-                    .ToArray();
-                if (excelTypeData.Any()) fileTypes.AddRange(excelTypeData);
-            }
-            else if (provinceId == 1409) //贵州
-            { }
-            else if (provinceId == 1410) //重庆
-            { }
-            else if (provinceId == 1411) //昆明
-            { }
+            var fileTypes = new List<EecSetDataInfoView>();
+
+            //三公费用-Word明细类型
+            var wordTypeData = dataSource
+                .Where(it => it.STid == 72)
+                .Select(x => new EecSetDataInfoView
+                {
+                    ParentId = 1,
+                    Id = x.Id,
+                    Name = x.Name
+                })
+                .ToArray();
+
+            if (wordTypeData.Any()) fileTypes.AddRange(wordTypeData);
+            var excelTypeData = dataSource
+                .Where(it => it.STid == 73)
+                .Select(x => new EecSetDataInfoView
+                {
+                    ParentId = 2,
+                    Id = x.Id,
+                    Name = x.Name
+                })
+                .ToArray();
+            if (excelTypeData.Any()) fileTypes.AddRange(excelTypeData);
 
 
             var groupNameList = new EecSetDataInfoView() { ParentId = 3, Id = 1, Name = "团组成员名单" };
@@ -9404,9 +9390,39 @@ FROM
                     GroupName = x.TeamName,
                     IsNull = SqlFunc.Subqueryable<Grp_EnterExitCost>().Where(x1 => x1.DiId == x.Id && x1.IsDel == 0).Any() ? false : true,
                     IsView = SqlFunc.Subqueryable<Grp_EnterExitCostPermission>().Where(x1 => x1.GroupId == x.Id && x1.UserId == dto.CurrUserId).Any(),
+                    ProvinceId = x.CityId
                 })
                 .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
 
+            //处理省份Id
+            if (data.Any())
+            {
+                var provCityDatas = await _groupRepository.ProvinceCityBasicSource();
+                if (provCityDatas.Any())
+                {
+                    foreach (var item in data)
+                    {
+                        var provinceId = item.ProvinceId;
+                        var isDefualtVal = true;
+                        if (provinceId > 0)
+                        {
+                            var parentId = _groupRepository.FindParentIdByChildId(provCityDatas, provinceId);
+                            if (parentId != null)
+                            {
+                                isDefualtVal = false;
+                                item.ProvinceId = (int)parentId;
+                            }
+                        }
+
+                        if (isDefualtVal)
+                        {
+                            item.ProvinceId = 122; //默认四川
+                        }
+                    }
+                }
+            }
+
+            //处理是否显示
             if (basicUserId.Any(x => x.Id == dto.CurrUserId))
             {
                 foreach (var item in data)
@@ -10030,11 +10046,11 @@ FROM
             int id = dto.Id;
             if (id <= 0) //add 
             {
-                int provinceId = dto.ProvinceId,
-                    groupId = dto.DiId;
+                //int provinceId = dto.ProvinceId;
+                  int  groupId = dto.DiId;
 
-                if (provinceId < 1) provinceId = 122;
-                var info = new Grp_EnterExitCost() { ProvinceId = provinceId, DiId = groupId, CurrencyRemark = currencyStr, CreateUserId = dto.CurrUserId };
+                //if (provinceId < 1) provinceId = 122;
+                var info = new Grp_EnterExitCost() { DiId = groupId, CurrencyRemark = currencyStr, CreateUserId = dto.CurrUserId };
 
                 var add = await _sqlSugar.Insertable(info).ExecuteCommandAsync();
 
@@ -10154,7 +10170,7 @@ FROM
             if (dto.DiId < 1) return Ok(JsonView(false, MsgTips.DiId));
             if (dto.CurrUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
 
-            if (dto.ProvinceId < 1) dto.ProvinceId = 122;
+            //if (dto.ProvinceId < 1) dto.ProvinceId = 122;
 
             var checkboxInfo = _mapper.Map<Grp_EnterExitCost>(dto);
 
@@ -10203,8 +10219,8 @@ FROM
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostMobileOpSingleCheckbox(EnterExitCostMobileOpSingleCheckboxDto dto)
         {
-            int itemTypeId = dto.ItemType, id = dto.Id, currUserId = dto.CurrUserId, diId = dto.DiId, isSelected = dto.IsSelected, provinceId = dto.ProvinceId;
-            if (provinceId < 1) provinceId = 122;
+            int itemTypeId = dto.ItemType, id = dto.Id, currUserId = dto.CurrUserId, diId = dto.DiId, isSelected = dto.IsSelected;
+           // if (provinceId < 1) provinceId = 122;
             var itemTypes = new List<int>() { 3, 4, 5, 6, 7 };
 
             if (!_portTypeData.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
@@ -10215,7 +10231,7 @@ FROM
             var checkboxInfo = new Grp_EnterExitCost()
             {
                 Id = id,
-                ProvinceId = provinceId,
+                //ProvinceId = provinceId,
                 DiId = diId,
                 CreateUserId = currUserId
             };
@@ -10267,7 +10283,7 @@ FROM
             if (dto.DiId < 1) return Ok(JsonView(false, MsgTips.DiId));
             if (dto.CurrUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
 
-            if (dto.ProvinceId < 1) dto.ProvinceId = 122;
+            //if (dto.ProvinceId < 1) dto.ProvinceId = 122;
 
             var info = _mapper.Map<Grp_EnterExitCost>(dto);
             info.FirstItemRemark = dto.FirstItemRemark;
@@ -10325,12 +10341,12 @@ FROM
             if (!_portTypeData.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
             if (dto.DiId < 1) return Ok(JsonView(false, MsgTips.DiId));
             if (dto.CurrUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
-            if (dto.ProvinceId < 1) dto.ProvinceId = 122;
+            //if (dto.ProvinceId < 1) dto.ProvinceId = 122;
 
             var info = _mapper.Map<Grp_EnterExitCost>(dto);
 
             info.DiId = dto.DiId;
-            info.ProvinceId = dto.ProvinceId;
+            //info.ProvinceId = dto.ProvinceId;
             info.OutsideJJPay = dto.OutsideJJPay;
             info.OutsideGWPay = dto.OutsideGWPay;
             info.OutsideTDPay = dto.OutsideTDPay;
@@ -10694,6 +10710,19 @@ FROM
 
         #region 团组经理模块 出入境费用-草稿 移动端(Android/IOS)
 
+        /// <summary>
+        /// 团组模块 - 出入境费用-草稿 - 基础数据源 - 省份归属
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> EnterExitDraftMobileProvBelongCostDataSource()
+        {
+            var provData = await _groupRepository.ProvinceBasicSource();
+
+            return Ok(JsonView(true, "查询成功!", provData));
+        }
+
         /// <summary>
         /// 团组模块 - 出入境费用-草稿-移动端 - 草稿名称数据Data
         /// </summary>
@@ -10742,46 +10771,34 @@ FROM
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostDraftMobileDataSource(EnterExitCostDraftMobileDataSourceDto dto)
         {
-            string sql = string.Format("Select * From Sys_SetData Where IsDel = 0");
-            //SetDataInfoView
-            var dataSource = await _sqlSugar.SqlQueryable<Sys_SetData>(sql).ToListAsync();
-
+            //验证城市归属并给默认值
             int provinceId = dto.ProvinceId;
             if (provinceId < 1) provinceId = 122;
-            List<SetDataInfoView> wordTypeData = new List<SetDataInfoView>();
-            List<SetDataInfoView> excelTypeData = new List<SetDataInfoView>();
 
-            if (provinceId == 122) //四川
-            {
-                //三公费用-Word明细类型
-                wordTypeData = dataSource.Where(it => it.STid == 72)
+            var dataSource = await _sqlSugar
+                .Queryable<Sys_SetData>()
+                .Where(x => x.IsDel == 0 && (x.STid == 72 || x.STid == 73) && x.Remark.Contains(provinceId.ToString()))
+                .ToListAsync();
+
+            //三公费用-Word明细类型
+            var wordTypeData = dataSource.Where(it => it.STid == 72)
                     .Select(x => new SetDataInfoView
                     {
                         Id = x.Id,
                         Name = x.Name,
                         Remark = x.Remark
                     })
-                    .OrderBy(x => x.RemarkSort)
                     .ToList();
 
-                //三公费用-Excel明细类型
-                excelTypeData = dataSource.Where(it => it.STid == 73)
+            //三公费用-Excel明细类型
+            var excelTypeData = dataSource.Where(it => it.STid == 73)
                    .Select(x => new SetDataInfoView
                    {
                        Id = x.Id,
                        Name = x.Name,
                        Remark = x.Remark
                    })
-                   .OrderBy(x => x.RemarkSort)
                    .ToList();
-            }
-            else if (provinceId == 1409) //贵州
-            { }
-            else if (provinceId == 1410) //重庆
-            { }
-            else if (provinceId == 1411) //昆明
-            { }
-
 
             //默认币种显示
             var _currencyInfos = await EnterExitCostMobileGetCurrencyInit();
@@ -11450,6 +11467,42 @@ FROM
             return Ok(JsonView(false));
         }
 
+        /// <summary>
+        /// 团组模块 - 出入境费用-草稿-移动端 - OP --> 省份
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> EnterExitCostDraftMobileOpProv(EnterExitCostDraftMobileOpProvDto dto)
+        {
+            if (!_portTypeData.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
+            if (dto.DraftId < 1) return Ok(JsonView(false, MsgTips.UserId));
+            if (dto.CurrUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
+            if (dto.ProvinceId < 1) return Ok(JsonView(false, "请传入有效的省份Id!"));
+
+            int id = dto.DraftId;
+            if (id <= 0) //add 
+            {
+                if (dto.ProvinceId < 1) dto.ProvinceId = 122;
+
+                var add = await _sqlSugar.Insertable(new Grp_EnterExitCostDraft() { ProvinceId = dto.ProvinceId, CreateUserId = dto.CurrUserId }).ExecuteCommandAsync();
+
+                if (add < 1) return Ok(JsonView(false));
+                id = add;
+            }
+            else //update
+            {
+                //验证查看编辑权限
+                (bool viewPerm, bool assignPerm) = await _enterExitCostDraftRep.PermissionValidationAsync(dto.DraftId, dto.CurrUserId);
+                if (!viewPerm) return Ok(JsonView(false, _viewPermStr));
+
+                var upd = await _sqlSugar.Updateable<Grp_EnterExitCostDraft>().SetColumns(x => new Grp_EnterExitCostDraft() { ProvinceId = dto.ProvinceId }).Where(x => x.Id == dto.DraftId).ExecuteCommandAsync();
+                if (upd < 1) return Ok(JsonView(false));
+            }
+
+            return Ok(JsonView(new { parentId = id }));
+        }
+
         /// <summary>
         /// 团组模块 - 出入境费用-草稿-移动端 - OP --> 汇率
         /// </summary>
@@ -11623,7 +11676,7 @@ FROM
         }
 
         /// <summary>
-        /// 团组模块 - 出入境费用-草稿-移动端 - OP --> 3-7项复选框单个复选框更改
+        /// 团组模块 - 出入境费用-草稿-移动端 - OP --> 3-7项复选框单个复选框
         /// </summary>
         /// <returns></returns>
         [HttpPost]

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

@@ -270,6 +270,10 @@ namespace OASystem.Domain.Dtos.Groups
 
     }
 
+    public class EnterExitCostDraftDataSourceDto : PortDtoBase
+    {
+        public int ProvinceId { get; set; }
+    }
     public class EnterExitCostDraftCorrelationTipsDto : PortDtoBase { }
 
     public class EnterExitCostDraftVisaTipsDto : PortDtoBase {

+ 3 - 2
OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDto.cs

@@ -548,7 +548,7 @@ namespace OASystem.Domain.Dtos.Groups
 
         public int Id { get; set; }
 
-        public int ProvinceId { get; set; } = 1408;
+        //public int ProvinceId { get; set; } = 122;
 
         public int DiId { get; set; }
 
@@ -937,7 +937,7 @@ namespace OASystem.Domain.Dtos.Groups
 
         public int DraftId { get; set; }
 
-        public int ProvinceId { get; set; } = 1408;
+        public int ProvinceId { get; set; } = 122;
         public int CurrUserId { get; set; }
 
     }
@@ -956,6 +956,7 @@ namespace OASystem.Domain.Dtos.Groups
         public int CurrUserId { get; set; }
     }
 
+    public class EnterExitCostDraftMobileOpProvDto : PostEnterExitCostDraftMobileUpdateDtoBase { }
     public class PostEnterExitCostDraftMobileFeeRateOpDto : PostEnterExitCostDraftMobileUpdateDtoBase
     {
         /// <summary>

+ 4 - 7
OASystem/OASystem.Domain/ViewModels/Groups/EnterExitCostView.cs

@@ -453,15 +453,12 @@ namespace OASystem.Domain.ViewModels.Groups
 
     #region 移动端
 
-    public class EnterExitCostMobileGroupView
+    public class EnterExitCostMobileGroupView : EnterExitCostGroupNameView
     {
-        public int Id { get; set; }
-        public string GroupName { get; set; }
-        public bool IsNull { get; set; }
-        //public bool IsEdit { get; set; }
+        public new bool IsNull { get; set; }
         public bool IsView { get; set; }
-    }
 
+    }
 
     #region info View
     public class EnterExitCostMobileInfoView
@@ -854,7 +851,7 @@ namespace OASystem.Domain.ViewModels.Groups
     {
         public int Id { get; set; }
 
-        public int ProvinceId { get; set; }
+        //public int ProvinceId { get; set; }
         public int DiId { get; set; }
 
         public bool IsAssignPerm { get; set; }

+ 2 - 7
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -296,7 +296,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return countrys;
         }
 
-
         /// <summary>
         /// 获取接团信息 Page List
         /// </summary>
@@ -368,7 +367,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
         }
 
-
         /// <summary>
         /// 获取接团信息List
         /// </summary>
@@ -576,8 +574,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return result;
         }
 
-
-
         /// <summary>
         /// 获取接团信息 编辑 
         /// 城市基础 数据源
@@ -601,7 +597,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return data;
         }
 
-
         /// <summary>
         /// 获取接团信息 编辑 
         /// 省份基础 数据源
@@ -1362,7 +1357,7 @@ ORDER BY
                     var isDefualtVal = true;
                     if (provinceId > 0)
                     {
-                        var parentId = FindParentIdByChildId(provCityDatas, item.ProvinceId);
+                        var parentId = FindParentIdByChildId(provCityDatas, provinceId);
                         if (parentId != null)
                         {
                             isDefualtVal = false;
@@ -1386,7 +1381,7 @@ ORDER BY
         /// <param name="tree"></param>
         /// <param name="childId"></param>
         /// <returns></returns>
-        private int? FindParentIdByChildId(List<CityTree> tree, int childId)
+        public int? FindParentIdByChildId(List<CityTree> tree, int childId)
         {
             foreach (var node in tree)
             {

+ 44 - 5
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostDraftRepository.cs

@@ -319,10 +319,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 {
                     int enterExitId = 0;
 
-                    var isNull = _sqlSugar.Queryable<Grp_EnterExitCostDraft>().Where(it => it.IsDel == 0 && it.ProvinceId == dto.ProvinceId && it.DraftName.Equals(dto.DraftName)).First();
+                    var isNull = _sqlSugar.Queryable<Grp_EnterExitCostDraft>().Where(it => it.IsDel == 0 && it.CreateUserId == dto.UserId && it.DraftName.Equals(dto.DraftName)).First();
                     if (isNull != null) //修改
                     {
-
+                        enterExitId = isNull.Id;
                         (bool viewPerm,bool assignPerm)  = await PermissionValidationAsync(enterExitCost.Id, dto.UserId);
                         if (!viewPerm)
                         {
@@ -333,11 +333,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                         var updateId = _sqlSugar.Updateable(enterExitCost)
                             .IgnoreColumns(it => new { it.DeleteUserId, it.DeleteTime, it.CreateUserId, it.CreateTime, it.IsDel })
-                            .WhereColumns(it => it.DraftName)
+                            .WhereColumns(it => enterExitId)
                             .ExecuteCommand();
 
-                        if (updateId > 0) enterExitId = isNull.Id;
-                        else
+                        if (updateId < 1)
                         {
                             _sqlSugar.RollbackTran();
                             result.Msg = "修改操作失败!";
@@ -529,5 +528,45 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             return result;
         }
+
+        /// <summary>
+        /// 文件类型
+        /// </summary>
+        /// <param name="provinceId"></param>
+        /// <returns></returns>
+        public async Task<(SetDataInfoView[], SetDataInfoView[])> FileOwner(int provinceId = 122)
+        {
+            //122 四川
+            //108 贵州
+            //103 重庆
+            //132 云南
+
+            var datas = await _sqlSugar
+                .Queryable<Sys_SetData>()
+                .Where(x => x.IsDel == 0 && (x.STid == 72 || x.STid == 73))
+
+                .ToListAsync();
+
+
+            var wordTypeData = datas.Where(x => x.STid == 72 && x.Remark.Contains(provinceId.ToString()))
+                                .Select(x => new SetDataInfoView()
+                                {
+                                    Id = x.Id,
+                                    Name = x.Name,
+                                    Remark = x.Remark
+
+                                }).ToArray();
+            var excelTypeData = datas.Where(x => x.STid == 73 && x.Remark.Contains(provinceId.ToString()))
+                                .Select(x => new SetDataInfoView()
+                                {
+                                    Id = x.Id,
+                                    Name = x.Name,
+                                    Remark = x.Remark
+
+                                }).ToArray();
+
+            return (wordTypeData, excelTypeData);
+        }
+
     }
 }

+ 39 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -732,5 +732,44 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return result;
         }
 
+        /// <summary>
+        /// 文件类型
+        /// </summary>
+        /// <param name="provinceId"></param>
+        /// <returns></returns>
+        public async Task<(SetDataInfoView[], SetDataInfoView[])> FileOwner(int provinceId = 122)
+        {
+            //122 四川
+            //108 贵州
+            //103 重庆
+            //132 云南
+
+            var datas = await _sqlSugar
+                .Queryable<Sys_SetData>()
+                .Where(x => x.IsDel == 0 && (x.STid == 72 || x.STid == 73))
+
+                .ToListAsync();
+
+
+            var wordTypeData = datas.Where(x => x.STid == 72 && x.Remark.Contains(provinceId.ToString()))
+                                .Select(x => new SetDataInfoView()
+                                {
+                                    Id = x.Id,
+                                    Name = x.Name,
+                                    Remark = x.Remark
+
+                                }).ToArray();
+            var excelTypeData = datas.Where(x => x.STid == 73 && x.Remark.Contains(provinceId.ToString()))
+                                .Select(x => new SetDataInfoView()
+                                {
+                                    Id = x.Id,
+                                    Name = x.Name,
+                                    Remark = x.Remark
+
+                                }).ToArray();
+
+            return (wordTypeData, excelTypeData);
+        }
+
     }
 }