jianghaiqing 1 year ago
commit f9cbaf6598

@ -5,7 +5,7 @@ using Myshipping.Core.Entity;
namespace Myshipping.Application.Entity namespace Myshipping.Application.Entity
{ {
/// <summary> /// <summary>
/// /// 收发通模板
/// </summary> /// </summary>
[SugarTable("booking_template")] [SugarTable("booking_template")]
[Description("订舱收发通模板")] [Description("订舱收发通模板")]
@ -50,4 +50,31 @@ namespace Myshipping.Application.Entity
/// </summary> /// </summary>
public string TEL { get; set; } public string TEL { get; set; }
} }
/// <summary>
/// 收发通模板分享
/// </summary>
[SugarTable("booking_template_share")]
[Description("收发通模板分享")]
public class BookingTemplateShare : DBEntityTenant
{
/// <summary>
/// 模板ID
/// </summary>
public long TemplateId { get; set; }
/// <summary>
/// 分享用户Id
/// </summary>
public long ShareToId { get; set; }
/// <summary>
/// 分享用户
/// </summary>
public string ShareToName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
} }

@ -171,5 +171,17 @@ namespace Myshipping.Application
/// CNPTNo /// CNPTNo
/// </summary> /// </summary>
public string CNPTNo { get; set; } public string CNPTNo { get; set; }
/// <summary>
/// 箱满仓业务员
/// </summary>
[Description("箱满仓业务员")]
public string XMCYWY { get; set; }
/// <summary>
/// EMC Name accout
/// </summary>
[Description("EMC Name accout")]
public string EmcNameAccount { get; set; }
} }
} }

@ -813,6 +813,9 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
public List<BookingRemark> bookremark { get; set; } public List<BookingRemark> bookremark { get; set; }
public List<BookingStatusLogDto> statuslogs { get; set; }
public List<GoodsStatusList> GoodsStatusList { get; set; } public List<GoodsStatusList> GoodsStatusList { get; set; }
/// <summary> /// <summary>

@ -40,11 +40,11 @@ namespace Myshipping.Application
/// </summary> /// </summary>
/// <param name="model">订舱、截单EDI请求</param> /// <param name="model">订舱、截单EDI请求</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<string> SendBookingOrClosingEDI (BookingOrClosingEDIOrderDto model); Task<dynamic> SendBookingOrClosingEDI (BookingOrClosingEDIOrderDto model);
Task BachUpdate(BatchUpdate dto); Task BachUpdate(BatchUpdate dto);
Task<string> InnerBookingOrClosingEDI(BookingOrClosingEDIOrderDto model); Task<dynamic> InnerBookingOrClosingEDI(BookingOrClosingEDIOrderDto model);
Task<dynamic> SendBookingOrder(long[] ids); Task<dynamic> SendBookingOrder(long[] ids);

