|  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | import com.doumee.service.business.third.EmailService; | 
 |  |  | import com.doumee.service.business.third.EmayService; | 
 |  |  | import org.apache.commons.lang3.StringUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | 
 |  |  |     private SystemDictDataBiz systemDictDataBiz; | 
 |  |  |     @Autowired | 
 |  |  |     private EmayService emayService; | 
 |  |  |     @Autowired | 
 |  |  |     private EmailService emailService; | 
 |  |  |  | 
 |  |  |     public static void isCaptcheValide(SmsEmailMapper smsEmailMapper, String phone, String captche) { | 
 |  |  |         SmsEmail model = smsEmailMapper.selectOne(new QueryWrapper<SmsEmail>().lambda() | 
 |  |  | 
 |  |  |         return smsEmail.getId(); | 
 |  |  |     } | 
 |  |  |     @Override | 
 |  |  |     public Integer sendEmail(SmsEmail smsEmail) { | 
 |  |  |         if(StringUtils.isBlank(smsEmail.getEmail())){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
 |  |  |         } | 
 |  |  |         boolean result=   emailService.sendEmail(smsEmail.getEmail(),smsEmail.getTitle(),smsEmail.getContent(),smsEmail.getFileList()); | 
 |  |  |         smsEmail.setRemark("邮件发生成功"); | 
 |  |  |         if(!result){ | 
 |  |  |             smsEmail.setRemark("邮件发生失败"); | 
 |  |  |         } | 
 |  |  |         smsEmail.setIsdeleted(Constants.ZERO); | 
 |  |  |         smsEmail.setCreateDate(new Date()); | 
 |  |  |         smsEmail.setStatus(Constants.ONE); | 
 |  |  |         smsEmail.setType(Constants.TWO); | 
 |  |  |         smsEmailMapper.insert(smsEmail); | 
 |  |  |  | 
 |  |  |         return smsEmail.getId(); | 
 |  |  |     } | 
 |  |  |     @Override | 
 |  |  |     public Integer sendSms(SmsEmail smsEmail) { | 
 |  |  |         if(StringUtils.isBlank(smsEmail.getPhone())){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
 |  |  |         } | 
 |  |  |         String code = Constants.getRandom6Num(); | 
 |  |  |         boolean result=   emayService.sendSingleSms(smsEmail.getPhone(),code); | 
 |  |  |         if(!result){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,短信验证码发送失败,请稍后重试!"); | 
 |  |  |         } | 
 |  |  |         smsEmail.setRemark(code); | 
 |  |  |         smsEmail.setIsdeleted(Constants.ZERO); | 
 |  |  |         smsEmail.setCreateDate(new Date()); | 
 |  |  | 
 |  |  |         smsEmailMapper.insert(smsEmail); | 
 |  |  |  | 
 |  |  |         return smsEmail.getId(); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override |