cjy 1 month ago
commit bb8704dec9

@ -17,6 +17,16 @@ namespace DS.WMS.Core.Op.Dtos
/// </summary>
[Description("新增")]
ADD = 0,
/// <summary>
/// VOLTA订舱
/// </summary>
[Description("VOLTA订舱")]
VOLTA_SO = 1104,
/// <summary>
/// VOLTA截单
/// </summary>
[Description("VOLTA截单")]
VOLTA_SI = 1105
}
/// <summary>

@ -23,6 +23,8 @@ using DS.Module.Core.Data;
using DS.WMS.Core.Sys.Interface;
using DS.WMS.Core.Code.Method;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Utils;
using NPOI.SS.Formula.PTG;
namespace DS.WMS.Core.Op.Method
{
@ -34,6 +36,7 @@ namespace DS.WMS.Core.Op.Method
private readonly ISaasDbService saasService;
private readonly IConfigService _configService;
private readonly ICodeThirdPartyService _codeThirdPartyService;
private readonly IDingTalkGroupHelper _dingTalkGroupHelper;
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
@ -42,6 +45,10 @@ namespace DS.WMS.Core.Op.Method
_serviceProvider = serviceProvider;
_configService = serviceProvider.GetRequiredService<IConfigService>();
_codeThirdPartyService = serviceProvider.GetRequiredService<ICodeThirdPartyService>();
_dingTalkGroupHelper = serviceProvider.GetRequiredService<IDingTalkGroupHelper>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
user = _serviceProvider.GetRequiredService<IUser>();
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
}
#region 扣费
@ -131,6 +138,13 @@ namespace DS.WMS.Core.Op.Method
string feeUserId = webAccountConfig.AppKey;
string feeUserKey = webAccountConfig.AppSecret;
var c = tenantDb.Queryable<DJYChargeFee>().Filter(null, true).Count(x => x.Id == id);
if (c > 0)
{
Logger.Log(NLog.LogLevel.Info, $"{batchId}-已存在扣费记录id{id},提单号:{orderInfo.MBLNO}");
continue;
}
var runId = Guid.NewGuid().ToString();
var seconds = DateTime.Now.ToTimestamp();
var srcBeforMD5 = $"{runId}{feeUserId}expend{(int)model.BSType}{(int)model.SendType}{id}{orderInfo.MBLNO}{seconds}{feeUserKey}";
@ -214,7 +228,7 @@ namespace DS.WMS.Core.Op.Method
Logger.Log(NLog.LogLevel.Info, $"批次号={batchId}-扣费失败,原因:{msg}");
//DingTalkGroupHelper.SendDingTalkGroupMessage("bookingFeeNotify", "扣费失败提醒", errMsg);
_dingTalkGroupHelper.SendDingTalkGroupMessage("bookingFeeNotify", "扣费失败提醒", msg);
}
}
catch (Exception ex)
@ -226,6 +240,8 @@ namespace DS.WMS.Core.Op.Method
detail.Status = "EXCEPTION";
detail.Message = ex.Message;
_dingTalkGroupHelper.SendDingTalkGroupMessage("bookingFeeNotify", "扣费失败提醒", record.ResultNote);
}
resultDto.ExcuteDetail.Add(detail);

@ -1820,6 +1820,8 @@ namespace DS.WMS.Core.Op.Method
if (ediRouteEnum == EDIRouteEnum.TSL)
{
sendStatus = await InnerSendBookingOrClosingEDIToPOST(result.ExtraData1.ToString(), postSpiderUrl, userWebAccountConfig);
}
else
{
@ -1853,6 +1855,25 @@ namespace DS.WMS.Core.Op.Method
}
}
if (sendStatus.Succeeded)
{
if (ediRouteEnum == EDIRouteEnum.VOLTA)
{
var feeRlt = await _dJYChargeFeeService.ChargeFee(new DJYChargeFeeRequestDto
{
BSType = ChargeFeeBSTypeEnum.BOOKING_CHANNEL_FEE,
SendType = req.SendType.Equals("B") ? ChargeFeeSendTypeEnum.VOLTA_SO : ChargeFeeSendTypeEnum.VOLTA_SI,
BusinessIdList = new List<long> {
order.Id
}
});
_logger.Info($"批次={batchNo} 扣费完成,结果{JsonConvert.SerializeObject(feeRlt)}");
}
}
_logger.Info("批次={no} 扣费", batchNo, result.ExtraData1.ToString());
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;

