| | |
| | | |
| | | @ApiOperation(value = "删除标准树的层级") |
| | | @DeleteMapping("/delStandardTree") |
| | | public Result delStandardTree(String tree) { |
| | | return Result.success(standardTreeService.delStandardTree(tree)); |
| | | public Result delStandardTree(String level, String id) { |
| | | return Result.success(standardTreeService.delStandardTree(level,id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "通过标准树查询对应的检验项目") |
| | |
| | | |
| | | int addStandardTree(ModelAddDto modelAddDto); |
| | | |
| | | int delStandardTree(String tree); |
| | | int delStandardTree(String level,String id); |
| | | |
| | | List<BasicTreeDto> getStandardTree2(); |
| | | |
| | |
| | | return map; |
| | | } |
| | | StringBuilder checkItemQueryTree = new StringBuilder(); // 检查项查询 |
| | | StringBuilder productTree = new StringBuilder(); // 检验产品树 |
| | | // 判断是否包含车间 |
| | | boolean existWorkShopFlag = this.existWorkShop(tree); |
| | | // 车间层级多一层级 |
| | |
| | | case 7: |
| | | sampleType = trees[4]; |
| | | checkItemQueryTree.append("\"").append(trees[4]).append("\",\"").append(trees[5]).append("\",\"").append(trees[6]).append("\""); |
| | | productTree.append("\"").append(trees[4]).append("\",\"").append(trees[5]).append("\""); |
| | | break; |
| | | case 6: |
| | | sampleType = trees[4]; |
| | |
| | | case 6: |
| | | sampleType = trees[3]; |
| | | checkItemQueryTree.append("\"").append(trees[3]).append("\",\"").append(trees[4]).append("\",\"").append(trees[5]).append("\""); |
| | | productTree.append("\"").append(trees[3]).append("\",\"").append(trees[4]).append("\""); |
| | | break; |
| | | case 5: |
| | | sampleType = trees[3]; |
| | |
| | | List<StandardMethodList> standardMethodListArray = standardMethodListMapper.selectStandardMethodLists(checkItemQueryTree.toString()); |
| | | // 查不到查询检查对象 |
| | | if(CollectionUtils.isEmpty(standardMethodListArray)){ |
| | | standardMethodListArray = standardMethodListMapper.selectStandardMethodLists(sampleType); |
| | | // 如果是完整层级,向上推到产品层级 |
| | | if((existWorkShopFlag&&trees.length == 7) || (!existWorkShopFlag&&trees.length == 6)){ |
| | | standardMethodListArray = standardMethodListMapper.selectStandardMethodLists(productTree.toString()); |
| | | |
| | | } |
| | | // 还是为空查询对象层级 |
| | | if(CollectionUtils.isEmpty(standardMethodListArray)){ |
| | | standardMethodListArray = standardMethodListMapper.selectStandardMethodLists(sampleType); |
| | | } |
| | | } |
| | | map.put("standardMethodList", standardMethodListArray); |
| | | return map; |
| | |
| | | import com.ruoyi.basic.service.StandardMethodListService; |
| | | import com.ruoyi.basic.service.StandardProductListService; |
| | | import com.ruoyi.basic.service.StandardProductListUpdateRecordService; |
| | | import com.ruoyi.common.config.MinioConfig; |
| | | import com.ruoyi.common.core.domain.MinioResult; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | |
| | | @Resource |
| | | private MinioUtils minioUtils; |
| | | |
| | | @Value("${minio.bucketName}") |
| | | private String bucketName; |
| | | @Autowired |
| | | private MinioConfig minioConfig; |
| | | |
| | | /** |
| | | * 标准树下检验项修改记录分页查询 |
| | |
| | | @Override |
| | | public void uploadRecordFile(MultipartFile file, Long id) { |
| | | try { |
| | | MinioResult result = minioUtils.upload(bucketName, file, true); |
| | | MinioResult result = minioUtils.upload(minioConfig.getBucketName(), file, true); |
| | | // 保存路径 |
| | | StandardProductListUpdateRecord standardProductListUpdateRecord = new StandardProductListUpdateRecord(); |
| | | standardProductListUpdateRecord.setId(id); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int delStandardTree(String tree) { |
| | | String[] trees = tree.split(" - "); |
| | | switch (trees.length) { |
| | | case 5: |
| | | if (trees[3].equals("null")) { |
| | | standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).isNull(StandardTree::getSample).eq(StandardTree::getModel, trees[4])); |
| | | } else { |
| | | standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4])); |
| | | } |
| | | break; |
| | | public int delStandardTree(String level,String id) { |
| | | if(BasicTreeEnums.MODEL_TYPE.getCode().equals(level)){ |
| | | modelMapper.deleteById(id); |
| | | } |
| | | return 1; |
| | | } |
| | |
| | | import com.ruoyi.basic.mapper.*; |
| | | import com.ruoyi.basic.pojo.*; |
| | | import com.ruoyi.basic.service.WorkShopFileService; |
| | | import com.ruoyi.common.config.MinioConfig; |
| | | import com.ruoyi.common.utils.file.MinioUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Resource |
| | | private MinioUtils minioUtils; |
| | | |
| | | @Value("${minio.bucketName}") |
| | | private String bucketName; |
| | | @Autowired |
| | | private MinioConfig minioConfig; |
| | | |
| | | @Override |
| | | public int delFile(Integer id) { |
| | |
| | | WorkShopFile file = workShopFileMapper.selectById(id); |
| | | if (file != null && file.getFileUrl() != null) { |
| | | // 检查 MinIO 中文件是否存在 |
| | | if (minioUtils.objectExists(bucketName, file.getFileUrl())) { |
| | | if (minioUtils.objectExists(minioConfig.getBucketName(), file.getFileUrl())) { |
| | | // 先删除 MinIO 中的对象 |
| | | minioUtils.removeObjectsResult(bucketName, file.getFileUrl()); |
| | | minioUtils.removeObjectsResult(minioConfig.getBucketName(), file.getFileUrl()); |
| | | } |
| | | } |
| | | // 执行数据库删除操作 |
| | |
| | | import com.ruoyi.basic.pojo.WorkShop; |
| | | import com.ruoyi.basic.pojo.WorkShopFile; |
| | | import com.ruoyi.basic.service.WorkShopService; |
| | | import com.ruoyi.common.config.MinioConfig; |
| | | import com.ruoyi.common.core.domain.MinioResult; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.file.MinioUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | @Resource |
| | | private MinioUtils minioUtils; |
| | | |
| | | @Value("${minio.bucketName}") |
| | | private String bucketName; |
| | | @Autowired |
| | | private MinioConfig minioConfig; |
| | | |
| | | |
| | | @Override |
| | |
| | | try { |
| | | String contentType = file.getContentType(); |
| | | String category = contentType != null && contentType.startsWith("image/") ? "images" : "docs"; |
| | | MinioResult upload = minioUtils.upload(bucketName, file, true); |
| | | MinioResult upload = minioUtils.upload(minioConfig.getBucketName(), file, true); |
| | | // 记录存储路径 |
| | | workShopFile.setFileUrl(upload.getBucketFileName()); |
| | | workShopFile.setFileMinioUrl(upload.getPreviewExpiry()); |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.config.MinioConfig; |
| | | import com.ruoyi.common.core.domain.MinioResult; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.LimsDateUtil; |
| | |
| | | import com.ruoyi.inspect.service.InspectionPurchasedService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.Setter; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | |
| | | private final NumberGenerator<InspectionPurchased> numberGenerator; |
| | | |
| | | @Value("${minio.bucketName}") |
| | | private String bucketName; |
| | | @Autowired |
| | | private MinioConfig minioConfig; |
| | | |
| | | @Override |
| | | public int addOrUpdateInspection(InspectionPurchasedDto inspectionPurchasedDto) { |
| | |
| | | if (ObjectUtils.isNotEmpty(inspectionPurchased.getFileUrl())) { |
| | | if (inspectionPurchased != null && inspectionPurchased.getFileUrl() != null) { |
| | | // 检查 MinIO 中文件是否存在 |
| | | if (minioUtils.objectExists(bucketName, inspectionPurchased.getFileUrl())) { |
| | | if (minioUtils.objectExists(minioConfig.getBucketName(), inspectionPurchased.getFileUrl())) { |
| | | // 先删除 MinIO 中的对象 |
| | | minioUtils.removeObjectsResult(bucketName, inspectionPurchased.getFileUrl()); |
| | | minioUtils.removeObjectsResult(minioConfig.getBucketName(), inspectionPurchased.getFileUrl()); |
| | | } |
| | | } |
| | | } |
| | | try { |
| | | String contentType = file.getContentType(); |
| | | String category = contentType != null && contentType.startsWith("image/") ? "images" : "docs"; |
| | | MinioResult upload = minioUtils.upload(bucketName, file, true); |
| | | MinioResult upload = minioUtils.upload(minioConfig.getBucketName(), file, true); |
| | | // 记录存储路径 |
| | | inspectionPurchased.setFileUrl(upload.getBucketFileName()); |
| | | inspectionPurchased.setFilePreviewUrl(upload.getPreviewExpiry()); |
| | |
| | | private String accessKey; |
| | | private String secretKey; |
| | | private Boolean secure; |
| | | private String bucketName; |
| | | |
| | | @Bean |
| | | public MinioClient getMinioClient() { |