package com.bonus.canteen.core.menuai.api;

import com.alibaba.fastjson.JSON;
import com.bonus.canteen.core.common.constant.LeMqConstant;
import com.bonus.canteen.core.menuai.constants.MenuaiContants;
import com.bonus.canteen.core.menuai.dto.MenuaiDishesNameEditDTO;
import com.bonus.canteen.core.order.mq.MqUtil;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

@Service
public class MenuaiServiceApi {
   private static final Logger log = LoggerFactory.getLogger(MenuaiServiceApi.class);
//   @Autowired
//   private AiPaddleModelServiceImpl aiPaddleModelServiceImpl;
//   @Autowired
//   private MenuaiPictureMapper menuaiPictureMapper;
//   @Autowired
//   private MenuaiV2Service menuaiV2Service;
//   @Autowired
//   private MenuaiV4Service menuaiV4Service;
//   @Autowired
//   private MenuaiV4ServiceImpl menuaiV4ServiceImpl;
//   @Autowired
//   private MenuaiService menuaiService;
//   @Autowired
//   private MenuAiPaddleService menuAiPaddleService;

   public void editMenuaiDishesName(MenuaiDishesNameEditDTO content) {
      Map<String, String> paramMap = Maps.newHashMap();
      paramMap.put("uid", String.valueOf(MenuaiContants.COMMON_STALL_ID));
      Long var10000 = content.getDishesId();
      String oldName = "" + var10000 + "_" + content.getOldDishesName().replace("/", "").replace(" ", "").replace(".", "");
      var10000 = content.getDishesId();
      String newName = "" + var10000 + "_" + content.getNewDishesName().replace("/", "").replace(" ", "").replace(".", "");
      paramMap.put("oldName", oldName);
      paramMap.put("newName", newName);
      log.info("请求修改菜品名称入参:{}", JSON.toJSONString(paramMap));
      paramMap.put("action", "renameDishes");
      MqUtil.pushToTenantAllDevice(paramMap, LeMqConstant.Topic.AI_GATEWAY_MQTT);
   }
//
//   public List<MenuaiRemoveModel> uploadBigPicture(MultipartFile file, Long canteenId, Long stallId, Long dishesId, String cutPictureResult) {
//      if (dishesId != -1L) {
//         MenuaiUploadBigPictureDTO content = new MenuaiUploadBigPictureDTO();
//         content.setCanteenId(canteenId);
//         content.setStallId(stallId);
//         content.setDishesId(dishesId);
//         return this.menuaiV4Service.uploadBigPicture(file, content, cutPictureResult);
//      } else {
//         this.menuaiV4Service.uploadEmptyTray(file, canteenId, stallId, ActionSourceTypeEnum.DEVICE);
//         return Lists.newArrayList();
//      }
//   }
//
//   public List<MenuaiPictureDetailVO> listDishesPicture(MenuaiPictureDetailDTO content) {
//      return this.menuaiV2Service.listDishesPicture(content);
//   }
//
//   public MenuaiDishesRegisterVO pageDishesPictureRegister(MenuaiDishesPictureAndRegisterDTO content) {
//      return this.menuaiV2Service.pageDishesPictureRegister(content);
//   }
//
//   public List<MenuaiRegisterDishesDetailVO> getDishesRegisterDetail(MenuaiRegisterDishesDetailDTO content) {
//      return this.menuaiV2Service.getDishesRegisterDetail(content);
//   }
//
//   public List<MenuaiRemoveModel> removeDishesPictureBatch(List<MenuaiPictureRemoveDTO> content) {
//      return this.menuaiV4Service.removeDishesPictureBatch(content);
//   }
//
//   public MenuaiQueryRegistResultVO packageRegister(MenuaiRegisterSaasDTO content) {
//      return this.menuaiV4Service.packageRegister(content);
//   }
//
//   public MenuaiQueryRegistResultVO queryRegistResult(MenuaiQueryRegistResultDTO content) {
//      return this.menuaiV4Service.queryRegistResult(content);
//   }
//
//   public void uploadMoreDishesFile(MultipartFile multipartFile1, MultipartFile multipartFile2, String path, Integer ifOne, Integer intervalId) {
//      this.menuaiService.uploadMoreDishesFile(multipartFile1, multipartFile2, path, ifOne, intervalId);
//   }
//
//   public List<MenuaiRemoveModel> uploadSmallPicture(MultipartFile multipartFile, MenuaiUploadSmallPictureDTO content) {
//      return this.menuaiV4Service.uploadSmallPicture(multipartFile, content);
//   }
//
//   public MenuaiQueryRegistResultVO packageRegisterPaddle(MenuaiRegisterSaasDTO content) {
//      Integer busLastModifyVersion = 0;
//      return this.menuAiPaddleService.packageRegisterPaddle(content, busLastModifyVersion);
//   }
//
//   public PredictPaddleResultVo packagePredictPaddle(MenuaiRegisterSaasDTO content) {
//      return this.menuAiPaddleService.packagePredictPaddle(content);
//   }
//
//   public PredictPaddleResultVo packagePredictPaddleAll(MenuaiPredictDTO content) {
//      return this.menuAiPaddleService.packagePredictPaddleAll(content);
//   }
//
//   public void packageResetDishesPaddle(MenuaiRegisterSaasDTO content) {
//      Integer busLastModifyVersion = 0;
//      this.menuAiPaddleService.packageResetDishesPaddle(content, busLastModifyVersion);
//   }
//
//   public void packageAppendPaddle(MenuaiRegisterAppendDTO content, FaissIndexActionEnum faissIndexActionEnum) {
//      this.menuAiPaddleService.packageAppendPaddle(content, faissIndexActionEnum);
//   }
//
//   public void packageDeletePaddle(MenuaiRegisterAppendDTO content) {
//      Integer busLastModifyVersion = 0;
//      this.menuAiPaddleService.packageDeletePaddle(content, busLastModifyVersion);
//   }
//
//   public MenuaiQueryRegistResultVO queryRegistPaddleResult(MenuaiQueryRegistResultDTO content) {
//      MenuaiQueryRegistResultVO vo = this.menuaiV4Service.queryRegistResult(content);
//      String requestId = vo.getRequestId();
//      AiPaddleModel aiPaddleModel = this.aiPaddleModelServiceImpl.queryByRequestId(requestId);
//      if (ObjectUtil.isNotNull(aiPaddleModel) && aiPaddleModel.getGenFlag().equals(RegistResultEnum.SUCCESS.key())) {
//         AiPaddleModelVo aiPaddleModelVo = (AiPaddleModelVo)BeanUtil.copyProperties(aiPaddleModel, AiPaddleModelVo.class, new String[0]);
//         aiPaddleModelVo.setModelType(FaissIndexTypeEnum.getValue(aiPaddleModel.getModelType()));
//         Map<String, Object> registerParamMap = (JSONObject)JSON.toJSON(aiPaddleModelVo);
//         vo.setRegisterParamMap(registerParamMap);
//      }
//
//      return vo;
//   }
//
//   public AiPaddleModelVo queryRegistPaddleRecipeResult(Long recipeId, Integer intervalId, FaissIndexTypeEnum faissIndexTypeEnum) {
//      AiPaddleModelVo aiPaddleModelVo = new AiPaddleModelVo();
//      AiPaddleModel aiPaddleModel = this.aiPaddleModelServiceImpl.queryByBusIdAndSubBusId(recipeId, intervalId, faissIndexTypeEnum);
//      if (ObjectUtil.isNotNull(aiPaddleModel) && aiPaddleModel.getGenFlag().equals(RegistResultEnum.SUCCESS.key())) {
//         aiPaddleModelVo = (AiPaddleModelVo)BeanUtil.copyProperties(aiPaddleModel, AiPaddleModelVo.class, new String[0]);
//         aiPaddleModelVo.setModelType(FaissIndexTypeEnum.getValue(aiPaddleModel.getModelType()));
//      }
//
//      return aiPaddleModelVo;
//   }
//
//   public MenuaiQueryRegistResultVO packageRegisterPaddleAll() {
//      return this.menuAiPaddleService.packageAppendPaddleAll();
//   }
//
//   public AiPaddleModelVo queryRegisterSamplePaddleResult(String registerId) {
//      AiPaddleModelVo aiPaddleModelVo = new AiPaddleModelVo();
//      AiPaddleModel aiPaddleModel = this.aiPaddleModelServiceImpl.queryByRequestId(registerId);
//      if (ObjectUtil.isNotNull(aiPaddleModel) && aiPaddleModel.getGenFlag().equals(RegistResultEnum.SUCCESS.key())) {
//         aiPaddleModelVo = (AiPaddleModelVo)BeanUtil.copyProperties(aiPaddleModel, AiPaddleModelVo.class, new String[0]);
//         aiPaddleModelVo.setModelType(FaissIndexTypeEnum.getValue(aiPaddleModel.getModelType()));
//      }
//
//      return aiPaddleModelVo;
//   }
}
