Ver código fonte

部门首页消息提示 代码编写

LEIYI 6 meses atrás
pai
commit
d77eadb9f5

+ 6 - 4
OASystem/OASystem.Api/Controllers/AuthController.cs

@@ -74,8 +74,9 @@ namespace OASystem.API.Controllers
 
             #endregion
             Result authData = null;
-            string uName = string.Empty;
-            string role = string.Empty;
+            string uName = string.Empty,
+                   role = string.Empty,
+                   depName = string.Empty;
             int uId = 0;
             int unReadCount = 0;
             int announcementUnReadCount = 0;
@@ -83,6 +84,7 @@ namespace OASystem.API.Controllers
             {
                 uId = (userData.Data as UserLoginInfoView).UserId;
                 uName = (userData.Data as UserLoginInfoView).CnName;
+                depName = (userData.Data as UserLoginInfoView).DepName;
                 role = (userData.Data as UserLoginInfoView).JobName;
                 authData = _SystemMenuPermissionRepository.QueryMenuLoad(uId, dto.PortType);
                 unReadCount = await _messageRep.GetUnReadCount(uId);
@@ -112,7 +114,7 @@ namespace OASystem.API.Controllers
 
                 if (expDt >= createZebraTime)  //超时重新获取token
                 {
-                    authorToken = await JwtHelper.IssueJwtAsync(new TokenModelJwt() { UserId = uId, UserName = uName, Role = role }); //
+                    authorToken = await JwtHelper.IssueJwtAsync(new TokenModelJwt() { UserId = uId, UserName = uName, Department = depName, Role = role }); //
                 }
 
                 view.Expires = expDt;
@@ -122,7 +124,7 @@ namespace OASystem.API.Controllers
             {
                 view.Expires = createZebraTime.AddMinutes(30);
                 //view.Token = await GeneralMethod.GetToken(_config, dto.Number, uId, uName, createZebraTime); //JwtHelper
-                view.Token = await JwtHelper.IssueJwtAsync(new TokenModelJwt() { UserId = uId, UserName = uName, Role = role }); //
+                view.Token = await JwtHelper.IssueJwtAsync(new TokenModelJwt() { UserId = uId, UserName = uName, Department = depName, Role = role }); //
                 TimeSpan ts = view.Expires.AddMinutes(-1) - createZebraTime; //设置redis 过期时间 比 jwt 时间 快一分钟
                 await RedisRepository.RedisFactory.CreateRedisRepository().StringSetAsync<string>(authorId, view.Token, ts);//string 存
             }

+ 366 - 275
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -12,6 +12,7 @@ using static OASystem.API.OAMethodLib.GeneralMethod;
 using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 using static QRCoder.PayloadGenerator;
 using static Quartz.Logging.OperationName;
+using static OASystem.API.OAMethodLib.JWTHelper;
 
 namespace OASystem.API.Controllers
 {
@@ -2201,7 +2202,6 @@ And u.UId = {0} And u.FId = 1 ", dto.UserId);
 
         #endregion
 
-
         #region 各部门首页消息提示
         /// <summary>
         /// 部门首页消息提示
@@ -2211,314 +2211,405 @@ And u.UId = {0} And u.FId = 1 ", dto.UserId);
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> DepartmentHomePageMessagePrompts(int portType)
         {
+            var currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
+            if (currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
+            var department = currUserInfo.Department;
             if (portType < 1 || portType > 3) return Ok(JsonView(false, MsgTips.Port));
 
             if (portType == 1 || portType == 2 || portType == 3) // web
             {
-                //总经办
-                //1、资料数据(市场部客户资源、op地接导游、op地接车数据、商邀数据、团组收款数据)数据提示Range(固定上个月) -- Add
                 //固定查询时间(当前月的上月)
                 var lastMoth = DateTime.Now.AddMonths(-1);
                 var (startDate, endDate) = CommonFun.GetMonthStartAndEndDates(lastMoth.Year, lastMoth.Month);
                 var startDateTime = Convert.ToDateTime(startDate.ToString("yyyy-MM-dd 00:00:00"));
                 var endDateTime = Convert.ToDateTime(endDate.ToString("yyyy-MM-dd 23:59:59"));
+                //固定查询时间(本年)
+                var currStartDate = Convert.ToDateTime($"{DateTime.Now.Year}-01-01 00:00:00");
+                var currEntDate = Convert.ToDateTime($"{DateTime.Now.Year}-12-31 23:59:59");
+                if (department.Equals("总经办")) //总经办
+                {
+                    //1、资料数据(市场部客户资源、op地接导游、op地接车数据、商邀数据、团组收款数据)数据提示Range(固定上个月) -- Add
+                    
+                    #region 市场部客户资源
+                    //1.1 市场部客户资源
+                    var users = await _sqlSugar.Queryable<Sys_Users>()
+                        .LeftJoin<Sys_Department>((u, d) => u.DepId == d.Id)
+                        .Where((u, d) => u.IsDel == 0 && (d.DepName.Contains("市场部") || u.Id == 21))
+                        .Select((u, d) => new { u.Id, u.CnName })
+                        .ToListAsync();
+
+                    var marketData = await _sqlSugar.Queryable<Crm_NewClientData>()
+                        .LeftJoin<Sys_Users>((ncd, u) => ncd.CreateUserId == u.Id)
+                        .Where((ncd, u) => ncd.IsDel == 0 && ncd.CreateTime >= startDateTime && ncd.CreateTime <= endDateTime)
+                        .Select((ncd, u) => new
+                        {
+                            Area = ncd.Location,
+                            ncd.Client,
+                            ncd.Contact,
+                            ncd.Job,
+                            Tel = ncd.Telephone,
+                            ncd.CreateUserId,
+                            CreatleUserName = u.CnName,
+                            ncd.CreateTime,
+                        })
+                        .ToListAsync();
+                    var marketDataGroup = marketData.GroupBy(x => x.CreateUserId).Select(g => new { CreateUserId = g.Key, Items = g.ToList(), Count = g.Count() });
+
+                    var marketData2 = new List<dynamic>();
+                    foreach (var user in users)
+                    {
+                        var userMarketData = marketDataGroup.FirstOrDefault(x => user.Id == x.CreateUserId);
+                        if (userMarketData != null)
+                        {
+                            marketData2.Add(new
+                            {
+                                uId = user.Id,
+                                name = user.CnName,
+                                count = userMarketData.Count,
+                                msgTips = $"上月新增市场客户资源共{userMarketData.Count}条",
+                                userMarketData = userMarketData.Items
+                            });
+                        }
+                        else
+                        {
+                            marketData2.Add(new
+                            {
+                                uId = user.Id,
+                                name = user.CnName,
+                                count = 0,
+                                msgTips = $"上月新增市场客户资源共{0}条",
+                                userMarketData = new List<dynamic>() { },
+                            });
+                        }
+                    }
+
+                    var marketData1 = new
+                    {
+                        msgTips = $"上月新增市场客户资源共{marketData.Count}条",
+                        Data = marketData2,
+                    };
+                    #endregion
+
+                    #region op地接导游
+                    //1.2 op地接导游 
+                    var opTourGuideData = await _sqlSugar.Queryable<Res_LocalGuideData>()
+                        .LeftJoin<Sys_Users>((lgd, u) => lgd.CreateUserId == u.Id)
+                        .Where((lgd, u) => lgd.IsDel == 0 && lgd.CreateTime >= startDateTime && lgd.CreateTime <= endDateTime)
+                        .Select((lgd, u) => new
+                        {
+                            Area = lgd.UnitArea,
+                            Client = lgd.UnitName,
+                            lgd.Contact,
+                            Job = "",
+                            Tel = lgd.ContactTel,
+                            lgd.CreateUserId,
+                            CreatleUserName = u.CnName,
+                            lgd.CreateTime,
+                        })
+                        .ToListAsync();
+                    var opTourGuideDataGroups = opTourGuideData.GroupBy(x => x.CreateUserId)
+                        .Select(g => new {
+                            uId = g.Key,
+                            name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
+                            msgTips = $"上月新增OP地接导游资源共{g.Count()}条",
+                            userTourGuideData = g.ToList(),
+                            Count = g.Count()
+                        });
 
-                #region 市场部客户资源
-                //1.1 市场部客户资源
-                var users = await _sqlSugar.Queryable<Sys_Users>()
-                    .LeftJoin<Sys_Department>((u, d) => u.DepId == d.Id)
-                    .Where((u, d) => u.IsDel == 0 && (d.DepName.Contains("市场部") || u.Id == 21))
-                    .Select((u, d) => new { u.Id, u.CnName })
-                    .ToListAsync();
-
-                var marketData = await _sqlSugar.Queryable<Crm_NewClientData>()
-                    .LeftJoin<Sys_Users>((ncd, u) => ncd.CreateUserId == u.Id)
-                    .Where((ncd, u) => ncd.IsDel == 0 && ncd.CreateTime >= startDateTime && ncd.CreateTime <= endDateTime)
-                    .Select((ncd, u) => new
+                    var opTourGuideData1 = new
                     {
-                        Area = ncd.Location,
-                        ncd.Client,
-                        ncd.Contact,
-                        ncd.Job,
-                        Tel = ncd.Telephone,
-                        ncd.CreateUserId,
-                        CreatleUserName = u.CnName,
-                        ncd.CreateTime,
-                    })
-                    .ToListAsync();
-                var marketDataGroup = marketData.GroupBy(x => x.CreateUserId).Select(g => new { CreateUserId = g.Key, Items = g.ToList(), Count = g.Count() });
-
-                var marketData2 = new List<dynamic>();
-                foreach (var user in users)
-                {
-                    var userMarketData = marketDataGroup.FirstOrDefault(x => user.Id == x.CreateUserId);
-                    if (userMarketData != null)
+                        msgTips = $"上月新增OP地接导游资源共{opTourGuideData.Count}条",
+                        Data = opTourGuideDataGroups,
+                    };
+                    #endregion
+
+                    #region op车数据
+                    //1.3 op车数据 
+                    var opCarData = await _sqlSugar.Queryable<Res_CarData>()
+                        .LeftJoin<Sys_Users>((cd, u) => cd.CreateUserId == u.Id)
+                        .Where((cd, u) => cd.IsDel == 0 && cd.CreateTime >= startDateTime && cd.CreateTime <= endDateTime)
+                        .Select((cd, u) => new
+                        {
+                            Area = cd.UnitArea,
+                            Client = cd.UnitName,
+                            cd.Contact,
+                            Job = "",
+                            Tel = cd.ContactTel,
+                            cd.CreateUserId,
+                            CreatleUserName = u.CnName,
+                            cd.CreateTime,
+                        })
+                        .ToListAsync();
+                    var opCarDataGroups = opCarData.GroupBy(x => x.CreateUserId)
+                        .Select(g => new {
+                            uId = g.Key,
+                            name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
+                            msgTips = $"上月新增OP地接车资源共{g.Count()}条",
+                            userTourGuideData = g.ToList(),
+                            Count = g.Count()
+                        });
+                    var opCarData1 = new
                     {
-                        marketData2.Add(new
+                        msgTips = $"上月新增OP地接车资源共{opCarData.Count}条",
+                        Data = opCarDataGroups,
+                    };
+                    #endregion
+
+                    #region 商邀数据
+                    //1.4 商邀数据 
+                    var invitationData = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
+                        .LeftJoin<Sys_Users>((ioa, u) => ioa.CreateUserId == u.Id)
+                        .Where((ioa, u) => ioa.IsDel == 0 && ioa.CreateTime >= startDateTime && ioa.CreateTime <= endDateTime)
+                        .Select((ioa, u) => new
                         {
-                            uId = user.Id,
-                            name = user.CnName,
-                            count = userMarketData.Count,
-                            msgTips = $"上月新增市场客户资源共{userMarketData.Count}条",
-                            userMarketData = userMarketData.Items
+                            //Area = string.Format("{0}{1}", ioa.Country, !string.IsNullOrEmpty(ioa.City) ? "" : "-" + ioa.City),
+                            Area = string.Format("{0}{1}", ioa.Country, ioa.City),
+                            Client = ioa.UnitName,
+                            ioa.Contact,
+                            ioa.Job,
+                            ioa.Tel,
+                            ioa.CreateUserId,
+                            CreatleUserName = u.CnName,
+                            ioa.CreateTime,
+                        })
+                        .ToListAsync();
+                    var invitationGroups = invitationData.GroupBy(x => x.CreateUserId)
+                        .Select(g => new {
+                            uId = g.Key,
+                            name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
+                            msgTips = $"上月新增商邀资源共{g.Count()}条",
+                            userTourGuideData = g.ToList(),
+                            Count = g.Count()
                         });
-                    }
-                    else
+                    var invitationData1 = new
                     {
-                        marketData2.Add(new
+                        msgTips = $"上月新增商邀资源共{invitationData.Count}条",
+                        Data = invitationGroups,
+                    };
+                    #endregion
+
+                    #region 团组收款数据
+                    //1.5 团组收款数据  
+                    var groupCollectionData = await _sqlSugar.Queryable<Fin_ForeignReceivables>()
+                        .LeftJoin<Sys_Users>((fr, u) => fr.CreateUserId == u.Id)
+                        .LeftJoin<Grp_DelegationInfo>((fr, u, di) => fr.Diid == di.Id)
+                        .LeftJoin<Sys_SetData>((fr, u, di, sd) => fr.Currency == sd.Id)
+                        .Where((fr, u, di, sd) => fr.IsDel == 0 && fr.CreateTime >= startDateTime && fr.CreateTime <= endDateTime)
+                        .Select((fr, u, di, sd) => new
                         {
-                            uId = user.Id,
-                            name = user.CnName,
-                            count = 0,
-                            msgTips = $"上月新增市场客户资源共{0}条",
-                            userMarketData = new List<dynamic>() { },
+                            fr.PriceName,
+                            fr.Price,
+                            fr.Count,
+                            fr.Unit,
+                            fr.ItemSumPrice,
+                            Currency = sd.Name,
+                            GroupName = di.TeamName,
+                            fr.CreateUserId,
+                            CreateUserName = u.CnName,
+                            fr.CreateTime,
+                        })
+                        .ToListAsync();
+                    var groupCollectionGroups = groupCollectionData.GroupBy(x => x.CreateUserId)
+                        .Select(g => new
+                        {
+                            uId = g.Key,
+                            name = g.ToList().FirstOrDefault()?.CreateUserName ?? "-",
+                            msgTips = $"上月累计团组收款共{g.Count()}条",
+                            userTourGuideData = g.ToList(),
+                            Count = g.Count()
                         });
-                    }
-                }
 
-                var marketData1 = new
-                {
-                    msgTips = $"上月新增市场客户资源共{marketData.Count}条",
-                    Data = marketData2,
-                };
-                #endregion
-
-                #region op地接导游
-                //1.2 op地接导游 
-                var opTourGuideData = await _sqlSugar.Queryable<Res_LocalGuideData>()
-                    .LeftJoin<Sys_Users>((lgd, u) => lgd.CreateUserId == u.Id)
-                    .Where((lgd, u) => lgd.IsDel == 0 && lgd.CreateTime >= startDateTime && lgd.CreateTime <= endDateTime)
-                    .Select((lgd, u) => new
+                    var groupCollectionData2 = new
                     {
-                        Area = lgd.UnitArea,
-                        Client = lgd.UnitName,
-                        lgd.Contact,
-                        Job="",
-                        Tel = lgd.ContactTel,
-                        lgd.CreateUserId,
-                        CreatleUserName = u.CnName,
-                        lgd.CreateTime,
-                    })
-                    .ToListAsync();
-                var opTourGuideDataGroups = opTourGuideData.GroupBy(x => x.CreateUserId)
-                    .Select(g => new {
-                        uId = g.Key,
-                        name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
-                        msgTips = $"上月新增OP地接导游资源共{g.Count()}条",
-                        userTourGuideData = g.ToList(), 
-                        Count = g.Count() 
-                    });
+                        msgTips = $"上月累计团组收款共{groupCollectionData.Count}条",
+                        Data = groupCollectionGroups,
+                    };
+                    #endregion
 
-                var opTourGuideData1 = new {
-                    msgTips = $"上月新增OP地接导游资源共{opTourGuideData.Count}条",
-                    Data = opTourGuideDataGroups,
-                };
-                #endregion
-
-                #region op车数据
-                //1.3 op车数据 
-                var opCarData = await _sqlSugar.Queryable<Res_CarData>()
-                    .LeftJoin<Sys_Users>((cd, u) => cd.CreateUserId == u.Id)
-                    .Where((cd, u) => cd.IsDel == 0 && cd.CreateTime >= startDateTime && cd.CreateTime <= endDateTime)
-                    .Select((cd, u) => new
+                    var materialData = new
                     {
-                        Area = cd.UnitArea,
-                        Client = cd.UnitName,
-                        cd.Contact,
-                        Job = "",
-                        Tel = cd.ContactTel,
-                        cd.CreateUserId,
-                        CreatleUserName = u.CnName,
-                        cd.CreateTime,
-                    })
-                    .ToListAsync();
-                var opCarDataGroups = opCarData.GroupBy(x => x.CreateUserId)
-                    .Select(g => new {
-                        uId = g.Key,
-                        name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
-                        msgTips = $"上月新增OP地接车资源共{g.Count()}条",
-                        userTourGuideData = g.ToList(),
-                        Count = g.Count()
-                    });
-                var opCarData1 = new
-                {
-                    msgTips = $"上月新增OP地接车资源共{opCarData.Count}条",
-                    Data = opCarDataGroups,
-                };
-                #endregion
-
-                #region 商邀数据
-                //1.4 商邀数据 
-                var invitationData = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
-                    .LeftJoin<Sys_Users>((ioa, u) => ioa.CreateUserId == u.Id)
-                    .Where((ioa, u) => ioa.IsDel == 0 && ioa.CreateTime >= startDateTime && ioa.CreateTime <= endDateTime)
-                    .Select((ioa, u) => new
+                        marketData = marketData1,
+                        opTourGuideData = opTourGuideData1,
+                        opCarData = opCarData1,
+                        invitationData = invitationData1,
+                        groupCollectionData = groupCollectionData2
+                    };
+                    //2、费用未审核(日付申请未审核数据、团组费用未审核数据)费用提示Range(固定本年)
+
+                    #region 日付申请未审核数据
+                    var dailyPaymentData = await _sqlSugar.Queryable<Fin_DailyFeePayment>()
+                                                 .LeftJoin<Sys_Users>((dfp, u) => dfp.CreateUserId == u.Id)
+                                                 .Where(dfp => dfp.IsDel == 0 &&
+                                                               dfp.MAudit == 0 &&
+                                                               dfp.CreateTime >= currStartDate &&
+                                                               dfp.CreateTime <= currEntDate
+                                                       )
+                                                 .OrderBy(dfp => dfp.CreateTime, OrderByType.Desc)
+                                                 //.OrderBy(dfp => dfp.FAudit, OrderByType.Desc)
+                                                 .Select((dfp, u) => new
+                                                 {
+                                                     id = dfp.Id,
+                                                     amountName = dfp.Instructions,
+                                                     amount = dfp.SumPrice,
+                                                     fAuditStatus = dfp.FAudit == 1 ? "审核通过" :
+                                                                    dfp.FAudit == 2 ? "审核未通过" : "未审核",
+                                                     fAuditDate = dfp.FAuditDate,
+                                                     dfp.CreateUserId,
+                                                     CreateUserName = u.CnName,
+                                                     dfp.CreateTime
+                                                 })
+                                                 .ToListAsync();
+
+                    var dailyPaymentGroups = dailyPaymentData.GroupBy(x => x.CreateUserId)
+                        .Select(g => new
+                        {
+                            uId = g.Key,
+                            name = g.ToList().FirstOrDefault()?.CreateUserName ?? "-",
+                            msgTips = $"本年有{g.Count()}条未审核日常付款申请条",
+                            userTourGuideData = g.ToList(),
+                            Count = g.Count()
+                        });
+
+                    var dailyPaymentData1 = new
                     {
-                        //Area = string.Format("{0}{1}", ioa.Country, !string.IsNullOrEmpty(ioa.City) ? "" : "-" + ioa.City),
-                        Area = string.Format("{0}{1}", ioa.Country,ioa.City),
-                        Client = ioa.UnitName,
-                        ioa.Contact,
-                        ioa.Job,
-                        ioa.Tel,
-                        ioa.CreateUserId,
-                        CreatleUserName = u.CnName,
-                        ioa.CreateTime,
-                    })
-                    .ToListAsync();
-                var invitationGroups = invitationData.GroupBy(x => x.CreateUserId)
-                    .Select(g => new {
-                        uId = g.Key,
-                        name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
-                        msgTips = $"上月新增商邀资源共{g.Count()}条",
-                        userTourGuideData = g.ToList(),
-                        Count = g.Count()
-                    });
-                var invitationData1 = new
-                {
-                    msgTips = $"上月新增商邀资源共{invitationData.Count}条",
-                    Data = invitationGroups,
-                };
-                #endregion
-
-                #region 团组收款数据
-                //1.5 团组收款数据  
-                var groupCollectionData = await _sqlSugar.Queryable<Fin_ForeignReceivables>()
-                    .LeftJoin<Sys_Users>((fr, u) => fr.CreateUserId == u.Id)
-                    .LeftJoin<Grp_DelegationInfo>((fr, u, di) => fr.Diid == di.Id)
-                    .LeftJoin<Sys_SetData>((fr, u, di, sd) => fr.Currency == sd.Id)
-                    .Where((fr, u, di, sd) => fr.IsDel == 0 && fr.CreateTime >= startDateTime && fr.CreateTime <= endDateTime)
-                    .Select((fr, u, di, sd) => new
+                        msgTips = $"本年有{dailyPaymentData.Count()}条未审核日常付款申请条",
+                        Data = dailyPaymentGroups,
+                    };
+                    #endregion
+
+                    #region 团组费用未审核数据
+
+                    var groupPaymentData = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
+                        .LeftJoin<Grp_DelegationInfo>((ccp, di) => ccp.Id == di.Id)
+                        .Where((ccp, di) => ccp.IsDel == 0 &&
+                                            ccp.IsAuditGM == 0 &&
+                                            ccp.CreateTime >= currStartDate &&
+                                            ccp.CreateTime <= currEntDate
+                              )
+                        .Select((ccp, di) => new
+                        {
+                            ccp.Id,
+                            ccp.DIId,
+                            GroupName = di.TeamName,
+                            ccp.CreateTime,
+                        })
+                        .ToListAsync();
+
+                    var groupPaymentGroups = groupPaymentData.GroupBy(x => x.DIId)
+                       .Select(g => new
+                       {
+                           uId = g.Key,
+                           name = g.ToList().FirstOrDefault()?.GroupName ?? "-",
+                           msgTips = $"本年有{g.Count()}条未审核团组费用申请条",
+                           userTourGuideData = g.ToList(),
+                           Count = g.Count()
+                       });
+
+                    var groupPaymentData1 = new
                     {
-                        fr.PriceName,
-                        fr.Price,
-                        fr.Count,
-                        fr.Unit,
-                        fr.ItemSumPrice,
-                        Currency = sd.Name,
-                        GroupName = di.TeamName,
-                        fr.CreateUserId,
-                        CreateUserName = u.CnName,
-                        fr.CreateTime,
-                    })
-                    .ToListAsync();
-                var groupCollectionGroups = groupCollectionData.GroupBy(x => x.CreateUserId)
-                    .Select(g => new
+                        msgTips = $"本年有{groupPaymentData.Count()}条未审核团组费用申请条",
+                        Data = groupPaymentGroups,
+                    };
+                    #endregion
+
+                    var feeUnAuditData = new
                     {
-                        uId = g.Key,
-                        name = g.ToList().FirstOrDefault()?.CreateUserName ?? "-",
-                        msgTips = $"上月累计团组收款共{g.Count()}条",
-                        userTourGuideData = g.ToList(),
-                        Count = g.Count()
-                    });
+                        dailyPaymentData = dailyPaymentData1,
+                        groupPaymentData = groupPaymentData1
+                    };
 
