增加设备名称
This commit is contained in:
@ -18,6 +18,8 @@ public class DeviceRespVO {
|
||||
private BigDecimal money;
|
||||
@Schema(description = "时间段", example = "早上")
|
||||
private String time;
|
||||
@Schema(description = "设备名称", example = "1号机")
|
||||
private String deviceName;
|
||||
/**
|
||||
* 预留,设备热门菜品
|
||||
*/
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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) -> {
|
||||
|
@ -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) -> {
|
||||
|
Reference in New Issue
Block a user