|
|
@ -14,8 +14,10 @@ import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
import com.elink.esua.epdc.vaccine.common.base.BaseVimCurdServiceImpl; |
|
|
import com.elink.esua.epdc.vaccine.common.base.BaseVimCurdServiceImpl; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.constant.StrConstant; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.constant.StrConstant; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInfoDao; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInfoDao; |
|
|
|
|
|
import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInoutRecordDao; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.dto.EpidemicUserInfoDTO; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.dto.EpidemicUserInfoDTO; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity; |
|
|
|
|
|
import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInoutRecordEntity; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicUserInfoService; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicUserInfoService; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.utils.StreamUtils; |
|
|
import com.elink.esua.epdc.vaccine.epidemic.utils.StreamUtils; |
|
|
import com.elink.esua.epdc.vaccine.vim.dao.VaccinationErrorDao; |
|
|
import com.elink.esua.epdc.vaccine.vim.dao.VaccinationErrorDao; |
|
|
@ -26,7 +28,10 @@ import com.elink.esua.epdc.vaccine.vim.dto.result.VaccineDto; |
|
|
import com.elink.esua.epdc.vaccine.vim.entity.VaccinationErrorEntity; |
|
|
import com.elink.esua.epdc.vaccine.vim.entity.VaccinationErrorEntity; |
|
|
import com.elink.esua.epdc.vaccine.vim.entity.VaccinationInfoEntity; |
|
|
import com.elink.esua.epdc.vaccine.vim.entity.VaccinationInfoEntity; |
|
|
import com.elink.esua.epdc.vaccine.vim.excel.VaccinationInfoAllExcel; |
|
|
import com.elink.esua.epdc.vaccine.vim.excel.VaccinationInfoAllExcel; |
|
|
import com.elink.esua.epdc.vaccine.vim.service.*; |
|
|
import com.elink.esua.epdc.vaccine.vim.service.VaccinationErrorService; |
|
|
|
|
|
import com.elink.esua.epdc.vaccine.vim.service.VaccinationInfoService; |
|
|
|
|
|
import com.elink.esua.epdc.vaccine.vim.service.VaccinationSiteService; |
|
|
|
|
|
import com.elink.esua.epdc.vaccine.vim.service.VaccineCompanyService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -36,10 +41,7 @@ import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.io.File; |
|
|
import java.io.File; |
|
|
import java.util.ArrayList; |
|
|
import java.util.*; |
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -64,6 +66,8 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati |
|
|
private VaccinationErrorDao vaccinationErrorDao; |
|
|
private VaccinationErrorDao vaccinationErrorDao; |
|
|
@Resource |
|
|
@Resource |
|
|
private EpidemicUserInfoDao epidemicUserInfoDao; |
|
|
private EpidemicUserInfoDao epidemicUserInfoDao; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private EpidemicUserInoutRecordDao epidemicUserInoutRecordDao; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public QueryWrapper<VaccinationInfoEntity> getWrapper(Map<String, Object> params) { |
|
|
public QueryWrapper<VaccinationInfoEntity> getWrapper(Map<String, Object> params) { |
|
|
@ -132,6 +136,28 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati |
|
|
return new Result(); |
|
|
return new Result(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result updateAddress() { |
|
|
|
|
|
// 剂次重复校验
|
|
|
|
|
|
List<VaccinationInfoEntity> entities = baseDao.checkEmptyAddress(); |
|
|
|
|
|
List<String> allUserIdCards = entities.stream().map(VaccinationInfoEntity::getIdentityNo).collect(Collectors.toList()); |
|
|
|
|
|
List<EpidemicUserInoutRecordEntity> addressList = epidemicUserInoutRecordDao.getAddressInfo(allUserIdCards); |
|
|
|
|
|
|
|
|
|
|
|
entities.forEach(entity -> { |
|
|
|
|
|
Optional<EpidemicUserInoutRecordEntity> addressOptional = addressList.stream().filter(address -> address.getIdCard().equals(entity.getIdentityNo())).findFirst(); |
|
|
|
|
|
if (addressOptional.isPresent()) { |
|
|
|
|
|
entity.setStreet(addressOptional.get().getLiveAddressName()); |
|
|
|
|
|
entity.setStreetId(addressOptional.get().getLiveAddressCode()); |
|
|
|
|
|
entity.setCommunity(addressOptional.get().getCommunity()); |
|
|
|
|
|
entity.setGrid(addressOptional.get().getGridName()); |
|
|
|
|
|
entity.setVillageName(addressOptional.get().getPlot()); |
|
|
|
|
|
baseDao.updateAddress(entity); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
log.info("已更新" + entities.size() + "条记录"); |
|
|
|
|
|
return new Result(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
|
public Result deleteNew(Long[] ids) { |
|
|
public Result deleteNew(Long[] ids) { |
|
|
@ -285,12 +311,17 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati |
|
|
log.info("循环结束,判断人员信息是否需要更新"); |
|
|
log.info("循环结束,判断人员信息是否需要更新"); |
|
|
|
|
|
|
|
|
List<String> idCards = new ArrayList<>(maxDoseMap.keySet()); |
|
|
List<String> idCards = new ArrayList<>(maxDoseMap.keySet()); |
|
|
|
|
|
List<VaccinationInfoEntity> insertUserList = new ArrayList<>(); |
|
|
List<EpidemicUserInfoDTO> updateList = new ArrayList<>(); |
|
|
List<EpidemicUserInfoDTO> updateList = new ArrayList<>(); |
|
|
|
|
|
List<VaccinationErrorEntity> insertErrorList = new ArrayList<>(); |
|
|
|
|
|
List<EpidemicUserInoutRecordEntity> addressList = new ArrayList<>(); |
|
|
EpidemicUserInfoDTO epidemicUserInfo; |
|
|
EpidemicUserInfoDTO epidemicUserInfo; |
|
|
String idCard; |
|
|
String idCard; |
|
|
|
|
|
|
|
|
if (!idCards.isEmpty()) { |
|
|
if (!idCards.isEmpty()) { |
|
|
List<EpidemicUserInfoDTO> existUserList = epidemicUserInfoDao.selectByIdCards(idCards); |
|
|
List<EpidemicUserInfoDTO> existUserList = epidemicUserInfoDao.selectByIdCards(idCards); |
|
|
|
|
|
addressList = epidemicUserInoutRecordDao.getAddressInfo(idCards); |
|
|
|
|
|
|
|
|
EpidemicUserInfoDTO updateDto; |
|
|
EpidemicUserInfoDTO updateDto; |
|
|
for (EpidemicUserInfoDTO item : existUserList) { |
|
|
for (EpidemicUserInfoDTO item : existUserList) { |
|
|
if (null == item) { |
|
|
if (null == item) { |
|
|
@ -318,27 +349,42 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
log.info("待处理人员数量为:" + idCards.size() + "||可用地址数量为" + addressList.size() + "||实际需要更新的人员信息数量为:" + updateList.size()); |
|
|
log.info("需要更新的人员信息数量为:" + updateList.size()); |
|
|
|
|
|
|
|
|
|
|
|
// 对历史数据根据身份证号进行逻辑删除
|
|
|
// 对历史数据根据身份证号进行逻辑删除
|
|
|
if (!deleteIdCardArr.isEmpty()) { |
|
|
if (!deleteIdCardArr.isEmpty()) { |
|
|
baseDao.deleteDistinctDose(deleteIdCardArr); |
|
|
baseDao.deleteDistinctDose(deleteIdCardArr); |
|
|
} |
|
|
} |
|
|
// 插入接种数据
|
|
|
// 插入接种数据
|
|
|
List<VaccinationInfoEntity> insertUserList = ConvertUtils.sourceToTarget(addList, VaccinationInfoEntity.class); |
|
|
if (!addList.isEmpty()) { |
|
|
insertBatch(insertUserList); |
|
|
insertUserList = ConvertUtils.sourceToTarget(addList, VaccinationInfoEntity.class); |
|
|
|
|
|
List<EpidemicUserInoutRecordEntity> finalAddressList = addressList; |
|
|
|
|
|
insertUserList.forEach(entity -> { |
|
|
|
|
|
Optional<EpidemicUserInoutRecordEntity> addressOptional = finalAddressList.stream().filter(address -> address.getIdCard().equals(entity.getIdentityNo())).findFirst(); |
|
|
|
|
|
if (addressOptional.isPresent()) { |
|
|
|
|
|
entity.setStreet(addressOptional.get().getLiveAddressName()); |
|
|
|
|
|
entity.setStreetId(addressOptional.get().getLiveAddressCode()); |
|
|
|
|
|
entity.setCommunity(addressOptional.get().getCommunity()); |
|
|
|
|
|
entity.setGrid(addressOptional.get().getGridName()); |
|
|
|
|
|
entity.setVillageName(addressOptional.get().getPlot()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
insertBatch(insertUserList); |
|
|
|
|
|
} |
|
|
// 更新人员的接种信息
|
|
|
// 更新人员的接种信息
|
|
|
for (EpidemicUserInfoDTO dto : updateList) { |
|
|
for (EpidemicUserInfoDTO dto : updateList) { |
|
|
epidemicUserInfoDao.updateVaccinationInfo(dto); |
|
|
epidemicUserInfoDao.updateVaccinationInfo(dto); |
|
|
} |
|
|
} |
|
|
// 批量插入错误数据
|
|
|
// 批量插入错误数据
|
|
|
List<VaccinationErrorEntity> insertErrorList = ConvertUtils.sourceToTarget(addErrorList, VaccinationErrorEntity.class); |
|
|
if (!addErrorList.isEmpty()) { |
|
|
Integer insertNo = vaccinationErrorDao.getMaxInsertNo(); |
|
|
insertErrorList = ConvertUtils.sourceToTarget(addErrorList, VaccinationErrorEntity.class); |
|
|
for (VaccinationErrorEntity entity : insertErrorList) { |
|
|
Integer insertNo = vaccinationErrorDao.getMaxInsertNo(); |
|
|
entity.setInsertNo(insertNo); |
|
|
for (VaccinationErrorEntity entity : insertErrorList) { |
|
|
|
|
|
entity.setInsertNo(insertNo); |
|
|
|
|
|
} |
|
|
|
|
|
vaccinationErrorService.insertBatch(insertErrorList); |
|
|
} |
|
|
} |
|
|
vaccinationErrorService.insertBatch(insertErrorList); |
|
|
log.info("已删除用户数量:" + deleteIdCardArr.size() + "||已插入接种记录" + insertUserList.size() + "||已更新用户记录:" + updateList.size() + "||错误信息记录:" + insertErrorList.size()); |
|
|
|
|
|
|
|
|
// 提示报错信息
|
|
|
// 提示报错信息
|
|
|
if (CollUtil.isNotEmpty(addErrorList)) { |
|
|
if (CollUtil.isNotEmpty(addErrorList)) { |
|
|
|