AFR日志记录功能测试

master
zhangxiaofeng 7 months ago
parent b6c9f28bc6
commit cd812a9d4d

@ -1,4 +1,5 @@
using System; using djy.Model.Attributes;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace djy.Model.AFRDto namespace djy.Model.AFRDto
@ -8,7 +9,9 @@ namespace djy.Model.AFRDto
/// </summary> /// </summary>
public class AFRRequestDto public class AFRRequestDto
{ {
[LogProperty("主单信息")]
public MasterBillInfo masterBillInfo { get; set; } public MasterBillInfo masterBillInfo { get; set; }
[LogProperty("分单信息")]
public List<HouseBillInfo> houseBillInfoList { get; set; } public List<HouseBillInfo> houseBillInfoList { get; set; }
} }
public class MasterBillInfo public class MasterBillInfo
@ -16,85 +19,102 @@ namespace djy.Model.AFRDto
/// <summary> /// <summary>
/// 船东提单号 /// 船东提单号
/// </summary> /// </summary>
[LogProperty("船东提单号")]
public string masterBillNo { get; set; } public string masterBillNo { get; set; }
/// <summary> /// <summary>
/// 船东单运编号(选填) /// 船东单运编号(选填)
/// </summary> /// </summary>
[LogProperty("船东单运编号")]
public string shippingNo { get; set; } public string shippingNo { get; set; }
/// <summary> /// <summary>
/// 运输条款代码 /// 运输条款代码
/// </summary> /// </summary>
[LogProperty("运输条款代码")]
public string clause { get; set; } public string clause { get; set; }
/// <summary> /// <summary>
/// 整箱/拼箱 FCL整箱 LCL拼箱 /// 整箱/拼箱 FCL整箱 LCL拼箱
/// </summary> /// </summary>
[LogProperty("整箱/拼箱")]
public string consignmentType { get; set; } public string consignmentType { get; set; }
/// <summary> /// <summary>
/// 卸货港全称 /// 卸货港全称
/// </summary> /// </summary>
[LogProperty("卸货港全称")]
public string dischargeHarbour { get; set; } public string dischargeHarbour { get; set; }
/// <summary> /// <summary>
/// 卸货港五字码 /// 卸货港五字码
/// </summary> /// </summary>
[LogProperty("卸货港五字码")]
public string dischargeHarbourCode { get; set; } public string dischargeHarbourCode { get; set; }
/// <summary> /// <summary>
/// 预计到达日期 /// 预计到达日期
/// </summary> /// </summary>
[LogProperty("预计到达日期")]
public DateTime? estimatedArrivalTime { get; set; } public DateTime? estimatedArrivalTime { get; set; }
/// <summary> /// <summary>
/// 申报运输类型 /// 申报运输类型
/// </summary> /// </summary>
[LogProperty("申报运输类型")]
public string filingType { get; set; } public string filingType { get; set; }
/// <summary> /// <summary>
/// 交货地全称条件申报运输类型Tranship时必填 /// 交货地全称条件申报运输类型Tranship时必填
/// </summary> /// </summary>
[LogProperty("交货地全称")]
public string lastForeignHarbour { get; set; } public string lastForeignHarbour { get; set; }
/// <summary> /// <summary>
/// 交货地五字码条件申报运输类型Tranship时必填 /// 交货地五字码条件申报运输类型Tranship时必填
/// </summary> /// </summary>
[LogProperty("交货地五字码")]
public string lastForeignHarbourCode { get; set; } public string lastForeignHarbourCode { get; set; }
/// <summary> /// <summary>
/// 预计开船日期 /// 预计开船日期
/// </summary> /// </summary>
[LogProperty("预计开船日期")]
public DateTime? loadDate { get; set; } public DateTime? loadDate { get; set; }
/// <summary> /// <summary>
/// 装货港全称 /// 装货港全称
/// </summary> /// </summary>
[LogProperty("装货港全称")]
public string loadHarbour { get; set; } public string loadHarbour { get; set; }
/// <summary> /// <summary>
/// 装货港五字码 /// 装货港五字码
/// </summary> /// </summary>
[LogProperty("装货港五字码")]
public string loadHarbourCode { get; set; } public string loadHarbourCode { get; set; }
/// <summary> /// <summary>
/// 船司MapName /// 船司MapName
/// </summary> /// </summary>
[LogProperty("船司")]
public string shipCompany { get; set; } public string shipCompany { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[LogProperty("船名")]
public string vessel { get; set; } public string vessel { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[LogProperty("航次")]
public string voyage { get; set; } public string voyage { get; set; }
/// <summary> /// <summary>
/// 发送方DEA CARGOEDI账号联系运营人员配置 /// 发送方DEA CARGOEDI账号联系运营人员配置
/// </summary> /// </summary>
[LogProperty(null, Readable = false)]
public string requesterDea { get; set; } public string requesterDea { get; set; }
} }
public class HouseBillInfo public class HouseBillInfo
@ -102,128 +122,154 @@ namespace djy.Model.AFRDto
/// <summary> /// <summary>
/// 货代提单号唯一编号 同货代提单号,原始修改删除重发报文,该值要一致 /// 货代提单号唯一编号 同货代提单号,原始修改删除重发报文,该值要一致
/// </summary> /// </summary>
[LogProperty("货代提单号唯一编号")]
public string businessId { get; set; } public string businessId { get; set; }
/// <summary> /// <summary>
/// 货代单运编号(选填) /// 货代单运编号(选填)
/// </summary> /// </summary>
[LogProperty("货代单运编号")]
public string shippingNo { get; set; } public string shippingNo { get; set; }
/// <summary> /// <summary>
/// 货代提单号 修改报文,该值不可以变更 /// 货代提单号 修改报文,该值不可以变更
/// </summary> /// </summary>
[LogProperty("货代提单号")]
public string houseBillNo { get; set; } public string houseBillNo { get; set; }
/// <summary> /// <summary>
/// 通知人地址 /// 通知人地址
/// </summary> /// </summary>
[LogProperty("通知人地址")]
public string notifyAddress { get; set; } public string notifyAddress { get; set; }
/// <summary> /// <summary>
/// 通知人城市 /// 通知人城市
/// </summary> /// </summary>
[LogProperty("通知人城市")]
public string notifyCity { get; set; } public string notifyCity { get; set; }
/// <summary> /// <summary>
/// 通知人联系人 /// 通知人联系人
/// </summary> /// </summary>
[LogProperty("通知人联系人")]
public string notifyContact { get; set; } public string notifyContact { get; set; }
/// <summary> /// <summary>
/// 通知人国家 /// 通知人国家
/// </summary> /// </summary>
[LogProperty("通知人国家")]
public string notifyCountry { get; set; } public string notifyCountry { get; set; }
/// <summary> /// <summary>
/// 通知人国家代码 /// 通知人国家代码
/// </summary> /// </summary>
[LogProperty("通知人国家代码")]
public string notifyCountryCode { get; set; } public string notifyCountryCode { get; set; }
/// <summary> /// <summary>
/// 通知人名称 /// 通知人名称
/// </summary> /// </summary>
[LogProperty("通知人名称")]
public string notifyName { get; set; } public string notifyName { get; set; }
/// <summary> /// <summary>
/// 通知人联系人电话 /// 通知人联系人电话
/// </summary> /// </summary>
[LogProperty("通知人联系人电话")]
public string notifyTel { get; set; } public string notifyTel { get; set; }
/// <summary> /// <summary>
/// 收货人地址 /// 收货人地址
/// </summary> /// </summary>
[LogProperty("收货人地址")]
public string receiveAddress { get; set; } public string receiveAddress { get; set; }
/// <summary> /// <summary>
/// 收货人城市 /// 收货人城市
/// </summary> /// </summary>
[LogProperty("收货人城市")]
public string receiveCity { get; set; } public string receiveCity { get; set; }
/// <summary> /// <summary>
/// 收货人联系人 /// 收货人联系人
/// </summary> /// </summary>
[LogProperty("收货人联系人")]
public string receiveContact { get; set; } public string receiveContact { get; set; }
/// <summary> /// <summary>
/// 收货人国家 /// 收货人国家
/// </summary> /// </summary>
[LogProperty("收货人国家")]
public string receiveCountry { get; set; } public string receiveCountry { get; set; }
/// <summary> /// <summary>
/// 收货人国家代码 /// 收货人国家代码
/// </summary> /// </summary>
[LogProperty("收货人国家代码")]
public string receiveCountryCode { get; set; } public string receiveCountryCode { get; set; }
/// <summary> /// <summary>
/// 收货人名称 /// 收货人名称
/// </summary> /// </summary>
[LogProperty("收货人名称")]
public string receiveName { get; set; } public string receiveName { get; set; }
/// <summary> /// <summary>
/// 收货人联系人电话 /// 收货人联系人电话
/// </summary> /// </summary>
[LogProperty("收货人联系人电话")]
public string receiveTel { get; set; } public string receiveTel { get; set; }
/// <summary> /// <summary>
/// 发货人地址 /// 发货人地址
/// </summary> /// </summary>
[LogProperty("发货人地址")]
public string sendAddress { get; set; } public string sendAddress { get; set; }
/// <summary> /// <summary>
/// 发货人城市 /// 发货人城市
/// </summary> /// </summary>
[LogProperty("发货人城市")]
public string sendCity { get; set; } public string sendCity { get; set; }
/// <summary> /// <summary>
/// 发货人联系人 /// 发货人联系人
/// </summary> /// </summary>
[LogProperty("发货人联系人")]
public string sendContact { get; set; } public string sendContact { get; set; }
/// <summary> /// <summary>
/// 发货人国家 /// 发货人国家
/// </summary> /// </summary>
[LogProperty("发货人国家")]
public string sendCountry { get; set; } public string sendCountry { get; set; }
/// <summary> /// <summary>
/// 发货人国家代码 /// 发货人国家代码
/// </summary> /// </summary>
[LogProperty("发货人国家代码")]
public string sendCountryCode { get; set; } public string sendCountryCode { get; set; }
/// <summary> /// <summary>
/// 发货人名称 /// 发货人名称
/// </summary> /// </summary>
[LogProperty("发货人名称")]
public string sendName { get; set; } public string sendName { get; set; }
/// <summary> /// <summary>
/// 发货人联系人电话 /// 发货人联系人电话
/// </summary> /// </summary>
[LogProperty("发货人联系人电话")]
public string sendTel { get; set; } public string sendTel { get; set; }
//public List<CtnInfo> ctnInfo { get; set; } //public List<CtnInfo> ctnInfo { get; set; }
[LogProperty("箱信息")]
public CtnInfo ctnInfo { get; set; } public CtnInfo ctnInfo { get; set; }
} }
public class CtnInfo public class CtnInfo
{ {
[LogProperty("箱信息列表")]
public List<InsertList> insertList { get; set; } public List<InsertList> insertList { get; set; }
} }
public class InsertList public class InsertList
@ -231,100 +277,120 @@ namespace djy.Model.AFRDto
/// <summary> /// <summary>
/// 货主箱标志 /// 货主箱标志
/// </summary> /// </summary>
[LogProperty("货主箱标志")]
public string containerMark { get; set; } public string containerMark { get; set; }
/// <summary> /// <summary>
/// 箱号 /// 箱号
/// </summary> /// </summary>
[LogProperty("箱号")]
public string containerNo { get; set; } public string containerNo { get; set; }
/// <summary> /// <summary>
/// 箱型 /// 箱型
/// </summary> /// </summary>
[LogProperty("箱型")]
public string containerType { get; set; } public string containerType { get; set; }
/// <summary> /// <summary>
/// 危品联系人(选填) /// 危品联系人(选填)
/// </summary> /// </summary>
[LogProperty("危品联系人")]
public string dangerContact { get; set; } public string dangerContact { get; set; }
/// <summary> /// <summary>
/// 危品联系人电话(选填) /// 危品联系人电话(选填)
/// </summary> /// </summary>
[LogProperty("危品联系人电话")]
public string dangerContactTel { get; set; } public string dangerContactTel { get; set; }
/// <summary> /// <summary>
/// 危品等级(条件必填) /// 危品等级(条件必填)
/// </summary> /// </summary>
[LogProperty("危品等级")]
public string dangerGrade { get; set; } public string dangerGrade { get; set; }
/// <summary> /// <summary>
/// 危品备注(选填) /// 危品备注(选填)
/// </summary> /// </summary>
[LogProperty("危品备注")]
public string dangerMemo { get; set; } public string dangerMemo { get; set; }
/// <summary> /// <summary>
/// 件数 /// 件数
/// </summary> /// </summary>
[LogProperty("件数")]
public string digit { get; set; } public string digit { get; set; }
/// <summary> /// <summary>
/// 品名 /// 品名
/// </summary> /// </summary>
[LogProperty("品名")]
public string enProductName { get; set; } public string enProductName { get; set; }
/// <summary> /// <summary>
/// 毛重 /// 毛重
/// </summary> /// </summary>
[LogProperty("毛重")]
public string grossWeight { get; set; } public string grossWeight { get; set; }
/// <summary> /// <summary>
/// HSCode /// HSCode
/// </summary> /// </summary>
[LogProperty("HSCode")]
public string hscode { get; set; } public string hscode { get; set; }
/// <summary> /// <summary>
/// 燃点,摄氏度(选填) /// 燃点,摄氏度(选填)
/// </summary> /// </summary>
[LogProperty("燃点")]
public string ignite { get; set; } public string ignite { get; set; }
/// <summary> /// <summary>
/// 原产国(选填) /// 原产国(选填)
/// </summary> /// </summary>
[LogProperty("原产国")]
public string originCountry { get; set; } public string originCountry { get; set; }
/// <summary> /// <summary>
/// 原产国国家代码(选填) /// 原产国国家代码(选填)
/// </summary> /// </summary>
[LogProperty("原产国国家代码")]
public string originCountryCode { get; set; } public string originCountryCode { get; set; }
/// <summary> /// <summary>
/// 包装 /// 包装
/// </summary> /// </summary>
[LogProperty("包装")]
public string packing { get; set; } public string packing { get; set; }
/// <summary> /// <summary>
/// 包装代码 /// 包装代码
/// </summary> /// </summary>
[LogProperty("包装代码")]
public string packingCode { get; set; } public string packingCode { get; set; }
/// <summary> /// <summary>
/// 封号 /// 封号
/// </summary> /// </summary>
[LogProperty("封号")]
public string sealNo { get; set; } public string sealNo { get; set; }
/// <summary> /// <summary>
/// 唛头 /// 唛头
/// </summary> /// </summary>
[LogProperty("唛头")]
public string shippingMark { get; set; } public string shippingMark { get; set; }
/// <summary> /// <summary>
/// UN CODE条件必填 /// UN CODE条件必填
/// </summary> /// </summary>
[LogProperty("UN CODE")]
public string unCode { get; set; } public string unCode { get; set; }
/// <summary> /// <summary>
/// 体积 /// 体积
/// </summary> /// </summary>
[LogProperty("体积")]
public string volume { get; set; } public string volume { get; set; }
} }
} }

