jianghaiqing 2 years ago
commit 07ba425b5a

@ -1765,6 +1765,7 @@ namespace Myshipping.Application
} }
var order = await _rep.FirstOrDefaultAsync(x => x.Id == bookingId); var order = await _rep.FirstOrDefaultAsync(x => x.Id == bookingId);
var edi = await _bookingEDIExt.FirstOrDefaultAsync(x => x.BookingId == bookingId);
if (order == null) if (order == null)
{ {
throw Oops.Bah(BookingErrorCode.BOOK001); throw Oops.Bah(BookingErrorCode.BOOK001);
@ -1847,11 +1848,15 @@ namespace Myshipping.Application
{ {
if (entity.Where(x => x.Row == _row && x.Column == _cellNum).Count() > 0) if (entity.Where(x => x.Row == _row && x.Column == _cellNum).Count() > 0)
{ {
var name = entity.Where(x => x.Row == _row && x.Column == _cellNum).Select(x => x.Field).FirstOrDefault();
if (name.Split('.')[0].ToLower() == "order")
{
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order)) foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order))
{ {
var name = entity.Where(x => x.Row == _row && x.Column == _cellNum).Select(x => x.Field).FirstOrDefault();
var _name = descriptor.Name.ToLower(); var _name = descriptor.Name.ToLower();
if (name == _name) if (name.Split('.')[0].ToLower() == "order" && name.Split('.')[1].ToLower() == _name)
{ {
var value = descriptor.GetValue(order).ToString(); var value = descriptor.GetValue(order).ToString();
ICell cell = row.GetCell(_cellNum - 1); ICell cell = row.GetCell(_cellNum - 1);
@ -1869,6 +1874,71 @@ namespace Myshipping.Application
} }
} }
} }
}
if (name.Split('.')[0].ToLower() == "edi")
{
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(edi))
{
var _name = descriptor.Name.ToLower();
if (name.Split('.')[0].ToLower() == "edi" && name.Split('.')[1].ToLower() == _name)
{
var value = descriptor.GetValue(edi).ToString();
ICell cell = row.GetCell(_cellNum - 1);
if (descriptor.PropertyType.FullName.Contains("DateTime"))
{
value = value != null ? Convert.ToDateTime(value).ToString("yyyy-MM-dd") : "";
}
if (cell != null)
{
row.Cells[_cellNum - 1].SetCellValue(value);
}
else
{
row.CreateCell(_cellNum - 1).SetCellValue(value);
}
}
}
}
if (name.Split('.')[0].ToLower() != "order" && name.Split('.')[0].ToLower() != "edi" && name.Split('.')[0].ToLower() != "ctn")
{
ICell cell = row.GetCell(_cellNum - 1);
var value = string.Empty;
if (name.Split('.')[0].ToLower() == "username")
{
value = UserManager.Name;
}
if (name.Split('.')[0].ToLower() == "usertel")
{
value = UserManager.TEl;
}
if (name.Split('.')[0].ToLower() == "usermobile")
{
value = UserManager.Phone;
}
if (name.Split('.')[0].ToLower() == "useremail")
{
value = UserManager.Email;
}
if (name.Split('.')[0].ToLower() == "usertenant")
{
value = UserManager.TENANT_NAME;
}
if (cell != null)
{
row.Cells[_cellNum - 1].SetCellValue(value);
}
else
{
row.CreateCell(_cellNum - 1).SetCellValue(value);
}
}
} }
} }
} }
@ -1880,18 +1950,71 @@ namespace Myshipping.Application
for (int _cellNum = 1; _cellNum <= entity.Max(x => x.Column); _cellNum++) for (int _cellNum = 1; _cellNum <= entity.Max(x => x.Column); _cellNum++)
{ {
if (entity.Where(x => x.Row == _row && x.Column == _cellNum).Count() > 0) if (entity.Where(x => x.Row == _row && x.Column == _cellNum).Count() > 0)
{
var name = entity.Where(x => x.Row == _row && x.Column == _cellNum).Select(x => x.Field).FirstOrDefault();
if (name.Split('.')[0].ToLower() == "order")
{ {
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order)) foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order))
{ {
var name = entity.Where(x => x.Row == _row && x.Column == _cellNum).Select(x => x.Field).FirstOrDefault();
var _name = descriptor.Name.ToLower(); var _name = descriptor.Name.ToLower();
if (name == _name) if (name.Split('.')[1].ToLower() == _name && name.Split('.')[0].ToLower() == "order")
{ {
var value = descriptor.GetValue(order).ToString(); var value = descriptor.GetValue(order).ToString();
if (descriptor.PropertyType.FullName.Contains("DateTime"))
{
value = value != null ? Convert.ToDateTime(value).ToString("yyyy-MM-dd") : "";
}
srow.CreateCell(_cellNum - 1).SetCellValue(value); srow.CreateCell(_cellNum - 1).SetCellValue(value);
} }
} }
} }
if (name.Split('.')[0].ToLower() == "edi")
{
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(edi))
{
var _name = descriptor.Name.ToLower();
if (name.Split('.')[1].ToLower() == _name && name.Split('.')[0].ToLower() == "edi")
{
var value = descriptor.GetValue(edi).ToString();
if (descriptor.PropertyType.FullName.Contains("DateTime"))
{
value = value != null ? Convert.ToDateTime(value).ToString("yyyy-MM-dd") : "";
}
srow.CreateCell(_cellNum - 1).SetCellValue(value);
}
}
}
if (name.Split('.')[0].ToLower() != "order" && name.Split('.')[0].ToLower() != "edi" && name.Split('.')[0].ToLower() != "ctn")
{
var value = string.Empty;
if (name.Split('.')[0].ToLower() == "username")
{
value = UserManager.Name;
}
if (name.Split('.')[0].ToLower() == "usertel")
{
value = UserManager.TEl;
}
if (name.Split('.')[0].ToLower() == "usermobile")
{
value = UserManager.Phone;
}
if (name.Split('.')[0].ToLower() == "useremail")
{
value = UserManager.Email;
}
if (name.Split('.')[0].ToLower() == "usertenant")
{
value = UserManager.TENANT_NAME;
}
srow.CreateCell(_cellNum - 1).SetCellValue(value);
}
}
} }
} }
@ -3709,9 +3832,6 @@ namespace Myshipping.Application
BookingOrder order = new BookingOrder(); BookingOrder order = new BookingOrder();
BookingCtn ctn = new BookingCtn(); BookingCtn ctn = new BookingCtn();
BookingEDIExt ext = new BookingEDIExt(); BookingEDIExt ext = new BookingEDIExt();
List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
////bookingorder
Dictionary<string, string> dic = new Dictionary<string, string>(); Dictionary<string, string> dic = new Dictionary<string, string>();
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order)) foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order))
{ {
@ -3725,7 +3845,7 @@ namespace Myshipping.Application
dic.Add(descriptor.Name, descriptor.Description); dic.Add(descriptor.Name, descriptor.Description);
} }
} }
list.Add(dic);
Dictionary<string, string> dic1 = new Dictionary<string, string>(); Dictionary<string, string> dic1 = new Dictionary<string, string>();
@ -3741,7 +3861,7 @@ namespace Myshipping.Application
dic1.Add(descriptor.Name, descriptor.Description); dic1.Add(descriptor.Name, descriptor.Description);
} }
} }
list.Add(dic1);
Dictionary<string, string> dic2 = new Dictionary<string, string>(); Dictionary<string, string> dic2 = new Dictionary<string, string>();
@ -3757,9 +3877,22 @@ namespace Myshipping.Application
dic2.Add(descriptor.Name, descriptor.Description); dic2.Add(descriptor.Name, descriptor.Description);
} }
} }
list.Add(dic2);
return list; Dictionary<string, string> dic3 = new Dictionary<string, string>();
dic3.Add("username", "当前登录人");
dic3.Add("usertel", "当前登录人电话");
dic3.Add("usermobile", "当前登录人手机");
dic3.Add("useremail", "当前登录人邮箱");
dic3.Add("usertenant", "当前登录人所在公司");
var dynamic = new
{
order = dic,
ctn = dic1,
edi = dic2,
userinfo = dic3
};
return dynamic;
} }
#endregion #endregion
} }

