package com.fuyuanshen.app.controller.device;

import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto;
import com.fuyuanshen.app.domain.dto.DeviceInstructDto;
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.core.validate.AddGroup;
import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessAnnotation;
import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessBatcAnnotation;
import com.fuyuanshen.common.web.core.BaseController;
import com.fuyuanshen.equipment.domain.dto.AppDeviceSendMsgBo;
import com.fuyuanshen.web.service.device.DeviceBJQBizService;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * BJQ6170设备控制类
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/test")
public class TestController extends BaseController {

    private final DeviceBJQBizService appDeviceService;


    /**
     * 上传设备logo图片
     */
    @PostMapping("/uploadLogo")
    @FunctionAccessAnnotation("uploadLogo")
    public R<Void> upload(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) {

        MultipartFile file = bo.getFile();
        if(file.getSize()>1024*1024*2){
            return R.warn("图片不能大于2M");
        }
        appDeviceService.uploadDeviceLogo2(bo);

        return R.ok();
    }

}
