Browse Source

计算工资 增加 获取请假模板信息 得到请假类型

leiy 1 year ago
parent
commit
4a1d4d4c06

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

@@ -217,6 +217,9 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> SalaryCalculatorAsync(SalaryCalculatorDto dto)
         {
+
+            var tepDetail = await _qiYeWeChatApiService.GetTemplateDetailAsync("C4NzTJCh1onCUK915rRkvy7Fh5Vqz4YbiEV9jrBY1");
+
             Result result = new Result();
             Stopwatch sw = new Stopwatch();
             sw.Start();

+ 302 - 285
OASystem/OASystem.Api/OAMethodLib/PayrollComputation.cs

@@ -4,6 +4,7 @@ using OASystem.Domain.Entities.PersonnelModule;
 using OASystem.Domain.ViewModels.PersonnelModule;
 using OASystem.Domain.ViewModels.QiYeWeChat;
 using OASystem.Infrastructure.Repositories.Groups;
+using TencentCloud.Ocr.V20181119.Models;
 
 namespace OASystem.API.OAMethodLib
 {
@@ -53,18 +54,23 @@ namespace OASystem.API.OAMethodLib
 
             List<Data> checkInDatas = checkIn.datas;
 
-            List<Sp_Info> sp_Infos = new List<Sp_Info>();
-            sp_Infos = await _qiYeWeChatApiService.GetApprovalDatasAsync(startDt, endDt); //时间段内所有 审批数据
-
-            if (sp_Infos.Count <= 0)
+            //请假
+            List<Sp_Detail> sp_leave_details = new List<Sp_Detail>();
+            sp_leave_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, 2, 1); //时间段内所有 已同意的 请假 审批数据
+            if (sp_leave_details.Count <= 0)
             {
-                string errMsg = startDt + " - " + endDt + "审批数据获取失败!";
+                string errMsg = startDt + " - " + endDt + "请假 审批数据获取失败!";
                 return _result;
             }
 
-            // 筛选 时间段内(请假时间,补卡时间) /审批类型(打卡补卡,请假)/审核通过的数据 
-            List<Sp_Info> sp_leave_InfosData = sp_Infos.Where(it => it.sp_status == 2 && it.spname == "请假" && it.leave.start_time_dt >= startDt && it.leave.start_time_dt <= endDt).ToList(); //请假
-            List<Sp_Info> sp_reissuecard_InfosData = sp_Infos.Where(it => it.sp_status == 2 && it.spname == "打卡补卡" && it.comm.FillingDt >= startDt && it.comm.FillingDt <= endDt).ToList();  //补卡
+            //打卡补卡
+            List<Sp_Detail> sp_reissuecard_details = new List<Sp_Detail>();
+            sp_reissuecard_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, 2, 2); //时间段内所有 已同意的 打卡补卡 审批数据
+            if (sp_reissuecard_details.Count <= 0)
+            {
+                string errMsg = startDt + " - " + endDt + "打卡补卡 审批数据获取失败!";
+                return _result;
+            }
 
             foreach (var pm_wsInfo in pm_WageSheetDattaSources)
             {
@@ -95,6 +101,7 @@ namespace OASystem.API.OAMethodLib
 
                 //打卡数据
                 Data? checkInData = checkInDatas.Where(it => it.base_info.name == itemName).FirstOrDefault();
+
                 if (checkInData == null) { continue; }
                 string acctid = checkInData.base_info.acctid; //用户Id
 
@@ -161,176 +168,186 @@ namespace OASystem.API.OAMethodLib
 
                 #region 请假类型金额/餐补 处理
 
-                List<Sp_Info> sp_leave_item_infosData = sp_leave_InfosData.Where(it => it.spname == "请假" && it.apply_name == itemName).ToList();
+                List<Sp_Detail> sp_leave_item_infosData = sp_leave_details.Where(it => it.applyer.userid == acctid).ToList();
 
                 List<Ex_Items> ex_Items = new List<Ex_Items>();//假勤 And 打卡备注集合
                 Ex_Items ex_Items_jq = new Ex_Items() { Type = "假勤" };   //假勤
                 List<Ex_Item> ex_ItemInfos = new List<Ex_Item>();
 
-                foreach (Sp_Info sp_item in sp_leave_item_infosData)
+                foreach (Sp_Detail sp_item in sp_leave_item_infosData)
                 {
-                    Leave? sp_leave = sp_item.leave;
-                    if (sp_leave != null)
+                    Apply_data? apply_data = sp_item.apply_data;
+                    if (apply_data != null)
                     {
+                        List<ContentsItem> contents = apply_data.contents;
+                        ContentsItem content_Vacation = contents.Where(it => it.control== "Vacation").FirstOrDefault();  //请假类型 
+                        ContentsItem content_Textarea = contents.Where(it => it.control == "Textarea").FirstOrDefault(); //多行文本 
 
-                        //请假时长
-                        double leaveLength = (sp_leave.end_time_dt - sp_leave.start_time_dt).TotalHours;
-
-                        string typeName = string.Empty;
-                        //leave_type 1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他
-                        switch (sp_leave.leave_type)
+                        if (content_Vacation != null)
                         {
-                            case 1:    //年假
-                                typeName = "年假";
-                                if (sp_leave.timeunit == 0) //半天
-                                {
-                                    meal_deduction += 10;
-                                }
-                                else if (sp_leave.timeunit == 1) //小时
-                                {
-                                    if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
-                                    {
-                                        meal_deduction += 10;
-                                    }
-                                    else if (sp_leave.duration > 7.5)
-                                    {
-                                        decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
-                                        meal_deduction += daysPrice;
-                                    }
-                                }
-                                break;
-                            case 2:    //事假 需调整
-                                typeName = "事假";
-                                if (sp_leave.timeunit == 0) //半天
-                                {
-                                    meal_deduction += 10;
-                                    personalLeaveTotal += dailyWage / 2;
-                                }
-                                else if (sp_leave.timeunit == 1) //小时
-                                {
-                                    if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
-                                    {
-                                        meal_deduction += 10;
-                                    }
-                                    else if (sp_leave.duration > 7.5)
-                                    {
-                                        decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
-                                        meal_deduction += daysPrice;
-                                    }
-                                }
-                                break;
-                            case 3:    //病假 需调整
-                                typeName = "病假";
-                                if (sp_leave.timeunit == 0) //半天
-                                {
-                                    meal_deduction += 10;
-                                    sickLeaveTotal += sickLeave_deduction / 2;
-                                }
-                                else if (sp_leave.timeunit == 1) //小时
-                                {
-                                    if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
-                                    {
-                                        meal_deduction += 10;
-                                    }
-                                    else if (sp_leave.duration > 7.5)
-                                    {
-                                        decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
-                                        meal_deduction += daysPrice;
-                                    }
-                                }
-                                break;
-                            case 4:    //调休假
-                                typeName = "调休假";
-                                if (sp_leave.timeunit == 0) //半天
-                                {
-                                    meal_deduction += 10;
-                                }
-                                else if (sp_leave.timeunit == 1) //小时
-                                {
-                                    if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
-                                    {
-                                        meal_deduction += 10;
-                                    }
-                                    else if (sp_leave.duration > 7.5)
-                                    {
-                                        decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
-                                        meal_deduction += daysPrice;
-                                    }
-                                }
-                                break;
-                            case 5:    //婚假
-                                typeName = "婚假";
-                                if (sp_leave.timeunit == 0) //半天
-                                {
-                                    meal_deduction += 10;
-                                }
-                                else if (sp_leave.timeunit == 1) //小时
-                                {
-                                    if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
-                                    {
-                                        meal_deduction += 10;
-                                    }
-                                    else if (sp_leave.duration > 7.5)
-                                    {
-                                        decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
-                                        meal_deduction += daysPrice;
-                                    }
-                                }
-                                break;
-                            case 6:    //产假
-                                typeName = "产假";
-                                if (sp_leave.timeunit == 0) //半天
-                                {
-                                    meal_deduction += 10;
-                                }
-                                else if (sp_leave.timeunit == 1) //小时
-                                {
-                                    if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
-                                    {
-                                        meal_deduction += 10;
-                                    }
-                                    else if (sp_leave.duration > 7.5)
-                                    {
-                                        decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
-                                        meal_deduction += daysPrice;
-                                    }
-                                }
-                                break;
-                            case 7:    //陪产假
-                                typeName = "陪产假";
-                                if (sp_leave.timeunit == 0) //半天
-                                {
-                                    meal_deduction += 10;
-                                }
-                                else if (sp_leave.timeunit == 1) //小时
-                                {
-                                    if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
-                                    {
-                                        meal_deduction += 10;
-                                    }
-                                    else if (sp_leave.duration > 7.5)
-                                    {
-                                        decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
-                                        meal_deduction += daysPrice;
-                                    }
-                                }
-                                break;
-                            default:
-                                break;
+                            Vacation vacation = content_Vacation.value.vacation;
+                            Attendance attendance = vacation.attendance; //假勤组件
+                            Selector selector = vacation.selector;       //请假类型
                         }
 
-                        Ex_Item ex_Item = new Ex_Item()
-                        {
-                            SubTypeId = sp_leave.leave_type,
-                            SubType = typeName,
-                            Start_time_dt = sp_leave.start_time_dt,
-                            End_time_dt = sp_leave.end_time_dt,
-                            Duration = sp_leave.duration,
-                            Reason = sp_leave.reason,
-                            Apply_time_dt = sp_item.apply_time_dt,
-                            Approval_name = sp_item.approval_name,
-                        };
-                        ex_ItemInfos.Add(ex_Item);
+                        //请假时长
+                        //double leaveLength = (sp_leave.end_time_dt - sp_leave.start_time_dt).TotalHours;
+
+                        //string typeName = string.Empty;
+                        ////leave_type 1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他
+                        //switch (sp_leave.leave_type)
+                        //{
+                        //    case 1:    //年假
+                        //        typeName = "年假";
+                        //        if (sp_leave.timeunit == 0) //半天
+                        //        {
+                        //            meal_deduction += 10;
+                        //        }
+                        //        else if (sp_leave.timeunit == 1) //小时
+                        //        {
+                        //            if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
+                        //            {
+                        //                meal_deduction += 10;
+                        //            }
+                        //            else if (sp_leave.duration > 7.5)
+                        //            {
+                        //                decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
+                        //                meal_deduction += daysPrice;
+                        //            }
+                        //        }
+                        //        break;
+                        //    case 2:    //事假 需调整
+                        //        typeName = "事假";
+                        //        if (sp_leave.timeunit == 0) //半天
+                        //        {
+                        //            meal_deduction += 10;
+                        //            personalLeaveTotal += dailyWage / 2;
+                        //        }
+                        //        else if (sp_leave.timeunit == 1) //小时
+                        //        {
+                        //            if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
+                        //            {
+                        //                meal_deduction += 10;
+                        //            }
+                        //            else if (sp_leave.duration > 7.5)
+                        //            {
+                        //                decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
+                        //                meal_deduction += daysPrice;
+                        //            }
+                        //        }
+                        //        break;
+                        //    case 3:    //病假 需调整
+                        //        typeName = "病假";
+                        //        if (sp_leave.timeunit == 0) //半天
+                        //        {
+                        //            meal_deduction += 10;
+                        //            sickLeaveTotal += sickLeave_deduction / 2;
+                        //        }
+                        //        else if (sp_leave.timeunit == 1) //小时
+                        //        {
+                        //            if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
+                        //            {
+                        //                meal_deduction += 10;
+                        //            }
+                        //            else if (sp_leave.duration > 7.5)
+                        //            {
+                        //                decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
+                        //                meal_deduction += daysPrice;
+                        //            }
+                        //        }
+                        //        break;
+                        //    case 4:    //调休假
+                        //        typeName = "调休假";
+                        //        if (sp_leave.timeunit == 0) //半天
+                        //        {
+                        //            meal_deduction += 10;
+                        //        }
+                        //        else if (sp_leave.timeunit == 1) //小时
+                        //        {
+                        //            if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
+                        //            {
+                        //                meal_deduction += 10;
+                        //            }
+                        //            else if (sp_leave.duration > 7.5)
+                        //            {
+                        //                decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
+                        //                meal_deduction += daysPrice;
+                        //            }
+                        //        }
+                        //        break;
+                        //    case 5:    //婚假
+                        //        typeName = "婚假";
+                        //        if (sp_leave.timeunit == 0) //半天
+                        //        {
+                        //            meal_deduction += 10;
+                        //        }
+                        //        else if (sp_leave.timeunit == 1) //小时
+                        //        {
+                        //            if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
+                        //            {
+                        //                meal_deduction += 10;
+                        //            }
+                        //            else if (sp_leave.duration > 7.5)
+                        //            {
+                        //                decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
+                        //                meal_deduction += daysPrice;
+                        //            }
+                        //        }
+                        //        break;
+                        //    case 6:    //产假
+                        //        typeName = "产假";
+                        //        if (sp_leave.timeunit == 0) //半天
+                        //        {
+                        //            meal_deduction += 10;
+                        //        }
+                        //        else if (sp_leave.timeunit == 1) //小时
+                        //        {
+                        //            if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
+                        //            {
+                        //                meal_deduction += 10;
+                        //            }
+                        //            else if (sp_leave.duration > 7.5)
+                        //            {
+                        //                decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
+                        //                meal_deduction += daysPrice;
+                        //            }
+                        //        }
+                        //        break;
+                        //    case 7:    //陪产假
+                        //        typeName = "陪产假";
+                        //        if (sp_leave.timeunit == 0) //半天
+                        //        {
+                        //            meal_deduction += 10;
+                        //        }
+                        //        else if (sp_leave.timeunit == 1) //小时
+                        //        {
+                        //            if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
+                        //            {
+                        //                meal_deduction += 10;
+                        //            }
+                        //            else if (sp_leave.duration > 7.5)
+                        //            {
+                        //                decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
+                        //                meal_deduction += daysPrice;
+                        //            }
+                        //        }
+                        //        break;
+                        //    default:
+                        //        break;
+                        //}
+
+                        //Ex_Item ex_Item = new Ex_Item()
+                        //{
+                        //    SubTypeId = sp_leave.leave_type,
+                        //    SubType = typeName,
+                        //    Start_time_dt = sp_leave.start_time_dt,
+                        //    End_time_dt = sp_leave.end_time_dt,
+                        //    Duration = sp_leave.duration,
+                        //    Reason = sp_leave.reason,
+                        //    Apply_time_dt = sp_item.apply_time_dt,
+                        //    Approval_name = sp_item.approval_name,
+                        //};
+                        //ex_ItemInfos.Add(ex_Item);
                     }
                 }
 
@@ -361,7 +378,7 @@ namespace OASystem.API.OAMethodLib
                 Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" };    //打卡
                 //List<Ex_Item> ex_reissuecard_Items = new List<Ex_Item>();
                 List<dynamic> ex_reissuecard_Items = new List<dynamic>();
-                List<Sp_Info> sp_reissuecard_item_InfosData = sp_reissuecard_InfosData.Where(it => it.apply_name == itemName).ToList();
+                List<Sp_Detail> sp_reissuecard_item_InfosData = sp_reissuecard_details.Where(it => it.applyer.userid == acctid).ToList();
 
                 #region 打卡异常处理 统计 1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常;
 
@@ -386,123 +403,123 @@ namespace OASystem.API.OAMethodLib
                     }
                 }
 
