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); + } +