| | |
| | | import com.mzl.flower.service.system.UserService; |
| | | import com.mzl.flower.utils.DateUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | |
| | | @Resource |
| | | private BaseService baseService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | |
| | | public PartnerService(PartnerMapper partnerMapper, UserMapper userMapper, WxMaService maService, UploadService uploadService) { |
| | | this.partnerMapper = partnerMapper; |
| | |
| | | partner.setContactTel(dto.getContactTel()); |
| | | userMapper.updateById(user); |
| | | } |
| | | partner.setIdCards(dto.getIdCards()); |
| | | partner.setAddress(dto.getAddress()); |
| | | partner.setCityWarehouse(dto.getCityWarehouse()); |
| | | partner.update(SecurityUtils.getUserId()); |
| | | partnerMapper.updateById(partner); |
| | | |
| | |
| | | partnerMapper.updateById(partner); |
| | | } |
| | | |
| | | @Transactional |
| | | public void phoneUpdate(UpdatePhoneDTO dto) { |
| | | Partner partner = partnerMapper.selectById(dto.getId()); |
| | | if(partner==null){ |
| | | throw new ValidationException("合伙人信息未登记"); |
| | | } |
| | | User user = userService.getUserById(partner.getUserId()); |
| | | if(user == null){ |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | |
| | | // 查看当前合伙人的手机号是否被占用 |
| | | |
| | | final List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>() |
| | | .eq(User::getDeleted, 0) |
| | | .eq(User::getType, Constants.USER_TYPE.partner.name()) |
| | | .eq(User::getLoginName, dto.getUsername())); |
| | | if(CollectionUtils.isNotEmpty(userList)){ |
| | | throw new ValidationException("用户已存在"); |
| | | } |
| | | |
| | | partner.setContactTel(dto.getUsername()); |
| | | partner.update(SecurityUtils.getUserId()); |
| | | partnerMapper.updateById(partner); |
| | | |
| | | user.setTel(dto.getUsername()); |
| | | user.setLoginName(dto.getUsername()); |
| | | user.update(SecurityUtils.getUserId()); |
| | | userMapper.updateById(user); |
| | | |
| | | } |
| | | |
| | | } |