|
@@ -13,12 +13,14 @@ import com.huimv.env.admin.common.utils.ResultUtil;
|
|
|
import com.huimv.env.admin.entity.BasePigpen;
|
|
|
import com.huimv.env.admin.entity.Gateway;
|
|
|
import com.huimv.env.admin.entity.Terminal;
|
|
|
+import com.huimv.env.admin.entity.TerminalPort;
|
|
|
import com.huimv.env.admin.entity.dto.BasePigpenDto;
|
|
|
import com.huimv.env.admin.entity.dto.ListPigpenDto;
|
|
|
import com.huimv.env.admin.entity.vo.TreeBasePigpen;
|
|
|
import com.huimv.env.admin.mapper.BasePigpenMapper;
|
|
|
import com.huimv.env.admin.mapper.GatewayMapper;
|
|
|
import com.huimv.env.admin.mapper.TerminalMapper;
|
|
|
+import com.huimv.env.admin.mapper.TerminalPortMapper;
|
|
|
import com.huimv.env.admin.service.IBasePigpenService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -44,6 +46,8 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
|
private GatewayMapper gatewayMapper;
|
|
|
@Autowired
|
|
|
private TerminalMapper terminalMapper;
|
|
|
+ @Autowired
|
|
|
+ private TerminalPortMapper portMapper;
|
|
|
|
|
|
// @Autowired
|
|
|
// private EnvDeviceMapper envDeviceMapper;
|
|
@@ -131,8 +135,11 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
|
Integer offGateway = 0;
|
|
|
Integer onTerminal = 0;
|
|
|
Integer offTerminal = 0;
|
|
|
- Integer infoGateway = 0;
|
|
|
- Integer infoTerminal = 0;
|
|
|
+ Integer infoGateway = 0;//暂时不管
|
|
|
+ Integer infoTerminal = 0;//暂时不管
|
|
|
+ Integer onPort = 0;
|
|
|
+ Integer offPort = 0;
|
|
|
+ Integer infoPort = 0;
|
|
|
QueryWrapper<Gateway> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("location_id", id);
|
|
|
List<Gateway> gateways = gatewayMapper.selectList(queryWrapper);
|
|
@@ -157,6 +164,23 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
|
onTerminal++;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ List<Integer> idList2 = new ArrayList<>();
|
|
|
+ terminals.forEach(item->{
|
|
|
+ idList2.add(item.getId());
|
|
|
+ });
|
|
|
+
|
|
|
+ QueryWrapper<TerminalPort> queryWrapper2 = new QueryWrapper<>();
|
|
|
+ queryWrapper2.in("terminal_id", idList);
|
|
|
+ List<TerminalPort> terminalPorts = portMapper.selectList(queryWrapper2);
|
|
|
+ for (TerminalPort terminal : terminalPorts) {
|
|
|
+ if (terminal.getStatus() == 0) {
|
|
|
+ offPort++;
|
|
|
+ } else {
|
|
|
+ onPort++;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("onGateway", onGateway);
|
|
|
jsonObject.put("offGateway", offGateway);
|
|
@@ -164,6 +188,9 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
|
jsonObject.put("offTerminal", offTerminal);
|
|
|
jsonObject.put("infoGateway", infoGateway);
|
|
|
jsonObject.put("infoTerminal", infoTerminal);
|
|
|
+ jsonObject.put("offPort", offPort);
|
|
|
+ jsonObject.put("onPort", onPort);
|
|
|
+ jsonObject.put("infoPort", infoPort);
|
|
|
return new Result(ResultCode.SUCCESS,jsonObject);
|
|
|
}
|
|
|
|