feat: 增加手动刷新全部拍照时间表接口

dev
huangfeng 1 month ago
parent a41b964b4a
commit b2e1e4717a

@ -8,6 +8,7 @@ import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.entity.RequestResults;
import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_framework.timeTask.StoreCameraScheduleTask;
import com.shxy.xymanager_service.service.TermSetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -21,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Api(value = "装置cma控制", tags = "装置cma控制")
@RestController
@ -29,6 +32,8 @@ public class TermSetController extends BaseController {
@Autowired
TermSetService termSetService;
@Resource
StoreCameraScheduleTask cameraScheduleTask;
@ApiOperation(value = "声光报警", notes = "声光报警", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@ -74,7 +79,7 @@ public class TermSetController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/setTermCamera")
@Log(title = "设备控制接口", type = "查询")
public ResponseReult<CmaRequestModel> setTermCamera(@RequestBody @Validated TermCtrlVo vo) throws Exception{
public ResponseReult<CmaRequestModel> setTermCamera(@RequestBody @Validated TermCtrlVo vo) throws Exception {
ServiceBody<CmaRequestModel> serviceBody = termSetService.setTermCamera(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
@ -96,4 +101,9 @@ public class TermSetController extends BaseController {
}
}
@RequestMapping("/refreshAllCameraSchedule")
public ResponseReult<String> refreshAllCameraSchedule() {
cameraScheduleTask.search();
return ResponseReult.success("OK");
}
}

@ -15,6 +15,7 @@ import com.shxy.xymanager_service.service.NewCacheService;
import com.shxy.xymanager_service.service.TermSetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -93,7 +94,8 @@ public class StoreCameraScheduleTask {
}
@Scheduled(cron = "0 1 3 * * ?")
private void search() {
@Async
public void search() {
if (!enable) {
return;
}
@ -106,7 +108,7 @@ public class StoreCameraScheduleTask {
TermAndChannelDto termAndChannelDto = termAndChannelMap.get(termId);
this.searchOne(term, termAndChannelDto);
try {
Thread.sleep(500);
Thread.sleep(200);
} catch (Exception ignore) {
}
}

Loading…
Cancel
Save