事件接口优化
This commit is contained in:
parent
b774366d13
commit
9bdaaf3506
|
@ -1,18 +1,16 @@
|
||||||
package com.hisense.monitormanage.controller;
|
package com.hisense.monitormanage.controller;
|
||||||
|
|
||||||
import cn.hutool.http.HttpRequest;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hisense.monitormanage.entity.CameraChannel;
|
import com.baomidou.mybatisplus.extension.api.R;
|
||||||
import com.hisense.monitormanage.entity.Event;
|
import com.hisense.monitormanage.entity.Event;
|
||||||
import com.hisense.monitormanage.entity.Result;
|
import com.hisense.monitormanage.entity.Result;
|
||||||
import com.hisense.monitormanage.mapper.EventMapper;
|
import com.hisense.monitormanage.mapper.EventMapper;
|
||||||
import com.hisense.monitormanage.service.ShangTangService;
|
import com.hisense.monitormanage.service.ShangTangService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.omg.CORBA.Request;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@ -21,12 +19,12 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("STapi/project")
|
@RequestMapping("STapi/project")
|
||||||
|
@Api(tags = "事件")
|
||||||
|
@Log4j2
|
||||||
public class ShangTangController {
|
public class ShangTangController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -44,6 +42,7 @@ public class ShangTangController {
|
||||||
return shangTangService.subscribe();
|
return shangTangService.subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订阅任务下发接口
|
* 订阅任务下发接口
|
||||||
* @param request
|
* @param request
|
||||||
|
@ -123,8 +122,9 @@ public class ShangTangController {
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
event.setTrackEvent(jsonObject.getString("trackEvent"));
|
||||||
eventMapper.insert(event);
|
eventMapper.insert(event);
|
||||||
System.out.println(strcont);
|
log.info(event);
|
||||||
return Result.success(strcont);
|
return Result.success(strcont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,12 @@ public class ShangTangController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("selectEvent")
|
@GetMapping("selectEvent")
|
||||||
|
@ApiOperation("查询所有事件")
|
||||||
public Result selectEvent(){
|
public Result selectEvent(){
|
||||||
List<Event> events = eventMapper.selectEvent();
|
List<Event> events = eventMapper.selectEvent();
|
||||||
|
|
||||||
|
@ -149,4 +154,19 @@ public class ShangTangController {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当天事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByTime")
|
||||||
|
@ApiOperation("查询当天事件")
|
||||||
|
public Result selectByTime(){
|
||||||
|
List<Event> byTime = eventMapper.selectByTime();
|
||||||
|
|
||||||
|
Result success = Result.success(byTime);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@TableName("t_event")
|
@TableName("t_event")
|
||||||
|
@ -24,4 +23,5 @@ public class Event {
|
||||||
private String imageUrl;
|
private String imageUrl;
|
||||||
private String taskId;
|
private String taskId;
|
||||||
private String captureTime;
|
private String captureTime;
|
||||||
|
private String trackEvent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.hisense.monitormanage.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.hisense.monitormanage.entity.Event;
|
import com.hisense.monitormanage.entity.Event;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -9,4 +10,7 @@ import java.util.List;
|
||||||
public interface EventMapper extends BaseMapper<Event> {
|
public interface EventMapper extends BaseMapper<Event> {
|
||||||
@Select("SELECT * FROM t_event")
|
@Select("SELECT * FROM t_event")
|
||||||
List<Event> selectEvent();
|
List<Event> selectEvent();
|
||||||
|
|
||||||
|
@Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW())")
|
||||||
|
List<Event> selectByTime();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue