feat 卡类型编辑
This commit is contained in:
@@ -33,7 +33,7 @@ public class SapPersonComparer : IEqualityComparer<SapPersonItem>
|
||||
&& (x.MASSN ?? string.Empty) == (y.MASSN ?? string.Empty)
|
||||
&& (x.MNTXT ?? string.Empty) == (y.MNTXT ?? string.Empty)
|
||||
&& (x.ZXUELI ?? string.Empty).Trim() == (y.ZXUELI ?? string.Empty).Trim()
|
||||
&& (x.ZZ_KLX ?? string.Empty) == (y.ZZ_KLX ?? string.Empty)
|
||||
//&& (x.ZZ_KLX ?? string.Empty) == (y.ZZ_KLX ?? string.Empty)
|
||||
&& (x.ZZ_GZDJDNM ?? string.Empty) == (y.ZZ_GZDJDNM ?? string.Empty)
|
||||
&& (x.ZZ_GZDCQNM ?? string.Empty) == (y.ZZ_GZDCQNM ?? string.Empty)
|
||||
;
|
||||
@@ -60,7 +60,7 @@ public class SapPersonComparer : IEqualityComparer<SapPersonItem>
|
||||
^ obj.MASSN.SafeGetHashCode()
|
||||
^ obj.MNTXT.SafeGetHashCode()
|
||||
^ obj.ZXUELI.SafeGetHashCode()
|
||||
^ obj.ZZ_KLX.SafeGetHashCode()
|
||||
//^ obj.ZZ_KLX.SafeGetHashCode()
|
||||
^ obj.ZZ_GZDJDNM.SafeGetHashCode()
|
||||
^ obj.ZZ_GZDCQNM.SafeGetHashCode()
|
||||
;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -44,4 +45,25 @@ public class GainfoCardsController : ControllerBase
|
||||
{
|
||||
return await _gainfoCardService.GetChangeRecordsAsync(userNo);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取卡类型
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("cardTypes")]
|
||||
public async Task<List<KeyValueDto<string, string>>> GetCardTypesAsync()
|
||||
{
|
||||
return await _gainfoCardService.GetCardTypesAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑卡类型
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
[HttpPost("cardType")]
|
||||
public async Task EditCardTypeAsync(GainfoCardEditRequest request)
|
||||
{
|
||||
//string code, int typeId
|
||||
await _gainfoCardService.EditCardTypeAsync(request.UserCode, request.CardType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class GainfoCardEditRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "工号不能为空")]
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 卡类型
|
||||
/// </summary>
|
||||
[Range(1, 100, ErrorMessage = "卡类型有误")]
|
||||
public int CardType { get; set; }
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class GainfoDetailResponse
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 6)]
|
||||
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 0)]
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -67,17 +67,20 @@ public class GainfoDetailResponse
|
||||
/// 身份证地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public DateTime OriginalBirthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 出生日期
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ToDateJsonConverter))]
|
||||
public DateTime Birthday { get; set; }
|
||||
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 0)]
|
||||
public string Birthday => OriginalBirthday.ToString("yyyy-MM-dd");
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 4)]
|
||||
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 0)]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
@@ -18,4 +19,18 @@ public interface IGainfoCardService : IScopeDependency
|
||||
/// <param name="userNo"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<ChangeCardResponse>> GetChangeRecordsAsync(string userNo);
|
||||
|
||||
/// <summary>
|
||||
/// 获取卡类型
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<KeyValueDto<string, string>>> GetCardTypesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// 编辑卡类型
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="typeId"></param>
|
||||
/// <returns></returns>
|
||||
Task EditCardTypeAsync(string code, int typeId);
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Mapster;
|
||||
@@ -11,11 +14,18 @@ public class GainfoCardService : IGainfoCardService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IGainfoStore _gainfoStore;
|
||||
private readonly IDevicePermissionService _devicePermissionService;
|
||||
private readonly IGainfoPermissionService _gainfoPermissionService;
|
||||
|
||||
public GainfoCardService(IDbContext dbContext, IGainfoStore gainfoStore)
|
||||
public GainfoCardService(IDbContext dbContext,
|
||||
IGainfoStore gainfoStore,
|
||||
IDevicePermissionService devicePermissionService,
|
||||
IGainfoPermissionService gainfoPermissionService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_gainfoStore = gainfoStore;
|
||||
_devicePermissionService = devicePermissionService;
|
||||
_gainfoPermissionService = gainfoPermissionService;
|
||||
}
|
||||
|
||||
public async Task ChangeCardAsync(GainfoChangeCardRequest request)
|
||||
@@ -46,4 +56,37 @@ public class GainfoCardService : IGainfoCardService
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<KeyValueDto<string, string>>> GetCardTypesAsync()
|
||||
{
|
||||
var r = new List<KeyValueDto<string, string>>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Key = "行政卡", Value = "2"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Key = "车间卡", Value = "3"
|
||||
}
|
||||
};
|
||||
|
||||
return await Task.FromResult(r);
|
||||
}
|
||||
|
||||
public async Task EditCardTypeAsync(string code, int typeId)
|
||||
{
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == code).SingleAsync();
|
||||
gainfo.ThrowIfNull("人员不存在");
|
||||
gainfo.CardType = typeId;
|
||||
|
||||
var myDeviceCodes = await _devicePermissionService.GetUserDeviceCodesByNoAsync(gainfo.No);
|
||||
var deviceCodes = await _dbContext.Queryable<DeviceEntity>()
|
||||
.Where(x => myDeviceCodes.Contains(x.Code))
|
||||
.Where(x => x.EnableTimePeriod)
|
||||
.Select(x => x.Code)
|
||||
.ToListAsync();
|
||||
|
||||
await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Update, deviceCodes, "卡类型编辑下发");
|
||||
}
|
||||
}
|
||||
@@ -362,7 +362,7 @@ public class GainfoService : IGainfoService
|
||||
IdNo = ga.IdNo,
|
||||
Gender = ga.Gender,
|
||||
Address = ga.Address,
|
||||
Birthday = ga.Birthday,
|
||||
OriginalBirthday = ga.Birthday,
|
||||
Phone = ga.Phone,
|
||||
Grade = ga.Grade,
|
||||
Title = ga.Title,
|
||||
|
||||
@@ -221,7 +221,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
CostId = item.KOSTL,
|
||||
EntryDate = item.createdate,
|
||||
ResignationDate = item.ZLZRQ,
|
||||
CardType = SafeParseCardType(item.ZZ_KLX),
|
||||
Workplace = _tenants.LastOrDefault(x => x.Name == item.ZZ_GZDJDNM)?.Code ?? item.ZZ_GZDJDNM,
|
||||
Factory = _tenants.FirstOrDefault(x => x.Name == item.ZZ_GZDCQNM)?.Code ?? item.ZZ_GZDCQNM,
|
||||
};
|
||||
@@ -251,7 +250,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
ZSTATUS = item.ZSTATUS,
|
||||
ZLZRQ = item.ZLZRQ,
|
||||
STELL_NM = item.STELL_NM,
|
||||
ZZ_KLX = item.ZZ_KLX,
|
||||
createdate = item.createdate,
|
||||
ZZ_GZDJDNM = item.ZZ_GZDJDNM,
|
||||
ZZ_GZDCQNM = item.ZZ_GZDCQNM,
|
||||
@@ -284,7 +282,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
ResignationDate = item.ZLZRQ,
|
||||
Workplace = workplace,
|
||||
Factory = factory,
|
||||
CardType = SafeParseCardType(item.ZZ_KLX)
|
||||
}).Where(x => x.Code == item.ename).ExecuteCommandAsync();
|
||||
|
||||
await _identityUserSyncService.SyncAccountAsync(gainfo.Code, gainfo.Name, gainfo.IdNo, factory);
|
||||
@@ -355,7 +352,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
ResignationDate = item.ZLZRQ,
|
||||
Workplace = workplace,
|
||||
Factory = factory,
|
||||
CardType = SafeParseCardType(item.ZZ_KLX)
|
||||
}).Where(x => x.Code == item.ename).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
@@ -385,7 +381,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
ZWORKCODE = x.ename,
|
||||
ZZ_SFZH = x.idno,
|
||||
GBDAT = x.birthday,
|
||||
ZZ_KLX = x.ZZ_KLX,
|
||||
ZXUELI = x.email,
|
||||
ORGEH = x.appellation,
|
||||
ZMOBILE = x.phone,
|
||||
@@ -432,7 +427,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
ename = person.ZWORKCODE,
|
||||
idno = person.ZZ_SFZH,
|
||||
birthday = person.GBDAT,
|
||||
ZZ_KLX = person.ZZ_KLX,
|
||||
email = person.ZXUELI,
|
||||
appellation = person.ORGEH,
|
||||
phone = person.ZMOBILE,
|
||||
@@ -477,14 +471,4 @@ public class GainfoUpdateService : IGainfoUpdateService
|
||||
idNo = idNo.TrimStart();
|
||||
return idNo[..6];
|
||||
}
|
||||
|
||||
private static int? SafeParseCardType(string ZZ_KLX)
|
||||
{
|
||||
if (int.TryParse(ZZ_KLX, out var cardType))
|
||||
{
|
||||
return cardType;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace Dlhis.Entity.Basic.Entity
|
||||
public string @class { get; set; }
|
||||
|
||||
public string passwd { get; set; }
|
||||
|
||||
|
||||
public string question { get; set; }
|
||||
|
||||
public string answer { get; set; }
|
||||
@@ -28,7 +28,7 @@ namespace Dlhis.Entity.Basic.Entity
|
||||
public string sex { get; set; }
|
||||
public DateTime birthday { get; set; }
|
||||
public string address { get; set; }
|
||||
|
||||
|
||||
public string postcode { get; set; }
|
||||
public string occupation { get; set; }
|
||||
public string appellation { get; set; }
|
||||
@@ -37,24 +37,24 @@ namespace Dlhis.Entity.Basic.Entity
|
||||
public string fax { get; set; }
|
||||
public string mobile { get; set; }
|
||||
public string email { get; set; }
|
||||
|
||||
|
||||
public string web { get; set; }
|
||||
|
||||
|
||||
public string vip { get; set; }
|
||||
|
||||
|
||||
public string sec { get; set; }
|
||||
|
||||
|
||||
public string cropsno { get; set; }
|
||||
|
||||
|
||||
public string cropname { get; set; }
|
||||
|
||||
|
||||
public string fancy { get; set; }
|
||||
public string remark { get; set; }
|
||||
|
||||
public int amount { get; set; }
|
||||
|
||||
|
||||
public int days { get; set; }
|
||||
|
||||
|
||||
public decimal consume01 { get; set; }
|
||||
|
||||
public decimal consume02 { get; set; }
|
||||
@@ -102,17 +102,18 @@ namespace Dlhis.Entity.Basic.Entity
|
||||
public string MASSN { get; set; }
|
||||
|
||||
public string MNTXT { get; set; }
|
||||
|
||||
|
||||
public string MASSG { get; set; }
|
||||
|
||||
|
||||
public string MGTXT { get; set; }
|
||||
public DateTime? logdate { get; set; }
|
||||
|
||||
|
||||
public DateTime? updatelogdate { get; set; }
|
||||
|
||||
|
||||
public string guestno { get; set; }
|
||||
public string ZZ_KLX { get; set; }
|
||||
|
||||
|
||||
// public string ZZ_KLX { get; set; }不再同步
|
||||
|
||||
public DateTime? DAT01 { get; set; }
|
||||
|
||||
public string ZZ_COUNNM { get; set; }
|
||||
|
||||
@@ -15,7 +15,7 @@ public class SapPersonItem
|
||||
|
||||
public string STELL_NM { get; set; }
|
||||
|
||||
public string ZZ_KLX { get; set; }
|
||||
//public string ZZ_KLX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user