| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -12,6 +12,7 @@ import com.epmet.commons.tools.dto.result.YtHscyResDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.dto.result.YtHsjcResDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.enums.GenderEnum; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					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.bean.AgencyInfoCache; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -39,12 +40,15 @@ import org.apache.commons.collections4.CollectionUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.collections4.ListUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.jdbc.core.JdbcTemplate; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import javax.annotation.Resource; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.concurrent.CountDownLatch; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.concurrent.ExecutorService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.function.Function; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -72,6 +76,9 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ExecutorService executorService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Resource(name = "yantaiLantuJdbcTemplate") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private JdbcTemplate yantaiJdbcTemplate; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public DataSyncConfigDTO get(String id) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        DataSyncConfigEntity entity = baseDao.selectById(id); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -766,4 +773,69 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return this; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 烟台核酸检测(视图方式获取数据) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param resiInfos | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param customerId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param isSync | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void yantaiHsjcByDbView(List<NatUserInfoResultDTO> resiInfos, String customerId, String isSync) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<List<NatUserInfoResultDTO>> resiInfobatchs = ListUtils.partition(resiInfos, 50); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for (List<NatUserInfoResultDTO> resibatch : resiInfobatchs) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 50个一批,来处理他们的核酸信息,太多怕给数据库查崩了。
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            yantaiHsjcByDbViewBatch(resibatch, customerId, isSync); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 50个一批,来处理他们的核酸信息,太多怕给数据库查崩了。 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param resiInfos | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param customerId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param isSync | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void yantaiHsjcByDbViewBatch(List<NatUserInfoResultDTO> resiInfos, String customerId, String isSync) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 将居民信息转化为<idCard,resiInfo>的map
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, NatUserInfoResultDTO> idCardAndResiInfo = resiInfos.stream().collect(Collectors.toMap(resi -> resi.getIdCard(), Function.identity())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> idCards = idCardAndResiInfo.keySet();//resiInfos.stream().map(resi -> resi.getIdCard()).collect(Collectors.toList());
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // String idCardsStr = "''" + String.join("','", idCards) + "''";
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 1.获取核酸采样信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String sql = "select id, name,card_no, create_time, realname from hscyxxb where card_no in (:idCards) order by create_time desc"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        HashMap<String, Object> args = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        args.put("idCards", idCards); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 这一批居民的核酸采样列表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<Map<String, Object>> hscyList = yantaiJdbcTemplate.queryForList(sql, args); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isNotEmpty(hscyList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcNatEntity> entities = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            hscyList.forEach(sampleInfo -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 从视图中获取到的核酸采样相关信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                String name = (String) sampleInfo.get("name"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                String cardNo = (String) sampleInfo.get("card_no"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Date createTime = (Date) sampleInfo.get("create_time"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 本地数据库中,居民信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                NatUserInfoResultDTO currentResiInfo = idCardAndResiInfo.get(cardNo); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                IcNatEntity e = new IcNatEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setCustomerId(customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setIsResiUser(StringUtils.isBlank(currentResiInfo.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setUserId(currentResiInfo.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setMobile(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setName(StringUtils.isNotBlank(name) ? name : ""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setIdCard(StringUtils.isNotBlank(cardNo) ? cardNo : ""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setSampleTime(createTime); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // e.setSampleTime(DateUtils.parseDate(createTime, DateUtils.DATE_TIME_PATTERN));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setAgencyId(currentResiInfo.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setPids(currentResiInfo.getPids()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setAttachmentType(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                e.setAttachmentUrl(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                entities.add(e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (CollectionUtils.isNotEmpty(entities)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<NatUserInfoResultDTO> existSampleInfo = icNatDao.getExistNatInfo(entities); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                sampleAndNat(existSampleInfo,entities,NumConstant.ONE_STR,customerId,isSync); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |