VGM直发

booking_auth_dev
wanghaomei 2 years ago
commit 17885cd453

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -22,7 +22,7 @@ namespace Myshipping.Application.Entity
/// <summary> /// <summary>
/// 状态时间 /// 状态时间
/// </summary> /// </summary>
public DateTime? OpTiem { get; set; } public DateTime? OpTime { get; set; }
/// <summary> /// <summary>
/// 类别 /// 类别
/// </summary> /// </summary>

File diff suppressed because it is too large Load Diff

@ -57,7 +57,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrint; private readonly SqlSugarRepository<BookingPrintTemplate> _repPrint;
private readonly ILogger<BookingOrderService> _logger; private readonly ILogger<BookingOrderService> _logger;
private readonly ISysCacheService _cache; private readonly ISysCacheService _cache;
private readonly SqlSugarRepository<BookingStatusLog> _statuslog; private readonly SqlSugarRepository<BookingStatusLog> _repStatuslog;
private readonly SqlSugarRepository<BookingStatusLogDetail> _statuslogdetail; private readonly SqlSugarRepository<BookingStatusLogDetail> _statuslogdetail;
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrintTemplate; private readonly SqlSugarRepository<BookingPrintTemplate> _repPrintTemplate;
private readonly SqlSugarRepository<BookingLetteryard> _repLetterYard; private readonly SqlSugarRepository<BookingLetteryard> _repLetterYard;
@ -85,7 +85,7 @@ namespace Myshipping.Application
this._repPrint = repPrint; this._repPrint = repPrint;
this._dicdata = dicdata; this._dicdata = dicdata;
this._cache = cache; this._cache = cache;
this._statuslog = statuslog; this._repStatuslog = statuslog;
this._statuslogdetail = statuslogdetail; this._statuslogdetail = statuslogdetail;
this._repPrintTemplate = repPrintTemplate; this._repPrintTemplate = repPrintTemplate;
this._repLetterYard = repLetterYard; this._repLetterYard = repLetterYard;
@ -555,7 +555,7 @@ namespace Myshipping.Application
public async Task<List<BookingStatusLogDto>> GetBookingStatusLog(long Id) public async Task<List<BookingStatusLogDto>> GetBookingStatusLog(long Id)
{ {
var statuslog = await _statuslog.AsQueryable().Where(x => x.BookingId == Id).ToListAsync(); var statuslog = await _repStatuslog.AsQueryable().Where(x => x.BookingId == Id).ToListAsync();
var dto = statuslog.Adapt<List<BookingStatusLogDto>>(); var dto = statuslog.Adapt<List<BookingStatusLogDto>>();
foreach (var item in dto) foreach (var item in dto)
{ {
@ -610,8 +610,8 @@ namespace Myshipping.Application
foreach (var item in all) foreach (var item in all)
{ {
//清空原有数据 //清空原有数据
var old = await _statuslog.AsQueryable().Where(x => x.BookingId == item.BookingId && x.Gategory == "ship").ToListAsync(); var old = await _repStatuslog.AsQueryable().Where(x => x.BookingId == item.BookingId && x.Gategory == "ship").ToListAsync();
await _statuslog.DeleteAsync(x => x.BookingId == item.BookingId && x.Gategory == "ship"); await _repStatuslog.DeleteAsync(x => x.BookingId == item.BookingId && x.Gategory == "ship");
foreach (var ot in old) foreach (var ot in old)
{ {
await _statuslogdetail.DeleteAsync(x => x.PId == ot.Id); await _statuslogdetail.DeleteAsync(x => x.PId == ot.Id);
@ -622,9 +622,9 @@ namespace Myshipping.Application
bookingStatusLog.Gategory = "ship"; bookingStatusLog.Gategory = "ship";
bookingStatusLog.CreatedTime = DateTime.Now; bookingStatusLog.CreatedTime = DateTime.Now;
bookingStatusLog.Status = item.Status; bookingStatusLog.Status = item.Status;
bookingStatusLog.OpTiem = item.OPTime; bookingStatusLog.OpTime = item.OpTime;
bookingStatusLog.MBLNO = item.MBLNO; bookingStatusLog.MBLNO = item.MBLNO;
var id = await _statuslog.InsertReturnSnowflakeIdAsync(bookingStatusLog); var id = await _repStatuslog.InsertReturnSnowflakeIdAsync(bookingStatusLog);
if (item.detail != null && item.detail.Count > 0) if (item.detail != null && item.detail.Count > 0)
{ {
foreach (var dt in item.detail) foreach (var dt in item.detail)
@ -952,8 +952,10 @@ namespace Myshipping.Application
var bsl = new BookingStatusLog(); var bsl = new BookingStatusLog();
bsl.BookingId = bookingId; bsl.BookingId = bookingId;
bsl.Status = $"生成提箱小票链接"; bsl.Status = $"生成提箱小票链接";
bsl.OpTiem = DateTime.Now; bsl.OpTime = DateTime.Now;
bsl.Gategory = "ship"; bsl.Gategory = "ship";
bsl.MBLNO = order.MBLNO;
await _repStatuslog.InsertAsync(bsl);
return txxpUrl; return txxpUrl;
} }
@ -1113,7 +1115,15 @@ namespace Myshipping.Application
ordUrl.UrlVgmSi = memoData.GetStringValue("vgmAndSiUrl"); ordUrl.UrlVgmSi = memoData.GetStringValue("vgmAndSiUrl");
await _repOrderUrl.UpdateAsync(ordUrl); await _repOrderUrl.UpdateAsync(ordUrl);
//todo:货运动态
//货运动态
var bsl = new BookingStatusLog();
bsl.BookingId = bookingId;
bsl.Status = $"生成VGM链接";
bsl.OpTime = DateTime.Now;
bsl.Gategory = "ship";
bsl.MBLNO = order.MBLNO;
await _repStatuslog.InsertAsync(bsl);
return new string[] { ordUrl.UrlVgm, ordUrl.UrlVgmSi }; return new string[] { ordUrl.UrlVgm, ordUrl.UrlVgmSi };
} }
@ -1263,7 +1273,15 @@ namespace Myshipping.Application
throw Oops.Oh(BookingErrorCode.BOOK128, jobjResp.GetStringValue("message")); throw Oops.Oh(BookingErrorCode.BOOK128, jobjResp.GetStringValue("message"));
} }
//todo:货运动态
//货运动态
var bsl = new BookingStatusLog();
bsl.BookingId = bookingId;
bsl.Status = $"直发VGM";
bsl.OpTime = DateTime.Now;
bsl.Gategory = "ship";
bsl.MBLNO = order.MBLNO;
await _repStatuslog.InsertAsync(bsl);
} }
@ -1271,7 +1289,26 @@ namespace Myshipping.Application
#endregion #endregion
#region 订舱、截单EDI #region 订舱、截单EDI
/// <summary>
/// 发送订舱、截单EDI
/// </summary>
/// <param name="model">订舱、截单EDI请求</param>
/// <returns>返回回执</returns>
public async Task<CommonWebApiResult> SendBookingOrClosingEDI(BookingOrClosingEDIOrderDto model)
{
CommonWebApiResult result = new CommonWebApiResult();
try
{
}
catch (Exception ex)
{
result.succ = false;
result.msg = ex.Message;
}
return result;
}
#endregion #endregion
#region 其他 #region 其他

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 海运订舱或截单EDI请求
/// </summary>
public class BookingOrClosingEDIOrderDto
{
/// <summary>
/// 订单主键
/// </summary>
public long Id { get; set; }
/// <summary>
/// 订单号
/// </summary>
public string orderNo { get; set; }
/// <summary>
/// 是否使用货代代码
/// </summary>
public bool useForwarderCode { get; set; }
/// <summary>
/// 货代代码
/// </summary>
public string forwarderCode { get; set; }
/// <summary>
/// 货代名称
/// </summary>
public string forwarderName { get; set; }
/// <summary>
///
/// </summary>
public string fileRole { get; set; }
/// <summary>
/// 发送类型
/// </summary>
public string sendType { get; set; } = "B";
/// <summary>
/// 是否直接发送 (默认false)
/// </summary>
public bool send { get; set; } = false;
}
}

@ -22,7 +22,7 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
/// <summary> /// <summary>
/// 状态时间 /// 状态时间
/// </summary> /// </summary>
public DateTime? OPTime { get; set; } public DateTime? OpTime { get; set; }
/// <summary> /// <summary>
/// 类别 /// 类别
/// </summary> /// </summary>

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 通用WebApi返回回执
/// </summary>
public class CommonWebApiResult
{
/// <summary>
/// 是否成功 true=成功 false=失败
/// </summary>
public bool succ { get; set; } = false;
/// <summary>
/// 状态 0-成功
/// </summary>
public int status { get; set; } = 0;
/// <summary>
/// 返回消息
/// </summary>
public string msg { get; set; }
/// <summary>
/// 总记录数
/// </summary>
public int total { get; set; }
/// <summary>
/// 当前页列表数据
/// </summary>
public object rows { get; set; }
/// <summary>
/// 合计信息
/// </summary>
public object summary { get; set; }
/// <summary>
/// 扩展信息
/// </summary>
public object extra { get; set; }
/// <summary>
/// 扩展信息2
/// </summary>
public object extra2 { get; set; }
}
}

