Browse Source

检查日志代码提交

jingyuanchao 1 năm trước cách đây
mục cha
commit
7f5e8b11e2

+ 4 - 5
soc-modules/soc-modules-deploy/src/main/java/com/xunmei/deploy/controller/IotDailyCheckDataController.java

@@ -1,12 +1,11 @@
 package com.xunmei.deploy.controller;
 
 
-import cn.hutool.http.server.HttpServerResponse;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.deploy.dto.dailycheck.DailyCheckDataPageDto;
 import com.xunmei.deploy.service.IotDailyCheckDataService;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -35,9 +34,9 @@ public class IotDailyCheckDataController {
         return dailyCheckDataService.selectPage(req);
     }
 
-    @GetMapping("/downLoad/{id}")
-    public void downLoad(@PathVariable String id, HttpServletResponse response){
-         dailyCheckDataService.downLoad(id,response);
+    @PostMapping("/downLoad")
+    public void downLoad(Long id, HttpServletResponse response){
+         dailyCheckDataService.downLoad(id.toString(),response);
 
     }
 

+ 1 - 3
soc-modules/soc-modules-deploy/src/main/java/com/xunmei/deploy/dto/dailycheck/DailyCheckDataPageDto.java

@@ -4,14 +4,12 @@ import com.xunmei.common.core.web.domain.PageRequest;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.util.Date;
-
 @EqualsAndHashCode(callSuper = true)
 @Data
 public class DailyCheckDataPageDto extends PageRequest {
 
 
-    private Date[] range;
+    private String[] range;
 
 
 

+ 8 - 10
soc-modules/soc-modules-deploy/src/main/java/com/xunmei/deploy/service/impl/IotDailyCheckDataServiceImpl.java

@@ -1,6 +1,5 @@
 package com.xunmei.deploy.service.impl;
 
-import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
@@ -29,7 +28,6 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URLEncoder;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -56,11 +54,11 @@ public class IotDailyCheckDataServiceImpl extends ServiceImpl<IotDailyCheckDataM
     }
 
     private void dealReqParam(DailyCheckDataPageDto req) {
-        if (ObjectUtil.isNotEmpty(req)) {
+       /* if (ObjectUtil.isNotEmpty(req.getRange())) {
             Date startTime = DateUtil.beginOfDay(req.getRange()[0]);
             Date endTime = DateUtil.endOfDay(req.getRange()[1]);
             req.setRange(new Date[]{startTime, endTime});
-        }
+        }*/
         if (req.getCheckSub()) {
             SysOrg sysOrg = remoteOrgService.selectOrgById(req.getOrgId(), SecurityConstants.INNER);
             req.setOrgPath(sysOrg.getPath());
@@ -93,7 +91,8 @@ public class IotDailyCheckDataServiceImpl extends ServiceImpl<IotDailyCheckDataM
         try {
             exportToExcel(exportDataList, response);
         } catch (IOException e) {
-            throw new RuntimeException(e);
+            log.error("导出失败", e);
+            throw new RuntimeException("导出失败");
         }
     }
 
@@ -104,12 +103,11 @@ public class IotDailyCheckDataServiceImpl extends ServiceImpl<IotDailyCheckDataM
         Sheet sheet = workbook.createSheet("智能巡查每日工作登记簿");
 
         // 设置列宽
-        for (int i = 0; i < 5; i++) { // 假设我们有5列
-            sheet.setColumnWidth(i, 256 * 40); // 列宽设为20个字符宽度
+        for (int i = 0; i < 5; i++) {
+            sheet.setColumnWidth(i, 256 * 40);
         }
 
-
-        // 创建表头
+        // 创建三行表头
         createHeader(sheet,exportDataList.get(0));
 
         // 填充数据
@@ -118,7 +116,7 @@ public class IotDailyCheckDataServiceImpl extends ServiceImpl<IotDailyCheckDataM
             Row row = sheet.createRow(rowNum++);
             row.setHeight((short) 700);
             int colNum = 0;
-            // 填充行数据,根据你的 exportVo 属性进行调整
+            // 填充行数据
             row.createCell(colNum++).setCellValue(exportVo.getType());
             row.createCell(colNum++).setCellValue(exportVo.getTotalCount());
             row.createCell(colNum++).setCellValue(exportVo.getExceptionCount());

+ 19 - 2
soc-modules/soc-modules-deploy/src/main/java/com/xunmei/deploy/vo/DailyCheckDataPageVo.java

@@ -1,5 +1,7 @@
 package com.xunmei.deploy.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.Date;
@@ -7,14 +9,29 @@ import java.util.Date;
 @Data
 public class DailyCheckDataPageVo {
 
+    @ApiModelProperty("主键")
     private Long id;
 
-    private String fileName;
+    @ApiModelProperty("地区")
+    private String affiliatedArea;
 
+    @ApiModelProperty("行社")
+    private String affiliatedBank;
 
-    private Date recordDate;
+    @ApiModelProperty("所属机构id")
+    private Long orgId;
+
+    @ApiModelProperty("所属机构名称")
+    private String orgName;
 
+    @ApiModelProperty("文件名称")
+    private String fileName;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty("自检日期")
+    private Date recordDate;
 
+    @ApiModelProperty("执行人")
     private String userName;
 
 }

+ 2 - 12
soc-modules/soc-modules-deploy/src/main/java/com/xunmei/deploy/vo/DailyCheckItemExportVo.java

@@ -1,6 +1,5 @@
 package com.xunmei.deploy.vo;
 
-import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.alibaba.excel.annotation.write.style.ContentRowHeight;
 import com.alibaba.excel.annotation.write.style.HeadRowHeight;
@@ -14,37 +13,28 @@ import lombok.Data;
 @ContentRowHeight(16) //数据行高
 public class DailyCheckItemExportVo {
 
-    @ExcelProperty(value = {"智能巡查每日工作登记簿"})
     private String title;
 
-    @ExcelProperty(value = {"智能巡查每日工作登记簿","日期"})
     private String time;
-    @ExcelProperty(value = {"智能巡查每日工作登记簿","机构"})
     private String orgName;
-    @ExcelProperty(value = {"智能巡查每日工作登记簿","登记人"})
     private String userName;
 
-    @ExcelProperty(value = {"智能巡查每日工作登记簿","日期","检测项"})
     private String type;
 
-    @ExcelProperty(value = {"智能巡查每日工作登记簿","日期","检测项","总数"})
     @ApiModelProperty(value = "总数")
     private String totalCount;
 
-    @ExcelProperty(value = {"智能巡查每日工作登记簿","日期","检测项","异常数"})
     @ApiModelProperty(value = "异常数")
     private String exceptionCount;
 
-    @ExcelProperty(value = {"智能巡查每日工作登记簿","机构","检查结果"})
     @ApiModelProperty(value = "检查结果")
     private String result;
 
-    @ExcelProperty(value = {"智能巡查每日工作登记簿","检查结果"})
     @ApiModelProperty(value = "处置意见")
     private String resolution;
 
-    public DailyCheckItemExportVo(DailyCheckItem item,String typeName) {
-        this.type=typeName;
+    public DailyCheckItemExportVo(DailyCheckItem item, String typeName) {
+        this.type = typeName;
         this.result = item.getResult();
         this.exceptionCount = item.getExceptionCount();
         this.totalCount = item.getTotalCount();

+ 5 - 5
soc-modules/soc-modules-deploy/src/main/resources/mapper/IotDailyCheckDataMapper.xml

@@ -2,16 +2,16 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xunmei.deploy.dao.IotDailyCheckDataMapper">
     <select id="selectPageData" resultType="com.xunmei.deploy.vo.DailyCheckDataPageVo">
-        select id,file_name,record_date,user_name from iot_daily_check_data
+        select d.id,d.org_id,d.org_name,d.file_name,d.record_date,d.user_name,s.affiliated_area,s.affiliated_bank from iot_daily_check_data d inner join sys_org s  on d.org_id = s.id
         <where>
             <if test="req.checkSub==false">
-                and org_id =#{req.orgId}
+                and d.org_id =#{req.orgId}
             </if>
             <if test="req.checkSub==true">
-                and org_path like concat(#{req.orgPath},'%')
+                and d.org_path like concat(#{req.orgPath},'%')
             </if>
-            <if test="req.range != null and req.range.length=2">
-                and record_date between #{req.range[0]} and #{req.range[1]}
+            <if test="req.range != null">
+                and d.record_date between #{req.range[0]} and #{req.range[1]}
             </if>
         </where>
     </select>