|
@@ -1,56 +0,0 @@
|
|
|
-package com.metro.job;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.metro.utils.HttpClientUtil;
|
|
|
-import lombok.extern.log4j.Log4j2;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import java.time.LocalDateTime;
|
|
|
-
|
|
|
-/**
|
|
|
- * 健康码定时任务
|
|
|
- *
|
|
|
- * @author :lws
|
|
|
- * @date :2022/3/16 12:18
|
|
|
- */
|
|
|
-@Component
|
|
|
-@EnableScheduling
|
|
|
-@Log4j2
|
|
|
-@Slf4j
|
|
|
-public class HealthCodeTask {
|
|
|
-
|
|
|
- /**
|
|
|
- * 健康码-新冠疫苗接种-核酸检测3合1接口
|
|
|
- * 健康码检测定时任务
|
|
|
- */
|
|
|
- @Scheduled(cron = "0/5 * * * * ?")
|
|
|
- public void healthCode() {
|
|
|
-
|
|
|
- long begin = System.currentTimeMillis();
|
|
|
- String params = "{\"sfzh\": \"410322199907309877\",\"xm\": \"\"}";
|
|
|
- String result = HttpClientUtil.httpPostSetConfig("http://115.236.38.205:8903/id/hvn", params);
|
|
|
- if (StringUtils.isEmpty(result)) {
|
|
|
- long timeValue = System.currentTimeMillis() - begin;
|
|
|
- log.error("调用3合1接口调用失败,总耗时: {} 毫秒",timeValue);
|
|
|
- return;
|
|
|
- }
|
|
|
- JSONObject jsonObject = JSON.parseObject(result);
|
|
|
- if (jsonObject.get("error_code").equals("00")) {
|
|
|
- long timeValue = System.currentTimeMillis() - begin;
|
|
|
- } else {
|
|
|
- long timeValue = System.currentTimeMillis() - begin;
|
|
|
- log.error("调用核酸检测3合1接口失败!:返回结果为:{},总耗时:{} 毫秒", result,timeValue);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|