增加设备名称

This commit is contained in:
qjq
2024-04-16 17:35:07 +08:00
parent ad8e9667dc
commit e47dbf0c4e
6 changed files with 39 additions and 2 deletions

View File

@ -18,6 +18,8 @@ public class DeviceRespVO {
private BigDecimal money;
@Schema(description = "时间段", example = "早上")
private String time;
@Schema(description = "设备名称", example = "1号机")
private String deviceName;
/**
* 预留,设备热门菜品
*/

View File

@ -64,4 +64,15 @@ public enum TimePeriodEnum {
return CostTypeEnum.NIGHT.getCode();
}
}
public static String getTimeName(LocalDateTime localDateTime){
int hour = localDateTime.getHour();
if(TimePeriodEnum.MORNING.startInt<=hour && hour<=TimePeriodEnum.MORNING.endInt){
return CostTypeEnum.MORNING.getName();
} else if (TimePeriodEnum.MIDDAY.startInt<=hour && hour<=TimePeriodEnum.MIDDAY.endInt){
return CostTypeEnum.NOON.getName();
}else{
return CostTypeEnum.NIGHT.getName();
}
}
}

View File

@ -80,8 +80,9 @@ public class DeviceMoneyJob implements JobHandler {
List<OrderDetailDO> value = map.getValue();
//设置设备ip
bean.setDeviceIp(map.getKey());
bean.setDeviceName(deviceInfoApi.getDeviceInfoName(map.getKey()));
//根据时间进行时间段赋值
value.forEach(v -> v.setCreator(TimePeriodEnum.getTimePeriod(v.getCreateTime())));
value.forEach(v -> v.setCreator(TimePeriodEnum.getTimeName(v.getCreateTime())));
//根据时间段分组
value.stream().collect(Collectors.groupingBy(OrderDetailDO::getCreator))
.forEach((k, v) -> {

View File

@ -209,8 +209,9 @@ public class CarteenMoneyServiceImpl implements CarteenMoneyService {
List<OrderDetailDO> value = map.getValue();
//设置设备ip
deviceRespVO.setDeviceIp(map.getKey());
deviceRespVO.setDeviceName(deviceInfoApi.getDeviceInfoName(map.getKey()));
//根据时间进行时间段赋值
value.forEach(v -> v.setCreator(TimePeriodEnum.getTimePeriod(v.getCreateTime())));
value.forEach(v -> v.setCreator(TimePeriodEnum.getTimeName(v.getCreateTime())));
//根据时间段分组
value.stream().collect(Collectors.groupingBy(OrderDetailDO::getCreator))
.forEach((k, v) -> {