Browse Source

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

yuanrf 1 year ago
parent
commit
4538f7d2b7

+ 25 - 0
OASystem/OASystem.Api/Controllers/ClientHubController.cs

@@ -1,6 +1,7 @@
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.SignalR;
+using OASystem.API.OAMethodLib;
 using OASystem.API.OAMethodLib.Hub.HubClients;
 using OASystem.API.OAMethodLib.Hub.Hubs;
 using OASystem.API.OAMethodLib.SignalR.Hubs;
@@ -72,5 +73,29 @@ namespace OASystem.API.Controllers
             await _hubContext.Clients.Client(connId).ReceiveMessage(date);
             return Ok("Send Successful!");
         }
+
+        /// <summary>
+        /// 消息 发布And 通知
+        /// </summary>
+        /// <param name="msgTypeEnum"></param>
+        /// <param name="title"></param>
+        /// <param name="content"></param>
+        /// <param name="userIds"></param>
+        /// <returns></returns>
+        [HttpPost("MessageIssuserAndNotification", Name = "MessageIssuserAndNotification")]
+        public async Task<IActionResult> MessageIssuserAndNotification(MessgeTypeEnum msgTypeEnum, string title, string content, List<int> userIds)
+        {
+            var status = await GeneralMethod.MessageIssueAndNotification(msgTypeEnum,title, content, userIds);
+            if (status)
+            {
+                return Ok("Operation Successful!");
+            }
+            else
+            {
+                return Ok("Operation Fail!");
+            }
+            
+        }
+
     }
 }

+ 10 - 6
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -7055,6 +7055,7 @@ namespace OASystem.API.Controllers
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostTourClientListByDiId(TourClientListByDiIdDto _dto)
         {
             #region  参数验证
@@ -7088,6 +7089,7 @@ namespace OASystem.API.Controllers
         /// <param name="_dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostTourClientListBasicDataInit(TourClientListBasicDataInitDto _dto)
         {
             #region  参数验证
@@ -7120,9 +7122,9 @@ namespace OASystem.API.Controllers
         /// <param name="_dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostTourClientListDetails(TourClientListDetailsDto _dto)
         {
-
             #region  参数验证
             if (_dto.UserId < 1) return Ok(JsonView(false, "请传入有效的UserId参数"));
             if (_dto.PageId < 1) _dto.PageId = 104; //接团客户名单PageId
@@ -7154,6 +7156,7 @@ namespace OASystem.API.Controllers
         /// <param name="_dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostTourClientListAddOrEdit(TourClientListAddOrEditDto _dto)
         {
             #region  参数验证
@@ -7184,7 +7187,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, viewData.Msg));
             }
 
-            return Ok(JsonView(viewData.Data));
+            return Ok(JsonView(true));
         }
 
         /// <summary>
@@ -7194,6 +7197,7 @@ namespace OASystem.API.Controllers
         /// <param name="_dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostTourClientListAddMultiple(TourClientListAddMultipleDto _dto)
         {
             #region  参数验证
@@ -7219,7 +7223,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, viewData.Msg));
             }
 
-            return Ok(JsonView(true,viewData.Msg));
+            return Ok(JsonView(true));
         }
 
         /// <summary>
@@ -7229,6 +7233,7 @@ namespace OASystem.API.Controllers
         /// <param name="_dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostTourClientListDel(TourClientListDelDto _dto)
         {
             #region  参数验证
@@ -7252,7 +7257,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, viewData.Msg));
             }
 
-            return Ok(JsonView(viewData.Data));
+            return Ok(JsonView(true));
         }
 
         /// <summary>
@@ -7262,6 +7267,7 @@ namespace OASystem.API.Controllers
         /// <param name="_dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostTourClientListDownloadFile(PostTourClientListDownloadFile _dto)
         {
             #region  参数验证
@@ -7357,8 +7363,6 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(true, "操作成功!", Url));
         }
 
-
-
         #endregion
     }
 }

+ 0 - 1
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -951,7 +951,6 @@ namespace OASystem.API.Controllers
         }
         #endregion
 
-
         #region 任务单
 
         /// <summary>