-                var groupCollectionData2 = new
+                    return Ok(JsonView(new { materialData = materialData, feeUnAuditData = feeUnAuditData }));
+                }
+                else if (department.Equals("国交部"))//国交部
                 {
-                    msgTips = $"上月累计团组收款共{groupCollectionData.Count}条",
-                    Data = groupCollectionGroups,
-                };
-                #endregion
-
-                //var 
-                var materialData = new
+                    return Ok(JsonView(false, "国交部消息提示正在开发者中......"));
+                }
+                else if (department.Equals("财务部"))//总经办
                 {
-                    marketData = marketData1,
-                    opTourGuideData = opTourGuideData1,
-                    opCarData = opCarData1,
-                    invitationData = invitationData1,
-                    groupCollectionData = groupCollectionData2
-                };
-                //2、费用未审核(日付申请未审核数据、团组费用未审核数据)费用提示Range(固定本年)
 
-                var currStartDate = Convert.ToDateTime($"{DateTime.Now.Year}-01-01 00:00:00");
-                var currEntDate = Convert.ToDateTime($"{DateTime.Now.Year}-12-31 23:59:59");
+                    #region 团组收款数据
+                    var groupCollectionData = await _sqlSugar.Queryable<Fin_ForeignReceivables>()
+                        .LeftJoin<Sys_Users>((fr, u) => fr.CreateUserId == u.Id)
+                        .LeftJoin<Grp_DelegationInfo>((fr, u, di) => fr.Diid == di.Id)
+                        .LeftJoin<Sys_SetData>((fr, u, di, sd) => fr.Currency == sd.Id)
+                        .Where((fr, u, di, sd) => fr.IsDel == 0 && fr.CreateTime >= startDateTime && fr.CreateTime <= endDateTime)
+                        .Select((fr, u, di, sd) => new
+                        {
+                            fr.PriceName,
+                            fr.Price,
+                            fr.Count,
+                            fr.Unit,
+                            fr.ItemSumPrice,
+                            Currency = sd.Name,
+                            GroupName = di.TeamName,
+                            fr.CreateUserId,
+                            CreateUserName = u.CnName,
+                            fr.CreateTime,
+                        })
+                        .ToListAsync();
+                    var groupCollectionGroups = groupCollectionData.GroupBy(x => x.CreateUserId)
+                        .Select(g => new
+                        {
+                            uId = g.Key,
+                            name = g.ToList().FirstOrDefault()?.CreateUserName ?? "-",
+                            msgTips = $"上月累计团组收款共{g.Count()}条",
+                            userTourGuideData = g.ToList(),
+                            Count = g.Count()
+                        });
 
