You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
3.7 KiB
109 lines
3.7 KiB
using AutoMapper; |
|
using Elight.Entity; |
|
using Elight.Entity.APPDto.Lawyer; |
|
using Elight.Entity.AppMode.Lawyer; |
|
using Elight.Logic; |
|
using Elight.Utility.Code; |
|
using Microsoft.AspNetCore.Authorization; |
|
using Microsoft.AspNetCore.Mvc; |
|
using SqlSugar; |
|
using System.Text; |
|
using static _24Hour.Controllers.Common.LawyerArchivesController; |
|
|
|
namespace _24Hour.Controllers.Common |
|
{ |
|
/// <summary> |
|
/// 律师服务 |
|
/// </summary> |
|
[ApiController] |
|
[Route("api/LawyerUnAuthorize")] |
|
public class LawyerArchivesUnAuthorizeController : Controller |
|
{ |
|
#region Identity |
|
private readonly SqlSugarClient _db;//数据库 |
|
private readonly ILogger<LawyerArchivesController> logger;//日志 |
|
|
|
private readonly IMapper mapper; |
|
public LawyerArchivesUnAuthorizeController(ILogger<LawyerArchivesController> _logger, SqlSugarClient db, IMapper _mapper) |
|
{ |
|
this.logger = _logger; |
|
_db = db; |
|
this.mapper = _mapper; |
|
} |
|
#endregion |
|
|
|
/// <summary> |
|
/// 一体机查询所有的未完成的预约信息 |
|
/// </summary> |
|
/// <returns></returns> |
|
[HttpGet("GetAllArchivesUncompleted")] |
|
public async Task<Result<IEnumerable<LawyerArchivesDto>>> GetAllArchivesUncompleted(string unitcode) |
|
{ |
|
var res = new Result<IEnumerable<LawyerArchivesDto>>(); |
|
var list = await _db.Queryable<LawyerArchives>() |
|
.Where(x => x.IsDeleted == 0) |
|
.Where(x => x.status != 2 && x.permissibleEndTime > DateTime.Now) |
|
.Where(x => x.unitcode == unitcode) |
|
.Where(x=>x.IsDeleted==0) |
|
.ToListAsync(); |
|
var data = mapper.Map<IEnumerable<LawyerArchivesDto>>(list); |
|
res.result = data; |
|
res.IsSucceed = true; |
|
return res; |
|
} |
|
/// <summary> |
|
/// 获取卷宗下所有的文件信息 |
|
/// </summary> |
|
/// <param name="jzid"></param> |
|
/// <returns></returns> |
|
[HttpPost("GetJzFileInfo")] |
|
public async Task<Result> GetJzFileInfo(IEnumerable<string> jzids) |
|
{ |
|
var result = new Result(); |
|
var list = await _db.Queryable<JZJBXX>() |
|
.Includes(x => x.jzml, q => q.jzwj) |
|
.Where(x => jzids.Contains(x.Id)) |
|
.ToListAsync(); |
|
var dtos = mapper.Map<List<JZJBXXDto>>(list); |
|
var listdata = dtos.Select(x => new |
|
{ |
|
jzid=x.Id, |
|
files = x.jzml.OrderBy(x => x.mlsxh) |
|
.SelectMany(e => e.jzwj.OrderBy(x => x.wjsxh)) |
|
.Select((q) => new |
|
{ |
|
order = q.wjsxh, |
|
fileid = q.Id, |
|
filepath = q.jpgwjlj |
|
}).OrderBy(x => x.order) |
|
}).ToList(); |
|
|
|
result.result = listdata; |
|
result.IsSucceed = true; |
|
return result; |
|
} |
|
/// <summary> |
|
/// 解密字符串信息 |
|
/// </summary> |
|
/// <param name="basestr"></param> |
|
/// <returns></returns> |
|
[HttpPost] |
|
[Route("DecodeData")] |
|
public Task<Result<string>> DecodeData(DecodeQRDataModel data) |
|
{ |
|
Result<string> result = new(); |
|
try |
|
{ |
|
result.result = Encoding.UTF8.GetString(Convert.FromBase64String(data.QRData)); |
|
result.IsSucceed = true; |
|
return Task.FromResult(result); |
|
} |
|
catch(Exception ex) |
|
{ |
|
logger.LogError(ex,""); |
|
result.IsSucceed = false; |
|
return Task.FromResult(result); |
|
} |
|
} |
|
} |
|
}
|
|
|