Răsfoiți Sursa

日常履职登记簿增加布撤防情况,代码提交

jingyuanchao 1 an în urmă
părinte
comite
1eff924dda

+ 5 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ProtectionServiceImpl.java

@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystem;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystemLog;
@@ -269,6 +270,8 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
         List<IotAlarmSubsystem> list = lambdaQuery()
                 .eq(IotAlarmSubsystem::getOrgId, orgId)
                 .eq(IotAlarmSubsystem::getDeleted, 0)
+                .eq(IotAlarmSubsystem::getInBook, 1)
+                .last(Constants.LIMIT1)//一个机构只会有一个子系统关联登记簿
                 .list();
         if (ObjectUtil.isEmpty(list)) {
             return resultList;
@@ -300,7 +303,7 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
                     IotAlarmSubsystemLog log = optional.get();
                     Map<String, Object> map = new HashMap<>();
                     map.put("status", log.getStatus());
-                    map.put("date", DateUtil.format(log.getStatusChangeTime(), "yyyy-MM-dd HH:mm:ss"));
+                    map.put("date", DateUtil.format(log.getStatusChangeTime(), "HH:mm"));
                     listEntry.getValue().add(map);
                 }
                 optional = subsystemLogList.stream().filter(r -> ObjectUtil.equal(r.getStatus(), 0)).min(Comparator.comparing(IotAlarmSubsystemLog::getStatusChangeTime));
@@ -308,7 +311,7 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
                     IotAlarmSubsystemLog log = optional.get();
                     Map<String, Object> map = new HashMap<>();
                     map.put("status", log.getStatus());
-                    map.put("date", DateUtil.format(log.getStatusChangeTime(), "yyyy-MM-dd HH:mm:ss"));
+                    map.put("date", DateUtil.format(log.getStatusChangeTime(), "HH:mm"));
                     listEntry.getValue().add(map);
                 }
             }

