| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.safePlatform.commons.enums.ResultCodes; |
| | | import com.gkhy.safePlatform.commons.utils.StringUtils; |
| | | import com.gkhy.safePlatform.equipment.entity.SafeMaterialCountDO; |
| | | import com.gkhy.safePlatform.equipment.entity.SafeMaterialDO; |
| | | import com.gkhy.safePlatform.equipment.entity.SafeMaterialInfo; |
| | | import com.gkhy.safePlatform.equipment.entity.*; |
| | | import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; |
| | | import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialQuery; |
| | | import com.gkhy.safePlatform.equipment.repository.SafeMaterialInfoRepository; |
| | | import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialInfoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public SafeMaterialInfo queryById(Long id) { |
| | | public SafeMaterialDO queryById(Long id) { |
| | | if(null == id){ |
| | | throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); |
| | | } |
| | | SafeMaterialInfo safeMaterialInfo = repository.selectOne(new LambdaQueryWrapper<SafeMaterialInfo>() |
| | | .eq(SafeMaterialInfo::getId, id) |
| | | .eq(SafeMaterialInfo::getDelFlag, 0) |
| | | ); |
| | | return safeMaterialInfo; |
| | | } |
| | | |
| | | /** |
| | | * 根据类型统计数据 |
| | | */ |
| | | @Override |
| | | public int getCountByClassify(Long classifyId){ |
| | | if(null == classifyId){ |
| | | throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); |
| | | } |
| | | return repository.getCountByClassify(classifyId); |
| | | return repository.queryById(id); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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; |
| | | } |
| | | |
| | | @Override |
| | | public void updateCountById(SafeMaterialBO safeMaterialBO) { |
| | | if(null == safeMaterialBO){ |
| | | throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); |
| | | } |
| | | repository.updateCountById(safeMaterialBO); |
| | | } |
| | | |
| | | @Override |
| | | public List<SafeMaterialInfo> listByDepId(Long depId) { |
| | | if(null == depId){ |
| | | throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); |
| | | } |
| | | List<SafeMaterialInfo> safeMaterialInfoList = repository.selectList(new LambdaQueryWrapper<SafeMaterialInfo>() |
| | | .eq(SafeMaterialInfo::getDelFlag, 0) |
| | | .eq(SafeMaterialInfo::getDepId, depId)); |
| | | return safeMaterialInfoList; |
| | | } |
| | | |
| | | @Override |
| | | public void updateStockCount(List<SafeMaterialBO> safeMaterialBOList) { |
| | | if(CollectionUtils.isEmpty(safeMaterialBOList)){ |
| | | throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); |
| | | } |
| | | repository.updateStockCount(safeMaterialBOList); |
| | | } |
| | | |
| | | |
| | | } |