| | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | @Lazy |
| | | private EmayService emayService; |
| | | |
| | | @Value("${debug_model}") |
| | |
| | | smsEmail.setType(Constants.ZERO); |
| | | smsEmail.setTitle("短信验证码"); |
| | | smsEmail.setContent(content); |
| | | smsEmail.setObjType(Constants.ZERO+""); |
| | | smsEmailMapper.insert(smsEmail); |
| | | |
| | | return smsEmail.getId(); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | QueryWrapper<SmsEmail> wrapper = new QueryWrapper<>(smsEmail); |
| | | return smsEmailMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | |
| | | public static void sendBusiness(EmayService emayService ,SmsEmailMapper smsEmailMapper ,List<String> phoneList,String objType,String content,Integer objId){ |
| | | //TODO 是否发送短信 |
| | | |
| | | for (String phone:phoneList) { |
| | | boolean result= emayService.sendSingleSms(phone,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.ONE); |
| | | smsEmail.setType(Constants.ZERO); |
| | | smsEmail.setTitle("业务短信"); |
| | | smsEmail.setContent(content); |
| | | smsEmail.setObjType(objType); |
| | | smsEmail.setObjId(objId); |
| | | smsEmailMapper.insert(smsEmail); |
| | | } |
| | | } |
| | | |
| | | } |