From 862808752f78569995a0d883882156ea43b1e244 Mon Sep 17 00:00:00 2001 From: chen <2710907404@qq.com> Date: Mon, 11 Nov 2024 11:37:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../imr/controller/DrugDepotsController.java | 13 +- .../controller/ReviewApprovalController.java | 9 - .../SampleOutWarehouseController.java | 4 +- .../imr/convert/DrugCaseInfoConvert.java | 2 + .../platform/imr/dto/DrugDepotsDTO.java | 3 + .../platform/imr/dto/ReviewApprovalDTO.java | 2 - .../imr/entity/DestructionPublicity.java | 3 +- .../platform/imr/entity/DrugCaseInfo.java | 5 + .../platform/imr/entity/DrugMaterialInfo.java | 2 +- .../platform/imr/entity/SampleApply.java | 4 +- .../imr/entity/SampleOutWarehouseApply.java | 4 +- .../imr/entity/SampleOutboundRecord.java | 4 +- .../imr/{entity => }/enums/ApplyStatus.java | 2 +- .../imr/enums/DrugMaterialStatus.java | 30 ++++ .../{entity => }/enums/OutApplyStatus.java | 2 +- .../imr/{entity => }/enums/OutboundType.java | 2 +- .../imr/{entity => }/enums/ReleaseStatus.java | 2 +- .../imr/{entity => }/enums/WarehouseMark.java | 2 +- .../imr/mapper/DrugCaseInfoMapper.java | 8 + .../imr/service/DrugCaseInfoService.java | 4 +- .../imr/service/DrugMaterialInfoService.java | 7 + .../impl/CabinetOpeningRecordServiceImpl.java | 7 +- .../impl/DestructionPublicityServiceImpl.java | 4 - .../service/impl/DrugCaseInfoServiceImpl.java | 11 +- .../impl/DrugMaterialInfoServiceImpl.java | 164 +++++++++++++----- .../impl/ReviewApprovalServiceImpl.java | 5 +- .../service/impl/SampleApplyServiceImpl.java | 6 +- .../SampleOutWarehouseApplyServiceImpl.java | 7 +- .../impl/SampleOutWarehouseServiceImpl.java | 4 +- .../impl/SamplePutInStorageServiceImpl.java | 4 +- .../platform/imr/vo/DrugCaseInfoVO.java | 9 + .../platform/imr/vo/DrugMaterialInfoVO.java | 10 +- .../resources/mapper/DrugCaseInfoMapper.xml | 20 ++- .../mapper/DrugMaterialInfoMapper.xml | 3 +- 34 files changed, 254 insertions(+), 114 deletions(-) rename src/main/java/digital/laboratory/platform/imr/{entity => }/enums/ApplyStatus.java (93%) create mode 100644 src/main/java/digital/laboratory/platform/imr/enums/DrugMaterialStatus.java rename src/main/java/digital/laboratory/platform/imr/{entity => }/enums/OutApplyStatus.java (90%) rename src/main/java/digital/laboratory/platform/imr/{entity => }/enums/OutboundType.java (91%) rename src/main/java/digital/laboratory/platform/imr/{entity => }/enums/ReleaseStatus.java (90%) rename src/main/java/digital/laboratory/platform/imr/{entity => }/enums/WarehouseMark.java (90%) diff --git a/src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java b/src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java index 3fe286c..c2e7009 100644 --- a/src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java +++ b/src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java @@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; +import javax.validation.ValidationException; import java.security.Principal; import java.util.HashMap; import java.util.List; @@ -79,15 +80,21 @@ public class DrugDepotsController { @ApiOperation(value = "毒品案件信息分页接口") @PostMapping("/drugCase/page") public R> drugCasePage(@RequestBody DrugDepotsQuery query) { - Page drugCaseInfoVOPage = drugCaseInfoService.getDrugCaseInfoVOPage(query); + IPage drugCaseInfoVOPage = drugCaseInfoService.getDrugCaseInfoVOPage(query); return R.ok(drugCaseInfoVOPage); } @ApiOperation("删除毒品检材信息") @PostMapping("/delete/drugMaterial") public R deleteDrugMaterial(@RequestBody List ids) { - boolean removeBatchByIds = drugMaterialInfoService.removeBatchByIds(ids); - return removeBatchByIds ? R.ok(true, "删除成功!") : R.failed(false, "删除失败!"); + boolean success = false; + try { + success = drugMaterialInfoService.delete(ids); + } catch (ValidationException e) { + e.printStackTrace(); + return R.failed(e.getMessage()); + } + return success ? R.ok(true, "删除成功!") : R.failed(false, "删除失败!"); } @ApiOperation(value = "根据模板生成样本标签的 html, 供 qz 打印使用", notes = "根据模板生成样本标签的 html, 供 qz 打印使用") diff --git a/src/main/java/digital/laboratory/platform/imr/controller/ReviewApprovalController.java b/src/main/java/digital/laboratory/platform/imr/controller/ReviewApprovalController.java index 3e152dc..3faec1d 100644 --- a/src/main/java/digital/laboratory/platform/imr/controller/ReviewApprovalController.java +++ b/src/main/java/digital/laboratory/platform/imr/controller/ReviewApprovalController.java @@ -3,27 +3,19 @@ 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.*; @@ -31,7 +23,6 @@ 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; /** diff --git a/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseController.java b/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseController.java index 3de459f..83061ea 100644 --- a/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseController.java +++ b/src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseController.java @@ -2,7 +2,6 @@ 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; @@ -18,7 +17,7 @@ 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.enums.OutboundType; import digital.laboratory.platform.imr.mapper.DestructionDetailMapper; import digital.laboratory.platform.imr.mapper.SampleOutWarehouseApplyMapper; import digital.laboratory.platform.imr.mapper.SampleOutboundRecordMapper; @@ -42,7 +41,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.security.Principal; import java.util.*; -import java.util.stream.Collectors; /** * 自定义出库controller diff --git a/src/main/java/digital/laboratory/platform/imr/convert/DrugCaseInfoConvert.java b/src/main/java/digital/laboratory/platform/imr/convert/DrugCaseInfoConvert.java index 36eb9fb..491c4ec 100644 --- a/src/main/java/digital/laboratory/platform/imr/convert/DrugCaseInfoConvert.java +++ b/src/main/java/digital/laboratory/platform/imr/convert/DrugCaseInfoConvert.java @@ -24,6 +24,7 @@ public class DrugCaseInfoConvert { drugCaseInfo.setCaseNo(dto.getCaseNo()); drugCaseInfo.setHandingOverOrg(dto.getHandingOverOrg()); drugCaseInfo.setHandingOverDate(dto.getHandingOverDate()); + drugCaseInfo.setFrontOrgIds(dto.getFrontOrgIds()); return drugCaseInfo; } @@ -38,6 +39,7 @@ public class DrugCaseInfoConvert { drugCaseInfoVO.setCaseNo(entity.getCaseNo()); drugCaseInfoVO.setHandingOverOrg(entity.getHandingOverOrg()); drugCaseInfoVO.setHandingOverDate(entity.getHandingOverDate()); + drugCaseInfoVO.setFrontOrgIds(entity.getFrontOrgIds()); return drugCaseInfoVO; } diff --git a/src/main/java/digital/laboratory/platform/imr/dto/DrugDepotsDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/DrugDepotsDTO.java index 0a7e57b..deac3d6 100644 --- a/src/main/java/digital/laboratory/platform/imr/dto/DrugDepotsDTO.java +++ b/src/main/java/digital/laboratory/platform/imr/dto/DrugDepotsDTO.java @@ -42,6 +42,9 @@ public class DrugDepotsDTO { @NotBlank(message = "送缴单位不能为空!") private String handingOverOrg; + @ApiModelProperty("前端需要展示的机构组件,保存了送缴单位的父级机构id和自己机构id") + private String frontOrgIds; + /** * 送缴日期 */ diff --git a/src/main/java/digital/laboratory/platform/imr/dto/ReviewApprovalDTO.java b/src/main/java/digital/laboratory/platform/imr/dto/ReviewApprovalDTO.java index 1c27222..cf7ccff 100644 --- a/src/main/java/digital/laboratory/platform/imr/dto/ReviewApprovalDTO.java +++ b/src/main/java/digital/laboratory/platform/imr/dto/ReviewApprovalDTO.java @@ -1,10 +1,8 @@ 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; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/DestructionPublicity.java b/src/main/java/digital/laboratory/platform/imr/entity/DestructionPublicity.java index 00c0293..86948b5 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/DestructionPublicity.java +++ b/src/main/java/digital/laboratory/platform/imr/entity/DestructionPublicity.java @@ -4,10 +4,9 @@ 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; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/DrugCaseInfo.java b/src/main/java/digital/laboratory/platform/imr/entity/DrugCaseInfo.java index 8c8b548..00a15b5 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/DrugCaseInfo.java +++ b/src/main/java/digital/laboratory/platform/imr/entity/DrugCaseInfo.java @@ -45,6 +45,11 @@ public class DrugCaseInfo extends BaseEntity{ */ private LocalDate handingOverDate; + /** + * 前端需要展示的机构组件,保存了送缴单位的父级机构id和自己机构id + */ + private String frontOrgIds; + @TableField(exist = false) private static final long serialVersionUID = 1L; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/DrugMaterialInfo.java b/src/main/java/digital/laboratory/platform/imr/entity/DrugMaterialInfo.java index e1890e2..f89b482 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/DrugMaterialInfo.java +++ b/src/main/java/digital/laboratory/platform/imr/entity/DrugMaterialInfo.java @@ -53,7 +53,7 @@ public class DrugMaterialInfo extends BaseEntity { private Boolean packageComplete; /** - * 毒品检材状态, 0 未入库 | 1 已入库 + * 毒品检材状态, 0 录入信息 | 3 待入库 | 5 已入库 */ private Integer status; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleApply.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleApply.java index fe5cd47..93a6788 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/SampleApply.java +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleApply.java @@ -4,10 +4,10 @@ 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 digital.laboratory.platform.imr.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; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleOutWarehouseApply.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleOutWarehouseApply.java index 70fec2b..38c42d3 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/SampleOutWarehouseApply.java +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleOutWarehouseApply.java @@ -6,10 +6,10 @@ 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 digital.laboratory.platform.imr.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; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/SampleOutboundRecord.java b/src/main/java/digital/laboratory/platform/imr/entity/SampleOutboundRecord.java index 585a2e4..b567b92 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/SampleOutboundRecord.java +++ b/src/main/java/digital/laboratory/platform/imr/entity/SampleOutboundRecord.java @@ -4,10 +4,10 @@ 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 digital.laboratory.platform.imr.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; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/ApplyStatus.java b/src/main/java/digital/laboratory/platform/imr/enums/ApplyStatus.java similarity index 93% rename from src/main/java/digital/laboratory/platform/imr/entity/enums/ApplyStatus.java rename to src/main/java/digital/laboratory/platform/imr/enums/ApplyStatus.java index 8b6a232..6ff5537 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/enums/ApplyStatus.java +++ b/src/main/java/digital/laboratory/platform/imr/enums/ApplyStatus.java @@ -1,4 +1,4 @@ -package digital.laboratory.platform.imr.entity.enums; +package digital.laboratory.platform.imr.enums; import com.baomidou.mybatisplus.annotation.EnumValue; diff --git a/src/main/java/digital/laboratory/platform/imr/enums/DrugMaterialStatus.java b/src/main/java/digital/laboratory/platform/imr/enums/DrugMaterialStatus.java new file mode 100644 index 0000000..1b07e23 --- /dev/null +++ b/src/main/java/digital/laboratory/platform/imr/enums/DrugMaterialStatus.java @@ -0,0 +1,30 @@ +package digital.laboratory.platform.imr.enums; + +import lombok.Getter; + +@Getter +public enum DrugMaterialStatus { + + ENTER_DRUG_INFO(0, "录入信息中"), + WAIT_INBOUND(3, "待入库"), + FINISH_INBOUND(5, "已入库"), + ; + + private final Integer status; + + private final String desc; + + DrugMaterialStatus(Integer status, String desc) { + this.status = status; + this.desc = desc; + } + + public static DrugMaterialStatus fromStatus(Integer status) { + for (DrugMaterialStatus drugMaterialStatus : values()) { + if (drugMaterialStatus.getStatus().equals(status)) { + return drugMaterialStatus; + } + } + throw new IllegalArgumentException("No enum constant with code: " + status); + } +} diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/OutApplyStatus.java b/src/main/java/digital/laboratory/platform/imr/enums/OutApplyStatus.java similarity index 90% rename from src/main/java/digital/laboratory/platform/imr/entity/enums/OutApplyStatus.java rename to src/main/java/digital/laboratory/platform/imr/enums/OutApplyStatus.java index 9bae387..247b5c8 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/enums/OutApplyStatus.java +++ b/src/main/java/digital/laboratory/platform/imr/enums/OutApplyStatus.java @@ -1,4 +1,4 @@ -package digital.laboratory.platform.imr.entity.enums; +package digital.laboratory.platform.imr.enums; import com.baomidou.mybatisplus.annotation.EnumValue; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/OutboundType.java b/src/main/java/digital/laboratory/platform/imr/enums/OutboundType.java similarity index 91% rename from src/main/java/digital/laboratory/platform/imr/entity/enums/OutboundType.java rename to src/main/java/digital/laboratory/platform/imr/enums/OutboundType.java index da6bfb4..1a15853 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/enums/OutboundType.java +++ b/src/main/java/digital/laboratory/platform/imr/enums/OutboundType.java @@ -1,4 +1,4 @@ -package digital.laboratory.platform.imr.entity.enums; +package digital.laboratory.platform.imr.enums; import com.baomidou.mybatisplus.annotation.EnumValue; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/ReleaseStatus.java b/src/main/java/digital/laboratory/platform/imr/enums/ReleaseStatus.java similarity index 90% rename from src/main/java/digital/laboratory/platform/imr/entity/enums/ReleaseStatus.java rename to src/main/java/digital/laboratory/platform/imr/enums/ReleaseStatus.java index 5b34085..143fa67 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/enums/ReleaseStatus.java +++ b/src/main/java/digital/laboratory/platform/imr/enums/ReleaseStatus.java @@ -1,4 +1,4 @@ -package digital.laboratory.platform.imr.entity.enums; +package digital.laboratory.platform.imr.enums; import com.baomidou.mybatisplus.annotation.EnumValue; diff --git a/src/main/java/digital/laboratory/platform/imr/entity/enums/WarehouseMark.java b/src/main/java/digital/laboratory/platform/imr/enums/WarehouseMark.java similarity index 90% rename from src/main/java/digital/laboratory/platform/imr/entity/enums/WarehouseMark.java rename to src/main/java/digital/laboratory/platform/imr/enums/WarehouseMark.java index 7eff3de..cd3c440 100644 --- a/src/main/java/digital/laboratory/platform/imr/entity/enums/WarehouseMark.java +++ b/src/main/java/digital/laboratory/platform/imr/enums/WarehouseMark.java @@ -1,4 +1,4 @@ -package digital.laboratory.platform.imr.entity.enums; +package digital.laboratory.platform.imr.enums; import com.baomidou.mybatisplus.annotation.EnumValue; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/src/main/java/digital/laboratory/platform/imr/mapper/DrugCaseInfoMapper.java b/src/main/java/digital/laboratory/platform/imr/mapper/DrugCaseInfoMapper.java index 1b0fd2f..5a162fc 100644 --- a/src/main/java/digital/laboratory/platform/imr/mapper/DrugCaseInfoMapper.java +++ b/src/main/java/digital/laboratory/platform/imr/mapper/DrugCaseInfoMapper.java @@ -1,8 +1,14 @@ package digital.laboratory.platform.imr.mapper; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; import digital.laboratory.platform.imr.entity.DrugCaseInfo; +import digital.laboratory.platform.imr.entity.DrugMaterialInfo; +import digital.laboratory.platform.imr.vo.DrugCaseInfoVO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * @author ChenJiangBao @@ -13,6 +19,8 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface DrugCaseInfoMapper extends BaseMapper { + IPage queryDrugCaseInfoVOPage(IPage page, @Param(Constants.WRAPPER) Wrapper wrapper); + } diff --git a/src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java b/src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java index 1325799..0efe021 100644 --- a/src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java +++ b/src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java @@ -1,6 +1,6 @@ package digital.laboratory.platform.imr.service; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import digital.laboratory.platform.imr.dto.DrugDepotsDTO; import digital.laboratory.platform.imr.entity.DrugCaseInfo; @@ -30,7 +30,7 @@ public interface DrugCaseInfoService extends IService { * @param query * @return */ - Page getDrugCaseInfoVOPage(DrugDepotsQuery query); + IPage getDrugCaseInfoVOPage(DrugDepotsQuery query); DrugCaseInfo drugCaseSave(DrugDepotsDTO dto); } diff --git a/src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java b/src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java index dd2ad0e..4688962 100644 --- a/src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java +++ b/src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java @@ -69,4 +69,11 @@ public interface DrugMaterialInfoService extends IService { * @return */ OutSampleVO drugMaterialToOutSampleVO(SampleStorage sampleStorage, String drugId); + + /** + * 批量删除毒品检材 + * @param ids + * @return + */ + boolean delete(List ids); } 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 index d34d2bd..6d8e27b 100644 --- a/src/main/java/digital/laboratory/platform/imr/service/impl/CabinetOpeningRecordServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/CabinetOpeningRecordServiceImpl.java @@ -11,13 +11,12 @@ 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.enums.OutApplyStatus; +import digital.laboratory.platform.imr.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; @@ -26,14 +25,12 @@ 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 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 index 0ba4331..d30d9f7 100644 --- a/src/main/java/digital/laboratory/platform/imr/service/impl/DestructionPublicityServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/DestructionPublicityServiceImpl.java @@ -9,10 +9,7 @@ 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; @@ -21,7 +18,6 @@ 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; 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 index 2ec0aae..a647583 100644 --- a/src/main/java/digital/laboratory/platform/imr/service/impl/DrugCaseInfoServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/DrugCaseInfoServiceImpl.java @@ -80,9 +80,9 @@ public class DrugCaseInfoServiceImpl extends ServiceImpl getDrugCaseInfoVOPage(DrugDepotsQuery query) { + public IPage getDrugCaseInfoVOPage(DrugDepotsQuery query) { String keywords = query.getKeywords(); - IPage page = super.page( + IPage page = baseMapper.queryDrugCaseInfoVOPage( new Page<>(query.getCurrent(), query.getSize()), Wrappers.lambdaQuery().and( StrUtil.isNotBlank(keywords), @@ -91,12 +91,9 @@ public class DrugCaseInfoServiceImpl extends ServiceImpl drugCaseInfoVOPage = new Page<>(); - BeanUtils.copyProperties(page, drugCaseInfoVOPage, "records"); - List drugCaseInfoVOS = DrugCaseInfoConvert.entityToVOList(page.getRecords()); + List drugCaseInfoVOS = page.getRecords(); drugCaseInfoVOS.parallelStream().forEach(item -> item.setHandingOverOrgName(commonFeignService.remoteGetSysOrg(item.getHandingOverOrg()).getName())); - drugCaseInfoVOPage.setRecords(drugCaseInfoVOS); - return drugCaseInfoVOPage; + return page; } @Override 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 index 019ddef..818da37 100644 --- a/src/main/java/digital/laboratory/platform/imr/service/impl/DrugMaterialInfoServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/imr/service/impl/DrugMaterialInfoServiceImpl.java @@ -13,15 +13,14 @@ import digital.laboratory.platform.common.feign.RemoteTemplate2htmlService; import digital.laboratory.platform.common.mybatis.security.service.DLPUser; import digital.laboratory.platform.imr.dto.InRepositoryDTO; import digital.laboratory.platform.imr.entity.*; +import digital.laboratory.platform.imr.enums.DrugMaterialStatus; import digital.laboratory.platform.imr.mapper.DrugMaterialInfoMapper; import digital.laboratory.platform.imr.mapper.SampleStorageMapper; import digital.laboratory.platform.imr.query.DrugDepotsQuery; -import digital.laboratory.platform.imr.service.DrugMaterialInfoService; -import digital.laboratory.platform.imr.service.SampleInboundAndOutboundTableService; -import digital.laboratory.platform.imr.service.SampleInboundRecordService; -import digital.laboratory.platform.imr.service.SampleStorageService; +import digital.laboratory.platform.imr.service.*; import digital.laboratory.platform.imr.vo.DrugMaterialInfoVO; import digital.laboratory.platform.imr.vo.OutSampleVO; +import digital.laboratory.platform.sys.entity.Drug; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -55,7 +54,8 @@ public class DrugMaterialInfoServiceImpl extends ServiceImpl page(DrugDepotsQuery query) { - return baseMapper.getDrugMaterialVOPage(new Page<>(query.getCurrent(), query.getSize()), query); + IPage drugMaterialVOPage = baseMapper.getDrugMaterialVOPage(new Page<>(query.getCurrent(), query.getSize()), query); + List records = drugMaterialVOPage.getRecords(); + records.parallelStream().forEach(record -> { + record.setHandingOverOrgName(commonFeignService.remoteGetSysOrg(record.getHandingOverOrg()).getName()); + record.setStatusName(DrugMaterialStatus.fromStatus(record.getStatus()).getDesc()); + }); + return drugMaterialVOPage; } @Override @@ -123,9 +129,10 @@ public class DrugMaterialInfoServiceImpl extends ServiceImpl data = new HashMap<>(); - data.put("drugInfo", drugMaterialInfoVOList.get(0)); + data.put("drugInfo", drugMaterialInfoVO); String templateFileName = "毒品库毒品检材条码模板.vm"; return remoteTemplate2htmlService.getHtml(templateFileName, data); @@ -144,14 +151,16 @@ public class DrugMaterialInfoServiceImpl extends ServiceImpl drugMaterialInfoVOS = baseMapper .getDrugMaterialVO(Wrappers.query() .in("drug_no", - sample.stream().map(InRepositoryDTO::getSampleNo).collect(Collectors.toList()))); + sample.stream().map(InRepositoryDTO::getSampleNo).collect(Collectors.toList())) + .eq("dm.status", DrugMaterialStatus.ENTER_DRUG_INFO.getStatus())); // 状态为为未入库的 Map drugMaterialInfoVOMap = drugMaterialInfoVOS.stream() .collect(Collectors.toMap(DrugMaterialInfoVO::getDrugNo, Function.identity())); - + // 待操作的毒品检材id列表 + List waitOpDrugIds = drugMaterialInfoVOS.stream().map(DrugMaterialInfoVO::getId).collect(Collectors.toList()); Map sampleStorageMap = sampleStorageMapper .selectList(Wrappers.lambdaQuery() .in(SampleStorage::getSampleId, - drugMaterialInfoVOS.stream().map(DrugMaterialInfoVO::getId).collect(Collectors.toList()))) + waitOpDrugIds)) .stream().collect(Collectors.toMap(SampleStorage::getSampleId, Function.identity())); // 存储需要批量保存的实体信息 List updateSampleStorageList = new ArrayList<>(); @@ -163,7 +172,8 @@ public class DrugMaterialInfoServiceImpl extends ServiceImpllambdaUpdate().in(DrugMaterialInfo::getId, waitOpDrugIds).set(DrugMaterialInfo::getStatus, DrugMaterialStatus.WAIT_INBOUND.getStatus())); return sampleVOS; } + /** * 毒品检材封装 * @param sampleStorage @@ -257,6 +242,32 @@ public class DrugMaterialInfoServiceImpl extends ServiceImpl ids) { + if (CollUtil.isEmpty(ids)) { + throw new ValidateCodeException("未选择删除的检材!"); + } + List drugMaterialInfos = super.list(Wrappers.lambdaQuery().in(DrugMaterialInfo::getId, ids)); + for (DrugMaterialInfo drugMaterialInfo : drugMaterialInfos) { + if (!drugMaterialInfo.getStatus().equals(DrugMaterialStatus.ENTER_DRUG_INFO.getStatus())) { + throw new ValidateCodeException(String.format("检材编号为 %s 的检材不在可删除状态,不能删除!", drugMaterialInfo.getDrugNo())); + } + } + return super.remove(Wrappers.lambdaQuery().in(DrugMaterialInfo::getId, ids)); + } + + /** + * 根据样本存储信息和药物材料信息生成出库样本对象 + * + * @param sampleStorage 样本存储信息 + * @param drugMaterialInfoVO 药物材料信息对象 + * @return 出库样本对象 + */ private OutSampleVO getOutSampleVO(SampleStorage sampleStorage, DrugMaterialInfoVO drugMaterialInfoVO) { OutSampleVO outSampleVO = new OutSampleVO(); outSampleVO.setId(sampleStorage.getId()); @@ -269,6 +280,73 @@ public class DrugMaterialInfoServiceImpl extends ServiceImpllambdaUpdate().eq(DrugMaterialInfo::getId, sampleStorage.getSampleId()).set(DrugMaterialInfo::getStatus, 1)); + drugMaterialInfoService.update(Wrappers.lambdaUpdate().eq(DrugMaterialInfo::getId, sampleStorage.getSampleId()) + .set(DrugMaterialInfo::getStatus, DrugMaterialStatus.FINISH_INBOUND.getStatus())); } sampleVO.setStorageLocation(dto.getStorageLocation()); outSampleVOS.add(sampleVO); diff --git a/src/main/java/digital/laboratory/platform/imr/vo/DrugCaseInfoVO.java b/src/main/java/digital/laboratory/platform/imr/vo/DrugCaseInfoVO.java index 0cd664a..a9e80cd 100644 --- a/src/main/java/digital/laboratory/platform/imr/vo/DrugCaseInfoVO.java +++ b/src/main/java/digital/laboratory/platform/imr/vo/DrugCaseInfoVO.java @@ -52,4 +52,13 @@ public class DrugCaseInfoVO{ @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate handingOverDate; + @ApiModelProperty("送缴检材数量") + private Integer handingOverCount; + + /** + * 前端需要展示的机构组件,保存了送缴单位的父级机构id和自己机构id + */ + @ApiModelProperty("前端需要展示的机构组件,保存了送缴单位的父级机构id和自己机构id") + private String frontOrgIds; + } \ No newline at end of file diff --git a/src/main/java/digital/laboratory/platform/imr/vo/DrugMaterialInfoVO.java b/src/main/java/digital/laboratory/platform/imr/vo/DrugMaterialInfoVO.java index 5a1113b..852764a 100644 --- a/src/main/java/digital/laboratory/platform/imr/vo/DrugMaterialInfoVO.java +++ b/src/main/java/digital/laboratory/platform/imr/vo/DrugMaterialInfoVO.java @@ -67,11 +67,17 @@ public class DrugMaterialInfoVO { private Boolean packageComplete; /** - * 毒品检材状态, 0 未入库 | 1 已入库 + * 毒品检材状态, 0 录入信息中 | 3 待入库 | 5 已入库 */ - @ApiModelProperty("毒品检材状态, 0 未入库 | 1 已入库") + @ApiModelProperty("毒品检材状态, 0 录入信息中 | 3 待入库 | 5 已入库") private Integer status; + /** + * 毒品检材状态, 0 录入信息中 | 3 待入库 | 5 已入库 + */ + @ApiModelProperty("毒品检材状态, 0 录入信息中 | 3 待入库 | 5 已入库") + private String statusName; + /** * 案事件名称 */ diff --git a/src/main/resources/mapper/DrugCaseInfoMapper.xml b/src/main/resources/mapper/DrugCaseInfoMapper.xml index f28674c..0973894 100644 --- a/src/main/resources/mapper/DrugCaseInfoMapper.xml +++ b/src/main/resources/mapper/DrugCaseInfoMapper.xml @@ -10,6 +10,7 @@ + @@ -18,7 +19,24 @@ id,case_name,case_no, - handing_over_org,handing_over_date,create_time, + handing_over_org,handing_over_date,front_org_ids,create_time, update_time,create_by,update_by + + + SELECT + , handingOverCount + FROM b_drug_case_info + LEFT JOIN ( + SELECT COUNT(*) AS handingOverCount , case_id + FROM b_drug_material_info GROUP BY case_id + ) AS t + ON b_drug_case_info.id = t.case_id + + + diff --git a/src/main/resources/mapper/DrugMaterialInfoMapper.xml b/src/main/resources/mapper/DrugMaterialInfoMapper.xml index f851e6b..14b95f1 100644 --- a/src/main/resources/mapper/DrugMaterialInfoMapper.xml +++ b/src/main/resources/mapper/DrugMaterialInfoMapper.xml @@ -12,6 +12,7 @@ + @@ -20,7 +21,7 @@ id,case_id,drug_no, - drug_name,mass_volume,unit,package_complete, + drug_name,mass_volume,unit,package_complete,status, create_time,update_time,create_by, update_by