| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | 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.jfpt.alarm.vo.AlarmVO; |
| | | import org.springblade.jfpt.alarm.wrapper.AlarmWrapper; |
| | | import org.springblade.jfpt.animalheat.service.AnimalHeatService; |
| | | import org.springblade.jfpt.alarm.vo.AlarmExcel; |
| | | import org.springblade.jfpt.animalheat.vo.AnimalHeatExcel; |
| | | 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; |
| | | import org.springblade.jfpt.operation.vo.OperationVO; |
| | | import org.springblade.jfpt.parcel.service.ParcelService; |
| | |
| | | |
| | | 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 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("修改成功"); |
| | | } |
| | | |
| | |
| | | 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)); |
| | | } |
| | | |
| | | } |