package com.hdkj.lt.mq.controller;

import com.hdkj.lt.core.plugins.thread.MultiThreadExecuteService;
import com.hdkj.lt.feign.IPlanCreateClient;
import com.hdkj.lt.modle.dto.plan.PlanCreateSwitchDTO;
import com.hdkj.lt.mq.entity.dto.AcceptPlanPowerCutDTO;
import com.hdkj.lt.mq.entity.dto.AcceptPlanPowerCutListDTO;
import com.hdkj.lt.mq.service.fault.FaultFhzgReasoningPlatformService;
import com.hdkj.lt.mq.service.plan.AcceptPlanPowerCutService;
import com.hdkj.lt.mq.service.plan.impl.FhzgReasoningPlatformServiceImpl;
import com.hdkj.hussar.ApiResponse;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.CompletableFuture;


/**
 * @author luorui
 * @date 2025/5/25 10:58
 * <p>
 * 模拟计划停电数据接入
 */
@Slf4j
@RestController
@RequestMapping("test")
@RequiredArgsConstructor
public class AcceptPlanPowerCutController {


    private final AcceptPlanPowerCutService acceptPlanPowerCutService;

    private final FhzgReasoningPlatformServiceImpl fhzgReasoningPlatformService;
    @Autowired
    MultiThreadExecuteService multiThreadExecuteService;


    /**
     * @author luorui
     * @date 2025/5/25 11:20
     * @discription 接收计划停电数据
     **/
    @PostMapping("/acceptPlanPowerCut")
    @ApiOperation(value = "接收计划停电数据")
    public ApiResponse<Boolean> acceptPlanPowerCut(@RequestBody AcceptPlanPowerCutDTO acceptPlanPowerCutDTO) {
        boolean result = acceptPlanPowerCutService.acceptPlanPowerCut(acceptPlanPowerCutDTO);
        return ApiResponse.success(result);
    }

    @PostMapping("/acceptPlanPowerCutList")
    @ApiOperation(value = "批量接收计划停电数据")
    public ApiResponse<Boolean> acceptPlanPowerCut(@RequestBody AcceptPlanPowerCutListDTO request) {
        acceptPlanPowerCutService
                .acceptPlanPowerCutList(request);
        return ApiResponse.success(true);
    }

    @PostMapping("/retryPlanPowerCutList")
    @ApiOperation(value = "批量重试计划停电数据")
    public ApiResponse<Boolean> retryPlanPowerCutList(@RequestBody AcceptPlanPowerCutListDTO request) {
        boolean result = acceptPlanPowerCutService.reTryPlanPowerCutList(request);
        return ApiResponse.success(result);
    }


}
