@ -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 ( ) ;
}
}