瀏覽代碼

行业页面基础信息

qinchaoyue 4 月之前
父節點
當前提交
4d51c2aa46
共有 29 個文件被更改,包括 508 次插入71 次删除
  1. 3 3
      src/Hotline.Api/Controllers/Snapshot/SnapshotController.cs
  2. 94 0
      src/Hotline.Application.Tests/Application/SnapshotApplicationMockTest.cs
  3. 72 5
      src/Hotline.Application.Tests/Application/SnapshotApplicationTest.cs
  4. 20 3
      src/Hotline.Application.Tests/Application/SystemSettingCacheManagerTest.cs
  5. 2 7
      src/Hotline.Application.Tests/Mock/ThirdTestService.cs
  6. 2 3
      src/Hotline.Application.Tests/Startup.cs
  7. 2 1
      src/Hotline.Application/Mappers/MapperConfigs.cs
  8. 5 0
      src/Hotline.Application/Mappers/SnapshotMapperConfigs.cs
  9. 2 1
      src/Hotline.Application/Snapshot/DefaultSnapshotApplication.cs
  10. 8 1
      src/Hotline.Application/Snapshot/ISnapshotApplication.cs
  11. 12 2
      src/Hotline.Application/Snapshot/IndustryApplication.cs
  12. 22 15
      src/Hotline.Application/Snapshot/SnapshotApplicationBase.cs
  13. 2 1
      src/Hotline.Application/Snapshot/ZiGongSnapshotApplication.cs
  14. 5 0
      src/Hotline.Repository.SqlSugar/File/FileRepository.cs
  15. 5 0
      src/Hotline.Share/Dtos/Settings/SystemAreaDto.cs
  16. 2 0
      src/Hotline.Share/Dtos/Settings/SystemDicDataDto.cs
  17. 16 2
      src/Hotline.Share/Dtos/Snapshot/HomePageDto.cs
  18. 5 0
      src/Hotline.Share/Dtos/Snapshot/IndustryDto.cs
  19. 23 9
      src/Hotline.Share/Dtos/Snapshot/IndustryFileDto.cs
  20. 11 0
      src/Hotline.Share/Tools/ListExtensions.cs
  21. 10 0
      src/Hotline/Caching/Interfaces/ISysDicDataCacheManager.cs
  22. 51 2
      src/Hotline/Caching/Services/SysDicDataCacheManager.cs
  23. 1 0
      src/Hotline/File/File.cs
  24. 1 0
      src/Hotline/File/IFileRepository.cs
  25. 112 0
      src/Hotline/SeedData/SystemDicDataSeedData.cs
  26. 1 1
      src/Hotline/Settings/ISystemAreaDomainService.cs
  27. 10 0
      src/Hotline/Settings/SysDicTypeConsts.cs
  28. 9 9
      src/Hotline/Settings/SystemAreaDomainService.cs
  29. 0 6
      src/Hotline/Snapshot/Industry.cs

+ 3 - 3
src/Hotline.Api/Controllers/Snapshot/SnapshotController.cs

@@ -45,10 +45,10 @@ public class SnapshotController : BaseController
     /// </summary>
     /// <param name="id">行业Id</param>
     /// <returns></returns>
-    [HttpGet("declare/base/{id}")]
+    [HttpGet("industry/base/{id}")]
     [AllowAnonymous]
-    public async Task<DeclareBaseOutDto> GetDeclareAsync(string id)
-        => await _snapshotApplication.GetDeclareAsync(id, HttpContext.RequestAborted);
+    public async Task<IndustryBaseOutDto> GetIndustryBaseAsync(string id)
+        => await _snapshotApplication.GetIndustryBaseAsync(id, HttpContext.RequestAborted);
 
     /// <summary>
     /// 获取小程序公告列表

+ 94 - 0
src/Hotline.Application.Tests/Application/SnapshotApplicationMockTest.cs

@@ -0,0 +1,94 @@
+using System.Threading;
+using System.Threading.Tasks;
+using Hotline.Application.Snapshot;
+using Hotline.Caching.Interfaces;
+using Hotline.File;
+using Hotline.Orders;
+using Hotline.Repository.SqlSugar.Extensions;
+using Hotline.Settings;
+using Hotline.Share.Dtos.Settings;
+using Hotline.Share.Dtos.Snapshot;
+using Hotline.Share.Enums.Snapshot;
+using Hotline.Snapshot;
+using Hotline.Users;
+using Mapster;
+using Moq;
+using XF.Domain.Authentications;
+using XF.Domain.Repository;
+using Xunit;
+
+namespace Hotline.Application.Tests.Snapshot
+{
+    public class SnapshotApplicationTest
+    {
+        private readonly Mock<IThirdIdentiyService> _thirdLoginServiceMock;
+        private readonly Mock<IRepository<Industry>> _industryRepositoryMock;
+        private readonly Mock<IRepository<Article.Bulletin>> _bulletinRepositoryMock;
+        private readonly Mock<ISessionContext> _sessionContextMock;
+        private readonly Mock<IRepository<RedPackRecord>> _redPackRecordRepositoryMock;
+        private readonly Mock<IRepository<Order>> _orderRepositoryMock;
+        private readonly Mock<IThirdAccountRepository> _thirdAccountRepositoryMock;
+        private readonly Mock<IRepository<OrderSnapshot>> _orderSnapshotRepositoryMock;
+        private readonly Mock<ISystemSettingCacheManager> _systemSettingCacheManagerMock;
+        private readonly Mock<ISystemAreaDomainService> _systemAreaDomainServiceMock;
+        private readonly Mock<IFileRepository> _fileRepositoryMock;
+        private readonly Mock<ISystemDicDataCacheManager> _systemDicDataCacheManagerMock;
+
+        private readonly DefaultSnapshotApplication _snapshotApplication;
+
+        public SnapshotApplicationTest()
+        {
+            _thirdLoginServiceMock = new Mock<IThirdIdentiyService>();
+            _industryRepositoryMock = new Mock<IRepository<Industry>>();
+            _bulletinRepositoryMock = new Mock<IRepository<Article.Bulletin>>();
+            _sessionContextMock = new Mock<ISessionContext>();
+            _redPackRecordRepositoryMock = new Mock<IRepository<RedPackRecord>>();
+            _orderRepositoryMock = new Mock<IRepository<Order>>();
+            _thirdAccountRepositoryMock = new Mock<IThirdAccountRepository>();
+            _orderSnapshotRepositoryMock = new Mock<IRepository<OrderSnapshot>>();
+            _systemSettingCacheManagerMock = new Mock<ISystemSettingCacheManager>();
+            _systemAreaDomainServiceMock = new Mock<ISystemAreaDomainService>();
+            _fileRepositoryMock = new Mock<IFileRepository>();
+            _systemDicDataCacheManagerMock = new Mock<ISystemDicDataCacheManager>();
+
+            _snapshotApplication = new DefaultSnapshotApplication(
+                _thirdLoginServiceMock.Object,
+                _industryRepositoryMock.Object,
+                _bulletinRepositoryMock.Object,
+                _sessionContextMock.Object,
+                _redPackRecordRepositoryMock.Object,
+                _orderRepositoryMock.Object,
+                _thirdAccountRepositoryMock.Object,
+                _orderSnapshotRepositoryMock.Object,
+                _systemSettingCacheManagerMock.Object,
+                _systemAreaDomainServiceMock.Object,
+                _fileRepositoryMock.Object,
+                _systemDicDataCacheManagerMock.Object
+            );
+        }
+
+        [Fact]
+        public async Task GetDeclareAsync_WithValidId_ReturnsDeclareBaseOutDto()
+        {
+            // Arrange
+            var id = "123";
+            var cancellationToken = CancellationToken.None;
+            var industry = new Industry { Id = id, IndustryType = EIndustryType.Declare };
+            var areaTree = new List<SystemArea>();
+            var files = new List<Hotline.File.File>();
+            _industryRepositoryMock.Setup(r => r.GetAsync(id, cancellationToken)).ReturnsAsync(industry);
+            _systemAreaDomainServiceMock.Setup(s => s.GetAreaTree(0, "510300")).ReturnsAsync(areaTree);
+            _fileRepositoryMock.Setup(f => f.GetByKeyAsync(id, cancellationToken)).ReturnsAsync(files);
+
+            // Act
+            var result = await _snapshotApplication.GetIndustryBaseAsync(id, cancellationToken);
+
+            // Assert
+            Assert.NotNull(result);
+            Assert.Equal(industry.Id, result.Industry.Id);
+            //Assert.Equal(industry.IndustryType, result.IndustryType);
+            Assert.Equal(areaTree.Adapt<List<SystemAreaOutDto>>(), result.AreaTree);
+            Assert.Equal(files.Adapt<List<IndustryFileDto>>(), result.Files);
+        }
+    }
+}

