xf 2 anos atrás
pai
commit
ec50133728

+ 12 - 0
build/dapr/components/pubsub.yaml

@@ -0,0 +1,12 @@
+apiVersion: dapr.io/v1alpha1
+kind: Component
+metadata:
+  name: pubsub
+spec:
+  type: pubsub.redis
+  version: v1
+  metadata:
+  - name: redisHost
+    value: 192.168.100.223:6379
+  - name: redisPassword
+    value: ""

+ 14 - 0
build/dapr/components/statestore.yaml

@@ -0,0 +1,14 @@
+apiVersion: dapr.io/v1alpha1
+kind: Component
+metadata:
+  name: statestore
+spec:
+  type: state.redis
+  version: v1
+  metadata:
+  - name: redisHost
+    value: 192.168.100.223:6379
+  - name: redisPassword
+    value: ""
+  - name: actorStateStore
+    value: "true"

+ 9 - 0
build/dapr/configuration/config.yaml

@@ -0,0 +1,9 @@
+apiVersion: dapr.io/v1alpha1
+kind: Configuration
+metadata:
+  name: daprConfig
+spec:
+  tracing:
+    samplingRate: "1"
+    zipkin:
+      endpointAddress: http://localhost:9411/api/v2/spans

+ 1 - 0
src/Hotline.Api/Controllers/TestController.cs

@@ -1,5 +1,6 @@
 using Conductor.Client;
 using Conductor.Domain.Models;
+using Dapr;
 using Hotline.CallCenter.BlackLists;
 using Hotline.CallCenter.Devices;
 using Hotline.CallCenter.Ivrs;

+ 22 - 1
src/Hotline.Api/Controllers/WorkflowController.cs

@@ -99,9 +99,30 @@ public class WorkflowController : BaseController
         if (!pubRsp.IsSuccess) throw new UserFriendlyException(pubRsp.Error ?? string.Empty, "发布流程模板失败");
     }
 
-    [HttpPost("")]
+    /// <summary>
+    /// 启用流程模板
+    /// </summary>
+    /// <param name="workflowId"></param>
+    /// <returns></returns>
+    /// <exception cref="UserFriendlyException"></exception>
+    [HttpPost("enable")]
     public async Task Enable(string workflowId)
     {
+        var enableRsp = await _workflowRemotingService.EnableAsync(workflowId, HttpContext.RequestAborted);
+        if (!enableRsp.IsSuccess) throw new UserFriendlyException(enableRsp.Error ?? string.Empty, "启用流程模板失败");
+    }
 
+    /// <summary>
+    /// 禁用流程模板
+    /// </summary>
+    /// <param name="workflowId"></param>
+    /// <returns></returns>
+    /// <exception cref="UserFriendlyException"></exception>
+    [HttpPost("disable")]
+    public async Task Disable(string workflowId)
+    {
+        var disableRsp = await _workflowRemotingService.DisableAsync(workflowId, HttpContext.RequestAborted);
+        if (!disableRsp.IsSuccess) throw new UserFriendlyException(disableRsp.Error ?? string.Empty, "禁用流程模板失败");
     }
+    
 }

+ 1 - 1
src/Hotline.Api/StartupExtensions.cs

@@ -108,7 +108,7 @@ internal static class StartupExtensions
             .AddDapr(d =>
             {
 #if DEBUG
-                d.UseHttpEndpoint("http://192.168.100.223:50122");
+                d.UseHttpEndpoint("http://192.168.100.223:50112");
 #endif
             });
         // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle

+ 8 - 0
src/Hotline.Application/Dtos/WorkflowDefinitionDto.cs

@@ -0,0 +1,8 @@
+using Conductor.Domain.Models;
+
+namespace Hotline.Application.Dtos;
+
+public class WorkflowDefinitionDto : PreDefinition
+{
+    public bool IsPreDefinition { get; set; }
+}

+ 8 - 0
src/Hotline/Orders/Order.cs

@@ -12,4 +12,12 @@ namespace Hotline.Orders
     public class Order
     {
     }
+
+    /// <summary>
+    /// 工单草稿
+    /// </summary>
+    public class PreOrder : Order
+    {
+
+    }
 }