package com.example.demo.handler; import com.example.demo.utils.JsonUtils; import com.example.demo.utils.RestTemplateUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import xyz.erupt.job.handler.EruptJobHandler; @Component public class DataSyncJob implements EruptJobHandler { @Autowired private RestTemplate restTemplate; @Value("${gis.syncurl}") private String syncurl; @Override public String exec(String code, String param) { System.out.println("------------exec code:"+code+",param:"+param+"----------"); String joburl = syncurl + "?bid="+code+JsonUtils.parseJsonStr(param); RestTemplateUtil.getDataByRestTemplate(joburl, restTemplate); return null; } @Override public void success(String result, String param) { System.out.println("------------exec success result:"+result+",param:"+param+"----------"); } @Override public void error(Throwable throwable, String param) { System.out.println("------------exec error:"+throwable.getMessage()+",param:"+param+"----------"); } }