| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | import com.ruoyi.common.core.domain.entity.sysUserInfo; |
| | | import com.ruoyi.common.utils.uuid.UUID; |
| | | import com.ruoyi.domain.*; |
| | | import com.ruoyi.domain.dto.MarryInfoDto; |
| | | import com.ruoyi.service.*; |
| | |
| | | infoUser.setSpouseId(user.getSpouseId()); |
| | | } |
| | | |
| | | String originalString=user.getUserName()+"-"+user.getPhonenumber(); |
| | | |
| | | String uniqueId = UUID.nameUUIDFromBytes(originalString.getBytes()).toString(); |
| | | infoUser.setUaid(uniqueId); |
| | | zInfoUserService.setUaidSame(user.getPhonenumber(),user.getUserName(),uniqueId); |
| | | |
| | | |
| | | // ----- 2.2 家族关系继承逻辑 ----- |
| | | // 优先获取当前数据库记录 |
| | | ZInfoUser byId = zInfoUserService.getById(user); |
| | |
| | | } |
| | | // 2.2.3 配偶家族继承(最高优先级) |
| | | if (user.getSpouseId() != null ){ |
| | | //将修改的对应用户原本id清空 |
| | | zInfoUserService.setSpouseOnly(user.getUserId()); |
| | | // 仅当用户首次成为家庭成员时继承配偶家族 |
| | | if (zInfoUserService.getById(user.getUserId()) == null || |
| | | zInfoUserService.getById(user.getUserId()).getIsMyFamily() == 0) { |
| | |
| | | } |
| | | |
| | | // ===== 3. 婚姻状态专项处理 ===== |
| | | if(infoUser.getMaritalStatus() != null) { |
| | | // 3.1 构建本人婚姻信息 |
| | | MarryInfoDto marrySelf = new MarryInfoDto(); |
| | | marrySelf.setUid(user.getSysId()); // 系统ID |
| | |
| | | exSpouseRecord.setMarryStatus(2); // 离婚状态 |
| | | marryUserService.save(exSpouseRecord); // 写入历史表 |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success(); // 操作成功 |
| | | } else { |
| | | // ⚠️ 非家庭成员直接阻断 |
| | |
| | | user.setRemark(userAll.getRemark()); // 备注信息 |
| | | user.setUpdateBy(userAll.getUpdateBy()); // 更新人 |
| | | user.setClanId(userAll.getClanId()); // 家族ID |
| | | user.setPaid(userAll.getPaid()); |
| | | |
| | | // ===================== 2. 唯一性校验(登录名/手机号/邮箱) ===================== |
| | | // 2.1 登录名校验 |
| | |
| | | return error("新增用户'" + user.getNickName() + "'失败,登录账号已存在"); |
| | | } |
| | | // 2.2 手机号校验(非空时验证) |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { |
| | | return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | // else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { |
| | | // |
| | | // return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | // } |
| | | // 2.3 邮箱校验(非空时验证) |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { |
| | | return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | |
| | | infoUser.setNickName(userAll.getNickName()); // 当前昵称 |
| | | infoUser.setOldName(userAll.getUserName()); // 历史名称(保留记录) |
| | | infoUser.setPhoneNumber(userAll.getPhonenumber()); // 联系方式 |
| | | |
| | | String originalString=userAll.getUserName()+"-"+userAll.getPhonenumber(); |
| | | |
| | | String uniqueId = UUID.nameUUIDFromBytes(originalString.getBytes()).toString(); |
| | | infoUser.setUaid(uniqueId); |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { |
| | | zInfoUserService.setUaidSame(user.getPhonenumber(),user.getUserName(),uniqueId); |
| | | } |
| | | // 性别格式转换(String → Integer) |
| | | infoUser.setSex(userAll.getSex().equals("0") ? 0 : 1); |
| | | infoUser.setSpouseId(userAll.getSpouseId()); // 配偶ID |