Explorar o código

团组增减款项 DecreasePaymentsList
更改接口
数据可见仅自己录入的数据

leiy hai 11 meses
pai
achega
88d56c665b

+ 11 - 7
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -2704,6 +2704,13 @@ namespace OASystem.API.Controllers
         {
             try
             {
+                #region 参数验证
+
+                if (dto.UserId < 1) return Ok(JsonView(false, "请传入有效的UserId参数!"));
+                if (dto.DiId < 1) return Ok(JsonView(false, "请传入有效的DiId参数!"));
+
+                #endregion
+
                 Result groupData = await _decreasePaymentsRep.DecreasePaymentsList(dto);
                 if (groupData.Code != 0)
                 {
@@ -2714,7 +2721,6 @@ namespace OASystem.API.Controllers
             catch (Exception ex)
             {
                 return Ok(JsonView(false, "程序错误!"));
-                throw;
             }
         }
         /// <summary>
@@ -4494,10 +4500,10 @@ namespace OASystem.API.Controllers
                 Stopwatch sw = new Stopwatch();
                 sw.Start();
                 string nationalTravelFeeSql = string.Format(@"Select ssd.Name as CurrencyCode, ssd.Remark as CurrencyName,su.CnName as LastUpdateUserName,gntf.* From Grp_NationalTravelFee gntf
-                                                                Left Join Sys_SetData ssd On ssd.STid = 66 And gntf.Currency = ssd.Id
-                                                                Left Join Sys_Users su On gntf.LastUpdateUserId = su.Id 
-                                                                Where gntf.Isdel = 0");
-                var nationalTravelFeeData = await _sqlSugar.SqlQueryable<NationalTravelFeeInfoView>(nationalTravelFeeSql).ToListAsync();
+                                                              Left Join Sys_SetData ssd On ssd.STid = 66 And gntf.Currency = ssd.Id
+                                                              Left Join Sys_Users su On gntf.LastUpdateUserId = su.Id 
+                                                              Where gntf.Isdel = 0");
+                var nationalTravelFeeData = _sqlSugar.SqlQueryable<NationalTravelFeeInfoView>(nationalTravelFeeSql).ToList();
 
                 //var nationalTravel = nationalTravelFeeData.GroupBy(it => it.Country).Select(it1 => it1.FirstOrDefault());
 
@@ -4512,8 +4518,6 @@ namespace OASystem.API.Controllers
                 //        cityData.Remove(otherData);
                 //        cityData.Add(otherData);
                 //    }
-
-
                 //    nationalTravelFeeData1.Add(new
                 //    {
                 //        Country = item.Country,

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

@@ -18,6 +18,7 @@ namespace OASystem.Domain.Dtos.Groups
     }
     public class DecreasePaymentsListDto
     {
+        public int UserId { get; set; }
         public int DiId { get; set; }
     }
     /// <summary>

+ 7 - 15
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -38,24 +38,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
             Result result = new Result() { Code = -2, Msg = "未知错误" };
             try
             {
-                string UserId = "";
-                List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 98).ToList();
-                foreach (Grp_GroupsTaskAssignment gta in gtaUIdList)
-                    UserId += gta.UId + ",";
+                //string UserId = "0";
+                //List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 98).ToList();
+                //UserId = string.Join(",", gtaUIdList.Select(it => it.UId).ToList());
 
-                if (!string.IsNullOrWhiteSpace(UserId))
-                {
-                    UserId = UserId.Substring(0, UserId.Length - 1);
-                }
-                else
-                {
-                    UserId = "0";
-                }
                 string sql = string.Format(@"select Id,DiId,PriceName,Price,(select name from Sys_SetData where id=s.Currency) as Currency,FilePath,
                                             (select CnName from Sys_Users where Id=s.CreateUserId) as 'CreateUserName',CreateTime,(select IsAuditGM from 
-                                            Grp_CreditCardPayment where CTable=98 and CId=s.Id and IsDel=0) as 'isAudit' from Grp_DecreasePayments s where DIID={0} and IsDel=0 and s.CreateUserId in ({1}) ", dto.DiId,UserId);
+                                            Grp_CreditCardPayment where CTable=98 and CId=s.Id and IsDel=0) as 'isAudit' from Grp_DecreasePayments s 
+                                            where DIID={0} and IsDel=0  and s.CreateUserId in ({1}) ", dto.DiId, dto.UserId);
                 List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
-                if (_DecreasePayments.Count != 0)
+                if (_DecreasePayments.Count > 0)
                 {
                     result = new Result() { Code = 0, Msg = "查询成功!", Data = _DecreasePayments };
                 }
@@ -66,7 +58,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             }
             catch (Exception ex)
             {
-                result = new Result() { Code = -2, Msg = "未知错误" };
+                result = new Result() { Code = -2, Msg = ex.Message };
             }
             return result;
         }