package com.whyc.controller; import com.whyc.dto.DefectiveDto; import com.whyc.dto.Response; import com.whyc.pojo.BOMFeedback; import com.whyc.pojo.DefectiveProducts; import com.whyc.pojo.DefectiveProductsHistory; 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 multipartFileList, @RequestParam String defectiveJson) throws IOException, MessagingException { DefectiveProducts defective= ActionUtil.getGson().fromJson(defectiveJson, DefectiveProducts.class); return service.addDefective(defective,multipartFileList); } @ApiOperation("处理不良品") @PostMapping("updateDefective") public Response updateDefective(@RequestPart(required = false) List multipartFileList, @RequestParam String defectiveHisJson) { DefectiveProductsHistory defectiveHis= ActionUtil.getGson().fromJson(defectiveHisJson, DefectiveProductsHistory.class); return service.updateDefective(defectiveHis,multipartFileList); } @ApiOperation("归档不良品") @PostMapping("stopDefective") public Response stopDefective(@RequestParam int deftId) { return service.stopDefective(deftId); } @ApiOperation("获取不良品") @GetMapping("getDefectives") public Response getDefectives(@RequestParam String message) { DefectiveDto defectiveDto= ActionUtil.getGson().fromJson(message, DefectiveDto.class); return service.getDefectiveLimit(defectiveDto); } }