@ -49,12 +49,16 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingOrderSeaeEdi> _seaeedi; private readonly SqlSugarRepository<BookingOrderSeaeEdi> _seaeedi;
private readonly SqlSugarRepository<BookingOrderSeaeEdiCtn> _seaeedictn; private readonly SqlSugarRepository<BookingOrderSeaeEdiCtn> _seaeedictn;
private readonly ISysCacheService _cache; private readonly ISysCacheService _cache;
private readonly IBookingOrderService _rep;
private readonly SqlSugarRepository<BookingStatusLog> _repStatuslog; private readonly SqlSugarRepository<BookingStatusLog> _repStatuslog;
private readonly SqlSugarRepository<BookingOrderSeaeEdiTemplate> _repTemplate; private readonly SqlSugarRepository<BookingOrderSeaeEdiTemplate> _repTemplate;
private readonly IDjyWebsiteAccountConfigService _webAccountConfig; private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
private readonly SqlSugarRepository<BookingGoodsStatusConfig> _goodsStatusConfig;
private readonly SqlSugarRepository<BookingGoodsStatus> _goodsStatus;
public BookingOrderSeaeEdiService(ILogger<BookingOrderSeaeEdiService> logger, SqlSugarRepository<BookingOrderSeaeEdi> seaeedi, public BookingOrderSeaeEdiService(ILogger<BookingOrderSeaeEdiService> logger, SqlSugarRepository<BookingOrderSeaeEdi> seaeedi,
SqlSugarRepository<BookingOrderSeaeEdiCtn> seaeedictn, ISysCacheService cache, SqlSugarRepository<BookingStatusLog> repStatuslog, SqlSugarRepository<BookingOrderSeaeEdiCtn> seaeedictn, ISysCacheService cache, SqlSugarRepository<BookingStatusLog> repStatuslog,
SqlSugarRepository<BookingOrderSeaeEdiTemplate> repTemplate, SqlSugarRepository<BookingOrderSeaeEdiTemplate> repTemplate, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig,
SqlSugarRepository<BookingGoodsStatus> goodsStatus, IBookingOrderService rep,
IDjyWebsiteAccountConfigService webAccountConfig) IDjyWebsiteAccountConfigService webAccountConfig)
{ {
this._logger = logger; this._logger = logger;
@ -64,6 +68,9 @@ namespace Myshipping.Application
this._repStatuslog = repStatuslog; this._repStatuslog = repStatuslog;
this._webAccountConfig = webAccountConfig; this._webAccountConfig = webAccountConfig;
this._repTemplate = repTemplate; this._repTemplate = repTemplate;
this._goodsStatusConfig = goodsStatusConfig;
this._goodsStatus = goodsStatus;
this._rep = rep;
} }
/// <summary> /// <summary>
/// 获取数据 /// 获取数据
@ -375,9 +382,61 @@ namespace Myshipping.Application
if (type == "4") if (type == "4")
{ {
await _seaeedi.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdi { State = "已作废", SENDREMARK = SENDREMARK }); await _seaeedi.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdi { State = "已作废", SENDREMARK = SENDREMARK });
}
if (type == "3"|| type == "0"||type == "1") {
#region 插入货运动态
//配置中所有的货物状态
var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == order.CreatedUserId).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery
{
ConfigId = config.Id,
SystemCode = config.SystemCode,
StatusName = config.StatusName,
FinishTime = null,
FinishUser = null,
FinishUserId = null,
IsPublic = false,
ExtData = null,
Remark = null,
Sort = config.Sort
}).ToList();
var ConfigId = config.Where(x => x.StatusName == "已订舱").Select(x => x.ConfigId).First();
await _goodsStatus.InsertAsync(new BookingGoodsStatus
{
bookingId= Id,
ConfigId= ConfigId,
FinishTime=DateTime.Now,
FinishUser= order.CreatedUserName,
FinishUserId = order.CreatedUserId,
IsPublic=false
});
List<long> tslist = new List<long>();
tslist.Add((long)Id);
var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
if (!string.IsNullOrEmpty(itemcode))
{
if (itemcode == "true")
await _rep.SendBookingOrder(tslist.ToArray());
_logger.LogInformation(Id + "自动订舱货物状态推送成功!");
} }
} }
#endregion
}
} }
} }
#endregion #endregion

@ -197,6 +197,10 @@ namespace Myshipping.Application.Service.BookingOrderSeaeEdi.Dto
/// 状态 /// 状态
/// </summary> /// </summary>
public string State { get; set; } public string State { get; set; }
public List<BookingOrderSeaeEdiCtnDto> EdiCtn { get; set; } public List<BookingOrderSeaeEdiCtnDto> EdiCtn { get; set; }