@ -0,0 +1,35 @@
using System;
namespace djy.Model.Attributes
{
/// <summary>
/// 用于格式化日志输出的属性
/// </summary>
[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
public class LogPropertyAttribute : Attribute
{
/// <summary>
/// 反序列化时要读取的属性名称
/// </summary>
public string ReadName { get; set; }
/// <summary>
/// 序列化时要写入的属性名称
/// </summary>
public string WriteName { get; set; }
/// <summary>
/// 是否可读
/// </summary>
public bool Readable { get; set; }
/// <summary>
/// 是否可写
/// </summary>
public bool Writable { get; set; }
public LogPropertyAttribute(string writeName)
{
Readable = true;
Writable = true;
WriteName = writeName;
}
}
}

@ -0,0 +1,23 @@
using djy.Model.Attributes;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System.Reflection;
namespace djy.Model.Converter
{
public class LogPropertyWriteResolver : DefaultContractResolver
{
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
var property = base.CreateProperty(member, memberSerialization);
var attr = member.GetCustomAttribute(typeof(LogPropertyAttribute)) as LogPropertyAttribute;
if (attr != null)
{
property.PropertyName = attr.WriteName ?? property.PropertyName;
property.Writable = attr.Writable;
property.Readable = attr.Readable;
}
return property;
}
}
}

