From 057a8f48e67966cfafa2d9c5f0b9d0a9d397a4a2 Mon Sep 17 00:00:00 2001 From: liriming <1343021927@qq.com> Date: 星期一, 17 三月 2025 14:59:23 +0800 Subject: [PATCH] 发电厂机组运行情况 --- /dev/null | 22 ------- ansteel-biz/src/main/java/com/iailab/module/ansteel/api/McsServiceImpl.java | 18 +++-- ansteel-api/src/main/java/com/iailab/module/sms/api/AnSteelApi.java | 27 +++++++++ ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/McsController.java | 36 ++++++++++++ ansteel-biz/src/main/java/com/iailab/module/ansteel/api/entity/ProductProcessEntity.java | 2 ansteel-api/src/main/java/com/iailab/module/sms/enums/ApiConstants.java | 21 +++++++ ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dao/PowerRunStateDao.java | 4 ansteel-api/src/main/java/com/iailab/module/sms/api/dto/PowerRunStateDTO.java | 26 ++++++++ ansteel-biz/src/main/java/com/iailab/module/ansteel/api/entity/PowerRunStateEntity.java | 2 ansteel-biz/pom.xml | 16 +++- 10 files changed, 135 insertions(+), 39 deletions(-) diff --git a/ansteel-api/src/main/java/com/iailab/module/sms/api/AnSteelApi.java b/ansteel-api/src/main/java/com/iailab/module/sms/api/AnSteelApi.java new file mode 100644 index 0000000..81d5dbc --- /dev/null +++ b/ansteel-api/src/main/java/com/iailab/module/sms/api/AnSteelApi.java @@ -0,0 +1,27 @@ +package com.iailab.module.model.api.mcs; + +import com.iailab.module.sms.api.dto.PowerRunStateDTO; +import com.iailab.module.sms.enums.ApiConstants; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +import java.util.List; + +/** + * @author lirm + * @Description + * @createTime 2025年03月17日 + */ +@FeignClient(name = ApiConstants.NAME) +@Tag(name = "RPC 服务 - 信息接口") +public interface AnSteelApi { + + String PREFIX = ApiConstants.PREFIX + "/mcs"; + + @GetMapping(PREFIX + "/power-run-state/list") + @Operation(summary = "发电厂机组运行情况") + List<PowerRunStateDTO> getPowerRunState(); + +} \ No newline at end of file diff --git a/ansteel-api/src/main/java/com/iailab/module/sms/api/dto/PowerRunStateDTO.java b/ansteel-api/src/main/java/com/iailab/module/sms/api/dto/PowerRunStateDTO.java new file mode 100644 index 0000000..4fbe762 --- /dev/null +++ b/ansteel-api/src/main/java/com/iailab/module/sms/api/dto/PowerRunStateDTO.java @@ -0,0 +1,26 @@ +package com.iailab.module.sms.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author lirm + * @date 2025年03月13日 + */ +@Data +public class PowerRunStateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + private String machineName; + private String qhRate; + private String fhRate; + private String gasTotal; + private String gasCost; + private String gasSurplus; + private String bfg; + private String ldg; + private String cog; +} diff --git a/ansteel-api/src/main/java/com/iailab/module/sms/enums/ApiConstants.java b/ansteel-api/src/main/java/com/iailab/module/sms/enums/ApiConstants.java new file mode 100644 index 0000000..9945287 --- /dev/null +++ b/ansteel-api/src/main/java/com/iailab/module/sms/enums/ApiConstants.java @@ -0,0 +1,21 @@ +package com.iailab.module.sms.enums; + +import com.iailab.framework.common.enums.RpcConstants; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年08月26日 + */ +public class ApiConstants { + /** + * 服务名 + * + * 注意,需要保证和 spring.application.name 保持一致 + */ + public static final String NAME = "model-server"; + + public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/model"; + + public static final String VERSION = "1.0.0"; +} \ No newline at end of file diff --git a/ansteel-biz/pom.xml b/ansteel-biz/pom.xml index b678ed3..95b3e65 100644 --- a/ansteel-biz/pom.xml +++ b/ansteel-biz/pom.xml @@ -19,11 +19,11 @@ <dependencies> <!-- 依赖服务 --> -<!-- <dependency>--> -<!-- <groupId>com.iailab</groupId>--> -<!-- <artifactId>ansteel-api</artifactId>--> -<!-- <version>${revision}</version>--> -<!-- </dependency>--> + <dependency> + <groupId>com.iailab</groupId> + <artifactId>ansteel-api</artifactId> + <version>${revision}</version> + </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-module-infra-api</artifactId> @@ -125,6 +125,12 @@ <groupId>com.iailab</groupId> <artifactId>iailab-common-mq</artifactId> </dependency> + <dependency> + <groupId>com.iailab</groupId> + <artifactId>ansteel-api</artifactId> + <version>1.0.0</version> + <scope>compile</scope> + </dependency> </dependencies> diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/impl/PowerRunStateServiceImpl.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/McsServiceImpl.java similarity index 83% rename from ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/impl/PowerRunStateServiceImpl.java rename to ansteel-biz/src/main/java/com/iailab/module/ansteel/api/McsServiceImpl.java index bb6ce60..1311665 100644 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/impl/PowerRunStateServiceImpl.java +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/McsServiceImpl.java @@ -1,12 +1,11 @@ -package com.iailab.module.ansteel.mpk.service.impl; +package com.iailab.module.ansteel.api; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.ConvertUtils; -import com.iailab.module.ansteel.mpk.dao.PowerRunStateDao; -import com.iailab.module.ansteel.mpk.entity.PowerRunStateEntity; -import com.iailab.module.ansteel.mpk.service.PowerRunStateService; +import com.iailab.module.ansteel.api.dao.PowerRunStateDao; import com.iailab.module.data.api.point.DataPointApi; +import com.iailab.module.model.api.mcs.AnSteelApi; +import com.iailab.module.sms.api.dto.PowerRunStateDTO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,14 +20,17 @@ @Slf4j @Service -public class PowerRunStateServiceImpl extends BaseServiceImpl<PowerRunStateDao, PowerRunStateEntity> implements PowerRunStateService { +public class McsServiceImpl implements AnSteelApi { @Autowired private DataPointApi dataPointApi; + @Autowired + private PowerRunStateDao powerRunStateDao; + @Override - public List<PowerRunStateEntity> list() { - List<PowerRunStateEntity> list = baseDao.selectList(new QueryWrapper<>()); + public List<PowerRunStateDTO> getPowerRunState() { + List<PowerRunStateDTO> list = ConvertUtils.sourceToTarget(powerRunStateDao.selectList(new QueryWrapper<>()), PowerRunStateDTO.class); if (!CollectionUtils.isEmpty(list)) { list.stream().map(item -> { StringBuffer sb = new StringBuffer(); diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/McsController.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/McsController.java new file mode 100644 index 0000000..f281cf1 --- /dev/null +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/McsController.java @@ -0,0 +1,36 @@ +package com.iailab.module.ansteel.api.controller; + +import com.iailab.framework.common.pojo.CommonResult; +import com.iailab.module.model.api.mcs.AnSteelApi; +import com.iailab.module.sms.api.dto.PowerRunStateDTO; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +import static com.iailab.framework.common.pojo.CommonResult.success; + +/** + * @author: lirm + * @date: 2025/03/17 + **/ +@Tag(name = "发电厂机组运行情况") +@RestController +@RequestMapping("/mcs/power-run-state") +public class McsController { + + @Autowired + private AnSteelApi anSteelApi; + + @GetMapping("list") + public CommonResult<List<PowerRunStateDTO>> list(@RequestParam Map<String, Object> params) { + List<PowerRunStateDTO> list = anSteelApi.getPowerRunState(); + return success(list); + } + +} \ No newline at end of file diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/dao/PowerRunStateDao.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dao/PowerRunStateDao.java similarity index 70% rename from ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/dao/PowerRunStateDao.java rename to ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dao/PowerRunStateDao.java index cc689f7..c8eb3db 100644 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/dao/PowerRunStateDao.java +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dao/PowerRunStateDao.java @@ -1,8 +1,8 @@ -package com.iailab.module.ansteel.mpk.dao; +package com.iailab.module.ansteel.api.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; -import com.iailab.module.ansteel.mpk.entity.PowerRunStateEntity; +import com.iailab.module.ansteel.api.entity.PowerRunStateEntity; import org.apache.ibatis.annotations.Mapper; @TenantDS diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/entity/PowerRunStateEntity.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/entity/PowerRunStateEntity.java similarity index 95% rename from ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/entity/PowerRunStateEntity.java rename to ansteel-biz/src/main/java/com/iailab/module/ansteel/api/entity/PowerRunStateEntity.java index 6321ef9..dab3187 100644 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/entity/PowerRunStateEntity.java +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/entity/PowerRunStateEntity.java @@ -1,4 +1,4 @@ -package com.iailab.module.ansteel.mpk.entity; +package com.iailab.module.ansteel.api.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/entity/ProductProcessEntity.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/entity/ProductProcessEntity.java similarity index 95% rename from ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/entity/ProductProcessEntity.java rename to ansteel-biz/src/main/java/com/iailab/module/ansteel/api/entity/ProductProcessEntity.java index 014234b..c1a2cb4 100644 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/entity/ProductProcessEntity.java +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/api/entity/ProductProcessEntity.java @@ -1,4 +1,4 @@ -package com.iailab.module.ansteel.mpk.entity; +package com.iailab.module.ansteel.api.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/controller/PowerRunStateController.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/controller/PowerRunStateController.java deleted file mode 100644 index 88997fc..0000000 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/controller/PowerRunStateController.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iailab.module.ansteel.mpk.controller; - -import com.iailab.framework.common.pojo.CommonResult; -import com.iailab.module.ansteel.mpk.entity.PowerRunStateEntity; -import com.iailab.module.ansteel.mpk.service.PowerRunStateService; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; -import java.util.Map; - -import static com.iailab.framework.common.pojo.CommonResult.success; - -/** - * @author: lirm - * @date: 2025/03/17 - **/ -@Tag(name = "发电厂机组运行情况") -@RestController -@RequestMapping("/mpk/power-run-state") -public class PowerRunStateController { - - @Autowired - private PowerRunStateService powerRunStateService; - - @GetMapping("list") - public CommonResult<List<PowerRunStateEntity>> list(@RequestParam Map<String, Object> params) { - List<PowerRunStateEntity> list = powerRunStateService.list(); - return success(list); - } - -} \ No newline at end of file diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/dao/ProductProcessDao.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/dao/ProductProcessDao.java deleted file mode 100644 index 4f39475..0000000 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/dao/ProductProcessDao.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.iailab.module.ansteel.mpk.dao; - -import com.iailab.framework.common.dao.BaseDao; -import com.iailab.framework.tenant.core.db.dynamic.TenantDS; -import com.iailab.module.ansteel.mpk.entity.ProductProcessEntity; -import org.apache.ibatis.annotations.Mapper; - -@TenantDS -@Mapper -public interface ProductProcessDao extends BaseDao<ProductProcessEntity> { - -} diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/PowerRunStateService.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/PowerRunStateService.java deleted file mode 100644 index d8c4d3a..0000000 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/PowerRunStateService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.iailab.module.ansteel.mpk.service; - - -import com.iailab.module.ansteel.mpk.entity.PowerRunStateEntity; - -import java.util.List; - -public interface PowerRunStateService { - - List<PowerRunStateEntity> list(); -} diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/ProductProcessService.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/ProductProcessService.java deleted file mode 100644 index daa5cf5..0000000 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/ProductProcessService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.iailab.module.ansteel.mpk.service; - - -import com.iailab.module.ansteel.mpk.entity.ProductProcessEntity; - -import java.util.List; - -public interface ProductProcessService { - - List<ProductProcessEntity> list(); -} diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/impl/ProductProcessServiceImpl.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/impl/ProductProcessServiceImpl.java deleted file mode 100644 index 4544a09..0000000 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/mpk/service/impl/ProductProcessServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.iailab.module.ansteel.mpk.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.iailab.framework.common.service.impl.BaseServiceImpl; -import com.iailab.module.ansteel.mpk.dao.ProductProcessDao; -import com.iailab.module.ansteel.mpk.entity.ProductProcessEntity; -import com.iailab.module.ansteel.mpk.service.ProductProcessService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Slf4j -@Service -public class ProductProcessServiceImpl extends BaseServiceImpl<ProductProcessDao, ProductProcessEntity> implements ProductProcessService { - - - @Override - public List<ProductProcessEntity> list() { - return baseDao.selectList(new QueryWrapper<>()); - } -} \ No newline at end of file -- Gitblit v1.9.3