+ 72 - 5
src/Hotline.Application.Tests/Application/SnapshotApplicationTest.cs

@@ -1,6 +1,8 @@
-using Hotline.Api.Controllers;
+using DocumentFormat.OpenXml.Wordprocessing;
+using Hotline.Api.Controllers;
 using Hotline.Application.Identity;
 using Hotline.Application.Snapshot;
+using Hotline.File;
 using Hotline.Identity.Accounts;
 using Hotline.Identity.Roles;
 using Hotline.Share.Dtos.Article;
@@ -22,12 +24,18 @@ public class SnapshotApplicationTest : TestBase
     private readonly ISnapshotApplication _snapshotApplication;
     private readonly IIdentityAppService _identityAppService;
     private readonly IRepository<RedPackRecord> _redPackRecordRepository;
+    private readonly IIndustryApplication _industryApplication;
+    private readonly IIndustryRepository _industryRepository;
+    private readonly IFileRepository _fileRepository;
 
-    public SnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, ISnapshotApplication snapshotApplication, IIdentityAppService identityAppService, IRepository<RedPackRecord> redPackRecordRepository) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor)
+    public SnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, ISnapshotApplication snapshotApplication, IIdentityAppService identityAppService, IRepository<RedPackRecord> redPackRecordRepository, IIndustryApplication industryApplication, IIndustryRepository industryRepository, IFileRepository fileRepository) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor)
     {
         _snapshotApplication = snapshotApplication;
         _identityAppService = identityAppService;
         _redPackRecordRepository = redPackRecordRepository;
+        _industryApplication = industryApplication;
+        _industryRepository = industryRepository;
+        _fileRepository = fileRepository;
     }
 
     [Fact]
@@ -119,7 +127,7 @@ public class SnapshotApplicationTest : TestBase
     [InlineData(12, 12)]
     public async Task GetRedPackDateAsync(int count, int exp)
     {
-        var items = await _snapshotApplication.GetRedPackDateAsync(new RedPackDateInDto { Count = count});
+        var items = await _snapshotApplication.GetRedPackDateAsync(new RedPackDateInDto { Count = count });
         items.Count.ShouldNotBe(0, "0数据");
         items.Count.ShouldBe(exp, $"应该:{exp}, 实际 {items.Count}");
     }
@@ -129,7 +137,7 @@ public class SnapshotApplicationTest : TestBase
     [InlineData(ERedPackPickupStatus.Received)]
     public async Task GetRedPacksAsync(ERedPackPickupStatus status)
     {
-        var page = await _snapshotApplication.GetRedPacksAsync(new RedPacksInDto { Status = status});
+        var page = await _snapshotApplication.GetRedPacksAsync(new RedPacksInDto { Status = status });
         page.Total.ShouldNotBe(0, "数据不应该为空");
     }
 
@@ -145,7 +153,7 @@ public class SnapshotApplicationTest : TestBase
     [Fact]
     public async Task InitRedPackDataAsync()
     {
-        for (int i = 0; i < 12; i++)
+        for (int i = 0;i < 12;i++)
         {
             var now = DateTime.Now;
             var entity = new RedPackRecord
@@ -159,4 +167,63 @@ public class SnapshotApplicationTest : TestBase
             await _redPackRecordRepository.AddAsync(entity);
         }
     }
+
+    /// <summary>
+    /// 测试行业
+    /// 测试添加数据是否和获取的数据一致
+    /// </summary>
+    /// <returns></returns>
+    [Fact]
+    public async Task Industry_Test()
+    {
+        var industry = new AddIndustryDto
+        {
+            Name = "测试行业",
+            TitleSuffix = "测试标题",
+            ApproveOrgId = "测试审批部门Id",
+            ApproveOrgName = "测试审批部门名字",
+            AcceptType = "测试受理类型",
+            AcceptTypeCode = "测试受理类型代码",
+            CitizenReadPackAmount = 100,
+            GuiderReadPackAmount = 200,
+            IsEnable = true,
+            Files = new List<IndustryFileDto>
+            {
+                new IndustryFileDto
+                {
+                    Name = "测试文件" + DateTime.Now.ToShortDateString(),
+                    Path = "测试文件地址" + DateTime.Now.ToShortTimeString(),
+                    FileName ="测试文件" + DateTime.Now.ToShortDateString()  + ".doc",
+                    AdditionId = DateTime.Now.ToLongDateString()
+                }
+            }
+        };
+        var industryId = await _industryApplication.AddIndustryAsync(industry, CancellationToken.None);
+        var pageDto = await _snapshotApplication.GetIndustryBaseAsync(industryId, CancellationToken.None);
+        try
+        {
+            pageDto.ShouldNotBeNull();
+            pageDto.Files.ShouldNotBeNull();
+            foreach (var file in pageDto.Files)
+            {
+                file.Id.ShouldNotBeNullOrEmpty();
+                file.Name.ShouldNotBeNullOrEmpty();
+                file.Path.ShouldNotBeNullOrEmpty();
+                file.FileName.ShouldNotBeNullOrEmpty();
+                file.AdditionId.ShouldNotBeNullOrEmpty();
+                file.Key.ShouldBe(industryId);
+            }
+            pageDto.Workplace.ShouldNotBeNull();
+            pageDto.WorkArea.ShouldNotBeNull();
+        }
+        catch (Exception e)
+        {
+            // ignore
+        }
+        finally
+        {
+            await _industryRepository.Removeable().Where(m => m.Id == industryId).ExecuteCommandAsync();
+            await _fileRepository.Removeable().Where(m => m.Id == pageDto.Files.First().Id).ExecuteCommandAsync();
+        }
+    }
 }

