| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.ProductDto; |
| | | import com.ruoyi.basic.dto.StructureTestObjectDto; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @ApiOperation(value = "获取项目检验参数列表") |
| | | @GetMapping("/selectItemParameterList") |
| | | public Result selectItemParameterList(Page page,StructureItemParameter itemParameter) { |
| | | public Result selectItemParameterList(Page page, StructureItemParameter itemParameter) { |
| | | return Result.success(capacityScopeService.selectItemParameterList(page, itemParameter)); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiOperation(value = "获取检验对象") |
| | | @GetMapping("/selectTestObjectList") |
| | | public Result selectTestObjectList(Page page,PageTestObjectDto pageTestObjectDto) { |
| | | public Result selectTestObjectList(Page page, PageTestObjectDto pageTestObjectDto) { |
| | | return Result.success(capacityScopeService.selectTestObjectList(page, pageTestObjectDto)); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiOperation(value = "维护检验对象的产品") |
| | | @GetMapping("/selectProductListByObjectId") |
| | | public Result selectProductListByObjectId(Page page,ProductDTO1 productDTO) { |
| | | public Result selectProductListByObjectId(Page page, ProductDTO1 productDTO) { |
| | | return Result.success(productService.selectProductListByObjectId(page, productDTO)); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiOperation(value = "导入检验对象") |
| | | @PostMapping("/importExcel") |
| | | public Result importExcel(@RequestParam("file") MultipartFile file) { |
| | | try { |
| | | public Result importExcel(@RequestParam("file") MultipartFile file){ |
| | | List<String> processedFiles = new ArrayList<>(); |
| | | try (InputStream inputStream = file.getInputStream()) { |
| | | String fileHash = DigestUtils.md5Hex(inputStream); |
| | | if (processedFiles.contains(fileHash)) { |
| | | return Result.success(); // 已处理过的文件直接跳过 |
| | | } |
| | | processedFiles.add(fileHash); |
| | | |
| | | EasyExcel.read(file.getInputStream(), StructureTestObjectData.class, new StructureTestObjectListener(productService)).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // 这里可以根据实际情况进行更完善的错误处理,比如记录日志等 |
| | | System.err.println("读取文件时发生错误: " + e.getMessage()); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "更新车间") |
| | | @ApiOperation(value = "更新产品车间") |
| | | @PostMapping("/updateWorkShop") |
| | | public Result updateWorkShop(Integer productId,Integer workShopId,String name) { |
| | | return Result.success(productService.updateWorkShop(productId,workShopId,name)); |
| | | public Result updateWorkShop(@RequestBody ProductDto productDto) { |
| | | return Result.success(productService.updateWorkShop(productDto.getId(), productDto.getWorkShopId(), productDto.getWorkShopName())); |
| | | } |
| | | |
| | | @ApiOperation(value = "更新检测对象车间") |
| | | @PostMapping("/updateObjectWorkShop") |
| | | public Result updateObjectWorkShop(@RequestBody StructureTestObjectDto structureTestObjectDto) { |
| | | return Result.success(productService.updateObjectWorkShop(structureTestObjectDto)); |
| | | } |
| | | } |