From f31ae33e37895b9517ee6ace6bd703f4bbb47e81 Mon Sep 17 00:00:00 2001 From: value <z1292839451@163.com> Date: 星期日, 23 六月 2024 23:44:30 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java index 66ca4aa..0aca9ac 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java @@ -58,16 +58,19 @@ 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 { @@ -373,6 +376,15 @@ }); } 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) { @@ -382,6 +394,12 @@ 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<>(); -- Gitblit v1.9.3