jianghaiqing 2 years ago
commit ab861a22a7

@ -9963,6 +9963,191 @@
租户ID 租户ID
</summary> </summary>
</member> </member>
<member name="T:Myshipping.Application.DataSyncService">
<summary>
数据同步服务
</summary>
</member>
<member name="T:Myshipping.Application.DjyCustomerSyncDto">
<summary>
订舱客户同步
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.Id">
<summary>
主键
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.CodeName">
<summary>
代码
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.ShortName">
<summary>
简称
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.FullName">
<summary>
全称
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.Chief">
<summary>
负责人
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.Tel">
<summary>
电话
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.Email">
<summary>
邮箱
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.QQ">
<summary>
QQ
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.WebUrl">
<summary>
网址
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.Province">
<summary>
省份
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.City">
<summary>
城市
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.Addr">
<summary>
地址
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.FullNameEN">
<summary>
英文全名
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.AddrEN">
<summary>
英文地址
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.PropString">
<summary>
属性字符串
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.InvTitle">
<summary>
发票抬头
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.TaxNO">
<summary>
纳税人识别号
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.InvAddrTel">
<summary>
发票地址电话
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.RMBBank">
<summary>
人民币开户行
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.RmbAccount">
<summary>
人民币账号
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.USDBank">
<summary>
美元开户行
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.USDAccount">
<summary>
美元账号
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerSyncDto.ContactList">
<summary>
联系人
</summary>
</member>
<member name="T:Myshipping.Application.DjyCustomerContactSyncDto">
<summary>
订舱客户联系人同步
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.Id">
<summary>
主键
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.CustomerId">
<summary>
客户Id
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.RoleCode">
<summary>
角色ID
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.RoleName">
<summary>
角色名称
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.Name">
<summary>
名称
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.Tel">
<summary>
电话
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.Email">
<summary>
邮箱
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.QQ">
<summary>
QQ
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.Sort">
<summary>
排序号
</summary>
</member>
<member name="P:Myshipping.Application.DjyCustomerContactSyncDto.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Myshipping.Application.ParaContractNoDto.Id"> <member name="P:Myshipping.Application.ParaContractNoDto.Id">
<summary> <summary>
主键 主键

@ -0,0 +1,85 @@
using Myshipping.Core;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System.Linq;
using System.Threading.Tasks;
using Myshipping.Application.Entity;
using Microsoft.AspNetCore.Authorization;
using Furion;
using Microsoft.AspNetCore.Http;
using Furion.DataEncryption;
using System.Collections.Generic;
using System.Security.Claims;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using Furion.FriendlyException;
using Furion.Logging;
using System;
using Microsoft.Extensions.Logging;
using System.Reflection;
using System.ComponentModel;
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Application.ConfigOption;
using System.IO;
using Yitter.IdGenerator;
using Myshipping.Core.Entity;
using Furion.RemoteRequest.Extensions;
using System.Net.Http;
using Myshipping.Core.Service;
namespace Myshipping.Application
{
/// <summary>
/// 数据同步服务
/// </summary>
[ApiDescriptionSettings("Application", Name = "DataSync", Order = 1), AllowAnonymous]
public class DataSyncService : IDynamicApiController, ITransient
{
private readonly ILogger<BookingOrderService> _logger;
private readonly ISysCacheService _cache;
private readonly SqlSugarRepository<BookingOrder> _rep;
private readonly SqlSugarRepository<BookingCtn> _repCtn;
private readonly SqlSugarRepository<SysUser> _repUser;
private readonly SqlSugarRepository<SysTenant> _repTenant;
public DataSyncService(ILogger<BookingOrderService> logger, ISysCacheService cache, SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
SqlSugarRepository<SysUser> repUser, SqlSugarRepository<SysTenant> repTenant)
{
this._logger = logger;
this._rep = rep;
this._repCtn = repCtn;
this._cache = cache;
this._repUser = repUser;
this._repTenant = repTenant;
}
#region 上传数据
[HttpPost("/DataSync/SyncCustomer"), ApiUser]
public async Task<long> SyncCustomer(DjyCustomerSyncDto model)
{
return 0;
}
#endregion
#region 下载数据
#endregion
#region 其他
[HttpGet("/DataSync/Test"), ApiUser]
public async Task<string> Test()
{
return $"当前用户:{UserManager.UserId} {UserManager.Name} ,当前租户:{UserManager.TENANT_ID} {UserManager.TENANT_NAME},管理员类型:{(UserManager.IsSuperAdmin ? "" : (UserManager.IsTenantAdmin ? "" : ""))}";
}
#endregion
}
}