+ 19 - 27
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -221,6 +221,10 @@ public class PdfUtil {
         for (String s : names) {
             List<LinkedHashMap<String, Object>> lists = (List<LinkedHashMap<String, Object>>) data.get(s);
             if (ObjectUtil.isEmpty(lists)) {
+                //不同的执行时刻
+                PdfUtil.createPDFCell(tableFont, table, s, PdfPCell.ALIGN_MIDDLE, 2,1);
+                PdfUtil.createPDFCell(tableFont, table,"/", PdfPCell.ALIGN_MIDDLE, 6, 1);
+                PdfUtil.createPDFCell(tableFont, table, "/", PdfPCell.ALIGN_MIDDLE, 2,1);
                 continue;
             }
             //不同的执行时刻
@@ -239,22 +243,15 @@ public class PdfUtil {
         }
 
         // ------------------------------------------------------------------------------------------------------------
-
+/*
         PdfUtil.createPDFCell(tableFont, table, "布撤防情况", Element.ALIGN_MIDDLE, 10, 1);
 
-        PdfUtil.createPDFCell(tableFont, table, "序号", Element.ALIGN_MIDDLE, 2, 1);
-        PdfUtil.createPDFCell(tableFont, table, "控制器", Element.ALIGN_MIDDLE, 3, 1);
-        PdfUtil.createPDFCell(tableFont, table, "状态", Element.ALIGN_MIDDLE, 2, 1);
-        PdfUtil.createPDFCell(tableFont, table, "时间", Element.ALIGN_MIDDLE, 3, 1);
+        PdfUtil.createPDFCell(tableFont, table, "控制器名称", Element.ALIGN_MIDDLE, 2, 1);
+        PdfUtil.createPDFCell(tableFont, table, "详情", Element.ALIGN_MIDDLE, 8, 1);*/
+
 
         List<Map<String, List<Map<String, Object>>>> protectionList = (List<Map<String, List<Map<String, Object>>>>) data.get("protection");
-        if (ObjectUtil.isEmpty(protectionList)) {
-            PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 2, 1);
-            PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 3, 1);
-            PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 2, 1);
-            PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 3, 1);
-            document.add(table);
-        } else {
+        if (ObjectUtil.isNotEmpty(protectionList)) {
             for (int i = 0; i < protectionList.size(); i++) {
                 Map<String, List<Map<String, Object>>> listMap = protectionList.get(i);
                 for (Map.Entry<String, List<Map<String, Object>>> listEntry : listMap.entrySet()) {
@@ -262,42 +259,37 @@ public class PdfUtil {
                     List<Map<String, Object>> value = listEntry.getValue();
                     //布防状态,0:撤防,1:布防
                     if (value.isEmpty()) {
-                        // 序号
-                        PdfUtil.createPDFCell(tableFont, table, String.valueOf(i + 1), Element.ALIGN_MIDDLE, 2, 1);
                         //子系统名称
-                        PdfUtil.createPDFCell(tableFont, table, subsystem.getName(), Element.ALIGN_MIDDLE, 3, 1);
-                        //状态
+                        PdfUtil.createPDFCell(tableFont, table, subsystem.getName(), Element.ALIGN_MIDDLE, 2, 1);
+                        PdfUtil.createPDFCell(tableFont, table,"撤防时间" , Element.ALIGN_MIDDLE, 2, 1);
+                        PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 2, 1);
+                        PdfUtil.createPDFCell(tableFont, table,"布防时间" , Element.ALIGN_MIDDLE, 2, 1);
                         PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 2, 1);
-                        // 时间
-                        PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 3, 1);
                     } else {
-                        // 序号
-                        PdfUtil.createPDFCell(tableFont, table, String.valueOf(i + 1), Element.ALIGN_MIDDLE, 2, 2);
-                        //子系统名称
-                        PdfUtil.createPDFCell(tableFont, table, subsystem.getName(), Element.ALIGN_MIDDLE, 3, 2);
-                        //状态
-                        PdfUtil.createPDFCell(tableFont, table, "撤防", Element.ALIGN_MIDDLE, 2, 1);
+                        // 子系统名称
+                        PdfUtil.createPDFCell(tableFont, table, subsystem.getName(), Element.ALIGN_MIDDLE, 2, 1);
                         Optional<Map<String, Object>> statusOptional1 = value.stream().filter(r -> {
                             Integer status = (Integer) r.get("status");
                             return ObjectUtil.equal(0,status);
                         }).findFirst();
                         String cfStatus = statusOptional1.isPresent() ? String.valueOf(statusOptional1.get().get("date")) : StringUtil.EMPTY_STRING;
                         // 撤防时间
-                        PdfUtil.createPDFCell(tableFont, table, cfStatus, Element.ALIGN_MIDDLE, 3, 1);
+                        PdfUtil.createPDFCell(tableFont, table, "撤防时间", Element.ALIGN_MIDDLE, 2, 1);
+                        PdfUtil.createPDFCell(tableFont, table, cfStatus, Element.ALIGN_MIDDLE, 2, 1);
 
-
-                        PdfUtil.createPDFCell(tableFont, table, "布防", Element.ALIGN_MIDDLE, 2, 1);
                         Optional<Map<String, Object>> statusOptional = value.stream().filter(r -> {
                             Integer status = (Integer) r.get("status");
                             return ObjectUtil.equal(1,status);
                         }).findFirst();
                         String bfStatus = statusOptional.isPresent() ? String.valueOf(statusOptional.get().get("date")) : StringUtil.EMPTY_STRING;
                         // 布防时间
+                        PdfUtil.createPDFCell(tableFont, table, "布防时间", Element.ALIGN_MIDDLE, 2, 1);
                         PdfUtil.createPDFCell(tableFont, table, bfStatus, Element.ALIGN_MIDDLE, 3, 1);
                     }
                 }
 
             }
+
         }