Browse Source

新增家庭成员添加更新信息

master
Jackwang 3 years ago
parent
commit
d284393ed7
  1. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  2. 27
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  3. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

9
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -355,4 +355,13 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
*/
MoveOutMemberFormDTO moveOutMember(@Param("icResiUserId") String icResiUserId,
@Param("customerId") String customerId);
/**
* @describe: 通过身份证号查询实体类
* @author wangtong
* @date 2022/6/13 17:32
* @params [idCard, customerId]
* @return com.epmet.entity.IcResiUserEntity
*/
IcResiUserEntity selectResiUserEntityByIdCard(@Param("idCard") String idCard,@Param("customerId") String customerId);
}

27
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -2343,11 +2343,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
HouseInfoResultDTO houseInfo = houseResult.getData();
IcResiUserDTO userDTO = baseDao.getResiUserByIdCard(dto.getIdCard(), houseInfo.getCustomerId());
if (null != userDTO && null != userDTO.getIdCard()) {
String errorMsg = "新增居民信息失败,身份证号已存在!";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg);
}
//这个房屋下已经设置了户主后,再次选择户主时提示提示“房屋下已存在户主” PS.户主指与户主关系是本人的用户
if (RelationshipEnum.SELF.getCode().equals(dto.getYhzgx())) {
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>();
@ -2360,7 +2355,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
}
dto.setCustomerId(houseInfo.getCustomerId());
dto.setAgencyId(houseInfo.getAgencyId());
dto.setPids(houseInfo.getAgencyPids());
@ -2370,12 +2364,33 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
dto.setUnitId(houseInfo.getBuildingUnitId());
dto.setHomeId(houseInfo.getHouseId());
IcResiUserDTO userDTO = baseDao.getResiUserByIdCard(dto.getIdCard(), houseInfo.getCustomerId());
if (null != userDTO && null != userDTO.getIdCard()) {
//覆盖原有的家庭成员信息
return updateOldMemberInfo(houseInfo.getCustomerId(),dto);
}
IcResiUserEntity entity = ConvertUtils.sourceToTarget(dto, IcResiUserEntity.class);
insert(entity);
return new Result().ok("新增成功");
}
private Result updateOldMemberInfo(String customerId, IcResiUserConfirmSubmitDTO dto) {
IcResiUserEntity userEntity = baseDao.selectResiUserEntityByIdCard(dto.getIdCard(), customerId);
userEntity.setName(dto.getName());
userEntity.setIdCard(dto.getIdCard());
userEntity.setMobile(dto.getMobile());
userEntity.setBirthday(dto.getBirthday());
userEntity.setGender(dto.getGender());
userEntity.setMz(dto.getMz());
userEntity.setYhzgx(dto.getYhzgx());
userEntity.setHjszd(dto.getHjszd());
userEntity.setXjzd(dto.getXjzd());
baseDao.updateById(userEntity);
return new Result().ok("新增成功");
}
/**
* desc:根据字段值获取 options
* @param customerId

8
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -1096,5 +1096,11 @@
AND customer_id = #{customerId}
AND DEL_FLAG = '0'
</select>
<select id="selectResiUserEntityByIdCard" resultType="com.epmet.entity.IcResiUserEntity">
select * from ic_resi_user
WHERE
ID_CARD = #{idCard}
AND customer_id = #{customerId}
AND DEL_FLAG = '0'
</select>
</mapper>

Loading…
Cancel
Save