From 5bb65e3489e6a9c39b535fbba889c85897925c7a Mon Sep 17 00:00:00 2001
From: wet <1034391973@qq.com>
Date: Mon, 14 Nov 2022 17:47:39 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E6=88=B7=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Entity/BookingStatusLog.cs | 2 +-
.../Myshipping.Application.xml | 4 +-
.../BookingOrder/BookingOrderService.cs | 2 +-
.../BookingOrder/Dto/BookingStatusLogDto.cs | 2 +-
Myshipping.Core/Enum/ErrorCode.cs | 55 +++++++
Myshipping.Core/Myshipping.Core.xml | 42 ++++-
.../DjyTenantParam/DjyTenantParamService.cs | 147 ++++++++++++++++--
.../Service/Tenant/SysTenantService.cs | 2 +-
.../Myshipping.Report.csproj.user | 2 +-
9 files changed, 238 insertions(+), 20 deletions(-)
diff --git a/Myshipping.Application/Entity/BookingStatusLog.cs b/Myshipping.Application/Entity/BookingStatusLog.cs
index 70c19dc3..f5d9d118 100644
--- a/Myshipping.Application/Entity/BookingStatusLog.cs
+++ b/Myshipping.Application/Entity/BookingStatusLog.cs
@@ -22,7 +22,7 @@ namespace Myshipping.Application.Entity
///
/// 状态时间
///
- public DateTime? OpTiem { get; set; }
+ public DateTime? OpTime { get; set; }
///
/// 类别
///
diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml
index 0e8e426f..2237f3ff 100644
--- a/Myshipping.Application/Myshipping.Application.xml
+++ b/Myshipping.Application/Myshipping.Application.xml
@@ -2426,7 +2426,7 @@
状态
-
+
状态时间
@@ -3519,7 +3519,7 @@
状态
-
+
状态时间
diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index 34793395..1ff993d1 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -609,7 +609,7 @@ namespace Myshipping.Application
bookingStatusLog.Gategory = "ship";
bookingStatusLog.CreatedTime = DateTime.Now;
bookingStatusLog.Status = item.Status;
- bookingStatusLog.OpTiem = item.OPTime;
+ bookingStatusLog.OpTime = item.OpTime;
bookingStatusLog.MBLNO = item.MBLNO;
var id = await _statuslog.InsertReturnSnowflakeIdAsync(bookingStatusLog);
if (item.detail != null && item.detail.Count > 0)
diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs
index 4204002e..4fb88455 100644
--- a/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs
+++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs
@@ -22,7 +22,7 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
///
/// 状态时间
///
- public DateTime? OPTime { get; set; }
+ public DateTime? OpTime { get; set; }
///
/// 类别
///
diff --git a/Myshipping.Core/Enum/ErrorCode.cs b/Myshipping.Core/Enum/ErrorCode.cs
index c22e553c..8f93df63 100644
--- a/Myshipping.Core/Enum/ErrorCode.cs
+++ b/Myshipping.Core/Enum/ErrorCode.cs
@@ -415,4 +415,59 @@ public enum ErrorCode
EMAIL001,
#endregion
+
+
+
+
+ #region 租户参数
+
+ ///
+ /// 主键不能为空
+ ///
+ [ErrorCodeItemMetadata("主键不能为空")]
+ Param000,
+
+ ///
+ /// 类别代码不能为空
+ ///
+ [ErrorCodeItemMetadata("类别代码不能为空")]
+ Param001,
+ ///
+ /// 类别名称不能为空
+ ///
+ [ErrorCodeItemMetadata("类别名称不能为空")]
+ Param002,
+
+ ///
+ /// 业务大类不能为空
+ ///
+ [ErrorCodeItemMetadata("业务大类不能为空")]
+ Param003,
+
+ ///
+ /// 存在相同数据
+ ///
+ [ErrorCodeItemMetadata("存在相同数据")]
+ Param004,
+
+ ///
+ /// 租户参数代码不能为空
+ ///
+ [ErrorCodeItemMetadata("租户参数代码不能为空")]
+ Param005,
+
+
+ ///
+ /// 租户参数名称不能为空
+ ///
+ [ErrorCodeItemMetadata("租户参数名称不能为空")]
+ Param006,
+
+ ///
+ /// 租户ID不能为空
+ ///
+ [ErrorCodeItemMetadata("租户ID不能为空")]
+ Param007,
+
+ #endregion
}
diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml
index 673c5660..1071a9aa 100644
--- a/Myshipping.Core/Myshipping.Core.xml
+++ b/Myshipping.Core/Myshipping.Core.xml
@@ -4035,6 +4035,46 @@
邮箱账号已存在
+
+
+ 主键不能为空
+
+
+
+
+ 类别代码不能为空
+
+
+
+
+ 类别名称不能为空
+
+
+
+
+ 业务大类不能为空
+
+
+
+
+ 存在相同数据
+
+
+
+
+ 租户参数代码不能为空
+
+
+
+
+ 租户参数名称不能为空
+
+
+
+
+ 租户ID不能为空
+
+
文件扩展枚举
@@ -9240,7 +9280,7 @@
-
+
获取参数
diff --git a/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs b/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs
index 95a4f459..5cc2755c 100644
--- a/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs
+++ b/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs
@@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using Myshipping.Core.Entity;
using System;
+using Furion.FriendlyException;
namespace Myshipping.Core.Service
{
@@ -33,7 +34,7 @@ namespace Myshipping.Core.Service
_cache = cache;
}
-
+ #region 类别
///
/// 增加租户参数类别表
///
@@ -41,6 +42,21 @@ namespace Myshipping.Core.Service
[HttpPost("/DJYTenantParam/add")]
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.Param002);
+ }
+
+ var list=await _rep.FirstOrDefaultAsync(x => x.ParaCode == input.ParaCode && x.Type == input.Type);
+ if (list!=null) {
+ throw Oops.Oh(ErrorCode.Param004);
+ }
var entity = input.Adapt();
await _rep.InsertAsync(entity);
}
@@ -52,6 +68,27 @@ namespace Myshipping.Core.Service
[HttpPost("/DJYTenantParam/edit")]
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.Param002);
+ }
+ var list = await _rep.FirstOrDefaultAsync(x => x.ParaCode == input.ParaCode && x.Type == input.Type&&x.Id!=input.Id);
+ if (list != null)
+ {
+ throw Oops.Oh(ErrorCode.Param004);
+ }
var entity = input.Adapt();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
@@ -64,12 +101,17 @@ namespace Myshipping.Core.Service
[SqlSugarUnitOfWork]
public async Task Delete(long Id)
{
+ if (Id == 0)
+ {
+ throw Oops.Oh(ErrorCode.Param000);
+ }
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == Id);
await _itemrep.DeleteAsync(m => m.ParaCode == entity.ParaCode);
await _valuerep.DeleteAsync(m => m.ParaCode == entity.ParaCode);
await _rep.DeleteAsync(entity);
}
+
///
/// 获取租户参数类别
///
@@ -79,6 +121,9 @@ namespace Myshipping.Core.Service
{
return await _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(Type),x => x.Type == Type).OrderBy(x => x.Sort).ToListAsync();
}
+ #endregion
+
+ #region 参数
///
/// 获取租户参数
@@ -100,6 +145,23 @@ namespace Myshipping.Core.Service
[HttpPost("/DJYTenantParam/addParamItem")]
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();
await _itemrep.InsertAsync(entity);
}
@@ -112,6 +174,27 @@ namespace Myshipping.Core.Service
[HttpPost("/DJYTenantParam/editParamItem")]
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();
await _itemrep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
@@ -125,30 +208,32 @@ namespace Myshipping.Core.Service
[SqlSugarUnitOfWork]
public async Task DeleteParamItem(long Id)
{
+ if (Id == 0)
+ {
+ throw Oops.Oh(ErrorCode.Param000);
+ }
var entity = await _itemrep.FirstOrDefaultAsync(u => u.Id == Id);
-
await _valuerep.DeleteAsync(m => m.ItemCode == entity.ItemCode && m.ParaCode == entity.ParaCode);
await _itemrep.DeleteAsync(entity);
}
+
+
+ #endregion
+
+
+ #region 值
///
/// 获取参数
///
///
[HttpGet("/DJYTenantParam/getParamValue")]
- public async Task> GetParamValue(long tenantId)
+ public async Task> GetParamValue(long tenantId, string paraCode=null)
{
- if (tenantId==0) {
- tenantId = Convert.ToInt64(UserManager.TENANT_ID);
- }
- return await _valuerep.AsQueryable().Where(x => x.TenantId == tenantId).OrderBy(x => x.Sort).ToListAsync();
+ return await _valuerep.AsQueryable().Where(x => x.TenantId == tenantId).WhereIF(paraCode!=null,x=>x.ParaCode==paraCode).OrderBy(x => x.Sort).ToListAsync();
}
-
-
-
-
///
/// 增加参数
///
@@ -157,6 +242,23 @@ namespace Myshipping.Core.Service
public async Task AddParamValue(DjyTenantParamValue input)
{
var entity = input.Adapt();
+ 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 CacheData();
}
@@ -170,6 +272,27 @@ namespace Myshipping.Core.Service
public async Task UpdateParamValue(DjyTenantParamValue input)
{
var entity = input.Adapt();
+ 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 CacheData();
}
@@ -185,7 +308,7 @@ namespace Myshipping.Core.Service
var entity = await _itemrep.FirstOrDefaultAsync(u => u.Id == Id);
await _valuerep.DeleteAsync(entity);
}
-
+ #endregion
public async Task CacheData()
{
diff --git a/Myshipping.Core/Service/Tenant/SysTenantService.cs b/Myshipping.Core/Service/Tenant/SysTenantService.cs
index 32adccdb..bfba0afc 100644
--- a/Myshipping.Core/Service/Tenant/SysTenantService.cs
+++ b/Myshipping.Core/Service/Tenant/SysTenantService.cs
@@ -82,7 +82,7 @@ public class SysTenantService : ISysTenantService, IDynamicApiController, ITrans
public async Task QueryTenantPageList([FromQuery] TenantInput input)
{
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.Host), u => u.Host.Contains(input.Host.Trim()))
.Select()
diff --git a/Myshipping.Report/Myshipping.Report.csproj.user b/Myshipping.Report/Myshipping.Report.csproj.user
index 5831b7bf..c54031d1 100644
--- a/Myshipping.Report/Myshipping.Report.csproj.user
+++ b/Myshipping.Report/Myshipping.Report.csproj.user
@@ -8,7 +8,7 @@
- Debug|Any CPU
+ Release|Any CPU