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