| | |
| | | package com.ruoyi.statistical.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.alarm.access.mapper.ArdAlarmAccessMapper; |
| | | import com.ruoyi.alarm.apponekey.mapper.ArdAlarmApponekeyMapper; |
| | |
| | | @Override |
| | | public List<CountVo> stealelecMonth(ESParam esParam) { |
| | | List<CountVo> list = stealelecMapper.stealelecMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> cameraMonth(ESParam esParam) { |
| | | List<CountVo> list = cameraMapper.cameraMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> moveMonth(ESParam esParam) { |
| | | List<CountVo> list = moveMapper.moveMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> fireMonth(ESParam esParam) { |
| | | List<CountVo> list = fireMapper.fileMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> externalMonth(ESParam esParam) { |
| | | List<CountVo> list = externalMapper.externalMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> accessMonth(ESParam esParam) { |
| | | List<CountVo> list = accessMapper.accessMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> apponekeyMonth(ESParam esParam) { |
| | | List<CountVo> list = apponekeyMapper.apponekeyMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> pumpMonth(ESParam esParam) { |
| | | List<CountVo> list = pumpMapper.pumpMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> wallMonth(ESParam esParam) { |
| | | List<CountVo> list = wallMapper.wallMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> digitizationMonth(ESParam esParam) { |
| | | List<CountVo> list = digitization3Mapper.digitizationMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountVo> tubeMonth(ESParam esParam) { |
| | | List<CountVo> list = tubeMapper.tubeMonth(esParam); |
| | | return esMonth(list,esParam.getEnd()); |
| | | return esMonth(list,esParam); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void data(String msg) { |
| | | JSONObject jsonObject = JSONObject.parseObject(msg); |
| | | String alarmTime = jsonObject.getString("alarmTime"); |
| | | List<JSONObject> list = (List<JSONObject>) jsonObject.get("ardAlarmRadars"); |
| | | if(list.size()>0){ |
| | | for (int i = 0; i < list.size(); i++) { |
| | | JSONObject j = list.get(i); |
| | | QueryWrapper<PumpStatus> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("target_id",j.getInteger("targetId")).eq("name",j.getString("name")); |
| | | PumpStatus pumpStatus1 = pumpStatusMapper.selectOne(queryWrapper); |
| | | if(pumpStatus1==null){ |
| | | PumpStatus pumpStatus = new PumpStatus(); |
| | | pumpStatus.setTargetId(j.getInteger("targetId")); |
| | | pumpStatus.setName(j.getString("name")); |
| | | if(j.containsKey("alarmType")){ |
| | | pumpStatus.setAlarmType(j.getString("alarmType")); |
| | | }else if(j.containsKey("alarm")){ |
| | | pumpStatus.setAlarmType(j.getString("alarm")); |
| | | } |
| | | pumpStatus.setAlarmTime(alarmTime); |
| | | pumpStatusMapper.insert(pumpStatus); |
| | | }else { |
| | | String alarmType = pumpStatus1.getAlarmType(); |
| | | Boolean bo = false; |
| | | if(j.containsKey("alarmType")){ |
| | | if(alarmType.equals(j.getString("alarmType"))){ |
| | | bo = true; |
| | | } |
| | | }else if(j.containsKey("alarm")){ |
| | | if(alarmType.equals(j.getString("alarm"))){ |
| | | bo = true; |
| | | } |
| | | } |
| | | if(!bo){ |
| | | pumpStatus1.setAlarmType(j.getString("alarmType")); |
| | | pumpStatus1.setAlarmTime(alarmTime); |
| | | pumpStatusMapper.updateById(pumpStatus1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public List<CountVo> es(List<CountVo> list){ |
| | | List<CountVo> countVoList = new ArrayList<>(); |
| | | for (int i = 1; i <= 12 ; i++) { |
| | |
| | | return countVoList; |
| | | } |
| | | |
| | | public List<CountVo> esMonth(List<CountVo> list,String end){ |
| | | public List<CountVo> esMonth(List<CountVo> list,ESParam esParam){ |
| | | List<CountVo> countVoList = new ArrayList<>(); |
| | | Integer day = Integer.valueOf(end.substring(end.length() - 2)); |
| | | String month = end.substring(5,7); |
| | | Integer day = Integer.valueOf(esParam.getEnd().substring(esParam.getEnd().length() - 2)); |
| | | Integer month = esParam.getMonth(); |
| | | for (int i = 1; i <= day ; i++) { |
| | | CountVo vo = new CountVo(); |
| | | String d = month + "月" + i + "日"; |
| | | String d = month + "-" + i ; |
| | | Boolean bo = false; |
| | | for (int j = 0; j < list.size(); j++) { |
| | | CountVo countVo = list.get(j); |
| | | String mon = month + "月" + Integer.valueOf(countVo.getDate()) + "日"; |
| | | String mon = month + "-" + Integer.valueOf(countVo.getDate()); |
| | | if(mon.equals(d)){ |
| | | bo = true; |
| | | vo.setDate(mon); |