Repository: PowerJob/PowerJob (language: java)

Issue:
Fail to cancel delay job instance by id
**Describe the bug**
Fail to cancel delay job instance by id. Get error like:

> PowerJobException: can't find appId in params for:void tech.powerjob.server.core.instance.InstanceService.cancelInstance(Long)


**To Reproduce**

1. create an API task w/ fixed host using the PowerJob Admin UI, say, the task is named as 'job1'
2. use PowerJob API (powerJobClient#runJob) to create a instance of 'job1' and schedule it run after 1 hour
3. use PowerJob API (powerJobClient#cancelInstance) to cancel the a instance created in previous step

**Expected behavior**
The cancellation of instance should succeed.

**Environment**
 - PowerJob Version: 4.0.1
 - Java Version:  OpenJDK 8
 - OS: CentOS 7.5

**Screenshots**

PowerJobException: can't find appId in params for:void tech.powerjob.server.core.instance.InstanceService.cancelInstance(Long)

**Additional context**
The root cause seems to me a programming issue which fail to add appId as parameter to the method `cancelInstance`.
This parameter is required by the `DesignateServerAspect`.



Discussion / hints:

Fix patch:
diff --git a/powerjob-server/powerjob-server-core/src/main/java/tech/powerjob/server/core/instance/InstanceService.java b/powerjob-server/powerjob-server-core/src/main/java/tech/powerjob/server/core/instance/InstanceService.java
index 9efa068a6..275ec1df3 100644
--- a/powerjob-server/powerjob-server-core/src/main/java/tech/powerjob/server/core/instance/InstanceService.java
+++ b/powerjob-server/powerjob-server-core/src/main/java/tech/powerjob/server/core/instance/InstanceService.java
@@ -191,8 +191,8 @@ public void retryInstance(Long appId, Long instanceId) {
      * @param instanceId 任务实例
      */
     @DesignateServer
-    public void cancelInstance(Long instanceId) {
-        log.info("[Instance-{}] try to cancel the instance.", instanceId);
+    public void cancelInstance(Long appId, Long instanceId) {
+        log.info("[Instance-{}] try to cancel the instance with appId {}.", instanceId, appId);
 
         try {
             InstanceInfoDO instanceInfo = fetchInstanceInfo(instanceId);
diff --git a/powerjob-server/powerjob-server-starter/src/main/java/tech/powerjob/server/web/controller/OpenAPIController.java b/powerjob-server/powerjob-server-starter/src/main/java/tech/powerjob/server/web/controller/OpenAPIController.java
index 836e06f60..cc5f67d08 100644
--- a/powerjob-server/powerjob-server-starter/src/main/java/tech/powerjob/server/web/controller/OpenAPIController.java
+++ b/powerjob-server/powerjob-server-starter/src/main/java/tech/powerjob/server/web/controller/OpenAPIController.java
@@ -126,7 +126,7 @@ public ResultDTO<Void> stopInstance(Long instanceId, Long appId) {
     @PostMapping(OpenAPIConstant.CANCEL_INSTANCE)
     public ResultDTO<Void> cancelInstance(Long instanceId, Long appId) {
         checkInstanceIdValid(instanceId, appId);
-        instanceService.cancelInstance(instanceId);
+        instanceService.cancelInstance(appId, instanceId);
         return ResultDTO.success(null);
     }
 


Test patch: