From ed56ae711e18c6f7624dac633c4af3ecfcf09520 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 18 九月 2026 16:40:19 +0800
Subject: [PATCH] fix:报告生成所有带导出值批注的检验项
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 554 ++++++++++++++++++++++++++++++------------------------
1 files changed, 308 insertions(+), 246 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 cd0ebb6..f09b388 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
@@ -281,12 +281,12 @@
/**
* 鐩寸粦妯℃澘璁㈠崟鐨勯〉绛炬潵婧愭槸璁㈠崟妯℃澘蹇収锛岃�屼笉鏄凡鐢熸垚鐨勬楠岄」銆�
- *
+ * <p>
* 浠嶄繚鐣欐瘡涓ā鏉夸笅宸叉湁鐨勬楠岄」璁板綍锛涘鏋滄煇涓ā鏉挎病鏈夆�滄楠岄」鈥濇爣璁帮紝琛ヤ竴鏉′粎鐢ㄤ簬
* 鎵胯浇妯℃澘鍐呭鐨勮繑鍥炲璞★紝浣垮墠绔篃鑳藉睍绀恒�佸~鍐欒妯℃澘銆�
*/
private List<InsProduct> mergeDirectTemplateSnapshots(InsOrder order, Integer sampleId,
- String laboratory, List<InsProduct> products) {
+ String laboratory, List<InsProduct> products) {
List<InsProduct> source = products == null ? new ArrayList<>() : products;
List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
Wrappers.<InsOrderStandardTemplate>lambdaQuery()
@@ -343,7 +343,7 @@
}
@Override
- public Map<String,Object> checkSubmitPlan(Integer orderId, String laboratory) {
+ public Map<String, Object> checkSubmitPlan(Integer orderId, String laboratory) {
Map<String, Object> map = new HashMap<>();
List<String> collect = new ArrayList<>();
if (isDirectTemplateOrder(orderId)) {
@@ -820,12 +820,12 @@
JSONObject recordValues = StrUtil.isBlank(snapshot.getRecordValues())
? new JSONObject() : JSON.parseObject(snapshot.getRecordValues());
- // 淇濆瓨鏃跺悓鏍峰彧鍙栨ā鏉夸腑鐨勭涓�涓鍑哄�硷紝鎻愪氦鏍¢獙涓庝繚瀛樺彛寰勪繚鎸佷竴鑷淬��
- String coordinate = coordinates.get(0);
- JSONObject cell = recordValues.getJSONObject(coordinate);
- Object value = cell == null ? null : cell.get("v");
- if (value == null || StringUtils.isBlank(String.valueOf(value))) {
- missing.add(templateName + "锛�" + coordinate + "锛�");
+ for (String coordinate : coordinates) {
+ JSONObject cell = recordValues.getJSONObject(coordinate);
+ Object value = cell == null ? null : cell.get("v");
+ if (value == null || StringUtils.isBlank(String.valueOf(value))) {
+ missing.add(templateName + "锛�" + coordinate + "锛�");
+ }
}
}
return missing;
@@ -846,7 +846,7 @@
throw new ErrorException("妫�楠屽崟涓嶅瓨鍦�");
}
Set<Integer> deviceIds = dto.getDeviceIds() == null ? Collections.emptySet() : dto.getDeviceIds().stream()
- .filter(Objects::nonNull).collect(Collectors.toSet());
+ .filter(Objects::nonNull).collect(Collectors.toSet());
List<InsOrderDeviceRecord> oldRecords = insOrderDeviceRecordMapper.selectList(
Wrappers.<InsOrderDeviceRecord>lambdaQuery().eq(InsOrderDeviceRecord::getInsOrderId, dto.getOrderId()));
Set<Integer> oldIds = oldRecords.stream().map(InsOrderDeviceRecord::getDeviceId).collect(Collectors.toSet());
@@ -943,6 +943,7 @@
/**
* 鏌ヨ妯℃澘鍐呭
+ *
* @param order
* @param insProducts
*/
@@ -1024,6 +1025,7 @@
/**
* todo: 鍘熷璁板綍妯℃澘娓呴櫎娌℃湁浣跨敤鐨勬楠岄」(鏆傛椂鏈塨ug鏃犳硶浣跨敤)
+ *
* @param sheet
* @param itemNameList
*/
@@ -1096,6 +1098,7 @@
/**
* 鍧愭爣鎷兼帴
+ *
* @param r 妯潗鏍�
* @param c 绾靛潗鏍�
* @return
@@ -1169,7 +1172,7 @@
int count = 0;
for (InsProduct product : insProducts) {
count++;
- str += (count != 0 ? "\n" : "") + count + "锛�" +
+ str += (count != 0 ? "\n" : "") + count + "锛�" +
product.getInspectionItemClass() + " " +
product.getInspectionItem() + " " +
product.getInspectionItemSubclass();
@@ -1296,7 +1299,7 @@
// 鐧昏妫�楠岀粨鏋�
// 鍒ゆ柇鏄惁鏈変笉鍚堟牸, 鏈変笉鍚堟牸涓嶈兘绉诲簱
// todo: ifs绉诲簱
- insReportService.isRawMaterial(order,registerInsResults,false);
+ insReportService.isRawMaterial(order, registerInsResults, false);
// 14 鍒ゆ柇褰撳墠鏍峰搧鏄惁涓哄師鏉愭枡, 鍘熸潗鏂欓渶瑕佽繘琛屾暟鎹垎鏋�, 鍒ゆ柇涔嬪墠10鏉℃暟鎹悓涓�涓緵搴斿晢, 鍚屼竴涓楠岄」鐨勫亸宸槸鍚﹁秴杩�10%
// 鏌ヨifs淇℃伅鑾峰彇鑾峰彇鍓�10涓緵搴斿晢涓�鏍风殑, 妫�楠岄」涓�鏍蜂俊鎭�
@@ -1326,6 +1329,7 @@
/**
* *****娣诲姞鍒嗘瀽鏁版嵁******
+ *
* @param productList
* @param ifsInventoryQuantity
* @param order
@@ -1416,6 +1420,7 @@
/**
* *****璁$畻鍋忓樊****
+ *
* @param data
* @param targetStr
* @return
@@ -1441,12 +1446,13 @@
/**
* *****璁$畻鍋忓樊锛堣姹傚�硷級****
+ *
* @param asked
* @param targetStr
* @return
*/
public static double isDeviationOverTenPercentByAsked(String asked, String targetStr) {
- if(!isNumeric(asked)) return 0;
+ if (!isNumeric(asked)) return 0;
double average = Double.parseDouble(asked);
double target = Double.parseDouble(targetStr);
double deviationPercent = Math.abs(target - average) / average * 100;
@@ -1459,6 +1465,7 @@
/**
* ******鍘熷璁板綍妯℃澘澶嶅埗*****
+ *
* @param orderId
* @param ids
*/
@@ -1541,6 +1548,7 @@
/**
* 妫�楠屼换鍔″鏍�
+ *
* @param orderId
* @param laboratory
* @param type
@@ -1616,7 +1624,7 @@
.collect(Collectors.toList());
if (templateResults.isEmpty()
|| templateResults.stream().anyMatch(result -> !Objects.equals(result, 0)
- && !Objects.equals(result, 1))) {
+ && !Objects.equals(result, 1))) {
throw new ErrorException("璇峰厛濉啓鍏ㄩ儴妯℃澘鐨勬楠岀粨璁�");
}
Integer aggregateResult = templateResults.stream().allMatch(result -> Objects.equals(result, 1))
@@ -1794,6 +1802,7 @@
/**
* 鐢熸垚鎶ュ憡
+ *
* @param orderId
*/
private void generateReport(Integer orderId, Integer reportType, Integer writeUserId) {
@@ -1801,19 +1810,19 @@
//杩欓噷鐨刬nsSamples鏄鍗曚笅鐨勬墍鏈夋牱鍝佸寘鎷�("/")
List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
if (Objects.equals(reportType, INSPECTION_REPORT)) {
- for (InsSample insSample : insSamples) {
- List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
- .eq(InsProduct::getInsSampleId, insSample.getId())
- .eq(InsProduct::getState, 1)
- .ne(InsProduct::getIsBinding, 1));
- List<Integer> results = insProducts.stream().map(InsProduct::getInsResult).filter(Objects::nonNull).collect(Collectors.toList());
- if (results.contains(0)) {
- insSample.setInsResult(0);
- } else {
- insSample.setInsResult(1);
+ for (InsSample insSample : insSamples) {
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsSampleId, insSample.getId())
+ .eq(InsProduct::getState, 1)
+ .ne(InsProduct::getIsBinding, 1));
+ List<Integer> results = insProducts.stream().map(InsProduct::getInsResult).filter(Objects::nonNull).collect(Collectors.toList());
+ if (results.contains(0)) {
+ insSample.setInsResult(0);
+ } else {
+ insSample.setInsResult(1);
+ }
+ insSampleMapper.updateById(insSample);
}
- insSampleMapper.updateById(insSample);
- }
}
InsOrder insOrder = insOrderMapper.selectById(orderId);
// 鎶芥鍙樻垚濮旀墭妫�楠�
@@ -1835,6 +1844,7 @@
/**
* 鐢电紗閰嶇疆, 鏌ョ湅閰嶇疆鏍囪瘑
+ *
* @param id
* @param laboratory
* @return
@@ -1846,6 +1856,7 @@
/**
* 鍘熸潗鏂欐煡鐪嬫爣璇�
+ *
* @param id
* @param laboratory
* @return
@@ -1857,6 +1868,7 @@
/**
* 鏌ョ湅閲嶅鏍囪瘑
+ *
* @param id
* @param laboratory
* @return
@@ -1868,6 +1880,7 @@
/**
* 鏂板涓嶅悎鏍煎娴嬪唴瀹�
+ *
* @return
*/
@Override
@@ -2064,6 +2077,7 @@
/**
* 鏌ヨ杩涜揣鍘熷璁板綍
+ *
* @param insOrderId
* @return
*/
@@ -2119,6 +2133,7 @@
/**
* 淇濆瓨鍘熸潗鏂欒繘璐ч獙璇�
+ *
* @param factoryVerify
* @return
*/
@@ -2170,22 +2185,34 @@
/**
* 璁剧疆琛ㄦ牸鏍峰紡
+ *
* @param max 鏍囪瘑鏈�澶т釜鏁�
* @return
*/
- private TableStyle setTableStyle(int max, boolean showResult){
+ private TableStyle setTableStyle(int max, boolean showResult) {
//璁剧疆鏍峰紡
TableStyle tableStyle = new TableStyle();
if (!showResult) {
switch (max) {
- case 1: tableStyle.setColWidths(new int[]{650, 3000, 850, 2400, 3100}); break;
- case 2: tableStyle.setColWidths(new int[]{650, 2800, 850, 2200, 1750, 1750}); break;
- case 3: tableStyle.setColWidths(new int[]{650, 2600, 850, 1800, 1400, 1400, 1400}); break;
- case 4: tableStyle.setColWidths(new int[]{650, 2400, 850, 1600, 1125, 1125, 1125, 1125}); break;
- case 5: tableStyle.setColWidths(new int[]{650, 2200, 850, 1500, 960, 960, 960, 960, 960}); break;
- default: break;
+ case 1:
+ tableStyle.setColWidths(new int[]{650, 3000, 850, 2400, 3100});
+ break;
+ case 2:
+ tableStyle.setColWidths(new int[]{650, 2800, 850, 2200, 1750, 1750});
+ break;
+ case 3:
+ tableStyle.setColWidths(new int[]{650, 2600, 850, 1800, 1400, 1400, 1400});
+ break;
+ case 4:
+ tableStyle.setColWidths(new int[]{650, 2400, 850, 1600, 1125, 1125, 1125, 1125});
+ break;
+ case 5:
+ tableStyle.setColWidths(new int[]{650, 2200, 850, 1500, 960, 960, 960, 960, 960});
+ break;
+ default:
+ break;
}
- } else if(max<=5){
+ } else if (max <= 5) {
for (int i = 1; i <= max; i++) {
// 鏍规嵁妫�楠岀粨鏋滀釜鏁颁慨鏀归暱搴�
switch (i) {
@@ -2224,30 +2251,31 @@
/**
* 澶勭悊鏈夌數缂嗛鑹叉爣璇嗙殑妫�娴嬮」
- * @param cableTags 鐢电紗棰滆壊鏍囪瘑
- * @param collect 妫�娴嬮」鍒楄〃
+ *
+ * @param cableTags 鐢电紗棰滆壊鏍囪瘑
+ * @param collect 妫�娴嬮」鍒楄〃
* @param startIndex 璧峰涓嬫爣
* @param endIndex 缁撴潫涓嬫爣
* @return
*/
- private List<SampleProductExportDto> transformSampleProduct(List<String> cableTags,Map<String, List<SampleProductExportDto>> collect,int startIndex,int endIndex){
+ private List<SampleProductExportDto> transformSampleProduct(List<String> cableTags, Map<String, List<SampleProductExportDto>> collect, int startIndex, int endIndex) {
List<SampleProductExportDto> sampleProductExportDtos = new ArrayList<>();
for (String s : collect.keySet()) {
List<String> lastValueList = new ArrayList<>();
SampleProductExportDto dto = new SampleProductExportDto();
- BeanUtil.copyProperties(collect.get(s).get(0),dto);
+ BeanUtil.copyProperties(collect.get(s).get(0), dto);
Set<String> tellSet = new HashSet<>();
for (int i = startIndex; i < endIndex; i++) {
String cableTag = cableTags.get(i);
for (SampleProductExportDto sDto : collect.get(s)) {
tellSet.add(sDto.getTell());
- if(sDto.getCableTag().equals(cableTag)){
+ if (sDto.getCableTag().equals(cableTag)) {
lastValueList.add(sDto.getLastValue());
}
}
}
//鍒囧壊鐢电紗閰嶇疆椤�
- dto.setTell(String.join("\n",tellSet));
+ dto.setTell(String.join("\n", tellSet));
dto.setLastValueList(lastValueList);
sampleProductExportDtos.add(dto);
}
@@ -2256,10 +2284,11 @@
/**
* 妫�娴嬮」鎺掑簭
+ *
* @param sourceMap
* @param targetMap
*/
- private void sortSampleProduct(Map<String, List<SampleProductExportDto>> sourceMap,Map<String, List<SampleProductExportDto>> targetMap){
+ private void sortSampleProduct(Map<String, List<SampleProductExportDto>> sourceMap, Map<String, List<SampleProductExportDto>> targetMap) {
List<Map.Entry<String, List<SampleProductExportDto>>> entries = new ArrayList<>(sourceMap.entrySet());
entries.sort(Comparator.comparingInt(o -> (o.getValue().get(0).getSort() == null ? 0 : o.getValue().get(0).getSort())));
for (Map.Entry<String, List<SampleProductExportDto>> entry : entries) {
@@ -2269,6 +2298,7 @@
/**
* 灏忔姤鍛婄敓鎴�
+ *
* @param orderId
* @param insOrder
* @param insSamples
@@ -2290,7 +2320,7 @@
//鏌ヨ闆朵欢灞炴��
IfsPartPropsRecord ifsPartPropsRecord = ifsPartPropsRecordMapper.selectOne(Wrappers.<IfsPartPropsRecord>lambdaQuery()
.eq(IfsPartPropsRecord::getIfsInventoryId, ifsInventoryQuantity.getId()));
- if(Objects.nonNull(ifsPartPropsRecord)){
+ if (Objects.nonNull(ifsPartPropsRecord)) {
enterFactoryReport.setOuterColor(ifsPartPropsRecord.getOuterColor());
}
enterFactoryReport.setQtyArrived(ifsInventoryQuantity.getQtyArrived() == null ? "" :
@@ -2315,7 +2345,7 @@
List<RowRenderData> rows = new ArrayList<>();
List<TextRenderData> text = new ArrayList<>();
RowRenderData rowRenderData = null;
- List<Map<String,Object>> cableTagEnclosureTables = new ArrayList<>();
+ List<Map<String, Object>> cableTagEnclosureTables = new ArrayList<>();
// 鏌ヨ妫�楠屽唴瀹�
List<SampleProductExportDto> sampleProductDto2s = insOrderMapper.selectSampleBySampleId(insSamples.stream()
@@ -2328,7 +2358,7 @@
Integer max = insSamples.stream().mapToInt(InsSample::getQuantity).sum();
TableRenderData tableRenderData = new TableRenderData();
String templateName;
- if(StringUtils.equals(OrderType.WG.getValue(),ifsInventoryQuantity.getOrderType())){
+ if (StringUtils.equals(OrderType.WG.getValue(), ifsInventoryQuantity.getOrderType())) {
//杩囨护涓嶅垽瀹氱殑妫�娴嬮」
List<SampleProductExportDto> filterItems = sampleProductDto2s.stream()
.filter(f -> !showResult || f.getInsResult() != 3)
@@ -2337,7 +2367,7 @@
templateName = showResult ? "/static/small-wg-report-template.docx" : "/static/small-wg-detection-template.docx";
//鏌ヨ妫�楠屽崟娑堟伅
InsSampleUserVO insSampleUser = insSampleUserMapper.selectUserNameByOrderId(orderId);
- if(Objects.nonNull(insSampleUser)){
+ if (Objects.nonNull(insSampleUser)) {
enterFactoryReport.setPartDesc(insSampleUser.getModel());
enterFactoryReport.setInspector(insSampleUser.getInspector());
enterFactoryReport.setInspectDate(insSampleUser.getInspectDate());
@@ -2349,7 +2379,7 @@
AtomicInteger finalIndex = new AtomicInteger(1);
List<String> cableTags = insOrderMapper.selectSampleCableTag(insSample.getId());
- max = Math.max(cableTags.size(),1);
+ max = Math.max(cableTags.size(), 1);
//澶勭悊鐢电紗閰嶇疆妫�娴嬮」
Map<String, List<SampleProductExportDto>> tempMap = new HashMap<>();
Map<String, List<SampleProductExportDto>> tempMap2 = new HashMap<>();
@@ -2361,41 +2391,41 @@
List<SampleProductExportDto> sampleProductExportDtos2;
//澶勭悊鐢电紗閰嶇疆椤�
Map<String, List<SampleProductExportDto>> collect = listMap2.get(key).stream().collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItemSubclass));
- if(cableTags.size()>maxCableTag){
- sampleProductExportDtos = transformSampleProduct(cableTags,collect,0,maxCableTag);
- sampleProductExportDtos2 = transformSampleProduct(cableTags,collect,maxCableTag,cableTags.size());
- tempMap2.put(key,sampleProductExportDtos2);
- }else{
- sampleProductExportDtos = transformSampleProduct(cableTags,collect,0,cableTags.size());
+ if (cableTags.size() > maxCableTag) {
+ sampleProductExportDtos = transformSampleProduct(cableTags, collect, 0, maxCableTag);
+ sampleProductExportDtos2 = transformSampleProduct(cableTags, collect, maxCableTag, cableTags.size());
+ tempMap2.put(key, sampleProductExportDtos2);
+ } else {
+ sampleProductExportDtos = transformSampleProduct(cableTags, collect, 0, cableTags.size());
}
- cableTagItem.put(key,sampleProductExportDtos);
+ cableTagItem.put(key, sampleProductExportDtos);
}
//澶勭悊闈炵數缂嗛厤缃娴嬮」
Map<String, List<SampleProductExportDto>> listMap = filterItems.stream()
.filter(f -> StringUtils.isBlank(f.getCableTag()) && StringUtils.isNotBlank(f.getInspectionItem()))
- .collect(Collectors.groupingBy(s->s.getInspectionItem()+"&"));
+ .collect(Collectors.groupingBy(s -> s.getInspectionItem() + "&"));
//鍚堝苟妫�娴嬮」鍒楄〃
tempMap.putAll(cableTagItem);
tempMap.putAll(listMap);
- sortSampleProduct(tempMap,totalItem);
- int tagNum = Math.min(max,maxCableTag);
- List<String> tagList = cableTags.isEmpty()?new ArrayList<>():cableTags.subList(0,tagNum);
+ sortSampleProduct(tempMap, totalItem);
+ int tagNum = Math.min(max, maxCableTag);
+ 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, showResult);
- if(CollectionUtil.isNotEmpty(tempMap2)){
- sortSampleProduct(tempMap2,cableTagEnclosureItem);
+ if (CollectionUtil.isNotEmpty(tempMap2)) {
+ sortSampleProduct(tempMap2, cableTagEnclosureItem);
//鐢熸垚闄勪欢鐢电紗琛ㄦ牸
TableRenderData tableRenderData2 = new TableRenderData();
- List<String> newCableTags = cableTags.subList(maxCableTag,cableTags.size());
+ List<String> newCableTags = cableTags.subList(maxCableTag, cableTags.size());
AtomicInteger finalIndex2 = new AtomicInteger(1);
List<TextRenderData> newText = new ArrayList<TextRenderData>();
List<RowRenderData> newRows = new ArrayList<>();
RowRenderData newRowRenderData = null;
handlerSampleItems(OrderType.WG.getValue(), cableTagEnclosureItem, finalIndex2, new ArrayList<>(), newCableTags.size(), newText, newRows, newRowRenderData, resultCh, newCableTags, true, showResult);
tableRenderData2.setRows(newRows);
- tableRenderData2.setTableStyle(setTableStyle(newCableTags.size(), showResult));
+ tableRenderData2.setTableStyle(setTableStyle(newCableTags.size(), showResult));
HashMap<String, Object> tableMap = new HashMap<>();
- tableMap.put("enclosureTable",tableRenderData2);
+ tableMap.put("enclosureTable", tableRenderData2);
tableMap.put("resultCh", resultCh);
tableMap.put("writeUrl", null);
tableMap.put("examineUrl", null);
@@ -2415,7 +2445,7 @@
resultCh.set("鏈骇鍝佺鍚堢浉鍏虫爣鍑嗚姹傦紝缁忔楠屽悎鏍煎噯浜堝嚭鍘傦紙鐩栫珷鏈夋晥锛�");
}
- }else{
+ } else {
templateName = showResult ? "/static/small-report-template.docx" : "/static/small-detection-template.docx";
// 杞垚Mpa杩涜鎺掑簭
Map<String, List<SampleProductExportDto>> sortedMap = sampleProductDto2s.stream()
@@ -2423,7 +2453,7 @@
.collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItem));
// // 鍒涘缓涓�涓� LinkedHashMap 鏉ヤ繚鎸佹彃鍏ラ『搴�
Map<String, List<SampleProductExportDto>> item = new LinkedHashMap<>();
- sortSampleProduct(sortedMap,item);
+ sortSampleProduct(sortedMap, item);
AtomicInteger finalIndex = new AtomicInteger(1);
@@ -2448,7 +2478,7 @@
put("standardMethod", standardMethod2.toString().equals("null") ? "" : standardMethod2);
put("orderType", orderType);
put("table", tableRenderData);
- put("enclosureTables", cableTagEnclosureTables.isEmpty()?null:cableTagEnclosureTables);
+ put("enclosureTables", cableTagEnclosureTables.isEmpty() ? null : cableTagEnclosureTables);
put("resultCh", resultCh);
put("writeUrl", null);
put("examineUrl", null);
@@ -2477,6 +2507,7 @@
/**
* 澶勭悊甯歌妫�娴嬮」
+ *
* @param item
* @param finalIndex
* @param sampleList
@@ -2502,7 +2533,7 @@
String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getCableTag();
if (map.containsKey(productName)) {
// 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
- if(CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){
+ if (CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(), orderType)) {
map.get(productName)
.getLastValueList()
.add(productDto2.getLastValue());
@@ -2512,7 +2543,7 @@
.add(productDto2.getInsResult());
} else {
// 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
- if(CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){
+ if (CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(), orderType)) {
productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
productDto2.getLastValueList().add(productDto2.getLastValue());
}
@@ -2547,7 +2578,7 @@
String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getInspectionItemSubclass() + productDto2.getCableTag();
if (map.containsKey(productName)) {
// 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
- if(CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){
+ if (CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(), orderType)) {
map.get(productName)
.getLastValueList()
.add(productDto2.getLastValue());
@@ -2557,7 +2588,7 @@
.add(productDto2.getInsResult());
} else {
// 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
- if(CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){
+ if (CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(), orderType)) {
productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
productDto2.getLastValueList().add(productDto2.getLastValue());
}
@@ -2578,7 +2609,7 @@
});
// 娣诲姞灏忔姤鍛婅〃澶�
- if(hasAddHead){
+ if (hasAddHead) {
text = addSmallHead(text, max, rows, cableTagList, showResult);
}
@@ -2598,8 +2629,8 @@
// 妫�楠岄」鐩�
TextRenderData middleRenderData2 = new TextRenderData();
String[] split = sample.getInspectionName().split("&");
- String itemName = split.length>0?split[0]:sample.getInspectionName();
- middleRenderData2.setText(itemName+"鈭�"+itemName+i+"_"+finalIndex);
+ String itemName = split.length > 0 ? split[0] : sample.getInspectionName();
+ middleRenderData2.setText(itemName + "鈭�" + itemName + i + "_" + finalIndex);
Style middleStyle2 = new Style();
middleStyle2.setFontFamily("瀹嬩綋");
middleStyle2.setColor("000000");
@@ -2686,7 +2717,7 @@
TextRenderData middleRenderData6 = new TextRenderData();
middleRenderData6.setText((StringUtils.isNotEmpty(sample.getLastValue()) ?
sample.getLastValue() : "")
- + "鈭�" + (finalIndex.get() +"_"+ i));
+ + "鈭�" + (finalIndex.get() + "_" + i));
Style middleStyle6 = new Style();
middleStyle6.setFontFamily("瀹嬩綋");
middleStyle6.setColor("000000");
@@ -2747,13 +2778,13 @@
}
if (showResult) {
- TextRenderData middleRenderData7 = new TextRenderData();
- middleRenderData7.setText(result);
- Style middleStyle7 = new Style();
- middleStyle7.setFontFamily("瀹嬩綋");
- middleStyle7.setColor("000000");
- middleRenderData7.setStyle(middleStyle7);
- text.add(middleRenderData7);
+ TextRenderData middleRenderData7 = new TextRenderData();
+ middleRenderData7.setText(result);
+ Style middleStyle7 = new Style();
+ middleStyle7.setFontFamily("瀹嬩綋");
+ middleStyle7.setColor("000000");
+ middleRenderData7.setStyle(middleStyle7);
+ text.add(middleRenderData7);
}
TextRenderData[] text2 = text.toArray(new TextRenderData[0]);
@@ -2770,6 +2801,7 @@
/**
* 娣诲姞灏忔姤鍛婅〃澶�
+ *
* @param text
* @param max
* @param rows
@@ -2820,13 +2852,13 @@
text.add(headRenderData6);
}
if (showResult) {
- TextRenderData headRenderData7 = new TextRenderData();
- headRenderData7.setText("鍗曢」鍒ゆ柇");
- Style headStyle7 = new Style();
- headStyle7.setFontFamily("瀹嬩綋");
- headStyle7.setColor("000000");
- headRenderData7.setStyle(headStyle7);
- text.add(headRenderData7);
+ TextRenderData headRenderData7 = new TextRenderData();
+ headRenderData7.setText("鍗曢」鍒ゆ柇");
+ Style headStyle7 = new Style();
+ headStyle7.setFontFamily("瀹嬩綋");
+ headStyle7.setColor("000000");
+ headRenderData7.setStyle(headStyle7);
+ text.add(headRenderData7);
}
TextRenderData[] text3 = text.toArray(new TextRenderData[0]);
@@ -2878,13 +2910,13 @@
text.add(tagRenderData6);
}
if (showResult) {
- TextRenderData tagRenderData7 = new TextRenderData();
- tagRenderData7.setText("");
- Style tagStyle7 = new Style();
- tagStyle7.setFontFamily("瀹嬩綋");
- tagStyle7.setColor("000000");
- tagRenderData7.setStyle(tagStyle7);
- text.add(tagRenderData7);
+ TextRenderData tagRenderData7 = new TextRenderData();
+ tagRenderData7.setText("");
+ Style tagStyle7 = new Style();
+ tagStyle7.setFontFamily("瀹嬩綋");
+ tagStyle7.setColor("000000");
+ tagRenderData7.setStyle(tagStyle7);
+ text.add(tagRenderData7);
}
TextRenderData[] text4 = text.toArray(new TextRenderData[0]);
@@ -2895,7 +2927,7 @@
}
//濡傛灉鏈夌數缂嗛鑹诧紝鐢熸垚棰滆壊鏍囪瘑琛�
- if(CollectionUtil.isNotEmpty(cableTagList)){
+ if (CollectionUtil.isNotEmpty(cableTagList)) {
TextRenderData tagRenderData1 = new TextRenderData();
tagRenderData1.setText("");
Style tagStyle1 = new Style();
@@ -2938,13 +2970,13 @@
text.add(tagRenderData6);
}
if (showResult) {
- TextRenderData tagRenderData7 = new TextRenderData();
- tagRenderData7.setText("/");
- Style tagStyle7 = new Style();
- tagStyle7.setFontFamily("瀹嬩綋");
- tagStyle7.setColor("000000");
- tagRenderData7.setStyle(tagStyle7);
- text.add(tagRenderData7);
+ TextRenderData tagRenderData7 = new TextRenderData();
+ tagRenderData7.setText("/");
+ Style tagStyle7 = new Style();
+ tagStyle7.setFontFamily("瀹嬩綋");
+ tagStyle7.setColor("000000");
+ tagRenderData7.setStyle(tagStyle7);
+ text.add(tagRenderData7);
}
TextRenderData[] text4 = text.toArray(new TextRenderData[0]);
@@ -2959,6 +2991,7 @@
/**
* 鍒涘缓澶ф姤鍛�
+ *
* @param orderId
* @param insOrder
* @param
@@ -2966,6 +2999,10 @@
private void addBitReport(Integer orderId, InsOrder insOrder, Integer reportType, Integer writeUserId) {
//samples鏄笉鍖呮嫭甯︽湁"/"鐨勬牱鍝�
List<SampleProductDto> samples = insSampleMapper.selectSampleProductListByOrderId(orderId);
+ boolean directTemplateOrder = isDirectTemplateOrder(orderId);
+ if (!directTemplateOrder && CollectionUtils.isEmpty(samples)) {
+ throw new ErrorException("褰撳墠璁㈠崟鏈壘鍒板彲鐢熸垚鎶ュ憡鐨勬湁鏁堟楠岄」鐩�");
+ }
InsReport insReport = new InsReport();
insReport.setCode(insOrder.getEntrustCode());
insReport.setInsOrderId(orderId);
@@ -3229,12 +3266,6 @@
}
}
- Map<String, String> codeStr = new HashMap<>();
- codeStr.put("鎶ュ憡缂栧彿", insReport.getCode());
- codeStr.put("鏍峰搧鍚嶇О", defaultReportText(insOrder.getSampleView(), insOrder.getSample()));
- codeStr.put("瑙勬牸鍨嬪彿", samples.get(0).getModel());
- codeStr.put("鍙戞斁鏃ユ湡", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-
String modelStr = CollUtil.join(models, "\n");
// 妫�娴嬬被鍨�
@@ -3358,7 +3389,10 @@
List<Map<String, String>> finalDeviceList = deviceList;
String finalModelStr = modelStr;
- List<Map<String, String>> detectionResultRows = buildDetectionResultRows(orderId, samples);
+ // 鐩寸粦妯℃澘璁㈠崟娌℃湁 ins_product锛屾娴嬮」鐩�佸崟浣嶅拰缁撴灉鍧囦粠璁㈠崟妯℃澘蹇収涓幏鍙栥��
+ List<Map<String, String>> detectionResultRows = directTemplateOrder
+ ? buildTemplateDetectionResultRows(orderId)
+ : buildDetectionResultRows(samples);
String productName = defaultReportText(insOrder.getSampleView(), insOrder.getSample());
String customerName = defaultReportText(custom == null ? null : custom.getCompany(), insOrder.getCompany());
String detectionCategory = defaultReportText(finalOrderType, "濮旀墭妫�娴�");
@@ -3385,7 +3419,7 @@
Wrappers.<InsOrderStandardTemplate>lambdaQuery()
.eq(InsOrderStandardTemplate::getInsOrderId, orderId)
.orderByAsc(InsOrderStandardTemplate::getSort, InsOrderStandardTemplate::getId));
- boolean newJuTemplateOrder = !templateSnapshots.isEmpty() && isDirectTemplateOrder(orderId);
+ boolean newJuTemplateOrder = !templateSnapshots.isEmpty() && directTemplateOrder;
if (newJuTemplateOrder) {
productName = defaultReportText(insOrder.getSampleView(), insOrder.getSample());
finalModelStr = "/";
@@ -3527,10 +3561,7 @@
/**
* 鏂扮増妫�娴嬫姤鍛婄殑缁撴灉琛ㄥ浐瀹氫负鍥涘垪锛氬簭鍙枫�佹娴嬮」鐩�佸崟浣嶃�佹娴嬬粨鏋溿��
*/
- private List<Map<String, String>> buildDetectionResultRows(Integer orderId, List<SampleProductDto> samples) {
- if (isDirectTemplateOrder(orderId)) {
- return buildTemplateDetectionResultRows(orderId);
- }
+ private List<Map<String, String>> buildDetectionResultRows(List<SampleProductDto> samples) {
List<Map<String, String>> rows = new ArrayList<>();
if (CollectionUtils.isEmpty(samples)) {
return rows;
@@ -3567,7 +3598,7 @@
}
/**
- * 鏂拌仛鐩寸粦妯℃澘璁㈠崟锛氫竴涓ā鏉块〉绛惧湪鎶ュ憡涓彧瀵瑰簲涓�鏉℃娴嬮」鐩��
+ * 鏂拌仛鐩寸粦妯℃澘璁㈠崟锛氭ā鏉夸腑姣忎竴涓�滃鍑哄�尖�濇壒娉ㄩ兘瀵瑰簲鎶ュ憡涓殑涓�鏉℃娴嬮」鐩��
*/
private List<Map<String, String>> buildTemplateDetectionResultRows(Integer orderId) {
List<InsOrderStandardTemplate> snapshots = insOrderStandardTemplateService.list(
@@ -3577,27 +3608,29 @@
List<Map<String, String>> rows = new ArrayList<>();
int sequence = 1;
for (InsOrderStandardTemplate snapshot : snapshots) {
- TemplateExportCell exportCell = getFirstTemplateExportCell(snapshot.getThing());
+ List<TemplateExportCell> exportCells = getTemplateExportCells(snapshot.getThing());
JSONObject recordValues = StrUtil.isBlank(snapshot.getRecordValues())
? new JSONObject() : JSON.parseObject(snapshot.getRecordValues());
- String result = readTemplateCellText(recordValues, exportCell.resultCoordinate, exportCell.templateValues);
- if (StringUtils.isBlank(result)) {
- throw new ErrorException("妯℃澘鈥�" + defaultReportText(snapshot.getName(), "妯℃澘ID " + snapshot.getTemplateId())
- + "鈥濈殑瀵煎嚭鍊间笉鑳戒负绌�");
- }
- String unit = exportCell.unitCoordinate == null ? null
- : readTemplateCellText(recordValues, exportCell.unitCoordinate, exportCell.templateValues);
- String itemName = exportCell.itemCoordinate == null ? null
- : readTemplateCellText(recordValues, exportCell.itemCoordinate, exportCell.templateValues);
+ for (TemplateExportCell exportCell : exportCells) {
+ String result = readTemplateCellText(recordValues, exportCell.resultCoordinate, exportCell.templateValues);
+ if (StringUtils.isBlank(result)) {
+ throw new ErrorException("妯℃澘鈥�" + defaultReportText(snapshot.getName(), "妯℃澘ID " + snapshot.getTemplateId())
+ + "鈥濈殑瀵煎嚭鍊间笉鑳戒负绌猴紙" + exportCell.resultCoordinate + "锛�");
+ }
+ String unit = exportCell.unitCoordinate == null ? null
+ : readTemplateCellText(recordValues, exportCell.unitCoordinate, exportCell.templateValues);
+ String itemName = exportCell.itemCoordinate == null ? null
+ : readTemplateCellText(recordValues, exportCell.itemCoordinate, exportCell.templateValues);
- Map<String, String> row = new LinkedHashMap<>();
- row.put("seq", String.valueOf(sequence++));
- String reportItemName = defaultReportText(itemName,
- defaultReportText(snapshot.getName(), "妯℃澘ID " + snapshot.getTemplateId()));
- row.put("itemName", formatExportItemName(reportItemName));
- row.put("unit", defaultReportText(unit, "/"));
- row.put("result", result);
- rows.add(row);
+ Map<String, String> row = new LinkedHashMap<>();
+ row.put("seq", String.valueOf(sequence++));
+ String reportItemName = defaultReportText(itemName,
+ defaultReportText(snapshot.getName(), "妯℃澘ID " + snapshot.getTemplateId()));
+ row.put("itemName", formatExportItemName(reportItemName));
+ row.put("unit", defaultReportText(unit, "/"));
+ row.put("result", result);
+ rows.add(row);
+ }
}
if (rows.isEmpty()) {
throw new ErrorException("褰撳墠璁㈠崟鏈壘鍒板彲鐢熸垚鎶ュ憡鐨勫師濮嬭褰曟ā鏉�");
@@ -3605,7 +3638,7 @@
return rows;
}
- private TemplateExportCell getFirstTemplateExportCell(String compressedThing) {
+ private List<TemplateExportCell> getTemplateExportCells(String compressedThing) {
if (StrUtil.isBlank(compressedThing)) {
throw new ErrorException("鍘熷璁板綍妯℃澘涓虹┖");
}
@@ -3650,17 +3683,20 @@
throw new ErrorException("妯℃澘蹇呴』鑷冲皯閰嶇疆涓�涓鍑哄�兼壒娉�");
}
exportCells.sort(Comparator.comparingInt((int[] cell) -> cell[0]).thenComparingInt(cell -> cell[1]));
- int[] firstExport = exportCells.get(0);
- int resultColumnForRow = resultColumn == null ? firstExport[1] : resultColumn;
- // 閫氬父鈥滃鍑哄�尖�濇壒娉ㄩ厤缃湪椤圭洰鍚嶇О鍗曞厓鏍硷紱鑻ラ厤缃湪缁撴灉鍗曞厓鏍硷紝鍒欏洖鍒扳�滄娴嬮」鐩�濆垪鍙栧悕绉般��
- Integer itemColumnForRow = !Objects.equals(firstExport[1], resultColumnForRow)
- ? firstExport[1] : itemColumn;
- TemplateExportCell result = new TemplateExportCell();
- result.resultCoordinate = firstExport[0] + "-" + resultColumnForRow;
- result.itemCoordinate = itemColumnForRow == null ? null : firstExport[0] + "-" + itemColumnForRow;
- result.unitCoordinate = unitColumn == null ? null : firstExport[0] + "-" + unitColumn;
- result.templateValues = templateValues;
- return result;
+ List<TemplateExportCell> results = new ArrayList<>();
+ for (int[] exportCell : exportCells) {
+ int resultColumnForRow = resultColumn == null ? exportCell[1] : resultColumn;
+ // 閫氬父鈥滃鍑哄�尖�濇壒娉ㄩ厤缃湪椤圭洰鍚嶇О鍗曞厓鏍硷紱鑻ラ厤缃湪缁撴灉鍗曞厓鏍硷紝鍒欏洖鍒扳�滄娴嬮」鐩�濆垪鍙栧悕绉般��
+ Integer itemColumnForRow = !Objects.equals(exportCell[1], resultColumnForRow)
+ ? exportCell[1] : itemColumn;
+ TemplateExportCell result = new TemplateExportCell();
+ result.resultCoordinate = exportCell[0] + "-" + resultColumnForRow;
+ result.itemCoordinate = itemColumnForRow == null ? null : exportCell[0] + "-" + itemColumnForRow;
+ result.unitCoordinate = unitColumn == null ? null : exportCell[0] + "-" + unitColumn;
+ result.templateValues = templateValues;
+ results.add(result);
+ }
+ return results;
}
private String readTemplateCellText(JSONObject recordValues, String coordinate, Map<String, String> templateValues) {
@@ -3752,7 +3788,9 @@
return minimumText + "~" + maximum.stripTrailingZeros().toPlainString() + unit;
}
- /** 鎶ュ憡椤圭洰鍚嶇О涓嶅睍绀烘ā鏉胯绠楄繃绋嬩腑鐨勨�滃钩鍧囧�尖�濆瓧鏍峰強鍏跺悗鐨勫垎闅旈�楀彿銆� */
+ /**
+ * 鎶ュ憡椤圭洰鍚嶇О涓嶅睍绀烘ā鏉胯绠楄繃绋嬩腑鐨勨�滃钩鍧囧�尖�濆瓧鏍峰強鍏跺悗鐨勫垎闅旈�楀彿銆�
+ */
private static String formatExportItemName(String itemName) {
if (StringUtils.isBlank(itemName)) {
return itemName;
@@ -3788,18 +3826,25 @@
/**
* 璁$畻琛ㄦ牸鍒楀搴�
+ *
* @param max 鏈�澶ф楠屼釜鏁�
* @return
*/
- private static int[] calcTableColWidths(int max, boolean showResult){
+ private static int[] calcTableColWidths(int max, boolean showResult) {
if (!showResult) {
switch (max) {
- case 1: return new int[]{650, 2200, 2200, 850, 2300, 1800};
- case 2: return new int[]{650, 1600, 1600, 850, 1900, 1700, 1700};
- case 3: return new int[]{650, 1400, 1400, 850, 1600, 1375, 1375, 1375};
- case 4: return new int[]{650, 1250, 1250, 850, 1450, 1140, 1140, 1140, 1140};
- case 5: return new int[]{650, 1150, 1150, 850, 1300, 980, 980, 980, 980, 980};
- default: return new int[0];
+ case 1:
+ return new int[]{650, 2200, 2200, 850, 2300, 1800};
+ case 2:
+ return new int[]{650, 1600, 1600, 850, 1900, 1700, 1700};
+ case 3:
+ return new int[]{650, 1400, 1400, 850, 1600, 1375, 1375, 1375};
+ case 4:
+ return new int[]{650, 1250, 1250, 850, 1450, 1140, 1140, 1140, 1140};
+ case 5:
+ return new int[]{650, 1150, 1150, 850, 1300, 980, 980, 980, 980, 980};
+ default:
+ return new int[0];
}
}
int[] colWidths = null;
@@ -3820,16 +3865,16 @@
colWidths = new int[]{650, 1100, 1100, 850, 1350, 750, 750, 750, 750, 750, 1200};
break;
}
- if(ObjectUtils.isNull(colWidths)){
+ if (ObjectUtils.isNull(colWidths)) {
List<Integer> defaultColWidths = new ArrayList<>(Arrays.asList(650, 1100, 1100, 850, 1350));
int totalWidth = 3000;//鎬诲搴�
- int byOneWidth = totalWidth/max;//姣忎竴涓殑瀹藉害
+ int byOneWidth = totalWidth / max;//姣忎竴涓殑瀹藉害
int realWidth = 0;//瀹為檯瀹藉害
for (int i = 0; i < max; i++) {
- realWidth+=byOneWidth;
+ realWidth += byOneWidth;
defaultColWidths.add(byOneWidth);
}
- defaultColWidths.add(1200+(totalWidth-realWidth));
+ defaultColWidths.add(1200 + (totalWidth - realWidth));
return defaultColWidths.stream().mapToInt(Integer::intValue).toArray();
}
return colWidths;
@@ -3837,6 +3882,7 @@
/**
* 璋冩暣楂樺害
+ *
* @param row
* @param rowHeight
* @return
@@ -4068,12 +4114,13 @@
/**
* 娣诲姞鎶ュ憡琛ㄥご
+ *
* @param sample
* @param text
* @param rowRenderData
* @param rows
* @param max
- * @param cableTags 绾胯姱棰滆壊
+ * @param cableTags 绾胯姱棰滆壊
*/
private static void addHead(SampleProductDto sample, List<TextRenderData> text, RowRenderData rowRenderData, List<RowRenderData> rows, int max, List<String> cableTags, boolean showResult) {
// 绗竴琛�
@@ -4213,13 +4260,13 @@
text.add(headRenderData6);
}
if (showResult) {
- TextRenderData headRenderData7 = new TextRenderData();
- headRenderData7.setText("缁撹@Conclusion");
- Style headStyle7 = new Style();
- headStyle7.setFontFamily("瀹嬩綋");
- headStyle7.setColor("000000");
- headRenderData7.setStyle(headStyle7);
- text.add(headRenderData7);
+ TextRenderData headRenderData7 = new TextRenderData();
+ headRenderData7.setText("缁撹@Conclusion");
+ Style headStyle7 = new Style();
+ headStyle7.setFontFamily("瀹嬩綋");
+ headStyle7.setColor("000000");
+ headRenderData7.setStyle(headStyle7);
+ text.add(headRenderData7);
}
TextRenderData[] text3 = text.toArray(new TextRenderData[0]);
@@ -4279,13 +4326,13 @@
text.add(cableRenderData6);
}
if (showResult) {
- TextRenderData cableRenderData7 = new TextRenderData();
- cableRenderData7.setText("-");
- Style cableStyle7 = new Style();
- cableStyle7.setFontFamily("瀹嬩綋");
- cableStyle7.setColor("000000");
- cableRenderData7.setStyle(cableStyle7);
- text.add(cableRenderData7);
+ TextRenderData cableRenderData7 = new TextRenderData();
+ cableRenderData7.setText("-");
+ Style cableStyle7 = new Style();
+ cableStyle7.setFontFamily("瀹嬩綋");
+ cableStyle7.setColor("000000");
+ cableRenderData7.setStyle(cableStyle7);
+ text.add(cableRenderData7);
}
TextRenderData[] text4 = text.toArray(new TextRenderData[0]);
@@ -4300,16 +4347,17 @@
/**
* 娣诲姞妫�娴嬪��
- * @param a 褰撳墠鏍峰搧
+ *
+ * @param a 褰撳墠鏍峰搧
* @param text
* @param rowRenderData
* @param rows
- * @param max 妫�楠屾暟閲�
+ * @param max 妫�楠屾暟閲�
* @param resultChList 涓嶇鍚堜俊鎭腑鏂�
* @param resultEhList 涓嶇鍚堜俊鎭嫳鏂�
* @param insSamples
- * @param cableTags 绾胯姱棰滆壊
- * @param isOneSample 鍒ゆ柇鏄惁鏄彧鏈変竴涓牱鍝�
+ * @param cableTags 绾胯姱棰滆壊
+ * @param isOneSample 鍒ゆ柇鏄惁鏄彧鏈変竴涓牱鍝�
*/
private int addTestValue(SampleProductDto a,
List<TextRenderData> text,
@@ -4844,74 +4892,74 @@
}
// 鍒ゅ畾缁撴灉
if (showResult) {
- String result = "";
- if (sample.getInsResult() != null) {
- switch (sample.getInsResult()) {
- case 1:
- result = "鈭�";
- break;
- case 2:
- result = "脳";
- break;
- case 3:
- result = "-";
- break;
- }
- }
- if (CollectionUtils.isNotEmpty(sample.getLastValueList())) {
- // 鍒ゆ柇鏄惁鏈変竴涓敊璇�
- if (sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 3))) {
- result = "-";
- } else {
- boolean error = sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 0));
- if (error) {
- List<String> collect = new ArrayList<>();
- int index = 0;
- for (Integer count : sample.getInsResultList()) {
- String type;
- if (Objects.equals(count, 0)) {
- String itemCh = "";
- String itemEn = "";
- // 娣诲姞涓嶅悎鏍兼弿杩�
- // 鍒ゆ柇闀垮害鏄惁涓�1
- if (sample.getLastValueList().size() == 1) {
- this.fillReportErrorResult(errorClassItemMapCn, errorClassItemMapEn, sample, itemCh, itemEn);
- } else if (CollectionUtils.isNotEmpty(cableTags)) {
- // 鍒ゆ柇鏄惁鏈夌數缂嗛厤缃�, 涓嶆槸鐨勮瘽鍙兘涓哄師鏉愭枡
- // 娣诲姞涓嶅悎鏍兼弿杩�
- itemCh = (max == 1 ? "" : cableTags.get(index));
- itemEn = (max == 1 ? "" : "The " + Integer.toString(index + 1) + " time ");
- this.fillReportErrorResult(errorClassItemMapCn, errorClassItemMapEn, sample, itemCh, itemEn);
- } else {
- // 娣诲姞涓嶅悎鏍兼弿杩�
- itemCh = (max == 1 ? "" : "绗�" + Integer.toString(index + 1) + "娆�");
- itemEn = (max == 1 ? "" : "The " + Integer.toString(index + 1) + " time ");
- this.fillReportErrorResult(errorClassItemMapCn, errorClassItemMapEn, sample, itemCh, itemEn);
- }
- type = "脳";
- } else {
- type = "鈭�";
- }
- collect.add(type);
- index++;
- }
- result = CollUtil.join(collect, " ");
- ;
- } else {
- result = "鈭�";
+ String result = "";
+ if (sample.getInsResult() != null) {
+ switch (sample.getInsResult()) {
+ case 1:
+ result = "鈭�";
+ break;
+ case 2:
+ result = "脳";
+ break;
+ case 3:
+ result = "-";
+ break;
}
}
- }
+ if (CollectionUtils.isNotEmpty(sample.getLastValueList())) {
+ // 鍒ゆ柇鏄惁鏈変竴涓敊璇�
+ if (sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 3))) {
+ result = "-";
+ } else {
+ boolean error = sample.getInsResultList().stream().anyMatch(s -> Objects.equals(s, 0));
+ if (error) {
+ List<String> collect = new ArrayList<>();
+ int index = 0;
+ for (Integer count : sample.getInsResultList()) {
+ String type;
+ if (Objects.equals(count, 0)) {
+ String itemCh = "";
+ String itemEn = "";
+ // 娣诲姞涓嶅悎鏍兼弿杩�
+ // 鍒ゆ柇闀垮害鏄惁涓�1
+ if (sample.getLastValueList().size() == 1) {
+ this.fillReportErrorResult(errorClassItemMapCn, errorClassItemMapEn, sample, itemCh, itemEn);
+ } else if (CollectionUtils.isNotEmpty(cableTags)) {
+ // 鍒ゆ柇鏄惁鏈夌數缂嗛厤缃�, 涓嶆槸鐨勮瘽鍙兘涓哄師鏉愭枡
+ // 娣诲姞涓嶅悎鏍兼弿杩�
+ itemCh = (max == 1 ? "" : cableTags.get(index));
+ itemEn = (max == 1 ? "" : "The " + Integer.toString(index + 1) + " time ");
+ this.fillReportErrorResult(errorClassItemMapCn, errorClassItemMapEn, sample, itemCh, itemEn);
+ } else {
+ // 娣诲姞涓嶅悎鏍兼弿杩�
+ itemCh = (max == 1 ? "" : "绗�" + Integer.toString(index + 1) + "娆�");
+ itemEn = (max == 1 ? "" : "The " + Integer.toString(index + 1) + " time ");
+ this.fillReportErrorResult(errorClassItemMapCn, errorClassItemMapEn, sample, itemCh, itemEn);
+ }
+ type = "脳";
+ } else {
+ type = "鈭�";
+ }
+ collect.add(type);
+ index++;
+ }
+ result = CollUtil.join(collect, " ");
+ ;
+ } else {
+ result = "鈭�";
+ }
+ }
+ }
- if (showResult) {
- TextRenderData headRenderData7 = new TextRenderData();
- headRenderData7.setText(result);
- Style headStyle7 = new Style();
- headStyle7.setFontFamily("瀹嬩綋");
- headStyle7.setColor("000000");
- headRenderData7.setStyle(headStyle7);
- text.add(headRenderData7);
- }
+ if (showResult) {
+ TextRenderData headRenderData7 = new TextRenderData();
+ headRenderData7.setText(result);
+ Style headStyle7 = new Style();
+ headStyle7.setFontFamily("瀹嬩綋");
+ headStyle7.setColor("000000");
+ headRenderData7.setStyle(headStyle7);
+ text.add(headRenderData7);
+ }
}
TextRenderData[] text2 = text.toArray(new TextRenderData[0]);
@@ -4993,11 +5041,12 @@
/**
* NBSP锛堥潪闂存柇绌烘牸锛� 杞垚 鏅�氱┖鏍�
+ *
* @param oldStr
* @return
*/
- private String normalizedSpaces(String oldStr){
- if(StringUtils.isBlank(oldStr)){
+ private String normalizedSpaces(String oldStr) {
+ if (StringUtils.isBlank(oldStr)) {
return oldStr;
}
return oldStr.replaceAll("\u00A0", " ").trim();
@@ -5005,6 +5054,7 @@
/**
* 娣诲姞鎶ュ憡缁撹涓嫳鏂�
+ *
* @param sample
* @param itemCh
* @param itemEn
@@ -5064,6 +5114,7 @@
/**
* 鏍煎紡鍖栦慨鏀规楠岄」
+ *
* @param sampleProductDto2s
*/
private void formatProducts(List<SampleProductExportDto> sampleProductDto2s) {
@@ -5133,6 +5184,7 @@
/**
* 娣诲姞缁撳熬
+ *
* @param text
* @param rowRenderData
* @param rows
@@ -5164,6 +5216,7 @@
/**
* 鍒ゆ柇褰撳墠鍐呭鏄惁鏄瀛﹁鏁版硶
+ *
* @param str
* @return
*/
@@ -5180,6 +5233,7 @@
/**
* 淇敼瑕佹眰鎻忚堪鐨勭瀛﹁鏁版硶
+ *
* @param input
*/
public static String convertToScientificNotation(String input) {
@@ -5209,6 +5263,7 @@
/**
* 灞曠ず鎴愮瀛﹁鏁版硶
+ *
* @param number
* @return
*/
@@ -5305,6 +5360,7 @@
/**
* 鏍规嵁瑕佹眰鎻忚堪淇濈暀缁撴灉灏忔暟鐐逛綅鏁�
+ *
* @param reference
* @param value
* @return
@@ -5373,6 +5429,7 @@
/**
* 淇濈暀浣嶆暟, 濡傛灉绛変簬0 杩斿洖鎵惧埌鐨勪竴涓潪0浣嶆暟
+ *
* @param number 褰撳墠鏁板瓧
* @param scale 鍘熸湰淇濈暀鐨勪綅鏁�
* @return
@@ -5411,9 +5468,10 @@
/**
* *****淇濆瓨鍏冩闃块噷杩涜揣楠岃瘉鍘熷璁板綍*****
- * @param insOrderId 璁㈠崟Id
- * @param examineUserId 澶嶆牳浜篒d
- * @param writeUserId 妫�楠屽憳Id
+ *
+ * @param insOrderId 璁㈠崟Id
+ * @param examineUserId 澶嶆牳浜篒d
+ * @param writeUserId 妫�楠屽憳Id
*/
private void reportFactoryVerify(Integer insOrderId, Integer examineUserId, Integer writeUserId) {
// 鏌ヨ杩涜揣楠岃瘉鍘熷璁板綍
@@ -5566,6 +5624,7 @@
/**
* ***鏍煎紡鍖栬繘鍘傞獙璇佸唴瀹�****
+ *
* @param basicType
* @return
*/
@@ -5595,6 +5654,7 @@
/**
* ***word杞崲pdf***
+ *
* @param path
* @return
*/
@@ -5643,6 +5703,7 @@
/**
* *****淇敼鎴愬搧鎶芥牱鐘舵��******
+ *
* @param insSamples
* @param order
*/
@@ -5680,6 +5741,7 @@
/**
* 娣诲姞宸ユ椂
+ *
* @param userId
* @param insProduct
* @param insOrder
--
Gitblit v1.9.3