Kaynağa Gözat

Merge branch 'develop' of http://192.168.11.14:51037/gitadmin/tuoheng_lc into feature_v1.0

tags/v1.2.0^2
chengwang 1 yıl önce
ebeveyn
işleme
fd812a4f71
3 değiştirilmiş dosya ile 85 ekleme ve 6 silme
  1. +36
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/CameraController.java
  2. +39
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/CameraServiceImpl.java
  3. +10
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/ICameraService.java

+ 36
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/CameraController.java Dosyayı Görüntüle

@@ -1,13 +1,13 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.domain.Camera;
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest;
import com.tuoheng.admin.service.camera.ICameraService;
import com.tuoheng.common.common.OperationEnum;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.system.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

/**
* @desc: 摄像头 前端控制器
@@ -38,5 +38,37 @@ public class CameraController {
return cameraService.getOneById(id);
}

/**
* 添加摄像头
*
* @param entity 实体对象
* @return
*/
@PostMapping("/add")
public JsonResult add(@RequestBody Camera entity) {
return cameraService.editInfo(entity);
}

/**
* 编辑摄像头
*
* @param entity 实体对象
* @return
*/
@PutMapping("/edit")
public JsonResult edit(@RequestBody Camera entity) {
return cameraService.editInfo(entity);
}

/**
* 删除摄像头
*
* @param ids 摄像头ID
* @return
*/
@DeleteMapping("/delete/{ids}")
public JsonResult delete(@PathVariable("ids") Integer[] ids) {
return cameraService.deleteByIds(ids);
}

}

+ 39
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/CameraServiceImpl.java Dosyayı Görüntüle

@@ -1,8 +1,17 @@
package com.tuoheng.admin.service.camera;
import cn.hutool.core.util.ObjectUtil;
import com.tuoheng.admin.entity.domain.Camera;
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest;
import com.tuoheng.admin.mapper.CameraMapper;
import com.tuoheng.admin.service.camera.query.QueryCameraListService;
import com.tuoheng.admin.utils.GaodeUtil;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.common.OperationEnum;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import com.tuoheng.system.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -14,7 +23,7 @@ import org.springframework.stereotype.Service;
* @date 2023-02-06
*/
@Service
public class CameraServiceImpl implements ICameraService {
public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> implements ICameraService {
@Autowired
private QueryCameraListService queryCameraListService;
@@ -41,4 +50,33 @@ public class CameraServiceImpl implements ICameraService {
return null;
}
@Override
public JsonResult editInfo(Camera entity) {
//新增
if (StringUtils.isNull(entity.getId())) {
if (StringUtils.isEmpty(entity.getCameraName())) {
throw new ServiceException(0, "摄像头名称不能为空");
}
if (ObjectUtil.isEmpty(entity.getCameraType())) {
throw new ServiceException(0, "设备类型不能为空");
}
if (StringUtils.isEmpty(entity.getLongitude())) {
throw new ServiceException(0, "经度不能为空");
}
if (StringUtils.isEmpty(entity.getLatitude())) {
throw new ServiceException(0, "纬度不能为空");
}
if (StringUtils.isEmpty(entity.getFlvUrl())) {
throw new ServiceException(0, "摄像头地址不能为空");
}
}
if(StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())){
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude());
entity.setLocation(gaodeAddress);
}
super.edit(entity);
return JsonResult.success();
}
}

+ 10
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/ICameraService.java Dosyayı Görüntüle

@@ -1,6 +1,8 @@
package com.tuoheng.admin.service.camera;
import com.tuoheng.admin.entity.domain.Camera;
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;
/**
@@ -10,7 +12,7 @@ import com.tuoheng.common.utils.JsonResult;
* @author wanjing
* @date 2023-02-06
*/
public interface ICameraService {
public interface ICameraService extends IBaseService<Camera> {
/**
* 查询摄像头列表
@@ -27,4 +29,11 @@ public interface ICameraService {
* @return 摄像头
*/
JsonResult getOneById(Integer id);
/**
* 新增或编辑摄像头
* @param entity
* @return
*/
JsonResult editInfo(Camera entity);
}

Yükleniyor…
İptal
Kaydet