Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

yuanrf 1 month ago
parent
commit
906f5c40ca

+ 3 - 3
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -1935,7 +1935,7 @@ namespace OASystem.API.Controllers
             decimal sumAll_fr = 0M; //应收
             decimal sumAll_pr = 0M; //已收
             decimal sumAll_balance = 0M; //尾款
-
+            var result = new PostSyntheticalReceivableByDateRangeResultView();
             if (list_rst.Count > 0)
             {
                 int rowNumber = 1;
@@ -2069,7 +2069,7 @@ namespace OASystem.API.Controllers
                     #endregion
                 }
 
-                PostSyntheticalReceivableByDateRangeResultView result = new PostSyntheticalReceivableByDateRangeResultView();
+               
                 result.total_fr = sumAll_fr.ToString("#0.00");
                 result.total_pr = sumAll_pr.ToString("#0.00");
                 result.total_balance = sumAll_balance.ToString("#0.00");
@@ -2137,7 +2137,7 @@ namespace OASystem.API.Controllers
                 }
             }
 
-            return Ok(JsonView(true, "获取成功", "", list_rst.Count));
+            return Ok(JsonView(true, "暂无数据", result, list_rst.Count));
         }
 
         #endregion

+ 0 - 9
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -667,16 +667,7 @@ namespace OASystem.API.Controllers
                 designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + "NewClientDataExcelDownload/" + fileName);
                 string url = AppSettingsHelper.Get("ExcelBaseUrl") + "Office/Excel/NewClientDataExcelDownload/" + fileName;
 
-                #region 客户资料表操作记录
                 var respose = JsonView(true, "成功", url);
-                //var paramData = new
-                //{
-                //    APIName = @"MarketCustomerResources/NewClientDataExcelDownload",
-                //    RequestParam = dto,
-                //    ResposeParam = respose
-                //};
-                //await GeneralMethod.NewClientOperationRecord(dto.PortType, OperationEnum.Download, dto.OperationUserId, 0, JsonConvert.SerializeObject(paramData));
-                #endregion
 
                 return Ok(respose);
             }

+ 42 - 95
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -2,10 +2,8 @@ using OASystem.Domain.AesEncryption;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
-using SqlSugar;
 using System.Collections;
 using System.Data;
-using static NPOI.HSSF.Util.HSSFColor;
 using static OASystem.API.OAMethodLib.GeneralMethod;
 using static OASystem.API.OAMethodLib.JWTHelper;
 
@@ -34,9 +32,8 @@ namespace OASystem.API.Controllers
         private readonly JobPostRepository _jobRep;
         private readonly SetDataTypeRepository _setDataTypeRep;
         private readonly UserAuthorityRepository _UserAuthorityRepository;
