|
|
@ -2,6 +2,7 @@ package com.qniao.zsh.api.command.controlspider.admin; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.EnumUtil; |
|
|
import cn.hutool.core.util.EnumUtil; |
|
|
|
|
|
import com.qniao.zsh.api.command.controlspider.admin.request.SpiderDeleteDto; |
|
|
import com.qniao.zsh.api.command.controlspider.admin.request.SpiderStopDto; |
|
|
import com.qniao.zsh.api.command.controlspider.admin.request.SpiderStopDto; |
|
|
import com.qniao.zsh.domain.aggregate.spiderstate.constant.SpiderStateEnum; |
|
|
import com.qniao.zsh.domain.aggregate.spiderstate.constant.SpiderStateEnum; |
|
|
import com.qniao.zsh.query.spider.queryparams.SpiderByQueryParam; |
|
|
import com.qniao.zsh.query.spider.queryparams.SpiderByQueryParam; |
|
|
@ -42,8 +43,8 @@ public class SpiderStateAdminCommandController { |
|
|
|
|
|
|
|
|
@ApiOperation("启动爬虫") |
|
|
@ApiOperation("启动爬虫") |
|
|
@PostMapping("/run/spider") |
|
|
@PostMapping("/run/spider") |
|
|
public List<String> run(@RequestParam("spiderId") Long spiderId) throws Exception { |
|
|
|
|
|
return spiderStateApplicationService.run(spiderId); |
|
|
|
|
|
|
|
|
public List<String> run(@RequestBody SpiderState spiderState) throws Exception { |
|
|
|
|
|
return spiderStateApplicationService.run(spiderState.getId()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation("停止爬虫的周期运行") |
|
|
@ApiOperation("停止爬虫的周期运行") |
|
|
@ -59,6 +60,12 @@ public class SpiderStateAdminCommandController { |
|
|
//判断爬虫是否已经存在 |
|
|
//判断爬虫是否已经存在 |
|
|
return new EntityCreatedVo(createSpiderApplicationService.create(dto.transform().getSpiderName())); |
|
|
return new EntityCreatedVo(createSpiderApplicationService.create(dto.transform().getSpiderName())); |
|
|
} |
|
|
} |
|
|
|
|
|
@ApiOperation("删除爬虫") |
|
|
|
|
|
@PostMapping("/delete/spider") |
|
|
|
|
|
public List<String> delete(@RequestBody @Validated SpiderDeleteDto dto) { |
|
|
|
|
|
//判断爬虫是否已经停止 |
|
|
|
|
|
return spiderStateApplicationService.delete(dto.transform().getId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation("查询爬虫列表分页") |
|
|
@ApiOperation("查询爬虫列表分页") |
|
|
@GetMapping("/query/spider") |
|
|
@GetMapping("/query/spider") |
|
|
|