Ver código fonte

返回结构调整

yangyue 1 ano atrás
pai
commit
36f982dedf

+ 1 - 1
video/src/main/java/cn/com/taiji/video/cotroller/VideoUrlController.java

@@ -44,7 +44,7 @@ public class VideoUrlController {
     }
 
     @GetMapping("analysis/line")
-    public VideoAnalysisLineDTO queryLineRecord(Integer type) {
+    public List<VideoAnalysisLineDTO> queryLineRecord(Integer type) {
         return urlService.queryLineRecord(type);
     }
 }

+ 1 - 3
video/src/main/java/cn/com/taiji/video/mapper/HtDpVideoAnalysisMapper.java

@@ -18,8 +18,6 @@ public interface HtDpVideoAnalysisMapper extends BaseMapper<HtDpVideoAnalysis> {
 
     List<AnalysisDTO> selectFilter(@Param("year") String year, @Param("yearMonth") String yearMonth);
 
-    List<AnalysisLineDTO> selectfacetotal(@Param("year") String year, @Param("yearMonth") String yearMonth);
-
-    List<AnalysisLineDTO> selectcartotal(@Param("year") String year, @Param("yearMonth") String yearMonth);
+    List<VideoAnalysisLineDTO> selecttotal(@Param("year") String year, @Param("yearMonth") String yearMonth);
 
 }

+ 6 - 0
video/src/main/java/cn/com/taiji/video/model/AnalysisLineDTO.java

@@ -14,4 +14,10 @@ public class AnalysisLineDTO {
 
     private Integer count;
 
+    private Integer face;
+
+    private Integer car;
+
+    private Integer body;
+
 }

+ 6 - 2
video/src/main/java/cn/com/taiji/video/model/VideoAnalysisLineDTO.java

@@ -12,8 +12,12 @@ import java.util.List;
 @Data
 public class VideoAnalysisLineDTO {
 
-    private List<AnalysisLineDTO> face;
+    private String time;
 
-    private List<AnalysisLineDTO> car;
+    private Integer face;
+
+    private Integer car;
+
+    private Integer body;
 
 }

+ 7 - 1
video/src/main/java/cn/com/taiji/video/model/VideoAnalysisPieDTO.java

@@ -14,6 +14,12 @@ public class VideoAnalysisPieDTO {
 
     private Integer total;
 
-    private List<AnalysisDTO> analysis;
+    private Integer face;
+
+    private Integer car;
+
+    private Integer body;
+
+    // private List<AnalysisDTO> analysis;
 
 }

+ 1 - 1
video/src/main/java/cn/com/taiji/video/service/IHtDpVideoAnalysisService.java

@@ -16,6 +16,6 @@ public interface IHtDpVideoAnalysisService extends IService<HtDpVideoAnalysis> {
 
     List<AnalysisDTO> queryFilter(String year, String yearMonth);
 
-    VideoAnalysisLineDTO querytotal(String year, String yearMonth);
+    List<VideoAnalysisLineDTO> querytotal(String year, String yearMonth);
 
 }

+ 2 - 2
video/src/main/java/cn/com/taiji/video/service/IVideoUrlService.java

@@ -46,8 +46,8 @@ public interface IVideoUrlService {
     /**
      * 查询视频记录
      * @param type 类型
-     * @return VideoAnalysisLineDTO
+     * @return List<VideoAnalysisLineDTO>
      */
-    VideoAnalysisLineDTO queryLineRecord(Integer type);
+    List<VideoAnalysisLineDTO> queryLineRecord(Integer type);
 
 }

+ 2 - 6
video/src/main/java/cn/com/taiji/video/service/impl/HtDpVideoAnalysisServiceImpl.java

@@ -26,11 +26,7 @@ public class HtDpVideoAnalysisServiceImpl extends ServiceImpl<HtDpVideoAnalysisM
     }
 
     @Override
-    public VideoAnalysisLineDTO querytotal(String year, String yearMonth) {
-
-        VideoAnalysisLineDTO analysisLineDTO = new VideoAnalysisLineDTO();
-        analysisLineDTO.setFace(videoAnalysisMapper.selectfacetotal(year,yearMonth));
-        analysisLineDTO.setCar(videoAnalysisMapper.selectcartotal(year,yearMonth));
-        return analysisLineDTO;
+    public List<VideoAnalysisLineDTO> querytotal(String year, String yearMonth) {
+        return videoAnalysisMapper.selecttotal(year,yearMonth);
     }
 }

+ 18 - 3
video/src/main/java/cn/com/taiji/video/service/impl/VideoUrlServiceImpl.java