@ -35,6 +35,8 @@ using Newtonsoft.Json.Linq;
using Myshipping.Application.Service.BookingOrder.Dto; using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Application.Enum; using Myshipping.Application.Enum;
using Myshipping.Core.Helper; using Myshipping.Core.Helper;
using Furion.TaskScheduler;
using System.Linq.Expressions;
namespace Myshipping.Application namespace Myshipping.Application
{ {
@ -264,6 +266,8 @@ namespace Myshipping.Application
public async Task SyncCustomer(List<DjyCustomerSyncDto> model) public async Task SyncCustomer(List<DjyCustomerSyncDto> model)
{ {
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var mlist = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var shiplist = await _codeForwarder.AsQueryable().ToListAsync();
foreach (var item in model) foreach (var item in model)
{ {
@ -272,7 +276,7 @@ namespace Myshipping.Application
{ {
throw Oops.Bah("简称未录入"); throw Oops.Bah("简称未录入");
} }
var m = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.ShortName == item.ShortName && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).FirstAsync(); var m = mlist.Where(x => x.ShortName == item.ShortName).FirstOrDefault();
var entity = item.Adapt<DjyCustomer>(); var entity = item.Adapt<DjyCustomer>();
if (m == null) if (m == null)
{ {
@ -306,7 +310,7 @@ namespace Myshipping.Application
if (entity.PropString.Contains("shipagency")) if (entity.PropString.Contains("shipagency"))
{ {
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync(); var ship = shiplist.Where(x => x.Code == entity.CodeName).FirstOrDefault();
if (ship == null) if (ship == null)
{ {
@ -371,7 +375,7 @@ namespace Myshipping.Application
if (entity.PropString.Contains("shipagency")) if (entity.PropString.Contains("shipagency"))
{ {
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync(); var ship = shiplist.Where(x => x.Code == entity.CodeName).FirstOrDefault();
if (ship == null) if (ship == null)
{ {
@ -417,7 +421,10 @@ namespace Myshipping.Application
public async Task<dynamic> SyncVesselDateList(List<DjyVesselInfoDto> model) public async Task<dynamic> SyncVesselDateList(List<DjyVesselInfoDto> model)
{ {
var mapcarrier = await _mapcarrier.Where(x => x.Module == "HeChuan").ToListAsync(); var mapcarrier = _mapcarrier.Where(x => x.Module == "HeChuan").ToList();
var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList();
var mlist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList();
var orderlist= _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList();
foreach (var item in model) foreach (var item in model)
{ {
@ -425,8 +432,8 @@ namespace Myshipping.Application
{ {
throw Oops.Bah("BSNO未录入"); throw Oops.Bah("BSNO未录入");
} }
var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var m = await _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.BSNO == item.BSNO && x.TenantId == UserManager.TENANT_ID).FirstAsync(); var m = mlist.Where(x => x.BSNO == item.BSNO).FirstOrDefault();
var entity = item.Adapt<DjyVesselInfo>(); var entity = item.Adapt<DjyVesselInfo>();
entity.Vessel = item.Vessel.ToUpper().Trim(); entity.Vessel = item.Vessel.ToUpper().Trim();
if (!string.IsNullOrEmpty(item.CARRIER)) if (!string.IsNullOrEmpty(item.CARRIER))
@ -449,7 +456,7 @@ namespace Myshipping.Application
if (!string.IsNullOrEmpty(item.CreatedUserName)) if (!string.IsNullOrEmpty(item.CreatedUserName))
{ {
entity.CreatedUserId = userlist.Result.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault(); entity.CreatedUserId = userlist.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault();
} }
if (string.IsNullOrEmpty(item.Voyno)) if (string.IsNullOrEmpty(item.Voyno))
{ {
@ -469,9 +476,9 @@ namespace Myshipping.Application
if (!string.IsNullOrEmpty(item.CARRIER) && !string.IsNullOrEmpty(item.Vessel) && (!string.IsNullOrEmpty(item.Voyno) || !string.IsNullOrWhiteSpace(item.VoynoInside))) if (!string.IsNullOrEmpty(item.CARRIER) && !string.IsNullOrEmpty(item.Vessel) && (!string.IsNullOrEmpty(item.Voyno) || !string.IsNullOrWhiteSpace(item.VoynoInside)))
{ {
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.CARRIERID == item.CARRIERID && x.VESSEL == item.Vessel && x.IsDeleted == false) var order = orderlist.Where(x => x.CARRIERID == item.CARRIERID && x.VESSEL == item.Vessel)
.WhereIF(!string.IsNullOrEmpty(item.Voyno), x => x.VOYNO == item.Voyno) .WhereIF(!string.IsNullOrEmpty(item.Voyno), x => x.VOYNO == item.Voyno)
.WhereIF(!string.IsNullOrEmpty(item.VoynoInside), x => x.VOYNOINNER == item.VoynoInside).ToListAsync(); .WhereIF(!string.IsNullOrEmpty(item.VoynoInside), x => x.VOYNOINNER == item.VoynoInside).ToList();
_logger.LogInformation($"同步船期_查询到{UserManager.TENANT_NAME}需要更新{order.Count()}条订舱数据"); _logger.LogInformation($"同步船期_查询到{UserManager.TENANT_NAME}需要更新{order.Count()}条订舱数据");
foreach (var it in order) foreach (var it in order)
@ -577,6 +584,9 @@ namespace Myshipping.Application
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var djycustomer = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); var djycustomer = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var goodsconfig = await _goodsStatusConfig.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); var goodsconfig = await _goodsStatusConfig.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false&& x.TenantId == UserManager.TENANT_ID).ToListAsync();
var linelist = await _repline.AsQueryable().Filter(null, true).Where(m => m.TenantId == UserManager.TENANT_ID).ToListAsync();
foreach (var model in list) foreach (var model in list)
{ {
if (string.IsNullOrWhiteSpace(model.BSNO)) if (string.IsNullOrWhiteSpace(model.BSNO))
@ -588,12 +598,12 @@ namespace Myshipping.Application
throw Oops.Bah("未录入创建人"); throw Oops.Bah("未录入创建人");
} }
var user = await _repUser.AsQueryable().Filter(null, true).Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).FirstAsync(); var user = userlist.Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).FirstOrDefault();
if (user == null) if (user == null)
{ {
throw Oops.Bah($"未匹配到创建人{model.CreatedUserName.Trim()}请联系管理员添加相关用户"); throw Oops.Bah($"未匹配到创建人{model.CreatedUserName.Trim()}请联系管理员添加相关用户");
} }
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.BSNO == model.BSNO && x.IsDeleted == false).FirstAsync(); var order = orderlist.Where(x => x.BSNO == model.BSNO ).FirstOrDefault();
if (order == null) if (order == null)
@ -677,7 +687,7 @@ namespace Myshipping.Application
} }
if (!string.IsNullOrEmpty(entity.LineName)) if (!string.IsNullOrEmpty(entity.LineName))
{ {
var line = _repline.AsQueryable().Filter(null, true).Where(m => m.TenantId == UserManager.TENANT_ID && m.LineName.Contains(entity.LineName)).FirstAsync(); var line = linelist.Where(m => m.LineName.Contains(entity.LineName)).FirstOrDefault();
if (line == null) if (line == null)
{ {
await _repline.InsertAsync(new DjyTenantLine await _repline.InsertAsync(new DjyTenantLine
@ -1663,10 +1673,12 @@ namespace Myshipping.Application
[SqlSugarUnitOfWork] [SqlSugarUnitOfWork]
public async Task SaveSyncVesselDate(List<DjyVesselDto> dto) public async Task SaveSyncVesselDate(List<DjyVesselDto> dto)
{ {
var infolist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList();
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
foreach (var item in dto) foreach (var item in dto)
{ {
var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).FirstOrDefault();
var model = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.TenantId == UserManager.TENANT_ID).First();
if (model != null) if (model != null)
{ {
model.ETA = item.ETA; model.ETA = item.ETA;
@ -1675,7 +1687,7 @@ namespace Myshipping.Application
await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync(); await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync();
} }
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); var order = orderlist.Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno).ToList();
bool issend = false; bool issend = false;
if (order != null) if (order != null)
{ {
@ -1800,6 +1812,7 @@ namespace Myshipping.Application
} }
} }
} }
@ -1812,16 +1825,16 @@ namespace Myshipping.Application
[SqlSugarUnitOfWork] [SqlSugarUnitOfWork]
public async Task SaveSyncGHVesselDate(List<DjyVesselGHDto> dto) public async Task SaveSyncGHVesselDate(List<DjyVesselGHDto> dto)
{ {
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
foreach (var item in dto) foreach (var item in dto)
{ {
//var model = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.TenantId == UserManager.TENANT_ID).First(); //var model = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.TenantId == UserManager.TENANT_ID).FirstOrDefault();
//model.ETA = item.ETA; //model.ETA = item.ETA;
//model.ETD = item.ETD; //model.ETD = item.ETD;
//model.ATD = item.ATD; //model.ATD = item.ATD;
//await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync(); //await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync();
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); var order = orderlist.Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno).ToList();
bool issend = false; bool issend = false;
if (order != null) if (order != null)
@ -2153,9 +2166,97 @@ namespace Myshipping.Application
} }
//推送钉钉消息 //推送钉钉消息
DingTalkGroupHelper.SendDingTalkGroupMessage("hechuanVesselExcepNotify", "船期获取异常提醒", msg); DingTalkGroupHelper.SendDingTalkGroupMessage("hechuanVesselExcepNotify", "船期获取异常提醒", msg);
//推送和川钉钉群,@具体操作
SyncVesselExcepAtOp(dto);
} }
} }
//[HttpPost("/DataSync/SyncVesselDateTest"), ApiUser(ApiCode = "SaveSyncVesselDate")]
//public async Task SyncVesselDateTest(List<DjyVesselExceptDto> dto)
private async Task SyncVesselExcepAtOp(List<DjyVesselExceptDto> dto)
{
var tenantId = UserManager.TENANT_ID;
SpareTime.DoOnce(1000, (tmr, l) =>
{
try
{
_logger.LogInformation($"SaveSyncVesselDate @通知执行");
int maxSendLimit = 20; //钉钉每分钟发送限制
var usrList = _repUser.AsQueryable().Filter(null, true).Where(u => u.TenantId == tenantId && !u.IsDeleted).ToList();
Dictionary<string, List<string>> dic = new Dictionary<string, List<string>>();
//遍历船名航次,查询订舱数据
foreach (var item in dto)
{
var boUserList = _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && (x.ParentId == 0 || x.ParentId == null) && !x.IsDeleted && x.TenantId == tenantId)
.Select(x => x.CreatedUserId).ToList();
if (boUserList.Count > 0)
{
var phoneList = usrList.Where(u => boUserList.Contains(u.Id) && u.Phone != "" && u.Phone != null).Select(x => x.Phone).ToList();
foreach (var phone in phoneList)
{
var msg = $"船名:{item.Vessel},航次:{item.Voyno}{item.Message}";
if (dic.ContainsKey(phone))
{
dic[phone].Add(msg);
}
else
{
dic.Add(phone, new List<string>(new string[] { msg }));
}
}
}
}
_logger.LogInformation($"处理发送后,准备给{dic.Count}个用户发送通知");
if (dic.Count > maxSendLimit) //大于限制,分多次发送
{
int times = (int)Math.Ceiling(dic.Count * 1.0 / maxSendLimit);
_logger.LogInformation($"发送通知超限,准备分为{times}次发送");
for (var t = 0; t < times; t++)
{
var keyList = dic.Keys.Skip(t * maxSendLimit).Take(maxSendLimit);
var currTimes = t + 1;
SpareTime.DoOnce(t == 0 ? 1000 : 70 * 1000 * t, doWhat: (st, val) =>
{
_logger.LogInformation($"超限第{currTimes}次发送,共{keyList.Count()}个");
foreach (var k in keyList)
{
var content = string.Join("\r\n", dic[k]);
_logger.LogInformation($"准备发送船期通知给 {k},内容:\r\n{content}");
//DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { k }, null);
}
});
}
}
else
{
foreach (var item in dic)
{
var content = string.Join("\r\n", item.Value);
_logger.LogInformation($"准备发送船期通知给 {item.Key},内容:\r\n{content}");
//DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { item.Key }, null);
}
}
}
catch (Exception ex)
{
var excep = ex;
while (excep != null)
{
_logger.LogError(excep.Message);
_logger.LogError(excep.StackTrace);
excep = excep.InnerException;
}
}
});
}
#endregion #endregion
#region 下载数据 #region 下载数据

@ -13,6 +13,7 @@ using System.IO;
using Furion.DynamicApiController; using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks; using System.Threading.Tasks;
using Furion.Logging;
namespace Myshipping.Core.Job; namespace Myshipping.Core.Job;
@ -42,7 +43,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
} }
// 默认值 // 默认值
var daysAgo = 15; var daysAgo = 30;
var sysCache = App.GetRequiredService<ISysCacheService>(); var sysCache = App.GetRequiredService<ISysCacheService>();
@ -53,10 +54,12 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
// 如果存在相关配置项 // 如果存在相关配置项
if (parameters != null && parameters.ContainsKey("daysAgo") && if (parameters != null && parameters.ContainsKey("daysAgo") &&
string.IsNullOrEmpty(parameters["daysAgo"])) !string.IsNullOrEmpty(parameters["daysAgo"]))
daysAgo = int.Parse(parameters["daysAgo"]); daysAgo = int.Parse(parameters["daysAgo"]);
} }
Log.Information($"准备清理天{daysAgo}之前的日志LogEx");
// 生成查询表达式 // 生成查询表达式
Expression<Func<SysLogEx, bool>> expression = ex => ex.ExceptionTime < DateTime.Now.AddDays(-daysAgo); Expression<Func<SysLogEx, bool>> expression = ex => ex.ExceptionTime < DateTime.Now.AddDays(-daysAgo);
@ -69,7 +72,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
/// </summary> /// </summary>
/// <param name="timer"></param> /// <param name="timer"></param>
/// <param name="count"></param> /// <param name="count"></param>
[SpareTime("@midnight", "LogOpDeletionService", Description = "后台定期删除操作日志,配置项参数:{\"daysAgo\": 7}不填默认为7", [SpareTime("@midnight", "LogOpDeletionService", Description = "后台定期删除操作日志,配置项参数:{\"daysAgo\": 30}不填默认为30",
DoOnce = false, StartNow = true, ExecuteType = SpareTimeExecuteTypes.Serial)] DoOnce = false, StartNow = true, ExecuteType = SpareTimeExecuteTypes.Serial)]
public void DoDeleteLogOp(SpareTimer timer, long count) public void DoDeleteLogOp(SpareTimer timer, long count)
{ {
@ -80,7 +83,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
} }
// 默认值 // 默认值
var daysAgo = 7; var daysAgo = 30;
var sysCache = App.GetRequiredService<ISysCacheService>(); var sysCache = App.GetRequiredService<ISysCacheService>();
@ -91,10 +94,12 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
// 如果存在相关配置项 // 如果存在相关配置项
if (parameters != null && parameters.ContainsKey("daysAgo") && if (parameters != null && parameters.ContainsKey("daysAgo") &&
string.IsNullOrEmpty(parameters["daysAgo"])) !string.IsNullOrEmpty(parameters["daysAgo"]))
daysAgo = int.Parse(parameters["daysAgo"]); daysAgo = int.Parse(parameters["daysAgo"]);
} }
Log.Information($"准备清理天{daysAgo}之前的日志LogOp");
// 生成查询表达式 // 生成查询表达式
Expression<Func<SysLogOp, bool>> expression = ex => ex.OpTime < DateTime.Now.AddDays(-daysAgo); Expression<Func<SysLogOp, bool>> expression = ex => ex.OpTime < DateTime.Now.AddDays(-daysAgo);
@ -107,7 +112,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
/// </summary> /// </summary>
/// <param name="timer"></param> /// <param name="timer"></param>
/// <param name="count"></param> /// <param name="count"></param>
[SpareTime("@midnight", "LogVisDeletionService", Description = "后台定期删除访问日志,配置项参数:{\"daysAgo\": 15}不填默认为15", [SpareTime("@midnight", "LogVisDeletionService", Description = "后台定期删除访问日志,配置项参数:{\"daysAgo\": 30}不填默认为30",
DoOnce = false, StartNow = true, ExecuteType = SpareTimeExecuteTypes.Serial)] DoOnce = false, StartNow = true, ExecuteType = SpareTimeExecuteTypes.Serial)]
public void DoDeleteLogVis(SpareTimer timer, long count) public void DoDeleteLogVis(SpareTimer timer, long count)
{ {
@ -118,7 +123,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
} }
// 默认值 // 默认值
var daysAgo = 15; var daysAgo = 30;
var sysCache = App.GetRequiredService<ISysCacheService>(); var sysCache = App.GetRequiredService<ISysCacheService>();
@ -129,10 +134,12 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
// 如果存在相关配置项 // 如果存在相关配置项
if (parameters != null && parameters.ContainsKey("daysAgo") && if (parameters != null && parameters.ContainsKey("daysAgo") &&
string.IsNullOrEmpty(parameters["daysAgo"])) !string.IsNullOrEmpty(parameters["daysAgo"]))
daysAgo = int.Parse(parameters["daysAgo"]); daysAgo = int.Parse(parameters["daysAgo"]);
} }
Log.Information($"准备清理天{daysAgo}之前的日志LogVis");
// 生成查询表达式 // 生成查询表达式
Expression<Func<SysLogVis, bool>> expression = ex => ex.VisTime < DateTime.Now.AddDays(-daysAgo); Expression<Func<SysLogVis, bool>> expression = ex => ex.VisTime < DateTime.Now.AddDays(-daysAgo);
@ -252,7 +259,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
{ {
var services = scope.ServiceProvider; var services = scope.ServiceProvider;
var logRep = App.GetService<ISqlSugarClient>(services); var logRep = App.GetService<ISqlSugarClient>(services);
logRep.Deleteable<T>(expression); logRep.Deleteable<T>(expression).ExecuteCommand();
}); });
} }
@ -288,7 +295,8 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient
{ {
fi.Delete(true); fi.Delete(true);
} }
else { else
{
TemporaryDirectories(it); TemporaryDirectories(it);
} }