-
-        private readonly List<int> _operationTypeList = new List<int>() { 1, 2, 3, 4, 5 }; //操作通知所属类型
-        private readonly List<int> _taskTypeList = new List<int>() { 6 };//任务通知 TaskNotification
+        private readonly List<int> _operationTypeList = new() { 1, 2, 3, 4, 5 }; //操作通知所属类型
+        private readonly List<int> _taskTypeList = new() { 6 };//任务通知 TaskNotification
 
 
         public SystemController(
@@ -86,13 +83,7 @@ namespace OASystem.API.Controllers
         public async Task<IActionResult> PsotMsgPageList(MsgDto dto)
         {
             var msgData = await _messageRep.GetMsgList(dto);
-
-            if (msgData.Code != 0)
-            {
-                return Ok(JsonView(false, msgData.Msg));
-            }
-
-            return Ok(JsonView(msgData.Data));
+            return msgData.Code != 0 ? Ok(JsonView(false, msgData.Msg)) : Ok(JsonView(msgData.Data));
         }
 
         #region 消息列表 - 分开
@@ -107,25 +98,15 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PotsMsgTypeData(MsgTypeDto dto)
         {
-            if (dto.PortType < 1 || dto.PortType > 3)
-            {
-                return Ok(JsonView(false, "请输入有效的PortType参数。1 Web 2 Android 3 IOS"));
-            }
+            if (dto.PortType < 1 || dto.PortType > 3) 
+                return Ok(JsonView(false, MsgTips.Port));
 
-            if (dto.UserId < 1)
-            {
+            if (dto.UserId < 1) 
                 return Ok(JsonView(false, "请输入有效的UserId参数。"));
-            }
 
             var msgData = await _messageRep.PotsMsgTypeData(dto);
 
-            if (msgData.Code != 0)
-            {
-
-                return Ok(JsonView(400, msgData.Msg, new string[] { }));
-            }
-
-            return Ok(JsonView(true, msgData.Msg, msgData.Data));
+            return msgData.Code != 0 ? Ok(JsonView(400, msgData.Msg, new string[] { })) : Ok(JsonView(true, msgData.Msg, msgData.Data));
         }
 
         /// <summary>
@@ -141,30 +122,19 @@ namespace OASystem.API.Controllers
             #region 参数验证
 
             if (dto.PortType < 1 || dto.PortType > 3)
-            {
-                return Ok(JsonView(false, "请输入有效的PortType参数。1 Web 2 Android 3 IOS"));
-            }
+                return Ok(JsonView(false, MsgTips.Port));
 
             var typeData = await _sqlSugar.Queryable<Sys_SetData>().Where(it => it.STid == 77).Select(it => it.Id).ToListAsync();
-            if (typeData.Count < 0)
-            {
+            if (typeData.Count < 0) 
                 return Ok(JsonView(false, "消息类型不存在"));
-            }
 
-            if (!typeData.Contains(dto.Type))
-            {
+            if (!typeData.Contains(dto.Type)) 
                 return Ok(JsonView(false, "请输入有效的Type参数。1021 团组操作通知 1020 任务操作通知 "));
-            }
-            if (dto.UserId < 1)
-            {
+            if (dto.UserId < 1) 
                 return Ok(JsonView(false, "请输入有效的UserId参数。"));
-            }
 
-            if (dto.ReadStatus < 1 || dto.ReadStatus > 3)
-            {
+            if (dto.ReadStatus < 1 || dto.ReadStatus > 3) 
                 return Ok(JsonView(false, "请输入有效的ReadStatus参数。1 全部(包含已读/未读) 2 未读 3 已读"));
-            }
-
             #endregion
 
             //userId
@@ -192,10 +162,13 @@ namespace OASystem.API.Controllers
             }
 
             //是否已读处理 1 全部(包含已读/未读) 2 未读 3 已读
-            if (dto.ReadStatus == 1) msgSqlWhere += "";
-            else if (dto.ReadStatus == 2) msgSqlWhere += $" And smra.IsRead = {0}";
-            else if (dto.ReadStatus == 3) msgSqlWhere += $" And smra.IsRead = {1}";
 
+            msgSqlWhere += dto.ReadStatus switch
+            {
+                2 => " And smra.IsRead = 0",
+                3 => " And smra.IsRead = 1",
+                _ => ""
+            };
 
             string msgSql = string.Format(@"Select * From(
                                                 Select row_number() over(order by sm.ReleaseTime Desc) as RowNumber,
@@ -216,18 +189,15 @@ namespace OASystem.API.Controllers
                 RefAsync<int> totalCount = 0;
                 var data = await _sqlSugar.SqlQueryable<MessageListView>(msgSql).ToPageListAsync(dto.PageIndex, dto.PageSize, totalCount);
 
-
                 return Ok(JsonView(true, "操作成功!", data, totalCount));
             }
             catch (Exception ex)
             {
-
                 return Ok(JsonView(false, ex.Message));
             }
 
         }
 
-
         /// <summary>
         /// 系统消息
         /// 获取消息未读条数
