Browse Source

团组模块 - 出入境费用-移动端 --> 代码逻辑调整;

LEIYI 3 weeks ago
parent
commit
bd8bea9925

+ 21 - 21
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -7404,7 +7404,7 @@ FROM
             if (!_portTypeData.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
             if (dto.DiId < 1) return Ok(JsonView(false, MsgTips.DiId));
 
-            var eecInfo = await _sqlSugar.Queryable<Grp_EnterExitCost>().FirstAsync(it => it.DiId == dto.DiId && it.IsDel == 0);
+            var eecInfo = await _sqlSugar.Queryable<Grp_EnterExitCost>().OrderByDescending(x => x.CreateTime).FirstAsync(it => it.DiId == dto.DiId && it.IsDel == 0);
 
             var mobileInfo = new EnterExitCostMobileParentInfoView();
             mobileInfo.DiId = dto.DiId;
@@ -7435,7 +7435,7 @@ FROM
             mobileInfo.ChoiceTwoJJ = eecInfo.SumJJC;
             mobileInfo.ChoiceTwoGW = eecInfo.SumGWC;
             mobileInfo.ChoiceTwoTD = eecInfo.SumTDC;
-            mobileInfo.Currencys = (List<CurrencyInfo>)CommonFun.GetCurrencyChinaToList(eecInfo.CurrencyRemark);
+            mobileInfo.Currencys = CommonFun.GetCurrencyChinaToList(eecInfo.CurrencyRemark);
             mobileInfo.ChoiceThreeTotalCost = dayAndCostData.Where(it => it.Type == 1).Sum(x => x.SubTotal); //住宿费 1
             mobileInfo.ChoiceFourTotalCost = dayAndCostData.Where(it => it.Type == 2).Sum(x => x.SubTotal);  //伙食费 2
             mobileInfo.ChoiceFiveTotalCost = dayAndCostData.Where(it => it.Type == 3).Sum(x => x.SubTotal);  //公杂费 3
@@ -7688,21 +7688,21 @@ FROM
         {
             try
             {
-                ////生成默认文件pdf并且通知人员
-                //var fileView = await GeneralMethod.EnterExitCostDownload(new EnterExitCostDownloadDto()
-                //{
-                //    DiId = diid,
-                //    ExportType = 1,
-                //    SubTypeId = 1005
-                //}, "pdf");
-
-                ////发送通知
-                //string fileUrl = (string)fileView.Data.GetType().GetProperty("Url").GetValue(fileView.Data, null);
-                //string md5Sign = GeneralMethod.Encrypt($"{id}&fileName={fileUrl}");
-                //string url = string.Format("http://oa.pan-american-intl.com:4399/#/Sankunginfo?sign={0}&fileName={1}", id, fileUrl);
-                //await AppNoticeLibrary.SendUserMsg_GroupShare_ToGM(diid, new List<string>() { "208", "233", "21" }, currUserId, url);
-                ////汇率信息记录
-                //await GeneralMethod.RateRecordSave(currUserId, id, "出入境费用");
+                //生成默认文件pdf并且通知人员
+                var fileView = await GeneralMethod.EnterExitCostDownload(new EnterExitCostDownloadDto()
+                {
+                    DiId = diid,
+                    ExportType = 1,
+                    SubTypeId = 1005
+                }, "pdf");
+
+                //发送通知
+                string fileUrl = (string)fileView.Data.GetType().GetProperty("Url").GetValue(fileView.Data, null);
+                string md5Sign = GeneralMethod.Encrypt($"{id}&fileName={fileUrl}");
+                string url = string.Format("http://oa.pan-american-intl.com:4399/#/Sankunginfo?sign={0}&fileName={1}", id, fileUrl);
+                await AppNoticeLibrary.SendUserMsg_GroupShare_ToGM(diid, new List<string>() { "208", "233", "21" }, currUserId, url);
+                //汇率信息记录
+                await GeneralMethod.RateRecordSave(currUserId, id, "出入境费用");
             }
             catch (Exception ex)
             {
@@ -7966,7 +7966,7 @@ FROM
             if (id <= 0) //add 
             {
                 info.CreateUserId = dto.CurrUserId;
-                var add = await _sqlSugar.Insertable(info).ExecuteCommandAsync();
+                var add = await _sqlSugar.Insertable(info).ExecuteReturnIdentityAsync();
 
                 if (add < 1) return Ok(JsonView(false));
                 id = add;
@@ -8019,10 +8019,10 @@ FROM
             if (id <= 0) //add 
             {
                 info.CreateUserId = dto.CurrUserId;
-                var addInfo = await _sqlSugar.Insertable(info).ExecuteReturnEntityAsync();
+                var addId = await _sqlSugar.Insertable(info).ExecuteReturnIdentityAsync();
 
-                if (addInfo == null) return Ok(JsonView(false));
-                id = addInfo.Id;
+                if (addId <= 0) return Ok(JsonView(false));
+                id = addId;
             }
             else //update
             {

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -72,7 +72,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         {
             var result = new JsonView() { Code = 400 , Msg = "暂无数据" };
 
-            var enterExitCostData = await _sqlSugar.Queryable<Grp_EnterExitCost>().FirstAsync(it => it.DiId == dto.DiId && it.IsDel == 0);
+            var enterExitCostData = await _sqlSugar.Queryable<Grp_EnterExitCost>().OrderByDescending(x => x.CreateTime).FirstAsync(it => it.DiId == dto.DiId && it.IsDel == 0);
 
             //Sys_PageFunctionPermission Function = _mapper.Map<Sys_PageFunctionPermission>(dto);