Commit b0c00e22 by 黄明步

.

parent ae5e426e
......@@ -37,9 +37,8 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
......@@ -107,6 +106,20 @@ public class AppAbilityRecordAllController {
}
try {
List<CallRecordModel> callRecordList = this.recordAllService.selectCallRecord(yearMonthDay, endYearMonthDay);
Map<String, CallRecordModel> mergedData = new HashMap<>();
for (CallRecordModel record : callRecordList) {
mergedData.putIfAbsent(record.getBusinessVendorName(), CallRecordModel.builder().businessVendorName(record.getBusinessVendorName()).callCount(0L).fileCount(0L).build());
CallRecordModel mergedRecord = mergedData.get(record.getBusinessVendorName());
mergedRecord.setCallCount(mergedRecord.getCallCount() + record.getAbilityDocCount());
mergedRecord.setFileCount(mergedRecord.getFileCount() + record.getFileCount());
}
List<CallRecordModel> result = new ArrayList<>(mergedData.values());
result = result.stream().filter(item -> StrUtil.isNotBlank(item.getBusinessVendorName())).collect(Collectors.toList());
System.out.println(result);
Assert.notNull(callRecordList, "未找到相关数据");
String fileName = StringUtils.isEmpty(newYearMonthDay) ? "各法院调用统计.xlsx" : "各法院" + newYearMonthDay + "调用统计.xlsx";
......@@ -117,7 +130,7 @@ public class AppAbilityRecordAllController {
// 设置单元格样式策略
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(ExcelStyleUtils.getHeadStyle(), ExcelStyleUtils.getContentStyle());
EasyExcel.write(response.getOutputStream(), CallRecordModel.class)
.sheet(StrUtil.isBlank(newYearMonthDay) ? "ALL" : newYearMonthDay)
.sheet(StrUtil.isBlank(newYearMonthDay) ? "各法院调用统计" : newYearMonthDay)
.head(CallRecordModel.class)
// 自动行宽策略
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
......
......@@ -2,8 +2,10 @@ package com.gxmailu.ocrCloudPlatform.excel.model;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
......@@ -13,6 +15,9 @@ import java.io.Serializable;
* @since 2024/1/20 21:05:04
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CallRecordModel implements Serializable {
private static final long serialVersionUID = 1L;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment