长庆项目

This commit is contained in:
ovo 2024-10-21 17:21:41 +08:00
parent 16352dcbd0
commit 9927f980de
32 changed files with 491 additions and 301 deletions

View File

@ -30,7 +30,7 @@
<junit.version>4.12</junit.version>
<jedis.version>2.9.0</jedis.version>
<druid.version>1.2.13</druid.version>
<mybatisplus.version>3.1.2</mybatisplus.version>
<mybatisplus.version>3.3.0</mybatisplus.version>
<mysql.version>8.0.25</mysql.version>
<mssql.version>4.0</mssql.version>
<oracle.version>11.2.0.3</oracle.version>
@ -279,6 +279,12 @@
<version>1.45</version>
</dependency>
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId>
<version>1.5.0</version>
</dependency>
</dependencies>
<!-- 阿里云maven仓库 -->

View File

@ -20,33 +20,24 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.common.config.GlobalValue;
import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.config.MinioUtils;
import net.shapelight.common.utils.*;
import net.shapelight.modules.app.entity.AppUserEntity;
import net.shapelight.modules.app.service.AppUserService;
import net.shapelight.modules.face.dto.FaceRecognitionResDTO;
import net.shapelight.modules.face.entity.UserCompareInfo;
import net.shapelight.modules.face.service.FaceEngineService;
import net.shapelight.modules.face.util.Base64Util;
import net.shapelight.modules.face.util.UserInfo;
import net.shapelight.modules.face.util.UserRamCache;
import net.shapelight.modules.face.util.UserRamGroup;
import net.shapelight.modules.feignClient.CxFeignClient;
import net.shapelight.modules.httpapi.service.AuthService;
import net.shapelight.modules.httpapi.service.RecordSaveSyncService;
import net.shapelight.modules.iCq.controller.enter.to.EnterVo;
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterMapper;
import net.shapelight.modules.nettyapi.config.CmdConstant;
import net.shapelight.modules.nettyapi.config.MyMessage;
import net.shapelight.modules.nettyapi.utils.Result;
import net.shapelight.modules.iCq.service.enter.CqEnterServiceImpl;
import net.shapelight.modules.sys.entity.*;
import net.shapelight.modules.sys.service.*;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import net.shapelight.modules.vo.*;
import org.apache.commons.io.FilenameUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -123,7 +114,7 @@ public class HttpApiController {
@Autowired
private TenPersonTrainService trainService;
@Autowired
private CqEnterMapper cqEnterMapper;
private CqEnterServiceImpl cqEnterService;
/**
*
@ -2090,10 +2081,8 @@ public class HttpApiController {
return R.ok().put("data", page);
}
@PostMapping("/role")
@GetMapping("/role")
public R roleList(@Param(value = "sn")String sn) {
TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn);
List<EnterVo> enterVoList = cqEnterMapper.queryByCellId(deviceEntity.getCellId());
return R.ok().put("data",enterVoList);
return R.ok().put("data",cqEnterService.queryByCellId(sn));
}
}

View File

@ -1,20 +1,15 @@
package net.shapelight.modules.iCq.controller.enter;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.shapelight.common.utils.R;
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.dal.mysql.enter.CqEnterMapper;
import net.shapelight.modules.iCq.dal.mysql.member.CqMemberMapper;
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigCellMapper;
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigMapper;
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigTypeMapper;
import net.shapelight.modules.iCq.service.enter.CqEnterServiceImpl;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("cq/enterConfig")
@ -22,58 +17,36 @@ import java.util.List;
@RequiredArgsConstructor
public class CqEnterController {
private final CqEnterMapper cqEnterMapper;
private final CqSafeVideoMapper safeVideoMapper;
private final CqMemberMapper cqMemberMapper;
private final CqEnterServiceImpl cqEnterService;
@GetMapping("list")
public R find(String operator, String cellId){
System.out.println("cellId = " + 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.setCellId(f.getCellId());
firstVo.setUnitName(safeVideoMapper.findTheNameById(f.getCellId()));
firstVo.setPerson(operator);
firstVo.setConfigurationTime(f.getOperateTime());
firstVos.add(firstVo);
}
return R.ok().put("data", firstVos).put("total", firstVos.size());
@ApiOperation(value = "配置首页列表查询")
public R list(String operator, Long cellId){
return R.ok()
.put("data", cqEnterService.list(operator, cellId))
.put("total", cqEnterService.list(operator, cellId).size());
}
@GetMapping("/getPersonType")
@ApiOperation(value = "获取人员类型")
public R getPersonType(){
List<PeronType> personType = cqEnterMapper.getPersonType();
return R.ok().put("data", personType);
return R.ok().put("data", cqEnterService.getPersonType());
}
@GetMapping("/rulesByType")
public R rulesByType(String typeId, String cellId){
if(typeId == null){
typeId = String.valueOf(cqMemberMapper.speciallyForVisitors2());
}
List<TypeRules> typeRules = cqEnterMapper.rulesByType(typeId, cellId);
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();
}
@GetMapping("/rulesByType")
@ApiOperation(value = "根据人员类型和单位id获取详细配置项")
public R rulesByType(Integer typeId, Long cellId){
return R.ok().put("data", cqEnterService.rulesByType(typeId, cellId));
}
@PutMapping("/changeState/{ruleId}")
@ApiOperation(value = "改变配置状态")
public R changeState(@PathVariable int ruleId){
if (cqEnterService.changeState(ruleId)){
return R.ok();
}else {
return R.error();
}
}
}

View File

@ -1,15 +0,0 @@
package net.shapelight.modules.iCq.controller.enter.to;
import lombok.Data;
@Data
public class EnterVo {
//配置ID
Integer enterConfigId;
//类型ID
Integer typeId;
//状态(1是2否)
Integer state;
//配置名称
String configName;
}

View File

@ -1,17 +0,0 @@
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,24 @@
package net.shapelight.modules.iCq.controller.enter.vo;
import lombok.Data;
@Data
public class CellRuleVo {
/**
* 配置ID
*/
Integer enterConfigId;
/**
* 类型id
*/
Integer typeId;
/**
* 状态(1是0否)
*/
Integer state;
/**
* 配置名称
*/
String configName;
}

