Showing
11 changed files
with
425 additions
and
28 deletions
... | ... | @@ -51,19 +51,27 @@ public abstract class BaseController { |
51 | 51 | if (CollectionUtils.isEmpty(errorList)) { |
52 | 52 | return false; |
53 | 53 | } |
54 | - Map<Integer, String> errorMap = errorList.stream().collect(Collectors.groupingBy(ExcelErrorMessage::getRowNum, | |
55 | - Collectors.mapping(ExcelErrorMessage::getMessage, Collectors.joining(";")))); | |
56 | - | |
57 | 54 | XSSFWorkbook workbook = new XSSFWorkbook(); |
58 | 55 | XSSFSheet sheet = workbook.createSheet("错误信息"); |
59 | - Integer rowNumIndex = 0; | |
60 | - for (Integer rowNum : errorMap.keySet()) { | |
61 | - XSSFRow row = sheet.createRow(rowNumIndex); | |
62 | - String errotMsg = "第" + rowNum + "行:" + errorMap.get(rowNum); | |
56 | + if (errorList.size() == 1 && errorList.get(0).getRowNum() == null) { | |
57 | + XSSFRow row = sheet.createRow(0); | |
58 | + String errotMsg = errorList.get(0).getMessage(); | |
63 | 59 | row.createCell(0).setCellValue(errotMsg); |
64 | - rowNumIndex++; | |
60 | + } else { | |
61 | + Map<Integer, String> errorMap = errorList.stream().collect(Collectors.groupingBy(ExcelErrorMessage::getRowNum, | |
62 | + Collectors.mapping(ExcelErrorMessage::getMessage, Collectors.joining(";")))); | |
63 | + | |
64 | + | |
65 | + int rowNumIndex = 0; | |
66 | + for (Integer rowNum : errorMap.keySet()) { | |
67 | + XSSFRow row = sheet.createRow(rowNumIndex); | |
68 | + String errotMsg = "第" + rowNum + "行:" + errorMap.get(rowNum); | |
69 | + row.createCell(0).setCellValue(errotMsg); | |
70 | + rowNumIndex++; | |
71 | + } | |
65 | 72 | } |
66 | 73 | |
74 | + | |
67 | 75 | FileOutputStream outputStream = new FileOutputStream(filePath); |
68 | 76 | |
69 | 77 | try { | ... | ... |
1 | +package com.ash.base.excelOpt; | |
2 | + | |
3 | +import com.alibaba.excel.converters.Converter; | |
4 | +import com.alibaba.excel.converters.WriteConverterContext; | |
5 | +import com.alibaba.excel.metadata.GlobalConfiguration; | |
6 | +import com.alibaba.excel.metadata.data.ReadCellData; | |
7 | +import com.alibaba.excel.metadata.data.WriteCellData; | |
8 | +import com.alibaba.excel.metadata.property.ExcelContentProperty; | |
9 | + | |
10 | +import java.text.SimpleDateFormat; | |
11 | +import java.util.Date; | |
12 | + | |
13 | + | |
14 | +public class DatetimeConverter implements Converter<Date> { | |
15 | + private static final String PATTERN_YYYY_MM_DD = "yyyy-MM-dd HH:mm:ss"; | |
16 | + | |
17 | + | |
18 | + @Override | |
19 | + public Class<Date> supportJavaTypeKey() { | |
20 | + return Date.class; | |
21 | + } | |
22 | + | |
23 | + | |
24 | + @Override | |
25 | + public Date convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { | |
26 | + String value = cellData.getStringValue(); | |
27 | + SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYY_MM_DD); | |
28 | + return sdf.parse(value); | |
29 | + } | |
30 | + | |
31 | + | |
32 | + @Override | |
33 | + public WriteCellData<String> convertToExcelData(WriteConverterContext<Date> context) throws Exception { | |
34 | + Date date = context.getValue(); | |
35 | + if (date == null) { | |
36 | + return null; | |
37 | + } | |
38 | + SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYY_MM_DD); | |
39 | + return new WriteCellData<>(sdf.format(date)); | |
40 | + } | |
41 | +} | ... | ... |
... | ... | @@ -13,6 +13,7 @@ import com.ash.enums.AnalysisStatusEnum; |
13 | 13 | import com.ash.enums.FileDataTypeEnum; |
14 | 14 | import com.ash.enums.ReviewStatusEnum; |
15 | 15 | import com.ash.excelData.CaseExcelData; |
16 | +import com.ash.excelData.CaseExportExcelData; | |
16 | 17 | import com.ash.service.CaseAnalysisService; |
17 | 18 | import com.ash.service.CaseService; |
18 | 19 | import com.ash.service.FileDataService; |
... | ... | @@ -109,8 +110,6 @@ public class CaseController extends BaseController { |
109 | 110 | return JsonResult.error("生成文件错误!"); |
110 | 111 | } |
111 | 112 | } |
112 | - } catch (ExcelDataConvertException e) { | |
113 | - return JsonResult.error("导入模板错误或数据格式错误!"); | |
114 | 113 | } catch (Exception e) { |
115 | 114 | return JsonResult.error("系统异常!"); |
116 | 115 | } |
... | ... | @@ -168,10 +167,23 @@ public class CaseController extends BaseController { |
168 | 167 | params.setEndTime(endTime); |
169 | 168 | List<Case> dataList = caseService.list(params); |
170 | 169 | |
171 | - List<CaseExcelData> dedList = Optional.ofNullable(dataList).map(all -> | |
170 | + List<CaseExportExcelData> dedList = Optional.ofNullable(dataList).map(all -> | |
172 | 171 | all.stream().map(e -> { |
173 | - CaseExcelData ed = new CaseExcelData(); | |
172 | + CaseExportExcelData ed = new CaseExportExcelData(); | |
174 | 173 | BeanUtils.copyProperties(e, ed); |
174 | + CaseAnalysis analysis = e.getAnalysis(); | |
175 | + if(analysis!=null){ | |
176 | + ed.setArea(analysis.getArea()); | |
177 | + ed.setCounty(analysis.getCounty()); | |
178 | + ed.setTotalAmount(analysis.getTotalAmount()); | |
179 | + ed.setAge(analysis.getAge()); | |
180 | + ed.setSex(analysis.getSex()); | |
181 | + ed.setCareer(analysis.getCareer()); | |
182 | + ed.setFraudType(analysis.getFraudType()); | |
183 | + ed.setRainageMethod(analysis.getRainageMethod()); | |
184 | + ed.setPayMethod(analysis.getPayMethod()); | |
185 | + } | |
186 | + | |
175 | 187 | return ed; |
176 | 188 | }).collect(Collectors.toList())).orElse(new ArrayList<>()); |
177 | 189 | |
... | ... | @@ -180,7 +192,7 @@ public class CaseController extends BaseController { |
180 | 192 | response.setCharacterEncoding("utf8"); |
181 | 193 | response.setHeader("Content-disposition", "attachment;filename=" + fileName); |
182 | 194 | ServletOutputStream outputStream = response.getOutputStream(); |
183 | - EasyExcel.write(outputStream, CaseExcelData.class) | |
195 | + EasyExcel.write(outputStream, CaseExportExcelData.class) | |
184 | 196 | .sheet("案件列表") |
185 | 197 | .doWrite(dedList); |
186 | 198 | ... | ... |
... | ... | @@ -14,6 +14,7 @@ import com.ash.enums.AnalysisStatusEnum; |
14 | 14 | import com.ash.enums.FileDataTypeEnum; |
15 | 15 | import com.ash.enums.ReviewStatusEnum; |
16 | 16 | import com.ash.excelData.WarningInstanceExcelData; |
17 | +import com.ash.excelData.WarningInstanceExportExcelData; | |
17 | 18 | import com.ash.service.FileDataService; |
18 | 19 | import com.ash.service.WarningInstanceAnalysisService; |
19 | 20 | import com.ash.service.WarningInstanceService; |
... | ... | @@ -118,10 +119,8 @@ public class WarningInstanceController extends BaseController { |
118 | 119 | } |
119 | 120 | |
120 | 121 | } |
121 | - } catch ( | |
122 | - ExcelDataConvertException e) { | |
123 | - return JsonResult.error("导入模板错误或数据格式错误!"); | |
124 | 122 | } catch (Exception e) { |
123 | + e.printStackTrace(); | |
125 | 124 | return JsonResult.error("系统异常!"); |
126 | 125 | } |
127 | 126 | |
... | ... | @@ -178,10 +177,19 @@ public class WarningInstanceController extends BaseController { |
178 | 177 | params.setEndTime(endTime); |
179 | 178 | List<WarningInstance> dataList = warningInstanceService.list(params); |
180 | 179 | |
181 | - List<WarningInstanceExcelData> dedList = Optional.ofNullable(dataList).map(all -> | |
180 | + List<WarningInstanceExportExcelData> dedList = Optional.ofNullable(dataList).map(all -> | |
182 | 181 | all.stream().map(e -> { |
183 | - WarningInstanceExcelData ed = new WarningInstanceExcelData(); | |
182 | + WarningInstanceExportExcelData ed = new WarningInstanceExportExcelData(); | |
184 | 183 | BeanUtils.copyProperties(e, ed); |
184 | + WarningInstanceAnalysis analysis = e.getAnalysis(); | |
185 | + if (analysis != null) { | |
186 | + ed.setArea(analysis.getArea()); | |
187 | + ed.setAmount(analysis.getAmount()); | |
188 | + ed.setSex(analysis.getSex()); | |
189 | + ed.setCareer(analysis.getCareer()); | |
190 | + ed.setRainageMethod(analysis.getRainageMethod()); | |
191 | + ed.setPayMethod(analysis.getPayMethod()); | |
192 | + } | |
185 | 193 | return ed; |
186 | 194 | }).collect(Collectors.toList())).orElse(new ArrayList<>()); |
187 | 195 | |
... | ... | @@ -190,7 +198,7 @@ public class WarningInstanceController extends BaseController { |
190 | 198 | response.setCharacterEncoding("utf8"); |
191 | 199 | response.setHeader("Content-disposition", "attachment;filename=" + fileName); |
192 | 200 | ServletOutputStream outputStream = response.getOutputStream(); |
193 | - EasyExcel.write(outputStream, WarningInstanceExcelData.class) | |
201 | + EasyExcel.write(outputStream, WarningInstanceExportExcelData.class) | |
194 | 202 | .sheet("警情列表") |
195 | 203 | .doWrite(dedList); |
196 | 204 | ... | ... |
... | ... | @@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth; |
5 | 5 | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
6 | 6 | import com.alibaba.excel.annotation.write.style.ContentStyle; |
7 | 7 | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
8 | +import com.ash.base.excelOpt.DatetimeConverter; | |
8 | 9 | import com.ash.base.excelOpt.ExcelCheck; |
9 | 10 | import lombok.AllArgsConstructor; |
10 | 11 | import lombok.Builder; |
... | ... | @@ -48,13 +49,13 @@ public class CaseExcelData implements Serializable { |
48 | 49 | private String caseDetail; |
49 | 50 | |
50 | 51 | @ExcelCheck(canEmpty = false, dateFormatValid = "yyyy-MM-dd HH:mm:ss") |
51 | - @ExcelProperty(value = "接警时间", index = 4) | |
52 | + @ExcelProperty(value = "接警时间", index = 4, converter = DatetimeConverter.class) | |
52 | 53 | @ContentStyle(dataFormat = 49) |
53 | 54 | @ColumnWidth(25) |
54 | 55 | private Date alarmDate; |
55 | 56 | |
56 | 57 | @ExcelCheck(canEmpty = false, dateFormatValid = "yyyy-MM-dd HH:mm:ss") |
57 | - @ExcelProperty(value = "立案时间", index = 5) | |
58 | + @ExcelProperty(value = "立案时间", index = 5, converter = DatetimeConverter.class) | |
58 | 59 | @ContentStyle(dataFormat = 49) |
59 | 60 | @ColumnWidth(25) |
60 | 61 | private Date filingDate; | ... | ... |
1 | +package com.ash.excelData; | |
2 | + | |
3 | +import com.alibaba.excel.annotation.ExcelProperty; | |
4 | +import com.alibaba.excel.annotation.write.style.ColumnWidth; | |
5 | +import com.alibaba.excel.annotation.write.style.ContentRowHeight; | |
6 | +import com.alibaba.excel.annotation.write.style.ContentStyle; | |
7 | +import com.alibaba.excel.annotation.write.style.HeadRowHeight; | |
8 | +import com.ash.base.excelOpt.DatetimeConverter; | |
9 | +import com.ash.base.excelOpt.ExcelCheck; | |
10 | +import lombok.AllArgsConstructor; | |
11 | +import lombok.Builder; | |
12 | +import lombok.Data; | |
13 | +import lombok.NoArgsConstructor; | |
14 | + | |
15 | +import java.io.Serializable; | |
16 | +import java.util.Date; | |
17 | + | |
18 | +@Data | |
19 | +@ContentRowHeight(15) | |
20 | +@HeadRowHeight(20) | |
21 | +@Builder | |
22 | +@NoArgsConstructor | |
23 | +@AllArgsConstructor | |
24 | +public class CaseExportExcelData implements Serializable { | |
25 | + private static final long serialVersionUID = 1L; | |
26 | + | |
27 | + @ExcelCheck(canEmpty = false, canRepeat = false) | |
28 | + @ExcelProperty(value = "案件标识", index = 0) | |
29 | + @ContentStyle(dataFormat = 49) | |
30 | + @ColumnWidth(25) | |
31 | + private String mark; | |
32 | + | |
33 | + @ExcelCheck(canEmpty = false, canRepeat = false) | |
34 | + @ExcelProperty(value = "案件编号", index = 1) | |
35 | + @ContentStyle(dataFormat = 49) | |
36 | + @ColumnWidth(25) | |
37 | + private String code; | |
38 | + | |
39 | + @ExcelCheck(canEmpty = false) | |
40 | + @ExcelProperty(value = "案件名称", index = 2) | |
41 | + @ContentStyle(dataFormat = 49) | |
42 | + @ColumnWidth(25) | |
43 | + private String name; | |
44 | + | |
45 | + @ExcelCheck(canEmpty = false) | |
46 | + @ExcelProperty(value = "案件详情", index = 3) | |
47 | + @ContentStyle(dataFormat = 49) | |
48 | + @ColumnWidth(25) | |
49 | + private String caseDetail; | |
50 | + | |
51 | + @ExcelCheck(canEmpty = false, dateFormatValid = "yyyy-MM-dd HH:mm:ss") | |
52 | + @ExcelProperty(value = "接警时间", index = 4, converter = DatetimeConverter.class) | |
53 | + @ContentStyle(dataFormat = 49) | |
54 | + @ColumnWidth(25) | |
55 | + private Date alarmDate; | |
56 | + | |
57 | + @ExcelCheck(canEmpty = false, dateFormatValid = "yyyy-MM-dd HH:mm:ss") | |
58 | + @ExcelProperty(value = "立案时间", index = 5, converter = DatetimeConverter.class) | |
59 | + @ContentStyle(dataFormat = 49) | |
60 | + @ColumnWidth(25) | |
61 | + private Date filingDate; | |
62 | + | |
63 | + @ExcelCheck(canEmpty = false) | |
64 | + @ExcelProperty(value = "立案单位", index = 6) | |
65 | + @ContentStyle(dataFormat = 49) | |
66 | + @ColumnWidth(25) | |
67 | + private String filingUnit; | |
68 | + | |
69 | + | |
70 | + @ExcelCheck(canEmpty = false) | |
71 | + @ExcelProperty(value = "地区", index = 7) | |
72 | + @ContentStyle(dataFormat = 49) | |
73 | + @ColumnWidth(25) | |
74 | + private String area; | |
75 | + | |
76 | + @ExcelCheck(canEmpty = false) | |
77 | + @ExcelProperty(value = "县区", index = 8) | |
78 | + @ContentStyle(dataFormat = 49) | |
79 | + @ColumnWidth(25) | |
80 | + private String county; | |
81 | + | |
82 | + @ExcelCheck(canEmpty = false) | |
83 | + @ExcelProperty(value = "涉案总金额", index = 9) | |
84 | + @ContentStyle(dataFormat = 49) | |
85 | + @ColumnWidth(25) | |
86 | + private Double totalAmount; | |
87 | + | |
88 | + @ExcelCheck(canEmpty = false) | |
89 | + @ExcelProperty(value = "受害人性别", index = 10) | |
90 | + @ContentStyle(dataFormat = 49) | |
91 | + @ColumnWidth(25) | |
92 | + private String sex; | |
93 | + | |
94 | + @ExcelCheck(canEmpty = false) | |
95 | + @ExcelProperty(value = "受害人年龄", index = 11) | |
96 | + @ContentStyle(dataFormat = 49) | |
97 | + @ColumnWidth(25) | |
98 | + private Integer age; | |
99 | + | |
100 | + @ExcelCheck(canEmpty = false) | |
101 | + @ExcelProperty(value = "受害人职业", index = 12) | |
102 | + @ContentStyle(dataFormat = 49) | |
103 | + @ColumnWidth(25) | |
104 | + private String career; | |
105 | + | |
106 | + @ExcelCheck(canEmpty = false) | |
107 | + @ExcelProperty(value = "诈骗类型", index = 13) | |
108 | + @ContentStyle(dataFormat = 49) | |
109 | + @ColumnWidth(25) | |
110 | + private String fraudType; | |
111 | + | |
112 | + @ExcelCheck(canEmpty = false) | |
113 | + @ExcelProperty(value = "引流方式", index = 14) | |
114 | + @ContentStyle(dataFormat = 49) | |
115 | + @ColumnWidth(25) | |
116 | + private String rainageMethod; | |
117 | + | |
118 | + @ExcelCheck(canEmpty = false) | |
119 | + @ExcelProperty(value = "支付方式", index = 15) | |
120 | + @ContentStyle(dataFormat = 49) | |
121 | + @ColumnWidth(25) | |
122 | + private String payMethod; | |
123 | +} | ... | ... |
... | ... | @@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth; |
5 | 5 | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
6 | 6 | import com.alibaba.excel.annotation.write.style.ContentStyle; |
7 | 7 | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
8 | +import com.ash.base.excelOpt.DatetimeConverter; | |
8 | 9 | import com.ash.base.excelOpt.ExcelCheck; |
9 | 10 | import lombok.AllArgsConstructor; |
10 | 11 | import lombok.Builder; |
... | ... | @@ -30,7 +31,7 @@ public class WarningInstanceExcelData implements Serializable { |
30 | 31 | private String code; |
31 | 32 | |
32 | 33 | @ExcelCheck(canEmpty = false) |
33 | - @ExcelProperty(value = "报警时间", index = 1) | |
34 | + @ExcelProperty(value = "报警时间", index = 1, converter = DatetimeConverter.class) | |
34 | 35 | @ContentStyle(dataFormat = 49) |
35 | 36 | @ColumnWidth(25) |
36 | 37 | private Date alarmDate; | ... | ... |
1 | +package com.ash.excelData; | |
2 | + | |
3 | +import com.alibaba.excel.annotation.ExcelProperty; | |
4 | +import com.alibaba.excel.annotation.write.style.ColumnWidth; | |
5 | +import com.alibaba.excel.annotation.write.style.ContentRowHeight; | |
6 | +import com.alibaba.excel.annotation.write.style.ContentStyle; | |
7 | +import com.alibaba.excel.annotation.write.style.HeadRowHeight; | |
8 | +import com.ash.base.excelOpt.DatetimeConverter; | |
9 | +import com.ash.base.excelOpt.ExcelCheck; | |
10 | +import lombok.AllArgsConstructor; | |
11 | +import lombok.Builder; | |
12 | +import lombok.Data; | |
13 | +import lombok.NoArgsConstructor; | |
14 | + | |
15 | +import java.io.Serializable; | |
16 | +import java.util.Date; | |
17 | + | |
18 | +@Data | |
19 | +@ContentRowHeight(15) | |
20 | +@HeadRowHeight(20) | |
21 | +@Builder | |
22 | +@NoArgsConstructor | |
23 | +@AllArgsConstructor | |
24 | +public class WarningInstanceExportExcelData implements Serializable { | |
25 | + private static final long serialVersionUID = 1L; | |
26 | + | |
27 | + @ExcelCheck(canEmpty = false, canRepeat = false) | |
28 | + @ExcelProperty(value = "警情单编号", index = 0) | |
29 | + @ContentStyle(dataFormat = 49) | |
30 | + @ColumnWidth(25) | |
31 | + private String code; | |
32 | + | |
33 | + @ExcelCheck(canEmpty = false, dateFormatValid = "yyyy-MM-dd HH:mm:ss") | |
34 | + @ExcelProperty(value = "报警时间", index = 1, converter = DatetimeConverter.class) | |
35 | + @ContentStyle(dataFormat = 49) | |
36 | + @ColumnWidth(25) | |
37 | + private Date alarmDate; | |
38 | + | |
39 | + @ExcelCheck(canEmpty = false) | |
40 | + @ExcelProperty(value = "报警电话", index = 2) | |
41 | + @ContentStyle(dataFormat = 49) | |
42 | + @ColumnWidth(25) | |
43 | + private String phoneNum; | |
44 | + | |
45 | + @ExcelCheck(canEmpty = false) | |
46 | + @ExcelProperty(value = "所属市局", index = 3) | |
47 | + @ContentStyle(dataFormat = 49) | |
48 | + @ColumnWidth(25) | |
49 | + private String municipalPolice; | |
50 | + | |
51 | + @ExcelCheck(canEmpty = false) | |
52 | + @ExcelProperty(value = "所属分县局", index = 4) | |
53 | + @ContentStyle(dataFormat = 49) | |
54 | + @ColumnWidth(25) | |
55 | + private String countyPolice; | |
56 | + | |
57 | + @ExcelCheck(canEmpty = false) | |
58 | + @ExcelProperty(value = "管辖单位", index = 5) | |
59 | + @ContentStyle(dataFormat = 49) | |
60 | + @ColumnWidth(25) | |
61 | + private String jurisdictionalUnit; | |
62 | + | |
63 | + @ExcelCheck(canEmpty = false) | |
64 | + @ExcelProperty(value = "所属区县", index = 6) | |
65 | + @ContentStyle(dataFormat = 49) | |
66 | + @ColumnWidth(25) | |
67 | + private String county; | |
68 | + | |
69 | + @ExcelCheck(canEmpty = false) | |
70 | + @ExcelProperty(value = "事发地址", index = 7) | |
71 | + @ContentStyle(dataFormat = 49) | |
72 | + @ColumnWidth(25) | |
73 | + private String address; | |
74 | + | |
75 | + @ExcelCheck(canEmpty = false) | |
76 | + @ExcelProperty(value = "报警内容", index = 8) | |
77 | + @ContentStyle(dataFormat = 49) | |
78 | + @ColumnWidth(25) | |
79 | + private String content; | |
80 | + | |
81 | + @ExcelCheck(canEmpty = false) | |
82 | + @ExcelProperty(value = "接警警情类别", index = 9) | |
83 | + @ContentStyle(dataFormat = 49) | |
84 | + @ColumnWidth(25) | |
85 | + private String alarmCategory; | |
86 | + | |
87 | + @ExcelCheck(canEmpty = false) | |
88 | + @ExcelProperty(value = "接警警情类型", index = 10) | |
89 | + @ContentStyle(dataFormat = 49) | |
90 | + @ColumnWidth(25) | |
91 | + private String alarmType; | |
92 | + | |
93 | + @ExcelCheck(canEmpty = false) | |
94 | + @ExcelProperty(value = "接警警情细类", index = 11) | |
95 | + @ContentStyle(dataFormat = 49) | |
96 | + @ColumnWidth(25) | |
97 | + private String alarmTypeDetail; | |
98 | + | |
99 | + @ExcelCheck(canEmpty = false) | |
100 | + @ExcelProperty(value = "接警警情子类", index = 12) | |
101 | + @ContentStyle(dataFormat = 49) | |
102 | + @ColumnWidth(25) | |
103 | + private String alarmSubType; | |
104 | + | |
105 | + @ExcelCheck(canEmpty = false) | |
106 | + @ExcelProperty(value = "反馈内容", index = 13) | |
107 | + @ContentStyle(dataFormat = 49) | |
108 | + @ColumnWidth(25) | |
109 | + private String feedbackContent; | |
110 | + | |
111 | + @ExcelCheck(canEmpty = false) | |
112 | + @ExcelProperty(value = "警情类别", index = 14) | |
113 | + @ContentStyle(dataFormat = 49) | |
114 | + @ColumnWidth(25) | |
115 | + private String category; | |
116 | + | |
117 | + @ExcelCheck(canEmpty = false) | |
118 | + @ExcelProperty(value = "警情类型", index = 15) | |
119 | + @ContentStyle(dataFormat = 49) | |
120 | + @ColumnWidth(25) | |
121 | + private String type; | |
122 | + | |
123 | + @ExcelCheck(canEmpty = false) | |
124 | + @ExcelProperty(value = "警情细类", index = 16) | |
125 | + @ContentStyle(dataFormat = 49) | |
126 | + @ColumnWidth(25) | |
127 | + private String typeDetail; | |
128 | + | |
129 | + @ExcelCheck(canEmpty = false) | |
130 | + @ExcelProperty(value = "警情子类", index = 17) | |
131 | + @ContentStyle(dataFormat = 49) | |
132 | + @ColumnWidth(25) | |
133 | + private String subType; | |
134 | + | |
135 | + @ExcelCheck(canEmpty = false) | |
136 | + @ExcelProperty(value = "处理结果", index = 18) | |
137 | + @ContentStyle(dataFormat = 49) | |
138 | + @ColumnWidth(25) | |
139 | + private String result; | |
140 | + | |
141 | + @ExcelCheck(canEmpty = false) | |
142 | + @ExcelProperty(value = "地区", index = 19) | |
143 | + @ContentStyle(dataFormat = 49) | |
144 | + @ColumnWidth(25) | |
145 | + private String area; | |
146 | + | |
147 | + @ExcelCheck(canEmpty = false) | |
148 | + @ExcelProperty(value = "案损金额", index = 20) | |
149 | + @ContentStyle(dataFormat = 49) | |
150 | + @ColumnWidth(25) | |
151 | + private Double amount; | |
152 | + | |
153 | + @ExcelCheck(canEmpty = false) | |
154 | + @ExcelProperty(value = "受害人性别", index = 21) | |
155 | + @ContentStyle(dataFormat = 49) | |
156 | + @ColumnWidth(25) | |
157 | + private String sex; | |
158 | + | |
159 | + @ExcelCheck(canEmpty = false) | |
160 | + @ExcelProperty(value = "受害人职业", index = 22) | |
161 | + @ContentStyle(dataFormat = 49) | |
162 | + @ColumnWidth(25) | |
163 | + private String career; | |
164 | + | |
165 | + @ExcelCheck(canEmpty = false) | |
166 | + @ExcelProperty(value = "引流方式", index = 23) | |
167 | + @ContentStyle(dataFormat = 49) | |
168 | + @ColumnWidth(25) | |
169 | + private String rainageMethod; | |
170 | + | |
171 | + @ExcelCheck(canEmpty = false) | |
172 | + @ExcelProperty(value = "支付方式", index = 24) | |
173 | + @ContentStyle(dataFormat = 49) | |
174 | + @ColumnWidth(25) | |
175 | + private String payMethod; | |
176 | +} | ... | ... |
... | ... | @@ -129,7 +129,14 @@ public class CaseService { |
129 | 129 | |
130 | 130 | public List<Case> list(Case params) { |
131 | 131 | QueryWrapper<Case> queryWrapper = getCondition(params); |
132 | - return caseMapper.selectList(queryWrapper); | |
132 | + List<Case> dataList = caseMapper.selectList(queryWrapper); | |
133 | + if(!CollectionUtils.isEmpty(dataList)){ | |
134 | + List<String> caseIds = dataList | |
135 | + .stream().map(Case::getId).collect(Collectors.toList()); | |
136 | + Map<String, CaseAnalysis> caseAnalysisMap = caseAnalysisService.listByCaseId(caseIds); | |
137 | + dataList.forEach(e -> e.setAnalysis(caseAnalysisMap.get(e.getId()))); | |
138 | + } | |
139 | + return dataList; | |
133 | 140 | } |
134 | 141 | |
135 | 142 | public List<Case> listUnAnalysis() { |
... | ... | @@ -651,11 +658,17 @@ public class CaseService { |
651 | 658 | } catch (ExcelAnalysisException e) { |
652 | 659 | return listener.getErrorList(); |
653 | 660 | } catch (ExcelDataConvertException e) { |
654 | - throw e; | |
661 | + List<ExcelErrorMessage> errorList=new ArrayList<>(); | |
662 | + ExcelErrorMessage eem = new ExcelErrorMessage().setMessage("模板错误"); | |
663 | + errorList.add(eem); | |
664 | + return errorList; | |
655 | 665 | } catch (Exception ex) { |
656 | 666 | ex.printStackTrace(); |
657 | 667 | log.info("导入失败,异常,", ex); |
658 | - throw new RuntimeException("导入失败!"); | |
668 | + List<ExcelErrorMessage> errorList=new ArrayList<>(); | |
669 | + ExcelErrorMessage eem = new ExcelErrorMessage().setMessage("系统异常"); | |
670 | + errorList.add(eem); | |
671 | + return errorList; | |
659 | 672 | } |
660 | 673 | |
661 | 674 | return null; | ... | ... |
... | ... | @@ -110,7 +110,14 @@ public class WarningInstanceService { |
110 | 110 | |
111 | 111 | public List<WarningInstance> list(WarningInstance params) { |
112 | 112 | QueryWrapper<WarningInstance> queryWrapper = getCondition(params); |
113 | - return warningInstanceMapper.selectList(queryWrapper); | |
113 | + List<WarningInstance> dataList = warningInstanceMapper.selectList(queryWrapper); | |
114 | + if (!CollectionUtils.isEmpty(dataList)) { | |
115 | + List<String> wiIds = dataList | |
116 | + .stream().map(WarningInstance::getId).collect(Collectors.toList()); | |
117 | + Map<String, WarningInstanceAnalysis> analysisMap = warningInstanceAnalysisService.listByWiId(wiIds); | |
118 | + dataList.forEach(e -> e.setAnalysis(analysisMap.get(e.getId()))); | |
119 | + } | |
120 | + return dataList; | |
114 | 121 | } |
115 | 122 | |
116 | 123 | public List<WarningInstance> listUnAnalysis() { |
... | ... | @@ -372,11 +379,17 @@ public class WarningInstanceService { |
372 | 379 | } catch (ExcelAnalysisException e) { |
373 | 380 | return listener.getErrorList(); |
374 | 381 | } catch (ExcelDataConvertException e) { |
375 | - throw e; | |
382 | + List<ExcelErrorMessage> errorList = new ArrayList<>(); | |
383 | + ExcelErrorMessage eem = new ExcelErrorMessage().setMessage("模板错误"); | |
384 | + errorList.add(eem); | |
385 | + return errorList; | |
376 | 386 | } catch (Exception ex) { |
377 | 387 | ex.printStackTrace(); |
378 | 388 | log.info("导入失败,异常,", ex); |
379 | - throw new RuntimeException("导入失败!"); | |
389 | + List<ExcelErrorMessage> errorList = new ArrayList<>(); | |
390 | + ExcelErrorMessage eem = new ExcelErrorMessage().setMessage("系统异常"); | |
391 | + errorList.add(eem); | |
392 | + return errorList; | |
380 | 393 | } |
381 | 394 | |
382 | 395 | return null; | ... | ... |