@ -0,0 +1,190 @@
using System;
using System.Collections.Generic;
using Myshipping.Core;
namespace Myshipping.Application
{
/// <summary>
/// 订舱客户同步
/// </summary>
public class DjyCustomerSyncDto
{
/// <summary>
/// 主键
/// </summary>
public long? Id { get; set; }
/// <summary>
/// 代码
/// </summary>
public string CodeName { get; set; }
/// <summary>
/// 简称
/// </summary>
public string ShortName { get; set; }
/// <summary>
/// 全称
/// </summary>
public string FullName { get; set; }
/// <summary>
/// 负责人
/// </summary>
public string Chief { get; set; }
/// <summary>
/// 电话
/// </summary>
public string Tel { get; set; }
/// <summary>
/// 邮箱
/// </summary>
public string Email { get; set; }
/// <summary>
/// QQ
/// </summary>
public string QQ { get; set; }
/// <summary>
/// 网址
/// </summary>
public string WebUrl { get; set; }
/// <summary>
/// 省份
/// </summary>
public string Province { get; set; }
/// <summary>
/// 城市
/// </summary>
public string City { get; set; }
/// <summary>
/// 地址
/// </summary>
public string Addr { get; set; }
/// <summary>
/// 英文全名
/// </summary>
public string FullNameEN { get; set; }
/// <summary>
/// 英文地址
/// </summary>
public string AddrEN { get; set; }
/// <summary>
/// 属性字符串
/// </summary>
public string PropString { get; set; }
/// <summary>
/// 发票抬头
/// </summary>
public string InvTitle { get; set; }
/// <summary>
/// 纳税人识别号
/// </summary>
public string TaxNO { get; set; }
/// <summary>
/// 发票地址电话
/// </summary>
public string InvAddrTel { get; set; }
/// <summary>
/// 人民币开户行
/// </summary>
public string RMBBank { get; set; }
/// <summary>
/// 人民币账号
/// </summary>
public string RmbAccount { get; set; }
/// <summary>
/// 美元开户行
/// </summary>
public string USDBank { get; set; }
/// <summary>
/// 美元账号
/// </summary>
public string USDAccount { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 联系人
/// </summary>
public List<DjyCustomerContactSyncDto> ContactList { get; set; }
}
/// <summary>
/// 订舱客户联系人同步
/// </summary>
public class DjyCustomerContactSyncDto
{
/// <summary>
/// 主键
/// </summary>
public long? Id { get; set; }
/// <summary>
/// 客户Id
/// </summary>
public long? CustomerId { get; set; }
/// <summary>
/// 角色ID
/// </summary>
public string RoleCode { get; set; }
/// <summary>
/// 角色名称
/// </summary>
public string RoleName { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 电话
/// </summary>
public string Tel { get; set; }
/// <summary>
/// 邮箱
/// </summary>
public string Email { get; set; }
/// <summary>
/// QQ
/// </summary>
public string QQ { get; set; }
/// <summary>
/// 排序号
/// </summary>
public int? Sort { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Myshipping.Core.Entity;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -25,14 +26,20 @@ namespace Myshipping.Core
{ {
var httpContext = App.GetService<IHttpContextAccessor>().HttpContext; var httpContext = App.GetService<IHttpContextAccessor>().HttpContext;
var repTenant = App.GetService<SqlSugarRepository<SysTenant>>();
var repUser = App.GetService<SqlSugarRepository<SysUser>>();
var tenant = repTenant.AsQueryable().Filter(null, true).First(x => x.Id == 142307070918780L);
var user = repUser.AsQueryable().Filter(null, true).First(x => x.Id == 142307070910551L);
ClaimsIdentity identity = new ClaimsIdentity("AuthenticationTypes.Federation"); ClaimsIdentity identity = new ClaimsIdentity("AuthenticationTypes.Federation");
identity.AddClaim(new Claim(type: ClaimConst.CLAINM_USERID, value: "111")); identity.AddClaim(new Claim(type: ClaimConst.CLAINM_USERID, value: user.Id.ToString()));
identity.AddClaim(new Claim(type: ClaimConst.TENANT_ID, value: "10")); identity.AddClaim(new Claim(type: ClaimConst.CLAINM_ACCOUNT, value: user.Account));
identity.AddClaim(new Claim(type: ClaimConst.CLAINM_ACCOUNT, value: "admin")); identity.AddClaim(new Claim(type: ClaimConst.CLAINM_NAME, value: user.Name));
identity.AddClaim(new Claim(type: ClaimConst.CLAINM_NAME, value: "管理员")); identity.AddClaim(new Claim(type: ClaimConst.CLAINM_SUPERADMIN, value: ((int)user.AdminType).ToString()));
identity.AddClaim(new Claim(type: ClaimConst.CLAINM_SUPERADMIN, value: AdminType.Admin.ToString())); identity.AddClaim(new Claim(type: ClaimConst.CLAINM_TENANT_TYPE, value: tenant.TenantType.ToString()));
identity.AddClaim(new Claim(type: ClaimConst.CLAINM_TENANT_TYPE, value: TenantTypeEnum.SYSTEM.ToString())); identity.AddClaim(new Claim(type: ClaimConst.TENANT_ID, value: tenant.Id.ToString()));
identity.AddClaim(new Claim(type: ClaimConst.TENANT_NAME, value: "测试")); identity.AddClaim(new Claim(type: ClaimConst.TENANT_NAME, value: tenant.Name));
ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(identity); ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(identity);
httpContext.User = claimsPrincipal; httpContext.User = claimsPrincipal;
} }

Loading…
Cancel
Save