长庆项目day2

This commit is contained in:
ovo 2024-10-18 17:34:46 +08:00
parent a9267ccd65
commit 1def3f300d
24 changed files with 415 additions and 117 deletions

View File

@ -0,0 +1,97 @@
package net.shapelight.modules.iCq.controller.enter;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.utils.R;
import net.shapelight.common.utils.SnowflakeIdWorker;
import net.shapelight.common.utils.UUIDUtil;
import net.shapelight.modules.iCq.controller.enter.to.FTo;
import net.shapelight.modules.iCq.controller.enter.vo.FirstVo;
import net.shapelight.modules.iCq.controller.enter.vo.PeronType;
import net.shapelight.modules.iCq.controller.enter.vo.TypeRules;
import net.shapelight.modules.iCq.controller.member.dto.VisitorDto;
import net.shapelight.modules.iCq.controller.member.vo.MemberListVo;
import net.shapelight.modules.iCq.dal.dataobject.member.TenPersonEntity;
import net.shapelight.modules.iCq.dal.dataobject.video.FileEntity;
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterMapper;
import net.shapelight.modules.iCq.dal.mysql.member.CqMemberMapper;
import net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper;
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
import net.shapelight.modules.ten.service.TenPersonService;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@RestController
@RequestMapping("cq/enterConfig")
@Api(value = "入场校验", tags = {"入场校验"})
@RequiredArgsConstructor
public class CqEnterController {
private final CqEnterMapper cqEnterMapper;
private final CqSafeVideoMapper safeVideoMapper;
private final CqMemberMapper cqMemberMapper;
@GetMapping("list")
public R find(String operator, String cellId){
List<FTo> fTo = cqEnterMapper.classifiedQuery(cellId);
System.out.println(fTo);
ArrayList<FirstVo> firstVos = new ArrayList<>();
for (FTo f : fTo) {
FirstVo firstVo = new FirstVo();
firstVo.setOrgId(f.getCellId());
firstVo.setUnitName(safeVideoMapper.findTheNameById(f.getCellId()));
firstVo.setPerson(operator);
firstVo.setConfigurationTime(f.getOperateTime());
firstVos.add(firstVo);
}
return R.ok().put("data", firstVos);
}
@GetMapping("/getPersonType")
public R getPersonType(){
List<PeronType> personType = cqEnterMapper.getPersonType();
return R.ok().put("data", personType);
}
@GetMapping("/rulesByType")
public R rulesByType(int typeId){
if(typeId == 0){
typeId = cqMemberMapper.speciallyForVisitors();
}
List<TypeRules> typeRules = cqEnterMapper.rulesByType(typeId);
return R.ok().put("data", typeRules);
}
@PutMapping("/changeState/{id}")
public R changeState(@PathVariable("id") int ruleId){
if (cqEnterMapper.changeState(ruleId) == 1) {
return R.ok();
}else {
return R.error();
}
}
}

View File

@ -0,0 +1,19 @@
package net.shapelight.modules.iCq.controller.enter.to;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FTo {
private String cellId;
private Date operateTime;
}

View File

@ -0,0 +1,18 @@
package net.shapelight.modules.iCq.controller.enter.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FirstVo {
private String orgId;
private String unitName;
private String person;
private Date configurationTime;
}

View File

@ -0,0 +1,13 @@
package net.shapelight.modules.iCq.controller.enter.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PeronType {
private int labelId;
private String name;
}

View File

@ -0,0 +1,14 @@
package net.shapelight.modules.iCq.controller.enter.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TypeRules {
private String checkItem;
private String remark;
private int state;
}

View File

