package com.bonus.canteen.core.device.manage.service;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bonus.canteen.core.device.constants.MacCounterActivateEnum;
import com.bonus.canteen.core.device.manage.mapper.DeviceLockerMapper;
import com.bonus.canteen.core.device.manage.model.DeviceLocker;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.lang.invoke.SerializedLambda;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;

@Service
public class DeviceLockerService {
   @Resource
   private DeviceLockerMapper deviceLockerMapper;
   @Resource
   @Lazy
   private DeviceInfoService deviceInfoService;
//   @Resource
//   @Lazy
//   private OrderDeviceApi orderDeviceApi;
//   @Resource
//   @Lazy
//   private DeviceCounterHandleRecordMapper deviceCounterHandleRecordMapper;
//   @Resource
//   @Lazy
//   private CustInfoApi custInfoApi;

//   @Transactional(
//      rollbackFor = {Exception.class}
//   )
//   public void insertByCount(long deviceId, int count) {
//      if (count > 0) {
//         ArrayList<Long> idList = CollUtil.toList(new Long[0]);
//
//         for(int i = 0; i < count; ++i) {
//            idList.add(Id.next());
//         }
//
//         this.deviceLockerMapper.insertList(idList, deviceId);
//      }
//   }

//   @Transactional(
//      rollbackFor = {Exception.class}
//   )
//   public void deleteByDeviceId(long deviceId) {
//      boolean existsNotEmpty = this.deviceLockerMapper.exists((Wrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(DeviceLocker.class).eq(DeviceLocker::getLockerStatus, MacCounterStatusEnum.NOT_EMPTY.key())).eq(DeviceLocker::getDeviceId, deviceId));
//      if (existsNotEmpty) {
//         throw new LeException(RetCodeEnum.MAC_IS_NOT_EMPTY_MEALS_COUNTER, "取餐柜内还有商品,不可删除 ^_^");
//      } else {
//         this.deviceLockerMapper.delete((Wrapper)Wrappers.lambdaQuery(DeviceLocker.class).eq(DeviceLocker::getDeviceId, deviceId));
//      }
//   }
//
//   @Transactional(
//      rollbackFor = {Exception.class}
//   )
//   public void updateByDeviceId(long deviceId, int count) {
//      this.deleteByDeviceId(deviceId);
//      this.insertByCount(deviceId, count);
//   }
//
//   public void updateOrdIdAndMealCode(Long ordId, Integer mealCode, Integer lockerStatus, Long deviceId, Integer lockerNum) {
//      this.deviceLockerMapper.update((Object)null, (Wrapper)((LambdaUpdateWrapper)((LambdaUpdateWrapper)((LambdaUpdateWrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(DeviceLocker.class).eq(DeviceLocker::getDeviceId, deviceId)).eq(DeviceLocker::getLockerNum, lockerNum)).set(DeviceLocker::getLockerStatus, lockerStatus)).set(DeviceLocker::getOrdId, ordId)).set(ObjectUtil.isNotNull(mealCode), DeviceLocker::getMealCode, mealCode));
//   }
//
//   public void editCounterWorkStatus(List<MacCounterWorkStatusEditDTO> content) {
//      Iterator var2 = content.iterator();
//
//      while(var2.hasNext()) {
//         MacCounterWorkStatusEditDTO editDTO = (MacCounterWorkStatusEditDTO)var2.next();
//         this.deviceLockerMapper.update((Object)null, (Wrapper)((LambdaUpdateWrapper)((LambdaUpdateWrapper)((LambdaUpdateWrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(DeviceLocker.class).eq(DeviceLocker::getDeviceId, editDTO.getMachineId())).eq(DeviceLocker::getLockerNum, editDTO.getCounterNum())).set(DeviceLocker::getIsSterilize, editDTO.getIsSterilize())).set(DeviceLocker::getIsLight, editDTO.getIsLight())).set(DeviceLocker::getIsHeat, editDTO.getIsHeat()));
//      }
//
//   }
//
//   public void reportFaultCounterNum(MacCounterNumFaultReportDTO content, String machineSn) {
//      DeviceInfo deviceInfo = this.deviceInfoService.getBySn(machineSn);
//      if (ObjectUtil.isNull(deviceInfo)) {
//         throw new LeException("设备信息有误,请重启取餐柜后重试 ^_^");
//      } else {
//         this.deviceLockerMapper.update((Object)null, (Wrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(DeviceLocker.class).in(DeviceLocker::getLockerNum, content.getCounterNumList())).set(DeviceLocker::getActivate, content.getActivate()));
//      }
//   }
//
//   public void increaseOpenTime(Long ordId, Integer counterNum) {
//      this.deviceLockerMapper.increaseOpenTime(ordId, counterNum);
//   }
//
//   public void putCounterEmptyBatch(MacMealsCounterPutEmptyDTO content) {
//      if (content.getMachineId() != null && !CollectionUtils.isEmpty(content.getCounterNumList())) {
//         String username = SecurityUtils.getUser().getUsername();
//         Iterator var3 = content.getCounterNumList().iterator();
//
//         while(var3.hasNext()) {
//            Integer counterNum = (Integer)var3.next();
//            this.deviceLockerMapper.update((Object)null, (Wrapper)((LambdaUpdateWrapper)((LambdaUpdateWrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(DeviceLocker.class).eq(DeviceLocker::getDeviceId, content.getMachineId())).eq(DeviceLocker::getLockerNum, counterNum)).set(DeviceLocker::getUpby, username)).set(DeviceLocker::getLockerStatus, MacCounterStatusEnum.IS_EMPTY.key()));
//         }
//
//      } else {
//         throw new LeException(RetCodeEnum.MAC_NO_PARAM_VARIABLE, "设备编号或柜门编号为空,请重试 ^_^");
//      }
//   }
//
//   public void disabledMealCounter(DeviceLockerDisabledDTO dto) {
//      this.deviceLockerMapper.update((Object)null, (Wrapper)((LambdaUpdateWrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(DeviceLocker.class).eq(DeviceLocker::getDeviceId, dto.getDeviceId())).eq(DeviceLocker::getLockerNum, dto.getLockerNum())).set(DeviceLocker::getActivate, dto.getActivate()));
//   }
//
//   public DeviceLocker getByDeviceIdAndNum(Long deviceId, Integer lockerNum) {
//      return (DeviceLocker)this.deviceLockerMapper.selectOne((Wrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(DeviceLocker.class).eq(DeviceLocker::getDeviceId, deviceId)).eq(DeviceLocker::getLockerNum, lockerNum));
//   }
//
//   public List<DeviceLocker> list(DeviceLockerSearchDTO param) {
//      LambdaQueryWrapper<DeviceLocker> queryWrapper = Wrappers.lambdaQuery(DeviceLocker.class);
//      if (param.getDeviceId() != null) {
//         queryWrapper.eq(DeviceLocker::getDeviceId, param.getDeviceId());
//      }
//
//      if (param.getOrdId() != null) {
//         queryWrapper.eq(DeviceLocker::getOrdId, param.getOrdId());
//      }
//
//      if (param.getMealCode() != null) {
//         queryWrapper.eq(DeviceLocker::getMealCode, param.getMealCode());
//      }
//
//      if (param.getLockerStatus() != null) {
//         queryWrapper.eq(DeviceLocker::getLockerStatus, param.getLockerStatus());
//      }
//
//      if (param.getActivate() != null) {
//         queryWrapper.eq(DeviceLocker::getActivate, param.getActivate());
//      }
//
//      return this.deviceLockerMapper.selectList(queryWrapper);
//   }
//
//   public List<DeviceLockerVO> fillVo(List<DeviceLocker> dataList) {
//      return (List)(CollUtil.isEmpty(dataList) ? CollUtil.newArrayList(new DeviceLockerVO[0]) : (List)dataList.stream().map(DeviceLockerVO::of).collect(Collectors.toList()));
//   }
//
//   public List<DeviceLockerVO> fillWithOrderInfoVo(List<DeviceLocker> dataList) {
//      if (CollUtil.isEmpty(dataList)) {
//         return CollUtil.newArrayList(new DeviceLockerVO[0]);
//      } else {
//         List<DeviceLockerVO> deviceLockerList = (List)dataList.stream().map(DeviceLockerVO::of).collect(Collectors.toList());
//         if (CollUtil.isEmpty(deviceLockerList)) {
//            return CollUtil.newArrayList(new DeviceLockerVO[0]);
//         } else {
//            List<OrderInfoVO> orderInfoVOList = this.orderDeviceApi.listOrderInfoVOByOrderIds(dataList.stream().map(DeviceLocker::getOrdId).filter(Objects::nonNull).distinct().toList());
//            Map<Long, List<OrderInfoVO>> orderMap = (Map)orderInfoVOList.stream().collect(Collectors.groupingBy(OrderInfoVO::getOrderId));
//            deviceLockerList.forEach((deviceLocker) -> {
//               List<OrderInfoVO> orderList = (List)orderMap.get(deviceLocker.getOrdId());
//               if (ObjectUtil.isNotEmpty(orderList)) {
//                  OrderInfoVO orderInfoVO = (OrderInfoVO)orderList.get(0);
//                  if (Optional.ofNullable(orderInfoVO).isPresent() && !CollUtil.isEmpty(orderInfoVO.getOrderDetailList())) {
//                     orderInfoVO.getOrderDetailList().forEach((info) -> {
//                        StringBuilder builder = new StringBuilder();
//                        String goodsDishesName = (String)Optional.ofNullable(info.getGoodsDishesName()).orElse("");
//                        Integer quantity = (Integer)Optional.ofNullable(info.getQuantity()).orElse(0);
//                        builder.append(goodsDishesName).append("*").append(quantity);
//                        info.setGoodsDishesName(builder.toString());
//                     });
//                     List<String> goodsDishesNameList = (List)orderInfoVO.getOrderDetailList().stream().map(OrderDetailVO::getGoodsDishesName).collect(Collectors.toList());
//                     goodsDishesNameList = (List)Optional.ofNullable(goodsDishesNameList).orElse(CollUtil.newArrayList(new String[0]));
//                     String menuDetail = String.join(";", goodsDishesNameList);
//                     deviceLocker.setGoodsDishesName(menuDetail);
//                     deviceLocker.setConsigneeName(orderInfoVO.getConsigneeName());
//                     deviceLocker.setConsigneeMobile(orderInfoVO.getConsigneeMobile());
//                  }
//               }
//
//            });
//            return deviceLockerList;
//         }
//      }
//   }
//
//   public List<Integer> listWaitLockerNum(Long custId, String deviceSn) {
//      return this.deviceLockerMapper.listWaitLockerNum(custId, deviceSn);
//   }
//
//   public List<Integer> listLockerNumByOrdId(Long ordId) {
//      List<DeviceLocker> deviceLockers = this.deviceLockerMapper.selectList((Wrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(DeviceLocker.class).eq(DeviceLocker::getOrdId, ordId)).eq(DeviceLocker::getLockerStatus, MacCounterStatusEnum.NOT_EMPTY.key())).orderByAsc(DeviceLocker::getOpenTime)).orderByAsc(DeviceLocker::getLockerNum));
//      return (List)deviceLockers.stream().map(DeviceLocker::getLockerNum).collect(Collectors.toList());
//   }
//
//   public Long getEmptyAndEnableLocker(Long deviceId) {
//      return this.deviceLockerMapper.selectCount((Wrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(DeviceLocker.class).eq(DeviceLocker::getDeviceId, deviceId)).eq(DeviceLocker::getLockerStatus, MacCounterStatusEnum.IS_EMPTY.key())).eq(DeviceLocker::getActivate, MacCounterActivateEnum.ENABLED.key()));
//   }