-                foreach (Sp_Info sp_reissuecard_item in sp_reissuecard_item_InfosData)
-                {
-                    DateTime apply_time_dt = sp_reissuecard_item.apply_time_dt; //申请时间
-                    List<string>? approval_name = sp_reissuecard_item.approval_name; //审核人
-
-                    Comm sp_comm = sp_reissuecard_item.comm;
-                    if (sp_comm != null)
-                    {
-                        if (sp_comm.applydata != null)
-                        {
-                            List<ApplyInfo> applyInfos = sp_comm.applydata;
-                            if (applyInfos.Count > 0)
-                            {
-                                //Ex_Item ex_reissuecard_Item = new Ex_Item();
-                                dynamic ex_reissuecard_Item = null;
-                                string text = applyInfos.Where(it => it.type == "text").FirstOrDefault().value.ToString(); //异常状态
-                                DateTime? datehour = applyInfos.Where(it => it.type == "datehour").FirstOrDefault().valueDt;//补卡时间
-                                string textarea = applyInfos.Where(it => it.type == "textarea").FirstOrDefault().value.ToString();//补卡事由
-                                if (text.Contains("未打卡"))
-                                {
-                                    ex_reissuecard_Item = new
-                                    {
-                                        SubTypeId = 0,
-                                        SubType = "未打卡",
-                                        title = text,
-                                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
-                                        textarea = textarea,
-                                        apply_time_dt = apply_time_dt,
-                                        approval_name = approval_name
-                                    };
-                                }
-                                else if (text.Contains("迟到"))
-                                {
-                                    ex_reissuecard_Item = new
-                                    {
-                                        SubTypeId = 1,
-                                        SubType = "迟到",
-                                        title = text,
-                                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
-                                        textarea = textarea,
-                                        apply_time_dt = apply_time_dt,
-                                        approval_name = approval_name
-                                    };
-                                }
-                                else if (text.Contains("早退"))
-                                {
-                                    ex_reissuecard_Item = new
-                                    {
-                                        SubTypeId = 2,
-                                        SubType = "早退",
-                                        title = text,
-                                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
-                                        textarea = textarea,
-                                        apply_time_dt = apply_time_dt,
-                                        approval_name = approval_name
-                                    };
-                                }
-                                else if (text.Contains("缺卡"))
-                                {
-                                    ex_reissuecard_Item = new
-                                    {
-                                        SubTypeId = 3,
-                                        SubType = "缺卡",
-                                        title = text,
-                                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
-                                        textarea = textarea,
-                                        apply_time_dt = apply_time_dt,
-                                        approval_name = approval_name
-                                    };
-                                }
-                                else if (text.Contains("旷工"))
-                                {
-                                    ex_reissuecard_Item = new
-                                    {
-                                        SubTypeId = 4,
-                                        SubType = "旷工",
-                                        title = text,
-                                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
-                                        textarea = textarea,
-                                        apply_time_dt = apply_time_dt,
-                                        approval_name = approval_name
-                                    };
-                                }
-                                else if (text.Contains("地点异常"))
-                                {
-                                    ex_reissuecard_Item = new
-                                    {
-                                        SubTypeId = 5,
-                                        SubType = "地点异常",
-                                        title = text,
-                                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
-                                        textarea = textarea,
-                                        apply_time_dt = apply_time_dt,
-                                        approval_name = approval_name
-                                    };
-                                }
-                                else if (text.Contains("设备异常"))
-                                {
-                                    ex_reissuecard_Item = new
-                                    {
-                                        SubTypeId = 6,
-                                        SubType = "设备异常",
-                                        title = text,
-                                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
-                                        textarea = textarea,
-                                        apply_time_dt = apply_time_dt,
-                                        approval_name = approval_name
-                                    };
-                                }
-                                if (ex_reissuecard_Item != null)
-                                {
-                                    ex_reissuecard_Items.Add(ex_reissuecard_Item);
-                                }
-                            }
-                        }
-                    }
-                }
+                //foreach (Sp_Info sp_reissuecard_item in sp_reissuecard_item_InfosData)
+                //{
+                //    DateTime apply_time_dt = sp_reissuecard_item.apply_time_dt; //申请时间
+                //    List<string>? approval_name = sp_reissuecard_item.approval_name; //审核人
+
+                //    Comm sp_comm = sp_reissuecard_item.comm;
+                //    if (sp_comm != null)
+                //    {
+                //        if (sp_comm.applydata != null)
+                //        {
+                //            List<ApplyInfo> applyInfos = sp_comm.applydata;
+                //            if (applyInfos.Count > 0)
+                //            {
+                //                //Ex_Item ex_reissuecard_Item = new Ex_Item();
+                //                dynamic ex_reissuecard_Item = null;
+                //                string text = applyInfos.Where(it => it.type == "text").FirstOrDefault().value.ToString(); //异常状态
+                //                DateTime? datehour = applyInfos.Where(it => it.type == "datehour").FirstOrDefault().valueDt;//补卡时间
+                //                string textarea = applyInfos.Where(it => it.type == "textarea").FirstOrDefault().value.ToString();//补卡事由
+                //                if (text.Contains("未打卡"))
+                //                {
+                //                    ex_reissuecard_Item = new
+                //                    {
+                //                        SubTypeId = 0,
+                //                        SubType = "未打卡",
+                //                        title = text,
+                //                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
+                //                        textarea = textarea,
+                //                        apply_time_dt = apply_time_dt,
+                //                        approval_name = approval_name
+                //                    };
+                //                }
+                //                else if (text.Contains("迟到"))
+                //                {
+                //                    ex_reissuecard_Item = new
+                //                    {
+                //                        SubTypeId = 1,
+                //                        SubType = "迟到",
+                //                        title = text,
+                //                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
+                //                        textarea = textarea,
+                //                        apply_time_dt = apply_time_dt,
+                //                        approval_name = approval_name
+                //                    };
+                //                }
+                //                else if (text.Contains("早退"))
+                //                {
+                //                    ex_reissuecard_Item = new
+                //                    {
+                //                        SubTypeId = 2,
+                //                        SubType = "早退",
+                //                        title = text,
+                //                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
+                //                        textarea = textarea,
+                //                        apply_time_dt = apply_time_dt,
+                //                        approval_name = approval_name
+                //                    };
+                //                }
+                //                else if (text.Contains("缺卡"))
+                //                {
+                //                    ex_reissuecard_Item = new
+                //                    {
+                //                        SubTypeId = 3,
+                //                        SubType = "缺卡",
+                //                        title = text,
+                //                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
+                //                        textarea = textarea,
+                //                        apply_time_dt = apply_time_dt,
+                //                        approval_name = approval_name
+                //                    };
+                //                }
+                //                else if (text.Contains("旷工"))
+                //                {
+                //                    ex_reissuecard_Item = new
+                //                    {
+                //                        SubTypeId = 4,
+                //                        SubType = "旷工",
+                //                        title = text,
+                //                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
+                //                        textarea = textarea,
+                //                        apply_time_dt = apply_time_dt,
+                //                        approval_name = approval_name
+                //                    };
+                //                }
+                //                else if (text.Contains("地点异常"))
+                //                {
+                //                    ex_reissuecard_Item = new
+                //                    {
+                //                        SubTypeId = 5,
+                //                        SubType = "地点异常",
+                //                        title = text,
+                //                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
+                //                        textarea = textarea,
+                //                        apply_time_dt = apply_time_dt,
+                //                        approval_name = approval_name
+                //                    };
+                //                }
+                //                else if (text.Contains("设备异常"))
+                //                {
+                //                    ex_reissuecard_Item = new
+                //                    {
+                //                        SubTypeId = 6,
+                //                        SubType = "设备异常",
+                //                        title = text,
+                //                        datehour = datehour == null ? "" : Convert.ToDateTime(datehour).ToString("yyyy-MM-dd HH:mm:ss"),
+                //                        textarea = textarea,
+                //                        apply_time_dt = apply_time_dt,
+                //                        approval_name = approval_name
+                //                    };
+                //                }
+                //                if (ex_reissuecard_Item != null)
+                //                {
+                //                    ex_reissuecard_Items.Add(ex_reissuecard_Item);
+                //                }
+                //            }
+                //        }
+                //    }
+                //}
 
                 if (ex_reissuecard_Items.Count > 0)
                 {

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

@@ -66,5 +66,37 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
         /// <param name="endDt"></param>
         /// <returns></returns>
         Task<List<Sp_Info>> GetApprovalDatasRedisAsync(DateTime startDt, DateTime endDt);
+
+        ///// <summary>
+        ///// 批量获取审批单号
+        ///// </summary>
+        ///// <param name="startDt"></param>
+        ///// <param name="endDt"></param>
+        ///// <param name="record_type">
+        ///// sp_status-审批单状态(1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付)
+        ///// </param>
+        ///// <returns></returns>
+        //Task<ApprovalInfoView> GetApprovalInfoAsync(DateTime startDt, DateTime endDt, int record_type);
+
+        /// <summary>
+        /// 批量获取审批详情
+        /// </summary>
+        /// <param name="startDt"></param>
+        /// <param name="endDt"></param>
+        /// <param name="sp_status">
+        /// sp_status-审批单状态(1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付)
+        /// </param>
+        /// <param name="record_type">
+        /// record_type - 审批单类型属性,1-请假;2-打卡补卡;3-出差;4-外出;5-加班; 6- 调班;7-会议室预定;8-退款审批;9-红包报销审批
+        /// </param>
+        /// <returns></returns>
+        Task<List<Sp_Detail>> GetApprovalDetailsAsync(DateTime startDt, DateTime endDt, int sp_status, int record_type);
+
+        /// <summary>
+        /// 获取审批模板详情
+        /// </summary>
+        /// <param name="template_id">模板Id</param>
+        /// <returns></returns>
+        Task<TemplateDetailView> GetTemplateDetailAsync(string template_id);
     }
 }

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

