| | |
| | | |
| | | |
| | | public void addOrUpdateSupplier(SupplierSubDTO dto) { |
| | | if(StringUtils.isEmpty(dto.getSmsCode())){ |
| | | throw new ValidationException("手机验证码为空"); |
| | | } |
| | | String smsCode = dto.getSmsCode(); |
| | | //从缓存中获取验证码 |
| | | String smsCacheCode = stringCacheClient.get(SMS_CODE_KEY + SEPARATOR + Constants.USER_TYPE.supplier.name() + SEPARATOR + dto.getPhone()); |
| | | if (!org.apache.commons.lang3.StringUtils.equals(smsCode, smsCacheCode)) { |
| | | throw new ValidationException("手机验证码不正确"); |
| | | if (StringUtils.isEmpty(dto.getType())) { |
| | | if (StringUtils.isEmpty(dto.getSmsCode())) { |
| | | throw new ValidationException("手机验证码为空"); |
| | | } |
| | | String smsCode = dto.getSmsCode(); |
| | | //从缓存中获取验证码 |
| | | String smsCacheCode = stringCacheClient.get(SMS_CODE_KEY + SEPARATOR + Constants.USER_TYPE.supplier.name() + SEPARATOR + dto.getPhone()); |
| | | if (!org.apache.commons.lang3.StringUtils.equals(smsCode, smsCacheCode)) { |
| | | throw new ValidationException("手机验证码不正确"); |
| | | } |
| | | } |
| | | |
| | | SupplierSub supplierSub; |
| | |
| | | |
| | | supplierSub = new SupplierSub(); |
| | | BeanUtils.copyProperties(dto, supplierSub, "id"); |
| | | supplierSub.setSupplierId(supplierDTO.getId()); |
| | | supplierSub.create(SecurityUtils.getUserId()); |
| | | supplierSub.setIsEnabled(true); |
| | | |
| | |
| | | } |
| | | return supplierSubMapper.getSubSupplier(String.valueOf(supplierDTO.getId())); |
| | | } |
| | | |
| | | public SupplierSub getById(Long id) { |
| | | return supplierSubMapper.selectById(id); |
| | | } |
| | | } |