| | |
| | | |
| | | import com.ruoyi.statistical.param.ESParam; |
| | | import com.ruoyi.statistical.service.StatisticalService; |
| | | import com.ruoyi.statistical.vo.NumVo; |
| | | import com.ruoyi.statistical.vo.TenVo; |
| | | import com.ruoyi.utils.result.Results; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | //移动终端 |
| | | return Results.succeed(statisticalService.apponekeyYear(esParam)); |
| | | }else if("1008".equals(type)){ |
| | | //移动终端 |
| | | //雷达停机 |
| | | return Results.succeed(statisticalService.pumpYear(esParam)); |
| | | }else if("1010".equals(type)){ |
| | | //电子围栏 |
| | |
| | | */ |
| | | @ApiOperation("报警数量分析月") |
| | | @GetMapping("alarm/month") |
| | | public Results alarmMonth(String month,String type){ |
| | | public Results alarmMonth(Integer month,String type){ |
| | | LocalDate today = LocalDate.now(); |
| | | int year = today.getYear(); |
| | | int day = getDaysInMonth(Integer.valueOf(month),year); |
| | | int day = getDaysInMonth(month); |
| | | ESParam esParam = new ESParam(); |
| | | esParam.setStart(year+"-"+month+"-01"); |
| | | esParam.setEnd(year+"-"+month+"-"+day); |
| | | esParam.setMonth(month); |
| | | if("1001".equals(type)){ |
| | | //盗电报警 |
| | | return Results.succeed(statisticalService.stealelecMonth(esParam)); |
| | |
| | | } |
| | | |
| | | //返回每月天数 |
| | | public int getDaysInMonth(int month, int year) { |
| | | public int getDaysInMonth(int month) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | switch (month) { |
| | | case Calendar.JANUARY: |
| | | case Calendar.MARCH: |
| | | case Calendar.MAY: |
| | | case Calendar.JULY: |
| | | case Calendar.AUGUST: |
| | | case Calendar.OCTOBER: |
| | | case Calendar.DECEMBER: |
| | | case 1: case 3: case 5: case 7: case 8: case 10: case 12: |
| | | return 31; |
| | | case Calendar.APRIL: |
| | | case Calendar.JUNE: |
| | | case Calendar.SEPTEMBER: |
| | | case Calendar.NOVEMBER: |
| | | case 4: case 6: case 9: case 11: |
| | | return 30; |
| | | case Calendar.FEBRUARY: |
| | | return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 29 : 28; |
| | | case 2: |
| | | if (calendar.get(Calendar.YEAR) % 4 == 0 && (calendar.get(Calendar.YEAR) % 100 != 0 || calendar.get(Calendar.YEAR) % 400 == 0)) { |
| | | return 29; |
| | | } else { |
| | | return 28; |
| | | } |
| | | default: |
| | | throw new IllegalArgumentException("Invalid Month"); |
| | | } |
| | |
| | | return Results.succeed(statisticalService.unit()); |
| | | } |
| | | |
| | | /** |
| | | * 报警数量 |
| | | */ |
| | | @ApiOperation("报警数量") |
| | | @GetMapping("alarm/num") |
| | | public Results num(){ |
| | | List<TenVo> tenVo = new ArrayList<>(); |
| | | TenVo stealelec = new TenVo(); |
| | | stealelec.setName("盗电报警"); |
| | | stealelec.setValue(statisticalService.stealelecNum()); |
| | | tenVo.add(stealelec); |
| | | TenVo camera = new TenVo(); |
| | | camera.setName("通用光电"); |
| | | camera.setValue(statisticalService.cameraNum()); |
| | | tenVo.add(camera); |
| | | TenVo move = new TenVo(); |
| | | move.setName("雷达移动"); |
| | | move.setValue(statisticalService.moveNum()); |
| | | tenVo.add(move); |
| | | TenVo fire = new TenVo(); |
| | | fire.setName("雷达防火"); |
| | | fire.setValue(statisticalService.fireNum()); |
| | | tenVo.add(fire); |
| | | TenVo external = new TenVo(); |
| | | external.setName("外联报警"); |
| | | external.setValue(statisticalService.externalNum()); |
| | | tenVo.add(external); |
| | | TenVo access = new TenVo(); |
| | | access.setName("门禁报警"); |
| | | access.setValue(statisticalService.accessNum()); |
| | | tenVo.add(access); |
| | | TenVo apponekey = new TenVo(); |
| | | apponekey.setName("移动终端"); |
| | | apponekey.setValue(statisticalService.apponekeyNum()); |
| | | tenVo.add(apponekey); |
| | | TenVo pump = new TenVo(); |
| | | pump.setName("雷达停机"); |
| | | pump.setValue(statisticalService.pumpNum()); |
| | | tenVo.add(pump); |
| | | TenVo wall = new TenVo(); |
| | | wall.setName("电子围栏"); |
| | | wall.setValue(statisticalService.wallNum()); |
| | | tenVo.add(wall); |
| | | TenVo digitization = new TenVo(); |
| | | digitization.setName("预警报警"); |
| | | digitization.setValue(statisticalService.digitizationNum()); |
| | | tenVo.add(digitization); |
| | | TenVo tube = new TenVo(); |
| | | tube.setName("管线泄露"); |
| | | tube.setValue(statisticalService.tubeNum()); |
| | | tenVo.add(tube); |
| | | return Results.succeed(tenVo); |
| | | } |
| | | |
| | | /** |
| | | * 24小时报警兴趣点前十 |
| | | */ |
| | | @ApiOperation("24小时报警兴趣点前十") |
| | | @GetMapping("alarm/ten") |
| | | public Results ten(){ |
| | | return Results.succeed(statisticalService.ten()); |
| | | } |
| | | |
| | | /** |
| | | * 抽油机运行状态 |
| | | */ |
| | | @ApiOperation("抽油机运行状态") |
| | | @GetMapping("alarm/pump") |
| | | public Results pump(){ |
| | | return Results.succeed(statisticalService.pump()); |
| | | } |
| | | |
| | | } |