Browse Source

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

jiangjc 2 months ago
parent
commit
8fc2175f87

+ 28 - 9
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -3267,6 +3267,7 @@ namespace OASystem.API.Controllers
             _entity.Area = dto.Area;
             _entity.SupervisorConfirm = dto.SupervisorConfirm;
             _entity.ManagerConfirm = dto.ManagerConfirm;
+            _entity.SYsupervisorConfirm = dto.SYsupervisorConfirm;
 
             DateTime dt_PriceDt;
             bool b_PriceDt = DateTime.TryParse(dto.PriceDt, out dt_PriceDt);
@@ -3579,8 +3580,9 @@ namespace OASystem.API.Controllers
             string sql_data = string.Format(@"Select * From (	
                                                 Select row_number() over (order by f.Id Desc) as RowNumber,f.Id,f.DiId,
 												f.PriceName,f.PriceType,f.PriceDetailType,CAST(f.Price as varchar)+' '+s.[Name] as PriceStr,f.PriceCount,CAST(f.PriceSum as varchar)+' '+s.[Name] as PriceSumStr,
-                                                f.CreateUserId,f.PriceDt,c.IsAuditGM,f.ManagerConfirm,f.SupervisorConfirm,
-                                                CASE  ManagerConfirm WHEN 1 THEN '已确认' ELSE '未确认' END as 'ManagerConfirmStr' , CASE  SupervisorConfirm WHEN 1 THEN '已确认' ELSE '未确认' END  as 'SupervisorConfirmStr'														
+                                                f.CreateUserId,f.PriceDt,c.IsAuditGM,f.ManagerConfirm,f.SupervisorConfirm,f.Remark,
+                                                CASE  ManagerConfirm WHEN 1 THEN '已确认' ELSE '未确认' END as 'ManagerConfirmStr' , CASE  SupervisorConfirm WHEN 1 THEN '已确认' ELSE '未确认' END  as 'SupervisorConfirmStr',		
+                                                CASE  SYsupervisorConfirm WHEN 1 THEN '已确认' ELSE '未确认' END  as 'SYsupervisorConfirmStr'
                                                 From Fin_GroupExtraCost f
                                                 Inner Join Grp_CreditCardPayment c On f.Id = c.CId
                                                 Inner Join Sys_SetData s On f.PriceCurrency = s.Id
@@ -3589,8 +3591,9 @@ namespace OASystem.API.Controllers
                                                 ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
             string sql_count = string.Format(@"Select Count(1) as DataCount From (	
                                                 Select row_number() over (order by f.Id Desc) as RowNumber,f.Id,f.DiId,
-												f.PriceName,f.PriceType,f.Price,f.FilePath,f.CreateUserId,f.CreateTime,c.IsAuditGM,f.ManagerConfirm,f.SupervisorConfirm,
-                                                CASE  ManagerConfirm WHEN 1 THEN '已确认' ELSE '未确认' END as 'ManagerConfirmStr' , CASE  SupervisorConfirm WHEN 1 THEN '已确认' ELSE '未确认' END  as 'SupervisorConfirmStr'
+												f.PriceName,f.PriceType,f.Price,f.FilePath,f.CreateUserId,f.CreateTime,c.IsAuditGM,f.ManagerConfirm,f.SupervisorConfirm,f.Remark,
+                                                CASE  ManagerConfirm WHEN 1 THEN '已确认' ELSE '未确认' END as 'ManagerConfirmStr' , CASE  SupervisorConfirm WHEN 1 THEN '已确认' ELSE '未确认' END  as 'SupervisorConfirmStr',
+                                                CASE  SYsupervisorConfirm WHEN 1 THEN '已确认' ELSE '未确认' END  as 'SYsupervisorConfirmStr'
                                                 From Fin_GroupExtraCost f
                                                 Inner Join Grp_CreditCardPayment c On f.Id = c.CId
                                                 Inner Join Sys_SetData s On f.PriceCurrency = s.Id
@@ -4029,8 +4032,7 @@ Group by PriceType ", dto.diId);
                     JoinType.Left, s1.Id == l.toCurr && s1.IsDel == 0,
                     JoinType.Left, i.Id == l.DiId && i.IsDel == 0
                 ))