+ 20 - 3
src/Hotline.Application.Tests/Application/SystemSettingCacheManagerTest.cs

@@ -1,6 +1,12 @@
-using Hotline.Caching.Interfaces;
+using Hotline.Api.Controllers;
+using Hotline.Caching.Interfaces;
 using Hotline.Caching.Services;
+using Hotline.Identity.Accounts;
+using Hotline.Identity.Roles;
 using Hotline.Settings;
+using Hotline.Users;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.DependencyInjection;
 using Shouldly;
 using System;
 using System.Collections.Generic;
@@ -10,14 +16,16 @@ using System.Threading.Tasks;
 using XF.Domain.Repository;
 
 namespace Hotline.Application.Tests.Application;
-public class SystemSettingCacheManagerTest
+public class SystemSettingCacheManagerTest : TestBase
 {
     private readonly ISystemSettingCacheManager _systemSettingCacheManager;
+    private readonly ISystemDicDataCacheManager _systemDicDataCacheManager;
     private readonly IRepository<SystemSetting> _systemSettingRepository;
 
-    public SystemSettingCacheManagerTest(ISystemSettingCacheManager systemSettingCacheManager, IRepository<SystemSetting> systemSettingRepository)
+    public SystemSettingCacheManagerTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, ISystemSettingCacheManager systemSettingCacheManager, ISystemDicDataCacheManager systemDicDataCacheManager, IRepository<SystemSetting> systemSettingRepository) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor)
     {
         _systemSettingCacheManager = systemSettingCacheManager;
+        _systemDicDataCacheManager = systemDicDataCacheManager;
         _systemSettingRepository = systemSettingRepository;
     }
 
@@ -43,5 +51,14 @@ public class SystemSettingCacheManagerTest
         _systemSettingCacheManager.VisitCallDelaySecond.ShouldNotBe(0);
         _systemSettingCacheManager.AutomaticPublishOrder.ShouldBe(true);
         _systemSettingCacheManager.CancelPublishOrderEnabled.ShouldBe(true);
+
+        var workplace = _systemDicDataCacheManager.Workplace;
+        workplace.ShouldNotBeNull();
+        workplace.Count.ShouldNotBe(0);
+
+        _systemDicDataCacheManager.RemoveSysDicDataCache(SysDicTypeConsts.WorkArea);
+        var workArea = _systemDicDataCacheManager.WorkArea;
+        workArea.ShouldNotBeNull();
+        workArea.Count.ShouldNotBe(0);
     }
 }

+ 2 - 7
src/Hotline/Snapshot/Test/ThirdTestService.cs → src/Hotline.Application.Tests/Mock/ThirdTestService.cs

@@ -1,12 +1,7 @@
 using Hotline.Share.Dtos.Snapshot;
 using Hotline.Users;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
-namespace Hotline.Snapshot.Test;
+namespace Hotline.Application.Tests.Mock;
 public class ThirdTestService : IThirdIdentiyService
 {
     public async Task<ThirdPhoneOutDto> GetPhoneNumberAsync(ThirdTokenDto dto)
@@ -19,7 +14,7 @@ public class ThirdTestService : IThirdIdentiyService
 
     public async Task<ThirdTokenOutDto> GetTokenAsync(ThirdTokenDto dto)
     {
-        return new ThirdTokenOutDto 
+        return new ThirdTokenOutDto
         {
             SessionKey = "sessionKeyfjdklsafjdskla",
             OpenId = "测试生成的OpenId"

+ 2 - 3
src/Hotline.Application.Tests/Startup.cs

@@ -29,8 +29,6 @@ using Polly;
 using Senparc.Weixin.AspNet;
 using Hotline.Share.Tools;
 using Hotline.Users;
-using Hotline.Snapshot.Test;
-using Hotline.Identity;
 using XF.Domain.Cache;
 using XF.EasyCaching;
 using Mapster;
@@ -153,7 +151,8 @@ public class Startup
                 .ToList()
                 .ForEach(d => ServiceRegister.Register(services, d));
 
-            services.AddScoped<IThirdIdentiyService, WeChatService>();
+            //services.AddScoped<IThirdIdentiyService, WeChatService>();
+            services.AddScoped<IThirdIdentiyService, ThirdTestService>();
             // services.AddScoped<IThirdIdentiyService, WeChatService>();
 
             //services.AddScoped<IThirdAccountRepository, ThirdAccountRepository>();

+ 2 - 1
src/Hotline.Application/Mappers/MapperConfigs.cs

@@ -41,7 +41,8 @@ namespace Hotline.Application.Mappers
             config.ForType<SystemDicData, SystemDicDataOutDto>()
                 .Map(m => m.Id, n => n.Id)
                 .Map(m => m.DicDataName, n => n.DicDataName)
-                .Map(m => m.DicDataValue, n => n.DicDataValue);
+                .Map(m => m.DicDataValue, n => n.DicDataValue)
+                .Map(m => m.Children, n => n.Children);
 
             config.ForType<Tr.Sdk.Tels.QueryTelResponse, TelOutDto>()
                 .Map(m => m.TelPwd, x => x.Password)

+ 5 - 0
src/Hotline.Application/Mappers/SnapshotMapperConfigs.cs

@@ -13,5 +13,10 @@ public class SnapshotMapperConfigs : IRegister
     public void Register(TypeAdapterConfig config)
     {
         config.ForType<AddIndustryDto, Industry>();
+        config.ForType<Hotline.File.File, IndustryFileDto>()
+            .Map(m => m.AdditionId, n => n.Additions);
+
+        config.ForType<IndustryFileDto, Hotline.File.File>()
+            .Map(m => m.Additions, n => n.AdditionId);
     }
 }

+ 2 - 1
src/Hotline.Application/Snapshot/DefaultSnapshotApplication.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.DI;
+using Hotline.File;
 using Hotline.Orders;
 using Hotline.Settings;
 using Hotline.Snapshot;
@@ -19,7 +20,7 @@ namespace Hotline.Application.Snapshot;
 public class DefaultSnapshotApplication : SnapshotApplicationBase
     , ISnapshotApplication, IScopeDependency
 {
-    public DefaultSnapshotApplication(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService) : base(thirdLoginService, industryRepository, bulletinRepository, sessionContext, redPackRecordRepository, orderRepository, thirdAccountRepository, orderSnapshotRepository, systemSettingCacheManager, systemAreaDomainService)
+    public DefaultSnapshotApplication(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService, IFileRepository fileRepository, ISystemDicDataCacheManager systemDicDataCacheManager) : base(thirdLoginService, industryRepository, bulletinRepository, sessionContext, redPackRecordRepository, orderRepository, thirdAccountRepository, orderSnapshotRepository, systemSettingCacheManager, systemAreaDomainService, fileRepository, systemDicDataCacheManager)
     {
     }
 }

+ 8 - 1
src/Hotline.Application/Snapshot/ISnapshotApplication.cs

@@ -56,5 +56,12 @@ public interface ISnapshotApplication
     /// <param name="id"></param>
     /// <returns></returns>
     Task<BulletinOutDto> GetBulletinsDetailAsync(string id);
-    Task<DeclareBaseOutDto> GetDeclareAsync(string id, CancellationToken requestAborted);
+
+    /// <summary>
+    /// 获取行业界面基础数据
+    /// </summary>
+    /// <param name="id"></param>
+    /// <param name="requestAborted"></param>
+    /// <returns></returns>
+    Task<IndustryBaseOutDto> GetIndustryBaseAsync(string id, CancellationToken requestAborted);
 }

+ 12 - 2
src/Hotline.Application/Snapshot/IndustryApplication.cs

@@ -1,4 +1,6 @@
-using Hotline.Share.Dtos.Snapshot;
+using Hotline.File;
+using Hotline.Share.Dtos.Snapshot;
+using Hotline.Share.Tools;
 using Hotline.Snapshot;
 using Mapster;
 using System;
@@ -12,10 +14,12 @@ namespace Hotline.Application.Snapshot;
 public class IndustryApplication : IIndustryApplication, IScopeDependency
 {
     private readonly IIndustryRepository _industryRepository;
+    private readonly IFileRepository _fileRepository;
 
-    public IndustryApplication(IIndustryRepository industryRepository)
+    public IndustryApplication(IIndustryRepository industryRepository, IFileRepository fileRepository)
     {
         _industryRepository = industryRepository;
+        _fileRepository = fileRepository;
     }
 
     /// <summary>
@@ -28,6 +32,12 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
     {
         var entity = dto.Adapt<Industry>();
         var id = await _industryRepository.AddAsync(entity, cancellationToken);
+        if (dto.Files.NotNullOrEmpty())
+        {
+            var fileEntities = dto.Files.Adapt<List<Hotline.File.File>>();
+            fileEntities.ForEach(m => m.Key = id);
+            await _fileRepository.AddRangeAsync(fileEntities, cancellationToken);
+        }
         return id;
     }
 }

+ 22 - 15
src/Hotline.Application/Snapshot/SnapshotApplicationBase.cs

@@ -20,6 +20,7 @@ using NPOI.Util.ArrayExtensions;
 using XF.Domain.Exceptions;
 using Hotline.Settings;
 using Hotline.Share.Dtos.Settings;
+using Hotline.File;
 
 namespace Hotline.Application.Snapshot;
 
@@ -42,8 +43,10 @@ public abstract class SnapshotApplicationBase
     private readonly IRepository<OrderSnapshot> _orderSnapshotRepository;
     private readonly ISystemSettingCacheManager _systemSettingCacheManager;
     private readonly ISystemAreaDomainService _systemAreaDomainService;
+    private readonly IFileRepository _fileRepository;
+    private readonly ISystemDicDataCacheManager _systemDicDataCacheManager;
 
-    public SnapshotApplicationBase(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService)
+    public SnapshotApplicationBase(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService, IFileRepository fileRepository, ISystemDicDataCacheManager systemDicDataCacheManager)
     {
         _thirdLoginService = thirdLoginService;
         _industryRepository = industryRepository;
@@ -55,6 +58,8 @@ public abstract class SnapshotApplicationBase
         _orderSnapshotRepository = orderSnapshotRepository;
         _systemSettingCacheManager = systemSettingCacheManager;
         _systemAreaDomainService = systemAreaDomainService;
+        _fileRepository = fileRepository;
+        _systemDicDataCacheManager = systemDicDataCacheManager;
     }
 
     /// <summary>
@@ -82,7 +87,7 @@ public abstract class SnapshotApplicationBase
         });
 
         return new HomePageOutDto