@ -0,0 +1,17 @@
using FreeSql.DataAnnotations;
namespace djy.Model
{
/// <summary>
///
/// </summary>
[Table(Name = "HistoryDetail", DisableSyncStructure = true)]
public partial class HistoryDetail
{
[Column(IsIdentity = true, IsPrimary = true)]
public long ID { get; set; }
public int Type { get; set; }
public string HistoryID { get; set; }
public string RequestLog { get; set; }
}
}

@ -11,9 +11,11 @@ using djy.Model.Afr;
using djy.Model.AFRDto; using djy.Model.AFRDto;
using djy.Model.Ams; using djy.Model.Ams;
using djy.Model.AmsDto; using djy.Model.AmsDto;
using djy.Model.Converter;
using djy.Service.DjyService; using djy.Service.DjyService;
using FreeSql; using FreeSql;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -426,7 +428,7 @@ namespace djy.Service.AFR
.WithTransaction(tran) .WithTransaction(tran)
.ExecuteAffrowsAsync(); .ExecuteAffrowsAsync();
await SaveHistoryAsync(input.GID, input.HouseList, "新增", 0, "创建了单据", tran); await SaveHistoryAsync(input.GID, input.HouseList, "新增", 0, "创建了单据", null, tran);
tran.Commit(); tran.Commit();
} }
@ -558,7 +560,7 @@ namespace djy.Service.AFR
{ {
await DbAMS.Insert(waitInsertHouseList).WithTransaction(tran).ExecuteAffrowsAsync(); await DbAMS.Insert(waitInsertHouseList).WithTransaction(tran).ExecuteAffrowsAsync();
await SaveHistoryAsync(input.GID, waitInsertHouseList, "新增", 0, "创建了分单", tran); await SaveHistoryAsync(input.GID, waitInsertHouseList, "新增", 0, "创建了分单", null, tran);
} }
if (waitDeleteHouseGids.Any()) if (waitDeleteHouseGids.Any())
{ {
@ -569,7 +571,7 @@ namespace djy.Service.AFR
.Where(h => waitDeleteHouseGids.Contains(h.GID)) .Where(h => waitDeleteHouseGids.Contains(h.GID))
.ExecuteAffrowsAsync(); .ExecuteAffrowsAsync();
await SaveHistoryAsync(input.GID, waitDeleteHouseGids.Select(gid => new AFRHouse() { GID = gid }), "删除", 0, "删除了单据", tran); await SaveHistoryAsync(input.GID, waitDeleteHouseGids.Select(gid => new AFRHouse() { GID = gid }), "删除", 0, "删除了单据", null, tran);
} }
if (waitUpdateHouseGids.Any()) if (waitUpdateHouseGids.Any())
{ {
@ -579,7 +581,7 @@ namespace djy.Service.AFR
.WithTransaction(tran) .WithTransaction(tran)
.ExecuteAffrowsAsync(); .ExecuteAffrowsAsync();
await SaveHistoryAsync(input.GID, waitUpdateHouseList, "修改", 0, "修改了单据", tran); await SaveHistoryAsync(input.GID, waitUpdateHouseList, "修改", 0, "修改了单据", null, tran);
} }
// 箱子执行 // 箱子执行
@ -863,7 +865,7 @@ namespace djy.Service.AFR
{ {
masterBillNo = masterItem.MBLNO, masterBillNo = masterItem.MBLNO,
shippingNo = masterItem.ShippingNo, shippingNo = masterItem.ShippingNo,
clause = masterItem.Clause, //test clause = masterItem.Clause,
consignmentType = masterItem.ConsignmentType, consignmentType = masterItem.ConsignmentType,
dischargeHarbour = masterItem.DischargeHarbour, dischargeHarbour = masterItem.DischargeHarbour,
dischargeHarbourCode = masterItem.DischargeHarbourCode, dischargeHarbourCode = masterItem.DischargeHarbourCode,
@ -874,7 +876,7 @@ namespace djy.Service.AFR
loadDate = masterItem.LoadDate, loadDate = masterItem.LoadDate,
loadHarbour = masterItem.LoadHarbour, loadHarbour = masterItem.LoadHarbour,
loadHarbourCode = masterItem.LoadHarbourCode, loadHarbourCode = masterItem.LoadHarbourCode,
requesterDea = sysOptionConfig.Webconfig.requesterDea, //test requesterDea = sysOptionConfig.Webconfig.requesterDea,
shipCompany = masterItem.ShipCompanyMapCode, shipCompany = masterItem.ShipCompanyMapCode,
vessel = masterItem.Vessel, vessel = masterItem.Vessel,
voyage = masterItem.Voyno voyage = masterItem.Voyno
@ -1035,7 +1037,26 @@ namespace djy.Service.AFR
.ExecuteAffrowsAsync(); .ExecuteAffrowsAsync();
// 记录历史 // 记录历史
await SaveHistoryAsync(masterItem.GID, houseList, state, 0, "发送了单据"); // 生成详细的发送日志
string requestLog = JsonConvert.SerializeObject(requestDto, Formatting.Indented, new JsonSerializerSettings()
{
ContractResolver = new LogPropertyWriteResolver(),
DateFormatString = "yyyy-MM-dd HH:mm:ss"
});
await SaveHistoryAsync(masterItem.GID, houseList, state, 0, "发送了单据", requestLog);
//await SaveHistoryAsync(masterItem.GID, houseList, "新增发送成功", 0, "发送了单据", requestLog);
//requestDto.masterBillInfo.estimatedArrivalTime = new DateTime(1999,12,12);
//requestDto.houseBillInfoList[0].notifyName = "测试人";
//requestDto.houseBillInfoList[0].ctnInfo.insertList[0].containerNo = "12312312";
//string requestLog2 = JsonConvert.SerializeObject(requestDto, Formatting.Indented, new JsonSerializerSettings()
//{
// ContractResolver = new LogPropertyWriteResolver(),
// DateFormatString = "yyyy-MM-dd HH:mm:ss"
//});
//await SaveHistoryAsync(masterItem.GID, houseList, "修改发送成功", 0, "发送了单据", requestLog2);
} }
else else
{ {
@ -1335,15 +1356,23 @@ namespace djy.Service.AFR
/// 保存操作历史或回执接收历史 /// 保存操作历史或回执接收历史
/// </summary> /// </summary>
/// <param name="mid">主单主键</param> /// <param name="mid">主单主键</param>
/// <param name="hids">分单主键列表</param> /// <param name="houseList">分单列表</param>
/// <param name="state">状态</param> /// <param name="state">状态</param>
/// <param name="type">0人工操作历史1回执接收历史</param> /// <param name="type">0人工操作历史1回执接收历史</param>
/// <param name="remark"></param> /// <param name="remark"></param>
/// <param name="requestLog">请求的详细日志内容</param>
/// <param name="tran"></param> /// <param name="tran"></param>
/// <returns></returns> /// <returns></returns>
private async Task SaveHistoryAsync(string mid, IEnumerable<AFRHouse> houseList, string state, int type, string remark, DbTransaction tran = null) private async Task SaveHistoryAsync(string mid,
{ IEnumerable<AFRHouse> houseList,
List<AFRMasterHistory> list = new(houseList.Count()); string state,
int type,
string remark,
string requestLog = null,
DbTransaction tran = null)
{
List<AFRMasterHistory> historyList = new(houseList.Count());
List<HistoryDetail> detailList = new(houseList.Count());
foreach (AFRHouse item in houseList) foreach (AFRHouse item in houseList)
{ {
var history = new AFRMasterHistory() var history = new AFRMasterHistory()
@ -1364,15 +1393,27 @@ namespace djy.Service.AFR
{ {
history.Remark = $"您的单据 {item.HouseBillNo} 于 {(DateTime)history.CreateTime:yyyy-MM-dd HH:mm:ss} 接收到回执:{remark}"; history.Remark = $"您的单据 {item.HouseBillNo} 于 {(DateTime)history.CreateTime:yyyy-MM-dd HH:mm:ss} 接收到回执:{remark}";
} }
list.Add(history); historyList.Add(history);
if (requestLog != null)
{
detailList.Add(new HistoryDetail()
{
HistoryID = history.GID,
RequestLog = requestLog,
Type = 3
});
}
} }
if (tran == null) if (tran == null)
{ {
await DbAMS.Insert(list).ExecuteAffrowsAsync(); await DbAMS.Insert(historyList).ExecuteAffrowsAsync();
await DbAMS.Insert(detailList).ExecuteAffrowsAsync();
} }
else else
{ {
await DbAMS.Insert(list).WithTransaction(tran).ExecuteAffrowsAsync(); await DbAMS.Insert(historyList).WithTransaction(tran).ExecuteAffrowsAsync();
await DbAMS.Insert(detailList).WithTransaction(tran).ExecuteAffrowsAsync();
} }
} }

@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<_PublishTargetUrl>D:\DJY\Code\djyweb_ams\web\djy.WebApi\bin\publish\net5</_PublishTargetUrl> <_PublishTargetUrl>D:\Code\djyweb_ams\web\djy.WebApi\bin\publish\net5</_PublishTargetUrl>
<History>True|2024-02-20T00:48:34.1425408Z;True|2023-06-16T09:09:45.1637530+08:00;True|2023-06-15T17:35:47.2298327+08:00;True|2022-10-24T13:58:36.8728872+08:00;True|2022-10-11T17:36:04.7506103+08:00;True|2022-09-29T09:16:51.0738556+08:00;True|2022-09-29T09:12:44.1994050+08:00;True|2022-09-29T09:05:28.1343572+08:00;True|2022-09-28T17:22:24.8692737+08:00;True|2022-09-28T16:15:13.4883777+08:00;True|2022-09-28T10:59:23.5270093+08:00;True|2022-08-31T10:01:14.0996702+08:00;True|2022-08-29T11:10:30.2643117+08:00;True|2022-08-29T10:55:49.0496591+08:00;True|2022-08-16T10:30:57.6816257+08:00;True|2022-08-15T17:50:55.2965000+08:00;True|2022-08-12T18:07:20.4848662+08:00;True|2022-08-12T17:46:41.1829405+08:00;True|2022-08-12T15:08:58.5925841+08:00;True|2022-07-20T16:18:49.1737260+08:00;True|2022-07-14T13:44:55.2043481+08:00;True|2022-07-13T10:21:13.3628429+08:00;True|2022-07-12T15:45:11.4672604+08:00;True|2022-07-12T10:48:29.8013532+08:00;True|2022-07-04T09:32:18.4540585+08:00;True|2022-07-01T17:34:50.7575127+08:00;True|2022-07-01T15:51:14.9076477+08:00;True|2022-06-30T15:06:12.0032112+08:00;True|2022-06-30T15:05:33.2540874+08:00;True|2022-06-30T10:26:41.3365814+08:00;True|2022-06-30T09:56:20.9021741+08:00;True|2022-06-30T08:53:10.0864638+08:00;True|2022-06-29T17:05:03.3034364+08:00;True|2022-06-29T16:50:10.1873653+08:00;True|2022-06-29T16:32:36.1524378+08:00;True|2022-06-29T15:56:09.9746651+08:00;True|2022-06-29T10:56:16.8088978+08:00;True|2022-06-29T08:54:20.5334051+08:00;True|2022-06-28T19:41:08.7023145+08:00;True|2022-06-28T19:26:28.7000486+08:00;True|2022-06-28T19:14:38.4827828+08:00;True|2022-06-28T18:56:21.8997711+08:00;True|2022-06-28T17:46:58.3643830+08:00;True|2022-06-28T17:10:20.1461539+08:00;True|2022-06-28T16:09:53.0805413+08:00;True|2022-06-28T15:52:30.2951989+08:00;True|2022-06-28T11:01:29.3265564+08:00;True|2022-06-28T10:35:04.6353020+08:00;True|2022-06-28T10:25:10.0426356+08:00;True|2022-06-28T10:22:28.8860296+08:00;True|2022-06-28T10:10:33.8758083+08:00;True|2022-06-28T10:03:21.1254163+08:00;True|2022-06-28T09:15:06.8911689+08:00;True|2022-06-27T17:07:03.5262846+08:00;True|2022-06-27T16:51:26.5898864+08:00;True|2022-06-27T16:28:43.2026298+08:00;True|2022-06-27T16:28:18.9494990+08:00;True|2022-06-27T16:27:16.7453474+08:00;True|2022-06-27T16:18:19.4634998+08:00;True|2022-06-27T16:02:41.1823096+08:00;True|2022-06-27T15:43:51.5116456+08:00;True|2022-06-27T15:23:40.6693098+08:00;True|2022-06-27T15:22:19.3671271+08:00;True|2022-06-27T14:41:57.2976612+08:00;True|2022-06-27T14:33:00.0677612+08:00;True|2022-06-27T14:24:08.5216447+08:00;True|2022-06-27T14:02:02.8566739+08:00;True|2022-06-27T09:23:01.1910441+08:00;True|2022-06-24T10:33:51.1549131+08:00;True|2022-06-24T09:59:03.2881122+08:00;True|2022-06-24T09:15:37.5422200+08:00;True|2022-06-23T15:11:47.3175395+08:00;True|2022-06-17T09:45:32.1714267+08:00;True|2022-06-16T17:03:22.3921843+08:00;True|2022-06-16T15:35:33.2295367+08:00;True|2022-06-16T15:21:17.5490522+08:00;True|2022-06-16T14:53:00.4693599+08:00;True|2022-06-10T14:25:18.7355725+08:00;True|2022-06-09T18:13:39.8032757+08:00;True|2022-06-09T17:57:35.8696074+08:00;True|2022-06-01T17:48:15.4107624+08:00;True|2022-05-31T16:09:22.2674554+08:00;True|2022-05-31T14:15:19.3700456+08:00;True|2022-05-18T09:06:11.5118231+08:00;True|2022-05-17T16:08:22.9679914+08:00;True|2022-02-07T09:32:52.8608715+08:00;True|2022-01-29T15:30:35.5581322+08:00;True|2022-01-29T15:13:03.4191677+08:00;True|2022-01-29T14:52:16.3700211+08:00;True|2022-01-29T14:48:59.8000767+08:00;True|2022-01-29T14:45:14.4545309+08:00;True|2022-01-29T14:38:57.6540259+08:00;True|2022-01-29T13:36:16.2370205+08:00;True|2022-01-29T11:46:45.8432136+08:00;True|2022-01-29T11:20:54.2763765+08:00;True|2022-01-29T11:16:23.0172880+08:00;True|2022-01-29T11:06:15.3648999+08:00;True|2022-01-29T11:00:39.8926536+08:00;True|2022-01-28T14:35:21.7742884+08:00;True|2022-01-28T13:44:47.5005402+08:00;</History> <History>True|2024-04-03T01:23:32.8437777Z;True|2024-02-20T08:48:34.1425408+08:00;True|2023-06-16T09:09:45.1637530+08:00;True|2023-06-15T17:35:47.2298327+08:00;True|2022-10-24T13:58:36.8728872+08:00;True|2022-10-11T17:36:04.7506103+08:00;True|2022-09-29T09:16:51.0738556+08:00;True|2022-09-29T09:12:44.1994050+08:00;True|2022-09-29T09:05:28.1343572+08:00;True|2022-09-28T17:22:24.8692737+08:00;True|2022-09-28T16:15:13.4883777+08:00;True|2022-09-28T10:59:23.5270093+08:00;True|2022-08-31T10:01:14.0996702+08:00;True|2022-08-29T11:10:30.2643117+08:00;True|2022-08-29T10:55:49.0496591+08:00;True|2022-08-16T10:30:57.6816257+08:00;True|2022-08-15T17:50:55.2965000+08:00;True|2022-08-12T18:07:20.4848662+08:00;True|2022-08-12T17:46:41.1829405+08:00;True|2022-08-12T15:08:58.5925841+08:00;True|2022-07-20T16:18:49.1737260+08:00;True|2022-07-14T13:44:55.2043481+08:00;True|2022-07-13T10:21:13.3628429+08:00;True|2022-07-12T15:45:11.4672604+08:00;True|2022-07-12T10:48:29.8013532+08:00;True|2022-07-04T09:32:18.4540585+08:00;True|2022-07-01T17:34:50.7575127+08:00;True|2022-07-01T15:51:14.9076477+08:00;True|2022-06-30T15:06:12.0032112+08:00;True|2022-06-30T15:05:33.2540874+08:00;True|2022-06-30T10:26:41.3365814+08:00;True|2022-06-30T09:56:20.9021741+08:00;True|2022-06-30T08:53:10.0864638+08:00;True|2022-06-29T17:05:03.3034364+08:00;True|2022-06-29T16:50:10.1873653+08:00;True|2022-06-29T16:32:36.1524378+08:00;True|2022-06-29T15:56:09.9746651+08:00;True|2022-06-29T10:56:16.8088978+08:00;True|2022-06-29T08:54:20.5334051+08:00;True|2022-06-28T19:41:08.7023145+08:00;True|2022-06-28T19:26:28.7000486+08:00;True|2022-06-28T19:14:38.4827828+08:00;True|2022-06-28T18:56:21.8997711+08:00;True|2022-06-28T17:46:58.3643830+08:00;True|2022-06-28T17:10:20.1461539+08:00;True|2022-06-28T16:09:53.0805413+08:00;True|2022-06-28T15:52:30.2951989+08:00;True|2022-06-28T11:01:29.3265564+08:00;True|2022-06-28T10:35:04.6353020+08:00;True|2022-06-28T10:25:10.0426356+08:00;True|2022-06-28T10:22:28.8860296+08:00;True|2022-06-28T10:10:33.8758083+08:00;True|2022-06-28T10:03:21.1254163+08:00;True|2022-06-28T09:15:06.8911689+08:00;True|2022-06-27T17:07:03.5262846+08:00;True|2022-06-27T16:51:26.5898864+08:00;True|2022-06-27T16:28:43.2026298+08:00;True|2022-06-27T16:28:18.9494990+08:00;True|2022-06-27T16:27:16.7453474+08:00;True|2022-06-27T16:18:19.4634998+08:00;True|2022-06-27T16:02:41.1823096+08:00;True|2022-06-27T15:43:51.5116456+08:00;True|2022-06-27T15:23:40.6693098+08:00;True|2022-06-27T15:22:19.3671271+08:00;True|2022-06-27T14:41:57.2976612+08:00;True|2022-06-27T14:33:00.0677612+08:00;True|2022-06-27T14:24:08.5216447+08:00;True|2022-06-27T14:02:02.8566739+08:00;True|2022-06-27T09:23:01.1910441+08:00;True|2022-06-24T10:33:51.1549131+08:00;True|2022-06-24T09:59:03.2881122+08:00;True|2022-06-24T09:15:37.5422200+08:00;True|2022-06-23T15:11:47.3175395+08:00;True|2022-06-17T09:45:32.1714267+08:00;True|2022-06-16T17:03:22.3921843+08:00;True|2022-06-16T15:35:33.2295367+08:00;True|2022-06-16T15:21:17.5490522+08:00;True|2022-06-16T14:53:00.4693599+08:00;True|2022-06-10T14:25:18.7355725+08:00;True|2022-06-09T18:13:39.8032757+08:00;True|2022-06-09T17:57:35.8696074+08:00;True|2022-06-01T17:48:15.4107624+08:00;True|2022-05-31T16:09:22.2674554+08:00;True|2022-05-31T14:15:19.3700456+08:00;True|2022-05-18T09:06:11.5118231+08:00;True|2022-05-17T16:08:22.9679914+08:00;True|2022-02-07T09:32:52.8608715+08:00;True|2022-01-29T15:30:35.5581322+08:00;True|2022-01-29T15:13:03.4191677+08:00;True|2022-01-29T14:52:16.3700211+08:00;True|2022-01-29T14:48:59.8000767+08:00;True|2022-01-29T14:45:14.4545309+08:00;True|2022-01-29T14:38:57.6540259+08:00;True|2022-01-29T13:36:16.2370205+08:00;True|2022-01-29T11:46:45.8432136+08:00;True|2022-01-29T11:20:54.2763765+08:00;True|2022-01-29T11:16:23.0172880+08:00;True|2022-01-29T11:06:15.3648999+08:00;True|2022-01-29T11:00:39.8926536+08:00;True|2022-01-28T14:35:21.7742884+08:00;</History>
<LastFailureDetails /> <LastFailureDetails />
</PropertyGroup> </PropertyGroup>
</Project> </Project>

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID> <Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath> <Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
<NameOfLastUsedPublishProfile>D:\DJY\Code\djyweb_ams\web\djy.WebApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> <NameOfLastUsedPublishProfile>D:\Code\djyweb_ams\web\djy.WebApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<ActiveDebugProfile>djy_AmsApi</ActiveDebugProfile> <ActiveDebugProfile>djy_AmsApi</ActiveDebugProfile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

@ -1,8 +1,10 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging; using NLog.Extensions.Logging;
using NLog.Web; using NLog.Web;
using System;
namespace djy_AfrApi namespace djy_AfrApi
{ {
@ -24,6 +26,15 @@ namespace djy_AfrApi
//logging.SetMinimumLevel(LogLevel.Information); //logging.SetMinimumLevel(LogLevel.Information);
logging.AddConsole(); logging.AddConsole();
logging.AddDebug(); logging.AddDebug();
}).ConfigureHostConfiguration(x =>
{
// 判断当前环境是否为开发环境
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development")
{
x.Sources.Clear();
x.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
}
}).UseNLog(); }).UseNLog();
} }
} }

