From e64d45013d6bfdf867d090f70030be9c94ace353 Mon Sep 17 00:00:00 2001 From: wangxy <1356089412@qq.com> Date: Fri, 23 Aug 2024 14:18:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=BD=BD=E4=BD=93=E7=BB=B4=E4=BF=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/count/TdChecknumController.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdChecknumController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdChecknumController.java index 6e49c0c..7a7d42d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdChecknumController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdChecknumController.java @@ -3,8 +3,12 @@ package com.ruoyi.web.controller.system.count; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.system.domain.TdPropertyInfo; +import com.ruoyi.system.domain.check.TdCheckReport; import com.ruoyi.system.domain.count.CheckResultCountDTO; import com.ruoyi.system.domain.count.CheckTypeCountDTO; +import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ITdNotifyService; import com.ruoyi.system.service.check.TdCheckReportService; import io.swagger.annotations.ApiOperation; @@ -20,6 +24,7 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -107,6 +112,39 @@ public class TdChecknumController extends BaseController{ return AjaxResult.success(datas); } + @Autowired + private ISysDictDataService dictDataService; + + /** + * + *检查类型统计 + * @return + */ + @PostMapping("/countType") + @ResponseBody + public AjaxResult countType() { + SysDictData sysDictData = new SysDictData(); + sysDictData.setDictType("sys_check_type"); + List smType = dictDataService.selectDictDataList(sysDictData); + List list = smType.stream().map(SysDictData::getDictLabel).collect(Collectors.toList()); + List yAxisData = new ArrayList<>(); + smType.forEach(xAxis -> { + AtomicReference yAxis = new AtomicReference<>(0L); + Integer count = checkReportService.lambdaQuery() + .eq(TdCheckReport::getCheckType, xAxis.getDictValue()) + .count(); + if(Objects.isNull(count)){ + count = 0; + } + yAxis.set(Long.valueOf(count)); + yAxisData.add(yAxis.get()); + }); + JSONObject obj = new JSONObject(); + obj.put("xAxisData", list.toArray()); + obj.put("yAxisData", yAxisData); + return AjaxResult.success(obj); + } +