|
|
@ -28,10 +28,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.YtHsResUtils; |
|
|
|
import com.epmet.constant.EpidemicConstant; |
|
|
|
import com.epmet.dao.DataSyncConfigDao; |
|
|
|
import com.epmet.dao.IcNatDao; |
|
|
|
import com.epmet.dao.IcSyncJobDao; |
|
|
|
import com.epmet.dao.IcVaccineDao; |
|
|
|
import com.epmet.dao.*; |
|
|
|
import com.epmet.dto.DataSyncConfigDTO; |
|
|
|
import com.epmet.dto.DataSyncRecordDeathDTO; |
|
|
|
import com.epmet.dto.DataSyncRecordDisabilityDTO; |
|
|
@ -105,6 +102,10 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
|
private IcVaccineRelationService icVaccineRelationService; |
|
|
|
@Autowired |
|
|
|
private IcVaccineDao icVaccineDao; |
|
|
|
@Autowired |
|
|
|
private IcTripReportRecordService icTripReportRecordService; |
|
|
|
@Autowired |
|
|
|
private IcTripReportRecordDao icTripReportRecordDao; |
|
|
|
|
|
|
|
@Resource(name = "yantaiNamedParamLantuJdbcTemplate") |
|
|
|
private NamedParameterJdbcTemplate yantaiNamedParamLantuJdbcTemplate; |
|
|
@ -1051,6 +1052,10 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
|
case JOB_TYPE_VACCINE: |
|
|
|
yanTaiVaccineByDbViewPartition(resiBatch, customerId, isSync); |
|
|
|
break; |
|
|
|
// 行程上报
|
|
|
|
case JOB_TYPE_TRIP_REPORT: |
|
|
|
yanTaiTripReportByDbViewPartition(resiBatch, customerId, isSync); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
@ -1061,6 +1066,87 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 行程上报信息拉取处理 |
|
|
|
* @param resiInfos |
|
|
|
* @param customerId |
|
|
|
* @param isSync |
|
|
|
* @Author zxc |
|
|
|
* @Date 2022/11/22 14:27 |
|
|
|
*/ |
|
|
|
public void yanTaiTripReportByDbViewPartition(List<NatUserInfoResultDTO> resiInfos, String customerId, String isSync){ |
|
|
|
// 将居民信息转化为<idCard,resiInfo>的map
|
|
|
|
Map<String, NatUserInfoResultDTO> idCardAndResiInfoMap = resiInfos.stream().collect(Collectors.toMap(resi -> resi.getIdCard(), Function.identity())); |
|
|
|
List<String> idCards = new ArrayList<>(idCardAndResiInfoMap.keySet()); |
|
|
|
Map<String, Object> args = new HashMap<>(); |
|
|
|
args.put("idcards", idCards); |
|
|
|
List<Map<String,Object>> tripReportList = yantaiNamedParamLantuJdbcTemplate.queryForList( |
|
|
|
"select card_id as idCard, address as presentAddress, i_flag, i_time, i_type, i_date,i_id, travel_code_abnormal, health_code_abnormal, twon_name, county_name, city_name, province_name,\n" + |
|
|
|
"carry_hesuan_proof, leave_the_risk_area_time, come_area_full, report_street, arrive_time, shift, come_mode, covid_flag, sex, age,\n" + |
|
|
|
"area, card_type, invalid_time, travel_code_img, arrive_lu_time, destination_station, carry_vehicle_number_color, carry_vehicle_number,\n" + |
|
|
|
"carry_vehicle, registered_residence_address, registered_residence_city, travel_personnel, via_county, via_city, via_province,\n" + |
|
|
|
"nonlocal_residence_history, declaration_status, two_code_one_report_status, detection_abnormal, from t_ymjz_info where cardno in (:idcards)", args); |
|
|
|
if (CollectionUtils.isNotEmpty(tripReportList)){ |
|
|
|
List<List<Map<String, Object>>> partition = ListUtils.partition(tripReportList, NumConstant.ONE_HUNDRED); |
|
|
|
partition.forEach(p -> { |
|
|
|
// 要更新的
|
|
|
|
List<IcTripReportRecordEntity> needUpdate = new ArrayList<>(); |
|
|
|
// 要新增的
|
|
|
|
List<IcTripReportRecordEntity> entities = ConvertUtils.sourceToTarget(p, IcTripReportRecordEntity.class); |
|
|
|
// 数据库存在的
|
|
|
|
List<String> existsTripReport = icTripReportRecordDao.getExistsTripReport(idCards); |
|
|
|
if (CollectionUtils.isNotEmpty(existsTripReport)){ |
|
|
|
// 要更新的
|
|
|
|
existsTripReport.forEach(etr -> entities.stream().filter(e -> e.getIId().equals(etr)).forEach(e -> { |
|
|
|
needUpdate.add(e); |
|
|
|
})); |
|
|
|
// 要新增的
|
|
|
|
existsTripReport.forEach(etr -> { |
|
|
|
Iterator<IcTripReportRecordEntity> iterator = entities.iterator(); |
|
|
|
while (iterator.hasNext()){ |
|
|
|
IcTripReportRecordEntity next = iterator.next(); |
|
|
|
if (next.getIId().equals(etr)){ |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
if (CollectionUtils.isNotEmpty(entities)){ |
|
|
|
entities.forEach(e -> { |
|
|
|
|
|
|
|
}); |
|
|
|
entities.forEach(e -> resiInfos.stream().filter(r ->r.getIdCard().equals(e.getIdCard())).forEach(r -> { |
|
|
|
e.setGridId(r.getGridId()); |
|
|
|
e.setCustomerId(r.getCustomerId()); |
|
|
|
e.setAgencyId(r.getAgencyId()); |
|
|
|
e.setPids(r.getPids()); |
|
|
|
e.setName(r.getName()); |
|
|
|
e.setMobile(r.getMobile()); |
|
|
|
e.setUserId(r.getUserId()); |
|
|
|
e.setUserType("ytPull"); |
|
|
|
|
|
|
|
|
|
|
|
})); |
|
|
|
icTripReportRecordService.insertBatch(entities); |
|
|
|
} |
|
|
|
if (CollectionUtils.isNotEmpty(needUpdate)){ |
|
|
|
// 因为更新字段较多,所以分批操作
|
|
|
|
List<List<IcTripReportRecordEntity>> needs = ListUtils.partition(needUpdate, NumConstant.TWENTY); |
|
|
|
needs.forEach(n -> { |
|
|
|
updateTripReportList(n); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}else { |
|
|
|
log.warn("未拉取到行程上报信息!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateTripReportList(List<IcTripReportRecordEntity> need){ |
|
|
|
icTripReportRecordDao.updateTripReportList(need); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 疫苗接种信息处理 |
|
|
|
* @param resiInfos |
|
|
@ -1076,38 +1162,6 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
|
// 1.获取核酸采样信息
|
|
|
|
Map<String, Object> args = new HashMap<>(); |
|
|
|
args.put("idcards", idCards); |
|
|
|
// todo 疫苗接种视图
|
|
|
|
String json = "[\n" + |
|
|
|
" {\n" + |
|
|
|
" \"id\": \"751956862490071040\",\n" + |
|
|
|
" \"cardno\": \"370785195001012558\",\n" + |
|
|
|
" \"name\": \"李国玺\",\n" + |
|
|
|
" \"data\":\n" + |
|
|
|
" {\n" + |
|
|
|
" \"vaccineList\":\n" + |
|
|
|
" [\n" + |
|
|
|
" {\n" + |
|
|
|
" \"vaccineCount\": \"1\",\n" + |
|
|
|
" \"inoculateDate\": \"2021-04-24 16:02:46\",\n" + |
|
|
|
" \"lastStationName\": \"烟台市只楚医院临时接种点\"\n" + |
|
|
|
" },\n" + |
|
|
|
" {\n" + |
|
|
|
" \"vaccineCount\": \"2\",\n" + |
|
|
|
" \"inoculateDate\": \"2021-06-10 16:20:30\",\n" + |
|
|
|
" \"lastStationName\": \"烟台市芝罘岛医院临时接种点\"\n" + |
|
|
|
" },\n" + |
|
|
|
" {\n" + |
|
|
|
" \"vaccineCount\": \"3\",\n" + |
|
|
|
" \"inoculateDate\": \"2021-12-10 15:12:24\",\n" + |
|
|
|
" \"lastStationName\": \"烟台市芝罘岛医院临时接种点\"\n" + |
|
|
|
" }\n" + |
|
|
|
" ],\n" + |
|
|
|
" \"flag\": 1\n" + |
|
|
|
" },\n" + |
|
|
|
" \"vaccineCount\": 3\n" + |
|
|
|
" }\n" + |
|
|
|
"]"; |
|
|
|
// List<Map> vaccineList = JSON.parseArray(json,Map.class);
|
|
|
|
List<Map<String,Object>> vaccineList = yantaiNamedParamLantuJdbcTemplate.queryForList( |
|
|
|
"select data, name, cardno, vaccineCount from t_ymjz_info where cardno in (:idcards)", args); |
|
|
|
List<YTVaccineListDTO> ytVaccineListFromApi = new ArrayList<>(); |
|
|
@ -1129,15 +1183,6 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
|
}); |
|
|
|
ytVaccineListFromApi.addAll(vaccineList1); |
|
|
|
} |
|
|
|
|
|
|
|
//Map<String, Object> data = (Map<String, Object>) v.get("data");
|
|
|
|
//if (data.containsKey("vaccineList")){
|
|
|
|
// List<YTVaccineListDTO> vaccineList1 = JSON.parseArray(data.get("vaccineList").toString(), YTVaccineListDTO.class);
|
|
|
|
// vaccineList1.forEach(v1 -> {
|
|
|
|
// v1.setCardno(v.get("cardno").toString());
|
|
|
|
// });
|
|
|
|
// ytVaccineListDTOS.addAll(vaccineList1);
|
|
|
|
//}
|
|
|
|
} |
|
|
|
}); |
|
|
|
List<IcVaccineEntity> entities = new ArrayList<>(); |
|
|
@ -1157,16 +1202,6 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//for (int i = 0; i < ytVaccineListFromApi.size(); i++) {
|
|
|
|
// String inoculateDateFromApi = ytVaccineListFromApi.get(i).getInoculateDate();
|
|
|
|
// Matcher matcher = VACCINE_DATE_OF_API_PATTERN.matcher(inoculateDateFromApi);
|
|
|
|
// if (ytVaccineListFromApi.get(i).getCardno().equals(e.getCardno())
|
|
|
|
// && matcher.matches()
|
|
|
|
// && matcher.group(1).equals(e.getInoculateDate())){
|
|
|
|
// ytVaccineListFromApi.remove(i);
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
} |
|
|
|
} |
|
|
|
if (CollectionUtils.isNotEmpty(ytVaccineListFromApi)){ |
|
|
|