| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.aspectj.weaver.patterns.Declare; |
| | | import org.springblade.common.vo.DeptVo; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.jfpt.alarm.entity.Alarm; |
| | | import org.springblade.jfpt.alarm.service.IAlarmService; |
| | | import org.springblade.jfpt.alarm.vo.AlarmVO; |
| | | import org.springblade.jfpt.alarm.wrapper.AlarmWrapper; |
| | | import org.springblade.jfpt.animalheat.service.AnimalHeatService; |
| | | import org.springblade.common.entity.AlarmExcel; |
| | | import org.springblade.jfpt.equipment.feign.DeptFeignApi; |
| | | import org.springblade.jfpt.equipment.service.IEquipmentService; |
| | | import org.springblade.jfpt.healthcode.service.IhealthcodeService; |
| | | import org.springblade.jfpt.operation.entity.Operation; |
| | | import org.springblade.jfpt.operation.service.IOperationService; |
| | |
| | | |
| | | private ParcelService parcelService; |
| | | |
| | | private final DeptFeignApi deptFeignApi; |
| | | |
| | | private IEquipmentService iEquipmentService; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | |
| | | @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); |
| | | } |
| | | |
| | |
| | | //获取类型集合数据 |
| | | String [] type = {"一键求助","违禁品","红色健康码","体温异常"}; |
| | | types = Arrays.asList(type); |
| | | if (null!=conditionVo){ |
| | | if (null!=conditionVo.getStartTime()){ |
| | | //获取时间集合数据 |
| | | times = DateUtils.getTimeOverOneDate(conditionVo.getStartTime(), conditionVo.getEndTime()); |
| | | //1.统计时间段内一键求助警情数量数据 3-20 修改展示紧急求助 |
| | | Map<String, Object> alarmData = alarmService.selectAlarmData(); |
| | | //1.统计时间段内一键求助警情数量数据 4-7 修改展示紧急求助 |
| | | Map<String, Object> alarmData = alarmService.selectAlarmTimeData(conditionVo); |
| | | alarmData.put("name", "一键求助"); |
| | | //2.统计时间段内违禁品的数量数据 |
| | | Map<String, Object> parcelData = parcelService.selectParcelData(conditionVo); |
| | | parcelData.put("name", "违禁品"); |
| | | //3.统计时间段内红色健康码人数数量数据 |
| | | Map<String, Object> healthcodeData = ihealthcodeService.selectHealthcodeData(); |
| | | Map<String, Object> healthcodeData = ihealthcodeService.selectHealthcodeTimeData(conditionVo); |
| | | healthcodeData.put("name", "红色健康码"); |
| | | //4.统计时间段内体温异常人数数量数据 |
| | | Map<String, Object> animalData = animalHeatService.selectAnimalData(); |
| | | Map<String, Object> animalData = animalHeatService.selectAnimalTimeData(conditionVo); |
| | | animalData.put("name", "体温异常"); |
| | | //封装数据 |
| | | dataList.add(alarmData); |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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()); |
| | | alarmService.updateJtype(operation.getJid(),operation.getJtype(),operation.getBz(),operation.getSecurityArr()); |
| | | alarmService.updatePoliceStatus(operation.getRid(),"0"); |
| | | operationService.save(operation); |
| | | //如果警情处理完成,则修改设备状态为正常 |
| | | if (null!=operation.getJtype() && operation.getJtype().equals("2")){ |
| | | String state ="处理完成"; |
| | | iEquipmentService.updateExstate(state,null,operation.getDeviceNumber()); |
| | | } |
| | | return R.success("修改成功"); |
| | | } |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 一键求助报警确认时间占比 |
| | | * @param response 跨域配置 |
| | | * @param conditionVo 条件 |
| | | * @return |
| | | */ |
| | | @GetMapping("/selConfirmTimePro") |
| | | public R selConfirmTimePro(HttpServletResponse response,ConditionVo conditionVo){ |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | if (null!= conditionVo.getStartTime() && conditionVo.getStartTime()!="" |
| | | && null!=conditionVo.getEndTime() && conditionVo.getEndTime()!="") { |
| | | return R.data(alarmService.selConfirmTimePro(conditionVo)); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 警情时间分布 0-2 2-4 4-6 6-8 .... 22-24 |
| | | * @param response 跨域配置 |
| | | * @param conditionVo 条件 |
| | | * @return |
| | | */ |
| | | @GetMapping("/selAlarmTimeDis") |
| | | public R selAlarmTimeDis(HttpServletResponse response,ConditionVo conditionVo) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //获取时间天数 |
| | | if (null!= conditionVo.getStartTime() && conditionVo.getStartTime()!="" |
| | | && null!=conditionVo.getEndTime() && conditionVo.getEndTime()!="") { |
| | | int times = DateUtils.getTimeOverOneDate(conditionVo.getStartTime(), conditionVo.getEndTime()).size(); |
| | | //查询当前时间段区间时间一键求助报警个数 |
| | | List<Integer> alarmTimeDis = alarmService.selAlarmTimeDis(conditionVo); |
| | | //查询当前时间段区间时间违禁品个数 |
| | | List<Integer> parcelTimeDis = parcelService.selParcelTimeDis(conditionVo); |
| | | //查询当前时间段区间时间红色健康码个数 |
| | | List<Integer> healthcodeTimeDis = ihealthcodeService.selHealthcodeTimeDis(conditionVo); |
| | | //查询当前时间段区间时间体温异常次数 |
| | | List<Integer> animalTimeDis = animalHeatService.selAnimalTimeDis(conditionVo); |
| | | //封装数据 |
| | | map.put("alarmTimeDis",alarmTimeDis); |
| | | map.put("parcelTimeDis",parcelTimeDis); |
| | | map.put("healthcodeTimeDis",healthcodeTimeDis); |
| | | map.put("animalTimeDis",animalTimeDis); |
| | | //返回数据 |
| | | return R.data(map); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询本年所有月份的警情数量 |
| | | * @param response 跨域配置 |
| | | * @param deviceNumber 条件 |
| | | * @return |
| | | */ |
| | | @GetMapping("/queryYearAlarm") |
| | | public List<Map<String, Object>> queryYearAlarm(HttpServletResponse response, String deviceNumber) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | |
| | | List<Map<String,Object>> list = alarmService.queryYearAlarm(deviceNumber); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 导出主动报警数据表格 |
| | | * @param alarmVO 查询条件 |
| | | * @param response |
| | | */ |
| | | @GetMapping("/export-alarm") |
| | | public void exportAlarm(AlarmVO alarmVO, HttpServletResponse response){ |
| | | List<AlarmExcel> list = alarmService.exportAlarm(alarmVO); |
| | | ExcelUtil.export(response, "主动报警数据" + DateUtil.time(), "主动报警数据表", list, AlarmExcel.class); |
| | | } |
| | | |
| | | /** |
| | | * APP查询警情 |
| | | * @param alarmVO |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @PostMapping("/APP-getAlarm") |
| | | public R getAlarm(AlarmVO alarmVO, HttpServletResponse response) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | |
| | | //获取部门数据 |
| | | List<DeptVo> deptVos = deptFeignApi.selDeptList(); |
| | | |
| | | List<AlarmVO> page = alarmService.getAlarm(alarmVO); |
| | | for (int j = 0; j < page.size(); j++) { |
| | | if (null!=page.get(j).getDeptId()){ |
| | | String[] split = page.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(","); |
| | | } |
| | | } |
| | | } |
| | | //封装部门名称数据 |
| | | page.get(j).setDeptName(deptNameBuiffer.substring(0,deptNameBuiffer.length()-1)); |
| | | } |
| | | } |
| | | return R.data(page); |
| | | } |
| | | |
| | | /** |
| | | * APP已接警情 |
| | | * @param alarmVO |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @PostMapping("/APP-getAlarming") |
| | | public R getAlarming(AlarmVO alarmVO, HttpServletResponse response) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | |
| | | //获取部门数据 |
| | | List<DeptVo> deptVos = deptFeignApi.selDeptList(); |
| | | |
| | | List<AlarmVO> page = alarmService.getAlarming(alarmVO); |
| | | for (int j = 0; j < page.size(); j++) { |
| | | if (null!=page.get(j).getDeptId()){ |
| | | String[] split = page.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(","); |
| | | } |
| | | } |
| | | } |
| | | //封装部门名称数据 |
| | | page.get(j).setDeptName(deptNameBuiffer.substring(0,deptNameBuiffer.length()-1)); |
| | | } |
| | | } |
| | | |
| | | return R.data(page); |
| | | } |
| | | |
| | | /** |
| | | * APP警情接受 |
| | | * @param alarmVO |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @PostMapping("/APP-setAlarm") |
| | | public R setAlarm(AlarmVO alarmVO, HttpServletResponse response) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat();// 格式化时间 |
| | | sdf.applyPattern("yyyy-MM-dd HH:mm:ss");// a为am/pm的标记 |
| | | Date date = new Date();// 获取当前时间 |
| | | |
| | | Operation operation = new Operation(); |
| | | operation.setJid(alarmVO.getId().toString()); |
| | | operation.setSnumber(alarmVO.getSecurityId()); |
| | | operation.setZc("接受任务"); |
| | | operation.setSname(alarmVO.getAlarmPeople()); |
| | | |
| | | operation.setZctime(sdf.format(date)); |
| | | operationService.save(operation); |
| | | |
| | | |
| | | return R.status(alarmService.setAlarm(alarmVO)); |
| | | } |
| | | |
| | | } |