/// <summary> /// 获取上传数据。 /// </summary> /// <returns></returns> protected override IEnumerable <WorkerAttendance> GetData(object parm) { Worker worker = parm as Worker; // 此处必须固定 1条 const int size = 1; var filtered = cache.Select($"worker_id = { worker.associated.worker_id }"); double d = filtered.Length * 1d / size; int total = (int)Math.Ceiling(d); for (int i = 0; i < total; i++) { yield return(new WorkerAttendance { projectCode = this.workers.projectCode, teamSysNo = this.workers.teamSysNo, dataList = from row in filtered.Skip(i * size).Take(size) select new Attendance { id = Convert.ToInt32(row["record_id"]), idcard = EncryptUtils.Encrypt(worker.associated.id_card, HjApiCaller.Appsecret), date = Convert.ToDateTime(row["record_time"]).ToString("yyyy-MM-dd HH:mm:ss"), direction = Attendance.ConvertDirection(Convert.ToInt32(row["type"])) } }); } }