Browse Source

youhua

master
4670101279 1 year ago
parent
commit
94a70a1f75
  1. 13
      ruoyi-api/src/main/resources/mapper/api/DapingMapper.xml
  2. 1
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/ApiController.java
  3. 38
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java
  4. 18
      ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/Camera.java
  5. 15
      ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/CameraParams.java
  6. 3
      ruoyi-code/src/main/java/com/ruoyi/code/camera/scheduled/RegisterServer.java
  7. 6
      ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/controller/ScStationInfoController.java
  8. 2
      ruoyi-code/src/main/java/utils/run_device_cfg.java
  9. 5
      ruoyi-code/src/main/resources/mapper/camera/CameraMapper.xml
  10. 4
      ruoyi-code/src/main/resources/mapper/camera/WaterPhotoInfoMapper.xml

13
ruoyi-api/src/main/resources/mapper/api/DapingMapper.xml

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
FROM
sc_station_info s
inner join sc_water_current_data c on c.stnm_id = s.id
where s.del_flag='0'
</select>
<select id="selectWaterLevel" resultType="com.ruoyi.code.camera.domain.WaterPhotoInfo">
SELECT
@ -27,6 +28,7 @@ @@ -27,6 +28,7 @@
FROM
sc_station_info s
LEFT JOIN sc_water_current_data w ON w.stnm_id = s.id
where s.del_flag='0'
</select>
<select id="selectWaterLevelTrend" resultType="com.ruoyi.code.camera.domain.WaterPhotoInfo">
select tms.tm,d.id, d.stnm, ifnull(d.value,0) value
@ -52,7 +54,7 @@ @@ -52,7 +54,7 @@
FROM
sc_station_info s
LEFT JOIN sc_water_data w ON w.stnm_id = s.id
WHERE
WHERE s.del_flag='0' and
tm BETWEEN DATE_SUB( NOW(), INTERVAL 12 HOUR )
AND DATE_SUB( NOW(), INTERVAL 1 HOUR )
AND RIGHT ( tm, 5 )= '00:00' and s.id= #{id}
@ -63,8 +65,9 @@ @@ -63,8 +65,9 @@
<select id="selectStationInfoId" resultType="java.util.Map">
select id,stnm from sc_station_info
<where>
del_flag='0'
<if test="ids != null and ids != ''">
id in (${ids})
and id in (${ids})
</if>
</where>
<if test="ids == null or ids == ''">
@ -72,10 +75,10 @@ @@ -72,10 +75,10 @@
</if>
</select>
<select id="selectStationByOnlineStatus" resultType="java.util.Map">
select count(1) as value , '在线' as name from camera where status = '1' and first_time is not null
select count(1) as value , '在线' as name from camera where status = '1' and first_time is not null and del_flag='0'
</select>
<select id="selectStationByOfflineStatus" resultType="java.util.Map">
select count(1) as value , '不在线' as name from camera where status = '0' and first_time is not null
select count(1) as value , '不在线' as name from camera where status = '0' and first_time is not null and del_flag='0'
</select>
<select id="selectAllAlea" resultType="java.util.Map">
@ -88,7 +91,7 @@ @@ -88,7 +91,7 @@
FROM
camera
WHERE
`status` = #{status}
`status` = #{status} and del_flag='0'
AND devsn IN ( SELECT camera_sn FROM sc_station_info WHERE del_flag = '0' AND alea_id = #{aleaId} )
</select>
</mapper>

1
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/ApiController.java

@ -235,6 +235,7 @@ public class ApiController extends BaseController @@ -235,6 +235,7 @@ public class ApiController extends BaseController
@RequestMapping("/getPicJson")
public R getPicJson(@RequestParam Map<String, Object> params) throws Exception {
System.out.println("===================================");
// System.out.println(JSON.toJSONString(params));
if(params.containsKey("json")){
String serialNo = (String) params.get("SerialNo");
String json = (String) params.get("json");

38
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java

@ -1,7 +1,9 @@ @@ -1,7 +1,9 @@
package com.ruoyi.code.camera.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.camera.domain.CameraParams;
import com.ruoyi.code.camera.domain.LogInfo;
import com.ruoyi.code.camera.service.ICameraService;
import com.ruoyi.common.annotation.Log;
@ -107,7 +109,9 @@ public class CameraController extends BaseController @@ -107,7 +109,9 @@ public class CameraController extends BaseController
@PreAuthorize("@ss.hasPermi('web:camera:remove')")
@Log(title = "Camera", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
cameraService.removeByIds(Arrays.asList(ids));
List<Camera> list = cameraService.list(new QueryWrapper<Camera>().in("id",Arrays.asList(ids)));
list.forEach(d ->d.setDelFlag("1"));
cameraService.updateBatchById(list);
return R.ok();
}
@ -313,4 +317,36 @@ public class CameraController extends BaseController @@ -313,4 +317,36 @@ public class CameraController extends BaseController
}
@RequestMapping("/setConfig")
public R setConfig(@RequestBody Map<String,Object> params){
Integer id = (Integer) params.get("id");
String lStart = (String)params.get("lstart");
String cLen = (String)params.get("clen");
String tLen = (String)params.get("tlen");
String cP = (String)params.get("cp");
Map<String,Object> map = new HashMap<>();
if(StringUtils.isNotBlank(lStart)){
map.put("l_start",Double.valueOf(lStart));
}
if(StringUtils.isNotBlank(cLen)){
map.put("c_len",Double.valueOf(cLen));
}
if(StringUtils.isNotBlank(tLen)){
map.put("t_len",Double.valueOf(tLen));
}
if(StringUtils.isNotBlank(cP)){
map.put("c_p",Double.valueOf(cP));
}
String paramsStr = JSON.toJSONString(map);
Camera camera = cameraService.getById(id);
if(paramsStr.length() > 5){
camera.setParams(paramsStr);
}else{
camera.setParams(null);
}
cameraService.updateById(camera);
return R.ok();
}
}

18
ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/Camera.java

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
package com.ruoyi.code.camera.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -70,4 +70,16 @@ public class Camera implements Serializable @@ -70,4 +70,16 @@ public class Camera implements Serializable
/** 摄像机品牌,关联品牌表 */
private Long brand;
private String delFlag;
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String params;
public CameraParams getParamsObject(){
if(StringUtils.isNotBlank(this.params)) {
return JSON.parseObject(this.params, CameraParams.class);
}
return new CameraParams();
}
}

15
ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/CameraParams.java

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
package com.ruoyi.code.camera.domain;
import lombok.Data;
@Data
public class CameraParams {
/** */
private Double lstart;
/** 某一时刻水位+水位上水尺长度,单位m */
private Double tlen;
/** 某一时刻水面上水尺长度(单位米)*/
private Double clen;
/** 和水面上的水尺长度对应像素 */
private Double cp;
}

3
ruoyi-code/src/main/java/com/ruoyi/code/camera/scheduled/RegisterServer.java

@ -48,7 +48,8 @@ public class RegisterServer { @@ -48,7 +48,8 @@ public class RegisterServer {
}
private void start(){
String ip = IPUtils.getLocalIpAddress();
// String ip = IPUtils.getLocalIpAddress();
String ip = "192.168.16.219";
System.out.println(ip);
if(localip.equals(ip) && "0".equals(accessmode)){
R result = cameraService.register(localip);

6
ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/controller/ScStationInfoController.java

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
package com.ruoyi.code.sctaationinfo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.code.sctaationinfo.service.IScStationInfoService;
import com.ruoyi.common.annotation.Log;
@ -96,7 +98,9 @@ public class ScStationInfoController extends BaseController @@ -96,7 +98,9 @@ public class ScStationInfoController extends BaseController
@PreAuthorize("@ss.hasPermi('system:info:remove')")
@Log(title = "ScStationInfo", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
scStationInfoService.removeByIds(Arrays.asList(ids));
List<ScStationInfo> list = scStationInfoService.list(new QueryWrapper<ScStationInfo>().in("id",Arrays.asList(ids)));
list.forEach(d ->d.setDelFlag("1"));
scStationInfoService.updateBatchById(list);
return R.ok();
}

2
ruoyi-code/src/main/java/utils/run_device_cfg.java

@ -60,7 +60,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -60,7 +60,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
* Create the application.
*/
public run_device_cfg() {
initialize();
// initialize();
initilizeRyNetLib();
}

5
ruoyi-code/src/main/resources/mapper/camera/CameraMapper.xml

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryCameraList" resultType="com.ruoyi.code.camera.domain.Camera">
select * from camera where devsn not in (
select camera_sn from sc_station_info
)
) and del_flag='0'
</select>
<select id="queryCameraBYSid" resultType="com.ruoyi.code.camera.domain.Camera">
@ -18,13 +18,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -18,13 +18,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sc_station_info s
where
c.devsn = s.camera_sn
and s.id = #{sid}
and s.id = #{sid} and s.del_flag='0' and c.del_flag='0'
</select>
<select id="queryPage" resultType="com.ruoyi.code.camera.domain.Camera">
select * from camera
<where>
del_flag='0'
<if test="params.devsn!= null and params.devsn != ''">
and devsn like concat('%',#{params.devsn},'%')
</if>

4
ruoyi-code/src/main/resources/mapper/camera/WaterPhotoInfoMapper.xml

@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sc_water_data w on s.id = w.stnm_id
<where>
s.del_flag='0' and c.del_flag='0'
<if test="params.stnm !=null and params.stnm !=''">and s.stnm like concat('%',#{params.stnm},'%')</if>
<if test="params.stcd !=null and params.stcd !=''">and c.name like concat('%',#{params.stcd},'%')</if>
<if test="params.startTime != null and params.startTime !=''"> and w.tm &gt;= #{params.startTime }</if>
@ -33,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -33,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join camera c on c.devsn = s.camera_sn
<where>
s.del_flag='0' and c.del_flag='0'
<if test="params.stnm !=null and params.stnm !=''">and s.stnm like concat('%',#{params.stnm},'%')</if>
<if test="params.stcd !=null and params.stcd !=''">and c.name like concat('%',#{params.name},'%')</if>
</where>
@ -48,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -48,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sc_station_info s
left join ${params.tableName} w on w.stnm_id = s.id
<where>
s.del_flag='0' and
w.stnm_id = #{params.stnmId}
<if test="params.startTime != null">
and w.tm>=#{params.startTime}
@ -66,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -66,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sc_station_info s
left join ${params.tableName} w on w.stnm_id = s.id
<where>
s.del_flag='0' and
w.stnm_id = #{params.stnmId}
<if test="params.startTime != null">
and w.tm>=#{params.startTime}

Loading…
Cancel
Save