| | |
| | | import com.moral.util.HttpUtils; |
| | | import com.moral.util.WxMappingJackson2HttpMessageConverter; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.apache.http.HttpResponse; |
| | |
| | | @Resource |
| | | private AQIService aqiService; |
| | | @XxlJob("insertData") |
| | | public void insertData(){ |
| | | public ReturnT insertData(){ |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | restTemplate.getMessageConverters().add(new WxMappingJackson2HttpMessageConverter()); |
| | |
| | | JSONObject json = JSON.parseObject(entity); |
| | | data = (Map<String, Object>) json.get("data"); |
| | | if (!ObjectUtils.isEmpty(data)) { |
| | | values = data.values(); |
| | | pubtime = format.parse(data.get("pubtime").toString()); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | } |
| | | ReturnT returnT = new ReturnT(500, "插入数据成功!"); |
| | | return returnT; |
| | | } |
| | | |
| | | } |