|
@@ -167,13 +167,13 @@ public class EsProcessEnterpriseController {
|
167
|
167
|
@ApiImplicitParam(name = "file", value = "文件对象集合")
|
168
|
168
|
})
|
169
|
169
|
@PostMapping(value= "/emergencySupport/esProcessEnterprise/importByEntity", headers= "content-type= multipart/form-data", consumes= "multipart/*")
|
170
|
|
- public Map<String,Object> importByEntity(@RequestParam(value= "file", required = true) MultipartFile file) throws IOException {
|
|
170
|
+ public CommonResult<Map<String,Object>> importByEntity(@RequestParam(value= "file", required = true) MultipartFile file) throws IOException {
|
171
|
171
|
Map<String, Object> map = new HashMap<>();
|
172
|
172
|
try {
|
173
|
173
|
if (file == null || file.isEmpty()) {
|
174
|
174
|
map.put("message", "无文件数据");
|
175
|
175
|
map.put("status", "500");
|
176
|
|
- return map;
|
|
176
|
+ return CommonResult.data(map);
|
177
|
177
|
}
|
178
|
178
|
// 获得文件名
|
179
|
179
|
String fileName = file.getOriginalFilename();
|
|
@@ -181,18 +181,18 @@ public class EsProcessEnterpriseController {
|
181
|
181
|
if (!fileName.endsWith("xls") && !fileName.endsWith("xlsx")) {
|
182
|
182
|
map.put("message", "请使用正确的导入模板");
|
183
|
183
|
map.put("status", "500");
|
184
|
|
- return map;
|
|
184
|
+ return CommonResult.data(map);
|
185
|
185
|
}
|
186
|
186
|
|
187
|
|
- return esProcessEnterpriseService.importByEntityResult(file, map);
|
|
187
|
+ return CommonResult.data(esProcessEnterpriseService.importByEntityResult(file, map));
|
188
|
188
|
} catch (IOException e) {
|
189
|
189
|
map.put("message", "文件处理异常: " + e.getMessage());
|
190
|
190
|
map.put("status", "500");
|
191
|
|
- return map;
|
|
191
|
+ return CommonResult.data(map);
|
192
|
192
|
} catch (Exception e) {
|
193
|
193
|
map.put("message", "发生异常: " + e.getMessage());
|
194
|
194
|
map.put("status", "500");
|
195
|
|
- return map;
|
|
195
|
+ return CommonResult.data(map);
|
196
|
196
|
}
|
197
|
197
|
|
198
|
198
|
}
|