lxw
2023-11-10 677366d1e1b92e0cb50a93a7f4c2a57643bf9448
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.whyc.controller;
 
import com.whyc.pojo.DevUpdateState;
import com.whyc.pojo.Response;
import com.whyc.service.DevUpdateStateService;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
@RequestMapping("devUpdate")
@RestController
@Api(tags = "设备升级")
public class DevUpdateStateController {
    @Autowired
    private DevUpdateStateService service;
 
    @ApiOperation(value = "远程升级")
    @PostMapping("updateDfu")
    @ApiImplicitParam(name = "file", value = "上传的文件", dataTypeClass = MultipartFile.class, required = false,paramType = "form")
    public Response updateDfu(@RequestPart(value = "file",required = false) MultipartFile file, @RequestParam String json){
        DevUpdateState dfu= ActionUtil.getGson().fromJson(json,DevUpdateState.class);
        return service.updateDfu(file,dfu);
    }
 
    @ApiOperation(value = "远程升级停止")
    @GetMapping("stopDfu")
    public Response stopDfu(@RequestParam int devId){
        return service.stopDfu(devId);
    }
}