|
@@ -776,8 +776,25 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
public List<CommonIcoVO> monthlyReport(String deviceCode, int cycle, String startTime, String endTime) {
|
|
|
List<Object> eppList = new ArrayList<>();
|
|
|
List<Object> freezingTimesList = new ArrayList<>();
|
|
|
- List<HtAnalogDataVo> maxMonthlyReport = baseMapper.energyUseList(deviceCode, startTime, endTime, cycle, 1);
|
|
|
- List<HtAnalogDataVo> minMonthlyReport = baseMapper.energyUseList(deviceCode, startTime, endTime, cycle, 2);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<Device> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(Device::getDeviceCode, deviceCode);
|
|
|
+ List<Device> deviceList = deviceService.list(queryWrapper);
|
|
|
+ String table = "ht_analog_data";
|
|
|
+ if(deviceList.size()>0){
|
|
|
+ if (deviceList.get(0).getDeviceType().equals("1")){
|
|
|
+ table = "ht_analog_data";
|
|
|
+ }else if (deviceList.get(0).getDeviceType().equals("4")){
|
|
|
+ table = "ht_analog_173_data";
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("173用电设备无用电数据采集");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("错误数据,设备不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<HtAnalogDataVo> maxMonthlyReport = baseMapper.getEnergyUseList(deviceCode, startTime, endTime, cycle, 1,table);
|
|
|
+ List<HtAnalogDataVo> minMonthlyReport = baseMapper.getEnergyUseList(deviceCode, startTime, endTime, cycle, 2,table);
|
|
|
if (maxMonthlyReport.size() > 0) {
|
|
|
for (int i = 0; i < maxMonthlyReport.size(); i++) {
|
|
|
BigDecimal b1 = new BigDecimal(maxMonthlyReport.get(i).getEpp().toString());
|
|
@@ -791,6 +808,24 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+// public List<CommonIcoVO> monthlyReport(String deviceCode, int cycle, String startTime, String endTime) {
|
|
|
+// List<Object> eppList = new ArrayList<>();
|
|
|
+// List<Object> freezingTimesList = new ArrayList<>();
|
|
|
+// List<HtAnalogDataVo> maxMonthlyReport = baseMapper.energyUseList(deviceCode, startTime, endTime, cycle, 1);
|
|
|
+// List<HtAnalogDataVo> minMonthlyReport = baseMapper.energyUseList(deviceCode, startTime, endTime, cycle, 2);
|
|
|
+// if (maxMonthlyReport.size() > 0) {
|
|
|
+// for (int i = 0; i < maxMonthlyReport.size(); i++) {
|
|
|
+// BigDecimal b1 = new BigDecimal(maxMonthlyReport.get(i).getEpp().toString());
|
|
|
+// BigDecimal b2 = new BigDecimal(minMonthlyReport.get(i).getEpp().toString());
|
|
|
+// eppList.add(b1.subtract(b2).doubleValue());
|
|
|
+// freezingTimesList.add(maxMonthlyReport.get(i).getFreezingTimes());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// List<CommonIcoVO> list = new ArrayList<>();
|
|
|
+// list.add(CommonIcoVO.builder().name("电量").list(eppList).listDate(freezingTimesList).build());
|
|
|
+// return list;
|
|
|
+// }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public List<CommonIcoVO> demandAnalysis(String deviceCode, String monthDate, int cycle) {
|
|
@@ -874,8 +909,23 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
@Override
|
|
|
public List<HtAnalogDataOneVo> monthlyReportlist(String deviceCode, String startTime, String endTime, int cycle, Integer startCurrent) {
|
|
|
List<HtAnalogDataOneVo> listOne = new ArrayList<>();
|
|
|
- List<HtAnalogDataOneVo> maxMonthlyReport = baseMapper.energyUseListOne(deviceCode, startTime, endTime, cycle, 1, 10000, startCurrent);
|
|
|
- List<HtAnalogDataOneVo> minMonthlyReport = baseMapper.energyUseListOne(deviceCode, startTime, endTime, cycle, 2, 10000, startCurrent);
|
|
|
+ LambdaQueryWrapper<Device> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(Device::getDeviceCode, deviceCode);
|
|
|
+ List<Device> deviceList = deviceService.list(queryWrapper);
|
|
|
+ String table = "ht_analog_data";
|
|
|
+ if(deviceList.size()>0){
|
|
|
+ if (deviceList.get(0).getDeviceType().equals("1")){
|
|
|
+ table = "ht_analog_data";
|
|
|
+ }else if (deviceList.get(0).getDeviceType().equals("4")){
|
|
|
+ table = "ht_analog_173_data";
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("173用电设备无用电数据采集");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("错误数据,设备不存在");
|
|
|
+ }
|
|
|
+ List<HtAnalogDataOneVo> maxMonthlyReport = baseMapper.getEnergyUseListOne(deviceCode, startTime, endTime, cycle, 1, 10000, startCurrent,table);
|
|
|
+ List<HtAnalogDataOneVo> minMonthlyReport = baseMapper.getEnergyUseListOne(deviceCode, startTime, endTime, cycle, 2, 10000, startCurrent,table);
|
|
|
if (maxMonthlyReport.size() > 0) {
|
|
|
Double epp=0.00;
|
|
|
for (int j = 0; j < maxMonthlyReport.size()+1; j++) {
|