Browse Source

Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test

tangjiang 1 month ago
parent
commit
2b2f7ecee1

+ 24 - 7
src/Hotline.Application/Snapshot/IndustryApplication.cs

@@ -1,4 +1,5 @@
 using DocumentFormat.OpenXml.Office2010.Excel;
 using DocumentFormat.OpenXml.Office2010.Excel;
+using DocumentFormat.OpenXml.Wordprocessing;
 using Hotline.Caching.Interfaces;
 using Hotline.Caching.Interfaces;
 using Hotline.File;
 using Hotline.File;
 using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Repository.SqlSugar.Extensions;
@@ -231,7 +232,7 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
             .LeftJoin<Industry>((s, i) => s.IndustryId == i.Id)
             .LeftJoin<Industry>((s, i) => s.IndustryId == i.Id)
             .Where((s, i) => s.Id == id)
             .Where((s, i) => s.Id == id)
             .Select((s, i) => new SnapshotSMSTemplateItemsOutDto
             .Select((s, i) => new SnapshotSMSTemplateItemsOutDto
-            { 
+            {
                 Status = s.Status
                 Status = s.Status
             }, true)
             }, true)
             .FirstAsync();
             .FirstAsync();
@@ -386,15 +387,30 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
     {
     {
         var query = _volunteerReportRepository.Queryable()
         var query = _volunteerReportRepository.Queryable()
             .LeftJoin<SystemDicData>((volunteer, dic) => volunteer.JobType == dic.Id)
             .LeftJoin<SystemDicData>((volunteer, dic) => volunteer.JobType == dic.Id)
-            .WhereIF(dto.Name.NotNullOrEmpty(), m => m.Name.Contains(dto.Name))
-            .WhereIF(dto.PhoneNumber.NotNullOrEmpty(), m => m.PhoneNumber.Contains(dto.PhoneNumber))
-            .OrderByDescending(m => m.CreationTime)
+            .WhereIF(dto.Name.NotNullOrEmpty(), (volunteer, dic) => volunteer.Name.Contains(dto.Name))
+            .WhereIF(dto.PhoneNumber.NotNullOrEmpty(), (volunteer, dic) => volunteer.PhoneNumber.Contains(dto.PhoneNumber))
+            .OrderByDescending((volunteer, dic) => volunteer.CreationTime)
             .Select((volunteer, dic) => new VolunteerReportItemsOutDto
             .Select((volunteer, dic) => new VolunteerReportItemsOutDto
             {
             {
                 JobType = dic.DicDataName,
                 JobType = dic.DicDataName,
                 PhoneNumber = volunteer.DeclarePhoneNumber,
                 PhoneNumber = volunteer.DeclarePhoneNumber,
-                FullAddress = volunteer.Address + volunteer.FullAddress
-            }, true);
+                FullAddress = volunteer.Address + volunteer.FullAddress,
+            }, true)
+            .Mapper((item, cache)=> 
+            {
+                item.Files = _fileRepository.Queryable()
+                .Where(file => file.Key == item.Id)
+                .Select(file => new IndustryFileDto
+                {
+                    Id = file.Id,
+                    Path = file.Path,
+                    FileName = file.FileName,
+                    Additions = file.Additions
+                }).ToList();
+            });
+#if DEBUG
+        var sql = query.ToSqlString();
+#endif
         return query;
         return query;
     }
     }
 
 
@@ -425,7 +441,8 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
         await _snapshotSMSTemplateRepository.Queryable()
         await _snapshotSMSTemplateRepository.Queryable()
             .Where(m => ids.Contains(m.Id))
             .Where(m => ids.Contains(m.Id))
             .ToListAsync()
             .ToListAsync()
-            .Then(async sms => {
+            .Then(async sms =>
+            {
                 for (int i = 0;i < sms.Count;i++)
                 for (int i = 0;i < sms.Count;i++)
                 {
                 {
                     sms[i].IsDeleted = true;
                     sms[i].IsDeleted = true;

+ 4 - 1
src/Hotline.Application/Snapshot/SnapshotApplicationBase.cs

@@ -138,10 +138,13 @@ public abstract class SnapshotApplicationBase
             if (m.CellImgUrl.NotNullOrEmpty())
             if (m.CellImgUrl.NotNullOrEmpty())
                 m.CellImgUrl = fileServiceUrl + m.CellImgUrl;
                 m.CellImgUrl = fileServiceUrl + m.CellImgUrl;
         });
         });
+        var SSPBannerId = _systemDicDataCacheManager.GetSnapshotBulletinSource("SSPBanner").Id;
+        var banners = (await _bulletinRepository.Queryable().Where(m => m.SnapshotBulletinTypeId == SSPBannerId)
+            .Select(m => m.Content).ToListAsync()).Select(m => m.GetHtmlImgSrc()).ToList();
 
 
         return new HomePageOutDto
         return new HomePageOutDto
         {
         {
-            Banners = _sysSetting.AppBanner.Split('|').Select(m => fileDownloadApi + m).ToList(),
+            Banners = banners,
             Industrys = items
             Industrys = items
         };
         };
     }
     }

+ 1 - 0
src/Hotline.Share/Dtos/Snapshot/IndustryFileDto.cs

@@ -30,6 +30,7 @@ public class IndustryFileDto
     /// 附件系统中附件的Id
     /// 附件系统中附件的Id
     /// </summary>
     /// </summary>
     public string AdditionId { get; set; }
     public string AdditionId { get; set; }
+    public string Additions { get; set; }
 
 
     /// <summary>
     /// <summary>
     /// Url
     /// Url

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

@@ -170,4 +170,9 @@ public class VolunteerReportItemsOutDto
     /// 上报时间
     /// 上报时间
     /// </summary>
     /// </summary>
     public DateTime CreationTime { get; set; }
     public DateTime CreationTime { get; set; }