@ -40,4 +40,17 @@ public class ClaimConst
/// 大简云userid /// 大简云userid
/// </summary> /// </summary>
public const string DjyUserId = "DjyUserId"; public const string DjyUserId = "DjyUserId";
/// <summary>
/// 电话
/// </summary>
public const string Tel = "Tel";
/// <summary>
/// 手机
/// </summary>
public const string Phone = "Phone";
/// <summary>
/// 邮箱
/// </summary>
public const string Email = "Email";
} }

@ -46,4 +46,20 @@ public static class UserManager
/// 大简云userid /// 大简云userid
/// </summary> /// </summary>
public static string DjyUserId => App.User.FindFirst(ClaimConst.DjyUserId)?.Value; public static string DjyUserId => App.User.FindFirst(ClaimConst.DjyUserId)?.Value;
/// <summary>
/// 电话
/// </summary>
public static string TEl => App.User.FindFirst(ClaimConst.Tel)?.Value;
/// <summary>
/// 手机
/// </summary>
public static string Phone => App.User.FindFirst(ClaimConst.Phone)?.Value;
/// <summary>
/// 邮箱
/// </summary>
public static string Email => App.User.FindFirst(ClaimConst.Email)?.Value;
} }

@ -15042,11 +15042,12 @@
<param name="userId"></param> <param name="userId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.SysUserService.GetTenantUser(System.String)"> <member name="M:Myshipping.Core.Service.SysUserService.GetTenantUser(System.String,System.Nullable{System.Int64})">
<summary> <summary>
获取租户下的用户 获取租户下的用户
</summary> </summary>
<param name="name"></param> <param name="name"></param>
<param name="TenantId">默认0 获取当前用户,可不传 传租户id获取当前租户</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Myshipping.Core.DjyEdiSettingDto"> <member name="T:Myshipping.Core.DjyEdiSettingDto">