-        { 
+        {
             Banners = _systemSettingCacheManager.AppBanner.Split('|').Select(m => fileDownloadApi + m).ToList(),
             Industrys = items
         };
@@ -94,22 +99,24 @@ public abstract class SnapshotApplicationBase
     /// <param name="id"></param>
     /// <param name="requestAborted"></param>
     /// <returns></returns>
-    public async Task<DeclareBaseOutDto> GetDeclareAsync(string id, CancellationToken requestAborted)
+    public async Task<IndustryBaseOutDto> GetIndustryBaseAsync(string id, CancellationToken requestAborted)
     {
         var fileServiceUrl = _systemSettingCacheManager.FileServerUrl;
         var fileDownloadApi = fileServiceUrl + _systemSettingCacheManager.FileDownloadApi;
         var indurstry = await _industryRepository.GetAsync(id, requestAborted)
             ?? throw UserFriendlyException.SameMessage("行业不存在:" + id);
 
-        var outDto = indurstry.Adapt<DeclareBaseOutDto>();
+        var outDto = new IndustryBaseOutDto
+        {
+            Industry = indurstry.Adapt<IndustryOutDto>()
+        };
         if (indurstry.IndustryType == EIndustryType.Declare)
         {
-            outDto.AreaTree = (await _systemAreaDomainService.GetAreaTree()).Adapt<List<SystemAreaOutDto>>();
-            outDto.Files = outDto.Files.Select(m => new IndustryFileDto
-            {
-                Name = m.Name,
-                Path = fileDownloadApi + m.Key
-            }).ToList();
+            outDto.AreaTree = (await _systemAreaDomainService.GetAreaTree(parentId: "510300")).Adapt<List<SystemAreaOutDto>>();
+            outDto.Files = (await _fileRepository.GetByKeyAsync(indurstry.Id, requestAborted)).Adapt<List<IndustryFileDto>>();
+            outDto.Files.ToList().ForEach(m => m.Url = fileDownloadApi + m.AdditionId);
+            outDto.WorkArea = _systemDicDataCacheManager.WorkArea.Adapt<List<SystemDicDataOutDto>>();
+            outDto.Workplace = _systemDicDataCacheManager.Workplace.Adapt<List<SystemDicDataOutDto>>();
         }
         return outDto;
     }
@@ -152,7 +159,7 @@ public abstract class SnapshotApplicationBase
                 ReplyCount = SqlFunc.AggregateSum(SqlFunc.IIF(m.Status >= Share.Enums.Order.EOrderStatus.Filed, 1, 0)),
                 AppraiseCount = SqlFunc.AggregateSum(SqlFunc.IIF(m.Status == Share.Enums.Order.EOrderStatus.Visited, 1, 0)),
             }).FirstAsync();
-            
+
         outDto.DayAmount = readPack;
         outDto.TotalAmount = thirdAccount.TotalAmount;
         outDto.PhoneNumber = thirdAccount.PhoneNumber;
@@ -173,7 +180,7 @@ public abstract class SnapshotApplicationBase
             .WhereIF(dto.Status == EOrderQueryStatus.NoReply, (snapshot, order) => order.Status < EOrderStatus.Filed)
             .WhereIF(dto.Status == EOrderQueryStatus.Reply, (snapshot, order) => order.Status >= EOrderStatus.Filed)
             .WhereIF(dto.KeyWords.NotNullOrEmpty(), (snapshot, order) => order.Title.Contains(dto.KeyWords))
