档案表crud
This commit is contained in:
@@ -15,8 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Sys", "Src\Dlhis.Perm
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.ScheduledTask", "Src\Dlhis.ScheduledTask\Dlhis.ScheduledTask.csproj", "{0F1F7144-0BA3-4BDC-814E-E57A4E4A6392}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen", "Src\Dlhis.Canteen\Dlhis.Canteen.csproj", "{B677442F-98D1-4F3A-8859-9F07D30E22E9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Common", "Src\Dlhis.Common\Dlhis.Common.csproj", "{4C1FADD9-8AFB-4087-9E52-EE6D6523ED38}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Common.Api", "Src\Dlhis.Common.Api\Dlhis.Common.Api.csproj", "{FD8D38C5-0827-49D1-A0BA-7707FBFDA2EC}"
|
||||
@@ -43,10 +41,6 @@ Global
|
||||
{0F1F7144-0BA3-4BDC-814E-E57A4E4A6392}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0F1F7144-0BA3-4BDC-814E-E57A4E4A6392}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0F1F7144-0BA3-4BDC-814E-E57A4E4A6392}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B677442F-98D1-4F3A-8859-9F07D30E22E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B677442F-98D1-4F3A-8859-9F07D30E22E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B677442F-98D1-4F3A-8859-9F07D30E22E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B677442F-98D1-4F3A-8859-9F07D30E22E9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4C1FADD9-8AFB-4087-9E52-EE6D6523ED38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4C1FADD9-8AFB-4087-9E52-EE6D6523ED38}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4C1FADD9-8AFB-4087-9E52-EE6D6523ED38}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -64,9 +58,7 @@ Global
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{5D7096DE-AB81-4423-95AF-6489C0D94CB3} = {57074FD8-1A2F-40C7-8476-001778A3F65D}
|
||||
{0F1F7144-0BA3-4BDC-814E-E57A4E4A6392} = {AA987BDF-EF63-467B-AD04-59F9B10D9000}
|
||||
{B677442F-98D1-4F3A-8859-9F07D30E22E9} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
|
||||
{4C1FADD9-8AFB-4087-9E52-EE6D6523ED38} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
||||
{FD8D38C5-0827-49D1-A0BA-7707FBFDA2EC} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
||||
{D1F81CB7-F3EF-4196-A751-468248368020} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
||||
|
||||
@@ -43,6 +43,7 @@ public class BusinessPlaceService : IBusinessPlaceService
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
public async Task SaveAsync(BusinessPlaceSaveRequest request)
|
||||
{
|
||||
await CheckExistsCustomCodeAsync(request);
|
||||
|
||||
66
Src/Dlhis.Basic/MealUser/Controllers/GainfoController.cs
Normal file
66
Src/Dlhis.Basic/MealUser/Controllers/GainfoController.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Basic.MealUser.Services;
|
||||
using Dlhis.Basic.MealUser.Services.Implements;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 档案表
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class GainfoController : ControllerBase
|
||||
{
|
||||
private readonly IGainfoService _gainfoService;
|
||||
|
||||
public GainfoController(IGainfoService gainfoService)
|
||||
{
|
||||
_gainfoService = gainfoService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案表保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("save")]
|
||||
public async Task SaveAsync( GainfoAddSaveRequest request)
|
||||
{
|
||||
await _gainfoService.SaveAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<GainfoEntity>> GetPageAsync([FromQuery] GainfoPageRequest request)
|
||||
{
|
||||
//var enums = await _enumSettingApi.GetEnums();
|
||||
return await _gainfoService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案表修改
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("update")]
|
||||
public async Task UpdateAsync(GainfoAddSaveRequest request)
|
||||
{
|
||||
await _gainfoService.UpdateAsync(request);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
16
Src/Dlhis.Basic/MealUser/Request/GainfoAddSaveRequest.cs
Normal file
16
Src/Dlhis.Basic/MealUser/Request/GainfoAddSaveRequest.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Request
|
||||
{
|
||||
public class GainfoAddSaveRequest
|
||||
{
|
||||
[EnumDataType(typeof(GainfoStatusEnumType))]
|
||||
public GainfoStatusEnumType gainfoStatus { get; set; }
|
||||
|
||||
|
||||
public GainfoEntity gainfoEntity { get; set; }
|
||||
}
|
||||
}
|
||||
13
Src/Dlhis.Basic/MealUser/Request/GainfoPageRequest.cs
Normal file
13
Src/Dlhis.Basic/MealUser/Request/GainfoPageRequest.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Request
|
||||
{
|
||||
public class GainfoPageRequest : PageDto
|
||||
{
|
||||
[EnumDataType(typeof(GainfoStatusEnumType))]
|
||||
public GainfoStatusEnumType gainfoStatus { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,51 @@
|
||||
namespace Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Response;
|
||||
|
||||
public class MealUserResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
public string UserId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 消费人员类型
|
||||
/// </summary>
|
||||
public CanteenUserEnumType UserType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 卡号
|
||||
/// </summary>
|
||||
public string CarNo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 余额
|
||||
/// </summary>
|
||||
public decimal Balance { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 余额(充值)
|
||||
/// </summary>
|
||||
public decimal BalanceOfRecharge { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 余额(餐补)
|
||||
/// </summary>
|
||||
public decimal BalanceOfSubsidies { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
15
Src/Dlhis.Basic/MealUser/Services/IGainfoService.cs
Normal file
15
Src/Dlhis.Basic/MealUser/Services/IGainfoService.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services
|
||||
{
|
||||
public interface IGainfoService : IScopeDependency
|
||||
{
|
||||
Task SaveAsync(GainfoAddSaveRequest request);
|
||||
Task<Pagination<GainfoEntity>> GetPageAsync(GainfoPageRequest request);
|
||||
Task UpdateAsync(GainfoAddSaveRequest request);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services.Implements
|
||||
{
|
||||
public class GainfoService : IGainfoService
|
||||
{
|
||||
|
||||
private readonly IGainfoStore _gainfoStore;
|
||||
|
||||
public GainfoService(IDbContext dbContext, IGainfoStore gainfoStore)
|
||||
{
|
||||
|
||||
_gainfoStore = gainfoStore;
|
||||
}
|
||||
/// <summary>
|
||||
///保存档案号
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task SaveAsync(GainfoAddSaveRequest request)
|
||||
{
|
||||
await CheckGainfoGuestnoAsync(request);//档案号是否重复
|
||||
|
||||
var gainfos = new List<GainfoEntity>();
|
||||
gainfos.Add(request.gainfoEntity);
|
||||
await _gainfoStore.InsertAsync(request.gainfoStatus,gainfos);
|
||||
}
|
||||
/// <summary>
|
||||
/// 档案分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public Task<Pagination<GainfoEntity>> GetPageAsync( GainfoPageRequest request)
|
||||
{
|
||||
var page = _gainfoStore.Queryable(request.gainfoStatus)
|
||||
.Select<GainfoEntity>()
|
||||
.ToPageListAsync(request);
|
||||
return page;
|
||||
}
|
||||
/// <summary>
|
||||
///修改档案号
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task UpdateAsync(GainfoAddSaveRequest request)
|
||||
{
|
||||
var gainfos = new List<GainfoEntity>();
|
||||
gainfos.Add(request.gainfoEntity);
|
||||
await _gainfoStore.UpdateAsync(request.gainfoStatus,gainfos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------help methods-----------------------------------------------
|
||||
/// <summary>
|
||||
/// 检查档案号是否重复
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
private async Task CheckGainfoGuestnoAsync(GainfoAddSaveRequest request)
|
||||
{
|
||||
|
||||
var checkGainfoGuestno = await _gainfoStore.Queryable(request.gainfoStatus)
|
||||
.Where(x => x.Guestno == request.gainfoEntity.Guestno)
|
||||
.AnyAsync();
|
||||
checkGainfoGuestno.ThrowIfTrue($"档案号[{request.gainfoEntity.Guestno}]已存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
@@ -10,10 +13,12 @@ namespace Dlhis.Basic.MealUser.Services.Implements;
|
||||
public class MealUserService : IMealUserService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IGainfoStore _gainfoStore;
|
||||
|
||||
public MealUserService(IDbContext dbContext)
|
||||
public MealUserService(IDbContext dbContext, IGainfoStore gainfoStore)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_gainfoStore = gainfoStore;
|
||||
}
|
||||
|
||||
public async Task<Pagination<MealUserResponse>> GetPageAsync(MealUserPageRequest request)
|
||||
@@ -29,12 +34,18 @@ public class MealUserService : IMealUserService
|
||||
{
|
||||
//todo 获取档案信息
|
||||
|
||||
var gainfoEntity = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
.Where(x => x.Guestno == request.UserId)
|
||||
.FirstAsync();
|
||||
var b = gainfoEntity == null ? true : false;
|
||||
b.ThrowIfTrue($"档案[{request.UserId}]不存在");
|
||||
|
||||
var entity = new CanteenUserEntity
|
||||
{
|
||||
UserId = request.UserId,
|
||||
UserType = request.UserType,
|
||||
UserCode = "",
|
||||
CarNo = "",
|
||||
UserCode = gainfoEntity.Ename,
|
||||
CarNo = gainfoEntity.CarNo,
|
||||
Balance = 0,
|
||||
BalanceOfRecharge = 0,
|
||||
BalanceOfSubsidies = 0,
|
||||
|
||||
@@ -1,11 +1,107 @@
|
||||
using SqlSugar;
|
||||
using System.Net;
|
||||
|
||||
namespace Dlhis.Entity.Basic.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// 用户档案
|
||||
/// </summary>
|
||||
[SugarTable("Gainfo")]
|
||||
[SugarTable(TableName = "Gainfo", TableDescription = "档案表")]
|
||||
public class GainfoEntity : SugarBaseEntity
|
||||
{
|
||||
[SugarColumn(ColumnDescription = "档案号")]
|
||||
public string Guestno { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "SAP内部编号")]
|
||||
public string Ano { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "人员类型")]
|
||||
public string Class { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "姓名")]
|
||||
public string Gname { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "工号")]
|
||||
public string Ename { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "国家代码")]
|
||||
public string Country { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "证件类型代码")]
|
||||
public string Idcls { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "身份证号")]
|
||||
public string IdNO { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "身份证籍贯区域代码")]
|
||||
public string Native { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "性别")]
|
||||
public string Sex { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "生日")]
|
||||
public DateTime Birthday { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "身份证地址")]
|
||||
public string Address { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "已婚/未婚")]
|
||||
public string Postcode { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "部门编码")]
|
||||
public string Appellation { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "民族代码")]
|
||||
public string Nation { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "手机号码")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "联系电话")]
|
||||
public string Mobile { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "学历")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "岗位")]
|
||||
public string Web { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "操作账号")]
|
||||
public string Log_id { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "操作班次")]
|
||||
public string Log_shift { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "操作时间")]
|
||||
public DateTime Log_date { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "操作IP")]
|
||||
public string Log_ip { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "是否在职 F 在职 T离职")]
|
||||
public string Isowner { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "创建时间")]
|
||||
public DateTime Createdate { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "外文名字")]
|
||||
public string Gname_en { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "人脸门禁权限代码")]
|
||||
public string Face_door { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "人脸考勤权限")]
|
||||
public string Face_kq { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "人脸就餐权限")]
|
||||
public string Face_dinner { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "人事范围")]
|
||||
public string Werks { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "卡号")]
|
||||
public string CarNo { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user