refactor 优化代码
This commit is contained in:
22
Src/Dlhis.Basic.Api/ContentHandlers/CodeContentHandler.cs
Normal file
22
Src/Dlhis.Basic.Api/ContentHandlers/CodeContentHandler.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Text;
|
||||
using Kurisu.RemoteCall;
|
||||
using Kurisu.RemoteCall.Abstractions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Api.ContentHandlers;
|
||||
|
||||
public class CodeContentHandler : IContentHandler
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public HttpContent Create(List<ParameterValue> values)
|
||||
{
|
||||
var code = values.First(x => x.Parameter.Name == "code").GetValue<string>();
|
||||
var obj = new
|
||||
{
|
||||
code,
|
||||
};
|
||||
var json = JsonConvert.SerializeObject(obj);
|
||||
|
||||
return new StringContent(json, Encoding.UTF8, "application/json");
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.RemoteCall" Version="0.4.2" />
|
||||
<PackageReference Include="Kurisu.RemoteCall" Version="0.4.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using Dlhis.Basic.Api.Dto;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
using Kurisu.RemoteCall.Default;
|
||||
|
||||
namespace Dlhis.Basic.Api;
|
||||
|
||||
[RequestResultHandler]
|
||||
[EnableRemoteClient(Name = "basic-service", BaseUrl = "${InternalRequest:BasicRequestUrl}")]
|
||||
public interface IBusinessPlacePermissionsApi
|
||||
{
|
||||
[Auth]
|
||||
[Get("/api/businessplacepermissions/my")]
|
||||
Task<DefaultApiResult<List<BusinessPlaceDto>>> GetMyAsync();
|
||||
Task<List<BusinessPlaceDto>> GetMyAsync();
|
||||
}
|
||||
@@ -1,16 +1,12 @@
|
||||
using Dlhis.Basic.Api.Request;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
using Kurisu.RemoteCall.Default;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
|
||||
namespace Dlhis.Basic.Api;
|
||||
|
||||
[RequestResultHandler]
|
||||
[EnableRemoteClient(Name = "basic-service", BaseUrl = "${InternalRequest:BasicRequestUrl}")]
|
||||
public interface IGainfoPermissionApi
|
||||
{
|
||||
[Post("/api/gainfoPermissions/reset")]
|
||||
Task<DefaultApiResult> ResetAsync(GainfoPermissionResetRequest request);
|
||||
|
||||
[Auth]
|
||||
[Get("/api/devicePermissions/userPermissionCodes")]
|
||||
Task<DefaultApiResult<List<Guid>>> GetPermissionsDeviceCodesAsync(string userCode);
|
||||
Task<List<Guid>> GetPermissionsDeviceCodesAsync(string userCode);
|
||||
}
|
||||
30
Src/Dlhis.Basic.Api/ISyncApi.cs
Normal file
30
Src/Dlhis.Basic.Api/ISyncApi.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Dlhis.Basic.Api.ContentHandlers;
|
||||
using Dlhis.Basic.Api.Response;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
|
||||
namespace Dlhis.Basic.Api;
|
||||
|
||||
[RequestResultHandler]
|
||||
[EnableRemoteClient(Name = "basic-service", BaseUrl = "${InternalRequest:BasicRequestUrl}")]
|
||||
public interface ISyncApi
|
||||
{
|
||||
[Post("/api/sync/gainfo/werk")]
|
||||
[RequestContentHandler(typeof(CodeContentHandler))]
|
||||
Task SyncGainfoByWerkAsync(string code);
|
||||
|
||||
[Post("/api/sync/gainfo/user")]
|
||||
[RequestContentHandler(typeof(CodeContentHandler))]
|
||||
Task SyncGainfoByUserCodeAsync(string code);
|
||||
|
||||
[Get("/api/sync/orgs")]
|
||||
Task<SapOrganizationResponse> SyncOrganizationsAsync();
|
||||
|
||||
|
||||
[Get("/api/sync/positions")]
|
||||
Task<SapPositionResponse> GetPositionsAsync();
|
||||
|
||||
|
||||
[Post("/api/sync/businessTrips")]
|
||||
[RequestContentHandler(typeof(CodeContentHandler))]
|
||||
Task HandlerBusinessTripsAsync(string code);
|
||||
}
|
||||
15
Src/Dlhis.Basic.Api/Response/SapOrganization.cs
Normal file
15
Src/Dlhis.Basic.Api/Response/SapOrganization.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Api.Response;
|
||||
|
||||
/// <summary>
|
||||
/// sap机构信息
|
||||
/// </summary>
|
||||
public class SapOrganization
|
||||
{
|
||||
/// <summary>
|
||||
/// 机构项
|
||||
/// </summary>
|
||||
[JsonProperty("item")]
|
||||
public List<SapOrganizationItem> Items { get; set; }
|
||||
}
|
||||
66
Src/Dlhis.Basic.Api/Response/SapOrganizationItem.cs
Normal file
66
Src/Dlhis.Basic.Api/Response/SapOrganizationItem.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
namespace Dlhis.Basic.Api.Response;
|
||||
|
||||
public class SapOrganizationItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始日期
|
||||
/// </summary>
|
||||
public string BEGDA { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束日期
|
||||
/// </summary>
|
||||
public string ENDDA { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 语言
|
||||
/// </summary>
|
||||
public string LANGU { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门id
|
||||
/// </summary>
|
||||
public string OBJID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string STEXT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上级部门
|
||||
/// </summary>
|
||||
public string SOBID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公司
|
||||
/// </summary>
|
||||
public string ORGID01 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 事业部
|
||||
/// </summary>
|
||||
public string ORGID02 { get; set; }
|
||||
}
|
||||
|
||||
|
||||
//public partial class SapOrganizationItem : IEquatable<SapOrganizationItem>
|
||||
//{
|
||||
// public bool Equals(SapOrganizationItem other)
|
||||
// {
|
||||
// if (other is null)
|
||||
// return false;
|
||||
|
||||
// return this.BEGDA == other.BEGDA
|
||||
// && this.ENDDA == other.ENDDA
|
||||
// && this.LANGU == other.LANGU
|
||||
// && this.OBJID == other.OBJID
|
||||
// && this.STEXT == other.STEXT
|
||||
// && this.SOBID == other.SOBID
|
||||
// && this.ORGID01 == other.ORGID01
|
||||
// && this.ORGID02 == other.ORGID02;
|
||||
// }
|
||||
|
||||
// public override bool Equals(object obj) => Equals(obj as SapOrganizationItem);
|
||||
// public override int GetHashCode() => (BEGDA, ENDDA, LANGU, OBJID, STEXT, SOBID, ORGID01, ORGID02).GetHashCode();
|
||||
//}
|
||||
9
Src/Dlhis.Basic.Api/Response/SapOrganizationResponse.cs
Normal file
9
Src/Dlhis.Basic.Api/Response/SapOrganizationResponse.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Api.Response;
|
||||
|
||||
public class SapOrganizationResponse
|
||||
{
|
||||
[JsonProperty("T_ORG")]
|
||||
public SapOrganization Org { get; set; }
|
||||
}
|
||||
211
Src/Dlhis.Basic.Api/Response/SapPersonItem.cs
Normal file
211
Src/Dlhis.Basic.Api/Response/SapPersonItem.cs
Normal file
@@ -0,0 +1,211 @@
|
||||
namespace Dlhis.Jip.Api.Dto;
|
||||
|
||||
public class SapPersonItem
|
||||
{
|
||||
public string KOSTL { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 离职日期
|
||||
/// </summary>
|
||||
public DateTime? ZLZRQ { get; set; }
|
||||
|
||||
public string ZZ_SFZH { get; set; }
|
||||
|
||||
public string STELL { get; set; }
|
||||
|
||||
public string STELL_NM { get; set; }
|
||||
|
||||
public string ZZ_KLX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string PERNR { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZWORKCODE { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string MASSN { get; set; }
|
||||
/// <summary>
|
||||
/// 数据变更
|
||||
/// </summary>
|
||||
public string MNTXT { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string MASSG { get; set; }
|
||||
/// <summary>
|
||||
/// 数据变更
|
||||
/// </summary>
|
||||
public string MGTXT { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZSTATUS { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string STAT2 { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string BEGDA { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ENDDA { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string WERKS { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string PERSG { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string PERSK { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string BTRTL { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ANSVH { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string MOABW { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ORGEH { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string PLANS { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_ZYSF { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_AQJB { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_ZD { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_SJGH { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_BGZT { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Z_ZJ { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_XSQY { get; set; }
|
||||
/// <summary>
|
||||
/// 上海
|
||||
/// </summary>
|
||||
public string ZZ_LOC { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_COUN { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_CITY { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string NACHN { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string VORNA { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string NAME { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string GESCH { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DateTime GBDAT { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string NATIO { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_QFRQ { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZMOBILE { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZEMAIL { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZADZH { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DateTime ZRZRQ { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DAT01 { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZCJRQ { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZZRQ { get; set; }
|
||||
/// <summary>
|
||||
/// 本科
|
||||
/// </summary>
|
||||
public string ZXUELI { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZ_ZPQD { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家
|
||||
/// </summary>
|
||||
public string ZZ_COUNNM { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 基地
|
||||
/// </summary>
|
||||
public string ZZ_GZDJDNM { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
public string ZZ_GZDCQNM { get; set; }
|
||||
}
|
||||
10
Src/Dlhis.Basic.Api/Response/SapPosition.cs
Normal file
10
Src/Dlhis.Basic.Api/Response/SapPosition.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Api.Response;
|
||||
|
||||
public class SapPosition
|
||||
{
|
||||
|
||||
[JsonProperty("item")]
|
||||
public List<SapPositionItem> Items { get; set; }
|
||||
}
|
||||
40
Src/Dlhis.Basic.Api/Response/SapPositionItem.cs
Normal file
40
Src/Dlhis.Basic.Api/Response/SapPositionItem.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
namespace Dlhis.Basic.Api.Response
|
||||
{
|
||||
public class SapPositionItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始日期
|
||||
/// </summary>
|
||||
public string BEGDA { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束日期
|
||||
/// </summary>
|
||||
public string ENDDA { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 语言代码
|
||||
/// </summary>
|
||||
public string LANGU { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 岗位编码
|
||||
/// </summary>
|
||||
public string ZJOBID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 岗位名称
|
||||
/// </summary>
|
||||
public string ZJOBNAME { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ZZWID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属部门ID
|
||||
/// </summary>
|
||||
public string ZDEPID { get; set; }
|
||||
}
|
||||
}
|
||||
10
Src/Dlhis.Basic.Api/Response/SapPositionResponse.cs
Normal file
10
Src/Dlhis.Basic.Api/Response/SapPositionResponse.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Dlhis.Jip.Api.Dto;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Api.Response;
|
||||
|
||||
public class SapPositionResponse
|
||||
{
|
||||
[JsonProperty("T_POST")]
|
||||
public SapPosition Position { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user