From a40e6b29c5a02c14712d56ffed16e36ce89464ca Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 29 十二月 2025 17:00:01 +0800
Subject: [PATCH] 报告生成调整
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
index e1d8152..727c34b 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -1798,7 +1798,7 @@
AtomicInteger finalIndex = new AtomicInteger(1);
List<String> cableTags = insOrderMapper.selectSampleCableTag(insSample.getId());
- max = cableTags.size();
+ max = Math.max(cableTags.size(),1);
//澶勭悊鐢电紗閰嶇疆妫�娴嬮」
Map<String, List<SampleProductExportDto>> tempMap = new HashMap<>();
Map<String, List<SampleProductExportDto>> tempMap2 = new HashMap<>();
@@ -1828,8 +1828,8 @@
tempMap.putAll(listMap);
sortSampleProduct(tempMap,totalItem);
int tagNum = Math.min(max,maxCableTag);
- List<String> tagList = cableTags.subList(0,tagNum);
- handlerSampleItems(totalItem,finalIndex,sampleList,tagNum,text,rows,rowRenderData,resultCh,tagList,true);
+ List<String> tagList = cableTags.isEmpty()?new ArrayList<>():cableTags.subList(0,tagNum);
+ handlerSampleItems(OrderType.WG.getValue(),totalItem,finalIndex,sampleList,tagNum,text,rows,rowRenderData,resultCh,tagList,true);
if(CollectionUtil.isNotEmpty(tempMap2)){
sortSampleProduct(tempMap2,cableTagEnclosureItem);
@@ -1840,7 +1840,7 @@
List<TextRenderData> newText = new ArrayList<TextRenderData>();
List<RowRenderData> newRows = new ArrayList<>();
RowRenderData newRowRenderData = null;
- handlerSampleItems(cableTagEnclosureItem,finalIndex2, new ArrayList<>(),newCableTags.size(),newText,newRows,newRowRenderData,resultCh,newCableTags,true);
+ handlerSampleItems(OrderType.WG.getValue(),cableTagEnclosureItem,finalIndex2, new ArrayList<>(),newCableTags.size(),newText,newRows,newRowRenderData,resultCh,newCableTags,true);
tableRenderData2.setRows(newRows);
tableRenderData2.setTableStyle(setTableStyle(newCableTags.size()));
HashMap<String, Object> tableMap = new HashMap<>();
@@ -1876,7 +1876,7 @@
AtomicInteger finalIndex = new AtomicInteger(1);
- handlerSampleItems(item,finalIndex,sampleList,max,text,rows,rowRenderData,resultCh,null,true);
+ handlerSampleItems(OrderType.RAW.getValue(), item,finalIndex,sampleList,max,text,rows,rowRenderData,resultCh,null,true);
tableRenderData.setRows(rows);
tableRenderData.setTableStyle(setTableStyle(max));
@@ -1937,7 +1937,7 @@
* @param rowRenderData
* @param resultCh
*/
- private static void handlerSampleItems(Map<String, List<SampleProductExportDto>> item,AtomicInteger finalIndex,List<SampleProductExportDto> sampleList,Integer max,List<TextRenderData> text,List<RowRenderData> rows,RowRenderData rowRenderData,AtomicReference<String> resultCh,List<String> cableTagList,Boolean hasAddHead ){
+ private static void handlerSampleItems(String orderType,Map<String, List<SampleProductExportDto>> item,AtomicInteger finalIndex,List<SampleProductExportDto> sampleList,Integer max,List<TextRenderData> text,List<RowRenderData> rows,RowRenderData rowRenderData,AtomicReference<String> resultCh,List<String> cableTagList,Boolean hasAddHead ){
item.forEach((s, sampleProductDtoInside) -> {
// 娣诲姞妫�楠岄」
SampleProductExportDto dto2 = new SampleProductExportDto();
@@ -1953,7 +1953,7 @@
String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getCableTag();
if (map.containsKey(productName)) {
// 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
- if(CollectionUtil.isEmpty(map.get(productName).getLastValueList())){
+ if(CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){
map.get(productName)
.getLastValueList()
.add(productDto2.getLastValue());
@@ -1963,7 +1963,7 @@
.add(productDto2.getInsResult());
} else {
// 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
- if(CollectionUtil.isEmpty(productDto2.getLastValueList())){
+ if(CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){
productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
productDto2.getLastValueList().add(productDto2.getLastValue());
}
@@ -1998,7 +1998,7 @@
String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getInspectionItemSubclass() + productDto2.getCableTag();
if (map.containsKey(productName)) {
// 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
- if(CollectionUtil.isEmpty(map.get(productName).getLastValueList())){
+ if(CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){
map.get(productName)
.getLastValueList()
.add(productDto2.getLastValue());
@@ -2008,7 +2008,7 @@
.add(productDto2.getInsResult());
} else {
// 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
- if(CollectionUtil.isEmpty(productDto2.getLastValueList())){
+ if(CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){
productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
productDto2.getLastValueList().add(productDto2.getLastValue());
}
--
Gitblit v1.9.3