工作日历
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.BasicData.Entities.Dto
|
||||
{
|
||||
public class CalendarInput
|
||||
{
|
||||
public string? datetext { get; set; }
|
||||
public string? datetype { get; set; }
|
||||
public string? workhour { get; set; }
|
||||
public string? worktype { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.BasicData.Entities.Dto.BasCalendar
|
||||
{
|
||||
public class CalendarOut
|
||||
{
|
||||
public string? datetext { get; set; }
|
||||
public string? datetype { get; set; }
|
||||
public string? workhour { get; set; }
|
||||
public string? worktype { get; set; }
|
||||
}
|
||||
}
|
||||
69
BasicData/Tnb.BasicData.Entities/Entity/BasCalendar.cs
Normal file
69
BasicData/Tnb.BasicData.Entities/Entity/BasCalendar.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.BasicData.Entities
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 休息日设置
|
||||
/// </summary>
|
||||
[SugarTable("bas_calendar")]
|
||||
public partial class BasCalendar : BaseEntity<string>
|
||||
{
|
||||
public BasCalendar()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 日期
|
||||
/// </summary>
|
||||
public string? datetext { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工作类型
|
||||
/// </summary>
|
||||
public string? worktype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日期类型
|
||||
/// </summary>
|
||||
public string? datetype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工作时段
|
||||
/// </summary>
|
||||
public string? workhour { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扩展
|
||||
/// </summary>
|
||||
public string? extras { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
24
BasicData/Tnb.BasicData.Interfaces/IBasCalendarService.cs
Normal file
24
BasicData/Tnb.BasicData.Interfaces/IBasCalendarService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
|
||||
namespace Tnb.BasicData.Interfaces
|
||||
{
|
||||
public interface IBasCalendarService
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存工作日历
|
||||
/// </summary>
|
||||
/// <param name="CalendarInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task SaveData(CalendarInput CalendarInput);
|
||||
/// <summary>
|
||||
/// 获取工作日历
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetWorkData();
|
||||
}
|
||||
}
|
||||
77
BasicData/Tnb.BasicData/BasCalendarService.cs
Normal file
77
BasicData/Tnb.BasicData/BasCalendarService.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Models.VisualDev;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.BasicData.Entities.Dto.BasCalendar;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
/// <summary>
|
||||
/// 工作日管理
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class BasCalendarService: IBasCalendarService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<BasCalendar> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public BasCalendarService(ISqlSugarRepository<BasCalendar> repository, IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存工作日历
|
||||
/// </summary>
|
||||
/// <param name="CalendarInput"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task SaveData(CalendarInput CalendarInput)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
BasCalendar BasCalendar = new BasCalendar();
|
||||
BasCalendar.datetext = CalendarInput.datetext;
|
||||
BasCalendar.datetype = CalendarInput.datetype;
|
||||
BasCalendar.workhour = CalendarInput.workhour;
|
||||
BasCalendar.worktype = CalendarInput.worktype;
|
||||
BasCalendar.create_id = _userManager.UserId;
|
||||
BasCalendar.create_time = DateTime.Now;
|
||||
await db.Insertable(BasCalendar).ExecuteCommandAsync();
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取工作日历
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetWorkData()
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var lists = await db.Queryable<BasCalendar>().ToListAsync();
|
||||
List<CalendarOut> CalendarOuts = new List<CalendarOut>();
|
||||
foreach (var list in lists)
|
||||
{
|
||||
CalendarOut CalendarOut = new CalendarOut();
|
||||
CalendarOut.datetext = list.datetext;
|
||||
CalendarOut.datetype = list.datetype;
|
||||
CalendarOut.workhour = list.workhour;
|
||||
CalendarOut.worktype = list.worktype;
|
||||
CalendarOuts.Add(CalendarOut);
|
||||
}
|
||||
return CalendarOuts;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user