diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java index 75403760af..d64ac4b252 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncRecordDeathServiceImpl.java +++ b/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.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dao.DataSyncRecordDeathDao; +import com.epmet.dao.IcResiUserDao; import com.epmet.dto.ChangeDeathDTO; import com.epmet.dto.DataSyncRecordDeathDTO; import com.epmet.dto.form.dataSync.DataSyncRecordDeathPageFormDTO; import com.epmet.entity.DataSyncRecordDeathEntity; +import com.epmet.entity.IcResiUserEntity; import com.epmet.service.DataSyncRecordDeathService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -38,6 +42,8 @@ import java.util.Map; */ @Service public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl implements DataSyncRecordDeathService { + @Autowired + private IcResiUserDao icResiUserDao; /** * 列表查询 @@ -124,27 +130,47 @@ public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl 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.setStaffId(userId); + changeDeathDTO.setUserId(entity.getIcResiUserId()); + changeDeathDTO.setGridId(entity.getGridId()); + changeDeathDTO.setName(entity.getName()); + changeDeathDTO.setIdCard(entity.getIdCard()); + // 手机号没有值 + changeDeathDTO.setMobile(StrConstant.EPMETY_STR); + changeDeathDTO.setDeathDate(DateUtils.stringToDate(entity.getDeathDate(), "yyyy-MM-dd")); + changeDeathDTO.setJoinReason("来源于数据比对-死亡人员数据"); + Result result=SpringContextUtils.getBean(ChangeDeathServiceImpl.class).save(changeDeathDTO); + if(!result.success()){ + entity.setDealStatus(NumConstant.TWO); + entity.setDealResult("同步死亡人员返回失败"); + } + } } catch (EpmetException epmetException) { - + //0:未处理;1:处理成功;2处理失败 entity.setDealStatus(NumConstant.TWO); entity.setDealResult("系统内部异常:" + epmetException.getMsg()); epmetException.printStackTrace(); } catch (Exception e) { - + //0:未处理;1:处理成功;2处理失败 entity.setDealStatus(NumConstant.TWO); entity.setDealResult("未知错误");