| | |
| | | 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 com.yuanchu.mom.mapper.StandardProductListMapper; |
| | | import com.yuanchu.mom.mapper.StandardTreeMapper; |
| | | import com.yuanchu.mom.pojo.InsSample; |
| | | import com.yuanchu.mom.pojo.StandardProductList; |
| | | import com.yuanchu.mom.service.StandardProductListService; |
| | | import com.yuanchu.mom.mapper.StandardProductListMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | private StandardProductListMapper standardProductListMapper; |
| | | |
| | | private StandardTreeMapper standardTreeMapper; |
| | | |
| | | @Override |
| | | public int upStandardProductList(StandardProductList list) { |
| | | return standardProductListMapper.updateById(list); |
| | |
| | | List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1)); |
| | | list = list.stream().filter(a -> { |
| | | try { |
| | | if(a.getSection()!=null && !Objects.equals(a.getSection(), "")){ |
| | | 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(">=",""); |
| | | 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("<=",""); |
| | | 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(">", ""); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<StandardProductList> selectStandardProductListByMethodId(Integer id) { |
| | | return standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id)); |
| | | public List<StandardProductList> selectStandardProductListByMethodId(Integer id, String tree) { |
| | | String[] trees = tree.split(" - "); |
| | | List<StandardProductList> list; |
| | | if(tree.length() == 3){ |
| | | list = standardTreeMapper.selectStandardProductListByTree(trees[2], trees[3]); |
| | | }else{ |
| | | list = standardTreeMapper.selectStandardProductListByTree(trees[2], null); |
| | | } |
| | | List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id)); |
| | | return list; |
| | | } |
| | | } |
| | | |