package com.example.demo.handler;
|
|
import com.alibaba.fastjson.JSONObject;
|
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;
|
|
import java.time.LocalDateTime;
|
import java.time.format.DateTimeFormatter;
|
|
@Component
|
public class DataDealJob implements EruptJobHandler {
|
|
@Autowired
|
private RestTemplate restTemplate;
|
|
@Value("${gis.staturl}")
|
private String staturl;
|
|
@Override
|
public String exec(String code, String param) {
|
System.out.println("------------exec code:"+code+",param:"+param+"----------");
|
String joburl = staturl + "?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+"----------");
|
}
|
}
|