长庆项目day3
This commit is contained in:
parent
e6aa88d552
commit
6a7d0bb746
|
@ -245,6 +245,15 @@
|
||||||
<version>1.4.4</version>
|
<version>1.4.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.modelmapper</groupId>
|
||||||
|
<artifactId>modelmapper</artifactId>
|
||||||
|
<version>3.1.0</version> <!-- 检查最新版本 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>com.arcsoft.face</groupId>-->
|
<!-- <groupId>com.arcsoft.face</groupId>-->
|
||||||
<!-- <artifactId>arcsoft-sdk-face</artifactId>-->
|
<!-- <artifactId>arcsoft-sdk-face</artifactId>-->
|
||||||
|
|
|
@ -8,6 +8,6 @@ import lombok.NoArgsConstructor;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class PeronType {
|
public class PeronType {
|
||||||
private int labelId;
|
private int type;
|
||||||
private String name;
|
private String name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,16 +65,6 @@ public class CqMemberController {
|
||||||
// 创建分页对象
|
// 创建分页对象
|
||||||
Page<TenPersonEntity> pageRequest = new Page<>(page, size);
|
Page<TenPersonEntity> pageRequest = new Page<>(page, size);
|
||||||
|
|
||||||
/* QueryWrapper<TenPersonEntity> queryWrapper = new QueryWrapper<>();
|
|
||||||
|
|
||||||
// 假设你想按名字进行筛选(name 为数据库中的字段名)
|
|
||||||
if (!unitName.isEmpty()){
|
|
||||||
queryWrapper.eq("cell_name", unitName);
|
|
||||||
}
|
|
||||||
|
|
||||||
queryWrapper.orderByDesc("upload_time");*/
|
|
||||||
|
|
||||||
|
|
||||||
// 使用 MyBatis-Plus 提供的分页查询
|
// 使用 MyBatis-Plus 提供的分页查询
|
||||||
IPage<TenPersonEntity> pageResult = cqMemberMapper.selectPage(pageRequest, null);
|
IPage<TenPersonEntity> pageResult = cqMemberMapper.selectPage(pageRequest, null);
|
||||||
|
|
||||||
|
@ -380,7 +370,7 @@ public class CqMemberController {
|
||||||
}else{
|
}else{
|
||||||
tenPersonEntity.setGender(2);
|
tenPersonEntity.setGender(2);
|
||||||
}
|
}
|
||||||
tenPersonEntity.setIc(visitorDto.getIdCard());
|
tenPersonEntity.setIdCard(visitorDto.getIdCard());
|
||||||
tenPersonEntity.setMobile(visitorDto.getPhone());
|
tenPersonEntity.setMobile(visitorDto.getPhone());
|
||||||
tenPersonEntity.setOrgImageTemp(visitorDto.getFacePhotoUrl());
|
tenPersonEntity.setOrgImageTemp(visitorDto.getFacePhotoUrl());
|
||||||
tenPersonEntity.setIsProtectDevice(visitorDto.getIsProtectDevice());
|
tenPersonEntity.setIsProtectDevice(visitorDto.getIsProtectDevice());
|
||||||
|
|
|
@ -1,26 +1,22 @@
|
||||||
package net.shapelight.modules.iCq.controller.video;
|
package net.shapelight.modules.iCq.controller.video;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.shapelight.common.config.MinioConfig;
|
|
||||||
import net.shapelight.common.utils.R;
|
import net.shapelight.common.utils.R;
|
||||||
import net.shapelight.modules.face.rtsp.RtspFrameGrabber;
|
import net.shapelight.modules.face.rtsp.RtspFrameGrabber;
|
||||||
import net.shapelight.modules.iCq.controller.video.dto.UpdateVideoDto;
|
import net.shapelight.modules.iCq.controller.video.dto.UpdateVideoDto;
|
||||||
import net.shapelight.modules.iCq.controller.video.dto.UploadVideoDto;
|
import net.shapelight.modules.iCq.controller.video.dto.UploadVideoDto;
|
||||||
import net.shapelight.modules.iCq.controller.video.vo.Unit;
|
|
||||||
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
|
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
|
||||||
import net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper;
|
import net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper;
|
||||||
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
|
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
|
||||||
|
import net.shapelight.modules.iCq.service.video.CqSafeVideoServiceImpl;
|
||||||
|
import net.shapelight.modules.ten.dao.TenCellDao;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,114 +28,81 @@ import java.util.List;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CqSafeVideoController {
|
public class CqSafeVideoController {
|
||||||
|
|
||||||
private static String BUCKET_NAME = "cqyt";
|
private final CqSafeVideoServiceImpl cqSafeVideoService;
|
||||||
|
|
||||||
private final MinioConfig minioConfig;
|
|
||||||
|
|
||||||
private final CqSafeVideoMapper cqSafeVideoMapper;
|
private final CqSafeVideoMapper cqSafeVideoMapper;
|
||||||
|
|
||||||
private final CqFileMapper cqFileMapper;
|
private final CqFileMapper cqFileMapper;
|
||||||
|
|
||||||
|
private final TenCellDao cqCellMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RtspFrameGrabber rtspFrameGrabber;
|
private RtspFrameGrabber rtspFrameGrabber;
|
||||||
|
|
||||||
@GetMapping("/getTopUnits")
|
|
||||||
|
@GetMapping("/getCells")
|
||||||
@ApiOperation(value = "获取单位列表")
|
@ApiOperation(value = "获取单位列表")
|
||||||
public R getTopUnits() {
|
public R getCells() {
|
||||||
List<Unit> queryUnit = cqSafeVideoMapper.queryUnit();
|
return R.ok()
|
||||||
return R.ok().put("data", queryUnit);
|
.put("data", cqSafeVideoService.getCellInfos())
|
||||||
|
.put("total", cqSafeVideoService.getCellInfos().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/insert")
|
@PostMapping("/insert")
|
||||||
public R insert(@RequestBody UploadVideoDto uploadVideoDto) throws IOException {
|
@ApiOperation(value = "新增视频接口")
|
||||||
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
|
public R insert(@RequestBody UploadVideoDto uploadVideoDto) throws IOException {
|
||||||
|
if (cqSafeVideoService.insert(uploadVideoDto) == 1) {
|
||||||
tenSafeVideoEntity.setName(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()).getFileName());
|
|
||||||
/* tenSafeVideoEntity.setCellId(cqSafeVideoMapper.runTheNameById(uploadVideoDto.getUnitName()));
|
|
||||||
tenSafeVideoEntity.setCellName(uploadVideoDto.getUnitName());*/
|
|
||||||
tenSafeVideoEntity.setCellId(uploadVideoDto.getUnitId());
|
|
||||||
tenSafeVideoEntity.setCellName(cqSafeVideoMapper.findTheNameById(uploadVideoDto.getUnitId()));
|
|
||||||
tenSafeVideoEntity.setUploadId(uploadVideoDto.getUploaderId());
|
|
||||||
tenSafeVideoEntity.setUploadName(uploadVideoDto.getUploader());
|
|
||||||
tenSafeVideoEntity.setUploadTime(new Date());
|
|
||||||
tenSafeVideoEntity.setUrl(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()).getFileUrl());
|
|
||||||
tenSafeVideoEntity.setPlayCount(0);
|
|
||||||
tenSafeVideoEntity.setFileId(uploadVideoDto.getFileId());
|
|
||||||
|
|
||||||
if (cqSafeVideoMapper.insert(tenSafeVideoEntity) == 1) {
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
} else {
|
} else {
|
||||||
return R.error();
|
return R.error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
@ApiOperation(value = "列表视频接口")
|
||||||
public R list(@RequestParam(defaultValue = "1") int page,
|
public R list(@RequestParam(defaultValue = "1") int page,
|
||||||
@RequestParam(defaultValue = "10") int size,
|
@RequestParam(defaultValue = "10") int size,
|
||||||
String unitId) {
|
String cellId) {
|
||||||
// 创建分页对象
|
List<TenSafeVideoEntity> list = cqSafeVideoService.list(page, size, cellId);
|
||||||
Page<TenSafeVideoEntity> pageRequest = new Page<>(page, size);
|
return R.ok()
|
||||||
QueryWrapper<TenSafeVideoEntity> queryWrapper = new QueryWrapper<>();
|
.put("data", list)
|
||||||
// 假设你想按名字进行筛选(name 为数据库中的字段名)
|
.put("total", list.size());
|
||||||
if (unitId != null && !unitId.isEmpty()){
|
|
||||||
queryWrapper.eq("cell_id", unitId);
|
|
||||||
}
|
|
||||||
|
|
||||||
queryWrapper.orderByDesc("upload_time");
|
|
||||||
|
|
||||||
|
|
||||||
// 使用 MyBatis-Plus 提供的分页查询
|
|
||||||
IPage<TenSafeVideoEntity> pageResult = cqSafeVideoMapper.selectPage(pageRequest, queryWrapper);
|
|
||||||
|
|
||||||
List<TenSafeVideoEntity> list = pageResult.getRecords();
|
|
||||||
|
|
||||||
/* for (TenSafeVideoEntity tenSafeVideoEntity : list) {
|
|
||||||
tenSafeVideoEntity.setCellName(cqSafeVideoMapper.findsTheParentId(tenSafeVideoEntity.getCellId()) + "/" +
|
|
||||||
tenSafeVideoEntity.getCellName());
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return R.ok().put("data", list).put("total", pageResult.getTotal());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete/{id}")
|
@DeleteMapping("/delete/{id}")
|
||||||
|
@ApiOperation(value = "删除视频接口")
|
||||||
public R delete(@PathVariable Long id) {
|
public R delete(@PathVariable Long id) {
|
||||||
if (cqSafeVideoMapper.deleteById(id) == 1) {
|
if (cqSafeVideoService.delete(id)) {
|
||||||
return R.ok();
|
return R.ok();
|
||||||
} else {
|
}else {
|
||||||
return R.error();
|
return R.error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改
|
@PutMapping("/update")
|
||||||
@PostMapping("/update")
|
@ApiOperation(value = "更新视频接口")
|
||||||
public R update(@RequestBody UpdateVideoDto updateVideoDto) {
|
public R update(@RequestBody UpdateVideoDto updateVideoDto) {
|
||||||
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
|
if (cqSafeVideoService.update(updateVideoDto) == 1) {
|
||||||
tenSafeVideoEntity.setName(cqFileMapper.selectByFileId(updateVideoDto.getFileId()).getFileName());
|
|
||||||
tenSafeVideoEntity.setId(updateVideoDto.getVideoId());
|
|
||||||
/* tenSafeVideoEntity.setCellId(cqSafeVideoMapper.runTheNameById(updateVideoDto.getUnitName()));
|
|
||||||
tenSafeVideoEntity.setCellName(updateVideoDto.getUnitName());*/
|
|
||||||
tenSafeVideoEntity.setCellId(updateVideoDto.getUnitId());
|
|
||||||
tenSafeVideoEntity.setCellName(cqSafeVideoMapper.findTheNameById(updateVideoDto.getUnitId()));
|
|
||||||
tenSafeVideoEntity.setUploadTime(new Date());
|
|
||||||
tenSafeVideoEntity.setUrl(cqFileMapper.selectByFileId(updateVideoDto.getFileId()).getFileUrl());
|
|
||||||
tenSafeVideoEntity.setFileId(updateVideoDto.getFileId());
|
|
||||||
if (cqSafeVideoMapper.updateById(tenSafeVideoEntity) == 1) {
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
} else {
|
} else {
|
||||||
return R.error();
|
return R.error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/inquireVideo")
|
||||||
@GetMapping("/inquireVideo")
|
@ApiOperation(value = "条件查询视频接口")
|
||||||
public R inquireVideo(@RequestParam(defaultValue = "1") int page,
|
public R inquireVideo(@RequestParam(defaultValue = "1") int page,
|
||||||
@RequestParam(defaultValue = "10") int size,
|
@RequestParam(defaultValue = "10") int size,
|
||||||
String unitId, String videoName, String uploader){
|
@RequestParam(required = false) String cellId,
|
||||||
System.out.println("uploader + 上传人 = " + uploader);
|
@RequestParam(required = false) String videoName,
|
||||||
List<TenSafeVideoEntity> list = cqSafeVideoMapper.relatedQuery(unitId, videoName, uploader);
|
@RequestParam(required = false) String uploadName){
|
||||||
return R.ok().put("data", list);
|
List<TenSafeVideoEntity> tenSafeVideoEntities =
|
||||||
}
|
cqSafeVideoService.inquireVideo(cellId, videoName, uploadName);
|
||||||
|
return R.ok()
|
||||||
|
.put("data", tenSafeVideoEntities)
|
||||||
|
.put("total",tenSafeVideoEntities.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/singleFind")
|
@GetMapping("/singleFind")
|
||||||
public R singleFind(int videoId){
|
public R singleFind(int videoId){
|
||||||
|
@ -154,7 +117,6 @@ public class CqSafeVideoController {
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/face/recognition")
|
@PostMapping("/face/recognition")
|
||||||
public R aWatchStart(@RequestParam("image") MultipartFile image, @RequestParam String cellId) {
|
public R aWatchStart(@RequestParam("image") MultipartFile image, @RequestParam String cellId) {
|
||||||
rtspFrameGrabber.recognition(image,cellId);
|
rtspFrameGrabber.recognition(image,cellId);
|
||||||
|
|
|
@ -4,7 +4,16 @@ import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UpdateVideoDto {
|
public class UpdateVideoDto {
|
||||||
|
/**
|
||||||
|
* 文件id
|
||||||
|
*/
|
||||||
private String fileId;
|
private String fileId;
|
||||||
|
/**
|
||||||
|
* 视频id
|
||||||
|
*/
|
||||||
private Long videoId;
|
private Long videoId;
|
||||||
private String unitId;
|
/**
|
||||||
|
* 单位id
|
||||||
|
*/
|
||||||
|
private Long cellId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,29 @@
|
||||||
package net.shapelight.modules.iCq.controller.video.dto;
|
package net.shapelight.modules.iCq.controller.video.dto;
|
||||||
|
|
||||||
import io.swagger.models.auth.In;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
public class UploadVideoDto {
|
public class UploadVideoDto {
|
||||||
|
/**
|
||||||
|
* 文件id
|
||||||
|
*/
|
||||||
private String fileId;
|
private String fileId;
|
||||||
private String uploader;
|
/**
|
||||||
private Long uploaderId;
|
* 上传人姓名
|
||||||
private String unitId;
|
*/
|
||||||
|
private String uploadName;
|
||||||
|
/**
|
||||||
|
* 上传人id
|
||||||
|
*/
|
||||||
|
private Long uploadId;
|
||||||
|
/**
|
||||||
|
* 单位id
|
||||||
|
*/
|
||||||
|
private Long cellId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package net.shapelight.modules.iCq.controller.video.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class VideoQueryDto {
|
||||||
|
/**
|
||||||
|
* 单位id
|
||||||
|
*/
|
||||||
|
private String cellId;
|
||||||
|
/**
|
||||||
|
* 视频名称
|
||||||
|
*/
|
||||||
|
private String videoName;
|
||||||
|
/**
|
||||||
|
* 上传人姓名
|
||||||
|
*/
|
||||||
|
private String uploadName;
|
||||||
|
|
||||||
|
}
|
|
@ -1,14 +1,22 @@
|
||||||
package net.shapelight.modules.iCq.controller.video.vo;
|
package net.shapelight.modules.iCq.controller.video.vo;
|
||||||
|
//前端查询部门返回Vo
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
//单位返回Vo
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class Unit {
|
@Accessors(chain = true)
|
||||||
private String orgId;
|
public class CellVo {
|
||||||
|
/**
|
||||||
|
* 部门Id
|
||||||
|
*/
|
||||||
|
private Long cellId;
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
}
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package net.shapelight.modules.iCq.dal.dataobject.video;
|
package net.shapelight.modules.iCq.dal.dataobject.video;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -15,9 +17,24 @@ import java.util.Date;
|
||||||
@TableName("ten_file")
|
@TableName("ten_file")
|
||||||
public class FileEntity implements Serializable {
|
public class FileEntity implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 文件id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
private String fileId;
|
private String fileId;
|
||||||
private String fileName;
|
/**
|
||||||
private String fileUrl;
|
* 文件名称
|
||||||
|
*/
|
||||||
|
@TableField("file_name")
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 文件url
|
||||||
|
*/
|
||||||
|
@TableField("file_url")
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* 文件上传时间
|
||||||
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date uploadTime;
|
private Date uploadTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class TenSafeVideoEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 单位ID
|
* 单位ID
|
||||||
*/
|
*/
|
||||||
private String cellId;
|
private Long cellId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单位名称
|
* 单位名称
|
||||||
|
|
|
@ -2,41 +2,14 @@ package net.shapelight.modules.iCq.dal.mysql.video;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
import net.shapelight.modules.iCq.controller.video.vo.Unit;
|
|
||||||
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
|
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
|
||||||
import org.apache.ibatis.annotations.MapKey;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CqSafeVideoMapper extends BaseMapper<TenSafeVideoEntity> {
|
public interface CqSafeVideoMapper extends BaseMapper<TenSafeVideoEntity> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询 单位 信息(名称 和 id)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<Unit> queryUnit();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据单位id查询单位名称
|
|
||||||
* @param unitName 单位名称
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Long runTheNameById(String unitName);
|
|
||||||
|
|
||||||
|
|
||||||
//目前没用 明天测试 待删除
|
|
||||||
String findsTheParentId(Long id);
|
|
||||||
|
|
||||||
//目前没用 明天测试 待删除
|
String findTheNameById(long cellId);
|
||||||
List<Long> queryHighestLevelUnit();
|
|
||||||
|
|
||||||
//目前没用 明天测试 待删除
|
|
||||||
List<String> queryChildUnit(String name);
|
|
||||||
|
|
||||||
List<TenSafeVideoEntity> relatedQuery(String unitId, String videoName, String uploader);
|
|
||||||
|
|
||||||
String findTheNameById(String unitId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
package net.shapelight.modules.iCq.service.video;
|
package net.shapelight.modules.iCq.service.video;
|
||||||
|
|
||||||
public interface CqSafeVideoService {
|
public interface CqSafeVideoService {
|
||||||
|
//接口声明()
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
package net.shapelight.modules.iCq.service.video;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import net.shapelight.common.utils.R;
|
||||||
|
import net.shapelight.modules.iCq.controller.video.dto.UpdateVideoDto;
|
||||||
|
import net.shapelight.modules.iCq.controller.video.dto.UploadVideoDto;
|
||||||
|
import net.shapelight.modules.iCq.controller.video.dto.VideoQueryDto;
|
||||||
|
import net.shapelight.modules.iCq.controller.video.vo.CellVo;
|
||||||
|
import net.shapelight.modules.iCq.dal.dataobject.video.FileEntity;
|
||||||
|
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
|
||||||
|
import net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper;
|
||||||
|
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
|
||||||
|
import net.shapelight.modules.ten.dao.TenCellDao;
|
||||||
|
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.modelmapper.TypeMap;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CqSafeVideoServiceImpl {
|
||||||
|
|
||||||
|
private final TenCellDao cqCellMapper;
|
||||||
|
|
||||||
|
private final CqFileMapper cqFileMapper;
|
||||||
|
|
||||||
|
private final CqSafeVideoMapper cqSafeVideoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<CellVo> getCellInfos() {
|
||||||
|
return cqCellMapper.selectList(new QueryWrapper<>()).stream()
|
||||||
|
.map(cell -> {
|
||||||
|
CellVo cellVo = new CellVo();
|
||||||
|
BeanUtils.copyProperties(cell, cellVo);
|
||||||
|
return cellVo;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int insert(UploadVideoDto uploadVideoDto) {
|
||||||
|
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
|
||||||
|
BeanUtils.copyProperties(uploadVideoDto, tenSafeVideoEntity);
|
||||||
|
BeanUtils.copyProperties(cqFileMapper.selectById(uploadVideoDto.getFileId()), tenSafeVideoEntity);
|
||||||
|
tenSafeVideoEntity.setCellName(cqCellMapper.selectOne(new QueryWrapper<TenCellEntity>()
|
||||||
|
.select("name")
|
||||||
|
.eq("cell_id", uploadVideoDto.getCellId())).getName());
|
||||||
|
tenSafeVideoEntity.setPlayCount(0);
|
||||||
|
return cqSafeVideoMapper.insert(tenSafeVideoEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TenSafeVideoEntity> list(int page, int size, String cellId) {
|
||||||
|
Page<TenSafeVideoEntity> pageRequest = new Page<>(page, size);
|
||||||
|
QueryWrapper<TenSafeVideoEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
if (cellId != null && !cellId.isEmpty()){
|
||||||
|
queryWrapper.eq("cell_id", cellId);
|
||||||
|
}
|
||||||
|
queryWrapper.orderByDesc("upload_time");
|
||||||
|
IPage<TenSafeVideoEntity> pageResult = cqSafeVideoMapper.selectPage(pageRequest, queryWrapper);
|
||||||
|
return pageResult.getRecords();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean delete(Long id) {
|
||||||
|
return (cqSafeVideoMapper.deleteById(id) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int update(UpdateVideoDto updateVideoDto) {
|
||||||
|
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
|
||||||
|
FileEntity fileEntity = cqFileMapper.selectById(updateVideoDto.getFileId());
|
||||||
|
BeanUtils.copyProperties(fileEntity, tenSafeVideoEntity);
|
||||||
|
tenSafeVideoEntity.setId(updateVideoDto.getVideoId());
|
||||||
|
tenSafeVideoEntity.setCellId(updateVideoDto.getCellId());
|
||||||
|
tenSafeVideoEntity.setCellName(cqCellMapper.selectById(updateVideoDto.getCellId()).getName());
|
||||||
|
tenSafeVideoEntity.setUploadTime(new Date());
|
||||||
|
return cqSafeVideoMapper.updateById(tenSafeVideoEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TenSafeVideoEntity> inquireVideo(String cellId, String videoName, String uploadName) {
|
||||||
|
VideoQueryDto queryDto = new VideoQueryDto();
|
||||||
|
queryDto.setCellId(cellId)
|
||||||
|
.setVideoName(videoName)
|
||||||
|
.setUploadName(uploadName);
|
||||||
|
QueryWrapper<TenSafeVideoEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
if (queryDto.getCellId() != null && !queryDto.getCellId().isEmpty()) {
|
||||||
|
queryWrapper.eq("cell_id", queryDto.getCellId());
|
||||||
|
}
|
||||||
|
if (queryDto.getVideoName() != null && !queryDto.getVideoName().isEmpty()) {
|
||||||
|
queryWrapper.like("name", queryDto.getVideoName());
|
||||||
|
}
|
||||||
|
if (queryDto.getUploadName() != null && !queryDto.getUploadName().isEmpty()) {
|
||||||
|
queryWrapper.eq("upload_name", queryDto.getUploadName());
|
||||||
|
}
|
||||||
|
queryWrapper.orderByDesc("upload_time");
|
||||||
|
return cqSafeVideoMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -262,6 +262,9 @@ public class TenPersonController extends AbstractController {
|
||||||
params.put("cellId", scope.getCellId().toString());
|
params.put("cellId", scope.getCellId().toString());
|
||||||
}
|
}
|
||||||
params.put("personType", Constant.PERSON_TYPE_GUEST);
|
params.put("personType", Constant.PERSON_TYPE_GUEST);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PageUtils page = tenPersonService.queryPage(params);
|
PageUtils page = tenPersonService.queryPage(params);
|
||||||
// Date now = new Date();
|
// Date now = new Date();
|
||||||
// for (TenPersonEntity guest : (List<TenPersonEntity>)page.getList()) {
|
// for (TenPersonEntity guest : (List<TenPersonEntity>)page.getList()) {
|
||||||
|
|
|
@ -3,64 +3,10 @@
|
||||||
|
|
||||||
<mapper namespace="net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper">
|
<mapper namespace="net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper">
|
||||||
|
|
||||||
<!-- 可根据自己的需求,是否要使用 -->
|
|
||||||
<resultMap type="net.shapelight.modules.changqing.entity.TenSafeVideoEntity" id="tenSafeVideoMap">
|
|
||||||
<result property="id" column="id"/>
|
|
||||||
<result property="name" column="name"/>
|
|
||||||
<result property="cellId" column="cell_id"/>
|
|
||||||
<result property="cellName" column="cell_name"/>
|
|
||||||
<result property="uploadId" column="upload_id"/>
|
|
||||||
<result property="uploadName" column="upload_name"/>
|
|
||||||
<result property="uploadTime" column="upload_time"/>
|
|
||||||
<result property="url" column="url"/>
|
|
||||||
<result property="playTime" column="play_time"/>
|
|
||||||
<result property="playCount" column="play_count"/>
|
|
||||||
</resultMap>
|
|
||||||
<select id="queryHighestLevelUnit" resultType="java.lang.Long">
|
|
||||||
SELECT cell_id from ten_cell WHERE delete_flag = 0
|
|
||||||
</select>
|
|
||||||
<select id="queryUnit" resultType="net.shapelight.modules.iCq.controller.video.vo.Unit">
|
|
||||||
SELECT org_id, name
|
|
||||||
FROM ten_cell
|
|
||||||
WHERE delete_flag = 0
|
|
||||||
</select>
|
|
||||||
<select id="queryChildUnit" resultType="java.lang.String">
|
|
||||||
SELECT name FROM ten_cell_dept WHERE
|
|
||||||
parent_id = (SELECT dept_id FROM ten_cell_dept WHERE name = #{name})
|
|
||||||
and delete_flag = 0
|
|
||||||
</select>
|
|
||||||
<select id="runTheNameById" resultType="java.lang.Long">
|
|
||||||
|
|
||||||
SELECT dept_id FROM ten_cell_dept WHERE name = #{name} and delete_flag = 0
|
|
||||||
|
|
||||||
</select>
|
|
||||||
<select id="findsTheParentId" resultType="java.lang.String">
|
|
||||||
SELECT name
|
|
||||||
FROM ten_cell_dept d1
|
|
||||||
WHERE EXISTS (
|
|
||||||
SELECT 1
|
|
||||||
FROM ten_cell_dept d2
|
|
||||||
WHERE d2.dept_id = #{id} AND d2.parent_id = d1.dept_id
|
|
||||||
) AND d1.delete_flag = 0;
|
|
||||||
</select>
|
|
||||||
<select id="relatedQuery" resultType="net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity">
|
|
||||||
SELECT *
|
|
||||||
FROM ten_safe_video
|
|
||||||
WHERE 1 = 1
|
|
||||||
<if test="unitId != null and unitId != ''">
|
|
||||||
AND cell_id = #{unitId}
|
|
||||||
</if>
|
|
||||||
<if test="videoName != null and videoName != ''">
|
|
||||||
AND name LIKE CONCAT('%', #{videoName}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="uploader != null and uploader != ''">
|
|
||||||
AND upload_name = #{uploader}
|
|
||||||
</if>
|
|
||||||
ORDER BY upload_time DESC
|
|
||||||
|
|
||||||
</select>
|
|
||||||
<select id="findTheNameById" resultType="java.lang.String">
|
<select id="findTheNameById" resultType="java.lang.String">
|
||||||
SELECT name FROM ten_cell WHERE org_id = #{unitId} and delete_flag = 0
|
SELECT name FROM ten_cell WHERE cell_id = #{cellId} and delete_flag = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue