Merge remote-tracking branch 'origin/master'
| | |
| | | Map option = new HashMap(); |
| | | option.put("value", item.getId()); |
| | | option.put("label", item.getName()); |
| | | option.put("channel", item.getChannel()); |
| | | option.put("channel", item.getChanNo()); |
| | | List timeList = ardVideoInspectTaskService.getCameraIdleTimeList(item.getId()); |
| | | option.put("idleTimeList", timeList);//ç©ºé²æ¶é´æ®µ |
| | | options.add(option); |
| | |
| | | package com.ruoyi.device.camera.domain; |
| | | |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | import com.sun.jna.Structure; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¸æºè®¾å¤å¯¹è±¡ ard_cameras |
| | |
| | | @Excel(name = "å
çµç±»å") |
| | | private String gdtype; |
| | | |
| | | /** |
| | | * ééå· |
| | | */ |
| | | @Excel(name = "ééå·") |
| | | private Integer channel; |
| | | |
| | | |
| | | /** |
| | | * ç»åº¦ |
| | |
| | | private Integer loginId; |
| | | private String operatorId; |
| | | private Date operatorExpired; |
| | | /** |
| | | * ééå· |
| | | */ |
| | | private Integer chanNo; |
| | | /** |
| | | * èµ·å§ééå· |
| | | */ |
| | | private Integer startDChan; |
| | | /** |
| | | * ééæ° |
| | | */ |
| | | @Excel(name = "ééæ°") |
| | | private Integer chanNum; |
| | | /** |
| | | * éé |
| | | */ |
| | | private List<ArdChannel> channelList; |
| | | } |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | import com.ruoyi.device.channel.mapper.ArdChannelMapper; |
| | | import com.ruoyi.device.channel.service.IArdChannelService; |
| | | import com.ruoyi.device.hiksdk.common.GlobalVariable; |
| | | import com.ruoyi.device.hiksdk.service.IHikClientService; |
| | | import com.ruoyi.scheduling.domian.SchedulingParam; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.utils.tools.ArdTool; |
| | |
| | | private SysDeptMapper sysDeptMapper; |
| | | @Resource |
| | | private RedisCache redisCache; |
| | | @Resource |
| | | private IHikClientService hikClientService; |
| | | @Resource |
| | | private ArdChannelMapper ardChannelMapper; |
| | | |
| | | |
| | | @PostConstruct |
| | |
| | | ardCameras.setCreateTime(DateUtils.getNowDate()); |
| | | ardCameras.setUserId(SecurityUtils.getUserId()); |
| | | redisCache.setCacheObject(getCacheKey(ardCameras.getId()), ardCameras); |
| | | return ardCamerasMapper.insertArdCameras(ardCameras); |
| | | int i = ardCamerasMapper.insertArdCameras(ardCameras); |
| | | if (i > 0) { |
| | | // //å é¤å½åç¸æºçææéé |
| | | // ardChannelMapper.deleteArdChannelByDeviceId(ardCameras.getId()); |
| | | // //è·åç¸æºéé |
| | | // List<ArdChannel> ipChannelList = hikClientService.getCameraChannelList(ardCameras); |
| | | // if (ipChannelList.size() > 0) { |
| | | // for (ArdChannel channel : ipChannelList) { |
| | | // channel.setId(IdUtils.simpleUUID()); |
| | | // ardChannelMapper.insertArdChannel(channel); |
| | | // } |
| | | // } |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | |
| | | if (res > 0) { |
| | | for (String id : ids) { |
| | | redisCache.deleteObject(getCacheKey(id)); |
| | | //å é¤å½åç¸æºçææéé |
| | | ardChannelMapper.deleteArdChannelByDeviceId(id); |
| | | } |
| | | } |
| | | return res; |
| | |
| | | */ |
| | | @Override |
| | | public int deleteArdCamerasById(String id) { |
| | | return ardCamerasMapper.deleteArdCamerasById(id); |
| | | int i = ardCamerasMapper.deleteArdCamerasById(id); |
| | | if (i > 0) { |
| | | //å é¤å½åç¸æºçææéé |
| | | ardChannelMapper.deleteArdChannelByDeviceId(id); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | public List findOptions(ArdCameras ardCameras) { |
| | |
| | | } |
| | | if (distance != 0.0 && distance <= camera.getCamMaxVisibleDistance()) { |
| | | distanceMap.put(camera.getId(), distance); |
| | | camera.setChannel(ArdTool.getChannelBydayNightTime(dayNightTime)); |
| | | camera.setChanNo(ArdTool.getChannelBydayNightTime(dayNightTime)); |
| | | ardCameras.put(distance, camera); |
| | | } |
| | | |
| | |
| | | double[] camPosition = new double[]{camera.getLongitude(), camera.getLatitude()}; |
| | | double distance = GisTool.getDistance(new double[]{longitude, latitude}, camPosition); |
| | | if (distance <= radius) { |
| | | camera.setChannel(ArdTool.getChannelBydayNightTime(dayNightTime)); |
| | | camera.setChanNo(ArdTool.getChannelBydayNightTime(dayNightTime)); |
| | | ardCameras.add(camera); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.channel.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | import com.ruoyi.device.channel.service.IArdChannelService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * éé管çController |
| | | * |
| | | * @author ard |
| | | * @date 2023-08-19 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/device/channel") |
| | | @Api(tags = "ééç®¡çæ¥å£") |
| | | public class ArdChannelController extends BaseController |
| | | { |
| | | @Autowired |
| | | private IArdChannelService ardChannelService; |
| | | |
| | | /** |
| | | * æ¥è¯¢éé管çå表 |
| | | */ |
| | | @ApiOperation("æ¥è¯¢éé管çå表") |
| | | // @PreAuthorize("@ss.hasPermi('device:channel:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ArdChannel ardChannel) |
| | | { |
| | | startPage(); |
| | | List<ArdChannel> list = ardChannelService.selectArdChannelList(ardChannel); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºéé管çå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('device:channel:export')") |
| | | @Log(title = "éé管ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ArdChannel ardChannel) |
| | | { |
| | | List<ArdChannel> list = ardChannelService.selectArdChannelList(ardChannel); |
| | | ExcelUtil<ArdChannel> util = new ExcelUtil<ArdChannel>(ArdChannel.class); |
| | | util.exportExcel(response, list, "ééç®¡çæ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * è·åéé管ç详ç»ä¿¡æ¯ |
| | | */ |
| | | @ApiOperation("è·åéé管ç详ç»ä¿¡æ¯") |
| | | // @PreAuthorize("@ss.hasPermi('device:channel:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") String id) |
| | | { |
| | | return success(ardChannelService.selectArdChannelById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢éé管ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('device:channel:add')") |
| | | @Log(title = "éé管ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ArdChannel ardChannel) |
| | | { |
| | | return toAjax(ardChannelService.insertArdChannel(ardChannel)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹éé管ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('device:channel:edit')") |
| | | @Log(title = "éé管ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ArdChannel ardChannel) |
| | | { |
| | | return toAjax(ardChannelService.updateArdChannel(ardChannel)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤éé管ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('device:channel:remove')") |
| | | @Log(title = "éé管ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable String[] ids) |
| | | { |
| | | return toAjax(ardChannelService.deleteArdChannelByIds(ids)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.channel.domain; |
| | | |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | |
| | | /** |
| | | * éé管ç对象 ard_channel |
| | | * |
| | | * @author ard |
| | | * @date 2023-08-19 |
| | | */ |
| | | public class ArdChannel extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** id */ |
| | | private String id; |
| | | |
| | | /** ééåç§° */ |
| | | @Excel(name = "ééåç§°") |
| | | private String name; |
| | | |
| | | /** ééå· */ |
| | | @Excel(name = "ééå·") |
| | | private Integer chanNo; |
| | | |
| | | /** æå±è®¾å¤id */ |
| | | @Excel(name = "æå±è®¾å¤id") |
| | | private String deviceId; |
| | | |
| | | public void setId(String id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getId() |
| | | { |
| | | return id; |
| | | } |
| | | public void setName(String name) |
| | | { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getName() |
| | | { |
| | | return name; |
| | | } |
| | | public void setChanNo(Integer chanNo) |
| | | { |
| | | this.chanNo = chanNo; |
| | | } |
| | | |
| | | public Integer getChanNo() |
| | | { |
| | | return chanNo; |
| | | } |
| | | public void setDeviceId(String deviceId) |
| | | { |
| | | this.deviceId = deviceId; |
| | | } |
| | | |
| | | public String getDeviceId() |
| | | { |
| | | return deviceId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("name", getName()) |
| | | .append("chanNo", getChanNo()) |
| | | .append("deviceId", getDeviceId()) |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.channel.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | |
| | | /** |
| | | * éé管çMapperæ¥å£ |
| | | * |
| | | * @author ard |
| | | * @date 2023-08-19 |
| | | */ |
| | | public interface ArdChannelMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢éé管ç |
| | | * |
| | | * @param id éé管çä¸»é® |
| | | * @return éé管ç |
| | | */ |
| | | public ArdChannel selectArdChannelById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢éé管çå表 |
| | | * |
| | | * @param ardChannel éé管ç |
| | | * @return éé管çéå |
| | | */ |
| | | public List<ArdChannel> selectArdChannelList(ArdChannel ardChannel); |
| | | |
| | | /** |
| | | * æ°å¢éé管ç |
| | | * |
| | | * @param ardChannel éé管ç |
| | | * @return ç»æ |
| | | */ |
| | | public int insertArdChannel(ArdChannel ardChannel); |
| | | |
| | | /** |
| | | * ä¿®æ¹éé管ç |
| | | * |
| | | * @param ardChannel éé管ç |
| | | * @return ç»æ |
| | | */ |
| | | public int updateArdChannel(ArdChannel ardChannel); |
| | | |
| | | /** |
| | | * å é¤éé管ç |
| | | * |
| | | * @param id éé管çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteArdChannelById(String id); |
| | | |
| | | /** |
| | | * æ¹éå é¤éé管ç |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteArdChannelByIds(String[] ids); |
| | | |
| | | /** |
| | | * å é¤éé管çæè®¾å¤ID |
| | | * |
| | | * @param deviceId æå±è®¾å¤ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteArdChannelByDeviceId(String deviceId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.channel.service; |
| | | |
| | | import java.util.List; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | |
| | | /** |
| | | * éé管çServiceæ¥å£ |
| | | * |
| | | * @author ard |
| | | * @date 2023-08-19 |
| | | */ |
| | | public interface IArdChannelService |
| | | { |
| | | /** |
| | | * æ¥è¯¢éé管ç |
| | | * |
| | | * @param id éé管çä¸»é® |
| | | * @return éé管ç |
| | | */ |
| | | public ArdChannel selectArdChannelById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢éé管çå表 |
| | | * |
| | | * @param ardChannel éé管ç |
| | | * @return éé管çéå |
| | | */ |
| | | public List<ArdChannel> selectArdChannelList(ArdChannel ardChannel); |
| | | |
| | | /** |
| | | * æ°å¢éé管ç |
| | | * |
| | | * @param ardChannel éé管ç |
| | | * @return ç»æ |
| | | */ |
| | | public int insertArdChannel(ArdChannel ardChannel); |
| | | |
| | | /** |
| | | * ä¿®æ¹éé管ç |
| | | * |
| | | * @param ardChannel éé管ç |
| | | * @return ç»æ |
| | | */ |
| | | public int updateArdChannel(ArdChannel ardChannel); |
| | | |
| | | /** |
| | | * æ¹éå é¤éé管ç |
| | | * |
| | | * @param ids éè¦å é¤çéé管ç主é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteArdChannelByIds(String[] ids); |
| | | |
| | | /** |
| | | * å é¤éé管çä¿¡æ¯ |
| | | * |
| | | * @param id éé管çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteArdChannelById(String id); |
| | | /** |
| | | * å é¤éé管çä¿¡æ¯ |
| | | * |
| | | * @param deviceId æå±è®¾å¤ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteArdChannelByDeviceId(String deviceId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.channel.service.impl; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.device.channel.mapper.ArdChannelMapper; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | import com.ruoyi.device.channel.service.IArdChannelService; |
| | | |
| | | /** |
| | | * éé管çServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author ard |
| | | * @date 2023-08-19 |
| | | */ |
| | | @Service |
| | | public class ArdChannelServiceImpl implements IArdChannelService { |
| | | @Autowired |
| | | private ArdChannelMapper ardChannelMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢éé管ç |
| | | * |
| | | * @param id éé管çä¸»é® |
| | | * @return éé管ç |
| | | */ |
| | | @Override |
| | | public ArdChannel selectArdChannelById(String id) { |
| | | return ardChannelMapper.selectArdChannelById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢éé管çå表 |
| | | * |
| | | * @param ardChannel éé管ç |
| | | * @return éé管ç |
| | | */ |
| | | @Override |
| | | public List<ArdChannel> selectArdChannelList(ArdChannel ardChannel) { |
| | | return ardChannelMapper.selectArdChannelList(ardChannel); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢éé管ç |
| | | * |
| | | * @param ardChannel éé管ç |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertArdChannel(ArdChannel ardChannel) { |
| | | ardChannel.setId(IdUtils.simpleUUID()); |
| | | return ardChannelMapper.insertArdChannel(ardChannel); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹éé管ç |
| | | * |
| | | * @param ardChannel éé管ç |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateArdChannel(ArdChannel ardChannel) { |
| | | return ardChannelMapper.updateArdChannel(ardChannel); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤éé管ç |
| | | * |
| | | * @param ids éè¦å é¤çéé管çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteArdChannelByIds(String[] ids) { |
| | | return ardChannelMapper.deleteArdChannelByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å é¤éé管çä¿¡æ¯ |
| | | * |
| | | * @param id éé管çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteArdChannelById(String id) { |
| | | return ardChannelMapper.deleteArdChannelById(id); |
| | | } |
| | | /** |
| | | * å é¤éé管çä¿¡æ¯ |
| | | * |
| | | * @param deviceId æå±è®¾å¤ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteArdChannelByDeviceId(String deviceId) { |
| | | return ardChannelMapper.deleteArdChannelByDeviceId(deviceId); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | //忢å½å-ä¸ä¸ä¼ minio |
| | | void recordStopNotToMinio(CameraCmd cmd); |
| | | |
| | | //è·åç¸æºééä¿¡æ¯ |
| | | public List<ArdChannel> getCameraChannelList(ArdCameras camera); |
| | | } |
| | |
| | | package com.ruoyi.device.hiksdk.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.common.annotation.SdkOperate; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | import com.ruoyi.device.channel.service.IArdChannelService; |
| | | import com.ruoyi.device.hiksdk.common.GlobalVariable; |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.hiksdk.config.MinioClientSingleton; |
| | |
| | | import com.ruoyi.device.hiksdk.util.hikSdkUtil.LoginResultCallBack; |
| | | import com.ruoyi.storage.minio.utils.MinioUtils; |
| | | import com.sun.jna.Native; |
| | | import com.sun.jna.NativeLong; |
| | | import com.sun.jna.Platform; |
| | | import com.sun.jna.Pointer; |
| | | import com.sun.jna.ptr.IntByReference; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Base64; |
| | | import javax.annotation.Resource; |
| | | import java.io.*; |
| | |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.device.hiksdk.util.hikSdkUtil.HCNetSDK.*; |
| | | |
| | |
| | | GlobalVariable.loginMap.remove(camera.getId()); |
| | | GlobalVariable.loginMap.put(camera.getId(), lUserID); |
| | | camera.setLoginId(lUserID); |
| | | camera.setChannel((int) m_strDeviceInfo.byStartChan); |
| | | camera.setStartDChan((int) m_strDeviceInfo.byStartChan); |
| | | return camera; |
| | | } |
| | | |
| | |
| | | log.error("å½å忢å¼å¸¸" + ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | //è·åIPéé |
| | | @Override |
| | | public List<ArdChannel> getCameraChannelList(ArdCameras camera) { |
| | | /*è·åéé*/ |
| | | List<ArdChannel> channelList = new ArrayList<>(); |
| | | try { |
| | | Integer chanNum = camera.getChanNum(); |
| | | Integer startDChan = camera.getStartDChan(); |
| | | if (chanNum > 0) { |
| | | // è·åééå· |
| | | for (int iChannum = 0; iChannum < chanNum; iChannum++) { |
| | | ArdChannel ardChannel = new ArdChannel(); |
| | | int channum = iChannum + startDChan+1; |
| | | HCNetSDK.NET_DVR_PICCFG_V40 strPicCfg = new HCNetSDK.NET_DVR_PICCFG_V40(); |
| | | strPicCfg.dwSize = strPicCfg.size(); |
| | | strPicCfg.write(); |
| | | Pointer pStrPicCfg = strPicCfg.getPointer(); |
| | | NativeLong lChannel = new NativeLong(channum); |
| | | IntByReference pInt = new IntByReference(0); |
| | | boolean b_GetPicCfg = hCNetSDK.NET_DVR_GetDVRConfig(camera.getLoginId(), HCNetSDK.NET_DVR_GET_PICCFG_V40, lChannel.intValue(), |
| | | pStrPicCfg, strPicCfg.size(), pInt); |
| | | if (b_GetPicCfg) { |
| | | strPicCfg.read(); |
| | | String channelName = new String(strPicCfg.sChanName, "GBK").trim(); |
| | | ardChannel.setName(channelName); |
| | | } |
| | | ardChannel.setDeviceId(camera.getId()); |
| | | ardChannel.setChanNo(iChannum + 1); |
| | | channelList.add(ardChannel); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("è·åç¸æºééå¼å¸¸:" + ex.getMessage()); |
| | | } |
| | | return channelList; |
| | | } |
| | | } |
| | |
| | | public byte byEnable; /* 该é鿝å¦å¯ç¨ */ |
| | | public byte byIPID; /* IP设å¤ID åå¼1- MAX_IP_DEVICE */ |
| | | public byte byChannel; /* ééå· */ |
| | | public byte byIPIDHigh; |
| | | public byte[] byres = new byte[33]; /* ä¿ç */ |
| | | |
| | | |
| | |
| | | import com.ruoyi.alarm.global.domain.GuidePriorityQueue; |
| | | import com.ruoyi.alarm.global.domain.GuideTask; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | import com.ruoyi.device.channel.service.IArdChannelService; |
| | | import com.ruoyi.device.hiksdk.common.GlobalVariable; |
| | | import com.ruoyi.device.hiksdk.service.IHikClientService; |
| | | import com.sun.jna.Pointer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.concurrent.PriorityBlockingQueue; |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public int invoke(int lUserID, int dwResult, HCNetSDK.NET_DVR_DEVICEINFO_V30 lpDeviceinfo, Pointer pUser) { |
| | | IArdChannelService ardChannelService = SpringUtils.getBean(IArdChannelService.class); |
| | | IHikClientService hikClientService = SpringUtils.getBean(IHikClientService.class); |
| | | IArdCamerasService ardCamerasService = SpringUtils.getBean(IArdCamerasService.class); |
| | | if (GlobalVariable.loginMap.containsKey(camera.getId())) { |
| | | GlobalVariable.loginMap.remove(camera.getId()); |
| | | } |
| | |
| | | GlobalVariable.loginMap.put(camera.getId(), lUserID); |
| | | log.debug(camera.getIp() + ":" + camera.getPort() + "ç»å½æå"); |
| | | camera.setLoginId(lUserID); |
| | | camera.setChannel((int) lpDeviceinfo.byChanNum); |
| | | camera.setChanNum((int) lpDeviceinfo.byChanNum); |
| | | camera.setStartDChan((int)lpDeviceinfo.byStartDChan); |
| | | |
| | | //è·åææ°éé |
| | | List<ArdChannel> cameraChannelList = hikClientService.getCameraChannelList(camera); |
| | | if(cameraChannelList.size()>0) { |
| | | //å é¤ç®¡çéé |
| | | ardChannelService.deleteArdChannelByDeviceId(camera.getId()); |
| | | for (ArdChannel channel : cameraChannelList) { |
| | | channel.setId(IdUtils.simpleUUID()); |
| | | ardChannelService.insertArdChannel(channel); |
| | | } |
| | | } |
| | | //å建å¼å¯¼éå |
| | | Comparator<GuideTask> comparator = GuidePriorityQueue.getComparator(); |
| | | PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000,comparator); |
| | | GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue); |
| | | } else { |
| | | log.debug(camera.getIp() + ":" + camera.getPort() + "ç»å½å¤±è´¥"); |
| | | camera.setChannel(0); |
| | | camera.setChanNum(0); |
| | | camera.setLoginId(-1); |
| | | } |
| | | IArdCamerasService ardCamerasService = SpringUtils.getBean(IArdCamerasService.class); |
| | | ardCamerasService.updateArdCameras(camera); |
| | | return 1; |
| | | } |
| | |
| | | <result property="username" column="username"/> |
| | | <result property="password" column="password"/> |
| | | <result property="gdtype" column="gdtype"/> |
| | | <result property="channel" column="channel"/> |
| | | <result property="chanNum" column="channel"/> |
| | | <result property="longitude" column="longitude"/> |
| | | <result property="latitude" column="latitude"/> |
| | | <result property="altitude" column="altitude"/> |
| | |
| | | <if test="username != null and username != ''">and c.username like '%'||#{username}||'%'</if> |
| | | <if test="password != null and password != ''">and c.password = #{password}</if> |
| | | <if test="gdtype != null and gdtype != ''">and c.gdtype = #{gdtype}</if> |
| | | <if test="channel != null ">and c.channel = #{channel}</if> |
| | | <if test="chanNum != null ">and c.channel = #{chanNum}</if> |
| | | <if test="longitude != null ">and c.longitude = #{longitude}</if> |
| | | <if test="latitude != null ">and c.latitude = #{latitude}</if> |
| | | <if test="altitude != null ">and c.altitude = #{altitude}</if> |
| | |
| | | <if test="username != null and username != ''">and c.username like '%'||#{username}||'%'</if> |
| | | <if test="password != null and password != ''">and c.password = #{password}</if> |
| | | <if test="gdtype != null and gdtype != ''">and c.gdtype = #{gdtype}</if> |
| | | <if test="channel != null ">and c.channel = #{channel}</if> |
| | | <if test="chanNum != null ">and c.channel = #{chanNum}</if> |
| | | <if test="longitude != null ">and c.longitude = #{longitude}</if> |
| | | <if test="latitude != null ">and c.latitude = #{latitude}</if> |
| | | <if test="altitude != null ">and c.altitude = #{altitude}</if> |
| | |
| | | <if test="username != null">username,</if> |
| | | <if test="password != null">password,</if> |
| | | <if test="gdtype != null">gdtype,</if> |
| | | <if test="channel != null">channel,</if> |
| | | <if test="chanNum != null">channel,</if> |
| | | <if test="longitude != null">longitude,</if> |
| | | <if test="latitude != null">latitude,</if> |
| | | <if test="altitude != null">altitude,</if> |
| | |
| | | <if test="username != null">#{username},</if> |
| | | <if test="password != null">#{password},</if> |
| | | <if test="gdtype != null">#{gdtype},</if> |
| | | <if test="channel != null">#{channel},</if> |
| | | <if test="chanNum != null">#{chanNum},</if> |
| | | <if test="longitude != null">#{longitude},</if> |
| | | <if test="latitude != null">#{latitude},</if> |
| | | <if test="altitude != null">#{altitude},</if> |
| | |
| | | <if test="username != null">username = #{username},</if> |
| | | <if test="password != null">password = #{password},</if> |
| | | <if test="gdtype != null">gdtype = #{gdtype},</if> |
| | | <if test="channel != null">channel = #{channel},</if> |
| | | <if test="chanNum != null">channel = #{chanNum},</if> |
| | | <if test="longitude != null">longitude = #{longitude},</if> |
| | | <if test="latitude != null">latitude = #{latitude},</if> |
| | | <if test="altitude != null">altitude = #{altitude},</if> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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="com.ruoyi.device.channel.mapper.ArdChannelMapper"> |
| | | |
| | | <resultMap type="ArdChannel" id="ArdChannelResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="name" column="name" /> |
| | | <result property="chanNo" column="chan_no" /> |
| | | <result property="deviceId" column="device_id" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectArdChannelVo"> |
| | | select id, name, chan_no, device_id from ard_channel |
| | | </sql> |
| | | |
| | | <select id="selectArdChannelList" parameterType="ArdChannel" resultMap="ArdChannelResult"> |
| | | <include refid="selectArdChannelVo"/> |
| | | <where> |
| | | <if test="deviceId!=null">device_id=#{deviceId}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectArdChannelById" parameterType="String" resultMap="ArdChannelResult"> |
| | | <include refid="selectArdChannelVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertArdChannel" parameterType="ArdChannel"> |
| | | insert into ard_channel |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="name != null">name,</if> |
| | | <if test="chanNo != null">chan_no,</if> |
| | | <if test="deviceId != null">device_id,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="name != null">#{name},</if> |
| | | <if test="chanNo != null">#{chanNo},</if> |
| | | <if test="deviceId != null">#{deviceId},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateArdChannel" parameterType="ArdChannel"> |
| | | update ard_channel |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="name != null">name = #{name},</if> |
| | | <if test="chanNo != null">chan_no = #{chanNo},</if> |
| | | <if test="deviceId != null">device_id = #{deviceId},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteArdChannelById" parameterType="String"> |
| | | delete from ard_channel where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteArdChannelByIds" parameterType="String"> |
| | | delete from ard_channel where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | <delete id="deleteArdChannelByDeviceId" parameterType="String"> |
| | | delete from ard_channel where device_id = #{deviceId} |
| | | </delete> |
| | | </mapper> |