| | |
| | | package com.battery.business.runtime; |
| | | |
| | | import com.battery.device.api.StepDirectionResolver; |
| | | import com.battery.device.api.StepDirectionResolver.Direction; |
| | | import com.battery.device.bts.BtsStepDirectionResolver; |
| | | import com.battery.device.neware.NewareStepDirectionResolver; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** 装配已保存 BTS 工步的方向解释,不触发任何设备请求。 */ |
| | | /** 装配已保存工步的方向解释,不触发任何设备请求。 */ |
| | | @Configuration |
| | | public class ReportStepDirectionConfig |
| | | { |
| | | /** |
| | | * 已保存工步的类型有两种形态:导入或协议路径给的是名称(`cc`、`charge`), |
| | | * 直连新威取来的是设备数字枚举(`1`/`2`/`4`)。两种都解释,未确认取值保持未知。 |
| | | */ |
| | | @Bean |
| | | public StepDirectionResolver reportStepDirectionResolver() { return new BtsStepDirectionResolver(); } |
| | | public StepDirectionResolver reportStepDirectionResolver() |
| | | { |
| | | StepDirectionResolver deviceTypes = new NewareStepDirectionResolver(); |
| | | StepDirectionResolver names = new BtsStepDirectionResolver(); |
| | | return stepType -> { |
| | | Direction direction = deviceTypes.resolve(stepType); |
| | | return direction == Direction.UNKNOWN ? names.resolve(stepType) : direction; |
| | | }; |
| | | } |
| | | } |