-                .Where((f, c, s, g) => f.IsDel == 0 && f.DiId == dto.diId && 
-                    (f.ManagerConfirm == 1 ||  f.ManagerConfirm == null || f.SupervisorConfirm == 1 || f.SupervisorConfirm == null))
+                .Where((f, c, s, g) => f.IsDel == 0 && f.DiId == dto.diId)
                 .Select((f, c, s, g, r, l, s1, i) => new
                 {
                     c.PaymentCurrency,
@@ -4054,9 +4056,25 @@ Group by PriceType ", dto.diId);
                     f.PriceDt,
                     i.VisitPNumber,
                     f.DiId,
-                    f.PriceCurrency
+                    f.PriceCurrency,
+                    f.SupervisorConfirm,
+                    f.ManagerConfirm,
+                    f.SYsupervisorConfirm,
                 })
                 .ToList()
+                .Where(x=> {
+                    var count = 0;
+                    var stringArr = new string[] { "SYsupervisorConfirm", "SupervisorConfirm", "ManagerConfirm" };
+                    foreach (var item in stringArr)
+                    {
+                        var number = x.GetType()?.GetProperty(item)?.GetValue(x).ObjToInt();
+                        if (number > 0)
+                        {
+                            count++;
+                        }
+                    }
+                    return count > 1;
+                })
                 .Select(x =>
                 {
                     var costPirce = x.Price;
@@ -4101,11 +4119,11 @@ Group by PriceType ", dto.diId);
 
                             if (x.toCurr != x.PaymentCurrency)
                             {
-                                remake += $"{x.PriceDt.ToString("M/d")} {findCheck?.Name} {x.PaymentCurrencyStr} {(int)Math.Round(oldPrice)}( 折算{x.toCurrStr} {(int)Math.Round(costPirce)}) - 财政{cost} * {x.VisitPNumber}  = {x.toCurrStr}{costResultPirce}";
+                                remake += $" {x.PriceDt.ToString("M/d")} {findCheck?.Name} {x.PaymentCurrencyStr} {(int)Math.Round(oldPrice)}( 折算{x.toCurrStr} {(int)Math.Round(costPirce)}) - 财政{cost} * {x.VisitPNumber}  = {x.toCurrStr}{costResultPirce}";
                             }
                             else
                             {
-                                remake += $"{x.PriceDt.ToString("M/d")} {findCheck?.Name}{x.PaymentCurrencyStr} {(int)Math.Round(costPirce)} - 财政{cost} * {x.VisitPNumber}  = {x.PaymentCurrencyStr}{costResultPirce}";
+                                remake += $" {x.PriceDt.ToString("M/d")} {findCheck?.Name}{x.PaymentCurrencyStr} {(int)Math.Round(costPirce)} - 财政{cost} * {x.VisitPNumber}  = {x.PaymentCurrencyStr}{costResultPirce}";
                             }
 
                             costPirce = costResultPirce;
@@ -4315,6 +4333,7 @@ Group by PriceType ", dto.diId);
             {
                 {1 ,"ManagerConfirm" },
                 {2 ,"SupervisorConfirm" },
+                {3 ,"SYsupervisorConfirm" },
             };
             if (dto.DataId < 1 || confirmStatusArr.Keys.Contains(dto.ConfirmId) == false)
             {

+ 8 - 2
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -2162,6 +2162,14 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
         public async Task<IActionResult> AssessmentSettingOperationAsync(PerAssessmentSettingOperationDto dto)
         {
             var jw = JsonView(false);
+
+            if (!ModelState.IsValid)
+            {
+                jw.Msg = "参数错误";
+                jw.Data = ModelState;
+                return Ok(jw);
+            }
+
             try
             {
                 if (dto.ParentId != 0)
@@ -2185,7 +2193,6 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
                 };
 
                 jw.Code = 200;
-                jw.Data = "";
                 if (dto.Id == 0)
                 {
                     entity.CreateUserId = dto.CreateId;
@@ -2203,7 +2210,6 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
             {
                jw.Msg = "Api error " + ex.Message;
                jw.Code = 400;
-               jw.Data = "";
             }
 
             return Ok(jw);

+ 97 - 1
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -1,5 +1,7 @@
-using Aspose.Words;
+using Aspose.Cells;
+using Aspose.Words;
 using EyeSoft.Extensions;
+using EyeSoft.Reflection;
 using NPOI.SS.Formula.Functions;
 using OASystem.API.OAMethodLib;
 using OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice;
@@ -2589,6 +2591,100 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             return numStr;
         }
 
+        [HttpPost]
+        public IActionResult ExportOfficialActivitiesInfo(ExportOfficialActivitiesInfoDto dto)
+        {
+            var jw = JsonView(false);
+
+            if (!ModelState.IsValid)
+            {
+                jw.Data = ModelState;
+                return Ok(jw);
+            }
+
+            var startTime_bool = DateTime.TryParse(dto.StartTime, out DateTime startTime_parse);
+            var endTime_bool = DateTime.TryParse(dto.EndTime, out DateTime endTime_parse);
+            if (startTime_bool && endTime_bool)
+            {
+                //处理时间模板
+                var Query_DB = _sqlSugar.Queryable<Grp_DelegationInfo>()
+                                .LeftJoin<Res_OfficialActivities>((a, b) => a.Id == b.DiId && b.IsDel == 0)
+                                .LeftJoin<Sys_Users>((a, b, c) => b.CreateUserId == c.Id && c.IsDel == 0)
+                                .Where((a, b, c) => a.IsDel == 0 && a.VisitDate >= startTime_parse && a.VisitDate <= endTime_parse)
+                                .WhereIF(dto.State != -1, (a, b, c) => b.ConfirmTheInvitation == dto.State)
+                                .Select((a, b, c) => new
+                                {
+                                    a.TeamName,
+                                    b.Client,
+                                    b.ConfirmTheInvitation,
+                                    b.Contact,
+                                    ConfirmTheInvitationStr = b.ConfirmTheInvitation == 1 ? "是" : "否",
+                                    b.Date,
+                                    b.Nature,
+                                    c.CnName,
+                                    b.Address,
+                                    b.CreateTime
+                                })
+                                .ToList()
+                                .Where(x=>!x.Client.IsNullOrWhiteSpace())
+                                .ToList();
+
+                if (Query_DB.Count > 0)
+                {
+                    //打开excel
+                    var fileBasePath = AppSettingsHelper.Get("ExcelBasePath");
+                    var fileName = "公务出访信息.docx";
+
+                    //创建数据源Table
+                    DataTable dtSource = new DataTable();
+                    dtSource.TableName = "TB";
+
+                    var firstElem = Query_DB.First();
+                    //遍历firstElem所有属性
+                    foreach (var item in firstElem.GetType().GetProperties())
+                    {
+                        dtSource.Columns.Add(item.Name, item.PropertyType);
+                    }
+
+                    foreach (var item in Query_DB)
+                    {
+                        DataRow dr = dtSource.NewRow();
+                        //遍历dtSource所有列头
+                        foreach (DataColumn column in dtSource.Columns)
+                        {
+                            dr[column.ColumnName] = item.GetType().GetProperty(column.ColumnName)?.GetValue(item)?.ToString();
+                        }
+                        dtSource.Rows.Add(dr);
+                    }
+
+                    WorkbookDesigner designer = new WorkbookDesigner();
+                    designer.Workbook = new Workbook(fileBasePath + ("Template/公务出访信息.xlsx"));
+
+                    var title = startTime_parse.ToString("yyyy年MM月dd日") + " - " + endTime_parse.ToString("yyyy年MM月dd日") + " 公务出访信息";
+                    designer.SetDataSource("title", title);
+                    designer.SetDataSource(dtSource);
+                    designer.Process();
+
+                    var exportPath = fileBasePath + "ExportOfficialActivitiesInfo/" + title + ".xlsx";
+                    //保存文件
+                    designer.Workbook.Save(exportPath);
+                    jw.Data = AppSettingsHelper.Get("ExcelBaseUrl") + exportPath;
+                    jw.Code = 200;
+                    jw.Msg = "获取成功!";
+                }
+                else
+                {
+                    jw.Data = "无公务信息!";
+                }
+
+            }
+            else
+            {
+                jw.Data = "时间格式错误!";
+            }
+            return Ok(jw);
+        }
+
         #endregion
 
         #region 请示数据库

+ 5 - 0
OASystem/OASystem.Domain/Dtos/Financial/Fin_GroupExtraCostDto.cs

@@ -106,6 +106,11 @@ namespace OASystem.Domain.Dtos.Financial
         /// 经理确认
         /// </summary>
         public int ManagerConfirm { get; set; }
+
+        /// <summary>
+        /// 商邀主管确认
+        /// </summary>
+        public int SYsupervisorConfirm { get; set; }
     }
 
     public class Fin_GroupExtraCostDto_Search : DtoBase

+ 2 - 0
OASystem/OASystem.Domain/Dtos/PersonnelModule/TreeNode.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -111,6 +112,7 @@ namespace OASystem.Domain.Dtos.PersonnelModule
 
     public class PerAssessmentSettingOperationDto
     {
+        [Required(ErrorMessage = "项名称不能为空")]
         public string Name { get; set; }
         public decimal AssessmentProportion { get; set; }
         public string AssessmentStandard { get; set; }

+ 15 - 0
OASystem/OASystem.Domain/Dtos/Resource/OfficialActivitiesDto.cs

@@ -1,6 +1,7 @@
 using Microsoft.AspNetCore.Http;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -191,6 +192,20 @@ namespace OASystem.Domain.Dtos.Resource
 
     }
 
+    public class ExportOfficialActivitiesInfoDto
+    {
+        [Required(ErrorMessage = "请输入开始时间")]
+        public string StartTime { get; set; }
+        [Required(ErrorMessage = "请输入结束时间")]
+
+        public string EndTime { get; set; }
+
+        /// <summary>
+        /// -1 All 0 未确认 1 已确认
+        /// </summary>
+        public int State { get; set; }
+    }
+
     public class PostOfficialActivitiesReqReqSampleTipsDto
     {
         public string country { get; set; }

+ 5 - 0
OASystem/OASystem.Domain/Entities/Financial/Fin_GroupExtraCost.cs

@@ -94,5 +94,10 @@ namespace OASystem.Domain.Entities.Financial
         /// 主管确认
         /// </summary>
         public int? SupervisorConfirm { get; set; }
+
+        /// <summary>
+        /// 商邀主管确认
+        /// </summary>
+        public int? SYsupervisorConfirm { get; set; }
     }
 }

+ 6 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_GroupExtraCostView.cs

@@ -33,6 +33,12 @@ namespace OASystem.Domain.ViewModels.Financial
 
         public string SupervisorConfirmStr { get; set; }
 
+        public string Remark { get; set; }
+
+        /// <summary>
+        /// 商邀主管确认
+        /// </summary>
+        public string SYsupervisorConfirmStr { get; set; }
     }
 
     public class Fin_GroupExtraCostDetailView

+ 7 - 0
OASystem/OASystem.Domain/ViewModels/Resource/OfficialActivitiesView.cs

@@ -36,6 +36,13 @@ namespace OASystem.Domain.ViewModels.Resource
 
         public string CreateUserName { get; set; }
         public string OfficialFormName { get; set; }
+
+        public string ConfirmTheInvitationStr
+        { 
+            get { 
+                return this.ConfirmTheInvitation == 0 ? "未确认" : "已确认";
+            }
+        }
     }
 
     /// <summary>

