|
@@ -9,6 +9,7 @@ import org.jeecg.modules.equipmentHealthSection.entity.EquipmentHealthSection;
|
|
|
import org.jeecg.modules.equipmentHealthSection.mapper.EquipmentHealthSectionMapper;
|
|
|
import org.jeecg.modules.equipmentOnoffSection.entity.EquipmentOnoffSection;
|
|
|
import org.jeecg.modules.healthStatistics.service.IHealthStatisticsService;
|
|
|
+import org.jeecg.modules.tpmEquipment.mapper.TpmEquipmentMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -30,6 +31,9 @@ public class HealthStatisticsServiceImpl implements IHealthStatisticsService {
|
|
|
@Autowired
|
|
|
private StatisticsMapper statisticsMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TpmEquipmentMapper tpmEquipmentMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 健康概况信息获取
|
|
|
* @param day
|
|
@@ -44,10 +48,41 @@ public class HealthStatisticsServiceImpl implements IHealthStatisticsService {
|
|
|
List<Integer> days = new ArrayList<>();
|
|
|
// 汇总查询最近的状态
|
|
|
List<EquipmentHealth> healthList = equipmentHealthMapper.selectLastStatusGroup();
|
|
|
- int equipnum = 0;
|
|
|
- if (healthList != null && healthList.size() > 0) {
|
|
|
- equipnum = healthList.stream().mapToInt(EquipmentHealth::getHowmany).sum();
|
|
|
+// int equipnum = 0;
|
|
|
+// if (healthList != null && healthList.size() > 0) {
|
|
|
+// equipnum = healthList.stream().mapToInt(EquipmentHealth::getHowmany).sum();
|
|
|
+// }
|
|
|
+// EquipmentHealth equipmentHealth2 = new EquipmentHealth();
|
|
|
+// equipmentHealth2.setStatus("1");
|
|
|
+// equipmentHealth2.setHowmany(99);
|
|
|
+// healthList.add(equipmentHealth2);
|
|
|
+// EquipmentHealth equipmentHealth3 = new EquipmentHealth();
|
|
|
+// equipmentHealth3.setStatus("3");
|
|
|
+// equipmentHealth3.setHowmany(2);
|
|
|
+// healthList.add(equipmentHealth3);
|
|
|
+ int equipnum = tpmEquipmentMapper.getAllByTpmequip();
|
|
|
+ int offlinenum = equipnum;
|
|
|
+ for(int i=0;i<3;i++){
|
|
|
+ if(healthList.size()>0 && healthList.size()>=i+1){
|
|
|
+ if(!healthList.get(i).getStatus().equals(Integer.toString(i+1))){
|
|
|
+ EquipmentHealth equipmentHealth = new EquipmentHealth();
|
|
|
+ equipmentHealth.setStatus(Integer.toString(i+1));
|
|
|
+ equipmentHealth.setHowmany(0);
|
|
|
+ healthList.add(i, equipmentHealth);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ EquipmentHealth equipmentHealth = new EquipmentHealth();
|
|
|
+ equipmentHealth.setStatus(Integer.toString(i+1));
|
|
|
+ equipmentHealth.setHowmany(0);
|
|
|
+ healthList.add(i, equipmentHealth);
|
|
|
+ }
|
|
|
+ offlinenum = offlinenum-healthList.get(i).getHowmany();
|
|
|
}
|
|
|
+ EquipmentHealth equipmentHealth1 = new EquipmentHealth();
|
|
|
+ equipmentHealth1.setStatus("4");
|
|
|
+ equipmentHealth1.setHowmany(offlinenum);
|
|
|
+ healthList.add(equipmentHealth1);
|
|
|
+
|
|
|
|
|
|
// 年度查询汇总查月状态时长汇总
|
|
|
List<EquipmentHealthSection> yearList = equipmentHealthSectionMapper.selectStatusGroupByYear(year);
|