From 36964d1308e7c1377443dcae12c435532120a2a4 Mon Sep 17 00:00:00 2001 From: 20918 <2091823062@qq.com> Date: Tue, 8 Oct 2024 17:14:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E8=AE=AE=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/count/SysMeetingnumController.java | 95 +++++++++++++++++++ .../tdmeeting/meetingnum/meetingnum.html | 10 ++ 2 files changed, 105 insertions(+) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysMeetingnumController.java create mode 100644 ruoyi-admin/src/main/resources/templates/system/tdmeeting/meetingnum/meetingnum.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysMeetingnumController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysMeetingnumController.java new file mode 100644 index 0000000..3c79812 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysMeetingnumController.java @@ -0,0 +1,95 @@ +package com.ruoyi.web.controller.system.count; + +import cn.hutool.core.text.StrPool; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.ObtainLastSixMonthsUtil; +import com.ruoyi.system.domain.TdMeeting; +import com.ruoyi.system.service.TdMeetingService; +import com.ruoyi.web.controller.manager.TdMeetingManager; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; + +/** + * 涉密会议统计 + */ +@Controller +@RequestMapping("/system/meetingnum") +public class SysMeetingnumController extends BaseController { + + private String prefix = "system/tdmeeting/meetingnum"; + @Resource + private TdMeetingService tdMeetingService; + @Resource + private TdMeetingManager tdMeetingManager; + + @RequiresPermissions("system:meetingnum:view") + @GetMapping() + public String meetingnum() { + return prefix + "/meetingnum"; + } + + /** + * 会议列表 + */ + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(TdMeeting tdMeeting) { + startPage(); + List tdMeetings = tdMeetingManager.selectTdMeetingList(tdMeeting); + return getDataTable(tdMeetings); + } + + /** + * 会议12个月统计 + * + * @return + */ + @PostMapping("/countMeetingMonth") + @ResponseBody + public AjaxResult countMeetingMonth() { + List recentlyTwelveMonth = ObtainLastSixMonthsUtil.getRecentlyTwelveMonth(); + List yAxisData = new ArrayList<>(); + recentlyTwelveMonth.forEach(month -> { + // 获取指定月份的最大日期 + String lastDayOfMonth = ObtainLastSixMonthsUtil.getLastDayOfMonth(month); + // 获取指定天的最大时间 + Date date = Date.from(LocalDate.parse(lastDayOfMonth).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); + Date maxDayTime = ObtainLastSixMonthsUtil.getEndOfDay(date); + // 获取最小时间 + date = Date.from(LocalDate.parse(month.concat(StrPool.DASHED).concat("01")).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); + Date minDayTime = ObtainLastSixMonthsUtil.getStartOfDay(date); + AtomicReference yAxis = new AtomicReference<>(0L); + Integer count = new LambdaQueryChainWrapper<>(tdMeetingService.getBaseMapper()) + .ge(TdMeeting::getMeetingTime, minDayTime) + .le(TdMeeting::getMeetingTime, maxDayTime).count(); + if (Objects.isNull(count)) { + count = 0; + } + yAxis.set(Long.valueOf(count)); + yAxisData.add(yAxis.get()); + }); + JSONObject obj = new JSONObject(); + obj.put("xAxisData", recentlyTwelveMonth.toArray()); + obj.put("yAxisData", yAxisData); + return AjaxResult.success(obj); + } + + +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/tdmeeting/meetingnum/meetingnum.html b/ruoyi-admin/src/main/resources/templates/system/tdmeeting/meetingnum/meetingnum.html new file mode 100644 index 0000000..c4ec13a --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/tdmeeting/meetingnum/meetingnum.html @@ -0,0 +1,10 @@ + + + + + Title + + +1 + + \ No newline at end of file