From 3aac0bf15ae2942f9b810715946be8a7588004ec Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期五, 28 二月 2025 11:39:53 +0800 Subject: [PATCH] 工时创建流程调整 --- basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java | 97 +++++++++++++++++------------------------------- 1 files changed, 34 insertions(+), 63 deletions(-) diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java index c5695ec..06567df 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java +++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java @@ -20,7 +20,6 @@ import com.ruoyi.basic.pojo.StandardProductListSupplierAsk; import com.ruoyi.basic.pojo.StandardTree; import com.ruoyi.basic.service.StandardProductListService; -import com.ruoyi.basic.service.StandardProductListService2; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -45,8 +44,6 @@ private StandardTreeMapper standardTreeMapper; - private StandardProductListService2 standardProductListService2; - private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; private StandardProductListSupplierAskMapper standardProductListSupplierAskMapper; @@ -57,10 +54,6 @@ return standardProductListMapper.updateById(list); } - @Override - public int delStandardProduct(JSONArray list) { - return standardProductListMapper.deleteBatchIds(list); - } @Override public List<StandardProductList> selectStandardProductList(InsSampleReceiveDto insSample) { @@ -139,7 +132,7 @@ } return true; }).peek(standardProductList -> { - // todo: 鍒ゆ柇鏄惁鏄師鏉愪笅鍗�, 闇�瑕佸晩鎶婇鑹茬粦瀹氬埌璇曟牱棰滆壊鐨勮姹傚�间笂 + //鍒ゆ柇鏄惁鏄師鏉愪笅鍗�, 闇�瑕佸晩鎶婇鑹茬粦瀹氬埌璇曟牱棰滆壊鐨勮姹傚�间笂 if (StringUtils.isNotBlank(insSample.getPartNo())) { // 鍒ゆ柇鏄惁鏈夎繖涓瓧娈典笖鏄枃鏈被鍨� if (StringUtils.isNotBlank(standardProductList.getInspectionItem()) @@ -263,13 +256,9 @@ @Override @Transactional(rollbackFor = Exception.class) - public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page) { + public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree) { String[] trees = tree.split(" - "); - try { - String tree1 = trees[2]; - } catch (Exception e) { - throw new BaseException("鎿嶄綔澶揩,绯荤粺浼犲弬閿欒!!!!"); - } + // 鍒ゆ柇鏄惁鎷栨嫿 boolean isDrag = false; List<StandardProductList> list = new ArrayList<>(); if (trees.length == 3) { @@ -411,55 +400,39 @@ if (sp.getTemplateId() != null && !sp.getTemplateId().equals("")) { pl.setTemplateId(sp.getTemplateId()); } - //鍥犱负杩樻湁涓骇鍝佸彨鑰愬紶绾垮す 鎺ョ画閲戝叿 ,杩欎袱涓」鐩殑鏁版嵁瀹屽叏涓�鏍�,鐗规畩澶勭悊 - if (sp.getTree() != null && !sp.getTree().equals("") && !pl.getTree().equals("涓ぉ绉戞妧妫�娴嬩腑蹇� - 鐢靛姏浜у搧瀹為獙瀹� - 閲戝叿 - 鑰愬紶绾垮す - null")) { - pl.setTree(sp.getTree()); - } break; } } } - if (page == 1) { - Integer userId = SecurityUtils.getUserId().intValue(); -// CompletableFuture.supplyAsync(() -> { - if (trees.length == 5) { - standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate() - .eq(StandardProductList::getStandardMethodListId, id) - .eq(StandardProductList::getTree, tree)); - } else { - standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate() - .eq(StandardProductList::getStandardMethodListId, id) - .like(StandardProductList::getTree, tree)); - } - boolean success = false; - int retryCount = 0; - while (!success && retryCount < 100) { - try { - standardProductListService2.saveBatch(list.stream().map(a -> { - a.setFactory(trees[0]); - a.setLaboratory(trees[1]); - a.setSampleType(trees[2]); - a.setCreateUser(userId); - a.setUpdateUser(userId); - a.setStandardMethodListId(id); - return a; - }).collect(Collectors.toList())); - ; - success = true; - } catch (Exception e) { - // 澶勭悊閲嶅 ID 鐨勮褰曪紝閲嶆柊鐢熸垚 ID 骞剁户缁皾璇曟彃鍏� - for (StandardProductList productList : list) { - productList.setId(IdWorker.getId()); - } - } - } - if (!success) { - throw new RuntimeException("鎻掑叆澶辫触"); - } - + Integer userId = SecurityUtils.getUserId().intValue(); + if (trees.length == 5) { + standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate() + .eq(StandardProductList::getStandardMethodListId, id) + .eq(StandardProductList::getTree, tree)); + } else { + standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate() + .eq(StandardProductList::getStandardMethodListId, id) + .like(StandardProductList::getTree, tree)); } - Map<String, Object> map = new HashMap<>(); + + + List<StandardProductList> productLists = list.stream().map(a -> { + a.setFactory(trees[0]); + a.setLaboratory(trees[1]); + a.setSampleType(trees[2]); + a.setCreateUser(userId); + a.setUpdateUser(userId); + a.setStandardMethodListId(id); + return a; + }).collect(Collectors.toList()); +// this.saveBatch(productLists); + // 鎵归噺娣诲姞鏍囧噯 + if (CollectionUtils.isNotEmpty(productLists)) { + baseMapper.saveBatchProductLists(productLists); + } + + Collections.sort(list, (o1, o2) -> { String field1 = o1.getManHourGroup(); String field2 = o2.getManHourGroup(); @@ -484,11 +457,9 @@ list.sort((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort()) - (o2.getSort() == null ? 0 : o2.getSort())); } - try { - map.put("productList", list.subList((page - 1) * 300, page * 300)); - } catch (IndexOutOfBoundsException e) { - map.put("productList", list.subList((page - 1) * 300, list.size())); - } + + Map<String, Object> map = new HashMap<>(); + map.put("productList", list); map.put("total", list.size()); return map; } @@ -583,7 +554,7 @@ @Override public void resetTreeDragBatch(List<StandardProductList> standardProductLists) { - standardProductListService2.updateBatchById(standardProductLists); + this.updateBatchById(standardProductLists); } /** -- Gitblit v1.9.3