Procházet zdrojové kódy

添加测试数据

yq před 4 roky
rodič
revize
64823ebf73

+ 16 - 0
fiveep-controller/src/main/java/com/bizmatics/controller/web/DeviceController.java

@@ -2,6 +2,8 @@ package com.bizmatics.controller.web;
 
 
 import com.bizmatics.common.core.bean.ApiResult;
+import com.bizmatics.model.Device;
+import com.bizmatics.persistence.mapper.DeviceMapper;
 import com.bizmatics.service.DeviceService;
 import com.bizmatics.service.vo.DeviceCountVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -11,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -26,6 +29,9 @@ public class DeviceController {
     @Autowired
     private DeviceService deviceService;
 
+    @Autowired
+    private DeviceMapper deviceMapper;
+
 
     /**
      * 查询设备总数
@@ -48,5 +54,15 @@ public class DeviceController {
     public ApiResult<DeviceCountVO> selectDeviceCountByType(@RequestParam Integer site){
         return ApiResult.success(deviceService.selectDeviceCountByType(site));
     }
+
+    @GetMapping("/test")
+    public List<String> test(){
+        List<Device> list = deviceMapper.list(1, null, null, null, null, null);
+        List<String> list1 = new ArrayList<>();
+        for (Device device:list) {
+            list1.add(device.getDeviceCode());
+        }
+        return list1;
+    }
 }
 

+ 2 - 2
fiveep-service/src/main/java/com/bizmatics/service/impl/HtAnalogDataServiceImpl.java

@@ -192,8 +192,8 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
     public Double getElectricity(Integer userId,Integer siteId,Date startTime,Date endTime){
         HtAnalogData ascHad = htAnalogDataMapper.selectByStartTime(startTime,endTime, siteId, userId);
         HtAnalogData descHad = htAnalogDataMapper.selectByEndTime(endTime,endTime, siteId, userId);
-        Integer ascHadEpp = Optional.ofNullable(ascHad).map(htAnalogData -> 0).orElse(0);
-        Integer descHadEpp = Optional.ofNullable(descHad).map(htAnalogData -> 0).orElse(0);
+        Double ascHadEpp = Optional.ofNullable(ascHad).map(HtAnalogData::getEpp).orElse(0.00);
+        Double descHadEpp = Optional.ofNullable(descHad).map(HtAnalogData::getEpp).orElse(0.00);
         return Arith.sub(descHadEpp,ascHadEpp);
     }