parent
be7e112e5f
commit
36964d1308
@ -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<TdMeeting> tdMeetings = tdMeetingManager.selectTdMeetingList(tdMeeting);
|
||||
return getDataTable(tdMeetings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会议12个月统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/countMeetingMonth")
|
||||
@ResponseBody
|
||||
public AjaxResult countMeetingMonth() {
|
||||
List<String> recentlyTwelveMonth = ObtainLastSixMonthsUtil.getRecentlyTwelveMonth();
|
||||
List<Long> 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<Long> 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
1
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue