长庆项目

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

View File

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

View File

@ -1,20 +1,15 @@
package net.shapelight.modules.iCq.controller.enter; package net.shapelight.modules.iCq.controller.enter;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.shapelight.common.utils.R; import net.shapelight.common.utils.R;
import net.shapelight.modules.iCq.controller.enter.to.FTo; import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigCellMapper;
import net.shapelight.modules.iCq.controller.enter.vo.FirstVo; import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigMapper;
import net.shapelight.modules.iCq.controller.enter.vo.PeronType; import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigTypeMapper;
import net.shapelight.modules.iCq.controller.enter.vo.TypeRules; import net.shapelight.modules.iCq.service.enter.CqEnterServiceImpl;
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 org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController @RestController
@RequestMapping("cq/enterConfig") @RequestMapping("cq/enterConfig")
@ -22,58 +17,36 @@ import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
public class CqEnterController { public class CqEnterController {
private final CqEnterMapper cqEnterMapper; private final CqEnterServiceImpl cqEnterService;
private final CqSafeVideoMapper safeVideoMapper;
private final CqMemberMapper cqMemberMapper;
@GetMapping("list") @GetMapping("list")
public R find(String operator, String cellId){ @ApiOperation(value = "配置首页列表查询")
System.out.println("cellId = " + cellId); public R list(String operator, Long cellId){
List<FTo> fTo = cqEnterMapper.classifiedQuery(cellId); return R.ok()
System.out.println(fTo); .put("data", cqEnterService.list(operator, cellId))
.put("total", cqEnterService.list(operator, cellId).size());
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());
} }
@GetMapping("/getPersonType") @GetMapping("/getPersonType")
@ApiOperation(value = "获取人员类型")
public R getPersonType(){ public R getPersonType(){
List<PeronType> personType = cqEnterMapper.getPersonType(); return R.ok().put("data", cqEnterService.getPersonType());
return R.ok().put("data", personType);
} }
@GetMapping("/rulesByType") @GetMapping("/rulesByType")
public R rulesByType(String typeId, String cellId){ @ApiOperation(value = "根据人员类型和单位id获取详细配置项")
if(typeId == null){ public R rulesByType(Integer typeId, Long cellId){
typeId = String.valueOf(cqMemberMapper.speciallyForVisitors2()); return R.ok().put("data", cqEnterService.rulesByType(typeId, cellId));
} }
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();
}
@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 @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class PeronType { public class PeronTypeVo {
/**
* 人员类型标志
*/
private int type; private int type;
/**
* 人员类型名称
*/
private String name; private String name;
} }

View File

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

View File

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

View File

@ -30,12 +30,6 @@ public class CqSafeVideoController {
private final CqSafeVideoServiceImpl cqSafeVideoService; private final CqSafeVideoServiceImpl cqSafeVideoService;
private final CqSafeVideoMapper cqSafeVideoMapper;
private final CqFileMapper cqFileMapper;
private final TenCellDao cqCellMapper;
@Autowired @Autowired
private RtspFrameGrabber rtspFrameGrabber; private RtspFrameGrabber rtspFrameGrabber;
@ -62,11 +56,14 @@ public class CqSafeVideoController {
@ApiOperation(value = "列表视频接口") @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 cellId) { @RequestParam(required = false) Long cellId,
List<TenSafeVideoEntity> list = cqSafeVideoService.list(page, size, cellId); @RequestParam(required = false) String videoName,
@RequestParam(required = false) String uploadName) {
return R.ok() return R.ok()
.put("data", list) .put("data", cqSafeVideoService.list(page, size, cellId,
.put("total", list.size()); videoName, uploadName))
.put("total", cqSafeVideoService.list(page, size, cellId,
videoName, uploadName).size());
} }
@DeleteMapping("/delete/{id}") @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") @GetMapping("/camara")
public R watchStart(String cellId) { public R watchStart(String cellId) {

View File

@ -13,7 +13,7 @@ public class VideoQueryDto {
/** /**
* 单位id * 单位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.io.Serializable;
import java.util.Date; import java.util.Date;
/**
* 宣传片表
*/
@Data @Data
@TableName("ten_enter_config") @TableName("ten_enter_config")
public class TenEnterConfigEntity implements Serializable { 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.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 com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@ -13,6 +16,7 @@ import java.util.Date;
*/ */
@Data @Data
@TableName("ten_safe_video") @TableName("ten_safe_video")
@Accessors(chain = true)
public class TenSafeVideoEntity implements Serializable { public class TenSafeVideoEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -20,6 +24,7 @@ public class TenSafeVideoEntity implements Serializable {
* 主键 * 主键
*/ */
@TableId @TableId
@JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
/** /**
@ -30,7 +35,8 @@ public class TenSafeVideoEntity implements Serializable {
/** /**
* 单位ID * 单位ID
*/ */
private String cellId; @JsonSerialize(using = ToStringSerializer.class)
private Long cellId;
/** /**
* 单位名称 * 单位名称
@ -40,7 +46,7 @@ public class TenSafeVideoEntity implements Serializable {
/** /**
* 上传人ID * 上传人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); String takeTheNameAccordingToType(Integer personType);
Integer speciallyForVisitors(); Integer speciallyForVisitors();
Long speciallyForVisitors2();
Long orgidBecomesCellId(String orgId); Long orgidBecomesCellId(String orgId);

View File

@ -7,11 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface CqFileMapper extends BaseMapper<FileEntity> { 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> { 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.modelmapper.TypeMap;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -40,7 +41,7 @@ public class CqSafeVideoServiceImpl {
* @return * @return
*/ */
public List<CellVo> getCellInfos() { public List<CellVo> getCellInfos() {
return cqCellMapper.selectList(new QueryWrapper<>()).stream() return cqCellMapper.selectList(null).stream()
.map(cell -> { .map(cell -> {
CellVo cellVo = new CellVo(); CellVo cellVo = new CellVo();
BeanUtils.copyProperties(cell, cellVo); BeanUtils.copyProperties(cell, cellVo);
@ -49,10 +50,17 @@ public class CqSafeVideoServiceImpl {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 新增视频
* @param uploadVideoDto
* @return
*/
public int insert(UploadVideoDto uploadVideoDto) { public int insert(UploadVideoDto uploadVideoDto) {
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity(); TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
BeanUtils.copyProperties(uploadVideoDto, 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>() tenSafeVideoEntity.setCellName(cqCellMapper.selectOne(new QueryWrapper<TenCellEntity>()
.select("name") .select("name")
.eq("cell_id", uploadVideoDto.getCellId())).getName()); .eq("cell_id", uploadVideoDto.getCellId())).getName());
@ -60,40 +68,24 @@ public class CqSafeVideoServiceImpl {
return cqSafeVideoMapper.insert(tenSafeVideoEntity); 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); 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(); VideoQueryDto queryDto = new VideoQueryDto();
queryDto.setCellId(cellId) queryDto.setCellId(cellId)
.setVideoName(videoName) .setVideoName(videoName)
.setUploadName(uploadName); .setUploadName(uploadName);
QueryWrapper<TenSafeVideoEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<TenSafeVideoEntity> queryWrapper = new QueryWrapper<>();
if (queryDto.getCellId() != null && !queryDto.getCellId().isEmpty()) { if (queryDto.getCellId() != null) {
queryWrapper.eq("cell_id", queryDto.getCellId()); queryWrapper.eq("cell_id", queryDto.getCellId());
} }
if (queryDto.getVideoName() != null && !queryDto.getVideoName().isEmpty()) { if (queryDto.getVideoName() != null && !queryDto.getVideoName().isEmpty()) {
@ -103,6 +95,38 @@ public class CqSafeVideoServiceImpl {
queryWrapper.eq("upload_name", queryDto.getUploadName()); queryWrapper.eq("upload_name", queryDto.getUploadName());
} }
queryWrapper.orderByDesc("upload_time"); 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"> <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> </mapper>

View File

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

View File

@ -4,9 +4,4 @@
<mapper namespace="net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper"> <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> </mapper>