|
|
|
@ -23,6 +23,7 @@ import com.ruoyi.common.datascope.annotation.DataScope;
|
|
|
|
|
import com.ruoyi.common.redis.service.RedisService;
|
|
|
|
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.ruoyi.system.api.domain.SysUser;
|
|
|
|
|
import com.ruoyi.system.api.model.LoginUser;
|
|
|
|
|
import com.ruoyi.tdengine.api.RemoteTdEngineService;
|
|
|
|
|
import com.ruoyi.tdengine.api.domain.*;
|
|
|
|
|
import io.swagger.models.auth.In;
|
|
|
|
@ -113,6 +114,10 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
|
@Override
|
|
|
|
|
@DataScope(tenantAlias = "hd")
|
|
|
|
|
public List<HwDevice> selectHwDeviceList(HwDevice hwDevice) {
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
|
SysUser sysUser = loginUser.getSysUser();
|
|
|
|
|
Long tenantId = sysUser.getTenantId();
|
|
|
|
|
hwDevice.setTenantId(tenantId);
|
|
|
|
|
return hwDeviceMapper.selectHwDeviceList(hwDevice);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -289,7 +294,10 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<DeviceModeVo> selectDeviceModeNameVo() {
|
|
|
|
|
List<DeviceModeVo> list = hwDeviceMapper.selectDeviceModeNameVo();
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
|
SysUser sysUser = loginUser.getSysUser();
|
|
|
|
|
Long tenantId = sysUser.getTenantId();
|
|
|
|
|
List<DeviceModeVo> list = hwDeviceMapper.selectDeviceModeNameVo(tenantId);
|
|
|
|
|
Integer value = 0;
|
|
|
|
|
if (list.size() > 10) {
|
|
|
|
|
for (int i = 9; i < list.size(); i++) {
|
|
|
|
@ -549,6 +557,10 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
|
@Override
|
|
|
|
|
@DataScope(tenantAlias = "hd")
|
|
|
|
|
public List<HwDevice> selectHwDeviceJoinList(HwDevice hwDevice) {
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
|
SysUser sysUser = loginUser.getSysUser();
|
|
|
|
|
Long tenantId = sysUser.getTenantId();
|
|
|
|
|
hwDevice.setTenantId(tenantId);
|
|
|
|
|
return hwDeviceMapper.selectHwDeviceJoinList(hwDevice);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1359,6 +1371,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
|
list.addAll(list1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Long modeId = hwDeviceMapper.selectModeIdByDeviceId(deviceIds);
|
|
|
|
|
Map<String, Object> mapName = new HashMap<String, Object>();
|
|
|
|
|
if (list.size()>0){
|
|
|
|
|
Set<String> strings = list.get(0).keySet();
|
|
|
|
@ -1366,7 +1379,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
|
list2.addAll(strings);
|
|
|
|
|
for (int i = 0; i < list2.size(); i++) {
|
|
|
|
|
//查询类型的字段名
|
|
|
|
|
String s = hwDeviceMapper.selectFunctionNameByFunctionIdentifier(list2.get(i));
|
|
|
|
|
String s = hwDeviceMapper.selectFunctionNameByFunctionIdentifier(list2.get(i),modeId);
|
|
|
|
|
mapName.put(list2.get(i),s);
|
|
|
|
|
}
|
|
|
|
|
list.add(mapName);
|
|
|
|
@ -1405,7 +1418,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
|
for (int i = 0; i < unitMap.size(); i++) {
|
|
|
|
|
List<TreeDeviceVo> list = new ArrayList<TreeDeviceVo>();
|
|
|
|
|
for (int j = 0; j < deviceMap.size(); j++) {
|
|
|
|
|
if (unitMap.get(i).getVoId() == deviceMap.get(j).getParentId()) {
|
|
|
|
|
if (unitMap.get(i).getVoId().longValue() == deviceMap.get(j).getParentId().longValue()) {
|
|
|
|
|
list.add(deviceMap.get(j));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1556,21 +1569,26 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject selectRedisFile(Long tenantId){
|
|
|
|
|
Object o = redisService.getCacheObject("file" + tenantId);
|
|
|
|
|
JSONObject array = new JSONObject(true);
|
|
|
|
|
array.put("content",o.toString());
|
|
|
|
|
|
|
|
|
|
String s = o.toString();
|
|
|
|
|
String[] split = s.split("},\\{");
|
|
|
|
|
String s2 = split[0].substring(1) + "}";
|
|
|
|
|
Map<String, Object> map = JSON.parseObject(s2,LinkedHashMap.class, Feature.OrderedField);
|
|
|
|
|
Map<Long, String> linkedMap = new LinkedHashMap<Long, String>();
|
|
|
|
|
Long along = 1l;
|
|
|
|
|
for (String key : map.keySet()){
|
|
|
|
|
linkedMap.put(along, key);
|
|
|
|
|
along++;
|
|
|
|
|
if (o == null){
|
|
|
|
|
return null;
|
|
|
|
|
}else {
|
|
|
|
|
JSONObject array = new JSONObject(true);
|
|
|
|
|
array.put("content",o.toString());
|
|
|
|
|
|
|
|
|
|
String s = o.toString();
|
|
|
|
|
String[] split = s.split("},\\{");
|
|
|
|
|
String s2 = split[0].substring(1) + "}";
|
|
|
|
|
Map<String, Object> map = JSON.parseObject(s2,LinkedHashMap.class, Feature.OrderedField);
|
|
|
|
|
Map<Long, String> linkedMap = new LinkedHashMap<Long, String>();
|
|
|
|
|
Long along = 1l;
|
|
|
|
|
for (String key : map.keySet()){
|
|
|
|
|
linkedMap.put(along, key);
|
|
|
|
|
along++;
|
|
|
|
|
}
|
|
|
|
|
array.put("Header",linkedMap);
|
|
|
|
|
return array;
|
|
|
|
|
}
|
|
|
|
|
array.put("Header",linkedMap);
|
|
|
|
|
return array;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|