修改谐波,终端及站点在线率bug

This commit is contained in:
wr
2023-04-12 10:41:48 +08:00
parent fe741f3f17
commit d32fd417f2
2 changed files with 5 additions and 8 deletions

View File

@@ -398,20 +398,17 @@ public interface LineMapper extends BaseMapper<Line> {
"FROM\n",
"\t(\n",
"\t\tSELECT\n",
"\t\t\ta.pid,\n",
"\t\t\tmax(b.com_flag) temp\n",
"\t\t\ta.pid\n",
"\t\tFROM\n",
"\t\t\tpq_line a\n",
"\t\tINNER JOIN pq_device b ON a.id = b.id\n",
"where a.Pid in",
"where b.Run_Flag = 0 and a.Pid in",
"<foreach item='item' index='index' collection='items' open='(' separator=',' close=')'>",
"#{item}",
"</foreach>",
"\t\tGROUP BY\n",
"\t\t\ta.pid\n",
"\t) TEMPTABLE\n",
"WHERE\n",
"\tTEMPTABLE .temp > 0",
"</script>"
})
Integer queryOnlineSubstaion(@Param("items") List<String> deviceIds);

View File

@@ -683,14 +683,14 @@ public class GeneralDeviceService {
DeptDeviceDetailVO deptDeviceDetailVO =new DeptDeviceDetailVO();
/*总数*/
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0,1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
List<String> DeviceIds = deptDeviceInfos.stream ( ).map (GeneralDeviceDTO::getDeviceIndexes).flatMap (Collection::stream).collect (Collectors.toList ( ));
Integer deviceCount = DeviceIds.size ();
/*实际运行*/
QueryWrapper<Device> query = new QueryWrapper<> ();
query.in ("Id",DeviceIds).
eq ("Com_Flag",1);
eq ("Run_Flag",0);
Integer runDeviceCount = deviceMapper.selectCount (query);
BigDecimal rate = BigDecimal.valueOf (runDeviceCount).divide ( BigDecimal.valueOf (deviceCount),4,BigDecimal.ROUND_HALF_UP);
deptDeviceDetailVO.setDeviceCount (deviceCount);
@@ -704,7 +704,7 @@ public class GeneralDeviceService {
DeptSubstationDetailVO deptSubstationDetailVO = new DeptSubstationDetailVO ();
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0,1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
List<String> DeviceIds = deptDeviceInfos.stream ( ).map (GeneralDeviceDTO::getSubIndexes).flatMap (Collection::stream).collect (Collectors.toList ( ));
Integer substationCount = DeviceIds.size ();