wl
2022-12-13 ee636374a5ce515b5dd25c2b7dd48a9d01743a25
fix: 趋势分析 和 驾驶舱接口
7个文件已修改
106 ■■■■ 已修改文件
ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/trend/TrendAnalysisController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/mapper/trend/TrendAnalysisMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/trend/TrendAnalysisService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/trend/impl/TrendAnalysisServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/vo/cockpit/aiIot/AIIotVO.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/resources/mapper/trend/TrendAnalysisMapper.xml 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java
@@ -3,6 +3,9 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ycl.api.CommonResult;
import com.ycl.entity.video.VideoPoint;
import com.ycl.service.carManage.ICarSlagcarService;
import com.ycl.service.equipment.IHandheldTerminalService;
import com.ycl.service.equipment.ILoudspeakerService;
import com.ycl.service.video.impl.IVideoPointService;
import com.ycl.util.CheckApiUtil;
import com.ycl.util.VideoUtil;
@@ -41,18 +44,24 @@
    private IVideoPointService iVideoPointService;
    @Autowired
    private VideoUtil videoUtil;
    @Autowired
    IHandheldTerminalService iHandheldTerminalService;
    @Autowired
    ILoudspeakerService loudspeakerService;
    @Autowired
    ICarSlagcarService iCarSlagcarService;
    @ApiOperation(value = "监测数据")
    @GetMapping("/detection")
    public CommonResult<AIIotVO.DetectionVO> detection(@Validated CockpitVO params) {
        checkApiUtil.cockpit(params);
        AIIotVO.DetectionVO detectionVO = new AIIotVO.DetectionVO();
        detectionVO.setVideo(121);
        detectionVO.setIndividual(20);
        detectionVO.setLampblack(154);
        detectionVO.setLoudspeaker(30);
        detectionVO.setSlagCar(33);
        detectionVO.setVideo(iVideoPointService.count());
        detectionVO.setIndividual(iHandheldTerminalService.count());
        detectionVO.setLampblack(154L);
        /// TODO: 2022/12/13 缺少油烟机监控表
        detectionVO.setLoudspeaker(loudspeakerService.count());
        detectionVO.setSlagCar(iCarSlagcarService.count());
        return CommonResult.success(detectionVO);
    }