+ 18 - 2
OASystem/OASystem.Infrastructure/Repositories/Financial/ForeignReceivablesRepository.cs

@@ -11,6 +11,7 @@ using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.Groups;
 using OASystem.Infrastructure.Repositories.System;
 using SqlSugar;
+using SqlSugar.Extensions;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -535,7 +536,7 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
             //币种不同则计算rmb值
             var overspList = _sqlSugar.Queryable<Fin_GroupExtraCost, Grp_CreditCardPayment>
                 ((e, c) => c.CTable == 1015 && c.CId == e.Id && c.IsDel == 0).
-                Where((e, c) => e.IsDel == 0 && e.DiId == dto.DiId && (e.SupervisorConfirm == 1 || e.ManagerConfirm == 1)).
+                Where((e, c) => e.IsDel == 0 && e.DiId == dto.DiId).
                 Select((e, c) => new
                 {
                     e.Price,
@@ -547,7 +548,22 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
                     e.PriceCurrency,
                     e.Remark,
                 })
-                .ToList();
+                .ToList().
+                Where(x =>
+                {
+                    var count = 0;
+                    var stringArr = new string[] { "SYsupervisorConfirm" , "SupervisorConfirm" , "ManagerConfirm" };
+                    foreach (var item in stringArr)
+                    {
+                        var number = x.GetType()?.GetProperty(item)?.GetValue(x).ObjToInt();
+                        if (number > 0)
+                        {
+                            count++;
+                        }
+                    }
+                    return count > 1;
+
+                }).ToList();
             var overspListGroup = overspList.GroupBy(x => x.PriceCurrency).ToList();
             string foreignReceivablesRemake = string.Empty;
             int count = 1;

