parent
2586f45112
commit
f39d0f7165
|
@ -92,7 +92,7 @@ public class Controller {
|
|||
|
||||
@GetMapping("capture")
|
||||
public Object capture(){
|
||||
monitorService.construction();
|
||||
monitorService.CameraScreenshot();
|
||||
|
||||
return "finish capture";
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class Controller {
|
|||
|
||||
@GetMapping("capture1")
|
||||
public Object capture1(){
|
||||
monitorService.scenicSpotAndBathing();
|
||||
monitorService.WaterPointService();
|
||||
|
||||
return "finish capture";
|
||||
}
|
||||
|
|
|
@ -94,12 +94,16 @@ public class EventController {
|
|||
}
|
||||
}
|
||||
JSONObject camera = jsonObject.getJSONObject("camera");
|
||||
if (camera!=null){
|
||||
event.setCameraName(camera.getString("cameraName"));
|
||||
event.setDistrict(camera.getString("district"));
|
||||
event.setLatitude(camera.getBigDecimal("latitude"));
|
||||
event.setLongitude(camera.getBigDecimal("longitude"));
|
||||
}
|
||||
JSONObject image = jsonObject.getJSONObject("image");
|
||||
if (image!=null){
|
||||
event.setImageUrl(image.getString("imageUrl"));
|
||||
}
|
||||
event.setTaskId(jsonObject.getString("taskId"));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//要转换的时间格式
|
||||
Date date;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.hisense.monitormanage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("t_test_code")
|
||||
public class TestCode {
|
||||
private String channelCode;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.hisense.monitormanage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("w_camera")
|
||||
public class WCamera {
|
||||
private Integer waterId;
|
||||
private String ChannelCode;
|
||||
private String channelName;
|
||||
private String gpsX;
|
||||
private String gpsY;
|
||||
private String illustrate;
|
||||
private String videoCapture;
|
||||
|
||||
}
|
|
@ -58,6 +58,6 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
|
|||
|
||||
List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
|
||||
|
||||
@Select("SELECT * FROM t_camera_channel WHERE channel_code > '404_37020348001325000037' ORDER BY channel_code DESC" )
|
||||
@Select("SELECT * FROM t_camera_channel WHERE channel_code < '404_37020323541317325139' AND channel_code > '404_37020300001310016729' ORDER BY channel_code DESC" )
|
||||
List<CameraChannel> selectCameraChannel();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.hisense.monitormanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hisense.monitormanage.entity.TestCode;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface TestCodeMapper extends BaseMapper<TestCode> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.hisense.monitormanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hisense.monitormanage.entity.WCamera;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface WCameraMapper extends BaseMapper<WCamera> {
|
||||
}
|
|
@ -15,7 +15,7 @@ public interface WaterPointMapper extends BaseMapper<WaterPoint> {
|
|||
@Select("select * from water_point wp LEFT JOIN water_point_report wpr ON wp.water_point_id = wpr.water_point_id WHERE wp.audit_flag = '2' and wp.disp_flag in (0,1)")
|
||||
List<WaterPointDto> selectWaterPoint();
|
||||
|
||||
@Select("select * from water_point where audit_flag = '2' and disp_flag in (0,1) and report_origin = #{reportOrigin}")
|
||||
@Select("select * from water_point wp LEFT JOIN water_point_report wpr ON wp.water_point_id = wpr.water_point_id where audit_flag = '2' and disp_flag in (0,1) and report_origin = #{reportOrigin}")
|
||||
List<WaterPointDto> selectReportOrigin(String reportOrigin);
|
||||
|
||||
@Select("SELECT * FROM w_camera w RIGHT JOIN water_camera wc ON w.water_id = wc.water_id where wc.water_point_name = #{waterPointName}")
|
||||
|
|
|
@ -70,6 +70,12 @@ public class MonitorService {
|
|||
@Autowired
|
||||
private PeopleRecognizeMapper peopleRecognizeMapper;
|
||||
|
||||
@Autowired
|
||||
private TestCodeMapper testCodeMapper;
|
||||
|
||||
@Autowired
|
||||
private WCameraMapper wCameraMapper;
|
||||
|
||||
|
||||
@Value("${hwx.file.work-path}")
|
||||
private String fileDir;
|
||||
|
@ -292,6 +298,7 @@ public class MonitorService {
|
|||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 7 * * ?")
|
||||
public void CameraScreenshot () {
|
||||
try {
|
||||
log.info("[monitor-capture]: start capture");
|
||||
|
@ -317,16 +324,9 @@ public class MonitorService {
|
|||
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
|
||||
i--;
|
||||
if (i == 0){
|
||||
QueryWrapper<CameraChannel> queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("channel_code",channelCode);
|
||||
CameraChannel cameraChannel = cameraChannelMapper.selectOne(queryWrapper);
|
||||
cameraChannel.setCheckStatus(0);
|
||||
cameraChannelMapper.update(cameraChannel,queryWrapper);
|
||||
}
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException interruptedException) {
|
||||
interruptedException.printStackTrace();
|
||||
TestCode testCode = new TestCode();
|
||||
testCode.setChannelCode(channelCode);
|
||||
testCodeMapper.insert(testCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1038,6 +1038,33 @@ public class MonitorService {
|
|||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 8 * * ?")
|
||||
public void WaterPointService() {
|
||||
try {
|
||||
log.info("[monitor-capture]: start capture");
|
||||
QueryWrapper<WCamera> queryWrapper = new QueryWrapper<>();
|
||||
List<WCamera> wCameras = wCameraMapper.selectList(queryWrapper);
|
||||
wCameras.forEach(camera -> {
|
||||
String channelCode = camera.getChannelCode();
|
||||
try {
|
||||
BufferedImage bufferedImage = capturecreenshot(channelCode);
|
||||
String fileName = channelCode + ".jpg";
|
||||
ImageIO.write(bufferedImage, "jpg", new File(fileDir + "/images/" + fileName));
|
||||
String picUrl = picHost + "/images/" + fileName;
|
||||
WCamera wCamera = new WCamera();
|
||||
wCamera.setVideoCapture(picUrl);
|
||||
QueryWrapper<WCamera> queryWrapper1 = new QueryWrapper<>();
|
||||
queryWrapper1.eq("channel_code", channelCode);
|
||||
wCameraMapper.update(wCamera, queryWrapper1);
|
||||
}catch (Exception e){
|
||||
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
|
||||
}
|
||||
});
|
||||
log.info("[monitor-capture]: end capture");
|
||||
}catch (Exception exception){
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hisense.monitormanage.mapper.TestCodeMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hisense.monitormanage.mapper.WCameraMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue