package com.hzjt.controller;

import com.hzjt.domain.ResultObj;
import com.hzjt.service.TraffdevicewriteresultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/traffdevicewriteresult")
public class TraffdevicewriteresultController {
    @Autowired
    private TraffdevicewriteresultService traffdevicewriteresultService;


    /**
     * 发送设备指纹指令
     * @param xhs
     * @return
     */
    @PostMapping("/sendDevices")
    public List<ResultObj> sendDevices(@RequestParam("xhs") String  xhs){

            return traffdevicewriteresultService.sendDevices( Arrays.asList(xhs.split(",")));
    }


    @GetMapping("/sendDevices")
    public List<ResultObj> sendEventsByids(){
        List<String> recordid=new ArrayList<>();
        recordid.add("5988892e-1dcf-4925-85a7-918e2b101040");
        recordid.add("5c606b11-aab4-441e-90c3-70bc26f10733");
        return traffdevicewriteresultService.sendDevices(recordid);
    }

    @RequestMapping("/registall")
    public ResultObj registall(HttpServletResponse response) {
        return traffdevicewriteresultService.registall(response);
    }

}