fix: 门店资质日期字段改为date
This commit is contained in:
@@ -625,6 +625,8 @@ public sealed class TakeoutAppDbContext(
|
||||
builder.Property(x => x.QualificationType).HasConversion<int>();
|
||||
builder.Property(x => x.FileUrl).HasMaxLength(500).IsRequired();
|
||||
builder.Property(x => x.DocumentNumber).HasMaxLength(100);
|
||||
builder.Property(x => x.IssuedAt).HasColumnType("date");
|
||||
builder.Property(x => x.ExpiresAt).HasColumnType("date");
|
||||
builder.Property(x => x.SortOrder).HasDefaultValue(100);
|
||||
builder.HasIndex(x => new { x.TenantId, x.StoreId });
|
||||
builder.HasIndex(x => x.ExpiresAt)
|
||||
|
||||
@@ -105,11 +105,12 @@ public sealed class StoreSchedulerService(
|
||||
public async Task<int> CheckQualificationExpiryAsync(DateTime now, CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 查询过期门店
|
||||
var today = DateOnly.FromDateTime(now);
|
||||
var expiredStoreIds = await context.StoreQualifications
|
||||
.AsNoTracking()
|
||||
.Where(qualification => qualification.DeletedAt == null
|
||||
&& qualification.ExpiresAt.HasValue
|
||||
&& qualification.ExpiresAt.Value < now)
|
||||
&& qualification.ExpiresAt.Value < today)
|
||||
.Select(qualification => qualification.StoreId)
|
||||
.Distinct()
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ChangeStoreQualificationDateColumns : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateOnly>(
|
||||
name: "IssuedAt",
|
||||
table: "store_qualifications",
|
||||
type: "date",
|
||||
nullable: true,
|
||||
comment: "签发日期。",
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true,
|
||||
oldComment: "签发日期。");
|
||||
|
||||
migrationBuilder.AlterColumn<DateOnly>(
|
||||
name: "ExpiresAt",
|
||||
table: "store_qualifications",
|
||||
type: "date",
|
||||
nullable: true,
|
||||
comment: "到期日期。",
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true,
|
||||
oldComment: "到期日期。");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "IssuedAt",
|
||||
table: "store_qualifications",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
comment: "签发日期。",
|
||||
oldClrType: typeof(DateOnly),
|
||||
oldType: "date",
|
||||
oldNullable: true,
|
||||
oldComment: "签发日期。");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "ExpiresAt",
|
||||
table: "store_qualifications",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
comment: "到期日期。",
|
||||
oldClrType: typeof(DateOnly),
|
||||
oldType: "date",
|
||||
oldNullable: true,
|
||||
oldComment: "到期日期。");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdateStoreQualificationDateFields : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateOnly>(
|
||||
name: "IssuedAt",
|
||||
table: "store_qualifications",
|
||||
type: "date",
|
||||
nullable: true,
|
||||
comment: "签发日期。",
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true,
|
||||
oldComment: "签发日期。");
|
||||
|
||||
migrationBuilder.AlterColumn<DateOnly>(
|
||||
name: "ExpiresAt",
|
||||
table: "store_qualifications",
|
||||
type: "date",
|
||||
nullable: true,
|
||||
comment: "到期日期。",
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true,
|
||||
oldComment: "到期日期。");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "IssuedAt",
|
||||
table: "store_qualifications",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
comment: "签发日期。",
|
||||
oldClrType: typeof(DateOnly),
|
||||
oldType: "date",
|
||||
oldNullable: true,
|
||||
oldComment: "签发日期。");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "ExpiresAt",
|
||||
table: "store_qualifications",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
comment: "到期日期。",
|
||||
oldClrType: typeof(DateOnly),
|
||||
oldType: "date",
|
||||
oldNullable: true,
|
||||
oldComment: "到期日期。");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5731,8 +5731,8 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasComment("证照编号。");
|
||||
|
||||
b.Property<DateTime?>("ExpiresAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
b.Property<DateOnly?>("ExpiresAt")
|
||||
.HasColumnType("date")
|
||||
.HasComment("到期日期。");
|
||||
|
||||
b.Property<string>("FileUrl")
|
||||
@@ -5741,8 +5741,8 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
.HasColumnType("character varying(500)")
|
||||
.HasComment("证照文件 URL。");
|
||||
|
||||
b.Property<DateTime?>("IssuedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
b.Property<DateOnly?>("IssuedAt")
|
||||
.HasColumnType("date")
|
||||
.HasComment("签发日期。");
|
||||
|
||||
b.Property<int>("QualificationType")
|
||||
|
||||
Reference in New Issue
Block a user