package com.mosty.lzother.task;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.mosty.lzother.service.VLz110TxjService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author dw
 * @since 2022/12/15
 * 同步特巡警110警情数据
 **/
@Slf4j
@Component
@AllArgsConstructor
public class SyncJqTask {

    private final VLz110TxjService vLz110TxjService;
    public static boolean start = true;
    public static boolean jqxz = true;

    @Scheduled(cron = "0/30 * * * * *")
    @Transactional
    public void run() {
        if (start) {
            log.info("同步特巡警110警情数据");
            this.vLz110TxjService.syncHndJq(null);
            this.vLz110TxjService.syncJqCjd(null);
            log.info("同步特巡警110警情数据--->结束");
        }
    }

    //两分钟分钟分钟修正一次经纬度
    @Scheduled(cron = "0 */20 * * * ?")
    @Transactional
    public void selectJjdbh() {
        if (jqxz) {
            log.info("修改经纬度");
            this.vLz110TxjService.selectJjdbh();
            log.info("修改经纬度--->结束");
        }
    }
}