@ -35,5 +35,12 @@ namespace Myshipping.Application
Task AddBookingStatusLog(List<BookingStatusLogDto> all); Task AddBookingStatusLog(List<BookingStatusLogDto> all);
/// <summary>
/// 发送订舱、截单EDI
/// </summary>
/// <param name="model">订舱、截单EDI请求</param>
/// <returns>返回回执</returns>
Task<CommonWebApiResult> SendBookingOrClosingEDI (BookingOrClosingEDIOrderDto model);
} }
} }

@ -415,4 +415,63 @@ public enum ErrorCode
EMAIL001, EMAIL001,
#endregion #endregion
#region 租户参数
/// <summary>
/// 主键不能为空
/// </summary>
[ErrorCodeItemMetadata("主键不能为空")]
Param000,
/// <summary>
/// 类别代码不能为空
/// </summary>
[ErrorCodeItemMetadata("类别代码不能为空")]
Param001,
/// <summary>
/// 类别名称不能为空
/// </summary>
[ErrorCodeItemMetadata("类别名称不能为空")]
Param002,
/// <summary>
/// 业务大类不能为空
/// </summary>
[ErrorCodeItemMetadata("业务大类不能为空")]
Param003,
/// <summary>
/// 存在相同数据
/// </summary>
[ErrorCodeItemMetadata("存在相同数据")]
Param004,
/// <summary>
/// 租户参数代码不能为空
/// </summary>
[ErrorCodeItemMetadata("租户参数代码不能为空")]
Param005,
/// <summary>
/// 租户参数名称不能为空
/// </summary>
[ErrorCodeItemMetadata("租户参数名称不能为空")]
Param006,
/// <summary>
/// 租户ID不能为空
/// </summary>
[ErrorCodeItemMetadata("租户ID不能为空")]
Param007,
/// <summary>
/// 业务大类不能为空
/// </summary>
[ErrorCodeItemMetadata("业务大类不能为空")]
Param008,
#endregion
} }

@ -4035,6 +4035,51 @@
邮箱账号已存在 邮箱账号已存在
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.ErrorCode.Param000">
<summary>
主键不能为空
</summary>
</member>
<member name="F:Myshipping.Core.ErrorCode.Param001">
<summary>
类别代码不能为空
</summary>
</member>
<member name="F:Myshipping.Core.ErrorCode.Param002">
<summary>
类别名称不能为空
</summary>
</member>
<member name="F:Myshipping.Core.ErrorCode.Param003">
<summary>
业务大类不能为空
</summary>
</member>
<member name="F:Myshipping.Core.ErrorCode.Param004">
<summary>
存在相同数据
</summary>
</member>
<member name="F:Myshipping.Core.ErrorCode.Param005">
<summary>
租户参数代码不能为空
</summary>
</member>
<member name="F:Myshipping.Core.ErrorCode.Param006">
<summary>
租户参数名称不能为空
</summary>
</member>
<member name="F:Myshipping.Core.ErrorCode.Param007">
<summary>
租户ID不能为空
</summary>
</member>
<member name="F:Myshipping.Core.ErrorCode.Param008">
<summary>
业务大类不能为空
</summary>
</member>
<member name="T:Myshipping.Core.FileExtensionEnum"> <member name="T:Myshipping.Core.FileExtensionEnum">
<summary> <summary>
文件扩展枚举 文件扩展枚举
@ -9210,7 +9255,7 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.DjyTenantParamService.List(System.String)"> <member name="M:Myshipping.Core.Service.DjyTenantParamService.List(System.String,System.String)">
<summary> <summary>
获取租户参数类别 获取租户参数类别
</summary> </summary>
@ -9240,7 +9285,7 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.DjyTenantParamService.GetParamValue(System.Int64)"> <member name="M:Myshipping.Core.Service.DjyTenantParamService.GetParamValue(System.Int64,System.String)">
<summary> <summary>
获取参数 获取参数
</summary> </summary>
@ -9260,7 +9305,7 @@
</member> </member>
<member name="M:Myshipping.Core.Service.DjyTenantParamService.DeleteParamValue(System.Int64)"> <member name="M:Myshipping.Core.Service.DjyTenantParamService.DeleteParamValue(System.Int64)">
<summary> <summary>
删除租户参数类别表 删除参数
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>

