diff --git a/24Hour/Controllers/Common/LawyerArchivesController.cs b/24Hour/Controllers/Common/LawyerArchivesController.cs index a575e2c..80e9e29 100644 --- a/24Hour/Controllers/Common/LawyerArchivesController.cs +++ b/24Hour/Controllers/Common/LawyerArchivesController.cs @@ -374,30 +374,39 @@ namespace _24Hour.Controllers.Common if (reponse.IsSucceed == true) { var a = reponse.result; - var datd = new + if (a?.jzml?.Any() == true) { - id = a.Id, - lable = a.jzmc, - children = a.jzml.Where(x => x.fmlbh == null).OrderBy(x => x.mlsxh).Select(x => new + var datd = new { - id = x.Id, - lable = x.mlxsmc, - children = a.jzml.Where(q => q.fmlbh == x.mlbh).OrderBy(q => q.mlsxh).Select(q => new + id = a.Id, + lable = a.jzmc, + children = a.jzml.Where(x => x.fmlbh == null).OrderBy(x => x.mlsxh).Select(x => new { - id = q.Id, - lable = q.mlxsmc, - children = q.jzwj.OrderBy(e => e.wjsxh).Select(e => new + id = x.Id, + lable = x.mlxsmc, + children = a.jzml.Where(q => q.fmlbh == x.mlbh).OrderBy(q => q.mlsxh).Select(q => new { - id = e.wjxh, - lable = e.wjxsmc, - filepath = e.jpgwjlj + id = q.Id, + lable = q.mlxsmc, + children = q.jzwj.OrderBy(e => e.wjsxh).Select(e => new + { + id = e.wjxh, + lable = e.wjxsmc, + filepath = e.jpgwjlj + }) }) }) - }) - }; + }; - result.IsSucceed = true; - result.result = datd; + result.IsSucceed = true; + result.result = datd; + } + else + { + result.IsSucceed = false; + result.Message = "未找到对应的卷宗信息"; + + } } else { @@ -599,6 +608,180 @@ namespace _24Hour.Controllers.Common } } /// + /// 统计 总数 已读的 未读的 刻录 + /// + /// + [HttpGet] + [Route("Countinfo")] + public async Task Countinfo() + { + try + { + var registerCount = await _db.Queryable().Where(x => x.unitcode == _userdata.unitCode).CountAsync(x => x.IsDeleted == 0); + var readcount = await _db.Queryable().Where(x => x.unitcode == _userdata.unitCode).CountAsync(x => x.IsDeleted == 0 && x.status != 0); + var unreadcount = await _db.Queryable().Where(x => x.unitcode == _userdata.unitCode).CountAsync(x => x.IsDeleted == 0 && x.status == 0); + var burnedcount = await _db.Queryable().Where(x => x.unitcode == _userdata.unitCode).CountAsync(x => x.IsDeleted == 0 && (x.copyStatus == 2 || x.copyStatus == 3)); + + result.result = new + { + registerCount = registerCount, + readcount = readcount, + unreadcount = unreadcount, + burnedcount = burnedcount, + }; + result.IsSucceed = true; + } + catch + { + result.result = new + { + registerCount = 0, + readcount = 0, + unreadcount = 0, + burnedcount = 0, + }; + result.IsSucceed = false; + } + return result; + } + /// + /// 统计近7天阅卷登记情况 + /// + /// + [HttpGet] + [Route("CountRegistSevendays")] + public async Task CountRegistSevendays() + { + try + { + var start = DateTime.Now.AddDays(-7).Date; + var end = DateTime.Now.Date; + var registerCount = await _db.Queryable() + .Where(x => x.createTime.Value.Date >= start && x.createTime.Value.Date <= end) + .Where(x => x.unitcode == _userdata.unitCode) + .Where(x => x.IsDeleted == 0) + .ToListAsync(); + var a = DateTime.Now.Date; + var b = DateTime.Now.AddDays(-1).Date; + var c = DateTime.Now.AddDays(-2).Date; + var d = DateTime.Now.AddDays(-3).Date; + var e = DateTime.Now.AddDays(-4).Date; + var f = DateTime.Now.AddDays(-5).Date; + var g = DateTime.Now.AddDays(-6).Date; + + var da = registerCount.Count(x => x.createTime.Value.Date == a); + var db = registerCount.Count(x => x.createTime.Value.Date == b); + var dc = registerCount.Count(x => x.createTime.Value.Date == c); + var dd = registerCount.Count(x => x.createTime.Value.Date == d); + var de = registerCount.Count(x => x.createTime.Value.Date == e); + var df = registerCount.Count(x => x.createTime.Value.Date == f); + var dg = registerCount.Count(x => x.createTime.Value.Date == g); + + result.result = new[] + { + new + { + date=g.ToShortDateString(), + count=dg + }, + new + { + date=f.ToShortDateString(), + count=df + }, + new + { + date=e.ToShortDateString(), + count=de + }, + new + { + date=d.ToShortDateString(), + count=dd + }, + new + { + date=c.ToShortDateString(), + count=dc + }, + new + { + date=b.ToShortDateString(), + count=db + },new + { + date=a.ToShortDateString(), + count=da + } + }; + result.IsSucceed = true; + } + catch + { + result.IsSucceed = false; + }; + return result; + } + /// + /// 按律师分类 + /// + /// + [HttpGet] + [Route("CountByLawyer")] + public async Task CountByLawyer() + { + try + { + // var allcount = await _db.Queryable().CountAsync(); + var registerCount = await _db.Queryable() + .LeftJoin((it,user)=>it.lawyerId==user.Id) + .GroupBy((it,user) => new { it.lawyerId }).Select((it,user) => new + { + name = user.name, + cardId = user.cardId, + departmentName = user.departmentName, + value = (double)SqlFunc.AggregateCount(it.lawyerId) + // count = (double)SqlFunc.AggregateCount(it.lawyerId) / (double)allcount + }).Take(10).ToListAsync(); + result.result = registerCount; + result.IsSucceed = true; + } + catch(Exception ex) + { + result.IsSucceed = true; + result.Message = "查询异常"; + logger.LogError(ex, "CountByLawyer"); + } + return result; + } + /// + /// 按卷宗案件类型分类 + /// + /// + [HttpGet] + [Route("CountByCaseType")] + public async Task CountByCaseType() + { + try + { + // var allcount = await _db.Queryable().CountAsync(); + var registerCount = await _db.Queryable() + .GroupBy(it => new { it.ajlbmc }).Select(it => new + { + name = it.ajlbmc, + value = SqlFunc.AggregateCount(it.ajlbmc) + //count = (double)SqlFunc.AggregateCount(it.ajlbmc) / (double)allcount + }).ToListAsync(); + result.result = registerCount; + result.IsSucceed = true; + } + catch + { + + } + return result; + } + /// /// 同步外网预约信息(不需要调用此接口) /// ///