Przeglądaj źródła

add 漏打点导出

459242451@qq.com 2 lat temu
rodzic
commit
af95607d25

+ 0 - 10
Dockerfile

@@ -1,10 +0,0 @@
-# jdk的版本
-FROM anapsix/alpine-java:8_server-jre_unlimited
-# 作者
-MAINTAINER xt
-ARG workdir=/app
-VOLUME ${workdir}
-WORKDIR ${workdir}
-ADD ruoyi-admin/target/ruoyi-admin.jar app.jar
-EXPOSE 8080
-ENTRYPOINT ["java","-Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps  -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC","-jar","app.jar"]

+ 46 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlInspectionLocationLogController.java

@@ -1,6 +1,8 @@
 package com.ruoyi.web.controller.qdtl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
@@ -8,8 +10,11 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.qdtl.domain.MissLoactionPoint;
+import com.ruoyi.qdtl.domain.TlInspectionLocation;
 import com.ruoyi.qdtl.domain.TlInspectionLocationLog;
 import com.ruoyi.qdtl.service.ITlInspectionLocationLogService;
+import com.ruoyi.qdtl.service.ITlInspectionLocationService;
 import com.ruoyi.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
@@ -22,9 +27,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * 巡检记录管理Controller
@@ -39,6 +47,8 @@ public class TlInspectionLocationLogController extends BaseController {
     private ITlInspectionLocationLogService tlInspectionLocationLogService;
     @Autowired
     private ISysRoleService sysRoleService;
+    @Autowired
+    private ITlInspectionLocationService locationService;
 
     /**
      * 查询巡检记录管理列表
@@ -103,6 +113,42 @@ public class TlInspectionLocationLogController extends BaseController {
         util.exportExcel(response, list, "巡检记录管理数据");
     }
 
+    @Log(title = "漏打巡检点导出", businessType = BusinessType.EXPORT)
+    @PostMapping("/missExport")
+    public void missExport(HttpServletResponse response, TlInspectionLocationLog tlInspectionLocationLog) {
+        // 查询每个镇所有的点位
+        List<TlInspectionLocation> locations = locationService.selectLocationList();
+        Set<String> locationsSet = locations.stream().map(TlInspectionLocation::getLocationCode).collect(Collectors.toSet());
+        Map<String, TlInspectionLocation> locationName = locations.stream().collect(Collectors.toMap(TlInspectionLocation::getLocationCode, a -> a));
+//        Map<Long, List<TlInspectionLocation>> locationCollect = locations.stream().collect(Collectors.groupingBy(TlInspectionLocation::getAreaId));
+        // 查询近一个月内所有打卡记录
+        TlInspectionLocationLog bean = new TlInspectionLocationLog();
+        DateTime endDate = DateUtil.date();
+        DateTime startDate = DateUtil.offsetDay(endDate, -30);
+        bean.setBeginTime(DateUtil.formatDateTime(startDate));
+        bean.setEndTime(DateUtil.formatDateTime(endDate));
+        List<TlInspectionLocationLog> locationLogList = tlInspectionLocationLogService.selectTlInspectionLocationLogList(bean);
+        // 解析根据日期分组
+        Map<String, List<TlInspectionLocationLog>> dateCollect = locationLogList.stream().collect(Collectors.groupingBy(a -> DateUtil.formatDate(a.getCreateTime())));
+        List<MissLoactionPoint> list = new ArrayList<>();
+        for (Map.Entry<String, List<TlInspectionLocationLog>> stringListEntry : dateCollect.entrySet()) {
+            String dateStr = stringListEntry.getKey();
+            List<TlInspectionLocationLog> value = stringListEntry.getValue();
+            Set<String> cardCollect = value.stream().map(TlInspectionLocationLog::getCheckpointCard).collect(Collectors.toSet());
+            List<String> pointList = CollUtil.subtractToList(locationsSet, cardCollect);
+            for (String s : pointList) {
+                MissLoactionPoint add = new MissLoactionPoint();
+                add.setDateStr(dateStr);
+                add.setLocationName(locationName.get(s).getLocationName());
+                add.setLocationCode(locationName.get(s).getLocationCode());
+                list.add(add);
+            }
+        }
+        CollUtil.sortByProperty(list, "dateStr");
+        ExcelUtil<MissLoactionPoint> util = new ExcelUtil<>(MissLoactionPoint.class);
+        util.exportExcel(response, list, "近一个月内漏打记录数据");
+    }
+
     /**
      * 获取巡检记录管理详细信息
      */

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -107,7 +107,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
                         "/qdtl/plan/exportSchedule",
                         "/profile/**"
                 ).permitAll()
-                .antMatchers("/common/upload", "/common/download/resource").permitAll()
+                .antMatchers("/common/upload", "/common/download/resource", "/qdtl/log/missExport").permitAll()
                 .antMatchers("/swagger-ui.html").anonymous()
                 .antMatchers("/swagger-resources/**").anonymous()
                 .antMatchers("/webjars/**").anonymous()

+ 20 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/MissLoactionPoint.java

@@ -0,0 +1,20 @@
+package com.ruoyi.qdtl.domain;
+
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2023/3/7
+ * @Version V1.0
+ */
+@Data
+public class MissLoactionPoint {
+    @Excel(name = "漏打日期")
+    private String dateStr;
+    @Excel(name = "漏打地点", width = 35)
+    private String locationName;
+    @Excel(name = "巡检点编号", width = 20)
+    private String locationCode;
+}