whyclxw
2024-07-23 a2cb0eed5a0bb7cf9d5eb8afe74f4ba6836205b4
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
package com.whyc.controller;
 
import com.whyc.dto.Response;
import com.whyc.pojo.BOMFeedback;
import com.whyc.pojo.DefectiveProducts;
import com.whyc.service.BOMFeedbakService;
import com.whyc.service.DefectiveProductsService;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.mail.MessagingException;
import java.io.IOException;
import java.util.List;
 
@RestController
@Api(tags = "不良品管理")
@RequestMapping("defective")
public class DefectiveProductsController {
 
    @Autowired
    private DefectiveProductsService service;
 
    @ApiOperation("录入不良品信息")
    @PostMapping("addDefective")
    public Response addDefective(@RequestPart(required = false) List<MultipartFile> multipartFileList, @RequestParam String defectiveJson) throws IOException, MessagingException {
        DefectiveProducts defective= ActionUtil.getGson().fromJson(defectiveJson, DefectiveProducts.class);
        return service.addDefective(defective,multipartFileList);
    }
}