diff --git a/modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/PubCockpitController.java b/modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/PubCockpitController.java index 12ac3b6..413a4eb 100644 --- a/modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/PubCockpitController.java +++ b/modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/PubCockpitController.java @@ -2,6 +2,7 @@ package com.thing.carbon.pub.controller; import com.thing.carbon.pub.dto.CockpitEnterpriseInfo; +import com.thing.carbon.pub.dto.CockpitStatisticsDto; import com.thing.carbon.pub.service.PubCockpitService; import com.thing.common.core.web.response.Result; import io.swagger.v3.oas.annotations.Operation; @@ -36,13 +37,11 @@ public class PubCockpitController { return new Result>().ok(list); } - - @GetMapping("statistics") @Operation(summary="中间六个统计") - public Result> statistics(){ - List list = pubCockpitService.cockpitEnterpriseInfoList(); - return new Result>().ok(list); + public Result statistics(){ + CockpitStatisticsDto statisticsDto = pubCockpitService.statistics(); + return new Result().ok(statisticsDto); } diff --git a/modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitStatisticsDto.java b/modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitStatisticsDto.java index e081d10..9409388 100644 --- a/modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitStatisticsDto.java +++ b/modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitStatisticsDto.java @@ -11,10 +11,18 @@ import lombok.Data; @Schema(description = "国网侧驾驶舱中间六个统计信息") public class CockpitStatisticsDto { - - - - + @Schema(description = "服务企业数") + private Long enterprisesCount; + @Schema(description = "服务产品数") + private Long productsCount; + @Schema(description = "工艺模型数") + private Long processCount; + @Schema(description = "碳足迹结果") + private Long carbonReportCount; + @Schema(description = "排放因子库调用次数") + private Long carbonLibCount; + @Schema(description = "累计产品碳足迹背景数据") + private Long carbonCount; } diff --git a/modules/carbon-public/src/main/java/com/thing/carbon/pub/service/PubCockpitService.java b/modules/carbon-public/src/main/java/com/thing/carbon/pub/service/PubCockpitService.java index f1d7bf5..a06370d 100644 --- a/modules/carbon-public/src/main/java/com/thing/carbon/pub/service/PubCockpitService.java +++ b/modules/carbon-public/src/main/java/com/thing/carbon/pub/service/PubCockpitService.java @@ -1,6 +1,7 @@ package com.thing.carbon.pub.service; import com.thing.carbon.pub.dto.CockpitEnterpriseInfo; +import com.thing.carbon.pub.dto.CockpitStatisticsDto; import java.util.List; @@ -8,4 +9,6 @@ public interface PubCockpitService { List cockpitEnterpriseInfoList(); + + CockpitStatisticsDto statistics(); } diff --git a/modules/carbon-public/src/main/java/com/thing/carbon/pub/service/impl/PubCockpitServiceImpl.java b/modules/carbon-public/src/main/java/com/thing/carbon/pub/service/impl/PubCockpitServiceImpl.java index eb1ccfd..e02839a 100644 --- a/modules/carbon-public/src/main/java/com/thing/carbon/pub/service/impl/PubCockpitServiceImpl.java +++ b/modules/carbon-public/src/main/java/com/thing/carbon/pub/service/impl/PubCockpitServiceImpl.java @@ -1,6 +1,10 @@ package com.thing.carbon.pub.service.impl; +import com.mybatisflex.core.query.QueryWrapper; import com.thing.carbon.pub.dto.CockpitEnterpriseInfo; +import com.thing.carbon.pub.dto.CockpitStatisticsDto; +import com.thing.carbon.pub.mapper.CarbonPubProductionModelMapper; +import com.thing.carbon.pub.mapper.CarbonPubProductionReportMapper; import com.thing.carbon.pub.mapper.CarbonPubSupplierMapper; import com.thing.carbon.pub.mapper.PubCockpitMapper; import com.thing.carbon.pub.service.PubCockpitService; @@ -23,6 +27,12 @@ public class PubCockpitServiceImpl implements PubCockpitService { @Autowired private CarbonPubSupplierMapper carbonPubSupplierMapper; + @Autowired + private CarbonPubProductionModelMapper carbonPubProductionModelMapper; + + @Autowired + private CarbonPubProductionReportMapper carbonPubProductionReportMapper; + @Override public List cockpitEnterpriseInfoList() { @@ -39,4 +49,32 @@ public class PubCockpitServiceImpl implements PubCockpitService { }); return infoList; } + + + + + + @Override + public CockpitStatisticsDto statistics() { + CockpitStatisticsDto dto = new CockpitStatisticsDto(); + + Long enterprisesCount = carbonPubSupplierMapper.selectCountByQuery(QueryWrapper.create()); + dto.setEnterprisesCount(enterprisesCount); + + Long processCount = carbonPubProductionModelMapper.selectCountByQuery(QueryWrapper.create()); + dto.setProcessCount(processCount); + + Long productsCount = carbonPubProductionReportMapper.selectCountByQuery(QueryWrapper.create().select()); + dto.setProductsCount(productsCount); + + Long carbonReportCount = carbonPubProductionReportMapper.selectCountByQuery(QueryWrapper.create()); + dto.setCarbonReportCount(carbonReportCount); + + + + + + return null; + } + } diff --git a/modules/thing/src/main/java/com/thing/thing/api/entity/IotThingApiLogEntity.java b/modules/thing/src/main/java/com/thing/thing/api/entity/IotThingApiLogEntity.java index 7c682aa..ebc3e3c 100644 --- a/modules/thing/src/main/java/com/thing/thing/api/entity/IotThingApiLogEntity.java +++ b/modules/thing/src/main/java/com/thing/thing/api/entity/IotThingApiLogEntity.java @@ -1,15 +1,12 @@ package com.thing.thing.api.entity; import com.mybatisflex.annotation.Table; -import com.thing.common.core.validator.group.UpdateGroup; import com.thing.common.orm.entity.BaseDateEntity; - import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; -import javax.validation.constraints.NotNull; import java.io.Serial; /** @@ -27,9 +24,9 @@ public class IotThingApiLogEntity extends BaseDateEntity { private static final long serialVersionUID = 1L; - @Schema(description = "主键") - @NotNull(message = "API日志id不能为空",groups = UpdateGroup.class) - private Long id; +// @Schema(description = "主键") +// @NotNull(message = "API日志id不能为空",groups = UpdateGroup.class) +// private Long id; /** * 调用API的主键 diff --git a/modules/thing/src/main/java/com/thing/thing/api/service/IotThingApiLogService.java b/modules/thing/src/main/java/com/thing/thing/api/service/IotThingApiLogService.java index 90dd25d..0626b1d 100644 --- a/modules/thing/src/main/java/com/thing/thing/api/service/IotThingApiLogService.java +++ b/modules/thing/src/main/java/com/thing/thing/api/service/IotThingApiLogService.java @@ -3,8 +3,6 @@ package com.thing.thing.api.service; import com.thing.common.orm.service.IBaseService; import com.thing.thing.api.entity.IotThingApiLogEntity; -; - /** * 超级api * diff --git a/modules/thing/src/main/java/com/thing/thing/api/service/impl/IotThingApiServiceImpl.java b/modules/thing/src/main/java/com/thing/thing/api/service/impl/IotThingApiServiceImpl.java index efd5fac..666187a 100644 --- a/modules/thing/src/main/java/com/thing/thing/api/service/impl/IotThingApiServiceImpl.java +++ b/modules/thing/src/main/java/com/thing/thing/api/service/impl/IotThingApiServiceImpl.java @@ -29,6 +29,7 @@ import com.thing.sys.security.context.UserContext; import com.thing.thing.api.controller.IotThingApiController; import com.thing.thing.api.dto.*; import com.thing.thing.api.entity.IotThingApiEntity; +import com.thing.thing.api.entity.IotThingApiLogEntity; import com.thing.thing.api.excel.IotThingApiExcel; import com.thing.thing.api.mapper.IotThingApiMapper; import com.thing.thing.api.service.IotThingApiLogService; @@ -823,7 +824,7 @@ public class IotThingApiServiceImpl extends BaseServiceImpl