From 58e29cd915769e2ab95a90c6205217340b175eb2 Mon Sep 17 00:00:00 2001 From: wangxy <1481820854@qq.com> Date: Wed, 30 Oct 2024 11:07:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:pg=E6=95=B0=E6=8D=AE=E5=BA=93=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/manager/UserExamManager.java | 8 ++++- .../system/count/TdExamnumController.java | 13 ++++++-- .../system/domain/count/ExamManagerDTO.java | 31 +++++++++++++++++++ .../ruoyi/system/mapper/ElUserExamMapper.java | 9 ++++++ .../system/service/ElUserExamService.java | 5 +++ .../service/impl/ElUserExamServiceImpl.java | 7 +++++ .../mapper/system/ElUserExamMapper.xml | 5 ++- 7 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/count/ExamManagerDTO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserExamManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserExamManager.java index 5463012..5833f56 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserExamManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserExamManager.java @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.manager; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.ruoyi.system.domain.check.TdCheckReport; +import com.ruoyi.system.domain.count.ExamManagerDTO; import com.ruoyi.system.domain.paper.dto.request.PaperListReqDTO; import com.ruoyi.system.domain.paper.dto.response.PaperListRespDTO; import com.ruoyi.system.domain.userexam.ElUserExam; @@ -103,7 +104,7 @@ public class UserExamManager { return elUserExamService.selectCountExam(); } - public Integer countExamMonth(Date minDayTime, Date maxDayTime,Boolean passed){ + public Integer countExamMonths(Date minDayTime, Date maxDayTime,Boolean passed){ return new LambdaQueryChainWrapper<>(elUserExamService.getBaseMapper()) .ge(ElUserExam::getUpdateTime, minDayTime) .le(ElUserExam::getUpdateTime, maxDayTime) @@ -111,4 +112,9 @@ public class UserExamManager { .count(); } + public Integer countExamMonth(ExamManagerDTO examManagerDTO){ + return elUserExamService.countExamMonth(examManagerDTO); + + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdExamnumController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdExamnumController.java index cb8d919..53c05b4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdExamnumController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdExamnumController.java @@ -14,6 +14,7 @@ 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.count.ExamManagerDTO; 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; @@ -136,7 +137,11 @@ public class TdExamnumController extends BaseController { 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 = userExamManager.countExamMonth(minDayTime, maxDayTime,true); + ExamManagerDTO examManagerDTO = new ExamManagerDTO(); + examManagerDTO.setMinDayTime(minDayTime); + examManagerDTO.setMaxDayTime(maxDayTime); + examManagerDTO.setPassed(1); + Integer count = userExamManager.countExamMonth(examManagerDTO); if(Objects.isNull(count)){ count = 0; } @@ -169,7 +174,11 @@ public class TdExamnumController extends BaseController { 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 = userExamManager.countExamMonth(minDayTime, maxDayTime,false); + ExamManagerDTO examManagerDTO = new ExamManagerDTO(); + examManagerDTO.setMinDayTime(minDayTime); + examManagerDTO.setMaxDayTime(maxDayTime); + examManagerDTO.setPassed(0); + Integer count = userExamManager.countExamMonth(examManagerDTO); if(Objects.isNull(count)){ count = 0; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/ExamManagerDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/ExamManagerDTO.java new file mode 100644 index 0000000..2137d6b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/ExamManagerDTO.java @@ -0,0 +1,31 @@ +package com.ruoyi.system.domain.count; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * ClassName: PropertyManagerDTO + * Package: com.ruoyi.system.domain.count + * Description: + * + * @Author wangxy + * @Create 2024/10/8 16:21 + * @Version 1.0 + */ +@Data +@ApiModel(value="密品报废统计", description="密品报废统计") +public class ExamManagerDTO implements Serializable { + + + + private Date minDayTime; + + private Date maxDayTime; + + private Integer passed; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ElUserExamMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ElUserExamMapper.java index 2e362fb..9cbb9e8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ElUserExamMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ElUserExamMapper.java @@ -1,6 +1,7 @@ package com.ruoyi.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.system.domain.count.ExamManagerDTO; import com.ruoyi.system.domain.userexam.ElUserExam; import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO; import com.ruoyi.system.domain.userexam.dto.response.ExamCountDTO; @@ -8,6 +9,7 @@ import com.ruoyi.system.domain.userexam.dto.response.UserExamCountDTO; import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO; import org.apache.ibatis.annotations.Mapper; +import java.util.Date; import java.util.List; /** @@ -28,6 +30,13 @@ public interface ElUserExamMapper extends BaseMapper { public List selectCountExam(); + + public Integer countExamMonth(ExamManagerDTO examManagerDTO); + + + + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ElUserExamService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ElUserExamService.java index 9f0bc63..a3feb92 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ElUserExamService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ElUserExamService.java @@ -1,6 +1,7 @@ package com.ruoyi.system.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.system.domain.count.ExamManagerDTO; import com.ruoyi.system.domain.exam.dto.ExamDTO; import com.ruoyi.system.domain.userexam.ElUserExam; import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO; @@ -8,6 +9,7 @@ import com.ruoyi.system.domain.userexam.dto.response.ExamCountDTO; import com.ruoyi.system.domain.userexam.dto.response.UserExamCountDTO; import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO; +import java.util.Date; import java.util.List; /** @@ -27,4 +29,7 @@ public interface ElUserExamService extends IService { public List selectCountExam(); + + public Integer countExamMonth(ExamManagerDTO examManagerDTO); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ElUserExamServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ElUserExamServiceImpl.java index 9621c11..baebd76 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ElUserExamServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ElUserExamServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.system.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.system.domain.count.ExamManagerDTO; import com.ruoyi.system.domain.exam.dto.ExamDTO; import com.ruoyi.system.domain.userexam.ElUserExam; import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO; @@ -12,6 +13,7 @@ import com.ruoyi.system.service.ElUserExamService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; /** @@ -40,6 +42,11 @@ public class ElUserExamServiceImpl extends ServiceImpl selectCountExam() { return userExamMapper.selectCountExam(); } + + @Override + public Integer countExamMonth(ExamManagerDTO examManagerDTO) { + return userExamMapper.countExamMonth(examManagerDTO); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/ElUserExamMapper.xml b/ruoyi-system/src/main/resources/mapper/system/ElUserExamMapper.xml index fee8906..80e2720 100644 --- a/ruoyi-system/src/main/resources/mapper/system/ElUserExamMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/ElUserExamMapper.xml @@ -65,8 +65,11 @@ exam_id ORDER BY u.create_time desc LIMIT 10 +