Browse Source

死亡数据同步逻辑调整

dev
yinzuomei 2 years ago
parent
commit
947072e704
  1. 34
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java

34
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java

@ -14,16 +14,20 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dao.DataSyncRecordDeathDao; import com.epmet.dao.DataSyncRecordDeathDao;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dto.ChangeDeathDTO; import com.epmet.dto.ChangeDeathDTO;
import com.epmet.dto.DataSyncRecordDeathDTO; import com.epmet.dto.DataSyncRecordDeathDTO;
import com.epmet.dto.form.dataSync.DataSyncRecordDeathPageFormDTO; import com.epmet.dto.form.dataSync.DataSyncRecordDeathPageFormDTO;
import com.epmet.entity.DataSyncRecordDeathEntity; import com.epmet.entity.DataSyncRecordDeathEntity;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.service.DataSyncRecordDeathService; import com.epmet.service.DataSyncRecordDeathService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -38,6 +42,8 @@ import java.util.Map;
*/ */
@Service @Service
public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl<DataSyncRecordDeathDao, DataSyncRecordDeathEntity> implements DataSyncRecordDeathService { public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl<DataSyncRecordDeathDao, DataSyncRecordDeathEntity> implements DataSyncRecordDeathService {
@Autowired
private IcResiUserDao icResiUserDao;
/** /**
* 列表查询 * 列表查询
@ -124,7 +130,23 @@ public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl<DataSyncReco
// 已处理的跳过 // 已处理的跳过
continue; continue;
} }
entity.setDealStatus(NumConstant.ONE);
try { try {
Boolean existedFlag=true;
LambdaQueryWrapper<IcResiUserEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IcResiUserEntity::getIdCard, entity.getIdCard())
.eq(IcResiUserEntity::getCustomerId, entity.getCustomerId())
.eq(IcResiUserEntity::getDelFlag, NumConstant.ZERO_STR)
.select(IcResiUserEntity::getId);
IcResiUserEntity icResiUserEntity = icResiUserDao.selectOne(queryWrapper);
if (null == icResiUserEntity) {
existedFlag = false;
entity.setIcResiUserId(null);
entity.setDealResult("居民信息表不存在此居民");
}else{
entity.setIcResiUserId(icResiUserEntity.getId());
}
if(existedFlag){
ChangeDeathDTO changeDeathDTO = new ChangeDeathDTO(); ChangeDeathDTO changeDeathDTO = new ChangeDeathDTO();
changeDeathDTO.setStaffId(userId); changeDeathDTO.setStaffId(userId);
changeDeathDTO.setUserId(entity.getIcResiUserId()); changeDeathDTO.setUserId(entity.getIcResiUserId());
@ -135,16 +157,20 @@ public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl<DataSyncReco
changeDeathDTO.setMobile(StrConstant.EPMETY_STR); changeDeathDTO.setMobile(StrConstant.EPMETY_STR);
changeDeathDTO.setDeathDate(DateUtils.stringToDate(entity.getDeathDate(), "yyyy-MM-dd")); changeDeathDTO.setDeathDate(DateUtils.stringToDate(entity.getDeathDate(), "yyyy-MM-dd"));
changeDeathDTO.setJoinReason("来源于数据比对-死亡人员数据"); changeDeathDTO.setJoinReason("来源于数据比对-死亡人员数据");
SpringContextUtils.getBean(ChangeDeathServiceImpl.class).save(changeDeathDTO); Result result=SpringContextUtils.getBean(ChangeDeathServiceImpl.class).save(changeDeathDTO);
entity.setDealStatus(NumConstant.ONE); if(!result.success()){
entity.setDealStatus(NumConstant.TWO);
entity.setDealResult("同步死亡人员返回失败");
}
}
} catch (EpmetException epmetException) { } catch (EpmetException epmetException) {
//0:未处理;1:处理成功;2处理失败
entity.setDealStatus(NumConstant.TWO); entity.setDealStatus(NumConstant.TWO);
entity.setDealResult("系统内部异常:" + epmetException.getMsg()); entity.setDealResult("系统内部异常:" + epmetException.getMsg());
epmetException.printStackTrace(); epmetException.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
//0:未处理;1:处理成功;2处理失败
entity.setDealStatus(NumConstant.TWO); entity.setDealStatus(NumConstant.TWO);
entity.setDealResult("未知错误"); entity.setDealResult("未知错误");

Loading…
Cancel
Save