-                #region 日付申请未审核数据
-                var dailyPaymentData = await _sqlSugar.Queryable<Fin_DailyFeePayment>()
-                                             .LeftJoin<Sys_Users>((dfp, u) => dfp.CreateUserId == u.Id)
-                                             .Where(dfp => dfp.IsDel == 0 &&
-                                                           dfp.MAudit == 0 &&
-                                                           dfp.CreateTime >= currStartDate &&
-                                                           dfp.CreateTime <= currEntDate 
-                                                   )
-                                             .OrderBy(dfp => dfp.CreateTime, OrderByType.Desc)
-                                             //.OrderBy(dfp => dfp.FAudit, OrderByType.Desc)
-                                             .Select((dfp, u) => new
-                                             {
-                                                 id = dfp.Id,
-                                                 amountName = dfp.Instructions,
-                                                 amount = dfp.SumPrice,
-                                                 fAuditStatus = dfp.FAudit == 1 ? "审核通过" :
-                                                                dfp.FAudit == 2 ? "审核未通过" : "未审核",
-                                                 fAuditDate = dfp.FAuditDate,
-                                                 dfp.CreateUserId,
-                                                 CreateUserName = u.CnName,
-                                                 dfp.CreateTime 
-                                             })
-                                             .ToListAsync();
-
-                var dailyPaymentGroups = dailyPaymentData.GroupBy(x => x.CreateUserId)
-                    .Select(g => new
+                    var groupCollectionData1 = new
                     {
-                        uId = g.Key,
-                        name = g.ToList().FirstOrDefault()?.CreateUserName ?? "-",
-                        msgTips = $"本年有{g.Count()}条未审核日常付款申请条",
-                        userTourGuideData = g.ToList(),
-                        Count = g.Count()
-                    });
-
-                var dailyPaymentData1 = new
-                {
-                    msgTips = $"本年有{dailyPaymentData.Count()}条未审核日常付款申请条",
-                    Data = dailyPaymentGroups,
-                };
-                #endregion
-
-                #region 团组费用未审核数据
+                        msgTips = $"上月累计团组收款共{groupCollectionData.Count}条",
+                        Data = groupCollectionGroups,
+                    };
+                    #endregion
+
+
+                    #region 日付申请未审核数据
+                    var dailyPaymentData = await _sqlSugar.Queryable<Fin_DailyFeePayment>()
+                                                 .LeftJoin<Sys_Users>((dfp, u) => dfp.CreateUserId == u.Id)
+                                                 .Where(dfp => dfp.IsDel == 0 &&
+                                                               dfp.MAudit == 0 &&
+                                                               dfp.CreateTime >= currStartDate &&
+                                                               dfp.CreateTime <= currEntDate
+                                                       )
+                                                 .OrderBy(dfp => dfp.CreateTime, OrderByType.Desc)
+                                                 //.OrderBy(dfp => dfp.FAudit, OrderByType.Desc)
+                                                 .Select((dfp, u) => new
+                                                 {
+                                                     id = dfp.Id,
+                                                     amountName = dfp.Instructions,
+                                                     amount = dfp.SumPrice,
+                                                     fAuditStatus = dfp.FAudit == 1 ? "审核通过" :
+                                                                    dfp.FAudit == 2 ? "审核未通过" : "未审核",
+                                                     fAuditDate = dfp.FAuditDate,
+                                                     dfp.CreateUserId,
+                                                     CreateUserName = u.CnName,
+                                                     dfp.CreateTime
+                                                 })
+                                                 .ToListAsync();
+
+                    var dailyPaymentGroups = dailyPaymentData.GroupBy(x => x.CreateUserId)
+                        .Select(g => new
+                        {
+                            uId = g.Key,
+                            name = g.ToList().FirstOrDefault()?.CreateUserName ?? "-",
+                            msgTips = $"本年有{g.Count()}条未审核日常付款申请条",
+                            userTourGuideData = g.ToList(),
+                            Count = g.Count()
+                        });
 
