|
|
@@ -5,9 +5,14 @@ import com.railway.business.catenary.service.IBusJcebJddzService;
|
|
|
import com.railway.common.core.controller.BaseController;
|
|
|
import com.railway.common.core.domain.AjaxResult;
|
|
|
import com.railway.common.core.page.TableDataInfo;
|
|
|
+import com.railway.common.utils.poi.EasyExcelUtil;
|
|
|
+import com.railway.system.service.ISysFileService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import javax.validation.Valid;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
@@ -29,9 +34,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
public class BusJcebJddzController extends BaseController {
|
|
|
|
|
|
private final IBusJcebJddzService busJcebJddzService;
|
|
|
+ private final ISysFileService sysFileService;
|
|
|
|
|
|
- public BusJcebJddzController(IBusJcebJddzService busJcebJddzService) {
|
|
|
+ public BusJcebJddzController(IBusJcebJddzService busJcebJddzService, ISysFileService sysFileService) {
|
|
|
this.busJcebJddzService = busJcebJddzService;
|
|
|
+ this.sysFileService = sysFileService;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "新增")
|
|
|
@@ -86,4 +93,19 @@ public class BusJcebJddzController extends BaseController {
|
|
|
public AjaxResult confirm(@RequestBody BusJcebJddz busJcebJddz) {
|
|
|
return toAjax(busJcebJddzService.confirm(busJcebJddz));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "导出excel")
|
|
|
+ @GetMapping(value = "exportExcel")
|
|
|
+ public AjaxResult exportExcel(BusJcebJddz busJcebJddz) {
|
|
|
+ List<BusJcebJddz> list = busJcebJddzService.getList(busJcebJddz);
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ if(!list.isEmpty()) {
|
|
|
+ params.put("mdh", list.get(0).getMdh());
|
|
|
+ params.put("stationName", list.get(0).getStationName());
|
|
|
+ }
|
|
|
+ String fileName = "接地电阻测量记录.xls";
|
|
|
+ String templateFileName = "excel/template/接地电阻测量记录.xls";
|
|
|
+ String localFilePath = new EasyExcelUtil().getExcel(params, list, templateFileName, fileName);
|
|
|
+ return sysFileService.uploadFile(localFilePath);
|
|
|
+ }
|
|
|
}
|