+ 32 - 4
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -868,6 +868,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                     var aMeal = cityPrice.FoodCost.ObjToDecimal() / 2; //一顿三公费用
                     var findSetDataCurr = _sqlSugar.Queryable<Sys_SetData>().First(q => q.Id == dto.toCurr && q.IsDel == 0);
+                    var carCurr = _sqlSugar.Queryable<Sys_SetData>().First(q => q.Id == carTouristList.First().Currency && q.IsDel == 0);
 
                     foreach (var item in arr)
                     {
@@ -910,6 +911,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     var exitMealCount = 0;
                     var price = 0M;
                     //var day = 0;
+                    var consumerMealStr = string.Empty;
+                    var consumerMealNumber = 0;
+                    var consumerMealAllPrice = 0.00M;
+
                     while (start <= end)
                     {
                         //查看每日每顿是否存在超支
@@ -919,6 +924,22 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         bool isExistsWan = carTouristList.Where(x => x.SId == mealsDic[989] && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0 && x.Price > 0).Count() == 0;
                         var mealPriceWu = carTouristList.Where(x => x.SId == 93 && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price * x.Count);
                         var mealPriceWan = carTouristList.Where(x => x.SId == 989 && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price * x.Count);
+                        var mealPriceWuChao = carTouristList.Where(x => x.SId == mealsDic[93] && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price * x.Count);
+                        var mealPriceWanChao = carTouristList.Where(x => x.SId == mealsDic[989] && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price * x.Count);
+
+                        if (mealPriceWu > 0)
+                        {
+                            consumerMealStr += $"{start.ToString("M/d")}午餐消费{mealPriceWu + mealPriceWuChao}{carCurr?.Name},";
+                            consumerMealNumber++;
+                            consumerMealAllPrice += mealPriceWu + mealPriceWuChao;
+                        }
+
+                        if (mealPriceWan > 0)
+                        {
+                            consumerMealStr += $"{start.ToString("M/d")}晚餐消费{mealPriceWan + mealPriceWanChao}{carCurr?.Name},";
+                            consumerMealNumber++;
+                            consumerMealAllPrice += mealPriceWan + mealPriceWanChao;
+                        }
 
                         if (isExistsWu && isExistsWan)
                         {
@@ -949,7 +970,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     {
                         remake = remake.TrimEnd(',');
                         remake += $"财政 {findSetDataCurr?.Name} {aMeal} * {di.VisitPNumber} * {exitMealCount}餐";
-                        int priceInt = (int)Math.Round(price / di.VisitPNumber / exitMealCount);
+                        remake += $",[TuT]{consumerMealStr} 共{consumerMealNumber}顿 {consumerMealAllPrice} {carCurr?.Name}";
+
+                        decimal priceInt = price / di.VisitPNumber / exitMealCount;
                         groupExtraCostsArr.Add(new Fin_GroupExtraCost
                         {
                             Coefficient = 1,
@@ -971,12 +994,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         });
                     }
 
+                    var needToConfirm = new int[] { 1088, 1050 }; 
+
                     if (groupExtraCostsArr.Count > 0)
                     {
                         foreach (var item in groupExtraCostsArr)
                         {
-                            var ManagerConfirm = item.PriceDetailType == 1088 ? 0 : 1;
-                            var SupervisorConfirm = item.PriceDetailType == 1088 ? 0 : 1;
+                            var ManagerConfirm = needToConfirm.Contains(item.PriceDetailType) ? 0 : 1;
+                            var SupervisorConfirm = needToConfirm.Contains(item.PriceDetailType) ? 0 : 1;
+                            var SYsupervisorConfirm = needToConfirm.Contains(item.PriceDetailType) ? 0 : 1;
                             var QuerySgin = _sqlSugar.Queryable<Fin_GroupExtraCost>()
                                 .Where(x => x.PriceName == item.PriceName && x.DiId == item.DiId && x.IsDel == 0 && x.PriceDt.ToString("yyyy-MM-dd") == item.PriceDt.ToString("yyyy-MM-dd"))
                                 .First();
@@ -1003,7 +1029,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                     costSign = dto.OrbitalPrivateTransfer,
                                     Area = item.Area,
                                     ManagerConfirm = ManagerConfirm,
-                                    SupervisorConfirm = SupervisorConfirm
+                                    SupervisorConfirm = SupervisorConfirm,
+                                    SYsupervisorConfirm = SYsupervisorConfirm
                                 });
                                 _sqlSugar.Insertable<Fin_LocalGuideRelevancyOverspend>(new Fin_LocalGuideRelevancyOverspend
                                 {
@@ -1291,6 +1318,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             _entity.Area = dto.Area;
             _entity.SupervisorConfirm = dto.SupervisorConfirm;
             _entity.ManagerConfirm = dto.ManagerConfirm;
+            _entity.SYsupervisorConfirm = dto.SYsupervisorConfirm;
 
             _daiRep.BeginTran();
             if (dto.editType == 1)