fix: 微信小程序接口对接修改,联调测试问题修复。
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package com.intc.common.core.config.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 设备类型配置
|
||||
*
|
||||
* @author intc
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "device-type")
|
||||
public class DeviceTypeProperties {
|
||||
|
||||
/**
|
||||
* 水质检测仪 ProductKey
|
||||
*/
|
||||
private String waterQualityMonitor;
|
||||
|
||||
/**
|
||||
* 控制一体机 ProductKey
|
||||
*/
|
||||
private String controlIntegrated;
|
||||
|
||||
/**
|
||||
* 根据 ProductKey 判断设备类型
|
||||
* @param productKey ProductKey
|
||||
* @return 设备类型: 1-水质检测仪, 2-控制一体机, null-未知类型
|
||||
*/
|
||||
public Integer getDeviceTypeByProductKey(String productKey) {
|
||||
if (productKey == null) {
|
||||
return null;
|
||||
}
|
||||
if (productKey.equals(waterQualityMonitor)) {
|
||||
return 1;
|
||||
} else if (productKey.equals(controlIntegrated)) {
|
||||
return 2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备类型获取 ProductKey
|
||||
* @param deviceType 1-水质检测仪, 2-控制一体机
|
||||
* @return ProductKey
|
||||
*/
|
||||
public String getProductKeyByType(Integer deviceType) {
|
||||
if (deviceType == null) {
|
||||
return null;
|
||||
}
|
||||
switch (deviceType) {
|
||||
case 1:
|
||||
return waterQualityMonitor;
|
||||
case 2:
|
||||
return controlIntegrated;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user