Sfoglia il codice sorgente

设备列表卡包信息

李进 1 anno fa
parent
commit
fc8db17bc9

+ 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);
     }
 

+ 4 - 2
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -126,7 +126,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);
     }
@@ -813,7 +815,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
             Long districtId = v.getDistrictId();
             vo.setDeviceNum(v.getDeviceNum());
             vo.setDistrictId(v.getDistrictId());
-            vo.setDistrictName(v.getDistrictId()==-1L ? "未分配区域" : districtMap.get(v.getDistrictId()));
+            vo.setDistrictName(v.getDistrictId() == -1L ? "未分配区域" : districtMap.get(v.getDistrictId()));
             //区域下的设备列表
             List<DeviceInfoDto.MercHomeDeviceVo> deviceInfos = BeanUtil.copyToList(deviceMap.get(districtId), DeviceInfoDto.MercHomeDeviceVo.class);
             if (CollUtil.isEmpty(deviceInfos)) {

+ 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

@@ -420,8 +420,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