| | |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public Integer create(IdentityInfo identityInfo) { |
| | | if(Objects.isNull(identityInfo) |
| | | || Objects.isNull(identityInfo.getType()) |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | //查询用户是否已存在当前身份 |
| | | if(identityInfoMapper.selectCount(new QueryWrapper<IdentityInfo>().lambda().eq(IdentityInfo::getMemberId,identityInfo.getMemberId()) |
| | | if(identityInfoMapper.selectCount(new QueryWrapper<IdentityInfo>().lambda().eq(IdentityInfo::getDeleted,Constants.ZERO).eq(IdentityInfo::getMemberId,identityInfo.getMemberId()) |
| | | .eq(IdentityInfo::getType,identityInfo.getType()))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"已存在该身份请刷新查看!"); |
| | | }; |
| | | identityInfo.setDeleted(Constants.ZERO); |
| | | identityInfo.setCreateTime(new Date()); |
| | | identityInfo.setAuditStatus(Constants.ZERO); |
| | | identityInfo.setUpdateTime(identityInfo.getCreateTime()); |
| | | identityInfo.setAuditStatus(Constants.ONE); |
| | | identityInfoMapper.insert(identityInfo); |
| | | |
| | | memberMapper.update(new UpdateWrapper<Member>().lambda() |
| | | .set(Constants.equalsInteger(identityInfo.getType(),Constants.ZERO),Member::getWorkerIdentity,Constants.ONE) |
| | | .set(Constants.equalsInteger(identityInfo.getType(),Constants.ONE),Member::getDriverIdentity,Constants.ONE) |
| | | .set(Constants.equalsInteger(identityInfo.getType(),Constants.TWO),Member::getChefIdentity,Constants.ONE) |
| | | .eq(Member::getId,identityInfo.getMemberId())); |
| | | |
| | | return identityInfo.getId(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public void updateById(IdentityInfo identityInfo) { |
| | | if(Objects.isNull(identityInfo) |
| | | || Objects.isNull(identityInfo.getId()) |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前状态无法进行该操作"); |
| | | } |
| | | identityInfo.setUpdateTime(new Date()); |
| | | identityInfo.setAuditStatus(Constants.ONE); |
| | | identityInfoMapper.updateById(identityInfo); |
| | | memberMapper.update(new UpdateWrapper<Member>().lambda() |
| | | .set(Constants.equalsInteger(identityInfo.getType(),Constants.ZERO),Member::getWorkerIdentity,Constants.ONE) |
| | | .set(Constants.equalsInteger(identityInfo.getType(),Constants.ONE),Member::getDriverIdentity,Constants.ONE) |
| | | .set(Constants.equalsInteger(identityInfo.getType(),Constants.TWO),Member::getChefIdentity,Constants.ONE) |
| | | .eq(Member::getId,identityInfo.getMemberId())); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public void updateLocation(IdentityInfo identityInfo) { |
| | | if(Objects.isNull(identityInfo) |
| | | || Objects.isNull(identityInfo.getId()) |