|
@@ -1,6 +1,7 @@
|
|
package com.boman.web.core.service;
|
|
package com.boman.web.core.service;
|
|
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.TypeReference;
|
|
import com.alibaba.fastjson.TypeReference;
|
|
@@ -20,6 +21,7 @@ import com.boman.system.api.RemoteDeptService;
|
|
import com.boman.system.api.RemoteUserService;
|
|
import com.boman.system.api.RemoteUserService;
|
|
import com.boman.web.core.domain.AccountingData;
|
|
import com.boman.web.core.domain.AccountingData;
|
|
import com.boman.web.core.domain.BirthRecords;
|
|
import com.boman.web.core.domain.BirthRecords;
|
|
|
|
+import com.boman.web.core.domain.TSampling514;
|
|
import com.boman.web.core.domain.vo.AccountingDataVo;
|
|
import com.boman.web.core.domain.vo.AccountingDataVo;
|
|
import com.boman.web.core.mapper.CzrkMapper;
|
|
import com.boman.web.core.mapper.CzrkMapper;
|
|
import com.boman.web.core.mapper.GridInfoMapper;
|
|
import com.boman.web.core.mapper.GridInfoMapper;
|
|
@@ -589,18 +591,21 @@ public class TaskService {
|
|
/**
|
|
/**
|
|
* 抓取核酸数据每10分钟抓取一次,新增到accounting_data
|
|
* 抓取核酸数据每10分钟抓取一次,新增到accounting_data
|
|
*/
|
|
*/
|
|
- @Scheduled(cron = "0 0/10 * * * ? ")
|
|
|
|
|
|
+ //@Scheduled(cron = "0 0/10 * * * ? ")
|
|
public void insertAccountingData() {
|
|
public void insertAccountingData() {
|
|
String token = getToken();
|
|
String token = getToken();
|
|
if (StringUtils.isNotBlank(token)) {
|
|
if (StringUtils.isNotBlank(token)) {
|
|
- //String startTime = "2022-05-14%2010:00:59";
|
|
|
|
String startTime = "2022-05-14 00:00:00.0";
|
|
String startTime = "2022-05-14 00:00:00.0";
|
|
//去数据库取最新的一条数据
|
|
//去数据库取最新的一条数据
|
|
AccountingDataVo accountingData = accountingDataService.getAccountingDataOne();
|
|
AccountingDataVo accountingData = accountingDataService.getAccountingDataOne();
|
|
- if(accountingData != null){
|
|
|
|
|
|
+ if (accountingData != null) {
|
|
startTime = accountingData.getCjsj();
|
|
startTime = accountingData.getCjsj();
|
|
|
|
+ Date parse = DateUtil.parse(startTime);
|
|
|
|
+ Date parseNew = DateUtil.offsetSecond(parse, 1);
|
|
|
|
+ startTime = DateUtil.format(parseNew, "yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
}
|
|
//String startTime = redisService.getCacheObject("startTime");
|
|
//String startTime = redisService.getCacheObject("startTime");
|
|
|
|
+ //String startTime = "2022-05-14 10:47:00.0";
|
|
Map<String, String> paramMap = new HashMap<>();
|
|
Map<String, String> paramMap = new HashMap<>();
|
|
paramMap.put("client_id", "acdf50bd13be4901b64c62b1fee862c0");
|
|
paramMap.put("client_id", "acdf50bd13be4901b64c62b1fee862c0");
|
|
paramMap.put("access_token", token);
|
|
paramMap.put("access_token", token);
|
|
@@ -622,11 +627,12 @@ public class TaskService {
|
|
String http = "http://60.171.171.235:9090/service/api/wjw/qshssjsjc";
|
|
String http = "http://60.171.171.235:9090/service/api/wjw/qshssjsjc";
|
|
try {
|
|
try {
|
|
String data = HttpClientUtils.doGet(http, paramMap);
|
|
String data = HttpClientUtils.doGet(http, paramMap);
|
|
|
|
+
|
|
if (StringUtils.isNotBlank(data)) {
|
|
if (StringUtils.isNotBlank(data)) {
|
|
List<AccountingData> list = JSONObject.parseArray(data, AccountingData.class);
|
|
List<AccountingData> list = JSONObject.parseArray(data, AccountingData.class);
|
|
if (list != null && list.size() > 0) {
|
|
if (list != null && list.size() > 0) {
|
|
//插入数据
|
|
//插入数据
|
|
- accountingDataService.insertAccountingData(list);
|
|
|
|
|
|
+ accountingDataService.insertAccountingData(list, accountingData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
@@ -635,6 +641,51 @@ public class TaskService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /***
|
|
|
|
+ * 匹配核酸和户籍数据
|
|
|
|
+ */
|
|
|
|
+ public void pphshj() {
|
|
|
|
+ //String startTime = "2022-05-14 00:00:00.0";
|
|
|
|
+ String startTime = redisService.getCacheObject("startTime");
|
|
|
|
+ if (StringUtils.isBlank(startTime)) {
|
|
|
|
+ startTime = "2022-05-14 00:00:00.0";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Date parse = DateUtil.parse(startTime);
|
|
|
|
+ Date parseNew = DateUtil.offsetSecond(parse, 300);
|
|
|
|
+ String endTime = DateUtil.format(parseNew, "yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ redisService.setCacheObject("startTime", endTime);
|
|
|
|
+
|
|
|
|
+ System.out.println("batchInsert 查询数据开始========");
|
|
|
|
+ long start1 = System.currentTimeMillis();
|
|
|
|
+ //获取所有核酸数据源
|
|
|
|
+ List<TSampling514> TSampling514List = accountingDataService.getTSampling514AllData(startTime,endTime);
|
|
|
|
+ //获取所有户籍数据
|
|
|
|
+ //List<Czrk> czrks = czrkMapper.listByCzrk(new Czrk());
|
|
|
|
+
|
|
|
|
+ long end1 = System.currentTimeMillis();
|
|
|
|
+ System.out.println("---------------查询数据耗时" + (end1 - start1) + "---------------");
|
|
|
|
+
|
|
|
|
+ //List<Czrk> czrkList = new ArrayList<>();
|
|
|
|
+ System.out.println("batchInsert 循环数据开始========");
|
|
|
|
+ long start2 = System.currentTimeMillis();
|
|
|
|
+ for (TSampling514 tSampling514 : TSampling514List) {
|
|
|
|
+ if(tSampling514.getCollectTime() != null){
|
|
|
|
+ Czrk czrk = new Czrk();
|
|
|
|
+ czrk.setNucleicAcidTime(String.valueOf(tSampling514.getCollectTime()));
|
|
|
|
+ czrk.setIdCard(tSampling514.getIdCard());
|
|
|
|
+ czrkMapper.updateCzrkByNucleicAcid(czrk);
|
|
|
|
+ //czrkList.add(czrk);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ long end2 = System.currentTimeMillis();
|
|
|
|
+ System.out.println("---------------循环数据耗时"+(end2 -start2)+"---------------");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
/***
|
|
/***
|
|
* 核酸统计
|
|
* 核酸统计
|
|
*/
|
|
*/
|