@ -50,6 +50,8 @@ public partial class SeaExportService : ISeaExportService
private readonly ISysCacheService _sysCacheService;
private readonly IRabbitMQService _rabbitMQService;
private readonly IRedisService _redisBaseService;
private readonly IDJYChargeFeeService _dJYChargeFeeService;
//private readonly IBookingSlotService _bookingSlotService;
private readonly Lazy<ITaskManageBaseService> _taskManageBaseService;
@ -88,6 +90,7 @@ public partial class SeaExportService : ISeaExportService
_configService = _serviceProvider.GetRequiredService<IConfigService>();
_rabbitMQService = _serviceProvider.GetRequiredService<IRabbitMQService>();
_redisBaseService = _serviceProvider.GetRequiredService<IRedisService>();
_dJYChargeFeeService = _serviceProvider.GetRequiredService<IDJYChargeFeeService>();
//_bookingSlotService = _serviceProvider.GetRequiredService<IBookingSlotService>();

@ -0,0 +1,135 @@
using DS.Module.Core;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Sys.Entity;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using NLog;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DS.Module.Core.Extensions;
using LogicExtensions;
using DS.Module.Core.Helpers;
using Newtonsoft.Json.Linq;
using DS.Module.Core.Data;
using DS.WMS.Core.Sys.Interface;
using DS.WMS.Core.Code.Method;
using DS.WMS.Core.Code.Interface;
using System.Text.Json.Nodes;
namespace DS.WMS.Core.Utils
{
public class DingTalkGroupHelper : IDingTalkGroupHelper
{
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
private readonly IConfigService _configService;
private readonly ICodeThirdPartyService _codeThirdPartyService;
public DingTalkGroupHelper(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
_configService = serviceProvider.GetRequiredService<IConfigService>();
_codeThirdPartyService = serviceProvider.GetRequiredService<ICodeThirdPartyService>();
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
}
/// <summary>
/// 发送钉钉客服群组消息通知
/// </summary>
/// <param name="code">钉钉群配置code</param>
/// <param name="title">标题</param>
/// <param name="content">内容</param>
public async Task SendDingTalkGroupMessage(string code, string title, string content)
{
var dingdingCfg = db.Queryable<SysConfig>().Filter(null, true)
.Where(x => x.Code == code && x.TenantId == 1288018625843826688).First();
var postdata = new
{
text =
new
{
content = $"【{title}】\r\n{content}\r\n----{dingdingCfg.Note}"
},
msgtype = "text"
};
Logger.Log(NLog.LogLevel.Info, $"准备发送钉钉消息:{postdata.ToJsonString()}");
var rtn = RequestHelper.Post(JsonConvert.SerializeObject(postdata), dingdingCfg.Value);
Logger.Log(NLog.LogLevel.Info, $"发送钉钉消息返回:{rtn}");
}
/// <summary>
/// 发送钉钉客服群组消息通知
/// </summary>
/// <param name="code">钉钉群配置code</param>
/// <param name="title">标题</param>
/// <param name="content">内容</param>
/// <param name="atAll">@所有人</param>
/// <param name="atMobiles">@手机号数组</param>
/// <param name="atUserIds">@用户id数组</param>
public async Task SendDingTalkGroupMessage(string code, string title, string content, bool atAll, string[] atMobiles, string[] atUserIds)
{
var dingdingCfg = db.Queryable<SysConfig>().Filter(null, true)
.Where(x => x.Code == code && x.TenantId == 1288018625843826688).First();
var postdata = new
{
text =
new
{
content = $"【{title}】\r\n{content}\r\n----{dingdingCfg.Note}"
},
msgtype = "text",
at = new
{
isAtAll = atAll,
atMobiles = atMobiles,
atUserIds = atUserIds
}
};
Logger.Log(NLog.LogLevel.Info, $"准备发送钉钉消息:{postdata.ToJsonString()}");
var rtn = RequestHelper.Post(JsonConvert.SerializeObject(postdata), dingdingCfg.Value);
Logger.Log(NLog.LogLevel.Info, $"发送钉钉消息返回:{rtn}");
}
}
public interface IDingTalkGroupHelper
{
/// <summary>
/// 发送钉钉客服群组消息通知
/// </summary>
/// <param name="code">钉钉群配置code</param>
/// <param name="title">标题</param>
/// <param name="content">内容</param>
Task SendDingTalkGroupMessage(string code, string title, string content);
/// <summary>
/// 发送钉钉客服群组消息通知
/// </summary>
/// <param name="code">钉钉群配置code</param>
/// <param name="title">标题</param>
/// <param name="content">内容</param>
/// <param name="atAll">@所有人</param>
/// <param name="atMobiles">@手机号数组</param>
/// <param name="atUserIds">@用户id数组</param>
Task SendDingTalkGroupMessage(string code, string title, string content, bool atAll, string[] atMobiles, string[] atUserIds);
}
}
Loading…
Cancel
Save