From 989fa753af2d52cd967266e1567210592ff31918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B5=B7=E8=88=AA?= <1344638791@qq.com> Date: Sun, 3 Sep 2023 10:22:54 +0800 Subject: [PATCH] update --- .../ReagentConsumableInventoryController.java | 16 ++++---- ...StandardMaterialApplicationController.java | 12 +++++- .../reagent/dto/BalanceWeighingDTO.java | 16 ++++++++ .../dto/StandardMaterialApplicationDTO.java | 2 +- .../reagent/dto/WarehousingRecordFormDTO.java | 3 ++ .../reagent/entity/ReferenceMaterial.java | 3 ++ .../entity/StandardMaterialApplication.java | 2 +- .../ReagentConsumableInventoryService.java | 2 + .../StandardMaterialApplicationService.java | 4 ++ .../DeliveryRegistrationFormServiceImpl.java | 4 +- ...ReagentConsumableInventoryServiceImpl.java | 38 +++++++++---------- ...tandardMaterialApplicationServiceImpl.java | 36 ++++++++++++++---- .../StandardReserveSolutionServiceImpl.java | 2 + .../WarehousingRecordFormServiceImpl.java | 2 + .../platform/reagent/vo/OrgFullVO.java | 2 +- .../vo/StandardMaterialApplicationVO.java | 3 ++ .../mapper/ReferenceMaterialMapper.xml | 1 + 17 files changed, 108 insertions(+), 40 deletions(-) create mode 100644 src/main/java/digital/laboratory/platform/reagent/dto/BalanceWeighingDTO.java diff --git a/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java b/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java index 38e1880..eab2925 100644 --- a/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java +++ b/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java @@ -392,14 +392,14 @@ public class ReagentConsumableInventoryController { } -// @PostMapping("org") -// public R> getOrgList(HttpServletResponse httpServletResponse) { -// -// List orgList = reagentConsumableInventoryService.getOrgList(); -// -// return R.ok(orgList); -// -// } + @PostMapping("org") + public R> getOrgList(HttpServletResponse httpServletResponse) { + + List orgList = reagentConsumableInventoryService.getOrgList(); + + return R.ok(orgList); + + } } diff --git a/src/main/java/digital/laboratory/platform/reagent/controller/StandardMaterialApplicationController.java b/src/main/java/digital/laboratory/platform/reagent/controller/StandardMaterialApplicationController.java index c4eba29..fe2932a 100644 --- a/src/main/java/digital/laboratory/platform/reagent/controller/StandardMaterialApplicationController.java +++ b/src/main/java/digital/laboratory/platform/reagent/controller/StandardMaterialApplicationController.java @@ -11,12 +11,14 @@ 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.common.oss.service.OssFile; +import digital.laboratory.platform.reagent.dto.BalanceWeighingDTO; import digital.laboratory.platform.reagent.dto.StandardMaterialApplicationDTO; import digital.laboratory.platform.reagent.entity.CatalogueDetails; import digital.laboratory.platform.reagent.entity.StandardMaterialApplication; import digital.laboratory.platform.reagent.service.StandardMaterialApplicationService; import digital.laboratory.platform.reagent.vo.PurchaseCatalogueVO; import digital.laboratory.platform.reagent.vo.StandardMaterialApplicationVO; +import digital.laboratory.platform.sys.feign.RemoteReagentConsumableService; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.security.access.prepost.PreAuthorize; import io.swagger.annotations.Api; @@ -53,7 +55,6 @@ import java.util.List; public class StandardMaterialApplicationController { private final StandardMaterialApplicationService standardMaterialApplicationService; - private final OssFile ossFile; /** @@ -260,6 +261,15 @@ public class StandardMaterialApplicationController { e.printStackTrace(); } } + @ApiOperation(value = "天平称量后记录标准物质使用数量", notes = "天平称量后记录标准物质使用数量") + @SysLog("天平称量后记录标准物质使用数量") + @PutMapping("/weighing") + public R getWeighingMass(@RequestBody List balanceWeighingDTOList) { + boolean weighingMass = standardMaterialApplicationService.getWeighingMass(balanceWeighingDTOList); + if (weighingMass) { + return R.ok("称量成功"); + } else return R.failed("称量失败"); + } } diff --git a/src/main/java/digital/laboratory/platform/reagent/dto/BalanceWeighingDTO.java b/src/main/java/digital/laboratory/platform/reagent/dto/BalanceWeighingDTO.java new file mode 100644 index 0000000..a6998ff --- /dev/null +++ b/src/main/java/digital/laboratory/platform/reagent/dto/BalanceWeighingDTO.java @@ -0,0 +1,16 @@ +package digital.laboratory.platform.reagent.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class BalanceWeighingDTO { + + @ApiModelProperty(value = "标准物质ID") + private String referenceMaterialId; + + @ApiModelProperty(value = "称重质量") + private BigDecimal weighingMass; +} diff --git a/src/main/java/digital/laboratory/platform/reagent/dto/StandardMaterialApplicationDTO.java b/src/main/java/digital/laboratory/platform/reagent/dto/StandardMaterialApplicationDTO.java index 372af60..4fd2abb 100644 --- a/src/main/java/digital/laboratory/platform/reagent/dto/StandardMaterialApplicationDTO.java +++ b/src/main/java/digital/laboratory/platform/reagent/dto/StandardMaterialApplicationDTO.java @@ -9,7 +9,7 @@ public class StandardMaterialApplicationDTO { private String standardMaterialApplicationId; @ApiModelProperty(value = "使用数量") - private String purposeAndQuantity; + private Double purposeAndQuantity; @ApiModelProperty(value = "格子id") private String latticeId; diff --git a/src/main/java/digital/laboratory/platform/reagent/dto/WarehousingRecordFormDTO.java b/src/main/java/digital/laboratory/platform/reagent/dto/WarehousingRecordFormDTO.java index b60bc33..8cdff52 100644 --- a/src/main/java/digital/laboratory/platform/reagent/dto/WarehousingRecordFormDTO.java +++ b/src/main/java/digital/laboratory/platform/reagent/dto/WarehousingRecordFormDTO.java @@ -65,4 +65,7 @@ public class WarehousingRecordFormDTO { @ApiModelProperty(value="柜子ID") private String boxId; + + @ApiModelProperty(value="标准物质质量") + private Double referenceMaterialMass; } diff --git a/src/main/java/digital/laboratory/platform/reagent/entity/ReferenceMaterial.java b/src/main/java/digital/laboratory/platform/reagent/entity/ReferenceMaterial.java index b9bc770..f9e5000 100644 --- a/src/main/java/digital/laboratory/platform/reagent/entity/ReferenceMaterial.java +++ b/src/main/java/digital/laboratory/platform/reagent/entity/ReferenceMaterial.java @@ -65,4 +65,7 @@ public class ReferenceMaterial extends BaseEntity { @ApiModelProperty(value="标准物质名称") private String reagentConsumableName; + @ApiModelProperty(value = "质量(有可能为重量、有可能为体积)") + private Double mass; + } diff --git a/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApplication.java b/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApplication.java index 15f3abd..0950b31 100644 --- a/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApplication.java +++ b/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApplication.java @@ -63,7 +63,7 @@ public class StandardMaterialApplication extends BaseEntity { * (使用数量) */ @ApiModelProperty(value="(使用数量)") - private String purposeAndQuantity; + private Double purposeAndQuantity; /** * (领用人ID) diff --git a/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java b/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java index 79f4544..eefc7af 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java @@ -60,5 +60,7 @@ public interface ReagentConsumableInventoryService extends IService getOrgList(); + // List getOrgList(); } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/StandardMaterialApplicationService.java b/src/main/java/digital/laboratory/platform/reagent/service/StandardMaterialApplicationService.java index 052d071..11a7f50 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/StandardMaterialApplicationService.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/StandardMaterialApplicationService.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.service.IService; import digital.laboratory.platform.common.mybatis.security.service.DLPUser; +import digital.laboratory.platform.reagent.dto.BalanceWeighingDTO; import digital.laboratory.platform.reagent.dto.StandardMaterialApplicationDTO; import digital.laboratory.platform.reagent.entity.StandardMaterialApplication; import digital.laboratory.platform.reagent.vo.StandardMaterialApplicationVO; @@ -35,4 +36,7 @@ public interface StandardMaterialApplicationService extends IService balanceWeighingDTOList); } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java index 601d9c3..0bdf2ed 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java @@ -243,7 +243,7 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl getOrgList() { -// -// List orgList = baseMapper.getOrgList(); -// ArrayList orgFullVOS = new ArrayList<>(); -// for (OrgVO orgVO : orgList) { -// if (orgVO.getOrgType() != null && orgVO.getOrgType().equals("county")) { -// OrgFullVO orgFullVO = new OrgFullVO(); -// orgFullVO.setUsername("X" + orgVO.getAreaCode()); -// String[] roles = {"10015", "10020"}; -// orgFullVO.setRoleIds(roles); -// orgFullVO.setPassword("123456"); -// orgFullVO.setOrgId(orgVO.getOrgId()); -// orgFullVOS.add(orgFullVO); -// } -// -// } -// return orgFullVOS; -// } + @Override + public List getOrgList() { + + List orgList = baseMapper.getOrgList(); + ArrayList orgFullVOS = new ArrayList<>(); + for (OrgVO orgVO : orgList) { + if (orgVO.getOrgType() != null && orgVO.getOrgType().equals("county")) { + OrgFullVO orgFullVO = new OrgFullVO(); + orgFullVO.setUsername("X" + orgVO.getAreaCode()); + String[] roles = {"10010","10015", "10020","10130","23020","23030"}; + orgFullVO.setRoleIds(roles); + orgFullVO.setPassword("123456"); + orgFullVO.setOrgId(orgVO.getOrgId()); + orgFullVO.setGender(1); + orgFullVOS.add(orgFullVO); + } + } + return orgFullVOS; + } } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApplicationServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApplicationServiceImpl.java index 7b535e1..570b877 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApplicationServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApplicationServiceImpl.java @@ -5,7 +5,6 @@ import cn.hutool.core.io.IoUtil; 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.Constants; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.deepoove.poi.XWPFTemplate; @@ -13,6 +12,7 @@ import com.deepoove.poi.config.Configure; import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; import digital.laboratory.platform.common.feign.RemoteWord2PDFService; import digital.laboratory.platform.common.oss.service.OssFile; +import digital.laboratory.platform.reagent.dto.BalanceWeighingDTO; import digital.laboratory.platform.reagent.dto.StandardMaterialApplicationDTO; import digital.laboratory.platform.reagent.entity.*; import digital.laboratory.platform.reagent.mapper.StandardMaterialApplicationMapper; @@ -24,11 +24,9 @@ import feign.Response; import io.seata.spring.annotation.GlobalTransactional; import lombok.RequiredArgsConstructor; import org.apache.commons.io.output.ByteArrayOutputStream; -import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; @@ -97,6 +95,7 @@ public class StandardMaterialApplicationServiceImpl extends ServiceImpl balanceWeighingDTOList) { + + String referenceMaterialId = balanceWeighingDTOList.get(0).getReferenceMaterialId(); + + List standardMaterialApplications = this.list(Wrappers.query().eq("reference_material_id", referenceMaterialId).orderByDesc("create_time")); + + if (standardMaterialApplications == null && standardMaterialApplications.size() == 0) { + throw new RuntimeException(String.format("未查询到该标准物质的领用登记表!")); + } + StandardMaterialApplication standardMaterialApplication = standardMaterialApplications.get(0); + //依次记录称量结果 + for (BalanceWeighingDTO balanceWeighingDTO : balanceWeighingDTOList) { + if (standardMaterialApplication.getPurposeAndQuantity() == 0) { + standardMaterialApplication.setPurposeAndQuantity(balanceWeighingDTO.getWeighingMass().doubleValue()); + } else { + standardMaterialApplication.setPurposeAndQuantity(standardMaterialApplication.getPurposeAndQuantity() + balanceWeighingDTO.getWeighingMass().doubleValue()); + } + } + return this.updateById(standardMaterialApplication); + } } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardReserveSolutionServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardReserveSolutionServiceImpl.java index b09fb5d..0f8de97 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardReserveSolutionServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardReserveSolutionServiceImpl.java @@ -163,6 +163,7 @@ public class StandardReserveSolutionServiceImpl extends ServiceImpl +