+ 1 - 3
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -179,10 +179,8 @@ namespace OASystem.API.Controllers
                     }
                     else if (dto.Type == 2) //2 任务操作通知
                     {
-
                         //任务通知 TaskNotification
-                        List<int> taskTypeList = new List<int>() { 6 };
-                        var taskNotificationData = _readableMsgList.Where(it => taskTypeList.Contains(it.Type)).OrderBy(it => it.IsRead).ToList();
+                        var taskNotificationData = _readableMsgList.Where(it => _taskTypeList.Contains(it.Type)).OrderBy(it => it.IsRead).ToList();
                         int taskNotificationDataCount = taskNotificationData.Count;
                         // 计算起始索引和结束索引
                         int taskStartIndex = (currentPage - 1) * pageSize;

+ 93 - 5
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -1,8 +1,13 @@
 using Microsoft.AspNetCore.Authentication;
 using Microsoft.AspNetCore.Authentication.Cookies;
 using Microsoft.AspNetCore.Mvc.TagHelpers;
+using Microsoft.AspNetCore.SignalR;
 using Microsoft.International.Converters.PinYinConverter;
+using NPOI.SS.Formula.PTG;
+using OASystem.API.OAMethodLib.Hub.HubClients;
+using OASystem.API.OAMethodLib.Hub.Hubs;
 using OASystem.API.OAMethodLib.JuHeAPI;
+using OASystem.API.OAMethodLib.SignalR.Hubs;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Financial;
 using OASystem.Domain.Entities.Customer;
@@ -16,14 +21,14 @@ using OASystem.Domain.ViewModels.JuHeExchangeRate;
 using OASystem.Domain.ViewModels.PersonnelModule;
 using OASystem.Infrastructure.Repositories.CRM;
 using OASystem.Infrastructure.Repositories.Groups;
+using System.Collections;
 using System.Collections.Generic;
 using System.IdentityModel.Tokens.Jwt;
 using System.Security.Claims;
+using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 
 namespace OASystem.API.OAMethodLib
 {
-
-
     public static class GeneralMethod
     {
         //团组信息
@@ -32,11 +37,94 @@ namespace OASystem.API.OAMethodLib
         private readonly static IJuHeApiService _juHeApiService = AutofacIocManager.Instance.GetService<IJuHeApiService>();
         private readonly static SetDataRepository _setDataRep = AutofacIocManager.Instance.GetService<SetDataRepository>();
         private readonly static TableOperationRecordRepository _tableOperationRecordRep = AutofacIocManager.Instance.GetService<TableOperationRecordRepository>();
-        private readonly static HttpContext _httpContext ;
+        private readonly static MessageRepository _messageRep = AutofacIocManager.Instance.GetService<MessageRepository>();
+        private readonly static IHubContext<ChatHub, IChatClient> _hubContext = AutofacIocManager.Instance.GetService<IHubContext<ChatHub, IChatClient>>();
+
+        #region 消息 
+        /// <summary>
+        /// 消息 发布And 通知
+        /// </summary>
+        /// <param name="msgTypeEnum">
+        /// 消息类型 
+        /// 1 公告通知
+        /// 2 团组流程管控通知
+        /// 1 团组业务操作通知
+        /// 2 团组费用审核消息
+        /// 5 团组签证进度通知
+        /// 6 团组任务进度通知
+        /// </param>
+        /// <param name="title">消息标题</param>
+        /// <param name="content">消息内容</param>
+        /// <param name="userIds"></param>
+        /// <param name="diId">团组id</param>
+        /// <returns></returns>
+        public static async Task<bool> MessageIssueAndNotification(MessgeTypeEnum msgTypeEnum,string title,string content, List<int> userIds,int diId = 0)
+        {
+            
+            MessageDto messageDto = new()
+            { 
+                Type = msgTypeEnum,
+                IssuerId = 4,//管理员
+                DiId = diId,
+                Title = title,
+                Content = content,
+                ReleaseTime = DateTime.Now,
+                UIdList = userIds
+            };
+            var status = await _messageRep.AddMsg(messageDto);//添加消息
+
+            if (status)
+            {
+                //给在线在用户发送消息
+                List<string> connIds = UserStore.OnlineUser.Where(it => userIds.Contains(it.UserId)).Select(it => it.ConnectionId).ToList();
+
+                string notificationTypeStr1 = GetMsgNotificationType(msgTypeEnum);
+                string notificationTypeStr = JsonConvert.SerializeObject(
+                       new
+                       {
+                           UserIds = userIds,
+                           Msg = $"您有一条{notificationTypeStr1}相关的消息!"
+                       }
+                   );
+                await _hubContext.Clients.Clients(connIds).ReceiveMessage($"您有一条{notificationTypeStr1}相关的消息!");
+
+                return true;
+            }
 
-        #region 消息
+            return false;
+        }
+        
+        /// <summary>
+        /// 根据消息类型 获取 消息通知类型
+        /// </summary>
+        /// <returns></returns>
+        public static string GetMsgNotificationType(MessgeTypeEnum msgTypeEnum)
+        {
+            int notificationType = 0;
+            string notificationStr = "";
+            List<NotificationTypeView> notificationTypeViews = AppSettingsHelper.Get<NotificationTypeView>("MessageNotificationType");
+            notificationType = notificationTypeViews.Where(it => it.MsgTypeIds.Contains((int)msgTypeEnum)).Select(it => it.TypeId).FirstOrDefault();
+
+            if (notificationType == 1) notificationStr = "操作";
+            else if (notificationType == 2) notificationStr = "任务";
 
+            return notificationStr;
+        }
 
+        public class NotificationTypeView
+        {
+            /// <summary>
+            /// 通知类型
+            /// 1 操作通知
+            /// 2 任务通知
+            /// </summary>
+            public int TypeId { get; set; }
+
+            /// <summary>
+            /// 消息类型id
+            /// </summary>
+            public List<int> MsgTypeIds { get; set; }
+        }
 
         #endregion
 
@@ -114,7 +202,7 @@ namespace OASystem.API.OAMethodLib
             var indentity = new ClaimsIdentity(claims, "formlogin");
             var principal = new ClaimsPrincipal(indentity);
 
-             await _httpContext.SignInAsync (CookieAuthenticationDefaults.AuthenticationScheme, principal);
+            // await _httpContext.SignInAsync (CookieAuthenticationDefaults.AuthenticationScheme, principal);
 
 
 

+ 85 - 15
OASystem/OASystem.Api/OAMethodLib/PayrollComputation.cs

@@ -15,6 +15,7 @@ using System.Collections.Generic;
 using System.Diagnostics.Eventing.Reader;
 using System.Drawing;
 using System.Linq.Expressions;
+using System.Text.Json.Nodes;
 using TencentCloud.Ocr.V20181119.Models;
 
 namespace OASystem.API.OAMethodLib
@@ -99,6 +100,38 @@ namespace OASystem.API.OAMethodLib
             //工作日日报
             workday_userRoots = workday_userRoots.OrderBy(it => it.base_info.date).ToList();
 
+
+            #region 特殊日期-不用打卡日期信息
+
+            //获取企业打卡规则
+            CorpCheckInRuleView corpCheckInRole = await _qiYeWeChatApiService.GetCheckIn_CorpCheckInOptionAsync();
+            if (corpCheckInRole.errcode != 0)
+            {
+                _result.Msg = "【企业微信】【打卡】【获取企业打卡规则】【Msg】" + corpCheckInRole.errmsg;
+                return _result;
+            }
+
+            int spe_offdays = 0;
+
+            GroupItem group = corpCheckInRole.group.Where(it => it.groupid == 4).FirstOrDefault();
+            if (group != null)
+            {
+                foreach (var item in group.spe_offdays)
+                {
+                    if (item.begtime_dt>= startDt && item.endtime_dt <= endDt)
+                    {
+                        if (item.endtime_dt > startDt)
+                        {
+                            TimeSpan ts = item.endtime_dt - item.begtime_dt;
+                            spe_offdays = (ts.Days + 1);
+                        }
+                    }
+                }
+            }
+            #endregion
+
+
+
             //获取 请假类型 Sp_Detail.template_id
             string leave_template_id = "C4NzTJCh1onCUK915rRkvy7Fh5Vqz4YbiEV9jrBY1";
             List<VacationLeaveTypeView> vacationLeaveTypes = await GetVacationLeaveTypes(leave_template_id);
@@ -565,7 +598,7 @@ namespace OASystem.API.OAMethodLib
                                         SubTypeId = 4,
                                         SubType = "旷工",
                                         Duration = 0,
-                                        StartTimeDt = Convert.ToDateTime(thisDay),
+                                        StartTimeDt = Convert.ToDateTime(goOutPunchItem.StartDt),
                                         Unit = "分钟",
                                         Reason ="数据来源【外出打卡】"
                                     };
@@ -638,12 +671,12 @@ namespace OASystem.API.OAMethodLib
                                             {
                                                 day_deduction = 0.00M;
                                             }
-                                            beLate_deduction += day_deduction; //迟到扣款 总额
+                                            early_deduction += day_deduction; //迟到扣款 总额
                                         }
                                         else if (timeLong >= 10 && timeLong < 60)
                                         {
                                             day_deduction = 50.00M;
-                                            beLate_deduction += day_deduction; //迟到扣款 总额
+                                            early_deduction += day_deduction; //迟到扣款 总额
                                             beLate_belate_ex.SubTypeId = 1;
                                             beLate_belate_ex.SubType = "早退";
                                         }
@@ -727,9 +760,15 @@ namespace OASystem.API.OAMethodLib
                                         Date_range date_Range = attendance.date_range;
 
                                         //筛选 不在工作日内的假勤申请
-                                        if ( Convert.ToDateTime(date_Range.new_begin_dt) < startDt  || Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd")) > endDt)
+
+                                        //if (Convert.ToDateTime(date_Range.new_begin_dt) < startDt || Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd")) > endDt)
+                                        //{
+                                        //    continue;
+                                        //}
+
+                                        if (Convert.ToDateTime(date_Range.new_begin_dt) < startDt || Convert.ToDateTime(date_Range.new_begin_dt) > endDt)
                                         {
-                                            continue;
+                                             continue;
                                         }
 
                                         string leave_starttime = date_Range.new_begin_dt.ToString("HH:mm");
@@ -871,6 +910,8 @@ namespace OASystem.API.OAMethodLib
                                             endTime1 = date_Range_new_end_dt.ToString("HH:mm:ss");
                                         }
 
+
+
                                         LeaveDetails leaveDetails1 = new LeaveDetails()
                                         {
                                             TypeId = leaveType,
@@ -923,6 +964,26 @@ namespace OASystem.API.OAMethodLib
 
                                     int leaveType = leave_item.TypeId;
                                     decimal new_duration = leave_item.New_Duration;
+
+                                    #region 处理跨月天数
+
+                                    if (leave_item.EndDt > endDt)
+                                    {
+                                        DateTime dt1 = Convert.ToDateTime(leave_item.StartDt.ToString("yyyy-MM-dd") + " 12:00");
+                                        DateTime dt2 = Convert.ToDateTime(leave_item.StartDt.ToString("yyyy-MM-dd") + " 09:00");
+                                        TimeSpan ts = Convert.ToDateTime(endDt.ToString("yyyy-MM-dd") + " 18:00") - Convert.ToDateTime(leave_item.StartDt.ToString("yyyy-MM-dd"));
+                                        if (dt2 >= leave_item.StartDt && leave_item.StartDt <= dt1)
+                                        {
+                                            new_duration = ts.Days + 1;
+                                        }
+                                        else
+                                        {
+                                            new_duration = ts.Days + 1.00M + 0.50M;
+                                        }
+                                    }
+
+                                    #endregion
+
                                     //计算餐补 假勤类型扣款
                                     CalculateTypeFee1(leaveDetails,leaveType, leave_item.DtType, leave_item.StartDt, leave_item.EndDt, amountPayable, work_days,
                                         new_duration,out leave_meals, out thisTypeDeduction);
@@ -1201,7 +1262,7 @@ namespace OASystem.API.OAMethodLib
                                         Date_range date_Range = attendance.date_range;
 
                                         //筛选 不在工作日内的假勤申请
-                                        if (startDt >= date_Range.new_begin_dt || Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd")) > endDt)
+                                        if (date_Range.new_begin_dt < startDt   || date_Range.new_end_dt < endDt)
                                         {
                                             continue;
                                         }
@@ -1339,7 +1400,7 @@ namespace OASystem.API.OAMethodLib
                     }
 
                     #region 应发合计 实发合计 扣款合计(假勤扣款,其他扣款,社保扣款,公积金代扣,个税扣款)
-
+                    int workDays = dk_work_days + spe_offdays;
                     decimal mealTotal = meal_subsidy - meal_deduction;  //餐补
                     decimal salaryTotal = 0.00M;
                     if (dk_work_days >= work_days)
@@ -1355,7 +1416,7 @@ namespace OASystem.API.OAMethodLib
                         }
                         else
                         {
-                            salaryTotal = (dk_work_days * dailyWage) + mealTotal + pm_wsInfo.OtherHandle;    //应发合计
+                            salaryTotal = (workDays * dailyWage) + mealTotal + pm_wsInfo.OtherHandle;    //应发合计
                         }
                             
                     }
