Commit 2c297ecf authored by 周昊's avatar 周昊

Merge branch 'develop' into 公司测试环境4.221

parents 38b7de8b 8c0582df
...@@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.algorithm.domain.dto.AlgorithmSceneDetailsDto; import com.ruoyi.algorithm.domain.dto.AlgorithmSceneDetailsDto;
import com.ruoyi.algorithm.domain.dto.AlgorithmSceneListDto; import com.ruoyi.algorithm.domain.dto.AlgorithmSceneListDto;
import com.ruoyi.algorithm.domain.dto.AlgorithmSceneSaveDto;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -65,10 +66,10 @@ public class AlgorithmSceneBaseController extends BaseController ...@@ -65,10 +66,10 @@ public class AlgorithmSceneBaseController extends BaseController
@PreAuthorize("@ss.hasPermi('system:algorithmScene:add')") @PreAuthorize("@ss.hasPermi('system:algorithmScene:add')")
@Log(title = "算法场景", businessType = BusinessType.INSERT) @Log(title = "算法场景", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody AlgorithmSceneDetailsDto algorithmSceneDetailsDto) public AjaxResult add(@RequestBody AlgorithmSceneSaveDto algorithmSceneSaveDto)
{ {
algorithmSceneDetailsDto.setCreateBy(getUsername()); algorithmSceneSaveDto.setCreateBy(getUsername());
return toAjax(algorithmSceneBaseService.insertAlgorithmSceneDetailsDto(algorithmSceneDetailsDto)); return toAjax(algorithmSceneBaseService.insertAlgorithmSceneSaveDto(algorithmSceneSaveDto));
} }
/** /**
...@@ -77,10 +78,10 @@ public class AlgorithmSceneBaseController extends BaseController ...@@ -77,10 +78,10 @@ public class AlgorithmSceneBaseController extends BaseController
@PreAuthorize("@ss.hasPermi('system:algorithmScene:edit')") @PreAuthorize("@ss.hasPermi('system:algorithmScene:edit')")
@Log(title = "算法场景", businessType = BusinessType.UPDATE) @Log(title = "算法场景", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AlgorithmSceneDetailsDto algorithmSceneDetailsDto) public AjaxResult edit(@RequestBody AlgorithmSceneSaveDto algorithmSceneSaveDto)
{ {
algorithmSceneDetailsDto.setUpdateBy(getUsername()); algorithmSceneSaveDto.setUpdateBy(getUsername());
return toAjax(algorithmSceneBaseService.updateAlgorithmSceneDetailsDto(algorithmSceneDetailsDto)); return toAjax(algorithmSceneBaseService.updateAlgorithmSceneSaveDto(algorithmSceneSaveDto));
} }
/** /**
......
package com.ruoyi.algorithm.domain.dto;
import lombok.Data;
import java.util.List;
/**
* @author 周昊
* @desc ...
* @date 2023-05-15 17:35:21
*/
@Data
public class AlgorithmPieceSaveDto {
/** 主键id */
private Long id;
/** 算法块参数 */
private List<AlgorithmPieceVariableDetailsDto> variables;
/** 排序 */
private Long sort;
}
...@@ -19,6 +19,9 @@ public class AlgorithmSceneListDto { ...@@ -19,6 +19,9 @@ public class AlgorithmSceneListDto {
/** 处理的预警类型 */ /** 处理的预警类型 */
private List<AlgorithmBaseType> alarmTypes; private List<AlgorithmBaseType> alarmTypes;
/** 处理的预警类型 */
private String alarmTypesString;
/** 每秒帧数 */ /** 每秒帧数 */
private Long frameSecond; private Long frameSecond;
......
package com.ruoyi.algorithm.domain.dto;
import lombok.Data;
import java.util.List;
@Data
public class AlgorithmSceneSaveDto {
/**
* 主键id
*/
private Long id;
/**
* 场景名
*/
private String sceneName;
/**
* 算法id
*/
private Long algorithmId;
/**
* 处理的预警类型
*/
private List<String> alarmTypes;
/**
* 每秒帧数(ai算法启动参数)
*/
private Long frameSecond;
/**
* 摄像头id列表
*/
private List<String> cameraIdList;
private List<AlgorithmPieceSaveDto> pieceDtos;
/**
* 创建者
*/
private String createBy;
/**
* 更新者
*/
private String updateBy;
}
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.algorithm.domain.AlgorithmSceneBase; import com.ruoyi.algorithm.domain.AlgorithmSceneBase;
import com.ruoyi.algorithm.domain.dto.AlgorithmSceneDetailsDto; import com.ruoyi.algorithm.domain.dto.AlgorithmSceneDetailsDto;
import com.ruoyi.algorithm.domain.dto.AlgorithmSceneListDto; import com.ruoyi.algorithm.domain.dto.AlgorithmSceneListDto;
import com.ruoyi.algorithm.domain.dto.AlgorithmSceneSaveDto;
/** /**
* 算法场景Service接口 * 算法场景Service接口
...@@ -67,7 +68,7 @@ public interface IAlgorithmSceneBaseService ...@@ -67,7 +68,7 @@ public interface IAlgorithmSceneBaseService
AlgorithmSceneDetailsDto selectAlgorithmSceneDetailsDtoById(Long id); AlgorithmSceneDetailsDto selectAlgorithmSceneDetailsDtoById(Long id);
int insertAlgorithmSceneDetailsDto(AlgorithmSceneDetailsDto algorithmSceneDetailsDto); int insertAlgorithmSceneSaveDto(AlgorithmSceneSaveDto algorithmSceneSaveDto);
int updateAlgorithmSceneDetailsDto(AlgorithmSceneDetailsDto algorithmSceneDetailsDto); int updateAlgorithmSceneSaveDto(AlgorithmSceneSaveDto algorithmSceneSaveDto);
} }
...@@ -11,6 +11,7 @@ import cn.hutool.json.JSONUtil; ...@@ -11,6 +11,7 @@ import cn.hutool.json.JSONUtil;
import com.ruoyi.algorithm.domain.AlgorithmScenePiece; import com.ruoyi.algorithm.domain.AlgorithmScenePiece;
import com.ruoyi.algorithm.domain.dto.AlgorithmSceneDetailsDto; import com.ruoyi.algorithm.domain.dto.AlgorithmSceneDetailsDto;
import com.ruoyi.algorithm.domain.dto.AlgorithmSceneListDto; import com.ruoyi.algorithm.domain.dto.AlgorithmSceneListDto;
import com.ruoyi.algorithm.domain.dto.AlgorithmSceneSaveDto;
import com.ruoyi.algorithm.service.IAlgorithmScenePieceService; import com.ruoyi.algorithm.service.IAlgorithmScenePieceService;
import com.ruoyi.algorithm.service.IAlgorithmSceneStatusService; import com.ruoyi.algorithm.service.IAlgorithmSceneStatusService;
import com.ruoyi.algorithm.utils.FlinkRestApiUtil; import com.ruoyi.algorithm.utils.FlinkRestApiUtil;
...@@ -156,17 +157,19 @@ public class AlgorithmSceneBaseServiceImpl implements IAlgorithmSceneBaseService ...@@ -156,17 +157,19 @@ public class AlgorithmSceneBaseServiceImpl implements IAlgorithmSceneBaseService
} }
@Override @Override
public int insertAlgorithmSceneDetailsDto(AlgorithmSceneDetailsDto algorithmSceneDetailsDto) { public int insertAlgorithmSceneSaveDto(AlgorithmSceneSaveDto algorithmSceneSaveDto) {
//新建场景 //新建场景
AlgorithmSceneBase algorithmSceneBase = new AlgorithmSceneBase(); AlgorithmSceneBase algorithmSceneBase = new AlgorithmSceneBase();
BeanUtils.copyBeanProp(algorithmSceneBase, algorithmSceneDetailsDto); BeanUtils.copyBeanProp(algorithmSceneBase, algorithmSceneSaveDto);
algorithmSceneBase.setAlarmTypes(algorithmSceneSaveDto.getAlarmTypes().stream().collect(Collectors.joining(",")));
algorithmSceneBase.setCameraIdList(algorithmSceneSaveDto.getCameraIdList().stream().collect(Collectors.joining(",")));
int i = insertAlgorithmSceneBase(algorithmSceneBase); int i = insertAlgorithmSceneBase(algorithmSceneBase);
//删除场景下算法块及参数数据 //删除场景下算法块及参数数据
algorithmScenePieceService.deleteAlgorithmScenePieceBySceneId(algorithmSceneBase.getId()); algorithmScenePieceService.deleteAlgorithmScenePieceBySceneId(algorithmSceneBase.getId());
//新建场景下算法块及参数 //新建场景下算法块及参数
List<AlgorithmScenePiece> algorithmScenePieceList = algorithmSceneDetailsDto List<AlgorithmScenePiece> algorithmScenePieceList = algorithmSceneSaveDto
.getPieceDtos() .getPieceDtos()
.stream() .stream()
.flatMap(pieceDto -> pieceDto.getVariables() .flatMap(pieceDto -> pieceDto.getVariables()
...@@ -189,17 +192,19 @@ public class AlgorithmSceneBaseServiceImpl implements IAlgorithmSceneBaseService ...@@ -189,17 +192,19 @@ public class AlgorithmSceneBaseServiceImpl implements IAlgorithmSceneBaseService
} }
@Override @Override
public int updateAlgorithmSceneDetailsDto(AlgorithmSceneDetailsDto algorithmSceneDetailsDto) { public int updateAlgorithmSceneSaveDto(AlgorithmSceneSaveDto algorithmSceneSaveDto) {
//更新场景 //更新场景
AlgorithmSceneBase algorithmSceneBase = new AlgorithmSceneBase(); AlgorithmSceneBase algorithmSceneBase = new AlgorithmSceneBase();
BeanUtils.copyBeanProp(algorithmSceneBase, algorithmSceneDetailsDto); BeanUtils.copyBeanProp(algorithmSceneBase, algorithmSceneSaveDto);
algorithmSceneBase.setAlarmTypes(algorithmSceneSaveDto.getAlarmTypes().stream().collect(Collectors.joining(",")));
algorithmSceneBase.setCameraIdList(algorithmSceneSaveDto.getCameraIdList().stream().collect(Collectors.joining(",")));
int i = updateAlgorithmSceneBase(algorithmSceneBase); int i = updateAlgorithmSceneBase(algorithmSceneBase);
//删除场景下算法块及参数数据 //删除场景下算法块及参数数据
algorithmScenePieceService.deleteAlgorithmScenePieceBySceneId(algorithmSceneBase.getId()); algorithmScenePieceService.deleteAlgorithmScenePieceBySceneId(algorithmSceneBase.getId());
//新建场景下算法块及参数 //新建场景下算法块及参数
List<AlgorithmScenePiece> algorithmScenePieceList = algorithmSceneDetailsDto List<AlgorithmScenePiece> algorithmScenePieceList = algorithmSceneSaveDto
.getPieceDtos() .getPieceDtos()
.stream() .stream()
.flatMap(pieceDto -> pieceDto.getVariables() .flatMap(pieceDto -> pieceDto.getVariables()
......
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
<result property="createBy" column="nick_name"/> <result property="createBy" column="nick_name"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="cameraIdList" column="camera_id_list"/> <result property="cameraIdList" column="camera_id_list"/>
<collection property="alarmTypes" javaType="ArrayList" column="id" <result property="alarmTypesString" column="alarm_types"/>
<collection property="alarmTypes" javaType="ArrayList" column="alarm_types"
ofType="com.ruoyi.algorithm.domain.AlgorithmBaseType" select="selectAlgorithmBaseType"/> ofType="com.ruoyi.algorithm.domain.AlgorithmBaseType" select="selectAlgorithmBaseType"/>
<collection property="cameras" javaType="ArrayList" column="camera_id_list" <collection property="cameras" javaType="ArrayList" column="camera_id_list"
ofType="com.ruoyi.algorithm.domain.dto.AlgorithmCameraListDto" select="selectAlgorithmCameraListDto"/> ofType="com.ruoyi.algorithm.domain.dto.AlgorithmCameraListDto" select="selectAlgorithmCameraListDto"/>
...@@ -67,7 +68,8 @@ ...@@ -67,7 +68,8 @@
su.nick_name, su.nick_name,
asb.create_time, asb.create_time,
asb.`status`, asb.`status`,
asb.camera_id_list asb.camera_id_list,
asb.alarm_types
FROM FROM
algorithm_scene_base asb algorithm_scene_base asb
LEFT JOIN algorithm_base ab ON ab.id = asb.algorithm_id LEFT JOIN algorithm_base ab ON ab.id = asb.algorithm_id
...@@ -98,7 +100,7 @@ ...@@ -98,7 +100,7 @@
type_key AS typeKey, type_key AS typeKey,
type_name AS typeName type_name AS typeName
from algorithm_base_type from algorithm_base_type
where algorithm_id = #{id} where FIND_IN_SET( type_key, #{alarmTypesString} )
</select> </select>
<select id="selectAlgorithmCameraListDto" resultType="com.ruoyi.algorithm.domain.dto.AlgorithmCameraListDto"> <select id="selectAlgorithmCameraListDto" resultType="com.ruoyi.algorithm.domain.dto.AlgorithmCameraListDto">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment