Merge branch 'Test.IRC' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test.IRC
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2023-12-20 14:42:14 +08:00
commit 37200b4ced
3 changed files with 45 additions and 8 deletions

View File

@ -78,7 +78,7 @@ public static class FileStoreHelper
{
var rootPath = GetIRaCISRootPath(_hostEnvironment);
var physicalFilePath = Path.Combine(rootPath, relativePath.Trim('/'));
var physicalFilePath = Path.Combine(rootPath, relativePath);
return physicalFilePath;
}

View File

@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Application.Contracts;
namespace IRaCIS.Core.Application.Service
{
@ -99,14 +100,36 @@ namespace IRaCIS.Core.Application.Service
//---读取模板内容失败, 请将文件另存为docx格式尝试!
return ResponseOutput.NotOk(_localizer["Document_ TemplateRead"]);
}
}
}
var entity = await _commonDocumentRepository.InsertOrUpdateAsync(addOrEditCommonDocument, true, verifyExp1, verifyExp2);
if (addOrEditCommonDocument.Id == null) //insert
{
return ResponseOutput.Ok(entity.Id.ToString());
var entity = await _commonDocumentRepository.InsertFromDTOAsync(addOrEditCommonDocument, true, verifyExp1, verifyExp2);
return ResponseOutput.Ok(entity.Id.ToString());
}
else //update
{
var dbbeforeEntity = await _commonDocumentRepository.UpdateFromDTOAsync(addOrEditCommonDocument, true, true, verifyExp1, verifyExp2);
var filePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, dbbeforeEntity.Path);
if (File.Exists(filePath))
{
File.Delete(filePath);
}
return ResponseOutput.Ok();
}
}
@ -114,7 +137,20 @@ namespace IRaCIS.Core.Application.Service
[HttpDelete("{commonDocumentId:guid}")]
public async Task<IResponseOutput> DeleteCommonDocument(Guid commonDocumentId)
{
var find= await _commonDocumentRepository.FirstOrDefaultNoTrackingAsync(t=>t.Id== commonDocumentId);
var success = await _commonDocumentRepository.DeleteFromQueryAsync(t => t.Id == commonDocumentId, true,true);
if (find != null)
{
var filePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, find.Path);
if (File.Exists(filePath))
{
File.Delete(filePath);
}
}
return ResponseOutput.Ok();
}

View File

@ -22,14 +22,14 @@ namespace IRaCIS.Application.Contracts
[DictionaryTranslateAttribute("IsUserExitTrial")]
public bool IsDeleted { get; set; }
[ExcelFormat("yyyy-MM-dd hh:mm:ss")]
[ExcelFormat("yyyy-MM-dd HH:mm:ss")]
public DateTime? DeletedTime { get; set; }
public Guid? SiteId { get; set; }
public string Phone { get; set; } = String.Empty;
public DateTime UpdateTime { get; set; }
[ExcelFormat("yyyy-MM-dd hh:mm:ss")]
[ExcelFormat("yyyy-MM-dd HH:mm:ss")]
public DateTime CreateTime { get; set; }
@ -84,7 +84,7 @@ namespace IRaCIS.Application.Contracts
[ExporterHeader(Format = "yyyy-mm-DD hh:mm:ss")]
[ExcelFormat("yyyy-MM-dd hh:mm:ss")]
[ExcelFormat("yyyy-MM-dd HH:mm:ss")]
public DateTime CreateTime { get; set; }
@ -118,6 +118,7 @@ namespace IRaCIS.Application.Contracts
public class ExcelExportInfo : TrialSelectDTO
{
public string CurrentTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
public bool IsEn_US { get; set; }