@@ -1373,8 +1434,7 @@ namespace OASystem.API.OAMethodLib
                     pm_wsInfo.StartDate = startDt.ToString("yyyy-MM-dd");
                     pm_wsInfo.EndDate = endDt.ToString("yyyy-MM-dd");
                     pm_wsInfo.WorkDays = work_days;        //当月应出勤天数
-                    pm_wsInfo.RegularDays = dk_work_days;  //当月正常出勤天数
-
+                    pm_wsInfo.RegularDays = workDays;  //当月正常出勤天数
                     pm_wsInfo.SickLeave = sickLeaveTotal;           //病假
                     pm_wsInfo.SomethingFalse = personalLeaveTotal;  //事假
                     pm_wsInfo.LateTo = beLate_deduction;            //迟到
@@ -1399,8 +1459,6 @@ namespace OASystem.API.OAMethodLib
                     #endregion
 
                 }
-
-                
             }
             catch (Exception ex)
             {
@@ -1611,7 +1669,6 @@ namespace OASystem.API.OAMethodLib
                             if (duration % 1 > 0)
                             {
                                 typeDeduction = (personalkLeave_dailywage_day / 2.00M) * (duration / 0.50M);
-                                
                             }
                             else
                             {
@@ -1804,7 +1861,6 @@ namespace OASystem.API.OAMethodLib
                         }
                     }
                     break;
