Browse Source

feat:新增地图场景环境配置和相机配置接口

master_tdsql
caoqi 1 year ago
parent
commit
2786739919
  1. 104
      shuili-system/src/main/java/com/kms/yg/znjg/controller/SySceneConfigRelationController.java
  2. 11
      shuili-system/src/main/java/com/kms/yg/znjg/domain/SySceneConfigRelation.java

104
shuili-system/src/main/java/com/kms/yg/znjg/controller/SySceneConfigRelationController.java

@ -0,0 +1,104 @@
package com.kms.yg.znjg.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kms.yg.znjg.domain.SyScene;
import com.kms.yg.znjg.domain.SySceneConfigRelation;
import com.kms.yg.znjg.mapper.SySceneConfigRelationMapper;
import com.kms.yg.znjg.mapper.SySceneMapper;
import com.kms.yg.znjg.service.SySceneConfigRelationService;
import com.kms.yg.znjg.service.SySceneService;
import com.kms.yxgh.base.Response;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description 地图场景环境和视角配置管理
*/
@RestController
@RequestMapping("/map/scene/config")
@Api(tags = "地图场景环境和视角配置管理")
public class SySceneConfigRelationController {
@Autowired
private SySceneConfigRelationService sySceneConfigRelationService;
@Autowired
private SySceneConfigRelationMapper sySceneConfigRelationMapper;
@Autowired
private SySceneMapper sySceneMapper;
/**
* 保存/更新环境和视角配置对象
*
* @param sySceneConfigRelation
* @return
*/
@PostMapping(value = "/saveOrUpdateConfig")
public Response<String> saveOrUpdateConfig(@RequestBody SySceneConfigRelation sySceneConfigRelation) {
Response<String> responseInfo = new Response<>();
try {
if (sySceneConfigRelation.getSceneId() == null) {
throw new Exception("场景id不能为空");
}
QueryWrapper<SyScene> wrapper = new QueryWrapper<>();
// and 语句
Map<String, Object> map = new HashMap();
map.put("id", sySceneConfigRelation.getSceneId());
map.put("is_valid", 1);
wrapper.allEq(map);
List<SyScene> sceneList = sySceneMapper.selectList(wrapper);
if (sceneList == null || sceneList.size() == 0) {
throw new Exception("场景不存在");
}
sySceneConfigRelation.setIsValid(1);
sySceneConfigRelationService.saveOrUpdate(sySceneConfigRelation);
responseInfo.setCode("200");
responseInfo.setData("保存成功");
} catch (Exception e) {
e.printStackTrace();
responseInfo.setCode("500");
responseInfo.setMsg(e.getMessage());
}
return responseInfo;
}
/**
* 根据id查询场景环境以及相机配置信息
*
* @param sceneId 场景id
* @return
* @throws Exception
*/
@GetMapping(value = "/findConfigBySceneId/{sceneId}")
public Response<SySceneConfigRelation> findConfigBySceneId(@PathVariable(value = "sceneId") String sceneId) throws Exception {
Response<SySceneConfigRelation> responseInfo = new Response<>();
try {
// 组装查询条件
QueryWrapper<SySceneConfigRelation> wrapper = new QueryWrapper<>();
// and 语句
Map<String, Object> map = new HashMap();
map.put("scene_id", sceneId);
map.put("is_valid", 1);
wrapper.allEq(map);
List<SySceneConfigRelation> sySceneConfigRelations = sySceneConfigRelationMapper.selectList(wrapper);
if (sySceneConfigRelations != null && sySceneConfigRelations.size() > 0) {
responseInfo.setCode("200");
responseInfo.setData(sySceneConfigRelations.get(0));
} else {
responseInfo.setCode("200");
responseInfo.setData(null);
}
} catch (Exception e) {
e.printStackTrace();
responseInfo.setCode("500");
responseInfo.setMsg(e.getMessage());
}
return responseInfo;
}
}

11
shuili-system/src/main/java/com/kms/yg/znjg/domain/SySceneConfigRelation.java

@ -4,15 +4,16 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName bs_sgc_qqjd_scene_config_relation
*/
@TableName(value ="bs_sgc_qqjd_scene_config_relation")
@TableName(value = "bs_sgc_qqjd_scene_config_relation")
@Data
public class SySceneConfigRelation implements Serializable {
/**
@ -58,7 +59,6 @@ public class SySceneConfigRelation implements Serializable {
/**
* 缩放灵敏度
*/
private Integer zoomSensitivity;
@ -77,6 +77,11 @@ public class SySceneConfigRelation implements Serializable {
*/
private Object cameraPosture;
/**
* 数据是否有效用来标识逻辑删除1可用0已被逻辑删除
*/
private Integer isValid;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
Loading…
Cancel
Save