Browse Source

修复异常

qinchaoyue 1 month ago
parent
commit
6c1ff8dcde

+ 4 - 4
src/Hotline.Application/Identity/IdentityAppService.cs

@@ -354,10 +354,10 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
         
         var dicOutData = new Dictionary<string, object>()
         {
-            { "Token", token },
-            { "OpenId", thirdAccount.OpenId },
-            { "PhoneNumber", thirdAccount.PhoneNumber },
-            { "UserName", thirdAccount.UserName }
+            { "token", token },
+            { "openId", thirdAccount.OpenId },
+            { "phoneNumber", thirdAccount.PhoneNumber },
+            { "userName", thirdAccount.UserName }
         };
         dicOutData = await _thirdAccountDomainFactory.GetLoginOutDataAsync(thirdAccount, dicOutData, cancel);
         return dicOutData;

+ 1 - 1
src/Hotline.Application/Snapshot/RedPackApplication.cs

@@ -15,6 +15,7 @@ using Hotline.Snapshot.Interfaces;
 using Hotline.ThirdAccountDomainServices.Interfaces;
 using Mapster;
 using Microsoft.AspNetCore.Http;
+using Microsoft.EntityFrameworkCore;
 using Microsoft.Extensions.Logging;
 using SqlSugar;
 using SqlSugar.Extensions;
@@ -337,7 +338,6 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
         if (has) throw new UserFriendlyException("该工单已发放红包,不能撤销审批");
         await _specialRedPackAuditRepository.Updateable()
             .SetColumns(m => m.Status, ERedPackAuditStatus.Pending)
-            .SetColumns(m => m.ApprovedAmount, null)
             .SetColumns(m => m.AuditType, null)
             .SetColumns(m => m.AuditTypeCode, null)
             .SetColumns(m => m.AuditRemark, null)

+ 3 - 3
src/Hotline.Application/Snapshot/SnapshotThirdAccountSupplier.cs

@@ -67,9 +67,9 @@ public class SnapshotThirdAccountSupplier : IThirdAccountSupplier, IScopeDepende
             user.Id = await _snapshotUserInfoRepository.AddAsync(user);
             await _thirdAccountDomainService.UpdateExternalIdAsync(thirdAccount.Id, thirdAccount.ExternalId, user.Id, cancel);
         }
-        dicOutData.Add("UserType", user.CitizenType);
-        dicOutData.Add("IsVolunteer", isVolunteer);
-        dicOutData.Add("InvitationCode", user.InvitationCode);
+        dicOutData.Add("userType", user.CitizenType);
+        dicOutData.Add("isVolunteer", isVolunteer);
+        dicOutData.Add("invitationCode", user.InvitationCode);
         return dicOutData;
     }
 

+ 1 - 1
src/Hotline.Share/Dtos/Snapshot/OrderDto.cs

@@ -741,7 +741,7 @@ public class SystemDicDataAmountOutDto : SystemDicDataOutDto
     /// <summary>
     /// 价格
     /// </summary>
-    public int Amount => int.Parse(_dicDataName.Split('|')[1]);
+    public int Amount => int.TryParse(_dicDataName.Split('|').ElementAtOrDefault(1), out var result) ? result : 100;
 
     private string _dicDataName;
     new public string DicDataName

+ 13 - 6
test/Hotline.Tests/Application/OrderSnapshotApplicationTest.cs

@@ -44,8 +44,9 @@ public class OrderSnapshotApplicationTest : TestBase
     private readonly ISnapshotLabelLogRepository _snapshotLabelLogRepository;
     private readonly IRedPackApplication _redPackApplication;
     private readonly IOrderRepository _orderRepository;
+    private readonly IIndustryCaseRepository _industryCaseRepository;
 