-
             }
         }
 
@@ -2109,7 +2165,7 @@ namespace OASystem.API.OAMethodLib
 
             if (date_Range_type == "halfday")
             {
-                mealDeduction = duration * 10; //餐补扣款 
+                mealDeduction = Math.Ceiling(duration) * 10; //餐补扣款 
             }
             else if (date_Range_type == "hour")
             {
@@ -2260,5 +2316,19 @@ namespace OASystem.API.OAMethodLib
 
             return workdays;
         }
+
+        /// <summary>
+        /// 获取一个类指定的属性值
+        /// </summary>
+        /// <param name="info">object对象</param>
+        /// <param name="field">属性名称</param>
+        /// <returns></returns>
+        public static object GetPropertyValue(object info, string field)
+        {
+            if (info == null) return null;
+            System.Type t = info.GetType();
+            IEnumerable<System.Reflection.PropertyInfo> property = from pi in t.GetProperties() where pi.Name.ToLower() == field.ToLower() select pi;
+            return property.First().GetValue(info, null);
+        }
     }
 }

+ 6 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/IQiYeWeChatApiService.cs

@@ -33,6 +33,12 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
         /// <returns></returns>
         Task<UserIdListView> GetUserIdListAsync();
 
+        /// <summary>
+        /// 获取企业所有打卡规则
+        /// </summary>
+        /// <returns></returns>
+        Task<CorpCheckInRuleView> GetCheckIn_CorpCheckInOptionAsync();
+
         /// <summary>
         /// 获取月打卡数据
         /// </summary>

