| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.*; |
| | | import com.doumee.core.wx.wxPlat.WxPlatNotice; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.dao.SmsConfigMapper; |
| | | import com.doumee.dao.business.dao.SmsEmailMapper; |
| | |
| | | |
| | | @Override |
| | | public Integer sendSms(SmsEmail smsEmail) { |
| | | if(StringUtils.isBlank(smsEmail.getPhone())){ |
| | | if(StringUtils.isBlank(smsEmail.getPhone()) || smsEmail.getPhone().length() != 11 ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | String nowDate = DateUtil.getFomartDate(new Date(),"yyyy-MM-dd HH:mm:ss"); |
| | |
| | | List<SmsEmail> smsEmails = smsEmailMapper.selectList(wrapper); |
| | | if(smsEmails!=null && smsEmails.size()>0){ |
| | | for(SmsEmail model : smsEmails){ |
| | | if(Constants.equalsInteger(model.getType(),Constants.ONE)){ |
| | | if(model.getPhone() == null){ |
| | | model.setStatus(Constants.THREE);//发送失败 |
| | | model.setRemark("手机号为空,取消任务发送!"); |
| | |
| | | model.setRemark("短信任务发送失败!"+e.getMessage()); |
| | | } |
| | | } |
| | | }else if(Constants.equalsInteger(model.getType(),Constants.TWO)){ |
| | | if(DateUtil.fromStringToDate("yyyy-MM-dd HH:mm:ss",model.getInfo()).getTime() < System.currentTimeMillis()){ |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | wxPlatNotice.sendMeetTemplateNotice(systemDictDataBiz,model,systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode()); |
| | | model.setStatus(Constants.ONE);//发送成功 |
| | | model.setRemark("微信通知发送成功"); |
| | | }else{ |
| | | model.setStatus(Constants.THREE);//发送成功 |
| | | model.setRemark("微信通知发送失败"); |
| | | } |
| | | }else{ |
| | | continue; |
| | | } |
| | | model.setEditDate(new Date()); |
| | | smsEmailMapper.updateById(model); |
| | | } |