From b2b89afbe946ba6cb10d2437afeecba8fd0ce0eb Mon Sep 17 00:00:00 2001 From: dx <1242347652@qq.com> Date: Fri, 21 Feb 2025 08:58:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigviewdata/BigViewDataController.java | 41 +++++++++++++++++++ .../vo/BigViewEnterpriseCountGroup.java | 12 ++++++ .../admin/bigviewdata/vo/NameCountVO.java | 9 ++++ .../admin/home/vo/HomeCountResVO.java | 2 +- .../bigviewdata/BigViewDataService.java | 10 +++++ .../bigviewdata/BigViewDataServiceImpl.java | 15 +++++++ .../system/service/home/HomeServiceImpl.java | 31 +++++++------- .../mapper/taskinfo/TaskInfoMapper.xml | 2 +- 8 files changed, 106 insertions(+), 16 deletions(-) create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/BigViewDataController.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/BigViewEnterpriseCountGroup.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/NameCountVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataService.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataServiceImpl.java diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/BigViewDataController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/BigViewDataController.java new file mode 100644 index 0000000..64c43c5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/BigViewDataController.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.system.controller.admin.bigviewdata; + +import cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo.BigViewEnterpriseCountGroup; +import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeSelectVO; +import cn.iocoder.yudao.module.system.service.bigviewdata.BigViewDataService; +import cn.iocoder.yudao.module.system.service.home.HomeService; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +@Tag(name = "管理后台 - app首页统计") +@RestController +@RequestMapping("/system/big-view-data") +@Validated +@Slf4j +public class BigViewDataController { + + @Resource + private BigViewDataService bigViewDataService; + + @GetMapping("/getLeftFist") + private List leftFirst() { + return null; + } + + @GetMapping("/getLeftSecond ") + private List getLeftSecond(HomeSelectVO homeSelectVO) { + return bigViewDataService.getLeftSecond(homeSelectVO); + } + + @GetMapping("/getLeftThird") + private List getLeftThird() { + return null; + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/BigViewEnterpriseCountGroup.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/BigViewEnterpriseCountGroup.java new file mode 100644 index 0000000..7c38fa4 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/BigViewEnterpriseCountGroup.java @@ -0,0 +1,12 @@ +package cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo; + +import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeListVO; +import lombok.Data; + +import java.util.List; + +@Data +public class BigViewEnterpriseCountGroup { + private Integer enterpriseCount; + private List enterpriseCountGroup; +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/NameCountVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/NameCountVO.java new file mode 100644 index 0000000..7023f31 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/NameCountVO.java @@ -0,0 +1,9 @@ +package cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo; + +import lombok.Data; + +@Data +public class NameCountVO { + private String name; + private Integer count; +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/HomeCountResVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/HomeCountResVO.java index 713d61d..4a8374c 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/HomeCountResVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/HomeCountResVO.java @@ -11,7 +11,7 @@ public class HomeCountResVO { private Integer taskCount; //执法总数 private Integer inspectionsCount; - private Long enterpriseCount; + private Integer enterpriseCount; //总任务完成率 private String taskCompletionRate; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataService.java new file mode 100644 index 0000000..a5fdfce --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataService.java @@ -0,0 +1,10 @@ +package cn.iocoder.yudao.module.system.service.bigviewdata; + +import cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo.BigViewEnterpriseCountGroup; +import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeSelectVO; + +import java.util.List; + +public interface BigViewDataService { + List getLeftSecond(HomeSelectVO homeSelectVO); +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataServiceImpl.java new file mode 100644 index 0000000..5e2b031 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataServiceImpl.java @@ -0,0 +1,15 @@ +package cn.iocoder.yudao.module.system.service.bigviewdata; + +import cn.iocoder.yudao.module.system.controller.admin.bigviewdata.vo.BigViewEnterpriseCountGroup; +import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeSelectVO; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class BigViewDataServiceImpl implements BigViewDataService { + @Override + public List getLeftSecond(HomeSelectVO homeSelectVO) { + return null; + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java index 76f09dc..9edd8a5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java @@ -44,23 +44,11 @@ public class HomeServiceImpl implements HomeService{ HomeCountResVO homeCountResVO = new HomeCountResVO(); - LambdaQueryWrapper enterpriseDOLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - //按时间查询 - if (homeSelectVO.getSelectWeek() != null) { - final LocalDateTime[] weekDate = this.getWeekDate(homeSelectVO.getSelectWeek()); - - enterpriseDOLambdaQueryWrapper.between(EnterpriseDO::getCreateTime, weekDate[0], weekDate[1]); - } - - enterpriseDOLambdaQueryWrapper.eq(homeSelectVO.getDeptId() != null, EnterpriseDO::getDepartmentId, homeSelectVO.getDeptId()); - - final Long enterpriseCount = enterpriseMapper.selectCount(enterpriseDOLambdaQueryWrapper); - + //查企业 + final Integer enterpriseCount = this.getEnterpriseCount(homeSelectVO); homeCountResVO.setEnterpriseCount(enterpriseCount); //查询任务和执法 - final List homeExecFinishVOS = taskInfoMapper.selectHomeExecFinish(homeSelectVO); List taskExecList = new ArrayList<>(); @@ -145,4 +133,19 @@ public class HomeServiceImpl implements HomeService{ return taskInfoMapper.selectEnterpriseNum(homeSelectVO); } } + + //查企业 + public Integer getEnterpriseCount(HomeSelectVO homeSelectVO) { + LambdaQueryWrapper enterpriseDOLambdaQueryWrapper = new LambdaQueryWrapper<>(); + //按时间查询 + if (homeSelectVO.getSelectWeek() != null) { + final LocalDateTime[] weekDate = this.getWeekDate(homeSelectVO.getSelectWeek()); + enterpriseDOLambdaQueryWrapper.between(EnterpriseDO::getCreateTime, weekDate[0], weekDate[1]); + } + enterpriseDOLambdaQueryWrapper.eq(homeSelectVO.getDeptId() != null, EnterpriseDO::getDepartmentId, homeSelectVO.getDeptId()); + final Long enterpriseCount = enterpriseMapper.selectCount(enterpriseDOLambdaQueryWrapper); + return enterpriseCount.intValue(); + } + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml index fb41c7d..13641d8 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml @@ -68,7 +68,7 @@ SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) as finishCount, COUNT(DISTINCT ei.id) as execCount, - COUNT(DISTINCT ei.id) AS total_count , -- 计算每个 user_id 的总数 + COUNT(DISTINCT ei.id) AS totalCount , -- 计算每个 user_id 的总数 round( SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) /COUNT(DISTINCT ei.id) * 100,1) as completionRate FROM enterprise_inspections ei