From 4289c5a85c5022933f081c8bdaed681df9f3eada Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期六, 25 十一月 2023 17:25:57 +0800
Subject: [PATCH] 17:25 案卷查询BUG修改
---
ycl-platform/src/main/java/com/ycl/controller/smoke/SmokeAlarmController.java | 150 +++++++++++++++++++++-----------------------------
1 files changed, 63 insertions(+), 87 deletions(-)
diff --git a/ycl-platform/src/main/java/com/ycl/controller/smoke/SmokeAlarmController.java b/ycl-platform/src/main/java/com/ycl/controller/smoke/SmokeAlarmController.java
index b86dd23..b152efb 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/smoke/SmokeAlarmController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/smoke/SmokeAlarmController.java
@@ -1,10 +1,26 @@
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.entity.smoke.OdsAlarmMsg;
+import com.ycl.dto.smoker.QueryAlarmParam;
import com.ycl.service.smoke.IOdsAlarmMsgService;
+import com.ycl.utils.EasyExcelUtils;
+import com.ycl.vo.smoke.OdsAlarmVo;
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")
@@ -17,91 +33,51 @@
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", "姝e父");
-// 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);
-// }
+
+ @ApiOperation("鏌ヨ鎶ヨ鏁版嵁")
+ @RequestMapping(value = "/alarm/list", method = RequestMethod.GET)
+ @ResponseBody
+ @LogSave(operationType = "娌圭儫妯″潡", contain = "鏌ヨ鎶ヨ鏁版嵁")
+ public CommonResult<CommonPage<OdsAlarmMsg>> findAlarmList(@RequestParam(value = "msgType", required = false) String type,
+ @RequestParam(value = "startTime", required = false) String startTime,
+ @RequestParam(value = "endTime", required = false) String endTime,
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
+ Page<OdsAlarmMsg> page = alarmMsgService.findList(type, startTime, endTime, pageSize, pageNum);
+ return CommonResult.success(CommonPage.restPage(page));
+ }
+
+ @ApiOperation("瀵煎嚭鎶ヨ鏁版嵁")
+ @PostMapping(value = "/alarm/export")
+ @LogSave(operationType = "娌圭儫妯″潡", contain = "瀵煎嚭鎶ヨ鏁版嵁")
+ public void exportAlarmList(HttpServletResponse response, QueryAlarmParam param) throws IOException {
+ Page<OdsAlarmMsg> page = alarmMsgService.findList(param.getMsgType(), param.getStartTime(),
+ param.getEndTime(), 99999, 1);
+
+ List<OdsAlarmVo> alarmMsgs = new ArrayList<>();
+
+ Dictionary<String, String> msgTypeDic = new Hashtable<>();
+ msgTypeDic.put("ExceedStandard", "瓒呮爣");
+ msgTypeDic.put("AbnormalOffline", "寮傚父绂荤嚎");
+
+ page.getRecords().stream().forEach(o -> {
+ OdsAlarmVo vo = new OdsAlarmVo();
+ BeanUtils.copyProperties(o, vo);
+ vo.setAcquitAtStr(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(o.getAcquitAt() * 1000)));
+ vo.setMsgTypeStr(msgTypeDic.get(o.getMsgType()));
+ alarmMsgs.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, OdsAlarmVo.class, alarmMsgs);
+ }
+
}
\ No newline at end of file
--
Gitblit v1.8.0