Commit 47d0cced by guo_minglei@163.com

调度中心添加杀死工作流和杀死任务的API接口修改

parent 3437a3c4
package com.byit.api; package com.byit.api;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.byit.service.ApiFlowService; import com.byit.service.ApiFlowService;
import com.byit.service.FlowService; import com.byit.service.FlowService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
......
...@@ -59,11 +59,6 @@ ...@@ -59,11 +59,6 @@
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.byit</groupId>
<artifactId>byit-validation-starter</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>myth-job</groupId> <groupId>myth-job</groupId>
......
...@@ -379,12 +379,12 @@ public class FlowServiceImpl implements FlowService { ...@@ -379,12 +379,12 @@ public class FlowServiceImpl implements FlowService {
return result; return result;
} }
private synchronized Boolean killJob(Integer logId, String exectUrl){ private static synchronized Boolean killJob(Integer logId, String exectUrl){
//具体访问的URL //具体访问的URL
String killUrl = exectUrl + "/processManager/killJob"; String killUrl = exectUrl + "/processManager/killJob";
Map<String, Integer> requestMap = new HashMap<>(2); Map<String, Object> requestMap = new HashMap<>(2);
requestMap.put("logId", logId); requestMap.put("logId", logId);
String killResult = HttpUtil.post(killUrl, JSON.toJSONString(requestMap)); String killResult = HttpUtil.post(killUrl, requestMap);
log.info("请求结果{}", killResult); log.info("请求结果{}", killResult);
ResponseResult responseResult = JSON.parseObject(killResult, ResponseResult.class); ResponseResult responseResult = JSON.parseObject(killResult, ResponseResult.class);
if ("SUCCESS".equals(responseResult.getResult())){ if ("SUCCESS".equals(responseResult.getResult())){
...@@ -392,4 +392,5 @@ public class FlowServiceImpl implements FlowService { ...@@ -392,4 +392,5 @@ public class FlowServiceImpl implements FlowService {
} }
return false; return false;
} }
} }
\ No newline at end of file
...@@ -45,6 +45,16 @@ ...@@ -45,6 +45,16 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.byit</groupId>
<artifactId>byit-validation-starter</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.byit.advice; package com.byit.job.advice;
import com.byit.exception.DataValidationException; import com.byit.exception.DataValidationException;
import com.byit.job.enums.IEnum; import com.byit.job.enums.IEnum;
......
package com.byit.advice; package com.byit.job.advice;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.byit.job.vo.ResponseResult; import com.byit.job.vo.ResponseResult;
......
package com.byit; package com.byit;
import com.byit.rpc.remoting.provider.annotation.RpcService;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
...@@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @date: 2019/11/14 16:03 * @date: 2019/11/14 16:03
**/ **/
@SpringBootApplication @SpringBootApplication
@RpcService(http_type = true)
public class ExecutorServiceApplication { public class ExecutorServiceApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(ExecutorServiceApplication.class,args); SpringApplication.run(ExecutorServiceApplication.class,args);
......
...@@ -4,7 +4,7 @@ import com.byit.executor.jobExecutor.process.MythJobProcess; ...@@ -4,7 +4,7 @@ import com.byit.executor.jobExecutor.process.MythJobProcess;
import com.byit.executor.util.JobContentUtil; import com.byit.executor.util.JobContentUtil;
import com.byit.utils.ValidationUtil; import com.byit.utils.ValidationUtil;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
...@@ -12,11 +12,11 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -12,11 +12,11 @@ import org.springframework.web.bind.annotation.RestController;
* @Author guo_m * @Author guo_m
* @Date 2020-02-22 * @Date 2020-02-22
*/ */
@RestController("processManager") @RestController
@RequestMapping("processManager")
public class ProcessManagerController { public class ProcessManagerController {
@PostMapping("killJob") @PostMapping("killJob")
@ResponseBody
public String killJob(Integer logId){ public String killJob(Integer logId){
ValidationUtil.dataNotNull(logId, "日志id不允许为空!"); ValidationUtil.dataNotNull(logId, "日志id不允许为空!");
MythJobProcess mythJobProcess = JobContentUtil.getJobThread(logId); MythJobProcess mythJobProcess = JobContentUtil.getJobThread(logId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment