|
|
@ -11,7 +11,6 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.distributedlock.DistributedLock; |
|
|
|
import com.epmet.commons.tools.dto.form.PageFormDTO; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.dto.result.YtDataSyncResDTO; |
|
|
|
import com.epmet.commons.tools.dto.result.YtHscyResDTO; |
|
|
|
import com.epmet.commons.tools.dto.result.YtHsjcResDTO; |
|
|
@ -21,7 +20,6 @@ import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
@ -32,9 +30,11 @@ 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.dto.DataSyncConfigDTO; |
|
|
|
import com.epmet.dto.DataSyncRecordDeathDTO; |
|
|
|
import com.epmet.dto.DataSyncRecordDisabilityDTO; |
|
|
|
import com.epmet.dto.YTVaccineListDTO; |
|
|
|
import com.epmet.dto.form.ConfigSwitchFormDTO; |
|
|
|
import com.epmet.dto.form.DataSyncTaskParam; |
|
|
|
import com.epmet.dto.form.ScopeSaveFormDTO; |
|
|
@ -48,7 +48,6 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.ListUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.redisson.api.RLock; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.jdbc.core.JdbcTemplate; |
|
|
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; |
|
|
@ -59,7 +58,6 @@ import javax.annotation.Resource; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.CountDownLatch; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -95,6 +93,12 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
|
private IcSyncJobDao icSyncJobDao; |
|
|
|
@Autowired |
|
|
|
private DistributedLock distributedLock; |
|
|
|
@Autowired |
|
|
|
private IcVaccineService icVaccineService; |
|
|
|
@Autowired |
|
|
|
private IcVaccineRelationService icVaccineRelationService; |
|
|
|
@Autowired |
|
|
|
private IcVaccineDao icVaccineDao; |
|
|
|
|
|
|
|
@Resource(name = "yantaiNamedParamLantuJdbcTemplate") |
|
|
|
private NamedParameterJdbcTemplate yantaiNamedParamLantuJdbcTemplate; |
|
|
@ -1065,15 +1069,69 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
|
Map<String, Object> args = new HashMap<>(); |
|
|
|
args.put("idcards", idCards); |
|
|
|
// todo 疫苗接种视图
|
|
|
|
|
|
|
|
List<Map<String, Object>> vaccineList = yantaiNamedParamLantuJdbcTemplate.queryForList( |
|
|
|
"select id, name,card_no, create_time from hscyxxb where card_no in (:idcards)", args); |
|
|
|
String json = "[\n" + |
|
|
|
"{\n" + |
|
|
|
"\t\"idCard\":\"370785195001012558\",\n" + |
|
|
|
"\t\"inoculateDate\":\"2023-01-01 10:01\",\n" + |
|
|
|
"\t\"lastStationName\":\"北京\"\n" + |
|
|
|
"},\n" + |
|
|
|
"{\n" + |
|
|
|
"\t\"idCard\":\"370785195001012558\",\n" + |
|
|
|
"\t\"inoculateDate\":\"2022-01-01 10:01\",\n" + |
|
|
|
"\t\"lastStationName\":\"南京\"\n" + |
|
|
|
"}\n" + |
|
|
|
"]"; |
|
|
|
List<Map<String, Object>> vaccineList = new ArrayList<>();/*yantaiNamedParamLantuJdbcTemplate.queryForList( |
|
|
|
"select id, name,card_no, create_time from hscyxxb where card_no in (:idcards)", args);*/ |
|
|
|
Map<String, Object> m = new HashMap<>(); |
|
|
|
vaccineList.add(m); |
|
|
|
if (CollectionUtils.isNotEmpty(vaccineList)) { |
|
|
|
List<IcVaccineEntity> entities = new ArrayList<>(); |
|
|
|
vaccineList.forEach(resiVaccineInfo -> { |
|
|
|
// 从视图中获取到的疫苗接种相关信息
|
|
|
|
|
|
|
|
// List<YTVaccineListDTO> ytVaccineListDTOS = ConvertUtils.sourceToTarget(vaccineList, YTVaccineListDTO.class);
|
|
|
|
List<YTVaccineListDTO> ytVaccineListDTOS = JSON.parseArray(json,YTVaccineListDTO.class); |
|
|
|
List<YTVaccineListDTO> existVaccine = icVaccineDao.getExistVaccine(ytVaccineListDTOS); |
|
|
|
if (CollectionUtils.isNotEmpty(existVaccine)){ |
|
|
|
for (YTVaccineListDTO e : existVaccine) { |
|
|
|
for (int i = 0; i < ytVaccineListDTOS.size(); i++) { |
|
|
|
if (ytVaccineListDTOS.get(i).getIdCard().equals(e.getIdCard()) && ytVaccineListDTOS.get(i).getInoculateDate().equals(e.getInoculateDate())){ |
|
|
|
ytVaccineListDTOS.remove(i); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (CollectionUtils.isNotEmpty(ytVaccineListDTOS)){ |
|
|
|
ytVaccineListDTOS.forEach(v -> { |
|
|
|
resiInfos.forEach(u -> { |
|
|
|
if (v.getIdCard().equals(u.getIdCard())){ |
|
|
|
IcVaccineEntity e = new IcVaccineEntity(); |
|
|
|
e.setCustomerId(customerId); |
|
|
|
e.setName(u.getName()); |
|
|
|
e.setMobile(u.getMobile()); |
|
|
|
e.setIdCard(u.getIdCard()); |
|
|
|
e.setIsResiUser(StringUtils.isBlank(u.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); |
|
|
|
e.setUserId(StringUtils.isBlank(u.getUserId()) ? "" : u.getUserId()); |
|
|
|
e.setUserType("ytPull"); |
|
|
|
e.setInoculateTime(DateUtils.parseDate(v.getInoculateDate(),DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE)); |
|
|
|
e.setInoculateAddress(v.getLastStationName()); |
|
|
|
e.setAgencyId(u.getAgencyId()); |
|
|
|
e.setPids(u.getPids()); |
|
|
|
entities.add(e); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
icVaccineService.insertBatch(entities); |
|
|
|
List<IcVaccineRelationEntity> relationEntities = new ArrayList<>(); |
|
|
|
entities.forEach(e -> { |
|
|
|
IcVaccineRelationEntity re = new IcVaccineRelationEntity(); |
|
|
|
re.setIcVaccineId(e.getAgencyId()); |
|
|
|
re.setPids(e.getPids()); |
|
|
|
re.setCustomerId(customerId); |
|
|
|
re.setUserType("ytPull"); |
|
|
|
re.setAgencyId(e.getAgencyId()); |
|
|
|
relationEntities.add(re); |
|
|
|
}); |
|
|
|
icVaccineRelationService.insertBatch(relationEntities); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|