Explorar o código

PostEnterExitCostDownload 返回参数优化

LEIYI hai 1 mes
pai
achega
6b99e2b4b8

+ 33 - 50
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -5311,30 +5311,16 @@ FROM
         {
             try
             {
-                if (dto.DiId < 1)
-                {
-                    return Ok(JsonView(400, "请传入有效的DiId参数;", ""));
-                }
-
-                if (dto.ExportType < 1)
-                {
-                    return Ok(JsonView(400, "请传入有效的ExportType参数; 1 明细表 2 表格", ""));
-                }
-
-                if (dto.SubTypeId < 1)
-                {
-                    return Ok(JsonView(400, @"请传入有效的SubTypeId参数; 
+                if (dto.DiId < 1) return Ok(JsonView(400, "请传入有效的DiId参数;", ""));
+                if (dto.ExportType < 1) return Ok(JsonView(400, "请传入有效的ExportType参数; 1 明细表 2 表格", ""));
+                if (dto.SubTypeId < 1) return Ok(JsonView(400, @"请传入有效的SubTypeId参数; 
                                                 1 明细表 --> 1005(默认明细表) 1006(因公出国(境)经费测算明细表) 1007(四川省商务厅出国经费财政先行审核表)  
                                                 2 表格 --> 1008(派员单位出(境)任务和预算审批意见表) 1009(省级单位出(境)经费报销单)
                                                 3 团组成员名单 1 团组成员名单", ""));
-                }
 
                 var _EnterExitCosts = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
                 var _DayAndCosts = _sqlSugar.Queryable<Grp_DayAndCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
-                if (_EnterExitCosts == null)
-                {
-                    return Ok(JsonView(400, "该团组未填写出入境费用;", ""));
-                }
+                if (_EnterExitCosts == null) return Ok(JsonView(400, "该团组未填写出入境费用;", ""));
 
                 //数据源
                 var dac1 = _DayAndCosts.Where(it => it.Type == 1).ToList(); //住宿费
@@ -5342,37 +5328,37 @@ FROM
                 var dac3 = _DayAndCosts.Where(it => it.Type == 3).ToList(); //公杂费
                 var dac4 = _DayAndCosts.Where(it => it.Type == 4).ToList(); //培训费
                 var dac5 = _sqlSugar.Queryable<Grp_DayOtherPrice>()
-                            .LeftJoin<Sys_SetData>((x, a) => a.IsDel == 0 && a.Id == x.SetDataId)
-                            .LeftJoin<Sys_SetData>((x, a, b) => b.IsDel == 0 && b.Id == x.Currency)
-                            .Where((x, a, b) => x.IsDel == 0 && x.Diid == dto.DiId)
-                            .Select((x, a, b) => new
-                            {
-                                x.Index,
-                                itemName = a.Name,
-                                CurrencyStr = b.Name,
-                                x.Cost,
-                                x.SubTotal,
-                                x.Remark
-                            })
-                            .OrderBy((x) => x.Index)
-                            .ToList();                                       //其他款项费用
+                    .LeftJoin<Sys_SetData>((x, a) => a.IsDel == 0 && a.Id == x.SetDataId)
+                    .LeftJoin<Sys_SetData>((x, a, b) => b.IsDel == 0 && b.Id == x.Currency)
+                    .Where((x, a, b) => x.IsDel == 0 && x.Diid == dto.DiId)
+                    .Select((x, a, b) => new
+                    {
+                        x.Index,
+                        itemName = a.Name,
+                        CurrencyStr = b.Name,
+                        x.Cost,
+                        x.SubTotal,
+                        x.Remark
+                    })
+                    .OrderBy((x) => x.Index)
+                    .ToList();                                               //其他款项费用
 
                 var _CurrDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
                 var _DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
                 var DeleClientList = _sqlSugar.Queryable<Grp_TourClientList>()
-                                                      .LeftJoin<Crm_DeleClient>((tcl, dc) => tcl.ClientId == dc.Id && dc.IsDel == 0)
-                                                      .LeftJoin<Crm_CustomerCompany>((tcl, dc, cc) => dc.CrmCompanyId == cc.Id && dc.IsDel == 0)
-                                                      .Where((tcl, dc, cc) => tcl.IsDel == 0 && tcl.DiId == dto.DiId)
-                                                      .Select((tcl, dc, cc) => new ClientInfo
-                                                      {
-                                                          LastName = dc.LastName,
-                                                          FirstName = dc.FirstName,
-                                                          Sex = dc.Sex,
-                                                          Birthday = dc.BirthDay,
-                                                          Company = cc.CompanyFullName,
-                                                          Job = dc.Job
-                                                      })
-                                                      .ToList();
+                    .LeftJoin<Crm_DeleClient>((tcl, dc) => tcl.ClientId == dc.Id && dc.IsDel == 0)
+                    .LeftJoin<Crm_CustomerCompany>((tcl, dc, cc) => dc.CrmCompanyId == cc.Id && dc.IsDel == 0)
+                    .Where((tcl, dc, cc) => tcl.IsDel == 0 && tcl.DiId == dto.DiId)
+                    .Select((tcl, dc, cc) => new ClientInfo
+                    {
+                        LastName = dc.LastName,
+                        FirstName = dc.FirstName,
+                        Sex = dc.Sex,
+                        Birthday = dc.BirthDay,
+                        Company = cc.CompanyFullName,
+                        Job = dc.Job
+                    })
+                    .ToList();
                 foreach (var item in DeleClientList)
                 {
                     EncryptionProcessor.DecryptProperties(item);
@@ -6718,10 +6704,7 @@ FROM
                 {
                     if (dto.SubTypeId == 1) //团组成员名单
                     {
-                        if (DeleClientList.Count < 1)
-                        {
-                            return Ok(JsonView(false, "团组成员暂未录入!!!", ""));
-                        }
+                        if (!DeleClientList.Any()) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成员暂未录入!!!", ""));
 
                         //获取模板
                         string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/dwon_团组人员列表模板.doc");
@@ -7141,7 +7124,7 @@ FROM
                 x.CreateUserId = _currUserInfo.UserId;
             });
 
-            if (data.Count > 0)
+            if (data.Any())
             {
                 var add = await _sqlSugar.Insertable(data).ExecuteCommandAsync();
                 if (add > 0)

+ 1 - 1
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -913,7 +913,7 @@ namespace OASystem.API.OAMethodLib
                                                      SpaceName = sd.Name
                                                  })
                                                  .ToListAsync();
-            if (groupClientList.Count < 1) return data;
+            if (!groupClientList.Any()) return data;
 
             decimal domesticFeeTotal = 0.00M,        //境内费用
                     economyClassFeeTotal = 0.00M,    //经济舱费用