| | |
| | | |
| | | /** |
| | | * 获取视频统计 |
| | | * @param cameraFunType 类型 |
| | | * @param tMonitor 条件 |
| | | * @return 统计数 |
| | | */ |
| | | Map<String, String> getVideoCount(TMonitor tMonitor); |
| | | |
| | | Map<String, String> recoveryException(); |
| | | Map<String, String> recoveryException(String time); |
| | | |
| | | /** |
| | | * 获取恢复异常持续关注设备 |
| | | * @return 设备 |
| | | */ |
| | | List<TMonitorVO> selectRecoveryMonitor(String time); |
| | | } |
| | |
| | | /** |
| | | * 获取指定摄像头功能类型下的视频数量。 |
| | | * |
| | | * @param cameraFunType 摄像头功能类型,用于筛选视频。 |
| | | * @param tMonitor 条件 |
| | | * @return 返回一个包含视频数量的Map对象,其中key为统计指标,value为对应功能类型下的统计数量。 |
| | | */ |
| | | Map<String, String> getVideoCount(TMonitor tMonitor); |
| | |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | | import com.ycl.system.service.ISysConfigService; |
| | | import com.ycl.utils.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 设备资产Service业务层处理 |
| | |
| | | { |
| | | @Autowired |
| | | private TMonitorMapper tMonitorMapper; |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * 查询设备资产 |
| | |
| | | @DataScope(deptAlias = "d",userAlias = "u") |
| | | public List<TMonitorVO> selectTMonitorList(TMonitor tMonitor) |
| | | { |
| | | return tMonitorMapper.selectTMonitorList(tMonitor); |
| | | List<TMonitorVO> monitors = tMonitorMapper.selectTMonitorList(tMonitor); |
| | | if (Objects.equals(tMonitor.getRecovery(), 1L)) { |
| | | String time = configService.selectConfigByKey("abnormal.equipment.continuous.attention.time"); |
| | | if (StringUtils.isBlank(time)) { |
| | | throw new RuntimeException("请配置异常设备连续关注时间"); |
| | | } |
| | | List<TMonitorVO> recoveryMonitors = tMonitorMapper.selectRecoveryMonitor(time); |
| | | monitors.addAll(recoveryMonitors); |
| | | } |
| | | return monitors; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public Map<String, String> recoveryException() { |
| | | return tMonitorMapper.recoveryException(); |
| | | String time = configService.selectConfigByKey("abnormal.equipment.continuous.attention.time"); |
| | | return tMonitorMapper.recoveryException(time); |
| | | } |
| | | } |
| | |
| | | import com.ycl.utils.SecurityUtils; |
| | | import com.ycl.utils.redis.RedisCache; |
| | | import com.ycl.utils.uuid.IdUtils; |
| | | import constant.PointConfigConstants; |
| | | import enumeration.general.*; |
| | | import enumeration.general.NotifyTypeEnum; |
| | | import enumeration.general.UrgentLevelEnum; |
| | | import enumeration.general.WorkOrderDistributeWayEnum; |
| | | import enumeration.general.WorkOrderStatusEnum; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.Assert; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | public Result distributeFast(DistributeWorkOrderVO data) { |
| | | // 获取当前时间 |
| | | LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault()); |
| | | data.setEnd(now); |
| | | switch (data.getFastWay()) { |
| | | case LAST_HALF_HOUR: |
| | | data.setStart(now.minusMinutes(30)); |
| | | data.setEnd(now); |
| | | break; |
| | | case LAST_HOUR: |
| | | data.setStart(now.minusHours(1)); |
| | | data.setEnd(now); |
| | | break; |
| | | case LAST_TWO_HOUR: |
| | | data.setStart(now.minusHours(2)); |
| | | data.setEnd(now); |
| | | break; |
| | | case LAST_DAY: |
| | | data.setStart(now.minusDays(1)); |
| | | data.setEnd(now); |
| | | break; |
| | | } |
| | | |
| | | // 查询符合条件的工单 |
| | | List<Integer> ids = new LambdaQueryChainWrapper<>(baseMapper) |
| | | List<WorkOrder> list = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .select(WorkOrder::getId, WorkOrder::getPointId) |
| | | .eq(WorkOrder::getStatus, WorkOrderStatusEnum.WAIT_DISTRIBUTE) |
| | | .eq(Objects.nonNull(data.getUnitId()), WorkOrder::getUnitId, data.getUnitId()) |
| | | .eq(WorkOrder::getErrorType, data.getErrorType()) |
| | | .between(WorkOrder::getCreateTime, data.getStart(), data.getEnd()) |
| | | .orderByDesc(WorkOrder::getCreateTime) |
| | | .last("limit " + data.getFastNumLimit()) |
| | | .list() |
| | | .stream() |
| | | .map(WorkOrder::getId) |
| | | .toList(); |
| | | .list(); |
| | | List<Integer> ids = list.stream().map(WorkOrder::getId).toList(); |
| | | List<Integer> pointIds = list.stream().map(WorkOrder::getPointId).toList(); |
| | | |
| | | if (ids.isEmpty()) { |
| | | return Result.error("没有符合条件的工单"); |
| | | } |
| | | if (!getDistributeLock()) { |
| | | return Result.error("此刻有人下发中,为避免冲突,请稍后重试"); |
| | | } |
| | | if (ids.isEmpty()) { return Result.error("没有符合条件的工单"); } |
| | | if (!getDistributeLock()) { return Result.error("此刻有人下发中,为避免冲突,请稍后重试"); } |
| | | try { |
| | | new LambdaUpdateChainWrapper<>(baseMapper) |
| | | .set(WorkOrder::getStatus, WorkOrderStatusEnum.DISTRIBUTED) |
| | |
| | | @Override |
| | | public Result selectedIdsDistribute(DistributeWorkOrderQuery query) { |
| | | WorkOrderDistributeWayEnum distributeWayEnum = WorkOrderDistributeWayEnum.SELECTED_DISTRIBUTE; |
| | | if (!getDistributeLock()) { |
| | | return Result.error("此刻有人下发中,为避免冲突,请稍后重试"); |
| | | } |
| | | if (!getDistributeLock()) { return Result.error("此刻有人下发中,为避免冲突,请稍后重试"); } |
| | | try { |
| | | if (query.getIds().isEmpty()) { |
| | | query.setIds(new LambdaQueryChainWrapper<>(baseMapper) |
| | |
| | | .collect(Collectors.toList())); |
| | | distributeWayEnum = WorkOrderDistributeWayEnum.ALL_DISTRIBUTE; |
| | | } |
| | | if (query.getIds().isEmpty()) { |
| | | return Result.error("没有工单待下发"); |
| | | } |
| | | if (query.getIds().isEmpty()) { return Result.error("没有工单待下发"); } |
| | | new LambdaUpdateChainWrapper<>(baseMapper) |
| | | .set(WorkOrder::getStatus, WorkOrderStatusEnum.DISTRIBUTED) |
| | | .in(WorkOrder::getId, query.getIds()) |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectTMonitorVo"> |
| | | select id, serial_number, name, site_type, mac_addr, ip, camera_fun_type, longitude, latitude, camera_capture_area, on_state, civil_code, integrated_device, camera_brand, address, net_working, public_security, installed_time, management_unit, mu_contact_info, storage_days, monitor_azimuth, scene_photo_addr, model, site_vulgo, camera_type, camera_light_type, encoded_format, camera_dept, hybm, lxbm, reason, recovery,recovery_time,dept_id from t_monitor |
| | | select id, serial_number, name, site_type, mac_addr, ip, camera_fun_type, longitude, latitude, camera_capture_area, on_state, civil_code, integrated_device, camera_brand, address, net_working, public_security, installed_time, management_unit, mu_contact_info, storage_days, monitor_azimuth, scene_photo_addr, model, site_vulgo, camera_type, camera_light_type, encoded_format, camera_dept, hybm, lxbm from t_monitor |
| | | </sql> |
| | | |
| | | <select id="selectTMonitorList" resultType="com.ycl.platform.domain.vo.TMonitorVO"> |
| | | select id, serial_number, name, site_type, mac_addr, ip, camera_fun_type, longitude, latitude, camera_capture_area, on_state, civil_code, integrated_device, camera_brand, address, net_working, public_security, installed_time, management_unit, mu_contact_info, storage_days |
| | | , monitor_azimuth, scene_photo_addr, model, site_vulgo, camera_type, camera_light_type, encoded_format, camera_dept, hybm, lxbm, reason, recovery,recovery_time,d.dept_name from t_monitor m |
| | | left join sys_dept d on m.dept_id = d.dept_id |
| | | select m.id, m.serial_number, name, site_type, mac_addr, ip, camera_fun_type, longitude, latitude, camera_capture_area, on_state, civil_code, integrated_device, camera_brand, address, net_working, public_security, installed_time, management_unit, mu_contact_info, storage_days |
| | | , monitor_azimuth, scene_photo_addr, model, site_vulgo, camera_type, camera_light_type, encoded_format, camera_dept, hybm, lxbm, d.dept_name from t_monitor m |
| | | left join t_yw_point p on m.serial_number = p.serial_number |
| | | left join sys_dept d on p.dept_id = d.dept_id |
| | | <where> |
| | | <if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if> |
| | | <if test="serialNumber != null and serialNumber != ''"> and m.serial_number = #{serialNumber}</if> |
| | | <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> |
| | | <if test="siteType != null "> and site_type = #{siteType}</if> |
| | | <if test="macAddr != null and macAddr != ''"> and mac_addr = #{macAddr}</if> |
| | |
| | | <if test="cameraDept != null and cameraDept != ''"> and camera_dept = #{cameraDept}</if> |
| | | <if test="hybm != null and hybm != ''"> and hybm = #{hybm}</if> |
| | | <if test="lxbm != null "> and lxbm = #{lxbm}</if> |
| | | <if test="reason != null and reason != ''"> and reason = #{reason}</if> |
| | | <if test="recovery != null "> and recovery = #{recovery}</if> |
| | | <if test="recoveryTime != null "> and recovery_time = #{recoveryTime}</if> |
| | | <if test="deptId != null "> and m.dept_id = #{deptId}</if> |
| | | <if test="recovery != null "> and p.recovery = #{recovery}</if> |
| | | </where> |
| | | ${params.dataScope} |
| | | </select> |
| | |
| | | <if test="cameraDept != null">camera_dept,</if> |
| | | <if test="hybm != null">hybm,</if> |
| | | <if test="lxbm != null">lxbm,</if> |
| | | <if test="reason != null">reason,</if> |
| | | <if test="recovery != null">recovery,</if> |
| | | <if test="recoveryTime != null">recovery_time,</if> |
| | | <if test="deptId != null">dept_id,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if> |
| | |
| | | <if test="cameraDept != null">#{cameraDept},</if> |
| | | <if test="hybm != null">#{hybm},</if> |
| | | <if test="lxbm != null">#{lxbm},</if> |
| | | <if test="reason != null">#{reason},</if> |
| | | <if test="recovery != null">#{recovery},</if> |
| | | <if test="recoveryTime != null">#{recoveryTime},</if> |
| | | <if test="deptId != null">#{deptId},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="cameraDept != null">camera_dept = #{cameraDept},</if> |
| | | <if test="hybm != null">hybm = #{hybm},</if> |
| | | <if test="lxbm != null">lxbm = #{lxbm},</if> |
| | | <if test="reason != null">reason = #{reason},</if> |
| | | <if test="recoveryTime != null">recovery_time = #{recoveryTime},</if> |
| | | <if test="deptId != null">dept_id = #{deptId},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | SELECT count(*) AS totalPosts, |
| | | IFNULL(SUM(IF(on_state = 1, 1, 0)), 0) AS totalMembers, |
| | | IFNULL(SUM(IF(on_state = 2, 1, 0)), 0) AS postsPercentage, |
| | | -1 as noStore, |
| | | -1 as partStore, |
| | | IFNULL(ROUND(SUM(IF(on_state = 1, 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage, |
| | | -1 as totalFace, |
| | | -1 as totalCar |
| | | IFNULL(ROUND(SUM(IF(on_state = 1, 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage |
| | | FROM t_monitor m |
| | | left join sys_dept d on m.dept_id = d.dept_id |
| | | left join t_yw_point p on m.serial_number = p.serial_number |
| | | left join sys_dept d on p.dept_id = d.dept_id |
| | | <where> |
| | | camera_fun_type like concat('%', #{cameraFunType}, '%') |
| | | </where> |
| | |
| | | </select> |
| | | |
| | | <select id="recoveryException" resultType="java.util.Map"> |
| | | <![CDATA[ |
| | | SELECT count(*) AS totalPosts, |
| | | IFNULL(SUM(IF(on_state = 1, 1, 0)), 0) AS totalMembers, |
| | | IFNULL(SUM(IF(on_state = 2, 1, 0)), 0) AS postsPercentage, |
| | | IFNULL(ROUND(SUM(IF(on_state = 1, 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage |
| | | FROM t_monitor |
| | | WHERE recovery = 1 |
| | | FROM t_monitor t |
| | | LEFT JOIN t_yw_point p ON t.serial_number = p.serial_number |
| | | WHERE p.recovery = 1 OR TIMESTAMPDIFF(DAY, p.recovery_time, NOW()) <= #{time} |
| | | ]]> |
| | | </select> |
| | | |
| | | <select id="selectRecoveryMonitor" resultType="com.ycl.platform.domain.vo.TMonitorVO"> |
| | | <![CDATA[ |
| | | SELECT t.id, p.serial_number, name, site_type, mac_addr, ip, camera_fun_type, longitude, latitude, camera_capture_area, on_state, civil_code, integrated_device, camera_brand, address, net_working, public_security, installed_time, management_unit, mu_contact_info, storage_days, monitor_azimuth, scene_photo_addr, model, site_vulgo, camera_type, camera_light_type, encoded_format, camera_dept, hybm, lxbm |
| | | FROM t_monitor t |
| | | LEFT JOIN t_yw_point p ON t.serial_number = p.serial_number |
| | | WHERE TIMESTAMPDIFF(DAY, p.recovery_time, NOW()) <= #{time} |
| | | ]]> |
| | | </select> |
| | | |
| | | </mapper> |