   public Long getActiveLockerCount(Long deviceId) {
      return this.deviceLockerMapper.selectCount(Wrappers.lambdaQuery(DeviceLocker.class)
              .eq(DeviceLocker::getDeviceId, deviceId).eq(DeviceLocker::getActivate, MacCounterActivateEnum.ENABLED.key()));
   }

//   public Integer getMinOpenableLocker(Long deviceId) {
//      return this.deviceLockerMapper.getMinOpenableLocker(deviceId);
//   }
//
//   public Integer selectMealCodeByOrdId(Long ordId) {
//      DeviceLocker deviceLocker = (DeviceLocker)this.deviceLockerMapper.selectOne((Wrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(DeviceLocker.class).eq(DeviceLocker::getOrdId, ordId)).eq(DeviceLocker::getLockerStatus, MacCounterStatusEnum.NOT_EMPTY.key())).eq(DeviceLocker::getActivate, MacCounterActivateEnum.ENABLED.key())).last("LIMIT 1"));
//      return deviceLocker != null ? deviceLocker.getMealCode() : null;
//   }
//
//   public List<DeviceLocker> listByDeviceIds(Collection<Long> deviceIds) {
//      return this.deviceLockerMapper.selectList((Wrapper)Wrappers.lambdaQuery(DeviceLocker.class).in(DeviceLocker::getDeviceId, deviceIds));
//   }
//
//   public List<DeviceCounterHandleRecordVO> listHandleRecord(String deviceSn) {
//      DeviceInfoVO deviceInfo = this.deviceInfoService.getDeviceInfoVoBySnCacheable(deviceSn);
//      if (!ObjectUtil.isNull(deviceInfo) && !ObjectUtil.isNull(deviceInfo.getDeviceId())) {
//         Long deviceId = deviceInfo.getDeviceId();
//         return this.deviceCounterHandleRecordMapper.selectRecordListByDeviceId(deviceId);
//      } else {
//         throw new LeException("设备信息有误,请重启取餐柜后重试 ^_^");
//      }
//   }
//
//   public List<DeviceCounterStateVO> listCounterState(String machineSn) {
//      DeviceInfoVO deviceInfo = this.deviceInfoService.getDeviceInfoVoBySnCacheable(machineSn);
//      if (!ObjectUtil.isNull(deviceInfo) && !ObjectUtil.isNull(deviceInfo.getDeviceId())) {
//         Long deviceId = deviceInfo.getDeviceId();
//         return this.deviceLockerMapper.selectCounterState(deviceId);
//      } else {
//         throw new LeException("设备信息有误,请重启取餐柜后重试 ^_^");
//      }
//   }
//
//   public List<DeviceLocker> searchLastMonth(DeviceLockerSearchDTO param) {
//      List<Long> orderIdList = this.getOrderIdByMoblieOrCustName(param);
//      if (CollUtil.isEmpty(orderIdList) && (ObjectUtil.isNotEmpty(param.getCustMobile()) || ObjectUtil.isNotEmpty(param.getCustName()))) {
//         orderIdList.add(0L);
//      }
//
//      LambdaQueryWrapper<DeviceLocker> queryWrapper = Wrappers.lambdaQuery(DeviceLocker.class);
//      param.setOrdIdList(orderIdList);
//      if (param.getDeviceId() != null) {
//         queryWrapper.eq(DeviceLocker::getDeviceId, param.getDeviceId());
//      }
//
//      if (ObjectUtil.isNotNull(param.getOrdId())) {
//         param.getOrdIdList().add(param.getOrdId());
//      }
//
//      queryWrapper.in(CollUtil.isNotEmpty(param.getOrdIdList()), DeviceLocker::getOrdId, param.getOrdIdList());
//      return (List)(queryWrapper.isEmptyOfWhere() ? CollUtil.newArrayList(new DeviceLocker[0]) : this.deviceLockerMapper.selectList(queryWrapper));
//   }
//
//   private List<Long> getOrderIdByMoblieOrCustName(DeviceLockerSearchDTO param) {
//      List<Long> orderIdList = CollUtil.newArrayList(new Long[0]);
//      Optional<CustInfo> optional = Optional.empty();
//      if (ObjectUtil.isNotEmpty(param.getCustName())) {
//         optional = this.custInfoApi.getCustInfoCustName(param.getCustName());
//      }
//
//      if (ObjectUtil.isNotEmpty(param.getCustMobile())) {
//         optional = this.custInfoApi.getNormalOneByMobile(param.getCustMobile());
//      }
//
//      if (optional.isPresent()) {
//         CustInfo custInfo = (CustInfo)optional.get();
//         orderIdList = this.orderDeviceApi.listOrderInfoVOByCustId(custInfo.getCustId(), LocalDate.now().minusMonths(1L));
//      }
//
//      return (List)orderIdList;
//   }
//
//   // $FF: synthetic method
//   private static Object $deserializeLambda$(SerializedLambda lambda) {
//      switch (lambda.getImplMethodName()) {
//         case "getDeviceId":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getDeviceId;
//            }
//            break;
//         case "getMealCode":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getMealCode;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getMealCode;
//            }
//            break;
//         case "getIsSterilize":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getIsSterilize;
//            }
//            break;
//         case "getOpenTime":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getOpenTime;
//            }
//            break;
//         case "getOrdId":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getOrdId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getOrdId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getOrdId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getOrdId;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
//               return DeviceLocker::getOrdId;
//            }
//            break;
//         case "getLockerNum":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerNum;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerNum;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerNum;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerNum;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerNum;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerNum;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerNum;
//            }
//            break;
//         case "getIsHeat":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getIsHeat;
//            }
//            break;
//         case "getLockerStatus":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerStatus;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerStatus;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerStatus;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerStatus;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerStatus;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerStatus;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getLockerStatus;
//            }
//            break;
//         case "getUpby":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//               return DeviceLocker::getUpby;
//            }
//            break;
//         case "getIsLight":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getIsLight;
//            }
//            break;
//         case "getActivate":
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getActivate;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getActivate;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getActivate;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getActivate;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getActivate;
//            }
//
//            if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/device/manage/model/DeviceLocker") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//               return DeviceLocker::getActivate;
//            }
//      }
//
//      throw new IllegalArgumentException("Invalid lambda deserialization");
//   }
}