@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging;
using System.Collections.Generic; using System.Collections.Generic;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
using System; using System;
using Furion.FriendlyException;
namespace Myshipping.Core.Service namespace Myshipping.Core.Service
{ {
@ -33,7 +34,7 @@ namespace Myshipping.Core.Service
_cache = cache; _cache = cache;
} }
#region 类别
/// <summary> /// <summary>
/// 增加租户参数类别表 /// 增加租户参数类别表
/// </summary> /// </summary>
@ -41,6 +42,25 @@ namespace Myshipping.Core.Service
[HttpPost("/DJYTenantParam/add")] [HttpPost("/DJYTenantParam/add")]
public async Task Add(AddDJYTenantParamInput input) public async Task Add(AddDJYTenantParamInput input)
{ {
if (string.IsNullOrWhiteSpace(input.ParaCode))
{
throw Oops.Oh(ErrorCode.Param001);
}
if (string.IsNullOrWhiteSpace(input.ParaName))
{
throw Oops.Oh(ErrorCode.Param002);
}
if (string.IsNullOrWhiteSpace(input.Type))
{
throw Oops.Oh(ErrorCode.Param008);
}
var list = await _rep.FirstOrDefaultAsync(x => x.ParaCode == input.ParaCode);
if (list != null)
{
throw Oops.Oh(ErrorCode.Param004);
}
var entity = input.Adapt<DjyTenantParam>(); var entity = input.Adapt<DjyTenantParam>();
await _rep.InsertAsync(entity); await _rep.InsertAsync(entity);
} }
@ -52,6 +72,28 @@ namespace Myshipping.Core.Service
[HttpPost("/DJYTenantParam/edit")] [HttpPost("/DJYTenantParam/edit")]
public async Task Update(UpdateDJYTenantParamInput input) public async Task Update(UpdateDJYTenantParamInput input)
{ {
if (input.Id == 0)
{
throw Oops.Oh(ErrorCode.Param000);
}
if (string.IsNullOrWhiteSpace(input.ParaCode))
{
throw Oops.Oh(ErrorCode.Param001);
}
if (string.IsNullOrWhiteSpace(input.ParaName))
{
throw Oops.Oh(ErrorCode.Param002);
}
if (string.IsNullOrWhiteSpace(input.Type))
{
throw Oops.Oh(ErrorCode.Param008);
}
var list = await _rep.FirstOrDefaultAsync(x => x.ParaCode == input.ParaCode && x.Id != input.Id);
if (list != null)
{
throw Oops.Oh(ErrorCode.Param004);
}
var entity = input.Adapt<DjyTenantParam>(); var entity = input.Adapt<DjyTenantParam>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
} }
@ -64,21 +106,29 @@ namespace Myshipping.Core.Service
[SqlSugarUnitOfWork] [SqlSugarUnitOfWork]
public async Task Delete(long Id) public async Task Delete(long Id)
{ {
if (Id == 0)
{
throw Oops.Oh(ErrorCode.Param000);
}
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == Id); var entity = await _rep.FirstOrDefaultAsync(u => u.Id == Id);
await _itemrep.DeleteAsync(m => m.ParaCode == entity.ParaCode); await _itemrep.DeleteAsync(m => m.ParaCode == entity.ParaCode);
await _valuerep.DeleteAsync(m => m.ParaCode == entity.ParaCode); await _valuerep.DeleteAsync(m => m.ParaCode == entity.ParaCode);
await _rep.DeleteAsync(entity); await _rep.DeleteAsync(entity);
} }
/// <summary> /// <summary>
/// 获取租户参数类别 /// 获取租户参数类别
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("/DJYTenantParam/list")] [HttpGet("/DJYTenantParam/list")]
public async Task<List<DjyTenantParam>> List(string Type) public async Task<List<DjyTenantParam>> List(string Type, string ParaName)
{ {
return await _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(Type),x => x.Type == Type).OrderBy(x => x.Sort).ToListAsync(); return await _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(Type), x => x.Type == Type).WhereIF(!string.IsNullOrEmpty(ParaName), x => x.ParaName.Contains(ParaName)).OrderBy(x => x.Sort).ToListAsync();
} }
#endregion
#region 参数
/// <summary> /// <summary>
/// 获取租户参数 /// 获取租户参数
@ -100,6 +150,23 @@ namespace Myshipping.Core.Service
[HttpPost("/DJYTenantParam/addParamItem")] [HttpPost("/DJYTenantParam/addParamItem")]
public async Task AddParamItem(DjyTenantParamItem input) public async Task AddParamItem(DjyTenantParamItem input)
{ {
if (string.IsNullOrWhiteSpace(input.ParaCode))
{
throw Oops.Oh(ErrorCode.Param001);
}
if (string.IsNullOrWhiteSpace(input.ItemCode))
{
throw Oops.Oh(ErrorCode.Param005);
}
if (string.IsNullOrWhiteSpace(input.ItemName))
{
throw Oops.Oh(ErrorCode.Param006);
}
var list = await _itemrep.FirstOrDefaultAsync(x => x.ParaCode == input.ParaCode && x.ItemCode == input.ItemCode);
if (list != null)
{
throw Oops.Oh(ErrorCode.Param004);
}
var entity = input.Adapt<DjyTenantParamItem>(); var entity = input.Adapt<DjyTenantParamItem>();
await _itemrep.InsertAsync(entity); await _itemrep.InsertAsync(entity);
} }
@ -112,6 +179,27 @@ namespace Myshipping.Core.Service
[HttpPost("/DJYTenantParam/editParamItem")] [HttpPost("/DJYTenantParam/editParamItem")]
public async Task UpdateParamItem(DjyTenantParamItem input) public async Task UpdateParamItem(DjyTenantParamItem input)
{ {
if (input.Id == 0)
{
throw Oops.Oh(ErrorCode.Param000);
}
if (string.IsNullOrWhiteSpace(input.ParaCode))
{
throw Oops.Oh(ErrorCode.Param001);
}
if (string.IsNullOrWhiteSpace(input.ItemCode))
{
throw Oops.Oh(ErrorCode.Param005);
}
if (string.IsNullOrWhiteSpace(input.ItemName))
{
throw Oops.Oh(ErrorCode.Param006);
}
var list = await _itemrep.FirstOrDefaultAsync(x => x.ParaCode == input.ParaCode && x.ItemCode == input.ItemCode && x.Id != input.Id);
if (list != null)
{
throw Oops.Oh(ErrorCode.Param004);
}
var entity = input.Adapt<DjyTenantParamItem>(); var entity = input.Adapt<DjyTenantParamItem>();
await _itemrep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); await _itemrep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
@ -125,30 +213,32 @@ namespace Myshipping.Core.Service
[SqlSugarUnitOfWork] [SqlSugarUnitOfWork]
public async Task DeleteParamItem(long Id) public async Task DeleteParamItem(long Id)
{ {
if (Id == 0)
{
throw Oops.Oh(ErrorCode.Param000);
}
var entity = await _itemrep.FirstOrDefaultAsync(u => u.Id == Id); var entity = await _itemrep.FirstOrDefaultAsync(u => u.Id == Id);
await _valuerep.DeleteAsync(m => m.ItemCode == entity.ItemCode && m.ParaCode == entity.ParaCode); await _valuerep.DeleteAsync(m => m.ItemCode == entity.ItemCode && m.ParaCode == entity.ParaCode);
await _itemrep.DeleteAsync(entity); await _itemrep.DeleteAsync(entity);
} }
#endregion
#region 值
/// <summary> /// <summary>
/// 获取参数 /// 获取参数
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("/DJYTenantParam/getParamValue")] [HttpGet("/DJYTenantParam/getParamValue")]
public async Task<List<DjyTenantParamValue>> GetParamValue(long tenantId) public async Task<List<DjyTenantParamValue>> GetParamValue(long tenantId, string paraCode = null)
{ {
if (tenantId==0) { return await _valuerep.AsQueryable().Filter(null, true).Where(x => x.TenantId == tenantId).WhereIF(paraCode != null, x => x.ParaCode == paraCode).OrderBy(x => x.Sort).ToListAsync();
tenantId = Convert.ToInt64(UserManager.TENANT_ID);
}
return await _valuerep.AsQueryable().Where(x => x.TenantId == tenantId).OrderBy(x => x.Sort).ToListAsync();
} }
/// <summary> /// <summary>
/// 增加参数 /// 增加参数
/// </summary> /// </summary>
@ -157,6 +247,23 @@ namespace Myshipping.Core.Service
public async Task AddParamValue(DjyTenantParamValue input) public async Task AddParamValue(DjyTenantParamValue input)
{ {
var entity = input.Adapt<DjyTenantParamValue>(); var entity = input.Adapt<DjyTenantParamValue>();
if (string.IsNullOrWhiteSpace(input.ParaCode))
{
throw Oops.Oh(ErrorCode.Param001);
}
if (string.IsNullOrWhiteSpace(input.ItemCode))
{
throw Oops.Oh(ErrorCode.Param005);
}
if (input.TenantId == null)
{
throw Oops.Oh(ErrorCode.Param007);
}
var list = await _valuerep.FirstOrDefaultAsync(x => x.ParaCode == input.ParaCode && x.TenantId == input.TenantId);
if (list != null)
{
throw Oops.Oh(ErrorCode.Param004);
}
await _valuerep.InsertAsync(entity); await _valuerep.InsertAsync(entity);
await CacheData(); await CacheData();
} }
@ -170,22 +277,42 @@ namespace Myshipping.Core.Service
public async Task UpdateParamValue(DjyTenantParamValue input) public async Task UpdateParamValue(DjyTenantParamValue input)
{ {
var entity = input.Adapt<DjyTenantParamValue>(); var entity = input.Adapt<DjyTenantParamValue>();
if (input.Id == 0)
{
throw Oops.Oh(ErrorCode.Param000);
}
if (string.IsNullOrWhiteSpace(input.ParaCode))
{
throw Oops.Oh(ErrorCode.Param001);
}
if (string.IsNullOrWhiteSpace(input.ItemCode))
{
throw Oops.Oh(ErrorCode.Param005);
}
if (input.TenantId == null)
{
throw Oops.Oh(ErrorCode.Param007);
}
var list = await _valuerep.FirstOrDefaultAsync(x => x.ParaCode == input.ParaCode && x.TenantId == input.TenantId && x.Id != input.Id);
if (list != null)
{
throw Oops.Oh(ErrorCode.Param004);
}
await _valuerep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); await _valuerep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
await CacheData(); await CacheData();
} }
/// <summary> /// <summary>
/// 删除租户参数类别表 ///删除参数
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost("/DJYTenantParam/deleteParamValue")] [HttpPost("/DJYTenantParam/deleteParamValue")]
[SqlSugarUnitOfWork] [SqlSugarUnitOfWork]
public async Task DeleteParamValue(long Id) public async Task DeleteParamValue(long Id)
{ {
var entity = await _itemrep.FirstOrDefaultAsync(u => u.Id == Id); await _valuerep.DeleteAsync(u => u.Id == Id);
await _valuerep.DeleteAsync(entity);
} }
#endregion
public async Task CacheData() public async Task CacheData()
{ {

@ -11,7 +11,7 @@ namespace Myshipping.Core.Service
Task Add(AddDJYTenantParamInput input); Task Add(AddDJYTenantParamInput input);
Task Update(UpdateDJYTenantParamInput input); Task Update(UpdateDJYTenantParamInput input);
Task Delete(long Id); Task Delete(long Id);
Task<List<DjyTenantParam>> List(string Type); Task<List<DjyTenantParam>> List(string Type,string ParaName);
Task<List<DjyTenantParamItem>> GetParamItem(string ParaCode); Task<List<DjyTenantParamItem>> GetParamItem(string ParaCode);
Task AddParamItem(DjyTenantParamItem input); Task AddParamItem(DjyTenantParamItem input);

@ -82,7 +82,7 @@ public class SysTenantService : ISysTenantService, IDynamicApiController, ITrans
public async Task<dynamic> QueryTenantPageList([FromQuery] TenantInput input) public async Task<dynamic> QueryTenantPageList([FromQuery] TenantInput input)
{ {
var tenants = await _sysTenantRep.AsQueryable() var tenants = await _sysTenantRep.AsQueryable()
.Where(m => m.TenantType != TenantTypeEnum.SYSTEM) //.Where(m => m.TenantType != TenantTypeEnum.SYSTEM)
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Host), u => u.Host.Contains(input.Host.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Host), u => u.Host.Contains(input.Host.Trim()))
.Select<TenantOutput>() .Select<TenantOutput>()

Loading…
Cancel
Save