-                var groupPaymentData = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
-                    .LeftJoin<Grp_DelegationInfo>((ccp, di) => ccp.Id == di.Id)
-                    .Where((ccp, di) => ccp.IsDel == 0 &&
-                                        ccp.IsAuditGM == 0 &&
-                                        ccp.CreateTime >= currStartDate &&
-                                        ccp.CreateTime <= currEntDate
-                          )
-                    .Select((ccp, di) => new
+                    var dailyPaymentData1 = new
                     {
-                        ccp.Id,
-                        ccp.DIId,
-                        GroupName = di.TeamName,
-                        ccp.CreateTime,
-                    })
-                    .ToListAsync();
+                        msgTips = $"本年有{dailyPaymentData.Count()}条未审核日常付款申请条",
+                        Data = dailyPaymentGroups,
+                    };
+                    #endregion
 
-                var groupPaymentGroups = groupPaymentData.GroupBy(x => x.DIId)
-                   .Select(g => new
-                   {
-                       uId = g.Key,
-                       name = g.ToList().FirstOrDefault()?.GroupName ?? "-",
-                       msgTips = $"本年有{g.Count()}条未审核团组费用申请条",
-                       userTourGuideData = g.ToList(),
-                       Count = g.Count()
-                   });
 
-                var groupPaymentData1 = new
-                {
-                    msgTips = $"本年有{groupPaymentData.Count()}条未审核团组费用申请条",
-                    Data = groupPaymentGroups,
-                };
-                #endregion
-
-                var feeUnAuditData = new
-                {
-                    dailyPaymentData = dailyPaymentData1,
-                    groupPaymentData = groupPaymentData1
-                };
-
-                //国交部
-
-                //财务
-
-                return Ok(JsonView(new { materialData = materialData, feeUnAuditData = feeUnAuditData }));
+                    return Ok(JsonView(new { groupCollectionData = groupCollectionData1, dailyPaymentData = dailyPaymentData1 }));
+                }
+                return Ok(JsonView(false,"其余部门消息提示正在开发者中......"));
             }
 
             return Ok(JsonView(false));

