|
@@ -85,6 +85,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
private final RedisService<String> redisService;
|
|
|
|
|
|
+ private final GoodsService goodsService;
|
|
|
+
|
|
|
private final String keyPrefix = "device:history:";
|
|
|
|
|
|
private final FileUtils fileUtils;
|
|
@@ -581,6 +583,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
//设备销售统计
|
|
|
String todayDate = DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN);
|
|
|
List<Long> deviceIds = deviceInfos.stream().map(DeviceInfoDto.MercHomeDeviceVo::getDeviceId).collect(Collectors.toList());
|
|
|
+
|
|
|
//统计条件:当天
|
|
|
DeviceDataDto.ListDTO deviceDataListDTO = new DeviceDataDto.ListDTO()
|
|
|
.setDeviceIds(deviceIds).setType(DictSonEnum.DEVICE_DATA_TYPE_DAY.getKey()).setDateValue(Integer.valueOf(todayDate)).setMercId(mercId);
|
|
@@ -597,7 +600,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
if (CollUtil.isNotEmpty(deviceStatusList)) {
|
|
|
datdeviceStatusMap = deviceStatusList.stream().collect(Collectors.toMap(DeviceStatusDto.Vo::getDeviceId, d -> d));
|
|
|
}
|
|
|
-
|
|
|
+ List<GoodsDeviceDto.Vo> goodsDeviceList = R.feignCheckData(goodsService.queryGoodsDeviceInfo(new GoodsDto.QueryGoodsDeviceInfo().setDeviceIds(deviceIds)));
|
|
|
+ Map<Long, GoodsDeviceDto.Vo> deviceIdGoodsMap = goodsDeviceList.stream().collect(Collectors.toMap(GoodsDeviceDto.Vo::getDeviceId, d -> d));
|
|
|
for (DeviceInfoDto.MercHomeDeviceVo device : deviceInfos) {
|
|
|
Long dId = device.getDeviceId();
|
|
|
//设备类型 反显
|
|
@@ -607,15 +611,14 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
SysDictRedis dictBusyState = SysDictUtils.get(DictConsts.DEVICE_BUSY_STATUS, String.valueOf(device.getBusyState()));
|
|
|
device.setBusyStateName(dictBusyState.getMsg());
|
|
|
DeviceDataDto.Vo deviceData = dataMap.get(dId);
|
|
|
-
|
|
|
+ Integer zero = new Integer(0);
|
|
|
//今日销售、库存情况 反显
|
|
|
- device.setDayOrderNum(deviceData != null ? deviceData.getSalesCount() : 0);
|
|
|
- device.setDaySalesPrice(deviceData != null ? deviceData.getSalesMoney() : 0);
|
|
|
+ device.setDayOrderNum(deviceData != null ? deviceData.getSalesCount() : zero);
|
|
|
+ device.setDaySalesPrice(deviceData != null ? deviceData.getSalesMoney() : zero);
|
|
|
DeviceStatusDto.Vo deviceStatus = datdeviceStatusMap.get(device.getDeviceId());
|
|
|
- Integer stock = Emptys.check(deviceStatus.getStock()) ? deviceStatus.getStock() : 0;
|
|
|
- device.setOnSaleNum(stock);
|
|
|
- Integer afterFillStock = Emptys.check(deviceStatus.getAfterFillStock()) ? deviceStatus.getAfterFillStock() : 0;
|
|
|
- device.setFillNum(afterFillStock);
|
|
|
+ GoodsDeviceDto.Vo goodsDevice = deviceIdGoodsMap.get(dId);
|
|
|
+ device.setOnSaleNum(goodsDevice == null ? zero : goodsDevice.getStock());
|
|
|
+ device.setFillNum(goodsDevice == null ? zero : goodsDevice.getFillCount());
|
|
|
//联网状态
|
|
|
Integer netState = deviceStatus == null ? DeviceNetSateType.DISCONNECT.getCode() : deviceStatus.getNetState();
|
|
|
device.setNetState(netState);
|
|
@@ -980,6 +983,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
//根据设备ID查商品id
|
|
|
GoodsDeviceDto.SelectList selectList = new GoodsDeviceDto.SelectList();
|
|
|
selectList.setDeviceIds(CollUtil.newArrayList(deviceId));
|
|
|
+ selectList.setMercId(dto.getMercId());
|
|
|
R<List<GoodsDeviceDto.Vo>> r = R.feignCheck(goodsDeviceService.list(selectList));
|
|
|
List<GoodsDeviceDto.Vo> goodsDeviceList = r.getData();
|
|
|
goodsData.setCategoryNum(CollUtil.isNotEmpty(goodsDeviceList) ? goodsDeviceList.size() : 0);
|