diff --git a/24Hour/24Hour.csproj b/24Hour/24Hour.csproj
index cadecde..9f4b3c8 100644
--- a/24Hour/24Hour.csproj
+++ b/24Hour/24Hour.csproj
@@ -14,6 +14,7 @@
+
diff --git a/24Hour/Controllers/Common/CommonController.cs b/24Hour/Controllers/Common/CommonController.cs
index 3751c8d..c2ea143 100644
--- a/24Hour/Controllers/Common/CommonController.cs
+++ b/24Hour/Controllers/Common/CommonController.cs
@@ -32,6 +32,7 @@ namespace _24Hour.Controllers.Common
App_Sys_UserModel _userdata = new App_Sys_UserModel();//当前用户
private readonly List _Unitdata;//当前用户
private readonly ILogger _logger;//日志
+ DateTime unixStartTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
Result result = new Result();
public CommonController(ILogger logger, SqlSugarClient db, WriteSysLog logs, User user, WebSocketController SocketCon)
{
@@ -582,6 +583,42 @@ namespace _24Hour.Controllers.Common
appurl = ""
});
});
+ //获取文书签收记录
+ var Documentdata = await _db.Queryable()
+ .Where(q => q.zjhm == _userdata.cardId && q.zt == "03").ToArrayAsync();
+ Documentdata.ToList().ForEach(q =>
+ {
+ var da = Stagingdata.Where(x => x.Id == q.reservationId).FirstOrDefault();
+ var Unitdata = _Unitdata.Where(x => x.unitCode == q.dwbm).FirstOrDefault();
+ list.Add(new
+ {
+ type = 4,
+ Id = q.Id,
+ daId = da?.Id,
+ title = da?.title,
+ color = da?.color,
+ icon = da?.icon,
+ name = q.wsmc,//律师律师名称
+
+ lawyerunit = "",//律师事务所
+ location = "",//预约地点
+
+ phone = "",//联系方式
+ matter = q.ajmc,//事由
+ objectstr = "",//访问对象(案件名称)
+ Code = "",
+ state = q.zt,//状态
+ reason = "",//原因
+ sttime = unixStartTime.AddMilliseconds(long.Parse(q.zhxgsj)),//预约时间
+ ettime = "",
+ creationtime = "",
+ receptionuser ="",//办理人Id
+ username = "",//办理人名称
+ receive = "",//办接收人
+ notes = "",
+ appurl = ""
+ });
+ });
list = list.WhereIF(Commondata.matter.NotNull(), x => x.matter.Contains(Commondata.matter) || x.title.Contains(Commondata.matter) || x.name.Contains(Commondata.matter) || x.objectstr.Contains(Commondata.matter) || x.lawyerunit.Contains(Commondata.matter)).OrderByDescending(q => q.creationtime).ToList().Skip(Commondata.PageSize * (Commondata.PageIndex - 1)).Take(Commondata.PageSize).ToList();
result.IsSucceed = true;
result.result = list.ToList();
@@ -753,6 +790,42 @@ namespace _24Hour.Controllers.Common
appurl = ""
});
});
+ //获取文书签收记录
+ var Documentdata = await _db.Queryable()
+ .Where(q => q.zjhm == _userdata.cardId&&q.zt=="03").ToArrayAsync();
+ Documentdata.ToList().ForEach(q =>
+ {
+ var da = Stagingdata.Where(x => x.Id == q.reservationId).FirstOrDefault();
+ var Unitdata = _Unitdata.Where(x => x.unitCode == q.dwbm).FirstOrDefault();
+ list.Add(new
+ {
+ type = 4,
+ Id = q.Id,
+ daId = da?.Id,
+ title = da?.title,
+ color = da?.color,
+ icon = da?.icon,
+ name = q.wsmc,//律师律师名称
+
+ lawyerunit = "",//律师事务所
+ location = "",//预约地点
+
+ phone = "",//联系方式
+ matter = q.ajmc,//事由
+ objectstr = "",//访问对象(案件名称)
+ Code = "",
+ state = q.zt,//状态
+ reason = "",//原因
+ sttime = unixStartTime.AddMilliseconds(long.Parse(q.zhxgsj)),//预约时间
+ ettime = "",
+ creationtime = unixStartTime.AddMilliseconds(long.Parse(q.zhxgsj)),
+ receptionuser = "",//办理人Id
+ username = "",//办理人名称
+ receive = "",//办接收人
+ notes = "",
+ appurl = ""
+ });
+ });
list = list.OrderByDescending(q => q.creationtime).ToList();
result.IsSucceed = true;
result.result =new {count= list.ToList().Count(), list = list.Take(10).ToList() } ;
@@ -874,8 +947,8 @@ namespace _24Hour.Controllers.Common
//获取律师服务预约记录--判断单位,查询不同数据信息
var Lawyerdata = await _db.Queryable()
.WhereIF(Commondata.state!=null, x => x.state == Commondata.state)
- .WhereIF(Commondata.unitId.NotNull(), x => x.createuserId == _userdata.Id)
- .WhereIF(!Commondata.unitId.NotNull(), x => x.receptionuser == _userdata.Id)
+ .WhereIF(!Commondata.unitId.NotNull(), x => x.createuserId == _userdata.Id)
+ .WhereIF(Commondata.unitId.NotNull(), x => x.receptionuser == _userdata.Id)
.Where(q => q.IsDeleted == 0).ToArrayAsync();
Lawyerdata.ToList().ForEach(q =>
{
@@ -883,6 +956,7 @@ namespace _24Hour.Controllers.Common
var Unitdata = _Unitdata.Where(x => x.Id == q.unitId).FirstOrDefault();
list.Add(new
{
+ type=0,
Id = q.Id,
Unitname = Unitdata?.unitname,
title = da?.title,
@@ -900,8 +974,8 @@ namespace _24Hour.Controllers.Common
//获取远程会见预约记录--判断单位,查询不同数据信息
var Remotedata = await _db.Queryable()
.WhereIF(Commondata.state!=null, x => x.state == Commondata.state)
- .WhereIF(Commondata.unitId.NotNull(), x => x.createuserId == _userdata.Id)
- .WhereIF(!Commondata.unitId.NotNull(), x => x.meetwitId == _userdata.Id)
+ .WhereIF(!Commondata.unitId.NotNull(), x => x.createuserId == _userdata.Id)
+ .WhereIF(Commondata.unitId.NotNull(), x => x.meetwitId == _userdata.Id)
.Where(q => q.IsDeleted == 0).ToArrayAsync();
Remotedata.ToList().ForEach(q =>
{
@@ -909,6 +983,7 @@ namespace _24Hour.Controllers.Common
var Unitdata = _Unitdata.Where(x => x.Id == q.unitId).FirstOrDefault();
list.Add(new
{
+ type = 1,
Id = q.Id,
Unitname = Unitdata?.unitname,
title = da?.title,
@@ -926,8 +1001,8 @@ namespace _24Hour.Controllers.Common
//获取远程接待预约记录--判断单位,查询不同数据信息
var Receptiondata = await _db.Queryable()
.WhereIF(Commondata.state!=null, x => x.state == Commondata.state)
- .WhereIF(Commondata.unitId.NotNull(), x => x.createuserId == _userdata.Id)
- .WhereIF(!Commondata.unitId.NotNull(), x => x.meetwitId == _userdata.Id)
+ .WhereIF(!Commondata.unitId.NotNull(), x => x.createuserId == _userdata.Id)
+ .WhereIF(Commondata.unitId.NotNull(), x => x.meetwitId == _userdata.Id)
.Where(q => q.IsDeleted == 0).ToArrayAsync();
Receptiondata.ToList().ForEach(q =>
{
@@ -935,6 +1010,7 @@ namespace _24Hour.Controllers.Common
var Unitdata = _Unitdata.Where(x => x.Id == q.unitId).FirstOrDefault();
list.Add(new
{
+ type = 2,
Id = q.Id,
Unitname = Unitdata?.unitname,
title = da?.title,
@@ -952,13 +1028,16 @@ namespace _24Hour.Controllers.Common
//获取听证预约记录
var Hearingdata = await _db.Queryable()
.WhereIF(Commondata.state != null, x => x.state == Commondata.state)
- .Where(q => q.IsDeleted == 0 && q.unitId == _userdata.unitCode).ToArrayAsync();
+ .WhereIF(!Commondata.unitId.NotNull(), x => x.createuserId == _userdata.Id)
+ .WhereIF(Commondata.unitId.NotNull(), x => x.receptionuser == _userdata.Id)
+ .Where(q => q.IsDeleted == 0).ToArrayAsync();
Hearingdata.ToList().ForEach(q =>
{
var da = Stagingdata.Where(x => x.Id == q.reservationId).FirstOrDefault();
var Unitdata = _Unitdata.Where(x => x.Id == q.unitId).FirstOrDefault();
list.Add(new
{
+ type = 3,
Id = q.Id,
Unitname = Unitdata?.unitname,
title = da?.title,
@@ -973,6 +1052,29 @@ namespace _24Hour.Controllers.Common
creationtime = q.creationtime
});
});
+ //获取文书签收记录
+ var Documentdata = await _db.Queryable()
+ .Where(q => q.zjhm == _userdata.cardId).ToArrayAsync();
+ Documentdata.ToList().ForEach(q =>
+ {
+ var da = Stagingdata.Where(x => x.Id == q.reservationId).FirstOrDefault();
+ var Unitdata = _Unitdata.Where(x => x.unitCode == q.dwbm).FirstOrDefault();
+ list.Add(new
+ {
+ type = 4,
+ Id = q.Id,
+ Unitname = Unitdata?.unitname,
+ title = da?.title,
+ path = da?.path,
+ color = da?.color,
+ icon = da?.icon,
+ matter = q.wsmc,
+ objectstr = q.ajmc,
+ sttime = "",
+ ettime = "",
+ state = q.zt
+ });
+ });
//查询
list =list.ToList().WhereIF(Commondata.matter.NotNull(), q => q.matter.Contains(Commondata.matter)|| q.objectstr.Contains(Commondata.matter) || q.title.Contains(Commondata.matter)).ToList();
result.IsSucceed = true;
diff --git a/24Hour/Controllers/Common/DocumentController.cs b/24Hour/Controllers/Common/DocumentController.cs
index e03889b..46a01aa 100644
--- a/24Hour/Controllers/Common/DocumentController.cs
+++ b/24Hour/Controllers/Common/DocumentController.cs
@@ -23,7 +23,8 @@ namespace _24Hour.Controllers.Common
private readonly WriteSysLog _logs;//操作日志
App_Sys_UserModel _userdata = new App_Sys_UserModel();//当前用户
private readonly ILogger _logger;//日志
- Result result = new Result();
+ Result result = new Result();
+ DateTime unixStartTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
public DocumentController(ILogger logger, SqlSugarClient db, WriteSysLog logs, User user)
{
_logger = logger;
@@ -35,24 +36,24 @@ namespace _24Hour.Controllers.Common
#endregion
#region 文书签收增删改查
+
///
- /// APP--根据当前登录人文书签收分页查询
+ /// app-文书签收分页查询
///
///
///
[HttpPost]
- [Route("QueryDocumentuser")]
- public async Task QueryDocumentuser(App_DocumentInput Documentdata)
+ [Route("APP_QueryDocument")]
+ public async Task APP_QueryDocument(App_DocumentInput Documentdata)
{
- //查询文书签收预约记录
+ //查询文书签收
var list = await _db.Queryable()
- .WhereIF(Documentdata.signforuser != null, q => q.signforuser.Contains(Documentdata.signforuser))
- .WhereIF(Documentdata.signforphone != null, q => q.signforphone.Contains(Documentdata.signforphone))
- .WhereIF(Documentdata.signforcardId != null, q => q.signforcardId.Contains(Documentdata.signforcardId))
- .WhereIF(Documentdata.state != null, q => q.state == Documentdata.state)
- .WhereIF(Documentdata.StartTime != null && Documentdata.EndTime != null, q => q.signfortime >= Documentdata.StartTime && q.signfortime < Documentdata.EndTime.Value.AddDays(1))
- .Where(q => q.IsDeleted == 0 && q.signforcardId == _userdata.cardId).ToPageListAsync(Documentdata.PageIndex, Documentdata.PageSize);
- var data = new QueryResult(Documentdata, list.OrderByDescending(q => q.creationtime).ToList());
+ .WhereIF(Documentdata.state != null, q => q.zt == $"{Documentdata.state}")
+ .WhereIF(Documentdata.name != null, q => q.wsmc.Contains(Documentdata.name))
+ .WhereIF(Documentdata.StartTime != null && Documentdata.EndTime != null, q => unixStartTime.AddMilliseconds(long.Parse(q.sdsj)) >= Documentdata.StartTime && unixStartTime.AddMilliseconds(long.Parse(q.sdsj)) < Documentdata.EndTime.Value.AddDays(1))
+ .Where(q => q.zjhm == _userdata.cardId)
+ .ToPageListAsync(Documentdata.PageIndex, Documentdata.PageSize);
+ var data = new QueryResult(Documentdata, list.OrderByDescending(q => q.sdsj).ToList());
result.IsSucceed = true;
result.result = data;
return result;
@@ -69,14 +70,10 @@ namespace _24Hour.Controllers.Common
{
//查询文书签收
var list = await _db.Queryable()
- .WhereIF(Documentdata.signforuser != null, q => q.signforuser.Contains(Documentdata.signforuser))
- .WhereIF(Documentdata.signforphone != null, q => q.signforphone.Contains(Documentdata.signforphone))
- .WhereIF(Documentdata.signforcardId != null, q => q.signforcardId.Contains(Documentdata.signforcardId))
- .WhereIF(Documentdata.unitId != null, q => q.unitId.Contains(Documentdata.unitId))
- .WhereIF(Documentdata.state != null, q => q.state == Documentdata.state)
- .WhereIF(Documentdata.StartTime != null && Documentdata.EndTime != null, q => q.signfortime >= Documentdata.StartTime && q.signfortime < Documentdata.EndTime.Value.AddDays(1))
- .Where(q => q.IsDeleted == 0).ToPageListAsync(Documentdata.PageIndex, Documentdata.PageSize);
- var data = new QueryResult(Documentdata, list.OrderByDescending(q => q.creationtime).ToList());
+ .WhereIF(Documentdata.state != null, q => q.zt == $"{Documentdata.state}")
+ .WhereIF(Documentdata.StartTime != null && Documentdata.EndTime != null, q => unixStartTime.AddMilliseconds(long.Parse(q.sdsj)) >= Documentdata.StartTime && unixStartTime.AddMilliseconds(long.Parse(q.sdsj)) < Documentdata.EndTime.Value.AddDays(1))
+ .ToPageListAsync(Documentdata.PageIndex, Documentdata.PageSize);
+ var data = new QueryResult(Documentdata, list.OrderByDescending(q => q.sdsj).ToList());
result.IsSucceed = true;
result.result = data;
return result;
@@ -84,7 +81,7 @@ namespace _24Hour.Controllers.Common
///
/// 添加文书签收
///
- ///
+ ///
///
[HttpPost]
[Route("AddDocument")]
@@ -94,8 +91,6 @@ namespace _24Hour.Controllers.Common
{
_db.BeginTran();
Documentdata.Id = Guid.NewGuid().ToString();
- Documentdata.createuserId = _userdata.Id.ToString();
- Documentdata.createusername = _userdata.name;
var num = await _db.Insertable(Documentdata).ExecuteCommandAsync();
_db.CommitTran();
if (num > 0)
@@ -118,7 +113,7 @@ namespace _24Hour.Controllers.Common
///
/// 修改文书签收预约
///
- ///
+ ///
///
[HttpPost]
[Route("UpdateDocument")]
@@ -146,41 +141,6 @@ namespace _24Hour.Controllers.Common
return result;
}
- ///
- /// 删除文书签收预约
- ///
- ///
- ///
- [HttpPost]
- [Route("DeleteDocument")]
- public async Task DeleteDocument(CurrencyDelete Currency)
- {
- try
- {
- var Deletelist = await _db.Queryable().In(q => q.Id, Currency.id).ToListAsync();
- Deletelist.ForEach(q =>
- {
- q.IsDeleted = 1;
- });
- _db.BeginTran();
- var num = await _db.Updateable(Deletelist).ExecuteCommandAsync();
- _db.CommitTran();
- if (num > 0)
- {
- result.IsSucceed = true;
- result.result = "删除成功";
- }
- }
- catch (System.Exception ex)
- {
- _db.RollbackTran();
- result.IsSucceed = false;
- result.Message = ex.Message;
- LogService.WriteLog(ex, "删除文书签收");
- }
- _logs.WriteSysLogadd("文书签收", "删除文书签收", result, _db);
- return result;
- }
#endregion
#region 文件签收更改状态
@@ -199,9 +159,9 @@ namespace _24Hour.Controllers.Common
var Documentbol = await _db.Queryable().Where(q => q.Id == Id).ToListAsync();
if (Documentbol.Count() > 0)
{
- Documentbol.FirstOrDefault().state = 1;
+ Documentbol.FirstOrDefault().zt = "04";
_db.BeginTran();
- var num = await _db.Updateable(Documentbol.FirstOrDefault()).UpdateColumns(it => new { it.state }).ExecuteCommandAsync();
+ var num = await _db.Updateable(Documentbol.FirstOrDefault()).UpdateColumns(it => new { it.zt }).ExecuteCommandAsync();
_db.CommitTran();
if (num > 0)
{
diff --git a/24Hour/Controllers/LoginController.cs b/24Hour/Controllers/LoginController.cs
index 2a63929..0ef418d 100644
--- a/24Hour/Controllers/LoginController.cs
+++ b/24Hour/Controllers/LoginController.cs
@@ -197,7 +197,8 @@ namespace _24Hour.Controllers
photo = date.photo,
duties = date.duties,
identity=date.identity,
- unitCode = "",
+ usertype = date.usertype,
+ unitCode = date.unitCode,
department = "",
token = tokenString
};
@@ -279,6 +280,8 @@ namespace _24Hour.Controllers
photo = date.photo,
duties = date.duties,
identity = date.identity,
+ usertype = date.usertype,
+ unitCode = date.unitCode,
token = tokenString
};
#endregion
@@ -420,6 +423,8 @@ namespace _24Hour.Controllers
photo = date.photo,
duties = date.duties,
identity = date.identity,
+ usertype = date.usertype,
+ unitCode = date.unitCode,
token = tokenString
};
#endregion
diff --git a/24Hour/Program.cs b/24Hour/Program.cs
index e4db607..f909365 100644
--- a/24Hour/Program.cs
+++ b/24Hour/Program.cs
@@ -2,21 +2,20 @@ using Elight.Logic;
using Elight.Utility;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Mvc.Authorization;
-using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using SqlSugar;
-using System.Data;
using System.Text;
-using System.Text.Json.Serialization;
-using System.Text.Json;
-using Microsoft.AspNetCore.Http.Json;
using _24Hour.Controllers.Common;
using System.IdentityModel.Tokens.Jwt;
+using Quartz.Impl;
+using Quartz;
+using Elight.Logic.Job;
+using Quartz.Spi;
+using Microsoft.IdentityModel.Logging;
+using System.Collections.Specialized;
+using System.Runtime.InteropServices;
#region builder
@@ -148,7 +147,7 @@ builder.Services.AddAuthentication(options =>
//builder.Services.AddAuthorization();
builder.Services.AddHttpContextAccessor();
builder.Services.AddScoped();
-builder.Services.TryAddSingleton(); //jwt
+builder.Services.TryAddSingleton();
builder.Services.TryAddSingleton(); //WriteSysLog
builder.Services.AddScoped(sp =>
{
@@ -163,8 +162,32 @@ builder.Services.AddScoped(sp =>
return db;
});
+#region ʱ
+// Quartz.NET
+builder.Services.TryAddSingleton();
+builder.Services.TryAddSingleton();
+builder.Services.TryAddSingleton();
+builder.Services.AddHostedService(); // עQuartz.NETйܷ
-
+//Task.Factory.StartNew(() =>
+//{
+// try
+// {
+// while (true)
+// {
+// Thread.Sleep(60 * 1000);
+// ClearMemory();
+// }
+// }
+// catch (Exception ex)
+// {
+// }
+//});
+//Task.Factory.StartNew(() =>
+//{
+// RunJob().Wait();
+//});
+#endregion
#endregion
#region APP
@@ -184,7 +207,7 @@ app.UseWebSockets(new WebSocketOptions
//app.UseMiddleware();
#endregion
app.UseStaticFiles();
-app.UseHttpsRedirection();
+//app.UseHttpsRedirection();
//·
app.UseRouting();
app.UseAuthentication(); // ֤м
@@ -204,3 +227,49 @@ app.UseSwaggerUI(c =>
#endregion
app.Run();
#endregion
+
+
+#region ʱ
+static void ClearMemory()
+{
+ try
+ {
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ }
+ catch (Exception ex)
+ {
+ }
+}
+static async Task RunJob()
+{
+ try
+ {
+ NameValueCollection props = new NameValueCollection
+ {
+ { "quartz.serializer.type", "binary" }
+ };
+ StdSchedulerFactory factory = new StdSchedulerFactory(props);
+ IScheduler scheduler = await factory.GetScheduler();
+ //
+ await scheduler.Start();
+ #region ͨϢÿ33ִ3
+ IJobDetail job3 = JobBuilder.Create()
+ .WithIdentity("job3", SchedulerConstants.DefaultGroup)
+ .Build();
+ var trigger3 = TriggerBuilder.Create()
+ .WithIdentity("trigger3") // һ
+ .StartAt(DateTime.Now) // ʼʱ
+ .ForJob("job3", SchedulerConstants.DefaultGroup) //ָһ
+ .WithCronSchedule("*/20 * * * * ?")
+ .UsingJobData("k", 321)
+ .Build();
+ await scheduler.ScheduleJob(job3, trigger3);
+ #endregion
+ }
+ catch (SchedulerException se)
+ {
+ await Console.Error.WriteLineAsync(se.ToString());
+ }
+}
+#endregion
diff --git a/Elight.Entity/AppMode/App_DocumentModel.cs b/Elight.Entity/AppMode/App_DocumentModel.cs
index 0ca1fb6..ceae1c4 100644
--- a/Elight.Entity/AppMode/App_DocumentModel.cs
+++ b/Elight.Entity/AppMode/App_DocumentModel.cs
@@ -19,86 +19,99 @@ namespace Elight.Entity
[DataMember]
[SugarColumn(IsPrimaryKey = true)]
public string? Id { get; set; }
- ///
- /// 单位Id
- ///
- [DataMember]
- public string? unitId { get; set; }
///
/// 文书编号
///
[DataMember]
- public string? documentnumber { get; set; }
+ public string? wsslbh { get; set; }
///
/// 文书名称
///
[DataMember]
- public string? name { get; set; }
+ public string? wsmc { get; set; }
///
- /// 签收人
+ /// 部门手受案号
///
[DataMember]
- public string? signforuser { get; set; }
+ public string? bmsah { get; set; }
///
- /// 签收人手机号
+ /// 单位编号
///
[DataMember]
- public string? signforphone { get; set; }
+ public string? dwbm { get; set; }
///
- /// 签收人身份证
+ /// 案件名称
///
[DataMember]
- public string? signforcardId { get; set; }
+ public string? ajmc { get; set; }
///
- /// 签收意见
+ /// 姓名
///
[DataMember]
- public string? signforopinion { get; set; }
+ public string? zrrxm { get; set; }
///
- /// 备注
+ /// 联系号码
///
[DataMember]
- public string? notes { get; set; }
+ public string? zrrlshm { get; set; }
///
- /// 签收时间
+ /// 身份证
///
[DataMember]
- public DateTime? signfortime { get; set; }
+ public string? zjhm { get; set; }
///
- /// 0:待签收,1已签收
+ /// 文书名称
///
[DataMember]
- public int state { get; set; }
+ public string? fwqwjmc { get; set; }
///
- /// 创建人
+ /// 登记时间
///
[DataMember]
- public string? createusername { get; set; }
+ public string? djsj { get; set; }
///
- /// 创建人Id
+ /// 办案检察官
///
[DataMember]
- public string? createuserId { get; set; }
-
+ public string? cbjcgbm { get; set; }
///
- /// 创建日期
+ /// 办案检察官手机号
///
[DataMember]
- public DateTime? creationtime { get; set; } = DateTime.Now;
-
+ public string? dhhm { get; set; }
+ ///
+ /// 存放时间
+ ///
+ [DataMember]
+ public string? sdsj { get; set; }
+ ///
+ /// 签收时间
+ ///
+ [DataMember]
+ public string? qmsj { get; set; }
+ ///
+ /// 状态 00:新建:01:待发送;02:已发送;03:待签收;04:已签收 ;99:已入卷
+ ///
+ [DataMember]
+ public string? zt { get; set; }
+ ///
+ /// 最新更新时间
+ ///
+ [DataMember]
+ public string? zhxgsj { get; set; }
///
- /// 是否删除:0:未删除、1:删除
+ /// 菜单类型
///
[DataMember]
- public int? IsDeleted { get; set; } = 0;
+ public string? reservationId { get; set; }
}
}
diff --git a/Elight.Logic/Elight.Logic.csproj b/Elight.Logic/Elight.Logic.csproj
index 6068d1a..9643df3 100644
--- a/Elight.Logic/Elight.Logic.csproj
+++ b/Elight.Logic/Elight.Logic.csproj
@@ -8,6 +8,7 @@
+
diff --git a/Elight.Logic/Job/BaseJob.cs b/Elight.Logic/Job/BaseJob.cs
new file mode 100644
index 0000000..54b9571
--- /dev/null
+++ b/Elight.Logic/Job/BaseJob.cs
@@ -0,0 +1,51 @@
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Elight.Logic.Job
+{
+ [DisallowConcurrentExecution]
+ public class BaseJob : IJob
+ {
+
+ public Stopwatch sw = new Stopwatch();
+ public string JobName { get; set; }
+ public string JobStatus { get; set; } = "任务失败";
+ public string JobResult { get; set; } = "*";
+
+ public BaseJob()
+ {
+ sw.Start();
+ }
+ public virtual Task Execute(IJobExecutionContext context)
+ {
+ return null;
+ }
+
+ public Task BaseExecute(Action action)
+ {
+ return Task.Run(() =>
+ {
+ try
+ {
+ action?.Invoke();
+ }
+ catch (Exception ex)
+ {
+ JobStatus = "任务异常";
+ JobResult = ex.StackTrace;
+ //LogHelper.WriteLogs($"{JobName}:耗时{(sw.ElapsedMilliseconds / 1000)}s", $"{ex.Message}", $"{ex.StackTrace}", true);
+ }
+ finally
+ {
+ sw.Stop();
+ Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm} {JobName}:耗时{(sw.ElapsedMilliseconds / 1000)}s-{JobStatus}-{JobResult}", $"{JobStatus}", $"{JobResult}");
+ }
+ });
+ }
+ }
+}
diff --git a/Elight.Logic/Job/JobFactory.cs b/Elight.Logic/Job/JobFactory.cs
new file mode 100644
index 0000000..5263844
--- /dev/null
+++ b/Elight.Logic/Job/JobFactory.cs
@@ -0,0 +1,46 @@
+using Microsoft.Extensions.DependencyInjection;
+using Quartz.Spi;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Elight.Logic.Job
+{
+ ///
+ /// 该工厂将一个IServiceProvider传入构造函数中,并实现IJobFactory接口。
+ ///
+ /// Author:mxg
+ /// CreatedTimed:2020-06-16 11:40
+ public class JobFactory : IJobFactory
+ {
+ private readonly IServiceProvider _serviceProvider;
+
+ public JobFactory(IServiceProvider serviceProvider)
+ {
+ _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
+ }
+
+ ///
+ /// 在这个方法中工厂必须返回Quartz调度程序所请求的IJob。在此实现中,我们直接委托给IServiceProvider,并让DI容器找到所需的实例。由于GetRequiredService的非泛型版本返回的是一个对象,因此我们必须在末尾将其强制转换成IJob。
+ ///
+ ///
+ ///
+ ///
+ public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
+ {
+ return (_serviceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob)!;
+ }
+
+ ///
+ /// 该ReturnJob方法是调度程序尝试返回(即销毁)工厂创建的作业的地方。不幸的是,使用内置的IServiceProvider没有这样做的机制。我们无法创建适合Quartz API所需的新的IScopeService,因此我们只能创建单例作业。
+ ///
+ ///
+ public void ReturnJob(IJob job)
+ {
+ // we let the DI container handler this
+ }
+ }
+}
diff --git a/Elight.Logic/Job/QuartzHostedService.cs b/Elight.Logic/Job/QuartzHostedService.cs
new file mode 100644
index 0000000..d0612c5
--- /dev/null
+++ b/Elight.Logic/Job/QuartzHostedService.cs
@@ -0,0 +1,55 @@
+using Elight.Utility;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Hosting;
+using Quartz;
+using Quartz.Spi;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection.Metadata;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Elight.Logic.Job
+{
+ public class QuartzHostedService : IHostedService
+ {
+ private readonly ISchedulerFactory _schedulerFactory;
+ private readonly IJobFactory _jobFactory;
+ private readonly WsJob _myJob;
+
+ public QuartzHostedService(ISchedulerFactory schedulerFactory, IJobFactory jobFactory, WsJob myJob, IConfiguration configuration)
+ {
+ _schedulerFactory = schedulerFactory;
+ _jobFactory = jobFactory;
+ _myJob = myJob;
+ }
+
+ public async Task StartAsync(CancellationToken cancellationToken)
+ {
+ IScheduler scheduler = await _schedulerFactory.GetScheduler(cancellationToken);
+ scheduler.JobFactory = _jobFactory;
+ #region 每33秒执行
+ IJobDetail job3 = JobBuilder.Create()
+ .WithIdentity("job3", SchedulerConstants.DefaultGroup)
+ .Build();
+ var trigger3 = TriggerBuilder.Create()
+ .WithIdentity("trigger3") // 给任务一个名字
+ .StartAt(DateTime.Now) // 设置任务开始时间
+ .ForJob("job3", SchedulerConstants.DefaultGroup) //给任务指定一个分组
+ .WithCronSchedule("*/20 * * * * ?")
+ .UsingJobData("k", 321)
+ .Build();
+ await scheduler.ScheduleJob(job3, trigger3, cancellationToken);
+ await scheduler.Start(cancellationToken);
+ #endregion
+ }
+
+ public async Task StopAsync(CancellationToken cancellationToken)
+ {
+ IScheduler scheduler = await _schedulerFactory.GetScheduler(cancellationToken);
+ await scheduler.Shutdown(cancellationToken);
+ }
+ }
+}
diff --git a/Elight.Logic/Job/WsJob.cs b/Elight.Logic/Job/WsJob.cs
new file mode 100644
index 0000000..f6605e1
--- /dev/null
+++ b/Elight.Logic/Job/WsJob.cs
@@ -0,0 +1,92 @@
+using Elight.Utility.logs;
+using Elight.Utility;
+using Newtonsoft.Json;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Elight.Entity;
+using Microsoft.Extensions.Logging;
+using SqlSugar;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.DependencyInjection;
+using java.sql;
+using org.omg.PortableServer;
+using System.Runtime.Intrinsics.X86;
+using Microsoft.OpenApi.Validations;
+using static com.sun.tools.@internal.xjc.reader.xmlschema.bindinfo.BIConversion;
+using Microsoft.Extensions.Configuration;
+
+namespace Elight.Logic.Job
+{
+ [DisallowConcurrentExecution]
+ public class WsJob : IJob
+ {
+ private readonly SqlSugarClient _db;//数据库
+ public WsJob(IConfiguration configuration)
+ {
+ var connectionString = configuration.GetSection("ConnectionStrings:MySQLConnString").Value;
+ _db = new SqlSugarClient(new ConnectionConfig
+ {
+ ConnectionString = connectionString,
+ DbType = SqlSugar.DbType.MySql,
+ IsAutoCloseConnection = true,
+ InitKeyType = InitKeyType.Attribute
+ });
+ }
+ public async Task Execute(IJobExecutionContext context)
+ {
+ Console.WriteLine("定时任务执行中...");
+ Console.WriteLine("定时任务执行中...");
+ JobDataMap datas = context.JobDetail.JobDataMap;
+ // 定时任务执行的代码
+ Console.WriteLine("定时任务执行中...");
+ var daa = new { data = "{\"token\":\"www.archives.net.cn\",\"dwbm\":\"640000\",\"zt\":\"03\"}" };
+ var msg = "";
+ var data = HttpHelper.Post("http://jhg.ahjiguang.cn:80/agyw/api/user/command/wssdapi/getwssdlist", daa, out msg);
+ var Results = JsonConvert.DeserializeObject(data);
+ var Documentlist = JsonConvert.DeserializeObject>(Results.data);
+ if (Documentlist.Count() > 0)
+ {
+ //await AddDocument(Documentlist);
+ _db.Dispose();
+ }
+ if (!string.IsNullOrEmpty(msg))
+ Console.WriteLine($"文书签收错误...{msg}");
+ //LogService.WriteLog(msg, "文书签收");
+ }
+
+
+ ///
+ /// 添加文书签收
+ ///
+ ///
+ ///
+ public async Task AddDocument(List Documentdata)
+ {
+ try
+ {
+ //获取app平台所有用户身份证
+ var usercardIds = _db.Queryable().Where(q => q.IsDeleted == 0 && q.usertype == 1).Select(q => q.cardId).ToList();
+ //获取app平台所有用户身份证
+ //var usercardIds = _db.Queryable().OrderByDescending(q=>q.i).ToList();
+ Documentdata = Documentdata.Where(q => usercardIds.Contains(q.zjhm)).ToList();
+ _db.BeginTran();
+ Documentdata.ForEach(q =>
+ {
+ q.Id = Guid.NewGuid().ToString();
+ });
+ //Documentdata.Id = Guid.NewGuid().ToString();
+ var num = await _db.Insertable(Documentdata).ExecuteCommandAsync();
+ _db.CommitTran();
+ }
+ catch (System.Exception ex)
+ {
+ _db.RollbackTran();
+ LogService.WriteLog(ex, "添加文书签收");
+ }
+ }
+ }
+}
diff --git a/Elight.Logic/Model/App_DocumentInput.cs b/Elight.Logic/Model/App_DocumentInput.cs
index 250850a..8b1542e 100644
--- a/Elight.Logic/Model/App_DocumentInput.cs
+++ b/Elight.Logic/Model/App_DocumentInput.cs
@@ -74,6 +74,6 @@ namespace Elight.Logic
/// 0:待签收,1已签收
///
[DataMember]
- public int state { get; set; }
+ public string? state { get; set; }
}
}
diff --git a/Elight.Logic/RequestResults.cs b/Elight.Logic/RequestResults.cs
new file mode 100644
index 0000000..f498cdf
--- /dev/null
+++ b/Elight.Logic/RequestResults.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Elight.Logic
+{
+ internal class RequestResults
+ {
+
+ public string? encryption { get; set; }
+ ///
+ /// 数据
+ ///
+ [DataMember]
+ public string? data { get; set; }
+ ///
+ /// 返回参数编号
+ ///
+ [DataMember]
+ public string? code { get; set; }
+ ///
+ /// 提示
+ ///
+ [DataMember]
+ public string? msg { get; set; }
+ }
+}