package com.zhgd.xmgl.task; import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.zhgd.xmgl.util.ThirdPartRequestUtil; import lombok.extern.log4j.Log4j; import net.javacrumbs.shedlock.core.SchedulerLock; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Objects; /** * 水稳拌合站任务 */ @Log4j @Component public class StableWaterMixStationTask { @Autowired ThirdPartRequestUtil thirdPartRequestUtil; /** * 定时拉取广联达的搅拌站数据,https://xmgl.glodon.com/wl/docs/third_help/part2/openapi/pull/mixTotal.html */ @Scheduled(cron = "0 2 0 * * ?") @SchedulerLock(name = "executeStableWaterMixStationTask", lockAtMostFor = 1000 * 60 * 2, lockAtLeastFor = 1000 * 60 * 1) public void executeTask() { log.info("定时拉取广联达的搅拌站数据任务开始"); //String url = "/api/mix/v1.0/mix/product/getMachineProductList?projectId=1460369&beginTimestamp=20170710101010000"; //String rs = thirdPartRequestUtil.get(url); //JSONObject jo = JSON.parseObject(rs); //if (Objects.equals(jo.getBoolean("success"), true)) { // BeanUtil.copyProperties(); //} } }