+ 31 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/QiYeWeChatApiService.cs

@@ -293,6 +293,37 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
 
         #region 打卡
 
+        /// <summary>
+        /// 获取企业所有打卡规则
+        /// </summary>
+        /// <returns></returns>
+        public async Task<CorpCheckInRuleView> GetCheckIn_CorpCheckInOptionAsync()
+        {
+            CorpCheckInRuleView corpCheckInRuleView = new CorpCheckInRuleView();
+
+            //获取打卡数据 token
+            Access_TokenView access_Token = await GetTokenAsync(2);
+            if (access_Token.errcode != 0)
+            {
+                corpCheckInRuleView.errcode = access_Token.errcode;
+                corpCheckInRuleView.errmsg = string.Format("【企业微信】【获取月打卡数据】【Token】【Msg】{0}", access_Token.errmsg);
+                return corpCheckInRuleView;
+            }
+
+            string url = string.Format("/cgi-bin/checkin/getcorpcheckinoption?access_token={0}", access_Token.access_token);
+
+            var content = new StringContent(string.Empty, Encoding.UTF8, "application/json");
+            var create_Req = await _httpClient.PostAsync(url, content);
+            var stringResponse = await create_Req.Content.ReadAsStringAsync();
+
+            corpCheckInRuleView = System.Text.Json.JsonSerializer.Deserialize<CorpCheckInRuleView>(stringResponse,
+                new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+
+
+            return corpCheckInRuleView;
+        }
+
+
         /// <summary>
         /// 获取月打卡记录数据
         /// </summary>

+ 3 - 1
OASystem/OASystem.Api/OAMethodLib/SignalR/Hubs/ChatHub.cs

@@ -43,6 +43,7 @@ namespace OASystem.API.OAMethodLib.Hub.Hubs
             if (!UserStore.OnlineUser.Exists(u => u.ConnectionId == connid))
             {
                 result += "上线成功!" ;
+                
                 UserStore.OnlineUser.Add( new UserModel() { UserId = userId,ConnectionId = connid,GroupName = "FMGJ-OASystem" });
             }
             else
@@ -74,6 +75,8 @@ namespace OASystem.API.OAMethodLib.Hub.Hubs
                     {
                         var connId = Context.ConnectionId;
 
+                        //UserStore.OnlineUser.RemoveAll(u => u.UserId == tokenModelJwt.UserId);
+                        
                         UserStore.OnlineUser.Add(new UserModel() { UserId = tokenModelJwt.UserId, ConnectionId = connId, GroupName = "FMGJ-OASystem" });
 
                         _logger.LogInformation($"Client ConnectionId=> [[{connId}]] UserId=> [[{tokenModelJwt.UserId}]] Already Connection Server!");
@@ -105,7 +108,6 @@ namespace OASystem.API.OAMethodLib.Hub.Hubs
             int count = UserStore.OnlineUser.RemoveAll(u => u.ConnectionId == connId);
             if (model != null)
             {
-
                 var onlineUser = UserStore.OnlineUser.FindAll(u => u.GroupName == model.GroupName);
 
                 Clients.Clients(connId).ReceiveMessage(_common.ReceiveMessage($"[UserID=>{model.UserId} ConnectionId=> {model.ConnectionId} ] 已下线!"));

+ 26 - 1
OASystem/OASystem.Api/appsettings.json

@@ -172,7 +172,7 @@
     {
       "CTableId": 98, //CtableId 其他款项
       "PageIdDatas": [ //页面Id
-        
+
       ]
     },
     {
@@ -186,5 +186,30 @@
       "PageIdDatas": [ //页面Id
       ]
     }
+  ],
+
+  //消息通知类型
+  "MessageNotificationType": [
+    {
+      "TypeId": 0, //系统公告
+      "MsgTypeIds": [
+        1  // 公告消息
+      ]
+    },
+    {
+      "TypeId": 1, //操作通知
+      "MsgTypeIds": [
+        2, // 团组流程管控消息
+        3, // 团组业务操作消息
+        4, // 费用审核消息
+        5  // 签证进度更新消息
+      ]
+    },
+    {
+      "TypeId": 2, //任务通知
+      "MsgTypeIds": [
+        6 //任务进度更新消息
+      ]
+    }
   ]
 }

+ 1 - 1
OASystem/OASystem.Domain/Dtos/System/MsgDto.cs

@@ -57,7 +57,7 @@ namespace OASystem.Domain.Dtos.System
     /// 消息设置已读
     /// 请求dto
     /// </summary>
-    public class MsgSetReadDto : DtoBase
+    public class MsgSetReadDto : PortDtoBase
     {
         /// <summary>
         /// MsgAnthId

+ 3 - 2
OASystem/OASystem.Domain/Entities/System/Sys_Message.cs

@@ -28,9 +28,10 @@ namespace OASystem.Domain.Entities.System
 
         /// <summary>
         /// 发布者用户Id
+        /// 4 管理员 Id 
         /// </summary>
-        [SugarColumn(IsNullable = true,ColumnDataType = "int")]
-        public int IssuerId { get; set; }
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int IssuerId { get; set; } = 4;
 
         /// <summary>
         /// 团组Id,可为0

+ 86 - 0
OASystem/OASystem.Domain/ViewModels/QiYeWeChat/CheckInView.cs

@@ -6,6 +6,92 @@ using System.Threading.Tasks;
 
 namespace OASystem.Domain.ViewModels.QiYeWeChat
 {
+
+    #region 企业微信 API 获取企业打卡规则
+
+    /// <summary>
+    /// 企业微信 API 获取企业打卡规则
+    /// </summary>
+    public class CorpCheckInRuleView : ResponseBase
+    {
+        /// <summary>
+        /// 企业规则信息列表
+        /// </summary>
+        public List<GroupItem>? group { get; set; }
+    }
+
+    public class GroupItem
+    {
+        /// <summary>
+        /// 打卡规则类型,1:固定时间上下班;2:按班次上下班;3:自由上下班
+        /// </summary>
+        public int grouptype { get; set; }
+
+        /// <summary>
+        /// 打卡规则id
+        /// </summary>
+        public int groupid { get; set; }
+
+        /// <summary>
+        /// 打卡规则名称
+        /// </summary>
+        public string groupname { get; set; }
+
+        /// <summary>
+        /// 特殊日期-不用打卡日期时间戳
+        /// </summary>
+        public List<spe_offdaysItem> spe_offdays { get; set; }
+    }
+
+    /// <summary>
+    /// 特殊日期-不用打卡日期时间戳
+    /// </summary>
+    public class spe_offdaysItem
+    {
+        /// <summary>
+        /// 特殊日期备注
+        /// </summary>
+        public string notes { get; set; }
+
+        public long timestamp { get; set; }
+
+        public List<long> checkintime { get; set; }
+
+        public int type { get; set; }
+
+        /// <summary>
+        /// 开始时间戳
+        /// </summary>
+        public long begtime { get; set; }
+
+        /// <summary>
+        /// 开始时间
+        /// </summary>
+        public DateTime begtime_dt
+        {
+            get
+            {
+                return new DateTime(begtime * 10000000 + 621355968000000000L).ToLocalTime();
+            }
+        }
+
+        public long endtime { get; set; }
+
+        /// <summary>
+        /// 开始时间
+        /// </summary>
+        public DateTime endtime_dt
+        {
+            get
+            {
+                return new DateTime(endtime * 10000000 + 621355968000000000L).ToLocalTime();
+            }
+        }
+    }
+
+
+    #endregion
+
     /// <summary>
     /// 企业微信 API
     /// 打卡月数据

+ 47 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -257,7 +257,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
 
-            if (dto.PortType == 1 || dto.PortType == 2) //Web Or Android
+            if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //Web Or Android
             {
                 string sql = string.Format(@"Select Id,SalesQuoteNo,TourCode,JietuanOperator,TeamLevSId,TeamDid,TeamName,ClientName,
 	                                                ClientUnit,VisitCountry,VisitDate,VisitDays,VisitPNumber,TontractTime,
@@ -272,7 +272,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     result.Msg = "成功!";
                     result.Data = _DelegationInfo;
 
-
                     if (dto.PortType == 2)
                     {
                         var GroupProcessOperationDtoParam = new GroupProcessOperationDto();
@@ -319,6 +318,52 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                         result.Data = GroupProcessOperationDtoParam;
                     }
+                    else if (dto.PortType == 3)
+                    {
+                        var GroupProcessOperationDtoParam = new GroupProcessOperationDto();
+                        GroupProcessOperationDtoParam = _mapper.Map<DelegationInfoWebView, GroupProcessOperationDto>(_DelegationInfo);
+                        List<Crm_DeleClient> DeleClientArr = await _sqlSugar.Queryable<Crm_DeleClient>().Where(it => it.IsDel == 0).ToListAsync(); //客户信息
+                        List<Grp_TourClientList> _DeleClients = await _sqlSugar.Queryable<Grp_TourClientList>().Where(it => it.IsDel == 0 && it.DiId == dto.Id).ToListAsync(); // 接团客户名单
+                        List<Crm_CustomerCert> _CustomerCerts = await _sqlSugar.Queryable<Crm_CustomerCert>().Where(it => it.IsDel == 0 && it.SdId == 773).ToListAsync(); // 身份证类型证件信息
+                        List<Crm_CustomerCompany> CompanyArr = await _sqlSugar.Queryable<Crm_CustomerCompany>().Where(it => it.IsDel == 0).ToListAsync();
+                        var TourClientListInfoArr = new List<TourClientListProcessInfo>();
+                        var timeParam = new DateTime();
+                        foreach (var item in _DeleClients)
+                        {
+                            var param = new TourClientListProcessInfo();
+                            var clientInfo = DeleClientArr.FirstOrDefault(x => x.Id == item.ClientId);
+                            if (clientInfo == null) clientInfo = new Crm_DeleClient();
+                            var clientIDInfo = _CustomerCerts.FirstOrDefault(x => x.DcId == item.ClientId); //身份证信息
+                            if (clientIDInfo == null) clientIDInfo = new Crm_CustomerCert();
+                            var Company = CompanyArr.FirstOrDefault(x => x.Id == clientInfo.CrmCompanyId);
+                            if (Company == null) Company = new Crm_CustomerCompany();
+
+                            param.IDCardNo = clientIDInfo.CertNo;
+                            param.Remark = item.Remark;
+                            param.BirthDay = DateTime.TryParse(clientInfo.BirthDay, out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
+                            param.FirstName = clientInfo.FirstName;
+                            param.LastName = clientInfo.LastName;
+                            param.CompanyFullName = Company.CompanyFullName;
+                            param.Job = clientInfo.Job;
+                            param.Sex = clientInfo.Sex;
+                            param.Phone = clientInfo.Phone;
+                            param.Pinyin = clientInfo.Pinyin;
+                            param.HotelSpecialNeeds = item.HotelSpecialNeeds;
+                            param.MealSpecialNeeds = item.MealSpecialNeeds;
+                            param.ShippingSpaceSpecialNeeds = item.ShippingSpaceSpecialNeeds;
+                            param.ShippingSpaceTypeId = item.ShippingSpaceTypeId;
+                            param.Id = item.Id;
+
+                            TourClientListInfoArr.Add(param);
+                        }
+
+                        GroupProcessOperationDtoParam.PortType = dto.PortType;
+                        GroupProcessOperationDtoParam.TourClientListInfos = TourClientListInfoArr;
+                        GroupProcessOperationDtoParam.VisitDate = DateTime.TryParse(GroupProcessOperationDtoParam.VisitDate, out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
+                        GroupProcessOperationDtoParam.TontractTime = DateTime.TryParse(GroupProcessOperationDtoParam.TontractTime, out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
+
+                        result.Data = GroupProcessOperationDtoParam;
+                    }
 
                 }
                 else result.Msg = "暂无该团组信息";

+ 2 - 2
OASystem/OASystem.Infrastructure/Repositories/System/MessageRepository.cs

@@ -222,8 +222,8 @@ namespace OASystem.Infrastructure.Repositories.System
                     foreach (var item in msgTypeData)
                     {
                         //1021	团组操作通知 1020	任务操作通知
-                        if (item.Id == 1020) item.UnReadCount = operationNotificationDataCount;
-                        else if (item.Id == 1021) item.UnReadCount = taskNotificationDataCount;
+                        if (item.Id == 1020) item.UnReadCount = taskNotificationDataCount;
+                        else if (item.Id == 1021) item.UnReadCount = operationNotificationDataCount ;
                     }
 
                     result.Code = 0;