@ -1,6 +1,6 @@
{ {
"profiles": { "profiles": {
"djy_AfrApi": { "djy_AfrApi_测试环境": {
"commandName": "Project", "commandName": "Project",
"launchUrl": "swagger", "launchUrl": "swagger",
"environmentVariables": { "environmentVariables": {
@ -8,13 +8,13 @@
}, },
"applicationUrl": "http://localhost:30818" "applicationUrl": "http://localhost:30818"
}, },
"IIS Express": { "djy_AfrApi_正式环境": {
"commandName": "IISExpress", "commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger", "launchUrl": "swagger",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Production"
} },
"applicationUrl": "http://localhost:30818"
} }
}, },
"$schema": "http://json.schemastore.org/launchsettings.json", "$schema": "http://json.schemastore.org/launchsettings.json",

@ -8,7 +8,7 @@
} }
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"Urls": "http://*:5012", "Urls": "http://*:30818",
"WebConfig": { "WebConfig": {
"IdentServerUrl": "http://djy-identity.myshipping.net", "IdentServerUrl": "http://djy-identity.myshipping.net",
"WebId": 236, "WebId": 236,
@ -23,13 +23,13 @@
"ConnName": "sqldb", "ConnName": "sqldb",
"cache_time": 10, "cache_time": 10,
"WebHostUrl": "https://zh-userapi.jingyiji.net", "WebHostUrl": "https://zh-userapi.jingyiji.net",
"Redis": "172.31.85.169:6379,defaultDatabase=9,", "Redis": "127.0.0.1,defaultDatabase=9,",
"RedisDb": "9", "RedisDb": "9",
"Rbmq_Host": "172.31.85.169:13866", "Rbmq_Host": "172.31.85.169:13866",
"Rbmq_UserName": "ams", "Rbmq_UserName": "ams",
"Rbmq_Password": "djy_ams", "Rbmq_Password": "djy_ams",
"Rbmq_Sqlhost": "Data Source =172.31.85.154; Initial Catalog=djy_logs; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true", "Rbmq_Sqlhost": "Data Source =47.104.73.97,6761; Initial Catalog=djy_logs; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true",
"DapperDbString": "Data Source =172.31.85.161; Initial Catalog=AMS; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true;", "DapperDbString": "Data Source =47.104.73.97,6762; Initial Catalog=AMS; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true;",
"requesterDea": "HWCDDS", "requesterDea": "HWCDDS",
"DataConnList": [ "DataConnList": [
{ {
@ -38,7 +38,7 @@
"Index": 100, "Index": 100,
"DataType": 1, "DataType": 1,
"Status": 0, "Status": 0,
"ConnString": "Data Source=172.31.85.161; Initial Catalog=AMS; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true;" "ConnString": "Data Source=47.104.73.97,6762; Initial Catalog=AMS; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true;"
}, },
{ {
"SysKey": "Common", "SysKey": "Common",
@ -46,7 +46,7 @@
"Index": 100, "Index": 100,
"DataType": 1, "DataType": 1,
"Status": 0, "Status": 0,
"ConnString": "Data Source=172.31.85.161; Initial Catalog=CommonDB; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true;" "ConnString": "Data Source=47.104.73.97,6762; Initial Catalog=CommonDB; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true;"
}, },
{ {
"SysKey": "djydb", "SysKey": "djydb",
@ -54,7 +54,7 @@
"Index": 100, "Index": 100,
"DataType": 1, "DataType": 1,
"Status": 0, "Status": 0,
"ConnString": "Data Source =172.31.85.154; Initial Catalog=DsPingTai; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true" "ConnString": "Data Source =47.104.73.97,6761; Initial Catalog=DsPingTai; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true"
}, },
{ {
@ -63,7 +63,7 @@
"Index": 100, "Index": 100,
"DataType": 1, "DataType": 1,
"Status": 0, "Status": 0,
"ConnString": "Data Source=172.31.85.154,1433; Initial Catalog=djy_logs; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true" "ConnString": "Data Source=47.104.73.97,6761,1433; Initial Catalog=djy_logs; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true"
} }
] ]
} }

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID> <Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath> <Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
<ActiveDebugProfile>djy_AfrApi</ActiveDebugProfile> <ActiveDebugProfile>djy_AfrApi_正式环境</ActiveDebugProfile>
<NameOfLastUsedPublishProfile>D:\DJY\Code\djyweb_ams\web\djy_AfrApi\Properties\PublishProfiles\FolderProfile-linux.pubxml</NameOfLastUsedPublishProfile> <NameOfLastUsedPublishProfile>D:\DJY\Code\djyweb_ams\web\djy_AfrApi\Properties\PublishProfiles\FolderProfile-linux.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

Loading…
Cancel
Save