@ -60,7 +60,7 @@ namespace Myshipping.Core.Job
{ {
foreach (var user in users) foreach (var user in users)
{ {
var existUser = sysUsers.Count(x => x.Account == user.CODENAME) > 0; var existUser = sysUsers.Count(x => x.DjyUserId == user.GID) > 0;
SysUser sysUser = null; SysUser sysUser = null;
if (!existUser) if (!existUser)
{ {
@ -68,24 +68,21 @@ namespace Myshipping.Core.Job
} }
else else
{ {
sysUser = sysUsers.First(x => x.Account == user.CODENAME); sysUser = sysUsers.First(x => x.DjyUserId == user.GID);
} }
var ub = _repPingTaiUserBase.FirstOrDefault(x => x.USERID == user.GID); var ub = _repPingTaiUserBase.FirstOrDefault(x => x.USERID == user.GID);
sysUser.Account = user.CODENAME;
//sysUser.Password = DESCEncryption.Encrypt(user.PASSWORD, keyDES); //只在新增时同步密码,防止覆盖
sysUser.TenantId = tenantId; sysUser.TenantId = tenantId;
//sysUser.Name = user.SHOWNAME;//只在新增时同步姓名,防止覆盖
sysUser.AdminType = AdminType.None; sysUser.AdminType = AdminType.None;
sysUser.DjyUserId = user.GID; sysUser.DjyUserId = user.GID;
//sysUser.NickName = user.SHOWNAME;//只在新增时同步昵称,防止覆盖
sysUser.Phone = ub.MOBILE;
sysUser.Email = ub.EMAIL1;
sysUser.IsDeleted = user.IsLeave; sysUser.IsDeleted = user.IsLeave;
if (!existUser) if (!existUser)
{ {
sysUser.Account = user.CODENAME;
sysUser.Phone = ub.MOBILE;
sysUser.Email = ub.EMAIL1;
sysUser.Password = DESCEncryption.Encrypt(user.PASSWORD, keyDES);//只在新增时同步密码 sysUser.Password = DESCEncryption.Encrypt(user.PASSWORD, keyDES);//只在新增时同步密码
sysUser.Name = user.SHOWNAME;//只在新增时同步姓名,防止覆盖 sysUser.Name = user.SHOWNAME;//只在新增时同步姓名,防止覆盖
sysUser.NickName = user.SHOWNAME;//只在新增时同步昵称,防止覆盖 sysUser.NickName = user.SHOWNAME;//只在新增时同步昵称,防止覆盖

@ -13,7 +13,8 @@
"launchBrowser": true, "launchBrowser": true,
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} },
"nativeDebugging": true
}, },
"Myshipping.Web.Entry": { "Myshipping.Web.Entry": {
"commandName": "Project", "commandName": "Project",
@ -22,7 +23,8 @@
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },
"applicationUrl": "http://localhost:5000", "applicationUrl": "http://localhost:5000",
"dotnetRunMessages": "true" "dotnetRunMessages": "true",
"nativeDebugging": true
} }
} }
} }
Loading…
Cancel
Save