| | |
| | | String[] models = insSample.getModel().split("-(?=[^-]*$)");//拆分最后一个【-】 |
| | | List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, models[0])); |
| | | if (list.size() == 0) { |
| | | list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1)); |
| | | list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() |
| | | .eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()) |
| | | .eq(StandardProductList::getState, 1) |
| | | .like(StandardProductList::getTree, insSample.getFactory().split("-(?=[^-]*$)")[0])); |
| | | } |
| | | list = list.stream().filter(a -> { |
| | | try { |
| | |
| | | List<String> tells = JSON.parseArray(a.getTell(), String.class); |
| | | List<String> manHours = JSON.parseArray(a.getManHour(), String.class); |
| | | List<String> prices = JSON.parseArray(a.getPrice(), String.class); |
| | | boolean isIf = false; |
| | | boolean isIf; |
| | | for (int i = 0; i < sections.size(); i++) { |
| | | if (sections.get(i).contains("&")) { |
| | | String[] split = sections.get(i).split("&"); |
| | | isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(split[0])) > -1 && new BigDecimal(models[1]).compareTo(new BigDecimal(split[1])) < 1; |
| | | } else if (sections.get(i).contains("≥") || sections.get(i).contains(">=")) { |
| | | String param = sections.get(i).replace("≥", "").replace(">=", ""); |
| | | isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) > -1; |
| | | } else if (sections.get(i).contains("≤") || sections.get(i).contains("<=")) { |
| | | String param = sections.get(i).replace("≤", "").replace("<=", ""); |
| | | isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) < 1; |
| | | } else if (sections.get(i).contains(">")) { |
| | | String param = sections.get(i).replace(">", ""); |
| | | isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) > 0; |
| | | } else if (sections.get(i).contains("<")) { |
| | | String param = sections.get(i).replace("<", ""); |
| | | isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) < 0; |
| | | } else if (sections.get(i).contains("=")) { |
| | | String param = sections.get(i).replace("=", ""); |
| | | isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) == 0; |
| | | isIf = getIsIf(split[0], models[1]) && getIsIf(split[1], models[1]); |
| | | } else { |
| | | isIf = getIsIf(sections.get(i), models[1]); |
| | | } |
| | | if (isIf) { |
| | | a.setSection(sections.get(i)); |
| | |
| | | return list; |
| | | } |
| | | |
| | | private boolean getIsIf(String str, String model){ |
| | | if (str.contains("≥") || str.contains(">=")) { |
| | | String param = str.replace("≥", "").replace(">=", ""); |
| | | return new BigDecimal(model).compareTo(new BigDecimal(param)) > -1; |
| | | } else if (str.contains("≤") || str.contains("<=")) { |
| | | String param = str.replace("≤", "").replace("<=", ""); |
| | | return new BigDecimal(model).compareTo(new BigDecimal(param)) < 1; |
| | | } else if (str.contains(">")||str.contains(">")) { |
| | | String param = str.replace(">", "").replace(">", ""); |
| | | return new BigDecimal(model).compareTo(new BigDecimal(param)) > 0; |
| | | } else if (str.contains("<")||str.contains("<")) { |
| | | String param = str.replace("<", "").replace("<", ""); |
| | | return new BigDecimal(model).compareTo(new BigDecimal(param)) < 0; |
| | | } else if (str.contains("=")) { |
| | | String param = str.replace("=", ""); |
| | | return new BigDecimal(model).compareTo(new BigDecimal(param)) == 0; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page) { |
| | | String[] trees = tree.split(" - "); |