From c9da4f6067cbf841a8a95ca9e4dc8e2e744caa89 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 20 Nov 2023 18:09:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=8E=A5=E5=8F=A3=E5=92=8C=E6=94=B9=E5=8F=98=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 24Hour/Controllers/Common/CommonController.cs | 106 ++++++++++++++++-- 1 file changed, 94 insertions(+), 12 deletions(-) diff --git a/24Hour/Controllers/Common/CommonController.cs b/24Hour/Controllers/Common/CommonController.cs index f4dfa39..490a23c 100644 --- a/24Hour/Controllers/Common/CommonController.cs +++ b/24Hour/Controllers/Common/CommonController.cs @@ -364,6 +364,80 @@ namespace _24Hour.Controllers.Common _logs.WriteSysLogadd("所有预约信息", "通过Id查询预约信息", result, _db); return result; } + /// + /// 统计预约申请 + /// + /// + [HttpGet] + [Route("CountReservationInfo")] + public async Task CountReservationInfo() + { + try + { + var lawyerdata = await _db.Queryable() + .Where(x => x.state == 1) + .Where(x => x.IsDeleted == 0) + .Where(x => x.createuserId == _userdata.Id) + .CountAsync(); + result.result = new + { + CountApprovedReservation = lawyerdata, + }; + result.IsSucceed = true; + } + catch (Exception) + { + result.IsSucceed = false; + throw; + } + return result; + } + /// + /// 修改预约申请状态 + /// + /// + /// 律师预约申请=>lawyer + /// + /// + [HttpGet] + [Route("ChangeReservationState")] + public async Task ChangeReservationState(string id, string type, int state) + { + try + { + result.IsSucceed = false; + result.Message = "修改失败"; + if (type == "lawyer") + { + var data = await _db.Queryable().FirstAsync(x => x.Id == id); + if (data != null) + { + data.state = state; + _db.BeginTran(); + var num = await _db.Updateable(data) + .UpdateColumns(x => x.state) + .ExecuteCommandAsync(); + _db.CommitTran(); + if (num > 0) + { + result.IsSucceed = true; + result.result = "修改成功"; + } + } + } + else + { + result.IsSucceed = true; + result.result = "不支持的修改类型"; + } + } + catch (Exception ex) + { + _logger.LogInformation(ex.Message); + result.IsSucceed = false; + } + return result; + } /// /// app---根据当前登录人获取所有预约信息--type类型为:0律师服务,1远程会见,2远程接待 @@ -677,9 +751,9 @@ namespace _24Hour.Controllers.Common handleuser = q.receptionusername, operatorId = q.operatorId, operatorName = q.operatorName, - party=q.party, - partyIDcard=q.partyIDcard, - endtime=q.receptionEndtime, + party = q.party, + partyIDcard = q.partyIDcard, + endtime = q.receptionEndtime, lawyerunit = Unitdata?.unitname, location = "", courtname = "", @@ -1026,7 +1100,7 @@ namespace _24Hour.Controllers.Common //获取律师服务预约记录 var Lawyerdata = await _db.Queryable() //.WhereIF(!string.IsNullOrEmpty(_userdata.department), x => /*x.receptionuser == _userdata.department &&*/ (x.operatorId == _userdata.Id || x.operatorId == null)) - .Where(q => q.IsDeleted == 0 && !string.IsNullOrEmpty(q.receptionuser) && q.state != 2 && q.state != 3&&q.unitCode==_userdata.unitCode).ToArrayAsync(); + .Where(q => q.IsDeleted == 0 && !string.IsNullOrEmpty(q.receptionuser) && q.state != 2 && q.state != 3 && q.unitCode == _userdata.unitCode).ToArrayAsync(); // .Where(q => q.IsDeleted == 0 && q.receptionuser == _userdata.department && q.state != 2 && q.state != 3).ToArrayAsync(); Lawyerdata.ToList().ForEach(q => { @@ -2664,7 +2738,7 @@ namespace _24Hour.Controllers.Common public async Task Upload_Files1(IFormFile file) { Result outParm = new Result(); - return await Task.Run(() => + return await Task.Run(async () => { if (file.Length <= 0) { @@ -2678,10 +2752,9 @@ namespace _24Hour.Controllers.Common IFormFile file = Request.Form.Files.FirstOrDefault(); var fname = $@"{file.FileName}"; var hzname = $"{Path.GetExtension(fname)}"; - var _path = $"/CaseFile/card/{DateTime.Now.ToString("yyyy-MM-dd")}"; - var dic = Path.Combine(Environment.CurrentDirectory, "wwwroot"); - if (!string.IsNullOrEmpty(_path)) - dic += _path; + var _path = Path.Combine("CaseFile", "card", DateTime.Now.ToString("yyyy-MM-dd")); + var dic = Path.Combine(Environment.CurrentDirectory, "wwwroot", _path); + if (!System.IO.Directory.Exists(dic)) Directory.CreateDirectory(dic); var filename = $"{DateTime.Now:yyyyMMddHHmmssfff}{Path.GetExtension(fname)}"; @@ -2689,11 +2762,20 @@ namespace _24Hour.Controllers.Common var path = Path.Combine(dic, $"{filename}"); using (var stream = new FileStream(path, FileMode.OpenOrCreate)) { - file.CopyToAsync(stream).Wait(); + await file.CopyToAsync(stream); } - var __path = $"{_path}/{filename}"; + // var __path = $"{_path}/{filename}"; + var __path = Path.Combine(_path, filename); outParm.IsSucceed = true; - outParm.result = new { hzname = hzname, url = __path, tile = Path.GetFileNameWithoutExtension(file.FileName), size, DataPath = path, filePath = dic }; + outParm.result = new + { + hzname = hzname, + url = __path, + tile = Path.GetFileNameWithoutExtension(file.FileName), + size, + DataPath = path, + filePath = dic + }; } catch (Exception e) {