南昌市物联网技防平台-后台
zengh
2021-07-26 2deeeb8b1e671cfeb421f973c644ffc2d3182841
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/controller/AlarmController.java
@@ -109,8 +109,52 @@
   @ApiOperationSupport(order = 3)
   @ApiOperation(value = "分页", notes = "传入alarm")
   public R<IPage<AlarmVO>> page(AlarmVO alarm, Query query) {
      //获取部门数据
      List<DeptVo> deptVos = deptFeignApi.selDeptList();
      IPage<AlarmVO> pages = alarmService.selectAlarmPage(Condition.getPage(query), alarm);
      //遍历数据
      for (int j = 0; j < pages.getRecords().size(); j++) {
         if (null!=pages.getRecords().get(j).getDeptId()){
            String[] split = pages.getRecords().get(j).getDeptId().split(",");
            List<String> list = Arrays.asList(split);
            StringBuffer deptNameBuiffer = new StringBuffer();
            //数据匹配封装
            for (String deptId:list) {
               for (DeptVo deptVo:deptVos) {
                  if (deptId.equals(deptVo.getId().toString())){
                     deptNameBuiffer.append(deptVo.getDeptName()).append(",");
                  }
               }
            }
            //封装部门名称数据
            pages.getRecords().get(j).setDeptName(deptNameBuiffer.substring(0,deptNameBuiffer.length()-1));
         }
      }
      return R.data(pages);
   }
   /**
    * 自定义分页
    */
   @GetMapping("/page_az")
   @ApiOperationSupport(order = 3)
   @ApiOperation(value = "分页", notes = "传入alarm")
   public R<IPage<AlarmVO>> page_az(AlarmVO alarm, Query query) {
      IPage<AlarmVO> pages = alarmService.selectazPage(Condition.getPage(query), alarm);
      return R.data(pages);
   }
   /**
    * 安装任务图表接口
    */
   @GetMapping("/getChartData")
   @ApiOperationSupport(order = 3)
   @ApiOperation(value = "分页", notes = "传入alarm")
   public R<List> getChartData(AlarmVO alarm) {
      List<Map<String,Object>> list = alarmService.getChartData(alarm);
      return R.data(list);
   }
   /**
@@ -465,6 +509,29 @@
      String time = df.format(new Date());// new Date()为获取当前系统时间
      String pastDate = getPastDate(7);
      List<AlarmVO> alarmVOS = alarmService.selectListSe(pastDate, time);
      //获取部门数据
      List<DeptVo> deptVos = deptFeignApi.selDeptList();
      //遍历数据
      for (int j = 0; j < alarmVOS.size(); j++) {
         if (null!=alarmVOS.get(j).getDeptId()){
            String[] split = alarmVOS.get(j).getDeptId().split(",");
            List<String> list = Arrays.asList(split);
            StringBuffer deptNameBuiffer = new StringBuffer();
            //数据匹配封装
            for (String deptId:list) {
               for (DeptVo deptVo:deptVos) {
                  if (deptId.equals(deptVo.getId().toString())){
                     deptNameBuiffer.append(deptVo.getDeptName()).append(",");
                  }
               }
            }
            //封装部门名称数据
            alarmVOS.get(j).setDeptName(deptNameBuiffer.substring(0,deptNameBuiffer.length()-1));
         }
      }
      return R.data(alarmVOS);
   }
@@ -477,7 +544,19 @@
      response.setHeader("Access-Control-Allow-Origin", "*");
      response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
      response.setHeader("Access-Control-Allow-Credentials","true");
      alarmService.updateJtype(operation.getJid(),operation.getJtype(),operation.getBz(),operation.getSecurityArr());
      String bs = null;
      if (operation.getZc() !=null && operation.getZc() !=""){
         if (operation.getZc().equals("派送保安")){
            bs = "0";
         }else if(operation.getZc().equals("办结")){
            bs = "1";
         }else if(operation.getZc().equals("推送110")){
            bs = "2";
         }
      }
      alarmService.updateJtype(operation.getJid(),operation.getJtype(),operation.getBz(),operation.getSecurityArr(),bs);
      alarmService.updatePoliceStatus(operation.getRid(),"0");
      operationService.save(operation);
      //如果警情处理完成,则修改设备状态为正常