|
|
|
@ -1,8 +1,19 @@
|
|
|
|
|
package com.ruoyi.web.controller.system.count;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
|
|
import cn.hutool.core.text.StrPool;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
|
|
|
import com.ruoyi.common.utils.ObtainLastSixMonthsUtil;
|
|
|
|
|
import com.ruoyi.system.domain.check.TdCheckReport;
|
|
|
|
|
import com.ruoyi.system.domain.userbook.dto.UserBookDTO;
|
|
|
|
|
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
|
|
|
|
|
import com.ruoyi.system.domain.userexam.dto.response.UserExamExportDTO;
|
|
|
|
@ -99,5 +110,71 @@ public class TdExamnumController extends BaseController {
|
|
|
|
|
return AjaxResult.success(userExamManager.selectCountExam());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*近6个月考试通过统计
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/countExamMonth")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult countExamMonth() {
|
|
|
|
|
List<String> recentlySixMonth = ObtainLastSixMonthsUtil.getRecentlySixMonth();
|
|
|
|
|
List<Long> yAxisData = new ArrayList<>();
|
|
|
|
|
recentlySixMonth.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 = userExamManager.countExamMonth(minDayTime, maxDayTime,true);
|
|
|
|
|
if(Objects.isNull(count)){
|
|
|
|
|
count = 0;
|
|
|
|
|
}
|
|
|
|
|
yAxis.set(Long.valueOf(count));
|
|
|
|
|
yAxisData.add(yAxis.get());
|
|
|
|
|
});
|
|
|
|
|
JSONObject obj = new JSONObject();
|
|
|
|
|
obj.put("xAxisData", recentlySixMonth.toArray());
|
|
|
|
|
obj.put("yAxisData", yAxisData);
|
|
|
|
|
return AjaxResult.success(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*近6个月考试未通过统计
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/countExamNoPass")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult countExamNoPass() {
|
|
|
|
|
List<String> recentlySixMonth = ObtainLastSixMonthsUtil.getRecentlySixMonth();
|
|
|
|
|
List<Long> yAxisData = new ArrayList<>();
|
|
|
|
|
recentlySixMonth.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 = userExamManager.countExamMonth(minDayTime, maxDayTime,false);
|
|
|
|
|
if(Objects.isNull(count)){
|
|
|
|
|
count = 0;
|
|
|
|
|
}
|
|
|
|
|
yAxis.set(Long.valueOf(count));
|
|
|
|
|
yAxisData.add(yAxis.get());
|
|
|
|
|
});
|
|
|
|
|
JSONObject obj = new JSONObject();
|
|
|
|
|
obj.put("xAxisData", recentlySixMonth.toArray());
|
|
|
|
|
obj.put("yAxisData", yAxisData);
|
|
|
|
|
return AjaxResult.success(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|