From 3547641f25634eec4b6dcf379080e92ed5025ee1 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期五, 21 六月 2024 14:21:52 +0800 Subject: [PATCH] 解决工时排序问题+考评bug调试 --- 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 491465c..a14f013 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 { @@ -255,6 +258,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) { @@ -264,6 +276,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