@@ -241,9 +211,7 @@ namespace OASystem.API.Controllers
             #region 参数验证
 
             if (dto.UserId < 1)
-            {
                 return Ok(JsonView(false, "请输入有效的UserId参数。"));
-            }
 
             #endregion
 
@@ -273,20 +241,9 @@ namespace OASystem.API.Controllers
                 //if (currentDateTime < startTime && currentDateTime > endTime) return Ok(JsonView(204, "NO ACCESS!!", ""));
                 #endregion
 
-                int messageUnReadCount = 0;
-                int announcementUnReadCount = 0;
-                var data = await _messageRep.GetUnReadCount(dto.UserId);
-                if (data > 0)
-                {
-                    messageUnReadCount = data;
-
-                }
-                var data1 = await _messageRep.GetAnnouncementUnReadCount(dto.UserId);
-                if (data1 > 0)
-                {
-                    announcementUnReadCount = data1;
-                }
-
+                int messageUnReadCount = await _messageRep.GetUnReadCount(dto.UserId);
+                int announcementUnReadCount = await _messageRep.GetAnnouncementUnReadCount(dto.UserId);
+                
                 return Ok(JsonView(true, "操作成功!", new { messageUnReadCount = messageUnReadCount, announcementUnReadCount = announcementUnReadCount }));
             }
             catch (Exception ex)
@@ -308,18 +265,11 @@ namespace OASystem.API.Controllers
         public async Task<IActionResult> PostMsgInfo(MsgInfoDto dto)
         {
             if (dto.PortType < 1 || dto.PortType > 3)
-            {
-                return Ok(JsonView(false, "请输入有效的PortType参数。1 Web 2 Android 3 IOS"));
-            }
+                return Ok(JsonView(false, MsgTips.Port));
 
             var msgData = await _messageRep.GetMsgInfo(dto);
 
-            if (msgData.Code != 0)
-            {
-                return Ok(JsonView(false, msgData.Msg));
-            }
-
-            return Ok(JsonView(true, "操作成功!", msgData.Data));
+            return msgData.Code != 0 ? Ok(JsonView(false, msgData.Msg)) : Ok(JsonView(true, "操作成功!", msgData.Data));
         }
 
         /// <summary>
@@ -332,13 +282,7 @@ namespace OASystem.API.Controllers
         public async Task<IActionResult> SetMessageRead(MsgSetReadDto dto)
         {
             var msgData = await _messageRep.SetMsgRead(dto);
-
-            if (msgData.Code != 0)
-            {
-                return Ok(JsonView(false, msgData.Msg));
-            }
-
-            return Ok(JsonView(true));
+            return msgData.Code != 0 ? Ok(JsonView(false, msgData.Msg)) : Ok(JsonView(true));
         }
 
         /// <summary>
@@ -351,13 +295,7 @@ namespace OASystem.API.Controllers
         public async Task<IActionResult> DeleMsg(MsgDeleteDto dto)
         {
             var msgData = await _messageRep.DelMsg(dto);
-
-            if (msgData.Code != 0)
-            {
-                return Ok(JsonView(false, msgData.Msg));
-            }
-
-            return Ok(JsonView(true));
+            return msgData.Code != 0 ? Ok(JsonView(false, msgData.Msg)) : Ok(JsonView(true));
         }
         #endregion
 
@@ -387,7 +325,6 @@ namespace OASystem.API.Controllers
             catch (Exception ex)
             {
                 return Ok(JsonView(false, "程序错误!"));
-                throw;
             }
         }
 
