|
@@ -16,6 +16,7 @@ using Hotline.Tools;
|
|
|
using Mapster;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using SqlSugar;
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
using System.Reflection;
|
|
|
using XF.Domain.Exceptions;
|
|
@@ -34,6 +35,7 @@ public class SnapshotController : BaseController
|
|
|
private readonly IIndustryRepository _industryRepository;
|
|
|
private readonly IOrderDomainService _orderDomainService;
|
|
|
private readonly IFileRepository _fileRepository;
|
|
|
+ private readonly IOrderSnapshotRepository _orderSnapshotRepository;
|
|
|
|
|
|
public SnapshotController(IRepository<Order> orderRepository, ISnapshotApplication snapshotApplication, ISystemAreaDomainService systemAreaDomainService, IIndustryRepository industryRepository, IOrderDomainService orderDomainService, IFileRepository fileRepository)
|
|
|
{
|
|
@@ -79,15 +81,17 @@ public class SnapshotController : BaseController
|
|
|
order.AcceptTypeCode = industry.AcceptTypeCode;
|
|
|
order.AcceptType = industry.AcceptType;
|
|
|
order.FromGender = EGender.Unknown;
|
|
|
- if (industry.IndustryType == EIndustryType.Declare)
|
|
|
- {
|
|
|
- order.Title = dto.GetTitle(industry.IndustryType, industry.AcceptType);
|
|
|
- order.Content = dto.GetContent(industry.IndustryType);
|
|
|
- }
|
|
|
+ order.Title = dto.GetTitle(industry.IndustryType, industry.AcceptType);
|
|
|
+ order.Content = dto.GetContent(industry.IndustryType);
|
|
|
order.InitId();
|
|
|
await _orderDomainService.AddAsync(order);
|
|
|
if (dto.Files.NotNullOrEmpty())
|
|
|
order.FileJson = await _fileRepository.AddFileAsync(dto.Files, order.Id, HttpContext.RequestAborted);
|
|
|
+ var orderSnapshot = dto.Adapt<OrderSnapshot>();
|
|
|
+ orderSnapshot.Id = order.Id;
|
|
|
+ orderSnapshot.IndustryId = dto.IndustryId;
|
|
|
+ orderSnapshot.IndustryName = industry.Name;
|
|
|
+ await _orderSnapshotRepository.AddAsync(orderSnapshot);
|
|
|
|
|
|
|
|
|
return order.Adapt<AddSnapshotOrderOutDto>();
|