-            .Select((snapshot, order) => new OrderOutDto 
+            .Select((snapshot, order) => new OrderOutDto
             {
                 Id = snapshot.Id,
                 OrderNo = order.No,
@@ -221,7 +228,7 @@ public abstract class SnapshotApplicationBase
             .Where(m => m.PickupStatus == dto.Status)
             .Where(m => m.CreationTime.ToString("yyyy-MM") == dto.Time)
             .LeftJoin<Order>((red, order) => red.OrderId == order.Id)
-            .Select((red, order) => new RedPackOutDto 
+            .Select((red, order) => new RedPackOutDto
             {
                 Amount = red.Amount,
                 Title = order.Title,
@@ -238,7 +245,7 @@ public abstract class SnapshotApplicationBase
     /// <param name="count"></param>
     /// <returns></returns>
     public async Task<IReadOnlyList<RedPackDateOutDto>> GetRedPackDateAsync(RedPackDateInDto dto)
-    { 
+    {
         var openId = _sessionContext.OpenId;
         var item = await _redPackRecordRepository.Queryable()
             .Where(m => m.WXOpenId == openId)
@@ -262,7 +269,7 @@ public abstract class SnapshotApplicationBase
             .Where(m => m.Id == id)
             .Where(m => m.BulletinState == Share.Enums.Article.EBulletinState.ReviewPass)
             .Select(m => new BulletinOutDto
-            { 
+            {
                 Id = m.Id,
                 Title = m.Title,
                 Content = m.Content

+ 2 - 1
src/Hotline.Application/Snapshot/ZiGongSnapshotApplication.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.DI;
+using Hotline.File;
 using Hotline.Orders;
 using Hotline.Settings;
 using Hotline.Snapshot;
@@ -18,7 +19,7 @@ namespace Hotline.Application.Snapshot;
 [Injection(AppScopes = EAppScope.ZiGong)]
 public class ZiGongSnapshotApplication : SnapshotApplicationBase, ISnapshotApplication, IScopeDependency
 {
-    public ZiGongSnapshotApplication(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService) : base(thirdLoginService, industryRepository, bulletinRepository, sessionContext, redPackRecordRepository, orderRepository, thirdAccountRepository, orderSnapshotRepository, systemSettingCacheManager, systemAreaDomainService)
+    public ZiGongSnapshotApplication(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService, IFileRepository fileRepository, ISystemDicDataCacheManager systemDicDataCacheManager) : base(thirdLoginService, industryRepository, bulletinRepository, sessionContext, redPackRecordRepository, orderRepository, thirdAccountRepository, orderSnapshotRepository, systemSettingCacheManager, systemAreaDomainService, fileRepository, systemDicDataCacheManager)
     {
     }
 }

+ 5 - 0
src/Hotline.Repository.SqlSugar/File/FileRepository.cs

@@ -59,6 +59,11 @@ namespace Hotline.Repository.SqlSugar.File
 			return files.Any() ? _mapper.Map<List<FileDto>>(files) : new List<FileDto>();
 		}
 
+		public async Task<List<Hotline.File.File>> GetByKeyAsync(string key, CancellationToken cancellationToken)
+		{ 
+			return await Queryable().Where(x => x.Key == key && x.IsDeleted == false).ToListAsync(cancellationToken);
+        }
+
 		public async Task<List<WorkflowTraceDto>> WorkflowTraceRecursion(List<WorkflowTraceDto> dto, CancellationToken cancellationToken)
 		{
 			foreach (var item in dto)

+ 5 - 0
src/Hotline.Share/Dtos/Settings/SystemAreaDto.cs

@@ -11,6 +11,11 @@ internal class SystemAreaDto
 
 public class SystemAreaOutDto
 {
+    /// <summary>
+    /// Id
+    /// </summary>
+    public string Id { get; set; }
+
     /// <summary>
     /// 区域名称
     /// </summary>

+ 2 - 0
src/Hotline.Share/Dtos/Settings/SystemDicDataDto.cs

@@ -16,5 +16,7 @@
         /// 字典值
         /// </summary>
         public string DicDataValue { get; set; }
+
+        public IList<SystemDicDataOutDto> Children { get; set; }
     }
 }

+ 16 - 2
src/Hotline.Share/Dtos/Snapshot/HomePageDto.cs

@@ -93,8 +93,8 @@ public class HomeIndustryOutDto
     public string IndustryTypeTxt => IndustryType.GetDescription();
 }
 
-public class DeclareBaseOutDto
-{
+public class IndustryOutDto
+{ 
     /// <summary>
     /// Id
     /// </summary>
@@ -109,6 +109,14 @@ public class DeclareBaseOutDto
     /// 帮助引导用语
     /// </summary>
     public string? TxtHelpRemarks { get; set; }
+}
+
+public class IndustryBaseOutDto
+{
+    /// <summary>
+    /// 行业信息
+    /// </summary>
+    public IndustryOutDto Industry { get; set; }
 
     /// <summary>
     /// 区域集合
@@ -119,4 +127,10 @@ public class DeclareBaseOutDto
     /// 附件集合
     /// </summary>
     public IList<IndustryFileDto> Files { get; set; } = [];
+
+    /// <summary>
+    /// 作业场所
+    /// </summary>
+    public IList<SystemDicDataOutDto> Workplace { get; set; }
+    public IList<SystemDicDataOutDto> WorkArea { get; set; }
 }

+ 5 - 0
src/Hotline.Share/Dtos/Snapshot/IndustryDto.cs

@@ -138,4 +138,9 @@ public class AddIndustryDto
     /// 关怀宫格图
     /// </summary>
     public string CareCellImgUrl { get; set; }
+
+    /// <summary>
+    /// 附件集合
+    /// </summary>
+    public IList<IndustryFileDto> Files { get; set; }
 }

+ 23 - 9
src/Hotline.Share/Dtos/Snapshot/IndustryFileDto.cs

@@ -1,25 +1,39 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Hotline.Share.Dtos.Snapshot;
+namespace Hotline.Share.Dtos.Snapshot;
 public class IndustryFileDto
 {
     /// <summary>
-    /// 附件名称
+    /// Id
+    /// </summary>
+    public string Id { get; set; }
+
+    /// <summary>
+    /// 文件名称(没有后缀)
     /// </summary>
     public string Name { get; set; }
 
+    /// <summary>
+    /// 文件名称(有后缀)
+    /// </summary>
+    public string FileName { get; set; }
+
     /// <summary>
     /// 附件路径
     /// </summary>
     public string Path { get; set; }
 
     /// <summary>
-    /// 附件Key
+    /// 业务数据Id
     /// </summary>
     public string Key { get; set; }
+
+    /// <summary>
+    /// 附件系统中附件的Id
+    /// </summary>
+    public string AdditionId { get; set; }
+
+    /// <summary>
+    /// Url
+    /// </summary>
+    public string Url { get; set; }
 }
 

+ 11 - 0
src/Hotline.Share/Tools/ListExtensions.cs

@@ -16,4 +16,15 @@ public static class ListExtensions
     {
         return value != null && value.Count != 0;
     }
+
+    public static bool NotNullOrEmpty<T>(this IList<T> value)
+    {
+        return value != null && value.Count != 0;
+    }
+
+    public static bool NotNullOrEmpty<T>(this IReadOnlyList<T> value)
+    {
+        return value != null && value.Count != 0;
+    }
+
 }

+ 10 - 0
src/Hotline/Caching/Interfaces/ISysDicDataCacheManager.cs

@@ -14,5 +14,15 @@ namespace Hotline.Caching.Interfaces
         void RemoveSysDicDataCache(string code);
         IReadOnlyList<SystemDicData> AcceptType { get; }
         IReadOnlyList<SystemDicData> LeaderSMS { get; }
+
+        /// <summary>
+        /// 工作场所
+        /// </summary>
+        public IReadOnlyList<SystemDicData> Workplace { get; }
+
+        /// <summary>
+        /// 作业区域
+        /// </summary>
+        public IReadOnlyList<SystemDicData> WorkArea { get; }
     }
 }

+ 51 - 2
src/Hotline/Caching/Services/SysDicDataCacheManager.cs

@@ -1,5 +1,7 @@
 using Hotline.Caching.Interfaces;
+using Hotline.SeedData;
 using Hotline.Settings;
+using Hotline.Share.Tools;
 using XF.Domain.Cache;
 using XF.Domain.Dependency;
 using XF.Domain.Repository;
@@ -9,12 +11,14 @@ namespace Hotline.Caching.Services
     public class SysDicDataCacheManager : ISystemDicDataCacheManager, IScopeDependency
     {
         private readonly IRepository<SystemDicData> _sysDicDataRepository;
+        private readonly IRepository<SystemDicType> _systemDicTypeRepository;
         private readonly ITypedCache<IReadOnlyList<SystemDicData>> _cacheSysDicData;
 
-        public SysDicDataCacheManager(IRepository<SystemDicData> sysDicDataRepository, ITypedCache<IReadOnlyList<SystemDicData>> cacheSysDicData)
+        public SysDicDataCacheManager(IRepository<SystemDicData> sysDicDataRepository, ITypedCache<IReadOnlyList<SystemDicData>> cacheSysDicData, IRepository<SystemDicType> systemDicTypeRepository)
         {
             _sysDicDataRepository = sysDicDataRepository;
             _cacheSysDicData = cacheSysDicData;
+            _systemDicTypeRepository = systemDicTypeRepository;
         }
 
 
@@ -22,11 +26,46 @@ namespace Hotline.Caching.Services
         {
             var sysDicDataList = _cacheSysDicData.GetOrSet(code, k =>
             {
-                return _sysDicDataRepository.Queryable().Where(x => x.DicTypeCode == code && x.IsShow == true).OrderBy(x=>x.Sort).ToTreeAsync(x => x.Children, it => it.ParentId, "").GetAwaiter().GetResult();
+                return _sysDicDataRepository.Queryable().Where(x => x.DicTypeCode == code && x.IsShow == true).OrderBy(x => x.Sort).ToTreeAsync(x => x.Children, it => it.ParentId, "").GetAwaiter().GetResult();
             });
             return sysDicDataList;
         }
 
+        public IReadOnlyList<SystemDicData> GetOrAdd(string code)
+        {
+            var items = GetSysDicDataCache(code);
+            if (items.NotNullOrEmpty()) return items;
+
+            var any = _sysDicDataRepository.Queryable().Where(m => m.DicTypeCode == code).Any();
+            if (any) return new List<SystemDicData>();
+
+            var sysDicType = _systemDicTypeRepository.Get(x => x.DicTypeCode == code);
+            var seedData = new SystemDicDataSeedData();
+            if (sysDicType == null)
+            {
+                sysDicType = seedData.GetType(code);
+                sysDicType.Id = _systemDicTypeRepository.AddAsync(sysDicType).GetAwaiter().GetResult();
+            }
+            var sysDicDatas = seedData.GetData(code);
+            AssignChilderDicType(sysDicDatas.ToList(), code, sysDicType.Id);
+
+            RemoveSysDicDataCache(code);
+            return GetSysDicDataCache(code);
+        }
+
+        private void AssignChilderDicType(IList<SystemDicData> sysDicDatas, string code, string dicTypeId, string parentId = "")
+        {
+            foreach (var item in sysDicDatas)
+            {
+                item.DicTypeCode = code;
+                item.DicTypeId = dicTypeId;
+                item.ParentId = parentId;
+                item.IsShow = true;
+                _sysDicDataRepository.AddAsync(item).GetAwaiter().GetResult();
+                if (item.Children.NotNullOrEmpty()) AssignChilderDicType(item.Children, code, dicTypeId, item.Id);
+            }
+        }
+
         public IReadOnlyList<SystemDicData> GetVisitSatisfaction()
             => GetSysDicDataCache(SysDicTypeConsts.VisitSatisfaction);
 
@@ -34,6 +73,16 @@ namespace Hotline.Caching.Services
 
         public IReadOnlyList<SystemDicData> LeaderSMS => GetSysDicDataCache(SysDicTypeConsts.LeaderSMS);
 
+        /// <summary>
+        /// 工作场所
+        /// </summary>
+        public IReadOnlyList<SystemDicData> Workplace => GetOrAdd(SysDicTypeConsts.Workplace);
+
+        /// <summary>
+        /// 作业区域
+        /// </summary>
+        public IReadOnlyList<SystemDicData> WorkArea => GetOrAdd(SysDicTypeConsts.WorkArea);
+
         public void RemoveSysDicDataCache(string code)
         {
             _cacheSysDicData.Remove(code);

+ 1 - 0
src/Hotline/File/File.cs

@@ -21,6 +21,7 @@ namespace Hotline.File
 
 		/// <summary>
 		/// 附件KEY
+		/// 业务数据关联Id
 		/// </summary>
 		[SugarColumn(ColumnDescription = "附件Key")]
 		public string Key { get; set; }

+ 1 - 0
src/Hotline/File/IFileRepository.cs

@@ -15,5 +15,6 @@ namespace Hotline.File
 		Task<List<FileJson>> AddFileAsync(List<FileDto> files ,string id, string flowId = "",CancellationToken cancellationToken = default);
 		Task<List<FileDto>> GetFilesAsync(List<string> ids, CancellationToken cancellationToken);
 		Task<List<WorkflowTraceDto>> WorkflowTraceRecursion(List<WorkflowTraceDto> dto, CancellationToken cancellationToken);
+		Task<List<Hotline.File.File>> GetByKeyAsync(string key, CancellationToken cancellationToken);
 	}
 }

+ 112 - 0
src/Hotline/SeedData/SystemDicDataSeedData.cs

@@ -0,0 +1,112 @@
+using Hotline.Settings;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Entities;
+
+namespace Hotline.SeedData;
+public class SystemDicDataSeedData : ISeedData<SystemDicData>
+{
+    public IEnumerable<SystemDicData> HasData()
+    {
+        return new List<SystemDicData>();
+    }
+
+    public IEnumerable<SystemDicData> GetData(string dicTypeCode)
+    {
+        if (dicTypeCode == SysDicTypeConsts.Workplace)
+        {
+            return
+            [
+                new() {Id="08dc39be-c7f1-44ae-878c-eaffb30b902c", DicDataValue = "宾馆、饭店、商场、市场", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "宾馆、饭店、商场、市场", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c665-4d40-8482-c8f5540e8ca2", DicDataValue = "学校、体育馆、校外培训机构", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "学校、体育馆、校外培训机构", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c655-4a4b-82c5-494827588653", DicDataValue = "医院", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "医院", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c648-4e03-804a-f01c8c86b2b9", DicDataValue = "养老院、福利院", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "养老院、福利院", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c63c-4931-8a53-abd5fd0db818", DicDataValue = "文化、娱乐、旅游场所", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "文化、娱乐、旅游场所", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c63b-40ca-8c1e-287a8cc48de4", DicDataValue = "宗教场所", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "宗教场所", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c635-468f-871e-bb70008c7822",  DicDataValue = "车站、码头、高铁站候车(船)厅、汽修企业", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "车站、码头、高铁站候车(船)厅、汽修企业", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c62d-4f37-83bf-845f77d45cd9", DicDataValue = "化工、民爆物品生产经营企业", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "化工、民爆物品生产经营企业", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c5d9-44fa-8a4d-62979927c932", DicDataValue = "机械、建材、纺织、服装生产企业", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "机械、建材、纺织、服装生产企业", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c5c9-4f57-8df6-22a8b54927bc", DicDataValue = "仓库、冷库、废品回收场所", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "仓库、冷库、废品回收场所", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c5b7-4529-8ea1-d555c321951c", DicDataValue = "物业服务、居民住宅装饰装修、小型商铺", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "物业服务、居民住宅装饰装修、小型商铺", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c5a8-4045-860a-966e7a41d967", DicDataValue = "电梯加装、拆除", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "电梯加装、拆除", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-c592-483b-84bc-8b0bc177db54", DicDataValue = "煤矿、非煤矿山、小生产加工企业", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "煤矿、非煤矿山、小生产加工企业", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+                new() {Id = "08dc39be-bcf8-4f2d-8495-98f3648309e7", DicDataValue = "水、电、气生产、管网维修,污水处理场所", DicTypeCode = SysDicTypeConsts.Workplace, DicDataName = "水、电、气生产、管网维修,污水处理场所", IsShow =  true, DicTypeId = "08dc39be-d203-460c-868e-46b7132e35b5", ParentId = ""},
+            ];
+        }
+        if (dicTypeCode == SysDicTypeConsts.WorkArea)
+        {
+            return
+            [
+                    new(){Id = "08dc39c1-6ba2-4f53-87e9-a229687bbd10", DicDataValue = "nspla", DicDataName = "九小场所", Children = [
+                            new() {Id = "08dc39c1-6eef-4858-8ad1-ef15fe4a7ee4", DicDataValue = "nspla_sshop", DicDataName = "小商店"},
+                            new() {Id = "08dc39c1-6fbc-4431-8238-f3d77609faa2", DicDataValue = "nspla_sdest", DicDataName = "小餐饮"},
+                            new() {Id = "08dc39c1-92ee-4a39-8e28-46ae40698570", DicDataValue = "nspla_ashotel", DicDataName = "小旅店"},
+                            new() {Id = "08dc39c1-96df-4057-8460-5b65c647986a", DicDataValue = "nspla_ssadev", DicDataName = "小歌舞娱乐"},
+                            new() {Id = "08dc39c1-99ed-4023-85a7-60f68c9090ea", DicDataValue = "nspla_sinca", DicDataName = "小网吧"},
+                            new() {Id = "08dc39c1-a3ce-4c64-8099-ba30142687f9", DicDataValue = "nspla_bathe", DicDataName = "小美容洗浴"},
+                            new() {Id = "08dc39c1-b23d-4672-835c-fe188b281ef3", DicDataValue = "nspla_garten", DicDataName = "小型学校(幼儿园)"},
+                            new() {Id = "08dc39c1-b55e-45ec-8310-2ceba78e5f9e", DicDataValue = "nspla_shosp", DicDataName = "小型医疗机构"},
+                            new() {Id = "08dc39c1-b9ea-4eac-88d6-8340338ead8a", DicDataValue = "nspla_spape", DicDataName = "小生产加工企业"}
+                        ] },
+                    new() { Id = "08dc39c1-be7e-4b7e-82b0-bf47f1cecf7d", DicDataValue = "mimbp", DicDataName = "多业态混合经营场所", Children = [
+                            new() {Id = "08dc3bf7-e15e-4e50-82b0-be8a7f5f68ae", DicDataValue = "mimbp_restaurant", DicDataName = "餐饮"},
+                            new() {Id = "08dc3bf7-e3a0-489b-8cfb-f4aca9ce4bdd", DicDataValue = "mimbp_stay", DicDataName = "住宿"},
+                            new() {Id = "08dc39c1-6bb7-473c-8a4e-f84028cf3a15", DicDataValue = "mimbp_trade", DicDataName = "商业"},
+                            new() {Id = "08dc39c1-6ef1-428a-85a5-a0933dcc1ae8", DicDataValue = "mimbp_game", DicDataName = "娱乐"},
+                            new() {Id = "08dc39c1-6efd-4084-8623-e1b0c4484735", DicDataValue = "mimbp_sport", DicDataName = "体育"},
+                            new() {Id = "08dc39c1-6f5a-48c6-8b53-07ad70e9588d", DicDataValue = "mimbp_culture", DicDataName = "文化"},
+                            new() {Id = "08dc39c1-6fa5-4413-8840-e62a9da7b883", DicDataValue = "mimbp_train", DicDataName = "培训"},
+                            new() {Id = "08dc39c1-893c-4be7-8016-28560096e8dd", DicDataValue = "mimbp_storage", DicDataName = "仓储"},
+                            new() {Id = "08dc39c1-912b-410e-8c64-6b0bcbb56cca", DicDataValue = "mimbp_sublease", DicDataName = "转租形成生产场所"},
+                            new() {Id = "08dc39c1-95c5-4e41-8d3c-b3d1db0ee16d", DicDataValue = "mimbp_sublet", DicDataName = "分租场所"},
+                            new() {Id = "08dc39c1-9776-4819-8820-7e0c0dce519e", DicDataValue = "mimbp_store", DicDataName = "存储多种功能的劳动密集型企业"}
+                        ] },
+                    new() { Id = "08dc39c1-98d2-476d-83a9-2f3844acd083", DicDataValue = "assocc", DicDataName = "人员密集场所", Children = [
+                            new() {Id = "08dc39c1-9eee-44f2-8909-f96d68743bb1", DicDataValue = "assocc_hot", DicDataName = "饭店"},
+                            new() {Id = "08dc39c1-a9ce-4525-8070-5dd822c8fcd8", DicDataValue = "assocc_restaurant", DicDataName = "餐饮场所"},
+                            new() {Id = "08dc39c1-b213-42b0-8956-c9d24c1ee92a", DicDataValue = "assocc_mall", DicDataName = "商场"},
+                            new() {Id = "08dc39c1-b22c-4452-8f59-c5074b980c56", DicDataValue = "assocc_hotel", DicDataName = "宾馆"},
+                            new() {Id = "08dc39c1-b2bf-4d4d-870f-b0e4dfedda7c", DicDataValue = "assocc_market", DicDataName = "集贸市场"},
+                            new() {Id = "08dc39c1-91fc-4f02-845b-2d327e9897a9", DicDataValue = "assocc_theatre", DicDataName = "影剧院"},
+                            new() {Id = "08dc39c1-9801-4670-8f55-c91f86cb9d14", DicDataValue = "assocc_playhouse", DicDataName = "录像厅"},
+                            new() {Id = "08dc39c1-98ff-4fd1-81b2-50c213ad40a8", DicDataValue = "assocc_ballroom", DicDataName = "舞厅"},
+                            new() {Id = "08dc39c1-9ef2-458d-82ad-6d62be526649", DicDataValue = "assocc_carla", DicDataName = "卡拉OK厅"},
+                            new() {Id = "08dc39c1-a9da-490d-8ef5-34e3f672057c", DicDataValue = "assocc_nightclub", DicDataName = "夜总会"}
+                        ] },
+                    new() { Id = "08dc39c1-b24f-4cdd-885d-c27b9872f530", DicDataValue = "vflsme", DicDataName = "大型群众性活动举办场所", Children = [
+                            new() {Id = "08dc39c1-b2ce-4536-814e-120d29a31c6a", DicDataValue = "vflsme_aafhlsme", DicDataName = "大型礼堂"},
+                            new() {Id = "08dc39c1-c57a-49aa-882b-273d4bc18998", DicDataValue = "vflsme_meetingplace", DicDataName = "大型会场"},
+                            new() {Id = "08dc39c1-c66b-44e7-8900-61d427c38fa4", DicDataValue = "vflsme_stadium", DicDataName = "大型体育场馆"}
+                            ] }
+                 ];
+        }
+
+        throw new NotImplementedException();
+    }
+
+    public SystemDicType GetType(string dicTypeCode)
+    {
+        if (dicTypeCode == SysDicTypeConsts.Workplace)
+        {
+            return new SystemDicType
+            {
+                Id = "08dc39be-d203-460c-868e-46b7132e35b5",
+                DicTypeCode = SysDicTypeConsts.Workplace,
+                DicTypeName = "工作场所",
+            };
+        }
+        if (dicTypeCode == SysDicTypeConsts.WorkArea)
+        {
+            return new SystemDicType
+            {
+                Id = "08dc3bf7-e134-47d6-8784-0bdbbc0e67df",
+                DicTypeCode = SysDicTypeConsts.WorkArea,
+                DicTypeName = "工作区域",
+            };
+        }
+        throw new NotImplementedException();
+    }
+}

+ 1 - 1
src/Hotline/Settings/ISystemAreaDomainService.cs

@@ -3,7 +3,7 @@ namespace Hotline.Settings
 {
     public interface ISystemAreaDomainService
     {
-        Task<List<SystemArea>> GetAreaTree(int idLength = 0);
+        Task<List<SystemArea>> GetAreaTree(int idLength = 0, string parentId = "510000");
 
         Task AddArea(SystemArea model,CancellationToken cancellationToken);
 

+ 10 - 0
src/Hotline/Settings/SysDicTypeConsts.cs

@@ -261,4 +261,14 @@ public class SysDicTypeConsts
     /// 知识库标签
     /// </summary>
     public const string KnowledgeBaseTags = "KnowledgeBaseTags";
+
+    /// <summary>
+    /// 工作场所
+    /// </summary>
+    public const string Workplace = "Workplace";
+
+    /// <summary>
+    /// 作业区域
+    /// </summary>
+    public const string WorkArea = "WorkArea";
 }

+ 9 - 9
src/Hotline/Settings/SystemAreaDomainService.cs

@@ -16,27 +16,27 @@ namespace Hotline.Settings
 
         public async Task AddArea(SystemArea model, CancellationToken cancellationToken)
         {
-            await _systemAreaRepository.AddAsync(model,cancellationToken);
+            await _systemAreaRepository.AddAsync(model, cancellationToken);
         }
 
         public async Task ModifyArea(SystemArea model, CancellationToken cancellationToken)
         {
-            await _systemAreaRepository.UpdateAsync(model,cancellationToken);
+            await _systemAreaRepository.UpdateAsync(model, cancellationToken);
         }
 
-        public async Task<List<SystemArea>> GetAreaTree(int idLength = 0)
+        public async Task<List<SystemArea>> GetAreaTree(int idLength = 0, string parentId = "510000")
         {
-           return await  _systemAreaRepository.Queryable()
-                .WhereIF(idLength != 0, x => SqlFunc.Length(x.Id) == idLength)
-                .OrderBy(x=>x.Id).ToTreeAsync(x => x.Children,q=>q.ParentId, "510000");
+            return await _systemAreaRepository.Queryable()
+                 .WhereIF(idLength != 0, x => SqlFunc.Length(x.Id) == idLength)
+                 .OrderBy(x => x.Id).ToTreeAsync(x => x.Children, q => q.ParentId, parentId);
         }
 
         public async Task<SystemArea?> GetArea(string id, CancellationToken cancellationToken)
         {
-            return await _systemAreaRepository.GetAsync(id,cancellationToken);
+            return await _systemAreaRepository.GetAsync(id, cancellationToken);
         }
 
-        public async Task DelArea(string id,CancellationToken cancellationToken)
+        public async Task DelArea(string id, CancellationToken cancellationToken)
         {
             await _systemAreaRepository.RemoveAsync(id, true, cancellationToken);
         }
@@ -48,7 +48,7 @@ namespace Hotline.Settings
         /// <param name="cancellationToken"></param>
         /// <returns></returns>
         /// <exception cref="UserFriendlyException"></exception>
-        public async Task<string> GenerateNewAreaCodeAsync(string parentId,CancellationToken cancellationToken)
+        public async Task<string> GenerateNewAreaCodeAsync(string parentId, CancellationToken cancellationToken)
         {
             var parentArea = await _systemAreaRepository.GetAsync(parentId, cancellationToken);
             if (parentArea == null)

+ 0 - 6
src/Hotline/Snapshot/Industry.cs

@@ -166,10 +166,4 @@ public class Industry : CreationSoftDeleteEntity
     /// </summary>
     [SugarColumn(ColumnDescription = "行业类型")]
     public EIndustryType IndustryType { get; set; }
-
-    /// <summary>
-    /// 附件
-    /// </summary>
-    [SugarColumn(ColumnDataType = "json", IsJson = true)]
-    public List<Share.Dtos.Snapshot.IndustryFileDto>? Additions { get; set; } = new();
 }