package com.mosty.lzother.controller;

import com.alibaba.fastjson.JSONObject;
import com.mosty.base.utils.OkHttpUtils;
import com.mosty.common.base.domain.BaseController;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.redis.service.RedisService;
import com.mosty.common.token.JwtSysUser;
import com.mosty.lzother.service.VLz110TxjService;
import com.mosty.lzother.task.SyncJqTask;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;


@RestController
@AllArgsConstructor
@RequestMapping(value = "lzJq")
@Api(tags = {"泸州特巡警警情110对象接口"})
public class VLz110TxjController extends BaseController {

    private final VLz110TxjService vLz110TxjService;
    private final RedisService redisService;

    @GetMapping(value = "/syncHndJq")
    @ApiOperation("同步警情110数据")
    public ResponseResult<Void> syncHndJq(String time) {
        this.vLz110TxjService.syncHndJq(time);
        return ResponseResult.success();
    }

    @GetMapping(value = "/syncJqCjd")
    @ApiOperation("处警警情")
    public ResponseResult<Void> syncJqCjd(String time) {
        this.vLz110TxjService.syncJqCjd(time);
        return ResponseResult.success();
    }

    @GetMapping(value = "/autoTime")
    @ApiOperation("启动或者停止警情定时器")
    public ResponseResult<Boolean> autoTime() {
        SyncJqTask.start = !SyncJqTask.start;
        return ResponseResult.success(SyncJqTask.start);
    }

    @GetMapping(value = "/autoTimeXzjq")
    @ApiOperation("启动或者停止修正警情定时器")
    public ResponseResult<Boolean> autoTimeXzjq() {
        SyncJqTask.jqxz = !SyncJqTask.jqxz;
        return ResponseResult.success(SyncJqTask.jqxz);
    }

    public static void main(String[] args) {

        for (int i = 0; i < 10000; i++) {
            int finalI = i;
            Runnable runnable = () -> {
                System.out.println(finalI);
            };
            new Thread(runnable).start();

        }


    }
}