diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceInfo.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceInfo.java index c7a0078..1fb764b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceInfo.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceInfo.java @@ -108,4 +108,7 @@ public class KitchenDeviceInfo extends Model { private Date updateTime; + private String ip; + private Integer channel; + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceInfoServiceImpl.java index 3dfef94..4ab99f6 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceInfoServiceImpl.java @@ -117,6 +117,28 @@ public class KitchenDeviceInfoServiceImpl extends ServiceImpllambdaQuery() + .eq(KitchenDeviceInfo::getIp, kitchenDeviceInfo.getIp())); + if(bean !=null) { + throw new ServiceException("设备IP已存在,请检查后重新输入"); + } + if (kitchenDeviceInfo.getChannel() == null || kitchenDeviceInfo.getChannel() < 1) { + throw new ServiceException("摄像头设备的IP地址不能为空或小于1"); + } + bean = kitchenDeviceInfoMapper.selectOne( + Wrappers.lambdaQuery() + .eq(KitchenDeviceInfo::getDeviceType, kitchenDeviceInfo.getDeviceType()) + .eq(KitchenDeviceInfo::getChannel, kitchenDeviceInfo.getChannel())); + if(bean !=null) { + throw new ServiceException("改类型设备通道已存在,请检查后重新输入"); + } + } try { return kitchenDeviceInfoMapper.insertKitchenDeviceInfo(kitchenDeviceInfo); } catch (Exception e) { @@ -143,6 +165,14 @@ public class KitchenDeviceInfoServiceImpl extends ServiceImpllambdaQuery() - .eq(KitchenDeviceInfo::getDeviceNo, kitchenDeviceInfo.getDeviceNo()) + .eq(KitchenDeviceInfo::getIp, kitchenDeviceInfo.getIp()) .ne(KitchenDeviceInfo::getDeviceId, kitchenDeviceInfo.getDeviceId()) ); if(bean !=null){ - throw new ServiceException("编设备编码已存在"); + throw new ServiceException("设备ip已存在"); + } + bean = kitchenDeviceInfoMapper.selectOne( + Wrappers.lambdaQuery() + .eq(KitchenDeviceInfo::getChannel, kitchenDeviceInfo.getChannel()) + .eq(KitchenDeviceInfo::getDeviceType, kitchenDeviceInfo.getDeviceType()) + .ne(KitchenDeviceInfo::getDeviceId, kitchenDeviceInfo.getDeviceId()) + ); + if(bean !=null){ + throw new ServiceException("改设备类型 设备通道号已存在"); } try { return kitchenDeviceInfoMapper.update(kitchenDeviceInfo, diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenHomePageerviceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenHomePageerviceImpl.java index c097509..8353db7 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenHomePageerviceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenHomePageerviceImpl.java @@ -105,11 +105,13 @@ public class KitchenHomePageerviceImpl implements IKitchenHomePageService { int expireCount = 0; for(KitchenStaffInfo kitchenStaffInfo : selectKitchenStaffInfoList){ LocalDate healthCertExpire = kitchenStaffInfo.getHealthCertExpire(); + System.err.println("111: " + ChronoUnit.DAYS.between(healthCertExpire,LocalDate.now())); + System.err.println("222: " + ChronoUnit.DAYS.between(LocalDate.now(),healthCertExpire)); if(healthCertExpire == null){ lackCount ++; - }else if(ChronoUnit.DAYS.between(LocalDate.now(), healthCertExpire)>inemValue){ + }else if(ChronoUnit.DAYS.between(LocalDate.now(), healthCertExpire)0){ adventCount ++; - }else if (ChronoUnit.DAYS.between(LocalDate.now(), healthCertExpire)<0){ + }else if (ChronoUnit.DAYS.between(LocalDate.now(),healthCertExpire)<0){ expireCount ++; }else{ normalCount ++; diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/vo/KitchenDeviceListVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/vo/KitchenDeviceListVO.java index 77c8a02..3c9776c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/vo/KitchenDeviceListVO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/vo/KitchenDeviceListVO.java @@ -87,5 +87,8 @@ public class KitchenDeviceListVO { private String canteenName; + private String ip; + + private String channel; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/controller/VideoController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/controller/VideoController.java index 948b526..25ed2e4 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/controller/VideoController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/controller/VideoController.java @@ -1,5 +1,6 @@ package com.bonus.canteen.core.video.controller; +import com.bonus.canteen.core.video.dto.CameraByPlaceDTO; import com.bonus.canteen.core.video.dto.PlaybackURLsDTO; import com.bonus.canteen.core.video.dto.PreviewDTO; import com.bonus.canteen.core.video.entity.VideoRequestBean; @@ -54,8 +55,8 @@ public class VideoController extends BaseController { @ApiOperation(value = "根据位置分类摄像头") @SysLog(title = "根据位置分类摄像头", businessType = OperaType.DELETE, logType = 1,module = "视频管理->根据位置分类摄像头") @PostMapping("/getCameraByPlace") - public AjaxResult getCameraByPlace(@RequestBody PlaybackURLsDTO playbackURLsDTO) { - return success(videoService.playbackURLs(playbackURLsDTO)); + public AjaxResult getCameraByPlace(@RequestBody CameraByPlaceDTO cameraByPlaceDTO) { + return success(videoService.getCameraByPlace(cameraByPlaceDTO)); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/dto/CameraByPlaceDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/dto/CameraByPlaceDTO.java new file mode 100644 index 0000000..42ff1b7 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/dto/CameraByPlaceDTO.java @@ -0,0 +1,20 @@ +package com.bonus.canteen.core.video.dto; + +import lombok.Data; + +/** + * @author xliu + * @date 2025/6/27 16:10 + */ +@Data +public class CameraByPlaceDTO { + + private String placeId; // 区域ID + + private String placeName; // 区域名称 + + private String cameraName; // 摄像头名称 + + private Integer deviceType; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/mapper/VideoMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/mapper/VideoMapper.java new file mode 100644 index 0000000..a23c373 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/mapper/VideoMapper.java @@ -0,0 +1,19 @@ +package com.bonus.canteen.core.video.mapper; + +import com.bonus.canteen.core.screening.vo.EchartsVO; +import com.bonus.canteen.core.screening.vo.SingleModelVO; +import com.bonus.canteen.core.video.dto.CameraByPlaceDTO; +import com.bonus.canteen.core.video.vo.CameraByPlaceVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author 19814 + */ +public interface VideoMapper { + + List getPlace(CameraByPlaceDTO cameraByPlaceDTO); + + List getDevice(CameraByPlaceDTO cameraByPlaceDTO); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/service/VideoService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/service/VideoService.java index 12e6042..584a27a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/service/VideoService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/service/VideoService.java @@ -1,8 +1,12 @@ package com.bonus.canteen.core.video.service; +import com.bonus.canteen.core.video.dto.CameraByPlaceDTO; import com.bonus.canteen.core.video.dto.PlaybackURLsDTO; import com.bonus.canteen.core.video.dto.PreviewDTO; import com.bonus.canteen.core.video.entity.VideoRequestBean; +import com.bonus.canteen.core.video.vo.CameraByPlaceVO; + +import java.util.List; /** * @author xliu @@ -15,4 +19,6 @@ public interface VideoService { String previewURLs(PreviewDTO previewDTO); String playbackURLs(PlaybackURLsDTO playbackURLsDTO); + + List getCameraByPlace(CameraByPlaceDTO cameraByPlaceDTO); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/service/impl/VideoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/service/impl/VideoServiceImpl.java index 0899730..c339c9f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/service/impl/VideoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/service/impl/VideoServiceImpl.java @@ -1,16 +1,25 @@ package com.bonus.canteen.core.video.service.impl; import com.alibaba.fastjson2.JSON; +import com.bonus.canteen.core.video.dto.CameraByPlaceDTO; import com.bonus.canteen.core.video.dto.PlaybackURLsDTO; import com.bonus.canteen.core.video.dto.PreviewDTO; import com.bonus.canteen.core.video.entity.VideoRequestBean; +import com.bonus.canteen.core.video.mapper.VideoMapper; import com.bonus.canteen.core.video.service.VideoService; import com.bonus.canteen.core.video.utils.HCNetVedio; import com.bonus.canteen.core.video.utils.HKRequest; +import com.bonus.canteen.core.video.vo.CameraByPlaceVO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + /** * @author xliu * @date 2025/6/23 15:27 @@ -18,6 +27,9 @@ import org.springframework.stereotype.Service; @Service public class VideoServiceImpl implements VideoService { public static Logger logger = LoggerFactory.getLogger(VideoServiceImpl.class); + + @Resource + private VideoMapper videoMapper; @Override public String download(VideoRequestBean bean) { String fileName = ""; @@ -57,4 +69,22 @@ public class VideoServiceImpl implements VideoService { String result = HKRequest.sendHttp(HKRequest.GET_VIDEO_HISTORY_URL, JSON.toJSONString(playbackURLsDTO)); return result; } + + @Override + public List getCameraByPlace(CameraByPlaceDTO cameraByPlaceDTO) { + List placeList = videoMapper.getPlace(cameraByPlaceDTO); + List deviceList = videoMapper.getDevice(cameraByPlaceDTO); + List allList = new ArrayList<>(); + Set placeIds = placeList.stream() + .map(CameraByPlaceVO::getId) + .collect(Collectors.toSet()); +// 过滤 deviceList 中 pId 存在于 placeIds 中的元素 + List filteredDevices = deviceList.stream() + .filter(device -> placeIds.contains(device.getPId())) + .collect(Collectors.toList()); + // 将 placeList 和 filteredDevices 合并 + allList.addAll(placeList); + allList.addAll(filteredDevices); + return allList; + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/vo/CameraByPlaceVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/vo/CameraByPlaceVO.java new file mode 100644 index 0000000..b28025e --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/video/vo/CameraByPlaceVO.java @@ -0,0 +1,17 @@ +package com.bonus.canteen.core.video.vo; + +import lombok.Data; + +/** + * @author xliu + * @date 2025/6/27 16:12 + */ +@Data +public class CameraByPlaceVO { + private String id; + private String name; + private String pId; + private String ip; + private String channel; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceInfoMapper.xml index 80ed265..8c4f6f7 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceInfoMapper.xml @@ -20,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -42,6 +44,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -62,6 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" device_repair_period, device_extend_info, del_flag, + ip, + channel, kit.create_by, kit.create_time, kit.update_by, @@ -125,6 +131,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, update_by, update_time, + ip, + channel, #{deviceNo}, @@ -145,6 +153,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{updateBy}, #{updateTime}, + #{ip}, + #{channel}, diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/video/VideoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/video/VideoMapper.xml new file mode 100644 index 0000000..cd0fd71 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/video/VideoMapper.xml @@ -0,0 +1,30 @@ + + + + + + + +