+ 7 - 1
OASystem/OASystem.Api/OAMethodLib/JwtHelper.cs

@@ -39,6 +39,7 @@ namespace OASystem.API.OAMethodLib
 
                 new Claim(JwtRegisteredClaimNames.Jti, tokenModel.UserId.ToString()),
                 new Claim(JwtRegisteredClaimNames.Name, tokenModel.UserName),
+                new Claim(JwtRegisteredClaimNames.FamilyName, tokenModel.Department),
                 //new Claim("UserId", tokenModel.UserId.ToString()),
                 new Claim(JwtRegisteredClaimNames.Iat, $"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}"),
                 new Claim(JwtRegisteredClaimNames.Nbf,$"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}") ,
@@ -83,10 +84,11 @@ namespace OASystem.API.OAMethodLib
                 if (string.IsNullOrEmpty(jwtStr)) return null;
                 var jwtHandler = new JwtSecurityTokenHandler();
                 JwtSecurityToken jwtToken = jwtHandler.ReadJwtToken(jwtStr);;
-                object role,userName;
+                object role,userName,department;
                 try
                 {
                     jwtToken.Payload.TryGetValue(ClaimTypes.Role, out role);
+                    jwtToken.Payload.TryGetValue("family_name", out department);
                     jwtToken.Payload.TryGetValue("name", out userName);
                 }
                 catch (Exception e)
@@ -99,6 +101,7 @@ namespace OASystem.API.OAMethodLib
                 {
                     UserId = (jwtToken.Id).ObjToInt(),
                     UserName = userName != null ? userName.ObjToString() : "",
+                    Department = department != null ? department.ObjToString() : "",
                     Role = role != null ? role.ObjToString() : "",
                 };
                 return tm;
@@ -117,6 +120,9 @@ namespace OASystem.API.OAMethodLib
 
             public string UserName { get; set; }
 
+
+            public string Department { get; set; } = "信息部";
+
             public string Role { get; set; } = "Admin";
 
             /// <summary>