ycl-platform/src/main/java/com/ycl/controller/trend/TrendAnalysisController.java
@@ -27,10 +27,10 @@
    }
    @ApiOperation("点位数据查询")
    @PostMapping("/pointInfo")
    public CommonResult<List<TrendVo>> queryPointInfo(@RequestBody String id) {
        JSONObject jsonObject = JSON.parseObject(id);
        return CommonResult.success(trendAnalysisService.queryPointInfo(jsonObject.getString("id")));
    @GetMapping("/pointInfo")
    public CommonResult<List<TrendVo>> queryPointInfo(@RequestParam String longitude,
                                                      @RequestParam String latitude) {
        return CommonResult.success(trendAnalysisService.queryPointInfo(longitude,latitude));
    }
    @ApiOperation("首次报警点位数据查询")
ycl-platform/src/main/java/com/ycl/mapper/trend/TrendAnalysisMapper.java
@@ -9,5 +9,6 @@
public interface TrendAnalysisMapper {
    List<TrendVo> selectTrendInfo(@Param("tap") TrendAnalysisParam trendAnalysisParam);
    List<TrendVo> selectTrendPointInfo(String id);
    List<TrendVo> selectTrendPointInfo(String longitude, String latitude);
}
ycl-platform/src/main/java/com/ycl/service/trend/TrendAnalysisService.java
@@ -1,9 +1,6 @@
package com.ycl.service.trend;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.dto.trend.TrendAnalysisParam;
import com.ycl.entity.store.StoreScoreRule;
import com.ycl.vo.TrendVo;
import java.util.List;
@@ -11,7 +8,7 @@
public interface TrendAnalysisService  {
    List<TrendVo> list(TrendAnalysisParam trendAnalysisParam, Integer pageSize, Integer pageNum);
    List<TrendVo> queryPointInfo(String id);
    List<TrendVo> queryListByCount(TrendAnalysisParam trendAnalysisParam, Integer pageSize, Integer pageNum);
    List<TrendVo> queryPointInfo(String longitude, String latitude);
}
ycl-platform/src/main/java/com/ycl/service/trend/impl/TrendAnalysisServiceImpl.java
@@ -9,6 +9,7 @@
import org.springframework.boot.autoconfigure.amqp.RabbitProperties;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@@ -16,7 +17,7 @@
public class TrendAnalysisServiceImpl implements TrendAnalysisService {
    @Autowired
    @Resource
    TrendAnalysisMapper trendAnalysisMapper;
    @Override
@@ -25,8 +26,8 @@
    }
    @Override
    public List<TrendVo> queryPointInfo(String id) {
        return trendAnalysisMapper.selectTrendPointInfo(id);
    public List<TrendVo> queryPointInfo(String longitude,String latitude) {
        return trendAnalysisMapper.selectTrendPointInfo(longitude,latitude);
    }
    @Override
ycl-platform/src/main/java/com/ycl/vo/cockpit/aiIot/AIIotVO.java
@@ -19,15 +19,15 @@
    @Data
    public static class DetectionVO {
        @ApiModelProperty(value = "城市监控")
        private Integer video;
        private Long video;
        @ApiModelProperty(value = "单兵设备")
        private Integer individual;
        private Long individual;
        @ApiModelProperty(value = "油烟监测")
        private Integer lampblack;
        private Long lampblack;
        @ApiModelProperty(value = "室外音柱")
        private Integer loudspeaker;
        private Long loudspeaker;
        @ApiModelProperty(value = "渣土车")
        private Integer slagCar;
        private Long slagCar;
    }
ycl-platform/src/main/resources/mapper/trend/TrendAnalysisMapper.xml
@@ -3,35 +3,37 @@
<mapper namespace="com.ycl.mapper.trend.TrendAnalysisMapper">
    <select id="selectTrendInfo" resultType="com.ycl.vo.TrendVo" parameterType="com.ycl.dto.trend.TrendAnalysisParam">
        select vp.id,vp.name,count(0) as count from
          ums_warn_alarm_record war
        left join
          ums_violations v
        on v.id=war.case_number_id
        left join
          ums_video_point vp
        on v.video_point_id=vp.id
        SELECT
        t2.id,
        t2.NAME,
        count( 0 ) AS count
        FROM
        ums_violations t1
        LEFT JOIN ums_video_point t2 ON t2.id = t1.video_point_id
        LEFT JOIN ums_video_alarm_report t3 ON t3.id = t1.video_alarm_report_id
        <where>
            <if test="tap.startTime!=null and tap.startTime!=''and tap.endTime!=null and tap.endTime!=''" >
                war.alarm_time between #{tap.startTime} and #{tap.endTime}
            </if>
            <if test="tap.type!=null and tap.type!=''" >
                war.violation_type=#{tap.type}
            </if>
                t3.alarm_time between #{tap.startTime} and #{tap.endTime}
        </where>
        group by vp.id,vp.name
        order by count DESC
        GROUP BY
        t1.video_point_id
        ORDER BY
        count DESC
    </select>
    <select id="selectTrendPointInfo" resultType="com.ycl.vo.TrendVo" parameterType="string">
        SELECT vp.address, DATE_FORMAT(war.alarm_time,"%Y-%m-%d") as dateTime,count(0) as count
        from ums_warn_alarm_record war
        left join ums_violations v
        on v.id=war.case_number_id
        left join ums_video_point vp
        on v.video_point_id=vp.id
        where vp.id=#{id}
        GROUP BY vp.address,DATE_FORMAT(war.alarm_time,"%Y-%m-%d")
    <select id="selectTrendPointInfo" resultType="com.ycl.vo.TrendVo">
        SELECT t2.address, DATE_FORMAT(t3.alarm_time,"%Y-%m-%d") as dateTime,count(0) as count
        FROM
        ums_violations t1
        LEFT JOIN ums_video_point t2 ON t2.id = t1.video_point_id
        LEFT JOIN ums_video_alarm_report t3 ON t3.id = t1.video_alarm_report_id
        <where>
            <if test="longitude='' and longitude =null and latitude='' and latitude=null">
                t2.longitude=#{longitude} and t2.latitude=#{latitude}
            </if>
        </where>
        GROUP BY
        t1.video_point_id,DATE_FORMAT(t3.alarm_time,"%Y-%m-%d")
    </select>
</mapper>