diff --git a/pom.xml b/pom.xml index 83c9395..75c72b5 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ 4.12 2.9.0 1.2.13 - 3.1.2 + 3.3.0 8.0.25 4.0 11.2.0.3 @@ -279,6 +279,12 @@ 1.45 + + com.github.yulichang + mybatis-plus-join-boot-starter + 1.5.0 + + diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java index 9c7cd1f..34683d2 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java @@ -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 enterVoList = cqEnterMapper.queryByCellId(deviceEntity.getCellId()); - return R.ok().put("data",enterVoList); + return R.ok().put("data",cqEnterService.queryByCellId(sn)); } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java index 03924d7..ee7ad17 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java @@ -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 = cqEnterMapper.classifiedQuery(cellId); - System.out.println(fTo); - - ArrayList 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 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 = 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(); + } } - } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/EnterVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/EnterVo.java deleted file mode 100644 index ac3a7af..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/EnterVo.java +++ /dev/null @@ -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; -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/FTo.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/FTo.java deleted file mode 100644 index cbb1999..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/FTo.java +++ /dev/null @@ -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; - -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/CellRuleVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/CellRuleVo.java new file mode 100644 index 0000000..e82d64d --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/CellRuleVo.java @@ -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; +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/ConfigListVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/ConfigListVo.java new file mode 100644 index 0000000..fd1bbe5 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/ConfigListVo.java @@ -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; + + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/FirstVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/FirstVo.java deleted file mode 100644 index 8419896..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/FirstVo.java +++ /dev/null @@ -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; - -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/PeronType.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/PeronTypeVo.java similarity index 68% rename from shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/PeronType.java rename to shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/PeronTypeVo.java index 0c7edc7..8590d59 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/PeronType.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/PeronTypeVo.java @@ -7,7 +7,13 @@ import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor -public class PeronType { +public class PeronTypeVo { + /** + * 人员类型标志 + */ private int type; + /** + * 人员类型名称 + */ private String name; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/TypeRules.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/TypeRuleVo.java similarity index 64% rename from shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/TypeRules.java rename to shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/TypeRuleVo.java index 85da58d..1651042 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/TypeRules.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/TypeRuleVo.java @@ -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; + + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java index d2c4b6c..d84729e 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java @@ -425,11 +425,9 @@ public class CqMemberController { @PutMapping("batchChangeStatus") public R batchChangeStatus(List memberIds){ - for (Long memberId : memberIds) { cqMemberMapper.changeViewingState(memberId); } - return R.ok(); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/CqSafeVideoController.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/CqSafeVideoController.java index b363e0b..0fe17bd 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/CqSafeVideoController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/CqSafeVideoController.java @@ -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 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 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) { diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/dto/VideoQueryDto.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/dto/VideoQueryDto.java index a37b030..f0978c8 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/dto/VideoQueryDto.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/dto/VideoQueryDto.java @@ -13,7 +13,7 @@ public class VideoQueryDto { /** * 单位id */ - private String cellId; + private Long cellId; /** * 视频名称 */ diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigCell.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigCell.java new file mode 100644 index 0000000..1ac34c6 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigCell.java @@ -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; + + + +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigEntity.java index d043e2d..ced12d5 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigEntity.java @@ -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 { diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigType.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigType.java new file mode 100644 index 0000000..4f62a61 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/enter/TenEnterConfigType.java @@ -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; + + + +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/TenSafeVideoEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/TenSafeVideoEntity.java index 468d020..2faf223 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/TenSafeVideoEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/TenSafeVideoEntity.java @@ -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; /** * 上传人姓名 diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterConfigCellMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterConfigCellMapper.java new file mode 100644 index 0000000..4891919 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterConfigCellMapper.java @@ -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 { +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterConfigMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterConfigMapper.java new file mode 100644 index 0000000..6b53451 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterConfigMapper.java @@ -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 { +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterConfigTypeMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterConfigTypeMapper.java new file mode 100644 index 0000000..ae00b6b --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterConfigTypeMapper.java @@ -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 { + + +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterMapper.java deleted file mode 100644 index 245255d..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterMapper.java +++ /dev/null @@ -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 { - - - List classifiedQuery(@Param("cellId")String cellId); - - List getPersonType(); - - List rulesByType(String typeId, @Param("cellId") String cellId); - - int changeState(int ruleId); - - List queryByCellId(Long cellId); -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/member/CqMemberMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/member/CqMemberMapper.java index 8eb88e0..d8e04cf 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/member/CqMemberMapper.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/member/CqMemberMapper.java @@ -16,7 +16,6 @@ public interface CqMemberMapper extends BaseMapper { String takeTheNameAccordingToType(Integer personType); Integer speciallyForVisitors(); - Long speciallyForVisitors2(); Long orgidBecomesCellId(String orgId); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqFileMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqFileMapper.java index b4a7c93..0459148 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqFileMapper.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqFileMapper.java @@ -7,11 +7,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface CqFileMapper extends BaseMapper { - /** - * 根据文件id获取文件信息 - * @param fileId - * @return - */ - FileEntity selectByFileId(String fileId); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqSafeVideoMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqSafeVideoMapper.java index 41ceacc..e803628 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqSafeVideoMapper.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqSafeVideoMapper.java @@ -9,7 +9,4 @@ import org.apache.ibatis.annotations.Mapper; public interface CqSafeVideoMapper extends BaseMapper { - - - String findTheNameById(String cellId); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/enter/CqEnterServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/enter/CqEnterServiceImpl.java new file mode 100644 index 0000000..735f011 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/enter/CqEnterServiceImpl.java @@ -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 list(String operator, Long cellId) { + QueryWrapper 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 getPersonType() { + return cqTenlableMapper.selectList( + new QueryWrapper() + .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 rulesByType(Integer typeId, Long cellId) { + if (typeId == null) { + typeId = cqTenlableMapper.selectOne(new QueryWrapper() + .eq("name", "访客人员")) + .getType(); + } + //查询主表 连 返回结果 join 从表 + return cqEnterConfigMapper.selectJoinList(TypeRuleVo.class, + new MPJLambdaWrapper() + .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() + .eq("enter_config_id", cqEnterConfigCellMapper + .selectOne(new QueryWrapper().eq("id", ruleId)) + .getEnterConfigId()) + .eq("cell_id", cqEnterConfigCellMapper + .selectOne(new QueryWrapper().eq("id", ruleId)).getCellId()) + .set("operate_time", new Date())) > 0 + && cqEnterConfigTypeMapper.update( + null, + new UpdateWrapper() + .eq("id", ruleId) + .setSql("state = 1 - state")) > 0; + + } + + /** + * 根据sn号下发配置规则 + * @param sn + * @return + */ + public List queryByCellId(String sn) { + return cqEnterConfigTypeMapper.selectJoinList(CellRuleVo.class, + new MPJLambdaWrapper() + .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() + .eq("sn", sn)).getCellId()) + ); + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoService.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoService.java deleted file mode 100644 index d2c37b8..0000000 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoService.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.shapelight.modules.iCq.service.video; - -public interface CqSafeVideoService { - //接口声明() -} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoServiceImpl.java index c9d25ad..4486532 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoServiceImpl.java @@ -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 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() + .eq("file_id", uploadVideoDto.getFileId())), + tenSafeVideoEntity); tenSafeVideoEntity.setCellName(cqCellMapper.selectOne(new QueryWrapper() .select("name") .eq("cell_id", uploadVideoDto.getCellId())).getName()); @@ -60,40 +68,24 @@ public class CqSafeVideoServiceImpl { return cqSafeVideoMapper.insert(tenSafeVideoEntity); } - public List list(int page, int size, String cellId) { + /** + * 查询视频列表 + * @param page + * @param size + * @param cellId + * @param videoName + * @param uploadName + * @return + */ + public List list(int page, int size, Long cellId, + String videoName, String uploadName) { Page pageRequest = new Page<>(page, size); - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (cellId != null && !cellId.isEmpty()){ - queryWrapper.eq("cell_id", cellId); - } - queryWrapper.orderByDesc("upload_time"); - IPage 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 inquireVideo(String cellId, String videoName, String uploadName) { VideoQueryDto queryDto = new VideoQueryDto(); queryDto.setCellId(cellId) .setVideoName(videoName) .setUploadName(uploadName); QueryWrapper 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 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() + .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); + } + + + } diff --git a/shapelight-admin/src/main/resources/mapper/iCq/CqEnterConfigMapper.xml b/shapelight-admin/src/main/resources/mapper/iCq/CqEnterConfigMapper.xml new file mode 100644 index 0000000..1543bce --- /dev/null +++ b/shapelight-admin/src/main/resources/mapper/iCq/CqEnterConfigMapper.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/shapelight-admin/src/main/resources/mapper/iCq/CqEnterMapper.xml b/shapelight-admin/src/main/resources/mapper/iCq/CqEnterMapper.xml deleted file mode 100644 index d566783..0000000 --- a/shapelight-admin/src/main/resources/mapper/iCq/CqEnterMapper.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - UPDATE ten_enter_config_type - SET state = NOT state - WHERE id = #{ruleId}; - - - - - - - - \ No newline at end of file diff --git a/shapelight-admin/src/main/resources/mapper/iCq/CqFileMapper.xml b/shapelight-admin/src/main/resources/mapper/iCq/CqFileMapper.xml index 766054d..c45bc6f 100644 --- a/shapelight-admin/src/main/resources/mapper/iCq/CqFileMapper.xml +++ b/shapelight-admin/src/main/resources/mapper/iCq/CqFileMapper.xml @@ -3,10 +3,5 @@ - \ No newline at end of file diff --git a/shapelight-admin/src/main/resources/mapper/iCq/CqMemberMapper.xml b/shapelight-admin/src/main/resources/mapper/iCq/CqMemberMapper.xml index 76c9a4d..1d7b51c 100644 --- a/shapelight-admin/src/main/resources/mapper/iCq/CqMemberMapper.xml +++ b/shapelight-admin/src/main/resources/mapper/iCq/CqMemberMapper.xml @@ -18,9 +18,7 @@ - + diff --git a/shapelight-admin/src/main/resources/mapper/iCq/CqSafeVideoMapper.xml b/shapelight-admin/src/main/resources/mapper/iCq/CqSafeVideoMapper.xml index 7ba27ff..bb4167b 100644 --- a/shapelight-admin/src/main/resources/mapper/iCq/CqSafeVideoMapper.xml +++ b/shapelight-admin/src/main/resources/mapper/iCq/CqSafeVideoMapper.xml @@ -4,9 +4,4 @@ - - - \ No newline at end of file