Explorar el Código

Merge branch 'master' of http://124.70.58.209:3000/ytrd-project-management/GeoHazardMonitor

gao.qiang hace 1 año
padre
commit
584044e5df

+ 52 - 2
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -696,17 +696,67 @@ public class MsgAlarmController extends BaseController {
         if (user.isAdmin(user.getId())) {
             userId = "";
         }
-
+        String sheetName = "报警年统计数据";
+        List<Integer> numbs = new ArrayList<>();
+        Integer listSize;
         List<AlarmStatisticMonthDto> list = null;
         if (ObjectUtils.isEmpty(alarmStatisticResVo.getCurrentMonth())) {
             list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
                     alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
+            listSize = 12;
         } else {
+            sheetName = "报警月统计数据";
+            if (alarmStatisticResVo.getCurrentMonth().equals(2)) {//2
+                listSize = 28;
+            } else if (alarmStatisticResVo.getCurrentMonth().equals(4) || alarmStatisticResVo.getCurrentMonth().equals(6) ||
+                    alarmStatisticResVo.getCurrentMonth().equals(9) || alarmStatisticResVo.getCurrentMonth().equals(11)) {//4,6,9,11
+                listSize = 30;
+            } else {//1,3,5,7,8,10,12
+                listSize = 31;
+            }
             list = msgAlarmService.getDayCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
                     alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
         }
+        if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+            for (int i = 1; i <= listSize; i++) {
+                numbs.add(i);
+            }
+            List<Integer> list1 = new ArrayList<>();
+            if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+                list.forEach(l -> {
+                    list1.add(l.getMonthsta());
+                });
+            }
+            AlarmStatisticMonthDto dto;
+            for (int i = 0; i < numbs.size(); i++) {
+                if (!list1.contains(numbs.get(i))) {
+                    dto = new AlarmStatisticMonthDto();
+                    String split = numbs.get(i).toString();
+                    if (numbs.get(i) <= 9) {
+                        split = "0" + numbs.get(i);
+                    }
+                    if (ObjectUtils.isEmpty(alarmStatisticResVo.getCurrentMonth())) {//年数据
+                        dto.setMonthstaString(list.get(0).getMonthstaString().substring(0, 5) + split + "月");
+                    } else {//月数据
+                        dto.setMonthstaString(list.get(0).getMonthstaString().substring(0, 8) + split + "日");
+                    }
+                    dto.setMonthsta(numbs.get(i));
+                    dto.setFrequency(0);
+                    list.add(dto);
+                }
+            }
+        }
+        if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+            Collections.sort(list, new Comparator<AlarmStatisticMonthDto>() {
+                @Override
+                public int compare(AlarmStatisticMonthDto o1, AlarmStatisticMonthDto o2) {
+
+                    return o1.getMonthsta().compareTo(o2.getMonthsta());
+                }
+            });
+        }
         ExcelUtil<AlarmStatisticMonthDto> util = new ExcelUtil<>(AlarmStatisticMonthDto.class);
-        util.exportExcel(response, list, "报警月统计数据");
+        util.exportExcel(response, list, sheetName);
     }
 }
 

+ 3 - 3
hazard-admin/src/main/java/com/ozs/web/controller/system/SysDeptController.java

@@ -178,13 +178,13 @@ public class SysDeptController extends BaseController {
         return toAjax(deptService.deleteDeptById(deptId));
     }
 
-    @Log(title = "部门管理" , businessType = BusinessType.EXPORT)
+    @Log(title = "部门导出", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:role:export')")
     @PostMapping("/export")
-    @ApiOperation("部门管理")
+    @ApiOperation("部门导出")
     public void export(HttpServletResponse response, SysDept dept) {
         List<SysDept> list = deptService.selectDeptListAll(dept);
         ExcelUtil<SysDept> util = new ExcelUtil<SysDept>(SysDept.class);
-        util.exportExcel(response, list, "角色数据");
+        util.exportExcel(response, list, "部门数据");
     }
 }

+ 3 - 3
hazard-admin/src/main/java/com/ozs/web/controller/system/SysMenuController.java

@@ -137,10 +137,10 @@ public class SysMenuController extends BaseController {
         return toAjax(menuService.deleteMenuById(menuId));
     }
 
-    @Log(title = "菜单管理", businessType = BusinessType.EXPORT)
+    @Log(title = "菜单导出", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:menu:export')")
     @PostMapping("/export")
-    @ApiOperation("菜单管理")
+    @ApiOperation("菜单导出")
     public void export(HttpServletResponse response, SysMenu menu) {
         LoginUser loginUser = getLoginUser();
         List<SysMenu> list = menuService.selectMenuList(menu, loginUser.getId());
@@ -153,6 +153,6 @@ public class SysMenuController extends BaseController {
             }
         }
         ExcelUtil<SysMenu> util = new ExcelUtil<SysMenu>(SysMenu.class);
-        util.exportExcel(response, list, "角色数据");
+        util.exportExcel(response, list, "菜单数据");
     }
 }