cloudroam
2024-12-09 2c5a0e133b64bb0a46b1419c48e9b62a4779e268
src/main/java/com/mzl/flower/service/supplier/SupplierSubService.java
@@ -51,14 +51,16 @@
    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;
@@ -81,6 +83,7 @@
            supplierSub = new SupplierSub();
            BeanUtils.copyProperties(dto, supplierSub, "id");
            supplierSub.setSupplierId(supplierDTO.getId());
            supplierSub.create(SecurityUtils.getUserId());
            supplierSub.setIsEnabled(true);
@@ -227,4 +230,8 @@
        }
        return supplierSubMapper.getSubSupplier(String.valueOf(supplierDTO.getId()));
    }
    public SupplierSub getById(Long id) {
        return supplierSubMapper.selectById(id);
    }
}