View File

@ -0,0 +1,33 @@
package net.shapelight.modules.iCq.controller.enter.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ConfigListVo {
/**
* 单位id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long cellId;
/**
* 操作时间
*/
private Date operateTime;
/**
* 单位名称
*/
private String cellName;
/**
* 操作人
*/
private String operator;
}

View File

@ -1,18 +0,0 @@
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 cellId;
private String unitName;
private String person;
private Date configurationTime;
}

View File

@ -7,7 +7,13 @@ import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PeronType {
public class PeronTypeVo {
/**
* 人员类型标志
*/
private int type;
/**
* 人员类型名称
*/
private String name;
}

View File

@ -7,9 +7,23 @@ import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TypeRules {
private String checkItem;
private String remark;
private int state;
public class TypeRuleVo {
/**
* 配置项id
*/
private int id;
/**
* 配置状态
*/
private int state;
/**
* 校验项
*/
private String checkItem;
/**
* 备注
*/
private String remark;
}

View File

@ -425,11 +425,9 @@ public class CqMemberController {
@PutMapping("batchChangeStatus")
public R batchChangeStatus(List<Long> memberIds){
for (Long memberId : memberIds) {
cqMemberMapper.changeViewingState(memberId);
}
return R.ok();
}

View File

@ -30,12 +30,6 @@ public class CqSafeVideoController {
private final CqSafeVideoServiceImpl cqSafeVideoService;
private final CqSafeVideoMapper cqSafeVideoMapper;
private final CqFileMapper cqFileMapper;
private final TenCellDao cqCellMapper;
@Autowired
private RtspFrameGrabber rtspFrameGrabber;
@ -62,11 +56,14 @@ public class CqSafeVideoController {
@ApiOperation(value = "列表视频接口")
public R list(@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size,
String cellId) {
List<TenSafeVideoEntity> list = cqSafeVideoService.list(page, size, cellId);
@RequestParam(required = false) Long cellId,
@RequestParam(required = false) String videoName,
@RequestParam(required = false) String uploadName) {
return R.ok()
.put("data", list)
.put("total", list.size());
.put("data", cqSafeVideoService.list(page, size, cellId,
videoName, uploadName))
.put("total", cqSafeVideoService.list(page, size, cellId,
videoName, uploadName).size());
}
@DeleteMapping("/delete/{id}")
@ -89,27 +86,6 @@ public class CqSafeVideoController {
}
}
@GetMapping("/inquireVideo")
@ApiOperation(value = "条件查询视频接口")
public R inquireVideo(@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size,
@RequestParam(required = false) String cellId,
@RequestParam(required = false) String videoName,
@RequestParam(required = false) String uploadName){
List<TenSafeVideoEntity> tenSafeVideoEntities =
cqSafeVideoService.inquireVideo(cellId, videoName, uploadName);
return R.ok()
.put("data", tenSafeVideoEntities)
.put("total",tenSafeVideoEntities.size());
}
@GetMapping("/singleFind")
public R singleFind(int videoId){
TenSafeVideoEntity tenSafeVideoEntity = cqSafeVideoMapper.selectById(videoId);
return R.ok().put("data", tenSafeVideoEntity);
}
@GetMapping("/camara")
public R watchStart(String cellId) {

View File

@ -13,7 +13,7 @@ public class VideoQueryDto {
/**
* 单位id
*/
private String cellId;
private Long cellId;
/**
* 视频名称
*/

View File

@ -0,0 +1,54 @@
package net.shapelight.modules.iCq.dal.dataobject.enter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
/**
*
* @TableName ten_enter_config_cell
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class TenEnterConfigCell implements Serializable {
/**
*
*/
@NotNull(message="[]不能为空")
@ApiModelProperty("")
private Integer id;
/**
*
*/
@ApiModelProperty("")
private Integer enterConfigId;
/**
*
*/
@Size(max= 255,message="编码长度不能超过255")
@ApiModelProperty("")
@Length(max= 255,message="编码长度不能超过255")
private Long cellId;
/**
*
*/
@ApiModelProperty("")
private Date operateTime;
}

View File

@ -8,9 +8,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 宣传片表
*/
@Data
@TableName("ten_enter_config")
public class TenEnterConfigEntity implements Serializable {

View File

@ -0,0 +1,55 @@
package net.shapelight.modules.iCq.dal.dataobject.enter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
/**
*
* @TableName ten_enter_config_type
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class TenEnterConfigType implements Serializable {
/**
*
*/
@NotNull(message="[]不能为空")
@ApiModelProperty("")
private Integer id;
/**
*
*/
@ApiModelProperty("")
private Integer enterConfigId;
/**
*
*/
@ApiModelProperty("")
private Integer typeId;
/**
* 0关闭1启用
*/
@ApiModelProperty("0关闭1启用")
private Integer state;
/**
*
*/
@ApiModelProperty("")
private Long cellId;
}

View File

@ -3,7 +3,10 @@ package net.shapelight.modules.iCq.dal.dataobject.video;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@ -13,6 +16,7 @@ import java.util.Date;
*/
@Data
@TableName("ten_safe_video")
@Accessors(chain = true)
public class TenSafeVideoEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ -20,6 +24,7 @@ public class TenSafeVideoEntity implements Serializable {
* 主键
*/
@TableId
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
@ -30,7 +35,8 @@ public class TenSafeVideoEntity implements Serializable {
/**
* 单位ID
*/
private String cellId;
@JsonSerialize(using = ToStringSerializer.class)
private Long cellId;
/**
* 单位名称
@ -40,7 +46,7 @@ public class TenSafeVideoEntity implements Serializable {
/**
* 上传人ID
*/
private String uploadId;
private Long uploadId;
/**
* 上传人姓名

View File

@ -0,0 +1,10 @@
package net.shapelight.modules.iCq.dal.mysql.enter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.iCq.dal.dataobject.enter.TenEnterConfigCell;
import net.shapelight.modules.iCq.dal.dataobject.enter.TenEnterConfigEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CqEnterConfigCellMapper extends BaseMapper<TenEnterConfigCell> {
}

View File

@ -0,0 +1,12 @@
package net.shapelight.modules.iCq.dal.mysql.enter;
import com.github.yulichang.base.MPJBaseMapper;
import net.shapelight.modules.iCq.controller.enter.vo.CellRuleVo;
import net.shapelight.modules.iCq.dal.dataobject.enter.TenEnterConfigEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CqEnterConfigMapper extends MPJBaseMapper<TenEnterConfigEntity> {
}

View File

@ -0,0 +1,11 @@
package net.shapelight.modules.iCq.dal.mysql.enter;
import com.github.yulichang.base.MPJBaseMapper;
import net.shapelight.modules.iCq.dal.dataobject.enter.TenEnterConfigType;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CqEnterConfigTypeMapper extends MPJBaseMapper<TenEnterConfigType> {
}

View File

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

View File

@ -16,7 +16,6 @@ public interface CqMemberMapper extends BaseMapper<TenPersonEntity> {
String takeTheNameAccordingToType(Integer personType);
Integer speciallyForVisitors();
Long speciallyForVisitors2();
Long orgidBecomesCellId(String orgId);

View File

@ -7,11 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CqFileMapper extends BaseMapper<FileEntity> {
/**
* 根据文件id获取文件信息
* @param fileId
* @return
*/
FileEntity selectByFileId(String fileId);
}

View File

@ -9,7 +9,4 @@ import org.apache.ibatis.annotations.Mapper;
public interface CqSafeVideoMapper extends BaseMapper<TenSafeVideoEntity> {
String findTheNameById(String cellId);
}

View File

@ -0,0 +1,149 @@
package net.shapelight.modules.iCq.service.enter;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
import net.shapelight.modules.iCq.controller.enter.vo.CellRuleVo;
import net.shapelight.modules.iCq.controller.enter.vo.ConfigListVo;
import net.shapelight.modules.iCq.controller.enter.vo.PeronTypeVo;
import net.shapelight.modules.iCq.controller.enter.vo.TypeRuleVo;
import net.shapelight.modules.iCq.dal.dataobject.enter.TenEnterConfigCell;
import net.shapelight.modules.iCq.dal.dataobject.enter.TenEnterConfigEntity;
import net.shapelight.modules.iCq.dal.dataobject.enter.TenEnterConfigType;
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigCellMapper;
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigMapper;
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigTypeMapper;
import net.shapelight.modules.ten.dao.TenCellDao;
import net.shapelight.modules.ten.dao.TenDeviceDao;
import net.shapelight.modules.ten.dao.TenLabelDao;
import net.shapelight.modules.ten.entity.TenDeviceEntity;
import net.shapelight.modules.ten.entity.TenLabelEntity;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
public class CqEnterServiceImpl {
private final CqEnterConfigCellMapper cqEnterConfigCellMapper;
private final TenCellDao cqCellMapper;
private final TenLabelDao cqTenlableMapper;
private final CqEnterConfigMapper cqEnterConfigMapper;
private final CqEnterConfigTypeMapper cqEnterConfigTypeMapper;
private final TenDeviceDao tenDeviceMapper;
/**
* 查询/列表配置首页
* @param operator
* @param cellId
* @return
*/
public List<ConfigListVo> list(String operator, Long cellId) {
QueryWrapper<TenEnterConfigCell> queryWrapper = new QueryWrapper<>();
if (cellId != null) {
queryWrapper.eq("cell_id", cellId);
}
return cqEnterConfigCellMapper.selectList(queryWrapper
.select("cell_id", "MAX(operate_time) AS operate_time")
.groupBy("cell_id"))
.stream()
.map(tenEnterConfigCell -> {
ConfigListVo configListVo = new ConfigListVo();
BeanUtils.copyProperties(tenEnterConfigCell, configListVo);
configListVo.setCellName(cqCellMapper
.selectById(configListVo.getCellId())
.getName());
configListVo.setOperator(operator);
return configListVo;
})
.collect(Collectors.toList());
}
/**
* 获取人员类型
* @return
*/
public List<PeronTypeVo> getPersonType() {
return cqTenlableMapper.selectList(
new QueryWrapper<TenLabelEntity>()
.orderByAsc("type"))
.stream()
.map(tenLabelEntity -> {
PeronTypeVo peronTypeVo = new PeronTypeVo();
BeanUtils.copyProperties(tenLabelEntity, peronTypeVo);
return peronTypeVo;
}).collect(Collectors.toList());
}
/**
* 根据单位id和人员类型id返回配置规则
* @param typeId
* @param cellId
* @return
*/
public List<TypeRuleVo> rulesByType(Integer typeId, Long cellId) {
if (typeId == null) {
typeId = cqTenlableMapper.selectOne(new QueryWrapper<TenLabelEntity>()
.eq("name", "访客人员"))
.getType();
}
//查询主表 返回结果 join 从表
return cqEnterConfigMapper.selectJoinList(TypeRuleVo.class,
new MPJLambdaWrapper<TenEnterConfigEntity>()
.select(TenEnterConfigEntity::getCheckItem, TenEnterConfigEntity::getRemark)
.select(TenEnterConfigType::getState, TenEnterConfigType::getId)
//子表类 主表字段 子表字段
.leftJoin(TenEnterConfigType.class, TenEnterConfigType::getEnterConfigId, TenEnterConfigEntity::getId)
.eq(TenEnterConfigType::getTypeId, typeId)
.eq(TenEnterConfigType::getCellId, cellId)
);
}
/**
* 改变规则状态
* @param ruleId
* @return
*/
@Transactional
public boolean changeState(int ruleId) {
return cqEnterConfigCellMapper.update(
null,
new UpdateWrapper<TenEnterConfigCell>()
.eq("enter_config_id", cqEnterConfigCellMapper
.selectOne(new QueryWrapper<TenEnterConfigCell>().eq("id", ruleId))
.getEnterConfigId())
.eq("cell_id", cqEnterConfigCellMapper
.selectOne(new QueryWrapper<TenEnterConfigCell>().eq("id", ruleId)).getCellId())
.set("operate_time", new Date())) > 0
&& cqEnterConfigTypeMapper.update(
null,
new UpdateWrapper<TenEnterConfigType>()
.eq("id", ruleId)
.setSql("state = 1 - state")) > 0;
}
/**
* 根据sn号下发配置规则
* @param sn
* @return
*/
public List<CellRuleVo> queryByCellId(String sn) {
return cqEnterConfigTypeMapper.selectJoinList(CellRuleVo.class,
new MPJLambdaWrapper<TenEnterConfigType>()
.select(TenEnterConfigType::getEnterConfigId, TenEnterConfigType::getTypeId, TenEnterConfigType::getState)
.selectAs(TenEnterConfigEntity::getCheckItem, CellRuleVo::getConfigName)
.leftJoin(TenEnterConfigEntity.class, TenEnterConfigEntity::getId, TenEnterConfigType::getEnterConfigId)
.eq(TenEnterConfigType::getCellId, tenDeviceMapper.selectOne(new QueryWrapper<TenDeviceEntity>()
.eq("sn", sn)).getCellId())
);
}
}

View File

@ -1,5 +0,0 @@
package net.shapelight.modules.iCq.service.video;
public interface CqSafeVideoService {
//接口声明
}

View File

@ -19,6 +19,7 @@ import org.modelmapper.ModelMapper;
import org.modelmapper.TypeMap;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.ArrayList;
import java.util.Date;
@ -40,7 +41,7 @@ public class CqSafeVideoServiceImpl {
* @return
*/
public List<CellVo> getCellInfos() {
return cqCellMapper.selectList(new QueryWrapper<>()).stream()
return cqCellMapper.selectList(null).stream()
.map(cell -> {
CellVo cellVo = new CellVo();
BeanUtils.copyProperties(cell, cellVo);
@ -49,10 +50,17 @@ public class CqSafeVideoServiceImpl {
.collect(Collectors.toList());
}
/**
* 新增视频
* @param uploadVideoDto
* @return
*/
public int insert(UploadVideoDto uploadVideoDto) {
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
BeanUtils.copyProperties(uploadVideoDto, tenSafeVideoEntity);
BeanUtils.copyProperties(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()), tenSafeVideoEntity);
BeanUtils.copyProperties(cqFileMapper.selectOne(new QueryWrapper<FileEntity>()
.eq("file_id", uploadVideoDto.getFileId())),
tenSafeVideoEntity);
tenSafeVideoEntity.setCellName(cqCellMapper.selectOne(new QueryWrapper<TenCellEntity>()
.select("name")
.eq("cell_id", uploadVideoDto.getCellId())).getName());
@ -60,40 +68,24 @@ public class CqSafeVideoServiceImpl {
return cqSafeVideoMapper.insert(tenSafeVideoEntity);
}
public List<TenSafeVideoEntity> list(int page, int size, String cellId) {
/**
* 查询视频列表
* @param page
* @param size
* @param cellId
* @param videoName
* @param uploadName
* @return
*/
public List<TenSafeVideoEntity> list(int page, int size, Long cellId,
String videoName, String uploadName) {
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(String.valueOf(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()) {
if (queryDto.getCellId() != null) {
queryWrapper.eq("cell_id", queryDto.getCellId());
}
if (queryDto.getVideoName() != null && !queryDto.getVideoName().isEmpty()) {
@ -103,6 +95,38 @@ public class CqSafeVideoServiceImpl {
queryWrapper.eq("upload_name", queryDto.getUploadName());
}
queryWrapper.orderByDesc("upload_time");
return cqSafeVideoMapper.selectList(queryWrapper);
IPage<TenSafeVideoEntity> pageResult = cqSafeVideoMapper.selectPage(pageRequest, queryWrapper);
return pageResult.getRecords();
}
/**
* 删除视频
* @param id
* @return
*/
public boolean delete(Long id) {
return (cqSafeVideoMapper.deleteById(id) == 1);
}
/**
* 更新视频
* @param updateVideoDto
* @return
*/
public int update(UpdateVideoDto updateVideoDto) {
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
BeanUtils.copyProperties(
cqFileMapper.selectOne(new QueryWrapper<FileEntity>()
.eq("file_id", updateVideoDto.getFileId())
), tenSafeVideoEntity);
tenSafeVideoEntity
.setId(updateVideoDto.getVideoId())
.setCellId(updateVideoDto.getCellId())
.setCellName(cqCellMapper.selectById(updateVideoDto.getCellId()).getName())
.setUploadTime(new Date());
return cqSafeVideoMapper.updateById(tenSafeVideoEntity);
}
}

View File

@ -0,0 +1,8 @@
<?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.CqEnterConfigMapper">
</mapper>

View File

@ -1,52 +0,0 @@
<?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 = #{cellId}
</if>
GROUP BY
cell_id ;
</select>
<select id="getPersonType" resultType="net.shapelight.modules.iCq.controller.enter.vo.PeronType">
select type, 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, tect.id
FROM
ten_enter_config tec
JOIN
ten_enter_config_type tect
ON
tec.id = tect.enter_config_id
WHERE
tect.type_id = #{typeId}
<if test="cellId != null and cellId != ''">
and tect.cell_id = #{cellId};
</if>
</select>
<select id="queryByCellId" resultType="net.shapelight.modules.iCq.controller.enter.to.EnterVo">
SELECT
enter_config_id,type_id,state,check_item as configName
FROM
ten_enter_config_type a left join ten_enter_config b on a.enter_config_id = b.id
WHERE cell_id = #{cellId}
</select>
</mapper>

View File

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

View File

@ -18,9 +18,7 @@
<select id="speciallyForVisitors" resultType="java.lang.Integer">
SELECT label_id FROM ten_label WHERE name = '访客人员'
</select>
<select id="speciallyForVisitors2" resultType="java.lang.Long">
SELECT type FROM ten_label WHERE name = '访客人员'
</select>
<select id="orgidBecomesCellId" resultType="java.lang.Long">
SELECT cell_id from ten_cell WHERE org_id = #{orgId}
</select>

View File

@ -4,9 +4,4 @@
<mapper namespace="net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper">
<select id="findTheNameById" resultType="java.lang.String">
SELECT name FROM ten_cell WHERE cell_id = #{cellId} and delete_flag = 0
</select>
</mapper>