@@ -2,7 +2,10 @@
 using OASystem.Domain.ViewModels.JuHeExchangeRate;
 using OASystem.Domain.ViewModels.QiYeWeChat;
 using Org.BouncyCastle.Ocsp;
+using SqlSugar;
+using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Text.Json;
 using Ubiety.Dns.Core;
 
@@ -595,6 +598,215 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
             return sp_Infos;
         }
 
+        /// <summary>
+        /// 批量获取审批单号
+        /// </summary>
+        /// <param name="startDt"></param>
+        /// <param name="endDt"></param>
+        /// <param name="sp_status">
+        /// sp_status-审批单状态(1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付)
+        /// </param>
+        /// <param name="record_type">
+        /// record_type - 审批单类型属性,1-请假;2-打卡补卡;3-出差;4-外出;5-加班; 6- 调班;7-会议室预定;8-退款审批;9-红包报销审批
+        /// </param>
+        /// <returns></returns>
+        private async Task<ApprovalInfoView> GetApprovalInfoAsync(DateTime startDt,DateTime endDt,int sp_status, int record_type)
+        {
+            Stopwatch sw = new Stopwatch();
+            sw.Start();
+
+            ApprovalInfoView approvalInfoView = new ApprovalInfoView();
+
+            //获取所有打卡补卡,审批 数据 前后范围增加10天
+            DateTime sp_startDt = startDt.AddDays(-10);
+            DateTime sp_centerDt = sp_startDt.AddDays(30);
+            DateTime sp_endDt = endDt.AddDays(10);
+
+            //获取审批数据 token
+            Access_TokenView access_Token = await GetTokenAsync(5);
+            if (access_Token.errcode != 0)
+            {
+                approvalInfoView.errcode = access_Token.errcode;
+                approvalInfoView.errmsg = string.Format("【企业微信】【批量获取审批单号】【Token】【Msg】{0}", access_Token.errmsg);
+                return approvalInfoView;
+            }
+
+            string url = string.Format("/cgi-bin/oa/getapprovalinfo?access_token={0}", access_Token.access_token);
+
+            List<Dic> filters = new List<Dic> {
+                new Dic() { key = "sp_status", value = sp_status.ToString() },    //筛选条件 审核状态 2 已同意
+                new Dic() { key = "record_type", value = record_type.ToString() },  //筛选条件 审批单类型 请假 1
+            }; 
+
+            ApprovalInfo_Request approvalInfoReq = new ApprovalInfo_Request()
+            {
+                access_token = access_Token.access_token,
+                starttime = (uint)(startDt - _1970).TotalSeconds,
+                endtime = (uint)(endDt - _1970).TotalSeconds,
+                filters = filters.ToList(),
+            };
+            var json = System.Text.Json.JsonSerializer.Serialize(approvalInfoReq);
+            var content = new StringContent(json, Encoding.UTF8, "application/json");
+            var create_Req = await _httpClient.PostAsync(url, content);
+            var stringResponse = await create_Req.Content.ReadAsStringAsync();
+
+            approvalInfoView = System.Text.Json.JsonSerializer.Deserialize<ApprovalInfoView>(stringResponse,
+                new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+
+            List<string> sp_datas = new List<string>();
+            sp_datas.AddRange(approvalInfoView.sp_no_list);
+
+
+            int index = 0;
+            while (true)
+            {
+                if (string.IsNullOrEmpty(approvalInfoView.new_next_cursor)) break;
+                string new_cursor = approvalInfoView.new_next_cursor;
+                approvalInfoReq.new_cursor = new_cursor;
+                var while_json = System.Text.Json.JsonSerializer.Serialize(approvalInfoReq);
+                var while_content = new StringContent(while_json, Encoding.UTF8, "application/json");
+                var while_create_Req = await _httpClient.PostAsync(url, while_content);
+                var while_stringResponse = await while_create_Req.Content.ReadAsStringAsync();
+
+                approvalInfoView = System.Text.Json.JsonSerializer.Deserialize<ApprovalInfoView>(while_stringResponse,
+                    new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+
+                sp_datas.AddRange(approvalInfoView.sp_no_list); //追加数据
+                index++;
+            }
+
+            approvalInfoView.sp_no_list = sp_datas;
+
+            sw.Stop();
+            approvalInfoView.errmsg = approvalInfoView.errmsg + " 耗时:" + sw.Elapsed.TotalMilliseconds + "ms";
+            return approvalInfoView;
+        }
+
+        /// <summary>
+        /// 获取审批申请详情
+        /// </summary>
+        /// <param name="sp_no"></param>
+        /// <returns></returns>
+        private async Task<ApprovalDetailView> GetApprovalDetailAsync(string sp_no)
+        {
+            ApprovalDetailView ApprovalDetailView = new ApprovalDetailView();
+
+            if (string.IsNullOrEmpty(sp_no))
+            {
+                return ApprovalDetailView;
+            }
+            //获取审批数据 token
+            Access_TokenView access_Token = await GetTokenAsync(5);
+            if (access_Token.errcode != 0)
+            {
+                ApprovalDetailView.errcode = access_Token.errcode;
+                ApprovalDetailView.errmsg = string.Format("【企业微信】【审批申请详情】【Token】【Msg】{0}", access_Token.errmsg);
+                return ApprovalDetailView;
+            }
+
+            string url = string.Format("/cgi-bin/oa/getapprovaldetail?access_token={0}", access_Token.access_token);
+
+            ApprovalDetail_Request approvalDetail_Req = new ApprovalDetail_Request() {
+                access_token = access_Token.access_token,
+                sp_no = sp_no,
+            };
+
+            var json = System.Text.Json.JsonSerializer.Serialize(approvalDetail_Req);
+            var content = new StringContent(json, Encoding.UTF8, "application/json");
+            var create_Req = await _httpClient.PostAsync(url, content);
+            var stringResponse = await create_Req.Content.ReadAsStringAsync();
+
+            ApprovalDetailView = System.Text.Json.JsonSerializer.Deserialize<ApprovalDetailView>(stringResponse,
+                new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+
+
+            return ApprovalDetailView;
+        }
+
+        /// <summary>
+        /// 批量获取审批详情
+        /// </summary>
+        /// <param name="startDt"></param>
+        /// <param name="endDt"></param>
+        /// <param name="sp_status">
+        /// sp_status-审批单状态(1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付)
+        /// </param>
+        /// <param name="record_type">
+        /// record_type - 审批单类型属性,1-请假;2-打卡补卡;3-出差;4-外出;5-加班; 6- 调班;7-会议室预定;8-退款审批;9-红包报销审批
+        /// </param>
+        /// <returns></returns>
+        public async Task<List<Sp_Detail>> GetApprovalDetailsAsync(DateTime startDt, DateTime endDt,int sp_status, int record_type)
+        {
+
+            List<Sp_Detail> details = new List<Sp_Detail>();
+
+            Stopwatch sw = new Stopwatch();
+            sw.Start();
+            ApprovalInfoView approvalInfoView = new ApprovalInfoView();
+            approvalInfoView = await GetApprovalInfoAsync(startDt,endDt, sp_status,record_type);
+            if (approvalInfoView.errcode != 0)
+            {
+                return details;
+            }
+            //循环查询详情
+            foreach (var item in approvalInfoView.sp_no_list)
+            {
+                ApprovalDetailView approvalDetailView = new ApprovalDetailView();
+                approvalDetailView = await GetApprovalDetailAsync(item);
+                if (approvalDetailView.errcode != 0)
+                {
+                    Log.Error("【GetApprovalDetailsAsync】 record_type:" + record_type + " ErrorMsg:" + approvalDetailView.errmsg);
+                    break;
+                }
+                
+                details.Add(approvalDetailView.info);
+            }
+            sw.Stop();
+            double hs = sw.Elapsed.TotalMilliseconds;
+            return details;
+        }
+
+        /// <summary>
+        /// 获取审批模板详情
+        /// </summary>
+        /// <param name="template_id">模板Id</param>
+        /// <returns></returns>
+        public async Task<TemplateDetailView> GetTemplateDetailAsync(string template_id)
+        {
+            TemplateDetailView templateDetailView = new TemplateDetailView();
+
+            if (string.IsNullOrEmpty(template_id))
+            {
+                templateDetailView.errmsg = "template_id为空!";
+                return templateDetailView;
+            }
+            //获取审批数据 token
+            Access_TokenView access_Token = await GetTokenAsync(5);
+            if (access_Token.errcode != 0)
+            {
+                templateDetailView.errcode = access_Token.errcode;
+                templateDetailView.errmsg = string.Format("【企业微信】【审批申请详情】【Token】【Msg】{0}", access_Token.errmsg);
+                return templateDetailView;
+            }
+
+            string url = string.Format("/cgi-bin/oa/gettemplatedetail?access_token={0}", access_Token.access_token);
+
+            var approvalDetail_Req = new 
+            {
+                access_token = access_Token.access_token,
+                template_id = template_id,
+            };
+
+            var json = System.Text.Json.JsonSerializer.Serialize(approvalDetail_Req);
+            var content = new StringContent(json, Encoding.UTF8, "application/json");
+            var create_Req = await _httpClient.PostAsync(url, content);
+            var stringResponse = await create_Req.Content.ReadAsStringAsync();
+
+            templateDetailView = System.Text.Json.JsonSerializer.Deserialize<TemplateDetailView>(stringResponse,
+                new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+
+            return templateDetailView;
+        }
         #endregion
     }
 }

+ 76 - 1
OASystem/OASystem.Domain/Dtos/QiYeWeChat/ApprovalData_Request.cs

@@ -8,7 +8,7 @@ namespace OASystem.Domain.Dtos.QiYeWeChat
 {
     /// <summary>
     /// 企业微信 
-    /// 审批数据 Dto
+    /// 审批数据(旧) Dto
     /// </summary>
     public class ApprovalData_Request
     {
@@ -32,4 +32,79 @@ namespace OASystem.Domain.Dtos.QiYeWeChat
         /// </summary>
         public long? next_spnum { get; set; }
     }
+
+
+    /// <summary>
+    /// 企业微信 
+    /// 批量获取审批单号  Dto
+    /// </summary>
+    public class ApprovalInfo_Request
+    {
+        /// <summary>
+        /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取
+        /// </summary>
+        public string? access_token { get; set; }
+
+        /// <summary>
+        /// 审批单提交的时间范围,开始时间,UNix时间戳
+        /// </summary>
+        public long starttime { get; set; }
+
+        /// <summary>
+        /// 审批单提交的时间范围,结束时间,UNix时间戳
+        /// </summary>
+        public long endtime { get; set; }
+
+        /// <summary>
+        /// 分页查询游标,默认为空串,后续使用返回的new_next_cursor进行分页拉取
+        /// </summary>
+        public string? new_cursor { get; set; }
+
+        /// <summary>
+        /// 一次请求拉取审批单数量,默认值为100,上限值为100。若accesstoken为自建应用,仅允许获取在应用可见范围内申请人提交的表单,
+        /// 返回的sp_no_list个数可能和size不一致,开发者需用next_cursor判断表单记录是否拉取完
+        /// </summary>
+        public int size { get; set; } = 100;
+        /// <summary>
+        /// 筛选条件,可对批量拉取的审批申请设置约束条件,支持设置多个条件
+        /// key   筛选类型,包括:
+        /// key   template_id - 模板类型/模板id;
+        /// key   creator - 申请人;
+        /// key   department - 审批单提单者所在部门;
+        /// key   sp_status - 审批状态;
+        /// key   record_type - 审批单类型属性,1-请假;2-打卡补卡;3-出差;4-外出;5-加班; 6- 调班;7-会议室预定;8-退款审批;9-红包报销审批
+        /// key   注意:
+        /// key   1、仅“部门”支持同时配置多个筛选条件。
+        /// key   2、不同类型的筛选条件之间为“与”的关系,同类型筛选条件之间为“或”的关系
+        /// key   3、record_type筛选类型仅支持2021/05/31以后新提交的审批单,历史单不支持表单类型属性过滤
+        /// value 筛选值,对应为:template_id-模板id;creator-申请人userid ;department-所在部门id;sp_status-审批单状态(1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付)
+        /// </summary>
+        public List<Dic>? filters { get; set; }
+    }
+
+    public class Dic
+    {
+        public string key { get; set; }
+
+        public string value { get; set; }
+    }
+
+    /// <summary>
+    /// 企业微信
+    /// 获取审批申请详情 Dto
+    /// </summary>
+    public class ApprovalDetail_Request
+    {
+
+        /// <summary>
+        /// 调用接口凭证。必须使用审批应用或企业内自建应用的secret获取
+        /// </summary>
+        public string? access_token { get; set; }
+
+        /// <summary>
+        /// 审批单编号
+        /// </summary>
+        public string sp_no { get; set; }
+
+    }
 }

+ 540 - 0
OASystem/OASystem.Domain/ViewModels/QiYeWeChat/ApprovalDataView.cs

@@ -36,6 +36,543 @@ namespace OASystem.Domain.ViewModels.QiYeWeChat
         public List<Sp_Info>? data { get; set; }
     }
 
+    /// <summary>
+    /// 批量获取审批单号 View
+    /// </summary>
+    public class ApprovalInfoView : ResponseBase
+    {
+        /// <summary>
+        /// 审批单号列表,包含满足条件的审批申请
+        /// </summary>
+        public List<string>? sp_no_list { get; set; }
+
+        /// <summary>
+        /// 后续请求查询的游标,当返回结果没有该字段时表示审批单已经拉取完
+        /// </summary>
+        public string? new_next_cursor { get; set; }
+    }
+
+    /// <summary>
+    /// 审批申请详情 View
+    /// </summary>
+    public class ApprovalDetailView : ResponseBase
+    {
+        /// <summary>
+        /// 审批申请详情
+        /// </summary>
+        public Sp_Detail? info { get; set; }
+    }
+
+
+    /// <summary>
+    /// 申请人信息
+    /// </summary>
+    public class Applyer
+    {
+        /// <summary>
+        /// 申请人userid
+        /// </summary>
+        public string userid { get; set; }
+        /// <summary>
+        /// 申请人所在部门id
+        /// </summary>
+        public string partyid { get; set; }
+    }
+
+    /// <summary>
+    /// 分支审批人
+    /// </summary>
+    public class Approver
+    {
+        /// <summary>
+        /// 分支审批人userid
+        /// </summary>
+        public string userid { get; set; }
+    }
+
+    /// <summary>
+    /// 审批节点详情,一个审批节点有多个审批人
+    /// </summary>
+    public class DetailsItem
+    {
+        /// <summary>
+        /// 分支审批人
+        /// </summary>
+        public Approver approver { get; set; }
+        /// <summary>
+        /// 审批意见
+        /// </summary>
+        public string speech { get; set; }
+        /// <summary>
+        /// 分支审批人审批状态:1-审批中;2-已同意;3-已驳回;4-已转审;11-已退回;12-已加签;13-已同意并加签
+        /// </summary>
+        public int sp_status { get; set; }
+        /// <summary>
+        /// 节点分支审批人审批操作时间戳,0表示未操作
+        /// </summary>
+        public int sptime { get; set; }
+        /// <summary>
+        /// 节点分支审批人审批意见附件,media_id具体使用请参考:文档-获取临时素材
+        /// </summary>
+        public List<string> media_id { get; set; }
+    }
+
+    /// <summary>
+    /// 审批流程信息,可能有多个审批节点。
+    /// </summary>
+    public class Sp_recordItem
+    {
+        /// <summary>
+        /// 审批节点状态:1-审批中;2-已同意;3-已驳回;4-已转审;11-已退回;12-已加签;13-已同意并加签
+        /// </summary>
+        public int sp_status { get; set; }
+        /// <summary>
+        /// 节点审批方式:1-或签;2-会签
+        /// </summary>
+        public int approverattr { get; set; }
+        /// <summary>
+        /// 审批节点详情,一个审批节点有多个审批人
+        /// </summary>
+        public List<DetailsItem> details { get; set; }
+    }
+
+    /// <summary>
+    /// 抄送信息,可能有多个抄送节点
+    /// </summary>
+    public class NotifyerItem
+    {
+        /// <summary>
+        /// 节点抄送人userid
+        /// </summary>
+        public string userid { get; set; }
+    }
+
+    /// <summary>
+    /// 控件标题
+    /// </summary>
+    public class TitleItem
+    {
+        /// <summary>
+        /// 文本值 中文
+        /// </summary>
+        public string text { get; set; }
+        /// <summary>
+        /// 文本值 英文值
+        /// </summary>
+        public string lang { get; set; }
+    }
+
+    /// <summary>
+    /// 用户所选选项
+    /// </summary>
+    public class OptionsItem
+    {
+        /// <summary>
+        /// 选项key,选项的唯一id,可通过“获取审批模板详情”接口获得
+        /// </summary>
+        public string key { get; set; }
+        /// <summary>
+        /// 选项值,若配置了多语言则会包含中英文的选项值
+        /// </summary>
+        public List<TitleItem> value { get; set; }
+    }
+
+    /// <summary>
+    /// 请假类型,所选选项与假期管理关联,为假期管理中的假期类型
+    /// </summary>
+    public class Selector
+    {
+        /// <summary>
+        /// 选择类型:single-单选;multi-多选,在假勤控件中固定为单选
+        /// </summary>
+        public string type { get; set; }
+        /// <summary>
+        /// 用户所选选项
+        /// </summary>
+        public List<OptionsItem> options { get; set; }
+    }
+
+    /// <summary>
+    /// 假勤组件时间选择范围
+    /// </summary>
+    public class Date_range
+    {
+        /// <summary>
+        /// 时间展示类型:halfday-日期;hour-日期+时间
+        /// </summary>
+        public string type { get; set; }
+        /// <summary>
+        /// 开始时间
+        /// </summary>
+        public long new_begin { get; set; }
+        /// <summary>
+        /// 结束时间
+        /// </summary>
+        public long new_end { get; set; }
+        /// <summary>
+        /// 请假时长
+        /// </summary>
+        public int new_duration { get; set; }
+    }
+
+    /// <summary>
+    /// 每一天的分片时长信息
+    /// </summary>
+    public class Day_itemsItem
+    {
+        /// <summary>
+        /// 日期的00:00:00时间戳,Unix时间
+        /// </summary>
+        public long daytime { get; set; }
+        ///// <summary>
+        ///// 
+        ///// </summary>
+        //public List<string> time_sections { get; set; }
+        /// <summary>
+        /// 分隔当前日期的时长秒数
+        /// </summary>
+        public long duration { get; set; }
+    }
+
+    /// <summary>
+    /// 时长支持按天分片信息, 2020/10/01之前的历史表单不支持时长分片
+    /// </summary>
+    public class Slice_info
+    {
+        /// <summary>
+        /// 每一天的分片时长信息
+        /// </summary>
+        public List<Day_itemsItem> day_items { get; set; }
+        /// <summary>
+        /// 时长计算来源类型: 1--系统自动计算;2--用户修改
+        /// </summary>
+        public int state { get; set; }
+        /// <summary>
+        /// 总时长,单位是秒
+        /// </summary>
+        public long duration { get; set; }
+    }
+
+    /// <summary>
+    /// 假勤组件
+    /// </summary>
+    public class Attendance
+    {
+        /// <summary>
+        /// 假勤组件时间选择范围
+        /// </summary>
+        public Date_range date_range { get; set; }
+        /// <summary>
+        /// 假勤组件类型:1-请假;2-补卡;3-出差;4-外出;5-加班
+        /// </summary>
+        public int type { get; set; }
+        /// <summary>
+        /// 时长支持按天分片信息, 2020/10/01之前的历史表单不支持时长分片
+        /// </summary>
+        public Slice_info slice_info { get; set; }
+    }
+
+    /// <summary>
+    /// 假内容,即申请人在此组件内选择的请假信息
+    /// </summary>
+    public class Vacation
+    {
+        /// <summary>
+        /// 请假类型,所选选项与假期管理关联,为假期管理中的假期类型
+        /// </summary>
+        public Selector selector { get; set; }
+        /// <summary>
+        /// 假勤组件
+        /// </summary>
+        public Attendance attendance { get; set; }
+    }
+
+    /// <summary>
+    /// 控件值 ,包含了申请人在各种类型控件中输入的值,不同控件有不同的值,具体说明详见附录
+    /// </summary>
+    public class Value
+    {
+        /// <summary>
+        /// 此控件不显示在审批详情中,故value为空
+        /// </summary>
+        public object? tips { get; set; }
+        /// <summary>
+        /// 成员内容,即申请人在此控件选择的成员,多选模式下可能有多个
+        /// </summary>
+        public List<Member> members { get; set; }
+        /// <summary>
+        /// 部门内容,即申请人在此控件选择的部门,多选模式下可能有多个
+        /// </summary>
+        public List<Department> departments { get; set; }
+        /// <summary>
+        /// 文件内容,即申请人在此控件上传的文件内容,可能有多个
+        /// </summary>
+        public List<File_Info> files { get; set; }
+        /// <summary>
+        /// 明细内容,一个明细控件可能包含多个子明细
+        /// </summary>
+        public List<Children> children { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public List<string> stat_field { get; set; }
+        /// <summary>
+        /// 请假内容,即申请人在此组件内选择的请假信息
+        /// </summary>
+        public Vacation vacation { get; set; }
+        ///// <summary>
+        ///// 
+        ///// </summary>
+        //public List<string> sum_field { get; set; }
+        /// <summary>
+        /// 关联审批单的模板
+        /// </summary>
+        public List<Related_Approval> related_approval { get; set; }
+        ///// <summary>
+        ///// 
+        ///// </summary>
+        //public List<string> students { get; set; }
+        ///// <summary>
+        ///// 
+        ///// </summary>
+        //public List<string> classes { get; set; }
+        ///// <summary>
+        ///// 
+        ///// </summary>
+        //public List<string> docs { get; set; }
+        ///// <summary>
+        ///// 
+        ///// </summary>
+        //public List<string> wedrive_files { get; set; }
+    }
+
+    /// <summary>
+    /// 部门内容,即申请人在此控件选择的部门,多选模式下可能有多个
+    /// </summary>
+    public class Department 
+    {
+        /// <summary>
+        /// 部门id
+        /// </summary>
+        public string openapi_id { get; set; }
+
+        /// <summary>
+        /// 部门名
+        /// </summary>
+        public string name { get; set; }
+    }
+
+    /// <summary>
+    /// 成员内容,即申请人在此控件选择的成员,多选模式下可能有多个
+    /// </summary>
+    public class Member
+    {
+        /// <summary>
+        /// 成员的userid
+        /// </summary>
+        public string userid { get; set; }
+
+        /// <summary>
+        /// 成员名
+        /// </summary>
+        public string name { get; set; }
+    }
+
+    /// <summary>
+    /// 文件内容,即申请人在此控件上传的文件内容,可能有多个
+    /// </summary>
+    public class File_Info
+    {
+        /// <summary>
+        /// 文件的media_id
+        /// </summary>
+        public string file_id { get; set; }
+
+    }
+
+    /// <summary>
+    /// 明细内容,一个明细控件可能包含多个子明细
+    /// </summary>
+    public class Children
+    {
+        public List<ListInfo> list { get; set; }
+    }
+
+    public class ListInfo
+    {
+        public string control { get; set; }
+
+        public string id { get; set; }
+
+        public List<TitleItem> title { get; set; }
+
+        public ValueText value { get; set; }
+    }
+
+    public class ValueText
+    {
+        public string text { get; set; }
+    }
+
+    /// <summary>
+    /// 关联审批单的模板
+    /// </summary>
+    public class Related_Approval
+    {
+        /// <summary>
+        /// 关联审批单的模板名
+        /// </summary>
+        public List<TitleItem> template_names { get; set; }
+
+        /// <summary>
+        /// 关联审批单的审批单号
+        /// </summary>
+        public string sp_no { get; set; }
+
+        /// <summary>
+        /// 关联审批单的状态
+        /// </summary>
+        public int sp_status { get; set; }
+
+        /// <summary>
+        /// 关联审批单的提单时间
+        /// </summary>
+        public long create_time { get; set; }
+
+        /// <summary>
+        /// 关联审批单的提单者
+        /// </summary>
+        public string name { get; set; }
+    }
+
+
+    /// <summary>
+    /// 审批申请详情,由多个表单控件及其内容组成
+    /// </summary>
+    public class ContentsItem
+    {
+        /// <summary>
+        /// 控件类型:
+        /// Text-文本;Textarea-多行文本;Number-数字;Money-金额;Date-日期/日期+时间;
+        /// Selector-单选/多选;;Contact-成员/部门;Tips-说明文字;File-附件;Table-明细;
+        /// Attendance-假勤;Vacation-请假;PunchCorrection-补卡;DateRange-时长
+        /// </summary>
+        public string control { get; set; }
+        /// <summary>
+        /// 控件id
+        /// </summary>
+        public string id { get; set; }
+        /// <summary>
+        /// 控件名称 ,若配置了多语言则会包含中英文的控件名称
+        /// </summary>
+        public List<TitleItem> title { get; set; }
+        /// <summary>
+        /// 控件值 ,包含了申请人在各种类型控件中输入的值,不同控件有不同的值,具体说明详见附录
+        /// </summary>
+        public Value value { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public int display { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public int require { get; set; }
+    }
+
+    /// <summary>
+    /// 审批申请数据
+    /// </summary>
+    public class Apply_data
+    {
+        /// <summary>
+        /// 审批申请详情,由多个表单控件及其内容组成
+        /// </summary>
+        public List<ContentsItem> contents { get; set; }
+    }
+
+    /// <summary>
+    /// 审批详情
+    /// </summary>
+    public class Sp_Detail
+    {
+        /// <summary>
+        /// 审批编号
+        /// </summary>
+        public string sp_no { get; set; }
+        /// <summary>
+        /// 审批申请类型名称(审批模板名称)
+        /// </summary>
+        public string sp_name { get; set; }
+        /// <summary>
+        /// 申请单状态:1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付
+        /// </summary>
+        public int sp_status { get; set; }
+        /// <summary>
+        /// 审批模板id。可在“获取审批申请详情”、“审批状态变化回调通知”中获得,也可在审批模板的模板编辑页面链接中获得。
+        /// </summary>
+        public string template_id { get; set; }
+        /// <summary>
+        /// 审批申请提交时间,Unix时间戳
+        /// </summary>
+        public int apply_time { get; set; }
+        /// <summary>
+        /// 申请人信息
+        /// </summary>
+        public Applyer applyer { get; set; }
+        /// <summary>
+        /// 审批流程信息,可能有多个审批节点。
+        /// </summary>
+        public List<Sp_recordItem> sp_record { get; set; }
+        /// <summary>
+        /// 抄送信息,可能有多个抄送节点
+        /// </summary>
+        public List<NotifyerItem> notifyer { get; set; }
+        /// <summary>
+        /// 审批申请数据
+        /// </summary>
+        public Apply_data apply_data { get; set; }
+        /// <summary>
+        /// 审批申请备注信息,可能有多个备注节点
+        /// </summary>
+        public List<string> comments { get; set; }
+    }
+
+    /// <summary>
+    /// 审批申请备注信息
+    /// </summary>
+    public class Comment
+    {
+        /// <summary>
+        /// userid
+        /// </summary>
+        public Approver commentUserInfo { get; set; }
+
+        /// <summary>
+        /// unix时间戳
+        /// </summary>
+        public long commenttime { get; set; }
+
+        /// <summary>
+        /// 备注信息
+        /// </summary>
+        public string commentcontent { get; set; }
+
+        /// <summary>
+        /// commentid
+        /// </summary>
+        public string commentid { get; set; }
+
+        /// <summary>
+        /// 备注附件id,可能有多个,media_id具体使用请参考:文档-获取临时素材
+        /// </summary>
+        public List<string> media_id { get; set; }
+    }
+
+
+    #region 审批详情 (旧版)
+
+
     /// <summary>
     /// 审批基本信息
     /// </summary>
@@ -274,5 +811,8 @@ namespace OASystem.Domain.ViewModels.QiYeWeChat
                 return null;
             }
         } 
+
     }
+
+    #endregion
 }

