| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.domain.NotifyDto; |
| | | import com.zy.asrs.entity.HttpRequestLog; |
| | | import com.zy.asrs.service.HttpRequestLogService; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.utils.RedisUtil; |
| | |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private HttpRequestLogService httpRequestLogService; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public synchronized void notifyShuttle(){ |
| | |
| | | continue; |
| | | } |
| | | |
| | | HttpRequestLog httpRequestLog = new HttpRequestLog(); |
| | | httpRequestLog.setName(notifyUri + notifyUriPath); |
| | | httpRequestLog.setRequest(JSON.toJSONString(notifyDto)); |
| | | httpRequestLog.setCreateTime(new Date()); |
| | | // HttpRequestLog httpRequestLog = new HttpRequestLog(); |
| | | // httpRequestLog.setName(notifyUri + notifyUriPath); |
| | | // httpRequestLog.setRequest(JSON.toJSONString(notifyDto)); |
| | | // httpRequestLog.setCreateTime(new Date()); |
| | | |
| | | try { |
| | | //触发通知 |
| | |
| | | .setJson(JSON.toJSONString(notifyDto)) |
| | | .build() |
| | | .doPost(); |
| | | httpRequestLog.setResponse(response); |
| | | // httpRequestLog.setResponse(response); |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | Integer code = jsonObject.getInteger("code"); |
| | |
| | | e.printStackTrace(); |
| | | }finally { |
| | | //保存记录 |
| | | httpRequestLogService.insert(httpRequestLog); |
| | | // httpRequestLogService.insert(httpRequestLog); |
| | | } |
| | | |
| | | //通知失败 |