Explorar o código

日付申请新增团组ID字段区分团组费用
优化费用支付逻辑并添加GroupId属性

在 `Library.cs` 文件中:
- 修改 `feeSignStr` 生成逻辑,使用空合并运算符 (`??`) 防止 `sd_priceType.Name` 为空。
- 简化 `if (sign == 2)` 代码块为单行。

在 `DailyFeePaymentDto.cs` 文件中:
- 为 `DailyFeePaymentDto` 和 `EditDailyFeePaymentDto` 类添加 `GroupId` 属性。

在 `Fin_DailyFeePayment.cs` 文件中:
- 为 `Fin_DailyFeePayment` 类添加 `GroupId` 属性。

在 `DailyFeePaymentRepository.cs` 文件中:
- 将 `_fee` 变量的声明从 `Fin_DailyFeePayment` 类型改为 `var`。
- 将 `dto.FeeContents.Count > 0` 改为 `dto.FeeContents.Any()`。
- 将 `_feeContents` 变量的声明从 `List<Fin_DailyFeePaymentContent>` 类型改为 `var`。
- 将 `_DailyFeePayment` 变量重命名为 `dailyFeePayment`。
- 调整 `#region` 注释内容。
- 更新 `Fin_DailyFeePayment` 时,添加 `GroupId` 字段。
- 简化 `_feeContents` 的插入逻辑。

LEIYI hai 4 meses
pai
achega
9b977f391b

+ 2 - 7
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -753,12 +753,10 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
             Sys_SetData sd_tansferType = _grpDeleRep.Query<Sys_SetData>(s => s.Id == fin_DailyFeePayment.TransferTypeId).First();
             Sys_SetData sd_priceType = _grpDeleRep.Query<Sys_SetData>(s => s.Id == fin_DailyFeePayment.PriceTypeId).First();
-            string feeSignStr = string.Format(@"{0}-{1}", sd_tansferType.Name, sd_priceType.Name);
+            string feeSignStr = string.Format(@"{0}-{1}", sd_tansferType.Name, sd_priceType?.Name ?? "");
 
             string priceStr = fin_DailyFeePayment.SumPrice.ToString("#0.00");
 
-
-
             DailyPayReminders_Create_ToCaiwuChatModel info = new DailyPayReminders_Create_ToCaiwuChatModel()
             {
                 CreateDt = fin_DailyFeePayment.CreateTime.ToString("yyyy-MM-dd HH:mm"),
@@ -770,10 +768,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
             };
 
-            if (sign == 2)
-            {
-                info.TitleStr = "[更新]一项费用待审核";
-            }
+            if (sign == 2) info.TitleStr = "[更新]一项费用待审核";
 
             ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.DailyPayReminders_Create_ToCaiwuChat(info));
             if (result.errcode != 0)

+ 11 - 0
OASystem/OASystem.Domain/Dtos/Financial/DailyFeePaymentDto.cs

@@ -121,6 +121,11 @@ namespace OASystem.Domain.Dtos.Financial
         /// </summary>
         public int CompanyId { get; set; }
 
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int GroupId { get; set; }
+
         /// <summary>
         /// 费用明细
         /// </summary>
@@ -197,6 +202,12 @@ namespace OASystem.Domain.Dtos.Financial
         /// </summary>
         public int CompanyId { get; set; }
 
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int GroupId { get; set; }
+
         /// <summary>
         /// 费用明细
         /// </summary>

+ 6 - 0
OASystem/OASystem.Domain/Entities/Financial/Fin_DailyFeePayment.cs

@@ -74,5 +74,11 @@ namespace OASystem.Domain.Entities.Financial
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")] 
         public int CompanyId { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int GroupId { get; set; }
     }
 }

+ 12 - 22
OASystem/OASystem.Infrastructure/Repositories/Financial/DailyFeePaymentRepository.cs