@ -1,5 +1,6 @@
package net.shapelight.modules.iCq.controller.member; package net.shapelight.modules.iCq.controller.member;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.minio.MinioClient; import io.minio.MinioClient;
@ -13,7 +14,9 @@ import net.shapelight.common.utils.UUIDUtil;
import net.shapelight.modules.iCq.controller.member.dto.VisitorDto; import net.shapelight.modules.iCq.controller.member.dto.VisitorDto;
import net.shapelight.modules.iCq.controller.member.vo.MemberListVo; import net.shapelight.modules.iCq.controller.member.vo.MemberListVo;
import net.shapelight.modules.iCq.dal.dataobject.member.TenPersonEntity; import net.shapelight.modules.iCq.dal.dataobject.member.TenPersonEntity;
import net.shapelight.modules.iCq.dal.dataobject.video.FileEntity;
import net.shapelight.modules.iCq.dal.mysql.member.CqMemberMapper; import net.shapelight.modules.iCq.dal.mysql.member.CqMemberMapper;
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.ten.service.TenPersonService; import net.shapelight.modules.ten.service.TenPersonService;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
@ -24,7 +27,9 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID;
/** /**
* 宣传片表 * 宣传片表
@ -40,6 +45,7 @@ public class CqMemberController {
private final CqSafeVideoMapper cqSafeVideoMapper; private final CqSafeVideoMapper cqSafeVideoMapper;
private final CqMemberMapper cqMemberMapper; private final CqMemberMapper cqMemberMapper;
private final CqFileMapper cqFileMapper;
private final MinioConfig minioConfig; private final MinioConfig minioConfig;
@ -47,14 +53,23 @@ public class CqMemberController {
private final MinioClient minioClient; private final MinioClient minioClient;
@GetMapping("/list") @GetMapping("/list")
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 unitName) {
// 创建分页对象 // 创建分页对象
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);
@ -65,8 +80,9 @@ public class CqMemberController {
for (TenPersonEntity tenSafeVideoEntity : list) { for (TenPersonEntity tenSafeVideoEntity : list) {
MemberListVo memberListVo = new MemberListVo(); MemberListVo memberListVo = new MemberListVo();
memberListVo.setId(tenSafeVideoEntity.getPersonId()); memberListVo.setId(tenSafeVideoEntity.getPersonId());
memberListVo.setUnitId(tenSafeVideoEntity.getOrgId());
memberListVo.setUnitName(cqMemberMapper.lookUpTheNameBasedOnTheDepartmentId memberListVo.setUnitName(cqMemberMapper.lookUpTheNameBasedOnTheDepartmentId
(tenSafeVideoEntity.getDeptId())); (tenSafeVideoEntity.getOrgId()));
memberListVo.setName(tenSafeVideoEntity.getName()); memberListVo.setName(tenSafeVideoEntity.getName());
memberListVo.setSex(tenSafeVideoEntity.getGender() == 0 ? "" : ""); memberListVo.setSex(tenSafeVideoEntity.getGender() == 0 ? "" : "");
memberListVo.setPhone(tenSafeVideoEntity.getMobile()); memberListVo.setPhone(tenSafeVideoEntity.getMobile());
@ -113,15 +129,26 @@ public class CqMemberController {
return R.ok(); return R.ok();
} }
@PostMapping("/gbUpload") @PostMapping("/Upload")
public R gbUpload(MultipartFile file) { public R gbUpload(MultipartFile file) {
if (file.isEmpty() || file.getSize() == 0) { if (file.isEmpty() || file.getSize() == 0) {
System.out.println("文件不能为空"); System.out.println("文件不能为空");
} }
String fileName = null; String fileName = null;
String catalogue;
try { try {
String extension = FilenameUtils.getExtension(file.getOriginalFilename()); //后缀名 String extension = FilenameUtils.getExtension(file.getOriginalFilename()); //后缀名
fileName = "temp/" + "t_" + UUIDUtil.uuid() + "." + extension; if (extension.equals("png") || extension.equals("jpg")){
catalogue = "temp/";
}else if (extension.equals("mp4")){
catalogue = "cqyt/";
}else {
return R.error().put("info", "不允许上传此类型!");
}
fileName = catalogue + "t_" + UUIDUtil.uuid() + "." + extension;
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
PutObjectOptions putObjectOptions = new PutObjectOptions(inputStream.available(), -1); PutObjectOptions putObjectOptions = new PutObjectOptions(inputStream.available(), -1);
putObjectOptions.setContentType(file.getContentType()); putObjectOptions.setContentType(file.getContentType());
@ -132,12 +159,28 @@ public class CqMemberController {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
System.out.println("方法结束"); System.out.println("方法结束");
return R.ok().put("data", fileName);
UUID uuid = UUID.randomUUID();
String replace = uuid.toString().replace("-", "");
int lastDotIndex = file.getOriginalFilename().lastIndexOf('.');
String substring = file.getOriginalFilename().substring(0, lastDotIndex);
FileEntity fileEntity = new FileEntity(replace,
substring, fileName, new Date());
cqFileMapper.insert(fileEntity);
return R.ok().put("data", fileEntity);
} }
/**
//修改 * 添加访客记录
* @param visitorDto
* @return
*/
@PostMapping("/newVisitor") @PostMapping("/newVisitor")
public R newVisitor(@RequestBody VisitorDto visitorDto) { public R newVisitor(@RequestBody VisitorDto visitorDto) {
@ -148,9 +191,8 @@ public class CqMemberController {
tenPersonEntity.setUuid(UUIDUtil.uuid()); tenPersonEntity.setUuid(UUIDUtil.uuid());
tenPersonEntity.setCellId(1255898969448382468L); tenPersonEntity.setCellId(1255898969448382468L);
tenPersonEntity.setAppFlag(0); tenPersonEntity.setAppFlag(0);
//tenPersonEntity.setDeptId(cqSafeVideoMapper.runTheNameById(visitorDto.getUnitName()));
tenPersonEntity.setDeptId(cqSafeVideoMapper.runTheNameById(visitorDto.getUnitName())); tenPersonEntity.setDeptId(Long.valueOf(visitorDto.getUnitId()));
tenPersonEntity.setLabelId(cqMemberMapper.speciallyForVisitors()); tenPersonEntity.setLabelId(cqMemberMapper.speciallyForVisitors());
tenPersonEntity.setName(visitorDto.getName()); tenPersonEntity.setName(visitorDto.getName());
tenPersonEntity.setGender(visitorDto.getSex()); tenPersonEntity.setGender(visitorDto.getSex());
@ -163,14 +205,9 @@ public class CqMemberController {
net.shapelight.modules.ten.entity.TenPersonEntity tenPersonEntity1 = new net.shapelight.modules.ten.entity.TenPersonEntity(); net.shapelight.modules.ten.entity.TenPersonEntity tenPersonEntity1 = new net.shapelight.modules.ten.entity.TenPersonEntity();
//把前面的复制到后面 //把前面的复制到后面
BeanUtils.copyProperties(tenPersonEntity, tenPersonEntity1); BeanUtils.copyProperties(tenPersonEntity, tenPersonEntity1);
/* int i = tenPersonService.saveTenPerson(tenPersonEntity1);
System.out.println(i);*/
if (tenPersonService.saveTenPerson(tenPersonEntity1) == 0) { if (tenPersonService.saveTenPerson(tenPersonEntity1) == 0) {
return R.ok(); return R.ok();
} else { } else {

View File

@ -9,7 +9,7 @@ import net.shapelight.common.base.BaseEntity;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class VisitorDto extends BaseEntity { public class VisitorDto extends BaseEntity {
private String unitName; private Integer unitId;
private String name; private String name;
private int sex; private int sex;
private String idCard; private String idCard;

View File

@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
public class MemberListVo { public class MemberListVo {
// id 或者 person id 一样的 // id 或者 person id 一样的
private Long id; private Long id;
private String unitId;
//单位名称 //单位名称
private String unitName; private String unitName;
//姓名 //姓名

View File

@ -1,5 +1,6 @@
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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -11,7 +12,6 @@ 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.controller.video.vo.Unit;
import net.shapelight.modules.iCq.dal.dataobject.video.File;
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;
@ -22,7 +22,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID;
/** /**
* 宣传片表 * 宣传片表
@ -51,57 +50,21 @@ public class CqSafeVideoController {
return R.ok().put("data", queryUnit); return R.ok().put("data", queryUnit);
} }
@GetMapping("/getChildUnits")
public R getChildUnits(String name) {
//查询子级
List<String> queryUnit = cqSafeVideoMapper.queryChildUnit(name);
return R.ok().put("data", queryUnit);
}
@PostMapping("/upload")
public R upload(@RequestParam("file")MultipartFile file){
/* String contentType = file.getContentType(); // 获取文件的 MIME 类型
UUID uuid = UUID.randomUUID();
String fileName = uuid.toString().replace("-", "") +
file.getOriginalFilename();
return;*/
File file1 = new File();
file1.setFileName(file.getOriginalFilename());
UUID uuid = UUID.randomUUID();
String replace = uuid.toString().replace("-", "");
file1.setFileId(replace);
//TODO:生成URL
file1.setFileUrl("测试的URL");
cqFileMapper.insert(file1);
return R.ok().put("data",file1);
}
@PostMapping("/insert") @PostMapping("/insert")
public R insert(@ModelAttribute UploadVideoDto uploadVideoDto) throws IOException { public R insert(@RequestBody UploadVideoDto uploadVideoDto) throws IOException {
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity(); TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
tenSafeVideoEntity.setName(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()).getFileName()); tenSafeVideoEntity.setName(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()).getFileName());
tenSafeVideoEntity.setCellId(cqSafeVideoMapper.runTheNameById(uploadVideoDto.getUnitName())); /* tenSafeVideoEntity.setCellId(cqSafeVideoMapper.runTheNameById(uploadVideoDto.getUnitName()));
tenSafeVideoEntity.setCellName(uploadVideoDto.getUnitName()); tenSafeVideoEntity.setCellName(uploadVideoDto.getUnitName());*/
tenSafeVideoEntity.setCellId(uploadVideoDto.getUnitId());
tenSafeVideoEntity.setCellName(cqSafeVideoMapper.findTheNameById(uploadVideoDto.getUnitId()));
tenSafeVideoEntity.setUploadId(uploadVideoDto.getUploaderId()); tenSafeVideoEntity.setUploadId(uploadVideoDto.getUploaderId());
tenSafeVideoEntity.setUploadName(uploadVideoDto.getUploader()); tenSafeVideoEntity.setUploadName(uploadVideoDto.getUploader());
tenSafeVideoEntity.setUploadTime(new Date()); tenSafeVideoEntity.setUploadTime(new Date());
tenSafeVideoEntity.setUrl(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()).getFileUrl()); tenSafeVideoEntity.setUrl(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()).getFileUrl());
tenSafeVideoEntity.setPlayCount(0); tenSafeVideoEntity.setPlayCount(0);
tenSafeVideoEntity.setFileId(uploadVideoDto.getFileId());
if (cqSafeVideoMapper.insert(tenSafeVideoEntity) == 1) { if (cqSafeVideoMapper.insert(tenSafeVideoEntity) == 1) {
return R.ok(); return R.ok();
@ -113,12 +76,21 @@ public class CqSafeVideoController {
@GetMapping("/list") @GetMapping("/list")
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) {
// 创建分页对象 // 创建分页对象
Page<TenSafeVideoEntity> pageRequest = new Page<>(page, size); Page<TenSafeVideoEntity> pageRequest = new Page<>(page, size);
QueryWrapper<TenSafeVideoEntity> queryWrapper = new QueryWrapper<>();
// 假设你想按名字进行筛选name 为数据库中的字段名
if (unitId != null && !unitId.isEmpty()){
queryWrapper.eq("cell_id", unitId);
}
queryWrapper.orderByDesc("upload_time");
// 使用 MyBatis-Plus 提供的分页查询 // 使用 MyBatis-Plus 提供的分页查询
IPage<TenSafeVideoEntity> pageResult = cqSafeVideoMapper.selectPage(pageRequest, null); IPage<TenSafeVideoEntity> pageResult = cqSafeVideoMapper.selectPage(pageRequest, queryWrapper);
List<TenSafeVideoEntity> list = pageResult.getRecords(); List<TenSafeVideoEntity> list = pageResult.getRecords();
@ -141,19 +113,17 @@ public class CqSafeVideoController {
//修改 //修改
@PostMapping("/update") @PostMapping("/update")
public R update(@ModelAttribute UpdateVideoDto updateVideoDto) { public R update(@RequestBody UpdateVideoDto updateVideoDto) {
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity(); TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
tenSafeVideoEntity.setName(cqFileMapper.selectByFileId(updateVideoDto.getFileId()).getFileName()); tenSafeVideoEntity.setName(cqFileMapper.selectByFileId(updateVideoDto.getFileId()).getFileName());
tenSafeVideoEntity.setId(updateVideoDto.getVideoId()); tenSafeVideoEntity.setId(updateVideoDto.getVideoId());
tenSafeVideoEntity.setCellId(cqSafeVideoMapper.runTheNameById(updateVideoDto.getUnitName())); /* tenSafeVideoEntity.setCellId(cqSafeVideoMapper.runTheNameById(updateVideoDto.getUnitName()));
tenSafeVideoEntity.setCellName(updateVideoDto.getUnitName()); tenSafeVideoEntity.setCellName(updateVideoDto.getUnitName());*/
tenSafeVideoEntity.setCellId(updateVideoDto.getUnitId());
tenSafeVideoEntity.setCellName(cqSafeVideoMapper.findTheNameById(updateVideoDto.getUnitId()));
tenSafeVideoEntity.setUploadTime(new Date()); tenSafeVideoEntity.setUploadTime(new Date());
tenSafeVideoEntity.setUrl(cqFileMapper.selectByFileId(updateVideoDto.getFileId()).getFileUrl()); tenSafeVideoEntity.setUrl(cqFileMapper.selectByFileId(updateVideoDto.getFileId()).getFileUrl());
tenSafeVideoEntity.setFileId(updateVideoDto.getFileId());
if (cqSafeVideoMapper.updateById(tenSafeVideoEntity) == 1) { if (cqSafeVideoMapper.updateById(tenSafeVideoEntity) == 1) {
return R.ok(); return R.ok();
} else { } else {
@ -162,29 +132,22 @@ public class CqSafeVideoController {
} }
@GetMapping("/show") @GetMapping("/inquireVideo")
public R show(@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){
Page<File> pageRequest = new Page<>(page, size); System.out.println("uploader + 上传人 = " + uploader);
List<TenSafeVideoEntity> list = cqSafeVideoMapper.relatedQuery(unitId, videoName, uploader);
// 使用 MyBatis-Plus 提供的分页查询
IPage<File> pageResult = cqFileMapper.selectPage(pageRequest, null);
List<File> list = pageResult.getRecords();
return R.ok().put("data", list); return R.ok().put("data", list);
} }
@GetMapping("/singleFind")
@GetMapping("/inquireVideo") public R singleFind(int videoId){
public R inquireVideo(String unitName, String videoName, String uploader){ TenSafeVideoEntity tenSafeVideoEntity = cqSafeVideoMapper.selectById(videoId);
return R.ok().put("data", tenSafeVideoEntity);
List<TenSafeVideoEntity> list = cqSafeVideoMapper.relatedQuery(unitName, videoName, uploader);
return R.ok();
} }
@GetMapping("/camara") @GetMapping("/camara")
public R watchStart(String cellId) { public R watchStart(String cellId) {
rtspFrameGrabber.startGrabber(cellId); rtspFrameGrabber.startGrabber(cellId);
@ -192,8 +155,8 @@ public class CqSafeVideoController {
} }
@GetMapping("/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);
return R.ok(); return R.ok();
} }

View File

@ -6,5 +6,5 @@ import lombok.Data;
public class UpdateVideoDto { public class UpdateVideoDto {
private String fileId; private String fileId;
private Long videoId; private Long videoId;
private String unitName; private String unitId;
} }

View File

@ -1,5 +1,6 @@
package net.shapelight.modules.iCq.controller.video.dto; package net.shapelight.modules.iCq.controller.video.dto;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -8,5 +9,5 @@ public class UploadVideoDto {
private String fileId; private String fileId;
private String uploader; private String uploader;
private Long uploaderId; private Long uploaderId;
private String unitName; private String unitId;
} }

View File

@ -9,6 +9,6 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class Unit { public class Unit {
private Long deptId; private String orgId;
private String name; private String name;
} }

View File

@ -0,0 +1,44 @@
package net.shapelight.modules.iCq.dal.dataobject.enter;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 宣传片表
*/
@Data
@TableName("ten_enter_config")
public class TenEnterConfigEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId
private Long id;
/**
* 视频名称
*/
private String checkItem;
private String remark;
private String assignId;
private Long assignName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String operateTime;
}

View File

@ -1,16 +1,23 @@
package net.shapelight.modules.iCq.dal.dataobject.video; package net.shapelight.modules.iCq.dal.dataobject.video;
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 lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("ten_file") @TableName("ten_file")
public class File implements Serializable { public class FileEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String fileId; private String fileId;
private String fileName; private String fileName;
private String fileUrl; private String fileUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date uploadTime;
} }

View File

@ -30,7 +30,7 @@ public class TenSafeVideoEntity implements Serializable {
/** /**
* 单位ID * 单位ID
*/ */
private Long cellId; private String cellId;
/** /**
* 单位名称 * 单位名称
@ -68,4 +68,12 @@ public class TenSafeVideoEntity implements Serializable {
* 播放次数 * 播放次数
*/ */
private Integer playCount; private Integer playCount;
}
private String fileId;
}
//checkItem
//remark
//assignPeople
//operatingTime

View File

@ -0,0 +1,23 @@
package net.shapelight.modules.iCq.dal.mysql.enter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.iCq.controller.enter.to.FTo;
import net.shapelight.modules.iCq.controller.enter.vo.PeronType;
import net.shapelight.modules.iCq.controller.enter.vo.TypeRules;
import net.shapelight.modules.iCq.dal.dataobject.enter.TenEnterConfigEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CqEnterMapper extends BaseMapper<TenEnterConfigEntity> {
List<FTo> classifiedQuery(String cellId);
List<PeronType> getPersonType();
List<TypeRules> rulesByType(int typeId);
int changeState(int ruleId);
}

View File

@ -11,7 +11,7 @@ import java.util.List;
public interface CqMemberMapper extends BaseMapper<TenPersonEntity> { public interface CqMemberMapper extends BaseMapper<TenPersonEntity> {
String lookUpTheNameBasedOnTheDepartmentId(Long deptId); String lookUpTheNameBasedOnTheDepartmentId(String orgId);
String takeTheNameAccordingToType(Integer personType); String takeTheNameAccordingToType(Integer personType);

View File

@ -1,20 +1,17 @@
package net.shapelight.modules.iCq.dal.mysql.video; 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.dal.dataobject.video.File; import net.shapelight.modules.iCq.dal.dataobject.video.FileEntity;
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper @Mapper
public interface CqFileMapper extends BaseMapper<File> { public interface CqFileMapper extends BaseMapper<FileEntity> {
/** /**
* 根据文件id获取文件信息 * 根据文件id获取文件信息
* @param fileId * @param fileId
* @return * @return
*/ */
File selectByFileId(String fileId); FileEntity selectByFileId(String fileId);
} }

View File

@ -36,5 +36,7 @@ public interface CqSafeVideoMapper extends BaseMapper<TenSafeVideoEntity> {
//目前没用 明天测试 待删除 //目前没用 明天测试 待删除
List<String> queryChildUnit(String name); List<String> queryChildUnit(String name);
List<TenSafeVideoEntity> relatedQuery(String unitName, String videoName, String uploader); List<TenSafeVideoEntity> relatedQuery(String unitId, String videoName, String uploader);
String findTheNameById(String unitId);
} }

View File

@ -2,6 +2,7 @@ package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import net.shapelight.modules.ten.entity.TenPersonCert; import net.shapelight.modules.ten.entity.TenPersonCert;
import org.springframework.stereotype.Service;
/** /**
@ -9,6 +10,7 @@ import net.shapelight.modules.ten.entity.TenPersonCert;
* @description 针对表ten_person_cert的数据库操作Service * @description 针对表ten_person_cert的数据库操作Service
* @createDate 2024-10-16 19:43:27 * @createDate 2024-10-16 19:43:27
*/ */
public interface TenPersonCertService extends IService<TenPersonCert> { public interface TenPersonCertService extends IService<TenPersonCert> {
public void saveOrUpdateByField(TenPersonCert entity, String fieldName); public void saveOrUpdateByField(TenPersonCert entity, String fieldName);

View File

@ -0,0 +1,41 @@
<?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="net.shapelight.modules.iCq.dal.mysql.enter.CqEnterMapper">
<update id="changeState">
UPDATE ten_enter_config_type
SET state = NOT state
WHERE id = #{ruleId};
</update>
<select id="classifiedQuery" resultType="net.shapelight.modules.iCq.controller.enter.to.FTo">
SELECT
cell_id,
MAX(operate_time) AS operate_time
FROM
ten_enter_config_cell
WHERE 1 = 1
<if test="cellId != null and cellId != ''">
AND cell_id = #{uploader}
</if>
GROUP BY
cell_id ;
</select>
<select id="getPersonType" resultType="net.shapelight.modules.iCq.controller.enter.vo.PeronType">
select label_id, name FROM ten_label WHERE delete_flag = 0
</select>
<select id="rulesByType" resultType="net.shapelight.modules.iCq.controller.enter.vo.TypeRules">
SELECT
tec.check_item, tec.remark,
tect.state
FROM
ten_enter_config tec
JOIN
ten_enter_config_type tect
ON
tec.id = tect.enter_config_id
WHERE
tect.type_id = #{typeId};
</select>
</mapper>

View File

@ -3,7 +3,7 @@
<mapper namespace="net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper"> <mapper namespace="net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper">
<select id="selectByFileId" resultType="net.shapelight.modules.iCq.dal.dataobject.video.File"> <select id="selectByFileId" resultType="net.shapelight.modules.iCq.dal.dataobject.video.FileEntity">
SELECT file_id, file_name, file_url SELECT file_id, file_name, file_url
FROM ten_file FROM ten_file
WHERE file_id = #{fileId} WHERE file_id = #{fileId}

View File

@ -5,12 +5,12 @@
<select id="lookUpTheNameBasedOnTheDepartmentId" resultType="java.lang.String"> <select id="lookUpTheNameBasedOnTheDepartmentId" resultType="java.lang.String">
SELECT name FROM ten_cell_dept WHERE dept_id = #{deptId} SELECT name FROM ten_cell_dept WHERE org_id = #{orgId}
</select> </select>
<select id="takeTheNameAccordingToType" resultType="java.lang.String"> <select id="takeTheNameAccordingToType" resultType="java.lang.String">
SELECT DISTINCT(name) from ten_label WHERE type = #{personType} SELECT DISTINCT(name) from ten_label WHERE type = #{personType}
</select> </select>
<select id="speciallyForVisitors" resultType="java.lang.Integer"> <select id="speciallyForVisitors" resultType="java.lang.Integer">
SELECT label_id FROM ten_label WHERE name = '访客' SELECT label_id FROM ten_label WHERE name = '访客人员'
</select> </select>
</mapper> </mapper>

View File

@ -20,8 +20,8 @@
SELECT cell_id from ten_cell WHERE delete_flag = 0 SELECT cell_id from ten_cell WHERE delete_flag = 0
</select> </select>
<select id="queryUnit" resultType="net.shapelight.modules.iCq.controller.video.vo.Unit"> <select id="queryUnit" resultType="net.shapelight.modules.iCq.controller.video.vo.Unit">
SELECT dept_id, name SELECT org_id, name
FROM ten_cell_dept FROM ten_cell
WHERE delete_flag = 0 WHERE delete_flag = 0
</select> </select>
<select id="queryChildUnit" resultType="java.lang.String"> <select id="queryChildUnit" resultType="java.lang.String">
@ -45,11 +45,22 @@
</select> </select>
<select id="relatedQuery" resultType="net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity"> <select id="relatedQuery" resultType="net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity">
SELECT * SELECT *
FROM video_table FROM ten_safe_video
WHERE WHERE 1 = 1
(:unitName IS NULL OR :unitName = '' OR unitName = :unitName) AND <if test="unitId != null and unitId != ''">
(:videoName IS NULL OR :videoName = '' OR videoName = :videoName) AND AND cell_id = #{unitId}
(:uploader IS NULL OR :uploader = '' OR uploader = :uploader); </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 name FROM ten_cell WHERE org_id = #{unitId} and delete_flag = 0
</select> </select>
</mapper> </mapper>