@@ -400,6 +337,11 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public IActionResult QuerySetDataInitByArr(QuerySetDataInitByArr Dto)
         {
+            if (Dto.DataTypeArr == null || !Dto.DataTypeArr.Any())
+            {
+                return Ok(JsonView(false, "请传入有效的类型数组!"));
+            }
+
             var DbQuery = _setDataRepository.QueryDto<Sys_SetData, SetDataView>(s => Dto.DataTypeArr.Contains(s.STid)).ToList();
             var GroupResult = DbQuery.GroupBy(x => x.STid).Select(x => new
             {
@@ -433,7 +375,6 @@ namespace OASystem.API.Controllers
             catch (Exception)
             {
                 return Ok(JsonView(false, "程序错误!"));
-                throw;
             }
         }
 
@@ -446,12 +387,13 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> OperationSetDataType(OperationSetDataTypeDto dto)
         {
+            if (dto == null || string.IsNullOrEmpty(dto.Name))
+            {
+                return Ok(JsonView(false, "请检查类型名称是否填写!"));
+            }
+
             try
             {
-                if (dto.Name == "")
-                {
-                    return Ok(JsonView(false, "请检查类型名称是否填写!"));
-                }
                 Result result = await _setDataTypeRep.OperationSetDataType(dto);
                 if (result.Code != 0)
                 {
@@ -462,7 +404,6 @@ namespace OASystem.API.Controllers
             catch (Exception ex)
             {
                 return Ok(JsonView(false, "程序错误!"));
-                throw;
             }
         }
 
@@ -475,6 +416,12 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> DelSetDataType(DelSetDataTypeDto dto)
         {
+            if (dto == null || dto.Id <= 0)
+                return Ok(JsonView(false, "请传入有效的Id参数!"));
+
+            if (dto == null || dto.DeleteUserId <= 0)
+                return Ok(JsonView(false, "请传入有效的DeleteUserId参数!"));
+
             try
             {
                 var res = await _setDataTypeRep.SoftDeleteByIdAsync<Sys_SetDataType>(dto.Id.ToString(), dto.DeleteUserId);
@@ -487,7 +434,6 @@ namespace OASystem.API.Controllers
             catch (Exception ex)
             {
                 return Ok(JsonView(false, "程序错误!"));
-                throw;
             }
         }
         #endregion
@@ -3106,5 +3052,6 @@ And u.UId = {0} And u.FId = 1 ", dto.UserId);
         }
 
         #endregion
+
     }
 }

+ 1 - 0
OASystem/OASystem.Api/OASystem.API.csproj

@@ -57,6 +57,7 @@
     <PackageReference Include="SqlSugarCore" Version="5.1.3.35" />
     <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
     <PackageReference Include="System.Data.OleDb" Version="8.0.0" />
+    <PackageReference Include="System.Security.Permissions" Version="6.0.1" />
     <PackageReference Include="TencentCloudSDK.Common" Version="3.0.734" />
     <PackageReference Include="TencentCloudSDK.Ocr" Version="3.0.734" />
     <PackageReference Include="TinyPinyin.Net" Version="1.0.2" />

+ 1 - 1
OASystem/OASystem.Domain/ViewModels/Financial/Fin_ForeignReceivablesView.cs

@@ -322,7 +322,7 @@ namespace OASystem.Domain.ViewModels.Financial
         public string total_pr { get; set; }
         public string total_balance { get; set; }
 
-        public List<PostSyntheticalReceivableByDateRangeView> dataList { get; set; }
+        public List<PostSyntheticalReceivableByDateRangeView> dataList { get; set; } = new List<PostSyntheticalReceivableByDateRangeView>();
     }
 
     public class PostSyntheticalReceivableByDateRangeView

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

@@ -248,10 +248,10 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public int Id { get; set; }
 
-        ///// <summary>
-        ///// 归属省份Id
-        ///// </summary>
-        //public int ProvinceId { get; set; }
+        /// <summary>
+        /// 归属省份Id
+        /// </summary>
+        public int ProvinceId { get; set; }
 
         /// <summary>
         /// 团组Id

+ 59 - 8
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -1352,15 +1352,11 @@ ORDER BY
                     var isDefualtVal = true;
                     if (provinceId > 0)
                     {
-                        Console.WriteLine(item.Id);
-                        if (item.Id == 2778)
+                        var parentId = FindParentIdByChildId(provCityDatas, provinceId);
+                        if (parentId != null)
                         {
-                            var parentId = FindParentIdByChildId(provCityDatas, provinceId);
-                            if (parentId != null)
-                            {
-                                isDefualtVal = false;
-                                item.ProvinceId = (int)parentId;
-                            }
+                            isDefualtVal = false;
+                            item.ProvinceId = (int)parentId;
                         }
                     }
 
@@ -1374,6 +1370,61 @@ ORDER BY
             return groupDatas;
         }
 
+        /// <summary>
+        /// 获取单组名称并验证出入境费用明细是否填写
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<EnterExitCostGroupNameView> EnterExitCostGroupNameInfoAsync(int groupId)
+        {
+            var groupSql = string.Format(@$"SELECT
+  Id,
+  TeamName GroupName,
+  CityId ProvinceId,
+  CASE
+    WHEN (
+      SELECT
+        COUNT(*)
+      FROM
+        Grp_EnterExitCost
+      WHERE
+        IsDel = 0
+        AND DiId = di.Id
+    ) > 0 THEN 'false'
+    ELSE 'true'
+  END AS [IsNull]
+FROM
+  Grp_DelegationInfo di
+WHERE
+  di.Isdel = 0
+  And Id = {0} ", groupId);
+
+            var groupData = await _sqlSugar.SqlQueryable<EnterExitCostGroupNameView>(groupSql).FirstAsync();
+            var provCityDatas = await ProvinceCityBasicSource();
+            if (provCityDatas.Any() && groupData != null)
+            {
+                var provinceId = groupData.ProvinceId;
+                var isDefualtVal = true;
+                if (provinceId > 0)
+                {
+                    var parentId = FindParentIdByChildId(provCityDatas, provinceId);
+                    if (parentId != null)
+                    {
+                        isDefualtVal = false;
+                        groupData.ProvinceId = (int)parentId;
+                    }
+                }
+
+                if (isDefualtVal)
+                {
+                    groupData.ProvinceId = 122; //默认四川
+                }
+            }
+
+            return groupData;
+        }
+
+
         /// <summary>
         /// 递归地遍历树状结构,查找子项的父类 Id。
         /// </summary>

+ 13 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -26,12 +26,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
     {
         private readonly IMapper _mapper;
         private readonly SetDataRepository _setDataRep;
+        private readonly DelegationInfoRepository _groupRep;
 
-        public EnterExitCostRepository(SqlSugarClient sqlSugar, IMapper mapper, SetDataRepository setDataRep)
+        public EnterExitCostRepository(SqlSugarClient sqlSugar, IMapper mapper, SetDataRepository setDataRep, DelegationInfoRepository groupRep)
             : base(sqlSugar)
         {
             _setDataRep = setDataRep;
-            _mapper = mapper;
+            _mapper = mapper; 
+            _groupRep = groupRep;
         }
 
         /// <summary>
@@ -295,6 +297,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             .ToArrayAsync();
                     }
 
+                    int provinceId = 122;
+                    var groupNames = await _groupRep.EnterExitCostGroupNameInfoAsync(dto.DiId);
+                    if (groupNames!=null)
+                    {
+                        provinceId = groupNames.ProvinceId;
+                    }
+                    enterExitCostInfoView.ProvinceId = provinceId;
+
+
                     //enterExitCostInfoView.FirstItemRemark = enterExitCostData.Remark;
                     var dayAndCostSql = string.Format(@"Select ntf.Country,ntf.City,ssd.Name CurremcyCode,ssd.Remark CurrencyName,gdac.* From Grp_DayAndCost gdac
                                                         Left Join Grp_NationalTravelFee ntf On ntf.Id = gdac.NationalTravelFeeId