@@ -367,7 +367,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
             _sqlSugar.BeginTran();
             try
             {
-                Fin_DailyFeePayment _fee = _mapper.Map<Fin_DailyFeePayment>(dto);
+                var _fee = _mapper.Map<Fin_DailyFeePayment>(dto);
                 _fee.CreateUserId = dto.UserId;
 
                 /*
@@ -385,9 +385,9 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
                 int? feeId = await _sqlSugar.Insertable(_fee).ExecuteReturnIdentityAsync();
 
-                if (dto.FeeContents.Count > 0)
+                if (dto.FeeContents.Any())
                 {
-                    List<Fin_DailyFeePaymentContent> _feeContents = _mapper.Map<List<Fin_DailyFeePaymentContent>>(dto.FeeContents);
+                    var _feeContents = _mapper.Map<List<Fin_DailyFeePaymentContent>>(dto.FeeContents);
 
                     foreach (var item in _feeContents)
                     {
@@ -410,7 +410,6 @@ namespace OASystem.Infrastructure.Repositories.Financial
             }
 
             return result;
-
         }
 
         /// <summary>
@@ -422,23 +421,21 @@ namespace OASystem.Infrastructure.Repositories.Financial
         {
             Result result = new Result() { Code = -2 };
 
-            #region 已审核过的日付申请不可编辑
-
-            var _DailyFeePayment = await _sqlSugar.Queryable<Fin_DailyFeePayment>().Where(it => it.Id == dto.Id && it.IsDel == 0).FirstAsync();
-            if (_DailyFeePayment != null)
+            #region 已审核的数据不可编辑
+            var dailyFeePayment = await _sqlSugar.Queryable<Fin_DailyFeePayment>().Where(it => it.Id == dto.Id && it.IsDel == 0).FirstAsync();
+            if (dailyFeePayment != null)
             {
-                if (_DailyFeePayment.FAudit == 1 || _DailyFeePayment.MAudit == 1)
+                if (dailyFeePayment.FAudit == 1 || dailyFeePayment.MAudit == 1)
                 {
                     var setData = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.Id == dto.PriceTypeId).FirstAsync();
                     if (setData != null)
                     {
                         if (setData.STid == 90)
                         {
-                            if (_DailyFeePayment.IsPay == 1)
+                            if (dailyFeePayment.IsPay == 1)
                             {
                                 result.Msg = "该笔费用已付款,不可修改!";
                                 return result;
-
                             }
                         }
                         else
@@ -471,10 +468,10 @@ namespace OASystem.Infrastructure.Repositories.Financial
                                           TransferTypeId = dto.TransferTypeId,
                                           PriceTypeId = dto.PriceTypeId,
                                           CompanyId = dto.CompanyId,
+                                          GroupId = dto.GroupId,
                                       }).ExecuteCommandAsync();
 
-                List<Fin_DailyFeePaymentContent> _feeContents = _mapper.Map<List<Fin_DailyFeePaymentContent>>(dto.FeeContents);
-
+                var _feeContents = _mapper.Map<List<Fin_DailyFeePaymentContent>>(dto.FeeContents);
 
                 await _sqlSugar.Updateable<Fin_DailyFeePaymentContent>()
                                   .Where(a => a.DFPId == _fee.Id)
@@ -485,22 +482,15 @@ namespace OASystem.Infrastructure.Repositories.Financial
                                       DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                   }).ExecuteCommandAsync();
 
-
-                if (_feeContents.Count > 0)
+                if (_feeContents.Any())
                 {
                     foreach (var item in _feeContents)
                     {
-
                         item.DFPId = _fee.Id;
                         item.CreateUserId = dto.UserId;
-
                     }
 
-                    if (_feeContents.Count > 0)
-                    {
-                        await _sqlSugar.Insertable(_feeContents).ExecuteCommandAsync();
-
-                    }
+                    await _sqlSugar.Insertable(_feeContents).ExecuteCommandAsync();
                 }
 
                 _sqlSugar.CommitTran();