dev #2

Merged
dashixiong merged 349 commits from dev into main 2026-02-11 01:55:46 +00:00
260 changed files with 31279 additions and 1038 deletions
Showing only changes of commit 451b2f6766 - Show all commits

View File

@ -35,8 +35,6 @@ public class EmsSiteConfigController extends BaseController{
@Autowired
private IEmsDeviceSettingService iEmsDeviceSettingService;
@Autowired
private EmsPointMatchMapper emsPointMatchMapper;
/**
* 获取站点列表
@ -161,4 +159,13 @@ public class EmsSiteConfigController extends BaseController{
{
return success(iEmsDeviceSettingService.getSiteAllDeviceCategory(siteId));
}
/**
* 根据设备类别获取父类的设备id
*/
@GetMapping("/getParentDeviceId")
public AjaxResult getParentDeviceId(@RequestParam String siteId, @RequestParam String deviceCategory)
{
return success(iEmsSiteService.getParentCategoryDeviceId(siteId, deviceCategory));
}
}

View File

@ -1,5 +1,7 @@
package com.xzzn.common.enums;
import org.apache.xmlbeans.impl.common.NameUtil;
import java.util.HashMap;
import java.util.Map;
@ -10,24 +12,26 @@ import java.util.Map;
*/
public enum DeviceCategory
{
PCS("PCS", "PCS设备"),
BRANCH("BRANCH", "PCS分支设备"),
STACK("STACK", "电池堆"),
CLUSTER("CLUSTER", "电池簇"),
BATTERY("BATTERY", "单体电池"),
AMMETER("AMMETER", "电表"),
COOLING("COOLING", "冷却"),
DH("DH", "动环"),
XF("XF", "消防"),
BATTERY_GROUP("BATTERY_GROUP", "电池组");
PCS("PCS", "PCS设备", null),
BRANCH("BRANCH", "PCS分支设备", PCS),
STACK("STACK", "电池堆", null),
CLUSTER("CLUSTER", "电池簇", STACK),
BATTERY("BATTERY", "单体电池", CLUSTER),
AMMETER("AMMETER", "电表", null),
COOLING("COOLING", "冷却", null),
DH("DH", "动环", null),
XF("XF", "消防", null),
BATTERY_GROUP("BATTERY_GROUP", "电池组", null),;
private final String code;
private final String info;
private final DeviceCategory parentCategory;
DeviceCategory(String code, String info)
DeviceCategory(String code, String info, DeviceCategory parentCategory)
{
this.code = code;
this.info = info;
this.parentCategory = parentCategory;
}
public String getCode()
@ -40,6 +44,10 @@ public enum DeviceCategory
return info;
}
public DeviceCategory getParentCategory()
{
return parentCategory;
}
// 缓存info与code的映射优化查询效率
private static final Map<String, String> INFO_CODE_MAP = new HashMap<>();
@ -54,4 +62,15 @@ public enum DeviceCategory
public static String getCodeByInfo(String info) {
return INFO_CODE_MAP.get(info); // 从缓存中直接获取,效率高
}
// 通过code获取父类code
// 根据字符串编码查找对应的枚举
public static DeviceCategory fromCode(String code) {
for (DeviceCategory category : values()) {
if (category.code.equalsIgnoreCase(code)) { // 忽略大小写,增强兼容性
return category;
}
}
return null;
}
}

View File

@ -28,4 +28,6 @@ public interface IEmsSiteService
public List<SiteDeviceListVo> getAllDeviceList(String siteId);
public List<Map<String,Object>> getAllPcsInfo(String siteId);
public List<Map<String,Object>> getParentCategoryDeviceId(String siteId, String deviceCategory);
}

View File

@ -106,4 +106,16 @@ public class EmsSiteServiceImpl implements IEmsSiteService
public List<Map<String, Object>> getAllPcsInfo(String siteId) {
return emsDevicesMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.PCS.getCode());
}
// 根据设备类别获取父类的设备id
@Override
public List<Map<String,Object>> getParentCategoryDeviceId(String siteId, String deviceCategory) {
DeviceCategory category = DeviceCategory.fromCode(deviceCategory);
if(category == null || category.getParentCategory() == null){
return null;
}
String parentCategory = category.getParentCategory().getCode();
List<Map<String,Object>> deviceIdList = emsDevicesMapper.getDeviceInfosBySiteIdAndCategory(siteId, parentCategory);
return deviceIdList;
}
}