|
|
@ -18,15 +18,13 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.IcNatDao; |
|
|
|
import com.epmet.dao.IcResiUserDao; |
|
|
|
import com.epmet.dao.IcVaccineDao; |
|
|
|
import com.epmet.dao.IcVaccineRelationDao; |
|
|
|
import com.epmet.dto.IcVaccineDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.IcVaccineListResultDTO; |
|
|
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|
|
|
import com.epmet.dto.result.UploadImgResultDTO; |
|
|
|
import com.epmet.dto.result.VaccineListDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IcResiUserEntity; |
|
|
|
import com.epmet.entity.IcVaccineEntity; |
|
|
|
import com.epmet.entity.IcVaccineRelationEntity; |
|
|
@ -82,6 +80,8 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin |
|
|
|
private UserService userService; |
|
|
|
@Autowired |
|
|
|
private IcNoticeService icNoticeService; |
|
|
|
@Autowired |
|
|
|
private IcNatDao icNatDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
@ -369,7 +369,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin |
|
|
|
|
|
|
|
// 建立关系
|
|
|
|
if (resi != null) { |
|
|
|
createVaccineRelation(resiVaccine.getId(), resi.getAgencyId(), resi.getPids()); |
|
|
|
createVaccineRelation(resiVaccine.getId(), resi.getAgencyId(), resi.getPids(), agencyPids); |
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
@ -383,7 +383,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin |
|
|
|
|
|
|
|
// 只要是居民,就创建上关系
|
|
|
|
if (resi != null) { |
|
|
|
createVaccineRelation(e.getId(), resi.getAgencyId(), resi.getPids()); |
|
|
|
createVaccineRelation(e.getId(), resi.getAgencyId(), resi.getPids(), agencyPids); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -425,7 +425,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin |
|
|
|
* @param vaccineId |
|
|
|
* @param currentUserAgencyId |
|
|
|
*/ |
|
|
|
private void createVaccineRelation(String vaccineId, String currentUserAgencyId, String agencyPids) { |
|
|
|
private void createVaccineRelation(String vaccineId, String currentUserAgencyId, String agencyPids, String tokenAgencyPids) { |
|
|
|
|
|
|
|
// 没有关系创建关系,有关系就跳过
|
|
|
|
LambdaQueryWrapper<IcVaccineRelationEntity> query = new LambdaQueryWrapper<>(); |
|
|
@ -440,6 +440,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin |
|
|
|
relation.setPids(String.join(":", Arrays.asList(agencyPids, currentUserAgencyId))); |
|
|
|
relation.setIcVaccineId(vaccineId); |
|
|
|
relation.setUserType("import"); |
|
|
|
relation.setIsLocalResiUser(tokenAgencyPids.contains(currentUserAgencyId) ? NumConstant.ONE_STR : NumConstant.ZERO_STR); |
|
|
|
icVaccineRelationDao.insert(relation); |
|
|
|
} |
|
|
|
|
|
|
@ -508,6 +509,9 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin |
|
|
|
IcVaccineRelationEntity relationEntity = ConvertUtils.sourceToTarget(formDTO, IcVaccineRelationEntity.class); |
|
|
|
relationEntity.setIcVaccineId(entity.getId()); |
|
|
|
relationEntity.setPids(StringUtils.isNotBlank(agencyInfo.getPids()) ? agencyInfo.getPids() + ":" + formDTO.getAgencyId() : formDTO.getAgencyId()); |
|
|
|
//判断当前身份证号是否本辖区下居民
|
|
|
|
ResiAndLocalResiResultDTO resiCount = icResiUserDao.getResiCount(formDTO.getAgencyId(), formDTO.getIdCard(), formDTO.getCustomerId()); |
|
|
|
relationEntity.setIsLocalResiUser(resiCount.getIsLocal() == NumConstant.ZERO ? NumConstant.ZERO_STR : NumConstant.ONE_STR); |
|
|
|
icVaccineRelationDao.insert(relationEntity); |
|
|
|
|
|
|
|
//3.新增通知表信息
|
|
|
@ -567,4 +571,46 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin |
|
|
|
icVaccineRelationDao.delRelation(formDTO.getVaccineId(), null); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void initVaccineLocal() { |
|
|
|
Integer no = NumConstant.ONE; |
|
|
|
Integer size; |
|
|
|
// 查询关系表
|
|
|
|
do { |
|
|
|
PageInfo<RelationAndNatResultDTO> pageInfo = PageHelper.startPage(no, NumConstant.ONE_THOUSAND).doSelectPageInfo(() -> baseDao.initVaccineLocal()); |
|
|
|
List<RelationAndNatResultDTO> list = pageInfo.getList(); |
|
|
|
size = list.size(); |
|
|
|
if (CollectionUtils.isNotEmpty(list)){ |
|
|
|
List<IcResiUserEntity> users = icNatDao.getResiByIdCards(list.stream().map(m -> m.getIdCard()).distinct().collect(Collectors.toList())); |
|
|
|
if (CollectionUtils.isNotEmpty(users)){ |
|
|
|
for (RelationAndNatResultDTO l : list) { |
|
|
|
for (IcResiUserEntity u : users) { |
|
|
|
if (l.getStaffAgencyIdPath().contains(u.getAgencyId())){ |
|
|
|
l.setIsLocalResiUser(NumConstant.ONE_STR); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
updateRelation(list,NumConstant.ONE_STR); |
|
|
|
} |
|
|
|
} |
|
|
|
no++; |
|
|
|
}while (size == NumConstant.ONE_THOUSAND); |
|
|
|
// 其他类型的userType直接是居民的组织信息,所以直接赋值 is_local_resi_user = '1'
|
|
|
|
updateRelation(null,NumConstant.TWO_STR); |
|
|
|
log.error("/epmetuser/icNat/initNatLocal更新核酸检测记录关系表,是否是本辖区居民标志 end"); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateRelation(List<RelationAndNatResultDTO> list,String type){ |
|
|
|
if (NumConstant.ONE_STR.equals(type)){ |
|
|
|
if (CollectionUtils.isNotEmpty(list)){ |
|
|
|
baseDao.updateRelation(list); |
|
|
|
} |
|
|
|
}else { |
|
|
|
baseDao.updateRelationOther("1"); |
|
|
|
baseDao.updateRelationOther("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|