| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public List<StandardProductList> selectStandardProductList(InsSample insSample) { |
| | | List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, insSample.getFactory()).eq(StandardProductList::getLaboratory, insSample.getLaboratory()).eq(StandardProductList::getSampleType, insSample.getSampleType()).eq(StandardProductList::getSample, insSample.getSample()).eq(StandardProductList::getModel, insSample.getModel())); |
| | | if (list.size() == 0) { |
| | | list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, insSample.getFactory()).eq(StandardProductList::getLaboratory, insSample.getLaboratory()).eq(StandardProductList::getSampleType, insSample.getSampleType()).eq(StandardProductList::getSample, insSample.getSample())); |
| | | list = list.stream().filter(a -> { |
| | | try { |
| | | list = list.stream().filter(a -> { |
| | | String[] split = a.getSection().split("~"); |
| | | return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(split[0])) > -1 && new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(split[1])) < 1; |
| | | }).collect(Collectors.toList()); |
| | | } catch (Exception e) {} |
| | | } |
| | | if(a.getSection()!=null && !Objects.equals(a.getSection(), "")){ |
| | | if (a.getSection().contains("~")) { |
| | | String[] split = a.getSection().split("~"); |
| | | return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(split[0])) > -1 && new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(split[1])) < 1; |
| | | } else if (a.getSection().contains("≥") || a.getSection().contains(">=")) { |
| | | String param = a.getSection().replace("≥", "").replace(">=",""); |
| | | return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) > -1; |
| | | } else if (a.getSection().contains("≤") || a.getSection().contains("<=")) { |
| | | String param = a.getSection().replace("≤", "").replace("<=",""); |
| | | return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) < 1; |
| | | } else if (a.getSection().contains(">")) { |
| | | String param = a.getSection().replace(">", ""); |
| | | return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) > 0; |
| | | } else if (a.getSection().contains("<")) { |
| | | String param = a.getSection().replace("<", ""); |
| | | return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) < 0; |
| | | } else if (a.getSection().contains("=")) { |
| | | String param = a.getSection().replace("=", ""); |
| | | return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) == 0; |
| | | } |
| | | } |
| | | } catch (Exception ignored) { |
| | | return false; |
| | | } |
| | | return true; |
| | | }).collect(Collectors.toList()); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<StandardProductList> selectStandardProductListByMethodId(Integer id) { |
| | | return standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id)); |
| | | } |
| | | } |
| | | |
| | | |