New file |
| | |
| | | package com.ycl.controller.smoke; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ycl.annotation.LogSave; |
| | | import com.ycl.api.CommonPage; |
| | | import com.ycl.api.CommonResult; |
| | | import com.ycl.controller.BaseController; |
| | | import com.ycl.dto.smoker.InTimeCountDto; |
| | | import com.ycl.dto.smoker.QueryInTimeParam; |
| | | import com.ycl.entity.smoke.OdsCustomer; |
| | | import com.ycl.entity.smoke.OdsInTime; |
| | | import com.ycl.service.smoke.IOdsAlarmMsgService; |
| | | import com.ycl.service.smoke.IOdsCustomerService; |
| | | import com.ycl.service.smoke.IOdsInTimeService; |
| | | import com.ycl.utils.EasyExcelUtils; |
| | | import com.ycl.vo.smoke.OdsInTimeVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/smoke") |
| | | @Api(tags = "油烟管理管理-报警") |
| | | public class AlarmController extends BaseController { |
| | | |
| | | IOdsAlarmMsgService alarmMsgService; |
| | | |
| | | @Autowired |
| | | public void setAlarmMsgService(IOdsAlarmMsgService alarmMsgService) { |
| | | this.alarmMsgService = alarmMsgService; |
| | | } |
| | | // |
| | | // @ApiOperation("获取所属单位") |
| | | // @RequestMapping(value = "/customer/list", method = RequestMethod.GET) |
| | | // @ResponseBody |
| | | // @LogSave(operationType = "油烟模块", contain = "获取所属单位") |
| | | // public CommonResult<CommonPage<OdsCustomer>> findCustomerList(@RequestParam(value = "keyword", required = false) String keyword, |
| | | // @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, |
| | | // @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { |
| | | // Page<OdsCustomer> customerPage = customerService.findList(keyword, pageSize, pageNum); |
| | | // return CommonResult.success(CommonPage.restPage(customerPage)); |
| | | // } |
| | | // |
| | | // @ApiOperation("查询实时数据") |
| | | // @RequestMapping(value = "/inTime/list", method = RequestMethod.GET) |
| | | // @ResponseBody |
| | | // @LogSave(operationType = "油烟模块", contain = "查询实时数据") |
| | | // public CommonResult<CommonPage<OdsInTime>> findInTimeList(@RequestParam(value = "owner", required = false) String owner, |
| | | // @RequestParam(value = "onlineStatus", required = false) String onlineStatus, |
| | | // @RequestParam(value = "status", required = false) String status, |
| | | // @RequestParam(value = "startTime", required = false) String startTime, |
| | | // @RequestParam(value = "endTime", required = false) String endTime, |
| | | // @RequestParam(value = "type", required = false) String type, |
| | | // @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, |
| | | // @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { |
| | | // Page<OdsInTime> inTimePage = inTimeService.findList(owner, onlineStatus, startTime, endTime, type, status, pageSize, pageNum); |
| | | // return CommonResult.success(CommonPage.restPage(inTimePage)); |
| | | // } |
| | | // |
| | | // @ApiOperation("导出实时数据") |
| | | // @PostMapping(value = "/inTime/export") |
| | | // @LogSave(operationType = "油烟模块", contain = "查询实时数据") |
| | | // public void exportInTimeList(HttpServletResponse response, QueryInTimeParam param) throws IOException { |
| | | // Page<OdsInTime> inTimePage = inTimeService.findList(param.getOwner(), param.getOnlineStatus(), param.getStartTime(), |
| | | // param.getEndTime(), param.getType(), param.getStatus(), 99999, 1); |
| | | // |
| | | // List<OdsInTimeVo> odsInTimeVos = new ArrayList<>(); |
| | | // Dictionary<Integer, String> fanStatusDic = new Hashtable<>(); |
| | | // fanStatusDic.put(1, "开"); |
| | | // fanStatusDic.put(2, "关"); |
| | | // fanStatusDic.put(3, "异常"); |
| | | // fanStatusDic.put(0, "异常"); |
| | | // |
| | | // Dictionary<Integer, String> onlineStatusDic = new Hashtable<>(); |
| | | // onlineStatusDic.put(1, "在线"); |
| | | // onlineStatusDic.put(2, "离线"); |
| | | // onlineStatusDic.put(3, "异常离线"); |
| | | // onlineStatusDic.put(0, "异常离线"); |
| | | // |
| | | // Dictionary<String, String> statusDic = new Hashtable<>(); |
| | | // statusDic.put("NORMAL", "正常"); |
| | | // statusDic.put("ALARM", "预警"); |
| | | // statusDic.put("EXCESS", "超标"); |
| | | // statusDic.put("DOWN", "离线"); |
| | | // statusDic.put("OFF", "异常离线"); |
| | | // |
| | | // inTimePage.getRecords().stream().forEach(o -> { |
| | | // OdsInTimeVo vo = new OdsInTimeVo(); |
| | | // BeanUtils.copyProperties(o, vo); |
| | | // vo.setAcquitAtStr(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(o.getAcquitAt() * 1000))); |
| | | // vo.setFanStatusStr(fanStatusDic.get(o.getFanStatus())); |
| | | // vo.setFilterStatusStr(fanStatusDic.get(o.getFilterStatus())); |
| | | // vo.setOnlineStatusStr(onlineStatusDic.get(o.getOnlineStatus())); |
| | | // vo.setStatusStr(statusDic.get(o.getStatus())); |
| | | // odsInTimeVos.add(vo); |
| | | // }); |
| | | // |
| | | // String sheetName = "实时数据"; |
| | | // |
| | | // String fileName = URLEncoder.encode(sheetName + ".xlsx", "UTF-8"); |
| | | // //设置响应字符集 |
| | | // response.setCharacterEncoding("UTF-8"); |
| | | // //设置响应媒体类型 |
| | | // response.setContentType("application/vnd.ms-excel"); |
| | | // response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | // |
| | | // EasyExcelUtils.export(response, sheetName, OdsInTimeVo.class, odsInTimeVos); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation("获取设备在线情况") |
| | | // @RequestMapping(value = "/inTime/count", method = RequestMethod.GET) |
| | | // @ResponseBody |
| | | // @LogSave(operationType = "油烟模块", contain = "获取设备在线情况") |
| | | // public CommonResult<InTimeCountDto> getInTimeCount() { |
| | | // InTimeCountDto dto = inTimeService.getInTimeCount(); |
| | | // return CommonResult.success(dto); |
| | | // } |
| | | } |