@ -95,6 +95,9 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
{ ClaimConst.CLAINM_TENANT_TYPE, tenant.TenantType }, { ClaimConst.CLAINM_TENANT_TYPE, tenant.TenantType },
{ ClaimConst.TENANT_NAME, tenant.Name }, { ClaimConst.TENANT_NAME, tenant.Name },
{ ClaimConst.DjyUserId, user.DjyUserId }, { ClaimConst.DjyUserId, user.DjyUserId },
{ ClaimConst.Tel, user.Tel },
{ ClaimConst.Phone, user.Phone },
{ ClaimConst.Email, user.Email },
}); });
// 设置Swagger自动登录 // 设置Swagger自动登录
@ -150,6 +153,9 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
{ ClaimConst.CLAINM_TENANT_TYPE, tenant.TenantType }, { ClaimConst.CLAINM_TENANT_TYPE, tenant.TenantType },
{ ClaimConst.TENANT_NAME, tenant.Name }, { ClaimConst.TENANT_NAME, tenant.Name },
{ ClaimConst.DjyUserId, user.DjyUserId }, { ClaimConst.DjyUserId, user.DjyUserId },
{ ClaimConst.Tel, user.Tel },
{ ClaimConst.Phone, user.Phone },
{ ClaimConst.Email, user.Email },
}); });
// 设置Swagger自动登录 // 设置Swagger自动登录

@ -31,5 +31,5 @@ public interface ISysUserService
Task<List<long>> GetDataScopeIdUserList(long userId = 0); Task<List<long>> GetDataScopeIdUserList(long userId = 0);
void CheckDataScopeByUserId(long userId); void CheckDataScopeByUserId(long userId);
void CheckDataScope(long orgId); void CheckDataScope(long orgId);
Task<List<SysUser>> GetTenantUser(string name,int type); Task<List<SysUser>> GetTenantUser(string name,long? tenantId);
} }

@ -544,12 +544,13 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
/// 获取租户下的用户 /// 获取租户下的用户
/// </summary> /// </summary>
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="type">默认0 获取当前用户,可不传 1 获取所有用户</param> /// <param name="TenantId">默认0 获取当前用户,可不传 传租户id获取当前租户</param>
/// <returns></returns> /// <returns></returns>
[HttpGet("/sysUser/GetTenantUser")] [HttpGet("/sysUser/GetTenantUser")]
public Task<List<SysUser>> GetTenantUser(string name, int type = 0) public Task<List<SysUser>> GetTenantUser(string name, long? tenantId = 0)
{ {
return _sysUserRep.AsQueryable().Filter(null, true).WhereIF(type == 0, x => x.TenantId == Convert.ToInt64(UserManager.TENANT_ID)) return _sysUserRep.AsQueryable().Filter(null, true).WhereIF(tenantId == 0, x => x.TenantId == Convert.ToInt64(UserManager.TENANT_ID))
.WhereIF(tenantId != 0, x => x.TenantId == tenantId)
.WhereIF(!string.IsNullOrWhiteSpace(name), x => x.Name.Contains(name)).ToListAsync(); .WhereIF(!string.IsNullOrWhiteSpace(name), x => x.Name.Contains(name)).ToListAsync();
} }

Loading…
Cancel
Save