Browse Source

大屏

master
DX 1 month ago
parent
commit
b2b89afbe9
  1. 41
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/BigViewDataController.java
  2. 12
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/BigViewEnterpriseCountGroup.java
  3. 9
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/bigviewdata/vo/NameCountVO.java
  4. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/HomeCountResVO.java
  5. 10
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataService.java
  6. 15
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/bigviewdata/BigViewDataServiceImpl.java
  7. 31
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java
  8. 2
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

41
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<String> leftFirst() {
return null;
}
@GetMapping("/getLeftSecond ")
private List<BigViewEnterpriseCountGroup> getLeftSecond(HomeSelectVO homeSelectVO) {
return bigViewDataService.getLeftSecond(homeSelectVO);
}
@GetMapping("/getLeftThird")
private List<String> getLeftThird() {
return null;
}
}

12
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<NameCountVO> enterpriseCountGroup;
}

9
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;
}

2
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;

10
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<BigViewEnterpriseCountGroup> getLeftSecond(HomeSelectVO homeSelectVO);
}

15
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<BigViewEnterpriseCountGroup> getLeftSecond(HomeSelectVO homeSelectVO) {
return null;
}
}

31
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<EnterpriseDO> 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<HomeExecFinishVO> homeExecFinishVOS = taskInfoMapper.selectHomeExecFinish(homeSelectVO);
List<Integer> taskExecList = new ArrayList<>();
@ -145,4 +133,19 @@ public class HomeServiceImpl implements HomeService{
return taskInfoMapper.selectEnterpriseNum(homeSelectVO);
}
}
//查企业
public Integer getEnterpriseCount(HomeSelectVO homeSelectVO) {
LambdaQueryWrapper<EnterpriseDO> 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();
}
}

2
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

@ -68,7 +68,7 @@
</if>
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

Loading…
Cancel
Save