Pārlūkot izejas kodu

动环诊断导出接口代码提交

jingyuanchao 1 gadu atpakaļ
vecāks
revīzija
814df9af56

+ 1 - 1
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/controller/IotSensorController.java

@@ -51,7 +51,7 @@ public class IotSensorController {
     //@RequiresPermissions("core:eduTask:export")
     @Log(title = "导出动环设备", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(@RequestBody final SensorPageDto request, HttpServletResponse response) throws IOException {
+    public void export(SensorPageDto request, HttpServletResponse response) throws IOException {
         sensorService.export(request, response);
     }
 }

+ 6 - 1
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotCommonSensorServiceImpl.java

@@ -88,7 +88,12 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
     public void export(SensorPageDto request, HttpServletResponse response) {
         dealPageParam(request);
         List<SensorExportVo> data = sensorMapper.selectListData(request);
-
+        for (SensorExportVo record : data) {
+            final String info = record.getInfo();
+            record.setInfo(dealInfoData(info));
+            record.setDeviceType(DictUtils.getDictLabel(DictConstants.SENSOR_DEVICE_TYPE, Integer.parseInt(record.getDeviceType())));
+            record.setStateText(DictUtils.getDictLabel(DictConstants.SENSOR_ALARM_STATUS, record.getState()));
+        }
         try {
             // 设置响应头
             response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("动环诊断", "utf-8"));

+ 15 - 15
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/vo/sensor/SensorExportVo.java

@@ -17,23 +17,23 @@ import java.time.LocalDateTime;
  * @date 2024/2/26 14:37
  */
 @Data
-@ColumnWidth(15) //列宽,最大值为255
-@HeadRowHeight(16) //表头行高
-@ContentRowHeight(16) //数据行高
+@ColumnWidth(30) //列宽,最大值为255
+@HeadRowHeight(20) //表头行高
+@ContentRowHeight(20) //数据行高
 public class SensorExportVo {
 
-    @ColumnWidth(10)
-    @ExcelProperty(value = "序号", index = 0)
+    @ColumnWidth(30)
+    @ExcelProperty(value = "设备名称", index = 0)
     @ApiModelProperty("设备名称")
     private String deviceName;
 
-    @ColumnWidth(10)
-    @ExcelProperty(value = "序号", index = 1)
+    @ColumnWidth(30)
+    @ExcelProperty(value = "设备类型", index = 1)
     @ApiModelProperty("设备类型")
     private String deviceType;
 
-    @ColumnWidth(10)
-    @ExcelProperty(value = "序号", index = 2)
+    @ColumnWidth(30)
+    @ExcelProperty(value = "所属机构", index = 2)
     @ApiModelProperty("所属机构")
     private String orgName;
 
@@ -41,19 +41,19 @@ public class SensorExportVo {
     @ApiModelProperty(value = "告警状态,0:正常,1:告警")
     private Integer state;
 
-    @ColumnWidth(10)
-    @ExcelProperty(value = "序号", index = 3)
+    @ColumnWidth(30)
+    @ExcelProperty(value = "告警状态", index = 3)
     @ApiModelProperty(value = "告警状态")
     private String stateText;
 
-    @ColumnWidth(10)
-    @ExcelProperty(value = "序号", index = 4)
+    @ColumnWidth(30)
+    @ExcelProperty(value = "上报时间", index = 4)
     @JsonFormat(pattern = Constants.HMS_FORMAT)
     @ApiModelProperty("上报时间")
     private String updateTime;
 
-    @ColumnWidth(10)
-    @ExcelProperty(value = "序号", index = 5)
+    @ColumnWidth(30)
+    @ExcelProperty(value = "上报内容", index = 5)
     @ApiModelProperty("上报内容")
     private String info;