فهرست منبع

Merge remote-tracking branch 'origin/test' into test

谭斌 1 سال پیش
والد
کامیت
07070434a9

+ 7 - 1
device-api-service-merc-mini/src/main/java/com/xy/controller/MercMiniDeviceController.java

@@ -161,7 +161,13 @@ public class MercMiniDeviceController {
 
                 Integer deviceStateL = deviceStatus.getLockStateL();
                 Integer deviceStateR = deviceStatus.getLockStateR();
-                vo.setSysPower(deviceStatus.getSysPower());
+                Boolean isUseBattery = deviceStatus.getIsUseBattery();
+                if (BooleanUtil.isTrue(isUseBattery)) {
+                    //使用电池。即断电状态
+                    vo.setSysPower(2);
+                } else {
+                    vo.setSysPower(1);
+                }
                 vo.setDeviceStateL(deviceStateL);
                 vo.setDeviceStateR(deviceStateR);
                 DeviceLockState deviceLockStateL = DeviceLockState.getEnumByCode(deviceStateL);

+ 12 - 2
device-api-service/src/main/java/com/xy/service/DeviceAlgorithmChargingServiceImpl.java

@@ -74,7 +74,9 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
         deviceIds.forEach(deviceId -> {
             DeviceAlgorithmChargingDto.CountVo countVo = new DeviceAlgorithmChargingDto.CountVo()
                     .setDeviceId(deviceId)
-                    .setCount(0);
+                    .setCount(0)
+                    .setSize(0)
+                    .setArrearageBalance(0);
             countVos.add(countVo);
         });
         JMap<Long, DeviceAlgorithmChargingDto.CountVo> cover = countVos.toMap(DeviceAlgorithmChargingDto.CountVo::getDeviceId).cover();
@@ -91,7 +93,15 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
                 .le(DeviceAlgorithmCharging::getBeginTime, thisTime)
         );
         JMap<Long, List<DeviceAlgorithmCharging>> group = new JArrayList<>(list).toMap(DeviceAlgorithmCharging::getDeviceId).group();
-        group.forEach((deviceId, deviceAlgorithmChargings) -> cover.get(deviceId).setCount(deviceAlgorithmChargings.size()));
+        group.forEach((deviceId, deviceAlgorithmChargings) -> {
+            DeviceAlgorithmChargingDto.CountVo countVo = cover.get(deviceId);
+            countVo.setCount(deviceAlgorithmChargings.size());
+            int size = 0;
+            for (DeviceAlgorithmCharging deviceAlgorithmCharging : deviceAlgorithmChargings) {
+                size += deviceAlgorithmCharging.getUnusedSize();
+            }
+            countVo.setSize(size);
+        });
         return R.ok(countVos);
     }
 

+ 3 - 1
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -133,7 +133,9 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         JMap<Long, DeviceAlgorithmChargingDto.CountVo> cover = new JArrayList<>(data).toMap(DeviceAlgorithmChargingDto.CountVo::getDeviceId).cover();
         algorithmChargingVos.forEach(algorithmChargingVo -> {
             DeviceAlgorithmChargingDto.CountVo countVo = cover.get(algorithmChargingVo.getDeviceId());
-            algorithmChargingVo.setAlgorithmChargingSize(countVo.getCount());
+            algorithmChargingVo.setAlgorithmChargingSize(countVo.getCount())
+                    .setAlgorithmChargingLength(countVo.getSize())
+                    .setArrearageBalance(countVo.getArrearageBalance());
         });
         return R.ok(algorithmChargingVoPageBean);
     }

+ 7 - 1
device-api/src/main/java/com/xy/dto/DeviceAlgorithmChargingDto.java

@@ -38,8 +38,14 @@ public class DeviceAlgorithmChargingDto {
         @ApiModelProperty(value = "设备id")
         private Long deviceId;
 
-        @ApiModelProperty(value = "卡包数")
+        @ApiModelProperty(value = "卡包数")
         private Integer count;
+
+        @ApiModelProperty(value = "卡包条数")
+        private Integer size;
+
+        @ApiModelProperty(value = "欠费金额")
+        private Integer arrearageBalance;
     }
 
     @Data

+ 7 - 1
device-api/src/main/java/com/xy/dto/DeviceInfoDto.java

@@ -427,8 +427,14 @@ public class DeviceInfoDto {
     @Accessors(chain = true)
     public static class AlgorithmChargingVo extends Vo {
 
-        @ApiModelProperty(value = "卡包数")
+        @ApiModelProperty(value = "卡包数")
         private Integer algorithmChargingSize;
+
+        @ApiModelProperty(value = "卡包条数")
+        private Integer algorithmChargingLength;
+
+        @ApiModelProperty(value = "欠费金额")
+        private Integer arrearageBalance;
     }
 
     @Data