feat 卡类型编辑
This commit is contained in:
@@ -33,7 +33,7 @@ public class SapPersonComparer : IEqualityComparer<SapPersonItem>
|
|||||||
&& (x.MASSN ?? string.Empty) == (y.MASSN ?? string.Empty)
|
&& (x.MASSN ?? string.Empty) == (y.MASSN ?? string.Empty)
|
||||||
&& (x.MNTXT ?? string.Empty) == (y.MNTXT ?? string.Empty)
|
&& (x.MNTXT ?? string.Empty) == (y.MNTXT ?? string.Empty)
|
||||||
&& (x.ZXUELI ?? string.Empty).Trim() == (y.ZXUELI ?? string.Empty).Trim()
|
&& (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_GZDJDNM ?? string.Empty) == (y.ZZ_GZDJDNM ?? string.Empty)
|
||||||
&& (x.ZZ_GZDCQNM ?? string.Empty) == (y.ZZ_GZDCQNM ?? 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.MASSN.SafeGetHashCode()
|
||||||
^ obj.MNTXT.SafeGetHashCode()
|
^ obj.MNTXT.SafeGetHashCode()
|
||||||
^ obj.ZXUELI.SafeGetHashCode()
|
^ obj.ZXUELI.SafeGetHashCode()
|
||||||
^ obj.ZZ_KLX.SafeGetHashCode()
|
//^ obj.ZZ_KLX.SafeGetHashCode()
|
||||||
^ obj.ZZ_GZDJDNM.SafeGetHashCode()
|
^ obj.ZZ_GZDJDNM.SafeGetHashCode()
|
||||||
^ obj.ZZ_GZDCQNM.SafeGetHashCode()
|
^ obj.ZZ_GZDCQNM.SafeGetHashCode()
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Dlhis.Basic.Organization.Request;
|
using Dlhis.Basic.Organization.Request;
|
||||||
using Dlhis.Basic.Organization.Response;
|
using Dlhis.Basic.Organization.Response;
|
||||||
using Dlhis.Basic.Organization.Services;
|
using Dlhis.Basic.Organization.Services;
|
||||||
|
using Kurisu.AspNetCore.CustomClass;
|
||||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@@ -44,4 +45,25 @@ public class GainfoCardsController : ControllerBase
|
|||||||
{
|
{
|
||||||
return await _gainfoCardService.GetChangeRecordsAsync(userNo);
|
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>
|
||||||
/// 身份证号
|
/// 身份证号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 6)]
|
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 0)]
|
||||||
public string IdNo { get; set; }
|
public string IdNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -68,16 +68,19 @@ public class GainfoDetailResponse
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Address { get; set; }
|
public string Address { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public DateTime OriginalBirthday { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出生日期
|
/// 出生日期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonConverter(typeof(ToDateJsonConverter))]
|
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 0)]
|
||||||
public DateTime Birthday { get; set; }
|
public string Birthday => OriginalBirthday.ToString("yyyy-MM-dd");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 手机号码
|
/// 手机号码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 4)]
|
[JsonConverter(typeof(ObfuscateProviderJsonConverter), 0)]
|
||||||
public string Phone { get; set; }
|
public string Phone { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Dlhis.Basic.Organization.Request;
|
using Dlhis.Basic.Organization.Request;
|
||||||
using Dlhis.Basic.Organization.Response;
|
using Dlhis.Basic.Organization.Response;
|
||||||
|
using Kurisu.AspNetCore.CustomClass;
|
||||||
|
|
||||||
namespace Dlhis.Basic.Organization.Services;
|
namespace Dlhis.Basic.Organization.Services;
|
||||||
|
|
||||||
@@ -18,4 +19,18 @@ public interface IGainfoCardService : IScopeDependency
|
|||||||
/// <param name="userNo"></param>
|
/// <param name="userNo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<ChangeCardResponse>> GetChangeRecordsAsync(string userNo);
|
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.Basic.Organization.Response;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
|
using Dlhis.Entity.Device.Enums;
|
||||||
|
using Kurisu.AspNetCore.CustomClass;
|
||||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||||
using Kurisu.AspNetCore.Utils.Extensions;
|
using Kurisu.AspNetCore.Utils.Extensions;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
@@ -11,11 +14,18 @@ public class GainfoCardService : IGainfoCardService
|
|||||||
{
|
{
|
||||||
private readonly IDbContext _dbContext;
|
private readonly IDbContext _dbContext;
|
||||||
private readonly IGainfoStore _gainfoStore;
|
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;
|
_dbContext = dbContext;
|
||||||
_gainfoStore = gainfoStore;
|
_gainfoStore = gainfoStore;
|
||||||
|
_devicePermissionService = devicePermissionService;
|
||||||
|
_gainfoPermissionService = gainfoPermissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ChangeCardAsync(GainfoChangeCardRequest request)
|
public async Task ChangeCardAsync(GainfoChangeCardRequest request)
|
||||||
@@ -46,4 +56,37 @@ public class GainfoCardService : IGainfoCardService
|
|||||||
})
|
})
|
||||||
.ToListAsync();
|
.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,
|
IdNo = ga.IdNo,
|
||||||
Gender = ga.Gender,
|
Gender = ga.Gender,
|
||||||
Address = ga.Address,
|
Address = ga.Address,
|
||||||
Birthday = ga.Birthday,
|
OriginalBirthday = ga.Birthday,
|
||||||
Phone = ga.Phone,
|
Phone = ga.Phone,
|
||||||
Grade = ga.Grade,
|
Grade = ga.Grade,
|
||||||
Title = ga.Title,
|
Title = ga.Title,
|
||||||
|
|||||||
@@ -221,7 +221,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
|||||||
CostId = item.KOSTL,
|
CostId = item.KOSTL,
|
||||||
EntryDate = item.createdate,
|
EntryDate = item.createdate,
|
||||||
ResignationDate = item.ZLZRQ,
|
ResignationDate = item.ZLZRQ,
|
||||||
CardType = SafeParseCardType(item.ZZ_KLX),
|
|
||||||
Workplace = _tenants.LastOrDefault(x => x.Name == item.ZZ_GZDJDNM)?.Code ?? item.ZZ_GZDJDNM,
|
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,
|
Factory = _tenants.FirstOrDefault(x => x.Name == item.ZZ_GZDCQNM)?.Code ?? item.ZZ_GZDCQNM,
|
||||||
};
|
};
|
||||||
@@ -251,7 +250,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
|||||||
ZSTATUS = item.ZSTATUS,
|
ZSTATUS = item.ZSTATUS,
|
||||||
ZLZRQ = item.ZLZRQ,
|
ZLZRQ = item.ZLZRQ,
|
||||||
STELL_NM = item.STELL_NM,
|
STELL_NM = item.STELL_NM,
|
||||||
ZZ_KLX = item.ZZ_KLX,
|
|
||||||
createdate = item.createdate,
|
createdate = item.createdate,
|
||||||
ZZ_GZDJDNM = item.ZZ_GZDJDNM,
|
ZZ_GZDJDNM = item.ZZ_GZDJDNM,
|
||||||
ZZ_GZDCQNM = item.ZZ_GZDCQNM,
|
ZZ_GZDCQNM = item.ZZ_GZDCQNM,
|
||||||
@@ -284,7 +282,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
|||||||
ResignationDate = item.ZLZRQ,
|
ResignationDate = item.ZLZRQ,
|
||||||
Workplace = workplace,
|
Workplace = workplace,
|
||||||
Factory = factory,
|
Factory = factory,
|
||||||
CardType = SafeParseCardType(item.ZZ_KLX)
|
|
||||||
}).Where(x => x.Code == item.ename).ExecuteCommandAsync();
|
}).Where(x => x.Code == item.ename).ExecuteCommandAsync();
|
||||||
|
|
||||||
await _identityUserSyncService.SyncAccountAsync(gainfo.Code, gainfo.Name, gainfo.IdNo, factory);
|
await _identityUserSyncService.SyncAccountAsync(gainfo.Code, gainfo.Name, gainfo.IdNo, factory);
|
||||||
@@ -355,7 +352,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
|||||||
ResignationDate = item.ZLZRQ,
|
ResignationDate = item.ZLZRQ,
|
||||||
Workplace = workplace,
|
Workplace = workplace,
|
||||||
Factory = factory,
|
Factory = factory,
|
||||||
CardType = SafeParseCardType(item.ZZ_KLX)
|
|
||||||
}).Where(x => x.Code == item.ename).ExecuteCommandAsync();
|
}).Where(x => x.Code == item.ename).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,7 +381,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
|||||||
ZWORKCODE = x.ename,
|
ZWORKCODE = x.ename,
|
||||||
ZZ_SFZH = x.idno,
|
ZZ_SFZH = x.idno,
|
||||||
GBDAT = x.birthday,
|
GBDAT = x.birthday,
|
||||||
ZZ_KLX = x.ZZ_KLX,
|
|
||||||
ZXUELI = x.email,
|
ZXUELI = x.email,
|
||||||
ORGEH = x.appellation,
|
ORGEH = x.appellation,
|
||||||
ZMOBILE = x.phone,
|
ZMOBILE = x.phone,
|
||||||
@@ -432,7 +427,6 @@ public class GainfoUpdateService : IGainfoUpdateService
|
|||||||
ename = person.ZWORKCODE,
|
ename = person.ZWORKCODE,
|
||||||
idno = person.ZZ_SFZH,
|
idno = person.ZZ_SFZH,
|
||||||
birthday = person.GBDAT,
|
birthday = person.GBDAT,
|
||||||
ZZ_KLX = person.ZZ_KLX,
|
|
||||||
email = person.ZXUELI,
|
email = person.ZXUELI,
|
||||||
appellation = person.ORGEH,
|
appellation = person.ORGEH,
|
||||||
phone = person.ZMOBILE,
|
phone = person.ZMOBILE,
|
||||||
@@ -477,14 +471,4 @@ public class GainfoUpdateService : IGainfoUpdateService
|
|||||||
idNo = idNo.TrimStart();
|
idNo = idNo.TrimStart();
|
||||||
return idNo[..6];
|
return idNo[..6];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int? SafeParseCardType(string ZZ_KLX)
|
|
||||||
{
|
|
||||||
if (int.TryParse(ZZ_KLX, out var cardType))
|
|
||||||
{
|
|
||||||
return cardType;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,8 @@ namespace Dlhis.Entity.Basic.Entity
|
|||||||
public DateTime? updatelogdate { get; set; }
|
public DateTime? updatelogdate { get; set; }
|
||||||
|
|
||||||
public string guestno { 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 DateTime? DAT01 { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class SapPersonItem
|
|||||||
|
|
||||||
public string STELL_NM { get; set; }
|
public string STELL_NM { get; set; }
|
||||||
|
|
||||||
public string ZZ_KLX { get; set; }
|
//public string ZZ_KLX { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user