瀏覽代碼

Merge branch 'master' into test

# Conflicts:
#	device-api-service-merc-mini/src/main/java/com/xy/controller/MercMiniDeviceController.java
李进 1 年之前
父節點
當前提交
eec2b6f9fe

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

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

@@ -6,6 +6,7 @@ import com.xy.dto.DeviceDataDayDto;
 import com.xy.dto.be.MercDto;
 import com.xy.service.DeviceDataDayService;
 import com.xy.service.be.MercService;
+import com.xy.utils.Emptys;
 import com.xy.utils.MercAuthUtils;
 import com.xy.utils.PageBean;
 import com.xy.utils.R;
@@ -38,10 +39,15 @@ public class MercMiniDeviceDataController {
     @ApiOperation("设备销售数据统计分页")
     public R<PageBean<DeviceDataDayDto.SumPageVo>> sumPage(@RequestBody @Valid DeviceDataDayDto.SumPageDto dto) {
         dto.setMercId(MercAuthUtils.getMercId());
-        if (CollUtil.isEmpty(getMercDeviceIds())) {
-            return R.ok(new PageBean<>());
+        if (Emptys.check(dto.getDeviceId())) {
+            dto.setMercDeviceIds(CollUtil.newArrayList(dto.getDeviceId()));
+        }else{
+            List<Long> mercDeviceIds = getMercDeviceIds();
+            if (CollUtil.isEmpty(mercDeviceIds)) {
+                return R.ok(new PageBean<>());
+            }
+            dto.setMercDeviceIds(mercDeviceIds);
         }
-        dto.setMercDeviceIds(getMercDeviceIds());
         return R.ok(deviceDataDayService.sumPage(dto).getData());
     }
 
@@ -49,11 +55,15 @@ public class MercMiniDeviceDataController {
     @ApiOperation("设备销售数据统计总计")
     public R<DeviceDataDayDto.SumCountVo> sumCount(@RequestBody @Valid DeviceDataDayDto.SumCountDto dto) {
         dto.setMercId(MercAuthUtils.getMercId());
-        List<Long> mercDeviceIds = getMercDeviceIds();
-        if (CollUtil.isEmpty(mercDeviceIds)) {
-            return R.ok(new DeviceDataDayDto.SumCountVo());
+        if (Emptys.check(dto.getDeviceId())) {
+            dto.setMercDeviceIds(CollUtil.newArrayList(dto.getDeviceId()));
+        }else{
+            List<Long> mercDeviceIds = getMercDeviceIds();
+            if (CollUtil.isEmpty(mercDeviceIds)) {
+                return R.ok(new DeviceDataDayDto.SumCountVo());
+            }
+            dto.setMercDeviceIds(mercDeviceIds);
         }
-        dto.setMercDeviceIds(mercDeviceIds);
         return R.ok(deviceDataDayService.sumCount(dto).getData());
     }
 

+ 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