+ 103 - 0
OASystem/OASystem.Domain/ViewModels/QiYeWeChat/TemplateDetailView.cs

@@ -0,0 +1,103 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.QiYeWeChat
+{
+    /// <summary>
+    /// 审批模板详情 View
+    /// </summary>
+    public class TemplateDetailView:ResponseBase
+    {
+        /// <summary>
+        /// 文本描述
+        /// </summary>
+        public List<ValueItem> template_names { get; set; }
+        /// <summary>
+        /// 模板控件信息
+        /// </summary>
+        public Template_content template_content { get; set; }
+    }
+
+    /// <summary>
+    /// 文本描述 中\英文
+    /// </summary>
+    public class ValueItem
+    {
+        /// <summary>
+        /// 中文描述
+        /// </summary>
+        public string text { get; set; }
+        /// <summary>
+        /// 英文描述
+        /// </summary>
+        public string lang { get; set; }
+    }
+
+    /// <summary>
+    /// 模板控件属性,包含了模板内控件的各种属性信息
+    /// </summary>
+    public class Property
+    {
+        /// <summary>
+        /// 控件类型:Text-文本;Textarea-多行文本;Number-数字;Money-金额;Date-日期/日期+时间;Selector-单选/多选;
+        /// Contact-成员/部门;Tips-说明文字;File-附件;Table-明细;Attendance-假勤控件;Vacation-请假控件;Location-位置;
+        /// RelatedApproval-关联审批单;Formula-公式;DateRange-时长
+        /// </summary>
+        public string control { get; set; }
+        /// <summary>
+        /// 控件id
+        /// </summary>
+        public string id { get; set; }
+        /// <summary>
+        /// 控件名称,若配置了多语言则会包含中英文的控件名称,默认为zh_CN中文
+        /// </summary>
+        public List<ValueItem> title { get; set; }
+        /// <summary>
+        /// 控件说明,向申请者展示的控件填写说明,若配置了多语言则会包含中英文的控件说明,默认为zh_CN中文
+        /// </summary>
+        public List<ValueItem> placeholder { get; set; }
+        /// <summary>
+        /// 是否必填:1-必填;0-非必填
+        /// </summary>
+        public int require { get; set; }
+        /// <summary>
+        /// 是否参与打印:1-不参与打印;0-参与打印
+        /// </summary>
+        public int un_print { get; set; }
+    }
+
+
+    public class Config
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public Selector selector { get; set; }
+    }
+
+    /// <summary>
+    /// 模板控件数组。模板详情由多个不同类型的控件组成,控件类型详细说明见附录。
+    /// </summary>
+    public class ControlsItem
+    {
+        /// <summary>
+        /// 模板控件属性,包含了模板内控件的各种属性信息
+        /// </summary>
+        public Property property { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public Config config { get; set; }
+    }
+
+    public class Template_content
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public List<ControlsItem> controls { get; set; }
+    }
+}