|
@@ -22,6 +22,7 @@ import com.bizmatics.service.util.FieldEscapeUtils;
|
|
|
import com.bizmatics.service.util.SecurityUtils;
|
|
|
import com.bizmatics.service.vo.*;
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
+import org.apache.ibatis.annotations.Select;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -60,6 +61,8 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
private SiteDynamicPropertiesService siteDynamicPropertiesService;
|
|
|
@Autowired
|
|
|
private DeviceAttributeService deviceAttributeService;
|
|
|
+ @Autowired
|
|
|
+ private HtAnalogDataMapper htAnalogDataMapper;
|
|
|
|
|
|
@Override
|
|
|
public HadCountVO selectCount() {
|
|
@@ -99,7 +102,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
List<Object> dates = new ArrayList<>();
|
|
|
dates.add("00:00:00");
|
|
|
for (int i = 2; i < 24; i += 2) {
|
|
|
- //结束时间
|
|
|
+ // 结束时间
|
|
|
Date hours = DateUtils.setHours(startTime, i);
|
|
|
startTime = hours;
|
|
|
dates.add(DateUtils.getTime(hours));
|
|
@@ -128,7 +131,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
List<Object> dates = new ArrayList<>();
|
|
|
dates.add("00:00:00");
|
|
|
for (int i = 2; i < 24; i += 2) {
|
|
|
- //结束时间
|
|
|
+ // 结束时间
|
|
|
Date hours = DateUtils.setHours(startTime, i);
|
|
|
objects.add(0.0);
|
|
|
startTime = hours;
|
|
@@ -166,11 +169,11 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
public HadCountVO getCountBySite(Integer siteId) {
|
|
|
Integer userId = SecurityUtils.getLoginUser().getUser().getUserId().intValue();
|
|
|
Date date = new Date();
|
|
|
- //当日开始时间
|
|
|
+ // 当日开始时间
|
|
|
Date firstDayOfDate = DateUtils.getDayStartTime(date);
|
|
|
- //当月开始时间
|
|
|
+ // 当月开始时间
|
|
|
Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(date);
|
|
|
- //当年开始时间
|
|
|
+ // 当年开始时间
|
|
|
Date firstDayOfYear = DateUtils.getBeginDayOfYear(date);
|
|
|
HadCountVO hadCountVO = new HadCountVO();
|
|
|
hadCountVO.setDayCount(hadSiteStaticService.getCount(userId, DateUtils.getDayStartTime(date), date, siteId));
|
|
@@ -304,7 +307,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
public List<RealScoreVO> rtRealScore(String deviceCode, Date startTime, Date endTime) {
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
- //查询设备
|
|
|
+ // 查询设备
|
|
|
LambdaQueryWrapper<Device> deviceQuery = Wrappers.lambdaQuery();
|
|
|
deviceQuery.eq(Device::getDeviceCode, deviceCode);
|
|
|
Device device = deviceService.getOne(deviceQuery);
|
|
@@ -318,7 +321,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
}
|
|
|
List<HtAnalogData> list = baseMapper.getDemandAnalysisList(deviceCode, formatter.format(startTime), formatter.format(endTime), table);
|
|
|
|
|
|
- //查询sd
|
|
|
+ // 查询sd
|
|
|
LambdaQueryWrapper<SiteDynamicProperties> sdQuery = Wrappers.lambdaQuery();
|
|
|
sdQuery.eq(SiteDynamicProperties::getSiteId, device.getSiteId());
|
|
|
SiteDynamicProperties siteDynamicProperties = siteDynamicPropertiesService.getOne(sdQuery);
|
|
@@ -395,25 +398,25 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
deviceAnalogVariableList.setVariableCoding(dataManagementOneVO.getDisplayField().get(i).split("_")[0] + "_" + dataManagementOneVO.getDisplayField().get(i).split("_")[1]);
|
|
|
variableCodingList.add(deviceAnalogVariableList);
|
|
|
}
|
|
|
- //通信设备编号
|
|
|
+ // 通信设备编号
|
|
|
Set set = new HashSet();
|
|
|
List<DataManagementVO> newList = new ArrayList();
|
|
|
set.addAll(dataManagementVOList);
|
|
|
newList.addAll(set);
|
|
|
|
|
|
- //显示的字段名
|
|
|
+ // 显示的字段名
|
|
|
Set set1 = new HashSet();
|
|
|
List<String> list = new ArrayList();
|
|
|
set1.addAll(newListOne);
|
|
|
list.addAll(set1);
|
|
|
|
|
|
- //监控ID
|
|
|
+ // 监控ID
|
|
|
Set set2 = new HashSet();
|
|
|
List<String> monitor_list = new ArrayList();
|
|
|
set2.addAll(newListTwo);
|
|
|
monitor_list.addAll(set2);
|
|
|
|
|
|
- //查询字段
|
|
|
+ // 查询字段
|
|
|
Set set3 = new HashSet();
|
|
|
List<String> fieldDisplayOne = new ArrayList();
|
|
|
set3.addAll(fieldDisplay);
|
|
@@ -444,15 +447,15 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
List<ContextualDataVo> yearOnYearList3 = new ArrayList<>();
|
|
|
if (fieldDisplayOne183.size() > 0) {
|
|
|
List<String> fieldDisplayList = FieldEscapeUtils.getSyllable(type, valueCalculation, fieldDisplayOne183);
|
|
|
- yearOnYearList1 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_data", 0,type);
|
|
|
+ yearOnYearList1 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_data", 0, type);
|
|
|
}
|
|
|
if (fieldDisplayOne171.size() > 0) {
|
|
|
List<String> fieldDisplayList = FieldEscapeUtils.getSyllable(type, valueCalculation, fieldDisplayOne171);
|
|
|
- yearOnYearList2 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_171_data", 0,type);
|
|
|
+ yearOnYearList2 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_171_data", 0, type);
|
|
|
}
|
|
|
if (fieldDisplayOne173.size() > 0) {
|
|
|
List<String> fieldDisplayList = FieldEscapeUtils.getSyllable(type, valueCalculation, fieldDisplayOne173);
|
|
|
- yearOnYearList3 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_173_data", 0,type);
|
|
|
+ yearOnYearList3 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_173_data", 0, type);
|
|
|
}
|
|
|
List<ContextualDataVo> yearOnYearList4 = Stream.of(yearOnYearList1, yearOnYearList2).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
|
|
List<ContextualDataVo> yearOnYearList = Stream.of(yearOnYearList3, yearOnYearList4).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
|
@@ -658,15 +661,15 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
List<ContextualDataVo> yearOnYearList3 = new ArrayList<>();
|
|
|
if (fieldDisplayOne183.size() > 0) {
|
|
|
List<String> fieldDisplayList = FieldEscapeUtils.getSyllable(type, valueCalculation, fieldDisplayOne183);
|
|
|
- yearOnYearList1 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_data", 0,type);
|
|
|
+ yearOnYearList1 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_data", 0, type);
|
|
|
}
|
|
|
if (fieldDisplayOne171.size() > 0) {
|
|
|
List<String> fieldDisplayList = FieldEscapeUtils.getSyllable(type, valueCalculation, fieldDisplayOne171);
|
|
|
- yearOnYearList2 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_171_data", 0,type);
|
|
|
+ yearOnYearList2 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_171_data", 0, type);
|
|
|
}
|
|
|
if (fieldDisplayOne173.size() > 0) {
|
|
|
List<String> fieldDisplayList = FieldEscapeUtils.getSyllable(type, valueCalculation, fieldDisplayOne173);
|
|
|
- yearOnYearList3 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_173_data", 0,type);
|
|
|
+ yearOnYearList3 = baseMapper.getYearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime(), variableCodingList, fieldDisplayList, "ht_analog_173_data", 0, type);
|
|
|
}
|
|
|
List<ContextualDataVo> yearOnYearList4 = Stream.of(yearOnYearList1, yearOnYearList2).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
|
|
List<ContextualDataVo> currentPeriodRingRatioList = Stream.of(yearOnYearList3, yearOnYearList4).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
|
@@ -1100,7 +1103,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
checkList.add(SingleLoopReportList.get(0).getAvgIa());
|
|
|
checkList.add(SingleLoopReportList.get(0).getAvgIb());
|
|
|
checkList.add(SingleLoopReportList.get(0).getAvgIc());
|
|
|
- //电流不平衡(平均)
|
|
|
+ // 电流不平衡(平均)
|
|
|
Double AvgElBalun = checkBalun(checkList) * 100;
|
|
|
singleLoopReportOneVo.setAvgElBalun(Double.valueOf(df.format(AvgElBalun)));
|
|
|
if (AvgElBalun < 15) {
|
|
@@ -1113,7 +1116,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
checkList.add(SingleLoopReportList.get(0).getMaxIa());
|
|
|
checkList.add(SingleLoopReportList.get(0).getMaxIb());
|
|
|
checkList.add(SingleLoopReportList.get(0).getMaxIc());
|
|
|
- //电流不平衡(最大)
|
|
|
+ // 电流不平衡(最大)
|
|
|
Double MaxElBalun = checkBalun(checkList) * 100;
|
|
|
singleLoopReportOneVo.setMaxElBalun(Double.valueOf(df.format(MaxElBalun)));
|
|
|
if (MaxElBalun < 15) {
|
|
@@ -1126,7 +1129,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
checkList.add(SingleLoopReportList.get(0).getMinIa());
|
|
|
checkList.add(SingleLoopReportList.get(0).getMinIb());
|
|
|
checkList.add(SingleLoopReportList.get(0).getMinIc());
|
|
|
- //电流不平衡(最小)
|
|
|
+ // 电流不平衡(最小)
|
|
|
Double MinElBalun = checkBalun(checkList) * 100;
|
|
|
singleLoopReportOneVo.setMinElBalun(Double.valueOf(df.format(MinElBalun)));
|
|
|
if (MinElBalun < 15) {
|
|
@@ -1144,7 +1147,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
checkList.add(SingleLoopReportList.get(0).getAvgUa());
|
|
|
checkList.add(SingleLoopReportList.get(0).getAvgUb());
|
|
|
checkList.add(SingleLoopReportList.get(0).getAvgUc());
|
|
|
- //电压不平衡(平均)
|
|
|
+ // 电压不平衡(平均)
|
|
|
Double AvgVtBalun = checkBalun(checkList) * 100;
|
|
|
singleLoopReportOneVo.setAvgVtBalun(Double.valueOf(df.format(AvgVtBalun)));
|
|
|
if (AvgVtBalun < 15) {
|
|
@@ -1157,7 +1160,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
checkList.add(SingleLoopReportList.get(0).getMaxUa());
|
|
|
checkList.add(SingleLoopReportList.get(0).getMaxUb());
|
|
|
checkList.add(SingleLoopReportList.get(0).getMaxUc());
|
|
|
- //电压不平衡(最大)
|
|
|
+ // 电压不平衡(最大)
|
|
|
Double MaxVtBalun = checkBalun(checkList) * 100;
|
|
|
singleLoopReportOneVo.setMaxVtBalun(Double.valueOf(df.format(MaxVtBalun)));
|
|
|
if (MaxVtBalun < 15) {
|
|
@@ -1170,7 +1173,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
checkList.add(SingleLoopReportList.get(0).getMinUa());
|
|
|
checkList.add(SingleLoopReportList.get(0).getMinUb());
|
|
|
checkList.add(SingleLoopReportList.get(0).getMinUc());
|
|
|
- //电压不平衡(最小)
|
|
|
+ // 电压不平衡(最小)
|
|
|
Double MinVtBalun = checkBalun(checkList) * 100;
|
|
|
singleLoopReportOneVo.setMinVtBalun(Double.valueOf(df.format(MinVtBalun)));
|
|
|
if (MinVtBalun < 15) {
|
|
@@ -1189,7 +1192,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
double voltageLevel = Double.parseDouble(singleLoopReportOneVo.getVoltageLevel());
|
|
|
double voltageLevelWanting = voltageLevel / 100 * 7;
|
|
|
|
|
|
- //A相电压合格率(平均)
|
|
|
+ // A相电压合格率(平均)
|
|
|
checkList.clear();
|
|
|
checkList.add(SingleLoopReportList.get(0).getAvgUa());
|
|
|
checkList.add(voltageLevel);
|
|
@@ -1200,7 +1203,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setAvgUaStatus(false);
|
|
|
}
|
|
|
- //B相电压合格率(平均)
|
|
|
+ // B相电压合格率(平均)
|
|
|
checkList.clear();
|
|
|
checkList.add(SingleLoopReportList.get(0).getAvgUb());
|
|
|
checkList.add(voltageLevel);
|
|
@@ -1211,7 +1214,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setAvgUbStatus(false);
|
|
|
}
|
|
|
- //C相电压合格率(平均)
|
|
|
+ // C相电压合格率(平均)
|
|
|
checkList.clear();
|
|
|
checkList.add(SingleLoopReportList.get(0).getAvgUc());
|
|
|
checkList.add(voltageLevel);
|
|
@@ -1222,7 +1225,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setAvgUcStatus(false);
|
|
|
}
|
|
|
- //A相电压合格率(最大)
|
|
|
+ // A相电压合格率(最大)
|
|
|
checkList.clear();
|
|
|
checkList.add(SingleLoopReportList.get(0).getMaxUa());
|
|
|
checkList.add(voltageLevel);
|
|
@@ -1233,7 +1236,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setMaxUaStatus(false);
|
|
|
}
|
|
|
- //B相电压合格率(最大)
|
|
|
+ // B相电压合格率(最大)
|
|
|
checkList.clear();
|
|
|
checkList.add(SingleLoopReportList.get(0).getMaxUb());
|
|
|
checkList.add(voltageLevel);
|
|
@@ -1244,7 +1247,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setMaxUbStatus(false);
|
|
|
}
|
|
|
- //C相电压合格率(最大)
|
|
|
+ // C相电压合格率(最大)
|
|
|
checkList.clear();
|
|
|
checkList.add(SingleLoopReportList.get(0).getMaxUc());
|
|
|
checkList.add(voltageLevel);
|
|
@@ -1255,7 +1258,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setMaxUcStatus(false);
|
|
|
}
|
|
|
- //A相电压合格率(最小)
|
|
|
+ // A相电压合格率(最小)
|
|
|
checkList.clear();
|
|
|
checkList.add(SingleLoopReportList.get(0).getMinUa());
|
|
|
checkList.add(voltageLevel);
|
|
@@ -1266,7 +1269,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setMinUaStatus(false);
|
|
|
}
|
|
|
- //B相电压合格率(最小)
|
|
|
+ // B相电压合格率(最小)
|
|
|
checkList.clear();
|
|
|
checkList.add(SingleLoopReportList.get(0).getMinUb());
|
|
|
checkList.add(voltageLevel);
|
|
@@ -1277,7 +1280,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setMinUbStatus(false);
|
|
|
}
|
|
|
- //C相电压合格率(最小)
|
|
|
+ // C相电压合格率(最小)
|
|
|
checkList.clear();
|
|
|
checkList.add(SingleLoopReportList.get(0).getMinUc());
|
|
|
checkList.add(voltageLevel);
|
|
@@ -1308,7 +1311,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
}
|
|
|
|
|
|
|
|
|
- //频率(平均)
|
|
|
+ // 频率(平均)
|
|
|
Double cAvgF = 0.00;
|
|
|
if (SingleLoopReportList.get(0).getAvgF() >= 50) {
|
|
|
cAvgF = Double.valueOf(df.format(SingleLoopReportList.get(0).getAvgF() - 50.00));
|
|
@@ -1321,7 +1324,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setAvgFStatus(false);
|
|
|
}
|
|
|
- //频率(最大)
|
|
|
+ // 频率(最大)
|
|
|
Double cMaxF = 0.00;
|
|
|
if (SingleLoopReportList.get(0).getAvgF() >= 50) {
|
|
|
cMaxF = Double.valueOf(df.format(SingleLoopReportList.get(0).getMaxF() - 50.00));
|
|
@@ -1334,7 +1337,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
singleLoopReportOneVo.setMaxFStatus(false);
|
|
|
}
|
|
|
- //频率(最小)
|
|
|
+ // 频率(最小)
|
|
|
Double cMinF = 0.00;
|
|
|
if (SingleLoopReportList.get(0).getAvgF() >= 50) {
|
|
|
cMinF = Double.valueOf(df.format(SingleLoopReportList.get(0).getMinF() - 50.00));
|
|
@@ -1406,7 +1409,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
checkList.add(RtAnalogDataList.get(i).getIa());
|
|
|
checkList.add(RtAnalogDataList.get(i).getIb());
|
|
|
checkList.add(RtAnalogDataList.get(i).getIc());
|
|
|
- //电流不平衡
|
|
|
+ // 电流不平衡
|
|
|
Double ElBalun = checkBalun(checkList);
|
|
|
if (ElBalun < 0.15) {
|
|
|
OverrunElBalun++;
|
|
@@ -1416,7 +1419,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
checkList.add(RtAnalogDataList.get(i).getUa());
|
|
|
checkList.add(RtAnalogDataList.get(i).getUb());
|
|
|
checkList.add(RtAnalogDataList.get(i).getUc());
|
|
|
- //电压不平衡
|
|
|
+ // 电压不平衡
|
|
|
Double VtBalunQ = checkBalun(checkList);
|
|
|
if (VtBalunQ < 0.15) {
|
|
|
OverrunVtBalun++;
|
|
@@ -1466,4 +1469,9 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
return Arith.div(Arith.sub(max, min), max);
|
|
|
}
|
|
|
|
|
|
+ // 获取设备三相总有功功率值
|
|
|
+ @Override
|
|
|
+ public List<HtAnalogData> getP(List<String> deviceCodes) {
|
|
|
+ return htAnalogDataMapper.getP(deviceCodes);
|
|
|
+ }
|
|
|
}
|