| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> accessYear(ESParam esParam); |
| | | //æ ¹æ®å¤©ç»è®¡æ°é |
| | | List<CountVo> accessMonth(ESParam esParam); |
| | | } |
| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> apponekeyYear(ESParam esParam); |
| | | //æ ¹æ®å¤©ç»è®¡æ°é |
| | | List<CountVo> apponekeyMonth(ESParam esParam); |
| | | } |
| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> cameraYear(ESParam esParam); |
| | | //æ ¹æ®å¤©ç»è®¡æ°é |
| | | List<CountVo> cameraMonth(ESParam esParam); |
| | | } |
| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> digitizationYear(ESParam esParam); |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> digitizationMonth(ESParam esParam); |
| | | } |
| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> externalYear(ESParam esParam); |
| | | //æ ¹æ®å¤©ç»è®¡æ°é |
| | | List<CountVo> externalMonth(ESParam esParam); |
| | | |
| | | } |
| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> fileYear(ESParam esParam); |
| | | //æ ¹æ®å¤©ç»è®¡æ°é |
| | | List<CountVo> fileMonth(ESParam esParam); |
| | | } |
| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> moveYear(ESParam esParam); |
| | | //æ ¹æ®å¤©ä»½ç»è®¡æ°é |
| | | List<CountVo> moveMonth(ESParam esParam); |
| | | } |
| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> stealelecYear(ESParam esParam); |
| | | //æ ¹æ®å¤©ç»è®¡æ°é |
| | | List<CountVo> stealelecMonth(ESParam esParam); |
| | | } |
| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> tubeYear(ESParam esParam); |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> tubeMonth(ESParam esParam); |
| | | } |
| | |
| | | |
| | | //æ ¹æ®æä»½ç»è®¡æ°é |
| | | List<CountVo> wallYear(ESParam esParam); |
| | | //æ ¹æ®å¤©ç»è®¡æ°é |
| | | List<CountVo> wallMonth(ESParam esParam); |
| | | } |
| | |
| | | package com.ruoyi.statistical.controller; |
| | | |
| | | import com.ruoyi.statistical.param.ESParam; |
| | | import com.ruoyi.statistical.param.MonthParam; |
| | | import com.ruoyi.statistical.service.StatisticalService; |
| | | import com.ruoyi.utils.result.Results; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.util.Calendar; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | return Results.succeed(); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¦æ°éåææ |
| | | */ |
| | | @ApiOperation("æ¥è¦æ°éåææ") |
| | | @GetMapping("alarm/month") |
| | | public Results alarmMonth(String month,String type){ |
| | | LocalDate today = LocalDate.now(); |
| | | int year = today.getYear(); |
| | | int day = getDaysInMonth(Integer.valueOf(month),year); |
| | | ESParam esParam = new ESParam(); |
| | | esParam.setStart(year+"-"+month+"-01"); |
| | | esParam.setEnd(year+"-"+month+"-"+day); |
| | | if("1001".equals(type)){ |
| | | //ççµæ¥è¦ |
| | | return Results.succeed(statisticalService.stealelecMonth(esParam)); |
| | | }else if("1002".equals(type)){ |
| | | //éç¨å
çµ |
| | | return Results.succeed(statisticalService.cameraMonth(esParam)); |
| | | }else if("1003".equals(type)){ |
| | | //é·è¾¾æ¥è¦ |
| | | return Results.succeed(statisticalService.moveMonth(esParam)); |
| | | }else if("1004".equals(type)){ |
| | | //é²ç«æ¥è¦ |
| | | return Results.succeed(statisticalService.fireMonth(esParam)); |
| | | }else if("1005".equals(type)){ |
| | | //å¤èæ¥è¦ |
| | | return Results.succeed(statisticalService.externalMonth(esParam)); |
| | | }else if("1006".equals(type)){ |
| | | //é¨ç¦æ¥è¦ |
| | | return Results.succeed(statisticalService.accessMonth(esParam)); |
| | | }else if("1007".equals(type)){ |
| | | //ç§»å¨ç»ç«¯ |
| | | return Results.succeed(statisticalService.apponekeyMonth(esParam)); |
| | | }else if("1010".equals(type)){ |
| | | //çµåå´æ |
| | | return Results.succeed(statisticalService.wallMonth(esParam)); |
| | | }else if("1012".equals(type)){ |
| | | //é¢è¦åè¦ |
| | | return Results.succeed(statisticalService.digitizationMonth(esParam)); |
| | | }else if("1014".equals(type)){ |
| | | //ç®¡çº¿æ³æ¼ |
| | | return Results.succeed(statisticalService.tubeMonth(esParam)); |
| | | } |
| | | return Results.succeed(); |
| | | } |
| | | |
| | | //è¿åæ¯æå¤©æ° |
| | | public int getDaysInMonth(int month, int year) { |
| | | switch (month) { |
| | | case Calendar.JANUARY: |
| | | case Calendar.MARCH: |
| | | case Calendar.MAY: |
| | | case Calendar.JULY: |
| | | case Calendar.AUGUST: |
| | | case Calendar.OCTOBER: |
| | | case Calendar.DECEMBER: |
| | | return 31; |
| | | case Calendar.APRIL: |
| | | case Calendar.JUNE: |
| | | case Calendar.SEPTEMBER: |
| | | case Calendar.NOVEMBER: |
| | | return 30; |
| | | case Calendar.FEBRUARY: |
| | | return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 29 : 28; |
| | | default: |
| | | throw new IllegalArgumentException("Invalid Month"); |
| | | } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.statistical.param; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class MonthParam { |
| | | private String type; |
| | | private String month; |
| | | } |
| | |
| | | List<CountVo> wallYear(ESParam esParam); |
| | | List<CountVo> digitizationYear(ESParam esParam); |
| | | List<CountVo> tubeYear(ESParam esParam); |
| | | |
| | | List<CountVo> stealelecMonth(ESParam esParam); |
| | | List<CountVo> cameraMonth(ESParam esParam); |
| | | List<CountVo> moveMonth(ESParam esParam); |
| | | List<CountVo> fireMonth(ESParam esParam); |
| | | List<CountVo> externalMonth(ESParam esParam); |
| | | List<CountVo> accessMonth(ESParam esParam); |
| | | List<CountVo> apponekeyMonth(ESParam esParam); |
| | | List<CountVo> wallMonth(ESParam esParam); |
| | | List<CountVo> digitizationMonth(ESParam esParam); |
| | | List<CountVo> tubeMonth(ESParam esParam); |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | return es(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> stealelecMonth(ESParam esParam) { |
| | | List<CountVo> list = stealelecMapper.stealelecMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> cameraMonth(ESParam esParam) { |
| | | List<CountVo> list = cameraMapper.cameraMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> moveMonth(ESParam esParam) { |
| | | List<CountVo> list = moveMapper.moveMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> fireMonth(ESParam esParam) { |
| | | List<CountVo> list = fireMapper.fileMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> externalMonth(ESParam esParam) { |
| | | List<CountVo> list = externalMapper.externalMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> accessMonth(ESParam esParam) { |
| | | List<CountVo> list = accessMapper.accessMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> apponekeyMonth(ESParam esParam) { |
| | | List<CountVo> list = apponekeyMapper.apponekeyMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> wallMonth(ESParam esParam) { |
| | | List<CountVo> list = wallMapper.wallMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> digitizationMonth(ESParam esParam) { |
| | | List<CountVo> list = digitization3Mapper.digitizationMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> tubeMonth(ESParam esParam) { |
| | | List<CountVo> list = tubeMapper.tubeMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | } |
| | | |
| | | public List<CountVo> es(List<CountVo> list){ |
| | | for (int i = 1; i <= 12 ; i++) { |
| | | String month = null; |
| | | String month; |
| | | if(i<=10){ |
| | | month = "0"+i; |
| | | }else { |
| | |
| | | Boolean bo = false; |
| | | for (int j = 0; j < list.size(); j++) { |
| | | CountVo countVo = list.get(j); |
| | | String mon = countVo.getMonth(); |
| | | String mon = countVo.getDate(); |
| | | if(mon.equals(month)){ |
| | | bo = true; |
| | | } |
| | | } |
| | | if(!bo){ |
| | | CountVo countVo = new CountVo(); |
| | | countVo.setMonth(month); |
| | | countVo.setDate(month); |
| | | countVo.setCount(0); |
| | | list.add(countVo); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public List<CountVo> esMonth(List<CountVo> list,String end){ |
| | | Integer day = Integer.valueOf(end.substring(end.length() - 2)); |
| | | for (int i = 1; i <= day ; i++) { |
| | | String d; |
| | | if(i<=10){ |
| | | d = "0"+i; |
| | | }else { |
| | | d = String.valueOf(i); |
| | | } |
| | | Boolean bo = false; |
| | | for (int j = 0; j < list.size(); j++) { |
| | | CountVo countVo = list.get(j); |
| | | String mon = countVo.getDate(); |
| | | if(mon.equals(d)){ |
| | | bo = true; |
| | | } |
| | | } |
| | | if(!bo){ |
| | | CountVo countVo = new CountVo(); |
| | | countVo.setDate(d); |
| | | countVo.setCount(0); |
| | | list.add(countVo); |
| | | } |
| | |
| | | |
| | | @Data |
| | | public class CountVo { |
| | | private String month; |
| | | private String date; |
| | | private Integer count; |
| | | } |
| | |
| | | </update> |
| | | |
| | | <select id="accessYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'MM') as month,count(id) |
| | | select to_char(alarm_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_access |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by month order by month |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | <select id="accessMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_access |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | </mapper> |
| | |
| | | </update> |
| | | |
| | | <select id="apponekeyYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(create_time::DATE, 'MM') as month,count(id) |
| | | select to_char(create_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_apponekey |
| | | where create_time >= #{start} and create_time <= #{end} group by month order by month |
| | | where create_time >= #{start} and create_time <= #{end} group by date order by date |
| | | </select> |
| | | <select id="apponekeyMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(create_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_apponekey |
| | | where create_time >= #{start} and create_time <= #{end} group by date order by date |
| | | </select> |
| | | </mapper> |
| | |
| | | </update> |
| | | |
| | | <select id="cameraYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'MM') as month,count(id) |
| | | select to_char(alarm_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_camera |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by month order by month |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | <select id="cameraMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_camera |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | </mapper> |
| | |
| | | and view_time is null |
| | | </update> |
| | | <select id="digitizationYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'MM') as month,count(id) |
| | | select to_char(alarm_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_digitization3 |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by month order by month |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | <select id="digitizationMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_digitization3 |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | </mapper> |
| | |
| | | </update> |
| | | |
| | | <select id="externalYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'MM') as month,count(id) |
| | | select to_char(alarm_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_external |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by month order by month |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | <select id="externalMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_external |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | <select id="fileYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'MM') as month,count(id) |
| | | select to_char(alarm_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_radar_fire |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by month order by month |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | <select id="fileMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_radar_fire |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | <select id="moveYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'MM') as month,count(id) |
| | | select to_char(alarm_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_radar_move |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by month order by month |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | <select id="moveMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_radar_move |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | </mapper> |
| | |
| | | </insert> |
| | | |
| | | <select id="stealelecYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(start_time::DATE, 'MM') as month,count(id) |
| | | select to_char(start_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_stealelec |
| | | where start_time >= #{start} and start_time <= #{end} group by month order by month |
| | | where start_time >= #{start} and start_time <= #{end} group by date order by date |
| | | </select> |
| | | |
| | | <select id="stealelecMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(start_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_stealelec |
| | | where start_time >= #{start} and start_time <= #{end} group by date order by date |
| | | </select> |
| | | </mapper> |
| | |
| | | and view_time is null |
| | | </update> |
| | | <select id="tubeYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(create_time::DATE, 'MM') as month,count(id) |
| | | select to_char(create_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_tube |
| | | where create_time >= #{start} and create_time <= #{end} group by month order by month |
| | | where create_time >= #{start} and create_time <= #{end} group by date order by date |
| | | </select> |
| | | <select id="tubeMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(create_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_tube |
| | | where create_time >= #{start} and create_time <= #{end} group by date order by date |
| | | </select> |
| | | </mapper> |
| | |
| | | and view_time is null |
| | | </update> |
| | | <select id="wallYear" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'MM') as month,count(id) |
| | | select to_char(alarm_time::DATE, 'MM') as date,count(id) |
| | | from ard_alarm_wall |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by month order by month |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | <select id="wallMonth" resultType="com.ruoyi.statistical.vo.CountVo"> |
| | | select to_char(alarm_time::DATE, 'dd') as date,count(id) |
| | | from ard_alarm_wall |
| | | where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date |
| | | </select> |
| | | </mapper> |