From f7d2f20365467a834188edd35c464d9fb9349214 Mon Sep 17 00:00:00 2001 From: zhangfeng <1603559716@qq.com> Date: 星期五, 23 十二月 2022 08:53:43 +0800 Subject: [PATCH] 安全物资和设备管理调整v2 --- equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialInfo.java | 22 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialDeliveryReq.java | 10 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialReceiveRecordsService.java | 19 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsInfo.java | 168 ++ equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialClassifyInfoService.java | 4 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java | 37 equipment/equipment-service/src/main/resources/config/mapper/equipment/MaterialReceiveRecordsBaseInfoMapper.xml | 61 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ValidStatusEnum.java | 4 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialBO.java | 32 equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml | 57 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialClassifyService.java | 12 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialStatusEnum.java | 50 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsQuery.java | 65 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialAddReq.java | 25 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyInfo.java | 10 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialModReq.java | 30 equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialClassifyInfoMapper.xml | 15 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialDeliveryRecordDO.java | 153 + equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialClassifyRPCRespDto.java | 22 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailAddReq.java | 9 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfo.java | 52 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyAddReq.java | 13 equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/MaterialReceiveRecordsRPCRespDto.java | 213 ++ equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseBO.java | 32 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDetailDto.java | 85 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseInfo.java | 226 ++ equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/MaterialReceiveRecordsInfoService.java | 22 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/MaterialReceiveRecordsBaseInfoServiceImpl.java | 29 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsBaseReq.java | 27 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/MaterialReceiveRecordsInfoRepository.java | 23 equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml | 152 + equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialReceiveRecordsStatusEnum.java | 49 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialController.java | 33 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialClassifyServiceImpl.java | 78 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsDO.java | 207 ++ equipment/equipment-rpc-provider/src/main/java/com/gkhy/safePlatform/equipment/rpc/provider/EquipmentRpcProvider.java | 57 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsReq.java | 41 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialBatchDeliveryBO.java | 25 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfoDO.java | 64 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialClassifyInfoServiceImpl.java | 2 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialInfoRepository.java | 7 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/EquipmentResultCodes.java | 1 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDto.java | 24 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialDetailInfoService.java | 19 equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/EquipmentRpcAPi.java | 11 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialDetailServiceImpl.java | 776 +++++++-- equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialService.java | 19 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/MaterialReceiveRecordsInfoServiceImpl.java | 69 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java | 21 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/MaterialReceiveRecordsBaseInfoRepository.java | 18 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialReceiveRecordsBaseDto.java | 174 ++ equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialReceiveRecordsDto.java | 193 ++ equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java | 40 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ConsumableEnum.java | 4 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDO.java | 30 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyModReq.java | 13 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialRandomDeliveryReq.java | 10 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialInfoService.java | 9 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialDetailInfoServiceImpl.java | 53 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/db/SafeMaterialDetailDBQuery.java | 59 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialReceiveRecordsServiceImpl.java | 219 ++ equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/req/MaterialReceiveRecordsRPCReq.java | 25 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialReceiveRecordsController.java | 46 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialQuery.java | 10 equipment/equipment-rpc-api/pom.xml | 8 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseDO.java | 153 + equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialServiceImpl.java | 140 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialRevertStatusEnum.java | 47 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialClassifyDto.java | 23 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialDetailService.java | 14 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBO.java | 25 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialDetailInfoRepository.java | 17 equipment/equipment-service/src/main/resources/config/mapper/equipment/MaterialReceiveRecordsInfoMapper.xml | 94 + equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailReq.java | 20 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/MaterialReceiveRecordsBaseInfoService.java | 15 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/BaseMaterialDto.java | 22 76 files changed, 4,110 insertions(+), 553 deletions(-) diff --git a/equipment/equipment-rpc-api/pom.xml b/equipment/equipment-rpc-api/pom.xml index 8e76508..50c5710 100644 --- a/equipment/equipment-rpc-api/pom.xml +++ b/equipment/equipment-rpc-api/pom.xml @@ -79,6 +79,14 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>8</source> + <target>8</target> + </configuration> + </plugin> </plugins> </build> diff --git a/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/EquipmentRpcAPi.java b/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/EquipmentRpcAPi.java index 26d5506..884384b 100644 --- a/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/EquipmentRpcAPi.java +++ b/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/EquipmentRpcAPi.java @@ -1,11 +1,9 @@ package com.gkhy.safePlatform.equipment.rpc.api; import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.equipment.rpc.api.model.dto.req.MaterialReceiveRecordsRPCReq; import com.gkhy.safePlatform.equipment.rpc.api.model.dto.req.MaterialSpwRPCReq; -import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.SafeMaterialBsClassifyRPCRespDto; -import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.SafeMaterialClassifyRPCRespDto; -import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.SafeMaterialClassifyStockRPCRespDto; -import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.SafeRfidMaterialDetailRPCRespDto; +import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.*; import java.util.List; @@ -48,4 +46,9 @@ * 根据rfids获取物资 */ ResultVO<List<SafeRfidMaterialDetailRPCRespDto>> getListByRfid(List<String> rfids); + + /** + * 根据人员和小类获取领取记录 + */ + ResultVO<List<MaterialReceiveRecordsRPCRespDto>> getMaterialReceiveRecords(MaterialReceiveRecordsRPCReq req); } diff --git a/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/req/MaterialReceiveRecordsRPCReq.java b/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/req/MaterialReceiveRecordsRPCReq.java new file mode 100644 index 0000000..c6a5887 --- /dev/null +++ b/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/req/MaterialReceiveRecordsRPCReq.java @@ -0,0 +1,25 @@ +package com.gkhy.safePlatform.equipment.rpc.api.model.dto.req; + + +import java.util.List; + +public class MaterialReceiveRecordsRPCReq { + private List<Long> receiveUids; + private List<Long> smallClassifyIds; + + public List<Long> getReceiveUids() { + return receiveUids; + } + + public void setReceiveUids(List<Long> receiveUids) { + this.receiveUids = receiveUids; + } + + public List<Long> getSmallClassifyIds() { + return smallClassifyIds; + } + + public void setSmallClassifyIds(List<Long> smallClassifyIds) { + this.smallClassifyIds = smallClassifyIds; + } +} diff --git a/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/MaterialReceiveRecordsRPCRespDto.java b/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/MaterialReceiveRecordsRPCRespDto.java new file mode 100644 index 0000000..e3a5597 --- /dev/null +++ b/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/MaterialReceiveRecordsRPCRespDto.java @@ -0,0 +1,213 @@ +package com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp; + + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.time.LocalDateTime; + +public class MaterialReceiveRecordsRPCRespDto { + /** + * id + */ + private Long id; + /** + * 物资名称 + */ + private String materialName; + /** + * 物资编号 + */ + private String materialNo; + /** + * rfid + */ + private String rfid; + /** + * 领取时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime receiveTime; + /** + * 领取人id + */ + private Long receiveUid; + /** + * 领取人姓名 + */ + private String receiveUname; + /** + * 归还状态(0未归还,1归还,3损耗) + */ + private Byte revertStatus; + /** + * 物资状态 + */ + private Byte materialStatus; + /** + * 备注 + */ + private String remark; + /** + * 归还时间 + */ + private LocalDateTime revertTime; + + /** + * 物资清单(详细物资)id + */ + private Long smdId; + /** + * 基础记录id + */ + private Long receiveBaseId; + + private Byte validStatus; + private Long smallClassifyId; + private Byte consumable; + private Long bigClassifyId; + private String bigClassifyName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getRfid() { + return rfid; + } + + public void setRfid(String rfid) { + this.rfid = rfid; + } + + public LocalDateTime getReceiveTime() { + return receiveTime; + } + + public void setReceiveTime(LocalDateTime receiveTime) { + this.receiveTime = receiveTime; + } + + public Long getReceiveUid() { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + public Byte getRevertStatus() { + return revertStatus; + } + + public void setRevertStatus(Byte revertStatus) { + this.revertStatus = revertStatus; + } + + public Byte getMaterialStatus() { + return materialStatus; + } + + public void setMaterialStatus(Byte materialStatus) { + this.materialStatus = materialStatus; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public LocalDateTime getRevertTime() { + return revertTime; + } + + public void setRevertTime(LocalDateTime revertTime) { + this.revertTime = revertTime; + } + + public Long getSmdId() { + return smdId; + } + + public void setSmdId(Long smdId) { + this.smdId = smdId; + } + + public Long getReceiveBaseId() { + return receiveBaseId; + } + + public void setReceiveBaseId(Long receiveBaseId) { + this.receiveBaseId = receiveBaseId; + } + + public Byte getValidStatus() { + return validStatus; + } + + public void setValidStatus(Byte validStatus) { + this.validStatus = validStatus; + } + + public Long getSmallClassifyId() { + return smallClassifyId; + } + + public void setSmallClassifyId(Long smallClassifyId) { + this.smallClassifyId = smallClassifyId; + } + + public Byte getConsumable() { + return consumable; + } + + public void setConsumable(Byte consumable) { + this.consumable = consumable; + } + + public Long getBigClassifyId() { + return bigClassifyId; + } + + public void setBigClassifyId(Long bigClassifyId) { + this.bigClassifyId = bigClassifyId; + } + + public String getBigClassifyName() { + return bigClassifyName; + } + + public void setBigClassifyName(String bigClassifyName) { + this.bigClassifyName = bigClassifyName; + } +} diff --git a/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialClassifyRPCRespDto.java b/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialClassifyRPCRespDto.java index 76ac151..e466567 100644 --- a/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialClassifyRPCRespDto.java +++ b/equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialClassifyRPCRespDto.java @@ -7,6 +7,12 @@ private String materialClassifyName; private Long parentId; + /** + * 是否是耗材(0是,1否) + */ + private Byte consumable; + + private String consumableName; private List<SafeMaterialClassifyRPCRespDto> childList; @@ -41,4 +47,20 @@ public void setChildList(List<SafeMaterialClassifyRPCRespDto> childList) { this.childList = childList; } + + public Byte getConsumable() { + return consumable; + } + + public void setConsumable(Byte consumable) { + this.consumable = consumable; + } + + public String getConsumableName() { + return consumableName; + } + + public void setConsumableName(String consumableName) { + this.consumableName = consumableName; + } } diff --git a/equipment/equipment-rpc-provider/src/main/java/com/gkhy/safePlatform/equipment/rpc/provider/EquipmentRpcProvider.java b/equipment/equipment-rpc-provider/src/main/java/com/gkhy/safePlatform/equipment/rpc/provider/EquipmentRpcProvider.java index b5cbfb2..ca71dc0 100644 --- a/equipment/equipment-rpc-provider/src/main/java/com/gkhy/safePlatform/equipment/rpc/provider/EquipmentRpcProvider.java +++ b/equipment/equipment-rpc-provider/src/main/java/com/gkhy/safePlatform/equipment/rpc/provider/EquipmentRpcProvider.java @@ -3,6 +3,8 @@ import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO; import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO; import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; import com.gkhy.safePlatform.equipment.model.dto.req.MaterialSpwDeliveryReq; @@ -11,14 +13,14 @@ import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyStockDto; import com.gkhy.safePlatform.equipment.model.dto.resp.SafeRfidMaterialDetailDto; import com.gkhy.safePlatform.equipment.rpc.api.EquipmentRpcAPi; +import com.gkhy.safePlatform.equipment.rpc.api.model.dto.req.MaterialReceiveRecordsRPCReq; import com.gkhy.safePlatform.equipment.rpc.api.model.dto.req.MaterialSpwDeliveryRPCReq; import com.gkhy.safePlatform.equipment.rpc.api.model.dto.req.MaterialSpwRPCReq; -import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.SafeMaterialBsClassifyRPCRespDto; -import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.SafeMaterialClassifyRPCRespDto; -import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.SafeMaterialClassifyStockRPCRespDto; -import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.SafeRfidMaterialDetailRPCRespDto; +import com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp.*; import com.gkhy.safePlatform.equipment.service.MaterialClassifyService; +import com.gkhy.safePlatform.equipment.service.MaterialReceiveRecordsService; import com.gkhy.safePlatform.equipment.service.SafeMaterialDetailService; +import com.gkhy.safePlatform.equipment.service.impl.MaterialReceiveRecordsServiceImpl; import org.apache.dubbo.config.annotation.DubboService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -33,6 +35,8 @@ private MaterialClassifyService materialClassifyService; @Autowired private SafeMaterialDetailService safeMaterialDetailService; + @Autowired + private MaterialReceiveRecordsService materialReceiveRecordsService; public ResultVO<List<SafeMaterialClassifyRPCRespDto>> getMaterialClassifyList(){ @@ -47,11 +51,17 @@ List<SafeMaterialClassifyDto> childList = classifyDto.getChildList(); List<SafeMaterialClassifyRPCRespDto> childRPCList = new ArrayList<>(); for(SafeMaterialClassifyDto child:childList){ - SafeMaterialClassifyRPCRespDto childRPCRespDto = new SafeMaterialClassifyRPCRespDto(); - childRPCRespDto.setId(child.getId()); - childRPCRespDto.setParentId(child.getParentId()); - childRPCRespDto.setMaterialClassifyName(child.getMaterialClassifyName()); - childRPCList.add(childRPCRespDto); + //临时限制一下 + if(child.getConsumable() == 1){ + SafeMaterialClassifyRPCRespDto childRPCRespDto = new SafeMaterialClassifyRPCRespDto(); + childRPCRespDto.setId(child.getId()); + childRPCRespDto.setParentId(child.getParentId()); + childRPCRespDto.setMaterialClassifyName(child.getMaterialClassifyName()); + childRPCRespDto.setConsumable(child.getConsumable()); + childRPCRespDto.setConsumableName(child.getConsumableName()); + childRPCList.add(childRPCRespDto); + } + } classifyRPCRespDto.setChildList(childRPCList); rpcRespList.add(classifyRPCRespDto); @@ -197,4 +207,33 @@ } return resultVO; } + + @Override + public ResultVO<List<MaterialReceiveRecordsRPCRespDto>> getMaterialReceiveRecords(MaterialReceiveRecordsRPCReq req) { + ResultVO resultVO = new ResultVO<>(ResultCodes.OK); + MaterialReceiveRecordsBO materialReceiveRecordsBO = new MaterialReceiveRecordsBO(); + if(null != req){ + BeanUtils.copyProperties(req,materialReceiveRecordsBO); + } + try { + List<MaterialReceiveRecordsDO> list = materialReceiveRecordsService.getReceiveRecordsByReceiveUids(materialReceiveRecordsBO); + List<MaterialReceiveRecordsRPCRespDto> materialReceiveRecordsRPCRespDtos = new ArrayList<>(); + if(list.size()>0){ + for(MaterialReceiveRecordsDO recordsDO:list){ + MaterialReceiveRecordsRPCRespDto receiveRecordsRPCRespDto = new MaterialReceiveRecordsRPCRespDto(); + BeanUtils.copyProperties(recordsDO,receiveRecordsRPCRespDto); + materialReceiveRecordsRPCRespDtos.add(receiveRecordsRPCRespDto); + } + resultVO.setData(materialReceiveRecordsRPCRespDtos); + } + }catch (EquipmentException e){ + resultVO.setCode(e.getCode()); + resultVO.setMsg(e.getMessage()); + }catch (Exception e){ + resultVO.setCode(ResultCodes.SERVER_ERROR.getCode()); + resultVO.setCode(ResultCodes.SERVER_ERROR.getDesc()); + + } + return resultVO; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java index 56a8311..91a9ab1 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java @@ -7,10 +7,7 @@ import com.gkhy.safePlatform.commons.utils.PageUtils; import com.gkhy.safePlatform.commons.vo.ResultVO; import com.gkhy.safePlatform.commons.vo.SearchResultVO; -import com.gkhy.safePlatform.equipment.model.dto.req.MaterialClassifyQuery; -import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyAddReq; -import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyModReq; -import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyQuery; +import com.gkhy.safePlatform.equipment.model.dto.req.*; import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyDto; import com.gkhy.safePlatform.equipment.service.MaterialClassifyService; import org.springframework.beans.factory.annotation.Autowired; @@ -46,7 +43,7 @@ public SearchResultVO<List<SafeMaterialClassifyDto>> listByPage(Authentication authentication,@RequestBody PageQuery<MaterialClassifyQuery> pageQuery){ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); PageUtils.checkCheck(pageQuery); - return materialClassifyService.listByPage(pageQuery); + return materialClassifyService.listByPage(currentUser,pageQuery); } @@ -78,15 +75,25 @@ public ResultVO delete(Authentication authentication, @RequestBody JSONObject jsonObject){ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); Long id = jsonObject.getLong("id"); - return materialClassifyService.delete(id); + return materialClassifyService.delete(currentUser,id); } + /** + * 逻辑删除-批量 + * @return + */ +// @PostMapping(value = "batch/delete") +// public ResultVO batchDelete(Authentication authentication, @Validated @RequestBody ParamForm paramForm){ +// ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); +// return materialClassifyService.batchDelete(currentUser,paramForm); +// } /** * 查询单条数据 */ @PostMapping(value = "queryById") public ResultVO<SafeMaterialClassifyDto> queryById(Authentication authentication, @RequestBody JSONObject jsonObject){ + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); Long id = jsonObject.getLong("id"); - return new ResultVO<>(ResultCodes.OK,materialClassifyService.queryById(id)); + return new ResultVO<>(ResultCodes.OK,materialClassifyService.queryById(currentUser,id)); } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialController.java index 558b456..2c86fc8 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialController.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialController.java @@ -1,8 +1,12 @@ package com.gkhy.safePlatform.equipment.controller; import com.alibaba.fastjson.JSONObject; +import com.gkhy.safePlatform.commons.co.ContextCacheUser; +import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.utils.PageUtils; import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.equipment.model.dto.req.ParamForm; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialAddReq; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialModReq; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialQuery; @@ -23,34 +27,47 @@ @PostMapping(value = "save") public ResultVO save(Authentication authentication, @Validated @RequestBody SafeMaterialAddReq req){ - return safeMaterialService.save(req); + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return safeMaterialService.save(currentUser,req); } @PostMapping(value = "update") public ResultVO update(Authentication authentication, @Validated @RequestBody SafeMaterialModReq req){ - return safeMaterialService.update(req); + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return safeMaterialService.update(currentUser,req); } @PostMapping(value = "delete") public ResultVO delete(Authentication authentication, @RequestBody JSONObject jsonObject){ + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); Long id = jsonObject.getLong("id"); - return safeMaterialService.delete(id); + return safeMaterialService.delete(currentUser,id); } @PostMapping(value = "queryById") public ResultVO queryById(Authentication authentication, @RequestBody JSONObject jsonObject){ + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); Long id = jsonObject.getLong("id"); - return safeMaterialService.queryById(id); + return safeMaterialService.queryById(currentUser,id); } @PostMapping(value = "list") public ResultVO list(Authentication authentication){ - return safeMaterialService.list(); + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return new ResultVO<>(ResultCodes.OK,safeMaterialService.list(currentUser)); + } + @PostMapping(value = "listByDepId") + public ResultVO listByDepId(Authentication authentication){ + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return new ResultVO<>(ResultCodes.OK,safeMaterialService.listByDepId(currentUser)); } @PostMapping(value = "page/list") public ResultVO listByPage(Authentication authentication,@RequestBody PageQuery<SafeMaterialQuery> pageQuery){ - return safeMaterialService.listByPage(pageQuery); + PageUtils.checkCheck(pageQuery); + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return safeMaterialService.listByPage(currentUser,pageQuery); } @PostMapping(value = "deleteBatch") - public ResultVO deleteBatch(Authentication authentication, @RequestBody Long[] ids){ - return safeMaterialService.deleteBatch(ids); + public ResultVO deleteBatch(Authentication authentication,@Validated @RequestBody ParamForm paramForm){ + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return safeMaterialService.deleteBatch(currentUser,paramForm); } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java index 619a9e5..bc58e55 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java @@ -1,6 +1,7 @@ package com.gkhy.safePlatform.equipment.controller; import com.alibaba.fastjson.JSONObject; +import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.query.PageQuery; import com.gkhy.safePlatform.commons.vo.ResultVO; @@ -46,15 +47,7 @@ public ResultVO update(Authentication authentication,@Validated @RequestBody SafeMaterialDetailReq req){ return safeMaterialDetailService.update(req); } - /** - * 单独出入库 - * @param authentication - * @return - */ - @PostMapping(value = "/single/delivery0rReceipt") - public ResultVO singleDdelivery0rReceipt(Authentication authentication, @Validated @RequestBody SafeMaterialDetailReq req){ - return safeMaterialDetailService.singleDdelivery0rReceipt(req); - } + /** * 单独出库 @@ -63,7 +56,9 @@ */ @PostMapping(value = "/single/delivery") public ResultVO singleDelivery(Authentication authentication, @Validated @RequestBody SafeMaterialDetailReq req){ - return safeMaterialDetailService.singleDelivery(req); + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + safeMaterialDetailService.singleDelivery(currentUser,req); + return new ResultVO(ResultCodes.OK); } /** @@ -73,8 +68,10 @@ */ @PostMapping(value = "/single/receipt") public ResultVO singleReceipt(Authentication authentication,@RequestBody JSONObject jsonObject){ + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); Long id = jsonObject.getLong("id"); - return safeMaterialDetailService.singleReceipt(id); + safeMaterialDetailService.singleReceipt(id,currentUser); + return new ResultVO(ResultCodes.OK); } /** * 批量出库 - 根据ids @@ -83,8 +80,9 @@ */ @PostMapping(value = "/batch/delivery/ids") public ResultVO deliveryBatchByIds(Authentication authentication, @Validated @RequestBody MterialDeliveryReq req){ - - return safeMaterialDetailService.deliveryBatchByIds(req); + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + safeMaterialDetailService.deliveryBatchByIds(req,currentUser); + return new ResultVO(ResultCodes.OK); } /** * 批量出库 @@ -93,7 +91,9 @@ */ @PostMapping(value = "/batch/delivery/random") public ResultVO deliveryBatchRandom(Authentication authentication,@Validated @RequestBody MterialRandomDeliveryReq req){ - return safeMaterialDetailService.deliveryBatchRandom(req); + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + safeMaterialDetailService.deliveryBatchBySmId(req,currentUser); + return new ResultVO(ResultCodes.OK); } /** @@ -101,6 +101,7 @@ */ @PostMapping(value = "/batch/receipt") public ResultVO receiptBatch(Authentication authentication ,@Validated @RequestBody ParamForm paramForm){ + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); return safeMaterialDetailService.receiptBatch(paramForm); } /** @@ -121,7 +122,8 @@ */ @PostMapping(value = "/deleteBatch") public ResultVO deleteBatch(Authentication authentication,@Validated @RequestBody ParamForm paramForm){ - return safeMaterialDetailService.deleteBatch(paramForm); + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return safeMaterialDetailService.deleteBatch(currentUser,paramForm); } @@ -132,7 +134,8 @@ */ @PostMapping(value = "/page/list") public SearchResultVO<List<SafeMaterialDetailDto>> listByPage(Authentication authentication, @RequestBody PageQuery<SafeMatetrialDetailQuery> pageQuery){ - return safeMaterialDetailService.listByPage(pageQuery); + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return safeMaterialDetailService.listByPage(currentUser,pageQuery); } /** @@ -155,7 +158,7 @@ safeMaterialDetailService.deliveryBatchSpw(req); return new ResultVO<>(ResultCodes.OK); } - /* *//** + /** * 根据rfid获去数据 * @param authentication * @return diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialReceiveRecordsController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialReceiveRecordsController.java new file mode 100644 index 0000000..43f4b22 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialReceiveRecordsController.java @@ -0,0 +1,46 @@ +package com.gkhy.safePlatform.equipment.controller; + + +import com.gkhy.safePlatform.commons.co.ContextCacheUser; +import com.gkhy.safePlatform.commons.enums.ResultCodes; +import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.utils.PageUtils; +import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.commons.vo.SearchResultVO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseDO; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsBaseReq; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsQuery; +import com.gkhy.safePlatform.equipment.model.dto.resp.MaterialReceiveRecordsBaseDto; +import com.gkhy.safePlatform.equipment.service.MaterialReceiveRecordsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + + +@RestController +@RequestMapping("/equipment/material/record") +public class SafeMaterialReceiveRecordsController { + @Autowired + private MaterialReceiveRecordsService materialReceiveRecordsService; + + @RequestMapping("page/list") + public SearchResultVO<List<MaterialReceiveRecordsBaseDto>> list(Authentication authentication, @RequestBody PageQuery<MaterialReceiveRecordsQuery> pageQuery){ + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + PageUtils.checkCheck(pageQuery); + return materialReceiveRecordsService.listByPage(currentUser,pageQuery); + } + /** + * 归还物资 + */ + @RequestMapping("revert") + public ResultVO revertMaterial(Authentication authentication, @Validated @RequestBody MaterialReceiveRecordsBaseReq req){ + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + materialReceiveRecordsService.revertMaterial(currentUser,req); + return new ResultVO(ResultCodes.OK); + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialDeliveryRecordDO.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialDeliveryRecordDO.java new file mode 100644 index 0000000..ab3223c --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialDeliveryRecordDO.java @@ -0,0 +1,153 @@ +package com.gkhy.safePlatform.equipment.entity; + + +import java.time.LocalDateTime; + +/** + * 出库记录 + */ +public class MaterialDeliveryRecordDO { + /** + * 主键 + */ + private Long receiveBaseId; + /** + * 物资名称 + */ + private String materialName; + /** + * RFID + */ + private String rfid; + /** + * 状态 + */ + private Byte status; + /** + * 安全物资详表id + */ + private Long smdId; + /** + * 认领人id + */ + private Long receiveUid; + /** + * 认领人姓名 + */ + private String receiveUname; + /** + * 归还时间 + */ + private LocalDateTime revertTime; + + private Long receiveId; + + /** + * 领取数量 + */ + private Integer receiveCount; + /** + * 归还数量 + */ + private Integer revertCount; + /** + * 物资归还 + */ + private Byte revertStatus; + + public Long getReceiveBaseId() { + return receiveBaseId; + } + + public void setReceiveBaseId(Long receiveBaseId) { + this.receiveBaseId = receiveBaseId; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getRfid() { + return rfid; + } + + public void setRfid(String rfid) { + this.rfid = rfid; + } + + public Byte getStatus() { + return status; + } + + public void setStatus(Byte status) { + this.status = status; + } + + public Long getSmdId() { + return smdId; + } + + public void setSmdId(Long smdId) { + this.smdId = smdId; + } + + public Long getReceiveUid() { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + public LocalDateTime getRevertTime() { + return revertTime; + } + + public void setRevertTime(LocalDateTime revertTime) { + this.revertTime = revertTime; + } + + public Long getReceiveId() { + return receiveId; + } + + public void setReceiveId(Long receiveId) { + this.receiveId = receiveId; + } + + public Integer getReceiveCount() { + return receiveCount; + } + + public void setReceiveCount(Integer receiveCount) { + this.receiveCount = receiveCount; + } + + public Integer getRevertCount() { + return revertCount; + } + + public void setRevertCount(Integer revertCount) { + this.revertCount = revertCount; + } + + public Byte getRevertStatus() { + return revertStatus; + } + + public void setRevertStatus(Byte revertStatus) { + this.revertStatus = revertStatus; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBO.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBO.java new file mode 100644 index 0000000..cf91249 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBO.java @@ -0,0 +1,25 @@ +package com.gkhy.safePlatform.equipment.entity; + + +import java.util.List; + +public class MaterialReceiveRecordsBO { + private List<Long> receiveUids; + private List<Long> smallClassifyIds ; + + public List<Long> getReceiveUids() { + return receiveUids; + } + + public void setReceiveUids(List<Long> receiveUids) { + this.receiveUids = receiveUids; + } + + public List<Long> getSmallClassifyIds() { + return smallClassifyIds; + } + + public void setSmallClassifyIds(List<Long> smallClassifyIds) { + this.smallClassifyIds = smallClassifyIds; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseBO.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseBO.java new file mode 100644 index 0000000..ed2893b --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseBO.java @@ -0,0 +1,32 @@ +package com.gkhy.safePlatform.equipment.entity; + + +public class MaterialReceiveRecordsBaseBO { + private Long id; + private Byte status; + private Integer revertCount; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Byte getStatus() { + return status; + } + + public void setStatus(Byte status) { + this.status = status; + } + + public Integer getRevertCount() { + return revertCount; + } + + public void setRevertCount(Integer revertCount) { + this.revertCount = revertCount; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseDO.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseDO.java new file mode 100644 index 0000000..a88e490 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseDO.java @@ -0,0 +1,153 @@ +package com.gkhy.safePlatform.equipment.entity; + + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.time.LocalDateTime; + +public class MaterialReceiveRecordsBaseDO { + /** + * 主键 + */ + private Long id; + /** + * 物资种类名称 + */ + private String materialName; + + /** + * 领取人id + */ + private Long receiveUid; + + /** + * 领取人姓名 + */ + private String receiveUname; + /** + * 领取数量 + */ + private Integer receiveCount; + /** + * 归还数量 + */ + private Integer revertCount; + private Integer consumeCount; + /** + * 归还情况(0未归还,1部分归还,2归还完成,3耗材无需归还) + */ + private Byte status; + + /** + * 物资管理id + */ + private Long smId; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + public LocalDateTime createTime; + + + private Long depId; + + private String depName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public Long getReceiveUid() { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + public Integer getReceiveCount() { + return receiveCount; + } + + public void setReceiveCount(Integer receiveCount) { + this.receiveCount = receiveCount; + } + + public Integer getRevertCount() { + return revertCount; + } + + public void setRevertCount(Integer revertCount) { + this.revertCount = revertCount; + } + + public Byte getStatus() { + return status; + } + + public void setStatus(Byte status) { + this.status = status; + } + + public Long getSmId() { + return smId; + } + + public void setSmId(Long smId) { + this.smId = smId; + } + + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public Long getDepId() { + return depId; + } + + public void setDepId(Long depId) { + this.depId = depId; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public Integer getConsumeCount() { + return consumeCount; + } + + public void setConsumeCount(Integer consumeCount) { + this.consumeCount = consumeCount; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseInfo.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseInfo.java new file mode 100644 index 0000000..bdc772e --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsBaseInfo.java @@ -0,0 +1,226 @@ +package com.gkhy.safePlatform.equipment.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.time.LocalDateTime; + + +@TableName("material_receive_records_base") +public class MaterialReceiveRecordsBaseInfo { + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 物资种类名称 + */ + private String materialName; + + /** + * 领取人id + */ + private Long receiveUid; + + /** + * 领取人姓名 + */ + private String receiveUname; + /** + * 领取数量 + */ + private Integer receiveCount; + /** + * 归还数量 + */ + private Integer revertCount; + /** + * 损耗数量 + */ + private Integer consumeCount; + /** + * 归还情况(0未归还,1部分归还,2归还完成,3耗材无需归还) + */ + private Byte status; + + /** + * 物资管理id + */ + private Long smId; + /** + * 删除标识 + */ + @TableField(fill = FieldFill.INSERT) //自动填充的注解 + private int delFlag; + /** + * 创建人id + */ + @TableField(fill = FieldFill.INSERT) //自动填充的注解 + private Long createUid; + /** + * 创建人姓名 + */ + @TableField(fill = FieldFill.INSERT) //自动填充的注解 + private String createUname; + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) //自动填充的注解 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + public LocalDateTime createTime; + /** + * 修改人id + */ + @TableField(fill = FieldFill.INSERT_UPDATE) //自动填充的注解 + private Long updateUid; + /** + * 修改人姓名 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) //自动填充的注解 + private String updateUname; + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) //自动填充的注解 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime updateTime; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public Long getReceiveUid(Long uid) { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + + + public Integer getReceiveCount() { + return receiveCount; + } + + public void setReceiveCount(Integer receiveCount) { + this.receiveCount = receiveCount; + } + + public Integer getRevertCount() { + return revertCount; + } + + public void setRevertCount(Integer revertCount) { + this.revertCount = revertCount; + } + + + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public Long getCreateUid() { + return createUid; + } + + public void setCreateUid(Long createUid) { + this.createUid = createUid; + } + + public String getCreateUname() { + return createUname; + } + + public void setCreateUname(String createUname) { + this.createUname = createUname; + } + + public LocalDateTime getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(LocalDateTime updateTime) { + this.updateTime = updateTime; + } + + public Long getUpdateUid() { + return updateUid; + } + + public void setUpdateUid(Long updateUid) { + this.updateUid = updateUid; + } + + public String getUpdateUname() { + return updateUname; + } + + public void setUpdateUname(String updateUname) { + this.updateUname = updateUname; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + + + public Byte getStatus() { + return status; + } + + public void setStatus(Byte status) { + this.status = status; + } + + public Long getReceiveUid() { + return receiveUid; + } + + public Long getSmId() { + return smId; + } + + public void setSmId(Long smId) { + this.smId = smId; + } + + public Integer getConsumeCount() { + return consumeCount; + } + + public void setConsumeCount(Integer consumeCount) { + this.consumeCount = consumeCount; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsDO.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsDO.java new file mode 100644 index 0000000..f389147 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsDO.java @@ -0,0 +1,207 @@ +package com.gkhy.safePlatform.equipment.entity; + + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.time.LocalDateTime; + +public class MaterialReceiveRecordsDO { + /** + * id + */ + private Long id; + /** + * 物资名称 + */ + private String materialName; + /** + * 物资编号 + */ + private String materialNo; + /** + * rfid + */ + private String rfid; + /** + * 领取时间 + */ + @TableField(fill = FieldFill.INSERT) //自动填充的注解 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime receiveTime; + /** + * 领取人id + */ + private Long receiveUid; + /** + * 领取人姓名 + */ + private String receiveUname; + /** + * 归还状态(0未归还,1归还,3损耗) + */ + private Byte revertStatus; + /** + * 物资状态 + */ + private Byte materialStatus; + /** + * 备注 + */ + private String remark; + /** + * 归还时间 + */ + private LocalDateTime revertTime; + + /** + * 物资清单(详细物资)id + */ + private Long smdId; + /** + * 基础记录id + */ + private Long receiveBaseId; + + private Byte validStatus; + private Long smallClassifyId; + private Long bigClassifyId; + private Byte consumable; + + public Long getReceiveBaseId() { + return receiveBaseId; + } + + public void setReceiveBaseId(Long receiveBaseId) { + this.receiveBaseId = receiveBaseId; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getRfid() { + return rfid; + } + + public void setRfid(String rfid) { + this.rfid = rfid; + } + + public LocalDateTime getReceiveTime() { + return receiveTime; + } + + public void setReceiveTime(LocalDateTime receiveTime) { + this.receiveTime = receiveTime; + } + + public Long getReceiveUid() { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + public Byte getRevertStatus() { + return revertStatus; + } + + public void setRevertStatus(Byte revertStatus) { + this.revertStatus = revertStatus; + } + + public Byte getMaterialStatus() { + return materialStatus; + } + + public void setMaterialStatus(Byte materialStatus) { + this.materialStatus = materialStatus; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public LocalDateTime getRevertTime() { + return revertTime; + } + + public void setRevertTime(LocalDateTime revertTime) { + this.revertTime = revertTime; + } + + public Long getSmdId() { + return smdId; + } + + public void setSmdId(Long smdId) { + this.smdId = smdId; + } + + public Byte getValidStatus() { + return validStatus; + } + + public void setValidStatus(Byte validStatus) { + this.validStatus = validStatus; + } + + public Long getSmallClassifyId() { + return smallClassifyId; + } + + public void setSmallClassifyId(Long smallClassifyId) { + this.smallClassifyId = smallClassifyId; + } + + public Long getBigClassifyId() { + return bigClassifyId; + } + + public void setBigClassifyId(Long bigClassifyId) { + this.bigClassifyId = bigClassifyId; + } + + public Byte getConsumable() { + return consumable; + } + + public void setConsumable(Byte consumable) { + this.consumable = consumable; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsInfo.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsInfo.java new file mode 100644 index 0000000..f0c59bf --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/MaterialReceiveRecordsInfo.java @@ -0,0 +1,168 @@ +package com.gkhy.safePlatform.equipment.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.time.LocalDateTime; + + +@TableName("material_receive_records") +public class MaterialReceiveRecordsInfo { + @TableId(type = IdType.AUTO) + private Long id; + /** + * 物资名称 + */ + private String materialName; + /** + * 物资编号 + */ + private String materialNo; + /** + * rfid + */ + private String rfid; + /** + * 领取时间 + */ + @TableField(fill = FieldFill.INSERT) //自动填充的注解 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime receiveTime; + /** + * 领取人id + */ + private Long receiveUid; + /** + * 领取人姓名 + */ + private String receiveUname; + /** + * 归还状态(0未归还,1归还,3损耗) + */ + private Byte revertStatus; + /** + * 物资状态 + */ + private Byte materialStatus; + /** + * 备注 + */ + private String remark; + /** + * 归还时间 + */ + private LocalDateTime revertTime; + + /** + * 物资清单(详细物资)id + */ + private Long smdId; + /** + * 基础记录id + */ + private Long receiveBaseId; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getRfid() { + return rfid; + } + + public void setRfid(String rfid) { + this.rfid = rfid; + } + + public Long getSmdId() { + return smdId; + } + + public void setSmdId(Long smdId) { + this.smdId = smdId; + } + + public Long getReceiveBaseId() { + return receiveBaseId; + } + + public void setReceiveBaseId(Long receiveBaseId) { + this.receiveBaseId = receiveBaseId; + } + + public LocalDateTime getReceiveTime() { + return receiveTime; + } + + public void setReceiveTime(LocalDateTime receiveTime) { + this.receiveTime = receiveTime; + } + + public Long getReceiveUid() { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + public Byte getRevertStatus() { + return revertStatus; + } + + public void setRevertStatus(Byte revertStatus) { + this.revertStatus = revertStatus; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public LocalDateTime getRevertTime() { + return revertTime; + } + + public void setRevertTime(LocalDateTime revertTime) { + this.revertTime = revertTime; + } + + public Byte getMaterialStatus() { + return materialStatus; + } + + public void setMaterialStatus(Byte materialStatus) { + this.materialStatus = materialStatus; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialBO.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialBO.java new file mode 100644 index 0000000..e3bf9f1 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialBO.java @@ -0,0 +1,32 @@ +package com.gkhy.safePlatform.equipment.entity; + + +public class SafeMaterialBO { + private Long id; + private Integer totalCount; + private Integer stockCount; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public Integer getStockCount() { + return stockCount; + } + + public void setStockCount(Integer stockCount) { + this.stockCount = stockCount; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailBO.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialBatchDeliveryBO.java similarity index 67% rename from equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailBO.java rename to equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialBatchDeliveryBO.java index 6ad8730..d41e2e7 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailBO.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialBatchDeliveryBO.java @@ -3,12 +3,14 @@ import java.time.LocalDateTime; import java.util.List; -public class SafeMaterialDetailBO { +public class SafeMaterialBatchDeliveryBO { private List<Long> ids; private Integer count; private Byte irStatus; - private Long claimantId; - private String claimantName; + + private Long receiveUid; + + private String receiveUname; private LocalDateTime deliveryTime; @@ -37,20 +39,21 @@ this.irStatus = irStatus; } - public Long getClaimantId() { - return claimantId; + + public Long getReceiveUid() { + return receiveUid; } - public void setClaimantId(Long claimantId) { - this.claimantId = claimantId; + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; } - public String getClaimantName() { - return claimantName; + public String getReceiveUname() { + return receiveUname; } - public void setClaimantName(String claimantName) { - this.claimantName = claimantName; + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; } public LocalDateTime getDeliveryTime() { diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyInfo.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyInfo.java index a44963f..d38dd84 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyInfo.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyInfo.java @@ -21,6 +21,8 @@ * 父级id */ private Long parentId; + + private Byte consumable; /** * 删除标识 */ @@ -140,4 +142,12 @@ public void setParentId(Long parentId) { this.parentId = parentId; } + + public Byte getConsumable() { + return consumable; + } + + public void setConsumable(Byte consumable) { + this.consumable = consumable; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDO.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDO.java index fcc9cdd..3f0df27 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDO.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDO.java @@ -25,6 +25,7 @@ private String bigClassifyName; private Long smallClassifyId; + private String smallClassifyName; /** * 部门id */ @@ -37,6 +38,11 @@ * 物资名称 */ private String materialName; + /** + * + */ + private Integer totalCount; + private Integer stockCount; /** * 是否是耗材(0是, 1否) */ @@ -209,4 +215,28 @@ public void setSmallClassifyId(Long smallClassifyId) { this.smallClassifyId = smallClassifyId; } + + public String getSmallClassifyName() { + return smallClassifyName; + } + + public void setSmallClassifyName(String smallClassifyName) { + this.smallClassifyName = smallClassifyName; + } + + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public Integer getStockCount() { + return stockCount; + } + + public void setStockCount(Integer stockCount) { + this.stockCount = stockCount; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfo.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfo.java index 47c026d..1329793 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfo.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfo.java @@ -5,6 +5,7 @@ import java.io.Serializable; import java.time.LocalDateTime; +import java.util.Date; @TableName("safe_material_detail") public class SafeMaterialDetailInfo implements Serializable { @@ -46,7 +47,7 @@ /** * 保质到期时间 */ - private LocalDateTime validTime; + private Date validTime; /** * 状态 */ @@ -70,13 +71,21 @@ /** * 认领人id */ - private Long claimantId; + private Long receiveUid; /** * 认领人姓名 */ - private String claimantName; + private String receiveUname; + /** + * 无效原因 + */ + private Byte status; + /** + * 描述 + */ + private String remark; /** * 删除标识 */ @@ -179,11 +188,11 @@ this.validType = validType; } - public LocalDateTime getValidTime() { + public Date getValidTime() { return validTime; } - public void setValidTime(LocalDateTime validTime) { + public void setValidTime(Date validTime) { this.validTime = validTime; } @@ -283,19 +292,36 @@ this.updateTime = updateTime; } - public Long getClaimantId() { - return claimantId; + public Long getReceiveUid() { + return receiveUid; } - public void setClaimantId(Long claimantId) { - this.claimantId = claimantId; + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; } - public String getClaimantName() { - return claimantName; + public String getReceiveUname() { + return receiveUname; } - public void setClaimantName(String claimantName) { - this.claimantName = claimantName; + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + + public Byte getStatus() { + return status; + } + + public void setStatus(Byte status) { + this.status = status; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfoDO.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfoDO.java index 413842f..7669f3b 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfoDO.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfoDO.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import java.time.LocalDateTime; +import java.util.Date; public class SafeMaterialDetailInfoDO { /** @@ -51,12 +52,16 @@ /** * 保质到期时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private LocalDateTime validTime; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date validTime; /** * 状态 */ private Byte validStatus; + + private Byte status; + + private String remark; /** * 出入库状态 */ @@ -78,12 +83,12 @@ /** * 认领人id */ - private Long claimantId; + private Long receiveUid; /** * 认领人姓名 */ - private String claimantName; + private String receiveUname; public Long getId() { return id; @@ -165,11 +170,11 @@ this.validType = validType; } - public LocalDateTime getValidTime() { + public Date getValidTime() { return validTime; } - public void setValidTime(LocalDateTime validTime) { + public void setValidTime(Date validTime) { this.validTime = validTime; } @@ -213,21 +218,6 @@ this.smId = smId; } - public Long getClaimantId() { - return claimantId; - } - - public void setClaimantId(Long claimantId) { - this.claimantId = claimantId; - } - - public String getClaimantName() { - return claimantName; - } - - public void setClaimantName(String claimantName) { - this.claimantName = claimantName; - } public Long getSmallClassifyId() { return smallClassifyId; @@ -236,4 +226,36 @@ public void setSmallClassifyId(Long smallClassifyId) { this.smallClassifyId = smallClassifyId; } + + public Long getReceiveUid() { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + public Byte getStatus() { + return status; + } + + public void setStatus(Byte status) { + this.status = status; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialInfo.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialInfo.java index a2a467b..76a9e62 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialInfo.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialInfo.java @@ -44,6 +44,14 @@ */ private Byte consumable; /** + * 有效数量 + */ + private Integer totalCount; + /** + * 库存数量 + */ + private Integer stockCount; + /** * 删除标识 */ @TableField(fill = FieldFill.INSERT) //自动填充的注解 @@ -202,5 +210,19 @@ this.updateTime = updateTime; } + public Integer getTotalCount() { + return totalCount; + } + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public Integer getStockCount() { + return stockCount; + } + + public void setStockCount(Integer stockCount) { + this.stockCount = stockCount; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ConsumableEnum.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ConsumableEnum.java index bcbedcb..d2b16e5 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ConsumableEnum.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ConsumableEnum.java @@ -4,8 +4,8 @@ import java.util.Map; public enum ConsumableEnum { - YES((byte) 0, "是"), - NO((byte) 1, "否"); + YES((byte) 0, "耗材"), + NO((byte) 1, "非耗材"); private Byte code; private String value; diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/EquipmentResultCodes.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/EquipmentResultCodes.java index 387ad2f..fb9b177 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/EquipmentResultCodes.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/EquipmentResultCodes.java @@ -17,6 +17,7 @@ MATERIAL_IN_THE_LIBRARY("E1008","物资已入库,不可再次入库"), MATERIAL_CONSUMABLE("E1009","耗材物资不可重新入库"), DATA_EXIST("E1010","数据已存在"), + DATA_ILLEGAL("E1011","数据不合法"), ERROR("A3000", "未知错误"); diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialReceiveRecordsStatusEnum.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialReceiveRecordsStatusEnum.java new file mode 100644 index 0000000..3a67fef --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialReceiveRecordsStatusEnum.java @@ -0,0 +1,49 @@ +package com.gkhy.safePlatform.equipment.enums; + + +import java.util.HashMap; +import java.util.Map; + +public enum MaterialReceiveRecordsStatusEnum { + RETURN_NO((byte) 0, "未归还"), + RETURN_PART((byte) 1, "部分归还"), + RETURN_COMPLETE((byte)2,"归还完成"), + CONSUMABLE_RETURN_NO((byte)3,"--"); + private Byte code; + private String value; + + MaterialReceiveRecordsStatusEnum(Byte code, String value) { + this.code = code; + this.value = value; + } + + public Byte getCode() { + return code; + } + + public void setCode(Byte code) { + this.code = code; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能 + public static Map<Byte, MaterialReceiveRecordsStatusEnum> toMap() { + Map<Byte, MaterialReceiveRecordsStatusEnum> map = new HashMap(); + for (MaterialReceiveRecordsStatusEnum receiveRecordsStatusEnum : MaterialReceiveRecordsStatusEnum.values()) { + map.put(receiveRecordsStatusEnum.getCode(), receiveRecordsStatusEnum); + } + return map; + } + + public static MaterialReceiveRecordsStatusEnum getByCode(Byte code){ + return toMap().get(code); + } + +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialRevertStatusEnum.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialRevertStatusEnum.java new file mode 100644 index 0000000..7d60e0f --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialRevertStatusEnum.java @@ -0,0 +1,47 @@ +package com.gkhy.safePlatform.equipment.enums; + +import java.util.HashMap; +import java.util.Map; + + +public enum MaterialRevertStatusEnum { + REVERT_YES((byte) 0, "已归还"), + REVERT_NO((byte) 1, "未归还"), + DEPLETION((byte)2,"耗损"); + private Byte code; + private String value; + + MaterialRevertStatusEnum(Byte code, String value) { + this.code = code; + this.value = value; + } + + public Byte getCode() { + return code; + } + + public void setCode(Byte code) { + this.code = code; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能 + public static Map<Byte, MaterialRevertStatusEnum> toMap() { + Map<Byte, MaterialRevertStatusEnum> map = new HashMap(); + for (MaterialRevertStatusEnum revertStatusEnum : MaterialRevertStatusEnum.values()) { + map.put(revertStatusEnum.getCode(), revertStatusEnum); + } + return map; + } + + public static MaterialRevertStatusEnum getByCode(Byte code){ + return toMap().get(code); + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialStatusEnum.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialStatusEnum.java new file mode 100644 index 0000000..8a1d2ca --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/MaterialStatusEnum.java @@ -0,0 +1,50 @@ +package com.gkhy.safePlatform.equipment.enums; + +import java.util.HashMap; +import java.util.Map; + +public enum MaterialStatusEnum { + INTACT((byte) 0, "完好"), + DAMAGE((byte) 1, "损坏"), + LOSS((byte) 2, "丢失"), + OVERDUE((byte) 3, "过期"), + OTHER((byte) 4,"其他") + ; + + private Byte code; + private String value; + + MaterialStatusEnum(Byte code, String value) { + this.code = code; + this.value = value; + } + + public Byte getCode() { + return code; + } + + public void setCode(Byte code) { + this.code = code; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能 + public static Map<Byte, MaterialStatusEnum> toMap() { + Map<Byte, MaterialStatusEnum> map = new HashMap(); + for (MaterialStatusEnum materialStatusEnum : MaterialStatusEnum.values()) { + map.put(materialStatusEnum.getCode(), materialStatusEnum); + } + return map; + } + + public static MaterialStatusEnum getByCode(Byte code){ + return toMap().get(code); + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ValidStatusEnum.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ValidStatusEnum.java index ba6840d..26e44c7 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ValidStatusEnum.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/ValidStatusEnum.java @@ -34,8 +34,8 @@ // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能 public static Map<Byte, ValidStatusEnum> toMap() { Map<Byte, ValidStatusEnum> map = new HashMap(); - for (ValidStatusEnum consumableEnum : ValidStatusEnum.values()) { - map.put(consumableEnum.getCode(), consumableEnum); + for (ValidStatusEnum validStatusEnum : ValidStatusEnum.values()) { + map.put(validStatusEnum.getCode(), validStatusEnum); } return map; } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsBaseReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsBaseReq.java new file mode 100644 index 0000000..2fa3fe0 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsBaseReq.java @@ -0,0 +1,27 @@ +package com.gkhy.safePlatform.equipment.model.dto.req; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class MaterialReceiveRecordsBaseReq { + @NotNull(message = "领取记录主键不可为空!") + private Long receiveBaseId; + @NotNull(message = "领取物资不可为空!") + private List<MaterialReceiveRecordsReq> materialList; + + public Long getReceiveBaseId() { + return receiveBaseId; + } + + public void setReceiveBaseId(Long receiveBaseId) { + this.receiveBaseId = receiveBaseId; + } + + public List<MaterialReceiveRecordsReq> getMaterialList() { + return materialList; + } + + public void setMaterialList(List<MaterialReceiveRecordsReq> materialList) { + this.materialList = materialList; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsQuery.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsQuery.java new file mode 100644 index 0000000..18c295a --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsQuery.java @@ -0,0 +1,65 @@ +package com.gkhy.safePlatform.equipment.model.dto.req; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.time.LocalDate; + + +public class MaterialReceiveRecordsQuery { + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate startTime; + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate endTime; + private String materialName; + private Long depId; + private Long receiveUid; + private String receiveUname; + + public LocalDate getStartTime() { + return startTime; + } + + public void setStartTime(LocalDate startTime) { + this.startTime = startTime; + } + + public LocalDate getEndTime() { + return endTime; + } + + public void setEndTime(LocalDate endTime) { + this.endTime = endTime; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public Long getDepId() { + return depId; + } + + public void setDepId(Long depId) { + this.depId = depId; + } + + public Long getReceiveUid() { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsReq.java new file mode 100644 index 0000000..04bdbb1 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialReceiveRecordsReq.java @@ -0,0 +1,41 @@ +package com.gkhy.safePlatform.equipment.model.dto.req; + + +public class MaterialReceiveRecordsReq { + /** + * 领取物资id + */ + private Long receiveId; + /** + * 物资状态 + */ + private Byte materialStatus; + /** + * 物资情况说明 + */ + private String remark; + + public Long getReceiveId() { + return receiveId; + } + + public void setReceiveId(Long receiveId) { + this.receiveId = receiveId; + } + + public Byte getMaterialStatus() { + return materialStatus; + } + + public void setMaterialStatus(Byte materialStatus) { + this.materialStatus = materialStatus; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialDeliveryReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialDeliveryReq.java index bda8a2d..c0f3ade 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialDeliveryReq.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialDeliveryReq.java @@ -8,7 +8,7 @@ @NotNull(message = "主键不可为空!") private List<Long> ids; @NotNull(message = "认领人不可为空!") - private Long claimantId; + private Long receiveUid; public List<Long> getIds() { return ids; @@ -18,11 +18,11 @@ this.ids = ids; } - public Long getClaimantId() { - return claimantId; + public Long getReceiveUid() { + return receiveUid; } - public void setClaimantId(Long claimantId) { - this.claimantId = claimantId; + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialRandomDeliveryReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialRandomDeliveryReq.java index 46f1b45..027a630 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialRandomDeliveryReq.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialRandomDeliveryReq.java @@ -7,7 +7,7 @@ @NotNull(message = "主键不可为空!") private Integer count; @NotNull(message = "认领人不可为空!") - private Long claimantId; + private Long receiveUid; @NotNull(message = "物资管理id不可为空!") private Long smId; @@ -22,12 +22,12 @@ this.smId = smId; } - public Long getClaimantId() { - return claimantId; + public Long getReceiveUid() { + return receiveUid; } - public void setClaimantId(Long claimantId) { - this.claimantId = claimantId; + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; } public Integer getCount() { diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialAddReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialAddReq.java index 9f4b63a..a83fdaf 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialAddReq.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialAddReq.java @@ -16,17 +16,7 @@ */ @NotNull(message = "物资类型(大类)不可为空!") private Long bigClassifyId; - /** - * 部门id - */ - @NotNull(message = "所属部门不可为空!") - private Long depId; - /** - * 是否是耗材(0是, 1否) - */ - @NotNull(message = "是否是耗材不可为空!") - private Byte consumable; public Long getSmallClassifyId() { return smallClassifyId; @@ -36,21 +26,6 @@ this.smallClassifyId = smallClassifyId; } - public Long getDepId() { - return depId; - } - - public void setDepId(Long depId) { - this.depId = depId; - } - - public Byte getConsumable() { - return consumable; - } - - public void setConsumable(Byte consumable) { - this.consumable = consumable; - } public Long getBigClassifyId() { return bigClassifyId; diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyAddReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyAddReq.java index d5b83af..3a6f87b 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyAddReq.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyAddReq.java @@ -14,6 +14,11 @@ */ private Long ParentId; + /** + * 是否是耗材(0是,1否) + */ + private Byte consumable; + public String getMaterialClassifyName() { return materialClassifyName; } @@ -29,4 +34,12 @@ public void setParentId(Long parentId) { ParentId = parentId; } + + public Byte getConsumable() { + return consumable; + } + + public void setConsumable(Byte consumable) { + this.consumable = consumable; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyModReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyModReq.java index 33aa411..3e3e2a7 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyModReq.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyModReq.java @@ -16,6 +16,11 @@ @NotBlank(message = "物资名称不可为空") private String materialClassifyName; + /** + * 是否是耗材(0是,1否) + */ + private Byte consumable; + public Long getId() { return id; } @@ -31,4 +36,12 @@ public void setMaterialClassifyName(String materialClassifyName) { this.materialClassifyName = materialClassifyName; } + + public Byte getConsumable() { + return consumable; + } + + public void setConsumable(Byte consumable) { + this.consumable = consumable; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailAddReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailAddReq.java index 001f192..53e52a0 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailAddReq.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailAddReq.java @@ -4,6 +4,7 @@ import javax.validation.constraints.NotNull; import java.time.LocalDateTime; +import java.util.Date; public class SafeMaterialDetailAddReq { @NotNull(message = "物资不可为空!") @@ -14,8 +15,8 @@ private Integer wareHousingCount; @NotNull(message = "有效期类型不可为空!") private Byte validType; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private LocalDateTime validTime; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date validTime; //rfid private String rfid; @@ -60,11 +61,11 @@ this.validType = validType; } - public LocalDateTime getValidTime() { + public Date getValidTime() { return validTime; } - public void setValidTime(LocalDateTime validTime) { + public void setValidTime(Date validTime) { this.validTime = validTime; } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailReq.java index 53467ea..256e447 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailReq.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialDetailReq.java @@ -4,6 +4,7 @@ import javax.validation.constraints.NotNull; import java.time.LocalDateTime; +import java.util.Date; public class SafeMaterialDetailReq { /** @@ -28,8 +29,8 @@ /** * 保质到期时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private LocalDateTime validTime; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date validTime; /** * 出入库状态 */ @@ -42,7 +43,7 @@ /** * 认领人id */ - private Long claimantId; + private Long receiveUid; public Long getId() { return id; @@ -76,11 +77,11 @@ this.validType = validType; } - public LocalDateTime getValidTime() { + public Date getValidTime() { return validTime; } - public void setValidTime(LocalDateTime validTime) { + public void setValidTime(Date validTime) { this.validTime = validTime; } @@ -100,12 +101,11 @@ this.smId = smId; } - public Long getClaimantId() { - return claimantId; + public Long getReceiveUid() { + return receiveUid; } - public void setClaimantId(Long claimantId) { - this.claimantId = claimantId; + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; } - } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialModReq.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialModReq.java index 56ab3c4..41898f2 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialModReq.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialModReq.java @@ -15,19 +15,7 @@ */ @NotNull(message = "物资类型(大类)不可为空!") private Long bigClassifyId; - /** - * 部门id - */ - @NotNull(message = "所属部门不可为空!") - private Long depId; - /** - * 物资名称 - */ - /** - * 是否是耗材(0是, 1否) - */ - @NotNull(message = "是否是耗材不可为空!") - private Byte consumable; + public Long getId() { return id; @@ -43,22 +31,6 @@ public void setSmallClassifyId(Long smallClassifyId) { this.smallClassifyId = smallClassifyId; - } - - public Long getDepId() { - return depId; - } - - public void setDepId(Long depId) { - this.depId = depId; - } - - public Byte getConsumable() { - return consumable; - } - - public void setConsumable(Byte consumable) { - this.consumable = consumable; } public Long getBigClassifyId() { diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialQuery.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialQuery.java index 6e958de..9667d35 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialQuery.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialQuery.java @@ -10,6 +10,8 @@ */ private String materialName; + private Long depId; + public Long getBigClassifyId() { return bigClassifyId; } @@ -25,4 +27,12 @@ public void setMaterialName(String materialName) { this.materialName = materialName; } + + public Long getDepId() { + return depId; + } + + public void setDepId(Long depId) { + this.depId = depId; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/db/SafeMaterialDetailDBQuery.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/db/SafeMaterialDetailDBQuery.java new file mode 100644 index 0000000..2682498 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/db/SafeMaterialDetailDBQuery.java @@ -0,0 +1,59 @@ +package com.gkhy.safePlatform.equipment.model.dto.req.db; + + +public class SafeMaterialDetailDBQuery { + private Byte irStatus; + private String rfid; + private Long depId; + private Long smId; + private Byte validStatus; + private Integer count; + + public Byte getIrStatus() { + return irStatus; + } + + public void setIrStatus(Byte irStatus) { + this.irStatus = irStatus; + } + + public String getRfid() { + return rfid; + } + + public void setRfid(String rfid) { + this.rfid = rfid; + } + + public Long getSmId() { + return smId; + } + + public void setSmId(Long smId) { + this.smId = smId; + } + + public Long getDepId() { + return depId; + } + + public void setDepId(Long depId) { + this.depId = depId; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public Byte getValidStatus() { + return validStatus; + } + + public void setValidStatus(Byte validStatus) { + this.validStatus = validStatus; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/BaseMaterialDto.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/BaseMaterialDto.java index 86907be..9d72f5b 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/BaseMaterialDto.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/BaseMaterialDto.java @@ -6,6 +6,12 @@ //物资名称 private String materialName; + /** + * 是否是耗材(0是, 1否) + */ + private Byte consumable; + private String consumableName; + public Long getSmId() { return smId; } @@ -21,4 +27,20 @@ public void setMaterialName(String materialName) { this.materialName = materialName; } + + public Byte getConsumable() { + return consumable; + } + + public void setConsumable(Byte consumable) { + this.consumable = consumable; + } + + public String getConsumableName() { + return consumableName; + } + + public void setConsumableName(String consumableName) { + this.consumableName = consumableName; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialReceiveRecordsBaseDto.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialReceiveRecordsBaseDto.java new file mode 100644 index 0000000..c2bc2c7 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialReceiveRecordsBaseDto.java @@ -0,0 +1,174 @@ +package com.gkhy.safePlatform.equipment.model.dto.resp; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import java.time.LocalDateTime; +import java.util.List; + +public class MaterialReceiveRecordsBaseDto { + /** + * 主键 + */ + private Long id; + /** + * 物资种类名称 + */ + private String materialName; + + /** + * 领取人id + */ + private Long receiveUid; + + /** + * 领取人姓名 + */ + private String receiveUname; + /** + * 领取数量 + */ + private Integer receiveCount; + /** + * 归还数量 + */ + private Integer revertCount; + private Integer consumeCount; + /** + * 归还情况(0未归还,1部分归还,2归还完成,3耗材无需归还) + */ + private Byte status; + /** + * 归还情况 + */ + private String statusName; + + /** + * 物资管理id + */ + private Long smId; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + public LocalDateTime createTime; + + + private Long depId; + + private String depName; + + private List<MaterialReceiveRecordsDto> materialList; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public Long getReceiveUid() { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + public Integer getReceiveCount() { + return receiveCount; + } + + public void setReceiveCount(Integer receiveCount) { + this.receiveCount = receiveCount; + } + + public Integer getRevertCount() { + return revertCount; + } + + public void setRevertCount(Integer revertCount) { + this.revertCount = revertCount; + } + + public Byte getStatus() { + return status; + } + + public void setStatus(Byte status) { + this.status = status; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public Long getSmId() { + return smId; + } + + public void setSmId(Long smId) { + this.smId = smId; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public Long getDepId() { + return depId; + } + + public void setDepId(Long depId) { + this.depId = depId; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public List<MaterialReceiveRecordsDto> getMaterialList() { + return materialList; + } + + public void setMaterialList(List<MaterialReceiveRecordsDto> materialList) { + this.materialList = materialList; + } + + public Integer getConsumeCount() { + return consumeCount; + } + + public void setConsumeCount(Integer consumeCount) { + this.consumeCount = consumeCount; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialReceiveRecordsDto.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialReceiveRecordsDto.java new file mode 100644 index 0000000..7f06ff6 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialReceiveRecordsDto.java @@ -0,0 +1,193 @@ +package com.gkhy.safePlatform.equipment.model.dto.resp; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.time.LocalDateTime; + +public class MaterialReceiveRecordsDto { + @TableId(type = IdType.AUTO) + private Long id; + /** + * 物资名称 + */ + private String materialName; + /** + * 物资编号 + */ + private String materialNo; + /** + * rfid + */ + private String rfid; + /** + * 领取时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime receiveTime; + /** + * 领取人id + */ + private Long receiveUid; + /** + * 领取人姓名 + */ + private String receiveUname; + /** + * 归还状态(0未归还,1归还,3损耗) + */ + private Byte revertStatus; + /** + * 归还状态 + */ + private String revertStatusName; + /** + * 物资状态 + */ + private Byte materialStatus; + /** + * 物资状态 + */ + private String materialStatusName; + /** + * 备注 + */ + private String remark; + /** + * 归还时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime revertTime; + + /** + * 物资清单(详细物资)id + */ + private Long smdId; + /** + * 基础记录id + */ + private Long receiveBaseId; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getRfid() { + return rfid; + } + + public void setRfid(String rfid) { + this.rfid = rfid; + } + + public LocalDateTime getReceiveTime() { + return receiveTime; + } + + public void setReceiveTime(LocalDateTime receiveTime) { + this.receiveTime = receiveTime; + } + + public Long getReceiveUid() { + return receiveUid; + } + + public void setReceiveUid(Long receiveUid) { + this.receiveUid = receiveUid; + } + + public String getReceiveUname() { + return receiveUname; + } + + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + public Byte getRevertStatus() { + return revertStatus; + } + + public void setRevertStatus(Byte revertStatus) { + this.revertStatus = revertStatus; + } + + public String getRevertStatusName() { + return revertStatusName; + } + + public void setRevertStatusName(String revertStatusName) { + this.revertStatusName = revertStatusName; + } + + public Byte getMaterialStatus() { + return materialStatus; + } + + public void setMaterialStatus(Byte materialStatus) { + this.materialStatus = materialStatus; + } + + public String getMaterialStatusName() { + return materialStatusName; + } + + public void setMaterialStatusName(String materialStatusName) { + this.materialStatusName = materialStatusName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public LocalDateTime getRevertTime() { + return revertTime; + } + + public void setRevertTime(LocalDateTime revertTime) { + this.revertTime = revertTime; + } + + public Long getSmdId() { + return smdId; + } + + public void setSmdId(Long smdId) { + this.smdId = smdId; + } + + public Long getReceiveBaseId() { + return receiveBaseId; + } + + public void setReceiveBaseId(Long receiveBaseId) { + this.receiveBaseId = receiveBaseId; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialClassifyDto.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialClassifyDto.java index 7195a44..ac53085 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialClassifyDto.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialClassifyDto.java @@ -8,6 +8,13 @@ private Long parentId; + /** + * 是否是耗材(0是,1否) + */ + private Byte consumable; + + private String consumableName; + private List<SafeMaterialClassifyDto> childList; public Long getParentId() { @@ -41,4 +48,20 @@ public void setChildList(List<SafeMaterialClassifyDto> childList) { this.childList = childList; } + + public Byte getConsumable() { + return consumable; + } + + public void setConsumable(Byte consumable) { + this.consumable = consumable; + } + + public String getConsumableName() { + return consumableName; + } + + public void setConsumableName(String consumableName) { + this.consumableName = consumableName; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDetailDto.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDetailDto.java index 6d83dec..4b26ec8 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDetailDto.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDetailDto.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import java.time.LocalDateTime; +import java.util.Date; public class SafeMaterialDetailDto { /** @@ -16,10 +17,14 @@ * 物资编号 */ private String materialNo; + + private Long bigClassifyId; /** * 物资类型名称 */ - private String materialClassifyName; + private String bigClassifyName; + + private Long depId; /** * 部门名称 */ @@ -43,8 +48,8 @@ /** * 保质到期时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private LocalDateTime validTime; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date validTime; /** * 状态 */ @@ -75,7 +80,19 @@ /** * 认领人姓名 */ - private String claimantName; + private String receiveUname; + /** + * 物资状态 + */ + private Byte status; + /** + * 物资状态名称 + */ + private String statusName; + /** + * 描述 + */ + private String remark; /** * 安全物资管理id @@ -123,12 +140,12 @@ this.rfid = rfid; } - public String getMaterialClassifyName() { - return materialClassifyName; + public String getBigClassifyName() { + return bigClassifyName; } - public void setMaterialClassifyName(String materialClassifyName) { - this.materialClassifyName = materialClassifyName; + public void setBigClassifyName(String bigClassifyName) { + this.bigClassifyName = bigClassifyName; } public String getConsumableName() { @@ -147,11 +164,11 @@ this.validType = validType; } - public LocalDateTime getValidTime() { + public Date getValidTime() { return validTime; } - public void setValidTime(LocalDateTime validTime) { + public void setValidTime(Date validTime) { this.validTime = validTime; } @@ -203,12 +220,28 @@ this.deliveryTime = deliveryTime; } - public String getClaimantName() { - return claimantName; + public String getReceiveUname() { + return receiveUname; } - public void setClaimantName(String claimantName) { - this.claimantName = claimantName; + public void setReceiveUname(String receiveUname) { + this.receiveUname = receiveUname; + } + + public Byte getStatus() { + return status; + } + + public void setStatus(Byte status) { + this.status = status; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; } public String getValidTypeName() { @@ -226,4 +259,28 @@ public void setSmId(Long smId) { this.smId = smId; } + + public Long getBigClassifyId() { + return bigClassifyId; + } + + public void setBigClassifyId(Long bigClassifyId) { + this.bigClassifyId = bigClassifyId; + } + + public Long getDepId() { + return depId; + } + + public void setDepId(Long depId) { + this.depId = depId; + } + + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDto.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDto.java index 6e0e6d2..c9c14bc 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDto.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDto.java @@ -42,7 +42,13 @@ /** * 有效库存数量 */ - private Integer validStockCount; + private Integer stockCount; + + /** + * 总库存 + * @return + */ + private Integer totalCount; public Long getId() { return id; @@ -102,12 +108,20 @@ this.consumableName = consumableName; } - public Integer getValidStockCount() { - return validStockCount; + public Integer getStockCount() { + return stockCount; } - public void setValidStockCount(Integer validStockCount) { - this.validStockCount = validStockCount; + public void setStockCount(Integer stockCount) { + this.stockCount = stockCount; + } + + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; } public Long getBigClassifyId() { diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/MaterialReceiveRecordsBaseInfoRepository.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/MaterialReceiveRecordsBaseInfoRepository.java new file mode 100644 index 0000000..897b86d --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/MaterialReceiveRecordsBaseInfoRepository.java @@ -0,0 +1,18 @@ +package com.gkhy.safePlatform.equipment.repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseDO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseInfo; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsQuery; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +@Repository +public interface MaterialReceiveRecordsBaseInfoRepository extends BaseMapper<MaterialReceiveRecordsBaseInfo> { + List<MaterialReceiveRecordsBaseDO> listByConditions(Page page, @Param("query") MaterialReceiveRecordsQuery query); + +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/MaterialReceiveRecordsInfoRepository.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/MaterialReceiveRecordsInfoRepository.java new file mode 100644 index 0000000..b6e84b5 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/MaterialReceiveRecordsInfoRepository.java @@ -0,0 +1,23 @@ +package com.gkhy.safePlatform.equipment.repository; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.safePlatform.equipment.entity.MaterialDeliveryRecordDO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsInfo; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface MaterialReceiveRecordsInfoRepository extends BaseMapper<MaterialReceiveRecordsInfo> { + + MaterialDeliveryRecordDO getRecordBySmdId(@Param("smdId") Long smdId, @Param("revertStatus") Byte revertStatus); + + List<MaterialReceiveRecordsDO> getNoReturnRecordByIds(@Param("idList") List<Long> idList, @Param("revertStatus") Byte revertStatus); + + List<MaterialReceiveRecordsDO> getReceiveRecordsByReceiveUids(MaterialReceiveRecordsBO bo); +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialDetailInfoRepository.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialDetailInfoRepository.java index 984dab5..7597d96 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialDetailInfoRepository.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialDetailInfoRepository.java @@ -3,7 +3,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gkhy.safePlatform.equipment.entity.*; -import com.gkhy.safePlatform.equipment.model.dto.req.SafeMatetrialDetailQuery; +import com.gkhy.safePlatform.equipment.model.dto.req.db.SafeMaterialDetailDBQuery; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -27,13 +27,12 @@ void deleteBatch(List<Long> ids); - void updateDeliveryStatusByIds(@Param("detailBO")SafeMaterialDetailBO detailBO); + void updateDeliveryStatusByIds(@Param("detailBO") SafeMaterialBatchDeliveryBO detailBO); - void deliveryBatchRandom(@Param("detailBO")SafeMaterialDetailBO detailBO); Integer getValidStockCount(@Param("smId")Long smId, @Param("validStatus")Byte validStatus, @Param("irStatus")Byte irStatus); - List<SafeMaterialDetailInfoDO> listByCondition(Page<SafeMaterialDetailInfo> page, @Param("query") SafeMatetrialDetailQuery query); + List<SafeMaterialDetailInfoDO> listByCondition(Page<SafeMaterialDetailInfo> page, @Param("query") SafeMaterialDetailDBQuery query); int getCountBySmIds(@Param("smIds") List<Long> smIds); @@ -52,4 +51,14 @@ List<SafeMaterialDetailDO> getListBySmallClassifyIds(List<Long> smallClassifyIds,@Param("depIds") List<Long> depIds); List<SafeMaterialDetailInfoDO> getListByRfids(List<String> rfids); + + void updateValidStatusByIds(@Param("ids")List<Long> ids, @Param("validStatus")Byte validStatus); + + List<SafeMaterialDetailInfo> getUnValidList(Byte validStatus); + + List<SafeMaterialDetailInfo> getListBySmIdAndRfid(@Param("query") SafeMaterialDetailDBQuery query); + + List<SafeMaterialDetailInfo> getListBySmId(@Param("query") SafeMaterialDetailDBQuery query); + + void updateBatch(List<SafeMaterialDetailInfo> list); } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialInfoRepository.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialInfoRepository.java index dc85ce8..43d633e 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialInfoRepository.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialInfoRepository.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gkhy.safePlatform.equipment.entity.SafeMaterialBO; import com.gkhy.safePlatform.equipment.entity.SafeMaterialDO; import com.gkhy.safePlatform.equipment.entity.SafeMaterialInfo; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialQuery; @@ -13,7 +14,7 @@ @Repository public interface SafeMaterialInfoRepository extends BaseMapper<SafeMaterialInfo> { - SafeMaterialInfo queryById(Long id); + SafeMaterialDO queryById(Long id); int getTotalCount(); @@ -25,4 +26,8 @@ int getCountBySmallClassifyId(Long smallClassifyId); Integer checkMatrial(@Param("smallClassifyId") Long smallClassifyId, @Param("depId") Long depId,@Param("id") Long id); + + void updateCountById(SafeMaterialBO safeMaterialBO); + + void updateStockCount(List<SafeMaterialBO> safeMaterialBOList); } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialClassifyService.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialClassifyService.java index 98f10b7..f6d538b 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialClassifyService.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialClassifyService.java @@ -5,10 +5,7 @@ import com.gkhy.safePlatform.commons.vo.ResultVO; import com.gkhy.safePlatform.commons.vo.SearchResultVO; import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO; -import com.gkhy.safePlatform.equipment.model.dto.req.MaterialClassifyQuery; -import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyAddReq; -import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyModReq; -import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyQuery; +import com.gkhy.safePlatform.equipment.model.dto.req.*; import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyDto; import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyStockDto; @@ -21,14 +18,15 @@ ResultVO update(ContextCacheUser currentUser, SafeMaterialClassifyModReq req); - ResultVO delete(Long id); + ResultVO delete(ContextCacheUser currentUser,Long id); - SafeMaterialClassifyDto queryById(Long id); + SafeMaterialClassifyDto queryById(ContextCacheUser currentUser,Long id); SafeMaterialClassifyDO getBigAndSmallClassifyInfo(Long smallClassifyId); List<SafeMaterialClassifyDto> getClassifyListByIds(List<Long> ids); List<SafeMaterialClassifyDO> getTraceabilityClassifyList(List<Long> smallClassifyIds); - SearchResultVO<List<SafeMaterialClassifyDto>> listByPage(PageQuery<MaterialClassifyQuery> pageQuery); + SearchResultVO<List<SafeMaterialClassifyDto>> listByPage(ContextCacheUser currentUser,PageQuery<MaterialClassifyQuery> pageQuery); + } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialReceiveRecordsService.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialReceiveRecordsService.java new file mode 100644 index 0000000..31679af --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialReceiveRecordsService.java @@ -0,0 +1,19 @@ +package com.gkhy.safePlatform.equipment.service; + +import com.gkhy.safePlatform.commons.co.ContextCacheUser; +import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.vo.SearchResultVO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsBaseReq; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsQuery; +import com.gkhy.safePlatform.equipment.model.dto.resp.MaterialReceiveRecordsBaseDto; + +import java.util.List; + +public interface MaterialReceiveRecordsService { + SearchResultVO<List<MaterialReceiveRecordsBaseDto>> listByPage(ContextCacheUser currentUser, PageQuery<MaterialReceiveRecordsQuery> pageQuery); + + void revertMaterial(ContextCacheUser currentUser, MaterialReceiveRecordsBaseReq req); + List<MaterialReceiveRecordsDO> getReceiveRecordsByReceiveUids(MaterialReceiveRecordsBO bo); +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialDetailService.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialDetailService.java index 7d4248b..70e99d4 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialDetailService.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialDetailService.java @@ -1,5 +1,6 @@ package com.gkhy.safePlatform.equipment.service; +import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.query.PageQuery; import com.gkhy.safePlatform.commons.vo.ResultVO; import com.gkhy.safePlatform.commons.vo.SearchResultVO; @@ -13,13 +14,12 @@ public interface SafeMaterialDetailService { ResultVO save(SafeMaterialDetailAddReq req); - ResultVO singleDelivery(SafeMaterialDetailReq req); + void singleDelivery(ContextCacheUser currentUser,SafeMaterialDetailReq req); - ResultVO singleReceipt(Long id); + void singleReceipt(Long id,ContextCacheUser currentUser); ResultVO delete(Long id); - ResultVO singleDdelivery0rReceipt(SafeMaterialDetailReq req); ResultVO saveBatch(SafeMaterialDetailAddReq req); @@ -27,13 +27,13 @@ ResultVO receiptBatch(ParamForm paramForm); - ResultVO deleteBatch(ParamForm paramForm); + ResultVO deleteBatch(ContextCacheUser currentUser,ParamForm paramForm); - ResultVO deliveryBatchByIds(MterialDeliveryReq req); + void deliveryBatchByIds(MterialDeliveryReq req,ContextCacheUser currentUser); - ResultVO deliveryBatchRandom(MterialRandomDeliveryReq req); + void deliveryBatchBySmId(MterialRandomDeliveryReq req,ContextCacheUser currentUser); - SearchResultVO<List<SafeMaterialDetailDto>> listByPage(PageQuery<SafeMatetrialDetailQuery> pageQuery); + SearchResultVO<List<SafeMaterialDetailDto>> listByPage(ContextCacheUser currentUser,PageQuery<SafeMatetrialDetailQuery> pageQuery); ResultVO queryById(Long id); List<SafeMaterialClassifyStockDto> getSmallClassifyStockByIds(List<Long> smallClassifyIds); diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialService.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialService.java index 6acc8c0..40ccea1 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialService.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialService.java @@ -1,26 +1,31 @@ package com.gkhy.safePlatform.equipment.service; +import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.query.PageQuery; import com.gkhy.safePlatform.commons.vo.ResultVO; import com.gkhy.safePlatform.commons.vo.SearchResultVO; +import com.gkhy.safePlatform.equipment.model.dto.req.ParamForm; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialAddReq; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialModReq; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialQuery; +import com.gkhy.safePlatform.equipment.model.dto.resp.MaterialClassificationDto; +import com.gkhy.safePlatform.equipment.model.dto.resp.MaterialDepartmentDto; import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialDto; import java.util.List; public interface SafeMaterialService { - ResultVO save(SafeMaterialAddReq req); + ResultVO save(ContextCacheUser currentUser,SafeMaterialAddReq req); - ResultVO update(SafeMaterialModReq req); + ResultVO update(ContextCacheUser currentUser,SafeMaterialModReq req); - ResultVO queryById(Long id); + ResultVO queryById(ContextCacheUser currentUser,Long id); - ResultVO delete(Long id); + ResultVO delete(ContextCacheUser currentUser,Long id); - ResultVO deleteBatch(Long[] ids); + ResultVO deleteBatch(ContextCacheUser currentUser, ParamForm paramForm); - ResultVO list(); - SearchResultVO<List<SafeMaterialDto>> listByPage(PageQuery<SafeMaterialQuery> pageQuery); + List<MaterialDepartmentDto> list(ContextCacheUser currentUser); + List<MaterialClassificationDto> listByDepId(ContextCacheUser currentUser); + SearchResultVO<List<SafeMaterialDto>> listByPage(ContextCacheUser currentUser,PageQuery<SafeMaterialQuery> pageQuery); } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/MaterialReceiveRecordsBaseInfoService.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/MaterialReceiveRecordsBaseInfoService.java new file mode 100644 index 0000000..9ac7179 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/MaterialReceiveRecordsBaseInfoService.java @@ -0,0 +1,15 @@ +package com.gkhy.safePlatform.equipment.service.baseService; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseDO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseInfo; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsQuery; + +import java.util.List; + +public interface MaterialReceiveRecordsBaseInfoService extends IService<MaterialReceiveRecordsBaseInfo> { + List<MaterialReceiveRecordsBaseDO> listByPage(Page page, MaterialReceiveRecordsQuery query); + + MaterialReceiveRecordsBaseInfo queryById(Long receiveBaseId); +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/MaterialReceiveRecordsInfoService.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/MaterialReceiveRecordsInfoService.java new file mode 100644 index 0000000..e0caa07 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/MaterialReceiveRecordsInfoService.java @@ -0,0 +1,22 @@ +package com.gkhy.safePlatform.equipment.service.baseService; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.safePlatform.equipment.entity.MaterialDeliveryRecordDO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsInfo; + +import java.util.List; + +public interface MaterialReceiveRecordsInfoService extends IService<MaterialReceiveRecordsInfo> { + MaterialDeliveryRecordDO getRecordBySmdId(Long smdId); + + List<MaterialReceiveRecordsInfo> getNoReturnRecordByReceiveBaseId(Long receiveBaseId); + + List<MaterialReceiveRecordsDO> getNoReturnRecordByIds(List<Long> idList); + + List<MaterialReceiveRecordsInfo> listByReceiveBaseIds(List<Long> idList); + + List<MaterialReceiveRecordsDO> getReceiveRecordsByReceiveUids(MaterialReceiveRecordsBO bo); +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialClassifyInfoService.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialClassifyInfoService.java index cc5df5d..de04439 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialClassifyInfoService.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialClassifyInfoService.java @@ -21,7 +21,7 @@ List<SafeMaterialClassifyInfo> list(); - List<SafeMaterialClassifyInfo> getList(); + List<SafeMaterialClassifyInfo> getParentList(); List<SafeMaterialClassifyInfo> getListByParentId(Long parentId); @@ -31,7 +31,7 @@ List<SafeMaterialClassifyDO> getTraceabilityClassifyList(List<Long> smallClassifyIds); - List<SafeMaterialClassifyInfo> listByPage(Page<SafeMaterialClassifyInfo> page, MaterialClassifyQuery searchParams); + List<SafeMaterialClassifyInfo> listByPage(Page<SafeMaterialClassifyInfo> page, MaterialClassifyQuery query); List<SafeMaterialClassifyInfo> getListByParentIds(List<Long> parentIdList); } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialDetailInfoService.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialDetailInfoService.java index c295f3b..50d2eae 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialDetailInfoService.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialDetailInfoService.java @@ -3,7 +3,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.safePlatform.equipment.entity.*; -import com.gkhy.safePlatform.equipment.model.dto.req.SafeMatetrialDetailQuery; +import com.gkhy.safePlatform.equipment.model.dto.req.db.SafeMaterialDetailDBQuery; import java.util.List; @@ -25,14 +25,13 @@ void deleteBatch(List<Long> ids); - void updateDeliveryStatusByIds(SafeMaterialDetailBO detailBO); - - void deliveryBatchRandom(SafeMaterialDetailBO detailBO); + void updateDeliveryStatusByIds(SafeMaterialBatchDeliveryBO detailBO); + Integer getValidStockCount(Long smId); - List<SafeMaterialDetailInfoDO> listByPage(Page<SafeMaterialDetailInfo> page, SafeMatetrialDetailQuery query); + List<SafeMaterialDetailInfoDO> listByPage(Page<SafeMaterialDetailInfo> page, SafeMaterialDetailDBQuery query); int getCountBySmIds(List<Long> smIds); @@ -53,4 +52,14 @@ List<SafeMaterialDetailInfoDO> getListByRfids(List<String> rfid); + List<SafeMaterialDetailInfo> getUnValidList(); + + void updateValidStatusByIds(List<Long> ids); + + + List<SafeMaterialDetailInfo> getListBySmIdAndRfid(SafeMaterialDetailDBQuery query); + + List<SafeMaterialDetailInfo> getListBySmId(SafeMaterialDetailDBQuery query); + + void updateBatch(List<SafeMaterialDetailInfo> safeMaterialDetailInfoList); } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialInfoService.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialInfoService.java index c7ffb01..237a9a8 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialInfoService.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialInfoService.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.safePlatform.equipment.entity.SafeMaterialBO; import com.gkhy.safePlatform.equipment.entity.SafeMaterialDO; import com.gkhy.safePlatform.equipment.entity.SafeMaterialInfo; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialQuery; @@ -11,7 +12,7 @@ public interface SafeMaterialInfoService extends IService<SafeMaterialInfo> { int getTotalCount(); - SafeMaterialInfo queryById(Long id); + SafeMaterialDO queryById(Long id); @@ -25,4 +26,10 @@ int getCountBySmallClassifyId(Long smallClassifyId); boolean checkMaterial(Long smallClassifyId, Long depId, Long id); + + void updateCountById(SafeMaterialBO safeMaterialBO); + + List<SafeMaterialInfo> listByDepId(Long depId); + + void updateStockCount(List<SafeMaterialBO> safeMaterialBOList); } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/MaterialReceiveRecordsBaseInfoServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/MaterialReceiveRecordsBaseInfoServiceImpl.java new file mode 100644 index 0000000..4630635 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/MaterialReceiveRecordsBaseInfoServiceImpl.java @@ -0,0 +1,29 @@ +package com.gkhy.safePlatform.equipment.service.baseService.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseDO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseInfo; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsQuery; +import com.gkhy.safePlatform.equipment.repository.MaterialReceiveRecordsBaseInfoRepository; +import com.gkhy.safePlatform.equipment.service.baseService.MaterialReceiveRecordsBaseInfoService; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class MaterialReceiveRecordsBaseInfoServiceImpl extends ServiceImpl<MaterialReceiveRecordsBaseInfoRepository,MaterialReceiveRecordsBaseInfo> implements MaterialReceiveRecordsBaseInfoService { + @Override + public List<MaterialReceiveRecordsBaseDO> listByPage(Page page, MaterialReceiveRecordsQuery query) { + return baseMapper.listByConditions(page,query); + } + + @Override + public MaterialReceiveRecordsBaseInfo queryById(Long receiveBaseId) { + MaterialReceiveRecordsBaseInfo receiveRecordsBaseInfo = baseMapper.selectOne(new LambdaQueryWrapper<MaterialReceiveRecordsBaseInfo>() + .eq(MaterialReceiveRecordsBaseInfo::getId, receiveBaseId) + .eq(MaterialReceiveRecordsBaseInfo::getDelFlag, 0)); + return receiveRecordsBaseInfo; + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/MaterialReceiveRecordsInfoServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/MaterialReceiveRecordsInfoServiceImpl.java new file mode 100644 index 0000000..4d28de4 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/MaterialReceiveRecordsInfoServiceImpl.java @@ -0,0 +1,69 @@ +package com.gkhy.safePlatform.equipment.service.baseService.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.safePlatform.commons.enums.ResultCodes; +import com.gkhy.safePlatform.equipment.entity.MaterialDeliveryRecordDO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO; +import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsInfo; +import com.gkhy.safePlatform.equipment.enums.MaterialRevertStatusEnum; +import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; +import com.gkhy.safePlatform.equipment.repository.MaterialReceiveRecordsInfoRepository; +import com.gkhy.safePlatform.equipment.service.baseService.MaterialReceiveRecordsInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +@Service +public class MaterialReceiveRecordsInfoServiceImpl extends ServiceImpl<MaterialReceiveRecordsInfoRepository, MaterialReceiveRecordsInfo> implements MaterialReceiveRecordsInfoService { + @Autowired + private MaterialReceiveRecordsInfoRepository repository; + @Override + public MaterialDeliveryRecordDO getRecordBySmdId(Long smdId) { + if(null == smdId){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + return repository.getRecordBySmdId(smdId,MaterialRevertStatusEnum.REVERT_NO.getCode()); + } + + @Override + public List<MaterialReceiveRecordsInfo> getNoReturnRecordByReceiveBaseId(Long receiveBaseId) { + if(null == receiveBaseId){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + List<MaterialReceiveRecordsInfo> recordsInfos = repository.selectList(new LambdaQueryWrapper<MaterialReceiveRecordsInfo>() + .eq(MaterialReceiveRecordsInfo::getReceiveBaseId, receiveBaseId) + .eq(MaterialReceiveRecordsInfo::getRevertStatus, MaterialRevertStatusEnum.REVERT_NO.getCode())); + return recordsInfos; + } + + @Override + public List<MaterialReceiveRecordsDO> getNoReturnRecordByIds(List<Long> idList) { + if (CollectionUtils.isEmpty(idList)) { + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + List<MaterialReceiveRecordsDO> records = repository.getNoReturnRecordByIds(idList, MaterialRevertStatusEnum.REVERT_NO.getCode()); + return records; + } + + @Override + public List<MaterialReceiveRecordsInfo> listByReceiveBaseIds(List<Long> idList) { + if (CollectionUtils.isEmpty(idList)) { + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + List<MaterialReceiveRecordsInfo> receiveRecordsInfoList = repository.selectList(new LambdaQueryWrapper<MaterialReceiveRecordsInfo>() + .in(MaterialReceiveRecordsInfo::getReceiveBaseId, idList)); + return receiveRecordsInfoList; + } + + @Override + public List<MaterialReceiveRecordsDO> getReceiveRecordsByReceiveUids(MaterialReceiveRecordsBO bo) { + if (CollectionUtils.isEmpty(bo.getReceiveUids()) || CollectionUtils.isEmpty(bo.getSmallClassifyIds())) { + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + return repository.getReceiveRecordsByReceiveUids(bo); + } +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialClassifyInfoServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialClassifyInfoServiceImpl.java index e9945ea..ff9cabb 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialClassifyInfoServiceImpl.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialClassifyInfoServiceImpl.java @@ -60,7 +60,7 @@ } @Override - public List<SafeMaterialClassifyInfo> getList(){ + public List<SafeMaterialClassifyInfo> getParentList(){ List<SafeMaterialClassifyInfo> list = repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>() .eq(SafeMaterialClassifyInfo::getDelFlag,0) .eq(SafeMaterialClassifyInfo::getParentId,0l)); diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialDetailInfoServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialDetailInfoServiceImpl.java index 6a8537b..8ba141c 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialDetailInfoServiceImpl.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialDetailInfoServiceImpl.java @@ -4,16 +4,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.safePlatform.commons.enums.ResultCodes; -import com.gkhy.safePlatform.commons.utils.StringUtils; import com.gkhy.safePlatform.equipment.entity.*; import com.gkhy.safePlatform.equipment.enums.IssueReceiptEnum; import com.gkhy.safePlatform.equipment.enums.ValidStatusEnum; import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; -import com.gkhy.safePlatform.equipment.model.dto.req.SafeMatetrialDetailQuery; +import com.gkhy.safePlatform.equipment.model.dto.req.db.SafeMaterialDetailDBQuery; import com.gkhy.safePlatform.equipment.repository.SafeMaterialDetailInfoRepository; import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialDetailInfoService; import jodd.util.StringUtil; -import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -85,23 +83,13 @@ } @Override - public void updateDeliveryStatusByIds(SafeMaterialDetailBO detailBO) { - if(CollectionUtils.isEmpty(detailBO.getIds()) || null == detailBO.getClaimantId() || StringUtil.isBlank(detailBO.getClaimantName())){ + public void updateDeliveryStatusByIds(SafeMaterialBatchDeliveryBO detailBO) { + if(CollectionUtils.isEmpty(detailBO.getIds()) || null == detailBO.getReceiveUid() || StringUtil.isBlank(detailBO.getReceiveUname())){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } detailBO.setIrStatus(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()); detailBO.setDeliveryTime(LocalDateTime.now()); repository.updateDeliveryStatusByIds(detailBO); - } - - @Override - public void deliveryBatchRandom(SafeMaterialDetailBO detailBO) { - if(null == detailBO.getCount() || null == detailBO.getClaimantId() || StringUtil.isBlank(detailBO.getClaimantName())){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); - } - detailBO.setIrStatus(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()); - detailBO.setDeliveryTime(LocalDateTime.now()); - repository.deliveryBatchRandom(detailBO); } @Override @@ -114,7 +102,7 @@ } @Override - public List<SafeMaterialDetailInfoDO> listByPage(Page<SafeMaterialDetailInfo> page, SafeMatetrialDetailQuery query) { + public List<SafeMaterialDetailInfoDO> listByPage(Page<SafeMaterialDetailInfo> page, SafeMaterialDetailDBQuery query) { return repository.listByCondition(page,query); } @@ -188,5 +176,38 @@ return repository.getListByRfids(rfids); } + @Override + public List<SafeMaterialDetailInfo> getUnValidList() { + return repository.getUnValidList(ValidStatusEnum.YES.getCode()); + } + + @Override + public void updateValidStatusByIds(List<Long> ids) { + if(CollectionUtils.isEmpty(ids)){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + repository.updateValidStatusByIds(ids,ValidStatusEnum.NO.getCode()); + } + + @Override + public List<SafeMaterialDetailInfo> getListBySmIdAndRfid(SafeMaterialDetailDBQuery query) { + List<SafeMaterialDetailInfo> list = repository.getListBySmIdAndRfid(query); + return list; + } + + @Override + public List<SafeMaterialDetailInfo> getListBySmId(SafeMaterialDetailDBQuery query) { + List<SafeMaterialDetailInfo> list = repository.getListBySmId(query); + return list; + } + + @Override + public void updateBatch(List<SafeMaterialDetailInfo> list) { + if(CollectionUtils.isEmpty(list)){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + repository.updateBatch(list); + } + } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java index d919c33..c77eb64 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java @@ -5,15 +5,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.utils.StringUtils; -import com.gkhy.safePlatform.equipment.entity.SafeMaterialCountDO; -import com.gkhy.safePlatform.equipment.entity.SafeMaterialDO; -import com.gkhy.safePlatform.equipment.entity.SafeMaterialInfo; +import com.gkhy.safePlatform.equipment.entity.*; import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialQuery; import com.gkhy.safePlatform.equipment.repository.SafeMaterialInfoRepository; import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import java.util.List; @@ -31,15 +30,11 @@ } @Override - public SafeMaterialInfo queryById(Long id) { + public SafeMaterialDO queryById(Long id) { if(null == id){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } - SafeMaterialInfo safeMaterialInfo = repository.selectOne(new LambdaQueryWrapper<SafeMaterialInfo>() - .eq(SafeMaterialInfo::getId, id) - .eq(SafeMaterialInfo::getDelFlag, 0) - ); - return safeMaterialInfo; + return repository.queryById(id); } @Override @@ -86,5 +81,32 @@ return flag; } + @Override + public void updateCountById(SafeMaterialBO safeMaterialBO) { + if(null == safeMaterialBO){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + repository.updateCountById(safeMaterialBO); + } + + @Override + public List<SafeMaterialInfo> listByDepId(Long depId) { + if(null == depId){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + List<SafeMaterialInfo> safeMaterialInfoList = repository.selectList(new LambdaQueryWrapper<SafeMaterialInfo>() + .eq(SafeMaterialInfo::getDelFlag, 0) + .eq(SafeMaterialInfo::getDepId, depId)); + return safeMaterialInfoList; + } + + @Override + public void updateStockCount(List<SafeMaterialBO> safeMaterialBOList) { + if(CollectionUtils.isEmpty(safeMaterialBOList)){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + repository.updateStockCount(safeMaterialBOList); + } + } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialClassifyServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialClassifyServiceImpl.java index 735b542..d7ec1ce 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialClassifyServiceImpl.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialClassifyServiceImpl.java @@ -1,5 +1,6 @@ package com.gkhy.safePlatform.equipment.service.impl; +import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.enums.ResultCodes; @@ -9,9 +10,11 @@ import com.gkhy.safePlatform.commons.vo.SearchResultVO; import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO; import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo; +import com.gkhy.safePlatform.equipment.enums.ConsumableEnum; import com.gkhy.safePlatform.equipment.enums.EquipmentResultCodes; import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; import com.gkhy.safePlatform.equipment.model.dto.req.MaterialClassifyQuery; +import com.gkhy.safePlatform.equipment.model.dto.req.ParamForm; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyAddReq; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyModReq; import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyDto; @@ -43,6 +46,7 @@ .stream() .filter(item -> item.getParentId().equals(0l)) .collect(Collectors.toList()); + List<SafeMaterialClassifyDto> respDTOList = new ArrayList<>(); //只有二级不采用递归 for (SafeMaterialClassifyInfo classifyInfo:parentList) { @@ -59,6 +63,10 @@ SafeMaterialClassifyDto childDTO = new SafeMaterialClassifyDto(); childDTO.setId(child.getId()); childDTO.setMaterialClassifyName(child.getMaterialClassifyName()); + if(null != child.getConsumable()){ + childDTO.setConsumableName(ConsumableEnum.getByCode(child.getConsumable()).getValue()); + } + childDTO.setConsumable(child.getConsumable()); childDTO.setParentId(child.getParentId()); childDTOList.add(childDTO); } @@ -72,14 +80,25 @@ @Override public ResultVO save(ContextCacheUser currentUser, SafeMaterialClassifyAddReq req) { ResultVO resultVO = null; + if(null != req.getParentId()){ + if(null == req.getConsumable()){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"是否耗材未选择"); + } + if(null == ConsumableEnum.getByCode(req.getConsumable())){ + throw new EquipmentException(EquipmentResultCodes.DATA_ILLEGAL); + } + } SafeMaterialClassifyInfo classifyInfo = new SafeMaterialClassifyInfo(); + classifyInfo.setId(IdUtil.getSnowflake(0,0).nextId()); classifyInfo.setMaterialClassifyName(req.getMaterialClassifyName()); + classifyInfo.setConsumable(req.getConsumable()); if(null != req.getParentId()){ classifyInfo.setParentId(req.getParentId()); }else{ classifyInfo.setParentId(0l); } + boolean flag = safeMaterialClassifyInfoService.save(classifyInfo); if (flag){ resultVO = new ResultVO(ResultCodes.OK); @@ -95,8 +114,19 @@ if(req.getId() == null){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } + SafeMaterialClassifyInfo safeMaterialClassifyInfo = safeMaterialClassifyInfoService.queryById(req.getId()); + if(safeMaterialClassifyInfo.getParentId() != 0 ){ + if(null == req.getConsumable()){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"是否耗材未选择"); + } + if(null == ConsumableEnum.getByCode(req.getConsumable())){ + throw new EquipmentException(EquipmentResultCodes.DATA_ILLEGAL); + } + } + SafeMaterialClassifyInfo classifyInfo = new SafeMaterialClassifyInfo(); classifyInfo.setMaterialClassifyName(req.getMaterialClassifyName()); + classifyInfo.setConsumable(req.getConsumable()); classifyInfo.setId(req.getId()); boolean flag = safeMaterialClassifyInfoService.updateById(classifyInfo); if (flag){ @@ -108,7 +138,7 @@ } @Override - public ResultVO delete(Long id) { + public ResultVO delete(ContextCacheUser currentUser,Long id) { if(id == null){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } @@ -138,7 +168,7 @@ } @Override - public SafeMaterialClassifyDto queryById(Long id) { + public SafeMaterialClassifyDto queryById(ContextCacheUser currentUser,Long id) { if(id == null){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } @@ -154,12 +184,18 @@ respDTO.setId(classifyInfo.getId()); respDTO.setMaterialClassifyName(classifyInfo.getMaterialClassifyName()); respDTO.setParentId(classifyInfo.getParentId()); + respDTO.setConsumable(classifyInfo.getConsumable()); + respDTO.setConsumableName(ConsumableEnum.getByCode(classifyInfo.getConsumable()).getValue()); List<SafeMaterialClassifyDto> childDtoList = new ArrayList<>(); for (SafeMaterialClassifyInfo child:childList){ SafeMaterialClassifyDto childDto = new SafeMaterialClassifyDto(); childDto.setId(child.getId()); childDto.setMaterialClassifyName(child.getMaterialClassifyName()); childDto.setParentId(child.getParentId()); + childDto.setConsumable(child.getConsumable()); + if(null != child.getConsumable()){ + childDto.setConsumableName(ConsumableEnum.getByCode(child.getConsumable()).getValue()); + } childDtoList.add(childDto); } respDTO.setChildList(childDtoList); @@ -206,25 +242,39 @@ } @Override - public SearchResultVO<List<SafeMaterialClassifyDto>> listByPage(PageQuery<MaterialClassifyQuery> pageQuery) { + public SearchResultVO<List<SafeMaterialClassifyDto>> listByPage(ContextCacheUser currentUser,PageQuery<MaterialClassifyQuery> pageQuery) { Page<SafeMaterialClassifyInfo> page = new Page<>(pageQuery.getPageIndex(),pageQuery.getPageSize()); - List<SafeMaterialClassifyInfo> classifyInfoList = safeMaterialClassifyInfoService.listByPage(page, pageQuery.getSearchParams()); + List<SafeMaterialClassifyInfo> parentList = safeMaterialClassifyInfoService.listByPage(page, pageQuery.getSearchParams()); List<SafeMaterialClassifyInfo> childList = new ArrayList<>(); - if (!CollectionUtils.isEmpty(classifyInfoList)) { - List<Long> parentIdList = classifyInfoList.stream().map(SafeMaterialClassifyInfo::getId).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(parentList)){ + List<Long> parentIdList = parentList.stream().map(SafeMaterialClassifyInfo::getId).collect(Collectors.toList()); childList = safeMaterialClassifyInfoService.getListByParentIds(parentIdList); } + List<SafeMaterialClassifyDto> respList = new ArrayList<>(); - for(SafeMaterialClassifyInfo classifyInfo:classifyInfoList){ + for(SafeMaterialClassifyInfo parentClassify:parentList){ SafeMaterialClassifyDto classifyDto = new SafeMaterialClassifyDto(); - classifyDto.setId(classifyInfo.getId()); - classifyDto.setMaterialClassifyName(classifyInfo.getMaterialClassifyName()); - classifyDto.setParentId(classifyInfo.getParentId()); + classifyDto.setId(parentClassify.getId()); + classifyDto.setMaterialClassifyName(parentClassify.getMaterialClassifyName()); + classifyDto.setParentId(parentClassify.getParentId()); + //获取子级 - List<SafeMaterialClassifyInfo> selectList = childList.stream().filter(cl -> cl.getParentId().equals(classifyInfo.getId())).collect(Collectors.toList()); + List<SafeMaterialClassifyInfo> selectList = childList + .stream() + .filter(cl -> cl.getParentId().equals(parentClassify.getId())) + .collect(Collectors.toList()); + List<SafeMaterialClassifyDto> childRespList = new ArrayList<>(); - if(selectList.size()>0){ - childRespList = BeanCopyUtils.copyBeanList(selectList,SafeMaterialClassifyDto.class); + for(SafeMaterialClassifyInfo child:selectList){ + SafeMaterialClassifyDto childClassify = new SafeMaterialClassifyDto(); + childClassify.setId(child.getId()); + childClassify.setMaterialClassifyName(child.getMaterialClassifyName()); + childClassify.setParentId(child.getParentId()); + childClassify.setConsumable(child.getConsumable()); + if(null != child.getConsumable()){ + childClassify.setConsumableName(ConsumableEnum.getByCode(child.getConsumable()).getValue()); + } + childRespList.add(childClassify); } classifyDto.setChildList(childRespList); respList.add(classifyDto); @@ -239,4 +289,6 @@ } + + } diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialReceiveRecordsServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialReceiveRecordsServiceImpl.java new file mode 100644 index 0000000..b7d8a20 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialReceiveRecordsServiceImpl.java @@ -0,0 +1,219 @@ +package com.gkhy.safePlatform.equipment.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gkhy.safePlatform.commons.co.ContextCacheUser; +import com.gkhy.safePlatform.commons.enums.ResultCodes; +import com.gkhy.safePlatform.commons.exception.BusinessException; +import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.vo.SearchResultVO; +import com.gkhy.safePlatform.equipment.entity.*; +import com.gkhy.safePlatform.equipment.enums.*; +import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsBaseReq; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsQuery; +import com.gkhy.safePlatform.equipment.model.dto.req.MaterialReceiveRecordsReq; +import com.gkhy.safePlatform.equipment.model.dto.resp.MaterialReceiveRecordsBaseDto; +import com.gkhy.safePlatform.equipment.model.dto.resp.MaterialReceiveRecordsDto; +import com.gkhy.safePlatform.equipment.service.MaterialReceiveRecordsService; +import com.gkhy.safePlatform.equipment.service.baseService.MaterialReceiveRecordsBaseInfoService; +import com.gkhy.safePlatform.equipment.service.baseService.MaterialReceiveRecordsInfoService; +import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialDetailInfoService; +import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialInfoService; +import io.micrometer.core.instrument.util.StringUtils; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +@Service +public class MaterialReceiveRecordsServiceImpl implements MaterialReceiveRecordsService { + @Autowired + private MaterialReceiveRecordsBaseInfoService recordsBaseInfoService; + @Autowired + private MaterialReceiveRecordsInfoService receiveRecordsInfoService; + + @Autowired + private SafeMaterialDetailInfoService safeMaterialDetailInfoService; + + @Autowired + private SafeMaterialInfoService safeMaterialInfoService; + @Autowired + private RedissonClient redissonClient; + @Override + public SearchResultVO<List<MaterialReceiveRecordsBaseDto>> listByPage(ContextCacheUser currentUser, PageQuery<MaterialReceiveRecordsQuery> pageQuery) { + MaterialReceiveRecordsQuery query = pageQuery.getSearchParams(); + query.setDepId(currentUser.getDepId()); + Page page = new Page<>(pageQuery.getPageIndex(), pageQuery.getPageSize()); + List<MaterialReceiveRecordsBaseDO> list = recordsBaseInfoService.listByPage(page,query); + List<MaterialReceiveRecordsInfo> receiveRecordsInfoList = new ArrayList<>(); + if(!CollectionUtils.isEmpty(list)) { + List<Long> idList = list.stream().map(MaterialReceiveRecordsBaseDO::getId).collect(Collectors.toList()); + receiveRecordsInfoList = receiveRecordsInfoService.listByReceiveBaseIds(idList); + } + List<MaterialReceiveRecordsBaseDto> receiveRecordsBaseDtoList = new ArrayList<>(); + for(MaterialReceiveRecordsBaseDO receiveRecordsBaseDO:list){ + MaterialReceiveRecordsBaseDto receiveRecordsBaseDto = new MaterialReceiveRecordsBaseDto(); + BeanUtils.copyProperties(receiveRecordsBaseDO,receiveRecordsBaseDto); + receiveRecordsBaseDto.setStatusName(MaterialReceiveRecordsStatusEnum.getByCode(receiveRecordsBaseDO.getStatus()).getValue()); + //获取该记录关联的物资 + List<MaterialReceiveRecordsInfo> selectList = receiveRecordsInfoList.stream().filter(item -> item.getReceiveBaseId().equals(receiveRecordsBaseDO.getId())).collect(Collectors.toList()); + List<MaterialReceiveRecordsDto> receiveRecordsDtoList = new ArrayList<>(); + for(MaterialReceiveRecordsInfo receiveRecordsInfo:selectList){ + MaterialReceiveRecordsDto receiveRecordsDto = new MaterialReceiveRecordsDto(); + BeanUtils.copyProperties(receiveRecordsInfo,receiveRecordsDto); + receiveRecordsDto.setMaterialStatusName(MaterialStatusEnum.getByCode(receiveRecordsInfo.getMaterialStatus()).getValue()); + receiveRecordsDto.setRevertStatusName(MaterialRevertStatusEnum.getByCode(receiveRecordsInfo.getRevertStatus()).getValue()); + receiveRecordsDtoList.add(receiveRecordsDto); + } + receiveRecordsBaseDto.setMaterialList(receiveRecordsDtoList); + receiveRecordsBaseDtoList.add(receiveRecordsBaseDto); + } + return new SearchResultVO<>(true, + page.getCurrent(), + page.getSize(), + page.getPages(), + page.getTotal(), + receiveRecordsBaseDtoList, + ResultCodes.OK); + } + + @Override + @Transactional + public void revertMaterial(ContextCacheUser currentUser, MaterialReceiveRecordsBaseReq req) { + //检查 + List<MaterialReceiveRecordsReq> materialList = req.getMaterialList(); + for(MaterialReceiveRecordsReq receiveRecordsReq:materialList){ + if(null == receiveRecordsReq.getReceiveId()){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"领取清单主键不可为空!"); + } + if(null != receiveRecordsReq.getMaterialStatus()){ + if(null == MaterialStatusEnum.getByCode(receiveRecordsReq.getMaterialStatus())){ + throw new EquipmentException(EquipmentResultCodes.DATA_ILLEGAL,"物资状态不合法!"); + }else{ + if(MaterialStatusEnum.OTHER.getCode().equals(receiveRecordsReq.getMaterialStatus()) && StringUtils.isBlank(receiveRecordsReq.getRemark())){ + throw new EquipmentException(EquipmentResultCodes.DATA_ILLEGAL,"损耗备注不可为空!"); + } + } + } + } + //加分布式锁,防止重复创建规则 + RLock lock = redissonClient.getLock("LOCK_REVERT_MATERIAL"); + try { + lock.lock(10, TimeUnit.SECONDS); + //获取该次领取记录 + MaterialReceiveRecordsBaseInfo receiveRecordsBaseInfo = recordsBaseInfoService.queryById(req.getReceiveBaseId()); + if(null == receiveRecordsBaseInfo){ + throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"该条记录不存在!"); + } + if(receiveRecordsBaseInfo.getStatus().equals(MaterialReceiveRecordsStatusEnum.CONSUMABLE_RETURN_NO.getCode())){ + throw new EquipmentException(EquipmentResultCodes.MATERIAL_CONSUMABLE); + } + List<Long> idList = materialList.stream().map(MaterialReceiveRecordsReq::getReceiveId).collect(Collectors.toList()); + //检查该次要归还的物资是否有归还或处理过 + List<MaterialReceiveRecordsDO> revertList = receiveRecordsInfoService.getNoReturnRecordByIds(idList); + if(materialList.size() > revertList.size()){ + throw new EquipmentException(EquipmentResultCodes.MATERIAL_IN_THE_LIBRARY,"已归还或已处理物资不可重复归还处理!"); + } + List<MaterialReceiveRecordsInfo> updateRecordsList = new ArrayList<>(); + List<SafeMaterialDetailInfo> updateDetailList = new ArrayList<>(); + int revertCount = 0; + int consumeCount = 0; + int validCount = 0; + for(MaterialReceiveRecordsReq receiveRecordsReq:materialList){ + //过滤出该条领取物资 + List<MaterialReceiveRecordsDO> selectList = revertList.stream().filter(item -> item.getId().equals(receiveRecordsReq.getReceiveId())).collect(Collectors.toList()); + MaterialReceiveRecordsDO receiveRecord = selectList.get(0); + //物资清单 + SafeMaterialDetailInfo safeMaterialDetailInfo = new SafeMaterialDetailInfo(); + safeMaterialDetailInfo.setId(receiveRecord.getSmdId()); + safeMaterialDetailInfo.setWareHousingTime(LocalDateTime.now()); + + + //领取清单 + MaterialReceiveRecordsInfo materialReceiveRecordsInfo = new MaterialReceiveRecordsInfo(); + materialReceiveRecordsInfo.setId(receiveRecordsReq.getReceiveId()); + materialReceiveRecordsInfo.setMaterialStatus(receiveRecordsReq.getMaterialStatus()); + materialReceiveRecordsInfo.setRemark(MaterialStatusEnum.getByCode(receiveRecordsReq.getMaterialStatus()).getValue()); + if(MaterialStatusEnum.INTACT.getCode().equals(receiveRecordsReq.getMaterialStatus()) || null == receiveRecordsReq.getMaterialStatus()){ + materialReceiveRecordsInfo.setRevertStatus(MaterialRevertStatusEnum.REVERT_YES.getCode()); + safeMaterialDetailInfo.setIrStatus(IssueReceiptEnum.IN_THE_LIBRARY.getCode()); + revertCount++; + if(receiveRecord.getValidStatus().equals(ValidStatusEnum.NO.getCode())){ + //无效情况 + validCount++; + } + }else{ + //损耗 + materialReceiveRecordsInfo.setRevertStatus(MaterialRevertStatusEnum.DEPLETION.getCode()); + if (StringUtils.isNotBlank(receiveRecordsReq.getRemark())) { + materialReceiveRecordsInfo.setRemark(receiveRecordsReq.getRemark()); + } + safeMaterialDetailInfo.setIrStatus(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()); + consumeCount++; + } + updateRecordsList.add(materialReceiveRecordsInfo); + + safeMaterialDetailInfo.setStatus(materialReceiveRecordsInfo.getMaterialStatus()); + safeMaterialDetailInfo.setRemark(materialReceiveRecordsInfo.getRemark()); + updateDetailList.add(safeMaterialDetailInfo); + + } + + //物资管理 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(receiveRecordsBaseInfo.getSmId()); + safeMaterialBO.setStockCount(revertCount-validCount); + //领取总记录 + MaterialReceiveRecordsBaseInfo materialReceiveRecordsBaseInfo = new MaterialReceiveRecordsBaseInfo(); + materialReceiveRecordsBaseInfo.setId(req.getReceiveBaseId()); + if(receiveRecordsBaseInfo.getReceiveCount() == receiveRecordsBaseInfo.getConsumeCount()+materialList.size()){ + materialReceiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.RETURN_COMPLETE.getCode()); + }else{ + materialReceiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.RETURN_PART.getCode()); + } + materialReceiveRecordsBaseInfo.setRevertCount(receiveRecordsBaseInfo.getRevertCount()+revertCount); + materialReceiveRecordsBaseInfo.setConsumeCount(receiveRecordsBaseInfo.getConsumeCount()+consumeCount); + //修改物资管理库存 + safeMaterialInfoService.updateCountById(safeMaterialBO); + //修改物资清单状态 + safeMaterialDetailInfoService.updateBatchById(updateDetailList); + //修改总记录 + recordsBaseInfoService.updateById(materialReceiveRecordsBaseInfo); + //修改领取清单 + receiveRecordsInfoService.updateBatchById(updateRecordsList); + //创建成功,释放锁 + lock.unlock(); + }catch (EquipmentException e) { + e.printStackTrace(); + throw new EquipmentException(e.getCode(), e.getMessage()); + }catch (Exception e) { + e.printStackTrace(); + throw new BusinessException(ResultCodes.SERVER_ERROR); + }finally { + if(lock.isLocked()){ + lock.unlock(); + } + } + } + @Override + public List<MaterialReceiveRecordsDO> getReceiveRecordsByReceiveUids(MaterialReceiveRecordsBO bo){ + if (CollectionUtils.isEmpty(bo.getReceiveUids())) { + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"领取人不可为空!"); + } + if(CollectionUtils.isEmpty(bo.getSmallClassifyIds())){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"物资类型(小类)不可为空!"); + } + List<MaterialReceiveRecordsDO> list = receiveRecordsInfoService.getReceiveRecordsByReceiveUids(bo); + return list; + } + +} diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialDetailServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialDetailServiceImpl.java index 09a01fe..cb8d742 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialDetailServiceImpl.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialDetailServiceImpl.java @@ -4,32 +4,28 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gkhy.safePlatform.account.rpc.apimodel.AccountUserService; import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.UserInfoRPCRespDTO; +import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.exception.BusinessException; import com.gkhy.safePlatform.commons.query.PageQuery; import com.gkhy.safePlatform.commons.utils.StringUtils; import com.gkhy.safePlatform.commons.vo.ResultVO; import com.gkhy.safePlatform.commons.vo.SearchResultVO; -import com.gkhy.safePlatform.equipment.common.RocketMQTemplateHelper; import com.gkhy.safePlatform.equipment.entity.*; import com.gkhy.safePlatform.equipment.enums.*; import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; import com.gkhy.safePlatform.equipment.model.dto.req.*; +import com.gkhy.safePlatform.equipment.model.dto.req.db.SafeMaterialDetailDBQuery; import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyStockDto; import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialDetailDto; import com.gkhy.safePlatform.equipment.model.dto.resp.SafeRfidMaterialDetailDto; -import com.gkhy.safePlatform.equipment.mq.msg.SafeMaterialMsg; import com.gkhy.safePlatform.equipment.service.SafeMaterialDetailService; -import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialClassifyInfoService; -import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialDetailInfoService; -import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialInfoService; +import com.gkhy.safePlatform.equipment.service.baseService.*; import org.apache.dubbo.config.annotation.DubboReference; -import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.redisson.api.RLock; import org.redisson.api.RedissonClient; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -51,22 +47,25 @@ @Autowired private SafeMaterialClassifyInfoService safeMaterialClassifyInfoService; - @Value("${rocketmq.topic.safeMaterialTopic}") - private String safeMaterialTopic; - @DubboReference(check = false) private AccountUserService accountUserService; @Autowired - private RocketMQTemplateHelper rocketMQTemplateHelper; + private RedissonClient redissonClient; @Autowired - private RedissonClient redissonClient; + private MaterialReceiveRecordsBaseInfoService materialReceiveRecordsBaseInfoService; + + @Autowired + private MaterialReceiveRecordsInfoService materialReceiveRecordsInfoService; + + @Override + @Transactional public ResultVO save(SafeMaterialDetailAddReq req) { //判断物资是否存在 - SafeMaterialInfo materialInfo = safeMaterialInfoService.queryById(req.getSmId()); - if(null == materialInfo){ + SafeMaterialDO safeMaterialDO = safeMaterialInfoService.queryById(req.getSmId()); + if(null == safeMaterialDO){ throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"该种物资不存在!"); } if(null == ValidTypeEnum.getByCode(req.getValidType())){ @@ -99,11 +98,13 @@ String rfid = "0000000".substring(0,(8 - countStr.length()))+countStr; SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo(); materialDetailInfo.setId(IdUtil.getSnowflake(0,0).nextId()); - materialDetailInfo.setBigClassifyId(materialInfo.getBigClassifyId()); - materialDetailInfo.setSmallClassifyId(materialInfo.getSmallClassifyId()); - materialDetailInfo.setName(materialInfo.getMaterialName()); + materialDetailInfo.setBigClassifyId(safeMaterialDO.getBigClassifyId()); + materialDetailInfo.setSmallClassifyId(safeMaterialDO.getSmallClassifyId()); + materialDetailInfo.setName(safeMaterialDO.getMaterialName()); materialDetailInfo.setSmId(req.getSmId()); - materialDetailInfo.setConsumable(materialInfo.getConsumable()); + materialDetailInfo.setConsumable(safeMaterialDO.getConsumable()); + materialDetailInfo.setStatus(MaterialStatusEnum.INTACT.getCode()); + materialDetailInfo.setRemark(MaterialStatusEnum.INTACT.getValue()); materialDetailInfo.setValidType(req.getValidType()); if(req.getValidType().equals(ValidTypeEnum.SHORT_TERM.getCode())){ materialDetailInfo.setValidTime(req.getValidTime()); @@ -120,11 +121,13 @@ for(int i = 0;i < req.getWareHousingCount();i++){ SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo(); materialDetailInfo.setId(IdUtil.getSnowflake(0,0).nextId()); - materialDetailInfo.setBigClassifyId(materialInfo.getBigClassifyId()); - materialDetailInfo.setSmallClassifyId(materialInfo.getSmallClassifyId()); - materialDetailInfo.setName(materialInfo.getMaterialName()); + materialDetailInfo.setBigClassifyId(safeMaterialDO.getBigClassifyId()); + materialDetailInfo.setSmallClassifyId(safeMaterialDO.getSmallClassifyId()); + materialDetailInfo.setName(safeMaterialDO.getMaterialName()); materialDetailInfo.setSmId(req.getSmId()); - materialDetailInfo.setConsumable(materialInfo.getConsumable()); + materialDetailInfo.setConsumable(safeMaterialDO.getConsumable()); + materialDetailInfo.setStatus(MaterialStatusEnum.INTACT.getCode()); + materialDetailInfo.setRemark(MaterialStatusEnum.INTACT.getValue()); materialDetailInfo.setValidType(req.getValidType()); if(req.getValidType().equals(ValidTypeEnum.SHORT_TERM.getCode())){ materialDetailInfo.setValidTime(req.getValidTime()); @@ -136,6 +139,11 @@ list.add(materialDetailInfo); } } + //填充物资管理数据 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(req.getSmId()); + safeMaterialBO.setStockCount(req.getWareHousingCount()); + safeMaterialBO.setTotalCount(req.getWareHousingCount()); //加分布式锁,防止重复创建规则 RLock lock = redissonClient.getLock("LOCK_SMD_SAVE"); @@ -143,16 +151,18 @@ lock.lock(10, TimeUnit.SECONDS); //批量入库 safeMaterialDetailInfoService.saveBatch(list); + //修改数量 + safeMaterialInfoService.updateCountById(safeMaterialBO); //发送消息 - if(req.getValidType().equals(ValidTypeEnum.SHORT_TERM.getCode()) && null != req.getValidTime()){ + /*if(req.getValidType().equals(ValidTypeEnum.SHORT_TERM.getCode()) && null != req.getValidTime()){ for(SafeMaterialDetailInfo materialDetailInfo:list){ SafeMaterialMsg safeMaterialMsg = new SafeMaterialMsg(); safeMaterialMsg.setId(materialDetailInfo.getId()); safeMaterialMsg.setValidTime(conversionTimeType(materialDetailInfo.getValidTime())); rocketMQTemplateHelper.syncSend(safeMaterialTopic,safeMaterialMsg); } - } + }*/ //创建成功,释放锁 lock.unlock(); }catch (EquipmentException e) { @@ -176,10 +186,11 @@ * @return */ @Override + @Transactional public ResultVO saveBatch(SafeMaterialDetailAddReq req) { //判断物资是否存在 - SafeMaterialInfo materialInfo = safeMaterialInfoService.queryById(req.getSmId()); - if(null == materialInfo){ + SafeMaterialDO safeMaterialDO = safeMaterialInfoService.queryById(req.getSmId()); + if(null == safeMaterialDO){ throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"该种物资不存在!"); } if(null == ValidTypeEnum.getByCode(req.getValidType())){ @@ -195,11 +206,13 @@ for(int i = 0;i < req.getWareHousingCount();i++){ SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo(); materialDetailInfo.setId(IdUtil.getSnowflake(0,0).nextId()); - materialDetailInfo.setBigClassifyId(materialInfo.getBigClassifyId()); - materialDetailInfo.setSmallClassifyId(materialInfo.getSmallClassifyId()); - materialDetailInfo.setName(materialInfo.getMaterialName()); + materialDetailInfo.setBigClassifyId(safeMaterialDO.getBigClassifyId()); + materialDetailInfo.setSmallClassifyId(safeMaterialDO.getSmallClassifyId()); + materialDetailInfo.setName(safeMaterialDO.getMaterialName()); materialDetailInfo.setSmId(req.getSmId()); - materialDetailInfo.setConsumable(materialInfo.getConsumable()); + materialDetailInfo.setConsumable(safeMaterialDO.getConsumable()); + materialDetailInfo.setStatus(MaterialStatusEnum.INTACT.getCode()); + materialDetailInfo.setRemark(MaterialStatusEnum.INTACT.getValue()); materialDetailInfo.setValidType(req.getValidType()); if(req.getValidType().equals(ValidTypeEnum.SHORT_TERM.getCode())){ materialDetailInfo.setValidTime(req.getValidTime()); @@ -211,22 +224,22 @@ materialDetailInfo.setMaterialNo(generateMaterialNo(totalCount+i)); list.add(materialDetailInfo); } + //填充物资管理数据 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(req.getSmId()); + safeMaterialBO.setStockCount(req.getWareHousingCount()); + safeMaterialBO.setTotalCount(req.getWareHousingCount()); + //加分布式锁,防止重复创建规则 RLock lock = redissonClient.getLock("LOCK_SMD_SAVEBATCH"); try { lock.lock(10, TimeUnit.SECONDS); //批量入库 safeMaterialDetailInfoService.saveBatch(list); - //发送消息 - if(req.getValidType().equals(ValidTypeEnum.SHORT_TERM.getCode()) && null != req.getValidTime()){ - for(SafeMaterialDetailInfo materialDetailInfo:list){ - //发送消息 - SafeMaterialMsg safeMaterialMsg = new SafeMaterialMsg(); - safeMaterialMsg.setId(materialInfo.getId()); - safeMaterialMsg.setValidTime(conversionTimeType(materialDetailInfo.getValidTime())); - rocketMQTemplateHelper.syncSend(safeMaterialTopic,safeMaterialMsg); - } - } + //修改数量 + safeMaterialInfoService.updateCountById(safeMaterialBO); + //创建成功,释放锁 + lock.unlock(); }catch (EquipmentException e) { e.printStackTrace(); throw new EquipmentException(e.getCode(), e.getMessage()); @@ -261,9 +274,17 @@ }else{ if(req.getValidType().equals(ValidTypeEnum.SHORT_TERM.getCode()) && null == req.getValidTime()){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"有效期时间不可为空!"); + }else{ + if(req.getValidTime().before(new Date())){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"有效期时间小于当前时间!"); + } } } } + //填充物资管理数据 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(vo.getSmId()); + safeMaterialBO.setStockCount(0); //填充数据 SafeMaterialDetailInfo safeMaterialDetailInfo = new SafeMaterialDetailInfo(); safeMaterialDetailInfo.setId(req.getId()); @@ -271,20 +292,29 @@ safeMaterialDetailInfo.setSmId(req.getSmId()); safeMaterialDetailInfo.setValidType(req.getValidType()); safeMaterialDetailInfo.setValidTime(req.getValidTime()); + if(ValidStatusEnum.NO.getCode().equals(vo.getValidStatus())){ + //无效情况 + if(vo.getStatus().equals(MaterialStatusEnum.OVERDUE.getCode())){ + //过期 + safeMaterialDetailInfo.setValidStatus(ValidStatusEnum.YES.getCode()); + safeMaterialDetailInfo.setStatus(MaterialStatusEnum.INTACT.getCode()); + safeMaterialDetailInfo.setRemark(MaterialStatusEnum.INTACT.getValue()); + safeMaterialBO.setStockCount(1); + } + } + + //加分布式锁,防止重复创建规则 RLock lock = redissonClient.getLock("LOCK_SMD_UPDATE"); try { lock.lock(10, TimeUnit.SECONDS); //修改 safeMaterialDetailInfoService.updateById(safeMaterialDetailInfo); - //如果是非常期 - if(req.getValidType().equals(ValidTypeEnum.SHORT_TERM.getCode()) && null != req.getValidTime()){ - //发送消息 - SafeMaterialMsg safeMaterialMsg = new SafeMaterialMsg(); - safeMaterialMsg.setId(req.getId()); - safeMaterialMsg.setValidTime(conversionTimeType(req.getValidTime())); - rocketMQTemplateHelper.syncSend(safeMaterialTopic,safeMaterialMsg); + if(null != safeMaterialBO){ + safeMaterialInfoService.updateCountById(safeMaterialBO); } + //创建成功,释放锁 + lock.unlock(); }catch (EquipmentException e) { e.printStackTrace(); throw new EquipmentException(e.getCode(), e.getMessage()); @@ -301,7 +331,7 @@ /** * 批量-重新入库 - * @param ids + * @param * @return */ @Override @@ -314,13 +344,15 @@ List<SafeMaterialDetailInfo> list = safeMaterialDetailInfoService.getListByIds(paramForm.getIds()); List<SafeMaterialDetailInfo> selectList = list .stream() - .filter(item -> item.getIrStatus().equals(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()) && item.getConsumable().equals(ConsumableEnum.YES.getCode())) + .filter(item -> item.getIrStatus().equals(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()) && item.getConsumable().equals(ConsumableEnum.NO.getCode())) .collect(Collectors.toList()); if(selectList.size() != paramForm.getIds().size()){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"已入库或耗材物资不可重复入库!"); } //修改为入库状态 safeMaterialDetailInfoService.updateReceiptStatusByIds(paramForm.getIds(),IssueReceiptEnum.IN_THE_LIBRARY.getCode()); + //创建成功,释放锁 + lock.unlock(); }catch (EquipmentException e) { e.printStackTrace(); throw new EquipmentException(e.getCode(), e.getMessage()); @@ -340,66 +372,39 @@ * @param * @return */ + @Transactional @Override - public ResultVO deleteBatch(ParamForm paramForm) { - safeMaterialDetailInfoService.deleteBatch(paramForm.getIds()); - return new ResultVO(ResultCodes.OK); - } - - /** - * 批量出库 - 根据ids - * @param req - * @return - */ - @Override - public ResultVO deliveryBatchByIds(MterialDeliveryReq req) { - //获取认领人信息 - UserInfoRPCRespDTO userInfo = getUserInfo(req.getClaimantId()); - //验证 - List<SafeMaterialDetailInfo> list = safeMaterialDetailInfoService.getListByIds(req.getIds()); - List<SafeMaterialDetailInfo> selectList = list - .stream() - .filter(item -> item.getIrStatus().equals(IssueReceiptEnum.IN_THE_LIBRARY.getCode()) && item.getValidStatus().equals(ValidStatusEnum.YES.getCode())) - .collect(Collectors.toList()); - if(selectList.size() != req.getIds().size()){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"已出库物资或无效物资,不可出库!"); - } - SafeMaterialDetailBO detailBO = new SafeMaterialDetailBO(); - detailBO.setIds(req.getIds()); - detailBO.setClaimantName(userInfo.getUsername()); - detailBO.setClaimantId(req.getClaimantId()); - safeMaterialDetailInfoService.updateDeliveryStatusByIds(detailBO); - return new ResultVO(ResultCodes.OK); - } - - @Override - public ResultVO deliveryBatchRandom(MterialRandomDeliveryReq req) { - UserInfoRPCRespDTO userInfo = getUserInfo(req.getClaimantId()); - List<Long> idList = new ArrayList<>(); + public ResultVO deleteBatch(ContextCacheUser currentUser,ParamForm paramForm) { //加分布式锁,防止重复创建规则 - RLock lock = redissonClient.getLock("LOCK_SMD_DELIVERYBATCHRANDOM"); + RLock lock = redissonClient.getLock("LOCK_SMD_DELETEBATCH"); try { lock.lock(10, TimeUnit.SECONDS); - if(StringUtils.isNotBlank(req.getRfid())){ - idList = safeMaterialDetailInfoService.getIdListByRfid(req.getCount(),req.getSmId(),req.getRfid()); - - }else{ - idList = safeMaterialDetailInfoService.getRfidNullList(req.getCount(), req.getSmId()); - + //获取所有物资管理 + List<SafeMaterialInfo> safeMaterialInfoList = safeMaterialInfoService.listByDepId(currentUser.getDepId()); + List<Long> idList = paramForm.getIds(); + List<SafeMaterialDetailInfo> list = safeMaterialDetailInfoService.getListByIds(idList); + List<SafeMaterialDetailInfo> collect = list.stream().filter(item -> item.getIrStatus().equals(IssueReceiptEnum.OUT_OF_LIBRARY.getCode())).collect(Collectors.toList()); + if(collect.size()>0){ + throw new EquipmentException(ResultCodes.SERVER_DEL_ERROR,"出库物资不可删除!"); } - if(idList.size()< req.getCount()){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"有效库存数量不足!"); + List<SafeMaterialBO> safeMaterialBOList = new ArrayList<>(); + for(SafeMaterialInfo materialInfo:safeMaterialInfoList){ + List<SafeMaterialDetailInfo> selectList = list.stream().filter(item -> item.getSmId().equals(materialInfo.getId())).collect(Collectors.toList()); + if(selectList.size()>0){ + //物资管理 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(materialInfo.getId()); + safeMaterialBO.setStockCount(-selectList.size()); + safeMaterialBO.setTotalCount(-selectList.size()); + safeMaterialBOList.add(safeMaterialBO); + } } - //获取有效数量 - Integer validStockCount = safeMaterialDetailInfoService.getValidStockCount(req.getSmId()); - if(req.getCount() > validStockCount){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"出库数量不可大于有效库存数量!"); - } - SafeMaterialDetailBO detailBO = new SafeMaterialDetailBO(); - detailBO.setClaimantName(userInfo.getUsername()); - detailBO.setClaimantId(req.getClaimantId()); - detailBO.setIds(idList); - safeMaterialDetailInfoService.updateDeliveryStatusByIds(detailBO); + //删除 + safeMaterialDetailInfoService.deleteBatch(paramForm.getIds()); + //修改库存 + safeMaterialInfoService.updateStockCount(safeMaterialBOList); + //创建成功,释放锁 + lock.unlock(); }catch (EquipmentException e) { e.printStackTrace(); throw new EquipmentException(e.getCode(), e.getMessage()); @@ -412,6 +417,246 @@ } } return new ResultVO(ResultCodes.OK); + } + + /** + * 批量出库 - 根据ids + * @param req + * @return + */ + @Transactional + @Override + public void deliveryBatchByIds(MterialDeliveryReq req,ContextCacheUser currentUser) { + //获取认领人信息 + UserInfoRPCRespDTO userInfo = getUserInfo(req.getReceiveUid()); + //加分布式锁,防止重复创建规则 + RLock lock = redissonClient.getLock("LOCK_SMD_DELIVERYBATCHBYIDS"); + try { + lock.lock(10, TimeUnit.SECONDS); + //验证 + List<SafeMaterialDetailInfo> list = safeMaterialDetailInfoService.getListByIds(req.getIds()); + List<SafeMaterialDetailInfo> selectList = list + .stream() + .filter(item -> item.getIrStatus().equals(IssueReceiptEnum.IN_THE_LIBRARY.getCode()) && item.getValidStatus().equals(ValidStatusEnum.YES.getCode())) + .collect(Collectors.toList()); + if(selectList.size() != req.getIds().size()){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"已出库物资或无效物资,不可出库!"); + } + //获取该部门的所管理物资 + List<SafeMaterialInfo> safeMaterialInfoList = safeMaterialInfoService.listByDepId(currentUser.getDepId()); + List<MaterialReceiveRecordsBaseInfo> receiveRecordsBaseInfoList = new ArrayList<>(); + List<MaterialReceiveRecordsInfo> receiveRecordsInfoList = new ArrayList<>(); + List<SafeMaterialBO> safeMaterialBOList = new ArrayList<>(); + List<SafeMaterialDetailInfo> safeMaterialDetailInfoList = new ArrayList<>(); + //循环 + for(SafeMaterialInfo safeMaterialInfo:safeMaterialInfoList){ + List<SafeMaterialDetailInfo> collectList = list.stream().filter(item -> safeMaterialInfo.getId().equals(item.getSmId())).collect(Collectors.toList()); + if(collectList.size()>0){ + //物资管理 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(safeMaterialInfo.getId()); + safeMaterialBO.setStockCount(-collectList.size()); + safeMaterialBOList.add(safeMaterialBO); + + //总记录 + MaterialReceiveRecordsBaseInfo receiveRecordsBaseInfo = new MaterialReceiveRecordsBaseInfo(); + receiveRecordsBaseInfo.setId(IdUtil.getSnowflake(0,0).nextId()); + receiveRecordsBaseInfo.setMaterialName(safeMaterialInfo.getMaterialName()); + receiveRecordsBaseInfo.setReceiveUid(userInfo.getUid()); + receiveRecordsBaseInfo.setReceiveUname(userInfo.getUsername()); + receiveRecordsBaseInfo.setReceiveCount(collectList.size()); + receiveRecordsBaseInfo.setRevertCount(0); + receiveRecordsBaseInfo.setConsumeCount(0); + if(ConsumableEnum.YES.getCode().equals(safeMaterialInfo.getConsumable())){ + receiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.CONSUMABLE_RETURN_NO.getCode()); + receiveRecordsBaseInfo.setConsumeCount(0); + }else{ + receiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.RETURN_NO.getCode()); + receiveRecordsBaseInfo.setConsumeCount(collectList.size()); + } + receiveRecordsBaseInfo.setSmId(safeMaterialInfo.getId()); + receiveRecordsBaseInfoList.add(receiveRecordsBaseInfo); + //循环详细物资 + for(SafeMaterialDetailInfo safeMaterialDetailInfo:collectList){ + //领取物资清单记录 + MaterialReceiveRecordsInfo materialReceiveRecordsInfo = new MaterialReceiveRecordsInfo(); + materialReceiveRecordsInfo.setId(IdUtil.getSnowflake(0,0).nextId()); + materialReceiveRecordsInfo.setMaterialName(safeMaterialDetailInfo.getName()); + materialReceiveRecordsInfo.setMaterialNo(safeMaterialDetailInfo.getMaterialNo()); + materialReceiveRecordsInfo.setReceiveBaseId(receiveRecordsBaseInfo.getId()); + if(ConsumableEnum.YES.getCode().equals(safeMaterialDetailInfo.getConsumable())){ + materialReceiveRecordsInfo.setRevertStatus(MaterialRevertStatusEnum.DEPLETION.getCode()); + materialReceiveRecordsInfo.setMaterialStatus(MaterialStatusEnum.OTHER.getCode()); + materialReceiveRecordsInfo.setRemark("耗材"); + }else{ + materialReceiveRecordsInfo.setRevertStatus(MaterialRevertStatusEnum.REVERT_NO.getCode()); + materialReceiveRecordsInfo.setMaterialStatus(MaterialStatusEnum.INTACT.getCode()); + materialReceiveRecordsInfo.setRemark(MaterialStatusEnum.INTACT.getValue()); + } + materialReceiveRecordsInfo.setReceiveTime(LocalDateTime.now()); + materialReceiveRecordsInfo.setReceiveUid(userInfo.getUid()); + materialReceiveRecordsInfo.setReceiveUname(userInfo.getUsername()); + materialReceiveRecordsInfo.setSmdId(safeMaterialDetailInfo.getId()); + materialReceiveRecordsInfo.setRfid(safeMaterialDetailInfo.getRfid()); + receiveRecordsInfoList.add(materialReceiveRecordsInfo); + //物资清单 + SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo(); + materialDetailInfo.setId(safeMaterialDetailInfo.getId()); + materialDetailInfo.setReceiveUid(userInfo.getUid()); + materialDetailInfo.setReceiveUname(userInfo.getRealName()); + materialDetailInfo.setIrStatus(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()); + materialDetailInfo.setDeliveryTime(LocalDateTime.now()); + if(ConsumableEnum.YES.getCode().equals(safeMaterialDetailInfo.getConsumable())){ + materialDetailInfo.setValidStatus(ValidStatusEnum.NO.getCode()); + materialDetailInfo.setStatus(MaterialStatusEnum.OTHER.getCode()); + materialDetailInfo.setRemark("耗材"); + } + safeMaterialDetailInfoList.add(materialDetailInfo); + } + + } + + } + //修改物资管理数量 + safeMaterialInfoService.updateStockCount(safeMaterialBOList); + //修改物资清单的状态 + safeMaterialDetailInfoService.updateBatchById(safeMaterialDetailInfoList); + //插入领取总记录 + materialReceiveRecordsBaseInfoService.saveBatch(receiveRecordsBaseInfoList); + //插入领取清单 + materialReceiveRecordsInfoService.saveBatch(receiveRecordsInfoList); + //创建成功,释放锁 + lock.unlock(); + }catch (EquipmentException e) { + e.printStackTrace(); + throw new EquipmentException(e.getCode(), e.getMessage()); + }catch (Exception e) { + e.printStackTrace(); + throw new BusinessException(ResultCodes.SERVER_ERROR); + }finally { + if(lock.isLocked()){ + lock.unlock(); + } + } + } + + + + @Transactional + @Override + public void deliveryBatchBySmId(MterialRandomDeliveryReq req,ContextCacheUser currentUser) { + SafeMaterialDO safeMaterialDO = safeMaterialInfoService.queryById(req.getSmId()); + if(null == safeMaterialDO){ + throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"物资不存在,无法出库!"); + } + SafeMaterialDetailDBQuery query = new SafeMaterialDetailDBQuery(); + query.setSmId(safeMaterialDO.getId()); + query.setCount(req.getCount()); + query.setRfid(req.getRfid()); + query.setIrStatus(IssueReceiptEnum.IN_THE_LIBRARY.getCode()); + query.setValidStatus(ValidStatusEnum.YES.getCode()); + UserInfoRPCRespDTO userInfo = getUserInfo(req.getReceiveUid()); + List<SafeMaterialDetailInfo> safeMaterialDetailInfoList = new ArrayList<>(); + //加分布式锁,防止重复创建规则 + RLock lock = redissonClient.getLock("LOCK_SMD_DELIVERYBATCHRANDOM"); + try { + lock.lock(10, TimeUnit.SECONDS); + //获取有效数量 + Integer validStockCount = safeMaterialDetailInfoService.getValidStockCount(req.getSmId()); + if(req.getCount() > validStockCount){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"出库数量不可大于有效库存数量!"); + } + if(StringUtils.isNotBlank(req.getRfid())){ + safeMaterialDetailInfoList = safeMaterialDetailInfoService.getListBySmIdAndRfid(query); + }else{ + safeMaterialDetailInfoList = safeMaterialDetailInfoService.getListBySmId(query); + } + if(safeMaterialDetailInfoList.size()< req.getCount()){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"库存数量不足!"); + } + //物资管理 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(req.getSmId()); + safeMaterialBO.setStockCount(-req.getCount()); + //领取记录 + MaterialReceiveRecordsBaseInfo receiveRecordsBaseInfo = new MaterialReceiveRecordsBaseInfo(); + receiveRecordsBaseInfo.setId(IdUtil.getSnowflake(0,0).nextId()); + receiveRecordsBaseInfo.setMaterialName(safeMaterialDO.getMaterialName()); + receiveRecordsBaseInfo.setReceiveUid(userInfo.getUid()); + receiveRecordsBaseInfo.setReceiveUname(userInfo.getUsername()); + receiveRecordsBaseInfo.setReceiveCount(req.getCount()); + receiveRecordsBaseInfo.setRevertCount(0); + receiveRecordsBaseInfo.setConsumeCount(0); + if(ConsumableEnum.YES.getCode().equals(safeMaterialDO.getConsumable())){ + receiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.CONSUMABLE_RETURN_NO.getCode()); + receiveRecordsBaseInfo.setConsumeCount(req.getCount()); + }else{ + receiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.RETURN_NO.getCode()); + receiveRecordsBaseInfo.setConsumeCount(0); + + } + receiveRecordsBaseInfo.setSmId(safeMaterialDO.getId()); + //物资领取清单 + List<MaterialReceiveRecordsInfo> receiveRecordsInfoList = new ArrayList<>(); + //物资清单 + List<SafeMaterialDetailInfo> updateDetailList = new ArrayList<>(); + for(SafeMaterialDetailInfo safeMaterialDetailInfo:safeMaterialDetailInfoList){ + //领取物资清单记录 + MaterialReceiveRecordsInfo materialReceiveRecordsInfo = new MaterialReceiveRecordsInfo(); + materialReceiveRecordsInfo.setId(IdUtil.getSnowflake(0,0).nextId()); + materialReceiveRecordsInfo.setMaterialName(safeMaterialDetailInfo.getName()); + materialReceiveRecordsInfo.setMaterialNo(safeMaterialDetailInfo.getMaterialNo()); + materialReceiveRecordsInfo.setReceiveBaseId(receiveRecordsBaseInfo.getId()); + if(ConsumableEnum.YES.getCode().equals(safeMaterialDetailInfo.getConsumable())){ + materialReceiveRecordsInfo.setRevertStatus(MaterialRevertStatusEnum.DEPLETION.getCode()); + materialReceiveRecordsInfo.setMaterialStatus(MaterialStatusEnum.OTHER.getCode()); + materialReceiveRecordsInfo.setRemark("耗材"); + }else{ + materialReceiveRecordsInfo.setRevertStatus(MaterialRevertStatusEnum.REVERT_NO.getCode()); + materialReceiveRecordsInfo.setMaterialStatus(MaterialStatusEnum.INTACT.getCode()); + materialReceiveRecordsInfo.setRemark(MaterialStatusEnum.INTACT.getValue()); + } + materialReceiveRecordsInfo.setReceiveTime(LocalDateTime.now()); + materialReceiveRecordsInfo.setReceiveUid(userInfo.getUid()); + materialReceiveRecordsInfo.setReceiveUname(userInfo.getUsername()); + materialReceiveRecordsInfo.setSmdId(safeMaterialDetailInfo.getId()); + materialReceiveRecordsInfo.setRfid(safeMaterialDetailInfo.getRfid()); + receiveRecordsInfoList.add(materialReceiveRecordsInfo); + //物资清单 + SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo(); + materialDetailInfo.setId(safeMaterialDetailInfo.getId()); + materialDetailInfo.setReceiveUid(userInfo.getUid()); + materialDetailInfo.setReceiveUname(userInfo.getRealName()); + materialDetailInfo.setIrStatus(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()); + materialDetailInfo.setDeliveryTime(LocalDateTime.now()); + if(ConsumableEnum.YES.getCode().equals(safeMaterialDetailInfo.getConsumable())){ + materialDetailInfo.setValidStatus(ValidStatusEnum.NO.getCode()); + materialDetailInfo.setStatus(MaterialStatusEnum.OTHER.getCode()); + materialDetailInfo.setRemark("耗材"); + } + updateDetailList.add(materialDetailInfo); + } + //修改物资清单状态 + safeMaterialDetailInfoService.updateBatchById(updateDetailList); + //修改物资管理库存 + safeMaterialInfoService.updateCountById(safeMaterialBO); + //插入领取总记录 + materialReceiveRecordsBaseInfoService.save(receiveRecordsBaseInfo); + //插入领取清单 + materialReceiveRecordsInfoService.saveBatch(receiveRecordsInfoList); + //创建成功,释放锁 + lock.unlock(); + }catch (EquipmentException e) { + e.printStackTrace(); + throw new EquipmentException(e.getCode(), e.getMessage()); + }catch (Exception e) { + e.printStackTrace(); + throw new BusinessException(ResultCodes.SERVER_ERROR); + }finally { + if(lock.isLocked()){ + lock.unlock(); + } + } } /** @@ -494,9 +739,9 @@ ids.addAll(collect); } } - SafeMaterialDetailBO detailBO = new SafeMaterialDetailBO(); - detailBO.setClaimantName(userInfo.getUsername()); - detailBO.setClaimantId(req.getClaimantId()); + SafeMaterialBatchDeliveryBO detailBO = new SafeMaterialBatchDeliveryBO(); + detailBO.setReceiveUname(userInfo.getUsername()); + detailBO.setReceiveUid(req.getClaimantId()); detailBO.setIds(ids); safeMaterialDetailInfoService.updateDeliveryStatusByIds(detailBO); @@ -528,9 +773,32 @@ } @Override - public SearchResultVO<List<SafeMaterialDetailDto>> listByPage(PageQuery<SafeMatetrialDetailQuery> pageQuery) { + @Transactional + public SearchResultVO<List<SafeMaterialDetailDto>> listByPage(ContextCacheUser currentUser,PageQuery<SafeMatetrialDetailQuery> pageQuery) { + SafeMaterialDetailDBQuery dbQuery = new SafeMaterialDetailDBQuery(); + if(null != pageQuery.getSearchParams()){ + BeanUtils.copyProperties(pageQuery.getSearchParams(),dbQuery); + dbQuery.setDepId(currentUser.getDepId()); + } + dbQuery.setDepId(currentUser.getDepId()); + //加分布式锁,防止重复创建规则 + RLock lock = redissonClient.getLock("LOCK_SMD_MATERIALEXPIRED"); + try { + lock.lock(10, TimeUnit.SECONDS); + //执行无效物资过期 + this.materialExpired(); + //创建成功,释放锁 + lock.unlock(); + }catch (Exception e) { + e.printStackTrace(); + throw new BusinessException(ResultCodes.SERVER_ERROR); + }finally { + if(lock.isLocked()){ + lock.unlock(); + } + } Page<SafeMaterialDetailInfo> page = new Page(pageQuery.getPageIndex(),pageQuery.getPageSize()); - List<SafeMaterialDetailInfoDO> safeMaterialDetailInfoDOS = safeMaterialDetailInfoService.listByPage(page, pageQuery.getSearchParams()); + List<SafeMaterialDetailInfoDO> safeMaterialDetailInfoDOS = safeMaterialDetailInfoService.listByPage(page, dbQuery); List<SafeMaterialDetailDto> detailDtoList = new ArrayList<>(); for(SafeMaterialDetailInfoDO materialDetailInfoDO : safeMaterialDetailInfoDOS){ SafeMaterialDetailDto materialDetailDto = new SafeMaterialDetailDto(); @@ -539,11 +807,53 @@ materialDetailDto.setValidStatusName(ValidStatusEnum.getByCode(materialDetailInfoDO.getValidStatus()).getValue()); materialDetailDto.setValidTypeName(ValidTypeEnum.getByCode(materialDetailInfoDO.getValidType()).getValue()); materialDetailDto.setIrStatusName(IssueReceiptEnum.getByCode(materialDetailInfoDO.getIrStatus()).getValue()); + materialDetailDto.setStatusName(MaterialStatusEnum.getByCode(materialDetailInfoDO.getStatus()).getValue()); detailDtoList.add(materialDetailDto); } return new SearchResultVO<>(true, page.getCurrent(),page.getSize(), page.getPages(),page.getTotal(),detailDtoList,ResultCodes.OK); } - + private void materialExpired(){ + //获取所有物资管理 + List<SafeMaterialInfo> list = safeMaterialInfoService.list(); + //获取在库有效物资 + List<SafeMaterialDetailInfo> unValidList = safeMaterialDetailInfoService.getUnValidList(); + if(unValidList.size()>0){ + List<SafeMaterialBO> safeMaterialBOList = new ArrayList<>(); + List<SafeMaterialDetailInfo> updateValidStatusList = new ArrayList<>(); + for(SafeMaterialInfo safeMaterialInfo:list){ + //过滤出该管理下过期物资 + List<SafeMaterialDetailInfo> expiredList = unValidList.stream().filter(item -> item.getSmId().equals(safeMaterialInfo.getId())).collect(Collectors.toList()); + if(expiredList.size()>0){ + //过滤非出库无效物资 + List<SafeMaterialDetailInfo> expiredAndInLibraryList = expiredList.stream().filter(item -> item.getIrStatus().equals(IssueReceiptEnum.IN_THE_LIBRARY.getCode())).collect(Collectors.toList()); + if(expiredAndInLibraryList.size()>0){ + //物资管理 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(safeMaterialInfo.getId()); + safeMaterialBO.setStockCount(-expiredAndInLibraryList.size()); + safeMaterialBOList.add(safeMaterialBO); + } + //物资清单 + for(SafeMaterialDetailInfo detailInfo:expiredList){ + SafeMaterialDetailInfo safeMaterialDetailInfo = new SafeMaterialDetailInfo(); + safeMaterialDetailInfo.setId(detailInfo.getId()); + safeMaterialDetailInfo.setValidStatus(ValidStatusEnum.NO.getCode()); + if(detailInfo.getStatus().equals(MaterialStatusEnum.INTACT.getCode())){ + safeMaterialDetailInfo.setStatus(MaterialStatusEnum.OVERDUE.getCode()); + safeMaterialDetailInfo.setRemark(MaterialStatusEnum.OVERDUE.getValue()); + } + updateValidStatusList.add(safeMaterialDetailInfo); + } + } + } + if(safeMaterialBOList.size()>0){ + safeMaterialInfoService.updateStockCount(safeMaterialBOList); + } + if(updateValidStatusList.size()>0){ + safeMaterialDetailInfoService.updateBatchById(updateValidStatusList); + } + } + } @Override public ResultVO queryById(Long id) { if(null == id){ @@ -552,18 +862,19 @@ SafeMaterialDetailInfo materialDetailInfo = safeMaterialDetailInfoService.queryById(id); SafeMaterialDetailDto detailDto = new SafeMaterialDetailDto(); if(materialDetailInfo != null){ - SafeMaterialInfo materialInfo = safeMaterialInfoService.queryById(materialDetailInfo.getSmId()); + SafeMaterialDO safeMaterialDO = safeMaterialInfoService.queryById(materialDetailInfo.getSmId()); SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(materialDetailInfo.getBigClassifyId()); BeanUtils.copyProperties(materialDetailInfo,detailDto); detailDto.setConsumableName(ConsumableEnum.getByCode(materialDetailInfo.getConsumable()).getValue()); detailDto.setValidStatusName(ValidStatusEnum.getByCode(materialDetailInfo.getValidStatus()).getValue()); detailDto.setValidTypeName(ValidTypeEnum.getByCode(materialDetailInfo.getValidType()).getValue()); detailDto.setIrStatusName(IssueReceiptEnum.getByCode(materialDetailInfo.getIrStatus()).getValue()); - if(materialInfo != null){ - detailDto.setDepName(materialInfo.getDepName()); + detailDto.setStatusName(MaterialStatusEnum.getByCode(materialDetailInfo.getStatus()).getValue()); + if(safeMaterialDO != null){ + detailDto.setDepName(safeMaterialDO.getDepName()); } if(classifyInfo != null){ - detailDto.setMaterialClassifyName(classifyInfo.getMaterialClassifyName()); + detailDto.setBigClassifyName(classifyInfo.getMaterialClassifyName()); } } @@ -576,7 +887,11 @@ * @return */ @Override - public ResultVO singleDelivery(SafeMaterialDetailReq req) { + @Transactional + public void singleDelivery(ContextCacheUser currentUser,SafeMaterialDetailReq req) { + if(null == req.getReceiveUid()){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"领取人不可为空!"); + } //加分布式锁,防止重复创建规则 RLock lock = redissonClient.getLock("LOCK_SMD_SINGLEDELIVERY"); try { @@ -593,15 +908,68 @@ throw new EquipmentException(EquipmentResultCodes.MATERIAL_OUT_OF_LIBRARY); } //检查认领人 - UserInfoRPCRespDTO userInfo = getUserInfo(req.getClaimantId()); + UserInfoRPCRespDTO userInfo = getUserInfo(req.getReceiveUid()); + //详细物资 SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo(); materialDetailInfo.setId(req.getId()); materialDetailInfo.setIrStatus(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()); - materialDetailInfo.setClaimantId(req.getClaimantId()); - materialDetailInfo.setClaimantName(userInfo.getUsername()); + materialDetailInfo.setReceiveUid(req.getReceiveUid()); + materialDetailInfo.setReceiveUname(userInfo.getUsername()); materialDetailInfo.setDeliveryTime(LocalDateTime.now()); + + //物资管理库存数量 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(vo.getSmId()); + safeMaterialBO.setStockCount(-1); + //出库记录 + MaterialReceiveRecordsBaseInfo receiveRecordsBaseInfo = new MaterialReceiveRecordsBaseInfo(); + receiveRecordsBaseInfo.setId(IdUtil.getSnowflake(0,0).nextId()); + receiveRecordsBaseInfo.setMaterialName(vo.getName()); + receiveRecordsBaseInfo.setReceiveCount(1); + receiveRecordsBaseInfo.setRevertCount(0); + receiveRecordsBaseInfo.setConsumeCount(0); + receiveRecordsBaseInfo.setReceiveUid(userInfo.getUid()); + receiveRecordsBaseInfo.setReceiveUname(userInfo.getUsername()); + receiveRecordsBaseInfo.setSmId(vo.getSmId()); + //出库物资记录 + MaterialReceiveRecordsInfo receiveRecordsInfo = new MaterialReceiveRecordsInfo(); + receiveRecordsInfo.setId(IdUtil.getSnowflake(0,0).nextId()); + receiveRecordsInfo.setMaterialName(vo.getName()); + receiveRecordsInfo.setMaterialNo(vo.getMaterialNo()); + receiveRecordsInfo.setRfid(vo.getRfid()); + receiveRecordsInfo.setReceiveTime(LocalDateTime.now()); + receiveRecordsInfo.setReceiveUid(userInfo.getUid()); + receiveRecordsInfo.setReceiveUname(userInfo.getUsername()); + receiveRecordsInfo.setReceiveBaseId(receiveRecordsBaseInfo.getId()); + receiveRecordsInfo.setSmdId(vo.getId()); + + if(vo.getConsumable().equals(ConsumableEnum.YES.getCode())){ + //耗材 + materialDetailInfo.setValidStatus(ValidStatusEnum.NO.getCode()); + materialDetailInfo.setStatus(MaterialStatusEnum.OTHER.getCode()); + materialDetailInfo.setRemark("耗材"); + receiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.CONSUMABLE_RETURN_NO.getCode()); + receiveRecordsInfo.setRevertStatus(MaterialRevertStatusEnum.DEPLETION.getCode()); + receiveRecordsInfo.setMaterialStatus(MaterialStatusEnum.OTHER.getCode()); + receiveRecordsInfo.setRemark("耗材"); + }else{ + //默认未归还 + receiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.RETURN_NO.getCode()); + receiveRecordsInfo.setRevertStatus(MaterialRevertStatusEnum.REVERT_NO.getCode()); + receiveRecordsInfo.setMaterialStatus(MaterialStatusEnum.INTACT.getCode()); + receiveRecordsInfo.setRemark(MaterialStatusEnum.INTACT.getValue()); + } + //修改出入库状态为出库 safeMaterialDetailInfoService.updateById(materialDetailInfo); + //修改物资管理库存 + safeMaterialInfoService.updateCountById(safeMaterialBO); + //物资领取总记录 + materialReceiveRecordsBaseInfoService.save(receiveRecordsBaseInfo); + //物资详细清单 + materialReceiveRecordsInfoService.save(receiveRecordsInfo); + //创建成功,释放锁 + lock.unlock(); }catch (EquipmentException e) { e.printStackTrace(); throw new EquipmentException(e.getCode(), e.getMessage()); @@ -613,7 +981,6 @@ lock.unlock(); } } - return new ResultVO<>(ResultCodes.OK); } /** @@ -623,7 +990,8 @@ */ @Override - public ResultVO singleReceipt(Long id) { + @Transactional + public void singleReceipt(Long id,ContextCacheUser currentUser) { if(null == id){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } @@ -634,7 +1002,7 @@ //获取该条数据 SafeMaterialDetailInfo vo = safeMaterialDetailInfoService.queryById(id); if(null == vo){ - throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST); + throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"未查询到该物资出库记录"); } //如果是耗材不可重新入库 if(vo.getConsumable().equals(ConsumableEnum.YES.getCode())){ @@ -643,8 +1011,60 @@ if(vo.getIrStatus().equals(IssueReceiptEnum.IN_THE_LIBRARY.getCode())){ throw new EquipmentException(EquipmentResultCodes.MATERIAL_IN_THE_LIBRARY); } + //物资管理库存数量 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(vo.getSmId()); + safeMaterialBO.setStockCount(1); + + //获取物资总记录数据 + MaterialDeliveryRecordDO deliveryRecordDO = materialReceiveRecordsInfoService.getRecordBySmdId(id); + SafeMaterialDetailInfo safeMaterialDetailInfo = new SafeMaterialDetailInfo(); + safeMaterialDetailInfo.setId(vo.getId()); + safeMaterialDetailInfo.setIrStatus(IssueReceiptEnum.IN_THE_LIBRARY.getCode()); + safeMaterialDetailInfo.setWareHousingTime(LocalDateTime.now()); + if(null == deliveryRecordDO){ + //无领取记录 + if (vo.getValidStatus().equals(ValidStatusEnum.NO.getCode())) {//无效 + if(vo.getStatus().equals(MaterialStatusEnum.OVERDUE.getCode())){//过期 + safeMaterialBO.setStockCount(0); + }else{ + //其他情况,重新入库则改成有效 + safeMaterialDetailInfo.setValidStatus(ValidStatusEnum.YES.getCode()); + safeMaterialDetailInfo.setStatus(MaterialStatusEnum.INTACT.getCode()); + safeMaterialDetailInfo.setRemark(MaterialStatusEnum.INTACT.getValue()); + } + } + + }else{ + //有领取记录,则归还 + //获取未归还物资详细记录 + List<MaterialReceiveRecordsInfo> recordsInfos = materialReceiveRecordsInfoService.getNoReturnRecordByReceiveBaseId(deliveryRecordDO.getReceiveBaseId()); + //领取总记录填充 + MaterialReceiveRecordsBaseInfo receiveRecordsBaseInfo = new MaterialReceiveRecordsBaseInfo(); + receiveRecordsBaseInfo.setId(deliveryRecordDO.getReceiveBaseId()); + if(recordsInfos.size() > 1) { + receiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.RETURN_PART.getCode()); + }else { + receiveRecordsBaseInfo.setStatus(MaterialReceiveRecordsStatusEnum.RETURN_COMPLETE.getCode()); + } + receiveRecordsBaseInfo.setRevertCount(deliveryRecordDO.getRevertCount()+1); + materialReceiveRecordsBaseInfoService.updateById(receiveRecordsBaseInfo); + //详细物资领取记录 + MaterialReceiveRecordsInfo receiveRecordsInfo = new MaterialReceiveRecordsInfo(); + receiveRecordsInfo.setId(deliveryRecordDO.getReceiveId()); + receiveRecordsInfo.setRevertStatus(MaterialRevertStatusEnum.REVERT_YES.getCode()); + receiveRecordsInfo.setRevertTime(LocalDateTime.now()); + receiveRecordsInfo.setMaterialStatus(MaterialStatusEnum.INTACT.getCode()); + receiveRecordsInfo.setRemark(MaterialStatusEnum.INTACT.getValue()); + materialReceiveRecordsInfoService.updateById(receiveRecordsInfo); + } + //修改出入库状态为入库 - safeMaterialDetailInfoService.updateReceiptStatus(id,IssueReceiptEnum.IN_THE_LIBRARY.getCode()); + safeMaterialDetailInfoService.updateById(safeMaterialDetailInfo); + //修改物资管理库存 + safeMaterialInfoService.updateCountById(safeMaterialBO); + //创建成功,释放锁 + lock.unlock(); }catch (EquipmentException e) { e.printStackTrace(); throw new EquipmentException(e.getCode(), e.getMessage()); @@ -656,62 +1076,8 @@ lock.unlock(); } } - return new ResultVO<>(ResultCodes.OK); + } - - @Override - public ResultVO singleDdelivery0rReceipt(SafeMaterialDetailReq req) { - if(null == IssueReceiptEnum.getByCode(req.getIrStatus())){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"物资状态不合法"); - } - - //获取该条数据 - SafeMaterialDetailInfo vo = safeMaterialDetailInfoService.queryById(req.getId()); - if(null == vo){ - throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST); - } - if(null == IssueReceiptEnum.getByCode(req.getIrStatus())){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"出入库状态不合法"); - } - - if(IssueReceiptEnum.IN_THE_LIBRARY.getCode().equals(req.getIrStatus())){ - //如果是耗材不可重新入库 - if(vo.getConsumable().equals(ConsumableEnum.YES.getCode())){ - throw new EquipmentException(EquipmentResultCodes.MATERIAL_CONSUMABLE); - } - //重新入库 - if(vo.getIrStatus().equals(req.getIrStatus())){ - throw new EquipmentException(EquipmentResultCodes.MATERIAL_IN_THE_LIBRARY); - } - - //修改出入库状态为入库 - safeMaterialDetailInfoService.updateReceiptStatus(req.getId(), req.getIrStatus()); - }else{ - //出库 - if(vo.getValidStatus().equals(ValidStatusEnum.NO.getCode())){ - throw new EquipmentException(EquipmentResultCodes.MATERIAL_INVALID,"无效物资不可出库"); - } - if(vo.getIrStatus().equals(req.getIrStatus())){ - throw new EquipmentException(EquipmentResultCodes.MATERIAL_OUT_OF_LIBRARY); - } - if(null == req.getClaimantId()){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"认领人不可为空!"); - } - //检查认领人 - UserInfoRPCRespDTO userInfo = getUserInfo(req.getClaimantId()); - //出库 - SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo(); - materialDetailInfo.setId(req.getId()); - materialDetailInfo.setIrStatus(req.getIrStatus()); - materialDetailInfo.setClaimantId(req.getClaimantId()); - materialDetailInfo.setClaimantName(userInfo.getUsername()); - materialDetailInfo.setDeliveryTime(LocalDateTime.now()); - //修改出入库状态为入库 - safeMaterialDetailInfoService.updateById(materialDetailInfo); - } - return new ResultVO<>(ResultCodes.OK); - } - /** @@ -719,21 +1085,55 @@ * @param * @return */ + @Transactional + @Override public ResultVO delete(Long id){ if(null == id){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } - //获取该条数据 - SafeMaterialDetailInfo vo = safeMaterialDetailInfoService.queryById(id); - if(null == vo){ - throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST); - } - SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo(); - materialDetailInfo.setId(id); - materialDetailInfo.setDelFlag(1); - //删除一条数据 - safeMaterialDetailInfoService.updateById(materialDetailInfo); + //加分布式锁,防止重复创建规则 + RLock lock = redissonClient.getLock("LOCK_SMD_DELETE"); + try { + //获取该条数据 + SafeMaterialDetailInfo vo = safeMaterialDetailInfoService.queryById(id); + if(null == vo){ + throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST); + } + if(vo.getIrStatus().equals(IssueReceiptEnum.OUT_OF_LIBRARY.getCode())){ + throw new EquipmentException(ResultCodes.SERVER_DEL_ERROR,"出库物资不可删除!"); + } + SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo(); + materialDetailInfo.setId(id); + materialDetailInfo.setDelFlag(1); + //物资管理库存数量 + SafeMaterialBO safeMaterialBO = new SafeMaterialBO(); + safeMaterialBO.setId(vo.getSmId()); + if(vo.getValidStatus().equals(ValidStatusEnum.YES.getCode())){ + //有效 + safeMaterialBO.setStockCount(-1); + safeMaterialBO.setTotalCount(-1); + }else{ + //无效 + safeMaterialBO.setTotalCount(-1); + } + //删除一条数据 + safeMaterialDetailInfoService.updateById(materialDetailInfo); + //减少库存 + safeMaterialInfoService.updateCountById(safeMaterialBO); + //创建成功,释放锁 + lock.unlock(); + }catch (EquipmentException e) { + e.printStackTrace(); + throw new EquipmentException(e.getCode(), e.getMessage()); + }catch (Exception e) { + e.printStackTrace(); + throw new BusinessException(ResultCodes.SERVER_ERROR); + }finally { + if(lock.isLocked()){ + lock.unlock(); + } + } return new ResultVO<>(ResultCodes.OK); } @@ -764,7 +1164,7 @@ if (rpcResult.getData() != null) { userInfo = (UserInfoRPCRespDTO) rpcResult.getData(); }else { - throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"认领人员不存在!"); + throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"领取人员不存在!"); } } else { throw new EquipmentException(ResultCodes.RPC_RESULT_NULL); @@ -777,12 +1177,14 @@ return null; } String serialCode = null; + String prefix = "NO-"; if(count >= 10000){ serialCode = "" + (count+1); }else if(count >=0){ String countStr = String.valueOf(count+1); serialCode = "10000".substring(0,(5 - countStr.length()))+countStr; } + serialCode = prefix + serialCode; return serialCode; } private Date conversionTimeType(LocalDateTime localDateTime){ diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialServiceImpl.java index 4b9107e..5ee82e9 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialServiceImpl.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialServiceImpl.java @@ -1,9 +1,11 @@ package com.gkhy.safePlatform.equipment.service.impl; +import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService; import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO; import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepRPCRespDTO; +import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.exception.BusinessException; import com.gkhy.safePlatform.commons.query.PageQuery; @@ -13,6 +15,7 @@ import com.gkhy.safePlatform.equipment.enums.ConsumableEnum; import com.gkhy.safePlatform.equipment.enums.EquipmentResultCodes; import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; +import com.gkhy.safePlatform.equipment.model.dto.req.ParamForm; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialAddReq; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialModReq; import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialQuery; @@ -25,6 +28,7 @@ import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialDetailInfoService; import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialInfoService; import org.apache.dubbo.config.annotation.DubboReference; +import org.apache.ibatis.annotations.Param; import org.redisson.api.RLock; import org.redisson.api.RedissonClient; import org.springframework.beans.BeanUtils; @@ -33,7 +37,6 @@ import org.springframework.util.CollectionUtils; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -52,23 +55,18 @@ private RedissonClient redissonClient; @Override - public ResultVO save(SafeMaterialAddReq req) { + public ResultVO save(ContextCacheUser currentUser,SafeMaterialAddReq req) { //加分布式锁,防止重复创建规则 RLock lock = redissonClient.getLock("LOCK_SM_INSERT"); try { lock.lock(10, TimeUnit.SECONDS); - //获取部门信息 - DepInfoRPCRespDTO depInfo = getDepInfoByDepId(req.getDepId()); - if(null == ConsumableEnum.getByCode(req.getConsumable())){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"耗材类型不合法!"); - } //获取物资类型 SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(req.getSmallClassifyId()); if(null == classifyInfo){ throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"物资类型不存在!"); } //判断该部门是否已经创建物资 - boolean flag = safeMaterialInfoService.checkMaterial(req.getSmallClassifyId(), req.getDepId(), null); + boolean flag = safeMaterialInfoService.checkMaterial(req.getSmallClassifyId(), currentUser.getDepId(), null); if(flag){ throw new EquipmentException(EquipmentResultCodes.DATA_EXIST,"该种物资已存在不可重复创建"); } @@ -76,13 +74,16 @@ //获取数量 int safeMaterialTotalCount = safeMaterialInfoService.getTotalCount(); SafeMaterialInfo safeMaterialInfo = new SafeMaterialInfo(); - safeMaterialInfo.setConsumable(req.getConsumable()); - safeMaterialInfo.setDepId(req.getDepId()); + safeMaterialInfo.setId(IdUtil.getSnowflake(0,0).nextId()); + safeMaterialInfo.setConsumable(classifyInfo.getConsumable()); + safeMaterialInfo.setDepId(currentUser.getDepId()); safeMaterialInfo.setSmallClassifyId(req.getSmallClassifyId()); safeMaterialInfo.setMaterialName(classifyInfo.getMaterialClassifyName()); - safeMaterialInfo.setDepName(depInfo.getDepName()); + safeMaterialInfo.setDepName(currentUser.getDepName()); safeMaterialInfo.setSerialNum(this.generateSerialNum(safeMaterialTotalCount)); safeMaterialInfo.setBigClassifyId(req.getBigClassifyId()); + safeMaterialInfo.setTotalCount(0); + safeMaterialInfo.setStockCount(0); //插入 safeMaterialInfoService.save(safeMaterialInfo); @@ -103,33 +104,29 @@ } @Override - public ResultVO update(SafeMaterialModReq req) { + public ResultVO update(ContextCacheUser currentUser,SafeMaterialModReq req) { //加分布式锁,防止重复创建规则 RLock lock = redissonClient.getLock("LOCK_SM_UPDATE"); try { lock.lock(10, TimeUnit.SECONDS); - //获取部门信息 - DepInfoRPCRespDTO depInfo = getDepInfoByDepId(req.getDepId()); - if(null == ConsumableEnum.getByCode(req.getConsumable())){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"耗材类型不合法!"); - } + //获取物资类型 SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(req.getSmallClassifyId()); if(null == classifyInfo){ throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"物资类型不存在!"); } - boolean flag = safeMaterialInfoService.checkMaterial(req.getSmallClassifyId(), req.getDepId(), req.getDepId()); + boolean flag = safeMaterialInfoService.checkMaterial(req.getSmallClassifyId(), currentUser.getDepId(), req.getId()); if(flag){ throw new EquipmentException(EquipmentResultCodes.DATA_EXIST,"该种物资已存在不可重复创建"); } SafeMaterialInfo safeMaterialInfo = new SafeMaterialInfo(); - safeMaterialInfo.setConsumable(req.getConsumable()); - safeMaterialInfo.setDepId(req.getDepId()); + safeMaterialInfo.setConsumable(classifyInfo.getConsumable()); safeMaterialInfo.setSmallClassifyId(req.getSmallClassifyId()); safeMaterialInfo.setMaterialName(classifyInfo.getMaterialClassifyName()); - safeMaterialInfo.setDepName(depInfo.getDepName()); + safeMaterialInfo.setDepName(currentUser.getDepName()); safeMaterialInfo.setBigClassifyId(req.getBigClassifyId()); + safeMaterialInfo.setId(req.getId()); //跟新 safeMaterialInfoService.updateById(safeMaterialInfo); //创建成功,释放锁 @@ -149,27 +146,22 @@ } @Override - public ResultVO queryById(Long id) { + public ResultVO queryById(ContextCacheUser currentUser,Long id) { if(null == id){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } - SafeMaterialInfo safeMaterialInfo = safeMaterialInfoService.queryById(id); + SafeMaterialDO safeMaterialDO = safeMaterialInfoService.queryById(id); SafeMaterialDto safeMaterialDto = new SafeMaterialDto(); - if(null != safeMaterialInfo){ - SafeMaterialClassifyDO classifyDO = safeMaterialClassifyInfoService.getBigAndSmallClassify(safeMaterialInfo.getSmallClassifyId()); - Integer validStockCount = safeMaterialDetailInfoService.getValidStockCount(safeMaterialInfo.getId()); - BeanUtils.copyProperties(safeMaterialInfo,safeMaterialDto); - safeMaterialDto.setConsumableName(ConsumableEnum.getByCode(safeMaterialInfo.getConsumable()).getValue()); - if(null != classifyDO){ - safeMaterialDto.setBigClassifyName(classifyDO.getBigClassifyName()); + if(null != safeMaterialDO){ + BeanUtils.copyProperties(safeMaterialDO,safeMaterialDto); + if(null != ConsumableEnum.getByCode(safeMaterialDO.getConsumable())){ + safeMaterialDto.setConsumableName(ConsumableEnum.getByCode(safeMaterialDO.getConsumable()).getValue()); } - safeMaterialDto.setValidStockCount(validStockCount); - } return new ResultVO(ResultCodes.OK,safeMaterialDto); } - public ResultVO delete(Long id) { + public ResultVO delete(ContextCacheUser currentUser,Long id) { ResultVO resultVO = null; //加分布式锁,防止重复创建规则 RLock lock = redissonClient.getLock("LOCK_SM_DELETE"); @@ -206,21 +198,19 @@ } @Override - public ResultVO deleteBatch(Long[] ids) { - if(ids.length == 0){ - throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); - } + public ResultVO deleteBatch(ContextCacheUser currentUser, ParamForm paramForm) { + //加分布式锁,防止重复创建规则 RLock lock = redissonClient.getLock("LOCK_SM_DELETEBATCH"); try { lock.lock(10, TimeUnit.SECONDS); - List<Long> idList = Arrays.asList(ids); - int count = safeMaterialDetailInfoService.getCountBySmIds(idList); + + int count = safeMaterialDetailInfoService.getCountBySmIds(paramForm.getIds()); //判断是否绑定具体安全物资数据 if(count > 0){ throw new EquipmentException(EquipmentResultCodes.DATA_HAS_BEEN_BOND,"物资已被绑定物资详情数据,不可删除!"); } - safeMaterialInfoService.deleteBatch(idList); + safeMaterialInfoService.deleteBatch(paramForm.getIds()); //创建成功,释放锁 lock.unlock(); }catch (EquipmentException e) { @@ -237,23 +227,61 @@ return new ResultVO(ResultCodes.OK); } + + /** * 获取列表 * @return */ @Override - public ResultVO list() { + public List<MaterialClassificationDto> listByDepId(ContextCacheUser currentUser) { + //获取所有数据 + List<SafeMaterialInfo> materialInfoList = safeMaterialInfoService.listByDepId(currentUser.getDepId()); + //获取所有物资类型 + List<SafeMaterialClassifyInfo> classifyInfoList = safeMaterialClassifyInfoService.getParentList(); + + List<MaterialClassificationDto> classificationDtoList = new ArrayList<>(); + for (SafeMaterialClassifyInfo classifyInfo:classifyInfoList) { + MaterialClassificationDto classificationDto = new MaterialClassificationDto(); + classificationDto.setMaterialClassifyName(classifyInfo.getMaterialClassifyName()); + classificationDto.setMaterialClassifyId(classifyInfo.getId()); + //过滤出物资数据 + List<SafeMaterialInfo> selectMaterialList = materialInfoList + .stream() + .filter(item -> classifyInfo.getId().equals(item.getBigClassifyId())) + .collect(Collectors.toList()); + List<BaseMaterialDto> baseMaterialDtoList = new ArrayList<>(); + if(selectMaterialList.size()>0){ + //循环物资 + for (SafeMaterialInfo materialInfo:selectMaterialList){ + //填充基础物资数据 + BaseMaterialDto baseMaterialDto = new BaseMaterialDto(); + baseMaterialDto.setMaterialName(materialInfo.getMaterialName()); + baseMaterialDto.setSmId(materialInfo.getId()); + baseMaterialDto.setMaterialName(materialInfo.getMaterialName()); + baseMaterialDto.setConsumable(materialInfo.getConsumable()); + baseMaterialDto.setConsumableName(ConsumableEnum.getByCode(materialInfo.getConsumable()).getValue()); + baseMaterialDtoList.add(baseMaterialDto); + } + classificationDto.setBaseMaterialList(baseMaterialDtoList); + classificationDtoList.add(classificationDto); + } + } + return classificationDtoList; + } + @Override + public List<MaterialDepartmentDto> list(ContextCacheUser currentUser) { //获取所有数据 List<SafeMaterialInfo> materialInfoList = safeMaterialInfoService.list(); //获取所有部门 List<DepRPCRespDTO> depInfoList = getDepInfoList(); //获取所有物资类型 - List<SafeMaterialClassifyInfo> classifyInfoList = safeMaterialClassifyInfoService.getList(); + List<SafeMaterialClassifyInfo> classifyInfoList = safeMaterialClassifyInfoService.getParentList(); //循环部门 List<MaterialDepartmentDto> departmentDtoList = new ArrayList<>(); recursiveDep(depInfoList,departmentDtoList,materialInfoList,classifyInfoList); - return new ResultVO(ResultCodes.OK,departmentDtoList); + return departmentDtoList; } private void recursiveDep(List<DepRPCRespDTO> depInfoList,List<MaterialDepartmentDto> departmentDtoList,List<SafeMaterialInfo> materialInfoList,List<SafeMaterialClassifyInfo> classifyInfoList){ for (DepRPCRespDTO dep:depInfoList){ @@ -295,31 +323,17 @@ } } @Override - public SearchResultVO<List<SafeMaterialDto>> listByPage(PageQuery<SafeMaterialQuery> pageQuery) { + public SearchResultVO<List<SafeMaterialDto>> listByPage(ContextCacheUser currentUser,PageQuery<SafeMaterialQuery> pageQuery) { Page<SafeMaterialDO> page= new Page(pageQuery.getPageIndex(),pageQuery.getPageSize()); - List<SafeMaterialDO> materialInfoList = safeMaterialInfoService.listByPage(page, pageQuery.getSearchParams()); - List<Long> materialIdList = new ArrayList<>(); - List<SafeMaterialDetailCountDO> statisticsList = new ArrayList<>(); - if(materialInfoList.size()>0){ - materialIdList = materialInfoList.stream().map(SafeMaterialDO::getId).collect(Collectors.toList()); - } - if(materialIdList.size()>0){ - statisticsList = safeMaterialDetailInfoService.getStatisticsValidStock(materialIdList); - } + SafeMaterialQuery query = pageQuery.getSearchParams(); + query.setDepId(currentUser.getDepId()); + List<SafeMaterialDO> materialInfoList = safeMaterialInfoService.listByPage(page, query); List<SafeMaterialDto> materialDtoList = new ArrayList<>(); for (SafeMaterialDO materialDO:materialInfoList){ SafeMaterialDto materialDto = new SafeMaterialDto(); BeanUtils.copyProperties(materialDO,materialDto); - materialDto.setConsumableName(ConsumableEnum.getByCode(materialDO.getConsumable()).getValue()); - //过滤出当前物资详细 - List<SafeMaterialDetailCountDO> selectList = statisticsList - .stream() - .filter(item -> item.getSmId().equals(materialDO.getId())) - .collect(Collectors.toList()); - if(selectList.size()>0){ - materialDto.setValidStockCount(selectList.get(0).getCount()); - }else{ - materialDto.setValidStockCount(0); + if(null != ConsumableEnum.getByCode(materialDO.getConsumable())){ + materialDto.setConsumableName(ConsumableEnum.getByCode(materialDO.getConsumable()).getValue()); } materialDtoList.add(materialDto); } diff --git a/equipment/equipment-service/src/main/resources/config/mapper/equipment/MaterialReceiveRecordsBaseInfoMapper.xml b/equipment/equipment-service/src/main/resources/config/mapper/equipment/MaterialReceiveRecordsBaseInfoMapper.xml new file mode 100644 index 0000000..7197c83 --- /dev/null +++ b/equipment/equipment-service/src/main/resources/config/mapper/equipment/MaterialReceiveRecordsBaseInfoMapper.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.safePlatform.equipment.repository.MaterialReceiveRecordsBaseInfoRepository"> + + <resultMap type="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseInfo" id="resultMap"> + <id column="id" property="id" jdbcType="BIGINT"/> + <result column="material_name" property="materialName" jdbcType="VARCHAR"/> + <result column="receive_uid" property="receiveId" jdbcType="BIGINT"/> + <result column="receive_uname" property="receiveName" jdbcType="VARCHAR"/> + <result column="receive_count" property="receiveCount" jdbcType="INTEGER"/> + <result column="revert_count" property="revertCount" jdbcType="INTEGER"/> + <result column="consume_count" property="consumeCount" jdbcType="INTEGER"/> + <result column="status" property="status" jdbcType="TINYINT"/> + <result column="remark" property="remark" jdbcType="VARCHAR"/> + <result column="sm_id" property="smId" jdbcType="BIGINT"/> + <result column="del_flag" property="delFlag" jdbcType="INTEGER"/> + <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> + <result column="create_uid" property="createUid" jdbcType="BIGINT"/> + <result column="create_uname" property="createUname" jdbcType="VARCHAR"/> + <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> + <result column="update_uid" property="updateUid" jdbcType="BIGINT"/> + <result column="update_uname" property="updateUname" jdbcType="VARCHAR"/> + </resultMap> + <select id="listByConditions" resultType="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBaseDO"> + SELECT b.id, + b.material_name, + b.receive_uid, + b.receive_uname, + b.receive_count, + b.revert_count, + b.consume_count, + b.status, + b.remark, + b.create_time, + b.sm_id, + s.dep_id, + s.dep_name + from material_receive_records_base b + inner join safe_material s on b.sm_id = s.id + where b.del_flag = 0 + <if test="query.materialName != null and query.materialName != '' "> + and instr(b.material_name,#{query.materialName})>0 + </if> + <if test="query.receiveUname != null and query.receiveUname != '' "> + and instr(b.receive_uname,#{query.receiveUname})>0 + </if> + <if test="query.depId != null"> + and s.dep_id = #{query.depId} + </if> + <if test="query.startTime != null "> + and DATE_FORMAT(b.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{query.startTime},'%Y-%m-%d') + </if> + <if test="query.endTime != null "> + and DATE_FORMAT(b.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{query.endTime},'%Y-%m-%d') + </if> + order by b.create_time desc + </select> + +</mapper> diff --git a/equipment/equipment-service/src/main/resources/config/mapper/equipment/MaterialReceiveRecordsInfoMapper.xml b/equipment/equipment-service/src/main/resources/config/mapper/equipment/MaterialReceiveRecordsInfoMapper.xml new file mode 100644 index 0000000..aa2f361 --- /dev/null +++ b/equipment/equipment-service/src/main/resources/config/mapper/equipment/MaterialReceiveRecordsInfoMapper.xml @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.safePlatform.equipment.repository.MaterialReceiveRecordsInfoRepository"> + + <resultMap type="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsInfo" id="resultMap"> + <id column="id" property="id" jdbcType="BIGINT"/> + <result column="material_name" property="materialName" jdbcType="VARCHAR"/> + <result column="material_no" property="materialNo" jdbcType="VARCHAR"/> + <result column="rfid" property="rfid" jdbcType="VARCHAR"/> + <result column="revert_status" property="revertStatus" jdbcType="TINYINT"/> + <result column="material_status" property="materialStatus" jdbcType="TINYINT"/> + <result column="smd_id" property="smdId" jdbcType="BIGINT"/> + <result column="receive_uid" property="receiveUid" jdbcType="BIGINT"/> + <result column="receive_uname" property="receiveUname" jdbcType="VARCHAR"/> + <result column="receive_time" property="receiveTime" jdbcType="TIMESTAMP"/> + <result column="receive_base_id" property="receiveBaseId" jdbcType="BIGINT"/> + <result column="remark" property="remark" jdbcType="VARCHAR"/> + <result column="revert_time" property="revertTime" jdbcType="TIMESTAMP"/> + + </resultMap> + <select id="getRecordBySmdId" resultType="com.gkhy.safePlatform.equipment.entity.MaterialDeliveryRecordDO"> + select + r.id as receiveId, + r.material_name, + r.rfid, + r.smd_id, + b.id as receiveBaseId, + b.revert_count, + b.receive_count, + b.receive_uid, + b.status, + b.receive_uname, + b.create_time as receiveTime + from material_receive_records r + inner join material_receive_records_base b + on r.receive_base_id = b.id + where r.smd_id = #{smdId} + and r.revert_status = #{revertStatus} + </select> + <select id="getNoReturnRecordByIds" resultType="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO"> + SELECT + r.id , + r.material_name, + r.rfid, + r.smd_id, + r.material_status, + r.revert_status, + r.receive_uid, + r.receive_uname, + r.receive_time, + r.remark, + r.revert_time, + s.valid_status + FROM + material_receive_records r + INNER JOIN safe_material_detail s ON r.smd_id = s.id + WHERE + r.id in + <foreach collection="idList" item="id" open="(" close=")" separator=","> + #{id} + </foreach> + and r.revert_status = #{revertStatus} + </select> + <select id="getReceiveRecordsByReceiveUids" resultType="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO"> + SELECT + r.id, + r.material_no, + r.material_name, + r.rfid, + r.receive_uid, + r.receive_uname, + r.smd_id, + d.small_classify_id, + d.big_classify_id, + d.consumable, + c.material_classify_name as bigClassifyName + FROM + material_receive_records r + LEFT JOIN safe_material_detail d ON r.smd_id = d.id + LEFT JOIN safe_material_classify c on d.big_classify_id = c.id + where r.revert_status = 1 and r.receive_uid in + <foreach collection="receiveUids" item="receiveUid" separator="," open="(" close=")"> + #{receiveUid} + </foreach> + and d.small_classify_id in + <foreach collection="smallClassifyIds" item="smallClassifyId" separator="," open="(" close=")"> + #{smallClassifyId} + </foreach> + </select> + + +</mapper> diff --git a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialClassifyInfoMapper.xml b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialClassifyInfoMapper.xml index 616d946..f8dee00 100644 --- a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialClassifyInfoMapper.xml +++ b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialClassifyInfoMapper.xml @@ -6,7 +6,7 @@ <!--新增--> <insert id="save" parameterType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo"> - insert into safe_material_classify (id,material_classify_name,parent_id,del_flag,create_time,create_uid,create_uname,update_time,update_uid,update_uname) values (#{id},#{materialClassifyName},#{parentId},#{delFlag},#{createTime},#{createUid},#{createUname},#{updateTime},#{updateUid},#{updateUname}) + insert into safe_material_classify (id,material_classify_name,parent_id,consumable,del_flag,create_time,create_uid,create_uname,update_time,update_uid,update_uname) values (#{id},#{materialClassifyName},#{parentId},#{consumable},#{delFlag},#{createTime},#{createUid},#{createUname},#{updateTime},#{updateUid},#{updateUname}) </insert> <!--更新--> <update id="update" parameterType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo"> @@ -24,7 +24,7 @@ </update> <!--查询单条数据--> <select id="queryById" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo"> - select id,material_classify_name,parent_id,create_time,create_uid,create_uname,update_time,update_uid,update_uname from safe_material_classify where id = #{id} and del_flag = 0; + select id,material_classify_name,parent_id,consumable,create_time,create_uid,create_uname,update_time,update_uid,update_uname from safe_material_classify where id = #{id} and del_flag = 0; </select> <select id="listByContion" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo"> select id, @@ -71,12 +71,12 @@ SELECT id, parent_id, - material_classify_name + material_classify_name, + consumable FROM safe_material_classify - WHERE - parent_id = 0 - AND del_flag = 0 + WHERE del_flag = 0 + and parent_id = 0 <if test="query.classifyName != null and query.classifyName != ''"> and instr(material_classify_name,#{query.classifyName}) > 0 </if> @@ -85,7 +85,8 @@ SELECT id, parent_id, - material_classify_name + material_classify_name, + consumable FROM safe_material_classify WHERE diff --git a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml index 8394b25..6ea5708 100644 --- a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml +++ b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml @@ -15,12 +15,14 @@ <result column="valid_type" property="validType" jdbcType="TINYINT"/> <result column="valid_time" property="validTime" jdbcType="TIMESTAMP"/> <result column="valid_status" property="validStatus" jdbcType="TINYINT"/> + <result column="status" property="status" jdbcType="TINYINT"/> <result column="ir_status" property="irStatus" jdbcType="TINYINT"/> <result column="ware_housing_time" property="wareHousingTime" jdbcType="TIMESTAMP"/> <result column="delivery_time" property="deliveryTime" jdbcType="TIMESTAMP"/> <result column="sm_id" property="smId" jdbcType="BIGINT"/> - <result column="claimant_id" property="claimantId" jdbcType="BIGINT"/> - <result column="claimant_name" property="claimantName" jdbcType="VARCHAR"/> + <result column="receive_uid" property="receiveUid" jdbcType="BIGINT"/> + <result column="receive_uname" property="receiveUname" jdbcType="VARCHAR"/> + <result column="remark" property="remark" jdbcType="VARCHAR"/> <result column="del_flag" property="delFlag" jdbcType="INTEGER"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_uid" property="createUid" jdbcType="BIGINT"/> @@ -35,7 +37,7 @@ </select> <select id="queryById" resultMap="materialDetailResult"> select id, - CONCAT(name,'(ID',sm_id,')') as name, + name, material_no, big_classify_id, rfid, @@ -43,25 +45,27 @@ valid_type, valid_time, valid_status, + status, ir_status, - ware_housing_time, ware_housing_time, delivery_time, sm_id, - claimant_id, - claimant_name + receive_uid, + receive_uname from safe_material_detail where del_flag = 0 and id = #{id} </select> <update id="updateReceiptStatus" > update safe_material_detail set ir_status = #{status}, ware_housing_time = #{wareHousingTime}, - claimant_id = null, - claimant_name = null + receive_uid = null, + receive_uname = null, + delivery_time = null where id = #{id} </update> <select id="getListByIds" resultMap="materialDetailResult"> - select id,name,material_no,big_classify_id,rfid,consumable,valid_type,valid_time,valid_status,ir_status,ware_housing_time,ware_housing_time,delivery_time,sm_id,claimant_id,claimant_name + select id,name,material_no,big_classify_id,rfid,consumable,valid_type,valid_time,valid_status,status,ir_status,ware_housing_time,ware_housing_time,delivery_time,sm_id,receive_uid, + receive_uname,remark from safe_material_detail where del_flag = 0 and id in @@ -73,8 +77,10 @@ update safe_material_detail set ir_status = #{irStatus}, ware_housing_time = #{wareHousingTime}, - claimant_id = null, - claimant_name = null where id in + receive_uid = null, + receive_uname = null, + delivery_time = null + where id in <foreach collection="ids" item="id" separator="," open="(" close=")"> #{id} </foreach> @@ -115,26 +121,13 @@ <update id="updateDeliveryStatusByIds" > update safe_material_detail set ir_status = #{detailBO.irStatus}, - claimant_id = #{detailBO.claimantId}, - claimant_name = #{detailBO.claimantName}, + receive_uid = #{detailBO.receiveUid}, + receive_uname = #{detailBO.receiveUname}, delivery_time = #{detailBO.deliveryTime} where id in <foreach collection="detailBO.ids" item="id" separator="," open="(" close=")"> #{id} </foreach> - </update> - <!--批量出库-随机--> - <update id="deliveryBatchRandom" > - update safe_material_detail - set ir_status = #{detailBO.irStatus}, - claimant_id = #{detailBO.claimantId}, - claimant_name = #{detailBO.claimantName}, - delivery_time = #{detailBO.deliveryTime} - where id in - <foreach collection="detailBO.ids" item="id" separator="," open="(" close=")" > - #{id} - </foreach> - </update> <select id="getValidStockCount" resultType="java.lang.Integer"> @@ -147,7 +140,7 @@ </select> <select id="listByCondition" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfoDO"> select sd.id, - CONCAT(sd.name,'(ID',sd.sm_id,')') as name, + CONCAT(sd.name,'(',sm.serial_num,')') as name, sd.material_no, sd.big_classify_id, sd.rfid, @@ -155,9 +148,11 @@ sd.valid_type, sd.valid_time, sd.valid_status, + sd.status, + sd.remark, sd.ir_status, sd.ware_housing_time, - sd.claimant_name, + sd.receive_uname, sd.delivery_time, sm.dep_id, sm.dep_name, @@ -175,6 +170,9 @@ </if> <if test="query.smId != null"> and sd.sm_id = #{query.smId} + </if> + <if test="query.depId != null"> + and sm.dep_id = #{query.depId} </if> ORDER BY sd.create_time desc </select> @@ -201,8 +199,43 @@ <select id="getRfidNullList" resultType="java.lang.Long"> select id from safe_material_detail where sm_id = #{smId} and ir_status = 0 and valid_status = 0 and del_flag = 0 and rfid is null ORDER BY ware_housing_time asc LIMIT #{count} </select> - <select id="getIdListByRfid" resultType="java.lang.Long"> - select id from safe_material_detail where sm_id = #{smId} and ir_status = 0 and valid_status = 0 and del_flag = 0 and rfid = #{rfid} ORDER BY ware_housing_time asc LIMIT #{count} + <select id="getListBySmIdAndRfid" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfo"> + select id, + name, + material_no, + big_classify_id, + rfid, + consumable, + valid_type, + valid_time, + valid_status, + status, + ir_status, + ware_housing_time, + delivery_time, + sm_id, + receive_uid, + receive_uname + from safe_material_detail where del_flag = 0 and sm_id = #{query.smId} and ir_status = #{query.irStatus} and valid_status = #{query.validStatus} and rfid = #{query.rfid} ORDER BY create_time asc LIMIT #{query.count} + </select> + <select id="getListBySmId" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfo"> + select id, + name, + material_no, + big_classify_id, + rfid, + consumable, + valid_type, + valid_time, + valid_status, + status, + ir_status, + ware_housing_time, + delivery_time, + sm_id, + receive_uid, + receive_uname + from safe_material_detail where del_flag = 0 and sm_id = #{query.smId} and ir_status = #{query.irStatus} and valid_status = #{query.validStatus} ORDER BY create_time asc LIMIT #{query.count} </select> <select id="getSmallClassifyStockByIds" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyStockDO"> select d.small_classify_id, @@ -264,4 +297,63 @@ #{rfid} </foreach> </select> + <select id="updateValidStatusByIds" > + update safe_material_detail set valid_status = #{validStatus} where id in + <foreach collection="ids" item="id" separator="," open="(" close=")"> + #{id} + </foreach> + </select> + <select id="getUnValidList" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfo"> + select + id, + name, + material_no, + big_classify_id, + rfid, + consumable, + valid_type, + valid_time, + valid_status, + ir_status, + ware_housing_time, + ware_housing_time, + delivery_time, + sm_id, + receive_uid, + receive_uname + from safe_material_detail + where del_flag = 0 + and valid_status = #{validStatus} + and DATE_FORMAT(valid_time,'%Y%m%d') < DATE_FORMAT(CURDATE( ),'%Y%m%d') + </select> + <update id="updateBatch" parameterType="java.util.List"> + <foreach collection="list" item="item" index="index" open="" close="" separator=";"> + update safe_material_detail + <trim prefix="SET" suffixOverrides=","> + <if test="null != item.receiveUid"> + receive_uid = #{item.receiveUid}, + </if> + <if test="null != item.receiveUname and '' != item.receiveUname"> + receive_uname = #{item.receiveUname}, + </if> + <if test="null != item.irStatus"> + ir_status = #{item.irStatus}, + </if> + <if test="null != item.deliveryTime"> + delivery_time = #{item.deliveryTime} + </if> + <if test="null != item.validStatus"> + valid_status = #{item.validStatus} + </if> + <if test="null != item.remark and '' != item.remark"> + remark = #{item.remark} + </if> + <if test="null != item.status"> + status = #{item.status} + </if> + + </trim> + where id = #{item.id} + </foreach> + </update> </mapper> diff --git a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml index e7f4763..49f481a 100644 --- a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml +++ b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml @@ -13,6 +13,8 @@ <result column="dep_name" property="depName" jdbcType="VARCHAR"/> <result column="material_name" property="materilaName" jdbcType="VARCHAR"/> <result column="consumable" property="consumable" jdbcType="TINYINT"/> + <result column="total_count" property="totalCount" jdbcType="INTEGER"/> + <result column="stock_count" property="stockCount" jdbcType="INTEGER"/> <result column="del_flag" property="delFlag" jdbcType="INTEGER"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_uid" property="createUid" jdbcType="BIGINT"/> @@ -22,8 +24,25 @@ <result column="update_uname" property="updateUname" jdbcType="VARCHAR"/> </resultMap> <!--查询单条数据--> - <select id="queryById" resultMap="materialResult"> - select id,serial_num,small_classify_id,big_classify_id,dep_id,dep_name,material_name,consumable,del_flag,create_time,create_uid,create_uname,update_time,update_uid,update_uname from safe_material where id = #{id} and del_flag = 0; + <select id="queryById" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDO"> + select m.id, + m.serial_num, + m.big_classify_id as bigClassifyId, + m.small_classify_id as smallClassifyId, + m.dep_id, + m.dep_name, + m.material_name, + m.consumable, + m.stock_count, + m.total_count, + m.create_time, + m.material_name as smallClassifyName, + c.material_classify_name as bigClassifyName + from safe_material m + inner join safe_material_classify c + on m.big_classify_id = c.id + where m.del_flag = 0 + and m.id = #{id}; </select> <!--查询所有数量--> <select id="getTotalCount" resultType="java.lang.Integer"> @@ -49,6 +68,10 @@ m.dep_name, m.material_name, m.consumable, + m.stock_count, + m.total_count, + m.create_time, + m.material_name as smallClassifyName, c.material_classify_name as bigClassifyName from safe_material m inner join safe_material_classify c @@ -59,6 +82,9 @@ </if> <if test="query.bigClassifyId != null"> and m.big_classify_id = #{query.bigClassifyId} + </if> + <if test="query.depId != null"> + and m.dep_id = #{query.depId} </if> order by m.create_time desc </select> @@ -72,5 +98,32 @@ and id != #{id} </if> </select> + <update id="updateCountById"> + update safe_material + <trim prefix="SET" suffixOverrides=","> + <if test="totalCount != null"> + total_count = total_count + #{totalCount}, + </if> + <if test="stockCount != null"> + stock_count = stock_count + #{stockCount}, + </if> + </trim> + where id = #{id} + </update> + <update id="updateStockCount"> + <foreach collection="safeMaterialBOList" item="safeMaterialBO" separator=";"> + update safe_material + <trim prefix="SET" suffixOverrides=","> + <if test="safeMaterialBO.totalCount != null"> + total_count = total_count + #{safeMaterialBO.totalCount}, + </if> + <if test="safeMaterialBO.stockCount != null"> + stock_count = stock_count + #{safeMaterialBO.stockCount} + </if> + </trim> + where id = #{safeMaterialBO.id} + </foreach> + + </update> </mapper> -- Gitblit v1.9.2