摄像头管理功能、摄像头查看页面
This commit is contained in:
parent
87cc7562d3
commit
b7d64a9d83
@ -0,0 +1,109 @@
|
||||
package com.cm.population.controller.api.camera;
|
||||
|
||||
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.population.pojo.dtos.camera.CameraDTO;
|
||||
import com.cm.population.pojo.vos.camera.CameraVO;
|
||||
import com.cm.population.service.camera.ICameraService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 摄像头管理
|
||||
* @author : LY
|
||||
* @date :2023-11-14 17:53
|
||||
* @description :
|
||||
* @modyified By:
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "摄像头接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/camera")
|
||||
public class CameraController extends AbstractController {
|
||||
|
||||
@Autowired
|
||||
private ICameraService cameraService;
|
||||
|
||||
|
||||
@ApiOperation(value = "新增摄像头信息", notes = "新增摄像头信息接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("save")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult save(@RequestBody CameraVO cameraVO) throws Exception {
|
||||
return cameraService.save(cameraVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改摄像头信息", notes = "修改摄像头信息接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "cityCameraId", value = "摄像头ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update/{cityCameraId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult update(@PathVariable("cityCameraId") String cityCameraId, @RequestBody CameraVO cameraVO) throws Exception {
|
||||
return cameraService.update(cityCameraId, cameraVO);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "摄像头详情(通过ID)", notes = "摄像头详情(通过ID)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "cityCameraId", value = "摄像头ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get/{cityCameraId}")
|
||||
public CameraDTO getCensusMsgById(@PathVariable("cityCameraId") String cityCameraId) throws SearchException {
|
||||
return cameraService.get(cityCameraId);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "攝像头信息列表", notes = "攝像头信息列表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list")
|
||||
public List<CameraDTO> list() throws SearchException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return cameraService.list(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "攝像头信息分页列表", notes = "攝像头信息分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage")
|
||||
public SuccessResultList<List<CameraDTO>> listPage(ListPage page) throws SearchException {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return cameraService.listPage(page);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "删除摄像头", notes = "删除摄像头接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@DeleteMapping("remove/{ids}")
|
||||
public SuccessResult remove(@PathVariable("ids") String ids) {
|
||||
cameraService.remove(null, Arrays.asList(ids.split("\\_")));
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.cm.population.controller.route.camera;
|
||||
|
||||
/**
|
||||
* @author : LY
|
||||
* @date :2023-11-16 14:36
|
||||
* @description :
|
||||
* @modyified By:
|
||||
*/
|
||||
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* @ClassName: SecurityController
|
||||
* @Description: 摄像头路由
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2023-10-25 15:53:09
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "摄像头路由")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/camera")
|
||||
public class CameraRouteController extends AbstractController {
|
||||
|
||||
|
||||
@GetMapping("save")
|
||||
public ModelAndView save() {
|
||||
return new ModelAndView("camera/save");
|
||||
}
|
||||
|
||||
@GetMapping("update")
|
||||
public ModelAndView update() {
|
||||
return new ModelAndView("camera/update");
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public ModelAndView list() {
|
||||
return new ModelAndView("camera/list");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("view-console")
|
||||
public ModelAndView viewConsole() {
|
||||
return new ModelAndView("camera/view-console");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
86
src/main/java/com/cm/population/dao/camera/ICameraDao.java
Normal file
86
src/main/java/com/cm/population/dao/camera/ICameraDao.java
Normal file
@ -0,0 +1,86 @@
|
||||
package com.cm.population.dao.camera;
|
||||
|
||||
import com.cm.common.exception.RemoveException;
|
||||
import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.exception.UpdateException;
|
||||
import com.cm.population.pojo.dtos.camera.CameraDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: ICameraDao
|
||||
* @Description: 摄像头管理
|
||||
* @Author: WenG
|
||||
* @Date: 2020-11-16 11:20
|
||||
* @Version: 1.0
|
||||
**/
|
||||
|
||||
|
||||
@Repository
|
||||
public interface ICameraDao {
|
||||
|
||||
|
||||
/**
|
||||
* 新增攝像头
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 删除攝像头
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void remove(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 删除攝像头(物理)
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 修改攝像头
|
||||
*
|
||||
* @param params
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void update(Map<String, Object> params) throws UpdateException;
|
||||
|
||||
/**
|
||||
* 攝像头详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
CameraDTO get(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 攝像头列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<CameraDTO> list(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 攝像头统计
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
Integer count(Map<String, Object> params) throws SearchException;
|
||||
|
||||
|
||||
}
|
134
src/main/java/com/cm/population/pojo/dtos/camera/CameraDTO.java
Normal file
134
src/main/java/com/cm/population/pojo/dtos/camera/CameraDTO.java
Normal file
@ -0,0 +1,134 @@
|
||||
package com.cm.population.pojo.dtos.camera;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
/**
|
||||
* 摄像头管理
|
||||
* @author : LY
|
||||
* @date :2023-11-14 18:01
|
||||
* @description :
|
||||
* @modyified By:
|
||||
*/
|
||||
|
||||
@ApiModel
|
||||
public class CameraDTO {
|
||||
|
||||
private String cityCameraId;
|
||||
private String cameraName;
|
||||
private String cameraStreetId;
|
||||
private String cameraStreetName;
|
||||
private String cameraCommunityId;
|
||||
private String cameraCommunityName;
|
||||
private String cameraDistrictId;
|
||||
private String cameraDistrictName;
|
||||
private String cameraLongitude;
|
||||
private String cameraLatitude;
|
||||
private String cameraAddress;
|
||||
private String cameraRtspLink;
|
||||
private String remark;
|
||||
|
||||
|
||||
public String getCityCameraId() {
|
||||
return cityCameraId;
|
||||
}
|
||||
|
||||
public void setCityCameraId(String cityCameraId) {
|
||||
this.cityCameraId = cityCameraId;
|
||||
}
|
||||
|
||||
public String getCameraName() {
|
||||
return cameraName;
|
||||
}
|
||||
|
||||
public void setCameraName(String cameraName) {
|
||||
this.cameraName = cameraName;
|
||||
}
|
||||
|
||||
public String getCameraStreetId() {
|
||||
return cameraStreetId;
|
||||
}
|
||||
|
||||
public void setCameraStreetId(String cameraStreetId) {
|
||||
this.cameraStreetId = cameraStreetId;
|
||||
}
|
||||
|
||||
public String getCameraStreetName() {
|
||||
return cameraStreetName;
|
||||
}
|
||||
|
||||
public void setCameraStreetName(String cameraStreetName) {
|
||||
this.cameraStreetName = cameraStreetName;
|
||||
}
|
||||
|
||||
public String getCameraCommunityId() {
|
||||
return cameraCommunityId;
|
||||
}
|
||||
|
||||
public void setCameraCommunityId(String cameraCommunityId) {
|
||||
this.cameraCommunityId = cameraCommunityId;
|
||||
}
|
||||
|
||||
public String getCameraCommunityName() {
|
||||
return cameraCommunityName;
|
||||
}
|
||||
|
||||
public void setCameraCommunityName(String cameraCommunityName) {
|
||||
this.cameraCommunityName = cameraCommunityName;
|
||||
}
|
||||
|
||||
public String getCameraDistrictId() {
|
||||
return cameraDistrictId;
|
||||
}
|
||||
|
||||
public void setCameraDistrictId(String cameraDistrictId) {
|
||||
this.cameraDistrictId = cameraDistrictId;
|
||||
}
|
||||
|
||||
public String getCameraDistrictName() {
|
||||
return cameraDistrictName;
|
||||
}
|
||||
|
||||
public void setCameraDistrictName(String cameraDistrictName) {
|
||||
this.cameraDistrictName = cameraDistrictName;
|
||||
}
|
||||
|
||||
public String getCameraLongitude() {
|
||||
return cameraLongitude;
|
||||
}
|
||||
|
||||
public void setCameraLongitude(String cameraLongitude) {
|
||||
this.cameraLongitude = cameraLongitude;
|
||||
}
|
||||
|
||||
public String getCameraLatitude() {
|
||||
return cameraLatitude;
|
||||
}
|
||||
|
||||
public void setCameraLatitude(String cameraLatitude) {
|
||||
this.cameraLatitude = cameraLatitude;
|
||||
}
|
||||
|
||||
public String getCameraAddress() {
|
||||
return cameraAddress;
|
||||
}
|
||||
|
||||
public void setCameraAddress(String cameraAddress) {
|
||||
this.cameraAddress = cameraAddress;
|
||||
}
|
||||
|
||||
public String getCameraRtspLink() {
|
||||
return cameraRtspLink;
|
||||
}
|
||||
|
||||
public void setCameraRtspLink(String cameraRtspLink) {
|
||||
this.cameraRtspLink = cameraRtspLink;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
129
src/main/java/com/cm/population/pojo/vos/camera/CameraVO.java
Normal file
129
src/main/java/com/cm/population/pojo/vos/camera/CameraVO.java
Normal file
@ -0,0 +1,129 @@
|
||||
package com.cm.population.pojo.vos.camera;
|
||||
|
||||
/**
|
||||
* @author : LY
|
||||
* @date :2023-11-16 9:22
|
||||
* @description :
|
||||
* @modyified By:
|
||||
*/
|
||||
public class CameraVO {
|
||||
|
||||
private String cityCameraId;
|
||||
private String cameraName;
|
||||
private String cameraStreetId;
|
||||
private String cameraStreetName;
|
||||
private String cameraCommunityId;
|
||||
private String cameraCommunityName;
|
||||
private String cameraDistrictId;
|
||||
private String cameraDistrictName;
|
||||
private String cameraLongitude;
|
||||
private String cameraLatitude;
|
||||
private String cameraAddress;
|
||||
private String cameraRtspLink;
|
||||
private String remark;
|
||||
|
||||
|
||||
public String getCityCameraId() {
|
||||
return cityCameraId;
|
||||
}
|
||||
|
||||
public void setCityCameraId(String cityCameraId) {
|
||||
this.cityCameraId = cityCameraId;
|
||||
}
|
||||
|
||||
public String getCameraName() {
|
||||
return cameraName;
|
||||
}
|
||||
|
||||
public void setCameraName(String cameraName) {
|
||||
this.cameraName = cameraName;
|
||||
}
|
||||
|
||||
public String getCameraStreetId() {
|
||||
return cameraStreetId;
|
||||
}
|
||||
|
||||
public void setCameraStreetId(String cameraStreetId) {
|
||||
this.cameraStreetId = cameraStreetId;
|
||||
}
|
||||
|
||||
public String getCameraStreetName() {
|
||||
return cameraStreetName;
|
||||
}
|
||||
|
||||
public void setCameraStreetName(String cameraStreetName) {
|
||||
this.cameraStreetName = cameraStreetName;
|
||||
}
|
||||
|
||||
public String getCameraCommunityId() {
|
||||
return cameraCommunityId;
|
||||
}
|
||||
|
||||
public void setCameraCommunityId(String cameraCommunityId) {
|
||||
this.cameraCommunityId = cameraCommunityId;
|
||||
}
|
||||
|
||||
public String getCameraCommunityName() {
|
||||
return cameraCommunityName;
|
||||
}
|
||||
|
||||
public void setCameraCommunityName(String cameraCommunityName) {
|
||||
this.cameraCommunityName = cameraCommunityName;
|
||||
}
|
||||
|
||||
public String getCameraDistrictId() {
|
||||
return cameraDistrictId;
|
||||
}
|
||||
|
||||
public void setCameraDistrictId(String cameraDistrictId) {
|
||||
this.cameraDistrictId = cameraDistrictId;
|
||||
}
|
||||
|
||||
public String getCameraDistrictName() {
|
||||
return cameraDistrictName;
|
||||
}
|
||||
|
||||
public void setCameraDistrictName(String cameraDistrictName) {
|
||||
this.cameraDistrictName = cameraDistrictName;
|
||||
}
|
||||
|
||||
public String getCameraLongitude() {
|
||||
return cameraLongitude;
|
||||
}
|
||||
|
||||
public void setCameraLongitude(String cameraLongitude) {
|
||||
this.cameraLongitude = cameraLongitude;
|
||||
}
|
||||
|
||||
public String getCameraLatitude() {
|
||||
return cameraLatitude;
|
||||
}
|
||||
|
||||
public void setCameraLatitude(String cameraLatitude) {
|
||||
this.cameraLatitude = cameraLatitude;
|
||||
}
|
||||
|
||||
public String getCameraAddress() {
|
||||
return cameraAddress;
|
||||
}
|
||||
|
||||
public void setCameraAddress(String cameraAddress) {
|
||||
this.cameraAddress = cameraAddress;
|
||||
}
|
||||
|
||||
public String getCameraRtspLink() {
|
||||
return cameraRtspLink;
|
||||
}
|
||||
|
||||
public void setCameraRtspLink(String cameraRtspLink) {
|
||||
this.cameraRtspLink = cameraRtspLink;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package com.cm.population.service.camera;
|
||||
|
||||
|
||||
import com.cm.common.exception.RemoveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.population.pojo.dtos.camera.CameraDTO;
|
||||
import com.cm.population.pojo.vos.camera.CameraVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 摄像头管理
|
||||
* @author : LY
|
||||
* @date :2023-11-16 9:25
|
||||
* @description :
|
||||
* @modyified By:
|
||||
*/
|
||||
|
||||
public interface ICameraService {
|
||||
|
||||
|
||||
/**
|
||||
* 保存摄像头
|
||||
* @param cameraVO
|
||||
* @throws Exception
|
||||
*/
|
||||
SuccessResult save(CameraVO cameraVO) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 修改摄像头
|
||||
* @param cityCameraId
|
||||
* @param cameraVO
|
||||
*/
|
||||
SuccessResult update(String cityCameraId, CameraVO cameraVO) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 获取摄像头详情
|
||||
* @param cityCameraId
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
CameraDTO get(String cityCameraId) throws SearchException;
|
||||
|
||||
|
||||
/**
|
||||
* 获取摄像头列表
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<CameraDTO> list(Map<String, Object> params);
|
||||
|
||||
|
||||
/**
|
||||
* 摄像头分页列表
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<CameraDTO>> listPage(ListPage page) throws SearchException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除摄像头
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return
|
||||
*/
|
||||
void remove(String token, List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 删除摄像头(物理删除)
|
||||
*
|
||||
* @param ids id列表
|
||||
*/
|
||||
void delete(List<String> ids) throws RemoveException;
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.cm.population.service.camera.impl;
|
||||
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.exception.RemoveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.common.utils.HashMapUtil;
|
||||
import com.cm.common.utils.UUIDUtil;
|
||||
import com.cm.population.dao.camera.ICameraDao;
|
||||
import com.cm.population.pojo.dtos.camera.CameraDTO;
|
||||
import com.cm.population.pojo.vos.camera.CameraVO;
|
||||
import com.cm.population.service.camera.ICameraService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 摄像头管理
|
||||
* @author : LY
|
||||
* @date :2023-11-16 9:25
|
||||
* @description :
|
||||
* @modyified By:
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class CameraServiceImpl extends AbstractService implements ICameraService {
|
||||
|
||||
@Autowired
|
||||
private ICameraDao cameraDao;
|
||||
|
||||
|
||||
@Override
|
||||
public SuccessResult save(CameraVO cameraVO) throws Exception {
|
||||
this.saveReturnId(null, cameraVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public SuccessResult update(String cityCameraId, CameraVO cameraVO) throws Exception{
|
||||
this.updateInfo(null, cityCameraId, cameraVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CameraDTO get(String cityCameraId) throws SearchException {
|
||||
Map<String, Object> params = super.getHashMap(1);
|
||||
params.put("cityCameraId", cityCameraId);
|
||||
return cameraDao.get(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CameraDTO> list(Map<String, Object> params) {
|
||||
return cameraDao.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<CameraDTO>> listPage(ListPage page) throws SearchException{
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<CameraDTO> list = cameraDao.list(page.getParams());
|
||||
PageInfo<CameraDTO> pageInfo = new PageInfo<>(list);
|
||||
return new SuccessResultList<>(list, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(String token, List<String> ids) {
|
||||
Map<String, Object> params = getHashMap(3);
|
||||
params.put("cityCameraIds", ids);
|
||||
if (token != null) {
|
||||
setUpdateInfo(token, params);
|
||||
} else {
|
||||
setUpdateInfo(params);
|
||||
}
|
||||
cameraDao.remove(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<String> ids) throws RemoveException {
|
||||
Map<String, Object> params = getHashMap(3);
|
||||
params.put("cityCameraIds", ids);
|
||||
cameraDao.delete(params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String saveReturnId(String token, CameraVO cameraVO) throws Exception{
|
||||
String cityCameraId = UUIDUtil.getUUID();
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(cameraVO);
|
||||
params.put("cityCameraId", cityCameraId);
|
||||
if (token != null) {
|
||||
setSaveInfo(token, params);
|
||||
} else {
|
||||
setSaveInfo(params);
|
||||
}
|
||||
cameraDao.save(params);
|
||||
return cityCameraId;
|
||||
}
|
||||
|
||||
|
||||
public void updateInfo(String token, String cityCameraId, CameraVO cameraVO) throws Exception{
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(cameraVO);
|
||||
params.put("cityCameraId", cityCameraId);
|
||||
if (token != null) {
|
||||
setUpdateInfo(token, params);
|
||||
} else {
|
||||
setUpdateInfo(params);
|
||||
}
|
||||
cameraDao.update(params);
|
||||
}
|
||||
}
|
202
src/main/resources/mybatis/mapper/camera/camera-mapper.xml
Normal file
202
src/main/resources/mybatis/mapper/camera/camera-mapper.xml
Normal file
@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cm.population.dao.camera.ICameraDao">
|
||||
|
||||
<resultMap id="cameraDTO" type="com.cm.population.pojo.dtos.camera.CameraDTO">
|
||||
<result column="city_camera_id" property="cityCameraId"/>
|
||||
<result column="camera_name" property="cameraName"/>
|
||||
<result column="camera_street_id" property="cameraStreetId"/>
|
||||
<result column="camera_street_name" property="cameraStreetName"/>
|
||||
<result column="camera_community_id" property="cameraCommunityId"/>
|
||||
<result column="camera_community_name" property="cameraCommunityName"/>
|
||||
<result column="camera_district_id" property="cameraDistrictId"/>
|
||||
<result column="camera_district_name" property="cameraDistrictName"/>
|
||||
<result column="camera_longitude" property="cameraLongitude"/>
|
||||
<result column="camera_latitude" property="cameraLatitude"/>
|
||||
<result column="camera_address" property="cameraAddress"/>
|
||||
<result column="camera_rtsp_link" property="cameraRtspLink"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 新增摄像头 -->
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO city_camera (
|
||||
city_camera_id,
|
||||
camera_name,
|
||||
camera_street_id,
|
||||
camera_street_name,
|
||||
camera_community_id,
|
||||
camera_community_name,
|
||||
camera_district_id,
|
||||
camera_district_name,
|
||||
camera_longitude,
|
||||
camera_latitude,
|
||||
camera_address,
|
||||
camera_rtsp_link,
|
||||
remark,
|
||||
creator,
|
||||
gmt_create,
|
||||
modifier,
|
||||
gmt_modified,
|
||||
is_delete
|
||||
) values (
|
||||
#{cityCameraId},
|
||||
#{cameraName},
|
||||
#{cameraStreetId},
|
||||
#{cameraStreetName},
|
||||
#{cameraCommunityId},
|
||||
#{cameraCommunityName},
|
||||
#{cameraDistrictId},
|
||||
#{cameraDistrictName},
|
||||
#{cameraLongitude},
|
||||
#{cameraLatitude},
|
||||
#{cameraAddress},
|
||||
#{cameraRtspLink},
|
||||
#{remark},
|
||||
#{creator},
|
||||
#{gmtCreate},
|
||||
#{modifier},
|
||||
#{gmtModified},
|
||||
#{isDelete}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除摄像头 -->
|
||||
<update id="remove" parameterType="map">
|
||||
UPDATE
|
||||
city_camera
|
||||
SET
|
||||
gmt_modified = #{gmtModified},
|
||||
modifier = #{modifier},
|
||||
is_delete = 1
|
||||
WHERE
|
||||
city_camera_id IN
|
||||
<foreach collection="cityCameraIds" index="index" open="(" separator="," close=")">
|
||||
#{cityCameraIds[${index}]}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 删除摄像头(物理) -->
|
||||
<update id="delete" parameterType="map">
|
||||
DELETE FROM
|
||||
city_camera
|
||||
WHERE
|
||||
city_camera_id = #{cityCameraId}
|
||||
</update>
|
||||
|
||||
<!-- 摄像头修改 -->
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
city_camera
|
||||
SET
|
||||
<if test="cameraName != null and cameraName != ''">
|
||||
camera_name = #{cameraName},
|
||||
</if>
|
||||
<if test="cameraStreetId != null and cameraStreetId != ''">
|
||||
camera_street_id = #{cameraStreetId},
|
||||
</if>
|
||||
<if test="cameraStreetName != null and cameraStreetName != ''">
|
||||
camera_street_name = #{cameraStreetName},
|
||||
</if>
|
||||
<if test="cameraCommunityId != null and cameraCommunityId != ''">
|
||||
camera_community_id = #{cameraCommunityId},
|
||||
</if>
|
||||
<if test="cameraCommunityName != null and cameraCommunityName != ''">
|
||||
camera_community_name = #{cameraCommunityName},
|
||||
</if>
|
||||
<if test="cameraDistrictId != null and cameraDistrictId != ''">
|
||||
camera_district_id = #{cameraDistrictId},
|
||||
</if>
|
||||
<if test="cameraDistrictName != null and cameraDistrictName != ''">
|
||||
camera_district_name = #{cameraDistrictName},
|
||||
</if>
|
||||
<if test="cameraLongitude != null and cameraLongitude != ''">
|
||||
camera_longitude = #{cameraLongitude},
|
||||
</if>
|
||||
<if test="cameraLatitude != null and cameraLatitude != ''">
|
||||
camera_latitude = #{cameraLatitude},
|
||||
</if>
|
||||
<if test="cameraAddress != null and cameraAddress != ''">
|
||||
camera_address = #{cameraAddress},
|
||||
</if>
|
||||
<if test="cameraRtspLink != null and cameraRtspLink != ''">
|
||||
camera_rtsp_link = #{cameraRtspLink},
|
||||
</if>
|
||||
remark = #{remark},
|
||||
gmt_modified = #{gmtModified},
|
||||
modifier = #{modifier}
|
||||
WHERE
|
||||
city_camera_id = #{cityCameraId}
|
||||
</update>
|
||||
|
||||
<!-- 摄像头详情 -->
|
||||
<select id="get" parameterType="map" resultMap="cameraDTO">
|
||||
SELECT
|
||||
city_camera_id,
|
||||
camera_name,
|
||||
camera_street_id,
|
||||
camera_street_name,
|
||||
camera_community_id,
|
||||
camera_community_name,
|
||||
camera_district_id,
|
||||
camera_district_name,
|
||||
camera_longitude,
|
||||
camera_latitude,
|
||||
camera_address,
|
||||
camera_rtsp_link,
|
||||
remark
|
||||
FROM
|
||||
city_camera
|
||||
WHERE
|
||||
city_camera_id = #{cityCameraId}
|
||||
</select>
|
||||
|
||||
<!-- 摄像头列表 -->
|
||||
<select id="list" parameterType="map" resultMap="cameraDTO">
|
||||
SELECT
|
||||
city_camera_id,
|
||||
camera_name,
|
||||
camera_street_id,
|
||||
camera_street_name,
|
||||
camera_community_id,
|
||||
camera_community_name,
|
||||
camera_district_id,
|
||||
camera_district_name,
|
||||
camera_longitude,
|
||||
camera_latitude,
|
||||
camera_address,
|
||||
camera_rtsp_link,
|
||||
remark
|
||||
FROM
|
||||
city_camera
|
||||
WHERE
|
||||
is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
camera_name LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="cameraStreetId != null and cameraStreetId != ''">
|
||||
AND camera_street_id = #{cameraStreetId}
|
||||
</if>
|
||||
<if test="cameraCommunityId != null and cameraCommunityId != ''">
|
||||
AND camera_community_id = #{cameraCommunityId}
|
||||
</if>
|
||||
<if test="cameraDistrictId != null and cameraDistrictId != ''">
|
||||
AND camera_district_id = #{cameraDistrictId}
|
||||
</if>
|
||||
ORDER BY gmt_create DESC
|
||||
</select>
|
||||
|
||||
<!-- 摄像头统计 -->
|
||||
<select id="count" parameterType="map" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
city_camera
|
||||
WHERE
|
||||
city_camera_id = #{cityCameraId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
BIN
src/main/resources/static/assets/images/camera-img.png
Normal file
BIN
src/main/resources/static/assets/images/camera-img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
358
src/main/resources/templates/camera/list.html
Normal file
358
src/main/resources/templates/camera/list.html
Normal file
@ -0,0 +1,358 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
|
||||
<style>
|
||||
.layui-input {
|
||||
width: 150px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="请输入名称">
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item" id="streetSelectTemplateBox" lay-filter="streetSelectTemplateBox"></div>
|
||||
<div class="layui-inline layui-form search-item" id="communitySelectTemplateBox" lay-filter="communitySelectTemplateBox"></div>
|
||||
<div class="layui-inline layui-form search-item" id="districtSelectTemplateBox" lay-filter="districtSelectTemplateBox"></div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 新增
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
|
||||
<i class="fa fa-lg fa-edit"></i> 编辑
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script id="streetSelectTemplate" type="text/html">
|
||||
<select id="cameraStreetId" lay-filter="street">
|
||||
<option value="">请选择街道</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.id}}">{{item.name}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
|
||||
<script id="communitySelectTemplate" type="text/html">
|
||||
<select id="cameraCommunityId" lay-filter="community">
|
||||
<option value="">请选择社区</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.communityId}}">{{item.communityName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
|
||||
<script id="districtSelectTemplate" type="text/html">
|
||||
<select id="cameraDistrictId" >
|
||||
<option value="">请选择小区</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.residentialId}}">{{item.name}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
|
||||
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'form', 'laytpl', 'laydate', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/camera/listpage';
|
||||
|
||||
|
||||
|
||||
// 街道数据
|
||||
function initStreetTemplate() {
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getStreetList', []), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('streetSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('streetSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'streetSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 社区数据
|
||||
function initCommunityTemplate(areaId){
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getCommunityList?areaId={areaId}', [areaId]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('communitySelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('communitySelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'communitySelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 小区数据
|
||||
function initDistrictTemplate(streetId, communityId){
|
||||
top.restAjax.get(top.restAjax.path('api/residential/list?street={street}&community={community}', [streetId, communityId]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('districtSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('districtSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'districtSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
form.on('select(street)', function(data){
|
||||
if(data.value){
|
||||
initCommunityTemplate(data.value)
|
||||
}else{
|
||||
initCommunityTemplate('0')
|
||||
}
|
||||
});
|
||||
|
||||
form.on('select(community)', function(data){
|
||||
if(data.value){
|
||||
initDistrictTemplate($('#cameraStreetId').val(), data.value)
|
||||
}else{
|
||||
initDistrictTemplate('0', '0')
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 90,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'cameraName', width: 200, title: '摄像头名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'cameraStreetName', width: 180, title: '所属街道', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'cameraCommunityName', width: 180, title: '所属社区', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'cameraDistrictName', width: 180, title: '所属小区', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'cameraAddress', width: 300, title: '详细地址', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
cameraStreetId: $('#cameraStreetId').val(),
|
||||
cameraCommunityId: $('#cameraCommunityId').val(),
|
||||
cameraDistrictId: $('#cameraDistrictId').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 90,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 删除
|
||||
function removeData(ids) {
|
||||
top.dialog.msg(top.dataMessage.delete, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/camera/remove/{ids}', [ids]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||
reloadTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(function () {
|
||||
initTable();
|
||||
initStreetTemplate();
|
||||
initCommunityTemplate('00')
|
||||
initDistrictTemplate('00','00')
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
// 事件 - 增删改
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'saveEvent') {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/camera/save', []),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'updateEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||
} else if(checkDatas.length > 1) {
|
||||
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||
} else {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/camera/update?cityCameraId={cityCameraId}', [checkDatas[0].cityCameraId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if(layEvent === 'removeEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectDelete);
|
||||
} else {
|
||||
var ids = '';
|
||||
for(var i = 0, item; item = checkDatas[i++];) {
|
||||
if(i > 1) {
|
||||
ids += '_';
|
||||
}
|
||||
ids += item['cityCameraId'];
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
294
src/main/resources/templates/camera/save.html
Normal file
294
src/main/resources/templates/camera/save.html
Normal file
@ -0,0 +1,294 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>新增内容</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm" id="dataForm">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称 <span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="cameraName" name="cameraName" class="layui-input" value="" placeholder="请输入摄像头名称" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所在街道 <span style="color: red">*</span></label>
|
||||
<div class="layui-input-block layui-form" id="streetSelectTemplateBox" lay-filter="streetSelectTemplateBox"></div>
|
||||
<script id="streetSelectTemplate" type="text/html">
|
||||
<select id="cameraStreetId" name="cameraStreetId" lay-filter="street" lay-verify="required" lay-search>
|
||||
<option value="">请选择街道</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.id}}">{{item.name}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所在社区 <span style="color: red">*</span></label>
|
||||
<div class="layui-input-block layui-form" id="communitySelectTemplateBox" lay-filter="communitySelectTemplateBox"></div>
|
||||
<script id="communitySelectTemplate" type="text/html">
|
||||
<select id="cameraCommunityId" name="cameraCommunityId" lay-filter="community" lay-verify="required" lay-search>
|
||||
<option value="">请选择社区</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.communityId}}">{{item.communityName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所在小区</label>
|
||||
<div class="layui-input-block layui-form" id="districtSelectTemplateBox" lay-filter="districtSelectTemplateBox"></div>
|
||||
<script id="districtSelectTemplate" type="text/html">
|
||||
<select id="cameraDistrictId" name="cameraDistrictId" lay-filter="district" lay-search>
|
||||
<option value="">请选择小区</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.residentialId}}">{{item.name}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">RTSP地址<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="cameraRtspLink" name="cameraRtspLink" class="layui-input" value="" placeholder="请输入RTSP地址" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">详细地址<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="cameraLongitude" name="cameraLongitude" lay-verify="longitude">
|
||||
<input type="hidden" id="cameraLatitude" name="cameraLatitude">
|
||||
<input type="text" id="cameraAddress" name="cameraAddress" class="layui-input" value="" placeholder="请输入详细地址" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row" id="mapDiv">
|
||||
<div class="layui-col-sm12" style="padding: 0 0 10px 0px;">
|
||||
<div id="mapContainer" style="width: 100%;height: 350px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea type="text" id="remark" name="remark" class="layui-textarea" value="" placeholder="请输入备注"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" id="submitBtn" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=oWU9RD4ihDHAafexgI6XOrTK8lDatRju"></script>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var viewerObj = {};
|
||||
var baseInfoId;
|
||||
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
|
||||
// 街道数据
|
||||
function initStreetTemplate() {
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getStreetList', []), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('streetSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('streetSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'streetSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 社区数据
|
||||
function initCommunityTemplate(areaId){
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getCommunityList?areaId={areaId}', [areaId]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('communitySelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('communitySelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'communitySelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 小区数据
|
||||
function initDistrictTemplate(streetId, communityId){
|
||||
top.restAjax.get(top.restAjax.path('api/residential/list?street={street}&community={community}', [streetId, communityId]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('districtSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('districtSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'districtSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化百度地图
|
||||
function initMap(longitude, latitude) {
|
||||
map = new BMap.Map("mapContainer", {enableMapClick: false,});
|
||||
var point = new BMap.Point(longitude, latitude);
|
||||
map.centerAndZoom(point, 13);
|
||||
map.disableDoubleClickZoom();
|
||||
map.addControl(new BMap.NavigationControl());
|
||||
map.addControl(new BMap.ScaleControl());
|
||||
map.addControl(new BMap.OverviewMapControl());
|
||||
map.addControl(new BMap.MapTypeControl());
|
||||
map.enableScrollWheelZoom();//启用地图滚轮放大缩小
|
||||
map.enableContinuousZoom();//开启缩放平滑
|
||||
// 点击获取地址
|
||||
var geocoder= new BMap.Geocoder();
|
||||
mapMarkPoint(map, point);
|
||||
map.addEventListener("click", function(e) {
|
||||
map.clearOverlays();
|
||||
$('#cameraLongitude').val(e.point.lng);
|
||||
$('#cameraLatitude').val(e.point.lat);
|
||||
point = new BMap.Point(e.point.lng, e.point.lat);
|
||||
mapMarkPoint(map, point);
|
||||
geocoder.getLocation(e.point, function(rs) {
|
||||
$('#cameraAddress').val(rs.address);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function mapMarkPoint(map, point) {
|
||||
var marker = new BMap.Marker(point);
|
||||
map.addOverlay(marker);
|
||||
}
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
initStreetTemplate();
|
||||
initCommunityTemplate('00')
|
||||
initDistrictTemplate('00','00')
|
||||
initMap(109.9169990478825, 40.59520202810689);
|
||||
}
|
||||
initData();
|
||||
|
||||
|
||||
|
||||
form.on('select(street)', function(data){
|
||||
if(data.value){
|
||||
initCommunityTemplate(data.value)
|
||||
}else{
|
||||
initCommunityTemplate('0')
|
||||
}
|
||||
});
|
||||
|
||||
form.on('select(community)', function(data){
|
||||
if(data.value){
|
||||
initDistrictTemplate($('#cameraStreetId').val(), data.value)
|
||||
}else{
|
||||
initDistrictTemplate('0', '0')
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
formData.field.cameraStreetName = $('#cameraStreetId option:selected').text();
|
||||
formData.field.cameraCommunityName = $('#cameraCommunityId option:selected').text();
|
||||
formData.field.cameraDistrictName = $('#cameraDistrictId').val() == '' ? '' : $('#cameraDistrictId option:selected').text();
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/camera/save', []), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
longitude : function(value, item){
|
||||
if(value == ''){
|
||||
return '请在地图上标记摄像头位置';
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
318
src/main/resources/templates/camera/update.html
Normal file
318
src/main/resources/templates/camera/update.html
Normal file
@ -0,0 +1,318 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm" id="dataForm">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称 <span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="cameraName" name="cameraName" class="layui-input" value="" placeholder="请输入摄像头名称" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所在街道 <span style="color: red">*</span></label>
|
||||
<div class="layui-input-block layui-form" id="streetSelectTemplateBox" lay-filter="streetSelectTemplateBox"></div>
|
||||
<script id="streetSelectTemplate" type="text/html">
|
||||
<select id="cameraStreetId" name="cameraStreetId" lay-filter="street" lay-verify="required" lay-search>
|
||||
<option value="">请选择街道</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.id}}">{{item.name}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所在社区 <span style="color: red">*</span></label>
|
||||
<div class="layui-input-block layui-form" id="communitySelectTemplateBox" lay-filter="communitySelectTemplateBox"></div>
|
||||
<script id="communitySelectTemplate" type="text/html">
|
||||
<select id="cameraCommunityId" name="cameraCommunityId" lay-filter="community" lay-verify="required" lay-search>
|
||||
<option value="">请选择社区</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.communityId}}">{{item.communityName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所在小区</label>
|
||||
<div class="layui-input-block layui-form" id="districtSelectTemplateBox" lay-filter="districtSelectTemplateBox"></div>
|
||||
<script id="districtSelectTemplate" type="text/html">
|
||||
<select id="cameraDistrictId" name="cameraDistrictId" lay-filter="district" lay-search>
|
||||
<option value="">请选择小区</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.residentialId}}">{{item.name}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">RTSP地址<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="cameraRtspLink" name="cameraRtspLink" class="layui-input" value="" placeholder="请输入RTSP地址" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">详细地址<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="cameraLongitude" name="cameraLongitude" lay-verify="longitude">
|
||||
<input type="hidden" id="cameraLatitude" name="cameraLatitude">
|
||||
<input type="text" id="cameraAddress" name="cameraAddress" class="layui-input" value="" placeholder="请输入详细地址" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row" id="mapDiv">
|
||||
<div class="layui-col-sm12" style="padding: 0 0 10px 0px;">
|
||||
<div id="mapContainer" style="width: 100%;height: 350px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea type="text" id="remark" name="remark" class="layui-textarea" value="" placeholder="请输入备注"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" id="submitBtn" class="layui-btn" lay-submit lay-filter="submitForm">提交修改</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=oWU9RD4ihDHAafexgI6XOrTK8lDatRju"></script>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
|
||||
var cityCameraId = top.restAjax.params(window.location.href).cityCameraId;
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
|
||||
// 街道数据
|
||||
function initStreetTemplate(selectValue) {
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getStreetList', []), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('streetSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('streetSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'streetSelectTemplateBox');
|
||||
|
||||
var selectObj = {};
|
||||
selectObj['cameraStreetId'] = selectValue;
|
||||
form.val('dataForm', selectObj);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 社区数据
|
||||
function initCommunityTemplate(areaId, selectValue){
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getCommunityList?areaId={areaId}', [areaId]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('communitySelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('communitySelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'communitySelectTemplateBox');
|
||||
|
||||
var selectObj = {};
|
||||
selectObj['cameraCommunityId'] = selectValue;
|
||||
form.val('dataForm', selectObj);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 小区数据
|
||||
function initDistrictTemplate(streetId, communityId, selectValue){
|
||||
top.restAjax.get(top.restAjax.path('api/residential/list?street={street}&community={community}', [streetId, communityId]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('districtSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('districtSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'districtSelectTemplateBox');
|
||||
|
||||
var selectObj = {};
|
||||
selectObj['cameraDistrictId'] = selectValue;
|
||||
form.val('dataForm', selectObj);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化百度地图
|
||||
function initMap(longitude, latitude) {
|
||||
map = new BMap.Map("mapContainer", {enableMapClick: false,});
|
||||
var point = new BMap.Point(longitude, latitude);
|
||||
map.centerAndZoom(point, 13);
|
||||
map.disableDoubleClickZoom();
|
||||
map.addControl(new BMap.NavigationControl());
|
||||
map.addControl(new BMap.ScaleControl());
|
||||
map.addControl(new BMap.OverviewMapControl());
|
||||
map.addControl(new BMap.MapTypeControl());
|
||||
map.enableScrollWheelZoom();//启用地图滚轮放大缩小
|
||||
map.enableContinuousZoom();//开启缩放平滑
|
||||
// 点击获取地址
|
||||
var geocoder= new BMap.Geocoder();
|
||||
mapMarkPoint(map, point);
|
||||
map.addEventListener("click", function(e) {
|
||||
map.clearOverlays();
|
||||
$('#cameraLongitude').val(e.point.lng);
|
||||
$('#cameraLatitude').val(e.point.lat);
|
||||
point = new BMap.Point(e.point.lng, e.point.lat);
|
||||
mapMarkPoint(map, point);
|
||||
geocoder.getLocation(e.point, function(rs) {
|
||||
$('#cameraAddress').val(rs.address);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function mapMarkPoint(map, point) {
|
||||
var marker = new BMap.Marker(point);
|
||||
map.addOverlay(marker);
|
||||
}
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/camera/get/{cityCameraId}', [cityCameraId]), {}, null, function(code, data) {
|
||||
var dataFormData = {};
|
||||
for(var i in data) {
|
||||
dataFormData[i] = data[i] +'';
|
||||
}
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render(null, 'dataForm');
|
||||
initStreetTemplate(data.cameraStreetId);
|
||||
initCommunityTemplate(data.cameraStreetId, data.cameraCommunityId)
|
||||
initDistrictTemplate(data.cameraStreetId, data.cameraCommunityId, data.cameraDistrictId)
|
||||
initMap(data.cameraLongitude, data.cameraLatitude);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
|
||||
|
||||
|
||||
form.on('select(street)', function(data){
|
||||
if(data.value){
|
||||
initCommunityTemplate(data.value)
|
||||
}else{
|
||||
initCommunityTemplate('0')
|
||||
}
|
||||
});
|
||||
|
||||
form.on('select(community)', function(data){
|
||||
if(data.value){
|
||||
initDistrictTemplate($('#cameraStreetId').val(), data.value)
|
||||
}else{
|
||||
initDistrictTemplate('0', '0')
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
formData.field.cameraStreetName = $('#cameraStreetId option:selected').text();
|
||||
formData.field.cameraCommunityName = $('#cameraCommunityId option:selected').text();
|
||||
formData.field.cameraDistrictName = $('#cameraDistrictId').val() == '' ? '' : $('#cameraDistrictId option:selected').text();
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/camera/update/{cityCameraId}', [cityCameraId]), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
longitude : function(value, item){
|
||||
if(value == ''){
|
||||
return '请在地图上标记摄像头位置';
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
302
src/main/resources/templates/camera/view-console.html
Normal file
302
src/main/resources/templates/camera/view-console.html
Normal file
@ -0,0 +1,302 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
|
||||
<style>
|
||||
video{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.camera {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
/*border-bottom: 1px solid #ccc;*/
|
||||
}
|
||||
|
||||
.camera-icon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
/*background-color: #ccc;*/
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.camera-icon img{
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.camera-details {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.camera-name {
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.camera-location {
|
||||
color: #888;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.camera:hover {
|
||||
border: 2px solid #999;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
/* .container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.container .layui-form-select {
|
||||
width: 100%;
|
||||
}*/
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" id="LAY-component-grid-mobile">
|
||||
<div class="layui-row layui-col-space12">
|
||||
<div class="layui-col-md3 camera-list">
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header container">
|
||||
<div class="layui-inline layui-form search-item" id="streetSelectTemplateBox" lay-filter="streetSelectTemplateBox"></div>
|
||||
<div class="layui-inline layui-form search-item" id="communitySelectTemplateBox" lay-filter="communitySelectTemplateBox"></div>
|
||||
<div class="layui-inline layui-form search-item" id="districtSelectTemplateBox" lay-filter="districtSelectTemplateBox"></div>
|
||||
</div>
|
||||
<div class="layui-card-body" id="camera-data">
|
||||
<!--<div class="camera">
|
||||
<div class="camera-icon"></div>
|
||||
<div class="camera-details">
|
||||
<div class="camera-name">摄像头2</div>
|
||||
<div class="camera-location">位置2</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md9 camera-feed">
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
摄像头一
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<video src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" controls autoplay></video>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
摄像头一
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<video src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" controls autoplay></video>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
摄像头一
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<video src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" controls autoplay></video>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
摄像头一
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<video src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" controls autoplay></video>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script id="streetSelectTemplate" type="text/html">
|
||||
<select id="cameraStreetId" lay-filter="street">
|
||||
<option value="">请选择街道</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.id}}">{{item.name}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
|
||||
<script id="communitySelectTemplate" type="text/html">
|
||||
<select id="cameraCommunityId" lay-filter="community">
|
||||
<option value="">请选择社区</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.communityId}}">{{item.communityName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
|
||||
<script id="districtSelectTemplate" type="text/html">
|
||||
<select id="cameraDistrictId" lay-filter="district">
|
||||
<option value="">请选择小区</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.residentialId}}">{{item.name}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
|
||||
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index','common', 'flow', 'form', 'laytpl'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var admin = layui.admin;
|
||||
var common = layui.common;
|
||||
var flow = layui.flow;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var resizeTimeout = null;
|
||||
|
||||
|
||||
// 街道数据
|
||||
function initStreetTemplate() {
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getStreetList', []), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('streetSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('streetSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'streetSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 社区数据
|
||||
function initCommunityTemplate(areaId){
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getCommunityList?areaId={areaId}', [areaId]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('communitySelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('communitySelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'communitySelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 小区数据
|
||||
function initDistrictTemplate(streetId, communityId){
|
||||
top.restAjax.get(top.restAjax.path('api/residential/list?street={street}&community={community}', [streetId, communityId]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('districtSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('districtSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'districtSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
form.on('select(street)', function(data){
|
||||
if(data.value){
|
||||
initCommunityTemplate(data.value)
|
||||
}else{
|
||||
initCommunityTemplate('0')
|
||||
}
|
||||
});
|
||||
|
||||
form.on('select(community)', function(data){
|
||||
if(data.value){
|
||||
initDistrictTemplate($('#cameraStreetId').val(), data.value)
|
||||
}else{
|
||||
initDistrictTemplate('0', '0')
|
||||
}
|
||||
});
|
||||
|
||||
form.on('select(district)', function(data){
|
||||
if(data.value){
|
||||
initData(data.value)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(function(){
|
||||
// 样式
|
||||
var windowHeight = $(window).height() - 50;
|
||||
$('.camera-list .layui-card-body').css({
|
||||
'height': (windowHeight - 50) + 'px',
|
||||
'overflow' : 'auto'
|
||||
});
|
||||
$('.camera-feed .layui-card-body').css({
|
||||
'height': (windowHeight / 2 - 61) + 'px'
|
||||
});
|
||||
|
||||
initStreetTemplate();
|
||||
initCommunityTemplate('00')
|
||||
initDistrictTemplate('00','00')
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
function initData(cameraDistrictId){
|
||||
$('#camera-data').children().remove()
|
||||
flow.load({
|
||||
elem: '#camera-data'
|
||||
,done: function(page, next){
|
||||
top.restAjax.get(top.restAjax.path('api/camera/listpage', []), {
|
||||
page: page,
|
||||
rows: 10,
|
||||
cameraDistrictId : cameraDistrictId
|
||||
}, null, function(code, data) {
|
||||
var lis = [];
|
||||
$.each(data.rows, function(i,d){
|
||||
lis.push('<div class="camera">');
|
||||
lis.push('<div class="camera-icon"><img src="assets/images/camera-img.png" alt="摄像头"></div>');
|
||||
lis.push('<div class="camera-details">');
|
||||
lis.push('<div class="camera-name">名称:'+ d.cameraName +'</div>');
|
||||
lis.push('<div class="camera-location">位置:'+ d.cameraAddress +'</div>');
|
||||
lis.push('</div>');
|
||||
lis.push('</div>');
|
||||
});
|
||||
next(lis.join(''), page < (data.total / 10));
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user