@@ -234,26 +234,41 @@ public class VideoUrlServiceImpl implements IVideoUrlService {
             analysisDTO = videoAnalysisService.queryFilter(null,yearMonth);
         }
         VideoAnalysisPieDTO videoAnalysisPieDTO = new VideoAnalysisPieDTO();
-        videoAnalysisPieDTO.setAnalysis(analysisDTO);
+        // videoAnalysisPieDTO.setAnalysis(analysisDTO);
         Integer total = 0;
+        Integer face = 0;
+        Integer car = 0;
+        Integer body = 0;
         if (null != analysisDTO && analysisDTO.size() > 0) {
             for (AnalysisDTO dto: analysisDTO) {
                 total += dto.getCount();
+                if (dto.getType() == 1) {
+                    face = dto.getCount();
+                }
+                if (dto.getType() == 2) {
+                    car = dto.getCount();
+                }
+                if (dto.getType() == 3) {
+                    body = dto.getCount();
+                }
             }
         }
         videoAnalysisPieDTO.setTotal(total);
+        videoAnalysisPieDTO.setFace(face);
+        videoAnalysisPieDTO.setCar(car);
+        videoAnalysisPieDTO.setBody(body);
 
         return videoAnalysisPieDTO;
     }
 
     @Override
-    public VideoAnalysisLineDTO queryLineRecord(Integer type) {
+    public List<VideoAnalysisLineDTO> queryLineRecord(Integer type) {
 
         LocalDate localDate = LocalDate.now();
         String year = String.valueOf(localDate.getYear());
         DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM");
         String yearMonth = localDate.format(fmt);
-        VideoAnalysisLineDTO analysisLineDTO;
+        List<VideoAnalysisLineDTO> analysisLineDTO;
         if (1 == type) {
             analysisLineDTO = videoAnalysisService.querytotal(year, null);
         } else {

+ 15 - 33
video/src/main/resources/mapper/HtDpVideoAnalysisMapper.xml

@@ -16,52 +16,34 @@
         </where>
         GROUP BY type
     </select>
-    <select id="selectfacetotal" resultType="cn.com.taiji.video.model.AnalysisLineDTO">
+    <select id="selecttotal" resultType="cn.com.taiji.video.model.VideoAnalysisLineDTO">
         SELECT
         <if test="year != null and year != ''">
-            `year_month` as time,
+            t.`year_month` as time,
+            (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.`year_month` = t.`year_month` and t1.type = 1) as face,
+            (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.`year_month` = t.`year_month` and t1.type = 2) as car,
+            (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.`year_month` = t.`year_month` and t1.type = 3) as body
         </if>
         <if test="yearMonth != null and yearMonth != ''">
-            stat_date as time,
+            t.stat_date as time,
+            (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.stat_date = t.stat_date and t1.type = 1) as face,
+            (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.stat_date = t.stat_date and t1.type = 2) as car,
+            (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.stat_date = t.stat_date and t1.type = 3) as body
         </if>
-        sum(pic_filter_count) AS count FROM `ht_dp_video_analysis`
-        where type = 1
+        FROM `ht_dp_video_analysis` t
+        where
         <if test="year != null and year != ''">
-            and `year` = #{year}
-        </if>
-        <if test="yearMonth != null and yearMonth != ''">
-            and `year_month` = #{yearMonth}
-        </if>
-        GROUP BY
-        <if test="year != null and year != ''">
-            `year_month`
+            t.`year` = #{year}
         </if>
         <if test="yearMonth != null and yearMonth != ''">
-            stat_date
-        </if>
-    </select>
-    <select id="selectcartotal" resultType="cn.com.taiji.video.model.AnalysisLineDTO">
-        SELECT
-        <if test="year != null and year != ''">
-            `year_month` as time,
-        </if>
-        <if test="yearMonth != null and yearMonth != ''">
-            stat_date as time,
-        </if>
-        sum(pic_filter_count) AS count FROM `ht_dp_video_analysis`
-        where type = 2
-        <if test="year != null and year != ''">
-            and `year` = #{year}
-        </if>
-        <if test="yearMonth != null and yearMonth != ''">
-            and `year_month` = #{yearMonth}
+            t.`year_month` = #{yearMonth}
         </if>
         GROUP BY
         <if test="year != null and year != ''">
-            `year_month`
+            t.`year_month`
         </if>
         <if test="yearMonth != null and yearMonth != ''">
-            stat_date
+            t.stat_date
         </if>
     </select>
 </mapper>