-    public OrderSnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdIdentiyService, IThirdAccountRepository thirdAccountRepository, OrderServiceMock orderServiceMock, ISystemDicDataCacheManager systemDicDataCacheManager, IOrderSnapshotRepository orderSnapshotRepository, IOrderSnapshotApplication orderSnapshotApplication, ISnapshotApplication snapshotApplication, IIndustryLogRepository industryLogRepository, ICommunityInfoRepository communityInfoRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, ISnapshotLabelLogRepository snapshotLabelLogRepository, ITypedCache<SystemSetting> cacheSettingData, IRedPackApplication redPackApplication, IOrderRepository orderRepository, ThirdAccounSupplierFactory thirdAccountDomainFactory) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdIdentiyService, thirdAccountRepository, cacheSettingData, thirdAccountDomainFactory)
+    public OrderSnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdIdentiyService, IThirdAccountRepository thirdAccountRepository, OrderServiceMock orderServiceMock, ISystemDicDataCacheManager systemDicDataCacheManager, IOrderSnapshotRepository orderSnapshotRepository, IOrderSnapshotApplication orderSnapshotApplication, ISnapshotApplication snapshotApplication, IIndustryLogRepository industryLogRepository, ICommunityInfoRepository communityInfoRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, ISnapshotLabelLogRepository snapshotLabelLogRepository, ITypedCache<SystemSetting> cacheSettingData, IRedPackApplication redPackApplication, IOrderRepository orderRepository, ThirdAccounSupplierFactory thirdAccountDomainFactory, IIndustryCaseRepository industryCaseRepository) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdIdentiyService, thirdAccountRepository, cacheSettingData, thirdAccountDomainFactory)
     {
         _orderServiceMock = orderServiceMock;
         _systemDicDataCacheManager = systemDicDataCacheManager;
@@ -59,6 +60,7 @@ public class OrderSnapshotApplicationTest : TestBase
         _snapshotLabelLogRepository = snapshotLabelLogRepository;
         _redPackApplication = redPackApplication;
         _orderRepository = orderRepository;
+        _industryCaseRepository = industryCaseRepository;
     }
 
     /// <summary>
@@ -99,6 +101,7 @@ public class OrderSnapshotApplicationTest : TestBase
         SetSettingCache(SettingConstants.OvertimeBack, "4");
         var snapshotLabels = _systemDicDataCacheManager.SnapshotOrderLabel;
         var inputLable = snapshotLabels.Where(m => m.DicDataValue == "bss").ToList();
+        var industryCase = await _industryCaseRepository.Queryable().Where(m => m.IsEnable ==  true).FirstAsync();
         var order = _orderServiceMock.CreateSnapshotOrder(SetWeiXin)
             .办理到网格员(SetZuoXi)
             .StepHandle(async (order, mock) =>
@@ -121,7 +124,7 @@ public class OrderSnapshotApplicationTest : TestBase
                     .Where(m => m.Id == order.Id)
                     .ExecuteCommandAsync();
                 orderSnapshot = await _orderSnapshotRepository.GetAsync(order.Id);
-                var replyDto =  mock.GetGuiderSystemInDto(orderSnapshot.NetworkENumber);
+                var replyDto = mock.GetGuiderSystemInDto(orderSnapshot.NetworkENumber);
                 await _snapshotApplication.SaveGuiderSystemReplyAsync(replyDto, CancellationToken.None);
                 orderSnapshot = await _orderSnapshotRepository.GetAsync(order.Id);
                 orderSnapshot.CommunityName.ShouldNotBeNull();
@@ -140,13 +143,17 @@ public class OrderSnapshotApplicationTest : TestBase
             })
             .办理到派单员(Set班长)
             .办理到一级部门(SetPaiDanYuan)
-            .办理到归档(Set一级部门)
+            .办理到归档(Set一级部门, data =>
+            {
+                data.IsDangerDepartment = true;
+                data.IndustryCase = industryCase.Id;
+            })
             .发布工单(SetZuoXi, inputLable.Select(m => new Kv(m.DicDataName, m.DicDataName)).ToList())
             .StepHandle(async order =>
             {
                 var log = _snapshotLabelLogRepository.Queryable().Where(m => m.OrderId == order.Id).First();
                 log.ShouldNotBeNull();
-                await _orderSnapshotApplication.UpdateIsEmphasisAsync(new UpdateIsEmphasisInDto { Ids = [order.Id]});
+                await _orderSnapshotApplication.UpdateIsEmphasisAsync(new UpdateIsEmphasisInDto { Ids = [order.Id] });
                 var snapshot = _orderSnapshotRepository.Get(order.Id);
                 snapshot.LabelName.ShouldBe(string.Join(',', inputLable.Select(m => m.DicDataName)), "label异常");
                 snapshot.IsEmphasis.ShouldBe(true);
@@ -169,9 +176,9 @@ public class OrderSnapshotApplicationTest : TestBase
                 redPackRecord.ShouldNotBeNull();
             })
             .部门审核特殊红包(Set应急管理局)
-            .StepHandle(async order => 
+            .StepHandle(async order =>
             {
-                 var baseData = await _redPackApplication.GetRedPackRecordBaseDataAsync(order.Id);
+                var baseData = await _redPackApplication.GetRedPackRecordBaseDataAsync(order.Id);
                 baseData.AuditType.ShouldNotBeNull();
                 baseData.AuditTypeCode.ShouldNotBeNull();
                 baseData.Amount.ShouldNotBeNull();