zhangfeng
2022-11-21 99968f83982943669af3829ea6bc3bbe745cada4
安全物资和设备管理相关rpc接口
已修改38个文件
已添加14个文件
已删除1个文件
2036 ■■■■ 文件已修改
equipment/equipment-rpc-api/pom.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/EquipmentDemoRpcAPi.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/EquipmentRpcAPi.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/req/MaterialSpwDeliveryRPCReq.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/req/MaterialSpwRPCReq.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialBsClassifyRPCRespDto.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialClassifyRPCRespDto.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialClassifyStockRPCRespDto.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeRfidMaterialDetailRPCRespDto.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-provider/src/main/java/com/gkhy/safePlatform/equipment/rpc/provider/EquipmentRpcProvider.java 200 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyDO.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyInfo.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyStockDO.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDO.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailCountDO.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailDO.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfo.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfoDO.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialInfo.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/EquipmentResultCodes.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialSpwDeliveryReq.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialSpwReq.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialRandomDeliveryReq.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialAddReq.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyAddReq.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialModReq.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialQuery.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialClassificationDto.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialDepartmentDto.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialClassifyDto.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialClassifyStockDto.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDetailDto.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDto.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeRfidMaterialDetailDto.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialClassifyInfoRepository.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialDetailInfoRepository.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialInfoRepository.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialClassifyService.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialDetailService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialClassifyInfoService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialDetailInfoService.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialInfoService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialClassifyInfoServiceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialDetailInfoServiceImpl.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialClassifyServiceImpl.java 152 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialDetailServiceImpl.java 189 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialServiceImpl.java 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialClassifyInfoMapper.xml 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-rpc-api/pom.xml
@@ -9,7 +9,14 @@
    </parent>-->
    <modelVersion>4.0.0</modelVersion>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>com.gkhy.safePlatfrom</groupId>
            <artifactId>commons</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <groupId>com.gkhy.safePlatfrom</groupId>
    <artifactId>equipment-rpc-api</artifactId>
    <version>1.0-SNAPSHOT</version>
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/EquipmentDemoRpcAPi.java
文件已删除
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/EquipmentRpcAPi.java
对比新文件
@@ -0,0 +1,51 @@
package com.gkhy.safePlatform.equipment.rpc.api;
import com.gkhy.safePlatform.commons.vo.ResultVO;
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 java.util.List;
public interface EquipmentRpcAPi {
    /**
     * 物资类型分类
     */
    ResultVO<List<SafeMaterialClassifyRPCRespDto>> getMaterialClassifyList();
    /**
     * 根据小类溯源到父类信息
     * @param smallClassifyIds
     * @return
     */
    ResultVO<List<SafeMaterialBsClassifyRPCRespDto>> getTraceabilityClassifyList(List<Long> smallClassifyIds);
    /**
     * 根据小类溯源到父类信息 列表
     * @param smallClassifyId
     * @return
     */
    ResultVO<SafeMaterialBsClassifyRPCRespDto> getBigAndSmallClassifyInfo(Long smallClassifyId);
    /**
     * 根据小类ids查询物资种类
     */
    ResultVO<List<SafeMaterialClassifyRPCRespDto>> getClassifyListByIds(List<Long> ids);
    /**
     * 根据物资种类(小类)获取其库存
     */
    ResultVO<List<SafeMaterialClassifyStockRPCRespDto>> getSmallClassifyStockByIds(List<Long> smallClassifyIds);
    /**
     * 特殊作业批量出库
     */
    ResultVO deliveryBatchSpw(MaterialSpwRPCReq req);
    /**
     * 根据rfids获取物资
     */
    ResultVO<List<SafeRfidMaterialDetailRPCRespDto>> getListByRfid(List<String> rfids);
}
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/req/MaterialSpwDeliveryRPCReq.java
对比新文件
@@ -0,0 +1,35 @@
package com.gkhy.safePlatform.equipment.rpc.api.model.dto.req;
public class MaterialSpwDeliveryRPCReq {
    private Integer count;
    private Long smallClassifyId;
    private Long depId;
    public Integer getCount() {
        return count;
    }
    public void setCount(Integer count) {
        this.count = count;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public Long getDepId() {
        return depId;
    }
    public void setDepId(Long depId) {
        this.depId = depId;
    }
}
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/req/MaterialSpwRPCReq.java
对比新文件
@@ -0,0 +1,27 @@
package com.gkhy.safePlatform.equipment.rpc.api.model.dto.req;
import java.util.List;
public class MaterialSpwRPCReq {
    private Long claimantId;
    private List<MaterialSpwDeliveryRPCReq> deliveryReqList;
    public Long getClaimantId() {
        return claimantId;
    }
    public void setClaimantId(Long claimantId) {
        this.claimantId = claimantId;
    }
    public List<MaterialSpwDeliveryRPCReq> getDeliveryReqList() {
        return deliveryReqList;
    }
    public void setDeliveryReqList(List<MaterialSpwDeliveryRPCReq> deliveryReqList) {
        this.deliveryReqList = deliveryReqList;
    }
}
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialBsClassifyRPCRespDto.java
对比新文件
@@ -0,0 +1,40 @@
package com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp;
public class SafeMaterialBsClassifyRPCRespDto {
    private Long smallClassifyId;
    private String smallClassifyName;
    private Long bigClassifyId;
    private String bigClassifyName;
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public String getSmallClassifyName() {
        return smallClassifyName;
    }
    public void setSmallClassifyName(String smallClassifyName) {
        this.smallClassifyName = smallClassifyName;
    }
    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;
    }
}
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialClassifyRPCRespDto.java
对比新文件
@@ -0,0 +1,44 @@
package com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp;
import java.util.List;
public class SafeMaterialClassifyRPCRespDto {
    private Long id;
    private String materialClassifyName;
    private Long parentId;
    private List<SafeMaterialClassifyRPCRespDto> childList;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getMaterialClassifyName() {
        return materialClassifyName;
    }
    public void setMaterialClassifyName(String materialClassifyName) {
        this.materialClassifyName = materialClassifyName;
    }
    public Long getParentId() {
        return parentId;
    }
    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }
    public List<SafeMaterialClassifyRPCRespDto> getChildList() {
        return childList;
    }
    public void setChildList(List<SafeMaterialClassifyRPCRespDto> childList) {
        this.childList = childList;
    }
}
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeMaterialClassifyStockRPCRespDto.java
对比新文件
@@ -0,0 +1,40 @@
package com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp;
public class SafeMaterialClassifyStockRPCRespDto {
    private Long smallClassifyId;
    private Long depId;
    private String depName;
    private Integer stockCount;
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    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 getStockCount() {
        return stockCount;
    }
    public void setStockCount(Integer stockCount) {
        this.stockCount = stockCount;
    }
}
equipment/equipment-rpc-api/src/main/java/com/gkhy/safePlatform/equipment/rpc/api/model/dto/resp/SafeRfidMaterialDetailRPCRespDto.java
对比新文件
@@ -0,0 +1,52 @@
package com.gkhy.safePlatform.equipment.rpc.api.model.dto.resp;
public class SafeRfidMaterialDetailRPCRespDto {
    private Long id;
    private String name;
    private Long bigClassifyId;
    private Long smallClassifyId;
    private Long depId;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Long getBigClassifyId() {
        return bigClassifyId;
    }
    public void setBigClassifyId(Long bigClassifyId) {
        this.bigClassifyId = bigClassifyId;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public Long getDepId() {
        return depId;
    }
    public void setDepId(Long depId) {
        this.depId = depId;
    }
}
equipment/equipment-rpc-provider/src/main/java/com/gkhy/safePlatform/equipment/rpc/provider/EquipmentRpcProvider.java
对比新文件
@@ -0,0 +1,200 @@
package com.gkhy.safePlatform.equipment.rpc.provider;
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.SafeMaterialClassifyDO;
import com.gkhy.safePlatform.equipment.excepiton.EquipmentException;
import com.gkhy.safePlatform.equipment.model.dto.req.MaterialSpwDeliveryReq;
import com.gkhy.safePlatform.equipment.model.dto.req.MaterialSpwReq;
import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyDto;
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.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.service.MaterialClassifyService;
import com.gkhy.safePlatform.equipment.service.SafeMaterialDetailService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
@DubboService
public class EquipmentRpcProvider implements EquipmentRpcAPi {
    @Autowired
    private MaterialClassifyService materialClassifyService;
    @Autowired
    private SafeMaterialDetailService safeMaterialDetailService;
    public ResultVO<List<SafeMaterialClassifyRPCRespDto>> getMaterialClassifyList(){
      ResultVO<List<SafeMaterialClassifyRPCRespDto>> resultVO = new ResultVO(ResultCodes.OK);
        List<SafeMaterialClassifyDto> list = materialClassifyService.list();
        List<SafeMaterialClassifyRPCRespDto> rpcRespList = new ArrayList<>();
        for (SafeMaterialClassifyDto classifyDto:list) {
            SafeMaterialClassifyRPCRespDto classifyRPCRespDto = new SafeMaterialClassifyRPCRespDto();
            classifyRPCRespDto.setId(classifyDto.getId());
            classifyRPCRespDto.setParentId(classifyDto.getParentId());
            classifyRPCRespDto.setMaterialClassifyName(classifyDto.getMaterialClassifyName());
            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);
            }
            classifyRPCRespDto.setChildList(childRPCList);
            rpcRespList.add(classifyRPCRespDto);
        }
       resultVO.setData(rpcRespList);
       return resultVO;
    }
    @Override
    public ResultVO<List<SafeMaterialBsClassifyRPCRespDto>> getTraceabilityClassifyList(List<Long> smallClassifyIds) {
        ResultVO<List<SafeMaterialBsClassifyRPCRespDto>> resultVO = new ResultVO<>(ResultCodes.OK);
        try {
            List<SafeMaterialClassifyDO> list = materialClassifyService.getTraceabilityClassifyList(smallClassifyIds);
            List<SafeMaterialBsClassifyRPCRespDto> classifyRPCRespDtoList= new ArrayList<>();
            for(SafeMaterialClassifyDO classifyDO:list){
                SafeMaterialBsClassifyRPCRespDto bsClassifyRPCRespDto = new SafeMaterialBsClassifyRPCRespDto();
                BeanUtils.copyProperties(classifyDO,bsClassifyRPCRespDto);
                classifyRPCRespDtoList.add(bsClassifyRPCRespDto);
            }
            resultVO.setData(classifyRPCRespDtoList);
        }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;
    }
    public ResultVO<SafeMaterialBsClassifyRPCRespDto> getBigAndSmallClassifyInfo(Long smallClassifyId){
        ResultVO<SafeMaterialBsClassifyRPCRespDto> resultVO = new ResultVO<>(ResultCodes.OK);
        try {
            SafeMaterialClassifyDO safeMaterialClassifyDO = materialClassifyService.getBigAndSmallClassifyInfo(smallClassifyId);
            SafeMaterialBsClassifyRPCRespDto bsClassifyRPCRespDto = new SafeMaterialBsClassifyRPCRespDto();
            if(null != safeMaterialClassifyDO){
                BeanUtils.copyProperties(safeMaterialClassifyDO,bsClassifyRPCRespDto);
            }
            resultVO.setData(bsClassifyRPCRespDto);
        }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;
    }
    @Override
    public ResultVO<List<SafeMaterialClassifyRPCRespDto>> getClassifyListByIds(List<Long> ids) {
        ResultVO<List<SafeMaterialClassifyRPCRespDto>> resultVO = new ResultVO<>(ResultCodes.OK);
        try {
            List<SafeMaterialClassifyDto> listBySmallClassify = materialClassifyService.getClassifyListByIds(ids);
            List<SafeMaterialClassifyRPCRespDto> classifyRPCRespDtoList = new ArrayList<>();
            for(SafeMaterialClassifyDto classifyDto:listBySmallClassify){
                SafeMaterialClassifyRPCRespDto classifyRPCRespDto = new SafeMaterialClassifyRPCRespDto();
                BeanUtils.copyProperties(classifyDto,classifyRPCRespDto);
                classifyRPCRespDtoList.add(classifyRPCRespDto);
            }
            resultVO.setData(classifyRPCRespDtoList);
        }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;
    }
    @Override
    public ResultVO<List<SafeMaterialClassifyStockRPCRespDto>> getSmallClassifyStockByIds(List<Long> smallClassifyIds) {
        ResultVO<List<SafeMaterialClassifyStockRPCRespDto>> resultVO = new ResultVO<>(ResultCodes.OK);
        try {
            List<SafeMaterialClassifyStockDto> smallClassifyStockList  = safeMaterialDetailService.getSmallClassifyStockByIds(smallClassifyIds);
            List<SafeMaterialClassifyStockRPCRespDto> classifyRPCRespDtoList = new ArrayList<>();
            for(SafeMaterialClassifyStockDto classifyStockDto:smallClassifyStockList){
                SafeMaterialClassifyStockRPCRespDto classifyRPCRespDto = new SafeMaterialClassifyStockRPCRespDto();
                BeanUtils.copyProperties(classifyStockDto,classifyRPCRespDto);
                classifyRPCRespDtoList.add(classifyRPCRespDto);
            }
            resultVO.setData(classifyRPCRespDtoList);
        }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;
    }
    @Override
    public ResultVO deliveryBatchSpw(MaterialSpwRPCReq req) {
        ResultVO resultVO = new ResultVO<>(ResultCodes.OK);
        MaterialSpwReq materialSpwReq = new MaterialSpwReq();
        List<MaterialSpwDeliveryReq> list = new ArrayList<>();
        List<MaterialSpwDeliveryRPCReq> deliveryRPCReqList = req.getDeliveryReqList();
        if(!CollectionUtils.isEmpty(deliveryRPCReqList)){
            for (MaterialSpwDeliveryRPCReq deliveryRPCReq:deliveryRPCReqList) {
                MaterialSpwDeliveryReq deliveryReq = new MaterialSpwDeliveryReq();
                BeanUtils.copyProperties(deliveryRPCReq,deliveryReq);
                list.add(deliveryReq);
            }
        }
        materialSpwReq.setClaimantId(req.getClaimantId());
        materialSpwReq.setDeliveryReqList(list);
        try {
            safeMaterialDetailService.deliveryBatchSpw(materialSpwReq);
        }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;
    }
    @Override
    public ResultVO<List<SafeRfidMaterialDetailRPCRespDto>> getListByRfid(List<String> rfids) {
        ResultVO resultVO = new ResultVO<>(ResultCodes.OK);
        try {
            List<SafeRfidMaterialDetailDto> listByRfids = safeMaterialDetailService.getListByRfids(rfids);
            if(listByRfids.size()>0){
                List<SafeRfidMaterialDetailRPCRespDto> safeRfidMaterialDetailRPCRespDtos = BeanCopyUtils.copyBeanList(listByRfids, SafeRfidMaterialDetailRPCRespDto.class);
                resultVO.setData(safeRfidMaterialDetailRPCRespDtos);
            }
        }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;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSONObject;
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyAddReq;
import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyModReq;
@@ -28,9 +29,9 @@
     * @return
     */
    @PostMapping(value = "/list")
    public ResultVO<List<SafeMaterialClassifyDto>> list(Authentication authentication, @RequestBody SafeMaterialClassifyQuery query){
    public ResultVO<List<SafeMaterialClassifyDto>> list(Authentication authentication){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return materialClassifyService.list(query);
        return new ResultVO<>(ResultCodes.OK,materialClassifyService.list());
    }
@@ -71,6 +72,6 @@
    @PostMapping(value = "queryById")
    public ResultVO<SafeMaterialClassifyDto> queryById(Authentication authentication, @RequestBody JSONObject jsonObject){
        Long id = jsonObject.getLong("id");
        return materialClassifyService.queryById(id);
        return new ResultVO<>(ResultCodes.OK,materialClassifyService.queryById(id));
    }
}
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.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
@@ -144,5 +145,23 @@
        Long id = jsonObject.getLong("id");
        return safeMaterialDetailService.queryById(id);
    }
    /**
     * 特殊作业批量出库接口
     * @param authentication
     * @return
     */
    @PostMapping(value = "/deliveryBatchSpw")
    public ResultVO deliveryBatchSpw(Authentication authentication, @Validated @RequestBody MaterialSpwReq req){
        safeMaterialDetailService.deliveryBatchSpw(req);
        return new ResultVO<>(ResultCodes.OK);
    }
 /*   *//**
     * 根据rfid获去数据
     * @param authentication
     * @return
     *//*
    @PostMapping(value = "/rfid/list")
    public ResultVO getListByRfid(Authentication authentication, @RequestBody String[] rfids){
        return new ResultVO(ResultCodes.OK,safeMaterialDetailService.getListByRfids(rfids));
    }*/
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyDO.java
@@ -1,22 +1,40 @@
package com.gkhy.safePlatform.equipment.entity;
public class SafeMaterialClassifyDO {
    private Long id;
    private String materialClassifyName;
    private Long smallClassifyId;
    private String smallClassifyName;
    private Long bigClassifyId;
    private String bigClassifyName;
    public Long getId() {
        return id;
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setId(Long id) {
        this.id = id;
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public String getMaterialClassifyName() {
        return materialClassifyName;
    public String getSmallClassifyName() {
        return smallClassifyName;
    }
    public void setMaterialClassifyName(String materialClassifyName) {
        this.materialClassifyName = materialClassifyName;
    public void setSmallClassifyName(String smallClassifyName) {
        this.smallClassifyName = smallClassifyName;
    }
    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;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyInfo.java
@@ -18,6 +18,10 @@
     */
    private String materialClassifyName;
    /**
     * 父级id
     */
    private Long parentId;
    /**
     * 删除标识
     */
    @TableField(fill = FieldFill.INSERT) //自动填充的注解
@@ -128,4 +132,12 @@
    public void setUpdateUname(String updateUname) {
        this.updateUname = updateUname;
    }
    public Long getParentId() {
        return parentId;
    }
    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialClassifyStockDO.java
对比新文件
@@ -0,0 +1,44 @@
package com.gkhy.safePlatform.equipment.entity;
public class SafeMaterialClassifyStockDO {
    private Long smallClassifyId;
    private Long depId;
    private String depName;
    private Integer stockCount;
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    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 getStockCount() {
        return stockCount;
    }
    public void setStockCount(Integer stockCount) {
        this.stockCount = stockCount;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDO.java
@@ -20,9 +20,11 @@
    /**
     * 物资类型id
     */
    private Long materialClassifyId;
    private Long bigClassifyId;
    private String materialClassifyName;
    private String bigClassifyName;
    private Long smallClassifyId;
    /**
     * 部门id
     */
@@ -94,13 +96,7 @@
        this.serialNum = serialNum;
    }
    public Long getMaterialClassifyId() {
        return materialClassifyId;
    }
    public void setMaterialClassifyId(Long materialClassifyId) {
        this.materialClassifyId = materialClassifyId;
    }
    public Long getDepId() {
        return depId;
@@ -190,11 +186,27 @@
        this.updateTime = updateTime;
    }
    public String getMaterialClassifyName() {
        return materialClassifyName;
    public Long getBigClassifyId() {
        return bigClassifyId;
    }
    public void setMaterialClassifyName(String materialClassifyName) {
        this.materialClassifyName = materialClassifyName;
    public void setBigClassifyId(Long bigClassifyId) {
        this.bigClassifyId = bigClassifyId;
    }
    public String getBigClassifyName() {
        return bigClassifyName;
    }
    public void setBigClassifyName(String bigClassifyName) {
        this.bigClassifyName = bigClassifyName;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailCountDO.java
@@ -4,6 +4,8 @@
    private Long smId;
    private Integer count;
    private Long smallClassifyId;
    public Long getSmId() {
        return smId;
    }
@@ -19,4 +21,12 @@
    public void setCount(Integer count) {
        this.count = count;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailDO.java
对比新文件
@@ -0,0 +1,49 @@
package com.gkhy.safePlatform.equipment.entity;
public class SafeMaterialDetailDO {
    private Long id;
    private String rfid;
    private Long depId;
    private Long smallClassifyId;
    private Long bigClassifyId;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getRfid() {
        return rfid;
    }
    public void setRfid(String rfid) {
        this.rfid = rfid;
    }
    public Long getDepId() {
        return depId;
    }
    public void setDepId(Long depId) {
        this.depId = depId;
    }
    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;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfo.java
@@ -24,9 +24,13 @@
     */
    private String materialNo;
    /**
     * 物资类型id
     * 物资类型id 大类
     */
    private Long materialClassifyId;
    private Long bigClassifyId;
    /**
     * 物资类型id 小类
     */
    private Long smallClassifyId;
    /**
     * RFID
     */
@@ -135,12 +139,20 @@
        this.materialNo = materialNo;
    }
    public Long getMaterialClassifyId() {
        return materialClassifyId;
    public Long getBigClassifyId() {
        return bigClassifyId;
    }
    public void setMaterialClassifyId(Long materialClassifyId) {
        this.materialClassifyId = materialClassifyId;
    public void setBigClassifyId(Long bigClassifyId) {
        this.bigClassifyId = bigClassifyId;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public String getRfid() {
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialDetailInfoDO.java
@@ -18,14 +18,15 @@
     * 物资编号
     */
    private String materialNo;
    private Long smallClassifyId;
    /**
     * 物资类型id
     */
    private Long materialClassifyId;
    private Long bigClassifyId;
    /**
     * 物资类型名称
     */
    private String materialClassifyName;
    private String bigClassifyName;
    /**
     * RFID
     */
@@ -108,20 +109,20 @@
        this.materialNo = materialNo;
    }
    public Long getMaterialClassifyId() {
        return materialClassifyId;
    public Long getBigClassifyId() {
        return bigClassifyId;
    }
    public void setMaterialClassifyId(Long materialClassifyId) {
        this.materialClassifyId = materialClassifyId;
    public void setBigClassifyId(Long bigClassifyId) {
        this.bigClassifyId = bigClassifyId;
    }
    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 getRfid() {
@@ -227,4 +228,12 @@
    public void setClaimantName(String claimantName) {
        this.claimantName = claimantName;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/entity/SafeMaterialInfo.java
@@ -20,9 +20,13 @@
     */
    private String serialNum;
    /**
     * 物资类型id
     * 物资类型id 大类
     */
    private Long materialClassifyId;
    private Long bigClassifyId;
    /**
     * 物资类型 小类
     */
    private Long smallClassifyId;
    /**
     * 部门id
     */
@@ -94,12 +98,20 @@
        this.serialNum = serialNum;
    }
    public Long getMaterialClassifyId() {
        return materialClassifyId;
    public Long getBigClassifyId() {
        return bigClassifyId;
    }
    public void setMaterialClassifyId(Long materialClassifyId) {
        this.materialClassifyId = materialClassifyId;
    public void setBigClassifyId(Long bigClassifyId) {
        this.bigClassifyId = bigClassifyId;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public Long getDepId() {
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/enums/EquipmentResultCodes.java
@@ -14,7 +14,9 @@
    DATA_NOT_EXIST("E1005","数据不存在"),
    MATERIAL_INVALID("E1006","物资无效"),
    MATERIAL_OUT_OF_LIBRARY("E1007","物资已出库,不可再次出库"),
    MATERIAL_IN_THE_LIBRARY("E1007","物资已入库,不可再次入库"),
    MATERIAL_IN_THE_LIBRARY("E1008","物资已入库,不可再次入库"),
    MATERIAL_CONSUMABLE("E1009","耗材物资不可重新入库"),
    DATA_EXIST("E1010","数据已存在"),
    ERROR("A3000", "未知错误");
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialSpwDeliveryReq.java
对比新文件
@@ -0,0 +1,39 @@
package com.gkhy.safePlatform.equipment.model.dto.req;
import javax.validation.constraints.NotNull;
public class MaterialSpwDeliveryReq {
    @NotNull(message = "主键不可为空!")
    private Integer count;
    @NotNull(message = "物资主键不可为空!")
    private Long smallClassifyId;
    @NotNull(message = "部门或者仓库不可为空!")
    private Long depId;
    public Integer getCount() {
        return count;
    }
    public void setCount(Integer count) {
        this.count = count;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public Long getDepId() {
        return depId;
    }
    public void setDepId(Long depId) {
        this.depId = depId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MaterialSpwReq.java
对比新文件
@@ -0,0 +1,29 @@
package com.gkhy.safePlatform.equipment.model.dto.req;
import javax.validation.constraints.NotNull;
import java.util.List;
public class MaterialSpwReq {
    @NotNull(message = "认领人不可为空!")
    private Long claimantId;
    @NotNull(message = "出库物资不可为空!")
    private List<MaterialSpwDeliveryReq> deliveryReqList;
    public Long getClaimantId() {
        return claimantId;
    }
    public void setClaimantId(Long claimantId) {
        this.claimantId = claimantId;
    }
    public List<MaterialSpwDeliveryReq> getDeliveryReqList() {
        return deliveryReqList;
    }
    public void setDeliveryReqList(List<MaterialSpwDeliveryReq> deliveryReqList) {
        this.deliveryReqList = deliveryReqList;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/MterialRandomDeliveryReq.java
@@ -9,8 +9,10 @@
    @NotNull(message = "认领人不可为空!")
    private Long claimantId;
    @NotNull(message = "物资主键不可为空!")
    @NotNull(message = "物资管理id不可为空!")
    private Long smId;
    private String rfid;
    public Long getSmId() {
        return smId;
@@ -35,4 +37,12 @@
    public void setCount(Integer count) {
        this.count = count;
    }
    public String getRfid() {
        return rfid;
    }
    public void setRfid(String rfid) {
        this.rfid = rfid;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialAddReq.java
@@ -9,30 +9,31 @@
    /**
     * 物资类型id
     */
    @NotNull(message = "物资类型不可为空!")
    private Long materialClassifyId;
    @NotNull(message = "物资类型(小类)不可为空!")
    private Long smallClassifyId;
    /**
     * 大类id
     */
    @NotNull(message = "物资类型(大类)不可为空!")
    private Long bigClassifyId;
    /**
     * 部门id
     */
    @NotNull(message = "所属部门不可为空!")
    private Long depId;
    /**
     * 物资名称
     */
    @NotBlank(message = "安全物资名称不可为空!")
    private String materialName;
    /**
     * 是否是耗材(0是, 1否)
     */
    @NotNull(message = "是否是耗材不可为空!")
    private Byte consumable;
    public Long getMaterialClassifyId() {
        return materialClassifyId;
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setMaterialClassifyId(Long materialClassifyId) {
        this.materialClassifyId = materialClassifyId;
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public Long getDepId() {
@@ -43,15 +44,6 @@
        this.depId = depId;
    }
    public String getMaterialName() {
        return materialName;
    }
    public void setMaterialName(String materialName) {
        this.materialName = materialName;
    }
    public Byte getConsumable() {
        return consumable;
    }
@@ -59,4 +51,12 @@
    public void setConsumable(Byte consumable) {
        this.consumable = consumable;
    }
    public Long getBigClassifyId() {
        return bigClassifyId;
    }
    public void setBigClassifyId(Long bigClassifyId) {
        this.bigClassifyId = bigClassifyId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialClassifyAddReq.java
@@ -1,9 +1,6 @@
package com.gkhy.safePlatform.equipment.model.dto.req;
import org.hibernate.validator.constraints.Length;
import org.jetbrains.annotations.NotNull;
import javax.validation.constraints.NotBlank;
public class SafeMaterialClassifyAddReq {
@@ -12,6 +9,10 @@
     */
    @NotBlank(message = "物资名称不可为空")
    private String materialClassifyName;
    /**
     * 父级id
     */
    private Long ParentId;
    public String getMaterialClassifyName() {
        return materialClassifyName;
@@ -20,4 +21,12 @@
    public void setMaterialClassifyName(String materialClassifyName) {
        this.materialClassifyName = materialClassifyName;
    }
    public Long getParentId() {
        return ParentId;
    }
    public void setParentId(Long parentId) {
        ParentId = parentId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialModReq.java
@@ -1,6 +1,5 @@
package com.gkhy.safePlatform.equipment.model.dto.req;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
public class SafeMaterialModReq {
@@ -10,7 +9,12 @@
     * 物资类型id
     */
    @NotNull(message = "物资类型不可为空!")
    private Long materialClassifyId;
    private Long smallClassifyId;
    /**
     * 大类id
     */
    @NotNull(message = "物资类型(大类)不可为空!")
    private Long bigClassifyId;
    /**
     * 部门id
     */
@@ -19,8 +23,6 @@
    /**
     * 物资名称
     */
    @NotBlank(message = "安全物资名称不可为空!")
    private String materialName;
    /**
     * 是否是耗材(0是, 1否)
     */
@@ -35,12 +37,12 @@
        this.id = id;
    }
    public Long getMaterialClassifyId() {
        return materialClassifyId;
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setMaterialClassifyId(Long materialClassifyId) {
        this.materialClassifyId = materialClassifyId;
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public Long getDepId() {
@@ -51,14 +53,6 @@
        this.depId = depId;
    }
    public String getMaterialName() {
        return materialName;
    }
    public void setMaterialName(String materialName) {
        this.materialName = materialName;
    }
    public Byte getConsumable() {
        return consumable;
    }
@@ -66,4 +60,12 @@
    public void setConsumable(Byte consumable) {
        this.consumable = consumable;
    }
    public Long getBigClassifyId() {
        return bigClassifyId;
    }
    public void setBigClassifyId(Long bigClassifyId) {
        this.bigClassifyId = bigClassifyId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/SafeMaterialQuery.java
@@ -4,18 +4,18 @@
    /**
     * 物资类型id
     */
    private Long materialClassifyId;
    private Long bigClassifyId;
    /**
     * 物资名称
     */
        private String materialName;
    private String materialName;
    public Long getMaterialClassifyId() {
        return materialClassifyId;
    public Long getBigClassifyId() {
        return bigClassifyId;
    }
    public void setMaterialClassifyId(Long materialClassifyId) {
        this.materialClassifyId = materialClassifyId;
    public void setBigClassifyId(Long bigClassifyId) {
        this.bigClassifyId = bigClassifyId;
    }
    public String getMaterialName() {
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialClassificationDto.java
@@ -7,8 +7,8 @@
    private Long materialClassifyId;
    //物资类型名称
    private String materialClassifyName;
    private List<MaterialDepartmentDto> departmentList;
    private List<BaseMaterialDto> baseMaterialList;
    public Long getMaterialClassifyId() {
        return materialClassifyId;
    }
@@ -25,11 +25,11 @@
        this.materialClassifyName = materialClassifyName;
    }
    public List<MaterialDepartmentDto> getDepartmentList() {
        return departmentList;
    public List<BaseMaterialDto> getBaseMaterialList() {
        return baseMaterialList;
    }
    public void setDepartmentList(List<MaterialDepartmentDto> departmentList) {
        this.departmentList = departmentList;
    public void setBaseMaterialList(List<BaseMaterialDto> baseMaterialList) {
        this.baseMaterialList = baseMaterialList;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/MaterialDepartmentDto.java
@@ -8,7 +8,7 @@
    //部门名称
    private String depName;
    //基础物资设备
    private List<BaseMaterialDto> baseMaterialList;
    private List<MaterialClassificationDto> classificationList;
    public Long getDepId() {
        return depId;
@@ -26,11 +26,11 @@
        this.depName = depName;
    }
    public List<BaseMaterialDto> getBaseMaterialList() {
        return baseMaterialList;
    public List<MaterialClassificationDto> getClassificationList() {
        return classificationList;
    }
    public void setBaseMaterialList(List<BaseMaterialDto> baseMaterialList) {
        this.baseMaterialList = baseMaterialList;
    public void setClassificationList(List<MaterialClassificationDto> classificationList) {
        this.classificationList = classificationList;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialClassifyDto.java
@@ -1,8 +1,22 @@
package com.gkhy.safePlatform.equipment.model.dto.resp;
import java.util.List;
public class SafeMaterialClassifyDto {
    private Long id;
    private String materialClassifyName;
    private Long parentId;
    private List<SafeMaterialClassifyDto> childList;
    public Long getParentId() {
        return parentId;
    }
    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }
    public Long getId() {
        return id;
@@ -19,4 +33,12 @@
    public void setMaterialClassifyName(String materialClassifyName) {
        this.materialClassifyName = materialClassifyName;
    }
    public List<SafeMaterialClassifyDto> getChildList() {
        return childList;
    }
    public void setChildList(List<SafeMaterialClassifyDto> childList) {
        this.childList = childList;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialClassifyStockDto.java
对比新文件
@@ -0,0 +1,40 @@
package com.gkhy.safePlatform.equipment.model.dto.resp;
public class SafeMaterialClassifyStockDto {
    private Long smallClassifyId;
    private Long depId;
    private String depName;
    private Integer stockCount;
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    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 getStockCount() {
        return stockCount;
    }
    public void setStockCount(Integer stockCount) {
        this.stockCount = stockCount;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDetailDto.java
@@ -77,6 +77,12 @@
     */
    private String claimantName;
    /**
     * 安全物资管理id
     * @return
     */
    private Long smId;
    public Long getId() {
        return id;
    }
@@ -212,4 +218,12 @@
    public void setValidTypeName(String validTypeName) {
        this.validTypeName = validTypeName;
    }
    public Long getSmId() {
        return smId;
    }
    public void setSmId(Long smId) {
        this.smId = smId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeMaterialDto.java
@@ -16,9 +16,11 @@
    /**
     * 物资类型id
     */
    private Long materialClassifyId;
    private Long bigClassifyId;
    private String materialClassifyName;
    private String bigClassifyName;
    private Long smallClassifyId;
    /**
     * 部门id
     */
@@ -58,21 +60,7 @@
        this.serialNum = serialNum;
    }
    public Long getMaterialClassifyId() {
        return materialClassifyId;
    }
    public void setMaterialClassifyId(Long materialClassifyId) {
        this.materialClassifyId = materialClassifyId;
    }
    public String getMaterialClassifyName() {
        return materialClassifyName;
    }
    public void setMaterialClassifyName(String materialClassifyName) {
        this.materialClassifyName = materialClassifyName;
    }
    public Long getDepId() {
        return depId;
@@ -122,5 +110,27 @@
        this.validStockCount = validStockCount;
    }
    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;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/SafeRfidMaterialDetailDto.java
对比新文件
@@ -0,0 +1,52 @@
package com.gkhy.safePlatform.equipment.model.dto.resp;
public class SafeRfidMaterialDetailDto {
    private Long id;
    private String name;
    private Long bigClassifyId;
    private Long smallClassifyId;
    private Long depId;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Long getBigClassifyId() {
        return bigClassifyId;
    }
    public void setBigClassifyId(Long bigClassifyId) {
        this.bigClassifyId = bigClassifyId;
    }
    public Long getSmallClassifyId() {
        return smallClassifyId;
    }
    public void setSmallClassifyId(Long smallClassifyId) {
        this.smallClassifyId = smallClassifyId;
    }
    public Long getDepId() {
        return depId;
    }
    public void setDepId(Long depId) {
        this.depId = depId;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialClassifyInfoRepository.java
@@ -1,9 +1,12 @@
package com.gkhy.safePlatform.equipment.repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface SafeMaterialClassifyInfoRepository extends BaseMapper<SafeMaterialClassifyInfo> {
@@ -14,4 +17,9 @@
    SafeMaterialClassifyInfo queryById(@Param("id") Long id);
    List<SafeMaterialClassifyInfo> getListByParentId(Long parentId);
    SafeMaterialClassifyDO getBigAndSmallClassify(Long smallClassifyId);
    List<SafeMaterialClassifyDO> getTraceabilityClassifyList(List<Long> smallClassifyIds);
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialDetailInfoRepository.java
@@ -2,10 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailBO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfo;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailCountDO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfoDO;
import com.gkhy.safePlatform.equipment.entity.*;
import com.gkhy.safePlatform.equipment.model.dto.req.SafeMatetrialDetailQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -43,4 +40,16 @@
    int getCountBySmId(Long smId);
    void updateValidStatus(@Param("id") Long id, @Param("validStatus")Byte validStatus);
    List<Long> getRfidNotNullList(@Param("count") Integer count,@Param("smId")Long smId);
    List<Long> getRfidNullList(@Param("count") Integer count,@Param("smId") Long smId);
    List<Long> getIdListByRfid(Integer count, Long smId, String rfid);
    List<SafeMaterialClassifyStockDO> getSmallClassifyStockByIds(@Param("smallClassifyIds") List<Long> smallClassifyIds);
    List<SafeMaterialDetailDO> getListBySmallClassifyIds(List<Long> smallClassifyIds,@Param("depIds") List<Long> depIds);
    List<SafeMaterialDetailInfoDO> getListByRfids(List<String> rfids);
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/repository/SafeMaterialInfoRepository.java
@@ -22,6 +22,7 @@
    int deleteBatch(List<Long> ids);
    List<SafeMaterialDO> listByConditions(Page<SafeMaterialDO> page, @Param("query") SafeMaterialQuery query);
    int getCountBySmallClassifyId(Long smallClassifyId);
    Integer checkMatrial(@Param("smallClassifyId") Long smallClassifyId, @Param("depId") Long depId,@Param("id")  Long id);
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/MaterialClassifyService.java
@@ -2,15 +2,17 @@
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO;
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.resp.SafeMaterialClassifyDto;
import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyStockDto;
import java.util.List;
public interface MaterialClassifyService {
    ResultVO<List<SafeMaterialClassifyDto>> list(SafeMaterialClassifyQuery query);
    List<SafeMaterialClassifyDto> list();
    ResultVO save(ContextCacheUser currentUser, SafeMaterialClassifyAddReq req);
@@ -18,5 +20,11 @@
    ResultVO delete(Long id);
    ResultVO<SafeMaterialClassifyDto> queryById(Long id);
    SafeMaterialClassifyDto queryById(Long id);
    SafeMaterialClassifyDO getBigAndSmallClassifyInfo(Long smallClassifyId);
    List<SafeMaterialClassifyDto> getClassifyListByIds(List<Long> ids);
    List<SafeMaterialClassifyDO> getTraceabilityClassifyList(List<Long> smallClassifyIds);
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/SafeMaterialDetailService.java
@@ -4,7 +4,9 @@
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.equipment.model.dto.req.*;
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 java.util.List;
@@ -34,5 +36,9 @@
    SearchResultVO<List<SafeMaterialDetailDto>> listByPage(PageQuery<SafeMatetrialDetailQuery> pageQuery);
    ResultVO queryById(Long id);
    List<SafeMaterialClassifyStockDto> getSmallClassifyStockByIds(List<Long> smallClassifyIds);
    void deliveryBatchSpw(MaterialSpwReq req);
    List<SafeRfidMaterialDetailDto> getListByRfids(List<String> rfids);
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialClassifyInfoService.java
@@ -1,7 +1,9 @@
package com.gkhy.safePlatform.equipment.service.baseService;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyStockDO;
import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyQuery;
import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyDto;
@@ -15,7 +17,16 @@
    int update(SafeMaterialClassifyInfo classifyInfo);
    List<SafeMaterialClassifyInfo> listByCondition(SafeMaterialClassifyQuery query);
    List<SafeMaterialClassifyInfo> list();
    List<SafeMaterialClassifyInfo> getList();
    List<SafeMaterialClassifyInfo> getListByParentId(Long parentId);
    SafeMaterialClassifyDO getBigAndSmallClassify(Long smallClassifyId);
    List<SafeMaterialClassifyInfo> getClassifyListByIds(List<Long> smallClassifyIds);
    List<SafeMaterialClassifyDO> getTraceabilityClassifyList(List<Long> smallClassifyIds);
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialDetailInfoService.java
@@ -2,10 +2,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailBO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfo;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailCountDO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfoDO;
import com.gkhy.safePlatform.equipment.entity.*;
import com.gkhy.safePlatform.equipment.model.dto.req.SafeMatetrialDetailQuery;
import java.util.List;
@@ -42,4 +39,18 @@
    int getCountBySmId(Long smId);
    void updateValidStatus(Long id);
    List<Long> getRfidNotNullList(Integer count, Long smId);
    List<Long> getRfidNullList(Integer count, Long smId);
    List<Long> getIdListByRfid(Integer count, Long smId, String rfid);
    List<SafeMaterialClassifyStockDO> getSmallClassifyStockByIds(List<Long> smallClassifyIds);
    List<SafeMaterialDetailDO> getListBySmallClassifyIds(List<Long> smallClassifyIds,List<Long> depIds);
    List<SafeMaterialDetailInfoDO> getListByRfids(List<String> rfid);
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/SafeMaterialInfoService.java
@@ -13,7 +13,7 @@
    SafeMaterialInfo queryById(Long id);
    int getCountByClassify(Long classifyId);
    int deleteBatch(List<Long> ids);
@@ -22,4 +22,7 @@
    List<SafeMaterialDO> listByPage(Page<SafeMaterialDO> page, SafeMaterialQuery query);
    int getCountBySmallClassifyId(Long smallClassifyId);
    boolean checkMaterial(Long smallClassifyId, Long depId, Long id);
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialClassifyInfoServiceImpl.java
@@ -4,15 +4,18 @@
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.SafeMaterialClassifyInfo;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialInfo;
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.SafeMaterialClassifyQuery;
import com.gkhy.safePlatform.equipment.repository.SafeMaterialClassifyInfoRepository;
import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialClassifyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.InputStream;
import java.util.List;
@Service("SafeMaterialClassifyInfoService")
@@ -47,17 +50,55 @@
        return repository.queryById(id);
    }
    @Override
    public List<SafeMaterialClassifyInfo> listByCondition(SafeMaterialClassifyQuery query){
    public List<SafeMaterialClassifyInfo> list(){
        List<SafeMaterialClassifyInfo> list = repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>()
                .eq(SafeMaterialClassifyInfo::getDelFlag, 0)
                .like(StringUtils.isNotBlank(query.getMaterialClassifyName()), SafeMaterialClassifyInfo::getMaterialClassifyName, query.getMaterialClassifyName())
        );
        return list;
    }
    @Override
    public List<SafeMaterialClassifyInfo> getList(){
        List<SafeMaterialClassifyInfo> list = repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>());
        List<SafeMaterialClassifyInfo> list = repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>()
                .eq(SafeMaterialClassifyInfo::getDelFlag,0)
                .eq(SafeMaterialClassifyInfo::getParentId,0l));
        return list;
    }
    @Override
    public List<SafeMaterialClassifyInfo> getListByParentId(Long parentId) {
       if(null == parentId){
           throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
       }
        return repository.getListByParentId(parentId);
    }
    @Override
    public SafeMaterialClassifyDO getBigAndSmallClassify(Long smallClassifyId) {
        if(null == smallClassifyId){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getBigAndSmallClassify(smallClassifyId);
    }
    @Override
    public List<SafeMaterialClassifyInfo> getClassifyListByIds(List<Long> ids) {
       if(CollectionUtils.isEmpty(ids)){
           throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
       }
        return repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>()
                .eq(SafeMaterialClassifyInfo::getDelFlag,0)
                .in(SafeMaterialClassifyInfo::getId,ids)
        );
    }
    @Override
    public List<SafeMaterialClassifyDO> getTraceabilityClassifyList(List<Long> smallClassifyIds) {
       if(CollectionUtils.isEmpty(smallClassifyIds)){
           throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getTraceabilityClassifyList(smallClassifyIds);
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialDetailInfoServiceImpl.java
@@ -1,12 +1,11 @@
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.commons.enums.ResultCodes;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailBO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfo;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailCountDO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfoDO;
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;
@@ -14,6 +13,7 @@
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;
@@ -143,5 +143,50 @@
        repository.updateValidStatus(id,ValidStatusEnum.NO.getCode());
    }
    @Override
    public List<Long> getRfidNotNullList(Integer count,Long smId) {
        if(null == count || null == smId){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getRfidNotNullList(count,smId);
    }
    @Override
    public List<Long> getRfidNullList(Integer count,Long smId) {
        if(null == count || null == smId){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getRfidNullList(count,smId);
    }
    @Override
    public List<Long> getIdListByRfid(Integer count, Long smId, String rfid) {
        return repository.getIdListByRfid(count,smId,rfid);
    }
    @Override
    public List<SafeMaterialClassifyStockDO> getSmallClassifyStockByIds(List<Long> smallClassifyIds) {
        if(CollectionUtils.isEmpty(smallClassifyIds) ){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getSmallClassifyStockByIds(smallClassifyIds);
    }
    @Override
    public List<SafeMaterialDetailDO> getListBySmallClassifyIds(List<Long> smallClassifyIds,List<Long> depIds) {
        if(CollectionUtils.isEmpty(smallClassifyIds) || CollectionUtils.isEmpty(depIds)){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getListBySmallClassifyIds(smallClassifyIds,depIds);
    }
    @Override
    public List<SafeMaterialDetailInfoDO> getListByRfids(List<String> rfids) {
        if(CollectionUtils.isEmpty(rfids)){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getListByRfids(rfids);
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java
@@ -42,17 +42,6 @@
        return safeMaterialInfo;
    }
    /**
     * 根据类型统计数据
     */
    @Override
    public int getCountByClassify(Long classifyId){
        if(null == classifyId){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getCountByClassify(classifyId);
    }
    @Override
    public int deleteBatch(List<Long> ids) {
        if(null == ids || ids.size() == 0){
@@ -76,5 +65,26 @@
        return materialInfoList;
    }
    @Override
    public int getCountBySmallClassifyId(Long smallClassifyId) {
        if(null == smallClassifyId){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getCountBySmallClassifyId(smallClassifyId);
    }
    @Override
    public boolean checkMaterial(Long smallClassifyId, Long depId, Long id) {
        if(null == depId || null == smallClassifyId){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        boolean flag = false;
        int i = repository.checkMatrial(smallClassifyId,depId,id);
        if (i>0){
            flag = true;
        }
        return flag;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialClassifyServiceImpl.java
@@ -1,25 +1,27 @@
package com.gkhy.safePlatform.equipment.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.utils.StringUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo;
import com.gkhy.safePlatform.equipment.enums.EquipmentResultCodes;
import com.gkhy.safePlatform.equipment.excepiton.EquipmentException;
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.resp.SafeMaterialClassifyDto;
import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyStockDto;
import com.gkhy.safePlatform.equipment.service.MaterialClassifyService;
import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialClassifyInfoService;
import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialInfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service("MaterialClassifyService")
public class MaterialClassifyServiceImpl implements MaterialClassifyService {
@@ -29,25 +31,50 @@
    private SafeMaterialInfoService safeMaterialInfoService;
    @Override
    public ResultVO<List<SafeMaterialClassifyDto>> list(SafeMaterialClassifyQuery query) {
        List<SafeMaterialClassifyInfo> list = safeMaterialClassifyInfoService.listByCondition(query);
        List<SafeMaterialClassifyDto> respList = new ArrayList<>();
        if(!CollectionUtils.isEmpty(list)){
            for(SafeMaterialClassifyInfo classifyInfo : list){
                SafeMaterialClassifyDto respDTO = new SafeMaterialClassifyDto();
                respDTO.setId(classifyInfo.getId());
                respDTO.setMaterialClassifyName(classifyInfo.getMaterialClassifyName());
                respList.add(respDTO);
    public List<SafeMaterialClassifyDto> list() {
        List<SafeMaterialClassifyInfo> list = safeMaterialClassifyInfoService.list();
        //过滤出父级
        List<SafeMaterialClassifyInfo> parentList = list
                .stream()
                .filter(item -> item.getParentId().equals(0l))
                .collect(Collectors.toList());
        List<SafeMaterialClassifyDto> respDTOList = new ArrayList<>();
        //只有二级不采用递归
        for (SafeMaterialClassifyInfo classifyInfo:parentList) {
            SafeMaterialClassifyDto respDTO = new SafeMaterialClassifyDto();
            respDTO.setId(classifyInfo.getId());
            respDTO.setMaterialClassifyName(classifyInfo.getMaterialClassifyName());
            respDTO.setParentId(classifyInfo.getParentId());
            List<SafeMaterialClassifyInfo> childList = list
                    .stream()
                    .filter(item -> item.getParentId().equals(classifyInfo.getId()))
                    .collect(Collectors.toList());
            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());
                childDTOList.add(childDTO);
            }
            respDTO.setChildList(childDTOList);
            respDTOList.add(respDTO);
        }
        return new ResultVO<>(ResultCodes.OK,respList);
        return respDTOList;
    }
    @Override
    public ResultVO save(ContextCacheUser currentUser, SafeMaterialClassifyAddReq req) {
        ResultVO resultVO = null;
        SafeMaterialClassifyInfo classifyInfo = new SafeMaterialClassifyInfo();
        classifyInfo.setMaterialClassifyName(req.getMaterialClassifyName());
        if(null != req.getParentId()){
            classifyInfo.setParentId(req.getParentId());
        }else{
            classifyInfo.setParentId(0l);
        }
        boolean flag = safeMaterialClassifyInfoService.save(classifyInfo);
        if (flag){
            resultVO = new ResultVO(ResultCodes.OK);
@@ -80,35 +107,98 @@
        if(id == null){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        ResultVO resultVO = null;
        //判断是否被绑定
        int count = safeMaterialInfoService.getCountByClassify(id);
        if(count > 0){
            throw new EquipmentException(ResultCodes.SERVER_DEL_ERROR,"该类型已被绑定,不可删除!");
        }else{
            //如果没有被绑定,逻辑删除
            SafeMaterialClassifyInfo classifyInfo = new SafeMaterialClassifyInfo();
            classifyInfo.setId(id);
            classifyInfo.setDelFlag(1);
            boolean flag = safeMaterialClassifyInfoService.updateById(classifyInfo);
            if (flag){
                resultVO = new ResultVO(ResultCodes.OK);
            }else {
                resultVO = new ResultVO(ResultCodes.SERVER_DEL_ERROR);
        SafeMaterialClassifyInfo classify = safeMaterialClassifyInfoService.queryById(id);
        if(null == classify){
            throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST);
        }
        if(0 == classify.getParentId()){//一级
            List<SafeMaterialClassifyInfo> childrenList = safeMaterialClassifyInfoService.getListByParentId(id);
            if (childrenList.size()>0){
                throw new EquipmentException(ResultCodes.SERVER_DEL_ERROR,"改类型存在小类,不可删除!");
            }
        }else {//二级
            //判断是否被绑定
            int count = safeMaterialInfoService.getCountBySmallClassifyId(id);
            if(count > 0){
                throw new EquipmentException(ResultCodes.SERVER_DEL_ERROR,"该类型已被绑定,不可删除!");
            }
        }
        return  resultVO;
        //如果没有被绑定,逻辑删除
        SafeMaterialClassifyInfo classifyInfo = new SafeMaterialClassifyInfo();
        classifyInfo.setId(id);
        classifyInfo.setDelFlag(1);
        safeMaterialClassifyInfoService.updateById(classifyInfo);
        return new ResultVO(ResultCodes.OK);
    }
    @Override
    public ResultVO<SafeMaterialClassifyDto> queryById(Long id) {
    public SafeMaterialClassifyDto queryById(Long id) {
        if(id == null){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(id);
        if(null == classifyInfo){
            throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST);
        }
        List<SafeMaterialClassifyInfo> childList = new ArrayList<>();
        if(0l ==  classifyInfo.getParentId()){
            childList = safeMaterialClassifyInfoService.getListByParentId(id);
        }
        SafeMaterialClassifyDto respDTO = new SafeMaterialClassifyDto();
        respDTO.setId(classifyInfo.getId());
        respDTO.setMaterialClassifyName(classifyInfo.getMaterialClassifyName());
        return new ResultVO<>(ResultCodes.OK,respDTO);
        respDTO.setParentId(classifyInfo.getParentId());
        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());
            childDtoList.add(childDto);
        }
        respDTO.setChildList(childDtoList);
        return respDTO;
    }
    /**
     * 根据小类id获取大小类相关信息
     * @param smallClassifyId
     * @return
     */
    public SafeMaterialClassifyDO getBigAndSmallClassifyInfo(Long smallClassifyId){
        if(null == smallClassifyId){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        SafeMaterialClassifyDO classifyDO = safeMaterialClassifyInfoService.getBigAndSmallClassify(smallClassifyId);
        return classifyDO;
    }
    /**
     * 根据小类ids获取小类相关信息
     * @param ids
     * @return
     */
    public List<SafeMaterialClassifyDto> getClassifyListByIds(List<Long> ids){
        if(CollectionUtils.isEmpty(ids)){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        List<SafeMaterialClassifyInfo> list = safeMaterialClassifyInfoService.getClassifyListByIds(ids);
        List<SafeMaterialClassifyDto> classifyDtoList = new ArrayList<>();
        for (SafeMaterialClassifyInfo classifyInfo:list){
            SafeMaterialClassifyDto classifyDto = new SafeMaterialClassifyDto();
            BeanUtils.copyProperties(classifyInfo,classifyDto);
            classifyDtoList.add(classifyDto);
        }
        return classifyDtoList;
    }
    @Override
    public List<SafeMaterialClassifyDO> getTraceabilityClassifyList(List<Long> smallClassifyIds) {
        if(CollectionUtils.isEmpty(smallClassifyIds)){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return safeMaterialClassifyInfoService.getTraceabilityClassifyList(smallClassifyIds);
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialDetailServiceImpl.java
@@ -14,7 +14,9 @@
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.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;
@@ -27,14 +29,12 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Service("SafeMaterialDetailService")
@@ -93,8 +93,9 @@
                String rfid = "0000000".substring(0,(8 - countStr.length()))+countStr;
                SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo();
                materialDetailInfo.setId(IdUtil.getSnowflake(0,0).nextId());
                materialDetailInfo.setMaterialClassifyId(materialInfo.getMaterialClassifyId());
                materialDetailInfo.setName(materialInfo.getMaterialName()+"(ID"+materialInfo.getId()+")");
                materialDetailInfo.setBigClassifyId(materialInfo.getBigClassifyId());
                materialDetailInfo.setSmallClassifyId(materialInfo.getSmallClassifyId());
                materialDetailInfo.setName(materialInfo.getMaterialName());
                materialDetailInfo.setSmId(req.getSmId());
                materialDetailInfo.setConsumable(materialInfo.getConsumable());
                materialDetailInfo.setValidType(req.getValidType());
@@ -113,8 +114,9 @@
            for(int i = 0;i < req.getWareHousingCount();i++){
                SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo();
                materialDetailInfo.setId(IdUtil.getSnowflake(0,0).nextId());
                materialDetailInfo.setMaterialClassifyId(materialInfo.getMaterialClassifyId());
                materialDetailInfo.setName(materialInfo.getMaterialName()+"(ID"+materialInfo.getId()+")");
                materialDetailInfo.setBigClassifyId(materialInfo.getBigClassifyId());
                materialDetailInfo.setSmallClassifyId(materialInfo.getSmallClassifyId());
                materialDetailInfo.setName(materialInfo.getMaterialName());
                materialDetailInfo.setSmId(req.getSmId());
                materialDetailInfo.setConsumable(materialInfo.getConsumable());
                materialDetailInfo.setValidType(req.getValidType());
@@ -169,8 +171,9 @@
        for(int i = 0;i < req.getWareHousingCount();i++){
            SafeMaterialDetailInfo materialDetailInfo = new SafeMaterialDetailInfo();
            materialDetailInfo.setId(IdUtil.getSnowflake(0,0).nextId());
            materialDetailInfo.setMaterialClassifyId(materialInfo.getMaterialClassifyId());
            materialDetailInfo.setName(materialInfo.getMaterialName()+"(ID"+materialInfo.getId()+")");
            materialDetailInfo.setBigClassifyId(materialInfo.getBigClassifyId());
            materialDetailInfo.setSmallClassifyId(materialInfo.getSmallClassifyId());
            materialDetailInfo.setName(materialInfo.getMaterialName());
            materialDetailInfo.setSmId(req.getSmId());
            materialDetailInfo.setConsumable(materialInfo.getConsumable());
            materialDetailInfo.setValidType(req.getValidType());
@@ -258,10 +261,10 @@
        List<SafeMaterialDetailInfo> list = safeMaterialDetailInfoService.getListByIds(idList);
        List<SafeMaterialDetailInfo> selectList = list
                .stream()
                .filter(item -> item.getIrStatus().equals(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()))
                .filter(item -> item.getIrStatus().equals(IssueReceiptEnum.OUT_OF_LIBRARY.getCode()) && item.getConsumable().equals(ConsumableEnum.YES.getCode()))
                .collect(Collectors.toList());
        if(selectList.size() != ids.length){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"已入库物资不可重复入库!");
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"已入库或耗材物资不可重复入库!");
        }
        //修改为入库状态
        safeMaterialDetailInfoService.updateReceiptStatusByIds(idList,IssueReceiptEnum.IN_THE_LIBRARY.getCode());
@@ -311,18 +314,141 @@
    @Override
    public ResultVO deliveryBatchRandom(MterialRandomDeliveryReq req) {
        UserInfoRPCRespDTO userInfo = getUserInfo(req.getClaimantId());
        List<Long> idList = new ArrayList<>();
        if(StringUtils.isNotBlank(req.getRfid())){
            idList = safeMaterialDetailInfoService.getIdListByRfid(req.getCount(),req.getSmId(),req.getRfid());
        }else{
            idList = safeMaterialDetailInfoService.getRfidNullList(req.getCount(), req.getSmId());
        }
        if(idList.size()< req.getCount()){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"有效库存数量不足!");
        }
        //获取有效数量
        Integer validStockCount = safeMaterialDetailInfoService.getValidStockCount(req.getSmId());
        if(req.getCount() > validStockCount){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"出库数量不可大于有效库存数量!");
        }
        SafeMaterialDetailBO detailBO = new SafeMaterialDetailBO();
        detailBO.setCount(req.getCount());
        detailBO.setClaimantName(userInfo.getUsername());
        detailBO.setClaimantId(req.getClaimantId());
        safeMaterialDetailInfoService.deliveryBatchRandom(detailBO);
        detailBO.setIds(idList);
        safeMaterialDetailInfoService.updateDeliveryStatusByIds(detailBO);
        return new ResultVO(ResultCodes.OK);
    }
    /**
     * 特殊作业物资出库
     * @param req
     * @return
     */
    @Override
    public void deliveryBatchSpw(MaterialSpwReq req) {
        //验证
        if(null == req.getClaimantId()){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"认领人不可为空!");
        }
        List<MaterialSpwDeliveryReq> deliveryReqList = req.getDeliveryReqList();
        if(CollectionUtils.isEmpty(deliveryReqList)){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"出库物资不可为空!");
        }
        //获取小类物资
        List<Long> smallClassifyIds = deliveryReqList
                .stream()
                .map(MaterialSpwDeliveryReq::getSmallClassifyId)
                .collect(Collectors.toList());
        List<Long> depIds = deliveryReqList
                .stream()
                .map(MaterialSpwDeliveryReq::getDepId)
                .collect(Collectors.toList());
        if(smallClassifyIds.size() == 0 || depIds.size() == 0){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"部门/仓库或者物资类型(小类)不可为空!");
        }
        List<SafeMaterialClassifyStockDO> classifyStockList= safeMaterialDetailInfoService.getSmallClassifyStockByIds(smallClassifyIds);
        //根据物资种类获取有效在库物资
        List<SafeMaterialDetailDO> listBySmallClassifyIds = safeMaterialDetailInfoService.getListBySmallClassifyIds(smallClassifyIds,depIds);
        for(MaterialSpwDeliveryReq deliveryReq:deliveryReqList){
            if(null == deliveryReq.getDepId()){
                throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"部门或仓库不可为空!");
            }
            if(null == deliveryReq.getCount()){
                throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"出库数量不可为空!");
            }
            if(null == deliveryReq.getSmallClassifyId()){
                throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"物资类型(小类)不可为空!");
            }
            List<SafeMaterialClassifyStockDO> collect = classifyStockList
                    .stream()
                    .filter(cs -> cs.getSmallClassifyId().equals(deliveryReq.getSmallClassifyId()) && cs.getDepId().equals(deliveryReq.getDepId())  && cs.getStockCount() >= deliveryReq.getCount())
                    .collect(Collectors.toList());
            if(collect.size() == 0){
                throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"库存不足!");
            }
        }
        UserInfoRPCRespDTO userInfo = getUserInfo(req.getClaimantId());
        List<Long> ids = new ArrayList<>();
        //循环数据
        for(MaterialSpwDeliveryReq deliveryReq:deliveryReqList){
            //过滤出rfid存在的数据
            List<SafeMaterialDetailDO> selectRfidNotNull = listBySmallClassifyIds
                    .stream()
                    .filter(item -> null != item.getRfid() && item.getSmallClassifyId().equals(deliveryReq.getSmallClassifyId()) && item.getDepId().equals(deliveryReq.getDepId()))
                    .collect(Collectors.toList());
            List<Long> selectIds = new ArrayList<>();
            if(selectRfidNotNull.size()>0){
                selectIds = selectRfidNotNull
                        .stream()
                        .map(SafeMaterialDetailDO::getId)
                        .collect(Collectors.toList());
            }
            if(selectRfidNotNull.size() >= deliveryReq.getCount()){
                ids.addAll(selectIds.subList(0,deliveryReq.getCount()));
            }else{
                ids.addAll(selectIds);
                List<SafeMaterialDetailDO> selectRfidIsNull = listBySmallClassifyIds
                        .stream()
                        .filter(item -> null == item.getRfid() && item.getSmallClassifyId().equals(deliveryReq.getSmallClassifyId()) && item.getDepId().equals(deliveryReq.getDepId()))
                        .collect(Collectors.toList());
                List<Long> collect = selectRfidIsNull.subList(0,deliveryReq.getCount()-selectRfidNotNull.size()).stream().map(SafeMaterialDetailDO::getId)
                        .collect(Collectors.toList());
                ids.addAll(collect);
            }
        }
        SafeMaterialDetailBO detailBO = new SafeMaterialDetailBO();
        detailBO.setClaimantName(userInfo.getUsername());
        detailBO.setClaimantId(req.getClaimantId());
        detailBO.setIds(ids);
        safeMaterialDetailInfoService.updateDeliveryStatusByIds(detailBO);
    }
    /**
     * 根据rfid获取数据信息
     * @param rfids
     * @return
     */
    @Override
    public List<SafeRfidMaterialDetailDto> getListByRfids(List<String> rfids) {
        if(CollectionUtils.isEmpty(rfids)){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        List<SafeMaterialDetailInfoDO> listByRfid = safeMaterialDetailInfoService.getListByRfids(rfids);
        List<SafeRfidMaterialDetailDto> rfidMaterialDetailDtoList = new ArrayList<>();
        for (SafeMaterialDetailInfoDO detailInfoDO:listByRfid){
            SafeRfidMaterialDetailDto detailDto = new SafeRfidMaterialDetailDto();
            detailDto.setId(detailInfoDO.getId());
            detailDto.setName(detailInfoDO.getName());
            detailDto.setBigClassifyId(detailInfoDO.getBigClassifyId());
            detailDto.setSmallClassifyId(detailInfoDO.getSmallClassifyId());
            detailDto.setDepId(detailInfoDO.getDepId());
            rfidMaterialDetailDtoList.add(detailDto);
        }
        return rfidMaterialDetailDtoList;
    }
    @Override
@@ -337,7 +463,6 @@
            materialDetailDto.setValidStatusName(ValidStatusEnum.getByCode(materialDetailInfoDO.getValidStatus()).getValue());
            materialDetailDto.setValidTypeName(ValidTypeEnum.getByCode(materialDetailInfoDO.getValidType()).getValue());
            materialDetailDto.setIrStatusName(IssueReceiptEnum.getByCode(materialDetailInfoDO.getIrStatus()).getValue());
            detailDtoList.add(materialDetailDto);
        }
        return new SearchResultVO<>(true, page.getCurrent(),page.getSize(), page.getPages(),page.getTotal(),detailDtoList,ResultCodes.OK);
@@ -352,7 +477,7 @@
        SafeMaterialDetailDto detailDto = new SafeMaterialDetailDto();
        if(materialDetailInfo != null){
            SafeMaterialInfo materialInfo = safeMaterialInfoService.queryById(materialDetailInfo.getSmId());
            SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(materialDetailInfo.getMaterialClassifyId());
            SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(materialDetailInfo.getBigClassifyId());
            BeanUtils.copyProperties(materialDetailInfo,detailDto);
            detailDto.setConsumableName(ConsumableEnum.getByCode(materialDetailInfo.getConsumable()).getValue());
            detailDto.setValidStatusName(ValidStatusEnum.getByCode(materialDetailInfo.getValidStatus()).getValue());
@@ -416,6 +541,10 @@
        if(null == vo){
            throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST);
        }
        //如果是耗材不可重新入库
        if(vo.getConsumable().equals(ConsumableEnum.YES.getCode())){
            throw new EquipmentException(EquipmentResultCodes.MATERIAL_CONSUMABLE);
        }
        if(vo.getIrStatus().equals(IssueReceiptEnum.IN_THE_LIBRARY.getCode())){
            throw new EquipmentException(EquipmentResultCodes.MATERIAL_IN_THE_LIBRARY);
        }
@@ -440,6 +569,10 @@
        }
        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);
@@ -498,9 +631,24 @@
        return new ResultVO<>(ResultCodes.OK);
    }
    /**
     * 根据小类id(物资种类)获取库存数量
     * @param smallClassifyIds
     * @return
     */
    public List<SafeMaterialClassifyStockDto> getSmallClassifyStockByIds(List<Long> smallClassifyIds) {
        if(CollectionUtils.isEmpty(smallClassifyIds)){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        List<SafeMaterialClassifyStockDO> classifyStockList= safeMaterialDetailInfoService.getSmallClassifyStockByIds(smallClassifyIds);
        List<SafeMaterialClassifyStockDto> classifyStockDtoList = new ArrayList<>();
        for (SafeMaterialClassifyStockDO classifyStockDO:classifyStockList){
            SafeMaterialClassifyStockDto classifyStockDto = new SafeMaterialClassifyStockDto();
            BeanUtils.copyProperties(classifyStockDO,classifyStockDto);
            classifyStockDtoList.add(classifyStockDto);
        }
        return classifyStockDtoList;
    }
    private UserInfoRPCRespDTO getUserInfo(Long uid) {
@@ -537,5 +685,4 @@
        Date date = Date.from(zdt.toInstant());
        return date;
    }
}
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/SafeMaterialServiceImpl.java
@@ -52,30 +52,34 @@
        ResultVO resultVO = null;
        //获取部门信息
        DepInfoRPCRespDTO depInfo = getDepInfoByDepId(req.getDepId());
        if(null == ConsumableEnum.getByCode(req.getConsumable())){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"耗材类型不合法!");
        }
        //获取物资类型
        SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(req.getMaterialClassifyId());
        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);
        if(flag){
            throw new EquipmentException(EquipmentResultCodes.DATA_EXIST,"该种物资已存在不可重复创建");
        }
        //获取数量
        int safeMaterialTotalCount = safeMaterialInfoService.getTotalCount();
        SafeMaterialInfo safeMaterialInfo = new SafeMaterialInfo();
        BeanUtils.copyProperties(req,safeMaterialInfo);
        safeMaterialInfo.setConsumable(req.getConsumable());
        safeMaterialInfo.setDepId(req.getDepId());
        safeMaterialInfo.setSmallClassifyId(req.getSmallClassifyId());
        safeMaterialInfo.setMaterialName(classifyInfo.getMaterialClassifyName());
        safeMaterialInfo.setDepName(depInfo.getDepName());
        safeMaterialInfo.setSerialNum(this.generateSerialNum(safeMaterialTotalCount));
        safeMaterialInfo.setBigClassifyId(req.getBigClassifyId());
        //插入
        boolean flag = safeMaterialInfoService.save(safeMaterialInfo);
        if(flag){
            resultVO = new ResultVO(ResultCodes.OK);
        }else {
            resultVO = new ResultVO(ResultCodes.SERVER_ADD_ERROR);
        }
        safeMaterialInfoService.save(safeMaterialInfo);
        return resultVO;
        return new ResultVO(ResultCodes.OK);
    }
    @Override
@@ -88,22 +92,25 @@
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_ILLEGAL,"耗材类型不合法!");
        }
        //获取物资类型
        SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(req.getMaterialClassifyId());
        SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(req.getSmallClassifyId());
        if(null == classifyInfo){
            throw new EquipmentException(EquipmentResultCodes.DATA_NOT_EXIST,"物资类型不存在!");
        }
        SafeMaterialInfo safeMaterialInfo = new SafeMaterialInfo();
        BeanUtils.copyProperties(req,safeMaterialInfo);
        safeMaterialInfo.setDepName(depInfo.getDepName());
        //跟新
        boolean flag = safeMaterialInfoService.updateById(safeMaterialInfo);
        boolean flag = safeMaterialInfoService.checkMaterial(req.getSmallClassifyId(), req.getDepId(), req.getDepId());
        if(flag){
            resultVO = new ResultVO(ResultCodes.OK);
        }else {
            resultVO = new ResultVO(ResultCodes.SERVER_UPDATE_ERROR);
            throw new EquipmentException(EquipmentResultCodes.DATA_EXIST,"该种物资已存在不可重复创建");
        }
        SafeMaterialInfo safeMaterialInfo = new SafeMaterialInfo();
        safeMaterialInfo.setConsumable(req.getConsumable());
        safeMaterialInfo.setDepId(req.getDepId());
        safeMaterialInfo.setSmallClassifyId(req.getSmallClassifyId());
        safeMaterialInfo.setMaterialName(classifyInfo.getMaterialClassifyName());
        safeMaterialInfo.setDepName(depInfo.getDepName());
        safeMaterialInfo.setBigClassifyId(req.getBigClassifyId());
        //跟新
        safeMaterialInfoService.updateById(safeMaterialInfo);
        return resultVO;
        return new ResultVO(ResultCodes.OK);
    }
    @Override
@@ -114,12 +121,12 @@
        SafeMaterialInfo safeMaterialInfo = safeMaterialInfoService.queryById(id);
        SafeMaterialDto safeMaterialDto = new SafeMaterialDto();
        if(null != safeMaterialInfo){
            SafeMaterialClassifyInfo classifyInfo = safeMaterialClassifyInfoService.queryById(safeMaterialInfo.getMaterialClassifyId());
            SafeMaterialClassifyDO classifyDO = safeMaterialClassifyInfoService.getBigAndSmallClassify(safeMaterialInfo.getSmallClassifyId());
            Integer validStockCount = safeMaterialDetailInfoService.getValidStockCount(safeMaterialInfo.getId());
            BeanUtils.copyProperties(safeMaterialInfo,safeMaterialDto);
            safeMaterialDto.setConsumable(ConsumableEnum.getByCode(safeMaterialInfo.getConsumable()).getCode());
            if(null != classifyInfo){
                safeMaterialDto.setMaterialClassifyName(classifyInfo.getMaterialClassifyName());
            safeMaterialDto.setConsumableName(ConsumableEnum.getByCode(safeMaterialInfo.getConsumable()).getValue());
            if(null != classifyDO){
                safeMaterialDto.setBigClassifyName(classifyDO.getBigClassifyName());
            }
            safeMaterialDto.setValidStockCount(validStockCount);
@@ -173,27 +180,29 @@
        List<DepRPCRespDTO> depInfoList = getDepInfoList();
        //获取所有物资类型
        List<SafeMaterialClassifyInfo> classifyInfoList = safeMaterialClassifyInfoService.getList();
        //循环物资分类
        List<MaterialClassificationDto> classificationDtoList = new ArrayList<>();
        for (SafeMaterialClassifyInfo classifyInfo:classifyInfoList){
            MaterialClassificationDto classificationDto = new MaterialClassificationDto();
            classificationDto.setMaterialClassifyId(classifyInfo.getId());
            classificationDto.setMaterialClassifyName(classifyInfo.getMaterialClassifyName());
            //循环部门
            List<MaterialDepartmentDto> departmentDtoList = new ArrayList<>();
            for (DepRPCRespDTO dep:depInfoList){
        //循环部门
        List<MaterialDepartmentDto> departmentDtoList = new ArrayList<>();
        recursiveDep(depInfoList,departmentDtoList,materialInfoList,classifyInfoList);
        return new ResultVO(ResultCodes.OK,departmentDtoList);
    }
    private void recursiveDep(List<DepRPCRespDTO> depInfoList,List<MaterialDepartmentDto> departmentDtoList,List<SafeMaterialInfo> materialInfoList,List<SafeMaterialClassifyInfo> classifyInfoList){
        for (DepRPCRespDTO dep:depInfoList){
            MaterialDepartmentDto materialDepartmentDto = new MaterialDepartmentDto();
            materialDepartmentDto.setDepId(dep.getDepId());
            materialDepartmentDto.setDepName(dep.getDepName());
            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.getMaterialClassifyId()) && dep.getDepId().equals(item.getDepId()))
                        .filter(item -> classifyInfo.getId().equals(item.getBigClassifyId()) && dep.getDepId().equals(item.getDepId()))
                        .collect(Collectors.toList());
                List<BaseMaterialDto> baseMaterialDtoList = new ArrayList<>();
                if(selectMaterialList.size()>0){
                    //填充部门数据
                    MaterialDepartmentDto departmentDto = new MaterialDepartmentDto();
                    departmentDto.setDepId(dep.getDepId());
                    departmentDto.setDepName(dep.getDepName());
                    List<BaseMaterialDto> baseMaterialDtoList = new ArrayList<>();
                    //循环物资
                    for (SafeMaterialInfo materialInfo:selectMaterialList){
                        //填充基础物资数据
@@ -202,48 +211,17 @@
                        baseMaterialDto.setSmId(materialInfo.getId());
                        baseMaterialDtoList.add(baseMaterialDto);
                    }
                    departmentDto.setBaseMaterialList(baseMaterialDtoList);
                    departmentDtoList.add(departmentDto);
                }
                //子集部门
                if(!CollectionUtils.isEmpty(dep.getChildren())){
                    this.recursiveDep(dep.getChildren(),departmentDtoList,materialInfoList,classifyInfo.getId());
                    classificationDto.setBaseMaterialList(baseMaterialDtoList);
                    classificationDtoList.add(classificationDto);
                }
            }
            classificationDto.setDepartmentList(departmentDtoList);
            classificationDtoList.add(classificationDto);
        }
        return new ResultVO(ResultCodes.OK,classificationDtoList);
    }
    private void recursiveDep(List<DepRPCRespDTO> depList,List<MaterialDepartmentDto> departmentDtoList,List<SafeMaterialInfo> materialInfoList,Long classifyId){
        for(DepRPCRespDTO dep:depList){
            //过滤出物资数据
            List<SafeMaterialInfo> selectMaterialList = materialInfoList
                    .stream()
                    .filter(item -> classifyId.equals(item.getMaterialClassifyId()) && dep.getDepId().equals(item.getDepId()))
                    .collect(Collectors.toList());
            if(selectMaterialList.size()>0){
                //填充部门数据
                MaterialDepartmentDto departmentDto = new MaterialDepartmentDto();
                departmentDto.setDepId(dep.getDepId());
                departmentDto.setDepName(dep.getDepName());
                List<BaseMaterialDto> baseMaterialDtoList = new ArrayList<>();
                //循环物资
                for (SafeMaterialInfo materialInfo:selectMaterialList){
                    //填充基础物资数据
                    BaseMaterialDto baseMaterialDto = new BaseMaterialDto();
                    baseMaterialDto.setMaterialName(materialInfo.getMaterialName());
                    baseMaterialDto.setSmId(materialInfo.getId());
                    baseMaterialDtoList.add(baseMaterialDto);
                }
                departmentDto.setBaseMaterialList(baseMaterialDtoList);
                departmentDtoList.add(departmentDto);
            if(classificationDtoList.size()>0){
                materialDepartmentDto.setClassificationList(classificationDtoList);
                departmentDtoList.add(materialDepartmentDto);
            }
            //子集
            //子集部门
            if(!CollectionUtils.isEmpty(dep.getChildren())){
                this.recursiveDep(dep.getChildren(),departmentDtoList,materialInfoList,classifyId);
                this.recursiveDep(dep.getChildren(),departmentDtoList,materialInfoList,classifyInfoList);
            }
        }
    }
equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialClassifyInfoMapper.xml
@@ -4,13 +4,9 @@
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gkhy.safePlatform.equipment.repository.SafeMaterialClassifyInfoRepository">
    <resultMap type="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO" id="materialClassifyResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="material_classify_name" property="materialClassifyName"/>
    </resultMap>
    <!--新增-->
    <insert id="save" parameterType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo">
        insert into safe_material_classify (id,material_classify_name,del_flag,create_time,create_uid,create_uname,update_time,update_uid,update_uname) values (#{id},#{materialClassifyName},#{delFlag},#{createTime},#{createUid},#{createUname},#{updateTime},#{updateUid},#{updateUname})
        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>
    <!--更新-->
    <update id="update" parameterType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo">
@@ -28,7 +24,7 @@
    </update>
    <!--查询单条数据-->
    <select id="queryById" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo">
        select id,material_classify_name,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,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,
@@ -39,5 +35,37 @@
           and instr(material_classify_name,#{materialClassifyName}) > 0
        </if>
    </select>
    <select id="getListByParentId" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyInfo">
        select id,material_classify_name,parent_id from safe_material_classify where parent_id = #{parentId} and del_flag = 0;
    </select>
    <select id="getBigAndSmallClassify" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO">
        SELECT
            c1.id as smallClassifyId,
            c1.material_classify_name as smallClassifyName,
            c2.id as bigClassifyId,
            c2.material_classify_name as bigClassifyName
        FROM
            safe_material_classify c1
                INNER JOIN safe_material_classify c2 ON c1.parent_id = c2.id
        WHERE
            c1.del_flag = 0
          AND c1.id = #{smallClassifyId}
    </select>
    <select id="getTraceabilityClassifyList" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyDO">
        SELECT
            c1.id as smallClassifyId,
            c1.material_classify_name as smallClassifyName,
            c2.id as bigClassifyId,
            c2.material_classify_name as bigClassifyName
        FROM
            safe_material_classify c1
                INNER JOIN safe_material_classify c2 ON c1.parent_id = c2.id
        WHERE
            c1.del_flag = 0
          AND c1.id in
              <foreach collection="smallClassifyIds" item="id" close=")" open="(" separator=",">
                  #{id}
              </foreach>
    </select>
</mapper>
equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml
@@ -8,7 +8,8 @@
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="name" property="name" jdbcType="VARCHAR"/>
        <result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
        <result column="material_classify_id" property="materialClassifyId" jdbcType="BIGINT"/>
        <result column="big_classify_id" property="bigClassifyId" jdbcType="BIGINT"/>
        <result column="small_classify_id" property="smallClassifyId" jdbcType="BIGINT"/>
        <result column="rfid" property="rfid" jdbcType="VARCHAR"/>
        <result column="consumable" property="consumable" jdbcType="TINYINT"/>
        <result column="valid_type" property="validType" jdbcType="TINYINT"/>
@@ -34,9 +35,9 @@
    </select>
    <select id="queryById" resultMap="materialDetailResult">
        select id,
               name,
               CONCAT(name,'(ID',sm_id,')') as name,
               material_no,
               material_classify_id,
               big_classify_id,
               rfid,
               consumable,
               valid_type,
@@ -60,7 +61,7 @@
        where id = #{id}
    </update>
    <select id="getListByIds" resultMap="materialDetailResult">
        select id,name,material_no,material_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,ir_status,ware_housing_time,ware_housing_time,delivery_time,sm_id,claimant_id,claimant_name
               from safe_material_detail
               where del_flag = 0
                 and id in
@@ -130,8 +131,10 @@
            claimant_name = #{detailBO.claimantName},
            delivery_time = #{detailBO.deliveryTime}
        where id in
              (select t.id from (select id from safe_material_detail where ir_status = 0 and valid_status = 0 and del_flag = 0 ORDER BY ware_housing_time asc LIMIT #{detailBO.count}) t
              )
        <foreach collection="detailBO.ids" item="id" separator="," open="(" close=")" >
            #{id}
        </foreach>
    </update>
    <select id="getValidStockCount" resultType="java.lang.Integer">
@@ -144,9 +147,9 @@
    </select>
    <select id="listByCondition" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfoDO">
        select sd.id,
               sd.name,
               CONCAT(sd.name,'(ID',sd.sm_id,')') as name,
               sd.material_no,
               sd.material_classify_id,
               sd.big_classify_id,
               sd.rfid,
               sd.consumable,
               sd.valid_type,
@@ -158,9 +161,10 @@
               sd.delivery_time,
               sm.dep_id,
               sm.dep_name,
               sc.material_classify_name
               sd.sm_id,
               sc.material_classify_name as bigClassifyName
        from safe_material_detail sd
                 INNER JOIN safe_material_classify sc on sd.material_classify_id = sc.id
                 INNER JOIN safe_material_classify sc on sd.big_classify_id = sc.id
                 INNER JOIN safe_material sm on sd.sm_id = sm.id
        where sd.del_flag = 0
        <if test="query.rfid != null and query.rfid != '' ">
@@ -187,4 +191,74 @@
    <update id="updateValidStatus" >
        update safe_material_detail set valid_status = #{validStatus} where id = #{id}
    </update>
    <select id="getRfidNotNullList" 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 not null ORDER BY ware_housing_time asc LIMIT #{count}
    </select>
    <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>
    <select id="getSmallClassifyStockByIds" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyStockDO">
        select d.small_classify_id,
        m.dep_id,
        m.dep_name,
        count(1) as stockCount
        from safe_material_detail d
        INNER JOIN safe_material m
        ON d.sm_id = m.id
        where d.del_flag = 0
        and d.ir_status = 0
        and d.valid_status = 0
        and d.small_classify_id in
        <foreach collection="smallClassifyIds" item="smallClassifyId" separator="," open="(" close=")">
            #{smallClassifyId}
        </foreach>
        group By d.small_classify_id,m.dep_id,m.dep_name
    </select>
    <select id="getListBySmallClassifyIds" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailDO">
        SELECT
        sd.id,
        sd.rfid,
        sm.dep_id,
        sd.small_classify_id,
        sd.big_classify_id
        FROM
        safe_material_detail sd
        INNER JOIN safe_material sm ON sd.sm_id = sm.id
        WHERE
        sd.del_flag = 0
        AND sd.ir_status = 0
        AND sd.valid_status = 0
        AND sd.small_classify_id IN
        <foreach collection="smallClassifyIds" item="smallClassifyId" open="(" close=")" separator=",">
            #{smallClassifyId}
        </foreach>
        AND sm.dep_id IN
        <foreach collection="depIds" item="depId" open="(" close=")" separator=",">
            #{depId}
        </foreach>
        ORDER BY
        sd.create_time ASC
    </select>
    <select id="getListByRfids" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfoDO">
        SELECT
            sd.id,
            CONCAT( sd.NAME, '(NO', sd.material_no, ')' ) as name,
            sd.big_classify_id,
            sd.small_classify_id,
            sm.dep_id
        FROM
            safe_material_detail sd
        inner join safe_material sm on sd.sm_id = sm.id
        WHERE
            sd.del_flag = 0
          AND sd.ir_status = 1
          AND sd.rfid in
        <foreach collection="rfids" item="rfid" open="(" close=")" separator=",">
            #{rfid}
        </foreach>
    </select>
</mapper>
equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml
@@ -7,7 +7,8 @@
    <resultMap type="com.gkhy.safePlatform.equipment.entity.SafeMaterialInfo" id="materialResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="serial_num" property="serialNum" jdbcType="VARCHAR"/>
        <result column="material_classify_id" property="materialClassifyId" jdbcType="BIGINT"/>
        <result column="big_classify_id" property="bigClassifyId" jdbcType="BIGINT"/>
        <result column="small_classify_id" property="smallClassifyId" jdbcType="BIGINT"/>
        <result column="dep_id" property="depId" jdbcType="BIGINT"/>
        <result column="dep_name" property="depName" jdbcType="VARCHAR"/>
        <result column="material_name" property="materilaName" jdbcType="VARCHAR"/>
@@ -22,15 +23,15 @@
    </resultMap>
    <!--查询单条数据-->
    <select id="queryById" resultMap="materialResult">
        select id,serial_num,material_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,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>
    <!--查询所有数量-->
    <select id="getTotalCount" resultType="java.lang.Integer">
        select count(1) from safe_material;
    </select>
    <!--根据类型统计数量-->
    <select id="getCountByClassify" resultType="java.lang.Integer">
        select count(1) from safe_material where del_flag = 0 and material_classify_id = #{classifyId}
    <!--根据小类型统计数量-->
    <select id="getCountBySmallClassifyId" resultType="java.lang.Integer">
        select count(1) from safe_material where del_flag = 0 and small_classify_id = #{smallClassifyId}
    </select>
    <update id="deleteBatch">
        update safe_material set del_flag = 1 where id in
@@ -42,24 +43,34 @@
    <select id="listByConditions" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDO">
        select m.id,
               m.serial_num,
               m.material_classify_id,
               m.big_classify_id as bigClassifyId,
               m.small_classify_id as smallClassifyId,
               m.dep_id,
               m.dep_name,
               m.material_name,
               m.consumable,
               c.material_classify_name
               c.material_classify_name as bigClassifyName
        from safe_material m
        inner join safe_material_classify c
        on m.material_classify_id = c.id
        on m.big_classify_id = c.id
        where m.del_flag = 0
        <if test="query.materialName != null and query.materialName != '' ">
            and instr(m.material_name,#{query.materialName})>0
        </if>
        <if test="query.materialClassifyId != null">
            and m.material_classify_id = #{query.materialClassifyId}
        <if test="query.bigClassifyId != null">
            and m.big_classify_id = #{query.bigClassifyId}
        </if>
        order by m.create_time desc
    </select>
    <select id="checkMatrial" resultType="java.lang.Integer">
        select count(1)
        from safe_material
        where del_flag = 0
        and small_classify_id = #{smallClassifyId}
        and dep_id = #{depId}
        <if test="id != null">
            and id != #{id}
        </if>
    </select>
</mapper>