|
@@ -6,6 +6,11 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import org.dromara.easyes.core.biz.EsPageInfo;
|
|
|
import org.eco.als.domain.FaultCase;
|
|
|
+import org.eco.als.domain.vo.AirConfigurationImportVo;
|
|
|
+import org.eco.als.domain.vo.AirConfigurationVo;
|
|
|
+import org.eco.als.listener.AirConfigurationImportListener;
|
|
|
+import org.eco.als.listener.FaultCaseImportListener;
|
|
|
+import org.eco.common.excel.core.ExcelResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.eco.common.core.core.domain.CommonResult;
|
|
@@ -24,6 +29,7 @@ import org.eco.als.service.IFaultCaseService;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import org.eco.common.core.core.page.PageResult;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.List;
|
|
|
import java.util.ArrayList;
|
|
|
|
|
@@ -65,14 +71,9 @@ public class FaultCaseController extends BaseController {
|
|
|
@SaCheckPermission("als:faultCase:export")
|
|
|
@Log(title = "故障案例", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
- public CommonResult<Void> export(FaultCaseBo faultCaseBo) {
|
|
|
- LoginUser loginUser = LoginHelper.getLoginUser();
|
|
|
+ public void export(HttpServletResponse response, FaultCaseBo faultCaseBo) {
|
|
|
List<FaultCaseVo> list = faultCaseService.selectList(faultCaseBo);
|
|
|
- if (CollUtil.isEmpty(list)) {
|
|
|
- return CommonResult.fail("导出列表为空");
|
|
|
- }
|
|
|
- faultCaseService.asyncExport(list, "故障案例", loginUser);
|
|
|
- return CommonResult.success();
|
|
|
+ ExcelUtil.exportExcel(list, "飞机构型", FaultCaseVo.class, response);
|
|
|
}
|
|
|
|
|
|
@SaCheckPermission("als:faultCase:import")
|
|
@@ -87,10 +88,10 @@ public class FaultCaseController extends BaseController {
|
|
|
@Log(title = "故障案例", businessType = BusinessType.IMPORT)
|
|
|
@SaCheckPermission("als:faultCase:import")
|
|
|
@PostMapping("/importData")
|
|
|
- public CommonResult<Void> importData(MultipartFile file, boolean updateSupport) {
|
|
|
+ public CommonResult<Void> importData(MultipartFile file, boolean updateSupport) throws IOException {
|
|
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
|
|
- faultCaseService.asyncImportData(file, updateSupport, loginUser);
|
|
|
- return CommonResult.success();
|
|
|
+ ExcelResult<FaultCaseImportVo> result = ExcelUtil.importExcel(file.getInputStream(), FaultCaseImportVo.class, new FaultCaseImportListener(updateSupport, loginUser));
|
|
|
+ return CommonResult.success(result.getAnalysis().getLogInfo());
|
|
|
}
|
|
|
|
|
|
/**
|