|  |  |  | 
|---|
|  |  |  | import com.doumee.dao.system.SystemUserMapper; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemUser; | 
|---|
|  |  |  | import com.doumee.service.business.SmsEmailService; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer sendBillSms(String content,String mobile,Integer billId) { | 
|---|
|  |  |  | if(StringUtils.isBlank(mobile)){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | boolean result=   emayService.sendSingleSms(mobile,content); | 
|---|
|  |  |  | if(!result){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,短信发送失败,请稍后重试!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | SmsEmail smsEmail = new SmsEmail(); | 
|---|
|  |  |  | smsEmail.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | smsEmail.setCreateDate(new Date()); | 
|---|
|  |  |  | smsEmail.setStatus(Constants.ZERO); | 
|---|
|  |  |  | smsEmail.setType(Constants.ZERO); | 
|---|
|  |  |  | smsEmail.setTitle("账单催费"); | 
|---|
|  |  |  | smsEmail.setObjId(billId); | 
|---|
|  |  |  | smsEmail.setObjType(Constants.ZERO+""); | 
|---|
|  |  |  | smsEmail.setContent(content); | 
|---|
|  |  |  | smsEmailMapper.insert(smsEmail); | 
|---|
|  |  |  | return smsEmail.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private EmailService emailService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer sendEmail(String email,String content,Integer billId) { | 
|---|
|  |  |  | if(StringUtils.isBlank(email)){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | boolean result=   emailService.sendEmail(email,"账单催费",content,null); | 
|---|
|  |  |  | SmsEmail smsEmail = new SmsEmail(); | 
|---|
|  |  |  | smsEmail.setRemark("邮件发生成功"); | 
|---|
|  |  |  | if(!result){ | 
|---|
|  |  |  | smsEmail.setRemark("邮件发生失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | smsEmail.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | smsEmail.setCreateDate(new Date()); | 
|---|
|  |  |  | smsEmail.setStatus(Constants.ONE); | 
|---|
|  |  |  | smsEmail.setType(Constants.TWO); | 
|---|
|  |  |  | smsEmail.setObjId(billId); | 
|---|
|  |  |  | smsEmail.setObjType(Constants.ONE+""); | 
|---|
|  |  |  | smsEmail.setContent(content); | 
|---|
|  |  |  | smsEmailMapper.insert(smsEmail); | 
|---|
|  |  |  | return smsEmail.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|