ow
This commit is contained in:
parent
d795476b1f
commit
0ba1352862
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,3 +20,4 @@
|
||||
/CloudBuilder.AI/obj
|
||||
/CloudBuilder.AI.Service/bin
|
||||
/CloudBuilder.AI.Service/obj
|
||||
/CloudBuilder.AI.Gui/obj
|
||||
|
||||
@ -2,11 +2,21 @@
|
||||
using CloudBuilder.AI.Entity;
|
||||
using CloudBuilder.AI.Policy;
|
||||
using CloudBuilder.AI.SearchCriteria;
|
||||
using CloudBuilder.AI.Service.Utility;
|
||||
using CloudBuilder.Core.DatabaseAccessor;
|
||||
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
using CloudBuilder.Core.Service;
|
||||
using CloudBuilder.Security.Data;
|
||||
using CloudBuilder.Security.Entity;
|
||||
using CloudBuilder.Security.Policy;
|
||||
using CloudBuilder.Security.Service;
|
||||
using CloudBuilder.Security.Utility;
|
||||
using DocumentFormat.OpenXml.ExtendedProperties;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Text;
|
||||
using System.Transactions;
|
||||
namespace CloudBuilder.AI.Service
|
||||
{
|
||||
public class AiBookService : IAiBookService
|
||||
@ -21,20 +31,71 @@ namespace CloudBuilder.AI.Service
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)]
|
||||
public AiBookEntity FindByKey(string key)
|
||||
public AiBookData FindByKey(string key)
|
||||
{
|
||||
return repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!;
|
||||
AiBookData data = new AiBookData();
|
||||
data.AiBook = repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!;
|
||||
|
||||
if (data.AiBook.FileId > 0)
|
||||
{
|
||||
IRepository<BookDmsFileViewEntity> repositoryUploadDmsFile = service.GetRepository<IRepository<BookDmsFileViewEntity>>();
|
||||
BookDmsFileViewEntity dms;
|
||||
|
||||
dms = repositoryUploadDmsFile.DetachedEntities.Where(x => x.FileId == data.AiBook.FileId).FirstOrDefault()!;
|
||||
data.FileName = dms.OrgFileName;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)]
|
||||
public AiBookEntity FindByTitle(string title)
|
||||
{
|
||||
return repository.DetachedEntities.Where(x => x.Title == title).FirstOrDefault()!;
|
||||
}
|
||||
|
||||
//[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)]
|
||||
public dynamic FindBySearchCriteria(AiBookSearchCriteria criteria)
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)]
|
||||
public AiBookResultData FindBySearchCriteria(AiBookSearchCriteria criteria)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
AiBookResultData data = new AiBookResultData();
|
||||
AiBookEntity[] list = null;
|
||||
|
||||
int count = 0;
|
||||
|
||||
string sqlWhere = null;
|
||||
|
||||
if (criteria.Filter != null && criteria.Filter.Length > 0)
|
||||
{
|
||||
sqlWhere = SearchFilter.ComposeWhereClause(criteria.Filter);
|
||||
}
|
||||
|
||||
AiBookEntity entity = AiBookEntity.GetInstance();
|
||||
string sql = entity.GetSelectTopFrom(criteria.limit, criteria.page, criteria.orderby.StringToDbField(), criteria.orderbytag, sqlWhere);
|
||||
|
||||
string err = null;
|
||||
try
|
||||
{
|
||||
list = repository.FromSql(sql).ToArray();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
err = ex.Message;
|
||||
}
|
||||
|
||||
|
||||
if (list != null && list.Length > 0)
|
||||
{
|
||||
sql = entity.GetSelectCountFrom(sqlWhere);
|
||||
count = (int)repository.ExecuteScalar(sql);
|
||||
}
|
||||
|
||||
data.Limit = criteria.limit;
|
||||
data.Page = criteria.page;
|
||||
data.Datas = list;
|
||||
data.Total = count;
|
||||
//data.Sql = sql;
|
||||
data.ErrorMessage = err;
|
||||
return data;
|
||||
}
|
||||
|
||||
//[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Print)]
|
||||
@ -43,16 +104,16 @@ namespace CloudBuilder.AI.Service
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Insert)]
|
||||
[UnitOfWork]
|
||||
public AiBookEntity Insert(AiBookEntity data)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
//[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Insert)]
|
||||
//[UnitOfWork]
|
||||
//public AiBookEntity Insert(AiBookEntity data)
|
||||
//{
|
||||
// throw new NotImplementedException();
|
||||
//}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Insert)]
|
||||
[UnitOfWork]
|
||||
public void Insert(AiBookData data)
|
||||
public AiBookData Insert(AiBookData data)
|
||||
{
|
||||
AiBookEntity entity = repository.DetachedEntities.Where(x => x.Title == data.AiBook.Title).FirstOrDefault();
|
||||
if (entity != null)
|
||||
@ -60,17 +121,36 @@ namespace CloudBuilder.AI.Service
|
||||
throw new ValidatedException("记录已存在.");
|
||||
}
|
||||
|
||||
ISecurityGeneratorNumberService securityGeneratorNumberService = service.ServiceProvider.GetService<ISecurityGeneratorNumberService>()!;
|
||||
|
||||
data.AiBook.Guid = securityGeneratorNumberService.GetNo(AIPrefixPolicy.AI_BOOK, AIPrefixPolicy.GUID, AIPrefixPolicy.AI_BOOK_PREFIX, YesNoPolicy.NO, AIPrefixPolicy.AI_BOOK_GUID_FORMAT);
|
||||
|
||||
repository.InsertNow(data.AiBook);
|
||||
|
||||
IRepository<AiChapterEntity> repositoryAiChapterEntity = repository.GetRepository<IRepository<AiChapterEntity>>();
|
||||
repositoryAiChapterEntity.InsertNow(data.AiChapters);
|
||||
if (data.AiChapters != null && data.AiChapters.Length > 0)
|
||||
repositoryAiChapterEntity.InsertNow(data.AiChapters);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Update)]
|
||||
[UnitOfWork]
|
||||
public AiBookEntity Update(AiBookEntity data)
|
||||
public AiBookData Update(AiBookData data)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
AiBookEntity aiBook = repository.DetachedEntities.Where(x => x.Guid == data.AiBook.Guid).FirstOrDefault();
|
||||
if (aiBook == null)
|
||||
{
|
||||
throw new ValidatedException("记录不存在.");
|
||||
}
|
||||
|
||||
ValidateHelper.Validate(service, data.AiBook, AiBookEntity.DB_NAME_AI_BOOK);
|
||||
|
||||
ObjectCopyHelper.Copy(data.AiBook, aiBook);
|
||||
|
||||
repository.UpdateNow(aiBook);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@ -82,6 +162,95 @@ namespace CloudBuilder.AI.Service
|
||||
if (ent != null) { repository.DeleteNow(ent); }
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Delete)]
|
||||
[UnitOfWork]
|
||||
public void Deletes(string[] keys)
|
||||
{
|
||||
foreach (string key in keys)
|
||||
{
|
||||
Delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Update)]
|
||||
[UnitOfWork]
|
||||
public AiBookData ProcessBook(string key, string encoding, string pattern)
|
||||
{
|
||||
AiBookData data = FindByKey(key);
|
||||
|
||||
ChapterSplitter chapterSplitter = new ChapterSplitter();
|
||||
ParagraphSplitter paragraphSplitter = new ParagraphSplitter();
|
||||
|
||||
IRepository<DmsFileEntity> repositoryDmsFile = repository.GetRepository<IRepository<DmsFileEntity>>();
|
||||
|
||||
DmsFileEntity entity = repositoryDmsFile.DetachedEntities.Where(x => x.FileId == data.AiBook.FileId && x.CreatedBy == service.UserId).FirstOrDefault()!;
|
||||
|
||||
if (entity == null) throw new ValidatedException("文件不存在.");
|
||||
|
||||
var fileExtension = Path.GetExtension(entity.OrderKey);//获取文件格式,拓展名
|
||||
|
||||
string file = FileTypePolicy.PackFilePath(service, entity.CreatedBy, entity.OrderKey);
|
||||
|
||||
if (!File.Exists(file)) throw new ValidatedException("文件不存在.");
|
||||
|
||||
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||
|
||||
string context = File.ReadAllText(file, Encoding.GetEncoding(encoding));
|
||||
|
||||
List<AiChapterEntity> aiChapterEntities = chapterSplitter.SplitNovelIntoChapters(context, pattern);
|
||||
|
||||
if (aiChapterEntities == null || aiChapterEntities.Count() == 0) return data;
|
||||
|
||||
aiChapterEntities.ToLookup(x => x.BookGuid = data.AiBook.Guid);
|
||||
aiChapterEntities.ToLookup(x => x.Status = ChapterStatusPolicy.PROCESS);
|
||||
|
||||
data.AiChapters = aiChapterEntities.ToArray();
|
||||
|
||||
paragraphSplitter.PackParagraphs(data);
|
||||
|
||||
IRepository<AiChapterEntity> repositoryAiChapterEntity = repository.GetRepository<IRepository<AiChapterEntity>>();
|
||||
IRepository<AiParagraphEntity> repositoryAiParagraphEntity = repository.GetRepository<IRepository<AiParagraphEntity>>();
|
||||
|
||||
IRepository<AiSentenceEntity> repositoryAiSentenceEntity = repository.GetRepository<IRepository<AiSentenceEntity>>();
|
||||
|
||||
AiChapterEntity[] aiChapters = repositoryAiChapterEntity.DetachedEntities.Where(x => x.BookGuid == data.AiBook.Guid).ToArray();
|
||||
|
||||
if (aiChapters != null && aiChapters.Length > 0)
|
||||
{
|
||||
foreach (AiChapterEntity aiChapter in aiChapters)
|
||||
{
|
||||
AiParagraphEntity[] aiParagraphs = repositoryAiParagraphEntity.DetachedEntities.Where(x => x.ChapterGuid == aiChapter.Guid).ToArray();
|
||||
|
||||
if (aiParagraphs != null && aiParagraphs.Length > 0)
|
||||
{
|
||||
foreach (AiParagraphEntity aiParagraph in aiParagraphs)
|
||||
{
|
||||
AiSentenceEntity[] aiSentences = repositoryAiSentenceEntity.DetachedEntities.Where(x => x.ParagraphGuid == aiParagraph.Guid).ToArray();
|
||||
|
||||
if (aiSentences != null && aiSentences.Length > 0)
|
||||
{
|
||||
repositoryAiSentenceEntity.DeleteNow(aiSentences);
|
||||
}
|
||||
}
|
||||
|
||||
repositoryAiParagraphEntity.DeleteNow(aiParagraphs);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
repositoryAiChapterEntity.DeleteNow(aiChapters);
|
||||
}
|
||||
|
||||
repositoryAiChapterEntity.InsertNow(data.AiChapters);
|
||||
|
||||
if (data.AiParagraphs == null || data.AiParagraphs.Count() == 0) return data;
|
||||
|
||||
repositoryAiParagraphEntity.InsertNow(data.AiParagraphs);
|
||||
|
||||
if (data.AiSentences == null || data.AiSentences.Count() == 0) return data;
|
||||
repositoryAiSentenceEntity.InsertNow(data.AiSentences);
|
||||
|
||||
return FindByKey(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using CloudBuilder.Core.DatabaseAccessor;
|
||||
using CloudBuilder.AI.Data;
|
||||
using CloudBuilder.AI.Entity;
|
||||
using CloudBuilder.AI.Policy;
|
||||
using CloudBuilder.AI.SearchCriteria;
|
||||
using CloudBuilder.Core.DatabaseAccessor;
|
||||
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
using CloudBuilder.Core.Service;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
namespace CloudBuilder.AI.Service
|
||||
{
|
||||
public class AiChapterService : IAiChapterService
|
||||
@ -17,7 +19,7 @@ namespace CloudBuilder.AI.Service
|
||||
repository = service.GetRepository<IRepository<AiChapterEntity>>();
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Find)]
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)]
|
||||
public AiChapterEntity FindByKey(string key)
|
||||
{
|
||||
return repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!;
|
||||
@ -34,26 +36,64 @@ namespace CloudBuilder.AI.Service
|
||||
return repository.DetachedEntities.Where(x => x.BookGuid == aiBookEntity.Guid).ToArray();
|
||||
}
|
||||
|
||||
//[PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Find)]
|
||||
public dynamic FindBySearchCriteria(AiChapterSearchCriteria criteria)
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)]
|
||||
public AiChapterResultData FindBySearchCriteria(AiChapterSearchCriteria criteria)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
AiChapterResultData data = new AiChapterResultData();
|
||||
AiChapterEntity[] list = null;
|
||||
|
||||
int count = 0;
|
||||
|
||||
string sqlWhere = null;
|
||||
|
||||
if (criteria.Filter != null && criteria.Filter.Length > 0)
|
||||
{
|
||||
sqlWhere = SearchFilter.ComposeWhereClause(criteria.Filter);
|
||||
}
|
||||
|
||||
AiChapterEntity entity = AiChapterEntity.GetInstance();
|
||||
string sql = entity.GetSelectTopFrom(criteria.limit, criteria.page, criteria.orderby.StringToDbField(), criteria.orderbytag, sqlWhere);
|
||||
|
||||
string err = null;
|
||||
try
|
||||
{
|
||||
list = repository.FromSql(sql).ToArray();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
err = ex.Message;
|
||||
}
|
||||
|
||||
|
||||
if (list != null && list.Length > 0)
|
||||
{
|
||||
sql = entity.GetSelectCountFrom(sqlWhere);
|
||||
count = (int)repository.ExecuteScalar(sql);
|
||||
}
|
||||
|
||||
data.Limit = criteria.limit;
|
||||
data.Page = criteria.page;
|
||||
data.Datas = list.OrderBy(x=>x.ChapterIndex).ToArray();
|
||||
data.Total = count;
|
||||
//data.Sql = sql;
|
||||
data.ErrorMessage = err;
|
||||
return data;
|
||||
}
|
||||
|
||||
//[PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Print)]
|
||||
//[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Print)]
|
||||
public dynamic PrintBySearchCriteria(AiChapterSearchCriteria criteria)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Insert)]
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Insert)]
|
||||
[UnitOfWork]
|
||||
public AiChapterEntity Insert(AiChapterEntity data)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Update)]
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Update)]
|
||||
[UnitOfWork]
|
||||
public AiChapterEntity Update(AiChapterEntity data)
|
||||
{
|
||||
@ -61,7 +101,7 @@ namespace CloudBuilder.AI.Service
|
||||
}
|
||||
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Delete)]
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Delete)]
|
||||
[UnitOfWork]
|
||||
public void Delete(string key)
|
||||
{
|
||||
|
||||
@ -21,16 +21,25 @@ namespace CloudBuilder.AI.Service
|
||||
repository = service.GetRepository<IRepository<AiSentenceEntity>>();
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Find)]
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)]
|
||||
public AiSentenceEntity FindByKey(string key)
|
||||
{
|
||||
return repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!;
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Find)]
|
||||
public AiSentenceViewEntityResultData FindBySearchCriteria(AiSentenceSearchCriteria criteria)
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)]
|
||||
public AiSentenceViewEntity[] FindByChapterGuid(string chapterGuid)
|
||||
{
|
||||
AiSentenceViewEntityResultData data = new AiSentenceViewEntityResultData();
|
||||
IRepository<AiSentenceViewEntity> repositoryAiSentenceViewEntity = repository.GetRepository<IRepository<AiSentenceViewEntity>>();
|
||||
|
||||
return repositoryAiSentenceViewEntity.DetachedEntities.Where(x => x.ChapterGuid == chapterGuid).OrderBy(x => x.ParagraphIndex).ThenBy(x=>x.SentenceIndex).ToArray();
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)]
|
||||
public AiSentenceViewResultData FindBySearchCriteria(AiSentenceSearchCriteria criteria)
|
||||
{
|
||||
AiSentenceViewResultData data = new AiSentenceViewResultData();
|
||||
AiSentenceViewEntity[] list = null;
|
||||
IRepository<AiSentenceViewEntity> repositoryAiSentenceViewEntity = repository.GetRepository<IRepository<AiSentenceViewEntity>>();
|
||||
|
||||
@ -72,13 +81,13 @@ namespace CloudBuilder.AI.Service
|
||||
return data;
|
||||
}
|
||||
|
||||
//[PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Print)]
|
||||
//[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Print)]
|
||||
public dynamic PrintBySearchCriteria(AiSentenceSearchCriteria criteria)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Insert)]
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Insert)]
|
||||
[UnitOfWork]
|
||||
public AiSentenceEntity Insert(AiSentenceEntity data)
|
||||
{
|
||||
@ -92,7 +101,7 @@ namespace CloudBuilder.AI.Service
|
||||
repository.InsertNow(datas);
|
||||
}
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Update)]
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Update)]
|
||||
[UnitOfWork]
|
||||
public AiSentenceEntity Update(AiSentenceEntity data)
|
||||
{
|
||||
@ -100,11 +109,11 @@ namespace CloudBuilder.AI.Service
|
||||
}
|
||||
|
||||
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Delete)]
|
||||
[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Delete)]
|
||||
[UnitOfWork]
|
||||
public void Delete(string key)
|
||||
{
|
||||
var ent= repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!;
|
||||
var ent = repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!;
|
||||
if (ent != null) { repository.DeleteNow(ent); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,12 +6,6 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Utility\**" />
|
||||
<EmbeddedResource Remove="Utility\**" />
|
||||
<None Remove="Utility\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="8.0.0" />
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Linkup\" />
|
||||
<Folder Include="Publisher\" />
|
||||
<Folder Include="SearchCriteria\" />
|
||||
<Folder Include="Service\" />
|
||||
|
||||
@ -15,5 +15,10 @@ namespace CloudBuilder.AI.Data
|
||||
public AiBookPersonEntity[]? AiBookPersons { get; set; }
|
||||
public AiParagraphEntity[]? AiParagraphs { get; set; }
|
||||
public AiSentenceEntity[]? AiSentences { get; set; }
|
||||
|
||||
public const string FILE_NAME = "FileName";
|
||||
|
||||
//如果没有加string.Empty;那么前端会要求必须有值
|
||||
public string? FileName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
using CloudBuilder.AI.Entity;
|
||||
using CloudBuilder.Core.Authorization;
|
||||
using CloudBuilder.Core.Service;
|
||||
using CloudBuilder.Security.Entity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.AI.Data
|
||||
{
|
||||
[TypeScript]
|
||||
public class AiSentenceViewEntityResultData : SearchCriteriaResultData
|
||||
{
|
||||
public AiSentenceViewEntity[]? Datas { get; set; }
|
||||
}
|
||||
}
|
||||
@ -13,8 +13,14 @@ namespace CloudBuilder.AI.Entity
|
||||
{
|
||||
}
|
||||
|
||||
[Column("created_datetime")]
|
||||
public DateTime CreatedDatetime { get; set; }
|
||||
[Column("description")]
|
||||
public string? Description { get; set; }
|
||||
[Column("book_type")]
|
||||
public string? BookType { get; set; }
|
||||
[Column("file_id")]
|
||||
public int FileId { get; set; }
|
||||
[Column("status")]
|
||||
public string Status { get; set; }
|
||||
[Column("created_by")]
|
||||
public string CreatedBy { get; set; }
|
||||
[Column("updated_datetime")]
|
||||
@ -28,41 +34,35 @@ namespace CloudBuilder.AI.Entity
|
||||
public string Title { get; set; }
|
||||
[Column("author")]
|
||||
public string? Author { get; set; }
|
||||
[Column("description")]
|
||||
public string? Description { get; set; }
|
||||
[Column("book_type")]
|
||||
public string? BookType { get; set; }
|
||||
[Column("file_path")]
|
||||
public string? FilePath { get; set; }
|
||||
[Column("status")]
|
||||
public string Status { get; set; }
|
||||
[Column("created_datetime")]
|
||||
public DateTime CreatedDatetime { get; set; }
|
||||
|
||||
public const string CREATED_DATETIME = "CreatedDatetime";
|
||||
public const string DESCRIPTION = "Description";
|
||||
public const string BOOK_TYPE = "BookType";
|
||||
public const string FILE_ID = "FileId";
|
||||
public const string STATUS = "Status";
|
||||
public const string CREATED_BY = "CreatedBy";
|
||||
public const string UPDATED_DATETIME = "UpdatedDatetime";
|
||||
public const string UPDATED_BY = "UpdatedBy";
|
||||
public const string GUID = "Guid";
|
||||
public const string TITLE = "Title";
|
||||
public const string AUTHOR = "Author";
|
||||
public const string DESCRIPTION = "Description";
|
||||
public const string BOOK_TYPE = "BookType";
|
||||
public const string FILE_PATH = "FilePath";
|
||||
public const string STATUS = "Status";
|
||||
public const string CREATED_DATETIME = "CreatedDatetime";
|
||||
|
||||
public const string DB_NAME_AI_BOOK = "ai_book";
|
||||
public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,guid,title,author,description,book_type,file_path,status";
|
||||
public const string DB_NAME_FIELDS="description,book_type,file_id,status,created_by,updated_datetime,updated_by,guid,title,author,created_datetime";
|
||||
|
||||
public const string DB_CREATED_DATETIME = "created_datetime";
|
||||
public const string DB_DESCRIPTION = "description";
|
||||
public const string DB_BOOK_TYPE = "book_type";
|
||||
public const string DB_FILE_ID = "file_id";
|
||||
public const string DB_STATUS = "status";
|
||||
public const string DB_CREATED_BY = "created_by";
|
||||
public const string DB_UPDATED_DATETIME = "updated_datetime";
|
||||
public const string DB_UPDATED_BY = "updated_by";
|
||||
public const string DB_GUID = "guid";
|
||||
public const string DB_TITLE = "title";
|
||||
public const string DB_AUTHOR = "author";
|
||||
public const string DB_DESCRIPTION = "description";
|
||||
public const string DB_BOOK_TYPE = "book_type";
|
||||
public const string DB_FILE_PATH = "file_path";
|
||||
public const string DB_STATUS = "status";
|
||||
public const string DB_CREATED_DATETIME = "created_datetime";
|
||||
|
||||
|
||||
public static AiBookEntity GetInstance()
|
||||
@ -82,24 +82,24 @@ namespace CloudBuilder.AI.Entity
|
||||
throw new NullReferenceException("Source entity is null.");
|
||||
}
|
||||
|
||||
this.CreatedDatetime = source.CreatedDatetime;
|
||||
this.Description = source.Description;
|
||||
this.BookType = source.BookType;
|
||||
this.FileId = source.FileId;
|
||||
this.Status = source.Status;
|
||||
this.CreatedBy = source.CreatedBy;
|
||||
this.UpdatedDatetime = source.UpdatedDatetime;
|
||||
this.UpdatedBy = source.UpdatedBy;
|
||||
this.Guid = source.Guid;
|
||||
this.Title = source.Title;
|
||||
this.Author = source.Author;
|
||||
this.Description = source.Description;
|
||||
this.BookType = source.BookType;
|
||||
this.FilePath = source.FilePath;
|
||||
this.Status = source.Status;
|
||||
this.CreatedDatetime = source.CreatedDatetime;
|
||||
|
||||
if (includeSystemFields)
|
||||
{
|
||||
this.CreatedDatetime = source.CreatedDatetime;
|
||||
this.CreatedBy = source.CreatedBy;
|
||||
this.UpdatedDatetime = source.UpdatedDatetime;
|
||||
this.UpdatedBy = source.UpdatedBy;
|
||||
this.CreatedDatetime = source.CreatedDatetime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -13,10 +13,6 @@ namespace CloudBuilder.AI.Entity
|
||||
{
|
||||
}
|
||||
|
||||
[Column("chapter_guid")]
|
||||
public string? ChapterGuid { get; set; }
|
||||
[Column("paragraph_index")]
|
||||
public int ParagraphIndex { get; set; }
|
||||
[Column("created_datetime")]
|
||||
public DateTime CreatedDatetime { get; set; }
|
||||
[Column("created_by")]
|
||||
@ -25,16 +21,16 @@ namespace CloudBuilder.AI.Entity
|
||||
public DateTime UpdatedDatetime { get; set; }
|
||||
[Column("updated_by")]
|
||||
public string UpdatedBy { get; set; }
|
||||
[Column("sentiment")]
|
||||
public string? Sentiment { get; set; }
|
||||
[Column("content")]
|
||||
public string Content { get; set; }
|
||||
[Column("status")]
|
||||
public string? Status { get; set; }
|
||||
[Column("guid")]
|
||||
public string Guid { get; set; }
|
||||
[Column("paragraph_guid")]
|
||||
public string ParagraphGuid { get; set; }
|
||||
[Column("status")]
|
||||
public string? Status { get; set; }
|
||||
[Column("chapter_guid")]
|
||||
public string ChapterGuid { get; set; }
|
||||
[Column("paragraph_index")]
|
||||
public int ParagraphIndex { get; set; }
|
||||
[Column("sentence_index")]
|
||||
public int SentenceIndex { get; set; }
|
||||
[Column("dialogue_indc")]
|
||||
@ -43,41 +39,45 @@ namespace CloudBuilder.AI.Entity
|
||||
public string? PersonName { get; set; }
|
||||
[Column("gender")]
|
||||
public string? Gender { get; set; }
|
||||
[Column("sentiment")]
|
||||
public string? Sentiment { get; set; }
|
||||
[Column("content")]
|
||||
public string Content { get; set; }
|
||||
|
||||
public const string CHAPTER_GUID = "ChapterGuid";
|
||||
public const string PARAGRAPH_INDEX = "ParagraphIndex";
|
||||
public const string CREATED_DATETIME = "CreatedDatetime";
|
||||
public const string CREATED_BY = "CreatedBy";
|
||||
public const string UPDATED_DATETIME = "UpdatedDatetime";
|
||||
public const string UPDATED_BY = "UpdatedBy";
|
||||
public const string SENTIMENT = "Sentiment";
|
||||
public const string CONTENT = "Content";
|
||||
public const string STATUS = "Status";
|
||||
public const string GUID = "Guid";
|
||||
public const string PARAGRAPH_GUID = "ParagraphGuid";
|
||||
public const string STATUS = "Status";
|
||||
public const string CHAPTER_GUID = "ChapterGuid";
|
||||
public const string PARAGRAPH_INDEX = "ParagraphIndex";
|
||||
public const string SENTENCE_INDEX = "SentenceIndex";
|
||||
public const string DIALOGUE_INDC = "DialogueIndc";
|
||||
public const string PERSON_NAME = "PersonName";
|
||||
public const string GENDER = "Gender";
|
||||
public const string SENTIMENT = "Sentiment";
|
||||
public const string CONTENT = "Content";
|
||||
|
||||
public const string DB_NAME_AI_SENTENCE_VIEW = "ai_sentence_view";
|
||||
public const string DB_NAME_FIELDS="chapter_guid,paragraph_index,created_datetime,created_by,updated_datetime,updated_by,sentiment,content,status,guid,paragraph_guid,sentence_index,dialogue_indc,person_name,gender";
|
||||
public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,guid,paragraph_guid,status,chapter_guid,paragraph_index,sentence_index,dialogue_indc,person_name,gender,sentiment,content";
|
||||
|
||||
public const string DB_CHAPTER_GUID = "chapter_guid";
|
||||
public const string DB_PARAGRAPH_INDEX = "paragraph_index";
|
||||
public const string DB_CREATED_DATETIME = "created_datetime";
|
||||
public const string DB_CREATED_BY = "created_by";
|
||||
public const string DB_UPDATED_DATETIME = "updated_datetime";
|
||||
public const string DB_UPDATED_BY = "updated_by";
|
||||
public const string DB_SENTIMENT = "sentiment";
|
||||
public const string DB_CONTENT = "content";
|
||||
public const string DB_STATUS = "status";
|
||||
public const string DB_GUID = "guid";
|
||||
public const string DB_PARAGRAPH_GUID = "paragraph_guid";
|
||||
public const string DB_STATUS = "status";
|
||||
public const string DB_CHAPTER_GUID = "chapter_guid";
|
||||
public const string DB_PARAGRAPH_INDEX = "paragraph_index";
|
||||
public const string DB_SENTENCE_INDEX = "sentence_index";
|
||||
public const string DB_DIALOGUE_INDC = "dialogue_indc";
|
||||
public const string DB_PERSON_NAME = "person_name";
|
||||
public const string DB_GENDER = "gender";
|
||||
public const string DB_SENTIMENT = "sentiment";
|
||||
public const string DB_CONTENT = "content";
|
||||
|
||||
|
||||
public static AiSentenceViewEntity GetInstance()
|
||||
@ -97,21 +97,21 @@ namespace CloudBuilder.AI.Entity
|
||||
throw new NullReferenceException("Source entity is null.");
|
||||
}
|
||||
|
||||
this.ChapterGuid = source.ChapterGuid;
|
||||
this.ParagraphIndex = source.ParagraphIndex;
|
||||
this.CreatedDatetime = source.CreatedDatetime;
|
||||
this.CreatedBy = source.CreatedBy;
|
||||
this.UpdatedDatetime = source.UpdatedDatetime;
|
||||
this.UpdatedBy = source.UpdatedBy;
|
||||
this.Sentiment = source.Sentiment;
|
||||
this.Content = source.Content;
|
||||
this.Status = source.Status;
|
||||
this.Guid = source.Guid;
|
||||
this.ParagraphGuid = source.ParagraphGuid;
|
||||
this.Status = source.Status;
|
||||
this.ChapterGuid = source.ChapterGuid;
|
||||
this.ParagraphIndex = source.ParagraphIndex;
|
||||
this.SentenceIndex = source.SentenceIndex;
|
||||
this.DialogueIndc = source.DialogueIndc;
|
||||
this.PersonName = source.PersonName;
|
||||
this.Gender = source.Gender;
|
||||
this.Sentiment = source.Sentiment;
|
||||
this.Content = source.Content;
|
||||
|
||||
if (includeSystemFields)
|
||||
{
|
||||
@ -136,7 +136,7 @@ namespace CloudBuilder.AI.Entity
|
||||
{
|
||||
if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
|
||||
|
||||
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_CHAPTER_GUID ; string top = limit > 0 ? $"top {limit}" : "";
|
||||
if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_CREATED_DATETIME ; string top = limit > 0 ? $"top {limit}" : "";
|
||||
return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_AI_SENTENCE_VIEW} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
|
||||
}
|
||||
|
||||
|
||||
@ -35,6 +35,10 @@ namespace CloudBuilder.AI.Entity
|
||||
//***BEGIN***
|
||||
|
||||
|
||||
builder.Entity<AiSentenceViewEntity>(eb => { eb.HasNoKey(); });
|
||||
builder.Entity<DmsFolderMapEntity>().HasKey(c => new {c.FolderNameParent,c.FolderNameSon});
|
||||
builder.Entity<BookDmsFileViewEntity>(eb => { eb.HasNoKey(); });
|
||||
builder.Entity<AiSentenceViewEntity>(eb => { eb.HasNoKey(); });
|
||||
builder.Entity<AiSentenceViewEntity>(eb => { eb.HasNoKey(); });
|
||||
//***END***
|
||||
}
|
||||
|
||||
@ -3,14 +3,14 @@ namespace CloudBuilder.AI.Policy
|
||||
public partial class AIPermissionPolicy
|
||||
{
|
||||
//***BEGIN***
|
||||
public const string AiCharacter = "AiCharacter";
|
||||
public const string AiSentence = "AiSentence";
|
||||
public const string AiWord = "AiWord";
|
||||
public const string AiBook = "AiBook";
|
||||
public const string AiBookPerson = "AiBookPerson";
|
||||
public const string AiChapter = "AiChapter";
|
||||
public const string AiChapterPerson = "AiChapterPerson";
|
||||
public const string AiParagraph = "AiParagraph";
|
||||
public const string DmsFile = "DmsFile";
|
||||
public const string DmsFolder = "DmsFolder";
|
||||
//***END***
|
||||
}
|
||||
}
|
||||
@ -11,8 +11,9 @@ namespace CloudBuilder.AI.Policy
|
||||
{
|
||||
public class BookStatusPolicy : LocalePolicy, IPolicy
|
||||
{
|
||||
public const string SUBMIT = "S";//待提交
|
||||
|
||||
public const string DRAFT = "D";
|
||||
public const string SUBMIT = "S";
|
||||
public const string COMPLETED = "C";
|
||||
|
||||
private readonly IContext context;
|
||||
private readonly ILocaleMessageManager localeMessageManager;
|
||||
|
||||
@ -3,12 +3,21 @@ using CloudBuilder.AI.Data;
|
||||
using CloudBuilder.AI.Entity;
|
||||
using CloudBuilder.AI.SearchCriteria;
|
||||
using CloudBuilder.Core.Service;
|
||||
using CloudBuilder.Security.Data;
|
||||
using CloudBuilder.Security.SearchCriteria;
|
||||
|
||||
namespace CloudBuilder.AI.Service
|
||||
{
|
||||
public interface IAiBookService : IServiceBase<AiBookEntity, string, AiBookSearchCriteria>
|
||||
public interface IAiBookService : IServiceBase<AiBookData, string, AiBookSearchCriteria>
|
||||
{
|
||||
AiBookResultData FindBySearchCriteria(AiBookSearchCriteria tc);
|
||||
|
||||
void Deletes(string[] keys);
|
||||
AiBookEntity FindByTitle(string title);
|
||||
void Insert(AiBookData data);
|
||||
AiBookData Insert(AiBookData data);
|
||||
|
||||
AiBookData Update(AiBookData data);
|
||||
|
||||
AiBookData ProcessBook(string key, string encoding, string pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
|
||||
using CloudBuilder.AI.Data;
|
||||
using CloudBuilder.AI.Entity;
|
||||
using CloudBuilder.AI.SearchCriteria;
|
||||
using CloudBuilder.Core.Service;
|
||||
@ -7,6 +8,8 @@ namespace CloudBuilder.AI.Service
|
||||
{
|
||||
public interface IAiChapterService :IServiceBase<AiChapterEntity, string ,AiChapterSearchCriteria>
|
||||
{
|
||||
AiChapterResultData FindBySearchCriteria(AiChapterSearchCriteria criteria);
|
||||
|
||||
AiChapterEntity[] FindByTitle(string title);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@ namespace CloudBuilder.AI.Service
|
||||
{
|
||||
public interface IAiParagraphService :IServiceBase<AiParagraphEntity, string ,AiParagraphSearchCriteria>
|
||||
{
|
||||
|
||||
|
||||
void Inserts(AiParagraphEntity[] datas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,8 @@ namespace CloudBuilder.AI.Service
|
||||
{
|
||||
public interface IAiSentenceService :IServiceBase<AiSentenceEntity, string ,AiSentenceSearchCriteria>
|
||||
{
|
||||
AiSentenceViewEntityResultData FindBySearchCriteria(AiSentenceSearchCriteria criteria);
|
||||
AiSentenceViewEntity[] FindByChapterGuid(string chapterGuid);
|
||||
AiSentenceViewResultData FindBySearchCriteria(AiSentenceSearchCriteria criteria);
|
||||
void Inserts(AiSentenceEntity[] datas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="CloudBuilder.AI">
|
||||
<HintPath>..\CloudBuilder.AI\bin\Debug\net8.0\CloudBuilder.AI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.Core">
|
||||
<HintPath>..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.AI", "CloudBui
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.AI.Service", "CloudBuilder.AI.Service\CloudBuilder.AI.Service.csproj", "{5767BF2F-70B3-4FF6-CB85-9C0F8F0C8612}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Core", "CloudBuilder.Core\CloudBuilder.Core.csproj", "{AFA9D41C-E8A5-32D3-E81B-2ABA7C37D46C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -33,6 +35,10 @@ Global
|
||||
{5767BF2F-70B3-4FF6-CB85-9C0F8F0C8612}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5767BF2F-70B3-4FF6-CB85-9C0F8F0C8612}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5767BF2F-70B3-4FF6-CB85-9C0F8F0C8612}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AFA9D41C-E8A5-32D3-E81B-2ABA7C37D46C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AFA9D41C-E8A5-32D3-E81B-2ABA7C37D46C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AFA9D41C-E8A5-32D3-E81B-2ABA7C37D46C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AFA9D41C-E8A5-32D3-E81B-2ABA7C37D46C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -28,6 +28,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="CloudBuilder.AI">
|
||||
<HintPath>..\CloudBuilder.AI\bin\Debug\net8.0\CloudBuilder.AI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.AI.Service">
|
||||
<HintPath>..\CloudBuilder.AI.Service\bin\Debug\net8.0\CloudBuilder.AI.Service.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.Core">
|
||||
<HintPath>..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@ -10,6 +10,7 @@ using CloudBuilder.AI.Service;
|
||||
using CloudBuilder.AI.Entity;
|
||||
using System;
|
||||
using CloudBuilder.AI.Data;
|
||||
using CloudBuilder.AI.SearchCriteria;
|
||||
|
||||
namespace CloudBuilder.Web.Entry.Controllers.Ai
|
||||
{
|
||||
@ -65,12 +66,32 @@ this.aiBookService= aiBookService;
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiBook", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindBySearchCriteria(AiBookSearchCriteria criteria)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var result = aiBookService.FindBySearchCriteria(criteria);
|
||||
return result;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiBook", operate: "Insert")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Insert(AiBookEntity data)
|
||||
public dynamic Insert(AiBookData data)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -86,32 +107,12 @@ this.aiBookService= aiBookService;
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiBook", operate: "Insert")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Insert(AiBookData data){
|
||||
try
|
||||
{
|
||||
aiBookService.Insert(data);
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiBook", operate: "Update")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Update(AiBookEntity data)
|
||||
public dynamic Update(AiBookData data)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -149,6 +150,55 @@ this.aiBookService= aiBookService;
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiBook", operate: "Delete")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Deletes(string[] keys){
|
||||
try
|
||||
{
|
||||
aiBookService.Deletes(keys);
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ProcessBookCompositionData
|
||||
{
|
||||
public string key { get; set; }
|
||||
public string encoding { get; set; }
|
||||
public string pattern { get; set; }
|
||||
|
||||
}
|
||||
[PermissionOperate(name: "AiBook", operate: "Update")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic ProcessBook(ProcessBookCompositionData compositionData)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var result = aiBookService.ProcessBook(compositionData.key,compositionData.encoding,compositionData.pattern);
|
||||
return result;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,7 @@ using CloudBuilder.AI.Service;
|
||||
using CloudBuilder.AI.Entity;
|
||||
using System;
|
||||
using CloudBuilder.AI.Data;
|
||||
using CloudBuilder.AI.SearchCriteria;
|
||||
|
||||
namespace CloudBuilder.Web.Entry.Controllers.Ai
|
||||
{
|
||||
@ -27,7 +28,7 @@ this.service = service;
|
||||
this.aiChapterService= aiChapterService;
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiChapter", operate: "Find")]
|
||||
[PermissionOperate(name: "AiBook", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindByKey(string key)
|
||||
{
|
||||
@ -67,7 +68,27 @@ this.aiChapterService= aiChapterService;
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiChapter", operate: "Insert")]
|
||||
[PermissionOperate(name: "AiBook", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindBySearchCriteria(AiChapterSearchCriteria criteria)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var result = aiChapterService.FindBySearchCriteria(criteria);
|
||||
return result;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiBook", operate: "Insert")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Insert(AiChapterEntity data)
|
||||
@ -88,7 +109,7 @@ this.aiChapterService= aiChapterService;
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiChapter", operate: "Update")]
|
||||
[PermissionOperate(name: "AiBook", operate: "Update")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Update(AiChapterEntity data)
|
||||
@ -109,7 +130,7 @@ this.aiChapterService= aiChapterService;
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiChapter", operate: "Delete")]
|
||||
[PermissionOperate(name: "AiBook", operate: "Delete")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Delete(string key){
|
||||
|
||||
@ -10,6 +10,7 @@ using CloudBuilder.AI.Service;
|
||||
using CloudBuilder.AI.Entity;
|
||||
using System;
|
||||
using CloudBuilder.AI.Data;
|
||||
using CloudBuilder.AI.SearchCriteria;
|
||||
|
||||
namespace CloudBuilder.Web.Entry.Controllers.Ai
|
||||
{
|
||||
|
||||
@ -10,6 +10,7 @@ using CloudBuilder.AI.Service;
|
||||
using CloudBuilder.AI.Entity;
|
||||
using System;
|
||||
using CloudBuilder.AI.Data;
|
||||
using CloudBuilder.AI.SearchCriteria;
|
||||
|
||||
namespace CloudBuilder.Web.Entry.Controllers.Ai
|
||||
{
|
||||
|
||||
@ -28,7 +28,7 @@ this.service = service;
|
||||
this.aiSentenceService= aiSentenceService;
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Find")]
|
||||
[PermissionOperate(name: "AiBook", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindByKey(string key)
|
||||
{
|
||||
@ -48,7 +48,27 @@ this.aiSentenceService= aiSentenceService;
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Find")]
|
||||
[PermissionOperate(name: "AiBook", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindByChapterGuid(string chapterGuid)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var result = aiSentenceService.FindByChapterGuid(chapterGuid);
|
||||
return result;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiBook", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindBySearchCriteria(AiSentenceSearchCriteria criteria)
|
||||
{
|
||||
@ -68,7 +88,7 @@ this.aiSentenceService= aiSentenceService;
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Insert")]
|
||||
[PermissionOperate(name: "AiBook", operate: "Insert")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Insert(AiSentenceEntity data)
|
||||
@ -109,7 +129,7 @@ this.aiSentenceService= aiSentenceService;
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Update")]
|
||||
[PermissionOperate(name: "AiBook", operate: "Update")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Update(AiSentenceEntity data)
|
||||
@ -130,7 +150,7 @@ this.aiSentenceService= aiSentenceService;
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Delete")]
|
||||
[PermissionOperate(name: "AiBook", operate: "Delete")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Delete(string key){
|
||||
|
||||
@ -50,9 +50,9 @@
|
||||
"FileServiceSettings": {
|
||||
"PhysicalFileDirectory": "D:\\Net8\\FileServer",
|
||||
"RequestPath": "/FileServer", //如果是IIS反向代理来的,那么要在本地给这个文件添加IUSR,IIS_IUSRS权限
|
||||
"UploadDmsFileDirectory": "D:\\Net8\\FileServer\\Upload\\DmsFile",
|
||||
"BackupDmsFileDirectory": "D:\\Net8\\FileServer\\Backup\\DmsFile",
|
||||
"ScaleDmsFileDirectory": "D:\\Net8\\FileServer\\Scale\\DmsFile",
|
||||
"UploadDmsFileDirectory": "D:\\Net8\\FileServer\\Upload\\DmsFile",//上传文件目录,有可能是分片文件,仅当临时文件使用
|
||||
"BackupDmsFileDirectory": "D:\\Net8\\FileServer\\Backup\\DmsFile",//这个是备份目录,也是完整文件目录,原文件目录
|
||||
"ScaleDmsFileDirectory": "D:\\Net8\\FileServer\\Scale\\DmsFile",//这个是压缩图片或者视频目录
|
||||
"ExcelOutputDirectory": "D:\\Net8\\FileServer\\Output"
|
||||
},
|
||||
"Ffmpeg": {
|
||||
|
||||
@ -7,6 +7,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilderLauncher", "Clo
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Security.Gui", "CloudBuilder.Security.Gui\CloudBuilder.Security.Gui.csproj", "{063D44BC-42F9-0A59-CE39-064C43029990}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Request", "CloudBuilder.Request\CloudBuilder.Request.csproj", "{6CB84CF4-7E06-780D-C061-2A8284878458}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.AI.Gui", "CloudBuilder.AI.Gui\CloudBuilder.AI.Gui.csproj", "{DCB1153B-908A-F08B-0191-DE1DF5A7309D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Gui", "CloudBuilder.Gui\CloudBuilder.Gui.csproj", "{8EFE6D03-160F-4F1F-8E23-1CDDF98AD064}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.AI", "CloudBuilder.AI\CloudBuilder.AI.csproj", "{8C849E66-BEC0-F09D-791F-FB353DA7DBE7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.AI.Service", "CloudBuilder.AI.Service\CloudBuilder.AI.Service.csproj", "{5767BF2F-70B3-4FF6-CB85-9C0F8F0C8612}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Security", "CloudBuilder.Security\CloudBuilder.Security.csproj", "{269A5036-BAE9-FD61-1DD5-0EA93B79F0D7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +33,30 @@ Global
|
||||
{063D44BC-42F9-0A59-CE39-064C43029990}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{063D44BC-42F9-0A59-CE39-064C43029990}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{063D44BC-42F9-0A59-CE39-064C43029990}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6CB84CF4-7E06-780D-C061-2A8284878458}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6CB84CF4-7E06-780D-C061-2A8284878458}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6CB84CF4-7E06-780D-C061-2A8284878458}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6CB84CF4-7E06-780D-C061-2A8284878458}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DCB1153B-908A-F08B-0191-DE1DF5A7309D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DCB1153B-908A-F08B-0191-DE1DF5A7309D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DCB1153B-908A-F08B-0191-DE1DF5A7309D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DCB1153B-908A-F08B-0191-DE1DF5A7309D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8EFE6D03-160F-4F1F-8E23-1CDDF98AD064}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8EFE6D03-160F-4F1F-8E23-1CDDF98AD064}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8EFE6D03-160F-4F1F-8E23-1CDDF98AD064}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8EFE6D03-160F-4F1F-8E23-1CDDF98AD064}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8C849E66-BEC0-F09D-791F-FB353DA7DBE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8C849E66-BEC0-F09D-791F-FB353DA7DBE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8C849E66-BEC0-F09D-791F-FB353DA7DBE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8C849E66-BEC0-F09D-791F-FB353DA7DBE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5767BF2F-70B3-4FF6-CB85-9C0F8F0C8612}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5767BF2F-70B3-4FF6-CB85-9C0F8F0C8612}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5767BF2F-70B3-4FF6-CB85-9C0F8F0C8612}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5767BF2F-70B3-4FF6-CB85-9C0F8F0C8612}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{269A5036-BAE9-FD61-1DD5-0EA93B79F0D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{269A5036-BAE9-FD61-1DD5-0EA93B79F0D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{269A5036-BAE9-FD61-1DD5-0EA93B79F0D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{269A5036-BAE9-FD61-1DD5-0EA93B79F0D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -18,6 +18,12 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CloudBuilder.AI">
|
||||
<HintPath>..\CloudBuilder.AI\bin\Debug\net8.0\CloudBuilder.AI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.AI.Gui">
|
||||
<HintPath>..\CloudBuilder.AI.Gui\bin\Debug\net8.0-windows\CloudBuilder.AI.Gui.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.Core">
|
||||
<HintPath>..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
BIN
Data/ai.bak
Normal file
BIN
Data/ai.bak
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user