From b51b9c28a21c668a51659739135bded07c46b2ea Mon Sep 17 00:00:00 2001 From: chen <2710907404@qq.com> Date: Thu, 7 Nov 2024 14:15:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=AF=92=E5=93=81=E5=BA=93?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E5=92=8Cservice=E3=80=81mapper=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 0 db/repository.sql | 518 ++++++++++ pom.xml | 238 +++++ ...ficationMaterialRepositoryApplication.java | 41 + .../platform/imr/component/DateUtils.java | 77 ++ .../imr/component/GetClientIPUtil.java | 62 ++ .../imr/config/WebSecurityConfigurer.java | 28 + .../imr/controller/CabinetOpenController.java | 428 ++++++++ .../DestructionPublicityController.java | 295 ++++++ .../imr/controller/DrugDepotsController.java | 15 + .../controller/ReviewApprovalController.java | 212 ++++ .../imr/controller/SampleApplyController.java | 680 +++++++++++++ .../SampleOutWarehouseApplyController.java | 472 +++++++++ .../SampleOutWarehouseController.java | 594 +++++++++++ .../SamplePutInStorageController.java | 947 ++++++++++++++++++ .../imr/controller/StorageCellController.java | 274 +++++ .../controller/StorageCupboardController.java | 354 +++++++ .../imr/controller/StorageRoomController.java | 309 ++++++ .../laboratory/platform/imr/dto/ApplyDTO.java | 45 + .../platform/imr/dto/CombinationOut.java | 22 + .../platform/imr/dto/DepositDTO.java | 61 ++ .../platform/imr/dto/DepositToDTO.java | 52 + .../platform/imr/dto/DestroyOutboundDTO.java | 16 + .../imr/dto/DestructionPublicityDTO.java | 54 + .../laboratory/platform/imr/dto/IconDTO.java | 22 + .../platform/imr/dto/InRepositoryDTO.java | 48 + .../platform/imr/dto/InnerSampleOutbound.java | 32 + .../imr/dto/OutWarehouseApplyDTO.java | 47 + .../platform/imr/dto/PrintTableDTO.java | 41 + .../platform/imr/dto/PublicityDTO.java | 38 + .../platform/imr/dto/QueryApplyDTO.java | 41 + .../laboratory/platform/imr/dto/QueryDTO.java | 64 ++ .../platform/imr/dto/QuerySampleDTO.java | 47 + .../platform/imr/dto/QueryStorageDTO.java | 32 + .../platform/imr/dto/ReturnOutboundDTO.java | 32 + .../platform/imr/dto/ReviewApprovalDTO.java | 40 + .../platform/imr/dto/ReviewSampleDetail.java | 20 + .../platform/imr/dto/SampleApplyQueryDTO.java | 22 + .../platform/imr/dto/SampleInfo.java | 17 + .../imr/dto/UpdateStorageDateDTO.java | 25 + .../platform/imr/dto/UseOutboundDTO.java | 46 + .../platform/imr/dto/UserInfoDTO.java | 18 + .../platform/imr/dto/VerificationCode.java | 25 + .../platform/imr/entity/AssociationOpen.java | 39 + .../imr/entity/CabinetOpeningRecord.java | 70 ++ .../imr/entity/DestructionDetail.java | 51 + .../imr/entity/DestructionPublicity.java | 86 ++ .../platform/imr/entity/DrugCaseInfo.java | 103 ++ .../platform/imr/entity/DrugMaterialInfo.java | 109 ++ ...ficationMaterialTransferAnalysisAnnex.java | 102 ++ ...ficationMaterialTransferRetainedAnnex.java | 102 ++ .../platform/imr/entity/InventorySample.java | 24 + .../imr/entity/OutWarehouseDetailed.java | 51 + .../imr/entity/PrintSampleInAndOutInfo.java | 39 + .../platform/imr/entity/SampleApply.java | 141 +++ .../imr/entity/SampleApplyDetailed.java | 57 ++ .../entity/SampleInboundAndOutboundTable.java | 89 ++ .../imr/entity/SampleInboundRecord.java | 70 ++ .../imr/entity/SampleOutWarehouseApply.java | 91 ++ .../imr/entity/SampleOutboundRecord.java | 70 ++ .../platform/imr/entity/SampleStorage.java | 150 +++ .../platform/imr/entity/StorageCell.java | 77 ++ .../platform/imr/entity/StorageCupboard.java | 110 ++ .../platform/imr/entity/StorageRoom.java | 75 ++ .../imr/entity/enums/ApplyStatus.java | 31 + .../imr/entity/enums/OutApplyStatus.java | 26 + .../imr/entity/enums/OutboundType.java | 29 + .../imr/entity/enums/ReleaseStatus.java | 24 + .../imr/entity/enums/WarehouseMark.java | 28 + .../imr/feign/TransferFeignService.java | 61 ++ .../imr/feign/dto/UpdateHolderDTO.java | 21 + .../platform/imr/handle/AppStartupRunner.java | 130 +++ .../FeignOauth2RequestInterceptor.java | 37 + .../imr/mapper/AssociationOpenMapper.java | 10 + .../mapper/CabinetOpeningRecordMapper.java | 24 + .../imr/mapper/DestructionDetailMapper.java | 38 + .../mapper/DestructionPublicityMapper.java | 42 + .../imr/mapper/DrugCaseInfoMapper.java | 18 + .../imr/mapper/DrugMaterialInfoMapper.java | 18 + ...onMaterialTransferAnalysisAnnexMapper.java | 21 + ...onMaterialTransferRetainedAnnexMapper.java | 21 + .../mapper/OutWarehouseDetailedMapper.java | 20 + .../imr/mapper/SampleApplyDetailedMapper.java | 26 + .../imr/mapper/SampleApplyMapper.java | 52 + .../SampleInboundAndOutboundTableMapper.java | 82 ++ .../imr/mapper/SampleInboundRecordMapper.java | 30 + .../mapper/SampleOutWarehouseApplyMapper.java | 61 ++ .../mapper/SampleOutboundRecordMapper.java | 24 + .../imr/mapper/SampleStorageMapper.java | 173 ++++ .../imr/mapper/StorageCellMapper.java | 27 + .../imr/mapper/StorageCupboardMapper.java | 26 + .../imr/mapper/StorageRoomMapper.java | 26 + .../imr/service/AssociationOpenService.java | 9 + .../service/CabinetOpeningRecordService.java | 30 + .../service/DestructionPublicityService.java | 31 + .../imr/service/DrugCaseInfoService.java | 13 + .../imr/service/DrugMaterialInfoService.java | 13 + .../service/OutWarehouseDetailedService.java | 14 + .../imr/service/ReviewApprovalService.java | 42 + .../imr/service/SampleApplyService.java | 42 + .../SampleInboundAndOutboundTableService.java | 14 + .../SampleOutWarehouseApplyService.java | 65 ++ .../service/SampleOutWarehouseService.java | 31 + .../service/SamplePutInStorageService.java | 95 ++ .../imr/service/StorageCellService.java | 14 + .../imr/service/StorageCupboardService.java | 14 + .../imr/service/StorageRoomService.java | 19 + .../impl/AssociationOpenServiceImpl.java | 20 + .../impl/CabinetOpeningRecordServiceImpl.java | 764 ++++++++++++++ .../impl/DestructionPublicityServiceImpl.java | 232 +++++ .../service/impl/DrugCaseInfoServiceImpl.java | 22 + .../impl/DrugMaterialInfoServiceImpl.java | 22 + .../impl/OutWarehouseDetailedServiceImpl.java | 18 + .../impl/ReviewApprovalServiceImpl.java | 357 +++++++ .../service/impl/SampleApplyServiceImpl.java | 391 ++++++++ ...pleInboundAndOutboundTableServiceImpl.java | 20 + .../SampleOutWarehouseApplyServiceImpl.java | 505 ++++++++++ .../impl/SampleOutWarehouseServiceImpl.java | 239 +++++ .../impl/SamplePutInStorageServiceImpl.java | 607 +++++++++++ .../service/impl/StorageCellServiceImpl.java | 18 + .../impl/StorageCupboardServiceImpl.java | 18 + .../service/impl/StorageRoomServiceImpl.java | 18 + .../platform/imr/task/DestructionWarning.java | 42 + .../platform/imr/vo/AnalysisSample.java | 36 + .../platform/imr/vo/ApplySampleVO.java | 61 ++ .../laboratory/platform/imr/vo/BaseEvent.java | 20 + .../platform/imr/vo/BaseSampleDetail.java | 101 ++ .../platform/imr/vo/BaseSampleVO.java | 64 ++ .../platform/imr/vo/CabinetSampleVO.java | 70 ++ .../laboratory/platform/imr/vo/CellVO.java | 46 + .../imr/vo/DestructionPublicityVO.java | 33 + .../laboratory/platform/imr/vo/IconVO.java | 26 + .../platform/imr/vo/InAndOutInfos.java | 27 + .../platform/imr/vo/InboundRecordVO.java | 52 + .../platform/imr/vo/OutSampleVO.java | 104 ++ .../platform/imr/vo/OutboundRecordVO.java | 25 + .../platform/imr/vo/RecipientDTO.java | 27 + .../platform/imr/vo/RepositorySampleVO.java | 80 ++ .../platform/imr/vo/RetainedSample.java | 36 + .../platform/imr/vo/SampleApplyVO.java | 56 ++ .../imr/vo/SampleOutWarehouseApplyVO.java | 49 + .../platform/imr/vo/SampleTableVO.java | 28 + .../platform/imr/vo/StatisticsCount.java | 17 + .../platform/imr/vo/StatusSampleVO.java | 17 + .../platform/imr/vo/StoragePictureVO.java | 26 + .../platform/imr/vo/ToBeReturnVO.java | 59 ++ src/main/resources/banner.txt | 12 + src/main/resources/bootstrap.yml | 60 ++ .../mapper/AssociationOpenMapper.xml | 16 + .../mapper/CabinetOpeningRecordMapper.xml | 129 +++ .../mapper/DestructionDetailMapper.xml | 82 ++ .../mapper/DestructionPublicityMapper.xml | 79 ++ .../resources/mapper/DrugCaseInfoMapper.xml | 24 + .../mapper/DrugMaterialInfoMapper.xml | 26 + ...ionMaterialTransferAnalysisAnnexMapper.xml | 76 ++ ...ionMaterialTransferRetainedAnnexMapper.xml | 79 ++ .../mapper/OutWarehouseDetailedMapper.xml | 49 + .../mapper/SampleApplyDetailedMapper.xml | 43 + .../resources/mapper/SampleApplyMapper.xml | 104 ++ .../SampleInboundAndOutboundTableMapper.xml | 310 ++++++ .../mapper/SampleInboundRecordMapper.xml | 65 ++ .../mapper/SampleOutWarehouseApplyMapper.xml | 152 +++ .../mapper/SampleOutboundRecordMapper.xml | 47 + .../resources/mapper/SampleStorageMapper.xml | 873 ++++++++++++++++ .../resources/mapper/StorageCellMapper.xml | 34 + .../mapper/StorageCupboardMapper.xml | 40 + .../resources/mapper/StorageRoomMapper.xml | 40 + 导出数据库.bat | 20 + 168 files changed, 16442 insertions(+) create mode 100644 README.md create mode 100644 db/repository.sql create mode 100644 pom.xml create mode 100644 src/main/java/digital/laboratory/platform/imr/IdentificationMaterialRepositoryApplication.java create mode 100644 src/main/java/digital/laboratory/platform/imr/component/DateUtils.java create mode 100644 src/main/java/digital/laboratory/platform/imr/component/GetClientIPUtil.java create mode 100644 src/main/java/digital/laboratory/platform/imr/config/WebSecurityConfigurer.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/CabinetOpenController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/DestructionPublicityController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/ReviewApprovalController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/SampleApplyController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseApplyController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/SamplePutInStorageController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/StorageCellController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/StorageCupboardController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/controller/StorageRoomController.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/ApplyDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/CombinationOut.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/DepositDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/DepositToDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/DestroyOutboundDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/DestructionPublicityDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/IconDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/InRepositoryDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/InnerSampleOutbound.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/OutWarehouseApplyDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/PrintTableDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/PublicityDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/QueryApplyDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/QueryDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/QuerySampleDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/QueryStorageDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/ReturnOutboundDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/ReviewApprovalDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/ReviewSampleDetail.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/SampleApplyQueryDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/SampleInfo.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/UpdateStorageDateDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/UseOutboundDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/UserInfoDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/dto/VerificationCode.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/AssociationOpen.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/CabinetOpeningRecord.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/DestructionDetail.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/DestructionPublicity.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/DrugCaseInfo.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/DrugMaterialInfo.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferAnalysisAnnex.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferRetainedAnnex.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/InventorySample.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/OutWarehouseDetailed.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/PrintSampleInAndOutInfo.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/SampleApply.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/SampleApplyDetailed.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/SampleInboundAndOutboundTable.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/SampleInboundRecord.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/SampleOutWarehouseApply.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/SampleOutboundRecord.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/SampleStorage.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/StorageCell.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/StorageCupboard.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/StorageRoom.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/enums/ApplyStatus.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/enums/OutApplyStatus.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/enums/OutboundType.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/enums/ReleaseStatus.java create mode 100644 src/main/java/digital/laboratory/platform/imr/entity/enums/WarehouseMark.java create mode 100644 src/main/java/digital/laboratory/platform/imr/feign/TransferFeignService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/feign/dto/UpdateHolderDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/handle/AppStartupRunner.java create mode 100644 src/main/java/digital/laboratory/platform/imr/interceptor/FeignOauth2RequestInterceptor.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/AssociationOpenMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/CabinetOpeningRecordMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/DestructionDetailMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/DestructionPublicityMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/DrugCaseInfoMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/DrugMaterialInfoMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferAnalysisAnnexMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferRetainedAnnexMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/OutWarehouseDetailedMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyDetailedMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundAndOutboundTableMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundRecordMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/SampleOutWarehouseApplyMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/SampleOutboundRecordMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/SampleStorageMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/StorageCellMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/StorageCupboardMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/mapper/StorageRoomMapper.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/AssociationOpenService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/CabinetOpeningRecordService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/DestructionPublicityService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/OutWarehouseDetailedService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/ReviewApprovalService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/SampleApplyService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/SampleInboundAndOutboundTableService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/SampleOutWarehouseApplyService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/SampleOutWarehouseService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/SamplePutInStorageService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/StorageCellService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/StorageCupboardService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/StorageRoomService.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/AssociationOpenServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/CabinetOpeningRecordServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/DestructionPublicityServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/DrugCaseInfoServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/DrugMaterialInfoServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/OutWarehouseDetailedServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/ReviewApprovalServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/SampleApplyServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/SampleInboundAndOutboundTableServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutWarehouseApplyServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutWarehouseServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/SamplePutInStorageServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/StorageCellServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/StorageCupboardServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/service/impl/StorageRoomServiceImpl.java create mode 100644 src/main/java/digital/laboratory/platform/imr/task/DestructionWarning.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/AnalysisSample.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/ApplySampleVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/BaseEvent.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/BaseSampleDetail.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/BaseSampleVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/CabinetSampleVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/CellVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/DestructionPublicityVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/IconVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/InAndOutInfos.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/InboundRecordVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/OutSampleVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/OutboundRecordVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/RecipientDTO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/RepositorySampleVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/RetainedSample.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/SampleApplyVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/SampleOutWarehouseApplyVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/SampleTableVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/StatisticsCount.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/StatusSampleVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/StoragePictureVO.java create mode 100644 src/main/java/digital/laboratory/platform/imr/vo/ToBeReturnVO.java create mode 100644 src/main/resources/banner.txt create mode 100644 src/main/resources/bootstrap.yml create mode 100644 src/main/resources/mapper/AssociationOpenMapper.xml create mode 100644 src/main/resources/mapper/CabinetOpeningRecordMapper.xml create mode 100644 src/main/resources/mapper/DestructionDetailMapper.xml create mode 100644 src/main/resources/mapper/DestructionPublicityMapper.xml create mode 100644 src/main/resources/mapper/DrugCaseInfoMapper.xml create mode 100644 src/main/resources/mapper/DrugMaterialInfoMapper.xml create mode 100644 src/main/resources/mapper/IdentificationMaterialTransferAnalysisAnnexMapper.xml create mode 100644 src/main/resources/mapper/IdentificationMaterialTransferRetainedAnnexMapper.xml create mode 100644 src/main/resources/mapper/OutWarehouseDetailedMapper.xml create mode 100644 src/main/resources/mapper/SampleApplyDetailedMapper.xml create mode 100644 src/main/resources/mapper/SampleApplyMapper.xml create mode 100644 src/main/resources/mapper/SampleInboundAndOutboundTableMapper.xml create mode 100644 src/main/resources/mapper/SampleInboundRecordMapper.xml create mode 100644 src/main/resources/mapper/SampleOutWarehouseApplyMapper.xml create mode 100644 src/main/resources/mapper/SampleOutboundRecordMapper.xml create mode 100644 src/main/resources/mapper/SampleStorageMapper.xml create mode 100644 src/main/resources/mapper/StorageCellMapper.xml create mode 100644 src/main/resources/mapper/StorageCupboardMapper.xml create mode 100644 src/main/resources/mapper/StorageRoomMapper.xml create mode 100644 导出数据库.bat diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/db/repository.sql b/db/repository.sql new file mode 100644 index 0000000..005d8d8 --- /dev/null +++ b/db/repository.sql @@ -0,0 +1,518 @@ +-- MySQL dump 10.13 Distrib 5.7.27, for Win64 (x86_64) +-- +-- Host: localhost Database: dlp_identification_material_repository +-- ------------------------------------------------------ +-- Server version 5.7.27-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Current Database: `dlp_identification_material_repository` +-- + +/*!40000 DROP DATABASE IF EXISTS `dlp_identification_material_repository`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `dlp_identification_material_repository` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `dlp_identification_material_repository`; + +-- +-- Table structure for table `b_sample_storage` +-- + +DROP TABLE IF EXISTS `b_sample_storage`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `b_sample_storage` ( + `id` varchar(255) NOT NULL COMMENT '主键id', + `sample_id` varchar(50) NOT NULL COMMENT '存储的样本id', + `storage_location` varchar(255) DEFAULT NULL COMMENT '存储位置', + `status` int(5) NOT NULL COMMENT '状态:已出库/已入库/待存放', + `in_repository_date` datetime DEFAULT NULL COMMENT '入库时间', + `storage_cell_id` varchar(255) DEFAULT NULL COMMENT '存储格子id', + `storage_date` datetime DEFAULT NULL COMMENT '存储期限', + `depositor_id` varchar(255) DEFAULT NULL COMMENT '存放人id', + `recipient_id` varchar(255) DEFAULT NULL COMMENT '领取人id', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `early_warning` int(10) DEFAULT NULL COMMENT '销毁预警:0.还未到销毁;1.已到销毁时间', + `out_repository_date` datetime DEFAULT NULL COMMENT '出库时间', + `quality` decimal(10,5) DEFAULT NULL COMMENT '入库时的质量/体积', + `unit` varchar(255) DEFAULT NULL COMMENT '质量/体积计量单位', + `name` varchar(255) DEFAULT NULL COMMENT '样本名称', + `sample_type` varchar(255) DEFAULT NULL COMMENT '样本类型', + `return_time` datetime DEFAULT NULL COMMENT '出库归还时间', + `is_return` int(2) DEFAULT NULL COMMENT '出库后是否需要归还(1.需要归还-1不需要归还)', + `purpose` varchar(255) DEFAULT NULL COMMENT '出库用途(测试数据)', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `b_sample_storage` +-- + +LOCK TABLES `b_sample_storage` WRITE; +/*!40000 ALTER TABLE `b_sample_storage` DISABLE KEYS */; +INSERT INTO `b_sample_storage` VALUES ('698BD2360CEE78602A7422DA95DB5BBB','B15C2120633B333D33F82A7FE80BEC52','3楼2房间-test-fan-CLtes0003',3,'2023-04-20 14:05:48','18A7EE925C8277F462EF4C5B892DA431','2024-04-20 14:05:48','test-myc',NULL,'2023-04-20 14:05:48','2023-04-20 14:06:03','test-myc','test-myc',0,NULL,NULL,'','72样本8','B','2023-04-06 00:00:00',1,'888'); +/*!40000 ALTER TABLE `b_sample_storage` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `destruction_detail` +-- + +DROP TABLE IF EXISTS `destruction_detail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `destruction_detail` ( + `id` varchar(11) NOT NULL COMMENT '主键id', + `destruction_id` varchar(255) DEFAULT NULL COMMENT '销毁公示id', + `sample_id` varchar(255) DEFAULT NULL COMMENT '销毁样本id', + `create_time` datetime DEFAULT NULL COMMENT '--创建时间', + `update_time` datetime DEFAULT NULL COMMENT '--修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '--创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '--修改人', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `destruction_detail` +-- + +LOCK TABLES `destruction_detail` WRITE; +/*!40000 ALTER TABLE `destruction_detail` DISABLE KEYS */; +/*!40000 ALTER TABLE `destruction_detail` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `destruction_publicity` +-- + +DROP TABLE IF EXISTS `destruction_publicity`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `destruction_publicity` ( + `id` varchar(255) NOT NULL COMMENT '主键id', + `applicant_id` varchar(255) DEFAULT NULL COMMENT '申请人id', + `reviewer_id` varchar(255) DEFAULT NULL COMMENT '审核人id', + `destroy_quantity` bigint(10) DEFAULT NULL COMMENT '销毁样本数量', + `destroy_company` varchar(255) DEFAULT NULL COMMENT '销毁单位', + `destroy_date` datetime DEFAULT NULL COMMENT '销毁时间', + `remarks` varchar(255) DEFAULT NULL COMMENT '备注', + `status` int(1) DEFAULT NULL COMMENT '未发布/已发布', + `create_time` datetime DEFAULT NULL COMMENT '--创建时间', + `update_time` datetime DEFAULT NULL COMMENT '--修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '--创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '--修改人', + `release_date` datetime DEFAULT NULL COMMENT '发布时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `destruction_publicity` +-- + +LOCK TABLES `destruction_publicity` WRITE; +/*!40000 ALTER TABLE `destruction_publicity` DISABLE KEYS */; +/*!40000 ALTER TABLE `destruction_publicity` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `out_warehouse_detailed` +-- + +DROP TABLE IF EXISTS `out_warehouse_detailed`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `out_warehouse_detailed` ( + `id` varchar(255) NOT NULL COMMENT '--主键id', + `apply_id` varchar(255) NOT NULL COMMENT '申请id', + `sample_id` varchar(255) NOT NULL COMMENT '样本id', + `create_time` datetime DEFAULT NULL COMMENT '--创建时间', + `update_time` datetime DEFAULT NULL COMMENT '--修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '--创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '--修改人', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='出库明细'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `out_warehouse_detailed` +-- + +LOCK TABLES `out_warehouse_detailed` WRITE; +/*!40000 ALTER TABLE `out_warehouse_detailed` DISABLE KEYS */; +INSERT INTO `out_warehouse_detailed` VALUES ('B8FC4B249E8DBB0C662F7D8286EDA96F','8FC8D600FB37CCEAF373171242D36826','B15C2120633B333D33F82A7FE80BEC52','2023-04-20 14:06:18','2023-04-20 14:06:18','test-myc','test-myc'); +/*!40000 ALTER TABLE `out_warehouse_detailed` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sample_apply` +-- + +DROP TABLE IF EXISTS `sample_apply`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sample_apply` ( + `id` varchar(255) NOT NULL COMMENT '主键id', + `applicant_id` varchar(255) DEFAULT NULL COMMENT '申请人id', + `application_date` datetime DEFAULT NULL COMMENT '申请日期', + `application_status` int(11) DEFAULT NULL COMMENT '申请状态', + `apply_quality` double DEFAULT NULL COMMENT '申请重量', + `apply_quantity` int(11) DEFAULT NULL COMMENT '申请数量', + `approval_date` datetime DEFAULT NULL COMMENT '审批人审批时间', + `approver_id` varchar(255) DEFAULT NULL COMMENT '审批人id', + `approver_opinion` text COMMENT '审批人意见', + `first_auditor_id` varchar(255) DEFAULT NULL COMMENT '一级审核员id', + `first_audit_date` datetime DEFAULT NULL COMMENT '一级审核时间', + `first_audit_opinion` text COMMENT '一级审核意见', + `reason` text COMMENT '申请原因', + `secondary_audit_date` datetime DEFAULT NULL COMMENT '二级审核时间', + `secondary_audit_opinion` text COMMENT '二级审核意见', + `secondary_auditor_id` varchar(255) DEFAULT NULL COMMENT '二级审核员id', + `apply_type` varchar(255) DEFAULT NULL COMMENT '申请类型:销毁/外带', + `create_time` datetime DEFAULT NULL COMMENT '--创建时间', + `update_time` datetime DEFAULT NULL COMMENT '--修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '--创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '--修改人', + `unit` varchar(255) DEFAULT NULL COMMENT '重量单位', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='检材申请实体类'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sample_apply` +-- + +LOCK TABLES `sample_apply` WRITE; +/*!40000 ALTER TABLE `sample_apply` DISABLE KEYS */; +INSERT INTO `sample_apply` VALUES ('154A4866716C47C9BDB5CE9339A75CEB','text-myc','2023-03-23 15:52:04',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','哈哈','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-24 14:12:11','1','1','g'),('1EF448E93712580A133D79483402EB36','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('220D7BA318030CC65804EDA4970C25FF','test-myc','2023-04-20 14:38:40',0,NULL,1,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','123','2023-04-07 15:06:16','二级审核','1','1','2023-04-20 14:38:40','2023-04-20 14:38:40','test-myc','test-myc',NULL),('2A8367F4C0BE729AB1A1BA7988E02185','test-myc','2023-04-20 17:00:48',0,NULL,4,NULL,NULL,NULL,NULL,NULL,NULL,'吼吼吼吼吼吼吼吼吼吼吼吼吼吼吼',NULL,NULL,NULL,'1','2023-04-20 17:00:48','2023-04-20 17:00:48','test-myc','test-myc',NULL),('4991236DA645820C8F27E2BED0C2B19E','test-myc','2023-04-20 14:23:21',0,NULL,1,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','我喜欢','2023-04-07 15:06:16','二级审核','1','1','2023-04-20 14:23:21','2023-04-20 14:23:21','test-myc','test-myc',NULL),('6ACE4C9771C5F686835A4B789CA01B78','test-myc','2023-04-20 18:02:00',1,NULL,3,NULL,NULL,NULL,NULL,NULL,NULL,'9999',NULL,NULL,NULL,'1','2023-04-20 17:00:38','2023-04-20 18:02:00','test-myc','test-myc',NULL),('9','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('904BD490B692834C93E256B2E59931E9','test-myc','2023-04-20 14:25:25',0,NULL,1,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','我喜欢啊 不行吗','2023-04-07 15:06:16','二级审核','1','1','2023-04-20 14:25:25','2023-04-20 14:25:25','test-myc','test-myc',NULL),('9D711AF2BF5B6071EBB04A2BFE79B102','test-myc','2023-04-20 14:39:11',0,NULL,1,'2023-04-12 15:07:15','1','审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批审批','1','2023-04-12 15:06:41','一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核一级审核','我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢我喜欢','2023-04-07 15:06:16','二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核二级审核','1','1','2023-04-20 14:39:11','2023-04-20 14:39:11','test-myc','test-myc',NULL),('9D866AE53CE90501012ABDDFE4A826A5','test-myc','2023-04-20 14:36:07',0,NULL,3,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','6666666','2023-04-07 15:06:16','二级审核','1','1','2023-04-20 14:36:07','2023-04-20 14:36:07','test-myc','test-myc',NULL),('A30338C7506380F3131A6CEBFCEBB60F','test-myc','2023-04-20 17:03:35',0,NULL,2,NULL,NULL,NULL,NULL,NULL,NULL,'哈哈哈哈哈哈',NULL,NULL,NULL,'1','2023-04-20 17:03:35','2023-04-20 17:03:35','test-myc','test-myc',NULL),('B407DC1DB89A27A5082757418FCABB1A','test-myc','2023-04-20 14:23:15',0,NULL,1,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','我喜欢','2023-04-07 15:06:16','二级审核','1','1','2023-04-20 14:23:15','2023-04-20 14:23:15','test-myc','test-myc',NULL),('D1CBA377B3AF3FB433AB20E03A98C9D2','test-myc','2023-04-20 14:25:01',0,NULL,1,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','我喜欢啊 不行吗','2023-04-07 15:06:16','二级审核','1','1','2023-04-20 14:25:01','2023-04-20 14:25:01','test-myc','test-myc',NULL),('D49ABB942D3448B7FFC027325A7157C5','test-myc','2023-04-20 17:47:17',1,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,'2222',NULL,NULL,NULL,'1','2023-04-20 16:58:59','2023-04-20 17:47:17','test-myc','1',NULL),('DDF925D7A40CC5068B738AA4F13B2C30','test-myc','2023-04-20 17:01:23',0,NULL,4,NULL,NULL,NULL,NULL,NULL,NULL,'000000',NULL,NULL,NULL,'1','2023-04-20 17:01:23','2023-04-20 17:01:23','test-myc','test-myc',NULL),('F72882BA20D064B6F22E6C921FA62614','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('F72882BA20D064B6F22E6C921FA67614','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('F72882BA20D064B6F22E6C921FA67616','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('F72882BA20D064B6F22E6C921FA67619','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('F72882BA20D064B6F22E6C921FA676195555','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('F72882BA20D064B6F22E6C921FA6765','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('F72882BA20D064B6F22E6C921FA6769999','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('F72882BA20D064B6F22E6C92999FA67614','text-myc','2023-03-23 15:52:05',0,3.2,2,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','规格','2023-04-07 15:06:16','二级审核','1','1','2023-03-23 15:52:05','2023-03-23 15:52:05','1','1','g'),('FFBF18F0639FA24ED8BB75295A4E9AAD','test-myc','2023-04-20 14:25:13',0,NULL,1,'2023-04-12 15:07:15','1','审批','1','2023-04-12 15:06:41','一级审核','我喜欢啊 不行吗','2023-04-07 15:06:16','二级审核','1','1','2023-04-20 14:25:13','2023-04-20 14:25:13','test-myc','test-myc',NULL),('test','1',NULL,2,NULL,NULL,NULL,NULL,NULL,'1','2023-04-20 23:39:01','这个454545',NULL,NULL,NULL,'','1',NULL,'2023-04-20 23:39:01',NULL,'1',NULL); +/*!40000 ALTER TABLE `sample_apply` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sample_apply_detailed` +-- + +DROP TABLE IF EXISTS `sample_apply_detailed`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sample_apply_detailed` ( + `id` varchar(255) NOT NULL COMMENT 'id', + `sample_id` varchar(255) DEFAULT NULL COMMENT '样本id', + `apply_id` varchar(255) DEFAULT NULL COMMENT '申请id', + `status` int(5) DEFAULT NULL COMMENT '1通过/-1不通过', + `create_time` datetime DEFAULT NULL COMMENT '--创建时间', + `update_time` datetime DEFAULT NULL COMMENT '--修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '--创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '--修改人', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sample_apply_detailed` +-- + +LOCK TABLES `sample_apply_detailed` WRITE; +/*!40000 ALTER TABLE `sample_apply_detailed` DISABLE KEYS */; +INSERT INTO `sample_apply_detailed` VALUES ('016f73129355399c08789646df26ab36','20B4714AE6D05D3A108FB93DE621751C','2A8367F4C0BE729AB1A1BA7988E02185',0,'2023-04-20 17:00:48','2023-04-20 17:00:48','test-myc','test-myc'),('043c24d1d8fbab195b15ba1b87252d2a','33CE6442AEC859E97787E1FFE273D28B','B407DC1DB89A27A5082757418FCABB1A',0,'2023-04-20 14:23:15','2023-04-20 14:23:15','test-myc','test-myc'),('0aa1f508d59a11f64afe3bb1bb3b386e','E88E547988E26D58EA64124BFB31E2FD','9D866AE53CE90501012ABDDFE4A826A5',0,'2023-04-20 14:36:07','2023-04-20 14:36:07','test-myc','test-myc'),('0b99f17a4390c63c194400b1e5311766','33CE6442AEC859E97787E1FFE273D28B','D1CBA377B3AF3FB433AB20E03A98C9D2',0,'2023-04-20 14:25:01','2023-04-20 14:25:01','test-myc','test-myc'),('0c05c8ed9ee488d9a3b42ba127c862f1','04F6E8B659AA152B7118D67146FD8F65','9D866AE53CE90501012ABDDFE4A826A5',0,'2023-04-20 14:36:07','2023-04-20 14:36:07','test-myc','test-myc'),('0dc7b733c03aee5e31859e8c313c3090','632E67E4710E55C1F149A8A8C3CC883D','DDF925D7A40CC5068B738AA4F13B2C30',0,'2023-04-20 17:01:23','2023-04-20 17:01:23','test-myc','test-myc'),('0e6effebc6530f22c8377ec7aff1cb81','632E67E4710E55C1F149A8A8C3CC883D','A30338C7506380F3131A6CEBFCEBB60F',0,'2023-04-20 17:03:35','2023-04-20 17:03:35','test-myc','test-myc'),('12366666','12366666','test',-1,NULL,'2023-04-20 23:39:01',NULL,'1'),('1ef1f599469f90fa47856c243ff73260','07AA201EA5A5EC62C04FB3375EF51C66','DDF925D7A40CC5068B738AA4F13B2C30',0,'2023-04-20 17:01:23','2023-04-20 17:01:23','test-myc','test-myc'),('4a75','E88E547988E26D58EA64124BFB31E2FD','9D711AF2BF5B6071EBB04A2BFE79B102',1,'2023-04-20 14:38:40','2023-04-20 14:38:40','test-myc','test-myc'),('4a7566666','E88E547988E26D58EA64124BFB31E2FD','9D711AF2BF5B6071EBB04A2BFE79B102',-1,'2023-04-20 14:38:40','2023-04-20 14:38:40','test-myc','test-myc'),('4a7b8ae049043e75bba55bbbfaef0f4d','90DE0E82DD6DA6A5802B9C428B97D787','220D7BA318030CC65804EDA4970C25FF',0,'2023-04-20 14:38:40','2023-04-20 14:38:40','test-myc','test-myc'),('52ba35b8a539a30505ee0f037e1d2f44','07AA201EA5A5EC62C04FB3375EF51C66','9D711AF2BF5B6071EBB04A2BFE79B102',0,'2023-04-20 14:39:11','2023-04-20 14:39:11','test-myc','test-myc'),('5796198d96382753c1fb8eb99d096ce8','07AA201EA5A5EC62C04FB3375EF51C66','2A8367F4C0BE729AB1A1BA7988E02185',0,'2023-04-20 17:00:48','2023-04-20 17:00:48','test-myc','test-myc'),('581dda778cdd398a44ab332f821cd560','E88E547988E26D58EA64124BFB31E2FD','6ACE4C9771C5F686835A4B789CA01B78',0,'2023-04-20 18:02:00','2023-04-20 18:02:00','test-myc','test-myc'),('72450c08c744642251f7f0d6263e9fca','33CE6442AEC859E97787E1FFE273D28B','FFBF18F0639FA24ED8BB75295A4E9AAD',0,'2023-04-20 14:25:13','2023-04-20 14:25:13','test-myc','test-myc'),('74305d88c278710d32fb76f8e90dc9e9','E88E547988E26D58EA64124BFB31E2FD','DDF925D7A40CC5068B738AA4F13B2C30',0,'2023-04-20 17:01:23','2023-04-20 17:01:23','test-myc','test-myc'),('7d91fa302f92d614f80a8b0d15753d2d','E88E547988E26D58EA64124BFB31E2FD','2A8367F4C0BE729AB1A1BA7988E02185',0,'2023-04-20 17:00:48','2023-04-20 17:00:48','test-myc','test-myc'),('a0a4bda0743e313862973c438bebb9ec','07AA201EA5A5EC62C04FB3375EF51C66','D49ABB942D3448B7FFC027325A7157C5',0,'2023-04-20 17:47:17','2023-04-20 17:47:17','1','1'),('a3b7b997168bc8dd64934fc43167ba1a','33CE6442AEC859E97787E1FFE273D28B','4991236DA645820C8F27E2BED0C2B19E',0,'2023-04-20 14:23:21','2023-04-20 14:23:21','test-myc','test-myc'),('b874a10997a831788d565b276758f723','E88E547988E26D58EA64124BFB31E2FD','2A8367F4C0BE729AB1A1BA7988E02185',0,'2023-04-20 17:00:48','2023-04-20 17:00:48','test-myc','test-myc'),('b9db27c33badfd3ff4f400004bc90470','07AA201EA5A5EC62C04FB3375EF51C66','6ACE4C9771C5F686835A4B789CA01B78',0,'2023-04-20 18:02:00','2023-04-20 18:02:00','test-myc','test-myc'),('d0566172d90888472be8a9ce4f529fa6','33CE6442AEC859E97787E1FFE273D28B','9D866AE53CE90501012ABDDFE4A826A5',0,'2023-04-20 14:36:07','2023-04-20 14:36:07','test-myc','test-myc'),('ecf318d0819a3a749edbdf1063c23443','07AA201EA5A5EC62C04FB3375EF51C66','6ACE4C9771C5F686835A4B789CA01B78',0,'2023-04-20 18:02:00','2023-04-20 18:02:00','test-myc','test-myc'),('f7b7bfe0a17382e4601fba3b34ffe1dc','E88E547988E26D58EA64124BFB31E2FD','904BD490B692834C93E256B2E59931E9',0,'2023-04-20 14:25:25','2023-04-20 14:25:25','test-myc','test-myc'),('f8a863ed2b59b3764d643f9c913f7717','07AA201EA5A5EC62C04FB3375EF51C66','A30338C7506380F3131A6CEBFCEBB60F',0,'2023-04-20 17:03:35','2023-04-20 17:03:35','test-myc','test-myc'),('f9a09d018efaed4c5055046648a6ddb1','E88E547988E26D58EA64124BFB31E2FD','DDF925D7A40CC5068B738AA4F13B2C30',0,'2023-04-20 17:01:23','2023-04-20 17:01:23','test-myc','test-myc'); +/*!40000 ALTER TABLE `sample_apply_detailed` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sample_inbound_and_outbound_table` +-- + +DROP TABLE IF EXISTS `sample_inbound_and_outbound_table`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sample_inbound_and_outbound_table` ( + `id` varchar(255) NOT NULL COMMENT '主键id', + `appraiser_id` varchar(255) DEFAULT NULL COMMENT '鉴定人--也是领取人', + `out_warehouse_date` datetime DEFAULT NULL COMMENT '分析样出库时间', + `remarks` varchar(255) DEFAULT NULL COMMENT '备注', + `sample_id` varchar(255) DEFAULT NULL COMMENT '样本id', + `warehousing_date` datetime(6) DEFAULT NULL COMMENT '入库时间', + `im_administrators` varchar(255) DEFAULT NULL COMMENT '检材管理员', + `recipient` varchar(255) DEFAULT NULL COMMENT '存放人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '--创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '--修改人', + `return_time` datetime DEFAULT NULL COMMENT '归还时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sample_inbound_and_outbound_table` +-- + +LOCK TABLES `sample_inbound_and_outbound_table` WRITE; +/*!40000 ALTER TABLE `sample_inbound_and_outbound_table` DISABLE KEYS */; +INSERT INTO `sample_inbound_and_outbound_table` VALUES ('2744DEC7FDFE33B677A0E68755923219','0200BE816125C8260D3A191B209115DF','2023-04-20 14:06:50','888','B15C2120633B333D33F82A7FE80BEC52','2023-04-20 14:05:48.492000','test-myc','test-myc','2023-04-20 14:05:48','2023-04-20 14:05:48','test-myc','test-myc','2023-04-06 00:00:00'); +/*!40000 ALTER TABLE `sample_inbound_and_outbound_table` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sample_inbound_record` +-- + +DROP TABLE IF EXISTS `sample_inbound_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sample_inbound_record` ( + `id` varchar(255) NOT NULL COMMENT '主键id', + `warehousing_date` datetime DEFAULT NULL COMMENT '入库时间', + `im_administrators` varchar(255) DEFAULT NULL COMMENT '检材管理员id', + `sample_id` varchar(50) DEFAULT NULL COMMENT '样本id', + `warehousing_person_id` varchar(255) DEFAULT NULL COMMENT '入库人id', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `remarks` varchar(255) DEFAULT NULL COMMENT '备注', + `name` varchar(255) DEFAULT NULL COMMENT '样本名称', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sample_inbound_record` +-- + +LOCK TABLES `sample_inbound_record` WRITE; +/*!40000 ALTER TABLE `sample_inbound_record` DISABLE KEYS */; +INSERT INTO `sample_inbound_record` VALUES ('8CAE9AB29B7EE118F1F4D4C1279133F9','2023-04-20 14:05:48','test-myc','B15C2120633B333D33F82A7FE80BEC52','test-myc','2023-04-20 14:05:48','2023-04-20 14:05:48','test-myc','test-myc','检材入库','72样本8'); +/*!40000 ALTER TABLE `sample_inbound_record` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sample_out_warehouse_apply` +-- + +DROP TABLE IF EXISTS `sample_out_warehouse_apply`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sample_out_warehouse_apply` ( + `id` varchar(255) NOT NULL COMMENT '主键id', + `applicant_id` varchar(255) DEFAULT NULL COMMENT '申请人id', + `application_date` datetime DEFAULT NULL COMMENT '申请时间', + `purpose` varchar(255) DEFAULT NULL COMMENT '出库用途', + `return_date` datetime DEFAULT NULL COMMENT '归还日期', + `sample_code_number` varchar(10) DEFAULT NULL COMMENT '取检码', + `status` tinyint(1) NOT NULL COMMENT '申请状态:待同意/拒绝/同意/已经失效', + `appraiser_id` varchar(255) DEFAULT NULL COMMENT '鉴定人id', + `create_time` datetime DEFAULT NULL COMMENT '--创建时间', + `update_time` datetime DEFAULT NULL COMMENT '--修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '--创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '--修改人', + `im_administrators_id` varchar(255) DEFAULT NULL COMMENT '检材管理员', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='样本出库申请实体类'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sample_out_warehouse_apply` +-- + +LOCK TABLES `sample_out_warehouse_apply` WRITE; +/*!40000 ALTER TABLE `sample_out_warehouse_apply` DISABLE KEYS */; +INSERT INTO `sample_out_warehouse_apply` VALUES ('8FC8D600FB37CCEAF373171242D36826','test-myc','2023-04-20 14:06:18','888','2023-04-06 00:00:00','916112',3,'0200BE816125C8260D3A191B209115DF','2023-04-20 14:06:18','2023-04-20 14:06:50','test-myc','test-myc','test-myc'); +/*!40000 ALTER TABLE `sample_out_warehouse_apply` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sample_outbound_record` +-- + +DROP TABLE IF EXISTS `sample_outbound_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sample_outbound_record` ( + `id` varchar(50) NOT NULL COMMENT '主键id', + `sample_id` varchar(50) DEFAULT NULL COMMENT '样本id', + `recipient_id` varchar(30) DEFAULT NULL COMMENT '领取人id', + `reason` varchar(255) DEFAULT NULL COMMENT '原因/备注', + `name` varchar(255) DEFAULT NULL COMMENT '样本名称', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `outbound_type` int(2) DEFAULT NULL COMMENT '出库类型:1.领用/2.销毁/3.退还', + `outbound_date` datetime DEFAULT NULL COMMENT '出库时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sample_outbound_record` +-- + +LOCK TABLES `sample_outbound_record` WRITE; +/*!40000 ALTER TABLE `sample_outbound_record` DISABLE KEYS */; +INSERT INTO `sample_outbound_record` VALUES ('4E96B98E38A35D952B2C4FB9DE01A812',NULL,'test-myc','888','72样本8','2023-04-20 14:06:50','2023-04-20 14:06:50','test-myc','test-myc',1,'2023-04-20 14:06:50'); +/*!40000 ALTER TABLE `sample_outbound_record` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `storage_cell` +-- + +DROP TABLE IF EXISTS `storage_cell`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `storage_cell` ( + `id` varchar(255) NOT NULL COMMENT '主键id', + `cell_no` varchar(255) NOT NULL COMMENT '格子编号', + `box_id` varchar(255) DEFAULT NULL COMMENT '存储物品id', + `status` tinyint(1) DEFAULT NULL COMMENT '状态:已存放物品/未存放物品', + `sort` bigint(10) DEFAULT NULL COMMENT '排序', + `cupboard_id` varchar(255) NOT NULL COMMENT '柜子id', + `cell_photo` varchar(255) DEFAULT NULL COMMENT '格子照片', + `create_by` varchar(255) DEFAULT NULL, + `create_time` datetime DEFAULT NULL, + `update_By` varchar(255) DEFAULT NULL, + `update_time` datetime DEFAULT NULL, + `content` varchar(255) DEFAULT NULL COMMENT '描述内容', + `file_name` varchar(255) DEFAULT NULL COMMENT '照片名称', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `storage_cell` +-- + +LOCK TABLES `storage_cell` WRITE; +/*!40000 ALTER TABLE `storage_cell` DISABLE KEYS */; +INSERT INTO `storage_cell` VALUES ('18A7EE925C8277F462EF4C5B892DA431','CLtes0003',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E','cell/18A7EE925C8277F462EF4C5B892DA431','1','2023-04-18 00:09:37','1','2023-04-18 13:46:19',NULL,'QQ图片20190314125557.jpg'),('2DA415972D3CC2D68053C029F58E7F4B','CLtes0006',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL),('30BBD1EAC7A6A072BD96F536CF49045D','CLtes0004',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL),('3840D693810A7162216C452AED3BAB6C','CLtes0010',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:37','1','2023-04-18 00:09:37',NULL,NULL),('3DADBCB5C5520962F87C7F6B6998D702','CLtes0002',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL),('526AA9BBAAF989FF7BA837B7D2AE3FFF','CLtes0008',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL),('53E2378532DE32415DD0ACB97AAF28AA','CLtes0001',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:37','1','2023-04-18 00:09:37',NULL,NULL),('5CB97667FAE39988D6CC47A632CE6EC3','CLtes0006',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:37','1','2023-04-18 00:09:37',NULL,NULL),('5DBABCFB732A021CD6058DED3C8B434D','CLtes0002',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:37','1','2023-04-18 00:09:37',NULL,NULL),('6DA5D0CB6775C373259CC548B51B8387','CLtes0005',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:37','1','2023-04-18 00:09:37',NULL,NULL),('791119222D9CC33B8EA399031D0FF17A','CLtes0008',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:37','1','2023-04-18 00:09:37',NULL,NULL),('8395210C1DD98B2207CE0F18311FED4C','CLtes0003',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL),('A675262AF995268CCF715D3B4CA94A89','CLtes0004',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:37','1','2023-04-18 00:09:37',NULL,NULL),('B20D6691C711EEDB8548142AEA797CC3','CLtes0005',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL),('B30886B4984BCB2E8BE82C532EA8D9BA','CLtes0007',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:37','1','2023-04-18 00:09:37',NULL,NULL),('BC5E0B5B1CB5126CD844A9B877F59B89','CLtes0009',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:37','1','2023-04-18 00:09:37',NULL,NULL),('D96D85799A8A9B0640192ABBE48FE44A','CLtes0009',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL),('E38BAD44FEB528FAF7C7076CC83062FC','CLtes0010',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL),('E7911F2C14447F966E84BAC48BF2E444','CLtes0007',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL),('EF3AE14FD91BFD2AA0E4CA04A912E073','CLtes0001',NULL,0,NULL,'34EECFAFC3C01A5B5BB56994ACAC655E',NULL,'1','2023-04-18 00:09:44','1','2023-04-18 00:09:44',NULL,NULL); +/*!40000 ALTER TABLE `storage_cell` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `storage_cupboard` +-- + +DROP TABLE IF EXISTS `storage_cupboard`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `storage_cupboard` ( + `id` varchar(255) NOT NULL COMMENT '柜子id', + `name` varchar(255) DEFAULT NULL COMMENT '柜子名称', + `cupboard_no` varchar(255) DEFAULT NULL COMMENT '柜子编号', + `specifications` int(5) DEFAULT NULL COMMENT '规格', + `storage_type` varchar(255) DEFAULT NULL COMMENT '存储类型(测试)', + `status` tinyint(1) DEFAULT NULL COMMENT '状态(正常/停用)--测试数据', + `room_id` varchar(255) DEFAULT NULL COMMENT '房间id', + `cupboard_photo` varchar(255) DEFAULT NULL COMMENT '柜子照片', + `create_by` varchar(255) DEFAULT NULL, + `create_time` datetime DEFAULT NULL, + `update_By` varchar(255) DEFAULT NULL, + `update_time` datetime DEFAULT NULL, + `sort` bigint(10) DEFAULT NULL COMMENT '排序', + `cupboard_type` varchar(255) DEFAULT NULL COMMENT '柜子/货架', + `rule` int(2) DEFAULT NULL COMMENT '1规则/2不规则', + `file_name` varchar(255) DEFAULT NULL COMMENT '照片名称', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `storage_cupboard` +-- + +LOCK TABLES `storage_cupboard` WRITE; +/*!40000 ALTER TABLE `storage_cupboard` DISABLE KEYS */; +INSERT INTO `storage_cupboard` VALUES ('34EECFAFC3C01A5B5BB56994ACAC655E','检材柜88888','test-fan',10,NULL,1,'test01','cupboard/34EECFAFC3C01A5B5BB56994ACAC655E','1','2023-04-18 00:09:44',NULL,'2023-04-18 00:09:44',NULL,NULL,NULL,'495.jpg'),('FEBA7CFB63B2EE89418050B03FE0F241','检材柜66666','test-fan',10,NULL,1,'test01','cupboard/FEBA7CFB63B2EE89418050B03FE0F241','1','2023-04-18 00:09:37',NULL,'2023-04-18 00:39:19',NULL,NULL,NULL,'001b389989a80a15b1b501.jpg'); +/*!40000 ALTER TABLE `storage_cupboard` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `storage_room` +-- + +DROP TABLE IF EXISTS `storage_room`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `storage_room` ( + `id` varchar(255) NOT NULL COMMENT '主键id', + `name` varchar(255) DEFAULT NULL COMMENT '房间名称(冷冻356)', + `room_location` varchar(255) DEFAULT NULL COMMENT '房间位置(3楼356)', + `room_photo` varchar(255) DEFAULT NULL COMMENT '房间照片', + `create_by` varchar(255) DEFAULT NULL, + `create_time` datetime DEFAULT NULL, + `update_By` varchar(255) DEFAULT NULL, + `update_time` datetime DEFAULT NULL, + `sort` bigint(10) DEFAULT NULL COMMENT '排序', + `file_name` varchar(255) DEFAULT NULL COMMENT '照片名称', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `storage_room` +-- + +LOCK TABLES `storage_room` WRITE; +/*!40000 ALTER TABLE `storage_room` DISABLE KEYS */; +INSERT INTO `storage_room` VALUES ('test01','存储室302','3楼2房间','room/test01','1','2023-03-24 10:26:47','1','2023-04-17 14:05:08',1,'9bd00b47b989f69a776c273f1c4fbb1b.jpg'),('test09','存储室3666','3楼2房间','','1','2023-03-24 10:26:47','1','2023-04-17 14:05:08',1,''); +/*!40000 ALTER TABLE `storage_room` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `undo_log` +-- + +DROP TABLE IF EXISTS `undo_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `undo_log` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `branch_id` bigint(20) NOT NULL, + `xid` varchar(100) NOT NULL, + `context` varchar(128) NOT NULL, + `rollback_info` longblob NOT NULL, + `log_status` int(11) NOT NULL, + `log_created` datetime NOT NULL, + `log_modified` datetime NOT NULL, + `ext` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `undo_log` +-- + +LOCK TABLES `undo_log` WRITE; +/*!40000 ALTER TABLE `undo_log` DISABLE KEYS */; +/*!40000 ALTER TABLE `undo_log` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2023-04-21 0:10:38 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..2e7cbac --- /dev/null +++ b/pom.xml @@ -0,0 +1,238 @@ + + + 4.0.0 + + digital.laboratory.platform + DigitalLaboratoryPlatform + 2022.10.11-snapshots + + + dlp-repository + jar + DLP 的检材仓库管理 + + 1.8 + 1.8 + 5.7.1 + + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + 2021.1 + + + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + 2021.1 + + + + + digital.laboratory.platform + dlp-common-swagger + 2022.10.11-snapshots + + + + + com.deepoove + poi-tl + 1.12.0 + + + + + org.springframework + spring-test + + + + digital.laboratory.platform + dlp-common-oss + 2022.10.11-snapshots + + + + digital.laboratory.platform + dlp-common-remote-word2pdf + 2022.10.11-snapshots + + + + + digital.laboratory.platform + dlp-common-seata + 2022.10.11-snapshots + + + + org.springframework.boot + spring-boot-starter-web + 2.5.5 + + + + digital.laboratory.platform + dlp-common-feign + 2022.10.11-snapshots + + + + + digital.laboratory.platform + dlp-common-security + 2022.10.11-snapshots + + + + + org.springframework.boot + spring-boot-starter-jdbc + + + + + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + digital.laboratory.platform + dlp-common-core + 2022.10.11-snapshots + + + + + + + mysql + mysql-connector-java + 8.0.28 + + + + + org.springframework.boot + spring-boot-starter-undertow + + + + + digital.laboratory.platform + dlp-common-log + 2022.10.11-snapshots + + + + + digital.laboratory.platform + dlp-admin-api + 2022.10.11-snapshots + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + -Xlint:unchecked + + 3.8.1 + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + timestamp-property + + timestamp-property + + + timestamp + yyyy-MM-dd HH:mm:ss + zh_CN + Asia/Shanghai + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + + maven-resources-plugin + org.apache.maven.plugins + 3.1.0 + + + copy-resource-one + install + + copy-resources + + + ${basedir}/../out + + + ${basedir}/target + + ${project.artifactId}.jar + + + + + + + + + + + + diff --git a/src/main/java/digital/laboratory/platform/imr/IdentificationMaterialRepositoryApplication.java b/src/main/java/digital/laboratory/platform/imr/IdentificationMaterialRepositoryApplication.java new file mode 100644 index 0000000..334b405 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/IdentificationMaterialRepositoryApplication.java @@ -0,0 +1,41 @@ +package digital.laboratory.platform.imr; + +import digital.laboratory.platform.common.feign.annotation.EnableDLPFeignClients; +import digital.laboratory.platform.common.security.annotation.EnableDLPResourceServer; +import digital.laboratory.platform.common.swagger.annotation.EnableDLPSwagger2; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration // ??? +@EnableDLPSwagger2 +@EnableDLPFeignClients +@EnableDiscoveryClient +@EnableDLPResourceServer +@SpringBootApplication(scanBasePackages="digital.laboratory.platform") +@EnableCaching +public class IdentificationMaterialRepositoryApplication { + + public static void main(String[] args) { + SpringApplication.run(IdentificationMaterialRepositoryApplication.class, args); + + + // System.out.println("\n\n\n"); + // System.out.println("-----------------------------"); + // System.out.println("end of Spring Application main()"); + // System.out.println("-----------------------------"); + // System.out.println("\n\n\n"); + + + } + + // @Bean + // RestTemplate restTemplate() { + // return new RestTemplate(); + // } + // +} diff --git a/src/main/java/digital/laboratory/platform/imr/component/DateUtils.java b/src/main/java/digital/laboratory/platform/imr/component/DateUtils.java new file mode 100644 index 0000000..bc29437 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/component/DateUtils.java @@ -0,0 +1,77 @@ +package digital.laboratory.platform.imr.component; + + +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoField; +import java.time.temporal.ChronoUnit; +import java.time.temporal.TemporalAdjusters; +import java.util.*; + +/** + * @Description: + * @Author: fangzh + * @CreateDate: 2020-11-18 17:53 + */ +public class DateUtils { + + /** + * 获取当前的分钟 + * + * @return + */ + public static String getTime() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String min = dateString.substring(14, 16); + return min; + } + + + public static String formatDateByPattern(Date date,String dateFormat) { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); + String formatTimeStr = null; + if (date != null) { + formatTimeStr = sdf.format(date); + } + return formatTimeStr; + } + + + public static String parseToCron(LocalDateTime taskTime) { + //Date-->LocalDateTime + Date date = toDate(taskTime); + //规定cron表达式格式 + String cronFormat = "ss mm HH dd MM ? yyyy"; + + return formatDateByPattern(date, cronFormat); + } + + public static String getCron(Date date) { + String dateFormat = "ss mm HH dd MM ? yyyy"; + return formatDateByPattern(date, dateFormat); + } + + public static Date toDate(LocalDateTime localDateTime) { + return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + } + + + public static String localDateTimeToStr(LocalDateTime localDateTime){ + DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + String dateStr = localDateTime.format(fmt); + + return dateStr ; + } + +} diff --git a/src/main/java/digital/laboratory/platform/imr/component/GetClientIPUtil.java b/src/main/java/digital/laboratory/platform/imr/component/GetClientIPUtil.java new file mode 100644 index 0000000..dba0be9 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/component/GetClientIPUtil.java @@ -0,0 +1,62 @@ +package digital.laboratory.platform.imr.component; + +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; + +import javax.servlet.http.HttpServletRequest; +import java.util.Enumeration; + +@Slf4j +public class GetClientIPUtil { + + public static String getIpAddress(HttpServletRequest request) { + + String ip = null; + + // x-forwarded-for : Squid 服务代理 + String ipAddresses = request.getHeader("X-Forwarded-For"); + log.info("====ipAddresses: {}", ipAddresses); + + // 获取所有头信息 + Enumeration headerNames = request.getHeaderNames(); + while (headerNames.hasMoreElements()) { + String headerKey = headerNames.nextElement(); + String header = request.getHeader(headerKey); + System.out.println(headerKey + ":::" + header); + } + + System.out.println("headerNames: " + JSON.toJSONString(headerNames)); + + String unknown = "unknown"; + if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) { + //Proxy-Client-IP:apache 服务代理 + ipAddresses = request.getHeader("Proxy-Client-IP"); + } + + if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) { + //WL-Proxy-Client-IP:weblogic 服务代理 + ipAddresses = request.getHeader("WL-Proxy-Client-IP"); + } + + if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) { + //HTTP_CLIENT_IP:有些代理服务器 + ipAddresses = request.getHeader("HTTP_CLIENT_IP"); + } + + if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) { + //X-Real-IP:nginx服务代理 + ipAddresses = request.getHeader("X-Real-IP"); + } + + //有些网络通过多层代理,那么获取到的ip就会有多个,一般都是通过逗号(,)分割开来,并且第一个ip为客户端的真实IP + if (ipAddresses != null && ipAddresses.length() != 0) { + ip = ipAddresses.split(",")[0]; + } + + //还是不能获取到,最后再通过request.getRemoteAddr();获取 + if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) { + ip = request.getRemoteAddr(); + } + return ip; + } +} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/config/WebSecurityConfigurer.java b/src/main/java/digital/laboratory/platform/imr/config/WebSecurityConfigurer.java new file mode 100644 index 0000000..c4999c4 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/config/WebSecurityConfigurer.java @@ -0,0 +1,28 @@ +package digital.laboratory.platform.imr.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.context.SecurityContextHolder; + +//@EnableOAuth2Sso +@Configuration + +public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter { + + @Override + public void configure(WebSecurity web) { + SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL); + web.ignoring().antMatchers("/", "/static/**", "/static/dist/**", "/hello**", "/favicon.ico**", "/login", "/login-callback", "/v2/**", "/papp/v2/**", "/papp/entrustment/common/**","/cabinetOpen/temperatureAndHumidity","/cabinetOpen/statisticsSampleCount/**"); + } + + @Override + public void configure(HttpSecurity http) throws Exception { + + http.csrf().disable() + .authorizeRequests() + .antMatchers("/", "/static/**", "/static/dist/**", "/hello**", "/favicon.ico**", "/login", "/login-callback", "/v2/**", "/papp/v2/**", "/papp/entrustment/common/**").permitAll() + .anyRequest().permitAll(); + } +} diff --git a/src/main/java/digital/laboratory/platform/imr/controller/CabinetOpenController.java b/src/main/java/digital/laboratory/platform/imr/controller/CabinetOpenController.java new file mode 100644 index 0000000..dc7b8c3 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/CabinetOpenController.java @@ -0,0 +1,428 @@ +package digital.laboratory.platform.imr.controller; + + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.component.GetClientIPUtil; +import digital.laboratory.platform.imr.dto.DepositToDTO; +import digital.laboratory.platform.imr.dto.QueryDTO; +import digital.laboratory.platform.imr.dto.UseOutboundDTO; +import digital.laboratory.platform.imr.dto.UserInfoDTO; +import digital.laboratory.platform.imr.entity.CabinetOpeningRecord; +import digital.laboratory.platform.imr.entity.SampleStorage; +import digital.laboratory.platform.imr.mapper.DestructionDetailMapper; +import digital.laboratory.platform.imr.mapper.SampleStorageMapper; +import digital.laboratory.platform.imr.service.CabinetOpeningRecordService; +import digital.laboratory.platform.imr.vo.CabinetSampleVO; +import digital.laboratory.platform.imr.vo.StatisticsCount; +import digital.laboratory.platform.sys.feign.RemoteEnvironmentService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.security.Principal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/cabinetOpen" ) +@Api(value = "cabinetOpen", tags = "智能物证柜管理") +public class CabinetOpenController { + + private static final PasswordEncoder ENCODER = new org.springframework.security.crypto.password.MessageDigestPasswordEncoder("MD5"); + + + + public final SampleStorageMapper storageMapper; + + + private final DestructionDetailMapper ddMapper; + + + public final RemoteEnvironmentService environmentService; + + + public final CabinetOpeningRecordService openingRecordService; + + /* + 通过请求获取id判断是属于哪个房间获取温湿度 + 这个接口不需要验证 + */ + + @ApiOperation(value = "获取房间号", notes = "获取房间号") + @GetMapping("/getRoom" ) + public R getRoom(HttpServletRequest request){ + + //根据ip判断属于那个房间 + String ipAddress = GetClientIPUtil.getIpAddress(request); + String roomNo = ""; + switch (ipAddress) { + case "192.168.30.243": + roomNo = "702"; + break; + case "192.168.30.241": + roomNo = "709"; + break; + case "192.168.10.242": + roomNo = "602"; + break; + case "192.168.10.241": + roomNo = "609"; + break; + case "192.168.10.243": + roomNo = "605"; + break; + default: + roomNo = "709"; + } + + + return R.ok(roomNo,"查询成功"); + } + + + + + @ApiOperation(value = "通过请求获取ip判断是属于哪个房间获取温湿度", notes = "通过请求获取ip判断是属于哪个房间获取温湿度") + @GetMapping("/temperatureAndHumidity" ) + public R temperatureAndHumidity(HttpServletRequest request){ + + //根据ip判断属于那个房间 + String ipAddress = GetClientIPUtil.getIpAddress(request); + String roomNo = ""; + switch (ipAddress) { + case "192.168.30.243": + roomNo = "702"; + break; + case "192.168.30.241": + roomNo = "709"; + break; + case "192.168.10.242": + roomNo = "602"; + break; + case "192.168.10.241": + roomNo = "609"; + break; + case "192.168.10.243": + roomNo = "605"; + break; + default: + roomNo = "706"; + } + + R> humiture = environmentService.getHumitureByRoomNo(roomNo); + + return R.ok(humiture,"查询成功"); + } + + + /* + 统计仓库模块的检材/样本 + */ + + @ApiOperation(value = "统计仓库模块的检材/样本type=1仓库现有样本总数;2出库待归还样本;3.退还出库/销毁出库样本", notes = "统计仓库模块的检材/样本") + @GetMapping("/statisticsSampleCount/{type}" ) + public R> statisticsSampleCount(@PathVariable("type") Integer type,HttpServletRequest request){ + + + //根据ip判断属于那个房间 + String ipAddress = GetClientIPUtil.getIpAddress(request); + String roomNo = ""; + switch (ipAddress) { + case "192.168.30.243": + roomNo = "702"; + break; + case "192.168.30.241": + roomNo = "709"; + break; + case "192.168.10.242": + roomNo = "602"; + break; + case "192.168.10.241": + roomNo = "609"; + break; + case "192.168.10.243": + roomNo = "605"; + break; + default: + roomNo = "706"; + } + + + ArrayList list = new ArrayList<>(); + if(type==1){ + //仓库现有样本(要区分房间) + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status",2); + queryWrapper.eq("room_no",roomNo); + Long count = storageMapper.selectCount(queryWrapper); + list.add(new StatisticsCount("inbound",count)); + } else if (type==2) { + //出库待归还样本 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status",3); + queryWrapper.eq("is_return",1); + queryWrapper.eq("room_no",roomNo); + Long count = storageMapper.selectCount(queryWrapper); + list.add(new StatisticsCount("return",count)); + + } else if (type==3) { + //出库样本 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status",3); + queryWrapper.eq("room_no",roomNo); + Long count = storageMapper.selectCount(queryWrapper); + list.add(new StatisticsCount("outbound",count)); + } + + return R.ok(list,"查询成功"); + + } + + + /* + 扫码查询检材接口 + */ + @ApiOperation(value = "扫码查询检材接口/支持样本编号入库/取检码出库", notes = "扫码查询检材接口") + @GetMapping("/scanCode/{number}" ) + public R> scanCode(@PathVariable("number") String number){ + if(StrUtil.isEmpty(number)){ + throw new RuntimeException("编号不能为空"); + } + List vo = openingRecordService.scanCode(number); + return R.ok(vo,"查询成功"); + } + + /* + 批量入库时扫码查询 + */ + @ApiOperation(value = "批量入库时扫码查询", notes = "批量入库时扫码查询") + @GetMapping("/batchScanCode/{number}" ) + public R> batchScanCode(@PathVariable("number") String number){ + if(StrUtil.isEmpty(number)){ + throw new RuntimeException("编号不能为空"); + } + + List vo = openingRecordService.batchScanCode(number); + + if(vo==null || vo.size()==0){ + return R.failed("当前编号未查询到任何数据,请检查是否错误"); + }else { + return R.ok(vo,"查询成功"); + } + } + + /* + 扫码查询检材推荐位置入库(选择位置后确认入库) + */ + @ApiOperation(value = "扫码推荐位置入库/批量入库--确认按钮--", notes = "扫码推荐位置入库--确认按钮") + @PostMapping("/scanCodePromptInbound" ) + public R scanCodePromptInbound(@RequestBody DepositToDTO dto, HttpServletRequest theHttpServletRequest){ + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + openingRecordService.scanCodePromptInbound(dto,dlpUser); + + return R.ok("存储成功","存储成功"); + } + + /* + 扫码查询检材显示存储位置出库(确认出库) + */ + @ApiOperation(value = "扫码推荐出库--这里传入单个sampleId和监督人id", notes = "扫码推荐出库") + @PostMapping("/scanCodePromptOutbound" ) + public R scanCodePromptOutbound(@RequestBody UseOutboundDTO dto, HttpServletRequest theHttpServletRequest){ + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if(StrUtil.isEmpty(dto.getSupervisorId())){ + throw new RuntimeException("监督人不能为空"); + } + + openingRecordService.scanCodePromptOutbound(dto,dlpUser); + + return R.ok("出库成功","出库成功"); + } + + + /* + 智能柜修改sample质量 + */ + @ApiOperation(value = "智能柜修改sample质量", notes = "智能柜修改sample质量") + @PostMapping("/updateSampleQuality") + public R updateSampleQuality(String sampleId,double sampleQuality){ + + if(StrUtil.isEmpty(sampleId)){ + throw new RuntimeException("id不能为空"); + } + + //查询并修改 + openingRecordService.updateSampleQuality(sampleId,sampleQuality); + + return R.ok(null,"修改质量成功"); + } + + + + + /* + 根据取检码查询检材信息 + */ + @ApiOperation(value = "根据取检码查询检材信息", notes = "根据取检码查询检材信息") + @GetMapping("/querySampleByCode" ) + public R> querySampleByCode(String code,HttpServletRequest request){ + + + //根据ip判断属于那个房间 + String ipAddress = GetClientIPUtil.getIpAddress(request); + String roomNo = ""; + switch (ipAddress) { + case "192.168.30.243": + roomNo = "702"; + break; + case "192.168.30.241": + roomNo = "709"; + break; + case "192.168.10.242": + roomNo = "602"; + break; + case "192.168.10.241": + roomNo = "609"; + break; + case "192.168.10.243": + roomNo = "605"; + break; + default: + roomNo = "709"; + } + + List list = openingRecordService.querySampleByCode(code,roomNo); + + return R.ok(list,"查询成功"); + } + + /* + 领用出库 + */ + @ApiOperation(value = "领用出库--这里传code和监督人id和sampleIds样本id集合", notes = "领用出库") + @PostMapping("/useOutbound") + public R useOutbound(@RequestBody UseOutboundDTO dto, HttpServletRequest theHttpServletRequest){ + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if(StrUtil.isEmpty(dto.getSupervisorId())){ + throw new RuntimeException("监督人不能为空"); + } + + openingRecordService.useOutbound(dto,dlpUser); + + return R.ok("出库成功","出库成功"); + } + + + + /* + 强制开箱forceOpen + */ + @ApiOperation(value = "强制开箱--这里传cellId和监督人id", notes = "强制开箱") + @PostMapping("/forceOpen" ) + public R forceOpen(@RequestBody UseOutboundDTO dto, HttpServletRequest theHttpServletRequest){ + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if(StrUtil.isEmpty(dto.getSupervisorId())){ + throw new RuntimeException("监督人不能为空"); + } + if(StrUtil.isEmpty(dto.getPassword())){ + throw new RuntimeException("请填写密码"); + } + + String s = dlpUser.getPassword(); + String password = s.replace("{MD5}", ""); + Assert.isTrue(ENCODER.matches(dto.getPassword(), password), "密码错误, 请重试"); + openingRecordService.forceOpen(dto,dlpUser); + return R.ok("出库成功","出库成功"); + } + + + /* + 查询人接口 + */ + + @ApiOperation(value = "查询人接口", notes = "查询人接口") + @GetMapping("/getUserInfo" ) + public R getApprove(String name, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + //查询全部接收人 + List user = ddMapper.getApprove(name,dlpUser.getId()); + return R.ok(user,"查询成功"); + } + + /* + 分页查询开箱记录 + */ + + @ApiOperation(value = "分页查询开箱记录", notes = "分页查询开箱记录") + @GetMapping("/page/openRecord" ) + public R> openRecord(QueryDTO dto, HttpServletRequest theHttpServletRequest){ + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + String ipAddress = GetClientIPUtil.getIpAddress(theHttpServletRequest); + String roomNo = ""; + switch (ipAddress) { + case "192.168.30.243": + roomNo = "702"; + break; + case "192.168.30.241": + roomNo = "709"; + break; + case "192.168.10.242": + roomNo = "602"; + break; + case "192.168.10.241": + roomNo = "609"; + break; + case "192.168.10.243": + roomNo = "605"; + break; + default: + roomNo = "706"; + } + + + Page recordPage = new Page<>(dto.getCurrent(), dto.getSize()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + + queryWrapper.like(StrUtil.isNotEmpty(dto.getName()),"open_person",dto.getName()); + queryWrapper.eq("warehouse",roomNo); + queryWrapper.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"open_time",dto.getBeginDate(),dto.getFinishDate()); + + queryWrapper.orderByDesc("open_time"); + + IPage thisPage = openingRecordService.page(recordPage,queryWrapper); + + return R.ok(thisPage,"查询成功"); + + } + +} diff --git a/src/main/java/digital/laboratory/platform/imr/controller/DestructionPublicityController.java b/src/main/java/digital/laboratory/platform/imr/controller/DestructionPublicityController.java new file mode 100644 index 0000000..069bf8c --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/DestructionPublicityController.java @@ -0,0 +1,295 @@ +package digital.laboratory.platform.imr.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.log.annotation.SysLog; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.DestructionPublicityDTO; +import digital.laboratory.platform.imr.dto.PublicityDTO; +import digital.laboratory.platform.imr.dto.QueryDTO; +import digital.laboratory.platform.imr.dto.UserInfoDTO; +import digital.laboratory.platform.imr.entity.DestructionPublicity; +import digital.laboratory.platform.imr.entity.SampleStorage; +import digital.laboratory.platform.imr.mapper.DestructionDetailMapper; +import digital.laboratory.platform.imr.mapper.DestructionPublicityMapper; +import digital.laboratory.platform.imr.mapper.SampleStorageMapper; +import digital.laboratory.platform.imr.service.DestructionPublicityService; +import digital.laboratory.platform.imr.vo.DestructionPublicityVO; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.security.Principal; +import java.util.Arrays; +import java.util.List; + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-23 + * @describe 前端控制器 + * + * 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 + * 这里写什么: + * 为前端提供数据, 接受前端的数据 + * 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 + * 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 + * 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/destruction_publicity" ) +@Api(value = "destruction_publicity", tags = "检材销毁与公示管理") +public class DestructionPublicityController { + + private final DestructionPublicityService dpService; + + + private final DestructionDetailMapper ddMapper; + + private final DestructionPublicityMapper dpMapper; + + + private final SampleStorageMapper storageMapper; + + /** + * 通过id查询 + * @param id id + * @return R + */ + @ApiOperation(value = "通过id查询公示详情", notes = "通过id查询公示详情") + @GetMapping("/getOneById/{id}" ) + @PreAuthorize("@pms.hasPermission('imr_destruction_publicity_get')" ) + public R getOneById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) { + if(id==null||"".equals((id))){ + throw new RuntimeException(String.format("申请id不能为空" )); + } + DestructionPublicity vo = dpService.getOneById(id); + return R.ok(vo); + } + + /** + * 分页查询 + * @param dto 分页对象 + * @param dto + * @return + */ + @ApiOperation(value = "分页查询", notes = "分页查询") + @GetMapping("/page" ) + @PreAuthorize("@pms.hasPermission('imr_destruction_publicity_get')" ) + public R> getDestructionPublicityPage(PublicityDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + Page page = new Page<>(dto.getCurrent(),dto.getSize()); + + IPage vo = dpService.getDestructionPublicityPage(page,Wrappers.query() + .between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"release_date",dto.getBeginDate(),dto.getFinishDate()) + .eq("status",dto.getStatus()) + ); + return R.ok(vo,"查询成功"); + } + + /** + * 列表查询 + */ + + + /** + * 新增 + * @param dto + * @return R + */ + @ApiOperation(value = "创建检材销毁与公示", notes = "新增") + @SysLog("新增" ) + @PostMapping("/createPublicity") + @PreAuthorize("@pms.hasPermission('imr_destruction_publicity_add')" ) + public R createPublicity(@RequestBody DestructionPublicityDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if (dto.getDestroyDate()==null|| + dto.getReviewerId()==null|| + dto.getDestroyCompany()==null|| + dto.getSampleIds().isEmpty() + ){ + throw new RuntimeException(String.format("公示数据不能为空")); + } + + DestructionPublicityVO vo = null; + if(dto.getId()==null){ + vo = dpService.createPublicity(dto,dlpUser); + }else { + vo = dpService.updatePublicity(dto,dlpUser); + } + + if (vo!=null){ + return R.ok(vo,"公示创建成功"); + }else{ + return R.failed("公示创建失败"); + } + } + + /** + * 修改 + * @param dto + * @return R + */ + @ApiOperation(value = "修改", notes = "修改") + @SysLog("修改" ) + @PutMapping("/updatePublicity") + @PreAuthorize("@pms.hasPermission('imr_destruction_publicity_edit')" ) + public R updatePublicity(@RequestBody DestructionPublicityDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + if (dto.getDestroyDate()==null|| + dto.getReviewerId()==null|| + dto.getDestroyCompany()==null|| + dto.getSampleIds().isEmpty()|| + dto.getId()==null + ){ + throw new RuntimeException(String.format("创建销毁与申请的数据不能为空")); + } + DestructionPublicityVO vo = dpService.updatePublicity(dto,dlpUser); + + if (vo!=null){ + return R.ok(vo,"操作成功"); + }else{ + return R.failed("操作失败"); + } + } + + /** + * 单个通过id删除 + * @param id id + * @return R + */ + @ApiOperation(value = "通过id删除", notes = "通过id删除") + @SysLog("通过id删除" ) + @DeleteMapping("/delete/{id}" ) + @PreAuthorize("@pms.hasPermission('imr_destruction_publicity_del')" ) + public R deleteOneById(@PathVariable("id") String id) { + + + dpService.deleteOneById(id); + + return R.ok(null,"删除成功"); + } + + + + @ApiOperation(value = "批量删除", notes = "批量删除") + @SysLog("通过id删除" ) + @DeleteMapping("/deleteList" ) + @PreAuthorize("@pms.hasPermission('imr_destruction_publicity_del')" ) + public R deleteOneById(@RequestBody List ids) { + + + for (String id : ids) { + dpService.deleteOneById(id); + } + return R.ok(null,"删除成功"); + + } + + + @ApiOperation(value = "查询审核人接口", notes = "查询审核人接口") + @GetMapping("/getApprove" ) + @PreAuthorize("@pms.hasPermission('imr_destruction_publicity_get')" ) + public R getApprove(String name, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + //查询全部接收人 + List user = ddMapper.getApprove(name,dlpUser.getId()); + return R.ok(user,"查询成功"); + } + + /** + * 发布/提交 + */ + @ApiOperation(value = "发布/提交", notes = "发布/提交") + @PutMapping("/release" ) + @PreAuthorize("@pms.hasPermission('imr_destruction_publicity_edit')" ) + public R release(String id, HttpServletRequest theHttpServletRequest) { + + if(id == null){ + throw new RuntimeException(String.format("id不能为空")); + } + + DestructionPublicity vo = dpService.release(id); + + return R.ok(vo,"发布成功"); + } + + + /* + 查询可公示的样本(审核审批成功后的) + */ + @ApiOperation(value = "查询可公示的样本(审核审批成功后的)", notes = "查询可公示的样本(审核审批成功后的)") + @GetMapping("/getSampleInfo" ) + @PreAuthorize("@pms.hasPermission('imr_destruction_publicity_get')" ) + public R getSampleInfo(QueryDTO dto) { + + List sampleIds = Arrays.asList(dto.getSampleIds().split(",")); + int size = sampleIds.size(); + if ("".equals(dto.getSampleIds())){ + size = sampleIds.size()-1; + } + + + if(dto.getTotal()!=0){ + int num = 0;//去重后目前能分的页数 + + if((dto.getTotal()-size)%8==0){ + num = (dto.getTotal()-size)/8; + }else { + num = (dto.getTotal()-size)/8+1; + } + + System.out.println(num); + + if(dto.getCurrent()>num){ + //求余数 + int a = dto.getTotal()%8;//求最后一页的剩余条数 + if(a==0){ + a=8; + if(sampleIds.size()>=a){ + dto.setCurrent(num); + } + }else { + if(sampleIds.size()>=a){ + dto.setCurrent(num); + } + } + } + } + Page page = new Page<>(dto.getCurrent(),dto.getSize()); + + IPage sampleVOIPage = storageMapper.getSampleInfo(page,Wrappers.query() + .notIn(!sampleIds.isEmpty(),"storage.sample_id",sampleIds)//去重数组sampleIds + .like(!dto.getName().isEmpty(),"storage.name",dto.getName()) + .eq("storage.early_warning",2) //只能查找通过审核审批的样本 + .eq("s.status",7)//状态等于待销毁 + + ); + List records = sampleVOIPage.getRecords(); + for (OutSampleVO vo : records) { + vo.setSampleId(vo.getId()); + } + + return R.ok(sampleVOIPage,"查询成功"); + } + +} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java b/src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java new file mode 100644 index 0000000..791c20e --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java @@ -0,0 +1,15 @@ +package digital.laboratory.platform.imr.controller; + + +import io.swagger.annotations.Api; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/drugDepots" ) +@Api(value = "DrugDepotsController", tags = "毒品库信息管理接口") +public class DrugDepotsController { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/controller/ReviewApprovalController.java b/src/main/java/digital/laboratory/platform/imr/controller/ReviewApprovalController.java new file mode 100644 index 0000000..3e152dc --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/ReviewApprovalController.java @@ -0,0 +1,212 @@ +package digital.laboratory.platform.imr.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.log.annotation.SysLog; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.QueryApplyDTO; +import digital.laboratory.platform.imr.dto.ReviewApprovalDTO; +import digital.laboratory.platform.imr.dto.ReviewSampleDetail; +import digital.laboratory.platform.imr.dto.SampleApplyQueryDTO; +import digital.laboratory.platform.imr.entity.SampleApply; +import digital.laboratory.platform.imr.entity.enums.ApplyStatus; +import digital.laboratory.platform.imr.mapper.SampleApplyDetailedMapper; +import digital.laboratory.platform.imr.mapper.SampleApplyMapper; +import digital.laboratory.platform.imr.service.ReviewApprovalService; +import digital.laboratory.platform.imr.service.SampleApplyService; +import digital.laboratory.platform.imr.vo.ApplySampleVO; +import digital.laboratory.platform.imr.vo.SampleApplyVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.security.Principal; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +/** + * 自定义审核/审批控制层 + * 这个controller应用与检材申请的审核审批 + * 外带+销毁 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/review_approval" ) +@Api(value = "review_approval", tags = "样本申请审核审批") +public class ReviewApprovalController { + + private final ReviewApprovalService reviewApprovalService; + private final SampleApplyService sampleApplyService; + + /* + ---------------审核模块分页(加权限)------------------ + */ + + /** + * + */ + /* @ApiOperation(value = "一级审核员分页查询", notes = "一级审核员分页查询") + @GetMapping("firstAudit/page" ) + @PreAuthorize("@pms.hasPermission('imr_sample_apply_get_firstAudit')" ) + public R> getPage( @RequestBody SampleApplyQueryDTO dto) { + + return null; + }*/ + + + + + + + @ApiOperation(value = "查询申请详情", notes = "查询申请详情") + @SysLog("查询申请详情" ) + @GetMapping("/getDetail") + @PreAuthorize("@pms.hasPermission('imr_review_and_approval')" ) + public R getDetail(String id) { + + if(id==null){ + throw new RuntimeException(String.format("申请id不能为空" )); + } + + SampleApplyVO sampleApply = sampleApplyService.getDetail(id); + + return R.ok(sampleApply); + } + + @ApiOperation(value = "审核分页查询", notes = "审核分页查询") + @GetMapping("/page" ) + @PreAuthorize("@pms.hasPermission('imr_review_and_approval')" ) + public R> getAuditPage(QueryApplyDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + Page page = new Page<>(dto.getCurrent(),dto.getSize()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + ArrayList list = new ArrayList<>(); + + Set permissions = dlpUser.getPermissions();//判断权限 + + //System.out.println(permissions); + for (String permission : permissions) { + if ("imr_sample_apply_first_audit".equals(permission)) { + // + queryWrapper.eq("apply_type",1); + if(dto.getStatus()==null){//审核初页面(不应该有销毁申请) + queryWrapper.eq("application_status",1); + }else {//点击通过页面时 + if(dto.getStatus()==0){ + //返回全部 + queryWrapper.and(Wrapper->Wrapper.le("application_status",-2) + .or().ge("application_status",2) + ); + }else { + //通过status==1/不通过status==-1 + if(dto.getStatus()==1){ + queryWrapper.ge("application_status",2); + } + if(dto.getStatus()==-1){ + queryWrapper.le("application_status",-2); + } + } + } + break; + } else if ("imr_sample_apply_secondary_audit".equals(permission)) { + //二级审核员(不应该有销毁申请) + queryWrapper.eq("apply_type",1); + if(dto.getStatus()==null){ + queryWrapper.eq("application_status",2); + }else { + if(dto.getStatus()==0){ + //返回全部 + queryWrapper.and(Wrapper->Wrapper.le("application_status",-3) + .or().ge("application_status",3) + ); + /*queryWrapper.le("application_status",-3).or() + .ge("application_status",3);//大于=3的后面所有*/ + }else { + //通过status==1/不通过status==-1 + if(dto.getStatus()==1){ + queryWrapper.ge("application_status",3); + } + if(dto.getStatus()==-1){ + queryWrapper.le("application_status",-3); + } + } + } + break; + }else if ("imr_sample_apply_approval".equals(permission)) { + //审批人 + if(dto.getStatus()==null){ + queryWrapper.eq("application_status",3); + }else { + if(dto.getStatus()==0){ + list.add(-4);//二级不通过 + list.add(4);//通过/不通过 + queryWrapper.in("application_status",list); + }else { + //通过status==1/不通过status==-1 + if(dto.getStatus()==1){ + queryWrapper.eq("application_status",4); + } + if(dto.getStatus()==-1){ + queryWrapper.eq("application_status",-4); + } + } + } + break; + } + } + //判断权限查询条件设置完毕 + queryWrapper.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"application_date",dto.getBeginDate(),dto.getFinishDate()); + queryWrapper.orderByDesc("application_date"); + IPage applyVOPage = sampleApplyService.getApplyPage(page, queryWrapper); + return R.ok(applyVOPage,"查询成功"); + } + + /** + * 审核审批 + * @param dto + * @param theHttpServletRequest + * @return + */ + @ApiOperation(value = "检材申请审核审批", notes = "检材申请审核审批") + @PutMapping("/sampleApply/approval" ) + @PreAuthorize("@pms.hasPermission('imr_review_and_approval')" ) + public R applyApproval(@RequestBody ReviewApprovalDTO dto, HttpServletRequest theHttpServletRequest) { + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + Set permissions = dlpUser.getPermissions();//判断权限 + + SampleApplyVO sampleApplyVO = null; + + for (String permission : permissions) { + if ("imr_sample_apply_first_audit".equals(permission)) { + //一级审核员 + sampleApplyVO = reviewApprovalService.firstAudit(dto, dlpUser); + break; + } else if ("imr_sample_apply_secondary_audit".equals(permission)) { + //二级审核员 + reviewApprovalService.secondaryAudit(dto, dlpUser); + break; + }else if ("imr_sample_apply_approval".equals(permission)) { + //审批人 + reviewApprovalService.approval(dto,dlpUser); + break; + } + } + return R.ok(sampleApplyVO,"审核成功"); + } +} diff --git a/src/main/java/digital/laboratory/platform/imr/controller/SampleApplyController.java b/src/main/java/digital/laboratory/platform/imr/controller/SampleApplyController.java new file mode 100644 index 0000000..ef6aa68 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/SampleApplyController.java @@ -0,0 +1,680 @@ +package digital.laboratory.platform.imr.controller; + +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.io.IoUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; +import com.deepoove.poi.config.ConfigureBuilder; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.feign.RemoteWord2PDFService; +import digital.laboratory.platform.common.log.annotation.SysLog; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.common.oss.service.OssFile; +import digital.laboratory.platform.imr.dto.ApplyDTO; +import digital.laboratory.platform.imr.dto.QueryApplyDTO; +import digital.laboratory.platform.imr.dto.QueryDTO; +import digital.laboratory.platform.imr.entity.SampleApply; +import digital.laboratory.platform.imr.entity.SampleStorage; +import digital.laboratory.platform.imr.mapper.SampleApplyDetailedMapper; +import digital.laboratory.platform.imr.mapper.SampleStorageMapper; +import digital.laboratory.platform.imr.service.SampleApplyService; +import digital.laboratory.platform.imr.vo.ApplySampleVO; +import digital.laboratory.platform.imr.vo.BaseSampleVO; +import digital.laboratory.platform.imr.vo.SampleApplyVO; +import feign.Response; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.security.Principal; +import java.util.*; + +/** + * 检材申请实体类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 检材申请实体类 前端控制器 + * + * 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 + * 这里写什么: + * 为前端提供数据, 接受前端的数据 + * 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 + * 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 + * 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/sample_apply" ) +@Api(value = "sample_apply", tags = "检材申请管理--外带+销毁") +public class SampleApplyController { + + private final SampleApplyService sampleApplyService; + + + + private final OssFile ossFile; + + private final RemoteWord2PDFService remoteWord2PDFService; + + private final SampleStorageMapper storageMapper; + + + /** + * 提供id查询申请详情 + */ + @ApiOperation(value = "查询申请详情", notes = "查询申请详情") + @SysLog("查询申请详情" ) + @GetMapping("/getDetail") + @PreAuthorize("@pms.hasPermission('imr_sample_apply_get')" ) + public R getDetail(String id) { + + if(id==null){ + throw new RuntimeException("申请id不能为空"); + } + + SampleApplyVO sampleApply = sampleApplyService.getDetail(id); + + return R.ok(sampleApply); + } + + @ApiOperation(value = "申请人查询销毁申请--分页", notes = "申请人查询申请--分页") + @SysLog("申请人查询申请--分页" ) + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('imr_sample_des_apply')" ) + public R> getApplyPage(QueryApplyDTO dto,HttpServletRequest theHttpServletRequest) { + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + Page page = new Page<>(dto.getCurrent(),dto.getSize()); + + if(dto.getApplyType()==null){ + throw new RuntimeException(String.format("需要传递申请类型参数" )); + } + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("apply_type",dto.getApplyType()); + if(!dlpUser.getPermissions().contains("imr_inbound_or_outbound")){ + //如果不是检材管理员只能看见自己的 + wrapper.eq("applicant_id",dlpUser.getId()); + } + wrapper.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"application_date",dto.getBeginDate(),dto.getFinishDate()); + if(dto.getStatus()!=null){ + wrapper.eq("application_status",dto.getStatus()); + }else { + wrapper.ne("application_status",4); + } + wrapper.orderByDesc("application_date");//申请时间排序 + + IPage vo = sampleApplyService.getApplyPage(page,wrapper); + + return R.ok(vo,"查询成功"); + } + + + + + @ApiOperation(value = "申请人查询外带申请--分页", notes = "申请人查询申请--分页") + @SysLog("申请人查询申请--分页" ) + @GetMapping("/list") + @PreAuthorize("@pms.hasPermission('imr_sample_out_apply')" ) + public R> getApplyList(QueryApplyDTO dto,HttpServletRequest theHttpServletRequest) { + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + Page page = new Page<>(dto.getCurrent(),dto.getSize()); + + if(dto.getApplyType()==null){ + throw new RuntimeException("需要传递申请类型参数"); + } + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("apply_type",dto.getApplyType()); + wrapper.eq("applicant_id",dlpUser.getId()); + wrapper.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"application_date",dto.getBeginDate(),dto.getFinishDate()); + if(dto.getStatus()!=null){ + wrapper.eq("application_status",dto.getStatus()); + }else { + wrapper.ne("application_status",4); + } + wrapper.orderByDesc("application_date");//申请时间排序 + + + + IPage vo = sampleApplyService.getApplyPage(page,wrapper); + + return R.ok(vo,"查询成功"); + } + + + + + + + /** + * 创建并保存检材申请 + * @param dto + * @return R + */ + @ApiOperation(value = "创建并保存检材申请", notes = "创建并保存检材申请") + @SysLog("创建并保存检材申请" ) + @PostMapping("/createAndSave") + @PreAuthorize("@pms.hasPermission('imr_sample_apply_add')" ) + public R createAndSave(@RequestBody ApplyDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + if(dto.getApplyType()==null){ + throw new RuntimeException("必须提供一个申请类型/外带/销毁"); + } + if(dto.getSampleId()==null ||dto.getSampleId().size()==0){ + throw new RuntimeException("样本信息不能为空"); + } + SampleApplyVO applyVO = null; + if(dto.getId()==null||"".equals(dto.getId())) { + applyVO = sampleApplyService.createAndSave(dto, dlpUser); + }else { + applyVO = sampleApplyService.updateAndSave(dto, dlpUser); + } + + return R.ok(applyVO,"保存成功"); + + } + + + /** + * 根据当前持有人去查询数据 + * 问题:1.创建完流转后当前持有人数据显示问题 + * + * 设定查询有两个条件需要满 + * 1.当前持有人id + * 2.当前的样本状态!=4;(不等于流转中)---这个是目前的想法 + */ + @ApiOperation(value = "创建外带申请--根据当前持有人去查询数据", notes = "根据当前持有人去查询数据") + @GetMapping("/getSampleInfoByHolder" ) + @PreAuthorize("@pms.hasPermission('imr_sample_apply_get')" ) + public R> getSampleInfoByHolder(QueryDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + List sampleIds = Arrays.asList(dto.getSampleIds().split(",")); + int size = sampleIds.size(); + if ("".equals(dto.getSampleIds())){ + size = sampleIds.size()-1; + } + + + if(dto.getTotal()!=0){ + int num = 0;//去重后目前能分的页数 + + if((dto.getTotal()-size)%8==0){ + num = (dto.getTotal()-size)/8; + }else { + num = (dto.getTotal()-size)/8+1; + } + + System.out.println(num); + + if(dto.getCurrent()>num){ + //求余数 + int a = dto.getTotal()%8;//求最后一页的剩余条数 + if(a==0){ + a=8; + if(sampleIds.size()>=a){ + dto.setCurrent(num); + } + }else { + if(sampleIds.size()>=a){ + dto.setCurrent(num); + } + } + } + } + Page samplePage = new Page<>(dto.getCurrent(),dto.getSize()); + + IPage sampleVOS = storageMapper.getSampleInfoByHolder(samplePage,Wrappers.query() + .notIn(!sampleIds.isEmpty(),"s.id",sampleIds)//去重数组id + .like(!dto.getName().isEmpty(),"s.name",dto.getName()) + .eq("s.holder",dlpUser.getId()) + .eq("s.status",1)//状态为出库 + .ne("s.status",12)//当前状态不等于申请中 + + ); + return R.ok(sampleVOS,"查询成功"); + } + + + + /** + * 根据当前持有人去查询数据 + * 问题:1.创建完流转后当前持有人数据显示问题 + * + * 设定查询有两个条件需要满足 + * 1.当前持有人id + * 2.当前的样本状态!=4;(不等于流转中)---这个是目前的想法 + */ + @ApiOperation(value = "当前仓库库存样本--创建销毁申请", notes = "当前仓库库存样本--创建销毁申请") + @GetMapping("/getSampleInfoByRepository" ) + @PreAuthorize("@pms.hasPermission('imr_sample_apply_get')" ) + public R> getSampleInfoByRepository(QueryDTO dto) { + + List sampleIds = Arrays.asList(dto.getSampleIds().split(",")); + int size = sampleIds.size(); + if ("".equals(dto.getSampleIds())){ + size = sampleIds.size()-1; + } + + + if(dto.getTotal()!=0){ + int num = 0;//去重后目前能分的页数 + + if((dto.getTotal()-size)%8==0){ + num = (dto.getTotal()-size)/8; + }else { + num = (dto.getTotal()-size)/8+1; + } + + System.out.println(num); + + if(dto.getCurrent()>num){ + //求余数 + int a = dto.getTotal()%8;//求最后一页的剩余条数 + if(a==0){ + a=8; + } + if(sampleIds.size()>=a){ + dto.setCurrent(num); + } + } + } + + Page samplePage = new Page<>(dto.getCurrent(),dto.getSize()); + + IPage sampleVOS = storageMapper.getDestructionSample(samplePage,Wrappers.query() + .notIn(!sampleIds.isEmpty(),"storage.sample_id",sampleIds)//去重数组id + .like(!dto.getName().isEmpty(),"storage.name",dto.getName()) + .eq("storage.status",2)//在仓库的 + .eq("storage.early_warning",1)//在仓库已经到销毁时间了的 + .ne("s.status",12 )//当前状态不等于申请中 + .ne("s.status",8)//该样本没有被销毁 + + + ); + return R.ok(sampleVOS,"查询成功"); + } + + + + /** + * 创建并提交检材申请(创建直接点提交) + * @param dto + * @return R + */ + @ApiOperation(value = "创建并提交检材申请", notes = "创建并提交检材申请") + @SysLog("创建并提交检材申请" ) + @PostMapping("/createAndSubmit") + @PreAuthorize("@pms.hasPermission('imr_sample_apply_add')" ) + public R createAndSubmit(@RequestBody ApplyDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if (dto.getApplyType() == null) { + throw new RuntimeException(String.format("必须提供一个申请类型/外带/销毁")); + } + if (dto.getSampleId().isEmpty()) { + throw new RuntimeException(String.format("样本信息不能为空")); + } + if (dto.getSampleId().size() == 0) { + throw new RuntimeException(String.format("样本信息不能为空")); + } + SampleApplyVO applyVO = null; + if(dto.getId()==null||"".equals(dto.getId())) { + applyVO = sampleApplyService.createAndSubmit(dto, dlpUser); + }else { + applyVO = sampleApplyService.updateAndSubmit(dto, dlpUser); + } + return R.ok(applyVO, "创建成功"); + } + + + /** + *单个提交申请 + */ + @ApiOperation(value = "单个提交申请", notes = "单个提交申请") + @SysLog("单个提交申请" ) + @PutMapping("/submitApplyOne") + @PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" ) + public R submitApplyOne(String id){ + + if(id==null){ + throw new RuntimeException(String.format("id不能为空")); + } + SampleApplyVO vo = sampleApplyService.submitApplyOne(id); + + return R.ok(vo, "提交成功"); + } + + /** + * 批量提交申请 + */ + @ApiOperation(value = "批量提交申请", notes = "批量提交申请") + @SysLog("批量提交申请" ) + @PutMapping("/submitApplyList") + @PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" ) + public R submitApplyList(@RequestBody List ids){ + if (ids.isEmpty()){ + throw new RuntimeException(String.format("请选择提交的申请" )); + } + for (String id : ids) { + sampleApplyService.submitApplyOne(id); + } + return R.ok(null,"提交成功"); + } + + /** + * 单个撤回withdrawal + */ + + @ApiOperation(value = "单个撤回", notes = "单个撤回") + @SysLog("单个撤回" ) + @PutMapping("/withdrawalOne/{id}") + @PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" ) + public R withdrawalOne(@PathVariable("id") String id){ + + if(id==null){ + throw new RuntimeException(String.format("id不能为空")); + } + SampleApplyVO vo = sampleApplyService.withdrawalOne(id); + + return R.ok(vo, "撤回成功"); + } + + /** + * 批量撤回 + */ + @ApiOperation(value = "批量撤回", notes = "批量撤回") + @SysLog("批量撤回" ) + @PutMapping("/withdrawalList") + @PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" ) + public R withdrawalList(@RequestBody List ids){ + + if (ids.isEmpty()){ + throw new RuntimeException(String.format("请选择撤回的申请" )); + } + for (String id:ids) { + sampleApplyService.withdrawalOne(id); + } + + return R.ok(null,"撤回成功"); + + } + + + /** + * 单个删除 + * @param id id + * @return R + */ + @ApiOperation(value = "单个删除", notes = "单个删除") + @SysLog("通过id删除检材申请实体类" ) + @DeleteMapping("/deleteApplyOne/{id}" ) + @PreAuthorize("@pms.hasPermission('imr_sample_apply_del')" ) + public R deleteApplyOne(@PathVariable("id") String id, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if (id.isEmpty()){ + throw new RuntimeException(String.format("删除数据id不存在")); + } + + sampleApplyService.deleteOne(id); + + return R.ok(null, "删除成功"); + } + + /** + * 批量删除 + * @param ids + * @return R + */ + @ApiOperation(value = "批量删除", notes = "批量删除") + @SysLog("批量删除" ) + @DeleteMapping("/deleteApplyList" ) + @PreAuthorize("@pms.hasPermission('imr_sample_apply_del')" ) + public R deleteApplyList(@RequestBody List ids, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + + if(ids.isEmpty()){ + throw new RuntimeException(String.format("删除数据id不能为空")); + } + for (String id:ids) { + sampleApplyService.deleteOne(id); + } + return R.ok(null, "对象删除成功"); + } + + /** + * 修改并提交检材申请实体类(修改的设定为直接提交)修改应该叫修改并提交 + * 1.待提交 + * 2.审核审批不通过状态? + * 2的情况比较特殊,这种已经审批过的修改应该是重新创建一条数据? + * @param dto 检材申请实体类 + * @return R + */ + @ApiOperation(value = "修改并提交申请", notes = "修改并提交申请") + @SysLog("修改检材申请实体类" ) + @PutMapping("/updateAndSubmit") + @PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" ) + public R updateAndSubmit(@RequestBody ApplyDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if (dto.getId()==null){ + throw new RuntimeException(String.format("申请id不能为空")); + } + + if(dto.getSampleId().isEmpty()){ + throw new RuntimeException(String.format("选择样本不能为空")); + } + + SampleApplyVO vo = sampleApplyService.updateAndSubmit(dto,dlpUser); + + return R.ok(vo,"修改成功"); + + } + + + + + @ApiOperation(value = "修改并保存", notes = "修改并保存") + @SysLog("修改并保存" ) + @PutMapping("/updateAndSave") + @PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" ) + public R updateAndSave(@RequestBody ApplyDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if (dto.getId()==null){ + throw new RuntimeException(String.format("申请id不能为空")); + } + + if(dto.getSampleId().isEmpty()){ + throw new RuntimeException(String.format("选择样本不能为空")); + } + + SampleApplyVO vo = sampleApplyService.updateAndSave(dto,dlpUser); + + return R.ok(vo,"修改成功"); + } + + + + + /** + * 下载鉴定委托书 + * + * @param id + * + * @return + */ + @ApiOperation(value = "下载申请表格", notes = "下载申请表格。如果还没有创建, 立即创建: 根据鉴定申请信息内容的内容创建PDF格式的鉴定委托书, 并保存到 MinIO 存储中") + @SysLog("创建鉴定委托书") + @GetMapping("/print/apply") +// @PreAuthorize("@pms.hasPermission('EntrustmentEdit')") + public void bizGetPDFSampleApplyTable(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) { + System.out.println("bizApplyWord................."); + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + //查询数据 + SampleApplyVO detail = sampleApplyService.getDetail(id); + + if (detail == null) { + throw new RuntimeException(String.format("没有找到该申请")); + } + + if (detail.getApplicationStatus().getStatus()!=4) { + throw new RuntimeException("申请状态必须在[审批通过]之后才能打印申请表格"); + } + + /*if (!dlpUser.isStaff()) { + if (!StrUtil.equalsIgnoreCase(ev.getClientOrgId(), dlpUser.getOrgId())) { + throw new RuntimeException("您只能打印自己所在机构的委托"); + } + }*/ + + String applyFileName = ""; + + if(detail.getApplyType()==1){//外带申请 + applyFileName = "携带毒品外出申请表-"+detail.getId(); + //String entrustmentLetterFileName = "鉴定委托书-" + ev.getEntrustmentNo(); + }else { + applyFileName = "待销毁检材样本报批表-"+detail.getId(); + } + String pdfFilePath = "document" + "/"+"application" + "/" + detail.getId() + "/" + applyFileName + ".pdf"; + try { + if (!ossFile.objectExist(pdfFilePath)) { + GenerateSampleApplyTablePDF(detail,theHttpServletRequest,httpServletResponse); + } + ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream()); + httpServletResponse.setContentType(applyFileName); + } catch (Exception e) { + System.out.println(String.format("minioFile objectExist() Exception. %s", e.getLocalizedMessage())); + e.printStackTrace(); + } + } + + + private void GenerateSampleApplyTablePDF(SampleApplyVO applyVO , HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + System.out.println("GenerateSampleApplyTablePDF................."); + + //try { + //--------------- + // 构造对象 Map + //Map dm = BeanMap.create(ev); //ClassUtils.objectToMap(ev); + //Map dm = ClassUtils.objectToMap(applyVO); + + Map dm = new HashMap<>(); + //dm.put("size", 1);//号 + dm.put("applicantName", applyVO.getApplicantName());//申请人 + dm.put("reason", applyVO.getReason());//原因 + dm.put("id", LocalDateTimeUtil.format(applyVO.getApplicationDate(), "yyyy"));//设置为年份 + dm.put("applicationDate", LocalDateTimeUtil.format(applyVO.getApplicationDate(), "yyyy年MM月dd日"));//申请时间 + if(applyVO.getApplyType()==1){ + dm.put("firstAuditorName",applyVO.getFirstAuditorName());//一级审核人 + dm.put("firstAuditDate",LocalDateTimeUtil.format(applyVO.getFirstAuditDate(), "yyyy年MM月dd日"));//一级时间 + dm.put("firstAuditOpinion",applyVO.getFirstAuditOpinion());//一级意见 + dm.put("secondaryAuditName",applyVO.getSecondaryAuditName());//二级人 + dm.put("secondaryAuditDate",LocalDateTimeUtil.format(applyVO.getSecondaryAuditDate(), "yyyy年MM月dd日"));//二级时间 + dm.put("secondaryAuditOpinion",applyVO.getSecondaryAuditOpinion());//二级意见 + } + dm.put("approverName",applyVO.getApproverName());//审批人 + dm.put("approvalDate",LocalDateTimeUtil.format(applyVO.getApprovalDate(), "yyyy年MM月dd日"));//审批时间 + dm.put("approverOpinion",applyVO.getApproverOpinion());//审批意见 + dm.put("applyQuantity",applyVO.getApplyQuantity());//数量 + + + String str = ""; + + List sampleNos = new ArrayList<>(); + for (ApplySampleVO sampleVO : applyVO.getSampleVO()) { + if(sampleVO.getStatus()==1){ + str=str+sampleVO.getSampleNo()+"\n"; + } + } + + dm.put("sampleNo",str); + + //----------------------------- + // 生成 word 版本的 鉴定委托书 + + String applyFileName = ""; + + if (applyVO.getApplyType() == 1) {//外带申请 + applyFileName = "携带毒品外出申请表-" + applyVO.getId(); + } else { + applyFileName = "待销毁检材样本报批表-" + applyVO.getId(); + } + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + if (applyVO.getApplyType() == 1) {//外带申请 + ossFile.fileGet("template" + "/" + "携带毒品外出申请表模板.docx", bos); + } else { + ossFile.fileGet("template" + "/" + "待销毁检材报批申请表模板.docx", bos); + } + byte[] templateArray = bos.toByteArray(); + ByteArrayInputStream bis = new ByteArrayInputStream(templateArray); + bos.close(); + // 现在 bis 是模板的 InputStream + ConfigureBuilder builder = Configure.builder().buildGramer("${", "}").useSpringEL(false); + XWPFTemplate template = XWPFTemplate.compile(bis, builder.build()).render(dm); + bis.close(); + + ByteArrayOutputStream fosWord = new ByteArrayOutputStream(); + template.write(fosWord); + template.close(); + + //------------ + ByteArrayInputStream fisWord = new ByteArrayInputStream(fosWord.toByteArray()); + fosWord.close(); + + //MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fisWord); + MockMultipartFile mockMultipartFile = new MockMultipartFile("file", applyFileName + ".docx", "image/jpg", fisWord); + Response response = remoteWord2PDFService.word2pdf(mockMultipartFile); + fisWord.close(); + + + ByteArrayOutputStream outPDF = new ByteArrayOutputStream(); + IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_MIDDLE_BUFFER_SIZE); + ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray()); + outPDF.close(); + + + ossFile.fileSave("document" + "/" + "application" + "/" + applyVO.getId() + "/" + applyFileName + ".pdf", isPDF); + isPDF.close(); + + System.out.println("转换为 PDF 结束"); + + } +} + diff --git a/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseApplyController.java b/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseApplyController.java new file mode 100644 index 0000000..4c285c8 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseApplyController.java @@ -0,0 +1,472 @@ +package digital.laboratory.platform.imr.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.log.annotation.SysLog; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.CombinationOut; +import digital.laboratory.platform.imr.dto.OutWarehouseApplyDTO; +import digital.laboratory.platform.imr.dto.QueryDTO; +import digital.laboratory.platform.imr.entity.SampleOutWarehouseApply; +import digital.laboratory.platform.imr.entity.SampleStorage; +import digital.laboratory.platform.imr.mapper.SampleStorageMapper; +import digital.laboratory.platform.imr.service.SampleOutWarehouseApplyService; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import digital.laboratory.platform.imr.vo.RepositorySampleVO; +import digital.laboratory.platform.imr.vo.SampleOutWarehouseApplyVO; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.security.Principal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 样本出库申请实体类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 样本出库申请实体类 前端控制器 + *

+ * 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 + * 这里写什么: + * 为前端提供数据, 接受前端的数据 + * 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 + * 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 + * 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/sample_out_warehouse_apply") +@Api(value = "sample_out_warehouse_apply", tags = "领用出库申请管理") +public class SampleOutWarehouseApplyController { + + private final SampleOutWarehouseApplyService sampleOutWarehouseApplyService; + + private final SampleStorageMapper storageMapper; + + /** + * 通过id查询样本出库申请实体类 + * + * @param id id + * @return R + */ + @ApiOperation(value = "通过id查询", notes = "通过id查询") + @GetMapping("/{id}") + @PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_get')") + public R getById(@PathVariable("id") String id, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + SampleOutWarehouseApplyVO outWarehouseApplyVO = sampleOutWarehouseApplyService.getOutWarehouseDetailedById(id); + if (outWarehouseApplyVO != null) { + return R.ok(outWarehouseApplyVO, "查询成功"); + } else { + return R.failed("查询失败"); + } + } + + /** + * 分页查询 + * + * @param dto 查询参数 + * @return + */ + @ApiOperation(value = "分页查询", notes = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_get')") + public R> getSampleOutWarehouseApplyPage(QueryDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + QueryWrapper query = Wrappers.query(); + query.eq("applicant_id", dlpUser.getId()); + query.between(dto.getBeginDate() != null && dto.getFinishDate() != null, "application_date", dto.getBeginDate(), dto.getFinishDate()); + query.orderByDesc("create_time"); + + if (dto.getStatus() == 0) {//返回待审核和待使用的数据 + ArrayList integers = new ArrayList<>(); + integers.add(1); + integers.add(2); + query.in("status", integers); + } else if (dto.getStatus() == 1) { + query.eq("status", 1); + } else if (dto.getStatus() == 2) { + query.eq("status", 2); + } else if (dto.getStatus() == 3) { + query.eq("status", 3); + } + + if (dto.getStatus() == 4) {//全部数据--出库模块备用 + ArrayList integers = new ArrayList<>(); + integers.add(1); + integers.add(2); + integers.add(3); + query.in("status", integers); + } + + Page page = new Page<>(dto.getCurrent(), dto.getSize()); + + IPage thisPage = sampleOutWarehouseApplyService.getSampleOutWarehouseApplyVOPage(page, query); + return R.ok(thisPage, "查询出库申请成功"); + } + + @ApiOperation(value = "列表查询", notes = "列表查询") + @GetMapping("/list") + @PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_list')") + public R> getSampleOutWarehouseApplyList(Page page, SampleOutWarehouseApply sampleOutWarehouseApply, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + IPage thisList = sampleOutWarehouseApplyService.getSampleOutWarehouseApplyVOList(Wrappers.query() + .eq("applicant_id", dlpUser.getId()) + .eq(sampleOutWarehouseApply.getStatus() != null, "status", sampleOutWarehouseApply.getStatus()) + .orderByDesc("create_time") + ); + return R.ok(thisList, "查询出库申请成功"); + } + + + /** + * 查询当前已经存入仓库的样本信息(全部查询) + */ + + @ApiOperation(value = "创建领用申请时的查询样本接口--分页", notes = "创建领用申请时的查询样本接口--分页") + @GetMapping("/getSampleInfo") + @PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_list')") + public R getSampleInfo(QueryDTO dto) { + + List sampleIds = Arrays.asList(dto.getSampleIds().split(",")); + + if (dto.getType() == 1) {//任务 + IPage sampleVOIPage2 = new Page<>(); + List records1 = new ArrayList<>(); + + if (dto.getType() == 1) { + Integer begin = (dto.getCurrent() - 1) * dto.getSize(); + CombinationOut combinationOut = new CombinationOut(sampleIds, begin, dto.getSize(), dto.getName()); + //获取仓库现有样本;并进行事件分类 + //1.委托 + List vo1 = storageMapper.getWTSample(combinationOut); + if (!vo1.isEmpty()) { + records1.addAll(vo1); + } + + List vo2 = storageMapper.getWSSample(combinationOut); + if (!vo2.isEmpty()) { + records1.addAll(vo2); + } + List vo3 = storageMapper.getMFSample(combinationOut); + if (!vo3.isEmpty()) { + records1.addAll(vo3); + } + List vo4 = storageMapper.getSJSample(combinationOut); + if (!vo4.isEmpty()) { + records1.addAll(vo4); + } + List vo5 = storageMapper.getTZSample(combinationOut); + if (!vo5.isEmpty()) { + records1.addAll(vo5); + } + } + + if (records1.size() == 0) { + return R.ok(sampleVOIPage2, "暂无数据"); + } + Collections.sort(records1, new Comparator() { + @Override + public int compare(OutSampleVO o1, OutSampleVO o2) { + return o1.getRoomNo().compareTo(o2.getSampleNo()); + } + }); + List records2 = new ArrayList<>(); + sampleVOIPage2.setSize(dto.getSize()); + int pageCurrent = (dto.getCurrent() - 1) * dto.getSize(); + int pageTotal = 0; + if (records1.size() % dto.getSize() == 0) { + pageTotal = records1.size() / dto.getSize(); + } else { + pageTotal = records1.size() / dto.getSize() + 1; + } + if (pageCurrent + dto.getSize() <= records1.size()) { + records2 = records1.subList(pageCurrent, pageCurrent + dto.getSize()); + } else if (records1.size() % dto.getSize() > sampleIds.size() - 1) { + records2 = records1.subList(pageCurrent, records1.size()); + } else if (dto.getCurrent() > pageTotal) { + records2 = records1.subList(pageCurrent - dto.getSize(), records1.size()); + } else { + records2 = records1.subList(pageCurrent, records1.size()); + } + sampleVOIPage2.setTotal(records1.size());//不分页总数 + sampleVOIPage2.setRecords(records2); + return R.ok(sampleVOIPage2, "查询成功"); + + } else { +// int size = sampleIds.size(); +// if ("".equals(dto.getSampleIds())) { +// size = sampleIds.size() - 1; +// } +// if (dto.getTotal() != 0) { +// int num = 0;//去重后目前能分的页数 +// +// if ((dto.getTotal() - size) % 8 == 0) { +// num = (dto.getTotal() - size) / 8; +// } else { +// num = (dto.getTotal() - size) / 8 + 1; +// } +// +// +// if (dto.getCurrent() > num) { +// //求余数 +// int a = dto.getTotal() % 8;//求最后一页的剩余条数 +// if (a == 0) { +// a = 8; +// } +// if (sampleIds.size() >= a) { +// dto.setCurrent(num); +// } +// } +// } +// Page page = new Page<>(dto.getCurrent(), dto.getSize()); + + List sampleVOList = storageMapper.getSampleInfoList(Wrappers.query() + .and(StringUtils.isNotBlank(dto.getName()), qw -> qw + .like("storage.name", dto.getName()) + .or() + .like("sample_no", dto.getName())) + .notIn(!sampleIds.isEmpty(), "storage.sample_id", sampleIds)//去重数组sampleIds + .eq("storage.status", 2) //只能查找存入仓库的样本数据 + .eq("s.status", 2)//并且sample实际状态为2 + .like(StringUtils.isNotBlank(dto.getRoomNo()), "storage.room_no", dto.getRoomNo()) + .orderByDesc("sample_no") + ); + for (OutSampleVO vo : sampleVOList) { + vo.setSampleId(vo.getId()); + String eventName = ""; + //entrustment/hairJob/sewageJob + if (vo.getSource().equals("entrustment")) { + //委托 + eventName = storageMapper.getEntrustmentName(vo.getSampleId()); + } else if (vo.getSource().equals("hairJob")) { + //毛发 + eventName = storageMapper.getHairJobName(vo.getSampleId()); + } else if (vo.getSource().equals("sewageJob")) { + //污水 + eventName = storageMapper.getSewageJobName(vo.getSampleId()); + } else if (vo.getSource().contains("Event")) {//通用事件 + //内部录入 + eventName = storageMapper.getEventName(vo.getSampleId()); + } else { + //特征分析 + eventName = storageMapper.getFeatureName(vo.getSampleId()); + } + vo.setEventName(eventName); + } + Map> map = sampleVOList.stream().collect(Collectors.groupingBy(item -> item.getSource())); + List entrustmentSampleList = map.get("entrustment"); + List outSampleVOS = new ArrayList<>(); + if (entrustmentSampleList != null && entrustmentSampleList.size() > 0) { + sampleVOList.removeAll(entrustmentSampleList); + Collections.sort(entrustmentSampleList, new Comparator() { + @Override + public int compare(OutSampleVO o1, OutSampleVO o2) { + String[] split1 = o1.getSampleNo().split("-"); + String[] split2 = o2.getSampleNo().split("-"); + // 先比较年份 + int yearComparison = split2[0].compareTo(split1[0]); + if (yearComparison != 0) { + return yearComparison; + } + // 再比较序号 + int num1 = Integer.parseInt(split2[1]); + int num2 = Integer.parseInt(split1[1]); + if (num1 - num2 != 0) { + return num1 - num2; + } + + // 再比较尾号 + int num3 = Integer.parseInt(split1[2]); + int num4 = Integer.parseInt(split2[2]); + return num3 - num4; + + } + }); + outSampleVOS.addAll(entrustmentSampleList); + } + outSampleVOS.addAll(sampleVOList); + return R.ok(outSampleVOS, "查询成功"); + } + } + + + /** + * 查询当前已经存入仓库的样本信息(根据当前登录人查询对应部门的sample信息) + */ + + + /** + * 新增样本出库申请实体类 + * + * @param dto 样本出库申请实体类 + * @return R + */ + @ApiOperation(value = "新增样本出库申请实体类", notes = "新增样本出库申请实体类") + @SysLog("新增样本出库申请实体类") + @PostMapping("/addOutApply") + @PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_add')") + public R postAddOutApply(@RequestBody OutWarehouseApplyDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + //数据校验 + if (dto.getSampleIds() == null || dto.getSampleIds().size() == 0) { + throw new RuntimeException("申请出库检材不能为空"); + } + if (dto.getReturnDate() == null) { + throw new RuntimeException("归还时间不能为空"); + } + if ("".equals(dto.getAppraiserId()) || dto.getAppraiserId().isEmpty()) { + throw new RuntimeException("鉴定人不能为空"); + } + + SampleOutWarehouseApplyVO vo = sampleOutWarehouseApplyService.createOutApply(dto, dlpUser); + if (vo != null) { + return R.ok(vo, "创建出库申请成功"); + } else { + return R.failed("创建出库申请失败"); + } + } + + + /** + * 创建样本出库申请(接口2) + * + * @param dto + * @param theHttpServletRequest + * @return + */ + @ApiOperation(value = "创建样本出库申请(老版本)", notes = "创建样本出库申请(老版本)") + @SysLog("创建样本出库申请") + @PostMapping("/createOutRepositoryApply") + @PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_add')") + public R createOutRepositoryApply(@RequestBody OutWarehouseApplyDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + //数据校验 + if (dto.getSampleIds().isEmpty()) { + throw new RuntimeException("申请检材不能为空"); + } + if (dto.getReturnDate() == null) { + throw new RuntimeException("归还时间不能为空"); + } + if ("".equals(dto.getAppraiserId()) || dto.getAppraiserId().isEmpty()) { + throw new RuntimeException("鉴定人不能为空"); + } + + SampleOutWarehouseApplyVO vo = sampleOutWarehouseApplyService.createOutRepositoryApply(dto, dlpUser); + if (vo != null) { + return R.ok(vo, "创建出库申请成功"); + } else { + return R.failed("创建出库申请失败"); + } + } + + + @ApiOperation(value = "取检条码打印", + notes = "取检条码打印") + @SysLog("检材条码打印") + @GetMapping("/print_QR_code") + public String printgetSampleQRCode(String code) { + + return sampleOutWarehouseApplyService.buildEventImLabelContent(code); + } + + + /** + * 以下为新创建接口---------------------------------------------------------------------- + */ + + @GetMapping("/testQuery") + public R testQuery(QueryDTO dto) { + + List sampleIds = Arrays.asList(dto.getSampleIds().split(",")); + IPage sampleVOIPage2 = new Page<>(); + List records1 = new ArrayList<>(); + int total = 0; + + if (dto.getType() == 1) { + Integer begin = (dto.getCurrent() - 1) * dto.getSize(); + CombinationOut combinationOut = new CombinationOut(sampleIds, begin, dto.getSize(), dto.getName()); + //获取仓库现有样本;并进行事件分类 + //1.委托 + List vo1 = storageMapper.getWTSample(combinationOut); + if (!vo1.isEmpty()) { + total = total + vo1.size(); + records1.addAll(vo1); + } + + //2.污水 + List vo2 = storageMapper.getWSSample(combinationOut); + if (!vo2.isEmpty()) { + total = total + vo2.size(); + records1.addAll(vo2); + } + //3.毛发 + List vo3 = storageMapper.getMFSample(combinationOut); + if (!vo3.isEmpty()) { + total = total + vo3.size(); + records1.addAll(vo3); + } + //4.事件 + List vo4 = storageMapper.getSJSample(combinationOut); + if (!vo4.isEmpty()) { + total = total + vo4.size(); + records1.addAll(vo4); + } + } + + sampleVOIPage2.setTotal(total); + sampleVOIPage2.setRecords(records1); + return R.ok(sampleVOIPage2, "查询成功"); + } + + + + /*if(pageCurrentsampleIds.size()-1){ + records2 = records1.subList(pageCurrent,records1.size()); + }else { + if(dto.getCurrent()>=2){ + records2 = records1.subList(pageCurrent-dto.getSize(),records1.size()); + }else { + records2 = records1.subList(0,records1.size()); + } + } + } + }*/ + + /*if(records1.size()%dto.getSize()>sampleIds.size()-1){ + records2 = records1.subList(pageCurrent,records1.size()); + }else { + if (dto.getCurrent() > Math.ceil((float)records1.size()/dto.getSize())) { + records2 = records1.subList(pageCurrent - dto.getSize(), records1.size()); + } else { + records2 = records1.subList(pageCurrent, records1.size()); + } + }*/ + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseController.java b/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseController.java new file mode 100644 index 0000000..3de459f --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseController.java @@ -0,0 +1,594 @@ +package digital.laboratory.platform.imr.controller; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; +import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.feign.RemoteWord2PDFService; +import digital.laboratory.platform.common.log.annotation.SysLog; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.common.oss.service.OssFile; +import digital.laboratory.platform.imr.dto.*; +import digital.laboratory.platform.imr.entity.*; +import digital.laboratory.platform.imr.entity.enums.OutboundType; +import digital.laboratory.platform.imr.mapper.DestructionDetailMapper; +import digital.laboratory.platform.imr.mapper.SampleOutWarehouseApplyMapper; +import digital.laboratory.platform.imr.mapper.SampleOutboundRecordMapper; +import digital.laboratory.platform.imr.mapper.SampleStorageMapper; +import digital.laboratory.platform.imr.service.DestructionPublicityService; +import digital.laboratory.platform.imr.service.SampleOutWarehouseApplyService; +import digital.laboratory.platform.imr.service.SampleOutWarehouseService; +import digital.laboratory.platform.imr.vo.*; +import feign.Response; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.security.Principal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 自定义出库controller + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/sample_out_Warehouse" ) +@Api(value = "sample_out_Warehouse", tags = "样本出库管理") +public class SampleOutWarehouseController { + + + + private final SampleOutWarehouseApplyService sampleOutWarehouseApplyService; + + private final DestructionPublicityService destructionPublicityService; + + private final DestructionDetailMapper destructionDetailMapper; + + + private final SampleOutWarehouseApplyMapper outWarehouseApplyMapper; + + + private final SampleOutWarehouseService warehouseService; + + + private final SampleStorageMapper storageMapper; + + + private final SampleOutboundRecordMapper outboundRecordMapper; + + + private final RemoteWord2PDFService remoteWord2PDFService; + + private final OssFile ossFile; + + + + + /** + * 分页查询 + * @param dto 查询参数管理员可以看见所有数据 + * @return + */ + @ApiOperation(value = "出库模块领用出库申请--分页查询", notes = "出库模块领用出库申请--分页查询") + @GetMapping("/page" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" ) + public R> getSampleOutWarehouseApplyPage(QueryDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + QueryWrapper query = Wrappers.query(); + query.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"application_date",dto.getBeginDate(),dto.getFinishDate()); + query.orderByDesc("create_time"); + + if (dto.getStatus()==0){//返回待审核和待使用的数据 + ArrayList integers = new ArrayList<>(); + integers.add(1); + integers.add(2); + integers.add(3); + query.in("status",integers); + }else if (dto.getStatus()==1){ + query.eq("status",1); + } + else if (dto.getStatus()==2){ + query.eq("status",2); + } + else if (dto.getStatus()==3){ + query.eq("status",3); + } + + Page page = new Page<>(dto.getCurrent(),dto.getSize()); + + IPage thisPage = sampleOutWarehouseApplyService.getSampleOutWarehouseApplyVOPage(page,query); + return R.ok(thisPage,"查询出库申请成功"); + } + + + + + + + + + /** + * 检材管理员看见领用出库申请然后点击同意出库 + */ + + @ApiOperation(value = "检材管理员--确认同意领用申请", notes = "检材管理员--确认同意领用申请") + @PutMapping("/reconfirmApply" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" ) + public R reconfirmApply(String id, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if (id.isEmpty()){ + throw new RuntimeException(String.format("id不能为空")); + } + + SampleOutWarehouseApplyVO applyVO = sampleOutWarehouseApplyService.reconfirmApply(id,dlpUser.getId()); + + + return R.ok(applyVO,"确认成功"); + } + + + /** + * 根据"取检码"查询相关信息 + */ + @ApiOperation(value = "根据取检码查询相关信息", notes = "根据取检码查询相关信息") + @SysLog("根据取检码查询相关信息" ) + @GetMapping("/code/{code}" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')") + public R getInfoByCode(@PathVariable("code" ) String code, HttpServletRequest theHttpServletRequest) { + + if ("".equals(code)||code.isEmpty()) { + throw new RuntimeException(String.format("取检码不能为空")); + } + SampleOutWarehouseApplyVO vo = sampleOutWarehouseApplyService.getInfoByCode(code); + if (vo!=null) { + return R.ok(vo,"查询成功"); + }else { + return R.failed("查询失败"); + } + } + + + /** + * 根据"取检码"验证出库信息(确认出库) + * Confirm Outbound + */ + + @ApiOperation(value = "根据取检码验证出库信息(确认出库)", notes = "根据取检码验证出库信息(确认出库)") + @SysLog("根据取检码验证出库信息(确认出库)" ) + @PutMapping("/confirmOutbound" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')") + public R confirmOutbound(@RequestBody VerificationCode dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if(dto.getSampleIds().isEmpty()){ + throw new RuntimeException("领用申请样本id不能为空"); + } + if(StrUtil.isEmpty(dto.getCode())){ + throw new RuntimeException("'取检码不能为空'"); + } + + SampleOutWarehouseApplyVO vo = sampleOutWarehouseApplyService.confirmOutbound(dto,dlpUser); + return R.ok(vo,"确认出库成功"); + + } + + + /** + * 退还/销毁出库---待销毁样本列表查询 + */ + @ApiOperation(value = "待销毁或退还出库的样本查询接口", notes = "待销毁或退还出库的样本查询接口--分页") + @GetMapping("/toBeDestroyed/page" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" ) + public R getToBeDestroyedSample(QueryDTO dto) { + + List sampleIds = Arrays.asList(dto.getSampleIds().split(",")); + int size = sampleIds.size(); + if ("".equals(dto.getSampleIds())){ + size = sampleIds.size()-1; + } + + + if(dto.getTotal()!=0){ + int num = 0;//去重后目前能分的页数 + + if((dto.getTotal()-size)%8==0){ + num = (dto.getTotal()-size)/8; + }else { + num = (dto.getTotal()-size)/8+1; + } + + System.out.println(num); + + if(dto.getCurrent()>num){ + //求余数 + int a = dto.getTotal()%8;//求最后一页的剩余条数 + if(a==0){ + a=8; + if(sampleIds.size()>=a){ + dto.setCurrent(num); + } + }else { + if(sampleIds.size()>=a){ + dto.setCurrent(num); + } + } + } + } + Page page = new Page<>(dto.getCurrent(),dto.getSize()); + /* + * 两个条件 + * 审核通过待销毁状态-->=2 + * 销毁申请通过的不能再退还中出现 + * + * 还在仓库--status==2 + */ + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.notIn(!sampleIds.isEmpty(),"storage.sample_id",sampleIds);//去重数组sampleIds + queryWrapper.like(!dto.getName().isEmpty(),"storage.name",dto.getName()); + queryWrapper.eq("storage.status",2); //只能查找存入仓库的样本数据 + if(dto.getStatus()==null){ + queryWrapper.ne("storage.early_warning",2); //如果是退还出库不需要去查询销毁申请通过的检材 + }else { + queryWrapper.eq("storage.early_warning",dto.getStatus());//销毁出库就只查询销毁申请通过的 + } + //queryWrapper.eq(dto.getStatus()!=null,"storage.early_warning",dto.getStatus()); + IPage sampleVOIPage = storageMapper.getSampleInfoTwo(page,queryWrapper); + return R.ok(sampleVOIPage,"查询成功"); + } + + /** + * 退还出库自动查询退还单位 + */ + @ApiOperation(value = "退还出库查询委托方", notes = "退还出库查询委托方") + @GetMapping("/returnOutboundQuery" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" ) + public R returnOutboundQuery(String sampleId) { + + + String orgName = storageMapper.returnOutboundQuery(sampleId); + + return R.ok(orgName,"查询成功"); + } + + /** + * 退还出库 + */ + @ApiOperation(value = "退还出库", notes = "退还出库") + @PutMapping("/returnOutbound" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" ) + + public R returnOutbound(@RequestBody ReturnOutboundDTO dto, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if(dto.getSampleIds().isEmpty()){ + throw new RuntimeException("样本信息不能为空"); + } + if(dto.getReturnInstitution().isEmpty()){ + throw new RuntimeException("退还单位不能为空"); + } + + warehouseService.returnOutbound(dto,dlpUser); + + return R.ok("退还出库成功"); + + } + + /** + * 销毁出库 + */ + + @ApiOperation(value = "销毁出库", notes = "销毁出库") + @PutMapping("/destroyOutbound" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" ) + public R destroyOutbound(@RequestBody DestroyOutboundDTO dto, HttpServletRequest theHttpServletRequest) { + + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + /* + *这里销毁出库可能要先判断是否公示了 + */ +// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// queryWrapper.in(DestructionDetail::getSampleId, dto.getSampleIds()); +// queryWrapper.orderByDesc(DestructionDetail::getUpdateTime); +// List destructionDetails = destructionDetailMapper.selectList(queryWrapper); // 查询该dto中的样本id 是否已经公示 +// // 根据公示id 进行分类 +// Map> collect = destructionDetails.stream().collect(Collectors.groupingBy(item -> item.getDestructionId())); +// collect.forEach((k, v) -> { +// // 根据公示详情中关联的公示id 查公示 +// DestructionPublicity oneById = destructionPublicityService.getOneById(k); +// if (oneById == null || oneById.getStatus() != 1) { +// // 公示如果查不到或者状态不为1 则提示需要公示 +// throw new RuntimeException("请先进行销毁公示在出口!"); +// } +// }); + + + if(dto.getSampleIds().isEmpty()){ + throw new RuntimeException("样本信息不能为空"); + } + + warehouseService.destroyOutbound(dto,dlpUser); + + return R.ok("销毁出库成功"); + } + + + + /** + * 入库样本记录分页 + */ + @ApiOperation(value = "出库记录分页", notes = "出库记录分页") + @GetMapping("/outboundRecord/page" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" ) + public R> outboundRecord(QuerySampleDTO dto) { + Page page = new Page<>(dto.getCurrent(), dto.getSize()); + IPage sampleVOIPage = outboundRecordMapper.outboundRecord(page, Wrappers.query() + .like(!dto.getName().isEmpty(), "outbound.name", dto.getName()) + .orderByDesc("create_time") + ); + + List records = sampleVOIPage.getRecords(); + for (OutboundRecordVO record : records) { + record.setStatusCode(record.getOutboundType().getStatus()); + if(record.getOutboundType() == OutboundType.RETURN){ + record.setRecipientName(record.getRecipientId());//退还的比较特殊 + } + //销毁出库 + } + return R.ok(sampleVOIPage, "查询成功"); + + + } + + + /** + * 待归还样本toBeReturned + */ + @ApiOperation(value = "待归还样本--分页", notes = "待归还样本--分页") + @GetMapping("/toBeReturned/page" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" ) + public R> toBeReturned(QuerySampleDTO dto) { + + Page page = new Page<>(dto.getCurrent(), dto.getSize()); + + IPage sampleVOIPage = storageMapper.toBeReturned(page, Wrappers.query() + .like(!dto.getName().isEmpty(), "storage.name", dto.getName()) + .eq("is_return",1)//只查询需要归还的 + .eq("storage.status",3) + .orderByAsc("storage.update_time") + ); + List records = sampleVOIPage.getRecords(); + for (ToBeReturnVO toBeReturnVO : records) { + String eventName = ""; + //entrustment/hairJob/sewageJob + switch (toBeReturnVO.getSource()) { + case "entrustment": + //委托 + eventName = storageMapper.getEntrustmentName(toBeReturnVO.getSampleId()); + break; + case "hairJob": + //毛发 + eventName = storageMapper.getHairJobName(toBeReturnVO.getSampleId()); + break; + case "sewageJob": + //污水 + eventName = storageMapper.getSewageJobName(toBeReturnVO.getSampleId()); + break; + case "Event污水": + case "Event毛发": + //内部录入 + eventName = storageMapper.getEventName(toBeReturnVO.getSampleId()); + break; + default: + //特征分析 + eventName = storageMapper.getFeatureName(toBeReturnVO.getSampleId()); + break; + } + toBeReturnVO.setEventName(eventName); + } + + + return R.ok(sampleVOIPage, "查询成功"); + + + } + + /** + * 查询单个待归还样本 + */ + + @ApiOperation(value = "待归还样本--详情", notes = "待归还样本--详情") + @GetMapping("/toBeReturned/detail" ) + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" ) + public R toBeReturnedDetail(String sampleId) { + + + + RecipientDTO sampleVOIPage = storageMapper.toBeReturnedDetail(sampleId); + + return R.ok(sampleVOIPage, "查询成功"); + + + } + + /** + * 出库模块对应角标 + */ + + @ApiOperation(value = "出库模块对应角标0.待确认出库申请;2.出库待归还", notes = "出库模块对应角标0.待确认出库申请;2.出库待归还") + @GetMapping("/inboundIcon/count" ) + //@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" ) + public R> getIconCount() { + + + //出库申请 + QueryWrapper queryWrapper = new QueryWrapper<>(); + + queryWrapper.eq("status",1);//待确认(出库申请带确认) + + Long count = outWarehouseApplyMapper.selectCount(queryWrapper); + + IconDTO destroyed = new IconDTO(count, 0, "destroyed"); + + //出库待归还 + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("is_return",1);//需要归还 + wrapper.eq("status",3);//领用出库了 + + Long selectCount = storageMapper.selectCount(wrapper); + + IconDTO aReturn = new IconDTO(selectCount, 2, "return"); + + + ArrayList iconDTOS = new ArrayList<>(); + iconDTOS.add(destroyed); + iconDTOS.add(aReturn); + return R.ok(iconDTOS,"查询成功"); + + } + + + + /**-------出库清单*/ + /** + * 出库清单 + * + * @param ids + * + * @return + */ + @ApiOperation(value = "出库清单", notes = "出库清单") + @SysLog("出库清单") + @PostMapping("/print/inventory") +// @PreAuthorize("@pms.hasPermission('EntrustmentEdit')") + public void bizGetPDFInventory(@RequestBody List ids, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) { + System.out.println("bizApplyWord................."); + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + //查询数据 + List voList = storageMapper.getSampleInventory(new QueryWrapper() + .in("storage.id", ids)//查询该集合中相关样本数据 + ); + + if (voList.isEmpty()) { + throw new RuntimeException("未查询到相关信息"); + } + + String id = IdWorker.get32UUID().toUpperCase(); + + String applyFileName = "检材出库清单-"+id; + + String pdfFilePath = "document" + "/"+"inventory" + "/" + id + "/" + applyFileName + ".pdf"; + try { + //直接调用pdf方法 + GenerateSampleApplyTablePDF(voList,id,theHttpServletRequest,httpServletResponse); + ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream()); + httpServletResponse.setContentType(applyFileName); + } catch (Exception e) { + System.out.printf("minioFile objectExist() Exception. %s%n", e.getLocalizedMessage()); + e.printStackTrace(); + } + } + + + private void GenerateSampleApplyTablePDF(List voList,String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + System.out.println("GenerateSampleApplyTablePDF................."); + + //----------------------------- + // 生成 word 版本的 鉴定委托书 + + String applyFileName = "检材出库清单-"+id; + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ossFile.fileGet("template" + "/" + "检材出库清单模板.docx", bos); + + byte[] templateArray = bos.toByteArray(); + + ByteArrayInputStream bis = new ByteArrayInputStream(templateArray); + bos.close(); + + for (int i = 0;i() {{ + put("voList", voList); + }} + ); + bis.close(); + + ByteArrayOutputStream fosWord = new ByteArrayOutputStream(); + template.write(fosWord); + template.close(); + + //------------ + ByteArrayInputStream fisWord = new ByteArrayInputStream(fosWord.toByteArray()); + fosWord.close(); + + //MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fisWord); + MockMultipartFile mockMultipartFile = new MockMultipartFile("file", applyFileName + ".docx", "image/jpg", fisWord); + Response response = remoteWord2PDFService.word2pdf(mockMultipartFile); + fisWord.close(); + + + ByteArrayOutputStream outPDF = new ByteArrayOutputStream(); + IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_MIDDLE_BUFFER_SIZE); + ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray()); + outPDF.close(); + + + ossFile.fileSave("document" + "/" + "inventory" + "/" + id + "/" + applyFileName + ".pdf", isPDF); + isPDF.close(); + + + System.out.println("转换为 PDF 结束"); + + } + + + + + /** + * 催还 + */ + +} diff --git a/src/main/java/digital/laboratory/platform/imr/controller/SamplePutInStorageController.java b/src/main/java/digital/laboratory/platform/imr/controller/SamplePutInStorageController.java new file mode 100644 index 0000000..3cedd3f --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/SamplePutInStorageController.java @@ -0,0 +1,947 @@ +package digital.laboratory.platform.imr.controller; + + +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; +import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.feign.RemoteWord2PDFService; +import digital.laboratory.platform.common.log.annotation.SysLog; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.common.oss.service.OssFile; +import digital.laboratory.platform.common.security.annotation.Inner; +import digital.laboratory.platform.common.security.util.SecurityUtils; +import digital.laboratory.platform.imr.dto.*; +import digital.laboratory.platform.imr.entity.*; +import digital.laboratory.platform.imr.mapper.*; +import digital.laboratory.platform.imr.service.SamplePutInStorageService; +import digital.laboratory.platform.imr.vo.*; +import feign.Response; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.security.Principal; +import java.time.LocalDate; +import java.util.*; + + +/** + * @author Zhang Xiaolong created at 2023-03-21 + * @describe 前端控制器 + *

+ * 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 + * 这里写什么: + * 为前端提供数据, 接受前端的数据 + * 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 + * 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 + * 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 + */ + + +/** + * 样本入库controller + * 入库相关接口 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/sample_put_in_storage") +@Api(value = "sample_inbound_or_outbound", tags = "样本入库管理") +public class SamplePutInStorageController { + + private final SamplePutInStorageService samplePutInStorageService; + + private final SampleStorageMapper storageMapper; + + private final RemoteWord2PDFService remoteWord2PDFService; + + private final SampleApplyMapper asMapper; + + private final OssFile ossFile; + + private final SampleOutWarehouseApplyMapper outWarehouseApplyMapper; + + private final SampleInboundAndOutboundTableMapper tableMapper; + + /** + * 获取已录入仓库样本(分页) + */ + @ApiOperation(value = "获取已录入仓库样本(分页)", notes = "获取已录入仓库样本(分页)") + @GetMapping("/repositorySample/page") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')") + public R> getSampleVOList(QuerySampleDTO dto) { + + Page page = new Page<>(dto.getCurrent(), dto.getSize()); + IPage sampleVOIPage = samplePutInStorageService.getSampleVOList(page, Wrappers.query() + .like(StrUtil.isNotEmpty(dto.getName()), "storage.name", dto.getName()) + .eq(StrUtil.isNotEmpty(dto.getSampleType()), "storage.sample_type", dto.getSampleType()) + .eq("storage.status", dto.getStatus()) + .between(dto.getBeginDate() != null && dto.getFinishDate() != null, "in_repository_date", dto.getBeginDate(), dto.getFinishDate()) + .orderByDesc("create_time") + ); + return R.ok(sampleVOIPage, "查询成功"); + } + + /** + * 入库样本记录分页 + */ + @ApiOperation(value = "入库样本记录分页", notes = "入库样本记录分页") + @GetMapping("/inboundRecord/page") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')") + public R> inboundRecord(QuerySampleDTO dto) { + Page page = new Page<>(dto.getCurrent(), dto.getSize()); + IPage sampleVOIPage = samplePutInStorageService.inboundRecord(page, Wrappers.query() + .like(StrUtil.isNotEmpty(dto.getName()), "inbound.name", dto.getName()) + .orderByDesc("create_time") + ); + return R.ok(sampleVOIPage, "查询成功"); + } + + + /** + * 待销毁样本预警 + */ + @ApiOperation(value = "待销毁样本预警", notes = "待销毁样本预警") + @GetMapping("/destructionWarning/page") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')") + public R destructionWarning(QuerySampleDTO dto) { + Page page = new Page<>(dto.getCurrent(), dto.getSize()); + IPage sampleVOIPage = samplePutInStorageService.getDestructionVO(page, Wrappers.query() + .like(StrUtil.isNotEmpty(dto.getName()), "storage.name", dto.getName()) + .eq("early_warning", 1) + .eq("storage.status", 2)//只能查看当前入库的 + .orderByDesc("create_time") + ); + return R.ok(sampleVOIPage, "查询成功"); + } + + + /** + * 查询单个存放样本信息 + * sample信息+详情(出入库登记表) + */ + @ApiOperation(value = "查询单个存放样本信息--这个id不是样本id", notes = "查询单个存放样本信息") + @GetMapping("/detailed") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')") + public R getSampleDetailed(String id) { + + if (StrUtil.isEmpty(id)) { + throw new RuntimeException("查询id不能为空"); + } + + RepositorySampleVO sampleVO = samplePutInStorageService.getSampleDetailed(id); + + return R.ok(sampleVO, "查询成功"); + } + + + /** + * 根据样本编号获取主要信息 + * (扫码枪扫描) + */ + @ApiOperation(value = "根据样本编号获取主要信息(入库)", notes = "根据样本编号获取主要信息(入库)") + @GetMapping("/getSampleInfoByNo") + @Inner(value = false) + //@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" ) + public R> getSampleInfoByNo(String sampleNo) { + + if (sampleNo == null || "".equals(sampleNo)) { + return R.failed(null); + } + + List vo = samplePutInStorageService.getSampleListByNo(sampleNo); + + if (!vo.isEmpty()) { + return R.ok(vo, "查询成功"); + } else { + return R.failed(vo, String.format("编号为" + sampleNo + "的样本不存在请重试")); + } + } + + + @ApiOperation(value = "修改sample质量", notes = "修改sample质量") + @PostMapping("/updateSampleQuality") + public R updateSampleQuality(String sampleId, double sampleQuality) { + + if (StrUtil.isEmpty(sampleId)) { + throw new RuntimeException("id不能为空"); + } + + //查询并修改 + samplePutInStorageService.updateSampleQuality(sampleId, sampleQuality); + + return R.ok(null, "修改质量成功"); + } + + + /** + * 扫码入库查看详情信息 + */ + @ApiOperation(value = "获取sample主要的详情信息", notes = "获取sample主要的详情信息") + @GetMapping("/getSampleDetailInfo") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')") + public R getSampleDetailInfo(String id) { + + if (id == null || "".equals(id)) { + return R.failed(null); + } + + BaseSampleDetail sampleDetail = storageMapper.getSampleDetailInfo(id); + + if (sampleDetail != null) { + if (sampleDetail.getSource().equals("entrustment") && sampleDetail.getQuantity() == 0) { + sampleDetail.setQuantity(storageMapper.getQuality(sampleDetail.getId())); + } + return R.ok(sampleDetail, "查询成功"); + } else { + return R.failed("查询失败"); + } + } + + + /** + * 默认没有仓库样本表 + * 外部关联一张样本存储表格 + * (接口2)(不考虑样本入库质量) + * 根据检材样本编号录入仓库(入库) + * 确认入库按钮 + */ + @ApiOperation(value = "根据编号录入仓库(入库)--不考虑质量", notes = "根据编号录入仓库(入库)--不考虑质量") + @PostMapping("/sampleEntryRepository") + //@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound')" ) + public R sampleEntryRepository(@RequestBody List sampleNos, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if (sampleNos != null) { + throw new RuntimeException("入库样本编号不能为空"); + } + + List vo = samplePutInStorageService.sampleEntryRepository(sampleNos, dlpUser); + if (vo != null) { + return R.ok(vo, "样本入库成功,本次入库样本数为" + sampleNos.size() + "份"); + } else { + return R.failed("入库失败"); + } + } + + + /** + * 默认没有仓库样本表 + * 外部关联一张样本存储表格 + * (接口3) + * 根据检材样本编号录入仓库(入库) + *

+ * 这里需要手动填写入库时的质量和计量单位(流转) + *

+ * 确认入库按钮 + */ + @ApiOperation(value = "根据样本编号录入仓库(入库)--考虑质量", notes = "根据样本编号录入仓库(入库)--考虑质量") + @PostMapping("/sampleInRepository") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_add')") + public R sampleInRepository(@RequestBody List sample, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if (sample == null) { + throw new RuntimeException("入库样本编号不能为空"); + } + + List vo = samplePutInStorageService.sampleInRepository(sample, dlpUser); + if (vo != null) { + return R.ok(vo, "样本入库成功,本次入库样本数为" + sample.size() + "份"); + } else { + return R.failed("入库失败"); + } + } + + + /** + * 待存放样本查询 + */ + @ApiOperation(value = "待存放样本查询", notes = "待存放样本查询") + @GetMapping("/getToBeStoredSample") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')") + public R> getToBeStoredSample(QueryDTO dto) { + + + Page page = new Page<>(dto.getCurrent(), dto.getSize()); + + IPage sampleVOS = storageMapper.getToBeStoredSample(page, Wrappers.query() + .like(StrUtil.isNotEmpty(dto.getName()), "storage.name", dto.getName()) + .eq("storage.status", 1) + ); + + + return R.ok(sampleVOS, "查询成功"); + } + + + /** + * 检材存放 + */ + @ApiOperation(value = "选择样本存放到格子(存放)", notes = "选择样本存放到格子(存放)") + @PostMapping("/sampleDepositRepository") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')") + public R sampleDepositRepository(@RequestBody DepositDTO dto) { + if (dto.getIds() == null) { + throw new RuntimeException("样本不能为空"); + } + if (StrUtil.isEmpty(dto.getCellId())) { + throw new RuntimeException("存放位置不能为空"); + } + + List vo = samplePutInStorageService.sampleDepositRepository(dto); + + return R.ok(vo, "已成功存入" + vo.get(0).getStorageLocation()); + } + + + /** + * 点击存放格子时展示对应内部的存放样本信息 + */ + + @ApiOperation(value = "通过样本id获取格子中存放的样本信息", notes = "通过样本id获取格子中存放的样本信息") + @GetMapping("/getStoredSample") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')") + public R> getStoredSample(String cellId) { + + + if (cellId == null || "".equals(cellId)) { + throw new RuntimeException("格子id不能为空"); + } + + ArrayList outSampleVOS = new ArrayList<>(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("storage_cell_id", cellId); + queryWrapper.eq("status", 2);//已经入库的 + List storages = storageMapper.selectList(queryWrapper); + for (SampleStorage storage : storages) { + OutSampleVO sampleVO = storageMapper.getSampleById(storage.getSampleId()); + if (sampleVO != null) { + outSampleVOS.add(sampleVO); + } + } + Collections.sort(outSampleVOS, new Comparator() { + @Override + public int compare(OutSampleVO o1, OutSampleVO o2) { + String[] split1 = o1.getSampleNo().split("-"); + String[] split2 = o2.getSampleNo().split("-"); + // 先比较年份 + int yearComparison = split2[0].compareTo(split1[0]); + if (yearComparison != 0) { + return yearComparison; + } + // 再比较序号 + int num1 = Integer.parseInt(split2[1]); + int num2 = Integer.parseInt(split1[1]); + if (num1 - num2 != 0) { + return num1 - num2; + } + + // 再比较尾号 + int num3 = Integer.parseInt(split1[2]); + int num4 = Integer.parseInt(split2[2]); + return num3 - num4; + } + }); + if (!outSampleVOS.isEmpty()) { + return R.ok(outSampleVOS, "查询成功"); + } else { + return R.failed("当前格子未存放样本"); + } + } + + + /** + * 修改存储期限 + */ + + @ApiOperation(value = "修改存储期限", notes = "修改存储期限") + @PutMapping("/updateStorageDate") + @PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')") + public R updateStorageLocation(@RequestBody UpdateStorageDateDTO dto) { + + if (dto.getStorageDate().isBefore(LocalDate.now())) { + throw new RuntimeException("请选择正确的时间"); + } + + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("id", dto.getId()); + wrapper.set("storage_date", dto.getStorageDate()); + wrapper.set("early_warning", 0);//销毁预警为0 + storageMapper.update(null, wrapper); + return R.ok("修改成功"); + } + + + /** + * 销毁预警角标 + */ + + @ApiOperation(value = "销毁预警角标", notes = "销毁预警角标") + @GetMapping("/destroyed/count") + //@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" ) + public R> getIconCount() { + //查询当前待销毁检材数量 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("early_warning", 1); + queryWrapper.eq("status", 2);//只能查看当前入库的 + Long count = storageMapper.selectCount(queryWrapper); + + IconDTO destroyed = new IconDTO(count, 1, "destroyed"); + + ArrayList iconDTOS = new ArrayList<>(); + iconDTOS.add(destroyed); + return R.ok(iconDTOS, "查询成功"); + + } + + + //待存放检材角标(--检材存放提示角标) + /*@ApiOperation(value = "待存放检材角标", notes = "待存放检材角标") + @GetMapping("/getToBeStoredIcon/count" ) + //@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" ) + public R> getToBeStoredIcon() { + //查询当前待存放检材的数量 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status",1);//只能查看当前入库的 + Long count = storageMapper.selectCount(queryWrapper); + + IconDTO toBeStored = new IconDTO(count, 1, "toBeStored"); + + ArrayList iconDTOS = new ArrayList<>(); + iconDTOS.add(toBeStored); + return R.ok(iconDTOS,"查询成功"); + + }*/ + + //---------------------------------------------------------- + + + /* + + */ + @ApiOperation(value = "一个检材入库时的可选检材列表", notes = "一个检材入库时的可选检材列表") + @GetMapping("/choseSampleList") + public R>> choseSampleList(String keyWords) { + Map> map = samplePutInStorageService.choseSampleList(keyWords); + return R.ok(map, "查询成功"); + } + + @ApiOperation(value = "临时入库接口,修改检材状态") + @PutMapping("/tempSampleIn") + public R temporaryProcessSampleIn(@RequestBody List vos) { + samplePutInStorageService.temporaryProcessSampleIn(vos, SecurityUtils.getUser()); + return R.ok(); + } + + + /** + * 生成出入库登记表 + * + * @param + */ + @ApiOperation(value = "生成出入库单个登记表", notes = "生成出入库单个登记表。如果还没有创建, 立即创建: 根据鉴定申请信息内容的内容创建PDF格式的鉴定委托书, 并保存到 MinIO 存储中") + @SysLog("生成出入库登记表") + @GetMapping("/print/inAndOutTable") +// @PreAuthorize("@pms.hasPermission('EntrustmentEdit')") + public R bizGetPDFSampleInAndOutTable(String sampleId, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) { + System.out.println("bizApplyWord................."); + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + //查询数据 + BaseSampleDetail sampleDetailInfo = storageMapper.getSampleDetailInfo(sampleId); + if (sampleDetailInfo == null) { + throw new RuntimeException("没有找到检材相关信息"); + } + + List inAndOutInfos = tableMapper.getInandOutTableInfo(sampleId); + if (inAndOutInfos == null || inAndOutInfos.size() == 0) { + throw new RuntimeException("没有找到检材出入库相关信息"); + } + + String id = IdWorker.get32UUID().toUpperCase(); + + String applyFileName = "检材出入库登记表-" + id; + String pdfFilePath = "document" + "/" + "repository" + "/" + id + "/" + applyFileName + ".docx"; + + try { + //直接调用生成 + GenerateSampleApplyTablePDF(inAndOutInfos, id, theHttpServletRequest, httpServletResponse); + return R.ok(pdfFilePath); +// ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream()); +// httpServletResponse.setContentType(applyFileName); + } catch (Exception e) { + System.out.printf("minioFile objectExist() Exception. %s%n", e.getLocalizedMessage()); + e.printStackTrace(); + return R.failed("生成失败!"); + } + } + + + private void GenerateSampleApplyTablePDF(List inAndOutInfos, String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + System.out.println("GenerateSampleApplyTablePDF................."); + + //----------------------------- + // 生成 word 版本的 鉴定委托书 + + String applyFileName = "检材出入库登记表-" + id; + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ossFile.fileGet("template" + "/" + "检材样本出入库登记表模板.docx", bos); + + byte[] templateArray = bos.toByteArray(); + + ByteArrayInputStream bis = new ByteArrayInputStream(templateArray); + bos.close(); + + for (int i = 0; i < inAndOutInfos.size(); i++) { + InAndOutInfos table = inAndOutInfos.get(i); + table.setNumber(i + 1); + if (inAndOutInfos.get(i).getSampleType().equals("A")) { + inAndOutInfos.get(i).setSampleType("分析样"); + } else { + inAndOutInfos.get(i).setSampleType("留存样"); + } + } +// int size = inAndOutInfos.size(); +// int index = 0; +// if (size < 12) { +// index = 12 - size; +// for (int i = 0; i < index; i++) { +// InAndOutInfos inAndOutInfos1 = new InAndOutInfos(); +// inAndOutInfos1.setSampleType(""); +// inAndOutInfos1.setSampleNo(""); +// inAndOutInfos1.setNumber(null); +// inAndOutInfos1.setWarehousingDate(null); +// inAndOutInfos1.setAppraiserName(""); +// inAndOutInfos1.setReturnTime(null); +// inAndOutInfos1.setImName(null); +// inAndOutInfos1.setRemarks(""); +// inAndOutInfos.add(inAndOutInfos1); +// } +// } else if (size > 12) { +// index = size % 12; +// if (index != 0) { +// for (int i = 0; i < index; i++) { +// InAndOutInfos inAndOutInfos1 = new InAndOutInfos(); +// inAndOutInfos1.setSampleType(""); +// inAndOutInfos1.setSampleNo(""); +// inAndOutInfos1.setNumber(null); +// inAndOutInfos1.setWarehousingDate(null); +// inAndOutInfos1.setAppraiserName(""); +// inAndOutInfos1.setReturnTime(null); +// inAndOutInfos1.setImName(null); +// inAndOutInfos1.setRemarks(""); +// inAndOutInfos.add(inAndOutInfos1); +// } +// } +// } +// + + LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy(); + + Configure config = Configure.builder(). + bind("inAndOutInfos", policy).build(); + /** + * 循环表格 + */ + XWPFTemplate template = XWPFTemplate.compile(bis, config).render( + new HashMap() {{ + put("inAndOutInfos", inAndOutInfos); + put("year", LocalDateTimeUtil.format(LocalDate.now(), "yyyy"));//将年份设置为编号 + }} + ); + bis.close(); + + ByteArrayOutputStream fosWord = new ByteArrayOutputStream(); + template.write(fosWord); + template.close(); + + //------------ + ByteArrayInputStream fisWord = new ByteArrayInputStream(fosWord.toByteArray()); + fosWord.close(); + boolean ret = ossFile.fileSave("document" + "/" + "repository" + "/" + id + "/" + applyFileName + ".docx", fisWord); + if (ret) { + System.out.println("生成word成功~~~~~~~~~~~~~~~~~~~~~~" + "document" + "/" + "repository" + "/" + id + "/" + applyFileName + ".docx"); + } else { + System.out.println("生成word失败~~~~~~~~~~~~~~~~~~~~~~"); + } + //MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fisWord); +// MockMultipartFile mockMultipartFile = new MockMultipartFile("file", applyFileName + ".docx", "image/jpg", fisWord); +// Response response = remoteWord2PDFService.word2pdf(mockMultipartFile); +// fisWord.close(); +// +// +// ByteArrayOutputStream outPDF = new ByteArrayOutputStream(); +// IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_MIDDLE_BUFFER_SIZE); +// ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray()); +// outPDF.close(); + +// isPDF.close(); +// +// +// System.out.println("转换为 PDF 结束"); + } + + + /** + * 返回当前样本管理中所存在的委托/任务列表 + */ + @ApiOperation(value = "返回任务/委托列表", notes = "返回任务/委托列表") + @GetMapping("/event/list") + public R> eventList(String name) { + + ArrayList baseEvents = new ArrayList<>(); + //查询毛发 + List hairJobIds = tableMapper.queryHairJob(); + //查询相关事件信息 + if (hairJobIds != null) { + for (String id : hairJobIds) { + BaseEvent baseEvent = new BaseEvent(); + String hairJobName = tableMapper.getHairJobName(id, name); + if (hairJobName != null) { + baseEvent.setEventId(id); + baseEvent.setEventName(hairJobName); + baseEvent.setSource("hairJob"); + baseEvents.add(baseEvent); + } + } + } + //查询污水 + List sewageJobIds = tableMapper.querySewageJob(); + if (sewageJobIds != null) { + for (String id : sewageJobIds) { + BaseEvent baseEvent = new BaseEvent(); + String sewageJobName = tableMapper.getSewageJobName(id, name); + if (sewageJobName != null) { + baseEvent.setEventId(id); + baseEvent.setEventName(sewageJobName); + baseEvent.setSource("sewageJob"); + baseEvents.add(baseEvent); + } + } + } + //查询委托 + List entrustmentIds = tableMapper.queryEntrustment(); + if (entrustmentIds != null) { + for (String id : entrustmentIds) { + BaseEvent baseEvent = new BaseEvent(); + String entrustmentName = tableMapper.getEntrustmentName(id, name); + if (entrustmentName != null) { + baseEvent.setEventId(id); + baseEvent.setEventName(entrustmentName); + baseEvent.setSource("entrustment"); + baseEvents.add(baseEvent); + } + } + } + //查询事件 + List eventIds = tableMapper.queryEvent(); + if (eventIds != null) { + for (String id : eventIds) { + BaseEvent baseEvent = new BaseEvent(); + String eventName = tableMapper.getEventName(id, name); + if (eventName != null) { + baseEvent.setEventId(id); + baseEvent.setEventName(eventName); + baseEvent.setSource("Event"); + baseEvents.add(baseEvent); + } + } + } + //查询特征分析 + List featureIds = tableMapper.queryFeature(); + if (featureIds != null) { + for (String id : featureIds) { + BaseEvent baseEvent = new BaseEvent(); + String eventName = tableMapper.getFeatureName(id, name); + if (eventName != null) { + baseEvent.setEventId(id); + baseEvent.setEventName(eventName); + baseEvent.setSource("feature"); + baseEvents.add(baseEvent); + } + } + } + + return R.ok(baseEvents, "查询成功"); + } + + + /** + * 按照时间段来生成出入库登记表 + */ + @ApiOperation(value = "按时间/委托段生成登记表", notes = "按时间/委托段生成登记表。如果还没有创建, 立即创建: 根据鉴定申请信息内容的内容创建PDF格式的鉴定委托书, 并保存到 MinIO 存储中") + @SysLog("生成出入库登记表") + @GetMapping("/print/inAndOutTableByDateOrEvent") +// @PreAuthorize("@pms.hasPermission('EntrustmentEdit')") + public R bizGetPDFSampleInAndOutTableByDate(PrintTableDTO dto, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) { + System.out.println("bizApplyWord................."); + + List inAndOutInfos = new ArrayList<>(); + List sampleIds = null; + if (dto.getType() == 1) { + //委托/任务 + switch (dto.getSource()) { + case "entrustment": + //委托(对应样本表中所有检材样本id) + sampleIds = tableMapper.getSampleIdsByEw(dto.getEventId()); + break; + case "hairJob": + //毛发 + sampleIds = tableMapper.getSampleIdsByHj(dto.getEventId()); + break; + case "sewageJob": + //污水 + sampleIds = tableMapper.getSampleIdsBySj(dto.getEventId()); + break; + case "Event": + //事件 + sampleIds = tableMapper.getSampleIdsByTy(dto.getEventId()); + break; + default: + //特征分析 + sampleIds = tableMapper.getSampleIdsByTz(dto.getEventId()); + break; + } + + if (sampleIds != null) { + for (String sampleId : sampleIds) { + List inAndOutTableInfo = tableMapper.getInandOutTableInfo(sampleId); + if (inAndOutTableInfo != null) { + inAndOutInfos.addAll(inAndOutTableInfo); + } + } + } + + } else { + //根据时间 + inAndOutInfos = tableMapper.getInandOutTableInfoByDate(dto.getBeginDate(), dto.getFinishDate()); + } + + //查询数据 + + if (inAndOutInfos.size() == 0) { + throw new RuntimeException("没有找到检材出入库相关信息"); + } + + String id = IdWorker.get32UUID().toUpperCase(); + + String applyFileName = "检材出入库登记表-" + id; + ; + String pdfFilePath = "document" + "/" + "repository" + "/" + id + "/" + applyFileName + ".docx"; + ; + + try { + //直接调用生成 + GenerateSampleApplyTablePDF(inAndOutInfos, id, theHttpServletRequest, httpServletResponse); + return R.ok(pdfFilePath); + } catch (Exception e) { + System.out.println(String.format("minioFile objectExist() Exception. %s", e.getLocalizedMessage())); + e.printStackTrace(); + } + return R.ok(pdfFilePath); + } + + /** + * 检材管理首页子模块所有角标 + * 一.检材流转 + * 1.待接收+2.待见证 + * 二.入库管理 + * 1.销毁预警 + * 三.出库管理 + * 1.待确认出库申请+2.待归还 + * 四.审核审批 + * 1.待审核/待审批 + */ + @ApiOperation(value = "检材管理首页子模块所有角标", notes = "检材管理首页子模块所有角标") + @SysLog("检材管理首页子模块所有角标") + @GetMapping("/getAllModuleIcon") + //@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound')") + public R> getAllModuleIcon(HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + /*Set permissions = dlpUser.getPermissions(); + if(permissions.contains("imr_sample_apply_first_audit")){ + //一级审核 + + } else if (permissions.contains("imr_sample_apply_secondary_audit")) { + //二级审核 + } else if (permissions.contains("imr_sample_apply_approval")) { + //审批 + }*/ + + ArrayList iconDTOS = new ArrayList<>(); + + //1.检材流转 + IconDTO count1 = samplePutInStorageService.getTransferIconCount(dlpUser.getId()); + if (count1 != null) { + iconDTOS.add(count1); + } + + //入库管理--销毁预警 + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("early_warning", 1); + queryWrapper1.eq("status", 2);//只能查看当前入库的 + Long destroyed = storageMapper.selectCount(queryWrapper1); + IconDTO count2 = null; + if (destroyed != 0) { + count2 = new IconDTO(destroyed, 3, "inbound"); + iconDTOS.add(count2); + } + + + //出库管理--待归还+待确认 + Long countReturn = storageMapper.selectCount(Wrappers.query() + .eq("status", 3) + .eq("is_return", 1)//需要归还 + ); + + //出库申请 + Long countConfirm = outWarehouseApplyMapper.selectCount(Wrappers.query() + .eq("status", 1)//待确认 + ); + IconDTO count3 = null; + if (countReturn + countConfirm != 0) { + count3 = new IconDTO(countReturn + countConfirm, 4, "outbound"); + iconDTOS.add(count3); + } + //审核/审批 + + return R.ok(iconDTOS, "查询成功"); + } + + /* + getExternalModuleIcon + 获取部分模块的角标 + */ + @ApiOperation(value = "获取部分模块的角标", notes = "获取部分模块的角标") + @GetMapping("/getExternalModuleIcon") + public R> getExternalModuleIcon(HttpServletRequest theHttpServletRequest) { + + ArrayList list = new ArrayList<>(); + + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + Set permissions = dlpUser.getPermissions(); + + //流转(imt_sample_transfer_get) + if (permissions.contains("imt_sample_transfer_get")) { + + int count = storageMapper.queryTransfer(dlpUser.getId()); + if (count != 0) { + IconVO iconVO = new IconVO("sample-circulation", true); + list.add(iconVO); + } + } + if (permissions.contains("imr_sample_out_warehouse_apply_get")) { + //出库申请申请人是自己并且待操作的数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status", 2);//已经创建待使用 + queryWrapper.eq("applicant_id", dlpUser.getId()); + + Long count = outWarehouseApplyMapper.selectCount(queryWrapper); + if (count != 0) { + IconVO iconVO = new IconVO("outapplication", true); + list.add(iconVO); + } + } + if (permissions.contains("imr_inbound_or_outbound")) { + //出库 待操作的数据 出库申请+领用待归还的 + + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("is_return", 1);//只查询需要归还的 + wrapper1.eq("status", 3); + + Long count1 = storageMapper.selectCount(wrapper1); + + + QueryWrapper wrapper2 = new QueryWrapper<>(); + wrapper2.eq("status", 1);//待确定的数据 + Long count2 = outWarehouseApplyMapper.selectCount(wrapper2); + + if (count1 + count2 != 0) { + IconVO iconVO = new IconVO("outbound-management", true); + list.add(iconVO); + } + } + if (permissions.contains("imr_inbound_or_outbound")) { + //入库 + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("early_warning", 1); + wrapper1.eq("status", 2);//只能查看当前入库的 + + Long count1 = storageMapper.selectCount(wrapper1); + + if (count1 != 0) { + IconVO iconVO = new IconVO("warehousing-management", true); + list.add(iconVO); + } + + } + + //审核审批 + if (permissions.contains("imr_sample_apply_first_audit")) { + //一级审核员 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("application_status", 1); + Long count1 = asMapper.selectCount(queryWrapper); + + if (count1 != 0) { + IconVO iconVO = new IconVO("review-approval", true); + list.add(iconVO); + } + + } else if (permissions.contains("imr_sample_apply_secondary_audit")) { + //二级审核员 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("application_status", 2); + Long count1 = asMapper.selectCount(queryWrapper); + + if (count1 != 0) { + IconVO iconVO = new IconVO("review-approval", true); + list.add(iconVO); + } + } else if (permissions.contains("imr_sample_apply_approval")) { + //审批人 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("application_status", 3); + Long count1 = asMapper.selectCount(queryWrapper); + + if (count1 != 0) { + IconVO iconVO = new IconVO("review-approval", true); + list.add(iconVO); + } + } + if (list.size() > 0) { + return R.ok(list, "查询成功"); + } else { + return R.failed("暂无数据"); + } + } + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/controller/StorageCellController.java b/src/main/java/digital/laboratory/platform/imr/controller/StorageCellController.java new file mode 100644 index 0000000..2261fb5 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/StorageCellController.java @@ -0,0 +1,274 @@ +package digital.laboratory.platform.imr.controller; + +import cn.hutool.core.io.file.FileNameUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.log.annotation.SysLog; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.QueryStorageDTO; +import digital.laboratory.platform.imr.entity.StorageCell; +import digital.laboratory.platform.imr.entity.StorageCupboard; +import digital.laboratory.platform.imr.mapper.StorageCellMapper; +import digital.laboratory.platform.imr.mapper.StorageCupboardMapper; +import digital.laboratory.platform.imr.service.StorageCellService; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.activation.MimetypesFileTypeMap; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.security.Principal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import digital.laboratory.platform.common.oss.service.OssFile; + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 前端控制器 + * + * 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 + * 这里写什么: + * 为前端提供数据, 接受前端的数据 + * 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 + * 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 + * 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/storage_cell" ) +@Api(value = "storage_cell", tags = "存储柜子对应格子管理") +public class StorageCellController { + + private final StorageCellService storageCellService; + + + private final StorageCellMapper cellMapper; + + private final StorageCupboardMapper cupboardMapper; + + + private final OssFile ossFile; + + /** + * 通过id查询 + * @param id id + * @return R + */ + @ApiOperation(value = "通过id查询", notes = "通过id查询") + @GetMapping("/{id}" ) + @PreAuthorize("@pms.hasPermission('imr_storage_cell_get')" ) + public R getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + StorageCell storageCell = storageCellService.getById(id); + return R.ok(storageCell); + //return R.ok(storageCellService.getById(id)); + } + + /** + * 上传图片 + * @param cellId + * @param file + * @return + * @throws Exception + */ + + + @ApiOperation(value = "上传格子图片", notes = "上传格子图片") + @PostMapping(value = " /{cellId}") + //@PreAuthorize("@pms.hasPermission('roomUpload')") + public R uploadAttachmentObj(@PathVariable("cellId") String cellId, @RequestPart("file") MultipartFile file) throws Exception { + + StorageCell storageCell = cellMapper.selectById(cellId); + if (storageCell != null) { + + String path = "cell" + "/" + cellId; + String fileName = FileNameUtil.getName(file.getOriginalFilename()); + boolean r = ossFile.fileUpload(file, path); + Map ResultData = new HashMap<>(); + ResultData.put("fileName", fileName); + ResultData.put("path", path); + + if (r) { + //修改数据库 + storageCell.setCellPhoto(path); + storageCell.setFileName(fileName); + cellMapper.updateById(storageCell); + return R.ok(ResultData, "上传成功"); + } + return R.failed("上传失败"); + } + return R.failed(null, "这个格子不存在"); + } + + + + + + + + + /*HairSample hs = hairSampleService.getById(hairSampleId); + if (hs != null) { + try { + // 获取样品所属的任务信息 + HairJob hairJob = hairJobService.getById(hs.getJobId()); + if (hairJob == null) { + throw new RuntimeException(String.format("任务id为 %s 的任务不存在", hs.getJobId())); + } + String rootId; + // 获取根任务id + if (hairJob.getRootTaskId().equals("0")) { + rootId = hairJob.getId(); + } else { + rootId = hairJob.getRootTaskId(); + } + ossFile.fileGet("hair_job" + "/" + rootId + "/" + hairSampleId + "/" + fileName, httpServletResponse.getOutputStream()); + httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(hs.getPicture())); + } catch (AmazonS3Exception s3e) { + httpServletResponse.sendError(s3e.getStatusCode(), s3e.toString()); + } catch (Exception e) { + httpServletResponse.sendError(501, e.toString()); + } + } + else { + httpServletResponse.sendError(404, "不存在这个毛发样品"); + }*/ + + + + @ApiOperation(value = "柜子列表查询接口--存储管理", notes = "柜子列表查询接口--存储管理") + @GetMapping("/cell/list" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public R> getStorageRoomPage(QueryStorageDTO dto){ + + + Page page = new Page<>(); + + IPage storageList = cellMapper.getStorageCellPage(page,Wrappers.query() + .eq(!dto.getId().isEmpty(),"id",dto.getId()) + .orderByDesc("create_time") + ); + return R.ok(storageList,"查询成功"); + } + + + + + /** + * + * @param dto + * @return + */ + @ApiOperation(value = "格子分页查询--入库模块使用", notes = "格子分页查询--入库模块使用") + @GetMapping("/page" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public R> getStorageRoomList(QueryStorageDTO dto) { + + Page page = new Page<>(dto.getCurrent(),dto.getSize()); + + IPage storage = cellMapper.getStorageCellPage(page,Wrappers.query() + .eq("cupboard_id",dto.getId()) + .orderByDesc("sort") + ); + return R.ok(storage,"查询成功"); + } + + + /** + * 通过id删除 + * @return R + */ + @ApiOperation(value = "通过格子id删除图片", notes = "通过格子id删除图片") + @SysLog("通过id删除" ) + @DeleteMapping("/deletePicture/{cellId}" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_cell_del')" ) + public R deleteById(@PathVariable("cellId") String cellId) throws Exception { + + + StorageCell storageCell = cellMapper.selectById(cellId); + if(storageCell==null){ + throw new RuntimeException(String.format("当前格子数据不存在")); + } + if(storageCell.getCellPhoto()!=null && storageCell.getFileName()!=null ){ + //删除图片 + ossFile.fileDelete("cell" + "/" + storageCell.getId() + "/" + storageCell.getFileName()); + storageCell.setCellPhoto(""); + storageCell.setFileName(""); + cellMapper.updateById(storageCell); + } + return R.ok("删除成功"); + } + + + + /** + * 通过id删除 + * @return R + */ + @ApiOperation(value = "批量删除格子", notes = "批量删除格子") + @SysLog("通过id删除" ) + @DeleteMapping("/deleteCell" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_cell_del')" ) + public R deleteById(@RequestBody List cellIds) throws Exception { + + List storageCells = cellMapper.selectBatchIds(cellIds); + + for (StorageCell storageCell : storageCells) { + if(storageCell.getStatus()){ + throw new RuntimeException(String.format("编号为"+storageCell.getCellNo()+"的格子已存放东西")); + } + } + for (StorageCell storageCell : storageCells) { + + //删除数据库数据 + cellMapper.deleteById(storageCell.getId()); + if(storageCell.getCellPhoto()!=null && storageCell.getFileName()!=null ){ + //删除图片 + ossFile.fileDelete("cell" + "/" + storageCell.getId() + "/" + storageCell.getFileName()); + } + //更新对应格子的规格数据 + StorageCupboard storageCupboard = cupboardMapper.selectById(storageCell.getCupboardId()); + storageCupboard.setSpecifications(storageCupboard.getSpecifications()-1);//删除一个减- + //获取对应格子数量 + /*QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("cupboard_id",storageCell.getCupboardId()); + cellMapper.selectCount(wrapper);*/ + cupboardMapper.updateById(storageCupboard); + } + return R.ok("删除成功"); + } + + + /** + * 通过柜子id和文件名获取图片"/getRoomPicture/{roomId}/{fileName}" + */ + @ApiOperation(value = "通过格子id和文件名获取图片--存储管理", notes = "通过格子id和文件名获取图片--存储管理") + @GetMapping("/getCellPicture/{cellId}/{fileName}") + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public void getRoomPicture (@PathVariable("cellId") String cellId, + @PathVariable("fileName") String fileName, + HttpServletResponse httpServletResponse) throws Exception { + StorageCell storageCell = storageCellService.getById(cellId); + if (storageCell == null) { + throw new RuntimeException(String.format("当前柜子数据不存在")); + } + ossFile.fileGet("cell" + "/" + storageCell.getId() + "/" + fileName, httpServletResponse.getOutputStream()); + httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(storageCell.getFileName())); + } + +} diff --git a/src/main/java/digital/laboratory/platform/imr/controller/StorageCupboardController.java b/src/main/java/digital/laboratory/platform/imr/controller/StorageCupboardController.java new file mode 100644 index 0000000..5e14ad8 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/StorageCupboardController.java @@ -0,0 +1,354 @@ +package digital.laboratory.platform.imr.controller; + +import cn.hutool.core.io.file.FileNameUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.log.annotation.SysLog; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.QueryStorageDTO; +import digital.laboratory.platform.imr.entity.StorageCell; +import digital.laboratory.platform.imr.entity.StorageCupboard; +import digital.laboratory.platform.imr.entity.StorageRoom; +import digital.laboratory.platform.imr.mapper.StorageCellMapper; +import digital.laboratory.platform.imr.mapper.StorageCupboardMapper; +import digital.laboratory.platform.imr.service.StorageCupboardService; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.activation.MimetypesFileTypeMap; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.security.Principal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import digital.laboratory.platform.common.oss.service.OssFile; + +import static com.alibaba.fastjson.util.IOUtils.stringSize; + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 前端控制器 + * + * 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 + * 这里写什么: + * 为前端提供数据, 接受前端的数据 + * 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 + * 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 + * 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/storage_cupboard" ) +@Api(value = "storage_cupboard", tags = "柜子管理") +public class StorageCupboardController { + + private final StorageCupboardService storageCupboardService; + + + private final StorageCupboardMapper cupboardMapper; + + + private final StorageCellMapper cellMapper; + + private final OssFile ossFile; + + /** + * 通过id查询 + * @param id id + * @return R + */ + @ApiOperation(value = "通过id查询", notes = "通过id查询") + @GetMapping("/{id}" ) + @PreAuthorize("@pms.hasPermission('imr_storage_cupboard_get')" ) + public R getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + StorageCupboard storageCupboard = storageCupboardService.getById(id); + return R.ok(storageCupboard); + //return R.ok(storageCupboardService.getById(id)); + } + + + + + + + @ApiOperation(value = "柜子列表查询接口--存储管理", notes = "柜子列表查询接口--存储管理") + @GetMapping("/cupboard/list" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public R> getStorageRoomPage(QueryStorageDTO dto){ + + + Page page = new Page<>(dto.getCurrent(),dto.getSize()); + + IPage storageCupboardList = cupboardMapper.getStorageCupboardPage(page,Wrappers.query() + .eq(!dto.getId().isEmpty(),"id",dto.getId()) + .orderByDesc("create_time") + ); + return R.ok(storageCupboardList,"查询成功"); + } + + + +/* @ApiOperation(value = "修改--上传柜子图片", notes = "修改--上传柜子图片") + @PostMapping(value = "/uploadCupboard/{cupboardId}") + //@PreAuthorize("@pms.hasPermission('roomUpload')") + public R uploadAttachmentObj(@PathVariable("cupboardId") String cupboardId, @RequestPart("file") MultipartFile file) throws Exception { + + StorageCupboard storageCupboard = cupboardMapper.selectById(cupboardId); + if (storageCupboard != null) { + + String path = "cupboard" + "/" + cupboardId; + String fileName = FileNameUtil.getName(file.getOriginalFilename()); + boolean r = ossFile.fileUpload(file, path); + Map ResultData = new HashMap<>(); + ResultData.put("fileName", fileName); + ResultData.put("path", path); + + if (r) { + //修改数据库 + storageCupboard.setCupboardPhoto(path); + storageCupboard.setFileName(fileName); + cupboardMapper.updateById(storageCupboard); + return R.ok(ResultData, "上传成功"); + } + return R.failed("上传失败"); + } + return R.failed(null, "这个柜子不存在"); + }*/ + + + /** + * 新增 + * @param storageCupboard + * @return R + */ + @ApiOperation(value = "添加存储柜--存储管理", notes = "添加存储柜--存储管理") + @SysLog("添加存储柜--存储管理" ) + @PostMapping("/createStorageCupboard") + //@PreAuthorize("@pms.hasPermission('imr_storage_room_add')" ) + public R postAddObject(StorageCupboard storageCupboard, HttpServletRequest theHttpServletRequest,@RequestPart(value = "file",required = false) MultipartFile file)throws Exception { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + if (storageCupboard.getRoomId() == null) { + throw new RuntimeException(String.format("柜子必须关联格子")); + } + if (storageCupboard.getSpecifications() == null) { + throw new RuntimeException(String.format("柜子必须要填写规格")); + } + if (storageCupboard.getCupboardNo() == null) { + throw new RuntimeException(String.format("柜子编号不能为空")); + } + + storageCupboard.setId(IdWorker.get32UUID().toUpperCase()); + + if (file != null) { + String path = "cupboard" + "/" + storageCupboard.getId(); + String fileName = FileNameUtil.getName(file.getOriginalFilename()); + boolean r = ossFile.fileUpload(file, path); + if (r) { + storageCupboard.setCupboardPhoto(path); + storageCupboard.setFileName(fileName); + cupboardMapper.insert(storageCupboard); + //根据柜子规格创建格子 + for (Integer a = 1; a <= storageCupboard.getSpecifications(); a++) { + StorageCell storageCell = new StorageCell(); + storageCell.setId(IdWorker.get32UUID().toUpperCase()); + storageCell.setStatus(true);//默认未存入东西 + storageCell.setCupboardId(storageCupboard.getId()); + //取柜子的编号前几位 + String head = storageCupboard.getCupboardNo().substring(0, 3); + //制定格子编号生成规则 + String str = "CL"; + String number = getNumber(a); + storageCell.setCellNo(str + head + number); + cellMapper.insert(storageCell); + } + return R.ok(storageCupboard, "创建成功"); + } else { + //删除图片 + ossFile.fileDelete("cupboard" + "/" + storageCupboard.getId() + "/" + fileName); + return R.failed("创建失败"); + } + } else { + cupboardMapper.insert(storageCupboard); + return R.ok(storageCupboard, "创建成功"); + } + } + + + /** + * 修改 + * @param storageCupboard + * @return R + */ + @ApiOperation(value = "修改--存储管理(数据修改+图片修改)", notes = "修改--存储管理") + @SysLog("修改") + @PutMapping("/updateCupboard") + //@PreAuthorize("@pms.hasPermission('imr_storage_room_edit')" ) + public R putUpdateById (StorageCupboard storageCupboard, HttpServletRequest + theHttpServletRequest, @RequestPart(value = "file", required = false) MultipartFile file)throws Exception { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + StorageCupboard cupboard = storageCupboardService.getById(storageCupboard.getId());//数据库数据 + + if(cupboard==null){ + throw new RuntimeException(String.format("当前修改数据不存在")); + } + + if ((int)storageCupboard.getSpecifications()!=(int)cupboard.getSpecifications()) { + throw new RuntimeException(String.format("不允许修改")); + } + + if (file != null) { + String path = "cupboard" + "/" + storageCupboard.getId(); + String fileName = FileNameUtil.getName(file.getOriginalFilename()); + boolean r = ossFile.fileUpload(file, path); + if (r) { + storageCupboard.setCupboardPhoto(path); + storageCupboard.setFileName(fileName); + cupboardMapper.updateById(storageCupboard); + return R.ok(storageCupboard, "修改成功"); + } else { + return R.failed("修改失败"); + } + } else { + if(cupboard.getCupboardPhoto()!=null && cupboard.getFileName()!=null) { + //删除图片 + ossFile.fileDelete("cupboard" + "/" + cupboard.getId() + "/" + cupboard.getFileName()); + } + storageCupboard.setFileName(null); + storageCupboard.setCupboardPhoto(null); + cupboardMapper.updateById(storageCupboard); + return R.ok(storageCupboard, "修改成功"); + } + } + + /** + * 通过id删除 + * @param id id + * @return R + **/ + @ApiOperation(value = "通过id删除柜子--存储管理", notes = "通过id删除柜子--存储管理") + @SysLog("通过id删除") + @DeleteMapping("deleteCupboard/{id}") + //@PreAuthorize("@pms.hasPermission('imr_storage_room_del')" ) + public R deleteById (@PathVariable String id, HttpServletRequest theHttpServletRequest) throws + Exception { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("cupboard_id", id); + List storageCells = cellMapper.selectList(wrapper); + for (StorageCell storageCell : storageCells) { + if (!storageCell.getStatus()) { + throw new RuntimeException(String.format("当前柜子中"+storageCell.getCellNo()+"格子还存有物品")); + } + } + //删除柜子 + StorageCupboard storageCupboard = storageCupboardService.getById(id); + if (storageCupboard.getCupboardPhoto() != null && storageCupboard.getFileName() != null) { + //删除图片 + ossFile.fileDelete("cupboard" + "/" + storageCupboard.getId() + "/" + storageCupboard.getFileName()); + } + + if (storageCupboardService.removeById(id)) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("cupboard_id",id); + cellMapper.delete(queryWrapper);//删除格子 + //删除对应格子照片 + for (StorageCell storageCell : storageCells) { + if (storageCell.getCellPhoto() != null && storageCell.getFileName() != null) { + //删除图片 + ossFile.fileDelete("cell" + "/" + storageCell.getId() + "/" + storageCell.getFileName()); + } + } + return R.ok(storageCupboard, "对象删除成功"); + } else { + return R.failed(storageCupboard, "对象删除失败"); + } + + } + + /** + * 通过柜子id和文件名获取图片"/getRoomPicture/{roomId}/{fileName}" + */ + @ApiOperation(value = "通过柜子id和文件名获取图片--存储管理", notes = "通过柜子id和文件名获取图片--存储管理") + @GetMapping("/getCupboardPicture/{cupboardId}/{fileName}") + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public void getRoomPicture (@PathVariable("cupboardId") String cupboardId, + @PathVariable("fileName") String fileName, + HttpServletResponse httpServletResponse) throws Exception { + StorageCupboard storageCupboard = storageCupboardService.getById(cupboardId); + if (storageCupboard == null) { + throw new RuntimeException(String.format("当前柜子数据不存在")); + } + ossFile.fileGet("cupboard" + "/" + storageCupboard.getId() + "/" + fileName, httpServletResponse.getOutputStream()); + httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(storageCupboard.getFileName())); + } + + + /** + * + * @param + * @return + **/ + @ApiOperation(value = "柜子列表查询--下拉框的", notes = "柜子列表查询--下拉框的") + @GetMapping("/list/{roomId}") + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public R> getStorageRoomList (@PathVariable("roomId") String roomId ){ + + List storage = cupboardMapper.getStorageCupboardList(Wrappers.query() + .eq("room_id", roomId) + .ne("status", 0)//排除不可用的柜子 + .orderByDesc("sort") + ); + return R.ok(storage, "查询成功"); + } + + + + + public static String getNumber(Integer a){ + String number = ""; + Integer i = stringSize(a); + if(i==1){ + number="000"+a.toString(); + }else if(i==2){ + number="00"+a.toString(); + }else if(i==3){ + number="0"+a.toString(); + } + + return number; + } + + + + + + + + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/controller/StorageRoomController.java b/src/main/java/digital/laboratory/platform/imr/controller/StorageRoomController.java new file mode 100644 index 0000000..2caab69 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/controller/StorageRoomController.java @@ -0,0 +1,309 @@ +package digital.laboratory.platform.imr.controller; + +import cn.hutool.core.io.file.FileNameUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.core.constant.OSSDirectoryConstants; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.log.annotation.SysLog; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.entity.StorageCupboard; +import digital.laboratory.platform.imr.entity.StorageRoom; +import digital.laboratory.platform.imr.mapper.StorageCupboardMapper; +import digital.laboratory.platform.imr.mapper.StorageRoomMapper; +import digital.laboratory.platform.imr.service.StorageRoomService; +import digital.laboratory.platform.common.oss.service.OssFile; +import digital.laboratory.platform.common.core.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.activation.MimetypesFileTypeMap; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.security.Principal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 前端控制器 + * + * 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 + * 这里写什么: + * 为前端提供数据, 接受前端的数据 + * 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 + * 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 + * 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/storage_room" ) +@Api(value = "storage_room", tags = "房间管理") +public class StorageRoomController { + + + + private final StorageRoomMapper roomMapper; + + private final StorageRoomService storageRoomService; + + + + private final StorageCupboardMapper cupboardMapper; + + private final OssFile ossFile; + + + + + + +/* @ApiOperation(value = "上传房间图片", notes = "上传房间图片") + @PostMapping(value = "/uploadRoom/{roomId}") + @PreAuthorize("@pms.hasPermission('roomUpload')") + public R uploadAttachmentObj(@PathVariable("roomId") String roomId, @RequestPart("file") MultipartFile file) throws Exception { + + StorageRoom storageRoom = roomMapper.selectById(roomId); + if (storageRoom != null) { + + String path = "room" + "/" + roomId; + String fileName = FileNameUtil.getName(file.getOriginalFilename()); + boolean r = ossFile.fileUpload(file, path); + Map ResultData = new HashMap<>(); + ResultData.put("fileName", fileName); + ResultData.put("path", path); + + if (r) { + //修改数据库 + storageRoom.setRoomPhoto(path); + storageRoom.setFileName(fileName); + roomMapper.updateById(storageRoom); + return R.ok(ResultData, "上传成功"); + } + return R.failed("上传失败"); + } + return R.failed(null, "这个房间不存在"); + }*/ + + + + + /** + * 通过id查询 + * @param id id + * @return R + */ + @ApiOperation(value = "通过id查询", notes = "通过id查询") + @GetMapping("/{id}" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public R getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + StorageRoom storageRoom = storageRoomService.getById(id); + return R.ok(storageRoom); + //return R.ok(storageRoomService.getById(id)); + } + + /** + * 分页查询 + * @param roomName + * @return + */ + @ApiOperation(value = "存储室列表查询接口--存储管理", notes = "存储室列表查询接口--存储管理") + @GetMapping("/room/list" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public R> getStorageRoomPage(String roomName){ + + List storageRoomList = roomMapper.getStorageRoomPage(Wrappers.query() + .like(!roomName.isEmpty(),"name",roomName) + .orderByDesc("create_time") + ); + return R.ok(storageRoomList,"查询成功"); + } + + /** + * 新增 + * @param storageRoom + * @return R + */ + @ApiOperation(value = "添加存储室--存储管理(上传或不上传图片)", notes = "添加存储室--存储管理") + @SysLog("添加存储室" ) + @PostMapping("/createStorageRoom") + //@PreAuthorize("@pms.hasPermission('imr_storage_room_add')" ) + public R postAddObject(StorageRoom storageRoom, HttpServletRequest theHttpServletRequest,@RequestPart(value = "file",required = false) MultipartFile file)throws Exception { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + storageRoom.setId(IdWorker.get32UUID().toUpperCase()); + + if(file!=null){ + String path = "room" + "/" + storageRoom.getId(); + String fileName = FileNameUtil.getName(file.getOriginalFilename()); + boolean r = ossFile.fileUpload(file, path); + if (r) { + storageRoom.setRoomPhoto(path); + storageRoom.setFileName(fileName); + roomMapper.insert(storageRoom); + return R.ok(storageRoom, "创建成功"); + } + else { + //删除图片 + ossFile.fileDelete("room" + "/" + storageRoom.getId() + "/" + fileName); + return R.failed("创建失败"); + } + }else { + roomMapper.insert(storageRoom); + return R.ok(storageRoom, "创建成功"); + } + } + + + + + + /** + * 修改 + * @return R + */ + @ApiOperation(value = "修改--存储管理(数据修改+图片修改)", notes = "修改--存储管理") + @SysLog("修改" ) + @PutMapping("/updateRoom") + //@PreAuthorize("@pms.hasPermission('imr_storage_room_edit')" ) + public R putUpdateById(StorageRoom storageRoom, HttpServletRequest theHttpServletRequest,@RequestPart(value = "file",required = false)MultipartFile file)throws Exception { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + + StorageRoom room = roomMapper.selectById(storageRoom.getId()); + if(room==null){ + throw new RuntimeException(String.format("存储室数据不存在")); + } + if(file!=null){ + String path = "room" + "/" + storageRoom.getId(); + String fileName = FileNameUtil.getName(file.getOriginalFilename()); + boolean r = ossFile.fileUpload(file, path); + if (r) { + storageRoom.setRoomPhoto(path); + storageRoom.setFileName(fileName); + roomMapper.updateById(storageRoom); + return R.ok(storageRoom, "修改成功"); + } + else { + return R.failed("修改失败"); + } + }else { + //判断数据库是否存储照片 + if(room.getRoomPhoto() != null && room.getFileName()!=null){ + //删除图片 + ossFile.fileDelete("room" + "/" + room.getId() + "/" + room.getFileName()); + } + //修改数据 + storageRoom.setFileName(""); + storageRoom.setRoomPhoto(""); + roomMapper.updateById(storageRoom); + return R.ok(storageRoom, "修改成功"); + } + } + + /** + * 通过id删除 + * @param id id + * @return R + */ + @ApiOperation(value = "通过id删除房间--存储管理", notes = "通过id删除--存储管理") + @SysLog("通过id删除" ) + @DeleteMapping("deleteRoom/{id}" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_room_del')" ) + public R deleteById(@PathVariable String id, HttpServletRequest theHttpServletRequest) throws Exception { + Principal principal = theHttpServletRequest.getUserPrincipal(); + DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("room_id",id); + List storageCupboards = cupboardMapper.selectList(wrapper); + + if (storageCupboards!=null){ + throw new RuntimeException(String.format("当前房间还存在柜子不允许删除")); + } + + StorageRoom storageRoom = storageRoomService.getById(id); + if(storageRoom.getRoomPhoto()!=null && storageRoom.getFileName()!=null){ + //删除图片 + ossFile.fileDelete("room" + "/" + storageRoom.getId() + "/" + storageRoom.getFileName()); + } + + if (storageRoomService.removeById(id)) { + return R.ok(storageRoom, "对象删除成功"); + } + else { + return R.failed(storageRoom, "对象删除失败"); + } + + } + + /** + * 通过房间id和文件名获取图片"/getRoomPicture/{roomId}/{fileName}" + */ + @ApiOperation(value = "通过房间id和文件名获取图片", notes = "通过房间id和文件名获取图片") + @GetMapping("/getRoomPicture/{roomId}/{fileName}" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public void getRoomPicture(@PathVariable("roomId") String roomId, + @PathVariable("fileName") String fileName, + HttpServletResponse httpServletResponse) throws Exception { + StorageRoom storageRoom = roomMapper.selectById(roomId); + if(storageRoom==null){ + throw new RuntimeException(String.format("当前房间数据不存在")); + } + ossFile.fileGet("room" + "/" + storageRoom.getId() + "/" + fileName, httpServletResponse.getOutputStream()); + httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(storageRoom.getFileName())); + } + + + + /* + @ApiOperation(value = "删除图片", notes = "删除图片") + @SysLog("通过id删除" ) + @DeleteMapping("deleteRoom/{id}" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_room_del')" ) + */ + + + + + + /** + * 列表 + * @param + * @return + */ + @ApiOperation(value = "房间列表查询--下拉框的", notes = "房间列表查询--下拉框的") + @GetMapping("/list" ) + //@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" ) + public R> getStorageRoomList() { + + List storage = roomMapper.getStorageRoomList(Wrappers.query() + .orderByDesc("sort") + ); + return R.ok(storage,"查询成功"); + } + + + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/ApplyDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/ApplyDTO.java new file mode 100644 index 0000000..d0041e4 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/ApplyDTO.java @@ -0,0 +1,45 @@ +package digital.laboratory.platform.imr.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 创建/修改申请DTO + */ + +@Data +@ApiModel(value = "ApplyDTO",description = "创建修改申请dto") +public class ApplyDTO { + + /** + * 申请id + */ + + @ApiModelProperty(value = "申请id--主键id") + private String id; + + /** + * 样本id + */ + @ApiModelProperty(value = "选择的样本id集合") + private List sampleId; + + /** + * 申请原因 + */ + @ApiModelProperty(value="申请原因") + private String reason; + + + /** + * 申请类型(如果是一个接口就要使用该字段) + * + * destroy销毁 + * Carry外带 + */ + @ApiModelProperty(value="申请类型/1.外带/2.销毁--必须传的字段") + private Integer applyType; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/CombinationOut.java b/src/main/java/digital/laboratory/platform/imr/dto/CombinationOut.java new file mode 100644 index 0000000..27d84e7 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/CombinationOut.java @@ -0,0 +1,22 @@ +package digital.laboratory.platform.imr.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.util.List; + +@Data +@AllArgsConstructor +public class CombinationOut { + + private List sampleIds;//去重数组id + + + private Integer begin;//计算分页开始数 + + + private Integer size;//每页显示条数 + + + private String name;//模糊匹配名字 +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/DepositDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/DepositDTO.java new file mode 100644 index 0000000..8730cf9 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/DepositDTO.java @@ -0,0 +1,61 @@ +package digital.laboratory.platform.imr.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 检材/样本存放dto + * + */ + +@Data +@ApiModel(value = "样本存放dto") +public class DepositDTO { + + + + //可多个检材存放到一个格子 + + + /** + * buildingLv:'', //楼层 + * roomNo:'', //房间号 + * boxId: '', //柜子id + * cabinetName + */ + @ApiModelProperty(value="楼层") + private String buildingLv; + + @ApiModelProperty(value="房间号") + private String roomNo; + + @ApiModelProperty(value="柜子名称") + private String cabinetName; + + @ApiModelProperty(value="柜子id") + private String boxId; + + + /** + * 样本存放id---主键id + */ + @ApiModelProperty(value="样本存放id---主键id") + private List ids; + + + @ApiModelProperty(value="详细位置") + private String storageLocation; + + /** + * 存放格子id + */ + @ApiModelProperty(value="存放格子id") + private String cellId; + + + @ApiModelProperty(value="格子状态") + private String cellStatus; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/DepositToDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/DepositToDTO.java new file mode 100644 index 0000000..cca663b --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/DepositToDTO.java @@ -0,0 +1,52 @@ +package digital.laboratory.platform.imr.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + + +@Data +@ApiModel(value = "存储dto") +public class DepositToDTO { + + + @ApiModelProperty(value="楼层") + private String buildingLv; + + @ApiModelProperty(value="房间号") + private String roomNo; + + @ApiModelProperty(value="柜子名称") + private String cabinetName; + + @ApiModelProperty(value="柜子id") + private String boxId; + + @ApiModelProperty(value="监督人id") + private String supervisorId; + + + @ApiModelProperty(value="样本信息") + private List sampleInfo; + + + @ApiModelProperty(value="详细位置") + private String storageLocation; + + /** + * 存放格子id + */ + @ApiModelProperty(value="存放格子id") + private String cellId; + + + @ApiModelProperty(value="格子状态") + private String cellStatus; + + + @ApiModelProperty(value="入库质量") + private double quality; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/DestroyOutboundDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/DestroyOutboundDTO.java new file mode 100644 index 0000000..e41ec88 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/DestroyOutboundDTO.java @@ -0,0 +1,16 @@ +package digital.laboratory.platform.imr.dto; + + +import lombok.Data; + +import java.util.List; + +@Data +public class DestroyOutboundDTO { + + + private List sampleIds; + + + private String supervisor;//监督人 +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/DestructionPublicityDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/DestructionPublicityDTO.java new file mode 100644 index 0000000..338dca9 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/DestructionPublicityDTO.java @@ -0,0 +1,54 @@ +package digital.laboratory.platform.imr.dto; + + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.time.LocalDate; + +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class DestructionPublicityDTO { + + + /** + * 主键id + */ + private String id; + + /** + * 审核人id + */ + @ApiModelProperty(value="审核人id") + private String reviewerId; + + /** + * 销毁单位 + */ + @ApiModelProperty(value="销毁单位") + private String destroyCompany; + + /** + * 销毁时间 + */ + @ApiModelProperty(value="销毁时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate destroyDate; + + /** + * 备注 + */ + @ApiModelProperty(value="备注") + private String remarks; + + + /** + * + */ + @ApiModelProperty(value="销毁公示样本id集合--sampleIds") + private List sampleIds; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/IconDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/IconDTO.java new file mode 100644 index 0000000..63a7959 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/IconDTO.java @@ -0,0 +1,22 @@ +package digital.laboratory.platform.imr.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@ApiModel(value = "显示图标") +@AllArgsConstructor +public class IconDTO { + + + @ApiModelProperty(value = "数量") + private Long number; + + @ApiModelProperty(value = "状态") + private Integer status; + + @ApiModelProperty(value = "描述类型") + private String type; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/InRepositoryDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/InRepositoryDTO.java new file mode 100644 index 0000000..f1504f5 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/InRepositoryDTO.java @@ -0,0 +1,48 @@ +package digital.laboratory.platform.imr.dto; + + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 入库DTO + */ + +@Data +@ApiModel(value = "样本入库dto") +public class InRepositoryDTO { + + /** + * 样本编号 + */ + @ApiModelProperty(value="样本编号") + private String sampleNo; + + + + /** + * 样本入库时质量(这里更确切应该是流转的质量) + */ + @ApiModelProperty(value="入库质量/体积") + private BigDecimal quality; + + + + /** + * 监督人 + */ + @ApiModelProperty(value="监督人") + private String supervisor; + + + /** + * 计量单位 + */ + @ApiModelProperty(value="计量单位") + private String unit; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/InnerSampleOutbound.java b/src/main/java/digital/laboratory/platform/imr/dto/InnerSampleOutbound.java new file mode 100644 index 0000000..162bbd8 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/InnerSampleOutbound.java @@ -0,0 +1,32 @@ +package digital.laboratory.platform.imr.dto; + +import java.time.LocalDateTime; + +/** + * 内部样本出库DTO + */ +public class InnerSampleOutbound { + + /** + * id + * 样本id + */ + private String id; + + /** + * 领取人Id + */ + private String recipientId; + + /** + * 归还时间 + */ + private LocalDateTime returnDate; + + + /** + * 原因 + */ + private String cause; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/OutWarehouseApplyDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/OutWarehouseApplyDTO.java new file mode 100644 index 0000000..9d81d5b --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/OutWarehouseApplyDTO.java @@ -0,0 +1,47 @@ +package digital.laboratory.platform.imr.dto; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 创建出库申请DTO + */ + +@Data +public class OutWarehouseApplyDTO implements Serializable { + + + + /** + * 出库用途 + */ + @ApiModelProperty(value="出库用途") + private String purpose; + + /** + * 归还日期 + */ + @ApiModelProperty(value="归还日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate returnDate; + + /** + * 鉴定人id + */ + @ApiModelProperty(value="鉴定人id") + private String appraiserId; + + /** + * 出库的样本id集合 + */ + @ApiModelProperty(value="样本id集合") + List sampleIds; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/PrintTableDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/PrintTableDTO.java new file mode 100644 index 0000000..6d50262 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/PrintTableDTO.java @@ -0,0 +1,41 @@ +package digital.laboratory.platform.imr.dto; + + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; + +@Data +@ApiModel(value = "按时间或委托生成检材出入库登记表") +public class PrintTableDTO { + + @ApiModelProperty(value = "打印筛选条件1.委托/任务;2.时间") + private Integer type; + + + @ApiModelProperty(value = "委托/任务id") + private String EventId; + + @ApiModelProperty(value = "mf--毛发/wt--委托/ws--污水--其他....") + private String source; + + + @ApiModelProperty(value = "事件名称") + private String EventName; + + @ApiModelProperty(value = "开始时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate beginDate; + @ApiModelProperty(value = "结束时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate finishDate; + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/PublicityDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/PublicityDTO.java new file mode 100644 index 0000000..45826eb --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/PublicityDTO.java @@ -0,0 +1,38 @@ +package digital.laboratory.platform.imr.dto; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +@Data +@ApiModel(value = "PublicityDTO",description = "销毁与公示dto") +public class PublicityDTO { + + + @ApiModelProperty(value = "开始时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate beginDate; + @ApiModelProperty(value = "结束时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate finishDate; + + @ApiModelProperty(value = "当前申请的状态") + private Integer status;//状态 + /** + * 当前页 + */ + @ApiModelProperty(value = "当前页") + private Integer current; + + /** + * 每页显示条数 + */ + + @ApiModelProperty(value = "每页显示条数") + private Integer size; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/QueryApplyDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/QueryApplyDTO.java new file mode 100644 index 0000000..327af7d --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/QueryApplyDTO.java @@ -0,0 +1,41 @@ +package digital.laboratory.platform.imr.dto; + + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +@Data +@ApiModel(value="查询申请通用DTO") +public class QueryApplyDTO { + + @ApiModelProperty(value = "申请类型(1.外带//2.销毁)") + private Integer applyType;//名称 + + @ApiModelProperty(value = "开始时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate beginDate; + @ApiModelProperty(value = "结束时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate finishDate; + + @ApiModelProperty(value = "当前申请的状态") + private Integer status;//状态 + /** + * 当前页 + */ + @ApiModelProperty(value = "当前页") + private Integer current; + + /** + * 每页显示条数 + */ + + @ApiModelProperty(value = "每页显示条数") + private Integer size; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/QueryDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/QueryDTO.java new file mode 100644 index 0000000..6594db9 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/QueryDTO.java @@ -0,0 +1,64 @@ +package digital.laboratory.platform.imr.dto; + + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +import java.util.List; + +@Data +@ApiModel(value = "通用的查询参数dto--选择其中部分数据作为查询参数") +public class QueryDTO { + + //以下为查询条件 + + @ApiModelProperty(value = "名称") + private String name;//名称 + + + @ApiModelProperty(value = "样本id集合") + private String sampleIds;//名称 + + @ApiModelProperty(value = "开始时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate beginDate; + @ApiModelProperty(value = "结束时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate finishDate; + + @ApiModelProperty(value = "状态--必带参数") + private Integer status;//状态 + /** + * 当前页 + */ + @ApiModelProperty(value = "当前页") + private Integer current; + + /** + * 每页显示条数 + */ + + @ApiModelProperty(value = "每页显示条数") + private Integer size; + + @ApiModelProperty(value = "总量") + private Integer total; + + + @ApiModelProperty(value = "查询类型字段1.按照样本模糊查询;2.按照任务模糊查询") + private Integer type; + + @ApiModelProperty(value = "查询参数:房间号") + private String roomNo; + + + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/QuerySampleDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/QuerySampleDTO.java new file mode 100644 index 0000000..4f5bf9b --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/QuerySampleDTO.java @@ -0,0 +1,47 @@ +package digital.laboratory.platform.imr.dto; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 仓库查询样本DTO + */ +@Data +@ApiModel(value = "仓库查询样本dto") +public class QuerySampleDTO { + + @ApiModelProperty(value = "样本名称") + private String name;//名称 + @ApiModelProperty(value = "样本类型") + private String sampleType;// + + + // private String sampleNo;//编号 + + @ApiModelProperty(value = "入库开始时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate beginDate; + @ApiModelProperty(value = "入库结束时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate finishDate; + @ApiModelProperty(value = "状态--必带参数") + private Integer status;//状态 + + @ApiModelProperty(value = "当前页") + private Integer current; + + /** + * 每页显示条数 + */ + @ApiModelProperty(value = "每页显示条数") + private Integer size; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/QueryStorageDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/QueryStorageDTO.java new file mode 100644 index 0000000..968fcad --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/QueryStorageDTO.java @@ -0,0 +1,32 @@ +package digital.laboratory.platform.imr.dto; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 查询房间--柜子--格子对应的dto + */ + +@Data +@ApiModel(value = "查询存储相关的dto") +public class QueryStorageDTO { + + @ApiModelProperty(value = "id--这个id可以是房间/柜子") + private String id; + + @ApiModelProperty(value = "name--这个name可以是房间/柜子") + private String name; + + + @ApiModelProperty(value = "当前页") + private Integer current; + + + @ApiModelProperty(value = "每页显示条数") + private Integer size; + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/ReturnOutboundDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/ReturnOutboundDTO.java new file mode 100644 index 0000000..a494dd2 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/ReturnOutboundDTO.java @@ -0,0 +1,32 @@ +package digital.laboratory.platform.imr.dto; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 退还出库dto + */ + +@Data +@ApiModel(value = "退还出库dto") +public class ReturnOutboundDTO { + + + @ApiModelProperty(value = "退还出库id集合") + List sampleIds; + + @ApiModelProperty(value = "退还单位") + String returnInstitution; + + @ApiModelProperty(value = "备注") + String remark; + + @ApiModelProperty(value = "监督人") + String supervisor; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/ReviewApprovalDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/ReviewApprovalDTO.java new file mode 100644 index 0000000..1c27222 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/ReviewApprovalDTO.java @@ -0,0 +1,40 @@ +package digital.laboratory.platform.imr.dto; + +import digital.laboratory.platform.imr.entity.enums.ApplyStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.w3c.dom.stylesheets.LinkStyle; + +import java.util.List; + +/** + * 审核审批DTO + */ +@Data +@ApiModel(value = "ReviewApprovalDTO",description = "审核审批带头") +public class ReviewApprovalDTO { + + /** + * 申请id + */ + @ApiModelProperty(value = "申请id") + private String applyId; + + + @ApiModelProperty(value = "可对单个样本进行审核审批的dto") + private List reviewSampleDetails; + + /** + * 审核审批状态(枚举) + */ + @ApiModelProperty(value = "审核审批状态:通过/不通过") + private Integer status; + + /** + * 意见 + */ + + @ApiModelProperty(value = "意见") + private String opinion; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/ReviewSampleDetail.java b/src/main/java/digital/laboratory/platform/imr/dto/ReviewSampleDetail.java new file mode 100644 index 0000000..2d64465 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/ReviewSampleDetail.java @@ -0,0 +1,20 @@ +package digital.laboratory.platform.imr.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value="ReviewSampleDetail",description = "单个审核dto") +public class ReviewSampleDetail { + + + @ApiModelProperty(value = "单个样本申请明细id--不是sample_id") + private String id; + + /** + * 审核审批状态(枚举) + */ + @ApiModelProperty(value = "单个样本审核审批状态:1.通过/-1不通过") + private Integer status; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/SampleApplyQueryDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/SampleApplyQueryDTO.java new file mode 100644 index 0000000..dbc6a95 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/SampleApplyQueryDTO.java @@ -0,0 +1,22 @@ +package digital.laboratory.platform.imr.dto; + +import lombok.Data; + +/** + * 销毁/外带申请查询dto + */ + +@Data +public class SampleApplyQueryDTO { + + + private String name;//名称 + + + private String sampleNo;//编号 + + + private Integer status;//状态 + + private String applyType;//必带条件;样本类型 +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/SampleInfo.java b/src/main/java/digital/laboratory/platform/imr/dto/SampleInfo.java new file mode 100644 index 0000000..4c3a316 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/SampleInfo.java @@ -0,0 +1,17 @@ +package digital.laboratory.platform.imr.dto; + + +import lombok.Data; + +@Data +public class SampleInfo { + + + private String sampleId; + + + private String sampleName; + + + private double quality; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/UpdateStorageDateDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/UpdateStorageDateDTO.java new file mode 100644 index 0000000..5b5d0fa --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/UpdateStorageDateDTO.java @@ -0,0 +1,25 @@ +package digital.laboratory.platform.imr.dto; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +import java.time.LocalDateTime; + + +@ApiModel +@Data +public class UpdateStorageDateDTO { + + + @ApiModelProperty(value = "id--主键id") + private String id; + + @ApiModelProperty(value = "存放期限") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate storageDate; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/UseOutboundDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/UseOutboundDTO.java new file mode 100644 index 0000000..43eda0b --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/UseOutboundDTO.java @@ -0,0 +1,46 @@ +package digital.laboratory.platform.imr.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +@Data +@ApiModel(value = "通用对象;需要什么就赋值什么") +public class UseOutboundDTO { + + + @ApiModelProperty(value = "格子id") + private String cellId; + + @ApiModelProperty(value = "房间号") + private String roomNo; + + @ApiModelProperty(value = "位置") + private String location; + + + @ApiModelProperty(value = "当前账户密码") + private String password; + + @ApiModelProperty(value = "取检码") + private String code; + + @ApiModelProperty(value = "监督人id") + private String supervisorId; + + @ApiModelProperty(value = "样本id集合") + private List sampleIds; + + + @ApiModelProperty(value = "样本id") + private String sampleId; + + private Integer type; + + private Integer number; + + private String cabinetId; +} diff --git a/src/main/java/digital/laboratory/platform/imr/dto/UserInfoDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/UserInfoDTO.java new file mode 100644 index 0000000..c89632b --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/UserInfoDTO.java @@ -0,0 +1,18 @@ +package digital.laboratory.platform.imr.dto; + +import lombok.Data; + +@Data +public class UserInfoDTO { + + + private String name; + + + private String department;//部门 + + + private String userId; + + private String position; +} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/dto/VerificationCode.java b/src/main/java/digital/laboratory/platform/imr/dto/VerificationCode.java new file mode 100644 index 0000000..b2e497a --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/dto/VerificationCode.java @@ -0,0 +1,25 @@ +package digital.laboratory.platform.imr.dto; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +@Data +@ApiModel(value = "校验取检码DTO") +public class VerificationCode { + + + @ApiModelProperty(value = "样本id数组") + private List sampleIds; + + @ApiModelProperty(value = "取检码") + private String code; + + + @ApiModelProperty(value = "监督人") + private String supervisor; +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/AssociationOpen.java b/src/main/java/digital/laboratory/platform/imr/entity/AssociationOpen.java new file mode 100644 index 0000000..7eaff82 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/AssociationOpen.java @@ -0,0 +1,39 @@ +package digital.laboratory.platform.imr.entity; + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@TableName(value = "association_open", autoResultMap = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "样本关联开箱记录表") +public class AssociationOpen extends BaseEntity { + + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * sample_id + */ + @ApiModelProperty(value="样本id") + private String sampleId; + + + + @ApiModelProperty(value="开箱记录id") + private String openId; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/CabinetOpeningRecord.java b/src/main/java/digital/laboratory/platform/imr/entity/CabinetOpeningRecord.java new file mode 100644 index 0000000..d4fb8a7 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/CabinetOpeningRecord.java @@ -0,0 +1,70 @@ +package digital.laboratory.platform.imr.entity; + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +@Data +@TableName(value = "cabinet_opening_record", autoResultMap = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "智能物证柜开箱记录") +public class CabinetOpeningRecord extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 销毁公示id + */ + @ApiModelProperty(value="存储位置:表示那个格子开箱了") + private String storageLocation; + + /** + * 开箱时间 + */ + @ApiModelProperty(value="开箱时间") + private LocalDateTime openTime; + + + + @ApiModelProperty(value="开箱人--检材管理员") + private String openPerson; + + + + @ApiModelProperty(value="申请人--检材管理员") + private String applyPerson; + + + + @ApiModelProperty(value="监督人--这里直接存名字") + private String supervisor; + + + + @ApiModelProperty(value="开箱类型:1.扫码开柜2.取检码开柜3.强制/点选开柜") + private String openType; + + + + @ApiModelProperty(value="开箱用途:1.检材出库2.检材入库") + private String openPurpose; + + + + @ApiModelProperty(value="仓库,标识是哪一个仓库") + private String warehouse; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/DestructionDetail.java b/src/main/java/digital/laboratory/platform/imr/entity/DestructionDetail.java new file mode 100644 index 0000000..cd684b7 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/DestructionDetail.java @@ -0,0 +1,51 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-23 11:59:56 + * @describe 实体类 + */ +@Data +@TableName(value = "destruction_detail", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "销毁公示明细实体类") +public class DestructionDetail extends BaseEntity { + + /** + * 主键id + */ + @TableId + @ApiModelProperty(value="主键id") + private String id; + + /** + * 销毁公示id + */ + @ApiModelProperty(value="销毁公示id") + private String destructionId; + + /** + * 销毁样本id + */ + @ApiModelProperty(value="销毁样本id") + private String sampleId; + + + + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/DestructionPublicity.java b/src/main/java/digital/laboratory/platform/imr/entity/DestructionPublicity.java new file mode 100644 index 0000000..00c0293 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/DestructionPublicity.java @@ -0,0 +1,86 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import digital.laboratory.platform.imr.entity.enums.ReleaseStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-23 11:57:26 + * @describe 实体类 + */ +@Data +@TableName(value = "destruction_publicity", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "检材销毁与公示管理") +public class DestructionPublicity extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 申请人id + */ + @ApiModelProperty(value="申请人id") + private String applicantId; + + /** + * 审核人id + */ + @ApiModelProperty(value="审核人id") + private String reviewerId; + + /** + * 销毁样本数量 + */ + @ApiModelProperty(value="销毁样本数量") + private Integer destroyQuantity; + + /** + * 销毁单位 + */ + @ApiModelProperty(value="销毁单位") + private String destroyCompany; + + /** + * 销毁时间 + */ + @ApiModelProperty(value="销毁时间") + private LocalDate destroyDate; + + /** + * 备注 + */ + @ApiModelProperty(value="备注") + private String remarks; + + /** + * 未发布/已发布 + */ + @ApiModelProperty(value="-1未发布/1已发布") + private Integer status; + + + /** + * 发布时间 + */ + @ApiModelProperty(value="发布时间") + private LocalDateTime ReleaseDate; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/DrugCaseInfo.java b/src/main/java/digital/laboratory/platform/imr/entity/DrugCaseInfo.java new file mode 100644 index 0000000..b70d84e --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/DrugCaseInfo.java @@ -0,0 +1,103 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 毒品库中关联的案事件信息 + * @TableName b_drug_case_info + */ +@TableName(value ="b_drug_case_info") +@Data +public class DrugCaseInfo extends BaseEntity implements Serializable { + /** + * 主键标识 + */ + @TableId + private String id; + + /** + * 案事件名称 + */ + private String caseName; + + /** + * 案件编号 + */ + private String caseNo; + + /** + * 送缴单位 + */ + private String handingOverOrg; + + /** + * 送缴日期 + */ + private LocalDateTime handingOverDate; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + DrugCaseInfo other = (DrugCaseInfo) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getCaseName() == null ? other.getCaseName() == null : this.getCaseName().equals(other.getCaseName())) + && (this.getCaseNo() == null ? other.getCaseNo() == null : this.getCaseNo().equals(other.getCaseNo())) + && (this.getHandingOverOrg() == null ? other.getHandingOverOrg() == null : this.getHandingOverOrg().equals(other.getHandingOverOrg())) + && (this.getHandingOverDate() == null ? other.getHandingOverDate() == null : this.getHandingOverDate().equals(other.getHandingOverDate())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) + && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy())) + && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getCaseName() == null) ? 0 : getCaseName().hashCode()); + result = prime * result + ((getCaseNo() == null) ? 0 : getCaseNo().hashCode()); + result = prime * result + ((getHandingOverOrg() == null) ? 0 : getHandingOverOrg().hashCode()); + result = prime * result + ((getHandingOverDate() == null) ? 0 : getHandingOverDate().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode()); + result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", caseName=").append(caseName); + sb.append(", caseNo=").append(caseNo); + sb.append(", handingOverOrg=").append(handingOverOrg); + sb.append(", handingOverDate=").append(handingOverDate); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/entity/DrugMaterialInfo.java b/src/main/java/digital/laboratory/platform/imr/entity/DrugMaterialInfo.java new file mode 100644 index 0000000..5cf42f0 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/DrugMaterialInfo.java @@ -0,0 +1,109 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import lombok.Data; + +import java.io.Serializable; + +/** + * 毒品库中的毒品检材信息 + * @TableName b_drug_material_info + */ +@TableName(value ="b_drug_material_info") +@Data +public class DrugMaterialInfo extends BaseEntity implements Serializable { + /** + * 主键标识 + */ + @TableId + private String id; + + /** + * 关联的案件id + */ + private String caseId; + + /** + * 毒品检材编号 + */ + private String drugNo; + + /** + * 毒品检材名称 + */ + private String drugName; + + /** + * 质量/体积 + */ + private String massVolume; + + /** + * 包装是否完整, 1 完整 | 0 不完整 + */ + private Integer packageComplete; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + DrugMaterialInfo other = (DrugMaterialInfo) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getCaseId() == null ? other.getCaseId() == null : this.getCaseId().equals(other.getCaseId())) + && (this.getDrugNo() == null ? other.getDrugNo() == null : this.getDrugNo().equals(other.getDrugNo())) + && (this.getDrugName() == null ? other.getDrugName() == null : this.getDrugName().equals(other.getDrugName())) + && (this.getMassVolume() == null ? other.getMassVolume() == null : this.getMassVolume().equals(other.getMassVolume())) + && (this.getPackageComplete() == null ? other.getPackageComplete() == null : this.getPackageComplete().equals(other.getPackageComplete())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) + && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy())) + && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getCaseId() == null) ? 0 : getCaseId().hashCode()); + result = prime * result + ((getDrugNo() == null) ? 0 : getDrugNo().hashCode()); + result = prime * result + ((getDrugName() == null) ? 0 : getDrugName().hashCode()); + result = prime * result + ((getMassVolume() == null) ? 0 : getMassVolume().hashCode()); + result = prime * result + ((getPackageComplete() == null) ? 0 : getPackageComplete().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode()); + result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", caseId=").append(caseId); + sb.append(", drugNo=").append(drugNo); + sb.append(", drugName=").append(drugName); + sb.append(", massVolume=").append(massVolume); + sb.append(", packageComplete=").append(packageComplete); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferAnalysisAnnex.java b/src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferAnalysisAnnex.java new file mode 100644 index 0000000..cc2477c --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferAnalysisAnnex.java @@ -0,0 +1,102 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-05-08 17:32:13 + * @describe 实体类 + */ +@Data +@TableName(value = "b_identification_material_transfer_analysis_annex", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "分析样出入库(流转记录附属表)") +public class IdentificationMaterialTransferAnalysisAnnex extends BaseEntity { + + /** + * 流转附件表id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="流转附件表id") + private String id; + + /** + * 分析样入库时间 + */ + @ApiModelProperty(value="分析样入库时间") + private LocalDateTime analysisSampleInboundDate; + + /** + * 分析样出库时间 + */ + @ApiModelProperty(value="分析样出库时间") + private LocalDateTime analysisSampleOutboundDate; + + /** + * 分析样入库质量 + */ + @ApiModelProperty(value="分析样入库质量") + private BigDecimal analysisSampleInboundQuality; + + /** + * 分析样出库质量 + */ + @ApiModelProperty(value="分析样出库质量") + private BigDecimal analysisSampleOutboundQuality; + + /** + * 入库样本管理员id + */ + @ApiModelProperty(value="入库样本管理员id") + private String inboundAdminId; + + /** + * 出库样本管理员id + */ + @ApiModelProperty(value="出库样本管理员id") + private String outboundAdminId; + + /** + * 入库监督人id + */ + @ApiModelProperty(value="入库监督人id") + private String inboundAppraiserId; + + /** + * 出库监督人id + */ + @ApiModelProperty(value="出库监督人id") + private String outboundAppraiserId; + + /** + * 入库经手人 + */ + @ApiModelProperty(value="入库经手人") + private String inboundHandledBy; + + /** + * 出库经手人 + */ + @ApiModelProperty(value="出库经手人") + private String outboundHandledBy; + + /** + * 样本id + */ + @ApiModelProperty(value="样本id") + private String sampleId; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferRetainedAnnex.java b/src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferRetainedAnnex.java new file mode 100644 index 0000000..242b6db --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferRetainedAnnex.java @@ -0,0 +1,102 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-05-08 17:32:13 + * @describe 实体类 + */ +@Data +@TableName(value = "b_identification_material_transfer_retained_annex", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "留存样出入库(流转记录附属表)") +public class IdentificationMaterialTransferRetainedAnnex extends BaseEntity { + + /** + * 流转附件表id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="流转附件表id") + private String id; + + /** + * 留存样入库时间 + */ + @ApiModelProperty(value="留存样入库时间") + private LocalDateTime retainedSampleInboundDate; + + /** + * 留存样出库时间 + */ + @ApiModelProperty(value="留存样出库时间") + private LocalDateTime retainedSampleOutboundDate; + + /** + * 留存样入库质量 + */ + @ApiModelProperty(value="留存样入库质量") + private BigDecimal retainedSampleInboundQuality; + + /** + * 留存样出库质量 + */ + @ApiModelProperty(value="留存样出库质量") + private BigDecimal retainedSampleOutboundQuality; + + /** + * 入库样本管理员id + */ + @ApiModelProperty(value="入库样本管理员id") + private String inboundAdminId; + + /** + * 出库样本管理员id + */ + @ApiModelProperty(value="出库样本管理员id") + private String outboundAdminId; + + /** + * 入库监督人id + */ + @ApiModelProperty(value="入库监督人id") + private String inboundAppraiserId; + + /** + * 出库监督人id + */ + @ApiModelProperty(value="出库监督人id") + private String outboundAppraiserId; + + /** + * 入库经手人 + */ + @ApiModelProperty(value="入库经手人") + private String inboundHandledBy; + + /** + * 出库经手人 + */ + @ApiModelProperty(value="出库经手人") + private String outboundHandledBy; + + /** + * 样本id + */ + @ApiModelProperty(value="样本id") + private String sampleId; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/InventorySample.java b/src/main/java/digital/laboratory/platform/imr/entity/InventorySample.java new file mode 100644 index 0000000..74fda6d --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/InventorySample.java @@ -0,0 +1,24 @@ +package digital.laboratory.platform.imr.entity; + + +import lombok.Data; + +@Data +public class InventorySample { + + + private Integer Number; + + + + private String sampleNo; + + + private String name; + + + private String sampleType; + + + private String storageLocation; +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/OutWarehouseDetailed.java b/src/main/java/digital/laboratory/platform/imr/entity/OutWarehouseDetailed.java new file mode 100644 index 0000000..fde5c29 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/OutWarehouseDetailed.java @@ -0,0 +1,51 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * 出库明细 + * + * @author Zhang Xiaolong created at 2023-03-17 11:23:41 + * @describe 出库明细 实体类 + */ +@Data +@TableName(value = "out_warehouse_detailed", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "出库明细") +public class OutWarehouseDetailed extends BaseEntity { + + /** + * --主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="--主键id") + private String id; + + /** + * 申请id + */ + @ApiModelProperty(value="申请id") + private String applyId; + + /** + * 样本id + */ + @ApiModelProperty(value="样本id") + private String sampleId; + + + + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/PrintSampleInAndOutInfo.java b/src/main/java/digital/laboratory/platform/imr/entity/PrintSampleInAndOutInfo.java new file mode 100644 index 0000000..488d63a --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/PrintSampleInAndOutInfo.java @@ -0,0 +1,39 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * 定时任务 + */ + +@Data + +public class PrintSampleInAndOutInfo { + + private Integer Number; + + + private String sampleNo;//执行周期 + + + private String sampleType; + + private String warehousingDate;//入库时间 + + + private String outWarehouseDate;//出库时间 + + private String appraiserName; + + private String imName; + + private String remarks; + + private String returnTime; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleApply.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleApply.java new file mode 100644 index 0000000..fe5cd47 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleApply.java @@ -0,0 +1,141 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import digital.laboratory.platform.imr.entity.enums.ApplyStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * 检材申请实体类 + * + * 销毁申请+外带申请 + * 申请状态用于区分两者 + * + * @author Zhang Xiaolong created at 2023-03-17 11:51:42 + * @describe 检材申请实体类 实体类 + */ +@Data +@TableName(value = "sample_apply", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "检材申请实体类") +public class SampleApply extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 申请人id + */ + @ApiModelProperty(value="申请人id") + private String applicantId; + + /** + * 申请日期 + */ + @ApiModelProperty(value="申请日期") + private LocalDateTime applicationDate; + + /** + * 申请状态 + */ + @ApiModelProperty(value="申请状态") + private ApplyStatus applicationStatus; + + /** + * 申请重量 + */ + @ApiModelProperty(value="申请重量") + private Double applyQuality; + + + /** + * 重量单位 + */ + @ApiModelProperty(value="重量单位") + private String unit; + + /** + * 申请数量 + */ + @ApiModelProperty(value="申请样本数量数量") + private Integer applyQuantity; + + /** + * 审批人审批时间 + */ + @ApiModelProperty(value="审批人审批时间") + private LocalDateTime approvalDate; + + /** + * 审批人id + */ + @ApiModelProperty(value="审批人id") + private String approverId; + + /** + * 审批人意见 + */ + @ApiModelProperty(value="审批人意见") + private String approverOpinion; + + /** + * 一级审核员id + */ + @ApiModelProperty(value="一级审核员id") + private String firstAuditorId; + + /** + * -一级审核时间 + */ + @ApiModelProperty(value="-一级审核时间") + private LocalDateTime firstAuditDate; + + /** + * 一级审核意见 + */ + @ApiModelProperty(value="一级审核意见") + private String firstAuditOpinion; + + /** + * 申请原因 + */ + @ApiModelProperty(value="申请原因") + private String reason; + + /** + * 二级审核时间 + */ + @ApiModelProperty(value="二级审核时间") + private LocalDateTime secondaryAuditDate; + + /** + * 二级审核意见 + */ + @ApiModelProperty(value="二级审核意见") + private String secondaryAuditOpinion; + + /** + * 二级审核员id + */ + @ApiModelProperty(value="二级审核员id") + private String secondaryAuditorId; + + /** + * 申请类型 + */ + @ApiModelProperty(value="申请类型:1.检材外带申请;2.检材销毁申请") + private Integer applyType; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleApplyDetailed.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleApplyDetailed.java new file mode 100644 index 0000000..4f57d19 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleApplyDetailed.java @@ -0,0 +1,57 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-04-16 23:35:51 + * @describe 实体类 + */ +@Data +@TableName(value = "sample_apply_detailed", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "样本申请明细") +public class SampleApplyDetailed extends BaseEntity { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="id") + private String id; + + /** + * 样本id + */ + @ApiModelProperty(value="样本id") + private String sampleId; + + /** + * 申请id + */ + @ApiModelProperty(value="申请id") + private String applyId; + + /** + * 1通过/-1不通过 + */ + @ApiModelProperty(value="1通过/0.待审核审批/-1不通过") + private Integer status; + + + + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleInboundAndOutboundTable.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleInboundAndOutboundTable.java new file mode 100644 index 0000000..51bcdaa --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleInboundAndOutboundTable.java @@ -0,0 +1,89 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-21 10:29:03 + * @describe 实体类 + */ +@Data +@TableName(value = "sample_inbound_and_outbound_table", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "检材出入库登记表") +public class SampleInboundAndOutboundTable extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 鉴定人 + */ + @ApiModelProperty(value="鉴定人") + private String appraiserId; + + /** + * 分析样出库时间 + */ + @ApiModelProperty(value="分析样出库时间") + private LocalDateTime outWarehouseDate; + + /** + * 备注 + */ + @ApiModelProperty(value="备注") + private String remarks; + + /** + * 样本id + */ + @ApiModelProperty(value="样本id") + private String sampleId; + + /** + * 入库时间 + */ + @ApiModelProperty(value="入库时间") + private LocalDateTime warehousingDate; + + /** + * 检材管理员 + */ + @ApiModelProperty(value="检材管理员") + private String imAdministrators; + + /** + * 存放人 + */ + @ApiModelProperty(value="存放人") + private String recipient; + + @ApiModelProperty(value="归还时间") + private LocalDateTime returnTime; + + @ApiModelProperty(value="入库监督人") + private String inboundSupervisor; + + + @ApiModelProperty(value="出库监督人") + private String outboundSupervisor; + + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleInboundRecord.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleInboundRecord.java new file mode 100644 index 0000000..49102b9 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleInboundRecord.java @@ -0,0 +1,70 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-04-10 23:44:10 + * @describe 实体类 + */ +@Data +@TableName(value = "sample_inbound_record", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "") +public class SampleInboundRecord extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 入库时间 + */ + @ApiModelProperty(value="入库时间") + private LocalDateTime warehousingDate; + + /** + * 检材管理员 + */ + @ApiModelProperty(value="检材管理员") + private String imAdministrators; + + /** + * 样本id + */ + @ApiModelProperty(value="样本id") + private String sampleId; + + /** + * 入库人id + */ + @ApiModelProperty(value="入库人id") + private String warehousingPersonId; + + + @ApiModelProperty(value="样本名称") + private String name; + + + /** + * 备注 + */ + @ApiModelProperty(value="备注") + private String remarks; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleOutWarehouseApply.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleOutWarehouseApply.java new file mode 100644 index 0000000..70fec2b --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleOutWarehouseApply.java @@ -0,0 +1,91 @@ +package digital.laboratory.platform.imr.entity; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import digital.laboratory.platform.imr.entity.enums.OutApplyStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * 样本出库申请实体类 + * + * @author Zhang Xiaolong created at 2023-03-17 11:51:42 + * @describe 样本出库申请实体类 实体类 + */ +@Data +@TableName(value = "sample_out_warehouse_apply", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "样本出库申请实体类") +public class SampleOutWarehouseApply extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 申请人id + */ + @ApiModelProperty(value="申请人id") + private String applicantId; + + /** + * 申请时间 + */ + @ApiModelProperty(value="申请时间") + private LocalDateTime applicationDate; + + /** + * 出库用途 + */ + @ApiModelProperty(value="出库用途") + private String purpose; + + /** + * 归还日期 + */ + @ApiModelProperty(value="归还日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + private LocalDate returnDate; + + /** + * 取检码 + */ + @ApiModelProperty(value="取检码") + private String sampleCodeNumber; + + /** + * 鉴定人id + */ + @ApiModelProperty(value="鉴定人id") + private String appraiserId; + + /** + * 申请状态 + */ + @ApiModelProperty(value="申请状态") + private OutApplyStatus status; + + /** + * 检材管理员 + * */ + + @ApiModelProperty(value="检材管理员id") + private String imAdministratorsId; + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleOutboundRecord.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleOutboundRecord.java new file mode 100644 index 0000000..585a2e4 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleOutboundRecord.java @@ -0,0 +1,70 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import digital.laboratory.platform.imr.entity.enums.OutboundType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-04-15 10:20:58 + * @describe 实体类 + */ +@Data +@TableName(value = "sample_outbound_record", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "样本出库记录") +public class SampleOutboundRecord extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 样本id + */ + @ApiModelProperty(value="样本id") + private String sampleId; + + /** + * 领取人id + */ + @ApiModelProperty(value="领取人id") + private String recipientId; + + /** + * 原因/备注 + */ + @ApiModelProperty(value="原因/备注") + private String reason; + + /** + * 样本名称 + */ + @ApiModelProperty(value="样本名称") + private String name; + + + /** + * 出库类型:1.领用/2.销毁/3.退还 + */ + @ApiModelProperty(value="出库类型:1.领用/2.销毁/3.退还") + private OutboundType outboundType; + + @ApiModelProperty(value="出库时间") + private LocalDateTime outboundDate; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleStorage.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleStorage.java new file mode 100644 index 0000000..2381f25 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleStorage.java @@ -0,0 +1,150 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-27 14:50:05 + * @describe 实体类 + * + * 样本存储实体类 + * 外建表格关联,样本入库时录入 + * 录入要判断 + */ +@Data +@TableName(value = "b_sample_storage", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "样本存储") +public class SampleStorage extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 存储的样本id + */ + @ApiModelProperty(value="存储的样本id") + private String sampleId; + + /** + * 存储位置 + */ + @ApiModelProperty(value="存储位置") + private String storageLocation; + + /** + * 状态:已出库/已入库/待存放 + */ + @ApiModelProperty(value="状态:/1.已入库待存放/2.已入库已存放 3.已出库") + private Integer status; + + /** + * 存储期限 + */ + @ApiModelProperty(value="存储期限") + private LocalDateTime storageDate; + + + /** + * 存放人;拿来入库的人 + */ + @ApiModelProperty(value="存放人ID") + private String depositorId; + + + /** + * 领取人id + */ + @ApiModelProperty(value="领取人") + private String recipientId; + + + /** + * 入库时间 + */ + @ApiModelProperty(value="入库时间") + private LocalDateTime inRepositoryDate; + + /** + * 出库时间 + */ + @ApiModelProperty(value="出库时间") + private LocalDateTime outRepositoryDate; + + + /** + * 存储格子id + */ + @ApiModelProperty(value="存储格子id") + private String storageCellId; + + + /** + * 销毁标识 + */ + @ApiModelProperty(value="销毁标识") + private Integer earlyWarning; //预留的字段 0.还未到销毁;1.已到销毁时间;(2.销毁审核通过;--后端业务字段) + + + /** + * 质量/体积 + */ + @ApiModelProperty(value="质量/体积") + private BigDecimal quality; + + + /** + * 计量单位 + */ + @ApiModelProperty(value="计量单位") + private String unit; + + @ApiModelProperty(value="样本名称") + private String name; + + @ApiModelProperty(value = "样本类型") + private String sampleType; + + + @ApiModelProperty(value = "是否需要归还(-1不需要;1.需要归还)") + private Integer isReturn; + + + @ApiModelProperty(value = "归还时间") + private LocalDate returnTime; + + + @ApiModelProperty(value = "出库用途") + private String purpose; + + + @ApiModelProperty(value="楼层") + private String buildingLv; + + @ApiModelProperty(value="房间号") + private String roomNo; + + @ApiModelProperty(value="柜子名称") + private String cabinetName; + + @ApiModelProperty(value="柜子id") + private String boxId; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/StorageCell.java b/src/main/java/digital/laboratory/platform/imr/entity/StorageCell.java new file mode 100644 index 0000000..5aa9eb0 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/StorageCell.java @@ -0,0 +1,77 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-17 11:48:03 + * @describe 实体类 + */ +@Data +@TableName(value = "storage_cell", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "存储格子") +public class StorageCell extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 格子编号 + */ + @ApiModelProperty(value="格子编号") + private String cellNo; + + /** + * 状态:可用/不可用 + */ + @ApiModelProperty(value="是否存放物品 true存放/false未存放") + private Boolean status; + + /** + * 排序 + */ + @ApiModelProperty(value="排序") + private Long sort; + + /** + * 柜子id + */ + @ApiModelProperty(value="柜子id") + private String cupboardId; + + /** + * 格子照片 + */ + @ApiModelProperty(value="格子照片") + private String cellPhoto; + + /** + * 格子描述 + */ + @ApiModelProperty(value="格子描述") + private String content; + + + /** + * 文件名称 + */ + @ApiModelProperty(value="文件名称") + private String fileName; + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/StorageCupboard.java b/src/main/java/digital/laboratory/platform/imr/entity/StorageCupboard.java new file mode 100644 index 0000000..99a3e65 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/StorageCupboard.java @@ -0,0 +1,110 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.models.auth.In; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-17 11:45:58 + * @describe 实体类 + */ +@Data +@TableName(value = "storage_cupboard", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "") +public class StorageCupboard extends BaseEntity { + + /** + * 柜子id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="柜子id") + private String id; + + /** + * 柜子名称 + */ + @ApiModelProperty(value="柜子名称") + private String name; + + /** + * 柜子编号 + */ + @ApiModelProperty(value="柜子编号") + private String cupboardNo; + + /** + * 规格 + */ + @ApiModelProperty(value="规格") + private Integer specifications; + + /** + * 存储类型(测试) + */ + @ApiModelProperty(value="存储类型(测试)") + private String storageType; + + /** + * 状态(存满/为存满)--测试数据 + */ + @ApiModelProperty(value="状态(true.正常使用;false停止使用)--测试数据") + private Boolean status; + + /** + * 房间id + */ + @ApiModelProperty(value="房间id") + private String roomId; + + /** + * 柜子照片 + */ + @ApiModelProperty(value="柜子照片") + private String cupboardPhoto; + + + + /** + * updateBy + */ + @ApiModelProperty(value="updateBy") + private String updateBy; + + + /** + * 排序 + */ + @ApiModelProperty(value="排序") + private Long sort; + + + /** + * 文件名称 + */ + @ApiModelProperty(value="文件名称") + private String fileName; + + + @ApiModelProperty(value="类型:柜子/货架") + private String cupboardType; + + + @ApiModelProperty(value="1规则/-1不规则") + private Integer rule; + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/StorageRoom.java b/src/main/java/digital/laboratory/platform/imr/entity/StorageRoom.java new file mode 100644 index 0000000..9c62cee --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/StorageRoom.java @@ -0,0 +1,75 @@ +package digital.laboratory.platform.imr.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import digital.laboratory.platform.common.mybatis.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * + * + * @author Zhang Xiaolong created at 2023-03-17 11:44:05 + * @describe 实体类 + */ +@Data +@TableName(value = "storage_room", autoResultMap = true) +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "房间") +public class StorageRoom extends BaseEntity { + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="主键id") + private String id; + + /** + * 房间名称(冷冻356) + */ + @ApiModelProperty(value="房间名称(冷冻356)") + private String name; + + /** + * 房间位置(3楼356) + */ + @ApiModelProperty(value="房间位置(3楼356)") + private String roomLocation; + + /** + * 房间照片 + */ + @ApiModelProperty(value="房间照片") + private String roomPhoto; + + + + /** + * updateBy + */ + @ApiModelProperty(value="updateBy") + private String updateBy; + + + /** + * 排序 + */ + @ApiModelProperty(value="排序") + private Long sort; + + + /** + * 文件名称 + */ + @ApiModelProperty(value="文件名称") + private String fileName; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/ApplyStatus.java b/src/main/java/digital/laboratory/platform/imr/entity/enums/ApplyStatus.java new file mode 100644 index 0000000..8b6a232 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/enums/ApplyStatus.java @@ -0,0 +1,31 @@ +package digital.laboratory.platform.imr.entity.enums; + + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * 申请的状态 + */ +@Getter +@RequiredArgsConstructor +public enum ApplyStatus { + + //FAIL + FIRST_LEVEL_FAIL(-2,"一级审核不通过"), + SECOND_LEVEL_FAIL(-3,"二级审核不通过"), + APPROVAL_FAILED(-4,"审批不通过"), + TO_BE_SUBMITTED(0,"已创建待提交"), + WITHDRAWN(-1,"已撤回"), + FIRST_LEVEL(1,"待一级审核"), + SECOND_LEVEL(2,"待二级审核"), + PENDING_APPROVAL(3,"待审批"), + APPROVED(4,"审批通过"); + @EnumValue//标记数据库存的值是status + private final int status; + @JsonValue//标记返回前端字段 + private final String description; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/OutApplyStatus.java b/src/main/java/digital/laboratory/platform/imr/entity/enums/OutApplyStatus.java new file mode 100644 index 0000000..9bae387 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/enums/OutApplyStatus.java @@ -0,0 +1,26 @@ +package digital.laboratory.platform.imr.entity.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * 出库申请状态 + */ +@Getter +@RequiredArgsConstructor +public enum OutApplyStatus { + + + TO_BE_CONFIRMED(1,"已创建待确认"), + + SUCCESS(2,"已确认待使用"), + + ALREADY_USED(3,"已使用"); + + @EnumValue//标记数据库存的值是status + private final int status; + @JsonValue//标记返回前端字段 + private final String description; +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/OutboundType.java b/src/main/java/digital/laboratory/platform/imr/entity/enums/OutboundType.java new file mode 100644 index 0000000..da6bfb4 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/enums/OutboundType.java @@ -0,0 +1,29 @@ +package digital.laboratory.platform.imr.entity.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor + +public enum OutboundType { + + + USE(1,"领用出库"), + + DESTRUCTION(2,"销毁出库"), + + RETURN(3,"退还出库"), + + + SCANCODE(4,"扫码出库"), + + FORCE(5,"强制出库"); + + @EnumValue//标记数据库存的值是status + private final int status; + @JsonValue//标记返回前端字段 + private final String description; +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/ReleaseStatus.java b/src/main/java/digital/laboratory/platform/imr/entity/enums/ReleaseStatus.java new file mode 100644 index 0000000..5b34085 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/enums/ReleaseStatus.java @@ -0,0 +1,24 @@ +package digital.laboratory.platform.imr.entity.enums; + + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + + +/** + * 公示发布状态 + */ +@Getter +@RequiredArgsConstructor +public enum ReleaseStatus { + + NOT_PUBLISHED(-1,"未发布"), + PUBLISHED(1,"已发布"); + + @EnumValue//标记数据库存的值是status + private final int status; + @JsonValue//标记返回前端字段 + private final String description; +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/WarehouseMark.java b/src/main/java/digital/laboratory/platform/imr/entity/enums/WarehouseMark.java new file mode 100644 index 0000000..7eff3de --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/entity/enums/WarehouseMark.java @@ -0,0 +1,28 @@ +package digital.laboratory.platform.imr.entity.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.Data; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * 样本出入库标识 + */ + +@Getter +@RequiredArgsConstructor +public enum WarehouseMark { + + + STORAGE_IN_WAREHOUSE(1,"已入库"), + + LEAVE_THE_WAREHOUSE(-1,"已出库"); + + + + @EnumValue//标记数据库存的值是mark + private final int mark; + @JsonValue//标记返回前端字段 + private final String description; +} diff --git a/src/main/java/digital/laboratory/platform/imr/feign/TransferFeignService.java b/src/main/java/digital/laboratory/platform/imr/feign/TransferFeignService.java new file mode 100644 index 0000000..38b1683 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/feign/TransferFeignService.java @@ -0,0 +1,61 @@ +package digital.laboratory.platform.imr.feign; + + +import digital.laboratory.platform.common.core.constant.SecurityConstants; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.feign.dto.UpdateHolderDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.math.BigDecimal; + +/** + * 这个feign接口是用于调整流转模块的其他信息 + */ +@FeignClient("dlp-identification-material-transfer") +public interface TransferFeignService { + + + + /*@PutMapping(value = "/sample_transfer/test",headers = SecurityConstants.HEADER_FROM_IN) + @LoadBalanced + public void testTransfer();*/ + + + /** + * 修改样本当前持有人 + */ + @PutMapping(value = "/sample/holder",headers = SecurityConstants.HEADER_FROM_IN) + void updateSampleHolder(@RequestBody UpdateHolderDTO dto );//样本id和当前持有人id + + /** + * 出库添加流转记录表(不考虑流转质量) + * 入库-->出库也不需要使用质量 + */ + @PostMapping(value = "/sample_transfer/out/{sampleId}/{userId}",headers = SecurityConstants.HEADER_FROM_IN) + void addTransferByOut(@PathVariable("sampleId") String sampleId,@PathVariable("userId") String userId); + + + /** + * 入库添加流转记录表(考虑流转质量) + */ + @PostMapping(value = "/sample_transfer/in/{sampleId}/{unit}/{quality}/{userId}",headers = SecurityConstants.HEADER_FROM_IN) + void addTransferByIn(@PathVariable("sampleId") String sampleId, @PathVariable("unit") String unit, @PathVariable("quality") BigDecimal quality, @PathVariable("userId") String userId); + + /** + * 入库添加流转记录表(不考虑流转质量) + */ + @PostMapping(value = "/sample_transfer/inbound/{sampleId}/{userId}",headers = SecurityConstants.HEADER_FROM_IN) + void addTransferByInbound(@PathVariable("sampleId") String sampleId,@PathVariable("userId") String userId); + + /** + * 修改当前样本sample表格中状态 + */ + + @PostMapping(value = "/sample/updateStatus/{sampleId}/{status}",headers = SecurityConstants.HEADER_FROM_IN) + void updateStatus(@PathVariable("sampleId") String sampleId,@PathVariable("status") Integer status); + +} diff --git a/src/main/java/digital/laboratory/platform/imr/feign/dto/UpdateHolderDTO.java b/src/main/java/digital/laboratory/platform/imr/feign/dto/UpdateHolderDTO.java new file mode 100644 index 0000000..c0eb8d2 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/feign/dto/UpdateHolderDTO.java @@ -0,0 +1,21 @@ +package digital.laboratory.platform.imr.feign.dto; + + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class UpdateHolderDTO { + + + private String sampleId;//样本id + + + + private String holder;//当前持有人 + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/handle/AppStartupRunner.java b/src/main/java/digital/laboratory/platform/imr/handle/AppStartupRunner.java new file mode 100644 index 0000000..a37868e --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/handle/AppStartupRunner.java @@ -0,0 +1,130 @@ +//package digital.laboratory.platform.imr.handle; +// +//import digital.laboratory.platform.common.core.constant.CommonConstants; +//import digital.laboratory.platform.common.core.util.R; +//import digital.laboratory.platform.sys.entity.Dictionary; +//import digital.laboratory.platform.sys.feign.RemoteDictionaryService; +//import lombok.RequiredArgsConstructor; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.boot.ApplicationArguments; +//import org.springframework.boot.ApplicationRunner; +//import org.springframework.stereotype.Component; +// +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +//import java.util.Optional; +// +///** +// * App 启动类 +// * 当 Spring Application 启动完成后, 会调用这个类的 run() 方法进行一些最后的初始化。 +// * 我们在这个方法中从数据库加载一些全局的配置 +// * +// * @author Zhang Xiaolong +// */ +// +//@Component +//@RequiredArgsConstructor +//public class AppStartupRunner implements ApplicationRunner { +// +// // @Value("${dlp.entrustment.processDefinitionId}") +// // public static String processDefinitionId; +// +// //public static boolean clientChoiceCheckers; +// //public static boolean checkerChoiceApprovers; +// //public static boolean singleOperateUser; +// +// // @Value("${dlp.entrustment.temporaryPath}") +// //public static String temporaryPath; +// +// @Value("${dlp.entrustment.entrustmentLetterTemplate}") +// public static String entrustmentLetterTemplate; +// +// private final RemoteDictionaryService remoteDictionaryService; +// +// public static Map entrustmentConfig = new HashMap<>(); +// +// public static String getCfg(String code) { +// return entrustmentConfig.get(code); +// } +// +// /** +// * +// * @param args 参数 +// * @throws Exception 异常 +// * +// * // @SysLog("委托受理模块初始化") 这里不能使用 @SysLog(), 因为 SysLog 还没有初始化 +// */ +// @Override +// public void run(ApplicationArguments args) throws Exception { +//// BusinessCodeUtils.removeSymbols("x-*/)——0*&……%¥#@xasdf!*&^&%^ 中文、/+)(()\n\\xx\rx"); +// +// { +// // 加载 entrustment 在字典中的配置 +// R> r = remoteDictionaryService.getDictionaryByType(CommonConstants.DLP_TYPE_ENTRUSTMENT); +// if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) { +// List itemList = r.getData(); +// for (Dictionary item : itemList) { +// entrustmentConfig.put(item.getCode(), item.getLabel()); +// } +// } +// +// for (String key : entrustmentConfig.keySet()) { +// System.out.println(String.format("entrustmentConfig[%s]=%s", key, entrustmentConfig.get(key))); +// } +// } +// +// // { +// // R> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_PROCESS_DEFINITION_ID); +// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) { +// // processDefinitionId = r.getData().get("label"); +// // } +// // } +// // { +// // R> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_CLIENT_CHOICE_CHECKERS); +// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) { +// // clientChoiceCheckers = "1".equals(r.getData().get("label")); +// // } +// // } +// // { +// // R> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_CHECKER_CHOICE_APPROVERS); +// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) { +// // checkerChoiceApprovers = "1".equals(r.getData().get("label")); +// // } +// // } +// // { +// // R> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_CLIENT_SINGLE_OPERATE_USER); +// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) { +// // singleOperateUser = "1".equals(r.getData().get("label")); +// // } +// // } +// // { +// // R> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_TEMPORARY_PATH); +// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) { +// // temporaryPath = r.getData().get("label"); +// // } +// // if (StrUtil.isEmpty(temporaryPath)) { +// // temporaryPath =new File(System.getProperty("user.dir")+"/temp").getCanonicalPath(); +// // } +// // +// // System.out.printf("临时目录是 %s%n", temporaryPath); +// // File tempPathFile = new File(temporaryPath); +// // if (! tempPathFile.exists()) { +// // System.out.printf("临时目录 %s 不存在, 创建之...%n", tempPathFile.getCanonicalPath()); +// // if (!tempPathFile.mkdirs()) { +// // System.out.printf("创建临时目录 %s 失败!%n", tempPathFile.getCanonicalPath()); +// // } +// // } +// // } +// +// // { +// // R> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_LETTER_TEMPLATE_PATH); +// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) { +// // entrustmentLetterTemplate = r.getData().get("label"); +// // } +// // } +// +// } +// +// +//} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/interceptor/FeignOauth2RequestInterceptor.java b/src/main/java/digital/laboratory/platform/imr/interceptor/FeignOauth2RequestInterceptor.java new file mode 100644 index 0000000..a66fddd --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/interceptor/FeignOauth2RequestInterceptor.java @@ -0,0 +1,37 @@ +package digital.laboratory.platform.imr.interceptor; + +import feign.RequestInterceptor; +import feign.RequestTemplate; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails; + +/** + * Feign 请求拦截器 + * Feign Client 向业务系统发出请求的时候, 把 Token 带上, 以用户自己的身份调用业务系统。 + * 目的是在业务系统中识别用户是谁, 允许或禁止用户进行对应的操作。 + */ + + +@Configuration +public class FeignOauth2RequestInterceptor implements RequestInterceptor { + + private final String AUTHORIZATION_HEADER = "Authorization"; + private final String BEARER_TOKEN_TYPE = "Bearer"; + + @Override + public void apply(RequestTemplate requestTemplate) { + System.out.println(String.format("dlp-repository, FeignOauth2RequestInterceptor()...")); + SecurityContext securityContext = SecurityContextHolder.getContext(); + Authentication authentication = securityContext.getAuthentication(); + if (authentication != null && authentication.getDetails() instanceof OAuth2AuthenticationDetails) { + OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) authentication.getDetails(); + System.out.println(String.format("FeignOauth2RequestInterceptor() Authorization, token=%s", details.getTokenValue())); + requestTemplate.header(AUTHORIZATION_HEADER, String.format("%s %s", BEARER_TOKEN_TYPE, details.getTokenValue())); + } + + } +} + diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/AssociationOpenMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/AssociationOpenMapper.java new file mode 100644 index 0000000..83d2da9 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/AssociationOpenMapper.java @@ -0,0 +1,10 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import digital.laboratory.platform.imr.entity.AssociationOpen; +import org.apache.ibatis.annotations.Mapper; + + +@Mapper +public interface AssociationOpenMapper extends BaseMapper { +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/CabinetOpeningRecordMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/CabinetOpeningRecordMapper.java new file mode 100644 index 0000000..884a904 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/CabinetOpeningRecordMapper.java @@ -0,0 +1,24 @@ +package digital.laboratory.platform.imr.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import digital.laboratory.platform.imr.entity.CabinetOpeningRecord; +import digital.laboratory.platform.imr.vo.CabinetSampleVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface CabinetOpeningRecordMapper extends BaseMapper { + + + List scanCode(@Param("number") String number); + + CabinetSampleVO getSampleById(@Param("sampleId")String sampleId); + + List batchScanCode(@Param("number")String number); + + void updateSampleQuality(@Param("sampleId")String sampleId, + @Param("sampleQuality")double sampleQuality); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/DestructionDetailMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/DestructionDetailMapper.java new file mode 100644 index 0000000..a3d979d --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/DestructionDetailMapper.java @@ -0,0 +1,38 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.imr.dto.UserInfoDTO; +import digital.laboratory.platform.imr.entity.DestructionDetail; +import digital.laboratory.platform.imr.entity.DestructionPublicity; +import digital.laboratory.platform.imr.vo.DestructionPublicityVO; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-24 + * @describe Mapper 类 + */ +@Mapper +public interface DestructionDetailMapper extends BaseMapper { + + /** + * 查询审核人 + * @param name + * @param id + * @return + */ + List getApprove(@Param("name") String name,@Param("userId") String id); + + + List getPublicityDetail(String id); + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/DestructionPublicityMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/DestructionPublicityMapper.java new file mode 100644 index 0000000..c78daf8 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/DestructionPublicityMapper.java @@ -0,0 +1,42 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.imr.entity.DestructionPublicity; +import digital.laboratory.platform.imr.vo.DestructionPublicityVO; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-23 + * @describe Mapper 类 + */ +@Mapper +public interface DestructionPublicityMapper extends BaseMapper { + + //List getPublicityDetail(String id); + + /** + * 查询单个vo + * @param page + * @param qw + * @return + */ + + + /* + 分页 + */ + IPage getDestructionPublicityPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper qw); + + DestructionPublicityVO getPublicityVO(String id); + +} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/DrugCaseInfoMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/DrugCaseInfoMapper.java new file mode 100644 index 0000000..5b8bb0d --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/DrugCaseInfoMapper.java @@ -0,0 +1,18 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import digital.laboratory.platform.imr.entity.DrugCaseInfo; + +/** +* @author ChenJiangBao +* @description 针对表【b_drug_case_info(毒品库中关联的案事件信息)】的数据库操作Mapper +* @createDate 2024-11-07 12:04:42 +* @Entity generator.entity.DrugCaseInfo +*/ +public interface DrugCaseInfoMapper extends BaseMapper { + +} + + + + diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/DrugMaterialInfoMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/DrugMaterialInfoMapper.java new file mode 100644 index 0000000..29b11e3 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/DrugMaterialInfoMapper.java @@ -0,0 +1,18 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import digital.laboratory.platform.imr.entity.DrugMaterialInfo; + +/** +* @author ChenJiangBao +* @description 针对表【b_drug_material_info(毒品库中的毒品检材信息)】的数据库操作Mapper +* @createDate 2024-11-07 12:04:42 +* @Entity generator.entity.DrugMaterialInfo +*/ +public interface DrugMaterialInfoMapper extends BaseMapper { + +} + + + + diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferAnalysisAnnexMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferAnalysisAnnexMapper.java new file mode 100644 index 0000000..4a07682 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferAnalysisAnnexMapper.java @@ -0,0 +1,21 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import digital.laboratory.platform.imr.entity.IdentificationMaterialTransferAnalysisAnnex; +import digital.laboratory.platform.imr.vo.AnalysisSample; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-05-08 + * @describe Mapper 类 + */ +@Mapper +public interface IdentificationMaterialTransferAnalysisAnnexMapper extends BaseMapper { + + List getSampleTransfer(@Param("sampleId") String sampleId); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferRetainedAnnexMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferRetainedAnnexMapper.java new file mode 100644 index 0000000..84e4754 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferRetainedAnnexMapper.java @@ -0,0 +1,21 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import digital.laboratory.platform.imr.entity.IdentificationMaterialTransferRetainedAnnex; +import digital.laboratory.platform.imr.vo.RetainedSample; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-05-08 + * @describe Mapper 类 + */ +@Mapper +public interface IdentificationMaterialTransferRetainedAnnexMapper extends BaseMapper { + + List getSampleTransfer(@Param("sampleId") String sampleId); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/OutWarehouseDetailedMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/OutWarehouseDetailedMapper.java new file mode 100644 index 0000000..22d70a6 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/OutWarehouseDetailedMapper.java @@ -0,0 +1,20 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import digital.laboratory.platform.imr.entity.OutWarehouseDetailed; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 出库明细 Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 出库明细 Mapper 类 + */ +@Mapper +public interface OutWarehouseDetailedMapper extends BaseMapper { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyDetailedMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyDetailedMapper.java new file mode 100644 index 0000000..2850cfa --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyDetailedMapper.java @@ -0,0 +1,26 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import digital.laboratory.platform.imr.entity.SampleApplyDetailed; +import digital.laboratory.platform.imr.vo.ApplySampleVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-04-17 + * @describe Mapper 类 + */ +@Mapper +public interface SampleApplyDetailedMapper extends BaseMapper { + + /** + * 申请id获取样本详情 + * @param id + * @return + */ + List getDetail(String id); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyMapper.java new file mode 100644 index 0000000..0861f53 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyMapper.java @@ -0,0 +1,52 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.imr.entity.SampleApply; +import digital.laboratory.platform.imr.vo.SampleApplyVO; +import digital.laboratory.platform.imr.vo.StatusSampleVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 检材申请实体类 Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 检材申请实体类 Mapper 类 + */ +@Mapper +public interface SampleApplyMapper extends BaseMapper { + + //SampleApplyVO getSampleApplyInfo(String id); + + /** + * 申请vo + * @param page + * @param qw + * @return + */ + + //IPage getApplyVOPage(@Param("page") Page page, @Param(Constants.WRAPPER)QueryWrapper qw); + + SampleApplyVO getSampleApply(String id); + + /** + * + * @param page + * @param qw + * @return + */ + IPage getApplyPage(@Param("page")Page page,@Param(Constants.WRAPPER) QueryWrapper qw); + + /** + * 获取样本状态及其他信息 + * @param sampleId + * @return + */ + StatusSampleVO getSampleInfo(String sampleId); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundAndOutboundTableMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundAndOutboundTableMapper.java new file mode 100644 index 0000000..cbab158 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundAndOutboundTableMapper.java @@ -0,0 +1,82 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import digital.laboratory.platform.imr.entity.SampleInboundAndOutboundTable; +import digital.laboratory.platform.imr.vo.InAndOutInfos; +import digital.laboratory.platform.imr.vo.RepositorySampleVO; +import digital.laboratory.platform.imr.vo.SampleTableVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDate; +import java.util.List; + + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-21 + * @describe Mapper 类 + */ +@Mapper +public interface SampleInboundAndOutboundTableMapper extends BaseMapper { + + + + /** + * 出入库登记表信息 + * @param sampleId + * @return + */ + List getTableVO(String sampleId); + + /** + * 获取单个检材出入库打印对象 + * @param sampleId + * @return + */ + List getInandOutTableInfo(String sampleId); + //根据时间段 + List getInandOutTableInfoByDate(@Param("beginDate") LocalDate beginDate,@Param("finishDate") LocalDate finishDate); + + + + String getEntrustmentName(@Param("id")String entrustmentId,@Param("name")String name); + + String getHairJobName(@Param("id")String hairJobId,@Param("name")String name); + + String getSewageJobName(@Param("id")String sewageJobId,@Param("name")String name); + + + String getEventName(@Param("id")String eventId,@Param("name")String name); + + + String getFeatureName(@Param("id")String eventId,@Param("name")String name); + + //分组查询毛发任务id + List queryHairJob(); + + //分组查询污水任务id + List querySewageJob(); + + //分组查询委托id + List queryEntrustment(); + + //分组查询事件id + List queryEvent(); + + + List queryFeature(); + + //委托样本 + List getSampleIdsByEw(@Param("eventId") String eventId); + //毛发样本 + List getSampleIdsByHj(@Param("eventId")String eventId); + //污水样本 + List getSampleIdsBySj(@Param("eventId")String eventId); + + List getSampleIdsByTy(@Param("eventId")String eventId); + + + List getSampleIdsByTz(@Param("eventId")String eventId); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundRecordMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundRecordMapper.java new file mode 100644 index 0000000..2ec1637 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundRecordMapper.java @@ -0,0 +1,30 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.imr.entity.SampleInboundRecord; +import digital.laboratory.platform.imr.vo.InboundRecordVO; +import digital.laboratory.platform.imr.vo.RepositorySampleVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-04-10 + * @describe Mapper 类 + */ +@Mapper +public interface SampleInboundRecordMapper extends BaseMapper { + + /** + * 入库记录分页 + * @param page + * @param qw + * @return + */ + IPage inboundRecord(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper qw); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/SampleOutWarehouseApplyMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/SampleOutWarehouseApplyMapper.java new file mode 100644 index 0000000..06ea026 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/SampleOutWarehouseApplyMapper.java @@ -0,0 +1,61 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.imr.entity.SampleOutWarehouseApply; +import digital.laboratory.platform.imr.vo.CellVO; +import digital.laboratory.platform.imr.vo.SampleOutWarehouseApplyVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 样本出库申请实体类 Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 样本出库申请实体类 Mapper 类 + */ +@Mapper +public interface SampleOutWarehouseApplyMapper extends BaseMapper { + + /** + * 获取出库申请信息+明细 + */ + SampleOutWarehouseApplyVO getOutApplyDetail(String id); + + + /** + * 获取出库申请信息+明细第二版 + */ + + SampleOutWarehouseApplyVO getSampleOutRepositoryInfo(String id); + + + + + /** + * 出库申请分页 + * @param page + * @param qw + * @return + */ + IPage getSampleOutWarehouseApplyVOPage(@Param("page") Page page, @Param(Constants.WRAPPER)QueryWrapper qw); + + /** + * 出库申请列表 + * @param qw + * @return + */ + IPage getSampleOutWarehouseApplyVOList(@Param(Constants.WRAPPER)QueryWrapper qw); + + /** + * 通过取检材码获取出库信息 + * @param code + * @return + */ + SampleOutWarehouseApplyVO getInfoByCode(@Param("code") String code); + //通过格子ID查询他的位置信息 + CellVO getCellLocation(@Param("id") String id); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/SampleOutboundRecordMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/SampleOutboundRecordMapper.java new file mode 100644 index 0000000..31bd785 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/SampleOutboundRecordMapper.java @@ -0,0 +1,24 @@ +package digital.laboratory.platform.imr.mapper; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.imr.entity.SampleOutboundRecord; +import digital.laboratory.platform.imr.vo.OutboundRecordVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-04-15 + * @describe Mapper 类 + */ +@Mapper +public interface SampleOutboundRecordMapper extends BaseMapper { + + IPage outboundRecord(@Param("page") Page page,@Param(Constants.WRAPPER) QueryWrapper qw); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/SampleStorageMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/SampleStorageMapper.java new file mode 100644 index 0000000..0b2ce48 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/SampleStorageMapper.java @@ -0,0 +1,173 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.imr.dto.CombinationOut; +import digital.laboratory.platform.imr.entity.InventorySample; +import digital.laboratory.platform.imr.entity.SampleStorage; +import digital.laboratory.platform.imr.vo.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-27 + * @describe Mapper 类 + */ +@Mapper +public interface SampleStorageMapper extends BaseMapper { + + + + /** + * sample_storage表中样本详细信息 + * @param id + * @return + */ + RepositorySampleVO getSampleDetailed(String id); + + + /** + * 通过id获取样本信息 + * @param sampleId + * @return + */ + OutSampleVO getSampleById(String sampleId); + + /** + * 通过编号获取样本信息 + * @param sampleNo + * @return + */ + OutSampleVO getSampleByNo(String sampleNo); + + + + + /** + * 通过编号获取样本信息集合 + * @param sampleNo + * @return + */ + List getSampleListByNo(String sampleNo); + + + /** + * 待存放样本列表 + * @param + * @return + */ + IPage getToBeStoredSample(@Param("page") Page page,@Param(Constants.WRAPPER)QueryWrapper qw); + + /** + * 仓库现有样本分页 + * @param page + * @param qw + * @return + */ + IPage getSampleVOList(@Param("page") Page page,@Param(Constants.WRAPPER) QueryWrapper qw); + + /** + * 查询仓库现有样本;并且状态不在领用中 + * @param page + * @param notIn + * @return + */ + IPage getSampleInfo(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper qw); + List getSampleInfoList(@Param(Constants.WRAPPER)QueryWrapper qw); + + + IPage getSampleInfoTwo(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper qw); + + /** + * 待归还样本id + * @param page + * @param updateTime + * @return + */ + IPage toBeReturned(@Param("page")Page page, @Param(Constants.WRAPPER) QueryWrapper updateTime); + + /* + 归还详情 + */ + RecipientDTO toBeReturnedDetail(String sampleId); + + /** + * 创建申请查询样本接口 + * @param samplePage + * @param ne + * @return + */ + IPage getSampleInfoByHolder(@Param("page") Page samplePage,@Param(Constants.WRAPPER) QueryWrapper ne); + + IPage getDestructionSample(@Param("page") Page samplePage,@Param(Constants.WRAPPER) QueryWrapper ne); + + /** + * 出库清单数据 + * @param ids + * @return + */ + List getSampleInventory(@Param(Constants.WRAPPER) QueryWrapper ne); + + /** + * 入库查看样本详情 + * @param id + * @return + */ + BaseSampleDetail getSampleDetailInfo(String id); + + + + + + String getEntrustmentName(@Param("id")String entrustmentId); + + String getHairJobName(@Param("id")String hairJobId); + + String getSewageJobName(@Param("id")String sewageJobId); + + //通用检材受理 + String getEventName(@Param("id")String sampleId); + + String getFeatureName(@Param("id")String sampleId); + + //查询委托方 + String returnOutboundQuery(@Param("id")String sampleId); + + + + + + + /*------------额外的测试接口*/ + List getWTSample(@Param("dto")CombinationOut combinationOut); + + List getWSSample(@Param("dto")CombinationOut combinationOut); + + List getMFSample(@Param("dto")CombinationOut combinationOut); + + List getSJSample(@Param("dto")CombinationOut combinationOut); + + + List getTZSample(@Param("dto")CombinationOut combinationOut); + + Long getTransferCount(String id); + + Long getWitnessCount(String id); + + + int queryTransfer(@Param("userId")String userId); + + String getUserName(@Param("userId")String userId); + + + List choseSampleList(); + + double getQuality(@Param("id")String sampleId); +} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/StorageCellMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/StorageCellMapper.java new file mode 100644 index 0000000..5c99ecd --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/StorageCellMapper.java @@ -0,0 +1,27 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.imr.entity.StorageCell; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe Mapper 类 + */ +@Mapper +public interface StorageCellMapper extends BaseMapper { + + /* + 格子分页 + */ + IPage getStorageCellPage(@Param("page") Page page,@Param(Constants.WRAPPER) QueryWrapper qw); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/StorageCupboardMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/StorageCupboardMapper.java new file mode 100644 index 0000000..fb4a2f0 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/StorageCupboardMapper.java @@ -0,0 +1,26 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.imr.entity.StorageCupboard; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe Mapper 类 + */ +@Mapper +public interface StorageCupboardMapper extends BaseMapper { + + List getStorageCupboardList(@Param(Constants.WRAPPER)QueryWrapper orderByDesc); + + IPage getStorageCupboardPage(@Param("page") Page page,@Param(Constants.WRAPPER) QueryWrapper orderByDesc); +} diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/StorageRoomMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/StorageRoomMapper.java new file mode 100644 index 0000000..0b43501 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/mapper/StorageRoomMapper.java @@ -0,0 +1,26 @@ +package digital.laboratory.platform.imr.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import digital.laboratory.platform.imr.entity.StorageRoom; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Mapper 接口 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe Mapper 类 + */ +@Mapper +public interface StorageRoomMapper extends BaseMapper { + + + + List getStorageRoomList(@Param(Constants.WRAPPER) QueryWrapper qw); + + List getStorageRoomPage(@Param(Constants.WRAPPER)QueryWrapper orderByDesc); +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/AssociationOpenService.java b/src/main/java/digital/laboratory/platform/imr/service/AssociationOpenService.java new file mode 100644 index 0000000..1f794b3 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/AssociationOpenService.java @@ -0,0 +1,9 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.imr.entity.AssociationOpen; +import digital.laboratory.platform.imr.entity.CabinetOpeningRecord; + +public interface AssociationOpenService extends IService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/CabinetOpeningRecordService.java b/src/main/java/digital/laboratory/platform/imr/service/CabinetOpeningRecordService.java new file mode 100644 index 0000000..785772b --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/CabinetOpeningRecordService.java @@ -0,0 +1,30 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.DepositToDTO; +import digital.laboratory.platform.imr.dto.UseOutboundDTO; +import digital.laboratory.platform.imr.entity.CabinetOpeningRecord; +import digital.laboratory.platform.imr.entity.DestructionPublicity; +import digital.laboratory.platform.imr.vo.CabinetSampleVO; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +public interface CabinetOpeningRecordService extends IService { + List scanCode(String number); + + void scanCodePromptInbound(DepositToDTO dto, DLPUser dlpUser); + + void scanCodePromptOutbound(UseOutboundDTO dto, DLPUser dlpUser); + + void forceOpen(UseOutboundDTO dto, DLPUser dlpUser); + + List querySampleByCode(String code,String roomNo); + + void useOutbound(UseOutboundDTO dto, DLPUser dlpUser); + + List batchScanCode(String number); + + void updateSampleQuality(String sampleId, double sampleQuality); +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/DestructionPublicityService.java b/src/main/java/digital/laboratory/platform/imr/service/DestructionPublicityService.java new file mode 100644 index 0000000..0a9d20c --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/DestructionPublicityService.java @@ -0,0 +1,31 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.DestructionPublicityDTO; +import digital.laboratory.platform.imr.entity.DestructionPublicity; +import digital.laboratory.platform.imr.vo.DestructionPublicityVO; + +/** + * 服务类 + * + * @author Zhang Xiaolong created at 2023-03-23 + * @describe 服务类 + */ +public interface DestructionPublicityService extends IService { + + DestructionPublicityVO createPublicity(DestructionPublicityDTO dto, DLPUser dlpUser); + + DestructionPublicityVO updatePublicity(DestructionPublicityDTO dto, DLPUser dlpUser); + + void deleteOneById(String id); + + IPage getDestructionPublicityPage(Page page, QueryWrapper eq); + + DestructionPublicity getOneById(String id); + + DestructionPublicity release(String id); +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java b/src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java new file mode 100644 index 0000000..e6b7217 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java @@ -0,0 +1,13 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.imr.entity.DrugCaseInfo; + +/** +* @author ChenJiangBao +* @description 针对表【b_drug_case_info(毒品库中关联的案事件信息)】的数据库操作Service +* @createDate 2024-11-07 12:04:42 +*/ +public interface DrugCaseInfoService extends IService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java b/src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java new file mode 100644 index 0000000..a8eac62 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java @@ -0,0 +1,13 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.imr.entity.DrugMaterialInfo; + +/** +* @author ChenJiangBao +* @description 针对表【b_drug_material_info(毒品库中的毒品检材信息)】的数据库操作Service +* @createDate 2024-11-07 12:04:42 +*/ +public interface DrugMaterialInfoService extends IService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/OutWarehouseDetailedService.java b/src/main/java/digital/laboratory/platform/imr/service/OutWarehouseDetailedService.java new file mode 100644 index 0000000..9757197 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/OutWarehouseDetailedService.java @@ -0,0 +1,14 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.imr.entity.OutWarehouseDetailed; + +/** + * 出库明细服务类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 出库明细 服务类 + */ +public interface OutWarehouseDetailedService extends IService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/ReviewApprovalService.java b/src/main/java/digital/laboratory/platform/imr/service/ReviewApprovalService.java new file mode 100644 index 0000000..548d4d4 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/ReviewApprovalService.java @@ -0,0 +1,42 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.ReviewApprovalDTO; +import digital.laboratory.platform.imr.entity.SampleApply; +import digital.laboratory.platform.imr.vo.SampleApplyVO; + +import java.util.List; + +public interface ReviewApprovalService { + /** + * 一级审核 + * @param dto + * @param dlpUser + * @return + */ + SampleApplyVO firstAudit(ReviewApprovalDTO dto, DLPUser dlpUser); + + /** + * 二级审核 + * @param dto + * @param dlpUser + * @return + */ + SampleApplyVO secondaryAudit(ReviewApprovalDTO dto, DLPUser dlpUser); + + + /** + * 审批 + * @param dto + * @param dlpUser + * @return + */ + SampleApplyVO approval(ReviewApprovalDTO dto, DLPUser dlpUser); + + //IPage getAuditPage(Page page, QueryWrapper qw); + + //List getAuditList(QueryWrapper qw); +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/SampleApplyService.java b/src/main/java/digital/laboratory/platform/imr/service/SampleApplyService.java new file mode 100644 index 0000000..1df6325 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/SampleApplyService.java @@ -0,0 +1,42 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.ApplyDTO; +import digital.laboratory.platform.imr.entity.SampleApply; +import digital.laboratory.platform.imr.vo.SampleApplyVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 检材申请实体类服务类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 检材申请实体类 服务类 + */ +public interface SampleApplyService extends IService { + + + SampleApplyVO createAndSave(ApplyDTO dto, DLPUser dlpUser); + + SampleApplyVO getDetail(String id); + + SampleApplyVO createAndSubmit(ApplyDTO dto, DLPUser dlpUser); + + SampleApplyVO submitApplyOne(String id); + + IPage getApplyPage(Page page,QueryWrapper orderByDesc); + + SampleApplyVO withdrawalOne(String id); + + void deleteOne(String id); + + SampleApplyVO updateAndSubmit(ApplyDTO dto, DLPUser dlpUser); + + SampleApplyVO updateAndSave(ApplyDTO dto, DLPUser dlpUser); +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/SampleInboundAndOutboundTableService.java b/src/main/java/digital/laboratory/platform/imr/service/SampleInboundAndOutboundTableService.java new file mode 100644 index 0000000..11614bd --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/SampleInboundAndOutboundTableService.java @@ -0,0 +1,14 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.imr.entity.SampleInboundAndOutboundTable; + +/** + * 服务类 + * + * @author Zhang Xiaolong created at 2023-03-21 + * @describe 服务类 + */ +public interface SampleInboundAndOutboundTableService extends IService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/SampleOutWarehouseApplyService.java b/src/main/java/digital/laboratory/platform/imr/service/SampleOutWarehouseApplyService.java new file mode 100644 index 0000000..1a9b915 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/SampleOutWarehouseApplyService.java @@ -0,0 +1,65 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.OutWarehouseApplyDTO; +import digital.laboratory.platform.imr.dto.VerificationCode; +import digital.laboratory.platform.imr.entity.SampleOutWarehouseApply; +import digital.laboratory.platform.imr.vo.SampleOutWarehouseApplyVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 样本出库申请实体类服务类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 样本出库申请实体类 服务类 + */ +public interface SampleOutWarehouseApplyService extends IService { + + SampleOutWarehouseApplyVO createOutApply(OutWarehouseApplyDTO dto, DLPUser dlpUser); + + /** + * 根据出库申请id查询单个出库信息 + * 出库信息+出库样本明细 + * + * @param id + * @return + */ + SampleOutWarehouseApplyVO getOutWarehouseDetailedById(String id); + + IPage getSampleOutWarehouseApplyVOList(@Param(Constants.WRAPPER) QueryWrapper qw); + + IPage getSampleOutWarehouseApplyVOPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper qw); + + SampleOutWarehouseApplyVO confirmOutbound(VerificationCode dto, DLPUser dlpUser); + + SampleOutWarehouseApplyVO getInfoByCode(@Param("code") String code); + + + + + /** + * 出库申请第二版 + * + * @param dto + * @param dlpUser + * @return + */ + SampleOutWarehouseApplyVO createOutRepositoryApply(OutWarehouseApplyDTO dto, DLPUser dlpUser); + + /** + * 领用出库确认 + * + * @param id + * @return + */ + SampleOutWarehouseApplyVO reconfirmApply(String id, String userId); + + String buildEventImLabelContent(String code); +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/SampleOutWarehouseService.java b/src/main/java/digital/laboratory/platform/imr/service/SampleOutWarehouseService.java new file mode 100644 index 0000000..937f2b8 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/SampleOutWarehouseService.java @@ -0,0 +1,31 @@ +package digital.laboratory.platform.imr.service; + + +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.DestroyOutboundDTO; +import digital.laboratory.platform.imr.dto.ReturnOutboundDTO; + +import java.util.List; + +/** + * + * 自定义出库业务层 + */ +public interface SampleOutWarehouseService { + + + /** + * 销毁出库 + * @param sampleIds + * @param dlpUser + */ + + void destroyOutbound(DestroyOutboundDTO dto, DLPUser dlpUser); + + /** + * 退还出库 + * @param dto + * @param dlpUser + */ + void returnOutbound(ReturnOutboundDTO dto, DLPUser dlpUser); +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/SamplePutInStorageService.java b/src/main/java/digital/laboratory/platform/imr/service/SamplePutInStorageService.java new file mode 100644 index 0000000..3eee4ba --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/SamplePutInStorageService.java @@ -0,0 +1,95 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.DepositDTO; +import digital.laboratory.platform.imr.dto.IconDTO; +import digital.laboratory.platform.imr.dto.InRepositoryDTO; +import digital.laboratory.platform.imr.entity.SampleInboundRecord; +import digital.laboratory.platform.imr.entity.SampleStorage; +import digital.laboratory.platform.imr.vo.InboundRecordVO; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import digital.laboratory.platform.imr.vo.RepositorySampleVO; + +import java.util.List; +import java.util.Map; + +/** + * + * 自定义入库业务层 + */ +public interface SamplePutInStorageService { + + /** + * 第二种录入仓库 + * 样本为基本单位 + * @param sampleNos + * @param dlpUser + * @return + */ + List sampleEntryRepository(List sampleNos, DLPUser dlpUser); + + /** + * 扫描样本编号获取数据 + * @param sampleNo + * @return + */ + List getSampleListByNo(String sampleNo); + + + /** + * 第三种样本入库(手动填入入库质量/体积;计量单位) + * @param sample + * @param dlpUser + * @return + */ + List sampleInRepository(List sample, DLPUser dlpUser); + + + /** + * 检材/样本存放 + * @param dto + * @return + */ + List sampleDepositRepository(DepositDTO dto); + + /** + * 销毁预警查询接口 + * @param page + * @param orderByDesc + * @return + */ + IPage getDestructionVO(Page page, QueryWrapper orderByDesc); + + /** + * 查询单个已录入详情接口 + * @param id + * @return + */ + RepositorySampleVO getSampleDetailed(String id); + + IPage getSampleVOList(Page page, QueryWrapper orderByDesc); + + IPage inboundRecord(Page page, QueryWrapper createTime); + + + //流转模块角标总和 + IconDTO getTransferIconCount(String id); + + void updateSampleQuality(String sampleId, double sampleQuality); + + /** + * 临时处理样本入库 + * @param vos + * @param user + */ + void temporaryProcessSampleIn(List vos, DLPUser user); + + /** + * 一个检材入库时的可选检材列表 + */ + Map> choseSampleList(String keyWords); + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/StorageCellService.java b/src/main/java/digital/laboratory/platform/imr/service/StorageCellService.java new file mode 100644 index 0000000..66be785 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/StorageCellService.java @@ -0,0 +1,14 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.imr.entity.StorageCell; + +/** + * 服务类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 服务类 + */ +public interface StorageCellService extends IService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/StorageCupboardService.java b/src/main/java/digital/laboratory/platform/imr/service/StorageCupboardService.java new file mode 100644 index 0000000..f8bdc7a --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/StorageCupboardService.java @@ -0,0 +1,14 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.imr.entity.StorageCupboard; + +/** + * 服务类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 服务类 + */ +public interface StorageCupboardService extends IService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/StorageRoomService.java b/src/main/java/digital/laboratory/platform/imr/service/StorageRoomService.java new file mode 100644 index 0000000..193a6f1 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/StorageRoomService.java @@ -0,0 +1,19 @@ +package digital.laboratory.platform.imr.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import digital.laboratory.platform.imr.entity.StorageRoom; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 服务类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 服务类 + */ +public interface StorageRoomService extends IService { + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/AssociationOpenServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/AssociationOpenServiceImpl.java new file mode 100644 index 0000000..2aa2f44 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/AssociationOpenServiceImpl.java @@ -0,0 +1,20 @@ +package digital.laboratory.platform.imr.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.imr.entity.AssociationOpen; +import digital.laboratory.platform.imr.mapper.AssociationOpenMapper; +import digital.laboratory.platform.imr.service.AssociationOpenService; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.Map; +import java.util.function.Function; + +@Service +public class AssociationOpenServiceImpl extends ServiceImpl implements AssociationOpenService { + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/CabinetOpeningRecordServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/CabinetOpeningRecordServiceImpl.java new file mode 100644 index 0000000..d34d2bd --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/CabinetOpeningRecordServiceImpl.java @@ -0,0 +1,764 @@ +package digital.laboratory.platform.imr.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.DepositToDTO; +import digital.laboratory.platform.imr.dto.SampleInfo; +import digital.laboratory.platform.imr.dto.UseOutboundDTO; +import digital.laboratory.platform.imr.entity.*; +import digital.laboratory.platform.imr.entity.enums.OutApplyStatus; +import digital.laboratory.platform.imr.entity.enums.OutboundType; +import digital.laboratory.platform.imr.feign.TransferFeignService; +import digital.laboratory.platform.imr.feign.dto.UpdateHolderDTO; +import digital.laboratory.platform.imr.mapper.*; +import digital.laboratory.platform.imr.service.CabinetOpeningRecordService; +import digital.laboratory.platform.imr.vo.BaseSampleDetail; +import digital.laboratory.platform.imr.vo.CabinetSampleVO; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import digital.laboratory.platform.sys.entity.CellAndStoreSupplyData; +import digital.laboratory.platform.sys.feign.RemoteCabinetService; +import io.seata.spring.annotation.GlobalTransactional; +import lombok.AllArgsConstructor; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestBody; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + + +@Service +@AllArgsConstructor +public class CabinetOpeningRecordServiceImpl extends ServiceImpl implements CabinetOpeningRecordService { + + + public final CabinetOpeningRecordMapper openingRecordMapper; + + public final SampleStorageMapper storageMapper; + + private final SampleOutboundRecordMapper outboundRecordMapper; + + public final OutWarehouseDetailedMapper outWarehouseDetailedMapper; + + + public final SampleOutWarehouseApplyMapper outWarehouseApplyMapper; + + + private final SampleInboundAndOutboundTableMapper tableMapper; + + + private final RemoteCabinetService cabinetService; + + private final TransferFeignService transferFeignService; + + private static final PasswordEncoder ENCODER = new org.springframework.security.crypto.password.MessageDigestPasswordEncoder("MD5"); + + + private final SampleInboundRecordMapper recordMapper; + + //扫码查询 + @Override + public List scanCode(String number) { + + List vo = openingRecordMapper.scanCode(number); + + if (vo == null || vo.size() == 0) { + throw new RuntimeException("当前物品未查询出入库信息,请检查是否已入库"); + } + String eventName = ""; + + switch (vo.get(0).getSource()) { + case "entrustment": + //委托 + if (vo.get(0).getQuality() == 0.0) { + //没查询到就赋值现有质量 + vo.get(0).setQuality(storageMapper.getQuality(vo.get(0).getSampleId())); + } + eventName = storageMapper.getEntrustmentName(vo.get(0).getSampleId()); + break; + case "hairJob": + //毛发 + eventName = storageMapper.getHairJobName(vo.get(0).getSampleId()); + break; + case "sewageJob": + //污水 + eventName = storageMapper.getSewageJobName(vo.get(0).getSampleId()); + break; + case "internal": + //内部录入 + eventName = storageMapper.getEventName(vo.get(0).getSampleId()); + break; + default: + //特征分析 + eventName = storageMapper.getFeatureName(vo.get(0).getSampleId()); + break; + } + //其他来源 + for (CabinetSampleVO cabinetSampleVO : vo) { + cabinetSampleVO.setEventName(eventName); + } + + + /* //判断当前是否存储 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("sample_id",vo.getSampleId()); + + SampleStorage storage = storageMapper.selectOne(queryWrapper); + if(storage==null || storage.getStatus()==3){ + //未入库 + vo.setIdentifying(false); + } else { + vo.setIdentifying(true); + //为了返显库存位置 + vo.setStorageLocation(storage.getStorageLocation()); + vo.setCabinetName(storage.getCabinetName()); + vo.setStorageCellId(storage.getStorageCellId()); + vo.setBuildingLv(storage.getBuildingLv()); + vo.setBoxId(storage.getBoxId()); + vo.setRoomNo(storage.getRoomNo()); + } +*/ + return vo; + } + + + /* + 推荐入库 + */ + @Override + @GlobalTransactional + public void scanCodePromptInbound(DepositToDTO dto, DLPUser dlpUser) { + List sampleInfo = dto.getSampleInfo(); + + ArrayList list = new ArrayList<>(); + + String applyPerson = "无"; + + for (SampleInfo sample : sampleInfo) { + + OutSampleVO sampleDetailInfo = storageMapper.getSampleById(sample.getSampleId()); + + applyPerson = storageMapper.getUserName(sampleDetailInfo.getHolder()); + //先查询判断是不是第一次存储 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("sample_id", sample.getSampleId()); + SampleStorage storage = storageMapper.selectOne(queryWrapper); + if (storage == null) { + SampleStorage sampleStorage = new SampleStorage(); + sampleStorage.setId(IdWorker.get32UUID().toUpperCase()); + sampleStorage.setName(sample.getSampleName()); + sampleStorage.setSampleId(sample.getSampleId()); + sampleStorage.setStorageDate(LocalDateTime.now().plusYears(10)); + sampleStorage.setEarlyWarning(0);//暂时不销毁 + sampleStorage.setStatus(2);//已经入库 + sampleStorage.setDepositorId(dlpUser.getId());//存放人id + sampleStorage.setInRepositoryDate(LocalDateTime.now());//入库时间 + sampleStorage.setSampleType(sampleDetailInfo.getSampleType());//A/B + + sampleStorage.setBuildingLv(dto.getBuildingLv()); + sampleStorage.setRoomNo(dto.getRoomNo()); + sampleStorage.setStorageCellId(dto.getCellId()); + sampleStorage.setCabinetName(dto.getCabinetName()); + sampleStorage.setBoxId(dto.getBoxId()); + sampleStorage.setStorageLocation(dto.getStorageLocation()); + + //数据添加 + storageMapper.insert(sampleStorage); + } else { + if (storage.getStatus() == 2) { + throw new RuntimeException("当前:" + storage.getName() + "的样本已经入库,切勿重复入库"); + } + storage.setStorageDate(LocalDateTime.now().plusYears(10)); + storage.setEarlyWarning(0);//暂时不销毁 + storage.setStatus(2);//已经入库 + storage.setDepositorId(dlpUser.getId());//存放人id + storage.setInRepositoryDate(LocalDateTime.now());//入库时间 + + storage.setBuildingLv(dto.getBuildingLv()); + storage.setRoomNo(dto.getRoomNo()); + storage.setStorageCellId(dto.getCellId()); + storage.setCabinetName(dto.getCabinetName()); + storage.setBoxId(dto.getBoxId()); + storage.setStorageLocation(dto.getStorageLocation()); + + //数据修改 + storageMapper.updateById(storage); + } + + //流转表 + transferFeignService.addTransferByInbound(sample.getSampleId(), dlpUser.getId()); + + //持有人 + UpdateHolderDTO updateHolderDTO = new UpdateHolderDTO(); + updateHolderDTO.setHolder(dlpUser.getId()); + updateHolderDTO.setSampleId(sample.getSampleId()); + transferFeignService.updateSampleHolder(updateHolderDTO); + + + //更新出入库登记表(这里因为只有入库,所以就创建部分数据;入库一定是添加数据) + List tables = tableMapper.selectList(Wrappers.lambdaQuery().eq(SampleInboundAndOutboundTable::getSampleId, sample.getSampleId()).orderByDesc(SampleInboundAndOutboundTable::getCreateTime)); + //证明之前已经入库过了,我们将这个入库时间赋值到新增的出入库登记表中 + if (tables != null && tables.size() > 0) { + SampleInboundAndOutboundTable sampleInboundAndOutboundTable = tables.get(0); + if (sampleInboundAndOutboundTable.getReturnTime() == null) { + sampleInboundAndOutboundTable.setReturnTime(LocalDateTime.now()); + } + tableMapper.updateById(sampleInboundAndOutboundTable); + SampleInboundAndOutboundTable table = new SampleInboundAndOutboundTable(); + table.setWarehousingDate(LocalDateTime.now());//入库时间 + table.setId(IdWorker.get32UUID().toUpperCase()); + table.setImAdministrators(dto.getSupervisorId()); + table.setRecipient(sampleDetailInfo.getHolder());//持有人变入库人 + table.setRemarks("检材入库"); + table.setSampleId(sample.getSampleId()); + table.setInboundSupervisor(dto.getSupervisorId());//入库监督人 + tableMapper.insert(table); + } +// table.setWarehousingDate(sampleInboundAndOutboundTable.getWarehousingDate());//入库时间 + else { + SampleInboundAndOutboundTable table = new SampleInboundAndOutboundTable(); + table.setWarehousingDate(LocalDateTime.now());//入库时间 + table.setId(IdWorker.get32UUID().toUpperCase()); + table.setImAdministrators(dto.getSupervisorId()); + table.setRecipient(sampleDetailInfo.getHolder());//持有人变入库人 + table.setRemarks("检材入库"); + table.setSampleId(sample.getSampleId()); + table.setInboundSupervisor(dto.getSupervisorId());//入库监督人 + tableMapper.insert(table); + } + + + //入库记录 + SampleInboundRecord record = new SampleInboundRecord(); + record.setId(IdWorker.get32UUID().toUpperCase()); + record.setWarehousingPersonId(dlpUser.getId());//入库人id + record.setWarehousingDate(LocalDateTime.now()); + record.setImAdministrators(dlpUser.getId()); + record.setSampleId(sample.getSampleId()); + record.setName(sample.getSampleName()); + record.setRemarks("检材入库"); + recordMapper.insert(record); + + //3.b_sample样本状态为已入库 + transferFeignService.updateStatus(sample.getSampleId(), 2); + + list.add(sample.getSampleId()); + + + //修改质量 + openingRecordMapper.updateSampleQuality(sample.getSampleId() + , sample.getQuality()); + } + + + /* + 柜子新接口 + */ + CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); + cellAndStoreSupplyData.setCellId(dto.getCellId());//格子id + cellAndStoreSupplyData.setCellStatus(dto.getCellStatus());//格子状态 + cellAndStoreSupplyData.setStoreSupplyList(list);//样本id + + //cabinetService.updateCabinet(dto.getCellId(),str,"1"); + ArrayList supplyData = new ArrayList<>(); + supplyData.add(cellAndStoreSupplyData); + cabinetService.takeOrSaveGoodsFromCabinet(supplyData, 1); + + + /* + 柜子开锁 + */ + ArrayList cellIds = new ArrayList<>(); + cellIds.add(dto.getCellId()); + cabinetService.openCabinetCellByIds(cellIds); + + + /* + 开箱记录 + */ + String userName = storageMapper.getUserName(dto.getSupervisorId()); + + CabinetOpeningRecord record = new CabinetOpeningRecord(); + record.setId(IdWorker.get32UUID(). + + toUpperCase()); + record.setOpenPurpose("检材入库"); + record.setApplyPerson(applyPerson);//申请人 + record.setOpenPerson(dlpUser.getName()); + record.setSupervisor(userName); + record.setStorageLocation(dto.getStorageLocation()); + record.setOpenTime(LocalDateTime.now()); + record.setOpenType("扫码开箱"); + record.setWarehouse(dto.getRoomNo());//这里先赋值房间号 + openingRecordMapper.insert(record); + + /* + 开箱记录关联表 + */ + + } + + + //推荐出库(单个) + @Override + @GlobalTransactional + public void scanCodePromptOutbound(UseOutboundDTO dto, DLPUser dlpUser) { + + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("sample_id", dto.getSampleId()); + SampleStorage storage = storageMapper.selectOne(queryWrapper); + + OutSampleVO sampleDetailInfo = storageMapper.getSampleById(storage.getSampleId()); + + //修改样本存储 + storage.setStatus(3); + storage.setRecipientId(dlpUser.getId());// + storage.setOutRepositoryDate(LocalDateTime.now());//出库时间 + storage.setIsReturn(-1);//不需要归还 + + storageMapper.updateById(storage); + + //流转表 + transferFeignService.addTransferByOut(dto.getSampleId(), dlpUser.getId()); + + //持有人 + UpdateHolderDTO updateHolderDTO = new UpdateHolderDTO(); + updateHolderDTO.setHolder(dlpUser.getId()); + updateHolderDTO.setSampleId(dto.getSampleId()); + transferFeignService.updateSampleHolder(updateHolderDTO); + + + //2.修改样本出入库登记表--出库是修改操作先查询出sample对应的出入库登记表 + //程序文件中说明:检验时才填写出入库登记表 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("sample_id", dto.getSampleId()); + wrapper.isNull("out_warehouse_date");//出库日期的数据 + SampleInboundAndOutboundTable table = tableMapper.selectOne(wrapper); + if (table != null) { + table.setOutboundSupervisor(dto.getSupervisorId());//出库监督人 + table.setOutWarehouseDate(LocalDateTime.now());//出库时间 + tableMapper.updateById(table); + } + + //2.出库记录 + SampleOutboundRecord sampleOutboundRecord = new SampleOutboundRecord(); + sampleOutboundRecord.setId(IdWorker.get32UUID().toUpperCase()); + sampleOutboundRecord.setOutboundType(OutboundType.SCANCODE);//扫码出库 + sampleOutboundRecord.setName(storage.getName());//样本名称--方便搜索 + sampleOutboundRecord.setRecipientId(dlpUser.getId());//领取人id + sampleOutboundRecord.setSampleId(dto.getSampleId()); + + + //后面的备注--当前样本已经销毁"+"销毁单位:"+xxx + sampleOutboundRecord.setReason("扫码单个出库");//把出库原因设置为备注 + sampleOutboundRecord.setOutboundDate(LocalDateTime.now());//出库时间 + outboundRecordMapper.insert(sampleOutboundRecord); + + //3.b_sample样本状态为出库 + transferFeignService.updateStatus(dto.getSampleId(), 1); + + + ArrayList list = new ArrayList<>(); + list.add(dto.getSampleId()); + + /* + 柜子存储数据新接口 + */ + CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); + cellAndStoreSupplyData.setCellId(storage.getStorageCellId());//格子id + cellAndStoreSupplyData.setCellStatus("1");//格子状态 + cellAndStoreSupplyData.setStoreSupplyList(list);//样本id + + //cabinetService.updateCabinet(dto.getCellId(),str,"1"); + ArrayList supplyData = new ArrayList<>(); + supplyData.add(cellAndStoreSupplyData); + cabinetService.takeOrSaveGoodsFromCabinet(supplyData, -1); + + + /* + 柜子开锁 + */ + ArrayList cellIds = new ArrayList<>(); + cellIds.add(storage.getStorageCellId()); + cabinetService.openCabinetCellByIds(cellIds); + + + /* + 开箱记录 + */ + + String userName = storageMapper.getUserName(dto.getSupervisorId()); + + CabinetOpeningRecord record1 = new CabinetOpeningRecord(); + record1.setId(IdWorker.get32UUID().toUpperCase()); + record1.setOpenPurpose("检材出库"); + record1.setApplyPerson(dlpUser.getName()); + record1.setOpenPerson(dlpUser.getName()); + record1.setSupervisor(userName); + record1.setStorageLocation(storage.getStorageLocation()); + record1.setOpenTime(LocalDateTime.now()); + record1.setOpenType("扫码开箱"); + record1.setWarehouse(storage.getRoomNo());//这里先赋值房间号 + openingRecordMapper.insert(record1); + /* + 开箱记录关联表 + */ + } + + /* + 强制开箱 + */ + @Override + @GlobalTransactional + public void forceOpen(UseOutboundDTO dto, DLPUser dlpUser) { + + + /* + 开箱记录 + */ + String userName = storageMapper.getUserName(dto.getSupervisorId()); + + + CabinetOpeningRecord record1 = new CabinetOpeningRecord(); + record1.setId(IdWorker.get32UUID().toUpperCase()); + record1.setOpenPurpose("检材出库"); + record1.setApplyPerson("无"); + record1.setOpenPerson(dlpUser.getName()); + record1.setSupervisor(userName); + record1.setStorageLocation(dto.getLocation()); + record1.setOpenTime(LocalDateTime.now()); + record1.setOpenType("强制开箱"); + record1.setWarehouse(dto.getRoomNo());//这里先赋值房间号 + openingRecordMapper.insert(record1); + + ArrayList cellIds = new ArrayList<>(); + + //说明要开的柜子是改造柜,因为改造柜的柜子没有ID,所以我们要去获得柜子中某一个盒子的ID,用于开箱 + if (dto.getType() != null && dto.getType() == 3 && StrUtil.isNotBlank(dto.getCabinetId()) && dto.getNumber() != null) { + + try { + R data = cabinetService.getCellId(dto.getCabinetId(), dto.getNumber()); + String id = data.getData(); + cellIds.add(id); + R r = cabinetService.openCabinetCellByIds(cellIds); + boolean ret = (boolean) r.getData(); + if (!ret) { + throw new RuntimeException(String.format("开箱失败")); + } + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(String.format("开箱失败")); + } + } + //说明只想开柜子 + else { + cellIds.add(dto.getCellId()); + R r = cabinetService.openCabinetCellByIds(cellIds); + boolean ret = (boolean) r.getData(); + if (!ret) { + throw new RuntimeException(String.format("开箱失败")); + } + } + + } + + + //取检码查询 + @Override + public List querySampleByCode(String code, String roomNo) { + //先通过取检码查询数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("sample_code_number", code); + SampleOutWarehouseApply apply = outWarehouseApplyMapper.selectOne(queryWrapper); + + if (apply == null || apply.getStatus() != OutApplyStatus.SUCCESS) { + throw new RuntimeException("当前取检码无效"); + } + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("apply_id", apply.getId()); + List detailedList = outWarehouseDetailedMapper.selectList(wrapper); + + List sampleVOS = new ArrayList<>(); + for (OutWarehouseDetailed detailed : detailedList) { + CabinetSampleVO vo = openingRecordMapper.getSampleById(detailed.getSampleId()); + if (!vo.getRoomNo().equals(roomNo)) { + throw new RuntimeException("当前取检码只在:" + vo.getRoomNo() + "房间生效"); + } + String eventName = ""; + switch (vo.getSource()) { + case "entrustment": + //委托 + eventName = storageMapper.getEntrustmentName(vo.getSampleId()); + break; + case "hairJob": + //毛发 + eventName = storageMapper.getHairJobName(vo.getSampleId()); + break; + case "sewageJob": + //污水 + eventName = storageMapper.getSewageJobName(vo.getSampleId()); + break; + case "internal": + //内部录入 + eventName = storageMapper.getEventName(vo.getSampleId()); + break; + default: + //特征分析 + eventName = storageMapper.getFeatureName(vo.getSampleId()); + break; + } + //其他来源 + vo.setEventName(eventName); + + sampleVOS.add(vo); + Collections.sort(sampleVOS, new Comparator() { + @Override + public int compare(CabinetSampleVO o1, CabinetSampleVO o2) { + String[] split1 = o1.getSampleNo().split("-"); + String[] split2 = o2.getSampleNo().split("-"); + // 先比较年份 + int yearComparison = split2[0].compareTo(split1[0]); + if (yearComparison != 0) { + return yearComparison; + } + // 再比较序号 + int num1 = Integer.parseInt(split2[1]); + int num2 = Integer.parseInt(split1[1]); + if (num1 - num2 != 0) { + return num1 - num2; + } + // 再比较尾号 + int num3 = Integer.parseInt(split1[2]); + int num4 = Integer.parseInt(split2[2]); + return num3 - num4; + } + }); + } + + return sampleVOS; + } + + + /* + 领用出库 + */ + @Override + @GlobalTransactional + public void useOutbound(UseOutboundDTO dto, DLPUser dlpUser) { + //通过取检码查询数据 + //先通过取检码查询数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("sample_code_number", dto.getCode()); + SampleOutWarehouseApply apply = outWarehouseApplyMapper.selectOne(queryWrapper); + + //0.修改当前领用出库申请状态为已使用 + apply.setStatus(OutApplyStatus.ALREADY_USED); + apply.setSampleCodeNumber(apply.getSampleCodeNumber() + "(已使用)"); + outWarehouseApplyMapper.updateById(apply); + ArrayList storages = new ArrayList<>(); + + //通过样本id循环查询并修改和改变其他逻辑 + + ArrayList cellIds = new ArrayList<>(); + + for (String sampleId : dto.getSampleIds()) { + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("sample_id", sampleId); + SampleStorage sample = storageMapper.selectOne(wrapper); + storages.add(sample); + + if (!cellIds.contains(sample.getStorageCellId())) { + + cellIds.add(sample.getStorageCellId()); + } + + //修改样本存储 + sample.setStatus(3); + sample.setRecipientId(dlpUser.getId());//领取人 + sample.setOutRepositoryDate(LocalDateTime.now());//出库时间 + sample.setIsReturn(1);//需要归还 + sample.setReturnTime(apply.getReturnDate());//归还时间 + sample.setPurpose(apply.getPurpose());//出库用途 + storageMapper.updateById(sample); + + + //流转表 + transferFeignService.addTransferByInbound(sample.getSampleId(), dlpUser.getId()); + + //持有人 + UpdateHolderDTO updateHolderDTO = new UpdateHolderDTO(); + updateHolderDTO.setHolder(dlpUser.getId()); + updateHolderDTO.setSampleId(sample.getSampleId()); + transferFeignService.updateSampleHolder(updateHolderDTO); + + + //2.修改样本出入库登记表--出库是修改操作先查询出sample对应的出入库登记表 + //程序文件中说明:检验时才填写出入库登记表 + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("sample_id", sample.getSampleId()); + wrapper1.isNull("out_warehouse_date");//出库日期的数据 + SampleInboundAndOutboundTable table = tableMapper.selectOne(wrapper1); + if (table != null) { + table.setOutboundSupervisor(dto.getSupervisorId());//出库监督人 + table.setOutWarehouseDate(LocalDateTime.now());//出库时间 + table.setAppraiserId(dlpUser.getId()); + tableMapper.updateById(table); + } + + //2.出库记录 + SampleOutboundRecord sampleOutboundRecord = new SampleOutboundRecord(); + sampleOutboundRecord.setId(IdWorker.get32UUID().toUpperCase()); + sampleOutboundRecord.setOutboundType(OutboundType.USE);//领用出库 + sampleOutboundRecord.setName(sample.getName());//样本名称--方便搜索 + sampleOutboundRecord.setRecipientId(dlpUser.getId());//领取人id + sampleOutboundRecord.setSampleId(sample.getSampleId()); + + //3.b_sample样本状态为已经出库 + transferFeignService.updateStatus(sample.getSampleId(), 1); + + /* + 柜子存储数据新接口 + */ + + + } + ArrayList supplyData = new ArrayList<>(); + for (SampleStorage storage : storages) { + ArrayList strings = new ArrayList<>(); + CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); + cellAndStoreSupplyData.setCellId(storage.getStorageCellId());//格子id + cellAndStoreSupplyData.setCellStatus("1");//格子状态 + strings.add(storage.getSampleId()); + cellAndStoreSupplyData.setStoreSupplyList(strings);//样本id + //cabinetService.updateCabinet(dto.getCellId(),str,"1"); + supplyData.add(cellAndStoreSupplyData); + } + cabinetService.takeOrSaveGoodsFromCabinet(supplyData, -1); + + /* + 柜子开锁 + 这里要做cell的去重 + */ + cabinetService.openCabinetCellByIds(cellIds); + + String applyPerson = storageMapper.getUserName(apply.getApplicantId()); + + for (String cellId : cellIds) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("storage_cell_id", cellId); + List sampleStorages = storageMapper.selectList(wrapper); + + /* + 开箱记录 + */ + String userName = storageMapper.getUserName(dto.getSupervisorId()); + CabinetOpeningRecord record1 = new CabinetOpeningRecord(); + record1.setId(IdWorker.get32UUID().toUpperCase()); + record1.setOpenPurpose("检材出库"); + record1.setApplyPerson(applyPerson); + record1.setOpenPerson(dlpUser.getName()); + record1.setSupervisor(userName);//监督人姓名 + record1.setStorageLocation(sampleStorages.get(0).getStorageLocation()); + record1.setOpenTime(LocalDateTime.now()); + record1.setOpenType("取检码开柜"); + record1.setWarehouse(sampleStorages.get(0).getRoomNo());//这里先赋值房间号 + openingRecordMapper.insert(record1); + } + + } + + //批量入库查询接口 + @Override + public List batchScanCode(String number) { + + + List sampleVOS = openingRecordMapper.batchScanCode(number); + + + if (sampleVOS == null || sampleVOS.size() == 0) { + throw new RuntimeException("请检查当前样本是否为入库状态"); + } + + for (CabinetSampleVO vo : sampleVOS) { + String eventName = ""; + switch (vo.getSource()) { + case "entrustment": + //委 + eventName = storageMapper.getEntrustmentName(vo.getSampleId()); + if (vo.getQuality() == 0.0) { + //没查询到就赋值现有质量 + vo.setQuality(storageMapper.getQuality(vo.getSampleId())); + } + break; + case "hairJob": + //毛发 + eventName = storageMapper.getHairJobName(vo.getSampleId()); + break; + case "sewageJob": + //污水 + eventName = storageMapper.getSewageJobName(vo.getSampleId()); + break; + case "internal": + //内部录入 + eventName = storageMapper.getEventName(vo.getSampleId()); + break; + default: + //特征分析 + eventName = storageMapper.getFeatureName(vo.getSampleId()); + break; + } + //其他来源 + vo.setEventName(eventName); + } + boolean isE = true; + for (CabinetSampleVO sampleVO : sampleVOS) { + if (!sampleVO.getSource().equals("entrustment")) { + isE = false; + } + } + if (isE) { + Collections.sort(sampleVOS, new Comparator() { + @Override + public int compare(CabinetSampleVO o1, CabinetSampleVO o2) { + String[] split1 = o1.getSampleNo().split("-"); + String[] split2 = o2.getSampleNo().split("-"); + // 先比较年份 + int yearComparison = split2[0].compareTo(split1[0]); + if (yearComparison != 0) { + return yearComparison; + } + // 再比较序号 + int num1 = Integer.parseInt(split2[1]); + int num2 = Integer.parseInt(split1[1]); + if (num1 - num2 != 0) { + return num1 - num2; + } + // 再比较尾号 + int num3 = Integer.parseInt(split1[2]); + int num4 = Integer.parseInt(split2[2]); + return num3 - num4; + } + }); + } + + return sampleVOS; + } + + //修改样本质量 + @Override + public void updateSampleQuality(String sampleId, double sampleQuality) { + openingRecordMapper.updateSampleQuality(sampleId, sampleQuality); + } +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/DestructionPublicityServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/DestructionPublicityServiceImpl.java new file mode 100644 index 0000000..0ba4331 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/DestructionPublicityServiceImpl.java @@ -0,0 +1,232 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.DestructionPublicityDTO; +import digital.laboratory.platform.imr.entity.DestructionDetail; +import digital.laboratory.platform.imr.entity.DestructionPublicity; +import digital.laboratory.platform.imr.entity.SampleApplyDetailed; +import digital.laboratory.platform.imr.entity.enums.ReleaseStatus; +import digital.laboratory.platform.imr.feign.TransferFeignService; +import digital.laboratory.platform.imr.feign.dto.UpdateHolderDTO; +import digital.laboratory.platform.imr.mapper.DestructionDetailMapper; +import digital.laboratory.platform.imr.mapper.DestructionPublicityMapper; +import digital.laboratory.platform.imr.mapper.SampleApplyMapper; +import digital.laboratory.platform.imr.service.DestructionPublicityService; +import digital.laboratory.platform.imr.vo.DestructionPublicityVO; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import digital.laboratory.platform.imr.vo.StatusSampleVO; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 服务实现类 + * + * @author Zhang Xiaolong created at 2023-03-23 + * @describe 服务实现类 + */ +@Service +@RequiredArgsConstructor +public class DestructionPublicityServiceImpl extends ServiceImpl implements DestructionPublicityService { + + + private final DestructionPublicityMapper dpMapper; + + private final DestructionDetailMapper ddMapper; + + + private final TransferFeignService transferFeignService; + + + private final SampleApplyMapper asMapper; + + /** + * 创建 + * @param dto + * @param dlpUser + * @return + */ + @Override + @Transactional + public DestructionPublicityVO createPublicity(DestructionPublicityDTO dto, DLPUser dlpUser) { + + //创建主表(销毁与公示) + DestructionPublicity publicity = new DestructionPublicity(); + publicity.setId(IdWorker.get32UUID().toUpperCase()); + publicity.setReviewerId(dto.getReviewerId());//审批人 + publicity.setRemarks(dto.getRemarks());//备注 + publicity.setStatus(-1);//创建默认未发布 + publicity.setDestroyCompany(dto.getDestroyCompany());//销毁单位 + publicity.setApplicantId(dlpUser.getId());//申请人--检材管理员 + publicity.setDestroyQuantity(dto.getSampleIds().size());//数量 + publicity.setDestroyDate(dto.getDestroyDate());//销毁时间 + dpMapper.insert(publicity); + //创建副表(销毁样本明细) + List sampleIds = dto.getSampleIds(); + for (String sampleId : sampleIds) { + DestructionDetail detail = new DestructionDetail(); + detail.setSampleId(sampleId); + detail.setId(IdWorker.get32UUID().toUpperCase()); + detail.setDestructionId(publicity.getId()); + ddMapper.insert(detail); + } + return dpMapper.getPublicityVO(publicity.getId()); + } + + /** + * 修改以当前页面为准 + * 所以对副表修改时先删除在添加 + * @param dto + * @param dlpUser + * @return + */ + @Override + @Transactional + public DestructionPublicityVO updatePublicity(DestructionPublicityDTO dto, DLPUser dlpUser) { + + //先获取修改对象是否存在 + DestructionPublicity publicity = dpMapper.selectById(dto.getId()); + if(publicity==null){ + throw new RuntimeException(String.format("修改对象不存在")); + } + if(publicity.getStatus()!=-1){//未发布 + throw new RuntimeException(String.format("当前状态不可修改")); + } + //修改信息 + publicity.setRemarks(dto.getRemarks()); + publicity.setReviewerId(dto.getReviewerId()); + publicity.setDestroyDate(dto.getDestroyDate()); + publicity.setDestroyCompany(dto.getDestroyCompany()); + publicity.setDestroyQuantity(dto.getSampleIds().size()); + dpMapper.updateById(publicity); + //先删除 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("destruction_id",publicity.getId()); + ddMapper.delete(wrapper); + //再添加 + //副表 + List sampleIds = dto.getSampleIds(); + for (String sampleId : sampleIds) { + DestructionDetail detail = new DestructionDetail(); + detail.setSampleId(sampleId); + detail.setId(IdWorker.get32UUID().toUpperCase()); + detail.setDestructionId(publicity.getId()); + ddMapper.insert(detail); + } + return dpMapper.getPublicityVO(dto.getId()); + } + + /** + * 单个删除 + * @param id + * @return + */ + @Override + @Transactional + public void deleteOneById(String id) { + + //先通过id查询出 + DestructionPublicity destructionPublicity = dpMapper.selectById(id); + if(destructionPublicity==null) { + throw new RuntimeException(String.format("数据不存在")); + }else if(destructionPublicity.getStatus()==1){//已经发布 + throw new RuntimeException(String.format("当前状态不可删除")); + } + + //先删除副表 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("destruction_id",id); + ddMapper.delete(wrapper); + + //删除主表数据 + dpMapper.deleteById(id); + + } + + /** + * 销毁与公示分页查询 + * @param page + * @param + * @return + */ + @Override + public IPage getDestructionPublicityPage(Page page, QueryWrapper qw) { + return dpMapper.getDestructionPublicityPage(page,qw); + } + + /** + * 查询单个 + * @param id + * @return + */ + @Override + public DestructionPublicity getOneById(String id) { + //先获取单个vo + DestructionPublicityVO vo = dpMapper.getPublicityVO(id); + if(vo==null) { + throw new RuntimeException(String.format("数据不存在")); + } + //获取对应样本信息集合 + List publicityDetail = ddMapper.getPublicityDetail(id); + vo.setSampleVO(publicityDetail); + + return vo; + } + + /** + * 发布公示 + * @param id + * @return + */ + @Override + public DestructionPublicity release(String id) { + + DestructionPublicity publicity = dpMapper.selectById(id); + if(publicity==null){ + throw new RuntimeException(String.format("数据不存在")); + }else if (publicity.getStatus()==1){ + throw new RuntimeException(String.format("当前公示已经发布")); + } + + // 发布前判断当前样本是否已经在别的公示里面发布了 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("destruction_id",publicity.getId()); + List details = ddMapper.selectList(wrapper); + + for (DestructionDetail detail : details) { + StatusSampleVO sampleVO = asMapper.getSampleInfo(detail.getSampleId()); + if(sampleVO.getStatus() == 11){ + throw new RuntimeException(String.format("名称为:"+sampleVO.getName()+"的样本已在别的公示中发布;请勿重复提交")); + } + } + + + + publicity.setStatus(1);//发布状态 + publicity.setReleaseDate(LocalDateTime.now());//发布时间 + + dpMapper.updateById(publicity); + + + for (DestructionDetail detail : details) { + transferFeignService.updateStatus(detail.getSampleId(),11);//样本状态为已经发布销毁公示,待出库销毁 + //transferFeignService.updateSampleHolder(new UpdateHolderDTO(detail.getSampleId(),""));//当期持有人 + } + + + /** + * 调用分中心官网 + */ + + return this.getOneById(id); + } +} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/DrugCaseInfoServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/DrugCaseInfoServiceImpl.java new file mode 100644 index 0000000..6774414 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/DrugCaseInfoServiceImpl.java @@ -0,0 +1,22 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.imr.entity.DrugCaseInfo; +import digital.laboratory.platform.imr.mapper.DrugCaseInfoMapper; +import digital.laboratory.platform.imr.service.DrugCaseInfoService; +import org.springframework.stereotype.Service; + +/** +* @author ChenJiangBao +* @description 针对表【b_drug_case_info(毒品库中关联的案事件信息)】的数据库操作Service实现 +* @createDate 2024-11-07 12:04:42 +*/ +@Service +public class DrugCaseInfoServiceImpl extends ServiceImpl + implements DrugCaseInfoService { + +} + + + + diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/DrugMaterialInfoServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/DrugMaterialInfoServiceImpl.java new file mode 100644 index 0000000..d00cc3f --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/DrugMaterialInfoServiceImpl.java @@ -0,0 +1,22 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.imr.entity.DrugMaterialInfo; +import digital.laboratory.platform.imr.mapper.DrugMaterialInfoMapper; +import digital.laboratory.platform.imr.service.DrugMaterialInfoService; +import org.springframework.stereotype.Service; + +/** +* @author ChenJiangBao +* @description 针对表【b_drug_material_info(毒品库中的毒品检材信息)】的数据库操作Service实现 +* @createDate 2024-11-07 12:04:42 +*/ +@Service +public class DrugMaterialInfoServiceImpl extends ServiceImpl + implements DrugMaterialInfoService { + +} + + + + diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/OutWarehouseDetailedServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/OutWarehouseDetailedServiceImpl.java new file mode 100644 index 0000000..f979dee --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/OutWarehouseDetailedServiceImpl.java @@ -0,0 +1,18 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.imr.entity.OutWarehouseDetailed; +import digital.laboratory.platform.imr.mapper.OutWarehouseDetailedMapper; +import digital.laboratory.platform.imr.service.OutWarehouseDetailedService; +import org.springframework.stereotype.Service; + +/** + * 出库明细服务实现类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 出库明细 服务实现类 + */ +@Service +public class OutWarehouseDetailedServiceImpl extends ServiceImpl implements OutWarehouseDetailedService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/ReviewApprovalServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/ReviewApprovalServiceImpl.java new file mode 100644 index 0000000..27e33ab --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/ReviewApprovalServiceImpl.java @@ -0,0 +1,357 @@ +package digital.laboratory.platform.imr.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.ReviewApprovalDTO; +import digital.laboratory.platform.imr.dto.ReviewSampleDetail; +import digital.laboratory.platform.imr.entity.SampleApply; +import digital.laboratory.platform.imr.entity.SampleApplyDetailed; +import digital.laboratory.platform.imr.entity.SampleStorage; +import digital.laboratory.platform.imr.entity.enums.ApplyStatus; +//import digital.laboratory.platform.imr.entity.enums.SampleStatus; +import digital.laboratory.platform.imr.feign.TransferFeignService; +import digital.laboratory.platform.imr.mapper.SampleApplyDetailedMapper; +import digital.laboratory.platform.imr.mapper.SampleApplyMapper; +import digital.laboratory.platform.imr.mapper.SampleStorageMapper; +import digital.laboratory.platform.imr.service.ReviewApprovalService; +import digital.laboratory.platform.imr.service.SampleApplyService; +import digital.laboratory.platform.imr.vo.ApplySampleVO; +import digital.laboratory.platform.imr.vo.SampleApplyVO; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +@RequiredArgsConstructor +public class ReviewApprovalServiceImpl implements ReviewApprovalService { + + + + private final SampleApplyMapper sampleApplyMapper; + + private final SampleApplyDetailedMapper detailedMapper; + + + private final SampleApplyService sampleApprovalService; + + + private final TransferFeignService transferFeignService; + + + private final SampleStorageMapper sampleStorageMapper; + + + /** + * 一级审核员审核 + * @param dto + * @param dlpUser + * @return + */ + @Override + @Transactional + public SampleApplyVO firstAudit(ReviewApprovalDTO dto, DLPUser dlpUser) { + + //查找对应的申请 + SampleApply sampleApply = sampleApplyMapper.selectById(dto.getApplyId()); + if(sampleApply == null){ + throw new RuntimeException("当前数据不存在"); + } else if (sampleApply.getApplyType()==1) {//外带申请 + if(sampleApply.getApplicationStatus()!=ApplyStatus.FIRST_LEVEL){ + throw new RuntimeException("当前数据不是待一级审核状态"); + } + } + //判断无误 + sampleApply.setFirstAuditDate(LocalDateTime.now());//时间 + sampleApply.setFirstAuditOpinion(dto.getOpinion());//意见 + sampleApply.setFirstAuditorId(dlpUser.getId());//一级审核员 + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("apply_id",dto.getApplyId()); + List applyDetailed = detailedMapper.selectList(queryWrapper); + ArrayList idList = new ArrayList<>(); + List sampleDetails = dto.getReviewSampleDetails(); + + if(dto.getStatus()==-1){//点击不通过按钮;勾选的数据为不通过 + + //循环有的 + for (ReviewSampleDetail detail:sampleDetails) { + //传值为不通过样本 + SampleApplyDetailed sampleApplyDetailed = detailedMapper.selectById(detail.getId()); + sampleApplyDetailed.setStatus(-1); + detailedMapper.updateById(sampleApplyDetailed); + idList.add(detail.getId()); + } + //循环没有的 + QueryWrapper not = queryWrapper.notIn("id", idList); + List detaileds = detailedMapper.selectList(not); + if(!detaileds.isEmpty()) { + for (SampleApplyDetailed detail : detaileds) { + detail.setStatus(1);//没有传值的为不通过 + detailedMapper.updateById(detail); + } + sampleApply.setApplicationStatus(ApplyStatus.SECOND_LEVEL); + }else { + sampleApply.setApplicationStatus(ApplyStatus.FIRST_LEVEL_FAIL); + for (ReviewSampleDetail detail:sampleDetails) { + //申请不通过的要恢复状态 + SampleApplyDetailed sampleApplyDetailed = detailedMapper.selectById(detail.getId()); + if(sampleApply.getApplyType()==2){ + transferFeignService.updateStatus(sampleApplyDetailed.getSampleId(),2); + }else { + transferFeignService.updateStatus(sampleApplyDetailed.getSampleId(),1); + } + } + } + }else { + //循环有的 + for (ReviewSampleDetail detail:sampleDetails) { + //传值为通过样本 + SampleApplyDetailed sampleApplyDetailed = detailedMapper.selectById(detail.getId()); + sampleApplyDetailed.setStatus(1); + detailedMapper.updateById(sampleApplyDetailed); + idList.add(detail.getId()); + } + //循环没有的 + QueryWrapper not = queryWrapper.notIn("id", idList); + List detaileds = detailedMapper.selectList(not); + if(!detaileds.isEmpty()) { + for (SampleApplyDetailed detail : detaileds) { + detail.setStatus(-1);//没有传值的为不通过 + detailedMapper.updateById(detail); + } + } + sampleApply.setApplicationStatus(ApplyStatus.SECOND_LEVEL); + } + + /*QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("apply_id",dto.getApplyId()); + List applyDetailed = detailedMapper.selectList(queryWrapper); + + + if(dto.getReviewSampleDetails().isEmpty()){ + //如果传值为空说明全部不通过 + sampleApply.setApplicationStatus(ApplyStatus.FIRST_LEVEL_FAIL); + for (SampleApplyDetailed detailed:applyDetailed) { + detailed.setStatus(-1);//不通过 + detailedMapper.updateById(detailed); + } + }else { + //传值对应的样本状态为通过;没有的则为不通过 + sampleApply.setApplicationStatus(ApplyStatus.SECOND_LEVEL); + ArrayList idList = new ArrayList<>(); + + for (ReviewSampleDetail reviewSampleDetail : dto.getReviewSampleDetails()) { + SampleApplyDetailed detailed = detailedMapper.selectById(reviewSampleDetail.getId()); + detailed.setStatus(1);//通过 + detailedMapper.updateById(detailed); + idList.add(reviewSampleDetail.getId()); + } + QueryWrapper not = queryWrapper.notIn("id", idList); + List detaileds = detailedMapper.selectList(not); + if(detaileds!=null) { + for (SampleApplyDetailed detail : detaileds) { + detail.setStatus(-1);//没有传值的为不通过 + detailedMapper.updateById(detail); + } + } + }*/ + sampleApplyMapper.updateById(sampleApply); + + return sampleApprovalService.getDetail(dto.getApplyId()); + } + + /** + * 二级审核 + * @param dto + * @param dlpUser + * @return + */ + @Override + public SampleApplyVO secondaryAudit(ReviewApprovalDTO dto, DLPUser dlpUser) { + //查找对应的申请 + SampleApply sampleApply = sampleApplyMapper.selectById(dto.getApplyId()); + if(sampleApply == null){ + throw new RuntimeException(String.format("当前数据不存在")); + } else if (sampleApply.getApplyType()==1) {//外带申请 + if(sampleApply.getApplicationStatus()!=ApplyStatus.SECOND_LEVEL){ + throw new RuntimeException(String.format("当前数据不是待二级审核状态")); + } + } + //判断无误 + sampleApply.setSecondaryAuditDate(LocalDateTime.now());//时间 + sampleApply.setSecondaryAuditOpinion(dto.getOpinion());//意见 + sampleApply.setSecondaryAuditorId(dlpUser.getId());//二级级审核员 + + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("apply_id",dto.getApplyId()); + List applyDetailed = detailedMapper.selectList(queryWrapper); + ArrayList idList = new ArrayList<>(); + List sampleDetails = dto.getReviewSampleDetails(); + + if(dto.getStatus()==-1){//点击不通过按钮;勾选的数据为不通过 + + //循环有的 + for (ReviewSampleDetail detail:sampleDetails) { + //传值为不通过样本 + SampleApplyDetailed sampleApplyDetailed = detailedMapper.selectById(detail.getId()); + sampleApplyDetailed.setStatus(-1); + detailedMapper.updateById(sampleApplyDetailed); + idList.add(detail.getId()); + } + //循环没有的 + QueryWrapper not = queryWrapper.notIn("id", idList); + List detaileds = detailedMapper.selectList(not); + if(!detaileds.isEmpty()) { + for (SampleApplyDetailed detail : detaileds) { + detail.setStatus(1);//没有传值的为不通过 + detailedMapper.updateById(detail); + } + sampleApply.setApplicationStatus(ApplyStatus.PENDING_APPROVAL); + }else { + sampleApply.setApplicationStatus(ApplyStatus.SECOND_LEVEL_FAIL); + for (ReviewSampleDetail detail:sampleDetails) { + //申请不通过的要恢复状态 + SampleApplyDetailed sampleApplyDetailed = detailedMapper.selectById(detail.getId()); + if(sampleApply.getApplyType()==2){ + transferFeignService.updateStatus(sampleApplyDetailed.getSampleId(),2); + }else { + transferFeignService.updateStatus(sampleApplyDetailed.getSampleId(),1); + } + } + + } + }else { + //循环有的 + for (ReviewSampleDetail detail:sampleDetails) { + //传值为通过样本 + SampleApplyDetailed sampleApplyDetailed = detailedMapper.selectById(detail.getId()); + sampleApplyDetailed.setStatus(1); + detailedMapper.updateById(sampleApplyDetailed); + idList.add(detail.getId()); + } + //循环没有的 + QueryWrapper not = queryWrapper.notIn("id", idList); + List detaileds = detailedMapper.selectList(not); + if(detaileds!=null) { + for (SampleApplyDetailed detail : detaileds) { + detail.setStatus(-1);//没有传值的为不通过 + detailedMapper.updateById(detail); + } + } + sampleApply.setApplicationStatus(ApplyStatus.PENDING_APPROVAL); + } + sampleApplyMapper.updateById(sampleApply); + return sampleApprovalService.getDetail(dto.getApplyId()); + } + + + + @Override + @Transactional + public SampleApplyVO approval(ReviewApprovalDTO dto, DLPUser dlpUser) { + //查找对应的申请 + SampleApply sampleApply = sampleApplyMapper.selectById(dto.getApplyId()); + if(sampleApply == null){ + throw new RuntimeException(String.format("当前数据不存在")); + }else if(sampleApply.getApplicationStatus()!=ApplyStatus.PENDING_APPROVAL){ + throw new RuntimeException(String.format("当前数据不是待审批状态")); + } + //判断无误 + sampleApply.setApprovalDate(LocalDateTime.now());//时间 + sampleApply.setApproverOpinion(dto.getOpinion());//意见 + sampleApply.setApproverId(dlpUser.getId());//审批人 + + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("apply_id",dto.getApplyId()); + List applyDetailed = detailedMapper.selectList(queryWrapper); + ArrayList idList = new ArrayList<>(); + List sampleDetails = dto.getReviewSampleDetails(); + + if(dto.getStatus()==-1){//点击不通过按钮;勾选的数据为不通过 + + //循环有的 + for (ReviewSampleDetail detail:sampleDetails) { + //传值为不通过样本 + SampleApplyDetailed sampleApplyDetailed = detailedMapper.selectById(detail.getId()); + sampleApplyDetailed.setStatus(-1); + if(sampleApply.getApplyType()==2){ + transferFeignService.updateStatus(sampleApplyDetailed.getSampleId(),2); + }else { + transferFeignService.updateStatus(sampleApplyDetailed.getSampleId(),1); + } + detailedMapper.updateById(sampleApplyDetailed); + idList.add(detail.getId()); + } + //循环没有的 + QueryWrapper not = queryWrapper.notIn("id", idList); + List detaileds = detailedMapper.selectList(not); + if(!detaileds.isEmpty()) { + for (SampleApplyDetailed detail : detaileds) { + detail.setStatus(1);//没有传值的为不通过 + detailedMapper.updateById(detail); + if(sampleApply.getApplyType()==2){//如果是销毁申请需要改变预警状态 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("sample_id",detail.getSampleId()); + updateWrapper.set("early_warning",2);//销毁预警状态修改为2--通过审核审批 + sampleStorageMapper.update(null,updateWrapper); + transferFeignService.updateStatus(detail.getSampleId(),7);//样本状态为待销毁 + }else { + //外带申请需要恢复状态 + transferFeignService.updateStatus(detail.getSampleId(),1); + } + } + sampleApply.setApplicationStatus(ApplyStatus.APPROVED); + }else { + sampleApply.setApplicationStatus(ApplyStatus.APPROVAL_FAILED); + } + }else {//点击通过按钮 + //循环有的 + for (ReviewSampleDetail detail:sampleDetails) { + //传值为通过样本 + SampleApplyDetailed sampleApplyDetailed = detailedMapper.selectById(detail.getId()); + sampleApplyDetailed.setStatus(1); + detailedMapper.updateById(sampleApplyDetailed); + idList.add(detail.getId()); + + if(sampleApply.getApplyType()==2){//如果是销毁申请需要改变预警状态 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("sample_id",sampleApplyDetailed.getSampleId()); + updateWrapper.set("early_warning",2);//销毁预警状态修改为2--通过审核审批 + sampleStorageMapper.update(null,updateWrapper); + transferFeignService.updateStatus(sampleApplyDetailed.getSampleId(),7);//样本状态为待销毁 + }else { + //外带申请需要恢复状态 + transferFeignService.updateStatus(sampleApplyDetailed.getSampleId(),1); + } + } + //循环没有的 + QueryWrapper not = queryWrapper.notIn("id", idList); + List detaileds = detailedMapper.selectList(not); + if(!detaileds.isEmpty()) { + for (SampleApplyDetailed detail : detaileds) { + detail.setStatus(-1);//没有传值的为不通过 + detailedMapper.updateById(detail); + if(sampleApply.getApplyType()==2){ + transferFeignService.updateStatus(detail.getSampleId(),2); + }else { + transferFeignService.updateStatus(detail.getSampleId(),1); + } + } + } + sampleApply.setApplicationStatus(ApplyStatus.APPROVED); + } + sampleApplyMapper.updateById(sampleApply); + return sampleApprovalService.getDetail(dto.getApplyId()); + } + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/SampleApplyServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/SampleApplyServiceImpl.java new file mode 100644 index 0000000..d4e1d70 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/SampleApplyServiceImpl.java @@ -0,0 +1,391 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.common.core.util.R; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.ApplyDTO; +import digital.laboratory.platform.imr.entity.SampleApply; +import digital.laboratory.platform.imr.entity.SampleApplyDetailed; +import digital.laboratory.platform.imr.entity.enums.ApplyStatus; +import digital.laboratory.platform.imr.feign.TransferFeignService; +import digital.laboratory.platform.imr.mapper.SampleApplyDetailedMapper; +import digital.laboratory.platform.imr.mapper.SampleApplyMapper; +import digital.laboratory.platform.imr.service.SampleApplyService; +import digital.laboratory.platform.imr.vo.ApplySampleVO; +import digital.laboratory.platform.imr.vo.BaseSampleVO; +import digital.laboratory.platform.imr.vo.SampleApplyVO; +import digital.laboratory.platform.imr.vo.StatusSampleVO; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +/** + * 检材申请实体类服务实现类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 检材申请实体类 服务实现类 + */ +@Service +@RequiredArgsConstructor +public class SampleApplyServiceImpl extends ServiceImpl implements SampleApplyService { + + + private final SampleApplyMapper asMapper; + + private final SampleApplyDetailedMapper detailedMapper; + + + private final TransferFeignService transferFeignService; + + + /** + * 创建并保存 + * @param dto + * @param dlpUser + * @return + */ + @Override + @Transactional + public SampleApplyVO createAndSave(ApplyDTO dto, DLPUser dlpUser) { + + SampleApply apply = new SampleApply(); + apply.setId(IdWorker.get32UUID().toUpperCase());//id + apply.setApplyType(dto.getApplyType());//类型 + apply.setApplyQuantity(dto.getSampleId().size());//数量 + apply.setApplicationStatus(ApplyStatus.TO_BE_SUBMITTED);//保存是待提交状态 + apply.setReason(dto.getReason());//原因 + apply.setApplicationDate(LocalDateTime.now()); + apply.setApplicantId(dlpUser.getId());//申请人id + //添加数据 + asMapper.insert(apply); + + //创建副表 + for (String sampleId :dto.getSampleId()) { + SampleApplyDetailed detailed = new SampleApplyDetailed(); + detailed.setApplyId(apply.getId()); + detailed.setSampleId(sampleId); + detailed.setStatus(0);//待审核审批 + //数据存储 + detailedMapper.insert(detailed); + //远程调用修改状态 + //transferFeignService.updateStatus(sampleId,12);//申请中 + } + + return this.getDetail(apply.getId()); + } + + /** + * 查询单个申请详情 + * @param id + * @return + */ + @Override + public SampleApplyVO getDetail(String id) { + + SampleApplyVO sampleApplyVO = asMapper.getSampleApply(id);//查询单个申请详情 + + sampleApplyVO.setStatusCode(sampleApplyVO.getApplicationStatus().getStatus()); + + List sampleVO = detailedMapper.getDetail(id);//详情 + + for (ApplySampleVO sample:sampleVO) { + if(sample.getStatus()==0){ + sample.setDescribeStatus("待审核审批"); + } else if (sample.getStatus()==1) { + sample.setDescribeStatus("通过"); + }else if (sample.getStatus()==-1) { + sample.setDescribeStatus("未通过"); + } + } + sampleApplyVO.setSampleVO(sampleVO);//设置样本信息 + + return sampleApplyVO; + } + + /** + * 创建并提交 + * @param dto + * @param dlpUser + * @return + */ + @Override + public SampleApplyVO createAndSubmit(ApplyDTO dto, DLPUser dlpUser) { + + SampleApply apply = new SampleApply(); + apply.setId(IdWorker.get32UUID().toUpperCase());//id + apply.setApplyType(dto.getApplyType());//类型 + apply.setApplyQuantity(dto.getSampleId().size());//数量 + if(dto.getApplyType()==1){ + apply.setApplicationStatus(ApplyStatus.FIRST_LEVEL);//待一级审核 + }else { + apply.setApplicationStatus(ApplyStatus.PENDING_APPROVAL);//待审批 + } + apply.setReason(dto.getReason());//原因 + apply.setApplicationDate(LocalDateTime.now()); + apply.setApplicantId(dlpUser.getId());//申请人id + //添加数据 + asMapper.insert(apply); + + //创建副表 + for (String sampleId :dto.getSampleId()) { + SampleApplyDetailed detailed = new SampleApplyDetailed(); + detailed.setApplyId(apply.getId()); + detailed.setSampleId(sampleId); + detailed.setStatus(0);//待审核审批 + //数据存储 + detailedMapper.insert(detailed); + //远程调用修改状态 + transferFeignService.updateStatus(sampleId,12);//申请中 + } + + + + //消息发送 + + + return this.getDetail(apply.getId()); + } + + + /** + * 单个提交 + * @param id + * @return + */ + @Override + public SampleApplyVO submitApplyOne(String id) { + + SampleApply apply = asMapper.selectById(id); + if(apply == null){ + throw new RuntimeException(String.format("当前数据不存在")); + } else if (apply.getApplicationStatus()!=ApplyStatus.TO_BE_SUBMITTED && apply.getApplicationStatus()!=ApplyStatus.WITHDRAWN) {//外带申请 + throw new RuntimeException(String.format("当前申请不是待提交状态")); + } + + List detaileds = detailedMapper.selectList(Wrappers.query().eq("apply_id", id)); + + + //判断当前准备提交申请中样本是否是在别的申请提交了 + for (SampleApplyDetailed detail : detaileds) { + StatusSampleVO sampleVO = asMapper.getSampleInfo(detail.getSampleId()); + if(sampleVO.getStatus() == 12){ + throw new RuntimeException(String.format("名称为:"+sampleVO.getName()+"的样本已在别的申请中提交;请勿重复提交")); + } + } + + //判断申请类型 + if(apply.getApplyType()==1){//外带 + apply.setApplicationStatus(ApplyStatus.FIRST_LEVEL); + }else { + apply.setApplicationStatus(ApplyStatus.PENDING_APPROVAL); + } + //修改数据 + asMapper.updateById(apply); + + for (SampleApplyDetailed detail : detaileds) { + //远程调用修改状态 + transferFeignService.updateStatus(detail.getSampleId(),12);//申请中 + } + return this.getDetail(id); + } + + /** + * 分页查询 + * @param qw + * @return + */ + @Override + public IPage getApplyPage(Page page,QueryWrapper qw) { + IPage vo = asMapper.getApplyPage(page, qw); + List records = vo.getRecords(); + + for (SampleApplyVO record :records) { + record.setStatusCode(record.getApplicationStatus().getStatus()); + } + + return vo; + } + + /** + * 单个撤回 + * @param id + * @return + */ + @Override + public SampleApplyVO withdrawalOne(String id) { + SampleApply apply = asMapper.selectById(id); + if(apply == null){ + throw new RuntimeException(String.format("当前数据不存在")); + } else if (apply.getApplicationStatus()!=ApplyStatus.FIRST_LEVEL && apply.getApplyType()==1) {//外带申请 + throw new RuntimeException(String.format("当前外带申请状态为"+apply.getApplicationStatus().getDescription()+"不可撤回")); + }else if (apply.getApplicationStatus()!=ApplyStatus.PENDING_APPROVAL && apply.getApplyType()==2) {//外带申请 + throw new RuntimeException(String.format("当前销毁申请状态为"+apply.getApplicationStatus().getDescription()+"不可撤回")); + } + //撤回数据 + apply.setApplicationStatus(ApplyStatus.WITHDRAWN); + //修改数据 + asMapper.updateById(apply); + + List detaileds = detailedMapper.selectList(Wrappers.query().eq("apply_id", id)); + + for (SampleApplyDetailed detail : detaileds) { + //远程调用修改状态 + if(apply.getApplyType()==1){//外带申请为出库状态 + transferFeignService.updateStatus(detail.getSampleId(),1);//出库 + }else { + transferFeignService.updateStatus(detail.getSampleId(),2);//销毁申请是在仓库里面 + } + //申请中 + } + + return this.getDetail(id); + } + + /** + * 单个删除 + * @param id + */ + @Override + @Transactional + public void deleteOne(String id) { + + SampleApply apply = asMapper.selectById(id); + + + if(apply==null){ + throw new RuntimeException(String.format("当前数据不存在")); + } else if (apply.getApplicationStatus()!=ApplyStatus.WITHDRAWN && apply.getApplicationStatus()!=ApplyStatus.TO_BE_SUBMITTED) { + throw new RuntimeException(String.format("当前状态不可删除")); + } + //删除副表 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("apply_id", id); + detailedMapper.delete(wrapper); + //删除主表 + asMapper.deleteById(id); + + } + + /** + * 修改并提交 + * @param dto + * @param dlpUser + * @return + */ + @Override + public SampleApplyVO updateAndSubmit(ApplyDTO dto, DLPUser dlpUser) { + + SampleApply sampleApply = asMapper.selectById(dto.getId()); + if(sampleApply==null){ + throw new RuntimeException(String.format("当前数据不存在")); + } else if (sampleApply.getApplicationStatus()!=ApplyStatus.WITHDRAWN && sampleApply.getApplicationStatus()!=ApplyStatus.TO_BE_SUBMITTED) { + throw new RuntimeException(String.format("当前状态不可修改")); + } + + //修改主表 + sampleApply.setReason(dto.getReason());//销毁原因 + sampleApply.setApplyQuantity(dto.getSampleId().size());//样本数量 + if(sampleApply.getApplyType()==1){ + sampleApply.setApplicationStatus(ApplyStatus.FIRST_LEVEL);//待一级审核 + }else { + sampleApply.setApplicationStatus(ApplyStatus.PENDING_APPROVAL);//待审批 + } + sampleApply.setApplicationDate(LocalDateTime.now()); + asMapper.updateById(sampleApply); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("apply_id", sampleApply.getId()); + + //样本还原状态 + List list = detailedMapper.selectList(wrapper); + for (SampleApplyDetailed detailed:list) { + if(sampleApply.getApplyType()==1){//外带申请 + transferFeignService.updateStatus(detailed.getSampleId(),1); + }else {//销毁 + transferFeignService.updateStatus(detailed.getSampleId(),2); + } + } + //删除副表 + + detailedMapper.delete(wrapper); + + //创建副表 + for (String sampleId :dto.getSampleId()) { + SampleApplyDetailed detailed = new SampleApplyDetailed(); + detailed.setApplyId(sampleApply.getId()); + detailed.setSampleId(sampleId); + detailed.setStatus(0);//待审核审批 + //数据存储 + detailedMapper.insert(detailed); + //远程调用修改状态 + transferFeignService.updateStatus(sampleId,12);//申请中 + } + + return this.getDetail(sampleApply.getId()); + } + + + /** + * 修改并保存 + * @param dto + * @param dlpUser + * @return + */ + public SampleApplyVO updateAndSave(ApplyDTO dto, DLPUser dlpUser) { + + SampleApply sampleApply = asMapper.selectById(dto.getId()); + if(sampleApply==null){ + throw new RuntimeException(String.format("当前数据不存在")); + } else if (sampleApply.getApplicationStatus()!=ApplyStatus.WITHDRAWN && sampleApply.getApplicationStatus()!=ApplyStatus.TO_BE_SUBMITTED) { + throw new RuntimeException(String.format("当前状态不可修改")); + } + + //修改主表 + sampleApply.setReason(dto.getReason());//销毁原因 + sampleApply.setApplyQuantity(dto.getSampleId().size());//样本数量 + + sampleApply.setApplicationStatus(ApplyStatus.TO_BE_SUBMITTED);// + + sampleApply.setApplicationDate(LocalDateTime.now()); + asMapper.updateById(sampleApply); + + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("apply_id", sampleApply.getId()); + + //样本还原状态 + List list = detailedMapper.selectList(wrapper); + for (SampleApplyDetailed detailed:list) { + if(sampleApply.getApplyType()==1){//外带申请 + transferFeignService.updateStatus(detailed.getSampleId(),1); + }else {//销毁 + transferFeignService.updateStatus(detailed.getSampleId(),2); + } + } + //删除副表 + + detailedMapper.delete(wrapper); + + //创建副表 + for (String sampleId :dto.getSampleId()) { + SampleApplyDetailed detailed = new SampleApplyDetailed(); + detailed.setApplyId(sampleApply.getId()); + detailed.setSampleId(sampleId); + detailed.setStatus(0);//待审核审批 + //数据存储 + detailedMapper.insert(detailed); + } + + return this.getDetail(sampleApply.getId()); + } +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/SampleInboundAndOutboundTableServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/SampleInboundAndOutboundTableServiceImpl.java new file mode 100644 index 0000000..d085933 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/SampleInboundAndOutboundTableServiceImpl.java @@ -0,0 +1,20 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.imr.entity.SampleInboundAndOutboundTable; +import digital.laboratory.platform.imr.mapper.SampleInboundAndOutboundTableMapper; +import digital.laboratory.platform.imr.service.SampleInboundAndOutboundTableService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 服务实现类 + * + * @author Zhang Xiaolong created at 2023-03-21 + * @describe 服务实现类 + */ +@Service +@RequiredArgsConstructor +public class SampleInboundAndOutboundTableServiceImpl extends ServiceImpl implements SampleInboundAndOutboundTableService { + +} \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutWarehouseApplyServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutWarehouseApplyServiceImpl.java new file mode 100644 index 0000000..dfe44be --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutWarehouseApplyServiceImpl.java @@ -0,0 +1,505 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.common.feign.RemoteTemplate2htmlService; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.OutWarehouseApplyDTO; +import digital.laboratory.platform.imr.dto.VerificationCode; +import digital.laboratory.platform.imr.entity.*; +import digital.laboratory.platform.imr.entity.enums.OutApplyStatus; +import digital.laboratory.platform.imr.entity.enums.OutboundType; +import digital.laboratory.platform.imr.feign.TransferFeignService; +import digital.laboratory.platform.imr.feign.dto.UpdateHolderDTO; +import digital.laboratory.platform.imr.mapper.*; +import digital.laboratory.platform.imr.service.SampleApplyService; +import digital.laboratory.platform.imr.service.SampleOutWarehouseApplyService; +import digital.laboratory.platform.imr.vo.BaseSampleDetail; +import digital.laboratory.platform.imr.vo.CellVO; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import digital.laboratory.platform.imr.vo.SampleOutWarehouseApplyVO; +import digital.laboratory.platform.common.feign.annotation.*; +import digital.laboratory.platform.sys.entity.CellAndStoreSupplyData; +import digital.laboratory.platform.sys.feign.RemoteCabinetService; +import io.seata.spring.annotation.GlobalTransactional; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 样本出库申请实体类服务实现类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 样本出库申请实体类 服务实现类 + */ +@Service +@RequiredArgsConstructor +public class SampleOutWarehouseApplyServiceImpl extends ServiceImpl implements SampleOutWarehouseApplyService { + + private final TransferFeignService transferFeignService; + + + private final RemoteTemplate2htmlService remoteTemplate2htmlService; + + private final RemoteCabinetService cabinetService; + + private final SampleOutWarehouseApplyMapper sawMapper; + + private final OutWarehouseDetailedMapper owdMapper; + + private final SampleStorageMapper storageMapper; + + private final SampleInboundAndOutboundTableMapper tableMapper; + + private final SampleOutboundRecordMapper outboundRecordMapper; + + /** + * 创建出库申请(检验人员使用) + * + * @param dto + * @param dlpUser + * @return + */ + @Override + @Transactional + public SampleOutWarehouseApplyVO createOutApply(OutWarehouseApplyDTO dto, DLPUser dlpUser) { + // + SampleOutWarehouseApply sampleOutWarehouseApply = new SampleOutWarehouseApply(); + sampleOutWarehouseApply.setReturnDate(dto.getReturnDate());//归还时间 + sampleOutWarehouseApply.setPurpose(dto.getPurpose()); + sampleOutWarehouseApply.setAppraiserId(dto.getAppraiserId()); + sampleOutWarehouseApply.setId(IdWorker.get32UUID().toUpperCase()); + sampleOutWarehouseApply.setApplicantId(dlpUser.getId());//申请人 + sampleOutWarehouseApply.setApplicationDate(LocalDateTime.now());//申请时间 + sampleOutWarehouseApply.setStatus(OutApplyStatus.TO_BE_CONFIRMED);//申请状态 + //添加数据 + sawMapper.insert(sampleOutWarehouseApply); + //创建出库申请明细 + List sampleIds = dto.getSampleIds(); + for (String sampleId : sampleIds) { + OutWarehouseDetailed outWarehouseDetailed = new OutWarehouseDetailed(); + outWarehouseDetailed.setId(IdWorker.get32UUID().toUpperCase()); + outWarehouseDetailed.setSampleId(sampleId); + outWarehouseDetailed.setApplyId(sampleOutWarehouseApply.getId()); + owdMapper.insert(outWarehouseDetailed); + //创建完成以后先修改sample状态为"领用出库申请中" + transferFeignService.updateStatus(sampleId, 9); + } + return sawMapper.getOutApplyDetail(sampleOutWarehouseApply.getId()); + } + + + /** + * 创建出库申请方法2 + * + * @param dto + * @param dlpUser + * @return + */ + @Override + public SampleOutWarehouseApplyVO createOutRepositoryApply(OutWarehouseApplyDTO dto, DLPUser dlpUser) { + // + SampleOutWarehouseApply sampleOutWarehouseApply = new SampleOutWarehouseApply(); + sampleOutWarehouseApply.setReturnDate(dto.getReturnDate()); + sampleOutWarehouseApply.setPurpose(dto.getPurpose()); + sampleOutWarehouseApply.setAppraiserId(dto.getAppraiserId()); + sampleOutWarehouseApply.setId(IdWorker.get32UUID().toUpperCase()); + sampleOutWarehouseApply.setApplicantId(dlpUser.getId());//申请人 + sampleOutWarehouseApply.setApplicationDate(LocalDateTime.now());//申请时间 + sampleOutWarehouseApply.setStatus(OutApplyStatus.TO_BE_CONFIRMED);//申请状态 + /** + * 创建"取检材"码(这个码不应该重复) + * 两种办法 + * 1.生成码先查询数据库重复就重新生成 + * 2.将已经使用出库的码设置为空 + */ + //String sampleCode = this.getSampleCode(); + //sampleOutWarehouseApply.setSampleCodeNumber(sampleCode); + this.save(sampleOutWarehouseApply); + //创建出库申请明细 + List sampleIds = dto.getSampleIds(); + for (String sampleId : sampleIds) { + OutWarehouseDetailed outWarehouseDetailed = new OutWarehouseDetailed(); + outWarehouseDetailed.setId(IdWorker.get32UUID().toUpperCase()); + outWarehouseDetailed.setSampleId(sampleId); + outWarehouseDetailed.setApplyId(sampleOutWarehouseApply.getId()); + owdMapper.insert(outWarehouseDetailed); + } + return sawMapper.getSampleOutRepositoryInfo(sampleOutWarehouseApply.getId()); + } + + /** + * 领用出库确认 + * 1.生成取检码(不能重复) + * 2.修改状态 + * 3.添加检材管理员 + * + * @param id + * @return + */ + @Override + @Transactional + public SampleOutWarehouseApplyVO reconfirmApply(String id, String userId) { + + SampleOutWarehouseApplyVO vo = sawMapper.getOutApplyDetail(id); + if (vo == null) { + throw new RuntimeException("当前数据不存在"); + } + + if (vo.getStatus() != OutApplyStatus.TO_BE_CONFIRMED) { + throw new RuntimeException("当前状态不是待审核状态"); + } + + //生成取检码(不能重复) + String sampleCode = this.getSampleCode(); + //修改数据 + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("id", vo.getId()); + wrapper.set("sample_code_number", sampleCode); + wrapper.set("status", OutApplyStatus.SUCCESS);//修改当前状态 + wrapper.set("im_administrators_id", userId); + this.update(wrapper); + SampleOutWarehouseApplyVO applyVO = sawMapper.getOutApplyDetail(id); + applyVO.setAmount((long) applyVO.getSampleList().size());//数量 + applyVO.setStatusCode(applyVO.getStatus().getStatus());//状态码 + return applyVO; + } + + /** + * 查询单个出库申请信息 + * + * @param id 出库申请信息+对应出库样本信息 + * @return + */ + @Override + public SampleOutWarehouseApplyVO getOutWarehouseDetailedById(String id) { + SampleOutWarehouseApplyVO vo = sawMapper.getOutApplyDetail(id); + if (vo == null) { + throw new RuntimeException(String.format("当前数据不存在")); + } + vo.setStatusCode(vo.getStatus().getStatus());//状态码 + + Long applyId = owdMapper.selectCount(Wrappers.query() + .eq("apply_id", vo.getId()) + ); + List sampleList = vo.getSampleList(); + Collections.sort(sampleList, new Comparator() { + @Override + public int compare(OutSampleVO o1, OutSampleVO o2) { + String[] split1 = o1.getSampleNo().split("-"); + String[] split2 = o2.getSampleNo().split("-"); + // 先比较年份 + int yearComparison = split2[0].compareTo(split1[0]); + if (yearComparison != 0) { + return yearComparison; + } + // 再比较序号 + int num1 = Integer.parseInt(split2[1]); + int num2 = Integer.parseInt(split1[1]); + if (num1 - num2 != 0) { + return num1 - num2; + } + // 再比较尾号 + int num3 = Integer.parseInt(split1[2]); + int num4 = Integer.parseInt(split2[2]); + return num3 - num4; + } + }); + + vo.setAmount(applyId); + if (vo != null) { + return vo; + } else { + return null; + } + } + + /** + * 分页1 + * + * @param qw + * @return + */ + @Override + public IPage getSampleOutWarehouseApplyVOList(QueryWrapper qw) { + IPage thisList = sawMapper.getSampleOutWarehouseApplyVOList(qw); + + return thisList; + } + + /** + * 分页 + * + * @param page + * @param qw + * @return + */ + @Override + public IPage getSampleOutWarehouseApplyVOPage(Page page, QueryWrapper qw) { + IPage thisPage = sawMapper.getSampleOutWarehouseApplyVOPage(page, qw); + List records = thisPage.getRecords(); + for (SampleOutWarehouseApplyVO sampleVO : records) { + + Long applyId = owdMapper.selectCount(Wrappers.query() + .eq("apply_id", sampleVO.getId()) + ); + sampleVO.setAmount(applyId);//数量 + sampleVO.setStatusCode(sampleVO.getStatus().getStatus());//状态码 + } + + return thisPage; + } + + /** + * 取检码确认出库 + * + * @param dto + * @return + */ + @Override + @GlobalTransactional + public SampleOutWarehouseApplyVO confirmOutbound(VerificationCode dto, DLPUser dlpUser) { + + //这里校验需要code和样本信息的校验 + + //判断当前取件码是否可用 + SampleOutWarehouseApply selectOne = sawMapper.selectOne(new QueryWrapper().eq("sample_code_number", dto.getCode())); + if (selectOne == null) { + throw new RuntimeException("未查询到该数据"); + } else if (selectOne.getStatus() != OutApplyStatus.SUCCESS) { + throw new RuntimeException("该取检码不可用,请重试"); + } + + //根据取检码获取领用申请样本明细id然后比对校验 + List detaileds = owdMapper.selectList(Wrappers.query() + .eq("apply_id", selectOne.getId()) + ); + + if (detaileds.size() != dto.getSampleIds().size()) { + throw new RuntimeException("数据不对应,请重试"); + } + + boolean result = true;//设定判断参数 + for (OutWarehouseDetailed detailed : detaileds) { + if (!dto.getSampleIds().contains(detailed.getSampleId())) {//如果不包含该元素;则数据存在错误 + result = false; + break; + } + } + if (!result) { + throw new RuntimeException("取检码对应的样本数据不匹配,请重新输入"); + } + + //0.修改当前领用出库申请状态为已使用 + selectOne.setStatus(OutApplyStatus.ALREADY_USED); + selectOne.setSampleCodeNumber(selectOne.getSampleCodeNumber() + "(已使用)"); + sawMapper.updateById(selectOne); + //代码出现到这一步说明样本验证成功 + /* + 0.修改当前领用出库申请状态为已使用 + 1.修改仓库样本状态为出库 + 2.修改流转样本状态为出库 + 3.修改样本出入库登记表 + 4.添加样本流转记录 + 5.添加样本出库记录(应该是修改出入库登记表,填充部分数据) + 6.修改样本状态为领用出库中 + 7.修改当前sample持有人为领取人 + + */ + for (OutWarehouseDetailed detailed : detaileds) { + + //样本名称 + SampleStorage storage = storageMapper.selectOne(new QueryWrapper().eq("sample_id", detailed.getSampleId())); + + BaseSampleDetail sampleDetailInfo = storageMapper.getSampleDetailInfo(detailed.getSampleId()); + + + //1.修改仓库样本状态为出库 + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("sample_id", detailed.getSampleId()); + wrapper.set("status", 3);//;已经出库 + wrapper.set("return_time", selectOne.getReturnDate());//归还时间 + wrapper.set("recipient_id", selectOne.getApplicantId());//领取人 + wrapper.set("is_return", 1);//需要归还 + wrapper.set("out_repository_date", LocalDateTime.now());//出库时间 + wrapper.set("purpose", selectOne.getPurpose());// 用途 + storageMapper.update(null, wrapper); +// 2.修改流转样本状态为出库(或者检验中) + transferFeignService.updateStatus(detailed.getSampleId(), 6); +// 3.修改样本出入库登记表--出库是修改操作先查询出sample对应的出入库登记表 + //程序文件中说明:检验时才填写出入库登记表 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("sample_id", detailed.getSampleId()); + updateWrapper.isNull("appraiser_id");//鉴定人为空的数据 + updateWrapper.set("appraiser_id", selectOne.getAppraiserId());//鉴定人 + updateWrapper.set("out_warehouse_date", LocalDateTime.now());//出库时间 + updateWrapper.set("remarks", selectOne.getPurpose());//备注 + updateWrapper.set("return_time", selectOne.getReturnDate());//返回时间 + updateWrapper.set("outbound_supervisor", dto.getSupervisor());//监督人 + tableMapper.update(null, updateWrapper); + + +// 4.添加样本流转记录(远程调用) + transferFeignService.addTransferByOut(detailed.getSampleId(), selectOne.getApplicantId()); +// 5.添加样本出库记录 + SampleOutboundRecord sampleOutboundRecord = new SampleOutboundRecord(); + sampleOutboundRecord.setId(IdWorker.get32UUID().toUpperCase()); + sampleOutboundRecord.setSampleId(detailed.getSampleId()); + sampleOutboundRecord.setOutboundType(OutboundType.USE);//领用出库 + sampleOutboundRecord.setRecipientId(selectOne.getApplicantId());//领取人 + sampleOutboundRecord.setName(storage.getName());//样本名称--方便搜索 + sampleOutboundRecord.setRecipientId(selectOne.getApplicantId());//领取人id + sampleOutboundRecord.setReason(selectOne.getPurpose());//把出库原因设置为备注 + sampleOutboundRecord.setOutboundDate(LocalDateTime.now());//出库时间 + outboundRecordMapper.insert(sampleOutboundRecord); + + + // 6.修改样本状态出库 + transferFeignService.updateStatus(detailed.getSampleId(), 1); +// 7.修改样本当前持有人为领取人 + transferFeignService.updateSampleHolder(new UpdateHolderDTO(detailed.getSampleId(), selectOne.getApplicantId())); + + + //8.柜子出库 + + ArrayList sampleIds = new ArrayList<>(); + CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); + cellAndStoreSupplyData.setCellId(storage.getStorageCellId()); + cellAndStoreSupplyData.setCellStatus("1"); + sampleIds.add(storage.getSampleId()); + cellAndStoreSupplyData.setStoreSupplyList(sampleIds); + /* + 柜子新接口 + */ + ArrayList supplyData = new ArrayList<>(); + supplyData.add(cellAndStoreSupplyData); + cabinetService.takeOrSaveGoodsFromCabinet(supplyData, -1); + + } + return this.getOutWarehouseDetailedById(selectOne.getId()); + } + + + /** + * 通过code取检码获取出库申请信息(出库申请+明细) + * + * @param code + * @return + */ + + @Override + public SampleOutWarehouseApplyVO getInfoByCode(String code) { + //判断当前取件码是否可用 + SampleOutWarehouseApply selectOne = sawMapper.selectOne(new QueryWrapper().eq("sample_code_number", code)); + if (selectOne == null) { + throw new RuntimeException("未查询到该数据"); + } else if (selectOne.getStatus() != OutApplyStatus.SUCCESS) { + throw new RuntimeException("该取检码不可用"); + } + SampleOutWarehouseApplyVO applyVO = sawMapper.getOutApplyDetail(selectOne.getId()); + applyVO.setAmount((long) applyVO.getSampleList().size());//数量 + applyVO.setStatusCode(applyVO.getStatus().getStatus());//状态码 + + List sampleList = applyVO.getSampleList(); + + //分组 + Map> map = sampleList.stream().collect(Collectors.groupingBy(OutSampleVO::getStorageLocation)); + + List cellVOList = new ArrayList<>(); + for (String str : map.keySet()) { + List sampleVOS = map.get(str); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("sample_id", sampleVOS.get(0).getSampleId()); + SampleStorage sampleStorage = storageMapper.selectOne(queryWrapper); + String cellId = sampleVOS.get(0).getCellId(); + Integer number = null; + CellVO cellVO1 = baseMapper.getCellLocation(cellId); + if (cellVO1.getCabinetType() != null && cellVO1.getCabinetType() == 3) { + String[] split = cellVO1.getLocation().split("-"); + number = Integer.parseInt(split[0]); + } + CellVO cellVO = new CellVO(sampleVOS.get(0).getCellId(), str, sampleStorage.getBuildingLv(), sampleStorage.getRoomNo(), sampleStorage.getCabinetName(), sampleStorage.getBoxId(), sampleVOS, number, cellVO1.getLocation(), cellVO1.getCabinetType()); + cellVOList.add(cellVO); + } + + applyVO.setCellVOS(cellVOList); + return applyVO; + } + + +/* +打印取检条码 + */ + + @Override + public String buildEventImLabelContent(String code) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("sample_code_number", code); + + SampleOutWarehouseApply apply = sawMapper.selectOne(queryWrapper); + + if (apply == null) { + throw new RuntimeException("未查询到相关取检码信息"); + } + + Map data = new HashMap<>(); + data.put("code", code); + + String templateFileName = "取检码标签模板.vm";//标签模板 + return remoteTemplate2htmlService.getHtml(templateFileName, data); + } + + + + + +/* +------------------------------------------------------------------------------------------------------------- + */ + + + /** + * 指定长度随机数 + * + * @param length + * @return + */ + public static String getRandomString(int length) { + String str = "0123456789"; + Random random = new Random(); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < length; i++) { + int number = random.nextInt(10); + sb.append(str.charAt(number)); + } + return sb.toString(); + } + + + /** + * 判断取检码重复 + */ + public String getSampleCode() { + String randomString = getRandomString(6); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("sample_code_number", randomString); + SampleOutWarehouseApply one = sawMapper.selectOne(wrapper); + if (one == null) { + return randomString; + } else { + getSampleCode(); + } + return null; + } +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutWarehouseServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutWarehouseServiceImpl.java new file mode 100644 index 0000000..992cecf --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/SampleOutWarehouseServiceImpl.java @@ -0,0 +1,239 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.DestroyOutboundDTO; +import digital.laboratory.platform.imr.dto.ReturnOutboundDTO; +import digital.laboratory.platform.imr.entity.*; +import digital.laboratory.platform.imr.entity.enums.OutboundType; +import digital.laboratory.platform.imr.feign.TransferFeignService; +import digital.laboratory.platform.imr.feign.dto.UpdateHolderDTO; +import digital.laboratory.platform.imr.mapper.*; +import digital.laboratory.platform.imr.service.SampleOutWarehouseService; +//import digital.laboratory.platform.common.seata.*; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import digital.laboratory.platform.sys.entity.CellAndStoreSupplyData; +import digital.laboratory.platform.sys.feign.RemoteCabinetService; +import io.seata.spring.annotation.GlobalTransactional; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +@Service +@RequiredArgsConstructor +public class SampleOutWarehouseServiceImpl implements SampleOutWarehouseService { + + + private final SampleStorageMapper storageMapper; + + + private final RemoteCabinetService cabinetService; + + private final SampleOutboundRecordMapper outboundRecordMapper; + + + private final TransferFeignService transferFeignService; + + + private final SampleInboundAndOutboundTableMapper tableMapper; + + + private final DestructionDetailMapper destructionDetailMapper; + + private final DestructionPublicityMapper publicityMapper; + + + + /** + * 销毁出库 + * + */ + @Override + @GlobalTransactional + public void destroyOutbound(DestroyOutboundDTO dto, DLPUser dlpUser) { + + //验证当前的样本id是否已经是待销毁状态 + for (String sampleId : dto.getSampleIds()) { + SampleStorage storage = storageMapper.selectOne(new QueryWrapper().eq("sample_id", sampleId)); + if (storage.getEarlyWarning() != 2) { + throw new RuntimeException(String.format("当前名称为" + storage.getName()) + "的样本不是审批通过的状态"); + } + /* + 这里做一下销毁出库要查询公示判断 + */ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("sample_id",sampleId); + List details = destructionDetailMapper.selectList(wrapper); + + if(details==null || details.size()==0){ + throw new RuntimeException("当前样本还未进行销毁公示"); + }else { + for (DestructionDetail detail:details) { + OutSampleVO sampleVO = storageMapper.getSampleById(detail.getSampleId()); + //查询样本看看是否已经发布 + DestructionPublicity destructionPublicity = publicityMapper.selectById(detail.getDestructionId()); + if(destructionPublicity.getStatus()==-1){ + //没查询出或者未发布的 + throw new RuntimeException("当前"+sampleVO.getName()+"样本还未进行销毁公示"); + } + } + } + + } + + /* + 验证完后 + 0.storage表修改为3出库 + 1.出库记录 + 2.出入库登记表 + 3.添加流转记录 + 4.修改样本状态 + 5.持有人 + */ + + for (String sampleId : dto.getSampleIds()) { + //0.storage表修改为3出库 + SampleStorage storage = storageMapper.selectOne(new QueryWrapper().eq("sample_id", sampleId)); + storage.setStatus(3);//已经出库 + storage.setRecipientId(dlpUser.getId());//检材管理员就是接受人 + storage.setOutRepositoryDate(LocalDateTime.now());//出库时间 + storage.setIsReturn(-1);//不需要归还 + storageMapper.updateById(storage); + + //2.出库记录 + SampleOutboundRecord sampleOutboundRecord = new SampleOutboundRecord(); + sampleOutboundRecord.setId(IdWorker.get32UUID().toUpperCase()); + sampleOutboundRecord.setOutboundType(OutboundType.DESTRUCTION);//销毁出库 + sampleOutboundRecord.setName(storage.getName());//样本名称--方便搜索 + sampleOutboundRecord.setRecipientId(dlpUser.getId());//领取人id + sampleOutboundRecord.setSampleId(sampleId); + + //后面的备注--当前样本已经销毁"+"销毁单位:"+xxx + sampleOutboundRecord.setReason("检材销毁出库");//把出库原因设置为备注 + sampleOutboundRecord.setOutboundDate(LocalDateTime.now());//出库时间 + outboundRecordMapper.insert(sampleOutboundRecord); + +// 2.修改样本出入库登记表--出库是修改操作先查询出sample对应的出入库登记表 + //程序文件中说明:检验时才填写出入库登记表 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("sample_id",sampleId); + queryWrapper.isNull("out_warehouse_date");//出库日期的数据 + SampleInboundAndOutboundTable table = tableMapper.selectOne(queryWrapper); + if(table != null){ + table.setOutboundSupervisor(dto.getSupervisor());//出库监督人 + table.setOutWarehouseDate(LocalDateTime.now());//出库时间 + tableMapper.updateById(table); + } +/* UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("sample_id",sampleId); + updateWrapper.isNull("appraiser_id");//鉴定人为空的数据 + updateWrapper.set("appraiser_id",null);//鉴定人 + updateWrapper.set("out_warehouse_date",LocalDateTime.now());//出库时间 + updateWrapper.set("remarks","当前样本已经出库销毁");//备注 + updateWrapper.set("return_time",null);//返回时间 + tableMapper.update(null,updateWrapper);*/ + +// 3.添加流转记录 + transferFeignService.addTransferByOut(sampleId,dlpUser.getId()); +// 4.修改样本状态 + transferFeignService.updateStatus(sampleId,8); + //5.持有人 + transferFeignService.updateSampleHolder(new UpdateHolderDTO(sampleId,dlpUser.getId())); + + ArrayList sampleIds = new ArrayList<>(); + sampleIds.add(storage.getSampleId()); + CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); + cellAndStoreSupplyData.setCellId(storage.getStorageCellId()); + cellAndStoreSupplyData.setCellStatus("1"); + cellAndStoreSupplyData.setStoreSupplyList(sampleIds); + /* + 柜子新接口 + */ + //cabinetService.updateCabinet(dto.getCellId(),str,"1"); + ArrayList supplyData = new ArrayList<>(); + supplyData.add(cellAndStoreSupplyData); + cabinetService.takeOrSaveGoodsFromCabinet(supplyData,-1); + } + } + + /** + * 退还出库 + * @param dto + * @param dlpUser + */ + @Override + @GlobalTransactional + public void returnOutbound(ReturnOutboundDTO dto, DLPUser dlpUser) { + + for (String sampleId : dto.getSampleIds()) { + SampleStorage storage = storageMapper.selectOne(new QueryWrapper().eq("sample_id", sampleId)); + if(storage==null){ + throw new RuntimeException("当前样本未找到在仓库信息"); + }else if (storage.getStatus()!=2) { + throw new RuntimeException(String.format("当前名称为" + storage.getName()) + "的样本不是审批通过的状态"); + } + + + /* + 0.修改当前storage表状态 + 1.流转记录表 + 2.修改样本当前状态 + 3.出库记录 + */ + //0.修改当前storage表状态 + storage.setIsReturn(-1);//不需要归还 + storage.setOutRepositoryDate(LocalDateTime.now());//出库时间 + storage.setRecipientId(dlpUser.getId());//领取人 + storage.setStatus(3);//已经出库 + storageMapper.updateById(storage); + + //1.流转记录表 + transferFeignService.addTransferByOut(sampleId,dlpUser.getId()); + + //2.修改sample状态(已经退还出库) + transferFeignService.updateStatus(sampleId,10);//退还出库 + + //3.出库记录 + SampleOutboundRecord sampleOutboundRecord = new SampleOutboundRecord(); + sampleOutboundRecord.setId(IdWorker.get32UUID().toUpperCase()); + sampleOutboundRecord.setOutboundType(OutboundType.RETURN);//退还出库 + sampleOutboundRecord.setName(storage.getName());//样本名称--方便搜索 + sampleOutboundRecord.setRecipientId(dto.getReturnInstitution());//这里把退还单位设置到领取人id中 + sampleOutboundRecord.setSampleId(sampleId); + sampleOutboundRecord.setReason(dto.getRemark());//备注 + sampleOutboundRecord.setOutboundDate(LocalDateTime.now());//出库时间 + outboundRecordMapper.insert(sampleOutboundRecord); + + //出入库登记表supervisor + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("sample_id",sampleId); + queryWrapper.isNull("out_warehouse_date");//出库日期的数据 + SampleInboundAndOutboundTable table = tableMapper.selectOne(queryWrapper); + if(table != null){ + table.setOutboundSupervisor(dto.getSupervisor());//出库监督人 + table.setOutWarehouseDate(LocalDateTime.now());//出库时间 + tableMapper.updateById(table); + } + ArrayList sampleIds = new ArrayList<>(); + sampleIds.add(storage.getSampleId()); + CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); + cellAndStoreSupplyData.setCellId(storage.getStorageCellId()); + cellAndStoreSupplyData.setCellStatus("1"); + cellAndStoreSupplyData.setStoreSupplyList(sampleIds); + /* + 柜子新接口 + */ + //cabinetService.updateCabinet(dto.getCellId(),str,"1"); + ArrayList supplyData = new ArrayList<>(); + supplyData.add(cellAndStoreSupplyData); + cabinetService.takeOrSaveGoodsFromCabinet(supplyData,-1); + } + } +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/SamplePutInStorageServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/SamplePutInStorageServiceImpl.java new file mode 100644 index 0000000..932987d --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/SamplePutInStorageServiceImpl.java @@ -0,0 +1,607 @@ +package digital.laboratory.platform.imr.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.imr.dto.DepositDTO; +import digital.laboratory.platform.imr.dto.IconDTO; +import digital.laboratory.platform.imr.dto.InRepositoryDTO; +import digital.laboratory.platform.imr.entity.*; +import digital.laboratory.platform.imr.feign.TransferFeignService; +import digital.laboratory.platform.imr.feign.dto.UpdateHolderDTO; +import digital.laboratory.platform.imr.mapper.*; +import digital.laboratory.platform.imr.service.SamplePutInStorageService; +import digital.laboratory.platform.imr.vo.InboundRecordVO; +import digital.laboratory.platform.imr.vo.OutSampleVO; +import digital.laboratory.platform.imr.vo.RepositorySampleVO; +import digital.laboratory.platform.imr.vo.SampleTableVO; +import digital.laboratory.platform.sys.entity.CellAndStoreSupplyData; +import digital.laboratory.platform.sys.feign.RemoteCabinetService; +import io.seata.spring.annotation.GlobalTransactional; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + +@Slf4j +@Service +@RequiredArgsConstructor +public class SamplePutInStorageServiceImpl implements SamplePutInStorageService { + + + private final RemoteCabinetService cabinetService; + + private final SampleInboundAndOutboundTableMapper tableMapper; + + private final SampleInboundRecordMapper recordMapper; + + private final SampleStorageMapper storageMapper; + + private final TransferFeignService transferFeignService; + + private final CabinetOpeningRecordMapper openingRecordMapper; + + private static Map> tempSampleInMap = new ConcurrentHashMap<>(); + + + + /** + * 销毁预警查询接口 + * @param page + * @param qw + * @return + */ + @Override + public IPage getDestructionVO(Page page, QueryWrapper qw) { + + IPage sampleVOList = storageMapper.getSampleVOList(page, qw); + for (RepositorySampleVO sampleVo:sampleVOList.getRecords()) { + sampleVo.setDescribe("样本存储期限快满"); + String eventName = ""; + //entrustment/hairJob/sewageJob + if (sampleVo.getSource().equals("entrustment")){ + //委托 + eventName = storageMapper.getEntrustmentName(sampleVo.getSampleId()); + }else if (sampleVo.getSource().equals("hairJob")) { + //毛发 + eventName = storageMapper.getHairJobName(sampleVo.getSampleId()); + }else if (sampleVo.getSource().equals("sewageJob")) { + //污水 + eventName = storageMapper.getSewageJobName(sampleVo.getSampleId()); + }else if (sampleVo.getSource().contains("Event")) { + //内部录入 + eventName = storageMapper.getEventName(sampleVo.getSampleId()); + }else { + //特征分析 + eventName = storageMapper.getFeatureName(sampleVo.getSampleId()); + } + //其他来源 + sampleVo.setEventName(eventName); + } + return sampleVOList; + } + + /** + * 出入库样本详情 + * 样本信息+出入库登记表信息 + * @param id + * @return + */ + @Override + public RepositorySampleVO getSampleDetailed(String id) { + + SampleStorage sampleStorage = storageMapper.selectById(id); + if(sampleStorage==null){ + throw new RuntimeException("当前数据不存在,请重试"); + } + //获取样本详情信息 + RepositorySampleVO sampleVO = storageMapper.getSampleDetailed(sampleStorage.getId()); + + String eventName = ""; + //entrustment/hairJob/sewageJob + if (sampleVO.getSource().equals("entrustment")){ + //委托 + eventName = storageMapper.getEntrustmentName(sampleVO.getSampleId()); + }else if (sampleVO.getSource().equals("hairJob")) { + //毛发 + eventName = storageMapper.getHairJobName(sampleVO.getSampleId()); + }else if (sampleVO.getSource().equals("sewageJob")) { + //污水 + eventName = storageMapper.getSewageJobName(sampleVO.getSampleId()); + }else if (sampleVO.getSource().contains("Event")) { + //内部录入 + eventName = storageMapper.getEventName(sampleVO.getSampleId()); + }else { + //特征分析 + eventName = storageMapper.getFeatureName(sampleVO.getSampleId()); + } + //其他来源--内部录入 + sampleVO.setEventName(eventName); + + //出入库登记表 + List table = tableMapper.getTableVO(sampleStorage.getSampleId()); + + sampleVO.setTableVO(table); + + return sampleVO ; + } + + @Override + public IPage getSampleVOList(Page page, QueryWrapper orderByDesc) { + IPage sampleVOList = storageMapper.getSampleVOList(page, orderByDesc); + + List records = sampleVOList.getRecords(); + + for (RepositorySampleVO sampleVO : records) { + + String eventName = ""; + //entrustment/hairJob/sewageJob/internal + if (sampleVO.getSource().equals("entrustment")){ + //委托 + eventName = storageMapper.getEntrustmentName(sampleVO.getSampleId()); + }else if (sampleVO.getSource().equals("hairJob")) { + //毛发 + eventName = storageMapper.getHairJobName(sampleVO.getSampleId()); + }else if (sampleVO.getSource().equals("sewageJob")) { + //污水 + eventName = storageMapper.getSewageJobName(sampleVO.getSampleId()); + } else if (sampleVO.getSource().contains("Event")) { + //内部录入 + eventName = storageMapper.getEventName(sampleVO.getSampleId()); + }else { + //特征分析 + eventName = storageMapper.getFeatureName(sampleVO.getSampleId()); + } + //其他来源 + sampleVO.setEventName(eventName); + } + + return sampleVOList; + } + + @Override + public IPage inboundRecord(Page page, QueryWrapper qw) { + + IPage inboundRecordVOIPage = recordMapper.inboundRecord(page, qw); + List records = inboundRecordVOIPage.getRecords(); + for (InboundRecordVO vo : records) { + String eventName = ""; + //entrustment/hairJob/sewageJob + if (vo.getSource().equals("entrustment")){ + //委托 + eventName = storageMapper.getEntrustmentName(vo.getSampleId()); + }else if (vo.getSource().equals("hairJob")) { + //毛发 + eventName = storageMapper.getHairJobName(vo.getSampleId()); + }else if (vo.getSource().equals("sewageJob")) { + //污水 + eventName = storageMapper.getSewageJobName(vo.getSampleId()); + } + else if (vo.getSource().contains("Event")) { + //内部录入 + eventName = storageMapper.getEventName(vo.getSampleId()); + }else { + //特征分析 + eventName = storageMapper.getFeatureName(vo.getSampleId()); + } + //其他来源 + vo.setEventName(eventName); + } + + return inboundRecordVOIPage; + } + + + + /** + * 扫描编号获取信息 + * @param sampleNo + * @return + */ + @Override + public List getSampleListByNo(String sampleNo) { + + //样本编号或检材编号 + List vo = storageMapper.getSampleListByNo(sampleNo); + +// if (vo.isEmpty()) { +// throw new RuntimeException(String.format("编号为"+sampleNo+"的样本不存在请重试")); +// } + return vo; + } + + + + /** 2... + * 仓库录入样本检材(无仓库样本表格) + * 录入单位为样本(盒子取消) + * (不考虑流转质量) + * @param sampleNos + * @param dlpUser + * @return + */ + @Override + @Transactional + public List sampleEntryRepository(List sampleNos, DLPUser dlpUser) { + + ArrayList sampleVOS = new ArrayList<>(); + + //验证样本编号的准确 + for (String sampleNo:sampleNos) { + OutSampleVO sampleVO = storageMapper.getSampleByNo(sampleNo); + if (sampleVO==null){ + throw new RuntimeException(String.format("编号为"+sampleNo+"的样本不存在请重试")); + } + SampleStorage sampleStorage = storageMapper.selectById(sampleVO.getSampleId()); + //已经录入到关联表;待存放状态 + if(sampleStorage!=null){ + if(sampleStorage.getStatus()==1||sampleStorage.getStatus()==2){ + throw new RuntimeException(String.format("编号为"+sampleNo+"的样本已录入")); + } else if (sampleStorage.getStatus()==3) {//已出库;现在是重新入库 + //重新入库是更新 + } + + }else { + //新录入仓库样本(添加操作) + SampleStorage storage = new SampleStorage(); + storage.setId(IdWorker.get32UUID().toUpperCase()); + storage.setStatus(1); + storage.setDepositorId(sampleVO.getHolder());//当前持有人变成入库人 + storage.setInRepositoryDate(LocalDateTime.now());//入库时间 + if (sampleVO.getCategory().equals("生物特性物证")){ + //存储时间为一年 + storage.setStorageDate(LocalDateTime.now().plusYears(1)); + }else { + //毒品和其他存储时间为长期(100年) + storage.setStorageDate(LocalDateTime.now().plusYears(100)); + } + storage.setSampleId(sampleVO.getSampleId());//样本id + storage.setEarlyWarning(0);//创建默认未到"销毁" + storage.setName(sampleVO.getName()); + storage.setSampleType(sampleVO.getSampleType());//样本类型 + //数据存储 + storageMapper.insert(storage); + } + + /*-- 远程调用 + 1.入库了这个当前持有人是变成仓库还是检材管理员 + + 2.流转记录要跟新 + 3.样本状态 + */ + //2. + transferFeignService.addTransferByInbound(sampleVO.getSampleId(),dlpUser.getId()); + + //1. + UpdateHolderDTO updateHolderDTO = new UpdateHolderDTO(); + updateHolderDTO.setHolder(dlpUser.getId()); + updateHolderDTO.setSampleId(sampleVO.getSampleId()); + transferFeignService.updateSampleHolder(updateHolderDTO); + + + + //入库记录 + SampleInboundRecord record = new SampleInboundRecord(); + record.setId(IdWorker.get32UUID().toUpperCase()); + record.setWarehousingPersonId(sampleVO.getHolder()); + record.setWarehousingDate(LocalDateTime.now()); + record.setImAdministrators(dlpUser.getId()); + record.setSampleId(sampleVO.getSampleId()); + record.setName(sampleVO.getName()); + record.setRemarks("检材入库"); + recordMapper.insert(record); + + //3.b_sample样本状态为已入库 + transferFeignService.updateStatus(sampleVO.getSampleId(),2); + + sampleVOS.add(storageMapper.getSampleByNo(sampleNo)); + } + // + return sampleVOS; + + } + + /** + * 第三种样本入库 + * (考虑流转质量) + * @param sample + * @param dlpUser + * @return + */ + + @Override + @Transactional + public List sampleInRepository(List sample, DLPUser dlpUser) { + + ArrayList sampleVOS = new ArrayList<>(); + for (InRepositoryDTO dto: sample) { + //先通过样本编号查询出这个样本的基本信息(重点是获取到id) + OutSampleVO sampleVO = storageMapper.getSampleById(dto.getSampleNo()); + if (sampleVO==null){ + throw new RuntimeException("样本不存在请重试"); + } + if (sampleVO.getSampleStatus()!=1 && sampleVO.getSampleStatus()!=14){//这里增加1和14的状态14是检验完成 + throw new RuntimeException(String.format("编号为"+sampleVO.getSampleNo()+"的样本当前状态不是入库状态")); + } + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("sample_id",sampleVO.getId()); + SampleStorage sampleStorage = storageMapper.selectOne(wrapper); + //已经录入到关联表;待存放状态 + if(sampleStorage!=null){ + if(sampleStorage.getStatus()==1||sampleStorage.getStatus()==2){ + throw new RuntimeException(String.format("编号为"+dto.getSampleNo()+"的样本已录入")); + } else if (sampleStorage.getStatus()==3) {//已出库;现在是重新入库 + //重新入库是更新(二次入库) + sampleStorage.setInRepositoryDate(LocalDateTime.now()); + sampleStorage.setRecipientId(null); + sampleStorage.setDepositorId(sampleVO.getHolder()); + sampleStorage.setStatus(1); + sampleStorage.setOutRepositoryDate(null); + storageMapper.updateById(sampleStorage); + + /* UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("sample_id", sampleVO.getSampleId()); + updateWrapper.set("in_repository_date",LocalDateTime.now());//入库时间 + updateWrapper.set("recipient_id",sampleVO.getHolder());//入库人 + updateWrapper.set("depositor_id",null);//删除领取人--这里把鉴定了设置为领取人; + updateWrapper.set("out_repository_date",null);//删除出库时间; + updateWrapper.set("status",1);//待存放 + storageMapper.update(null,updateWrapper);*/ + } + + }else { + //新录入仓库样本(添加操作) + SampleStorage storage = new SampleStorage(); + storage.setId(IdWorker.get32UUID().toUpperCase()); + storage.setStatus(1);//入库待存放 + storage.setDepositorId(sampleVO.getHolder());//当前持有人变成入库人 + storage.setInRepositoryDate(LocalDateTime.now());//入库时间 + if (sampleVO.getCategory().equals("生物特性物证")){ + //存储时间为一年 + storage.setStorageDate(LocalDateTime.now().plusYears(1)); + }else { + //毒品和其他存储时间为长期(100年) + storage.setStorageDate(LocalDateTime.now().plusYears(100)); + } + storage.setSampleId(sampleVO.getId());//样本id + storage.setEarlyWarning(0);//创建默认未到"销毁" + storage.setUnit(dto.getUnit());//单位 + storage.setQuality(dto.getQuality());//入库时的质量 + storage.setName(sampleVO.getName()); + storage.setSampleType(sampleVO.getSampleType());//样本类型 + //数据存储 + storageMapper.insert(storage); + } + + /*-- 远程调用 + 1.入库了这个当前持有人是变成仓库还是检材管理员 + 2.流转记录要跟新(但是当前入库时的样本质量怎么保证) + 3.b_sample样本状态为已入库 + */ + //2.入库记录流转记录表(考虑质量) + if (dto.getUnit()!=null && dto.getQuality()!=null){ + transferFeignService.addTransferByIn(sampleVO.getId(), dto.getUnit(), dto.getQuality(),dlpUser.getId()); + } + //不考虑质量 + transferFeignService.addTransferByInbound(sampleVO.getId(),dlpUser.getId()); + + //1.入库更新当前持有人(检材仓库) + UpdateHolderDTO updateHolderDTO = new UpdateHolderDTO(); + updateHolderDTO.setHolder(dlpUser.getId()); + updateHolderDTO.setSampleId(sampleVO.getId()); + transferFeignService.updateSampleHolder(updateHolderDTO);//远程调用 + + //更新出入库登记表(这里因为只有入库,所以就创建部分数据;入库一定是添加数据) + SampleInboundAndOutboundTable table = new SampleInboundAndOutboundTable(); + table.setId(IdWorker.get32UUID().toUpperCase()); + table.setImAdministrators(dlpUser.getId()); + table.setRecipient(sampleVO.getHolder());//持有人变入库人 + table.setRemarks("检材入库"); + table.setWarehousingDate(LocalDateTime.now());//入库时间 + table.setSampleId(sampleVO.getId()); + table.setInboundSupervisor(dto.getSupervisor());//入库监督人 + tableMapper.insert(table); + //新出入库登记表 + /* + 存在分析样本和留存样本两种 + */ +// if("A".equals(sampleVO.getSampleType())){//分析样 +// IdentificationMaterialTransferAnalysisAnnex analysisSample = new IdentificationMaterialTransferAnalysisAnnex(); +// analysisSample.setId(IdWorker.get32UUID().toUpperCase()); +// analysisSample.setAnalysisSampleInboundQuality(sampleVO.getExistingQuality());//现有质量 +// analysisSample.setInboundAdminId(dlpUser.getId()); +// analysisSample.setInboundHandledBy(sampleVO.getHolder());//经手人 +// analysisSample.setSampleId(sampleVO.getId());//样本id +// analysisSample.setAnalysisSampleInboundDate(LocalDateTime.now());//日期 +// analysisSample.setInboundAppraiserId(dto.getSupervisor());//入库监督人 +// analysisAnnexMapper.insert(analysisSample); +// }else { +// //留存样本 +// IdentificationMaterialTransferRetainedAnnex retainedAnnex = new IdentificationMaterialTransferRetainedAnnex(); +// retainedAnnex.setId(IdWorker.get32UUID().toUpperCase()); +// retainedAnnex.setRetainedSampleInboundQuality(sampleVO.getExistingQuality());//现有质量 +// retainedAnnex.setInboundAdminId(dlpUser.getId()); +// retainedAnnex.setInboundHandledBy(sampleVO.getHolder());//经手人 +// retainedAnnex.setSampleId(sampleVO.getId());//样本id +// retainedAnnex.setRetainedSampleInboundDate(LocalDateTime.now());//日期 +// retainedAnnex.setInboundAppraiserId(dto.getSupervisor());//入库监督人 +// retainedAnnexMapper.insert(retainedAnnex); +// } + + //入库记录 + SampleInboundRecord record = new SampleInboundRecord(); + record.setId(IdWorker.get32UUID().toUpperCase()); + record.setWarehousingPersonId(sampleVO.getHolder());//入库人 + record.setWarehousingDate(LocalDateTime.now()); + record.setImAdministrators(dlpUser.getId()); + record.setSampleId(sampleVO.getId()); + record.setName(sampleVO.getName()); + record.setRemarks("检材入库"); + recordMapper.insert(record); + + //3.b_sample样本状态为已入库 + transferFeignService.updateStatus(sampleVO.getId(),2); + + sampleVOS.add(storageMapper.getSampleById(dto.getSampleNo())); + } + + tempSampleInMap.remove(dlpUser.getId()); + log.warn("remove temporary put in storage sample, current map size: {}", tempSampleInMap.size()); + return sampleVOS; + } + + + /** + * 检材存放 + * @param dto + * @return + */ + @Override + @GlobalTransactional + public List sampleDepositRepository(DepositDTO dto) { + + ArrayList sampleIds = new ArrayList<>(); + List outSampleVOS = new ArrayList<>(); + for (String id:dto.getIds()) {//这里的id是样本存储表的id + SampleStorage sampleStorage = storageMapper.selectById(id); + if(sampleStorage==null){ + throw new RuntimeException(String.format("当前"+id+"样本存储数据为空")); + } + if(sampleStorage.getStatus()!=1){ + throw new RuntimeException(String.format("当前"+id+"样本不是待存放的状态")); + } + sampleStorage.setStorageLocation(dto.getStorageLocation()); + sampleStorage.setStatus(2);//入库已经存放 + sampleStorage.setStorageCellId(dto.getCellId());//存储格子id + sampleStorage.setRoomNo(dto.getRoomNo());//房间号 + sampleStorage.setBoxId(dto.getBoxId()); + sampleStorage.setCabinetName(dto.getCabinetName());//柜子名称 + sampleStorage.setBuildingLv(dto.getBuildingLv());//楼层 + //数据修改 + storageMapper.updateById(sampleStorage); + + //添加样本id + sampleIds.add(sampleStorage.getSampleId()); + + OutSampleVO sampleVO = storageMapper.getSampleById(sampleStorage.getSampleId()); + sampleVO.setStorageLocation(dto.getStorageLocation()); + outSampleVOS.add(sampleVO); + } + + //去除最后一个“,” + //String str = sampleIds.substring(0,sampleIds.lastIndexOf(",")); + + CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); + cellAndStoreSupplyData.setCellId(dto.getCellId());//格子id + cellAndStoreSupplyData.setCellStatus(dto.getCellStatus());//格子状态 + cellAndStoreSupplyData.setStoreSupplyList(sampleIds);//样本id + /* + 柜子新接口 + */ + //cabinetService.updateCabinet(dto.getCellId(),str,"1"); + ArrayList supplyData = new ArrayList<>(); + supplyData.add(cellAndStoreSupplyData); + cabinetService.takeOrSaveGoodsFromCabinet(supplyData,1); + return outSampleVOS; + } + + //流转模块角标总和 + @Override + public IconDTO getTransferIconCount(String id) { + + Long transferCount = storageMapper.getTransferCount(id); + + Long witnessCount = storageMapper.getWitnessCount(id); + + Long count = transferCount + witnessCount; + IconDTO transfer = null; + if(count!=0){ + transfer = new IconDTO(count, 5, "transfer"); + } + return transfer; + } + + //修改质量 + @Override + public void updateSampleQuality(String sampleId, double sampleQuality) { + //先查询出能不能修改 + + openingRecordMapper.updateSampleQuality(sampleId,sampleQuality); + } + + /** + * 临时处理样本入库 + * @param vos + * @param user + */ + @Override + public void temporaryProcessSampleIn(List vos, DLPUser user) { + String userId = user.getId(); + for (OutSampleVO vo : vos) { + if (tempSampleInMap.containsKey(userId)) { + Set sampleIds = tempSampleInMap.get(userId); + if (vo.getIsPutIn().equals(1)) { + sampleIds.add(vo.getId()); + } else { + sampleIds.remove(vo.getId()); + } + tempSampleInMap.put(userId, sampleIds); + } else { + Set synchronizedSet = Collections.synchronizedSet(new HashSet<>()); + synchronizedSet.add(vo.getId()); + tempSampleInMap.put(userId, synchronizedSet); + } + } + } + + /** + * 一个检材入库时的可选检材列表 + */ + @Override + public Map> choseSampleList(String keyWords) { + List voList = storageMapper.choseSampleList(); + Map> resultMap = new HashMap<>(); + if (CollUtil.isNotEmpty(tempSampleInMap)) { + Set idSet = Collections.synchronizedSet(new HashSet<>()); + tempSampleInMap.forEach((k, v) -> { + idSet.addAll(v); + }); + log.info("void ==== {}", idSet.toString()); + List inSampleList = new ArrayList<>(); + List waitInSampleList = new ArrayList<>(); + for (OutSampleVO outSampleVO : voList) { + if (idSet.contains(outSampleVO.getId())) { + inSampleList.add(outSampleVO); + } else { + waitInSampleList.add(outSampleVO); + } + } + if (StrUtil.isNotBlank(keyWords)) { + waitInSampleList = waitInSampleList.stream() + .filter(sampleVo -> sampleVo.getSampleNo().contains(keyWords) || sampleVo.getName().contains(keyWords)) + .collect(Collectors.toList()); + } + resultMap.put("putInStorage", inSampleList); + resultMap.put("waitPutInStorage", waitInSampleList); + return resultMap; + } + if (StrUtil.isNotBlank(keyWords)) { + voList = voList.stream() + .filter(sampleVo -> sampleVo.getSampleNo().contains(keyWords) || sampleVo.getName().contains(keyWords)) + .collect(Collectors.toList()); + } + resultMap.put("waitPutInStorage", voList); + return resultMap; + } + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/StorageCellServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/StorageCellServiceImpl.java new file mode 100644 index 0000000..60846ee --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/StorageCellServiceImpl.java @@ -0,0 +1,18 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.imr.entity.StorageCell; +import digital.laboratory.platform.imr.mapper.StorageCellMapper; +import digital.laboratory.platform.imr.service.StorageCellService; +import org.springframework.stereotype.Service; + +/** + * 服务实现类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 服务实现类 + */ +@Service +public class StorageCellServiceImpl extends ServiceImpl implements StorageCellService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/StorageCupboardServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/StorageCupboardServiceImpl.java new file mode 100644 index 0000000..d9b2905 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/StorageCupboardServiceImpl.java @@ -0,0 +1,18 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.imr.entity.StorageCupboard; +import digital.laboratory.platform.imr.mapper.StorageCupboardMapper; +import digital.laboratory.platform.imr.service.StorageCupboardService; +import org.springframework.stereotype.Service; + +/** + * 服务实现类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 服务实现类 + */ +@Service +public class StorageCupboardServiceImpl extends ServiceImpl implements StorageCupboardService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/service/impl/StorageRoomServiceImpl.java b/src/main/java/digital/laboratory/platform/imr/service/impl/StorageRoomServiceImpl.java new file mode 100644 index 0000000..a26c7f7 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/StorageRoomServiceImpl.java @@ -0,0 +1,18 @@ +package digital.laboratory.platform.imr.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import digital.laboratory.platform.imr.entity.StorageRoom; +import digital.laboratory.platform.imr.mapper.StorageRoomMapper; +import digital.laboratory.platform.imr.service.StorageRoomService; +import org.springframework.stereotype.Service; + +/** + * 服务实现类 + * + * @author Zhang Xiaolong created at 2023-03-17 + * @describe 服务实现类 + */ +@Service +public class StorageRoomServiceImpl extends ServiceImpl implements StorageRoomService { + +} diff --git a/src/main/java/digital/laboratory/platform/imr/task/DestructionWarning.java b/src/main/java/digital/laboratory/platform/imr/task/DestructionWarning.java new file mode 100644 index 0000000..80ae2ad --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/task/DestructionWarning.java @@ -0,0 +1,42 @@ +package digital.laboratory.platform.imr.task; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import digital.laboratory.platform.imr.entity.SampleStorage; +import digital.laboratory.platform.imr.mapper.SampleStorageMapper; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; + +import java.time.LocalDateTime; +import java.util.List; + +@Configuration +@EnableScheduling +@RequiredArgsConstructor +public class DestructionWarning { + + + private final SampleStorageMapper storageMapper; + + + //测试定时器 + @Scheduled(cron = "0 0/1 * * * ?")//60秒执行一次 + public void testTimer(){ + + //获取取当前时间+7>=存储期限的sample + LocalDateTime localDateTime = LocalDateTime.now().plusDays(7L);//当前时间+7天 + //查询数据库有哪些数据是符合该条件的 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.le("storage_date",localDateTime); + queryWrapper.eq("early_warning",0);//只能是未销毁预警状态的样本 + List sampleStorages = storageMapper.selectList(queryWrapper); + if(!sampleStorages.isEmpty()){ + System.out.println("定时任务启动"); + for (SampleStorage sample:sampleStorages) { + sample.setEarlyWarning(1);//销毁预警值;该样本待申请销毁 + storageMapper.updateById(sample); + } + } + } +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/AnalysisSample.java b/src/main/java/digital/laboratory/platform/imr/vo/AnalysisSample.java new file mode 100644 index 0000000..6184708 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/AnalysisSample.java @@ -0,0 +1,36 @@ +package digital.laboratory.platform.imr.vo; + + +import digital.laboratory.platform.imr.entity.IdentificationMaterialTransferAnalysisAnnex; +import lombok.Data; + +@Data +public class AnalysisSample extends IdentificationMaterialTransferAnalysisAnnex { + + + + private Integer number1;//序号 + + + private String inboundDate; //入库时间 + + private String outboundDate; //出库时间 + + + private String inboundAppraiserName;//入库监督人 + + + private String outboundAppraiserName;//出库监督人 + + + private String inboundAdminName;//入库管理员 + + + private String outboundAdminName;//出库管理员 + + + private String inboundHandledByName;//入库经手人 + private String outboundHandledByName;//出库经手人 + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/ApplySampleVO.java b/src/main/java/digital/laboratory/platform/imr/vo/ApplySampleVO.java new file mode 100644 index 0000000..d679dab --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/ApplySampleVO.java @@ -0,0 +1,61 @@ +package digital.laboratory.platform.imr.vo; + +import digital.laboratory.platform.imr.entity.SampleApplyDetailed; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 仅用于申请的样本显示(销毁/外带) + * 申请样本VO + * 这个vo是申请的查看详情显示 + */ + +@Data +@ApiModel(value = "样本申请明细vo") +public class ApplySampleVO extends SampleApplyDetailed { + + + /** + * 样本审核状态 + */ + @ApiModelProperty(value="状态描述") + private String describeStatus; + + /** + * 样本名称 + */ + @ApiModelProperty(value="样本名称") + private String name; + + + /** + * 样本编号 + */ + @ApiModelProperty(value="样本编号") + private String sampleNo; + + /** + * 性状 + */ + + + @ApiModelProperty(value="样本性状") + private String form; + + + /** + * 当前样本类型(A/B) + */ + @ApiModelProperty(value="当前样本类型(A/B)") + private String sampleType; + + + @ApiModelProperty(value="样本类型类别)") + private String category; + + @ApiModelProperty(value="存储方式") + private String storageMethod; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/BaseEvent.java b/src/main/java/digital/laboratory/platform/imr/vo/BaseEvent.java new file mode 100644 index 0000000..9877f7f --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/BaseEvent.java @@ -0,0 +1,20 @@ +package digital.laboratory.platform.imr.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +public class BaseEvent { + + + @ApiModelProperty(value = "委托/任务id") + private String EventId; + + @ApiModelProperty(value = "mf--毛发/wt--委托/ws--污水--其他....") + private String source; + + + @ApiModelProperty(value = "事件名称") + private String EventName; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/BaseSampleDetail.java b/src/main/java/digital/laboratory/platform/imr/vo/BaseSampleDetail.java new file mode 100644 index 0000000..a0d65cd --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/BaseSampleDetail.java @@ -0,0 +1,101 @@ +package digital.laboratory.platform.imr.vo; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class BaseSampleDetail { + + + @ApiModelProperty(value="样本id") + private String id; + + /** + * 样本编号 + */ + + @ApiModelProperty(value="样本编号") + private String sampleNo; + + /** + * 样本名称 + */ + @ApiModelProperty(value="样本名称") + private String name; + + + /** + * 样本类型 + */ + @ApiModelProperty(value="样本类型") + private String sampleType; + + + /** + *类别 + */ + @ApiModelProperty(value="类别") + private String category; + + /** + * 存储方式 + */ + @ApiModelProperty(value="存储方式") + private String storageMethod; + + + + /** + * 性状 + */ + @ApiModelProperty(value="性状") + private String form; + + /** + * 来源 + */ + @ApiModelProperty(value="来源") + private String source; + + @ApiModelProperty(value="来源名称") + private String sourceName; + + /** + * 提取方式 + */ + @ApiModelProperty(value="提取方式") + private String drawWay; + + /** + * 质量 + */ + @ApiModelProperty(value="质量") + private double quantity; + /** + * 计量单位 + */ + @ApiModelProperty(value="计量单位") + private String unit; + + /** + * 送检单位 + */ + @ApiModelProperty(value="送检单位") + private String orgName; + + + /** + * 受理人 + */ + @ApiModelProperty(value="受理人") + private String acceptedBy; + + /** + * 现有质量 + */ + @ApiModelProperty(value="现有质量") + private BigDecimal existingQuality; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/BaseSampleVO.java b/src/main/java/digital/laboratory/platform/imr/vo/BaseSampleVO.java new file mode 100644 index 0000000..77ecb83 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/BaseSampleVO.java @@ -0,0 +1,64 @@ +package digital.laboratory.platform.imr.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +public class BaseSampleVO { + /** + * 样本id + */ + + @ApiModelProperty(value="storage表id--生成出库清单时才使用") + private String id; + + + @ApiModelProperty(value="样本id--不是主键id") + private String sampleId; + + /** + * 样本编号 + */ + + private String sampleNo; + + /** + * 样本名称 + */ + private String name; + + + /** + * 样本类型 + */ + private String sampleType; + + + /** + *类别 + */ + private String category; + + /** + * 存储方式 + */ + private String storageMethod; + + /** + * 样本状态 + */ + private Integer sampleStatus; + + + /** + * 样本存储位置(看情况显示) + */ + private String storageLocation; + + /** + * 性状 + */ + private String form; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/CabinetSampleVO.java b/src/main/java/digital/laboratory/platform/imr/vo/CabinetSampleVO.java new file mode 100644 index 0000000..99e9a70 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/CabinetSampleVO.java @@ -0,0 +1,70 @@ +package digital.laboratory.platform.imr.vo; + + +import digital.laboratory.platform.imr.entity.SampleStorage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@ApiModel(value = "柜子样本vo") +public class CabinetSampleVO { + + @ApiModelProperty(value="案件/事件名称") + private String eventName; + + @ApiModelProperty(value="来源") + private String source; + + @ApiModelProperty(value="检材/样本来源名称") + private String sourceName; + + @ApiModelProperty(value="检材编号") + private String imNu; + + @ApiModelProperty(value="样本名称") + private String sampleName; + + @ApiModelProperty(value="A/B") + private String sampleType; + + @ApiModelProperty(value="样本编号") + private String sampleNo; + + @ApiModelProperty(value="样本id") + private String sampleId; + + @ApiModelProperty(value="现有质量") + private double quality; + + @ApiModelProperty(value="单位") + private String unit; + + @ApiModelProperty(value="判断标识 true表示有存储,false表示无存储") + private Boolean identifying; + + + /** + * 存储位置 + */ + @ApiModelProperty(value="存储位置") + private String storageLocation; + + @ApiModelProperty(value="存储的格子id") + private String storageCellId; + + @ApiModelProperty(value="楼层") + private String buildingLv; + + @ApiModelProperty(value="房间号") + private String roomNo; + + @ApiModelProperty(value="柜子名称") + private String cabinetName; + + @ApiModelProperty(value="柜子id") + private String boxId; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/CellVO.java b/src/main/java/digital/laboratory/platform/imr/vo/CellVO.java new file mode 100644 index 0000000..d4402a5 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/CellVO.java @@ -0,0 +1,46 @@ +package digital.laboratory.platform.imr.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@ApiModel("格子显示vo") +@AllArgsConstructor +@NoArgsConstructor +public class CellVO { + + @ApiModelProperty("格子id") + private String cellId; + + @ApiModelProperty("格子名称") + private String cellName; + + + @ApiModelProperty(value="楼层") + private String buildingLv; + + @ApiModelProperty(value="房间号") + private String roomNo; + + @ApiModelProperty(value="柜子名称") + private String cabinetName; + + @ApiModelProperty(value="柜子id") + private String boxId; + + + @ApiModelProperty(value="出库申请样本信息描述(部分简单信息)") + List sampleList; + + private Integer number; + private String location; + + private Integer cabinetType; + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/DestructionPublicityVO.java b/src/main/java/digital/laboratory/platform/imr/vo/DestructionPublicityVO.java new file mode 100644 index 0000000..3f20360 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/DestructionPublicityVO.java @@ -0,0 +1,33 @@ +package digital.laboratory.platform.imr.vo; + +import digital.laboratory.platform.imr.entity.DestructionPublicity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel(value = "DestructionPublicityVO",description = "销毁公示vo") +public class DestructionPublicityVO extends DestructionPublicity { + + /** + * 申请人姓名 + */ + + @ApiModelProperty("申请人姓名") + private String applicantName; + + /** + * 审核人姓名 + */ + @ApiModelProperty("审核人姓名") + private String reviewerName; + + + /** + *对应的样本vo + */ + @ApiModelProperty("样本显示vo") + private List sampleVO; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/IconVO.java b/src/main/java/digital/laboratory/platform/imr/vo/IconVO.java new file mode 100644 index 0000000..56aec86 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/IconVO.java @@ -0,0 +1,26 @@ +package digital.laboratory.platform.imr.vo; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +@ApiModel("部分模块角标显示vo") +public class IconVO { + + + @ApiModelProperty("名字") + private String name; + + + + + @ApiModelProperty("true显示;false不显示") + private Boolean icon; +} + + + diff --git a/src/main/java/digital/laboratory/platform/imr/vo/InAndOutInfos.java b/src/main/java/digital/laboratory/platform/imr/vo/InAndOutInfos.java new file mode 100644 index 0000000..ffc156b --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/InAndOutInfos.java @@ -0,0 +1,27 @@ +package digital.laboratory.platform.imr.vo; + +import lombok.Data; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 出入库登记表打印vo + */ +@Data +public class InAndOutInfos { + + private Integer number;//序号 + private String sampleNo;//编号 + private String sampleType;//样本类型 + private LocalDate warehousingDate;//入库时间 + private LocalDate outWarehouseDate;//出库时间 + private String appraiserName;//鉴定人姓名 + private LocalDate returnTime;//归还时间 + private String imName;//检材管理员 + private String remarks;//备注 + private String inboundSupervisorName;//入库监督人 + private String outboundSupervisorName;//出库监督人 + + private LocalDateTime createTime; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/InboundRecordVO.java b/src/main/java/digital/laboratory/platform/imr/vo/InboundRecordVO.java new file mode 100644 index 0000000..5e508e6 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/InboundRecordVO.java @@ -0,0 +1,52 @@ +package digital.laboratory.platform.imr.vo; + +import digital.laboratory.platform.imr.entity.SampleInboundRecord; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "入库记录vo") +public class InboundRecordVO extends SampleInboundRecord { + + + @ApiModelProperty(value = "样本编号") + private String sampleNo; + + + @ApiModelProperty(value = "来源") + private String source; + + + @ApiModelProperty(value = "事件名称") + private String eventName; + + + @ApiModelProperty(value = "样本类型") + private String sampleType; + + + @ApiModelProperty(value = "样本类别") + private String category; + + + @ApiModelProperty(value = "样本性状") + private String form; + + + @ApiModelProperty(value = "存储方式") + private String storageMethod; + + + @ApiModelProperty(value = "存放人") + private String depositorName ; + + @ApiModelProperty(value = "检材管理员") + private String imAdministratorsName ; + + + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/OutSampleVO.java b/src/main/java/digital/laboratory/platform/imr/vo/OutSampleVO.java new file mode 100644 index 0000000..4e194ca --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/OutSampleVO.java @@ -0,0 +1,104 @@ +package digital.laboratory.platform.imr.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 出库样本VO + */ + +@Data +@ApiModel(value = "样本基本数据") +public class OutSampleVO { + + + /** + * 主键id + */ + @ApiModelProperty(value="主键id--这里的id指定sample_storage表") + private String id; // + + /** + * 样本id + */ + + @ApiModelProperty(value="样本id--不是主键id") + private String sampleId; //不是主键id + + /** + * 样本编号 + */ + + private String sampleNo; + + + + private String cellId;//格子id + + /** + * 样本名称 + */ + private String name; + + + /** + * 样本类型 + */ + private String sampleType; + + + /** + *类别 + */ + private String category; + + /** + * 现有质量 + */ + private BigDecimal existingQuality; + + /** + * 存储方式 + */ + private String storageMethod; + + /** + * 样本状态 + */ + private Integer sampleStatus; + + + /** + * 样本存储位置(看情况显示) + */ + private String storageLocation; + + private String roomNo; + + /** + * 性状 + */ + private String form; + + /** + * 当前持有人 + */ + private String holder; + + /** + * 当前持有人姓名 + */ + private String holderName; + + + + private String eventName;//事件名称 + + private String source;//事件名称 + + @ApiModelProperty("判断是到入库列表还是移出列表, 0 移除 | 1 移入") + private Integer isPutIn; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/OutboundRecordVO.java b/src/main/java/digital/laboratory/platform/imr/vo/OutboundRecordVO.java new file mode 100644 index 0000000..f05a96b --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/OutboundRecordVO.java @@ -0,0 +1,25 @@ +package digital.laboratory.platform.imr.vo; + +import digital.laboratory.platform.imr.entity.SampleOutboundRecord; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 样本出库记录vo + */ +@Data +@ApiModel(value = "样本出库记录vo") +public class OutboundRecordVO extends SampleOutboundRecord { + + @ApiModelProperty(value = "领取人") + private String recipientName; + + + @ApiModelProperty(value="样本编号") + private String sampleNo; + + @ApiModelProperty(value="状态码") + private Integer statusCode; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/RecipientDTO.java b/src/main/java/digital/laboratory/platform/imr/vo/RecipientDTO.java new file mode 100644 index 0000000..cac9f15 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/RecipientDTO.java @@ -0,0 +1,27 @@ +package digital.laboratory.platform.imr.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +@ApiModel(value = "领取人信息dto") +public class RecipientDTO extends ToBeReturnVO { + + + + @ApiModelProperty(value = "用途") + private String purpose; + + + @ApiModelProperty(value = "领取人id") + private String recipientId; + + @ApiModelProperty(value="部门") + private String department; + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/RepositorySampleVO.java b/src/main/java/digital/laboratory/platform/imr/vo/RepositorySampleVO.java new file mode 100644 index 0000000..cc3deef --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/RepositorySampleVO.java @@ -0,0 +1,80 @@ +package digital.laboratory.platform.imr.vo; + +import cn.hutool.db.meta.Table; +import digital.laboratory.platform.imr.entity.SampleStorage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javassist.tools.rmi.Sample; +import lombok.Data; + +import java.util.List; + +/** + * 仓库现有样本VOD + */ + +@Data +@ApiModel(value = "仓库现有样本vo") +public class RepositorySampleVO extends SampleStorage { + + @ApiModelProperty(value = "样本编号") + private String sampleNo; + + + @ApiModelProperty(value = "事件名称") + private String eventName; + + + @ApiModelProperty(value = "样本类别") + private String category; + + + @ApiModelProperty(value = "样本性状") + private String form; + + + @ApiModelProperty(value = "存储方式") + private String storageMethod; + + @ApiModelProperty(value = "存放人--拿来入库的人") + private String depositorName; + + @ApiModelProperty(value = "领取人") + private String recipientName; + + + @ApiModelProperty(value = "描述") + private String describe;//销毁预警描述 + + + + @ApiModelProperty(value = "送检单位") + private String orgName;//送检单位 + + @ApiModelProperty(value = "检材编号") + private String imNo;//检材编号 + + + @ApiModelProperty(value = "来源") + private String source;//来源 + + + @ApiModelProperty(value = "来源名称") + private String sourceName;//来源 + + @ApiModelProperty(value = "检材管理员姓名") + private String imAdministratorsName;//来源 + + + + + @ApiModelProperty(value = "出入库登记表vo") + private List tableVO;//来源 + + + + + + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/RetainedSample.java b/src/main/java/digital/laboratory/platform/imr/vo/RetainedSample.java new file mode 100644 index 0000000..2453501 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/RetainedSample.java @@ -0,0 +1,36 @@ +package digital.laboratory.platform.imr.vo; + + +import digital.laboratory.platform.imr.entity.IdentificationMaterialTransferRetainedAnnex; +import lombok.Data; + +@Data +public class RetainedSample extends IdentificationMaterialTransferRetainedAnnex { + + + + private Integer number2;//序号 + + + private String inboundDate; //入库时间 + + private String outboundDate; //出库时间 + + + private String inboundAppraiserName;//入库监督人 + + + private String outboundAppraiserName;//出库监督人 + + + private String inboundAdminName;//入库管理员 + + + private String outboundAdminName;//出库管理员 + + + private String inboundHandledByName;//入库经手人 + private String outboundHandledByName;//出库经手人 + + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/SampleApplyVO.java b/src/main/java/digital/laboratory/platform/imr/vo/SampleApplyVO.java new file mode 100644 index 0000000..015ede5 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/SampleApplyVO.java @@ -0,0 +1,56 @@ +package digital.laboratory.platform.imr.vo; +import digital.laboratory.platform.imr.entity.SampleApply; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel(value = "SampleApplyVO",description = "检材申请vo") +public class SampleApplyVO extends SampleApply { + + /** + * + */ + @ApiModelProperty(value="一级审核员姓名") + private String firstAuditorName; + + + @ApiModelProperty(value="状态码") + private Integer statusCode; + + + + /** + * 二级审核员姓名 + */ + @ApiModelProperty(value="二级审核员姓名") + private String secondaryAuditName; + + + /** + * 审批人姓名 + */ + @ApiModelProperty(value="approverName") + private String approverName; + + + /** + * 申请人姓名 + */ + @ApiModelProperty(value="申请人姓名") + private String applicantName; + + /** + * 申请人部门 + */ + @ApiModelProperty(value="申请人部门") + private String applicantDepartment; + + /** + * 对应的样本信息vo + */ + @ApiModelProperty(value="对应的样本信息vo") + private List sampleVO; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/SampleOutWarehouseApplyVO.java b/src/main/java/digital/laboratory/platform/imr/vo/SampleOutWarehouseApplyVO.java new file mode 100644 index 0000000..de0a093 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/SampleOutWarehouseApplyVO.java @@ -0,0 +1,49 @@ +package digital.laboratory.platform.imr.vo; + +import digital.laboratory.platform.imr.entity.SampleOutWarehouseApply; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 出库申请VO + */ + +@Data +@ApiModel(value = "领用出库申请vo") +public class SampleOutWarehouseApplyVO extends SampleOutWarehouseApply { + /** + * 申请人姓名 + */ + + @ApiModelProperty(value="申请人") + private String applicantName ; + + @ApiModelProperty(value="数量") + private Long amount ; + + + @ApiModelProperty(value="状态码") + private Integer statusCode ; + + + /** + * 鉴定人姓名 + */ + @ApiModelProperty(value="鉴定人姓名") + private String assigneeName ; + + /** + * 出库申请样本信息描述(部分简单信息) + */ + + @ApiModelProperty(value="出库申请样本信息描述(部分简单信息)") + List sampleList; + + + + @ApiModelProperty(value="取检码获取的格子vo") + List CellVOS; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/SampleTableVO.java b/src/main/java/digital/laboratory/platform/imr/vo/SampleTableVO.java new file mode 100644 index 0000000..e27fc77 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/SampleTableVO.java @@ -0,0 +1,28 @@ +package digital.laboratory.platform.imr.vo; + +import digital.laboratory.platform.imr.entity.SampleInboundAndOutboundTable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@ApiModel +@Data +public class SampleTableVO extends SampleInboundAndOutboundTable { + + + @ApiModelProperty(value = "鉴定人姓名") + private String appraiserName; + @ApiModelProperty(value = "检材管理员") + private String imName; + @ApiModelProperty(value = "存放人姓名") + private String recipientName; + + + @ApiModelProperty(value = "入库监督人") + private String inboundSupervisorName; + + + @ApiModelProperty(value = "出库监督人") + private String outboundSupervisorName; + +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/StatisticsCount.java b/src/main/java/digital/laboratory/platform/imr/vo/StatisticsCount.java new file mode 100644 index 0000000..8a28e06 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/StatisticsCount.java @@ -0,0 +1,17 @@ +package digital.laboratory.platform.imr.vo; + + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class StatisticsCount { + + + private String name; + + + + private Long count; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/StatusSampleVO.java b/src/main/java/digital/laboratory/platform/imr/vo/StatusSampleVO.java new file mode 100644 index 0000000..7966af4 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/StatusSampleVO.java @@ -0,0 +1,17 @@ +package digital.laboratory.platform.imr.vo; + +import lombok.Data; + +@Data +public class StatusSampleVO { + + private String id; + + + private String name; + + private String sampleNo; + + + private Integer status; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/StoragePictureVO.java b/src/main/java/digital/laboratory/platform/imr/vo/StoragePictureVO.java new file mode 100644 index 0000000..821e032 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/StoragePictureVO.java @@ -0,0 +1,26 @@ +package digital.laboratory.platform.imr.vo; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "显示存放位置的图片vo对象") +public class StoragePictureVO { + + + @ApiModelProperty(value = "存储位置") + private String storageLocation; + + + @ApiModelProperty(value = "照片集合") + List theHttpServletRequest; +} diff --git a/src/main/java/digital/laboratory/platform/imr/vo/ToBeReturnVO.java b/src/main/java/digital/laboratory/platform/imr/vo/ToBeReturnVO.java new file mode 100644 index 0000000..2d48d9e --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/vo/ToBeReturnVO.java @@ -0,0 +1,59 @@ +package digital.laboratory.platform.imr.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +import java.time.LocalDateTime; +@Data +@ApiModel(value = "待归还样本信息") +public class ToBeReturnVO { + + @ApiModelProperty(value = "storage表主键id--不是样本id") + private String id; + + @ApiModelProperty(value = "样本id") + private String sampleId; + + @ApiModelProperty(value = "事件名称") + private String eventName; + + @ApiModelProperty(value = "样本名称") + private String name; + + @ApiModelProperty(value = "样本编号") + private String sampleNo; + + @ApiModelProperty(value = "样本性状") + private String form; + + + @ApiModelProperty(value = "样本类别") + private String category; + + @ApiModelProperty(value = "来源") + private String source; + + @ApiModelProperty(value = "样本类别") + private String sampleType; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @JSONField(format = "yyyy-MM-dd") + @ApiModelProperty(value = "归还时间") + private LocalDate returnTime; + + + + @ApiModelProperty(value = "存储方式") + private String storageMethod; + + + @ApiModelProperty(value = "领取人") + private String recipientName; + + @ApiModelProperty(value="出库时间") + private LocalDateTime outRepositoryDate; +} diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt new file mode 100644 index 0000000..bca2437 --- /dev/null +++ b/src/main/resources/banner.txt @@ -0,0 +1,12 @@ +${AnsiColor.BRIGHT_GREEN} + +检材仓库 +检材仓库 +检材仓库 + +检材仓库(Identifion Mmaterial Repository) + +版本: ${version} +创建: ${timestamp} + +${AnsiColor.DEFAULT} diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..ecb2eb4 --- /dev/null +++ b/src/main/resources/bootstrap.yml @@ -0,0 +1,60 @@ +logging: + level: + digital.laboratory.platform.camera.mapper: debug + +server: + port: 5208 + +mybatis-plus: + type-handlers-package: digital.laboratory.platform.imr.config + type-aliases-package: digital.laboratory.platform.imr.entity + mapper-locations: classpath:mapper/*Mapper.xml + typeEnumsPackage: digital.laboratory.platform.imr.entity.enums # 支持统配符 * 或者 ; 分割 + +spring: + application: + name: @artifactId@ + cloud: + nacos: + discovery: + server-addr: ${NACOS_HOST:dlp-nacos}:${NACOS_PORT:8848} + config: + server-addr: ${spring.cloud.nacos.discovery.server-addr} + file-extension: yml + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + profiles: + active: @profiles.active@ + datasource: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + username: root + password: 7990016 + url: jdbc:mysql://dlp-mysql:3306/dlp_identification_material_repository?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true + servlet: + multipart: + # 根据实际需求作调整 + # 默认最大上传文件大小为1M, 单个文件大小 + max-file-size: 20MB + # 默认最大请求大小为10M, 总上传的数据大小 + max-request-size: 55MB +# main: +# allow-bean-definition-overriding: true + +# 文件上传相关 支持阿里云、华为云、腾讯、minio +#oss: +# endpoint: http://127.0.0.1:9000 +# accessKey: 2PRf8hGarvXOVRTK +# secretKey: Ez564zLT2blBax5uv19kFq3nbFbLXB2k +# bucket-name: fan-bucket + +# 文件上传相关 支持阿里云、华为云、腾讯、minio +oss: + endpoint: http://127.0.0.1:9000 + accessKey: dlp + secretKey: 87990016 + bucket-name: dlpfiles + + + + diff --git a/src/main/resources/mapper/AssociationOpenMapper.xml b/src/main/resources/mapper/AssociationOpenMapper.xml new file mode 100644 index 0000000..5297236 --- /dev/null +++ b/src/main/resources/mapper/AssociationOpenMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/CabinetOpeningRecordMapper.xml b/src/main/resources/mapper/CabinetOpeningRecordMapper.xml new file mode 100644 index 0000000..46b5ab4 --- /dev/null +++ b/src/main/resources/mapper/CabinetOpeningRecordMapper.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update dlp_identification_material_transfer.b_sample + set existing_quality = #{sampleQuality} + where id = #{sampleId} + + + + diff --git a/src/main/resources/mapper/DestructionDetailMapper.xml b/src/main/resources/mapper/DestructionDetailMapper.xml new file mode 100644 index 0000000..00df293 --- /dev/null +++ b/src/main/resources/mapper/DestructionDetailMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/DestructionPublicityMapper.xml b/src/main/resources/mapper/DestructionPublicityMapper.xml new file mode 100644 index 0000000..f541e45 --- /dev/null +++ b/src/main/resources/mapper/DestructionPublicityMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select dp.*, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=dp.applicant_id + ) AS applicant_name, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=dp.reviewer_id + ) AS reviewer_name + from dlp_identification_material_repository.destruction_publicity dp + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/DrugCaseInfoMapper.xml b/src/main/resources/mapper/DrugCaseInfoMapper.xml new file mode 100644 index 0000000..f28674c --- /dev/null +++ b/src/main/resources/mapper/DrugCaseInfoMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + id,case_name,case_no, + handing_over_org,handing_over_date,create_time, + update_time,create_by,update_by + + diff --git a/src/main/resources/mapper/DrugMaterialInfoMapper.xml b/src/main/resources/mapper/DrugMaterialInfoMapper.xml new file mode 100644 index 0000000..91945db --- /dev/null +++ b/src/main/resources/mapper/DrugMaterialInfoMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + id,case_id,drug_no, + drug_name,mass_volume,package_complete, + create_time,update_time,create_by, + update_by + + diff --git a/src/main/resources/mapper/IdentificationMaterialTransferAnalysisAnnexMapper.xml b/src/main/resources/mapper/IdentificationMaterialTransferAnalysisAnnexMapper.xml new file mode 100644 index 0000000..3e9fac0 --- /dev/null +++ b/src/main/resources/mapper/IdentificationMaterialTransferAnalysisAnnexMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/IdentificationMaterialTransferRetainedAnnexMapper.xml b/src/main/resources/mapper/IdentificationMaterialTransferRetainedAnnexMapper.xml new file mode 100644 index 0000000..1509c35 --- /dev/null +++ b/src/main/resources/mapper/IdentificationMaterialTransferRetainedAnnexMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/OutWarehouseDetailedMapper.xml b/src/main/resources/mapper/OutWarehouseDetailedMapper.xml new file mode 100644 index 0000000..9c2d739 --- /dev/null +++ b/src/main/resources/mapper/OutWarehouseDetailedMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SampleApplyDetailedMapper.xml b/src/main/resources/mapper/SampleApplyDetailedMapper.xml new file mode 100644 index 0000000..5747db0 --- /dev/null +++ b/src/main/resources/mapper/SampleApplyDetailedMapper.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SampleApplyMapper.xml b/src/main/resources/mapper/SampleApplyMapper.xml new file mode 100644 index 0000000..da96b3b --- /dev/null +++ b/src/main/resources/mapper/SampleApplyMapper.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select sa.*, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=sa.applicant_id + ) AS applicant_name, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=sa.approver_id + ) AS approve_name, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=sa.first_auditor_id + ) AS first_auditor_name, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=sa.secondary_auditor_id + ) AS secondary_audit_name, + ( + SELECT user.department + FROM dlp_base.sys_user user + WHERE user.user_id=sa.applicant_id + ) AS department + from dlp_identification_material_repository.sample_apply sa + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SampleInboundAndOutboundTableMapper.xml b/src/main/resources/mapper/SampleInboundAndOutboundTableMapper.xml new file mode 100644 index 0000000..2213523 --- /dev/null +++ b/src/main/resources/mapper/SampleInboundAndOutboundTableMapper.xml @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SampleInboundRecordMapper.xml b/src/main/resources/mapper/SampleInboundRecordMapper.xml new file mode 100644 index 0000000..c5c1660 --- /dev/null +++ b/src/main/resources/mapper/SampleInboundRecordMapper.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select inbound.*, + sample.sample_no, + sample.storage_method, + sample.sample_type, + sample.source, + im.form, + im.type as category, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=inbound.warehousing_person_id + ) AS depositor_name, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=inbound.im_administrators + ) AS im_administrators_name + from dlp_identification_material_repository.sample_inbound_record inbound + join dlp_identification_material_transfer.b_sample sample + on sample.id = inbound.sample_id + join dlp_identification_material_transfer.identification_material im + on im.id = sample.identification_material_id + + + + + + diff --git a/src/main/resources/mapper/SampleOutWarehouseApplyMapper.xml b/src/main/resources/mapper/SampleOutWarehouseApplyMapper.xml new file mode 100644 index 0000000..ba53fd4 --- /dev/null +++ b/src/main/resources/mapper/SampleOutWarehouseApplyMapper.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select sowa.*, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=sowa.applicant_id + ) AS applicant_name, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=sowa.appraiser_id + ) AS assignee_name + from dlp_identification_material_repository.sample_out_warehouse_apply sowa + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SampleOutboundRecordMapper.xml b/src/main/resources/mapper/SampleOutboundRecordMapper.xml new file mode 100644 index 0000000..63e0ab5 --- /dev/null +++ b/src/main/resources/mapper/SampleOutboundRecordMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select outbound.*, + sample.sample_no, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=outbound.recipient_id + ) AS recipient_Name + from dlp_identification_material_repository.sample_outbound_record outbound + join dlp_identification_material_transfer.b_sample sample + on outbound.sample_id = sample.id + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SampleStorageMapper.xml b/src/main/resources/mapper/SampleStorageMapper.xml new file mode 100644 index 0000000..8d431ea --- /dev/null +++ b/src/main/resources/mapper/SampleStorageMapper.xml @@ -0,0 +1,873 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select storage.*, + sample.sample_no, + sample.storage_method, + im.type as category, + im.form, + sample.source + from dlp_identification_material_repository.b_sample_storage storage + join dlp_identification_material_transfer.b_sample sample + on storage.sample_id = sample.id + join dlp_identification_material_transfer.identification_material im + on im.id = sample.identification_material_id + + + + + + + + + select storage.*, + sample.sample_no, + sample.storage_method, + sample.source, + im.form, + im.type as category, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=storage.depositor_id + ) AS depositor_name, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=storage.recipient_id + ) AS recipient_name + from dlp_identification_material_repository.b_sample_storage storage + join dlp_identification_material_transfer.b_sample sample + on storage.sample_id = sample.id + join dlp_identification_material_transfer.identification_material im + on sample.identification_material_id = im.id + + + + + + + + + + + + + + + + + + + + + + + + + select s.id, + s.sample_no, + s.storage_method, + s.sample_type, + s.name, + im.form, + s.source, + im.type as category, + s.holder, + storage.room_no + from dlp_identification_material_repository.b_sample_storage storage + join dlp_identification_material_transfer.b_sample s + on storage.sample_id = s.id + join dlp_identification_material_transfer.identification_material im + on s.identification_material_id = im.id + + + + + + + + select s.id, + s.sample_no, + s.storage_method, + s.sample_type, + s.name, + im.form, + im.type as category, + s.holder, + storage.storage_location, + storage.id as storage_id + from dlp_identification_material_repository.b_sample_storage storage + join dlp_identification_material_transfer.b_sample s + on storage.sample_id = s.id + join dlp_identification_material_transfer.identification_material im + on s.identification_material_id = im.id + + + + + + + + + + + + + + + + + + + + + + + + + + + + select storage.return_time, + storage.name, + storage.out_repository_date, + storage.sample_id, + storage.id, + ( + SELECT user.name + FROM dlp_base.sys_user user + WHERE user.user_id=storage.recipient_id + ) AS recipient_name, + sample.sample_type, + sample.sample_no, + im.form , + sample.source, + im.type as category, + sample.storage_method + from dlp_identification_material_repository.b_sample_storage storage + join dlp_identification_material_transfer.b_sample sample + on storage.sample_id = sample.id + join dlp_identification_material_transfer.identification_material im + on sample.identification_material_id = im.id + + + + + + + + + + + select s.id, + s.sample_no, + s.storage_method, + s.sample_type, + s.name, + im.form, + im.type as category, + s.holder + from dlp_identification_material_transfer.b_sample s + join dlp_identification_material_transfer.identification_material im + on s.identification_material_id = im.id + + + + + + + + + + + + + + + + + + + select storage.storage_location, + sample.sample_no, + sample.sample_type, + sample.name + from dlp_identification_material_repository.b_sample_storage storage + join dlp_identification_material_transfer.b_sample sample + on sample.id = storage.sample_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/StorageCellMapper.xml b/src/main/resources/mapper/StorageCellMapper.xml new file mode 100644 index 0000000..283d29a --- /dev/null +++ b/src/main/resources/mapper/StorageCellMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select cell.* + from dlp_identification_material_repository.storage_cell cell + + + + + diff --git a/src/main/resources/mapper/StorageCupboardMapper.xml b/src/main/resources/mapper/StorageCupboardMapper.xml new file mode 100644 index 0000000..0753bdc --- /dev/null +++ b/src/main/resources/mapper/StorageCupboardMapper.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select cupboard.* + from dlp_identification_material_repository.storage_cupboard cupboard + + + + + + diff --git a/src/main/resources/mapper/StorageRoomMapper.xml b/src/main/resources/mapper/StorageRoomMapper.xml new file mode 100644 index 0000000..3c4a302 --- /dev/null +++ b/src/main/resources/mapper/StorageRoomMapper.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + select room.* + from dlp_identification_material_repository.storage_room room + + + + + + + + + + diff --git a/导出数据库.bat b/导出数据库.bat new file mode 100644 index 0000000..7b39d34 --- /dev/null +++ b/导出数据库.bat @@ -0,0 +1,20 @@ +set dbpath=%~dp0 + +rem db ǵǰĿ¼µĿ¼, ݿ⵼Ľű +copy %dbpath%db\V4.sql %dbpath%db\V4-old.sql + +rem ֮ǰҪȰ D:\MariaDB-10.4\bin\mysqldump ӵϵͳ· + +rem Ҫݵݿ: +rem naocs - NACOS ú +rem dlp_base - DLP Ļ +rem dlp_bpm - DLP +rem dlp_codegen - DLP Ĵľ, ԲҪ +rem dlp_entrustment - DLP ͼݿ +rem dlp_job - DLP , ڲʹ +rem dlp_device_manage - 豸 + + mysqldump --hex-blob --add-drop-database --add-drop-table -uroot -p7990016 --databases dlp_identification_material_repository> %dbpath%db\repository.sql + +rem nacos +rem mysqldump --hex-blob --add-drop-database --add-drop-table -uroot -p7990016 --databases dlp_base dlp_bpm dlp_codegen dlp_entrustment dlp_job dlp_flowable dlp_device_manage dlp_identification dlp_upload > %dbpath%db\V4.sql