| | |
| | | public List<StandardProductList> selectStandardProductList(InsSample insSample) { |
| | | String[] models = insSample.getModel().split("-(?=[^-]*$)");//拆分最后一个【-】 |
| | | String[] factorys = insSample.getFactory().split(" - "); |
| | | List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, models[0]).eq(StandardProductList::getSampleType, factorys[2])); |
| | | //List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, models[0]).eq(StandardProductList::getSampleType, factorys[2])); |
| | | List<StandardProductList> list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, models[0]); |
| | | if (list.size() == 0) { |
| | | if (Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null) { |
| | | return null; |
| | | } |
| | | String[] split = insSample.getFactory().split(" - "); |
| | | list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() |
| | | list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3]); |
| | | /* list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() |
| | | .eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()) |
| | | .eq(StandardProductList::getState, 1) |
| | | .like(StandardProductList::getTree, split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3])); |
| | | .like(StandardProductList::getTree, split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3]));*/ |
| | | |
| | | } |
| | | list = list.stream().filter(a -> { |
| | | try { |
| | |
| | | }); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Collections.sort(list, (o1, o2) -> { |
| | | String field1 = o1.getManHourGroup(); |
| | | String field2 = o2.getManHourGroup(); |
| | | |
| | | int num1 = extractNumber(field1); |
| | | int num2 = extractNumber(field2); |
| | | |
| | | return Integer.compare(num1, num2); |
| | | }); |
| | | try { |
| | | map.put("productList", list.subList((page - 1) * 50, page * 50)); |
| | | } catch (IndexOutOfBoundsException e) { |
| | |
| | | return map; |
| | | } |
| | | |
| | | private int extractNumber(String s) { |
| | | // 从字符串中提取数字的逻辑,这里假设字段的格式是 "text<number>" |
| | | String number = s.replaceAll("\\D", ""); |
| | | return Integer.parseInt(number); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<StandardProductList> selectStandardProductByMethodId(Integer id, String tree, Integer page, String laboratory, String item, String items) { |
| | | IPage<StandardProductList> iPage = new Page<>(); |