增加设备名称
This commit is contained in:
@ -18,6 +18,8 @@ public class DeviceRespVO {
|
|||||||
private BigDecimal money;
|
private BigDecimal money;
|
||||||
@Schema(description = "时间段", example = "早上")
|
@Schema(description = "时间段", example = "早上")
|
||||||
private String time;
|
private String time;
|
||||||
|
@Schema(description = "设备名称", example = "1号机")
|
||||||
|
private String deviceName;
|
||||||
/**
|
/**
|
||||||
* 预留,设备热门菜品
|
* 预留,设备热门菜品
|
||||||
*/
|
*/
|
||||||
|
@ -64,4 +64,15 @@ public enum TimePeriodEnum {
|
|||||||
return CostTypeEnum.NIGHT.getCode();
|
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();
|
List<OrderDetailDO> value = map.getValue();
|
||||||
//设置设备ip
|
//设置设备ip
|
||||||
bean.setDeviceIp(map.getKey());
|
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))
|
value.stream().collect(Collectors.groupingBy(OrderDetailDO::getCreator))
|
||||||
.forEach((k, v) -> {
|
.forEach((k, v) -> {
|
||||||
|
@ -209,8 +209,9 @@ public class CarteenMoneyServiceImpl implements CarteenMoneyService {
|
|||||||
List<OrderDetailDO> value = map.getValue();
|
List<OrderDetailDO> value = map.getValue();
|
||||||
//设置设备ip
|
//设置设备ip
|
||||||
deviceRespVO.setDeviceIp(map.getKey());
|
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))
|
value.stream().collect(Collectors.groupingBy(OrderDetailDO::getCreator))
|
||||||
.forEach((k, v) -> {
|
.forEach((k, v) -> {
|
||||||
|
@ -10,4 +10,11 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface DeviceInfoApi {
|
public interface DeviceInfoApi {
|
||||||
List<DeviceInfoDto> getDeviceInfoList(Long carteenId);
|
List<DeviceInfoDto> getDeviceInfoList(Long carteenId);
|
||||||
|
/**
|
||||||
|
* @Description: 根据设备ip获取设备名称
|
||||||
|
* @Author: qjq
|
||||||
|
* @Date: 2024/4/16 下午5:26
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getDeviceInfoName(String deviceIp);
|
||||||
}
|
}
|
||||||
|
@ -23,4 +23,19 @@ public class DeviceInfoApiImpl implements DeviceInfoApi {
|
|||||||
return BeanUtils.toBean(deviceInfoMapper.selectList(new LambdaQueryWrapperX<DeviceInfoDO>()
|
return BeanUtils.toBean(deviceInfoMapper.selectList(new LambdaQueryWrapperX<DeviceInfoDO>()
|
||||||
.eqIfPresent(DeviceInfoDO::getCarteenId, carteenId)), DeviceInfoDto.class);
|
.eqIfPresent(DeviceInfoDO::getCarteenId, carteenId)), DeviceInfoDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param deviceIp
|
||||||
|
* @return
|
||||||
|
* @Description: 根据设备ip获取设备名称
|
||||||
|
* @Author: qjq
|
||||||
|
* @Date: 2024/4/16 下午5:26
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getDeviceInfoName(String deviceIp) {
|
||||||
|
return deviceInfoMapper.selectOne(new LambdaQueryWrapperX<DeviceInfoDO>()
|
||||||
|
.eq(DeviceInfoDO::getDeviceIp, deviceIp)
|
||||||
|
.last(" limit 1"))
|
||||||
|
.getDeviceName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user