+
+    /// <summary>
+    /// 附件信息
+    /// </summary>
+    public List<IndustryFileDto> Files { get; set; }
 }
 }

+ 12 - 0
src/Hotline.Share/Tools/StringExtensions.cs

@@ -97,4 +97,16 @@ public static class StringExtensions
             return memoryStream.ToArray();
             return memoryStream.ToArray();
         }
         }
     }
     }
+
+    public static string GetHtmlImgSrc(this string value)
+    {
+        string pattern = @"<img\s[^>]*?src\s*=\s*[""'](?<src>[^""']+)[""']";
+        Match match = Regex.Match(value, pattern, RegexOptions.IgnoreCase);
+
+        if (match.Success)
+        {
+            return match.Groups["src"].Value;
+        }
+        return string.Empty;
+    }
 }
 }

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

@@ -56,6 +56,13 @@ namespace Hotline.Caching.Interfaces
         /// </summary>
         /// </summary>
         IReadOnlyCollection<SystemDicDataOutDto> SnapshotBulletinSource { get; }
         IReadOnlyCollection<SystemDicDataOutDto> SnapshotBulletinSource { get; }
 
 
+        /// <summary>
+        /// 随手拍公告来源
+        /// </summary>
+        /// <param name="dicDataValue"></param>
+        /// <returns></returns>
+        SystemDicDataOutDto GetSnapshotBulletinSource(string dicDataValue);
+
         /// <summary>
         /// <summary>
         /// 红包补充发放类型
         /// 红包补充发放类型
         /// </summary>
         /// </summary>

+ 4 - 0
src/Hotline/Caching/Services/SysDicDataCacheManager.cs

@@ -116,6 +116,9 @@ namespace Hotline.Caching.Services
         /// 随手拍公告来源
         /// 随手拍公告来源
         /// </summary>
         /// </summary>
         public IReadOnlyCollection<SystemDicDataOutDto> SnapshotBulletinSource => GetOrAdd(SysDicTypeConsts.SnapshotBulletinSource);
         public IReadOnlyCollection<SystemDicDataOutDto> SnapshotBulletinSource => GetOrAdd(SysDicTypeConsts.SnapshotBulletinSource);
+        public SystemDicDataOutDto GetSnapshotBulletinSource(string dicDataValue)
+            => this.SnapshotBulletinSource.FirstOrDefault(x => x.DicDataValue == dicDataValue) ?? new SystemDicDataOutDto();
+        
 
 
         /// <summary>
         /// <summary>
         /// 红包补充发放类型
         /// 红包补充发放类型
@@ -151,5 +154,6 @@ namespace Hotline.Caching.Services
         {
         {
             _cacheSysDicData.Remove(code);
             _cacheSysDicData.Remove(code);
         }
         }
+
     }
     }
 }
 }

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

@@ -172,6 +172,7 @@ public class SystemDicDataSeedData : ISeedData<SystemDicData>
                 new() { Id = "08dc0681-e9e1-493b-889d-3a238c2dde39", DicDataValue = "15", DicDataName = "城市管理操作指引", Sort = 15 },
                 new() { Id = "08dc0681-e9e1-493b-889d-3a238c2dde39", DicDataValue = "15", DicDataName = "城市管理操作指引", Sort = 15 },
                 new() { Id = "08dc0681-ed2e-40bb-829b-c8ee518b3229", DicDataValue = "16", DicDataName = "宣传学习安全隐患", Sort = 16 },
                 new() { Id = "08dc0681-ed2e-40bb-829b-c8ee518b3229", DicDataValue = "16", DicDataName = "宣传学习安全隐患", Sort = 16 },
                 new() { Id = "08dc0681-ee29-4624-865c-58d5d9667c92", DicDataValue = "17", DicDataName = "安全隐患操作指引", Sort = 17 },
                 new() { Id = "08dc0681-ee29-4624-865c-58d5d9667c92", DicDataValue = "17", DicDataName = "安全隐患操作指引", Sort = 17 },
+                new() { Id = "08dd6a95-9d0d-4ffd-82f6-0037ced40215", DicDataValue = "SSPBanner", DicDataName = "随手拍Banner", Sort = 18 },
                 ];
                 ];
         }
         }
 
 

+ 9 - 0
test/Hotline.Tests/Application/IndustryApplicationTest.cs

@@ -17,6 +17,7 @@ using Hotline.Settings;
 using XF.Domain.Cache;
 using XF.Domain.Cache;
 using Hotline.ThirdAccountDomainServices.Interfaces;
 using Hotline.ThirdAccountDomainServices.Interfaces;
 using Hotline.ThirdAccountDomainServices;
 using Hotline.ThirdAccountDomainServices;
+using Hotline.Repository.SqlSugar.Extensions;
 
 
 namespace Hotline.Tests.Application;
 namespace Hotline.Tests.Application;
 public class IndustryApplicationTest : TestBase
 public class IndustryApplicationTest : TestBase
@@ -32,6 +33,14 @@ public class IndustryApplicationTest : TestBase
         _systemOrganizeRepository = systemOrganizeRepository;
         _systemOrganizeRepository = systemOrganizeRepository;
     }
     }
 
 
+    [Fact]
+    public async Task GetVolunteerReportItems_Test()
+    {
+        var inDto = new VolunteerReportItemsInDto(null, null);
+        var items = await _industryApplication.GetVolunteerReportItems(inDto).ToListAsync();
+        items.ShouldNotBeNull();
+    }
+
     [Fact]
     [Fact]
     public async Task UpdateIndustry_Test()
     public async Task UpdateIndustry_Test()
     {
     {